Skip to content

Commit 43b01ad

Browse files
authored
docs: update workflow docs and mark schema commands as experimental (Fission-AI#526)
* docs: update workflow docs for schema management CLI Update documentation to reflect implemented schema management features: - Document schema CLI commands (which, validate, fork, init) - Update gap summary to show completed phases (PR Fission-AI#522, Fission-AI#525) - Improve custom schema examples with actual CLI usage - Update resolution order documentation * feat(cli): mark schema commands as experimental Add [experimental] tag to help description and runtime warning for schema management commands to indicate they may change.
1 parent 3cdcdfc commit 43b01ad

3 files changed

Lines changed: 85 additions & 46 deletions

File tree

docs/experimental-workflow.md

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -565,35 +565,53 @@ Artifacts form a directed acyclic graph (DAG). Dependencies are **enablers**, no
565565
566566
### Custom Schemas
567567
568-
Create your own workflow by adding a schema to `~/.local/share/openspec/schemas/`:
568+
Create custom workflows using the schema management commands:
569569
570+
```bash
571+
# Create a new schema from scratch (interactive)
572+
openspec schema init my-workflow
573+
574+
# Or fork an existing schema as a starting point
575+
openspec schema fork spec-driven my-workflow
576+
577+
# Validate your schema structure
578+
openspec schema validate my-workflow
579+
580+
# See where a schema resolves from (useful for debugging)
581+
openspec schema which my-workflow
582+
```
583+
584+
Schemas are stored in `openspec/schemas/` (project-local, version controlled) or `~/.local/share/openspec/schemas/` (user global).
585+
586+
**Schema structure:**
570587
```
571-
~/.local/share/openspec/schemas/research-first/
588+
openspec/schemas/research-first/
572589
├── schema.yaml
573590
└── templates/
574591
├── research.md
575592
├── proposal.md
576593
└── tasks.md
594+
```
595+
596+
**Example schema.yaml:**
597+
```yaml
598+
name: research-first
599+
artifacts:
600+
- id: research # Added before proposal
601+
generates: research.md
602+
requires: []
577603

578-
schema.yaml:
579-
┌─────────────────────────────────────────────────────────────────┐
580-
│ name: research-first │
581-
│ artifacts: │
582-
│ - id: research # Added before proposal │
583-
│ generates: research.md │
584-
│ requires: []
585-
│ │
586-
│ - id: proposal │
587-
│ generates: proposal.md │
588-
│ requires: [research] # Now depends on research │
589-
│ │
590-
│ - id: tasks │
591-
│ generates: tasks.md │
592-
│ requires: [proposal]
593-
└─────────────────────────────────────────────────────────────────┘
594-
595-
Dependency Graph:
604+
- id: proposal
605+
generates: proposal.md
606+
requires: [research] # Now depends on research
596607

608+
- id: tasks
609+
generates: tasks.md
610+
requires: [proposal]
611+
```
612+
613+
**Dependency Graph:**
614+
```
597615
research ──► proposal ──► tasks
598616
```
599617

@@ -615,7 +633,22 @@ Schemas define what artifacts exist and their dependencies. Currently available:
615633
- **spec-driven** (default): proposal → specs → design → tasks
616634
- **tdd**: tests → implementation → docs
617635

618-
Run `openspec schemas` to see available schemas.
636+
```bash
637+
# List available schemas
638+
openspec schemas
639+
640+
# See all schemas with their resolution sources
641+
openspec schema which --all
642+
643+
# Create a new schema interactively
644+
openspec schema init my-workflow
645+
646+
# Fork an existing schema for customization
647+
openspec schema fork spec-driven my-workflow
648+
649+
# Validate schema structure before use
650+
openspec schema validate my-workflow
651+
```
619652

620653
## Tips
621654

docs/schema-workflow-gaps.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ This document analyzes the complete user journey for working with schemas in Ope
1010

1111
| Component | Status |
1212
|-----------|--------|
13-
| Schema resolution (XDG) | 2-level: user override → package built-in |
13+
| Schema resolution | 3-level: project → user → package (PR #522) |
1414
| Built-in schemas | `spec-driven`, `tdd` |
1515
| Artifact workflow commands | `status`, `next`, `instructions`, `templates` with `--schema` flag |
1616
| Change creation | `openspec new change <name>` — no schema binding |
17+
| Project-local schemas | ✅ Supported via `openspec/schemas/` (PR #522) |
18+
| Schema management CLI |`schema which`, `validate`, `fork`, `init` (PR #525) |
1719

1820
### What's Missing
1921

2022
| Component | Status |
2123
|-----------|--------|
2224
| Schema bound to change | Not stored — must pass `--schema` every time |
23-
| Project-local schemas | Not supported — can't version control with repo |
24-
| Schema management CLI | None — manual path discovery required |
2525
| Project default schema | None — hardcoded to `spec-driven` |
2626

2727
---
@@ -114,13 +114,13 @@ cp -r <package-path>/schemas/spec-driven/* \
114114

115115
## Gap Summary
116116

117-
| Gap | Impact | Workaround |
118-
|-----|--------|------------|
119-
| Schema not bound to change | Wrong results, forgotten context | Remember to pass `--schema` |
120-
| No project-local schemas | Can't share via repo | Manual XDG setup per machine |
121-
| No schema management CLI | Manual path hunting | Know XDG + find npm package |
122-
| No project default schema | Must specify every time | Always pass `--schema` |
123-
| No init-time schema selection | Missed setup opportunity | Manual config |
117+
| Gap | Impact | Status |
118+
|-----|--------|--------|
119+
| Schema not bound to change | Wrong results, forgotten context | ⏳ Pending (Phase 1) |
120+
| No project-local schemas | Can't share via repo | ✅ Fixed (PR #522) |
121+
| No schema management CLI | Manual path hunting | ✅ Fixed (PR #525) |
122+
| No project default schema | Must specify every time | ⏳ Pending (Phase 4) |
123+
| No init-time schema selection | Missed setup opportunity | ⏳ Pending (Phase 4) |
124124

125125
---
126126

@@ -296,18 +296,17 @@ created: 2025-01-15T10:30:00Z
296296

297297
### Phase 2: Project-Local Schemas
298298

299-
**Priority:** High
299+
**Status:** ✅ Complete (PR #522)
300300
**Solves:** Team sharing, version control, no XDG knowledge needed
301301

302-
**Scope:**
303-
- Add `./openspec/schemas/` to resolution order (first priority)
304-
- `openspec schema copy <name> [new-name]` creates in project by default
305-
- `--global` flag for user-level XDG directory
302+
**Implemented:**
303+
- `./openspec/schemas/` added to resolution order (first priority)
304+
- `openspec schema fork <name> [new-name]` creates in project by default
306305
- Teams can commit `openspec/schemas/` to repo
307306

308307
**Resolution order:**
309308
```
310-
1. ./openspec/schemas/<name>/ # Project-local (NEW)
309+
1. ./openspec/schemas/<name>/ # Project-local
311310
2. ~/.local/share/openspec/schemas/<name>/ # User global
312311
3. <npm-package>/schemas/<name>/ # Built-in
313312
```
@@ -316,19 +315,21 @@ created: 2025-01-15T10:30:00Z
316315
317316
### Phase 3: Schema Management CLI
318317
319-
**Priority:** Medium
318+
**Status:** ✅ Complete (PR #525)
320319
**Solves:** Path discovery, scaffolding, debugging
321320
322-
**Commands:**
321+
**Implemented Commands:**
323322
```bash
324-
openspec schema list # Show available schemas with sources
325-
openspec schema which <name> # Show resolution path
326-
openspec schema copy <name> [to] # Copy for customization
327-
openspec schema diff <name> # Compare with built-in
328-
openspec schema reset <name> # Remove override
329-
openspec schema validate <name> # Validate schema.yaml structure
323+
openspec schema which [name] # Show resolution path, --all for all schemas
324+
openspec schema validate [name] # Validate schema structure and templates
325+
openspec schema fork <source> [name] # Copy existing schema for customization
326+
openspec schema init <name> # Create new project-local schema (interactive)
330327
```
331328

329+
**Not implemented (may add later):**
330+
- `schema diff` — Compare override with built-in
331+
- `schema reset` — Remove override, revert to built-in
332+
332333
---
333334

334335
### Phase 4: Project Config + Init Enhancement

src/commands/schema.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,12 @@ const DEFAULT_ARTIFACTS: Array<{
290290
export function registerSchemaCommand(program: Command): void {
291291
const schemaCmd = program
292292
.command('schema')
293-
.description('Manage workflow schemas');
293+
.description('Manage workflow schemas [experimental]');
294+
295+
// Experimental warning
296+
schemaCmd.hook('preAction', () => {
297+
console.error('Note: Schema commands are experimental and may change.');
298+
});
294299

295300
// schema which
296301
schemaCmd

0 commit comments

Comments
 (0)