|
1 | 1 | ## 1. Setup and Command Structure |
2 | 2 |
|
3 | | -- [ ] 1.1 Create `src/commands/schema.ts` with `registerSchemaCommand(program: Command)` function |
4 | | -- [ ] 1.2 Register schema command in `src/cli/index.ts` (import and call `registerSchemaCommand`) |
5 | | -- [ ] 1.3 Add schema command group with description: "Manage workflow schemas" |
| 3 | +- [x] 1.1 Create `src/commands/schema.ts` with `registerSchemaCommand(program: Command)` function |
| 4 | +- [x] 1.2 Register schema command in `src/cli/index.ts` (import and call `registerSchemaCommand`) |
| 5 | +- [x] 1.3 Add schema command group with description: "Manage workflow schemas" |
6 | 6 |
|
7 | 7 | ## 2. Schema Which Command |
8 | 8 |
|
9 | | -- [ ] 2.1 Add `schema which <name>` subcommand with `--json` and `--all` options |
10 | | -- [ ] 2.2 Implement resolution lookup using `getSchemaDir()` with project root |
11 | | -- [ ] 2.3 Implement shadow detection by checking all three locations (project, user, package) |
12 | | -- [ ] 2.4 Add text output: show source, path, and shadowing info |
13 | | -- [ ] 2.5 Add JSON output: `{ name, source, path, shadows: [] }` |
14 | | -- [ ] 2.6 Add `--all` mode to list all schemas with their resolution sources |
| 9 | +- [x] 2.1 Add `schema which <name>` subcommand with `--json` and `--all` options |
| 10 | +- [x] 2.2 Implement resolution lookup using `getSchemaDir()` with project root |
| 11 | +- [x] 2.3 Implement shadow detection by checking all three locations (project, user, package) |
| 12 | +- [x] 2.4 Add text output: show source, path, and shadowing info |
| 13 | +- [x] 2.5 Add JSON output: `{ name, source, path, shadows: [] }` |
| 14 | +- [x] 2.6 Add `--all` mode to list all schemas with their resolution sources |
15 | 15 |
|
16 | 16 | ## 3. Schema Validate Command |
17 | 17 |
|
18 | | -- [ ] 3.1 Add `schema validate [name]` subcommand with `--json` and `--verbose` options |
19 | | -- [ ] 3.2 Implement single-schema validation using existing `parseSchema()` from `schema.ts` |
20 | | -- [ ] 3.3 Add template existence check for each artifact's template file |
21 | | -- [ ] 3.4 Add dependency graph cycle detection (reuse topological sort logic) |
22 | | -- [ ] 3.5 Add validate-all mode when no name provided (scan `openspec/schemas/`) |
23 | | -- [ ] 3.6 Add text output with pass/fail indicators and error messages |
24 | | -- [ ] 3.7 Add JSON output matching existing `openspec validate` format: `{ valid, issues: [] }` |
25 | | -- [ ] 3.8 Add verbose mode showing each validation step |
| 18 | +- [x] 3.1 Add `schema validate [name]` subcommand with `--json` and `--verbose` options |
| 19 | +- [x] 3.2 Implement single-schema validation using existing `parseSchema()` from `schema.ts` |
| 20 | +- [x] 3.3 Add template existence check for each artifact's template file |
| 21 | +- [x] 3.4 Add dependency graph cycle detection (reuse topological sort logic) |
| 22 | +- [x] 3.5 Add validate-all mode when no name provided (scan `openspec/schemas/`) |
| 23 | +- [x] 3.6 Add text output with pass/fail indicators and error messages |
| 24 | +- [x] 3.7 Add JSON output matching existing `openspec validate` format: `{ valid, issues: [] }` |
| 25 | +- [x] 3.8 Add verbose mode showing each validation step |
26 | 26 |
|
27 | 27 | ## 4. Schema Fork Command |
28 | 28 |
|
29 | | -- [ ] 4.1 Add `schema fork <source> [name]` subcommand with `--json` and `--force` options |
30 | | -- [ ] 4.2 Implement source resolution using `getSchemaDir()` with project root |
31 | | -- [ ] 4.3 Implement default destination naming: `<source>-custom` |
32 | | -- [ ] 4.4 Implement directory copy with recursive file copy |
33 | | -- [ ] 4.5 Update `name` field in copied `schema.yaml` |
34 | | -- [ ] 4.6 Add overwrite protection: check destination exists, require `--force` or confirmation |
35 | | -- [ ] 4.7 Add text output with source/destination paths |
36 | | -- [ ] 4.8 Add JSON output: `{ forked, source, destination, sourceLocation }` |
| 29 | +- [x] 4.1 Add `schema fork <source> [name]` subcommand with `--json` and `--force` options |
| 30 | +- [x] 4.2 Implement source resolution using `getSchemaDir()` with project root |
| 31 | +- [x] 4.3 Implement default destination naming: `<source>-custom` |
| 32 | +- [x] 4.4 Implement directory copy with recursive file copy |
| 33 | +- [x] 4.5 Update `name` field in copied `schema.yaml` |
| 34 | +- [x] 4.6 Add overwrite protection: check destination exists, require `--force` or confirmation |
| 35 | +- [x] 4.7 Add text output with source/destination paths |
| 36 | +- [x] 4.8 Add JSON output: `{ forked, source, destination, sourceLocation }` |
37 | 37 |
|
38 | 38 | ## 5. Schema Init Command |
39 | 39 |
|
40 | | -- [ ] 5.1 Add `schema init <name>` subcommand with `--json`, `--description`, `--artifacts`, `--default`, `--no-default`, `--force` options |
41 | | -- [ ] 5.2 Implement schema name validation (kebab-case, no spaces) |
42 | | -- [ ] 5.3 Implement interactive prompts for description using `@inquirer/prompts` |
43 | | -- [ ] 5.4 Implement interactive artifact selection with descriptions (multi-select) |
44 | | -- [ ] 5.5 Create schema directory and `schema.yaml` with selected configuration |
45 | | -- [ ] 5.6 Create default template files for selected artifacts |
46 | | -- [ ] 5.7 Add `--default` flag to update `openspec/config.yaml` with new schema as default |
47 | | -- [ ] 5.8 Add overwrite protection: check if schema exists, require `--force` |
48 | | -- [ ] 5.9 Add text output with created path and next steps |
49 | | -- [ ] 5.10 Add JSON output: `{ created, path, schema }` |
50 | | -- [ ] 5.11 Add non-interactive mode with `--description` and `--artifacts` flags |
| 40 | +- [x] 5.1 Add `schema init <name>` subcommand with `--json`, `--description`, `--artifacts`, `--default`, `--no-default`, `--force` options |
| 41 | +- [x] 5.2 Implement schema name validation (kebab-case, no spaces) |
| 42 | +- [x] 5.3 Implement interactive prompts for description using `@inquirer/prompts` |
| 43 | +- [x] 5.4 Implement interactive artifact selection with descriptions (multi-select) |
| 44 | +- [x] 5.5 Create schema directory and `schema.yaml` with selected configuration |
| 45 | +- [x] 5.6 Create default template files for selected artifacts |
| 46 | +- [x] 5.7 Add `--default` flag to update `openspec/config.yaml` with new schema as default |
| 47 | +- [x] 5.8 Add overwrite protection: check if schema exists, require `--force` |
| 48 | +- [x] 5.9 Add text output with created path and next steps |
| 49 | +- [x] 5.10 Add JSON output: `{ created, path, schema }` |
| 50 | +- [x] 5.11 Add non-interactive mode with `--description` and `--artifacts` flags |
51 | 51 |
|
52 | 52 | ## 6. Testing |
53 | 53 |
|
54 | | -- [ ] 6.1 Add unit tests for `schema which` command in `test/commands/schema.test.ts` |
55 | | -- [ ] 6.2 Add unit tests for `schema validate` command |
56 | | -- [ ] 6.3 Add unit tests for `schema fork` command |
57 | | -- [ ] 6.4 Add unit tests for `schema init` command |
58 | | -- [ ] 6.5 Test interactive mode mocking with `@inquirer/prompts` |
59 | | -- [ ] 6.6 Test JSON output format for all commands |
60 | | -- [ ] 6.7 Test error cases: invalid name, not found, already exists, cycle detection |
| 54 | +- [x] 6.1 Add unit tests for `schema which` command in `test/commands/schema.test.ts` |
| 55 | +- [x] 6.2 Add unit tests for `schema validate` command |
| 56 | +- [x] 6.3 Add unit tests for `schema fork` command |
| 57 | +- [x] 6.4 Add unit tests for `schema init` command |
| 58 | +- [x] 6.5 Test interactive mode mocking with `@inquirer/prompts` |
| 59 | +- [x] 6.6 Test JSON output format for all commands |
| 60 | +- [x] 6.7 Test error cases: invalid name, not found, already exists, cycle detection |
61 | 61 |
|
62 | 62 | ## 7. Documentation and Polish |
63 | 63 |
|
64 | | -- [ ] 7.1 Add CLI help text for all schema subcommands |
65 | | -- [ ] 7.2 Update shell completion to include schema commands |
66 | | -- [ ] 7.3 Run linting and fix any issues (`npm run lint`) |
67 | | -- [ ] 7.4 Run full test suite (`npm test`) |
| 64 | +- [x] 7.1 Add CLI help text for all schema subcommands |
| 65 | +- [x] 7.2 Update shell completion to include schema commands |
| 66 | +- [x] 7.3 Run linting and fix any issues (`npm run lint`) |
| 67 | +- [x] 7.4 Run full test suite (`npm test`) |
0 commit comments