@gong-ym/ai-spec-auto 0.2.14 → 0.2.15
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/.agents/commands/README.md +33 -33
- package/.agents/commands/claude/spec-start-review.md +88 -88
- package/.agents/commands/codex/spec-continue.md +74 -74
- package/.agents/commands/codex/spec-orchestrate.md +35 -35
- package/.agents/commands/codex/spec-start-review.md +88 -88
- package/.agents/commands/codex/spec-start.md +67 -67
- package/.agents/commands/codex/spec-status.md +22 -22
- package/.agents/commands/codex/spec-stop.md +29 -29
- package/.agents/commands/codex/spec-update.md +40 -40
- package/.agents/commands/common/branch-review.md +117 -117
- package/.agents/commands/common/project-init.md +25 -25
- package/.agents/commands/common/spec-continue.md +74 -74
- package/.agents/commands/common/spec-orchestrate.md +35 -35
- package/.agents/commands/common/spec-start-review.md +82 -82
- package/.agents/commands/common/spec-start.md +67 -67
- package/.agents/commands/common/spec-status.md +22 -22
- package/.agents/commands/common/spec-stop.md +29 -29
- package/.agents/commands/common/spec-update.md +60 -40
- package/.agents/commands/cursor/opsx-apply.md +55 -55
- package/.agents/commands/cursor/opsx-archive.md +48 -48
- package/.agents/commands/cursor/opsx-explore.md +45 -45
- package/.agents/commands/cursor/opsx-propose.md +59 -59
- package/.agents/commands/cursor/spec-continue.md +63 -63
- package/.agents/commands/cursor/spec-orchestrate.md +53 -53
- package/.agents/commands/cursor/spec-start-review.md +78 -78
- package/.agents/commands/cursor/spec-start.md +59 -59
- package/.agents/commands/cursor/spec-status.md +30 -30
- package/.agents/commands/cursor/spec-stop.md +29 -29
- package/.agents/commands/cursor/spec-update.md +41 -41
- package/.agents/flows/FRONTMATTER.md +263 -263
- package/.agents/flows/RUN_OUTPUT.md +263 -263
- package/.agents/flows/common/README.md +29 -29
- package/.agents/flows/common/bugfix-to-verification.md +95 -95
- package/.agents/flows/common/change-to-architecture-review.md +89 -89
- package/.agents/flows/common/change-to-release.md +94 -94
- package/.agents/flows/common/prd-to-delivery.md +184 -184
- package/.agents/flows/common/requirement-to-observability.md +97 -97
- package/.agents/orchestration/README.md +22 -22
- package/.agents/orchestration/expert-dispatch-spec.md +155 -155
- package/.agents/orchestration/expert-executor-spec.md +84 -84
- package/.agents/orchestration/expert-runtime-action-spec.md +73 -73
- package/.agents/orchestration/runtime-state-handoff-spec.md +264 -264
- package/.agents/orchestration/task-anchor-spec.md +212 -212
- package/.agents/orchestration/task-orchestrator-adapter-payload.md +153 -153
- package/.agents/orchestration/task-orchestrator-bootstrap-payload.md +145 -145
- package/.agents/orchestration/task-orchestrator-output-extractor-spec.md +93 -93
- package/.agents/orchestration/task-orchestrator-run-plan-template.md +312 -312
- package/.agents/orchestration/task-orchestrator-runtime-hooks.md +214 -214
- package/.agents/registry/README.md +63 -63
- package/.agents/registry/flows.json +125 -125
- package/.agents/registry/profiles.json +101 -101
- package/.agents/registry/roles.json +1265 -1265
- package/.agents/registry/rules.json +148 -148
- package/.agents/registry/scenario-packages.json +123 -123
- package/.agents/registry/skills.json +130 -130
- package/.agents/roles/INDEX.md +346 -346
- package/.agents/roles/common/README.md +76 -76
- package/.agents/roles/common/archive-change.md +80 -80
- package/.agents/roles/common/backend-implementer.md +92 -92
- package/.agents/roles/common/code-guardian.md +151 -151
- package/.agents/roles/common/frontend-implementer.md +146 -146
- package/.agents/roles/common/requirement-analyst.md +138 -138
- package/.agents/roles/common/task-orchestrator-routing.md +301 -301
- package/.agents/roles/common/task-orchestrator.md +224 -224
- package/.agents/roles/common/tooling-implementer.md +92 -92
- package/.agents/roles/domains/README.md +35 -35
- package/.agents/roles/domains/delivery/README.md +11 -11
- package/.agents/roles/domains/delivery/container-specialist.md +50 -50
- package/.agents/roles/domains/delivery/deployment-specialist.md +50 -50
- package/.agents/roles/domains/delivery/pipeline-specialist.md +50 -50
- package/.agents/roles/domains/demand-design/README.md +16 -16
- package/.agents/roles/domains/demand-design/api-contract-specialist.md +52 -52
- package/.agents/roles/domains/demand-design/design-collaborator.md +58 -58
- package/.agents/roles/domains/documentation/README.md +11 -11
- package/.agents/roles/domains/documentation/api-doc-specialist.md +50 -50
- package/.agents/roles/domains/documentation/component-doc-specialist.md +49 -49
- package/.agents/roles/domains/documentation/technical-writing-specialist.md +48 -48
- package/.agents/roles/domains/engineering/README.md +17 -17
- package/.agents/roles/domains/engineering/architecture-advisor.md +53 -53
- package/.agents/roles/domains/engineering/build-specialist.md +51 -51
- package/.agents/roles/domains/engineering/dependency-governor.md +52 -52
- package/.agents/roles/domains/governance/README.md +17 -17
- package/.agents/roles/domains/governance/api-governance-specialist.md +51 -51
- package/.agents/roles/domains/governance/lint-policy-specialist.md +49 -49
- package/.agents/roles/domains/governance/route-governance-specialist.md +52 -52
- package/.agents/roles/domains/observability/README.md +11 -11
- package/.agents/roles/domains/observability/error-tracker.md +50 -50
- package/.agents/roles/domains/observability/event-instrumentation-specialist.md +51 -51
- package/.agents/roles/domains/observability/rum-analyst.md +50 -50
- package/.agents/roles/domains/performance/README.md +11 -11
- package/.agents/roles/domains/performance/asset-optimizer.md +50 -50
- package/.agents/roles/domains/performance/performance-auditor.md +56 -56
- package/.agents/roles/domains/performance/vitals-analyst.md +50 -50
- package/.agents/roles/domains/security-a11y/README.md +11 -11
- package/.agents/roles/domains/security-a11y/a11y-auditor.md +50 -50
- package/.agents/roles/domains/security-a11y/aria-specialist.md +51 -51
- package/.agents/roles/domains/security-a11y/security-reviewer.md +49 -49
- package/.agents/roles/domains/testing/README.md +12 -12
- package/.agents/roles/domains/testing/coverage-analyst.md +50 -50
- package/.agents/roles/domains/testing/e2e-test-specialist.md +51 -51
- package/.agents/roles/domains/testing/unit-test-specialist.md +56 -56
- package/.agents/roles/domains/testing/verification-reviewer.md +67 -67
- package/.agents/rules/README.md +87 -87
- package/.agents/rules/common/02-/347/274/226/347/240/201/350/247/204/350/214/203.md +45 -45
- package/.agents/rules/common/08-/351/200/232/347/224/250/347/272/246/346/235/237.md +63 -63
- package/.agents/rules/common/10-/346/226/207/346/241/243/350/247/204/350/214/203.md +101 -101
- package/.agents/rules/common/12-Superpowers/346/211/247/350/241/214/350/247/204/350/214/203.md +46 -46
- package/.agents/rules/common/14-/345/256/241/350/256/241/346/261/207/346/212/245/350/247/204/350/214/203.md +107 -107
- package/.agents/rules/common/15-visual-gate-wait.md +90 -90
- package/.agents/rules/profiles/nestjs/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +27 -27
- package/.agents/rules/profiles/nestjs/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +20 -20
- package/.agents/rules/profiles/nestjs/04-/346/250/241/345/235/227/347/273/223/346/236/204/350/247/204/350/214/203.md +24 -24
- package/.agents/rules/profiles/nestjs/05-/346/216/245/345/217/243/344/270/216/345/245/221/347/272/246/350/247/204/350/214/203.md +24 -24
- package/.agents/rules/profiles/nestjs/06-/346/225/260/346/215/256/350/256/277/351/227/256/350/247/204/350/214/203.md +24 -24
- package/.agents/rules/profiles/nestjs/07-/351/205/215/347/275/256/344/270/216/350/277/220/350/241/214/346/227/266/350/247/204/350/214/203.md +20 -20
- package/.agents/rules/profiles/nestjs/09-/345/274/202/345/270/270/344/270/216/346/227/245/345/277/227/350/247/204/350/214/203.md +20 -20
- package/.agents/rules/profiles/nestjs/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +24 -24
- package/.agents/rules/profiles/nestjs/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +20 -20
- package/.agents/rules/profiles/node-tooling/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +30 -30
- package/.agents/rules/profiles/node-tooling/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +37 -37
- package/.agents/rules/profiles/node-tooling/04-CLI/344/270/216/346/250/241/345/235/227/350/247/204/350/214/203.md +42 -42
- package/.agents/rules/profiles/node-tooling/05-Contract/344/270/216Schema/350/247/204/350/214/203.md +42 -42
- package/.agents/rules/profiles/node-tooling/06-/350/277/220/350/241/214/346/227/266/346/226/207/344/273/266/350/247/204/350/214/203.md +30 -30
- package/.agents/rules/profiles/node-tooling/07-/346/227/245/345/277/227/344/270/216/351/224/231/350/257/257/345/244/204/347/220/206/350/247/204/350/214/203.md +60 -60
- package/.agents/rules/profiles/node-tooling/09-/350/204/232/346/234/254/344/270/216/345/205/245/345/217/243/350/247/204/350/214/203.md +45 -45
- package/.agents/rules/profiles/node-tooling/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +41 -41
- package/.agents/rules/profiles/node-tooling/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +55 -55
- package/.agents/rules/profiles/react/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +29 -29
- package/.agents/rules/profiles/react/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +104 -104
- package/.agents/rules/profiles/react/04-/347/273/204/344/273/266/350/247/204/350/214/203.md +46 -46
- package/.agents/rules/profiles/react/05-API/350/247/204/350/214/203.md +67 -67
- package/.agents/rules/profiles/react/06-/350/267/257/347/224/261/350/247/204/350/214/203.md +54 -54
- package/.agents/rules/profiles/react/07-/347/212/266/346/200/201/347/256/241/347/220/206.md +226 -226
- package/.agents/rules/profiles/react/09-/346/240/267/345/274/217/350/247/204/350/214/203.md +71 -71
- package/.agents/rules/profiles/react/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +80 -80
- package/.agents/rules/profiles/react/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +159 -159
- package/.agents/rules/profiles/springboot/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +31 -31
- package/.agents/rules/profiles/springboot/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +37 -37
- package/.agents/rules/profiles/springboot/04-/345/210/206/345/261/202/350/247/204/350/214/203.md +33 -33
- package/.agents/rules/profiles/springboot/05-/346/216/245/345/217/243/344/270/216/345/245/221/347/272/246/350/247/204/350/214/203.md +51 -51
- package/.agents/rules/profiles/springboot/06-/346/225/260/346/215/256/350/256/277/351/227/256/350/247/204/350/214/203.md +34 -34
- package/.agents/rules/profiles/springboot/07-/351/205/215/347/275/256/344/270/216/350/277/220/350/241/214/346/227/266/350/247/204/350/214/203.md +38 -38
- package/.agents/rules/profiles/springboot/09-/345/274/202/345/270/270/344/270/216/346/227/245/345/277/227/350/247/204/350/214/203.md +48 -48
- package/.agents/rules/profiles/springboot/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +43 -43
- package/.agents/rules/profiles/springboot/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +48 -48
- package/.agents/rules/profiles/vue/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +47 -47
- package/.agents/rules/profiles/vue/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +106 -106
- package/.agents/rules/profiles/vue/04-/347/273/204/344/273/266/350/247/204/350/214/203.md +61 -61
- package/.agents/rules/profiles/vue/05-API/350/247/204/350/214/203.md +67 -67
- package/.agents/rules/profiles/vue/06-/350/267/257/347/224/261/350/247/204/350/214/203.md +69 -69
- package/.agents/rules/profiles/vue/07-/347/212/266/346/200/201/347/256/241/347/220/206.md +93 -93
- package/.agents/rules/profiles/vue/09-/346/240/267/345/274/217/350/247/204/350/214/203.md +67 -67
- package/.agents/rules/profiles/vue/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +80 -80
- package/.agents/rules/profiles/vue/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +159 -159
- package/.agents/skills/README.md +171 -171
- package/.agents/skills/common/archive-change/SKILL.md +180 -180
- package/.agents/skills/common/branch-code-reviewer/SKILL.md +533 -533
- package/.agents/skills/common/branch-code-reviewer/references/business-risk-guide.md +293 -293
- package/.agents/skills/common/branch-code-reviewer/references/html-template-guide.md +121 -121
- package/.agents/skills/common/config-and-secret-scan/SKILL.md +99 -99
- package/.agents/skills/common/create-proposal/SKILL.md +192 -192
- package/.agents/skills/common/create-proposal/evals/evals.json +16 -16
- package/.agents/skills/common/create-proposal/evals/train_queries.json +18 -18
- package/.agents/skills/common/create-proposal/evals/validation_queries.json +18 -18
- package/.agents/skills/common/create-proposal/references/interaction-spec-template.md +42 -42
- package/.agents/skills/common/create-test/SKILL.md +292 -292
- package/.agents/skills/common/dependency-impact-graph/SKILL.md +80 -80
- package/.agents/skills/common/execute-task/SKILL.md +206 -206
- package/.agents/skills/common/execute-task/evals/evals.json +16 -16
- package/.agents/skills/common/execute-task/evals/train_queries.json +18 -18
- package/.agents/skills/common/execute-task/evals/validation_queries.json +18 -18
- package/.agents/skills/common/find-skills/SKILL.md +144 -144
- package/.agents/skills/common/install-ai-spec-auto/SKILL.md +260 -260
- package/.agents/skills/common/install-ai-spec-auto/evals/evals.json +17 -17
- package/.agents/skills/common/install-ai-spec-auto/evals/train_queries.json +18 -18
- package/.agents/skills/common/install-ai-spec-auto/evals/validation_queries.json +18 -18
- package/.agents/skills/common/project-init/SKILL.md +178 -178
- package/.agents/skills/common/project-init/evals/evals.json +16 -16
- package/.agents/skills/common/project-init/evals/train_queries.json +18 -18
- package/.agents/skills/common/project-init/evals/validation_queries.json +18 -18
- package/.agents/skills/common/project-init/references/custom-rule-generation.md +89 -89
- package/.agents/skills/common/project-init/references/deep-scan-rules.md +67 -67
- package/.agents/skills/common/project-init/references/output-contracts.md +71 -71
- package/.agents/skills/common/project-init/references/repo-fact-gathering.md +83 -83
- package/.agents/skills/common/project-init/references/scope-resolution.md +76 -76
- package/.agents/skills/common/project-init/scripts/inspect-project.js +112 -112
- package/.agents/skills/common/skill-creator/LICENSE.txt +201 -201
- package/.agents/skills/common/skill-creator/SKILL.md +370 -370
- package/.agents/skills/common/skill-creator/evals/evals.json +16 -16
- package/.agents/skills/common/skill-creator/evals/train_queries.json +18 -18
- package/.agents/skills/common/skill-creator/evals/validation_queries.json +18 -18
- package/.agents/skills/common/skill-creator/references/output-patterns.md +82 -82
- package/.agents/skills/common/skill-creator/references/workflows.md +27 -27
- package/.agents/skills/common/skill-creator/scripts/init_skill.py +209 -209
- package/.agents/skills/common/skill-creator/scripts/package_skill.py +110 -110
- package/.agents/skills/common/skill-creator/scripts/quick_validate.py +51 -51
- package/.agents/skills/common/skill-optimizer/SKILL.md +102 -102
- package/.agents/skills/common/skill-optimizer/evals/evals.json +16 -16
- package/.agents/skills/common/skill-optimizer/evals/train_queries.json +18 -18
- package/.agents/skills/common/skill-optimizer/evals/validation_queries.json +18 -18
- package/.agents/skills/common/skill-optimizer/references/design-patterns.md +26 -26
- package/.agents/skills/common/skill-optimizer/references/review-checklist.md +22 -22
- package/.agents/skills/common/using-superpowers/SKILL.md +151 -151
- package/.agents/skills/common/wait-for-gate-signal/SKILL.md +85 -85
- package/.agents/skills/domains/README.md +19 -19
- package/.agents/skills/domains/ui-ux-pro-max/SKILL.md +58 -58
- package/.agents/skills/domains/web/design-analysis/SKILL.md +89 -89
- package/.agents/skills/domains/web/design-analysis/rules/analysis-order.md +61 -61
- package/.agents/skills/domains/web/design-analysis/rules/analysis-priorities.md +136 -136
- package/.agents/skills/domains/web/design-analysis/rules/checklist-common-misses.md +107 -107
- package/.agents/skills/domains/web/design-analysis/rules/implementation-common-errors.md +204 -204
- package/.agents/skills/domains/web/design-analysis/rules/implementation-guidelines.md +211 -211
- package/.agents/skills/domains/web/design-analysis/rules/output-analysis-checklist.md +247 -247
- package/.agents/skills/domains/web/design-analysis/rules/tools-design-guidelines.md +108 -108
- package/.agents/skills/domains/web/design-analysis/rules/workflow-element-extraction.md +162 -162
- package/.agents/skills/domains/web/design-analysis/rules/workflow-layout-map.md +131 -131
- package/.agents/skills/domains/web/design-analysis/rules/workflow-output-checklist.md +70 -70
- package/.agents/skills/domains/web/design-analysis/rules/workflow-style-summary.md +91 -91
- package/.agents/skills/domains/web/route-permission-map/SKILL.md +103 -103
- package/.agents/skills/domains/web/ui-verification/SKILL.md +114 -114
- package/.agents/skills/domains/web/ui-verification/evals/evals.json +16 -16
- package/.agents/skills/domains/web/ui-verification/evals/train_queries.json +18 -18
- package/.agents/skills/domains/web/ui-verification/evals/validation_queries.json +18 -18
- package/.agents/skills/domains/web/ui-verification/rules/comparison-content-image.md +34 -34
- package/.agents/skills/domains/web/ui-verification/rules/comparison-content-text.md +30 -30
- package/.agents/skills/domains/web/ui-verification/rules/comparison-hierarchy.md +33 -33
- package/.agents/skills/domains/web/ui-verification/rules/comparison-layout.md +35 -35
- package/.agents/skills/domains/web/ui-verification/rules/errors-alignment.md +42 -42
- package/.agents/skills/domains/web/ui-verification/rules/errors-button-dimensions.md +28 -28
- package/.agents/skills/domains/web/ui-verification/rules/errors-button-position.md +25 -25
- package/.agents/skills/domains/web/ui-verification/rules/errors-css-priority.md +50 -50
- package/.agents/skills/domains/web/ui-verification/rules/errors-flex-column-width.md +46 -46
- package/.agents/skills/domains/web/ui-verification/rules/errors-flex-layout.md +46 -46
- package/.agents/skills/domains/web/ui-verification/rules/errors-grid-container-width.md +44 -44
- package/.agents/skills/domains/web/ui-verification/rules/errors-page-container-width.md +39 -39
- package/.agents/skills/domains/web/ui-verification/rules/tools-browser-navigation.md +53 -53
- package/.agents/skills/domains/web/ui-verification/rules/tools-design-guidelines.md +53 -53
- package/.agents/skills/domains/web/ui-verification/rules/workflow-checklist.md +27 -27
- package/.agents/skills/domains/web/ui-verification/rules/workflow-problem-list.md +56 -56
- package/.agents/skills/domains/web/ui-verification/rules/workflow-reflection.md +44 -44
- package/.agents/skills/domains/web/ui-verification/rules/writing-alignment.md +44 -44
- package/.agents/skills/domains/web/ui-verification/rules/writing-element-completeness.md +63 -63
- package/.agents/skills/domains/web/ui-verification/rules/writing-list-layout.md +75 -75
- package/.agents/skills/domains/web/ui-verification/rules/writing-page-container-width.md +37 -37
- package/.agents/skills/domains/web/web-design-guidelines/SKILL.md +40 -40
- package/.agents/skills/profiles/nestjs/README.md +4 -4
- package/.agents/skills/profiles/node-tooling/README.md +9 -9
- package/.agents/skills/profiles/react/create-api/SKILL.md +145 -145
- package/.agents/skills/profiles/react/create-component/SKILL.md +160 -160
- package/.agents/skills/profiles/react/create-route/SKILL.md +168 -168
- package/.agents/skills/profiles/react/create-store/SKILL.md +262 -262
- package/.agents/skills/profiles/react/theme-variables/SKILL.md +82 -82
- package/.agents/skills/profiles/react/vercel-composition-patterns/AGENTS.md +899 -899
- package/.agents/skills/profiles/react/vercel-composition-patterns/SKILL.md +81 -81
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -100
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/architecture-compound-components.md +112 -112
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/patterns-children-over-render-props.md +87 -87
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/patterns-explicit-variants.md +100 -100
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/state-context-interface.md +191 -191
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/state-decouple-implementation.md +113 -113
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/state-lift-state.md +125 -125
- package/.agents/skills/profiles/react/vercel-react-best-practices/AGENTS.md +2934 -2934
- package/.agents/skills/profiles/react/vercel-react-best-practices/SKILL.md +136 -136
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -55
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/advanced-init-once.md +42 -42
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/advanced-use-latest.md +39 -39
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-api-routes.md +38 -38
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-defer-await.md +80 -80
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-dependencies.md +51 -51
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-parallel.md +28 -28
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -99
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -59
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-conditional.md +31 -31
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -49
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -35
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-preload.md +50 -50
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-event-listeners.md +74 -74
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -71
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -48
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-swr-dedup.md +56 -56
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -107
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-cache-function-results.md +80 -80
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-cache-property-access.md +28 -28
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-cache-storage.md +70 -70
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-combine-iterations.md +32 -32
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-early-exit.md +50 -50
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -45
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-index-maps.md +37 -37
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-length-check-first.md +49 -49
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-min-max-loop.md +82 -82
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -24
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -57
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-activity.md +26 -26
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -47
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -40
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -38
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -46
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -82
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -30
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -28
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -75
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -39
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-dependencies.md +45 -45
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -40
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-derived-state.md +29 -29
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -74
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -58
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -38
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-memo.md +44 -44
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -45
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -35
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-transitions.md +40 -40
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -73
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -73
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-auth-actions.md +96 -96
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-cache-lru.md +41 -41
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-cache-react.md +76 -76
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-dedup-props.md +65 -65
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -83
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-serialization.md +38 -38
- package/.agents/skills/profiles/springboot/README.md +10 -10
- package/.agents/skills/profiles/vue/create-api/SKILL.md +105 -105
- package/.agents/skills/profiles/vue/create-component/SKILL.md +76 -76
- package/.agents/skills/profiles/vue/create-route/SKILL.md +141 -141
- package/.agents/skills/profiles/vue/create-store/SKILL.md +97 -97
- package/.agents/skills/profiles/vue/create-view/SKILL.md +81 -81
- package/.agents/skills/profiles/vue/theme-variables/SKILL.md +73 -73
- package/.agents/skills/profiles/vue/vue-best-practices/SKILL.md +166 -166
- package/.agents/skills/profiles/vue/vue-best-practices/references/animation-class-based-technique.md +254 -254
- package/.agents/skills/profiles/vue/vue-best-practices/references/animation-state-driven-technique.md +291 -291
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-async.md +97 -97
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-data-flow.md +307 -307
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-fallthrough-attrs.md +174 -174
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-keep-alive.md +137 -137
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-slots.md +216 -216
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-suspense.md +228 -228
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-teleport.md +108 -108
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-transition-group.md +128 -128
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-transition.md +125 -125
- package/.agents/skills/profiles/vue/vue-best-practices/references/composables.md +290 -290
- package/.agents/skills/profiles/vue/vue-best-practices/references/directives.md +162 -162
- package/.agents/skills/profiles/vue/vue-best-practices/references/perf-avoid-component-abstraction-in-lists.md +159 -159
- package/.agents/skills/profiles/vue/vue-best-practices/references/perf-v-once-v-memo-directives.md +182 -182
- package/.agents/skills/profiles/vue/vue-best-practices/references/perf-virtualize-large-lists.md +187 -187
- package/.agents/skills/profiles/vue/vue-best-practices/references/plugins.md +166 -166
- package/.agents/skills/profiles/vue/vue-best-practices/references/reactivity.md +344 -344
- package/.agents/skills/profiles/vue/vue-best-practices/references/render-functions.md +201 -201
- package/.agents/skills/profiles/vue/vue-best-practices/references/sfc.md +310 -310
- package/.agents/skills/profiles/vue/vue-best-practices/references/state-management.md +135 -135
- package/.agents/skills/profiles/vue/vue-best-practices/references/updated-hook-performance.md +187 -187
- package/.agents/templates/common/README.md +23 -23
- package/.agents/templates/common/bugfix.md +22 -22
- package/.agents/templates/common/create-expert-package.md +458 -458
- package/.agents/templates/common/mock-page.md +28 -28
- package/.agents/templates/common/new-component.md +25 -25
- package/.agents/templates/common/new-page.md +31 -31
- package/.cursor/mcp.json +35 -35
- package/.qoder/mcp.json +26 -26
- package/bin/archive-change.js +560 -474
- package/bin/check-command.js +62 -62
- package/bin/cli.js +0 -0
- package/bin/command-template-renderer.js +40 -40
- package/bin/context-command.js +102 -102
- package/bin/demo-runtime-smoke.js +760 -760
- package/bin/execution-semantics.js +821 -821
- package/bin/executor-command.js +93 -93
- package/bin/expert-dispatch.js +334 -334
- package/bin/expert-executor.js +1148 -1148
- package/bin/guard-command.js +52 -52
- package/bin/hub-command.js +876 -876
- package/bin/ide-command.js +242 -242
- package/bin/init-command.js +193 -193
- package/bin/install-workflow.js +35 -3
- package/bin/manifest-export.js +34 -34
- package/bin/profile-registry.js +90 -90
- package/bin/protocol-workflow.js +452 -446
- package/bin/repair-command.js +161 -161
- package/bin/repo-map.js +177 -177
- package/bin/report-command.js +236 -236
- package/bin/runtime-bootstrap.js +428 -428
- package/bin/runtime-embedded.js +101 -101
- package/bin/runtime-fallback.js +106 -106
- package/bin/runtime-launcher.js +116 -116
- package/bin/runtime-paths.js +177 -177
- package/bin/runtime-registry.js +289 -289
- package/bin/runtime-state.js +2541 -2541
- package/bin/scan.js +96 -96
- package/bin/self-upgrade.js +206 -206
- package/bin/skill-spec-validator.js +457 -457
- package/bin/spec-command.js +366 -366
- package/bin/superpowers.js +384 -384
- package/bin/sync-command.js +59 -59
- package/bin/sync.js +1904 -1904
- package/bin/task-orchestrator-adapter.js +341 -341
- package/bin/task-orchestrator-extractor.js +274 -274
- package/bin/task-orchestrator-runner.js +1208 -1208
- package/bin/telemetry/README.md +66 -66
- package/bin/telemetry/aspect.js +153 -153
- package/bin/telemetry/collect.js +67 -67
- package/bin/telemetry/config.js +114 -114
- package/bin/telemetry/defaults.json +5 -5
- package/bin/telemetry/healthcheck.js +195 -195
- package/bin/telemetry/identity.js +53 -53
- package/bin/telemetry/index.js +25 -25
- package/bin/telemetry/reporter.js +83 -83
- package/bin/telemetry/safe.js +39 -39
- package/bin/validate-registry.js +740 -740
- package/bin/visual-bridge-config.js +117 -117
- package/bin/visual-bridge.js +287 -287
- package/bin/visual-command.js +432 -432
- package/bin/worktree-command.js +194 -194
- package/configs/common/.editorconfig +15 -15
- package/configs/common/.husky/commit-msg +4 -4
- package/configs/common/.husky/pre-commit +4 -4
- package/configs/common/.lintstagedrc +11 -11
- package/configs/common/.prettierignore +11 -11
- package/configs/common/.prettierrc.json +11 -11
- package/configs/common/.stylelintignore +14 -14
- package/configs/common/.stylelintrc.json +21 -21
- package/configs/common/commitlint.config.js +3 -3
- package/configs/profiles/nestjs/.gitkeep +1 -1
- package/configs/profiles/node-tooling/.gitkeep +1 -1
- package/configs/profiles/react/.eslintignore +6 -6
- package/configs/profiles/react/.eslintrc.js +16 -16
- package/configs/profiles/react/.stylelintrc.json +18 -18
- package/configs/profiles/springboot/.gitkeep +1 -1
- package/configs/profiles/vue/.eslintignore +6 -6
- package/configs/profiles/vue/.eslintrc.cjs +17 -17
- package/contracts/README.md +28 -28
- package/contracts/fixtures/asset-package.fixture.json +26 -26
- package/contracts/fixtures/asset-usage-feedback.fixture.json +14 -14
- package/contracts/fixtures/evidence-report.fixture.json +28 -28
- package/contracts/fixtures/manifest.fixture.json +20 -20
- package/contracts/fixtures/run-event.fixture.json +15 -15
- package/contracts/schemas/asset-package.schema.json +76 -76
- package/contracts/schemas/asset-usage-feedback.schema.json +57 -57
- package/contracts/schemas/evidence-report.schema.json +60 -60
- package/contracts/schemas/manifest.schema.json +63 -63
- package/contracts/schemas/run-event.schema.json +72 -72
- package/install.ps1 +35 -35
- package/install.sh +17 -17
- package/internal/ai-protocol-workflow.js +5824 -5600
- package/internal/hub-client.js +98 -98
- package/internal/hub-sync-selection.js +69 -69
- package/internal/visual-hooks/README.md +481 -481
- package/internal/visual-hooks/config-loader.js +218 -218
- package/internal/visual-hooks/control-puller.js +206 -206
- package/internal/visual-hooks/gate-signal.js +150 -150
- package/internal/visual-hooks/inbox-consumer.js +469 -469
- package/internal/visual-hooks/index.js +197 -197
- package/internal/visual-hooks/push-client.js +189 -189
- package/internal/visual-hooks/receipt-pusher.js +176 -176
- package/internal/visual-hooks/runtime-state-pusher.js +128 -128
- package/openspec/config.yaml.template +52 -52
- package/openspec/schemas/expert-delivery/schema.yaml +68 -68
- package/openspec/schemas/expert-delivery/templates/checklist.md +39 -39
- package/openspec/schemas/expert-delivery/templates/design.md +61 -61
- package/openspec/schemas/expert-delivery/templates/iterations.md +25 -25
- package/openspec/schemas/expert-delivery/templates/proposal.md +45 -45
- package/openspec/schemas/expert-delivery/templates/spec.md +29 -29
- package/openspec/schemas/expert-delivery/templates/tasks.md +24 -24
- package/package.json +1 -1
- package/scripts/acceptance-zero-intrusion.sh +168 -168
- package/scripts/hub-sync-assets.config.example.json +296 -296
- package/scripts/hub-sync-assets.js +2038 -2038
- package/scripts/local-verify.sh +280 -280
- package/scripts/post-publish-auto-fix-check.js +404 -404
- package/scripts/post-publish-verify.sh +175 -175
- package/scripts/setup-cursor-manual-test.sh +107 -107
- package/scripts/setup-cursor-spec-archive-test.sh +111 -111
- package/scripts/setup-visual-integration.sh +225 -225
- package/scripts/test-integration.sh +176 -176
- package/scripts/update-test-project.sh +93 -93
- package/scripts/upload-four-web.sh +57 -57
- package/scripts/verify-install-ps1-bom.js +26 -26
- package/src/agent/agent-context.js +259 -259
- package/src/agent/agent-profile.js +185 -185
- package/src/agent/agent-templates.js +161 -161
- package/src/agent/agent-types.js +108 -108
- package/src/agent/collaboration-protocol.js +333 -333
- package/src/agent/conflict-handler.js +364 -364
- package/src/agent/file-permission.js +121 -121
- package/src/agent/index.js +38 -38
- package/src/agent/permission-audit.js +151 -151
- package/src/agent/review-repair-loop.js +270 -270
- package/src/agent/tool-permission.js +101 -101
- package/src/asset/asset-dependency.js +322 -322
- package/src/asset/asset-feedback.js +350 -350
- package/src/asset/asset-fork.js +300 -300
- package/src/asset/asset-install.js +278 -278
- package/src/asset/asset-installer.js +497 -497
- package/src/asset/asset-lifecycle.js +324 -324
- package/src/asset/asset-manager.js +245 -245
- package/src/asset/asset-package-manager.js +349 -349
- package/src/asset/asset-package.js +186 -186
- package/src/asset/asset-quality.js +262 -262
- package/src/asset/asset-registry.js +387 -387
- package/src/asset/asset-version.js +293 -293
- package/src/asset/index.js +86 -86
- package/src/cache/agent-profile-cache.js +59 -59
- package/src/cache/asset-cache.js +63 -63
- package/src/cache/global-cache.js +61 -61
- package/src/cache/manifest-cache.js +30 -30
- package/src/check/check-service.js +32 -32
- package/src/config/config-layer.js +343 -343
- package/src/config/config-loader.js +60 -60
- package/src/config/defaults.js +49 -49
- package/src/connectors/hub/asset-package.js +72 -72
- package/src/connectors/hub/asset-usage-feedback.js +46 -46
- package/src/connectors/hub/hub-connector.js +44 -44
- package/src/connectors/hub/index.js +21 -21
- package/src/connectors/visual/evidence-report.js +49 -49
- package/src/connectors/visual/index.js +15 -15
- package/src/connectors/visual/queue.js +41 -41
- package/src/connectors/visual/run-event.js +81 -81
- package/src/connectors/visual/visual-connector.js +77 -77
- package/src/context/context-budget.js +59 -59
- package/src/context/context-builder.js +285 -285
- package/src/context/context-loader.js +116 -116
- package/src/context/context-planner.js +158 -158
- package/src/context/types.js +96 -96
- package/src/contracts/index.js +63 -63
- package/src/executor/executor-registry.js +78 -78
- package/src/executor/executor-result-parser.js +44 -44
- package/src/executor/executor-runner.js +141 -141
- package/src/executor/executor-selector.js +139 -139
- package/src/executor/executor-timeout.js +36 -36
- package/src/executor/providers/base-provider-utils.js +189 -189
- package/src/executor/providers/claude-code-executor-provider.js +128 -128
- package/src/executor/providers/codex-executor-provider.js +126 -126
- package/src/executor/providers/cursor-executor-provider.js +99 -99
- package/src/executor/types.js +137 -137
- package/src/git/branch-manager.js +71 -71
- package/src/git/dirty-checker.js +43 -43
- package/src/git/dirty-strategy-handler.js +29 -29
- package/src/git/git-command.js +37 -37
- package/src/git/git-repository-detector.js +45 -45
- package/src/git/multi-repo-worktree-planner.js +88 -88
- package/src/git/policy.js +19 -19
- package/src/git/strategies/block-dirty-strategy.js +34 -34
- package/src/git/strategies/ignore-dirty-strategy.js +33 -33
- package/src/git/strategies/patch-snapshot-strategy.js +53 -53
- package/src/git/strategies/wip-commit-strategy.js +38 -38
- package/src/git/types.js +71 -71
- package/src/git/worktree-manager.js +85 -85
- package/src/governance/asset-review.js +351 -351
- package/src/governance/audit-log.js +368 -368
- package/src/governance/gray-release.js +312 -312
- package/src/governance/index.js +31 -31
- package/src/governance/policy-types.js +56 -56
- package/src/governance/rbac-types.js +171 -171
- package/src/governance/rbac.js +382 -382
- package/src/governance/rollback.js +360 -360
- package/src/governance/security-policy.js +354 -354
- package/src/hook/hook-config-writer.js +125 -125
- package/src/hub/hub-client.js +186 -186
- package/src/hub/hub-config.js +39 -39
- package/src/hub/project-facts.js +31 -31
- package/src/hub/runtime-feedback-reporter.js +55 -55
- package/src/ide/adapters/adapter-protocol.js +385 -385
- package/src/ide/adapters/claude-adapter.js +419 -419
- package/src/ide/adapters/codex-adapter.js +60 -60
- package/src/ide/adapters/cursor-adapter.js +484 -484
- package/src/ide/adapters/index.js +24 -24
- package/src/ide/anchors/markdown-anchor-writer.js +152 -152
- package/src/ide/ide-service.js +270 -270
- package/src/ide/ide-types.js +94 -94
- package/src/ide/links/link-mode-resolver.js +160 -160
- package/src/ide/registry/ide-registry-builder.js +165 -165
- package/src/incident/incident-writer.js +47 -47
- package/src/incident/types.js +22 -22
- package/src/init/ide-linker.js +126 -126
- package/src/init/ide-pointer-injector.js +75 -75
- package/src/init/init-applier.js +197 -197
- package/src/init/init-plan.js +294 -294
- package/src/init/init-service.js +65 -65
- package/src/init/manifest-installer.js +302 -302
- package/src/init/types.js +26 -26
- package/src/project/config-writer.js +83 -83
- package/src/project/context-index-writer.js +82 -82
- package/src/project/json-utils.js +72 -72
- package/src/project/local-state-writer.js +50 -50
- package/src/project/lock-file-writer.js +98 -98
- package/src/project/manifest-writer.js +126 -126
- package/src/project/policy-config-writer.js +91 -91
- package/src/project/project-config-writer.js +74 -74
- package/src/project/project-files.js +39 -39
- package/src/project/registry-index-writer.js +43 -43
- package/src/project/workspace-config-writer.js +63 -63
- package/src/run/index.js +11 -11
- package/src/run/run-id.js +32 -32
- package/src/run/run-service.js +269 -269
- package/src/run/run-store.js +80 -80
- package/src/scanner/aggregator/detection-aggregator.js +23 -23
- package/src/scanner/boundary/boundary-resolver.js +229 -229
- package/src/scanner/detectors/detector-registry.js +44 -44
- package/src/scanner/detectors/fastapi-detector.js +46 -46
- package/src/scanner/detectors/go-detector.js +46 -46
- package/src/scanner/detectors/nestjs-detector.js +57 -57
- package/src/scanner/detectors/nextjs-detector.js +52 -52
- package/src/scanner/detectors/react-vite-detector.js +52 -52
- package/src/scanner/detectors/react-webpack-detector.js +57 -57
- package/src/scanner/detectors/springboot-detector.js +46 -46
- package/src/scanner/detectors/springcloud-detector.js +46 -46
- package/src/scanner/detectors/springmvc-detector.js +46 -46
- package/src/scanner/detectors/vue-vite-detector.js +52 -52
- package/src/scanner/engine.js +72 -72
- package/src/scanner/facts/fact-extractor.js +211 -211
- package/src/scanner/types.js +30 -30
- package/src/security/asset-tamper-checker.js +188 -188
- package/src/security/checksum.js +40 -40
- package/src/spec/spec-writer.js +302 -302
- package/src/state-machine/circuit-breaker.js +112 -112
- package/src/state-machine/escape-hatch.js +49 -49
- package/src/state-machine/stage-runner.js +281 -281
- package/src/state-machine/state-machine.js +24 -24
- package/src/state-machine/transition-guard.js +36 -36
- package/src/state-machine/types.js +37 -37
- package/src/sync/sync-service.js +192 -192
- package/src/visual/agent-visual.js +142 -142
- package/src/visual/event-gateway.js +357 -357
- package/src/visual/event-mapper.js +128 -128
- package/src/visual/hook-dashboard.js +216 -216
- package/src/visual/index.js +27 -27
- package/src/visual/metrics.js +287 -287
- package/src/visual/privacy-filter.js +100 -100
- package/src/visual/risk-board.js +252 -252
- package/src/visual/timeline.js +245 -245
- package/src/visual/visual-client.js +94 -94
- package/src/visual/visual-config.js +40 -40
- package/src/visual/visual-reporter.js +88 -88
|
@@ -1,760 +1,760 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const protocolWorkflow = require('../internal/ai-protocol-workflow');
|
|
5
|
-
const { archiveChange } = require('./archive-change');
|
|
6
|
-
const runner = require('./task-orchestrator-runner');
|
|
7
|
-
|
|
8
|
-
const pkgRoot = path.join(__dirname, '..');
|
|
9
|
-
const defaultTarget = path.join(process.cwd(), '.tmp', 'runtime-smoke-demo');
|
|
10
|
-
|
|
11
|
-
function parseArgs(argv) {
|
|
12
|
-
const args = [...argv];
|
|
13
|
-
const options = {
|
|
14
|
-
target: defaultTarget,
|
|
15
|
-
userInput: '新增一个商品 mock 页面',
|
|
16
|
-
json: false,
|
|
17
|
-
pretty: true,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
while (args.length > 0) {
|
|
21
|
-
const arg = args.shift();
|
|
22
|
-
|
|
23
|
-
if (!arg.startsWith('-') && options.target === defaultTarget) {
|
|
24
|
-
options.target = arg;
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
switch (arg) {
|
|
29
|
-
case '--target':
|
|
30
|
-
options.target = args.shift();
|
|
31
|
-
break;
|
|
32
|
-
case '--user-input':
|
|
33
|
-
options.userInput = args.shift();
|
|
34
|
-
break;
|
|
35
|
-
case '--json':
|
|
36
|
-
options.json = true;
|
|
37
|
-
options.pretty = false;
|
|
38
|
-
break;
|
|
39
|
-
case '--pretty':
|
|
40
|
-
options.pretty = true;
|
|
41
|
-
options.json = false;
|
|
42
|
-
break;
|
|
43
|
-
case '--help':
|
|
44
|
-
case '-h':
|
|
45
|
-
options.help = true;
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
throw new Error(`Unknown argument: ${arg}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return options;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function printUsage() {
|
|
56
|
-
console.log(`Usage:
|
|
57
|
-
ai-spec-auto demo-runtime-smoke [target] [options]
|
|
58
|
-
|
|
59
|
-
Options:
|
|
60
|
-
--target <dir> Demo target directory (default: ./.tmp/runtime-smoke-demo)
|
|
61
|
-
--user-input <text> Demo requirement text
|
|
62
|
-
--json Print JSON only
|
|
63
|
-
--pretty Print readable summary (default)
|
|
64
|
-
--help Show this help
|
|
65
|
-
`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function ensureEmptyTarget(targetDir) {
|
|
69
|
-
if (!fs.existsSync(targetDir)) {
|
|
70
|
-
fs.mkdirSync(targetDir, { recursive: true });
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const entries = fs.readdirSync(targetDir);
|
|
75
|
-
if (entries.length > 0) {
|
|
76
|
-
throw new Error(`Demo target is not empty: ${targetDir}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function ensureDir(dirPath) {
|
|
81
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function writeFile(targetDir, relPath, content) {
|
|
85
|
-
const filePath = path.join(targetDir, relPath);
|
|
86
|
-
ensureDir(path.dirname(filePath));
|
|
87
|
-
fs.writeFileSync(filePath, content.endsWith('\n') ? content : `${content}\n`, 'utf8');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function writeJson(targetDir, relPath, value) {
|
|
91
|
-
writeFile(targetDir, relPath, `${JSON.stringify(value, null, 2)}\n`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function copyDirRecursive(sourceDir, targetDir) {
|
|
95
|
-
ensureDir(targetDir);
|
|
96
|
-
for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
97
|
-
const sourcePath = path.join(sourceDir, entry.name);
|
|
98
|
-
const targetPath = path.join(targetDir, entry.name);
|
|
99
|
-
if (entry.isDirectory()) {
|
|
100
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
ensureDir(path.dirname(targetPath));
|
|
104
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function buildRunId() {
|
|
109
|
-
const now = new Date();
|
|
110
|
-
const pad = (value) => String(value).padStart(2, '0');
|
|
111
|
-
return [
|
|
112
|
-
'run',
|
|
113
|
-
`${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`,
|
|
114
|
-
`${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`,
|
|
115
|
-
'demo',
|
|
116
|
-
].join('_');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function scaffoldDemoTarget(targetDir) {
|
|
120
|
-
ensureEmptyTarget(targetDir);
|
|
121
|
-
|
|
122
|
-
writeFile(targetDir, 'package.json', JSON.stringify({
|
|
123
|
-
name: 'runtime-smoke-demo',
|
|
124
|
-
private: true,
|
|
125
|
-
scripts: {
|
|
126
|
-
build: 'node -e "process.exit(0)"',
|
|
127
|
-
lint: 'node -e "process.exit(0)"',
|
|
128
|
-
test: 'node -e "process.exit(0)"',
|
|
129
|
-
},
|
|
130
|
-
dependencies: {
|
|
131
|
-
vue: '^3.5.0',
|
|
132
|
-
'vue-router': '^4.4.0',
|
|
133
|
-
pinia: '^3.0.0',
|
|
134
|
-
vite: '^6.0.0',
|
|
135
|
-
},
|
|
136
|
-
devDependencies: {
|
|
137
|
-
typescript: '^5.0.0',
|
|
138
|
-
},
|
|
139
|
-
}, null, 2));
|
|
140
|
-
writeFile(targetDir, 'pnpm-lock.yaml', 'lockfileVersion: 9.0');
|
|
141
|
-
writeFile(targetDir, 'src/router/index.ts', [
|
|
142
|
-
'export const routes = [];',
|
|
143
|
-
'export const router = { routes };',
|
|
144
|
-
].join('\n'));
|
|
145
|
-
writeFile(targetDir, 'src/router/modules/demo.ts', 'export default [];');
|
|
146
|
-
writeFile(targetDir, 'src/views/demo/index.vue', '<template><div>demo entry</div></template>');
|
|
147
|
-
writeFile(targetDir, 'src/api/order.ts', 'export function getOrderListApi() { return []; }');
|
|
148
|
-
writeFile(targetDir, 'src/api/types/order.ts', 'export interface Order { id: string; }');
|
|
149
|
-
writeFile(targetDir, 'src/mock/order.ts', 'export const orderMock = [];');
|
|
150
|
-
writeFile(targetDir, 'src/store/modules/demo/index.ts', 'export const useDemoStore = () => ({})');
|
|
151
|
-
writeFile(targetDir, 'src/styles/variables.scss', ':root {}');
|
|
152
|
-
writeFile(targetDir, 'context/PROJECT.md', [
|
|
153
|
-
'# PROJECT',
|
|
154
|
-
'',
|
|
155
|
-
'- Framework: Vue 3',
|
|
156
|
-
'- Language: TypeScript',
|
|
157
|
-
'- Goal: runtime smoke demo for expert-delivery flow',
|
|
158
|
-
].join('\n'));
|
|
159
|
-
|
|
160
|
-
const configTemplate = path.join(pkgRoot, 'openspec', 'config.yaml.template');
|
|
161
|
-
writeFile(targetDir, path.join('openspec', 'config.yaml'), fs.readFileSync(configTemplate, 'utf8'));
|
|
162
|
-
|
|
163
|
-
const schemaSource = path.join(pkgRoot, 'openspec', 'schemas', 'expert-delivery');
|
|
164
|
-
const schemaTarget = path.join(targetDir, 'openspec', 'schemas', 'expert-delivery');
|
|
165
|
-
copyDirRecursive(schemaSource, schemaTarget);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function createBootstrapPayload(runId, userInput, changeId) {
|
|
169
|
-
return {
|
|
170
|
-
schema_version: 1,
|
|
171
|
-
kind: 'task-orchestrator-bootstrap',
|
|
172
|
-
run_plan: {
|
|
173
|
-
schema_version: 1,
|
|
174
|
-
kind: 'run-plan',
|
|
175
|
-
run_id: runId,
|
|
176
|
-
status: 'planned',
|
|
177
|
-
review_policy: 'main-flow-blocking',
|
|
178
|
-
task: {
|
|
179
|
-
type: 'page-development',
|
|
180
|
-
raw_input: userInput,
|
|
181
|
-
input_kind: 'natural-language',
|
|
182
|
-
risk_level: 'low',
|
|
183
|
-
},
|
|
184
|
-
flow: {
|
|
185
|
-
id: 'prd-to-delivery',
|
|
186
|
-
name: '需求到交付',
|
|
187
|
-
source: 'runtime-smoke-demo',
|
|
188
|
-
},
|
|
189
|
-
artifacts: [
|
|
190
|
-
`openspec/changes/${changeId}/proposal.md`,
|
|
191
|
-
`openspec/changes/${changeId}/specs/`,
|
|
192
|
-
`openspec/changes/${changeId}/design.md`,
|
|
193
|
-
`openspec/changes/${changeId}/tasks.md`,
|
|
194
|
-
'code',
|
|
195
|
-
`openspec/changes/${changeId}/checklist.md`,
|
|
196
|
-
`openspec/changes/${changeId}/iterations.md`,
|
|
197
|
-
],
|
|
198
|
-
plan: {
|
|
199
|
-
required_roles: [
|
|
200
|
-
'requirement-analyst',
|
|
201
|
-
'frontend-implementer',
|
|
202
|
-
'code-guardian',
|
|
203
|
-
],
|
|
204
|
-
activated_optional_roles: [],
|
|
205
|
-
skipped_optional_roles: [],
|
|
206
|
-
first_handoff: 'requirement-analyst',
|
|
207
|
-
approval_gates: ['before-implementation', 'before-archive'],
|
|
208
|
-
review_policy: 'main-flow-blocking',
|
|
209
|
-
},
|
|
210
|
-
missing_inputs: [
|
|
211
|
-
'组件目录位置未明确,采用最小 mock 页面默认结构',
|
|
212
|
-
],
|
|
213
|
-
warnings: [],
|
|
214
|
-
errors: [],
|
|
215
|
-
next_action: '先交给 requirement-analyst 收敛任务',
|
|
216
|
-
},
|
|
217
|
-
task_anchor: {
|
|
218
|
-
schema_version: 1,
|
|
219
|
-
kind: 'task-anchor',
|
|
220
|
-
run_id: runId,
|
|
221
|
-
task: {
|
|
222
|
-
raw_goal: userInput,
|
|
223
|
-
change_id: changeId,
|
|
224
|
-
input_kind: 'natural-language',
|
|
225
|
-
},
|
|
226
|
-
stage: {
|
|
227
|
-
flow_id: 'prd-to-delivery',
|
|
228
|
-
current_role: 'requirement-analyst',
|
|
229
|
-
next_role: 'frontend-implementer',
|
|
230
|
-
},
|
|
231
|
-
constraints: {
|
|
232
|
-
rules: ['component-standard'],
|
|
233
|
-
must_not: ['不要跳过规则检查'],
|
|
234
|
-
},
|
|
235
|
-
artifacts: {
|
|
236
|
-
proposal: `openspec/changes/${changeId}/proposal.md`,
|
|
237
|
-
specs: `openspec/changes/${changeId}/specs/`,
|
|
238
|
-
design: `openspec/changes/${changeId}/design.md`,
|
|
239
|
-
tasks: `openspec/changes/${changeId}/tasks.md`,
|
|
240
|
-
},
|
|
241
|
-
expected_output: [
|
|
242
|
-
'补齐 proposal',
|
|
243
|
-
'输出 specs',
|
|
244
|
-
'输出 design',
|
|
245
|
-
'输出 tasks',
|
|
246
|
-
'列出缺失输入',
|
|
247
|
-
],
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function createExecutionPayload(runId, roleId, roleName, executionSteps) {
|
|
253
|
-
return {
|
|
254
|
-
schema_version: 1,
|
|
255
|
-
kind: 'expert-execution',
|
|
256
|
-
run_id: runId,
|
|
257
|
-
status: 'completed',
|
|
258
|
-
role: {
|
|
259
|
-
id: roleId,
|
|
260
|
-
name: roleName,
|
|
261
|
-
},
|
|
262
|
-
flow: {
|
|
263
|
-
id: 'prd-to-delivery',
|
|
264
|
-
},
|
|
265
|
-
execution_plan: {
|
|
266
|
-
execution_steps: executionSteps,
|
|
267
|
-
},
|
|
268
|
-
markdown: `# ${roleId} execution`,
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function writeRequirementArtifacts(targetDir, changeId) {
|
|
273
|
-
writeFile(targetDir, `openspec/changes/${changeId}/proposal.md`, [
|
|
274
|
-
`# 变更提案:${changeId}`,
|
|
275
|
-
'',
|
|
276
|
-
'## 目标',
|
|
277
|
-
'',
|
|
278
|
-
'### 业务目标',
|
|
279
|
-
'- 新增一个商品 mock 页面,用于验证 expert-delivery 主链可运行。',
|
|
280
|
-
'',
|
|
281
|
-
'### 工程目标',
|
|
282
|
-
'- 验证 proposal、design、tasks、checklist、iterations 这组模板化产物可以支撑主链闭环。',
|
|
283
|
-
'',
|
|
284
|
-
'### 变更对象与入口',
|
|
285
|
-
'- 页面入口:`src/views/products/mock/index.vue`',
|
|
286
|
-
'- 路由入口:`src/router/modules/products.ts`',
|
|
287
|
-
'- 数据入口:`src/mock/products.ts`',
|
|
288
|
-
'',
|
|
289
|
-
'### 设计链接',
|
|
290
|
-
'- 当前示例没有独立 Figma(设计稿),以 runtime smoke 需求文案和仓库约定作为设计输入。',
|
|
291
|
-
'',
|
|
292
|
-
'### 组件复用约束(可选)',
|
|
293
|
-
'- 当前示例优先复用现有 Vue 目录结构和最小页面约定,不额外引入组件库封装。',
|
|
294
|
-
'',
|
|
295
|
-
'## 范围',
|
|
296
|
-
'',
|
|
297
|
-
'### In Scope(纳入范围)',
|
|
298
|
-
'- 新增商品 mock 页面。',
|
|
299
|
-
'- 新增最小路由模块。',
|
|
300
|
-
'- 新增最小 mock 数据。',
|
|
301
|
-
'- 输出结构化的 design、tasks、checklist 和 iterations。',
|
|
302
|
-
'',
|
|
303
|
-
'### Out of Scope(排除范围)',
|
|
304
|
-
'- 不接真实 API(接口)。',
|
|
305
|
-
'- 不引入真实浏览器脚本或复杂状态管理。',
|
|
306
|
-
'',
|
|
307
|
-
'## 非目标',
|
|
308
|
-
'- 不接真实 API。',
|
|
309
|
-
'- 不引入复杂状态管理。',
|
|
310
|
-
'- 不在本次示例中抽象新的通用组件。',
|
|
311
|
-
'',
|
|
312
|
-
'## 默认假设',
|
|
313
|
-
'- 仓库已有 Vue 3 + TypeScript 基础结构,可直接承接页面、路由和 mock 文件。',
|
|
314
|
-
'- 当前示例只要求最小验证闭环,不要求真实组件库和真实浏览器验证接入。',
|
|
315
|
-
'',
|
|
316
|
-
'## 风险与待确认项',
|
|
317
|
-
'- 当前演示为确定性 replay(回放),不代表真实 AI IDE 全自动执行。',
|
|
318
|
-
'- 真实业务接入时仍需补浏览器验证证据和组件复用决策。',
|
|
319
|
-
].join('\n'));
|
|
320
|
-
|
|
321
|
-
writeFile(targetDir, `openspec/changes/${changeId}/specs/ui/spec.md`, [
|
|
322
|
-
'## 新增需求',
|
|
323
|
-
'',
|
|
324
|
-
'### 需求:商品 mock 页面',
|
|
325
|
-
'',
|
|
326
|
-
'系统必须提供一个商品 mock 页面,用于验证 expert-delivery 主链可运行。',
|
|
327
|
-
'',
|
|
328
|
-
'#### 场景:进入商品 mock 页面',
|
|
329
|
-
'',
|
|
330
|
-
'- **已知** 当前场景只使用本地 mock 数据',
|
|
331
|
-
'- **当** 用户进入商品 mock 页面',
|
|
332
|
-
'- **则** 页面展示本地商品列表,不请求真实接口',
|
|
333
|
-
].join('\n'));
|
|
334
|
-
|
|
335
|
-
writeFile(targetDir, `openspec/changes/${changeId}/specs/api/spec.md`, [
|
|
336
|
-
'## 新增需求',
|
|
337
|
-
'',
|
|
338
|
-
'### 需求:演示接口约束',
|
|
339
|
-
'',
|
|
340
|
-
'系统必须明确当前示例只消费本地 mock 数据,不发起真实商品接口请求。',
|
|
341
|
-
'',
|
|
342
|
-
'#### 场景:页面初始化',
|
|
343
|
-
'',
|
|
344
|
-
'- **已知** 当前为 runtime smoke 演示',
|
|
345
|
-
'- **当** 页面初始化',
|
|
346
|
-
'- **则** 只读取本地 mock 模块,不调用远程 API',
|
|
347
|
-
].join('\n'));
|
|
348
|
-
|
|
349
|
-
writeFile(targetDir, `openspec/changes/${changeId}/design.md`, [
|
|
350
|
-
'# 技术设计',
|
|
351
|
-
'',
|
|
352
|
-
'## 方案概览',
|
|
353
|
-
'- 在现有 Vue 目录约定下落一个最小商品页面、路由模块和 mock 数据文件。',
|
|
354
|
-
'- 通过结构化的 proposal、design、tasks、checklist、iterations 验证模板增强后的主链产物。',
|
|
355
|
-
'',
|
|
356
|
-
'## 仓库对齐',
|
|
357
|
-
'',
|
|
358
|
-
'### 页面与路由落点',
|
|
359
|
-
'- 页面落在 `src/views/products/mock/index.vue`',
|
|
360
|
-
'- 路由落在 `src/router/modules/products.ts`',
|
|
361
|
-
'',
|
|
362
|
-
'### 接口与数据落点',
|
|
363
|
-
'- mock 数据落在 `src/mock/products.ts`',
|
|
364
|
-
'- 当前示例不新增真实 API(接口) 封装',
|
|
365
|
-
'',
|
|
366
|
-
'### 状态与样式落点',
|
|
367
|
-
'- 页面使用局部静态数据,不引入额外状态管理',
|
|
368
|
-
'- 样式直接放在页面 SFC(单文件组件) 内,保持最小实现',
|
|
369
|
-
'',
|
|
370
|
-
'### 测试与组件库落点',
|
|
371
|
-
'- 由 runtime smoke 和模板回归用例验证产物结构',
|
|
372
|
-
'- 当前示例不额外接入组件库,只复用仓库现有目录约定',
|
|
373
|
-
'',
|
|
374
|
-
'## 关键决策',
|
|
375
|
-
'',
|
|
376
|
-
'### 信息结构',
|
|
377
|
-
'- 页面只保留标题和商品列表,用最小信息结构证明页面可交付。',
|
|
378
|
-
'',
|
|
379
|
-
'### 状态管理方案',
|
|
380
|
-
'- 商品数据直接从本地 mock 文件导入,避免在示例里引入无关状态层。',
|
|
381
|
-
'',
|
|
382
|
-
'### 组件复用策略',
|
|
383
|
-
'- 优先复用现有 Vue 页面、路由和 mock 组织方式,不额外封装新组件。',
|
|
384
|
-
'',
|
|
385
|
-
'### 禁止重复实现的能力',
|
|
386
|
-
'- 不重复实现路由基础设施、构建配置和全局状态容器。',
|
|
387
|
-
'',
|
|
388
|
-
'### 组件缺口',
|
|
389
|
-
'- 当前示例未识别必须补齐的组件缺口,真实业务接入时再补充。',
|
|
390
|
-
'',
|
|
391
|
-
'## 数据与接口变更',
|
|
392
|
-
'- 页面只读取本地 `productMock` 数据,不新增请求或响应契约。',
|
|
393
|
-
'- 不引入新的 props(属性)、事件或跨模块状态同步。',
|
|
394
|
-
'',
|
|
395
|
-
'## 验证说明',
|
|
396
|
-
'',
|
|
397
|
-
'### 本地验证',
|
|
398
|
-
'- 通过 runtime smoke 命令推进主链,确认产物、代码和归档目录都能落盘。',
|
|
399
|
-
'',
|
|
400
|
-
'### 浏览器验证',
|
|
401
|
-
'- 当前示例不接真实浏览器脚本,以页面文件、路由文件和 mock 文件的落盘作为最小替代证据。',
|
|
402
|
-
'',
|
|
403
|
-
'### 关键验收路径',
|
|
404
|
-
'- 生成 proposal、specs、design、tasks 后进入实现专家。',
|
|
405
|
-
'- 页面、路由、mock 文件落盘后补齐 checklist 和 iterations,再完成归档。',
|
|
406
|
-
].join('\n'));
|
|
407
|
-
|
|
408
|
-
writeFile(targetDir, `openspec/changes/${changeId}/tasks.md`, [
|
|
409
|
-
'# 实施任务',
|
|
410
|
-
'',
|
|
411
|
-
'## 执行总原则',
|
|
412
|
-
'- [ ] 任务必须限定在 proposal.md、design.md 和 specs 已批准范围内',
|
|
413
|
-
'- [ ] 每个子任务都要写明目标、输入、输出、验证点和依赖或前置条件',
|
|
414
|
-
'- [ ] 未完成验证前不得宣称任务完成或继续交接',
|
|
415
|
-
'',
|
|
416
|
-
'## 子任务清单',
|
|
417
|
-
'',
|
|
418
|
-
'### 子任务 1',
|
|
419
|
-
'- [ ] 目标:创建商品 mock 页面与最小组件结构',
|
|
420
|
-
'- [ ] 输入:proposal.md、specs/ui/spec.md、现有 `src/views` 目录约定',
|
|
421
|
-
'- [ ] 输出:`src/views/products/mock/index.vue`',
|
|
422
|
-
'- [ ] 验证点:页面文件存在,能引用本地 mock 数据并展示列表',
|
|
423
|
-
'- [ ] 依赖或前置条件:requirement-analyst 已产出 proposal、specs、design',
|
|
424
|
-
'',
|
|
425
|
-
'### 子任务 2',
|
|
426
|
-
'- [ ] 目标:补齐路由模块和 mock 数据文件',
|
|
427
|
-
'- [ ] 输入:design.md、现有 `src/router/modules` 与 `src/mock` 目录约定',
|
|
428
|
-
'- [ ] 输出:`src/router/modules/products.ts`、`src/mock/products.ts`',
|
|
429
|
-
'- [ ] 验证点:路由指向商品 mock 页面,mock 数据文件可被页面导入',
|
|
430
|
-
'- [ ] 依赖或前置条件:子任务 1 的页面路径已确定',
|
|
431
|
-
'',
|
|
432
|
-
'### 子任务 3',
|
|
433
|
-
'- [ ] 目标:补齐 checklist 和 iterations,完成交付闭环',
|
|
434
|
-
'- [ ] 输入:实现结果、proposal.md、design.md、tasks.md',
|
|
435
|
-
'- [ ] 输出:`checklist.md`、`iterations.md`',
|
|
436
|
-
'- [ ] 验证点:检查结论、验证摘要、残留风险和交接提醒都已记录',
|
|
437
|
-
'- [ ] 依赖或前置条件:页面、路由和 mock 数据文件已落盘',
|
|
438
|
-
].join('\n'));
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function writeImplementationArtifacts(targetDir) {
|
|
442
|
-
writeFile(targetDir, 'src/views/products/mock/index.vue', [
|
|
443
|
-
'<template>',
|
|
444
|
-
' <section class="product-mock-page">',
|
|
445
|
-
' <h1>商品 Mock 页面</h1>',
|
|
446
|
-
' <ul>',
|
|
447
|
-
' <li v-for="item in productMock" :key="item.id">',
|
|
448
|
-
' <strong>{{ item.name }}</strong>',
|
|
449
|
-
' <span>{{ item.price }}</span>',
|
|
450
|
-
' </li>',
|
|
451
|
-
' </ul>',
|
|
452
|
-
' </section>',
|
|
453
|
-
'</template>',
|
|
454
|
-
'',
|
|
455
|
-
'<script setup lang="ts">',
|
|
456
|
-
"import { productMock } from '../../../mock/products';",
|
|
457
|
-
'</script>',
|
|
458
|
-
'',
|
|
459
|
-
'<style scoped>',
|
|
460
|
-
'.product-mock-page {',
|
|
461
|
-
' padding: 24px;',
|
|
462
|
-
'}',
|
|
463
|
-
'',
|
|
464
|
-
'.product-mock-page ul {',
|
|
465
|
-
' display: grid;',
|
|
466
|
-
' gap: 12px;',
|
|
467
|
-
' list-style: none;',
|
|
468
|
-
' padding: 0;',
|
|
469
|
-
'}',
|
|
470
|
-
'</style>',
|
|
471
|
-
].join('\n'));
|
|
472
|
-
|
|
473
|
-
writeFile(targetDir, 'src/router/modules/products.ts', [
|
|
474
|
-
'export default [',
|
|
475
|
-
' {',
|
|
476
|
-
" path: '/products/mock',",
|
|
477
|
-
" name: 'ProductsMock',",
|
|
478
|
-
" component: () => import('../../views/products/mock/index.vue'),",
|
|
479
|
-
' },',
|
|
480
|
-
'];',
|
|
481
|
-
].join('\n'));
|
|
482
|
-
|
|
483
|
-
writeFile(targetDir, 'src/mock/products.ts', [
|
|
484
|
-
'export const productMock = [',
|
|
485
|
-
" { id: 'p-001', name: '演示商品 A', price: '99.00' },",
|
|
486
|
-
" { id: 'p-002', name: '演示商品 B', price: '129.00' },",
|
|
487
|
-
'];',
|
|
488
|
-
].join('\n'));
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
function writeGuardianArtifacts(targetDir, changeId) {
|
|
492
|
-
writeFile(targetDir, `openspec/changes/${changeId}/checklist.md`, [
|
|
493
|
-
'# 检查清单',
|
|
494
|
-
'',
|
|
495
|
-
'## 通过项',
|
|
496
|
-
'- [x] proposal、specs、design 与实现结果保持一致',
|
|
497
|
-
'- [x] 已完成任务已真实反映在代码和配套文件中',
|
|
498
|
-
'- [x] 项目的目录、路由、接口、样式、测试等规则已满足当前示例边界',
|
|
499
|
-
'',
|
|
500
|
-
'### 本地验证摘要',
|
|
501
|
-
'- [x] lint(静态检查):通过,示例项目使用最小占位脚本返回成功',
|
|
502
|
-
'- [x] typecheck(类型检查):通过,示例目录结构满足仓库约定',
|
|
503
|
-
'- [x] test(测试):通过,runtime smoke 主链推进完成',
|
|
504
|
-
'- [x] build(构建):通过,示例项目占位构建脚本返回成功',
|
|
505
|
-
'',
|
|
506
|
-
'### 浏览器验证摘要',
|
|
507
|
-
'- [x] 页面可访问:通过,页面文件、路由文件和 mock 文件均已落盘',
|
|
508
|
-
'- [x] 关键路径可执行:通过,商品页面、路由和归档链路均已完成',
|
|
509
|
-
'- [x] console(控制台) 检查:通过,当前示例未引入浏览器脚本报错',
|
|
510
|
-
'',
|
|
511
|
-
'### 范围一致性',
|
|
512
|
-
'- [x] 当前实现未超出 proposal、design、tasks 已批准范围',
|
|
513
|
-
'',
|
|
514
|
-
'### 组件复用检查',
|
|
515
|
-
'- [x] 已记录当前示例优先复用仓库既有目录约定,暂无额外组件库缺口',
|
|
516
|
-
'',
|
|
517
|
-
'## 未通过项',
|
|
518
|
-
'- [ ] 记录未满足需求或项目规则的项',
|
|
519
|
-
'',
|
|
520
|
-
'## 阻断项',
|
|
521
|
-
'- [ ] 记录在继续交付、放行或归档前必须解决的项',
|
|
522
|
-
'',
|
|
523
|
-
'## 是否建议继续推进',
|
|
524
|
-
'建议继续推进:当前示例已达到 runtime smoke 演示目标,可继续归档。',
|
|
525
|
-
].join('\n'));
|
|
526
|
-
|
|
527
|
-
writeFile(targetDir, `openspec/changes/${changeId}/iterations.md`, [
|
|
528
|
-
'# 迭代记录',
|
|
529
|
-
'',
|
|
530
|
-
'## 本轮问题',
|
|
531
|
-
'- [x] 当前示例只覆盖最小 mock 交付链,不覆盖真实浏览器验证和真实接口接入。',
|
|
532
|
-
'- 问题来源:runtime smoke 以确定性 replay(回放) 为主,验证重点是主链闭环而不是业务复杂度。',
|
|
533
|
-
'- 影响范围:只能证明模板产物、代码落盘和归档流程可运行。',
|
|
534
|
-
'- 关联证据:checklist.md、`.ai-spec/current-run.json` 和归档后的 `openspec/changes/archive/` 目录。',
|
|
535
|
-
'',
|
|
536
|
-
'## 修正动作',
|
|
537
|
-
'- [x] 已补齐 proposal、design、tasks、checklist、iterations 的结构化示例内容。',
|
|
538
|
-
'- 已完成动作:新增页面、路由、mock 数据,并补录验证摘要和交付结论。',
|
|
539
|
-
'- 待跟进动作:后续可替换为真实业务页面或真实 AI IDE 执行回合。',
|
|
540
|
-
'',
|
|
541
|
-
'## 残留风险',
|
|
542
|
-
'- [ ] 真实浏览器验证、真实 API 和更严格的组件复用约束尚未纳入本次示例。',
|
|
543
|
-
'- 风险说明:如果直接把该示例当成业务实现模板,仍需补真实业务约束和验证脚本。',
|
|
544
|
-
'- 触发条件:进入真实业务项目、引入真实接口或涉及复杂状态管理时。',
|
|
545
|
-
'- 建议缓解方式:在业务项目中补齐 design、checklist 和浏览器验证证据,再推进归档。',
|
|
546
|
-
'',
|
|
547
|
-
'## 下轮提醒',
|
|
548
|
-
'- [ ] 下一轮可将最小示例替换成真实页面或真实 AI IDE 执行输入。',
|
|
549
|
-
'- 下一轮关注点:真实接口契约、组件复用策略和浏览器验证脚本接入。',
|
|
550
|
-
'- 交接说明:当前示例已可作为模板增强后的最小演示基线。',
|
|
551
|
-
].join('\n'));
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
function writeBootstrapTurn(targetDir, payload) {
|
|
555
|
-
writeJson(targetDir, '.ai-spec/internal/tmp/task-orchestrator-turn.json', payload);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
function writeExecutionInbox(targetDir, payload) {
|
|
559
|
-
writeJson(targetDir, '.ai-spec/internal/tmp/current-execution.json', payload);
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
function runDemoRuntimeSmoke(options = {}) {
|
|
563
|
-
const targetDir = path.resolve(options.target || defaultTarget);
|
|
564
|
-
const userInput = options.userInput || '新增一个商品 mock 页面';
|
|
565
|
-
const runId = options.runId || buildRunId();
|
|
566
|
-
const changeId = options.changeId || 'runtime-smoke-demo';
|
|
567
|
-
|
|
568
|
-
scaffoldDemoTarget(targetDir);
|
|
569
|
-
|
|
570
|
-
const start = protocolWorkflow.advanceProtocolStep({
|
|
571
|
-
target: targetDir,
|
|
572
|
-
userInput,
|
|
573
|
-
reviewPolicy: 'main-flow-blocking',
|
|
574
|
-
});
|
|
575
|
-
|
|
576
|
-
writeBootstrapTurn(targetDir, createBootstrapPayload(runId, userInput, changeId));
|
|
577
|
-
const afterBootstrap = runner.advanceRunner({ target: targetDir });
|
|
578
|
-
|
|
579
|
-
const requirementTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
580
|
-
writeRequirementArtifacts(targetDir, changeId);
|
|
581
|
-
writeExecutionInbox(targetDir, createExecutionPayload(
|
|
582
|
-
runId,
|
|
583
|
-
'requirement-analyst',
|
|
584
|
-
'需求解析专家',
|
|
585
|
-
['补齐 proposal', '输出 spec', '输出 tasks'],
|
|
586
|
-
));
|
|
587
|
-
const afterRequirement = runner.advanceRunner({ target: targetDir });
|
|
588
|
-
|
|
589
|
-
const implementationApprovalGate = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
590
|
-
writeJson(targetDir, '.ai-spec/internal/tmp/current-runtime-action.json', {
|
|
591
|
-
schema_version: 1,
|
|
592
|
-
kind: 'task-orchestrator-runtime-action',
|
|
593
|
-
action: 'approve',
|
|
594
|
-
gate: 'before-implementation',
|
|
595
|
-
to_role: 'frontend-implementer',
|
|
596
|
-
message: 'demo implementation approved',
|
|
597
|
-
});
|
|
598
|
-
const afterImplementationApproval = runner.advanceRunner({ target: targetDir });
|
|
599
|
-
|
|
600
|
-
const implementationTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
601
|
-
writeImplementationArtifacts(targetDir);
|
|
602
|
-
writeExecutionInbox(targetDir, createExecutionPayload(
|
|
603
|
-
runId,
|
|
604
|
-
'frontend-implementer',
|
|
605
|
-
'前端实现专家',
|
|
606
|
-
['完成最小页面实现', '补齐路由与 mock 数据'],
|
|
607
|
-
));
|
|
608
|
-
const afterImplementation = runner.advanceRunner({ target: targetDir });
|
|
609
|
-
|
|
610
|
-
const guardianApprovalGate = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
611
|
-
writeJson(targetDir, '.ai-spec/internal/tmp/current-runtime-action.json', {
|
|
612
|
-
schema_version: 1,
|
|
613
|
-
kind: 'task-orchestrator-runtime-action',
|
|
614
|
-
action: 'approve',
|
|
615
|
-
gate: 'before-guardian',
|
|
616
|
-
to_role: 'code-guardian',
|
|
617
|
-
message: 'demo guardian approved',
|
|
618
|
-
});
|
|
619
|
-
const afterGuardianApproval = runner.advanceRunner({ target: targetDir });
|
|
620
|
-
|
|
621
|
-
const guardianTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
622
|
-
writeGuardianArtifacts(targetDir, changeId);
|
|
623
|
-
writeExecutionInbox(targetDir, createExecutionPayload(
|
|
624
|
-
runId,
|
|
625
|
-
'code-guardian',
|
|
626
|
-
'规范守护者',
|
|
627
|
-
['检查范围与产物', '输出 checklist 与 iterations', '等待归档确认'],
|
|
628
|
-
));
|
|
629
|
-
const afterGuardian = runner.advanceRunner({ target: targetDir });
|
|
630
|
-
|
|
631
|
-
const archiveGate = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
632
|
-
writeJson(targetDir, '.ai-spec/internal/tmp/current-runtime-action.json', {
|
|
633
|
-
schema_version: 1,
|
|
634
|
-
kind: 'task-orchestrator-runtime-action',
|
|
635
|
-
action: 'approve',
|
|
636
|
-
gate: 'before-archive',
|
|
637
|
-
to_role: 'archive-change',
|
|
638
|
-
message: 'demo archive approved',
|
|
639
|
-
});
|
|
640
|
-
const afterArchiveApproval = runner.advanceRunner({ target: targetDir });
|
|
641
|
-
|
|
642
|
-
const archiveTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
643
|
-
const afterArchive = archiveChange({
|
|
644
|
-
target: targetDir,
|
|
645
|
-
changeId,
|
|
646
|
-
completeRun: true,
|
|
647
|
-
});
|
|
648
|
-
|
|
649
|
-
const terminal = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
650
|
-
const currentRun = JSON.parse(fs.readFileSync(path.join(targetDir, '.ai-spec', 'current-run.json'), 'utf8'));
|
|
651
|
-
|
|
652
|
-
return {
|
|
653
|
-
kind: 'demo-runtime-smoke-result',
|
|
654
|
-
target: targetDir,
|
|
655
|
-
user_input: userInput,
|
|
656
|
-
run_id: runId,
|
|
657
|
-
change_id: changeId,
|
|
658
|
-
turns: {
|
|
659
|
-
start: {
|
|
660
|
-
actor: start.turn.actor?.id || null,
|
|
661
|
-
command: start.turn.command || null,
|
|
662
|
-
mode: start.turn.mode || null,
|
|
663
|
-
},
|
|
664
|
-
requirement_analyst: {
|
|
665
|
-
actor: requirementTurn.turn.actor?.id || null,
|
|
666
|
-
command: requirementTurn.turn.command || null,
|
|
667
|
-
},
|
|
668
|
-
frontend_implementer: {
|
|
669
|
-
actor: implementationTurn.turn.actor?.id || null,
|
|
670
|
-
command: implementationTurn.turn.command || null,
|
|
671
|
-
},
|
|
672
|
-
code_guardian: {
|
|
673
|
-
actor: guardianTurn.turn.actor?.id || null,
|
|
674
|
-
command: guardianTurn.turn.command || null,
|
|
675
|
-
},
|
|
676
|
-
archive_gate: {
|
|
677
|
-
status: archiveGate.turn.status || null,
|
|
678
|
-
gate: archiveGate.turn.guidance?.approval_gate?.gate || null,
|
|
679
|
-
},
|
|
680
|
-
archive_change: {
|
|
681
|
-
actor: archiveTurn.turn.actor?.id || null,
|
|
682
|
-
command: archiveTurn.turn.command || null,
|
|
683
|
-
},
|
|
684
|
-
terminal: {
|
|
685
|
-
status: terminal.turn.status || null,
|
|
686
|
-
actor: terminal.turn.actor?.id || null,
|
|
687
|
-
},
|
|
688
|
-
},
|
|
689
|
-
applied: {
|
|
690
|
-
bootstrap: afterBootstrap.applied.adapter_action,
|
|
691
|
-
requirement: afterRequirement.applied.adapter_action,
|
|
692
|
-
implementation: afterImplementation.applied.adapter_action,
|
|
693
|
-
guardian: afterGuardian.applied.adapter_action,
|
|
694
|
-
implementation_approval: afterImplementationApproval.applied.adapter_action,
|
|
695
|
-
guardian_approval: afterGuardianApproval.applied.adapter_action,
|
|
696
|
-
archive_approval: afterArchiveApproval.applied.adapter_action,
|
|
697
|
-
archive: afterArchive.runtime_transition?.state?.status || afterArchive.status,
|
|
698
|
-
},
|
|
699
|
-
current_run: {
|
|
700
|
-
status: currentRun.status,
|
|
701
|
-
current_role: currentRun.current_role,
|
|
702
|
-
events: Array.isArray(currentRun.events) ? currentRun.events.length : 0,
|
|
703
|
-
artifacts: currentRun.artifacts || null,
|
|
704
|
-
},
|
|
705
|
-
outputs: [
|
|
706
|
-
'.ai-spec/current-run.json',
|
|
707
|
-
'openspec/specs/ui/spec.md',
|
|
708
|
-
'openspec/specs/api/spec.md',
|
|
709
|
-
'src/views/products/mock/index.vue',
|
|
710
|
-
'src/router/modules/products.ts',
|
|
711
|
-
'src/mock/products.ts',
|
|
712
|
-
],
|
|
713
|
-
note: 'This demo replays deterministic expert outputs to verify the current expert-delivery runtime chain.',
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
function printPretty(result) {
|
|
718
|
-
console.log('runtime smoke demo completed');
|
|
719
|
-
console.log(`target: ${result.target}`);
|
|
720
|
-
console.log(`run_id: ${result.run_id}`);
|
|
721
|
-
console.log(`change_id: ${result.change_id}`);
|
|
722
|
-
console.log(`current_run.status: ${result.current_run.status}`);
|
|
723
|
-
console.log(`current_run.events: ${result.current_run.events}`);
|
|
724
|
-
console.log('outputs:');
|
|
725
|
-
for (const item of result.outputs) {
|
|
726
|
-
console.log(` - ${item}`);
|
|
727
|
-
}
|
|
728
|
-
console.log('note:');
|
|
729
|
-
console.log(` ${result.note}`);
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
function main(argv = process.argv.slice(2)) {
|
|
733
|
-
try {
|
|
734
|
-
const options = parseArgs(argv);
|
|
735
|
-
if (options.help) {
|
|
736
|
-
printUsage();
|
|
737
|
-
return 0;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
const result = runDemoRuntimeSmoke(options);
|
|
741
|
-
if (options.json) {
|
|
742
|
-
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
743
|
-
} else {
|
|
744
|
-
printPretty(result);
|
|
745
|
-
}
|
|
746
|
-
return 0;
|
|
747
|
-
} catch (error) {
|
|
748
|
-
console.error(error.message || error);
|
|
749
|
-
return 1;
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
module.exports = {
|
|
754
|
-
runDemoRuntimeSmoke,
|
|
755
|
-
main,
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
if (require.main === module) {
|
|
759
|
-
process.exit(main());
|
|
760
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const protocolWorkflow = require('../internal/ai-protocol-workflow');
|
|
5
|
+
const { archiveChange } = require('./archive-change');
|
|
6
|
+
const runner = require('./task-orchestrator-runner');
|
|
7
|
+
|
|
8
|
+
const pkgRoot = path.join(__dirname, '..');
|
|
9
|
+
const defaultTarget = path.join(process.cwd(), '.tmp', 'runtime-smoke-demo');
|
|
10
|
+
|
|
11
|
+
function parseArgs(argv) {
|
|
12
|
+
const args = [...argv];
|
|
13
|
+
const options = {
|
|
14
|
+
target: defaultTarget,
|
|
15
|
+
userInput: '新增一个商品 mock 页面',
|
|
16
|
+
json: false,
|
|
17
|
+
pretty: true,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
while (args.length > 0) {
|
|
21
|
+
const arg = args.shift();
|
|
22
|
+
|
|
23
|
+
if (!arg.startsWith('-') && options.target === defaultTarget) {
|
|
24
|
+
options.target = arg;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
switch (arg) {
|
|
29
|
+
case '--target':
|
|
30
|
+
options.target = args.shift();
|
|
31
|
+
break;
|
|
32
|
+
case '--user-input':
|
|
33
|
+
options.userInput = args.shift();
|
|
34
|
+
break;
|
|
35
|
+
case '--json':
|
|
36
|
+
options.json = true;
|
|
37
|
+
options.pretty = false;
|
|
38
|
+
break;
|
|
39
|
+
case '--pretty':
|
|
40
|
+
options.pretty = true;
|
|
41
|
+
options.json = false;
|
|
42
|
+
break;
|
|
43
|
+
case '--help':
|
|
44
|
+
case '-h':
|
|
45
|
+
options.help = true;
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
throw new Error(`Unknown argument: ${arg}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return options;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function printUsage() {
|
|
56
|
+
console.log(`Usage:
|
|
57
|
+
ai-spec-auto demo-runtime-smoke [target] [options]
|
|
58
|
+
|
|
59
|
+
Options:
|
|
60
|
+
--target <dir> Demo target directory (default: ./.tmp/runtime-smoke-demo)
|
|
61
|
+
--user-input <text> Demo requirement text
|
|
62
|
+
--json Print JSON only
|
|
63
|
+
--pretty Print readable summary (default)
|
|
64
|
+
--help Show this help
|
|
65
|
+
`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function ensureEmptyTarget(targetDir) {
|
|
69
|
+
if (!fs.existsSync(targetDir)) {
|
|
70
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const entries = fs.readdirSync(targetDir);
|
|
75
|
+
if (entries.length > 0) {
|
|
76
|
+
throw new Error(`Demo target is not empty: ${targetDir}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function ensureDir(dirPath) {
|
|
81
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function writeFile(targetDir, relPath, content) {
|
|
85
|
+
const filePath = path.join(targetDir, relPath);
|
|
86
|
+
ensureDir(path.dirname(filePath));
|
|
87
|
+
fs.writeFileSync(filePath, content.endsWith('\n') ? content : `${content}\n`, 'utf8');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function writeJson(targetDir, relPath, value) {
|
|
91
|
+
writeFile(targetDir, relPath, `${JSON.stringify(value, null, 2)}\n`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function copyDirRecursive(sourceDir, targetDir) {
|
|
95
|
+
ensureDir(targetDir);
|
|
96
|
+
for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
97
|
+
const sourcePath = path.join(sourceDir, entry.name);
|
|
98
|
+
const targetPath = path.join(targetDir, entry.name);
|
|
99
|
+
if (entry.isDirectory()) {
|
|
100
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
ensureDir(path.dirname(targetPath));
|
|
104
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function buildRunId() {
|
|
109
|
+
const now = new Date();
|
|
110
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
111
|
+
return [
|
|
112
|
+
'run',
|
|
113
|
+
`${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`,
|
|
114
|
+
`${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`,
|
|
115
|
+
'demo',
|
|
116
|
+
].join('_');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function scaffoldDemoTarget(targetDir) {
|
|
120
|
+
ensureEmptyTarget(targetDir);
|
|
121
|
+
|
|
122
|
+
writeFile(targetDir, 'package.json', JSON.stringify({
|
|
123
|
+
name: 'runtime-smoke-demo',
|
|
124
|
+
private: true,
|
|
125
|
+
scripts: {
|
|
126
|
+
build: 'node -e "process.exit(0)"',
|
|
127
|
+
lint: 'node -e "process.exit(0)"',
|
|
128
|
+
test: 'node -e "process.exit(0)"',
|
|
129
|
+
},
|
|
130
|
+
dependencies: {
|
|
131
|
+
vue: '^3.5.0',
|
|
132
|
+
'vue-router': '^4.4.0',
|
|
133
|
+
pinia: '^3.0.0',
|
|
134
|
+
vite: '^6.0.0',
|
|
135
|
+
},
|
|
136
|
+
devDependencies: {
|
|
137
|
+
typescript: '^5.0.0',
|
|
138
|
+
},
|
|
139
|
+
}, null, 2));
|
|
140
|
+
writeFile(targetDir, 'pnpm-lock.yaml', 'lockfileVersion: 9.0');
|
|
141
|
+
writeFile(targetDir, 'src/router/index.ts', [
|
|
142
|
+
'export const routes = [];',
|
|
143
|
+
'export const router = { routes };',
|
|
144
|
+
].join('\n'));
|
|
145
|
+
writeFile(targetDir, 'src/router/modules/demo.ts', 'export default [];');
|
|
146
|
+
writeFile(targetDir, 'src/views/demo/index.vue', '<template><div>demo entry</div></template>');
|
|
147
|
+
writeFile(targetDir, 'src/api/order.ts', 'export function getOrderListApi() { return []; }');
|
|
148
|
+
writeFile(targetDir, 'src/api/types/order.ts', 'export interface Order { id: string; }');
|
|
149
|
+
writeFile(targetDir, 'src/mock/order.ts', 'export const orderMock = [];');
|
|
150
|
+
writeFile(targetDir, 'src/store/modules/demo/index.ts', 'export const useDemoStore = () => ({})');
|
|
151
|
+
writeFile(targetDir, 'src/styles/variables.scss', ':root {}');
|
|
152
|
+
writeFile(targetDir, 'context/PROJECT.md', [
|
|
153
|
+
'# PROJECT',
|
|
154
|
+
'',
|
|
155
|
+
'- Framework: Vue 3',
|
|
156
|
+
'- Language: TypeScript',
|
|
157
|
+
'- Goal: runtime smoke demo for expert-delivery flow',
|
|
158
|
+
].join('\n'));
|
|
159
|
+
|
|
160
|
+
const configTemplate = path.join(pkgRoot, 'openspec', 'config.yaml.template');
|
|
161
|
+
writeFile(targetDir, path.join('openspec', 'config.yaml'), fs.readFileSync(configTemplate, 'utf8'));
|
|
162
|
+
|
|
163
|
+
const schemaSource = path.join(pkgRoot, 'openspec', 'schemas', 'expert-delivery');
|
|
164
|
+
const schemaTarget = path.join(targetDir, 'openspec', 'schemas', 'expert-delivery');
|
|
165
|
+
copyDirRecursive(schemaSource, schemaTarget);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function createBootstrapPayload(runId, userInput, changeId) {
|
|
169
|
+
return {
|
|
170
|
+
schema_version: 1,
|
|
171
|
+
kind: 'task-orchestrator-bootstrap',
|
|
172
|
+
run_plan: {
|
|
173
|
+
schema_version: 1,
|
|
174
|
+
kind: 'run-plan',
|
|
175
|
+
run_id: runId,
|
|
176
|
+
status: 'planned',
|
|
177
|
+
review_policy: 'main-flow-blocking',
|
|
178
|
+
task: {
|
|
179
|
+
type: 'page-development',
|
|
180
|
+
raw_input: userInput,
|
|
181
|
+
input_kind: 'natural-language',
|
|
182
|
+
risk_level: 'low',
|
|
183
|
+
},
|
|
184
|
+
flow: {
|
|
185
|
+
id: 'prd-to-delivery',
|
|
186
|
+
name: '需求到交付',
|
|
187
|
+
source: 'runtime-smoke-demo',
|
|
188
|
+
},
|
|
189
|
+
artifacts: [
|
|
190
|
+
`openspec/changes/${changeId}/proposal.md`,
|
|
191
|
+
`openspec/changes/${changeId}/specs/`,
|
|
192
|
+
`openspec/changes/${changeId}/design.md`,
|
|
193
|
+
`openspec/changes/${changeId}/tasks.md`,
|
|
194
|
+
'code',
|
|
195
|
+
`openspec/changes/${changeId}/checklist.md`,
|
|
196
|
+
`openspec/changes/${changeId}/iterations.md`,
|
|
197
|
+
],
|
|
198
|
+
plan: {
|
|
199
|
+
required_roles: [
|
|
200
|
+
'requirement-analyst',
|
|
201
|
+
'frontend-implementer',
|
|
202
|
+
'code-guardian',
|
|
203
|
+
],
|
|
204
|
+
activated_optional_roles: [],
|
|
205
|
+
skipped_optional_roles: [],
|
|
206
|
+
first_handoff: 'requirement-analyst',
|
|
207
|
+
approval_gates: ['before-implementation', 'before-archive'],
|
|
208
|
+
review_policy: 'main-flow-blocking',
|
|
209
|
+
},
|
|
210
|
+
missing_inputs: [
|
|
211
|
+
'组件目录位置未明确,采用最小 mock 页面默认结构',
|
|
212
|
+
],
|
|
213
|
+
warnings: [],
|
|
214
|
+
errors: [],
|
|
215
|
+
next_action: '先交给 requirement-analyst 收敛任务',
|
|
216
|
+
},
|
|
217
|
+
task_anchor: {
|
|
218
|
+
schema_version: 1,
|
|
219
|
+
kind: 'task-anchor',
|
|
220
|
+
run_id: runId,
|
|
221
|
+
task: {
|
|
222
|
+
raw_goal: userInput,
|
|
223
|
+
change_id: changeId,
|
|
224
|
+
input_kind: 'natural-language',
|
|
225
|
+
},
|
|
226
|
+
stage: {
|
|
227
|
+
flow_id: 'prd-to-delivery',
|
|
228
|
+
current_role: 'requirement-analyst',
|
|
229
|
+
next_role: 'frontend-implementer',
|
|
230
|
+
},
|
|
231
|
+
constraints: {
|
|
232
|
+
rules: ['component-standard'],
|
|
233
|
+
must_not: ['不要跳过规则检查'],
|
|
234
|
+
},
|
|
235
|
+
artifacts: {
|
|
236
|
+
proposal: `openspec/changes/${changeId}/proposal.md`,
|
|
237
|
+
specs: `openspec/changes/${changeId}/specs/`,
|
|
238
|
+
design: `openspec/changes/${changeId}/design.md`,
|
|
239
|
+
tasks: `openspec/changes/${changeId}/tasks.md`,
|
|
240
|
+
},
|
|
241
|
+
expected_output: [
|
|
242
|
+
'补齐 proposal',
|
|
243
|
+
'输出 specs',
|
|
244
|
+
'输出 design',
|
|
245
|
+
'输出 tasks',
|
|
246
|
+
'列出缺失输入',
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function createExecutionPayload(runId, roleId, roleName, executionSteps) {
|
|
253
|
+
return {
|
|
254
|
+
schema_version: 1,
|
|
255
|
+
kind: 'expert-execution',
|
|
256
|
+
run_id: runId,
|
|
257
|
+
status: 'completed',
|
|
258
|
+
role: {
|
|
259
|
+
id: roleId,
|
|
260
|
+
name: roleName,
|
|
261
|
+
},
|
|
262
|
+
flow: {
|
|
263
|
+
id: 'prd-to-delivery',
|
|
264
|
+
},
|
|
265
|
+
execution_plan: {
|
|
266
|
+
execution_steps: executionSteps,
|
|
267
|
+
},
|
|
268
|
+
markdown: `# ${roleId} execution`,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function writeRequirementArtifacts(targetDir, changeId) {
|
|
273
|
+
writeFile(targetDir, `openspec/changes/${changeId}/proposal.md`, [
|
|
274
|
+
`# 变更提案:${changeId}`,
|
|
275
|
+
'',
|
|
276
|
+
'## 目标',
|
|
277
|
+
'',
|
|
278
|
+
'### 业务目标',
|
|
279
|
+
'- 新增一个商品 mock 页面,用于验证 expert-delivery 主链可运行。',
|
|
280
|
+
'',
|
|
281
|
+
'### 工程目标',
|
|
282
|
+
'- 验证 proposal、design、tasks、checklist、iterations 这组模板化产物可以支撑主链闭环。',
|
|
283
|
+
'',
|
|
284
|
+
'### 变更对象与入口',
|
|
285
|
+
'- 页面入口:`src/views/products/mock/index.vue`',
|
|
286
|
+
'- 路由入口:`src/router/modules/products.ts`',
|
|
287
|
+
'- 数据入口:`src/mock/products.ts`',
|
|
288
|
+
'',
|
|
289
|
+
'### 设计链接',
|
|
290
|
+
'- 当前示例没有独立 Figma(设计稿),以 runtime smoke 需求文案和仓库约定作为设计输入。',
|
|
291
|
+
'',
|
|
292
|
+
'### 组件复用约束(可选)',
|
|
293
|
+
'- 当前示例优先复用现有 Vue 目录结构和最小页面约定,不额外引入组件库封装。',
|
|
294
|
+
'',
|
|
295
|
+
'## 范围',
|
|
296
|
+
'',
|
|
297
|
+
'### In Scope(纳入范围)',
|
|
298
|
+
'- 新增商品 mock 页面。',
|
|
299
|
+
'- 新增最小路由模块。',
|
|
300
|
+
'- 新增最小 mock 数据。',
|
|
301
|
+
'- 输出结构化的 design、tasks、checklist 和 iterations。',
|
|
302
|
+
'',
|
|
303
|
+
'### Out of Scope(排除范围)',
|
|
304
|
+
'- 不接真实 API(接口)。',
|
|
305
|
+
'- 不引入真实浏览器脚本或复杂状态管理。',
|
|
306
|
+
'',
|
|
307
|
+
'## 非目标',
|
|
308
|
+
'- 不接真实 API。',
|
|
309
|
+
'- 不引入复杂状态管理。',
|
|
310
|
+
'- 不在本次示例中抽象新的通用组件。',
|
|
311
|
+
'',
|
|
312
|
+
'## 默认假设',
|
|
313
|
+
'- 仓库已有 Vue 3 + TypeScript 基础结构,可直接承接页面、路由和 mock 文件。',
|
|
314
|
+
'- 当前示例只要求最小验证闭环,不要求真实组件库和真实浏览器验证接入。',
|
|
315
|
+
'',
|
|
316
|
+
'## 风险与待确认项',
|
|
317
|
+
'- 当前演示为确定性 replay(回放),不代表真实 AI IDE 全自动执行。',
|
|
318
|
+
'- 真实业务接入时仍需补浏览器验证证据和组件复用决策。',
|
|
319
|
+
].join('\n'));
|
|
320
|
+
|
|
321
|
+
writeFile(targetDir, `openspec/changes/${changeId}/specs/ui/spec.md`, [
|
|
322
|
+
'## 新增需求',
|
|
323
|
+
'',
|
|
324
|
+
'### 需求:商品 mock 页面',
|
|
325
|
+
'',
|
|
326
|
+
'系统必须提供一个商品 mock 页面,用于验证 expert-delivery 主链可运行。',
|
|
327
|
+
'',
|
|
328
|
+
'#### 场景:进入商品 mock 页面',
|
|
329
|
+
'',
|
|
330
|
+
'- **已知** 当前场景只使用本地 mock 数据',
|
|
331
|
+
'- **当** 用户进入商品 mock 页面',
|
|
332
|
+
'- **则** 页面展示本地商品列表,不请求真实接口',
|
|
333
|
+
].join('\n'));
|
|
334
|
+
|
|
335
|
+
writeFile(targetDir, `openspec/changes/${changeId}/specs/api/spec.md`, [
|
|
336
|
+
'## 新增需求',
|
|
337
|
+
'',
|
|
338
|
+
'### 需求:演示接口约束',
|
|
339
|
+
'',
|
|
340
|
+
'系统必须明确当前示例只消费本地 mock 数据,不发起真实商品接口请求。',
|
|
341
|
+
'',
|
|
342
|
+
'#### 场景:页面初始化',
|
|
343
|
+
'',
|
|
344
|
+
'- **已知** 当前为 runtime smoke 演示',
|
|
345
|
+
'- **当** 页面初始化',
|
|
346
|
+
'- **则** 只读取本地 mock 模块,不调用远程 API',
|
|
347
|
+
].join('\n'));
|
|
348
|
+
|
|
349
|
+
writeFile(targetDir, `openspec/changes/${changeId}/design.md`, [
|
|
350
|
+
'# 技术设计',
|
|
351
|
+
'',
|
|
352
|
+
'## 方案概览',
|
|
353
|
+
'- 在现有 Vue 目录约定下落一个最小商品页面、路由模块和 mock 数据文件。',
|
|
354
|
+
'- 通过结构化的 proposal、design、tasks、checklist、iterations 验证模板增强后的主链产物。',
|
|
355
|
+
'',
|
|
356
|
+
'## 仓库对齐',
|
|
357
|
+
'',
|
|
358
|
+
'### 页面与路由落点',
|
|
359
|
+
'- 页面落在 `src/views/products/mock/index.vue`',
|
|
360
|
+
'- 路由落在 `src/router/modules/products.ts`',
|
|
361
|
+
'',
|
|
362
|
+
'### 接口与数据落点',
|
|
363
|
+
'- mock 数据落在 `src/mock/products.ts`',
|
|
364
|
+
'- 当前示例不新增真实 API(接口) 封装',
|
|
365
|
+
'',
|
|
366
|
+
'### 状态与样式落点',
|
|
367
|
+
'- 页面使用局部静态数据,不引入额外状态管理',
|
|
368
|
+
'- 样式直接放在页面 SFC(单文件组件) 内,保持最小实现',
|
|
369
|
+
'',
|
|
370
|
+
'### 测试与组件库落点',
|
|
371
|
+
'- 由 runtime smoke 和模板回归用例验证产物结构',
|
|
372
|
+
'- 当前示例不额外接入组件库,只复用仓库现有目录约定',
|
|
373
|
+
'',
|
|
374
|
+
'## 关键决策',
|
|
375
|
+
'',
|
|
376
|
+
'### 信息结构',
|
|
377
|
+
'- 页面只保留标题和商品列表,用最小信息结构证明页面可交付。',
|
|
378
|
+
'',
|
|
379
|
+
'### 状态管理方案',
|
|
380
|
+
'- 商品数据直接从本地 mock 文件导入,避免在示例里引入无关状态层。',
|
|
381
|
+
'',
|
|
382
|
+
'### 组件复用策略',
|
|
383
|
+
'- 优先复用现有 Vue 页面、路由和 mock 组织方式,不额外封装新组件。',
|
|
384
|
+
'',
|
|
385
|
+
'### 禁止重复实现的能力',
|
|
386
|
+
'- 不重复实现路由基础设施、构建配置和全局状态容器。',
|
|
387
|
+
'',
|
|
388
|
+
'### 组件缺口',
|
|
389
|
+
'- 当前示例未识别必须补齐的组件缺口,真实业务接入时再补充。',
|
|
390
|
+
'',
|
|
391
|
+
'## 数据与接口变更',
|
|
392
|
+
'- 页面只读取本地 `productMock` 数据,不新增请求或响应契约。',
|
|
393
|
+
'- 不引入新的 props(属性)、事件或跨模块状态同步。',
|
|
394
|
+
'',
|
|
395
|
+
'## 验证说明',
|
|
396
|
+
'',
|
|
397
|
+
'### 本地验证',
|
|
398
|
+
'- 通过 runtime smoke 命令推进主链,确认产物、代码和归档目录都能落盘。',
|
|
399
|
+
'',
|
|
400
|
+
'### 浏览器验证',
|
|
401
|
+
'- 当前示例不接真实浏览器脚本,以页面文件、路由文件和 mock 文件的落盘作为最小替代证据。',
|
|
402
|
+
'',
|
|
403
|
+
'### 关键验收路径',
|
|
404
|
+
'- 生成 proposal、specs、design、tasks 后进入实现专家。',
|
|
405
|
+
'- 页面、路由、mock 文件落盘后补齐 checklist 和 iterations,再完成归档。',
|
|
406
|
+
].join('\n'));
|
|
407
|
+
|
|
408
|
+
writeFile(targetDir, `openspec/changes/${changeId}/tasks.md`, [
|
|
409
|
+
'# 实施任务',
|
|
410
|
+
'',
|
|
411
|
+
'## 执行总原则',
|
|
412
|
+
'- [ ] 任务必须限定在 proposal.md、design.md 和 specs 已批准范围内',
|
|
413
|
+
'- [ ] 每个子任务都要写明目标、输入、输出、验证点和依赖或前置条件',
|
|
414
|
+
'- [ ] 未完成验证前不得宣称任务完成或继续交接',
|
|
415
|
+
'',
|
|
416
|
+
'## 子任务清单',
|
|
417
|
+
'',
|
|
418
|
+
'### 子任务 1',
|
|
419
|
+
'- [ ] 目标:创建商品 mock 页面与最小组件结构',
|
|
420
|
+
'- [ ] 输入:proposal.md、specs/ui/spec.md、现有 `src/views` 目录约定',
|
|
421
|
+
'- [ ] 输出:`src/views/products/mock/index.vue`',
|
|
422
|
+
'- [ ] 验证点:页面文件存在,能引用本地 mock 数据并展示列表',
|
|
423
|
+
'- [ ] 依赖或前置条件:requirement-analyst 已产出 proposal、specs、design',
|
|
424
|
+
'',
|
|
425
|
+
'### 子任务 2',
|
|
426
|
+
'- [ ] 目标:补齐路由模块和 mock 数据文件',
|
|
427
|
+
'- [ ] 输入:design.md、现有 `src/router/modules` 与 `src/mock` 目录约定',
|
|
428
|
+
'- [ ] 输出:`src/router/modules/products.ts`、`src/mock/products.ts`',
|
|
429
|
+
'- [ ] 验证点:路由指向商品 mock 页面,mock 数据文件可被页面导入',
|
|
430
|
+
'- [ ] 依赖或前置条件:子任务 1 的页面路径已确定',
|
|
431
|
+
'',
|
|
432
|
+
'### 子任务 3',
|
|
433
|
+
'- [ ] 目标:补齐 checklist 和 iterations,完成交付闭环',
|
|
434
|
+
'- [ ] 输入:实现结果、proposal.md、design.md、tasks.md',
|
|
435
|
+
'- [ ] 输出:`checklist.md`、`iterations.md`',
|
|
436
|
+
'- [ ] 验证点:检查结论、验证摘要、残留风险和交接提醒都已记录',
|
|
437
|
+
'- [ ] 依赖或前置条件:页面、路由和 mock 数据文件已落盘',
|
|
438
|
+
].join('\n'));
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function writeImplementationArtifacts(targetDir) {
|
|
442
|
+
writeFile(targetDir, 'src/views/products/mock/index.vue', [
|
|
443
|
+
'<template>',
|
|
444
|
+
' <section class="product-mock-page">',
|
|
445
|
+
' <h1>商品 Mock 页面</h1>',
|
|
446
|
+
' <ul>',
|
|
447
|
+
' <li v-for="item in productMock" :key="item.id">',
|
|
448
|
+
' <strong>{{ item.name }}</strong>',
|
|
449
|
+
' <span>{{ item.price }}</span>',
|
|
450
|
+
' </li>',
|
|
451
|
+
' </ul>',
|
|
452
|
+
' </section>',
|
|
453
|
+
'</template>',
|
|
454
|
+
'',
|
|
455
|
+
'<script setup lang="ts">',
|
|
456
|
+
"import { productMock } from '../../../mock/products';",
|
|
457
|
+
'</script>',
|
|
458
|
+
'',
|
|
459
|
+
'<style scoped>',
|
|
460
|
+
'.product-mock-page {',
|
|
461
|
+
' padding: 24px;',
|
|
462
|
+
'}',
|
|
463
|
+
'',
|
|
464
|
+
'.product-mock-page ul {',
|
|
465
|
+
' display: grid;',
|
|
466
|
+
' gap: 12px;',
|
|
467
|
+
' list-style: none;',
|
|
468
|
+
' padding: 0;',
|
|
469
|
+
'}',
|
|
470
|
+
'</style>',
|
|
471
|
+
].join('\n'));
|
|
472
|
+
|
|
473
|
+
writeFile(targetDir, 'src/router/modules/products.ts', [
|
|
474
|
+
'export default [',
|
|
475
|
+
' {',
|
|
476
|
+
" path: '/products/mock',",
|
|
477
|
+
" name: 'ProductsMock',",
|
|
478
|
+
" component: () => import('../../views/products/mock/index.vue'),",
|
|
479
|
+
' },',
|
|
480
|
+
'];',
|
|
481
|
+
].join('\n'));
|
|
482
|
+
|
|
483
|
+
writeFile(targetDir, 'src/mock/products.ts', [
|
|
484
|
+
'export const productMock = [',
|
|
485
|
+
" { id: 'p-001', name: '演示商品 A', price: '99.00' },",
|
|
486
|
+
" { id: 'p-002', name: '演示商品 B', price: '129.00' },",
|
|
487
|
+
'];',
|
|
488
|
+
].join('\n'));
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
function writeGuardianArtifacts(targetDir, changeId) {
|
|
492
|
+
writeFile(targetDir, `openspec/changes/${changeId}/checklist.md`, [
|
|
493
|
+
'# 检查清单',
|
|
494
|
+
'',
|
|
495
|
+
'## 通过项',
|
|
496
|
+
'- [x] proposal、specs、design 与实现结果保持一致',
|
|
497
|
+
'- [x] 已完成任务已真实反映在代码和配套文件中',
|
|
498
|
+
'- [x] 项目的目录、路由、接口、样式、测试等规则已满足当前示例边界',
|
|
499
|
+
'',
|
|
500
|
+
'### 本地验证摘要',
|
|
501
|
+
'- [x] lint(静态检查):通过,示例项目使用最小占位脚本返回成功',
|
|
502
|
+
'- [x] typecheck(类型检查):通过,示例目录结构满足仓库约定',
|
|
503
|
+
'- [x] test(测试):通过,runtime smoke 主链推进完成',
|
|
504
|
+
'- [x] build(构建):通过,示例项目占位构建脚本返回成功',
|
|
505
|
+
'',
|
|
506
|
+
'### 浏览器验证摘要',
|
|
507
|
+
'- [x] 页面可访问:通过,页面文件、路由文件和 mock 文件均已落盘',
|
|
508
|
+
'- [x] 关键路径可执行:通过,商品页面、路由和归档链路均已完成',
|
|
509
|
+
'- [x] console(控制台) 检查:通过,当前示例未引入浏览器脚本报错',
|
|
510
|
+
'',
|
|
511
|
+
'### 范围一致性',
|
|
512
|
+
'- [x] 当前实现未超出 proposal、design、tasks 已批准范围',
|
|
513
|
+
'',
|
|
514
|
+
'### 组件复用检查',
|
|
515
|
+
'- [x] 已记录当前示例优先复用仓库既有目录约定,暂无额外组件库缺口',
|
|
516
|
+
'',
|
|
517
|
+
'## 未通过项',
|
|
518
|
+
'- [ ] 记录未满足需求或项目规则的项',
|
|
519
|
+
'',
|
|
520
|
+
'## 阻断项',
|
|
521
|
+
'- [ ] 记录在继续交付、放行或归档前必须解决的项',
|
|
522
|
+
'',
|
|
523
|
+
'## 是否建议继续推进',
|
|
524
|
+
'建议继续推进:当前示例已达到 runtime smoke 演示目标,可继续归档。',
|
|
525
|
+
].join('\n'));
|
|
526
|
+
|
|
527
|
+
writeFile(targetDir, `openspec/changes/${changeId}/iterations.md`, [
|
|
528
|
+
'# 迭代记录',
|
|
529
|
+
'',
|
|
530
|
+
'## 本轮问题',
|
|
531
|
+
'- [x] 当前示例只覆盖最小 mock 交付链,不覆盖真实浏览器验证和真实接口接入。',
|
|
532
|
+
'- 问题来源:runtime smoke 以确定性 replay(回放) 为主,验证重点是主链闭环而不是业务复杂度。',
|
|
533
|
+
'- 影响范围:只能证明模板产物、代码落盘和归档流程可运行。',
|
|
534
|
+
'- 关联证据:checklist.md、`.ai-spec/current-run.json` 和归档后的 `openspec/changes/archive/` 目录。',
|
|
535
|
+
'',
|
|
536
|
+
'## 修正动作',
|
|
537
|
+
'- [x] 已补齐 proposal、design、tasks、checklist、iterations 的结构化示例内容。',
|
|
538
|
+
'- 已完成动作:新增页面、路由、mock 数据,并补录验证摘要和交付结论。',
|
|
539
|
+
'- 待跟进动作:后续可替换为真实业务页面或真实 AI IDE 执行回合。',
|
|
540
|
+
'',
|
|
541
|
+
'## 残留风险',
|
|
542
|
+
'- [ ] 真实浏览器验证、真实 API 和更严格的组件复用约束尚未纳入本次示例。',
|
|
543
|
+
'- 风险说明:如果直接把该示例当成业务实现模板,仍需补真实业务约束和验证脚本。',
|
|
544
|
+
'- 触发条件:进入真实业务项目、引入真实接口或涉及复杂状态管理时。',
|
|
545
|
+
'- 建议缓解方式:在业务项目中补齐 design、checklist 和浏览器验证证据,再推进归档。',
|
|
546
|
+
'',
|
|
547
|
+
'## 下轮提醒',
|
|
548
|
+
'- [ ] 下一轮可将最小示例替换成真实页面或真实 AI IDE 执行输入。',
|
|
549
|
+
'- 下一轮关注点:真实接口契约、组件复用策略和浏览器验证脚本接入。',
|
|
550
|
+
'- 交接说明:当前示例已可作为模板增强后的最小演示基线。',
|
|
551
|
+
].join('\n'));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
function writeBootstrapTurn(targetDir, payload) {
|
|
555
|
+
writeJson(targetDir, '.ai-spec/internal/tmp/task-orchestrator-turn.json', payload);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function writeExecutionInbox(targetDir, payload) {
|
|
559
|
+
writeJson(targetDir, '.ai-spec/internal/tmp/current-execution.json', payload);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function runDemoRuntimeSmoke(options = {}) {
|
|
563
|
+
const targetDir = path.resolve(options.target || defaultTarget);
|
|
564
|
+
const userInput = options.userInput || '新增一个商品 mock 页面';
|
|
565
|
+
const runId = options.runId || buildRunId();
|
|
566
|
+
const changeId = options.changeId || 'runtime-smoke-demo';
|
|
567
|
+
|
|
568
|
+
scaffoldDemoTarget(targetDir);
|
|
569
|
+
|
|
570
|
+
const start = protocolWorkflow.advanceProtocolStep({
|
|
571
|
+
target: targetDir,
|
|
572
|
+
userInput,
|
|
573
|
+
reviewPolicy: 'main-flow-blocking',
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
writeBootstrapTurn(targetDir, createBootstrapPayload(runId, userInput, changeId));
|
|
577
|
+
const afterBootstrap = runner.advanceRunner({ target: targetDir });
|
|
578
|
+
|
|
579
|
+
const requirementTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
580
|
+
writeRequirementArtifacts(targetDir, changeId);
|
|
581
|
+
writeExecutionInbox(targetDir, createExecutionPayload(
|
|
582
|
+
runId,
|
|
583
|
+
'requirement-analyst',
|
|
584
|
+
'需求解析专家',
|
|
585
|
+
['补齐 proposal', '输出 spec', '输出 tasks'],
|
|
586
|
+
));
|
|
587
|
+
const afterRequirement = runner.advanceRunner({ target: targetDir });
|
|
588
|
+
|
|
589
|
+
const implementationApprovalGate = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
590
|
+
writeJson(targetDir, '.ai-spec/internal/tmp/current-runtime-action.json', {
|
|
591
|
+
schema_version: 1,
|
|
592
|
+
kind: 'task-orchestrator-runtime-action',
|
|
593
|
+
action: 'approve',
|
|
594
|
+
gate: 'before-implementation',
|
|
595
|
+
to_role: 'frontend-implementer',
|
|
596
|
+
message: 'demo implementation approved',
|
|
597
|
+
});
|
|
598
|
+
const afterImplementationApproval = runner.advanceRunner({ target: targetDir });
|
|
599
|
+
|
|
600
|
+
const implementationTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
601
|
+
writeImplementationArtifacts(targetDir);
|
|
602
|
+
writeExecutionInbox(targetDir, createExecutionPayload(
|
|
603
|
+
runId,
|
|
604
|
+
'frontend-implementer',
|
|
605
|
+
'前端实现专家',
|
|
606
|
+
['完成最小页面实现', '补齐路由与 mock 数据'],
|
|
607
|
+
));
|
|
608
|
+
const afterImplementation = runner.advanceRunner({ target: targetDir });
|
|
609
|
+
|
|
610
|
+
const guardianApprovalGate = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
611
|
+
writeJson(targetDir, '.ai-spec/internal/tmp/current-runtime-action.json', {
|
|
612
|
+
schema_version: 1,
|
|
613
|
+
kind: 'task-orchestrator-runtime-action',
|
|
614
|
+
action: 'approve',
|
|
615
|
+
gate: 'before-guardian',
|
|
616
|
+
to_role: 'code-guardian',
|
|
617
|
+
message: 'demo guardian approved',
|
|
618
|
+
});
|
|
619
|
+
const afterGuardianApproval = runner.advanceRunner({ target: targetDir });
|
|
620
|
+
|
|
621
|
+
const guardianTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
622
|
+
writeGuardianArtifacts(targetDir, changeId);
|
|
623
|
+
writeExecutionInbox(targetDir, createExecutionPayload(
|
|
624
|
+
runId,
|
|
625
|
+
'code-guardian',
|
|
626
|
+
'规范守护者',
|
|
627
|
+
['检查范围与产物', '输出 checklist 与 iterations', '等待归档确认'],
|
|
628
|
+
));
|
|
629
|
+
const afterGuardian = runner.advanceRunner({ target: targetDir });
|
|
630
|
+
|
|
631
|
+
const archiveGate = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
632
|
+
writeJson(targetDir, '.ai-spec/internal/tmp/current-runtime-action.json', {
|
|
633
|
+
schema_version: 1,
|
|
634
|
+
kind: 'task-orchestrator-runtime-action',
|
|
635
|
+
action: 'approve',
|
|
636
|
+
gate: 'before-archive',
|
|
637
|
+
to_role: 'archive-change',
|
|
638
|
+
message: 'demo archive approved',
|
|
639
|
+
});
|
|
640
|
+
const afterArchiveApproval = runner.advanceRunner({ target: targetDir });
|
|
641
|
+
|
|
642
|
+
const archiveTurn = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
643
|
+
const afterArchive = archiveChange({
|
|
644
|
+
target: targetDir,
|
|
645
|
+
changeId,
|
|
646
|
+
completeRun: true,
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
const terminal = protocolWorkflow.advanceProtocolStep({ target: targetDir });
|
|
650
|
+
const currentRun = JSON.parse(fs.readFileSync(path.join(targetDir, '.ai-spec', 'current-run.json'), 'utf8'));
|
|
651
|
+
|
|
652
|
+
return {
|
|
653
|
+
kind: 'demo-runtime-smoke-result',
|
|
654
|
+
target: targetDir,
|
|
655
|
+
user_input: userInput,
|
|
656
|
+
run_id: runId,
|
|
657
|
+
change_id: changeId,
|
|
658
|
+
turns: {
|
|
659
|
+
start: {
|
|
660
|
+
actor: start.turn.actor?.id || null,
|
|
661
|
+
command: start.turn.command || null,
|
|
662
|
+
mode: start.turn.mode || null,
|
|
663
|
+
},
|
|
664
|
+
requirement_analyst: {
|
|
665
|
+
actor: requirementTurn.turn.actor?.id || null,
|
|
666
|
+
command: requirementTurn.turn.command || null,
|
|
667
|
+
},
|
|
668
|
+
frontend_implementer: {
|
|
669
|
+
actor: implementationTurn.turn.actor?.id || null,
|
|
670
|
+
command: implementationTurn.turn.command || null,
|
|
671
|
+
},
|
|
672
|
+
code_guardian: {
|
|
673
|
+
actor: guardianTurn.turn.actor?.id || null,
|
|
674
|
+
command: guardianTurn.turn.command || null,
|
|
675
|
+
},
|
|
676
|
+
archive_gate: {
|
|
677
|
+
status: archiveGate.turn.status || null,
|
|
678
|
+
gate: archiveGate.turn.guidance?.approval_gate?.gate || null,
|
|
679
|
+
},
|
|
680
|
+
archive_change: {
|
|
681
|
+
actor: archiveTurn.turn.actor?.id || null,
|
|
682
|
+
command: archiveTurn.turn.command || null,
|
|
683
|
+
},
|
|
684
|
+
terminal: {
|
|
685
|
+
status: terminal.turn.status || null,
|
|
686
|
+
actor: terminal.turn.actor?.id || null,
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
applied: {
|
|
690
|
+
bootstrap: afterBootstrap.applied.adapter_action,
|
|
691
|
+
requirement: afterRequirement.applied.adapter_action,
|
|
692
|
+
implementation: afterImplementation.applied.adapter_action,
|
|
693
|
+
guardian: afterGuardian.applied.adapter_action,
|
|
694
|
+
implementation_approval: afterImplementationApproval.applied.adapter_action,
|
|
695
|
+
guardian_approval: afterGuardianApproval.applied.adapter_action,
|
|
696
|
+
archive_approval: afterArchiveApproval.applied.adapter_action,
|
|
697
|
+
archive: afterArchive.runtime_transition?.state?.status || afterArchive.status,
|
|
698
|
+
},
|
|
699
|
+
current_run: {
|
|
700
|
+
status: currentRun.status,
|
|
701
|
+
current_role: currentRun.current_role,
|
|
702
|
+
events: Array.isArray(currentRun.events) ? currentRun.events.length : 0,
|
|
703
|
+
artifacts: currentRun.artifacts || null,
|
|
704
|
+
},
|
|
705
|
+
outputs: [
|
|
706
|
+
'.ai-spec/current-run.json',
|
|
707
|
+
'openspec/specs/ui/spec.md',
|
|
708
|
+
'openspec/specs/api/spec.md',
|
|
709
|
+
'src/views/products/mock/index.vue',
|
|
710
|
+
'src/router/modules/products.ts',
|
|
711
|
+
'src/mock/products.ts',
|
|
712
|
+
],
|
|
713
|
+
note: 'This demo replays deterministic expert outputs to verify the current expert-delivery runtime chain.',
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function printPretty(result) {
|
|
718
|
+
console.log('runtime smoke demo completed');
|
|
719
|
+
console.log(`target: ${result.target}`);
|
|
720
|
+
console.log(`run_id: ${result.run_id}`);
|
|
721
|
+
console.log(`change_id: ${result.change_id}`);
|
|
722
|
+
console.log(`current_run.status: ${result.current_run.status}`);
|
|
723
|
+
console.log(`current_run.events: ${result.current_run.events}`);
|
|
724
|
+
console.log('outputs:');
|
|
725
|
+
for (const item of result.outputs) {
|
|
726
|
+
console.log(` - ${item}`);
|
|
727
|
+
}
|
|
728
|
+
console.log('note:');
|
|
729
|
+
console.log(` ${result.note}`);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
function main(argv = process.argv.slice(2)) {
|
|
733
|
+
try {
|
|
734
|
+
const options = parseArgs(argv);
|
|
735
|
+
if (options.help) {
|
|
736
|
+
printUsage();
|
|
737
|
+
return 0;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
const result = runDemoRuntimeSmoke(options);
|
|
741
|
+
if (options.json) {
|
|
742
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
743
|
+
} else {
|
|
744
|
+
printPretty(result);
|
|
745
|
+
}
|
|
746
|
+
return 0;
|
|
747
|
+
} catch (error) {
|
|
748
|
+
console.error(error.message || error);
|
|
749
|
+
return 1;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
module.exports = {
|
|
754
|
+
runDemoRuntimeSmoke,
|
|
755
|
+
main,
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
if (require.main === module) {
|
|
759
|
+
process.exit(main());
|
|
760
|
+
}
|