pi-maestro-flow 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -0
- package/agents/aggregator.md +27 -0
- package/agents/cli-explore-agent.md +188 -0
- package/agents/cross-role-reviewer.md +171 -0
- package/agents/delegate.md +19 -0
- package/agents/explorer.md +23 -0
- package/agents/impeccable-agent.md +99 -0
- package/agents/ralph-executor.md +81 -0
- package/agents/reference.md +24 -0
- package/agents/role-design-author.md +220 -0
- package/agents/team-supervisor.md +143 -0
- package/agents/team-worker.md +237 -0
- package/agents/ui-design-agent.md +270 -0
- package/agents/workflow-analyzer.md +116 -0
- package/agents/workflow-codebase-mapper.md +77 -0
- package/agents/workflow-collab-planner.md +147 -0
- package/agents/workflow-debugger.md +104 -0
- package/agents/workflow-executor.md +133 -0
- package/agents/workflow-external-researcher.md +86 -0
- package/agents/workflow-integration-checker.md +83 -0
- package/agents/workflow-nyquist-auditor.md +85 -0
- package/agents/workflow-phase-researcher.md +85 -0
- package/agents/workflow-plan-checker.md +100 -0
- package/agents/workflow-planner.md +200 -0
- package/agents/workflow-project-researcher.md +74 -0
- package/agents/workflow-research-synthesizer.md +70 -0
- package/agents/workflow-reviewer.md +82 -0
- package/agents/workflow-roadmapper.md +81 -0
- package/agents/workflow-verifier.md +120 -0
- package/package.json +58 -0
- package/skills/codify-to-knowhow/SKILL.md +167 -0
- package/skills/delegation-check/SKILL.md +297 -0
- package/skills/domain-add/SKILL.md +75 -0
- package/skills/insight-challenge/SKILL.md +226 -0
- package/skills/learn-decompose/SKILL.md +124 -0
- package/skills/learn-follow/SKILL.md +163 -0
- package/skills/learn-investigate/SKILL.md +160 -0
- package/skills/learn-second-opinion/SKILL.md +128 -0
- package/skills/maestro/SKILL.md +239 -0
- package/skills/maestro-amend/SKILL.md +169 -0
- package/skills/maestro-analyze/SKILL.md +173 -0
- package/skills/maestro-blueprint/SKILL.md +159 -0
- package/skills/maestro-brainstorm/SKILL.md +193 -0
- package/skills/maestro-collab/SKILL.md +181 -0
- package/skills/maestro-companion/SKILL.md +536 -0
- package/skills/maestro-composer/SKILL.md +192 -0
- package/skills/maestro-execute/SKILL.md +193 -0
- package/skills/maestro-fork/SKILL.md +104 -0
- package/skills/maestro-grill/SKILL.md +151 -0
- package/skills/maestro-guard/SKILL.md +124 -0
- package/skills/maestro-help/SKILL.md +328 -0
- package/skills/maestro-impeccable/SKILL.md +302 -0
- package/skills/maestro-init/SKILL.md +151 -0
- package/skills/maestro-merge/SKILL.md +90 -0
- package/skills/maestro-milestone-audit/SKILL.md +117 -0
- package/skills/maestro-milestone-complete/SKILL.md +133 -0
- package/skills/maestro-milestone-release/SKILL.md +131 -0
- package/skills/maestro-next/SKILL.md +269 -0
- package/skills/maestro-overlay/SKILL.md +203 -0
- package/skills/maestro-plan/SKILL.md +194 -0
- package/skills/maestro-player/SKILL.md +184 -0
- package/skills/maestro-quick/SKILL.md +117 -0
- package/skills/maestro-ralph/SKILL.md +905 -0
- package/skills/maestro-ralph-cli/SKILL.md +976 -0
- package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
- package/skills/maestro-ralph-execute/SKILL.md +409 -0
- package/skills/maestro-ralph-v2/SKILL.md +1198 -0
- package/skills/maestro-roadmap/SKILL.md +157 -0
- package/skills/maestro-swarm-workflow/SKILL.md +272 -0
- package/skills/maestro-tools-execute/SKILL.md +143 -0
- package/skills/maestro-tools-register/SKILL.md +192 -0
- package/skills/maestro-ui-codify/SKILL.md +127 -0
- package/skills/maestro-universal-workflow/SKILL.md +622 -0
- package/skills/maestro-update/SKILL.md +156 -0
- package/skills/manage-codebase-rebuild/SKILL.md +111 -0
- package/skills/manage-drift-realign/SKILL.md +159 -0
- package/skills/manage-harvest/SKILL.md +121 -0
- package/skills/manage-issue/SKILL.md +88 -0
- package/skills/manage-issue-discover/SKILL.md +104 -0
- package/skills/manage-kg-extractors/SKILL.md +147 -0
- package/skills/manage-knowhow/SKILL.md +102 -0
- package/skills/manage-knowhow-capture/SKILL.md +109 -0
- package/skills/manage-knowledge-audit/SKILL.md +147 -0
- package/skills/manage-status/SKILL.md +80 -0
- package/skills/manage-wiki/SKILL.md +104 -0
- package/skills/odyssey-debug/SKILL.md +344 -0
- package/skills/odyssey-improve/SKILL.md +423 -0
- package/skills/odyssey-planex/SKILL.md +542 -0
- package/skills/odyssey-review-test-fix/SKILL.md +392 -0
- package/skills/odyssey-ui/SKILL.md +388 -0
- package/skills/prompt-generator/SKILL.md +470 -0
- package/skills/quality-auto-test/SKILL.md +168 -0
- package/skills/quality-debug/SKILL.md +176 -0
- package/skills/quality-refactor/SKILL.md +108 -0
- package/skills/quality-retrospective/SKILL.md +134 -0
- package/skills/quality-review/SKILL.md +169 -0
- package/skills/quality-sync/SKILL.md +90 -0
- package/skills/quality-test/SKILL.md +183 -0
- package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
- package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
- package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
- package/skills/scholar-citation-verify/SKILL.md +166 -0
- package/skills/scholar-citation-verify/references/api-usage.md +372 -0
- package/skills/scholar-citation-verify/references/common-errors.md +384 -0
- package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
- package/skills/scholar-experiment/SKILL.md +321 -0
- package/skills/scholar-ideation/SKILL.md +288 -0
- package/skills/scholar-latex-organizer/SKILL.md +186 -0
- package/skills/scholar-publish/SKILL.md +220 -0
- package/skills/scholar-rebuttal-pro/README.md +313 -0
- package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
- package/skills/scholar-review/SKILL.md +227 -0
- package/skills/scholar-thesis-docx/README.md +111 -0
- package/skills/scholar-thesis-docx/README_EN.md +108 -0
- package/skills/scholar-thesis-docx/SKILL.md +212 -0
- package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
- package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
- package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
- package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
- package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
- package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
- package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
- package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
- package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
- package/skills/scholar-writing/SKILL.md +296 -0
- package/skills/security-audit/SKILL.md +244 -0
- package/skills/skill-generator/SKILL.md +472 -0
- package/skills/skill-iter-tune/SKILL.md +382 -0
- package/skills/skill-simplify/SKILL.md +63 -0
- package/skills/skill-tuning/SKILL.md +174 -0
- package/skills/spec-add/SKILL.md +105 -0
- package/skills/spec-load/SKILL.md +98 -0
- package/skills/spec-remove/SKILL.md +74 -0
- package/skills/spec-setup/SKILL.md +75 -0
- package/skills/team-adversarial-swarm/SKILL.md +233 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
- package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
- package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
- package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
- package/skills/team-arch-opt/SKILL.md +158 -0
- package/skills/team-brainstorm/SKILL.md +171 -0
- package/skills/team-coordinate/SKILL.md +266 -0
- package/skills/team-designer/SKILL.md +160 -0
- package/skills/team-executor/SKILL.md +189 -0
- package/skills/team-frontend/SKILL.md +136 -0
- package/skills/team-frontend-debug/SKILL.md +198 -0
- package/skills/team-interactive-craft/SKILL.md +141 -0
- package/skills/team-issue/SKILL.md +171 -0
- package/skills/team-lifecycle-v4/SKILL.md +209 -0
- package/skills/team-motion-design/SKILL.md +142 -0
- package/skills/team-perf-opt/SKILL.md +175 -0
- package/skills/team-planex/SKILL.md +137 -0
- package/skills/team-quality-assurance/SKILL.md +147 -0
- package/skills/team-review/SKILL.md +147 -0
- package/skills/team-roadmap-dev/SKILL.md +169 -0
- package/skills/team-swarm/SKILL.md +178 -0
- package/skills/team-swarm/scripts/aco.py +473 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +92 -0
- package/skills/team-swarm/scripts/test_aco.py +475 -0
- package/skills/team-tech-debt/SKILL.md +128 -0
- package/skills/team-testing/SKILL.md +143 -0
- package/skills/team-ui-polish/SKILL.md +141 -0
- package/skills/team-uidesign/SKILL.md +144 -0
- package/skills/team-ultra-analyze/SKILL.md +173 -0
- package/skills/team-ux-improve/SKILL.md +151 -0
- package/skills/team-visual-a11y/SKILL.md +156 -0
- package/skills/workflow-skill-designer/SKILL.md +496 -0
- package/src/extension/index.ts +222 -0
- package/src/extension/schemas.ts +131 -0
- package/src/providers/cli-tools-loader.ts +74 -0
- package/src/providers/provider-registry.ts +130 -0
- package/src/tools/delegate.ts +85 -0
- package/src/tools/explore.ts +134 -0
- package/src/tools/moa.ts +213 -0
- package/src/tools/status.ts +99 -0
- package/src/tools/wait.ts +166 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: maestro-update
|
|
3
|
+
description: "Detect version, preview changes, apply workflow upgrades Arguments: [--dry-run] [--force] [--setup-only]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Detect current version, run schema migration to latest, then follow the version-specific upgrade workflow.
|
|
9
|
+
Schema migrations are handled by `maestro update --migrate`; workflow docs (`~/.maestro/workflows/updates/`) handle setup.
|
|
10
|
+
</purpose>
|
|
11
|
+
|
|
12
|
+
<context>
|
|
13
|
+
$ARGUMENTS — optional flags.
|
|
14
|
+
|
|
15
|
+
**Flags:**
|
|
16
|
+
- `--dry-run` -- Preview migration plan without executing
|
|
17
|
+
- `--force` -- Skip confirmation prompts (intended for CI/automated contexts). Migration diff is still displayed even with `--force` to maintain audit visibility.
|
|
18
|
+
- `--setup-only` -- Skip schema migration, run only the setup for current version
|
|
19
|
+
|
|
20
|
+
**Version source:** `.workflow/state.json` → `version` field
|
|
21
|
+
|
|
22
|
+
**Workflow docs:** `~/.maestro/workflows/updates/`
|
|
23
|
+
- `update-v{TO}-setup.md` — post-migration setup for version {TO}
|
|
24
|
+
|
|
25
|
+
**Schema registry:** `maestro update --migrate` — handles all intermediate version bumps automatically
|
|
26
|
+
|
|
27
|
+
**Output boundary**: ALL file writes MUST target `.workflow/state.json` (version bump), `.workflow/state.json.backup-*` (backup), and `.workflow/` config files touched by version-specific setup. NEVER modify source code or `src/migrations/` files.
|
|
28
|
+
</context>
|
|
29
|
+
|
|
30
|
+
<invariants>
|
|
31
|
+
1. **Backup before migration** — a timestamped backup of `.workflow/state.json` MUST be created before any schema migration runs; NEVER execute migration without backup
|
|
32
|
+
2. **Idempotent** — running update when already on latest version MUST be a no-op (display "up to date"); NEVER re-apply migrations
|
|
33
|
+
3. **Confirmation before execute** — migration diff MUST be displayed and user MUST confirm via AskUserQuestion before execution (unless `--force`); NEVER silently apply schema changes
|
|
34
|
+
4. **Migration diff always visible** — even with `--force`, the migration diff MUST be displayed for audit visibility; NEVER skip diff display
|
|
35
|
+
5. **Restore path on failure** — if migration fails, the backup restore command MUST be displayed; NEVER leave user without recovery instructions
|
|
36
|
+
6. **Sequential migration** — all intermediate version steps MUST be applied in order by the schema registry; NEVER skip intermediate versions
|
|
37
|
+
</invariants>
|
|
38
|
+
|
|
39
|
+
<execution>
|
|
40
|
+
|
|
41
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
42
|
+
|
|
43
|
+
**GATE 1: Detect → Check**
|
|
44
|
+
- REQUIRED: Current version read from `.workflow/state.json`.
|
|
45
|
+
- BLOCKED if: state.json missing or unreadable (E001).
|
|
46
|
+
|
|
47
|
+
**GATE 2: Check → Execute**
|
|
48
|
+
- REQUIRED: Dry-run migration check completed; target version identified.
|
|
49
|
+
- REQUIRED: User confirmation via AskUserQuestion (unless `--force`).
|
|
50
|
+
- BLOCKED if: already up to date (display message and exit) or user cancels.
|
|
51
|
+
|
|
52
|
+
**GATE 3: Execute → Summary**
|
|
53
|
+
- REQUIRED: Backup created at `.workflow/state.json.backup-v{current}-{timestamp}`.
|
|
54
|
+
- REQUIRED: Schema migration completed successfully.
|
|
55
|
+
- REQUIRED: Version-specific setup doc followed (if exists).
|
|
56
|
+
- BLOCKED if: migration failed — display restore command and exit.
|
|
57
|
+
|
|
58
|
+
### Step 1: Detect Version
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
1. Read .workflow/state.json → extract version (default "1.0" if missing)
|
|
62
|
+
2. Display:
|
|
63
|
+
=== Maestro Update ===
|
|
64
|
+
Current version: v{version}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
IF `--setup-only`:
|
|
68
|
+
→ Glob: ~/.maestro/workflows/updates/update-v{version}-setup.md
|
|
69
|
+
→ IF exists: follow that document completely, then EXIT
|
|
70
|
+
→ IF not exists: display "No setup script for v{version}" → EXIT
|
|
71
|
+
|
|
72
|
+
### Step 2: Check for Updates
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
1. Run: maestro update --migrate "$(pwd)" --dry-run --json
|
|
76
|
+
2. Parse JSON output
|
|
77
|
+
3. IF status = "up-to-date":
|
|
78
|
+
Display "Already up to date (v{version})"
|
|
79
|
+
→ Glob: ~/.maestro/workflows/updates/update-v{version}-setup.md
|
|
80
|
+
→ IF exists: AskUserQuestion "Run setup for v{version}?" → load and follow
|
|
81
|
+
→ EXIT
|
|
82
|
+
|
|
83
|
+
4. Display target:
|
|
84
|
+
Update available: v{current} → v{target}
|
|
85
|
+
Schema migrations: {N} step(s) (handled automatically)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
IF `--dry-run` → display info and EXIT.
|
|
89
|
+
|
|
90
|
+
### Step 3: Execute
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
1. Display migration diff (always — even with --force):
|
|
94
|
+
Show schema changes that will be applied.
|
|
95
|
+
|
|
96
|
+
2. Confirm (unless --force):
|
|
97
|
+
AskUserQuestion: "Upgrade v{current} → v{target}?"
|
|
98
|
+
Options: [执行 / 取消]
|
|
99
|
+
|
|
100
|
+
3. Create backup:
|
|
101
|
+
Bash: cp .workflow/state.json .workflow/state.json.backup-v{current}-{timestamp}
|
|
102
|
+
|
|
103
|
+
4. Run schema migration (handles all intermediate steps automatically):
|
|
104
|
+
Bash: maestro update --migrate "$(pwd)" --json
|
|
105
|
+
Parse result, display changes.
|
|
106
|
+
|
|
107
|
+
5. IF failed → display backup restore command → EXIT
|
|
108
|
+
|
|
109
|
+
6. Load version-specific setup:
|
|
110
|
+
Read: ~/.maestro/workflows/updates/update-v{target}-setup.md
|
|
111
|
+
IF exists → follow completely (hooks, deps, knowledge system config)
|
|
112
|
+
|
|
113
|
+
7. Display: "v{current} → v{target}: done"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Step 4: Summary
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
=== Update Complete ===
|
|
120
|
+
Version: v{current} → v{target}
|
|
121
|
+
Backup: .workflow/state.json.backup-v{current}-{timestamp}
|
|
122
|
+
|
|
123
|
+
Next steps:
|
|
124
|
+
/manage-status -- Verify project state
|
|
125
|
+
/maestro -- Continue workflow
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
</execution>
|
|
129
|
+
|
|
130
|
+
<error_codes>
|
|
131
|
+
| Code | Severity | Condition | Recovery |
|
|
132
|
+
|------|----------|-----------|----------|
|
|
133
|
+
| E001 | error | `.workflow/state.json` not found or unreadable | Run `/maestro-init` first |
|
|
134
|
+
| E002 | error | Schema migration failed (npx tsx returned error) | Display backup restore command: `cp .workflow/state.json.backup-* .workflow/state.json` |
|
|
135
|
+
| E003 | error | Version-specific setup doc failed to execute | Manual setup: read `~/.maestro/workflows/updates/update-v{target}-setup.md` |
|
|
136
|
+
| W001 | warning | No version-specific setup doc found for target version | Proceed without setup; schema migration alone is sufficient |
|
|
137
|
+
| W002 | warning | `--setup-only` but no setup script exists for current version | Display message and exit |
|
|
138
|
+
</error_codes>
|
|
139
|
+
|
|
140
|
+
<success_criteria>
|
|
141
|
+
- [ ] Current version detected from state.json
|
|
142
|
+
- [ ] Schema migrations run automatically (no manual intermediate steps)
|
|
143
|
+
- [ ] Backup created before migration
|
|
144
|
+
- [ ] Version-specific setup doc loaded and followed (if exists)
|
|
145
|
+
- [ ] --setup-only runs only setup for current version
|
|
146
|
+
- [ ] --dry-run previews without executing
|
|
147
|
+
- [ ] Summary shows version change and backup path
|
|
148
|
+
</success_criteria>
|
|
149
|
+
|
|
150
|
+
<completion>
|
|
151
|
+
### Next-step routing
|
|
152
|
+
| Condition | Suggestion |
|
|
153
|
+
|-----------|-----------|
|
|
154
|
+
| Update complete | `/manage-status` to verify project state |
|
|
155
|
+
| Want to continue workflow | `/maestro` |
|
|
156
|
+
</completion>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-codebase-rebuild
|
|
3
|
+
description: "Rebuild all codebase documentation from scratch Arguments: [--focus <area>] [--force] [--skip-commit]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Full rebuild of `.workflow/codebase/` docs: 4 parallel mapper agents → tech-stack, architecture, features, concerns. Destructive — overwrites existing docs.
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<required_reading>
|
|
12
|
+
@~/.maestro/workflows/codebase-rebuild.md
|
|
13
|
+
</required_reading>
|
|
14
|
+
|
|
15
|
+
<context>
|
|
16
|
+
$ARGUMENTS -- optional flags.
|
|
17
|
+
|
|
18
|
+
**Flags:**
|
|
19
|
+
- `--focus <area>` -- Scope mapper agents to a single domain (e.g., `auth`, `api`, `database`). When omitted, all 4 mappers run on the full codebase.
|
|
20
|
+
- `--force` -- Skip confirmation prompt and proceed directly
|
|
21
|
+
- `--skip-commit` -- Do not auto-commit after rebuild
|
|
22
|
+
|
|
23
|
+
**Confirmation gate:** Unless `--force` is set, prompt the user (AskUserQuestion) before executing git commit. Show the list of changed files and proposed commit message. If `--skip-commit` is set, skip the commit entirely.
|
|
24
|
+
|
|
25
|
+
**Mapper agent assignments (when `--focus` omitted):**
|
|
26
|
+
| Agent | Focus | Output file |
|
|
27
|
+
|-------|-------|-------------|
|
|
28
|
+
| Mapper 1 | **Tech stack** -- languages, frameworks, dependencies, build system | `tech-stack.md` |
|
|
29
|
+
| Mapper 2 | **Architecture** -- layers, module boundaries, data flow, entry points | `architecture.md` |
|
|
30
|
+
| Mapper 3 | **Features** -- capabilities, API surface, user-facing functionality | `features.md` |
|
|
31
|
+
| Mapper 4 | **Cross-cutting concerns** -- error handling, logging, auth, config, testing | `concerns.md` |
|
|
32
|
+
|
|
33
|
+
**State files:**
|
|
34
|
+
- `.workflow/` -- must be initialized (project.md, state.json exist)
|
|
35
|
+
- `.workflow/codebase/` -- target directory (will be cleared and rebuilt)
|
|
36
|
+
- `.workflow/codebase/doc-index.json` -- generated documentation index
|
|
37
|
+
- `.workflow/codebase/knowledge-graph.json` -- Knowledge Graph with nodes, edges, layers, and tour (generated by `maestro kg index`)
|
|
38
|
+
|
|
39
|
+
**Output boundary**: ALL file writes MUST target `.workflow/codebase/`, `.workflow/state.json`, or `.workflow/project.md` (Tech Stack section only). NEVER modify source code or files outside these paths.
|
|
40
|
+
</context>
|
|
41
|
+
|
|
42
|
+
<invariants>
|
|
43
|
+
1. **Destructive with confirmation** — rebuild clears `.workflow/codebase/` entirely; MUST confirm with user unless `--force` is set
|
|
44
|
+
2. **Commit confirmation** — git commit MUST be confirmed by user unless `--force` is set; `--skip-commit` bypasses commit entirely
|
|
45
|
+
3. **Partial failure tolerance** — if 1-3 mapper agents fail, proceed with partial results (W001); only abort if all 4 fail (E002)
|
|
46
|
+
4. **Focus scoping** — when `--focus <area>` is set, MUST only regenerate docs relevant to that scope; leave unrelated docs untouched
|
|
47
|
+
5. **State update** — MUST update state.json with rebuild timestamp on completion
|
|
48
|
+
6. **KG pipeline mandatory** — MUST run `maestro kg index` after doc regeneration; KG validation failure is non-fatal (W003)
|
|
49
|
+
</invariants>
|
|
50
|
+
|
|
51
|
+
<execution>
|
|
52
|
+
Follow '~/.maestro/workflows/codebase-rebuild.md' completely.
|
|
53
|
+
|
|
54
|
+
**When `--focus <area>` is set:** pass the area string to each mapper agent as scoping context; only regenerate the docs relevant to that scope (leave others untouched unless missing).
|
|
55
|
+
|
|
56
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
57
|
+
|
|
58
|
+
**GATE 1: Confirmation → Mapping** (Pre-flight → Agent spawn)
|
|
59
|
+
- REQUIRED: `.workflow/` initialized (E001 if missing).
|
|
60
|
+
- REQUIRED: User confirmed rebuild (or `--force` set). W002 if existing docs found.
|
|
61
|
+
- BLOCKED if user declines confirmation.
|
|
62
|
+
|
|
63
|
+
**GATE 2: Mapping → KG Pipeline** (Agent results → Knowledge Graph)
|
|
64
|
+
- REQUIRED: At least 1 of 4 mapper agents returned valid results.
|
|
65
|
+
- REQUIRED: All output files written to `.workflow/codebase/`.
|
|
66
|
+
- REQUIRED: doc-index.json generated and valid.
|
|
67
|
+
- BLOCKED if all 4 mapper agents failed (E002).
|
|
68
|
+
|
|
69
|
+
**GATE 3: KG Pipeline → Commit** (Knowledge Graph → Git)
|
|
70
|
+
- REQUIRED: `maestro kg index` executed (W003 if validation fails — non-blocking).
|
|
71
|
+
- REQUIRED: state.json updated with rebuild timestamp.
|
|
72
|
+
- REQUIRED: If not `--skip-commit`: user confirmed git commit (or `--force` set).
|
|
73
|
+
- BLOCKED if state.json update fails.
|
|
74
|
+
</execution>
|
|
75
|
+
|
|
76
|
+
<completion>
|
|
77
|
+
### Next-step routing
|
|
78
|
+
|
|
79
|
+
| Condition | Suggestion |
|
|
80
|
+
|-----------|-----------|
|
|
81
|
+
| View updated state | `/manage-status` |
|
|
82
|
+
| Incremental updates later | `/quality-sync` |
|
|
83
|
+
| Verify KG stats | `maestro kg stats` |
|
|
84
|
+
| Future change impact | `maestro kg diff-wiki` |
|
|
85
|
+
</completion>
|
|
86
|
+
|
|
87
|
+
<error_codes>
|
|
88
|
+
| Code | Severity | Condition | Recovery |
|
|
89
|
+
|------|----------|-----------|----------|
|
|
90
|
+
| E001 | error | .workflow/ not initialized | Run maestro-init first to create .workflow/ |
|
|
91
|
+
| E002 | error | All 4 mapper agents failed | Abort rebuild; check agent configuration and retry |
|
|
92
|
+
| W001 | warning | A mapper agent failed (partial results) | Retry failed mapper or accept partial results |
|
|
93
|
+
| W002 | warning | `.workflow/codebase/` already exists -- user prompted for rebuild/skip | check_existing |
|
|
94
|
+
| W003 | warning | KG validation failed (graph written with valid=false) | Review .kg-tmp/ artifacts, re-run KG pipeline |
|
|
95
|
+
| W004 | warning | Wiki index rebuild failed after KG generation | Non-fatal, retries on next wiki access |
|
|
96
|
+
</error_codes>
|
|
97
|
+
|
|
98
|
+
<success_criteria>
|
|
99
|
+
- [ ] User confirmed rebuild (or --force used)
|
|
100
|
+
- [ ] .workflow/codebase/ cleared and rebuilt from scratch (or scoped subset when --focus set)
|
|
101
|
+
- [ ] All 4 mapper agents spawned (all-fail → E002; partial fail → W001)
|
|
102
|
+
- [ ] If not --skip-commit: user confirmed git commit (or --force used) before committing
|
|
103
|
+
- [ ] doc-index.json generated and valid
|
|
104
|
+
- [ ] All documentation files regenerated
|
|
105
|
+
- [ ] state.json updated with rebuild timestamp
|
|
106
|
+
- [ ] project.md Tech Stack section updated if changes detected
|
|
107
|
+
- [ ] KG pipeline executed (`maestro kg index`)
|
|
108
|
+
- [ ] knowledge-graph.json generated in .workflow/codebase/
|
|
109
|
+
- [ ] KG nodes indexed as virtual wiki entries (automatic via WikiIndexer on next wiki access)
|
|
110
|
+
- [ ] Next step routed
|
|
111
|
+
</success_criteria>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-drift-realign
|
|
3
|
+
description: "Detect and realign .workflow/ artifact drift against code reality after refactoring Arguments: [--scope <roadmap|spec|codebase|state|issue|knowhow|project|all>] [--since YYYY-MM-DD|commit|HEAD~N] [--depth shallow|deep] [--dry-run] [--report] [--auto-archive] [--interactive]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
检测代码重构/增量变更后,代码现实与 .workflow/ 文档之间的漂移。互补于 `manage-knowledge-audit`(检测知识存储内部矛盾)。本命令通过 git 时间线 + session 历史检测 code↔document 漂移。
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<required_reading>
|
|
12
|
+
@~/.maestro/workflows/drift-realign.md
|
|
13
|
+
</required_reading>
|
|
14
|
+
|
|
15
|
+
<deferred_reading>
|
|
16
|
+
- ~/.maestro/workflows/knowledge-audit.md (交叉引用已有审计发现)
|
|
17
|
+
- ~/.maestro/workflows/sync.md (codebase 文档严重漂移时自动触发)
|
|
18
|
+
- ~/.maestro/workflows/codebase-rebuild.md (sync 不足时的回退方案)
|
|
19
|
+
</deferred_reading>
|
|
20
|
+
|
|
21
|
+
<context>
|
|
22
|
+
Arguments: $ARGUMENTS
|
|
23
|
+
|
|
24
|
+
**Scope:** `roadmap` | `spec` | `codebase` | `state` | `issue` | `knowhow` | `project` | `all`(默认 `all`)
|
|
25
|
+
|
|
26
|
+
**`--since`:** 分析起始点。支持日期(`YYYY-MM-DD`)、commit ref(`abc1234`)、相对引用(`HEAD~N`)。默认自动检测:优先读 `state.json` 的 `last_drift_realign` 或 `last_pruned` 时间戳,回退 90 天。
|
|
27
|
+
|
|
28
|
+
**`--depth`:** `shallow`(mtime + 引用检查)vs `deep`(LLM 语义分析)。默认 `shallow`。
|
|
29
|
+
|
|
30
|
+
**`--dry-run`:** 预览模式,不执行任何写入。
|
|
31
|
+
|
|
32
|
+
**`--report`:** 仅生成报告,不进入交互分诊。
|
|
33
|
+
|
|
34
|
+
**`--auto-archive`:** 自动归档陈旧项,跳过逐项确认。
|
|
35
|
+
|
|
36
|
+
**`--interactive`:** 逐项交互分诊(默认)。
|
|
37
|
+
|
|
38
|
+
**互斥规则:**
|
|
39
|
+
- `--report` 覆盖 `--interactive`
|
|
40
|
+
- `--auto-archive` 覆盖 `--interactive`
|
|
41
|
+
- `--report` 与 `--auto-archive` 互斥(同时传入 → E006)
|
|
42
|
+
|
|
43
|
+
**状态文件读取:**
|
|
44
|
+
- `.workflow/state.json`
|
|
45
|
+
- `.workflow/roadmap.md`
|
|
46
|
+
- `.workflow/specs/*.md`
|
|
47
|
+
- `.workflow/codebase/*.md`
|
|
48
|
+
- `.workflow/issues/issues.jsonl`
|
|
49
|
+
- `.workflow/knowhow/*.md`
|
|
50
|
+
- `.workflow/project.md`
|
|
51
|
+
|
|
52
|
+
使用 `maestro timeline` CLI 构建统一的 git+session 时间线。
|
|
53
|
+
|
|
54
|
+
**Output boundary**: ALL file writes MUST target `.workflow/` metadata files (specs, codebase docs, roadmap.md, state.json, issues.jsonl) or `.workflow/.trash/drift-realign-{timestamp}/` (backups) or `.workflow/.drift-realign/` (session details). NEVER modify source code files.
|
|
55
|
+
</context>
|
|
56
|
+
|
|
57
|
+
<invariants>
|
|
58
|
+
1. **Code-as-Truth** — 代码是唯一真理源;当文档说 X 但代码做 Y 时,文档漂移,NEVER 反向修改代码来匹配文档
|
|
59
|
+
2. **Backup before mutate** — MUST create backup tarball in `.workflow/.trash/` before any file modification (E005 if backup fails)
|
|
60
|
+
3. **Never modify source code** — drift-realign only updates `.workflow/` metadata; source code files are read-only
|
|
61
|
+
4. **Mutual exclusion** — `--report` 与 `--auto-archive` 互斥;同时传入 MUST trigger E006
|
|
62
|
+
5. **Auto-depth escalation** — `drift_window` > 180 天 MUST auto-upgrade to `--depth deep` with W002 warning
|
|
63
|
+
6. **Audit trail** — every triage decision MUST be logged in `drift-log.jsonl` with finding ID, action, and timestamp
|
|
64
|
+
7. **Rebuild trigger** — codebase scope 的 3+ P0 finding MUST auto-trigger `/quality-sync --full` after triage
|
|
65
|
+
</invariants>
|
|
66
|
+
|
|
67
|
+
<execution>
|
|
68
|
+
Follow `~/.maestro/workflows/drift-realign.md` Stages 1-9 in order.
|
|
69
|
+
|
|
70
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
71
|
+
|
|
72
|
+
**GATE 1: Parse → Timeline** (Stages 1-2)
|
|
73
|
+
- REQUIRED: `.workflow/` 存在,scope 解析通过,`--since` 已解析。
|
|
74
|
+
- REQUIRED: `maestro timeline --since <date> --json` 产出有效时间线。
|
|
75
|
+
- BLOCKED if `.workflow/` 缺失 (E001)、scope 非法 (E002)、git 不可用 (E003)。
|
|
76
|
+
|
|
77
|
+
**GATE 2: Timeline → Scan** (Stages 2-3 → Stage 4)
|
|
78
|
+
- REQUIRED: `timeline.json` 已生成且包含事件。
|
|
79
|
+
- REQUIRED: `drift_score` 已计算(LOW/MODERATE/SEVERE)。
|
|
80
|
+
- REQUIRED: 若 SEVERE 且 `--depth shallow`,发出 W002 建议 `--depth deep`。
|
|
81
|
+
- BLOCKED if 时间线为空(`--since` 之后无变更)。
|
|
82
|
+
|
|
83
|
+
**GATE 3: Scan → Triage** (Stage 4 → Stages 5-6)
|
|
84
|
+
- REQUIRED: 4 个并行漂移扫描 agent 全部返回结果(或 W003 部分覆盖)。
|
|
85
|
+
- REQUIRED: `DriftFinding[]` 已合并、去重、按严重度排序。
|
|
86
|
+
- BLOCKED if 所有 agent 均失败。
|
|
87
|
+
|
|
88
|
+
**GATE 4: Triage → Apply** (Stages 6-7 → Stage 8)
|
|
89
|
+
- REQUIRED: 备份 tarball 生成于 `.workflow/.trash/drift-realign-{timestamp}/`。
|
|
90
|
+
- REQUIRED: 所有用户决策已记录(或 `--auto-archive`/`--report` 已生效)。
|
|
91
|
+
- REQUIRED: codebase scope 的 rebuild 动作自动触发 `/quality-sync --full`。
|
|
92
|
+
- BLOCKED if 备份失败 (E005)。
|
|
93
|
+
|
|
94
|
+
### Execution Constraints
|
|
95
|
+
|
|
96
|
+
- **Code-as-Truth**: 代码是唯一真理源。当文档说 X 但代码做 Y 时,文档漂移。
|
|
97
|
+
- **Parallel scan**: Stage 4 在单条消息中派发 4 个 agent(roadmap-scanner、spec-scanner、codebase-scanner、artifact-scanner)。
|
|
98
|
+
- **Auto-rebuild**: 当 codebase-scanner 检测到严重漂移(3+ P0 finding)时,分诊后自动触发 `/quality-sync --full`。若 sync 报告重大结构变更,建议 `/manage-codebase-rebuild`。
|
|
99
|
+
- **Long gap handling**: 当 `drift_window` > 180 天时,自动升级为 `--depth deep` 并警告用户 (W002)。
|
|
100
|
+
|
|
101
|
+
### Platform Inquiry(Stage 2a,交互式)
|
|
102
|
+
|
|
103
|
+
当 `session_summary.by_platform` 包含多个平台且 session 总量 > 20 时,使用 AskUserQuestion 询问用户修改主要在哪个平台进行。用户选择后以 `--platform` 参数重新获取 timeline,缩小后续分析范围。
|
|
104
|
+
|
|
105
|
+
### Session 详情加载策略(Stage 2b)
|
|
106
|
+
|
|
107
|
+
`maestro timeline` 每条 session 事件已包含:`summary`(用户提问摘要)、`edited_files`、`code_paths`、`platform`。这些信息在 `--depth shallow` 模式下足以支撑漂移检测。
|
|
108
|
+
|
|
109
|
+
当 `--depth deep` 时,对与 cold_workflow_files 有 edited_files 交集的 session,通过 `maestro load --type session --id <id> --json` 按需加载完整 body 和 related 字段:
|
|
110
|
+
- 仅加载 edited_files 与 cold_workflow_files 有交集的 session
|
|
111
|
+
- 最多加载 10 个(按交集文件数降序排序)
|
|
112
|
+
- 结果写入 `.workflow/.drift-realign/session-details-{date}.json`
|
|
113
|
+
- scanner agent 在 deep 模式下同时接收 timeline.json + session-details.json
|
|
114
|
+
</execution>
|
|
115
|
+
|
|
116
|
+
<completion>
|
|
117
|
+
### Next-step routing
|
|
118
|
+
|
|
119
|
+
| Condition | Suggestion |
|
|
120
|
+
|-----------|-----------|
|
|
121
|
+
| codebase 文档已重建 | `/manage-status` |
|
|
122
|
+
| spec 标记待更新 | 手动编辑标记的 spec 文件 |
|
|
123
|
+
| roadmap 已过时 | `/maestro-roadmap` 重新生成 |
|
|
124
|
+
| state.json 需清理 | `/manage-knowledge-audit --scope artifact` |
|
|
125
|
+
| 需要完整同步 | `/quality-sync --full` |
|
|
126
|
+
| project.md 已过时 | 编辑 `.workflow/project.md` |
|
|
127
|
+
</completion>
|
|
128
|
+
|
|
129
|
+
<error_codes>
|
|
130
|
+
| Code | Severity | Condition | Recovery |
|
|
131
|
+
|------|----------|-----------|----------|
|
|
132
|
+
| E001 | error | `.workflow/` 未初始化 | 先跑 `/maestro-init` |
|
|
133
|
+
| E002 | error | `--scope` 非法 | 提供有效 scope: roadmap/spec/codebase/state/issue/knowhow/project/all |
|
|
134
|
+
| E003 | error | git 不可用(非 git 仓库) | 初始化 git |
|
|
135
|
+
| E004 | error | `--since` 无法解析 | 检查日期格式或 commit ref |
|
|
136
|
+
| E005 | error | 备份失败 | 检查磁盘空间 |
|
|
137
|
+
| E006 | error | `--report` 与 `--auto-archive` 同时传入 | 二选一:`--report` 仅生成报告,`--auto-archive` 执行归档 |
|
|
138
|
+
| W001 | warning | session 历史不可用(wiki 未索引) | 运行 `maestro wiki rebuild` |
|
|
139
|
+
| W002 | warning | `drift_window` > 180 天 | 建议使用 `--depth deep` |
|
|
140
|
+
| W003 | warning | 部分 scanner agent 失败 | 以部分覆盖继续 |
|
|
141
|
+
| W004 | warning | git log > 1000 commits | 自动截断至最近 1000 条 |
|
|
142
|
+
</error_codes>
|
|
143
|
+
|
|
144
|
+
<success_criteria>
|
|
145
|
+
- [ ] Scope 正确解析,互斥标志校验通过
|
|
146
|
+
- [ ] `maestro timeline` 已调用,`timeline.json` 已生成
|
|
147
|
+
- [ ] `drift_score` 已计算(LOW/MODERATE/SEVERE 已展示)
|
|
148
|
+
- [ ] 4 个并行 scanner agent 已派发
|
|
149
|
+
- [ ] `DriftFinding[]` 已合并并按 P0 > P1 > P2 排序
|
|
150
|
+
- [ ] 如 `--interactive`:用户已分诊所有 finding
|
|
151
|
+
- [ ] 变更前备份 tarball 已生成
|
|
152
|
+
- [ ] archive 动作已将文件移入 `.trash/`
|
|
153
|
+
- [ ] update 动作已注入 TODO 标记及提示
|
|
154
|
+
- [ ] rebuild 动作已自动触发 `/quality-sync --full`
|
|
155
|
+
- [ ] `state.json` 已更新 `last_drift_realign` 时间戳
|
|
156
|
+
- [ ] `drift-report-{date}.md` 已生成
|
|
157
|
+
- [ ] `drift-log.jsonl` 已追加
|
|
158
|
+
- [ ] 摘要展示及下一步路由已输出
|
|
159
|
+
</success_criteria>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-harvest
|
|
3
|
+
description: "Extract knowledge from artifacts into wiki/spec/issues Arguments: [<session-id|path>] [--to wiki|spec|issue|auto] [--source <type>] [--recent N] [--dry-run] [-y]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Extract knowledge from workflow artifacts → route to wiki/spec/issue stores. Works on any artifact (vs retrospective which is phase-scoped).
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<required_reading>
|
|
12
|
+
@~/.maestro/workflows/harvest.md
|
|
13
|
+
</required_reading>
|
|
14
|
+
|
|
15
|
+
<deferred_reading>
|
|
16
|
+
- @~/.maestro/workflows/issue.md (issues.jsonl schema for issue routing — read when creating issues in Stage 6c)
|
|
17
|
+
- @~/.maestro/workflows/specs-add.md (spec entry format — read when routing to spec in Stage 6b)
|
|
18
|
+
</deferred_reading>
|
|
19
|
+
|
|
20
|
+
<context>
|
|
21
|
+
Arguments: $ARGUMENTS
|
|
22
|
+
|
|
23
|
+
**Modes (auto-detected):**
|
|
24
|
+
- No arguments → `scan` mode: discover all harvestable artifacts, interactive selection
|
|
25
|
+
- `<session-id>` (e.g., `ANL-auth-20260410`, `WFS-xxx`) → `session` mode: harvest specific session
|
|
26
|
+
- `<path>` (e.g., `.workflow/.analysis/ANL-auth-20260410/`) → `path` mode: harvest from explicit directory
|
|
27
|
+
|
|
28
|
+
**Flags:**
|
|
29
|
+
- `-y` / `--yes` — Skip confirmation prompts for all write operations (artifact selection, routing decisions, store writes). Useful for CI or batch harvesting.
|
|
30
|
+
|
|
31
|
+
Additional flags, source registry (scan paths), and storage locations defined in workflow harvest.md.
|
|
32
|
+
|
|
33
|
+
**Output boundary**: ALL file writes MUST target `.workflow/knowhow/`, `.workflow/specs/`, `.workflow/issues/`, `.workflow/wiki/`, `.workflow/harvest/`, or `.workflow/state.json` only. NEVER modify source code, source artifacts, or files outside these paths.
|
|
34
|
+
</context>
|
|
35
|
+
|
|
36
|
+
<invariants>
|
|
37
|
+
1. **Read-only until routing** — extraction and classification happen in-memory; no files written until Stage 6
|
|
38
|
+
2. **Never modify source artifacts** — harvest is purely extractive; source files remain untouched
|
|
39
|
+
3. **Dedup before write** — MUST check harvest-log.jsonl and existing stores before each write to prevent duplicates
|
|
40
|
+
4. **Source tagging** — MUST set `source: "harvest"` on every issues.jsonl row so concurrent writers can be distinguished
|
|
41
|
+
5. **Relationship pre-check on spec routing** — when routing to spec, MUST compare against existing specs with same keywords/category. Classify the relationship: **supersede** (new replaces old) → attach `supersedes = <old-sid>`, after add run `maestro spec supersede`; **conflict** (genuine dispute) → set `confidence="low"` and log conflict note; **independent** → no metadata
|
|
42
|
+
6. **Provenance tracking** — every routed item MUST be logged in harvest-log.jsonl with fragment ID, target store, and timestamp
|
|
43
|
+
7. **Dry-run safety** — `--dry-run` MUST NOT write any files; preview only
|
|
44
|
+
</invariants>
|
|
45
|
+
|
|
46
|
+
<execution>
|
|
47
|
+
Follow '~/.maestro/workflows/harvest.md' Stages 1-8 in order.
|
|
48
|
+
|
|
49
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
50
|
+
|
|
51
|
+
**GATE 1: Discovery → Extraction** (Stages 1-3 → Stage 4)
|
|
52
|
+
- REQUIRED: Source artifacts discovered and mode resolved (scan/session/path).
|
|
53
|
+
- REQUIRED: User selected artifact(s) to harvest (or auto-selected via session/path mode, or `-y`).
|
|
54
|
+
- BLOCKED if no harvestable artifacts found (W001) or invalid source (E004/E005).
|
|
55
|
+
|
|
56
|
+
**GATE 2: Extraction → Routing** (Stage 4 → Stage 5-6)
|
|
57
|
+
- REQUIRED: All files in selected artifacts loaded and parsed.
|
|
58
|
+
- REQUIRED: Knowledge fragments extracted with category, confidence, and tags.
|
|
59
|
+
- REQUIRED: Fragments filtered by `--min-confidence`.
|
|
60
|
+
- BLOCKED if extraction produces zero fragments.
|
|
61
|
+
|
|
62
|
+
**GATE 3: Routing → Write** (Stage 6 → Stage 7-8)
|
|
63
|
+
- REQUIRED: Routing classification applied (auto or forced by `--to`).
|
|
64
|
+
- REQUIRED: Dedup check passed against harvest-log.jsonl and existing stores.
|
|
65
|
+
- REQUIRED: If `--dry-run`: preview displayed, no files written — GATE blocks further writes.
|
|
66
|
+
- BLOCKED if dedup check fails or store paths unresolvable.
|
|
67
|
+
|
|
68
|
+
Extraction patterns, classification rules, routing infrastructure, and fragment ID scheme defined in workflow harvest.md.
|
|
69
|
+
|
|
70
|
+
</execution>
|
|
71
|
+
|
|
72
|
+
<completion>
|
|
73
|
+
### Next-step routing
|
|
74
|
+
|
|
75
|
+
| Condition | Suggestion |
|
|
76
|
+
|-----------|-----------|
|
|
77
|
+
| Wiki entries created | `maestro wiki list --type note` |
|
|
78
|
+
| Wiki graph needs linking | `/manage-wiki connect --fix` |
|
|
79
|
+
| Issues created | `/manage-issue list --source harvest` |
|
|
80
|
+
| Specs extracted | `maestro load --type spec` |
|
|
81
|
+
| Specs extracted (审查) | `/manage-knowledge-audit --scope spec` — 新写入的 spec 可能与现有条目矛盾或替代 |
|
|
82
|
+
| 查看演化链 | `maestro spec history <sid>` — 确认 supersede 链完整 |
|
|
83
|
+
| Spec 冲突标记已存在 | `maestro spec conflict list` — 查看当前冲突状态 |
|
|
84
|
+
| 知识健康检查 | `maestro spec health` — 悬空/循环 supersedes 校验 |
|
|
85
|
+
| Full phase retrospective | `/quality-retrospective` |
|
|
86
|
+
</completion>
|
|
87
|
+
|
|
88
|
+
<error_codes>
|
|
89
|
+
| Code | Severity | Condition | Recovery |
|
|
90
|
+
|------|----------|-----------|----------|
|
|
91
|
+
| E001 | error | `.workflow/` not initialized | Run `/maestro-init` first |
|
|
92
|
+
| E002 | error | Invalid `--to` target (must be: wiki, spec, issue, auto) | Display valid options |
|
|
93
|
+
| E003 | error | Invalid `--source` type | Display valid source types from registry |
|
|
94
|
+
| E004 | error | Session ID not found in any source path | Show available sessions with `--source all` |
|
|
95
|
+
| E005 | error | Path does not exist or contains no parseable artifacts | Verify path and file structure |
|
|
96
|
+
| W001 | warning | No harvestable artifacts found within `--recent` window | Widen time window or check `.workflow/` contents |
|
|
97
|
+
| W002 | warning | `maestro wiki create` failed — wiki entries saved to `.workflow/harvest/wiki-pending-*.md` | Apply pending entries manually or retry |
|
|
98
|
+
| W003 | warning | Some fragments below confidence threshold — logged but not routed | Lower `--min-confidence` to include |
|
|
99
|
+
| W004 | warning | Duplicate fragments skipped | Review harvest-log.jsonl for prior routing |
|
|
100
|
+
| W005 | warning | `.workflow/issues/` directory missing | Auto-create directory and empty issues.jsonl |
|
|
101
|
+
</error_codes>
|
|
102
|
+
|
|
103
|
+
<success_criteria>
|
|
104
|
+
- [ ] Mode correctly resolved (scan / session / path)
|
|
105
|
+
- [ ] Source artifacts discovered and listed with metadata
|
|
106
|
+
- [ ] User selected artifact(s) to harvest (or auto-selected via session/path mode)
|
|
107
|
+
- [ ] All files in selected artifacts loaded and parsed
|
|
108
|
+
- [ ] Knowledge fragments extracted with category, confidence, tags
|
|
109
|
+
- [ ] Fragments filtered by `--min-confidence`
|
|
110
|
+
- [ ] Routing classification applied (auto or forced by `--to`)
|
|
111
|
+
- [ ] Dedup check passed against harvest-log.jsonl and existing stores
|
|
112
|
+
- [ ] If `--dry-run`: preview displayed, no files written
|
|
113
|
+
- [ ] If not dry-run: all routed items written to target stores
|
|
114
|
+
- [ ] Wiki entries created via `maestro wiki create` (or fallback to pending files)
|
|
115
|
+
- [ ] Spec entries added via `spec-add` mechanism
|
|
116
|
+
- [ ] Issue entries appended to `issues.jsonl` with canonical schema
|
|
117
|
+
- [ ] `harvest-log.jsonl` updated with provenance for each routed item
|
|
118
|
+
- [ ] `harvest-report-{date}.md` written with full summary
|
|
119
|
+
- [ ] No source artifacts modified
|
|
120
|
+
- [ ] Summary displayed with counts and next-step routing
|
|
121
|
+
</success_criteria>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-issue
|
|
3
|
+
description: "Create, query, update, close, and link issues Arguments: <subcommand: create|list|status|update|close|link> [--title text] [--severity S] [--status S] [--resolution text]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Issue lifecycle management: create, list, status, update, close, link. Stored in `.workflow/issues/issues.jsonl`. For automated discovery, use `/manage-issue-discover`.
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<required_reading>
|
|
12
|
+
@~/.maestro/workflows/issue.md
|
|
13
|
+
</required_reading>
|
|
14
|
+
|
|
15
|
+
<deferred_reading>
|
|
16
|
+
- [issue.json template](~/.maestro/templates/issue.json) — read when creating or updating issue records (create, update, close)
|
|
17
|
+
</deferred_reading>
|
|
18
|
+
|
|
19
|
+
<context>
|
|
20
|
+
$ARGUMENTS -- subcommand + options. Parse first token as subcommand.
|
|
21
|
+
|
|
22
|
+
**Valid subcommands:**
|
|
23
|
+
- `create` -- create a new issue (--title, --severity, --source, --phase, --description)
|
|
24
|
+
- `list` -- list issues with optional filters (--status, --phase, --severity, --source)
|
|
25
|
+
- `status` -- show full detail for a specific issue (ISS-XXXXXXXX-NNN)
|
|
26
|
+
- `update` -- update issue fields (ISS-XXXXXXXX-NNN --status, --priority, --severity, --tags, ...)
|
|
27
|
+
- `close` -- close an issue with resolution (ISS-XXXXXXXX-NNN --resolution)
|
|
28
|
+
- `link` -- link issue to a task (ISS-XXXXXXXX-NNN --task TASK-NNN)
|
|
29
|
+
|
|
30
|
+
**State files:**
|
|
31
|
+
- `.workflow/issues/issues.jsonl` -- active issues (one JSON per line)
|
|
32
|
+
- `.workflow/issues/issue-history.jsonl` -- archived/closed issues
|
|
33
|
+
|
|
34
|
+
**Output boundary**: ALL file writes MUST target `.workflow/issues/issues.jsonl`, `.workflow/issues/issue-history.jsonl`, or `.workflow/issues/` directory only. NEVER modify source code or files outside these paths.
|
|
35
|
+
</context>
|
|
36
|
+
|
|
37
|
+
<invariants>
|
|
38
|
+
1. **Schema compliance** — every issue record MUST conform to the canonical issue.json template schema
|
|
39
|
+
2. **ID uniqueness** — issue IDs (ISS-XXXXXXXX-NNN) MUST be unique across issues.jsonl and issue-history.jsonl
|
|
40
|
+
3. **Close moves to history** — `close` subcommand MUST move the record from issues.jsonl to issue-history.jsonl, NEVER delete without archiving
|
|
41
|
+
4. **Bidirectional links** — `link` subcommand MUST create references in both the issue and the linked task
|
|
42
|
+
5. **Confirmation on destructive ops** — `close` and bulk `update` MUST require user confirmation unless `-y` flag is set
|
|
43
|
+
6. **Append-only audit** — NEVER overwrite existing issue records; updates MUST preserve all prior fields and add `updated_at` timestamp
|
|
44
|
+
</invariants>
|
|
45
|
+
|
|
46
|
+
<execution>
|
|
47
|
+
Parse subcommand from first token of $ARGUMENTS.
|
|
48
|
+
Follow '~/.maestro/workflows/issue.md' completely.
|
|
49
|
+
|
|
50
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
51
|
+
|
|
52
|
+
**GATE 1: Parse → Execute** (Subcommand routing)
|
|
53
|
+
- REQUIRED: Subcommand parsed and validated against valid set (create/list/status/update/close/link).
|
|
54
|
+
- REQUIRED: `.workflow/issues/` directory exists (auto-create with empty issues.jsonl if missing).
|
|
55
|
+
- BLOCKED if E_NO_SUBCOMMAND or E_INVALID_SUBCOMMAND.
|
|
56
|
+
|
|
57
|
+
**GATE 2: Execute → Write** (For mutating subcommands: create/update/close/link)
|
|
58
|
+
- REQUIRED: Issue data validated against issue.json template schema.
|
|
59
|
+
- REQUIRED: For `close`: resolution text provided.
|
|
60
|
+
- REQUIRED: For `link`: target task ID resolved and exists.
|
|
61
|
+
- BLOCKED if schema validation fails or target references unresolvable.
|
|
62
|
+
</execution>
|
|
63
|
+
|
|
64
|
+
<completion>
|
|
65
|
+
### Next-step routing
|
|
66
|
+
|
|
67
|
+
| Subcommand | Suggestion |
|
|
68
|
+
|-----------|-----------|
|
|
69
|
+
| create | `/maestro-analyze --gaps <ISS-ID>` or `/maestro-plan --gaps` |
|
|
70
|
+
| list | `/maestro-analyze --gaps <ISS-ID>` for open issues |
|
|
71
|
+
| close | `/manage-status` |
|
|
72
|
+
</completion>
|
|
73
|
+
|
|
74
|
+
<error_codes>
|
|
75
|
+
| Code | Severity | Condition | Recovery |
|
|
76
|
+
|------|----------|-----------|----------|
|
|
77
|
+
| E_NO_SUBCOMMAND | error | No subcommand provided in $ARGUMENTS | Display valid subcommands, prompt user to select |
|
|
78
|
+
| E_INVALID_SUBCOMMAND | error | Unrecognized subcommand | Display valid subcommands with usage hints |
|
|
79
|
+
| E_ISSUES_DIR_MISSING | warning | `.workflow/issues/` directory does not exist | Auto-create directory and empty issues.jsonl |
|
|
80
|
+
</error_codes>
|
|
81
|
+
|
|
82
|
+
<success_criteria>
|
|
83
|
+
- [ ] Subcommand parsed and routed to correct handler
|
|
84
|
+
- [ ] Issue data read/written to correct JSONL file
|
|
85
|
+
- [ ] Output displayed in appropriate format (table for list, detail for status)
|
|
86
|
+
- [ ] Cross-references maintained (link creates bidirectional references)
|
|
87
|
+
- [ ] Next step routed by subcommand
|
|
88
|
+
</success_criteria>
|