-
Notifications
You must be signed in to change notification settings - Fork 1.3k
change(schema-management-cli): proposal for schema management commands #523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| schema: spec-driven | ||
| created: 2026-01-20 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| ## Why | ||
|
|
||
| Creating and managing project-local schemas currently requires manual directory creation, copying files, and hoping the structure is correct. Users only discover structural errors at runtime when commands fail. This friction discourages schema customization and makes it harder to tailor OpenSpec workflows to specific project needs. | ||
|
|
||
| Key pain points: | ||
| - **Manual scaffolding**: Users must manually create `openspec/schemas/<name>/` with correct structure | ||
| - **No validation feedback**: Schema errors aren't caught until a command tries to use the schema | ||
| - **Starting from scratch is hard**: No easy way to base a custom schema on an existing one | ||
| - **Debugging resolution**: When a schema doesn't resolve as expected, there's no way to see the resolution path | ||
|
|
||
| ## What Changes | ||
|
|
||
| Add a new `openspec schema` command group with subcommands for creating, forking, validating, and inspecting schemas. | ||
|
|
||
| ### Commands | ||
|
|
||
| 1. **`openspec schema init <name>`** - Interactive wizard to scaffold a new project schema | ||
| - Prompts for schema description | ||
| - Prompts for artifacts to include (with explanations) | ||
| - Creates valid directory structure with `schema.yaml` and template files | ||
| - Optionally sets as project default in `openspec/config.yaml` | ||
|
|
||
| 2. **`openspec schema fork <source> [name]`** - Copy an existing schema as a starting point | ||
| - Copies from user override or package built-in | ||
| - Allows renaming (defaults to `<source>-custom`) | ||
| - Preserves all templates and configuration | ||
|
|
||
| 3. **`openspec schema validate [name]`** - Validate schema structure and templates | ||
| - Checks `schema.yaml` is valid | ||
| - Verifies all referenced templates exist | ||
| - Reports missing or malformed files | ||
| - Run without name to validate all project schemas | ||
|
|
||
| 4. **`openspec schema which <name>`** - Show schema resolution path | ||
| - Displays which location the schema resolves from (project/user/package) | ||
| - Shows full path to schema directory | ||
| - Useful for debugging shadowing issues | ||
|
|
||
| ## Capabilities | ||
|
|
||
| ### New Capabilities | ||
| - `schema-init-command`: Interactive wizard for creating new project schemas with guided prompts | ||
| - `schema-fork-command`: Copy existing schemas to project for customization | ||
| - `schema-validate-command`: Validate schema structure and report errors before runtime | ||
| - `schema-which-command`: Debug schema resolution by showing which location is used | ||
|
|
||
| ### Modified Capabilities | ||
| <!-- None - these are additive commands --> | ||
|
|
||
| ## Impact | ||
|
|
||
| - **Code**: New command implementations in `src/commands/` using existing resolver infrastructure | ||
| - **CLI**: New `schema` command group with 4 subcommands | ||
| - **Dependencies**: May use `enquirer` or similar for interactive prompts in `schema init` | ||
| - **Documentation**: Need to update CLI reference and schema customization guide | ||
|
Comment on lines
+11
to
+55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add required change artifacts (tasks.md and any required delta specs). 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Missing required
specs/directory with delta files. Since new capabilities are being added (schema-init-command,schema-fork-command,schema-validate-command,schema-which-command), you must create spec deltas underopenspec/changes/schema-management-cli/specs/<capability-name>/spec.mdwith## ADDED Requirementssections peropenspec/AGENTS.md:177-195.Each capability needs:
### Requirement:header#### Scenario:header (4 hashtags)See
openspec/changes/add-feedback-command/specs/cli-feedback/spec.mdfor reference.Prompt To Fix With AI