|
1 | 1 | // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing |
2 | 2 |
|
| 3 | +exports[`cli-generator generates COMMANDS.md (man-page reference) 1`] = ` |
| 4 | +"# myapp - Command Reference |
| 5 | +
|
| 6 | +> @generated by @constructive-io/graphql-codegen - DO NOT EDIT |
| 7 | +
|
| 8 | +--- |
| 9 | +
|
| 10 | +## context(1) |
| 11 | +
|
| 12 | +### NAME |
| 13 | +
|
| 14 | +context - manage API endpoint contexts |
| 15 | +
|
| 16 | +### SYNOPSIS |
| 17 | +
|
| 18 | + myapp context <command> [options] |
| 19 | +
|
| 20 | +### COMMANDS |
| 21 | +
|
| 22 | +**create** \`<name>\` \`--endpoint <url>\` |
| 23 | +
|
| 24 | + Create a named context pointing at a GraphQL endpoint. |
| 25 | + Config stored at ~/.myapp/config/contexts/<name>.json |
| 26 | +
|
| 27 | +**list** |
| 28 | +
|
| 29 | + List all configured contexts with auth status. |
| 30 | +
|
| 31 | +**use** \`<name>\` |
| 32 | +
|
| 33 | + Set the active context for subsequent commands. |
| 34 | +
|
| 35 | +**current** |
| 36 | +
|
| 37 | + Display the currently active context and its endpoint. |
| 38 | +
|
| 39 | +**delete** \`<name>\` |
| 40 | +
|
| 41 | + Remove a context and its configuration. |
| 42 | +
|
| 43 | +--- |
| 44 | +
|
| 45 | +## auth(1) |
| 46 | +
|
| 47 | +### NAME |
| 48 | +
|
| 49 | +auth - manage authentication tokens |
| 50 | +
|
| 51 | +### SYNOPSIS |
| 52 | +
|
| 53 | + myapp auth <command> [options] |
| 54 | +
|
| 55 | +### COMMANDS |
| 56 | +
|
| 57 | +**set-token** \`<token>\` \`[--context <name>]\` |
| 58 | +
|
| 59 | + Store a bearer token for the current (or specified) context. |
| 60 | + Credentials stored at ~/.myapp/config/credentials.json (mode 0600). |
| 61 | +
|
| 62 | +**status** |
| 63 | +
|
| 64 | + Show authentication status for all contexts. |
| 65 | +
|
| 66 | +**logout** \`[--context <name>]\` |
| 67 | +
|
| 68 | + Remove stored credentials for the current (or specified) context. |
| 69 | +
|
| 70 | +--- |
| 71 | +
|
| 72 | +## car(1) |
| 73 | +
|
| 74 | +### NAME |
| 75 | +
|
| 76 | +car - manage Car records |
| 77 | +
|
| 78 | +### SYNOPSIS |
| 79 | +
|
| 80 | + car <command> [options] |
| 81 | +
|
| 82 | +### COMMANDS |
| 83 | +
|
| 84 | +**list** |
| 85 | +
|
| 86 | + car list |
| 87 | +
|
| 88 | +List all car records. Returns JSON array. |
| 89 | +
|
| 90 | +Selected fields: id, make, model, year, isElectric, createdAt |
| 91 | +
|
| 92 | +**get** |
| 93 | +
|
| 94 | + car get --id <value> |
| 95 | +
|
| 96 | +Fetch a single car by its id. |
| 97 | +
|
| 98 | +**create** |
| 99 | +
|
| 100 | + car create --make <value> --model <value> --year <value> --isElectric <value> |
| 101 | +
|
| 102 | +Create a new car. All fields are required. |
| 103 | +
|
| 104 | + Options: |
| 105 | + --make String (required) |
| 106 | + --model String (required) |
| 107 | + --year Int (required) |
| 108 | + --isElectric Boolean (required) |
| 109 | +
|
| 110 | +**update** |
| 111 | +
|
| 112 | + car update --id <value> [--make <value>] [--model <value>] [--year <value>] [--isElectric <value>] |
| 113 | +
|
| 114 | +Update an existing car. Only provided fields are changed. |
| 115 | +
|
| 116 | + Options: |
| 117 | + --id UUID (required) |
| 118 | + --make String |
| 119 | + --model String |
| 120 | + --year Int |
| 121 | + --isElectric Boolean |
| 122 | +
|
| 123 | +**delete** |
| 124 | +
|
| 125 | + car delete --id <value> |
| 126 | +
|
| 127 | +Delete a car by its id. |
| 128 | +
|
| 129 | +--- |
| 130 | +
|
| 131 | +## driver(1) |
| 132 | +
|
| 133 | +### NAME |
| 134 | +
|
| 135 | +driver - manage Driver records |
| 136 | +
|
| 137 | +### SYNOPSIS |
| 138 | +
|
| 139 | + driver <command> [options] |
| 140 | +
|
| 141 | +### COMMANDS |
| 142 | +
|
| 143 | +**list** |
| 144 | +
|
| 145 | + driver list |
| 146 | +
|
| 147 | +List all driver records. Returns JSON array. |
| 148 | +
|
| 149 | +Selected fields: id, name, licenseNumber |
| 150 | +
|
| 151 | +**get** |
| 152 | +
|
| 153 | + driver get --id <value> |
| 154 | +
|
| 155 | +Fetch a single driver by its id. |
| 156 | +
|
| 157 | +**create** |
| 158 | +
|
| 159 | + driver create --name <value> --licenseNumber <value> |
| 160 | +
|
| 161 | +Create a new driver. All fields are required. |
| 162 | +
|
| 163 | + Options: |
| 164 | + --name String (required) |
| 165 | + --licenseNumber String (required) |
| 166 | +
|
| 167 | +**update** |
| 168 | +
|
| 169 | + driver update --id <value> [--name <value>] [--licenseNumber <value>] |
| 170 | +
|
| 171 | +Update an existing driver. Only provided fields are changed. |
| 172 | +
|
| 173 | + Options: |
| 174 | + --id UUID (required) |
| 175 | + --name String |
| 176 | + --licenseNumber String |
| 177 | +
|
| 178 | +**delete** |
| 179 | +
|
| 180 | + driver delete --id <value> |
| 181 | +
|
| 182 | +Delete a driver by its id. |
| 183 | +
|
| 184 | +--- |
| 185 | +
|
| 186 | +## current-user(1) |
| 187 | +
|
| 188 | +### NAME |
| 189 | +
|
| 190 | +current-user - Get the currently authenticated user |
| 191 | +
|
| 192 | +### SYNOPSIS |
| 193 | +
|
| 194 | + current-user |
| 195 | +
|
| 196 | +### DESCRIPTION |
| 197 | +
|
| 198 | +Get the currently authenticated user |
| 199 | +
|
| 200 | +--- |
| 201 | +
|
| 202 | +## login(1) |
| 203 | +
|
| 204 | +### NAME |
| 205 | +
|
| 206 | +login - Authenticate a user |
| 207 | +
|
| 208 | +### SYNOPSIS |
| 209 | +
|
| 210 | + login --email <value> --password <value> |
| 211 | +
|
| 212 | +### DESCRIPTION |
| 213 | +
|
| 214 | +Authenticate a user |
| 215 | +
|
| 216 | +### OPTIONS |
| 217 | +
|
| 218 | +**--email** String (required) |
| 219 | +
|
| 220 | +**--password** String (required) |
| 221 | +
|
| 222 | +--- |
| 223 | +" |
| 224 | +`; |
| 225 | +
|
| 226 | +exports[`cli-generator generates README.md 1`] = ` |
| 227 | +"# myapp CLI |
| 228 | +
|
| 229 | +> Auto-generated CLI commands from GraphQL schema |
| 230 | +> @generated by @constructive-io/graphql-codegen - DO NOT EDIT |
| 231 | +
|
| 232 | +## Setup |
| 233 | +
|
| 234 | +\`\`\`bash |
| 235 | +# Create a context pointing at your GraphQL endpoint |
| 236 | +myapp context create production --endpoint https://api.example.com/graphql |
| 237 | +
|
| 238 | +# Set the active context |
| 239 | +myapp context use production |
| 240 | +
|
| 241 | +# Authenticate |
| 242 | +myapp auth set-token <your-token> |
| 243 | +\`\`\` |
| 244 | +
|
| 245 | +## Commands |
| 246 | +
|
| 247 | +| Command | Description | |
| 248 | +|---------|-------------| |
| 249 | +| \`context\` | Manage API contexts (endpoints) | |
| 250 | +| \`auth\` | Manage authentication tokens | |
| 251 | +| \`car\` | car CRUD operations | |
| 252 | +| \`driver\` | driver CRUD operations | |
| 253 | +| \`current-user\` | Get the currently authenticated user | |
| 254 | +| \`login\` | Authenticate a user | |
| 255 | +
|
| 256 | +## Infrastructure Commands |
| 257 | +
|
| 258 | +### \`context\` |
| 259 | +
|
| 260 | +Manage named API contexts (kubectl-style). |
| 261 | +
|
| 262 | +| Subcommand | Description | |
| 263 | +|------------|-------------| |
| 264 | +| \`create <name> --endpoint <url>\` | Create a new context | |
| 265 | +| \`list\` | List all contexts | |
| 266 | +| \`use <name>\` | Set the active context | |
| 267 | +| \`current\` | Show current context | |
| 268 | +| \`delete <name>\` | Delete a context | |
| 269 | +
|
| 270 | +Configuration is stored at \`~/.myapp/config/\`. |
| 271 | +
|
| 272 | +### \`auth\` |
| 273 | +
|
| 274 | +Manage authentication tokens per context. |
| 275 | +
|
| 276 | +| Subcommand | Description | |
| 277 | +|------------|-------------| |
| 278 | +| \`set-token <token>\` | Store bearer token for current context | |
| 279 | +| \`status\` | Show auth status across all contexts | |
| 280 | +| \`logout\` | Remove credentials for current context | |
| 281 | +
|
| 282 | +## Table Commands |
| 283 | +
|
| 284 | +### \`car\` |
| 285 | +
|
| 286 | +CRUD operations for Car records. |
| 287 | +
|
| 288 | +| Subcommand | Description | |
| 289 | +|------------|-------------| |
| 290 | +| \`list\` | List all car records | |
| 291 | +| \`get\` | Get a car by id | |
| 292 | +| \`create\` | Create a new car | |
| 293 | +| \`update\` | Update an existing car | |
| 294 | +| \`delete\` | Delete a car | |
| 295 | +
|
| 296 | +**Fields:** |
| 297 | +
|
| 298 | +| Field | Type | |
| 299 | +|-------|------| |
| 300 | +| \`id\` | UUID | |
| 301 | +| \`make\` | String | |
| 302 | +| \`model\` | String | |
| 303 | +| \`year\` | Int | |
| 304 | +| \`isElectric\` | Boolean | |
| 305 | +| \`createdAt\` | Datetime | |
| 306 | +
|
| 307 | +**Create fields:** \`make\`, \`model\`, \`year\`, \`isElectric\` |
| 308 | +
|
| 309 | +### \`driver\` |
| 310 | +
|
| 311 | +CRUD operations for Driver records. |
| 312 | +
|
| 313 | +| Subcommand | Description | |
| 314 | +|------------|-------------| |
| 315 | +| \`list\` | List all driver records | |
| 316 | +| \`get\` | Get a driver by id | |
| 317 | +| \`create\` | Create a new driver | |
| 318 | +| \`update\` | Update an existing driver | |
| 319 | +| \`delete\` | Delete a driver | |
| 320 | +
|
| 321 | +**Fields:** |
| 322 | +
|
| 323 | +| Field | Type | |
| 324 | +|-------|------| |
| 325 | +| \`id\` | UUID | |
| 326 | +| \`name\` | String | |
| 327 | +| \`licenseNumber\` | String | |
| 328 | +
|
| 329 | +**Create fields:** \`name\`, \`licenseNumber\` |
| 330 | +
|
| 331 | +## Custom Operations |
| 332 | +
|
| 333 | +### \`current-user\` |
| 334 | +
|
| 335 | +Get the currently authenticated user |
| 336 | +
|
| 337 | +- **Type:** query |
| 338 | +- **Arguments:** none |
| 339 | +
|
| 340 | +### \`login\` |
| 341 | +
|
| 342 | +Authenticate a user |
| 343 | +
|
| 344 | +- **Type:** mutation |
| 345 | +- **Arguments:** |
| 346 | +
|
| 347 | + | Argument | Type | |
| 348 | + |----------|------| |
| 349 | + | \`email\` | String (required) | |
| 350 | + | \`password\` | String (required) | |
| 351 | +
|
| 352 | +## Output |
| 353 | +
|
| 354 | +All commands output JSON to stdout. Pipe to \`jq\` for formatting: |
| 355 | +
|
| 356 | +\`\`\`bash |
| 357 | +myapp car list | jq '.[]' |
| 358 | +myapp car get --id <uuid> | jq '.' |
| 359 | +\`\`\` |
| 360 | +" |
| 361 | +`; |
| 362 | +
|
3 | 363 | exports[`cli-generator generates commands.ts (command map) 1`] = ` |
4 | 364 | "/** |
5 | 365 | * CLI command map and entry point |
|
0 commit comments