mirror of
https://github.com/Fission-AI/OpenSpec.git
synced 2026-11-02 08:23:13 +08:00
* chore: bulk archive completed changes and normalize specs * docs: finalize spec purposes and align init workflow scenarios * test: guard source specs against placeholders and delta headers * docs: resolve remaining spec review nits
3.0 KiB
3.0 KiB
schema-which-command Specification
Purpose
Define openspec schema which behavior for reporting resolved schema source, location, and fallback details.
Requirements
Requirement: Schema which shows resolution result
The CLI SHALL provide an openspec schema which <name> command that displays where a schema resolves from.
Scenario: Schema resolves from project
- WHEN user runs
openspec schema which my-workflowand schema exists inopenspec/schemas/my-workflow/ - THEN system displays source as "project"
- AND displays full path to schema directory
Scenario: Schema resolves from user directory
- WHEN user runs
openspec schema which my-workflowand schema exists only in user data directory - THEN system displays source as "user"
- AND displays full path including XDG data directory
Scenario: Schema resolves from package
- WHEN user runs
openspec schema which spec-drivenand no override exists - THEN system displays source as "package"
- AND displays full path to package's schemas directory
Scenario: Schema not found
- WHEN user runs
openspec schema which nonexistent - THEN system displays error that schema was not found
- AND lists available schemas
- AND exits with non-zero code
Requirement: Schema which shows shadowing information
The CLI SHALL indicate when a schema shadows another schema at a lower priority level.
Scenario: Project schema shadows package
- WHEN user runs
openspec schema which spec-drivenand both project and package havespec-driven - THEN system displays that project schema is active
- AND indicates it shadows the package version
- AND shows path to shadowed package schema
Scenario: No shadowing
- WHEN schema exists only in one location
- THEN system does not display shadowing information
Scenario: Multiple shadows
- WHEN project schema shadows both user and package schemas
- THEN system lists all shadowed locations in priority order
Requirement: Schema which outputs JSON format
The CLI SHALL support --json flag for machine-readable output.
Scenario: JSON output basic
- WHEN user runs
openspec schema which spec-driven --json - THEN system outputs JSON with
name,source, andpathfields
Scenario: JSON output with shadows
- WHEN user runs
openspec schema which spec-driven --jsonand schema has shadows - THEN JSON includes
shadowsarray withsourceandpathfor each shadowed schema
Requirement: Schema which supports list mode
The CLI SHALL support listing all schemas with their resolution sources.
Scenario: List all schemas
- WHEN user runs
openspec schema which --all - THEN system displays all available schemas grouped by source
- AND indicates which schemas shadow others
Scenario: List in JSON format
- WHEN user runs
openspec schema which --all --json - THEN system outputs JSON array with resolution info for each schema