zcode-expert-system 0.0.0-stage → 3.2.2
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/.zcode-plugin/plugin.json +25 -0
- package/LICENSE +30 -0
- package/README.md +680 -2
- package/README_CN.md +587 -0
- package/SKILL.md +357 -0
- package/agents/expert-academic-anthropologist.md +124 -0
- package/agents/expert-academic-geographer.md +126 -0
- package/agents/expert-academic-historian.md +122 -0
- package/agents/expert-academic-narratologist.md +117 -0
- package/agents/expert-academic-psychologist.md +117 -0
- package/agents/expert-academic-statistician.md +40 -0
- package/agents/expert-academic-study-planner.md +262 -0
- package/agents/expert-accounts-payable-agent.md +102 -0
- package/agents/expert-agentic-identity-trust.md +388 -0
- package/agents/expert-agents-orchestrator.md +366 -0
- package/agents/expert-authenticity-appraiser.md +38 -0
- package/agents/expert-automation-governance-architect.md +215 -0
- package/agents/expert-blender-addon-engineer.md +233 -0
- package/agents/expert-business-strategist.md +487 -0
- package/agents/expert-change-management-consultant.md +495 -0
- package/agents/expert-chief-executive-officer.md +104 -0
- package/agents/expert-chief-financial-officer.md +390 -0
- package/agents/expert-chief-marketing-officer.md +95 -0
- package/agents/expert-chief-of-staff.md +278 -0
- package/agents/expert-chief-operating-officer.md +88 -0
- package/agents/expert-chief-product-officer.md +91 -0
- package/agents/expert-chief-technology-officer.md +98 -0
- package/agents/expert-corporate-training-designer.md +191 -0
- package/agents/expert-customer-service.md +40 -0
- package/agents/expert-customer-success-manager.md +458 -0
- package/agents/expert-data-consolidation-agent.md +327 -0
- package/agents/expert-data-privacy-officer.md +411 -0
- package/agents/expert-design-brand-guardian.md +321 -0
- package/agents/expert-design-image-prompt-engineer.md +255 -0
- package/agents/expert-design-inclusive-visuals-specialist.md +177 -0
- package/agents/expert-design-persona-walkthrough.md +271 -0
- package/agents/expert-design-ui-designer.md +382 -0
- package/agents/expert-design-ui-finish-gate-reviewer.md +40 -0
- package/agents/expert-design-ux-architect.md +482 -0
- package/agents/expert-design-ux-researcher.md +328 -0
- package/agents/expert-design-video-prompt-engineer.md +110 -0
- package/agents/expert-design-visual-storyteller.md +159 -0
- package/agents/expert-design-whimsy-injector.md +453 -0
- package/agents/expert-economy-designer.md +40 -0
- package/agents/expert-engineering-ai-data-remediation-engineer.md +209 -0
- package/agents/expert-engineering-ai-engineer.md +161 -0
- package/agents/expert-engineering-api-platform-engineer.md +40 -0
- package/agents/expert-engineering-ats-validator-architect.md +38 -0
- package/agents/expert-engineering-autonomous-optimization-architect.md +115 -0
- package/agents/expert-engineering-backend-architect.md +234 -0
- package/agents/expert-engineering-china-network-engineer.md +33 -0
- package/agents/expert-engineering-cms-developer.md +534 -0
- package/agents/expert-engineering-code-reviewer.md +172 -0
- package/agents/expert-engineering-codebase-onboarding-engineer.md +172 -0
- package/agents/expert-engineering-data-engineer.md +324 -0
- package/agents/expert-engineering-data-visualization-engineer.md +40 -0
- package/agents/expert-engineering-database-optimizer.md +175 -0
- package/agents/expert-engineering-database-reliability-engineer.md +40 -0
- package/agents/expert-engineering-desktop-app-engineer.md +40 -0
- package/agents/expert-engineering-developer-tooling-engineer.md +40 -0
- package/agents/expert-engineering-devops-automator.md +375 -0
- package/agents/expert-engineering-dingtalk-integration-developer.md +574 -0
- package/agents/expert-engineering-drupal-performance.md +40 -0
- package/agents/expert-engineering-drupal-shopping-cart.md +359 -0
- package/agents/expert-engineering-email-intelligence-engineer.md +349 -0
- package/agents/expert-engineering-embedded-firmware-engineer.md +168 -0
- package/agents/expert-engineering-embedded-linux-driver-engineer.md +255 -0
- package/agents/expert-engineering-feishu-integration-developer.md +597 -0
- package/agents/expert-engineering-filament-optimization-specialist.md +283 -0
- package/agents/expert-engineering-finops-engineer.md +40 -0
- package/agents/expert-engineering-fpga-digital-design-engineer.md +227 -0
- package/agents/expert-engineering-frontend-developer.md +224 -0
- package/agents/expert-engineering-gaussdb-expert.md +40 -0
- package/agents/expert-engineering-git-workflow-master.md +220 -0
- package/agents/expert-engineering-i18n-engineer.md +40 -0
- package/agents/expert-engineering-identity-access-engineer.md +40 -0
- package/agents/expert-engineering-incident-response-commander.md +465 -0
- package/agents/expert-engineering-iot-fleet-engineer.md +40 -0
- package/agents/expert-engineering-iot-solution-architect.md +220 -0
- package/agents/expert-engineering-it-service-manager.md +560 -0
- package/agents/expert-engineering-knowledge-graph-engineer.md +40 -0
- package/agents/expert-engineering-llm-post-training-engineer.md +40 -0
- package/agents/expert-engineering-mechanical-design-engineer.md +311 -0
- package/agents/expert-engineering-minimal-change-engineer.md +206 -0
- package/agents/expert-engineering-mobile-app-builder.md +434 -0
- package/agents/expert-engineering-mobile-release-engineer.md +40 -0
- package/agents/expert-engineering-multi-agent-systems-architect.md +599 -0
- package/agents/expert-engineering-network-engineer-china.md +162 -0
- package/agents/expert-engineering-network-engineer.md +40 -0
- package/agents/expert-engineering-orgscript-engineer.md +112 -0
- package/agents/expert-engineering-payments-billing-engineer.md +40 -0
- package/agents/expert-engineering-pc-host-engineer.md +231 -0
- package/agents/expert-engineering-pdf-engine-architect.md +32 -0
- package/agents/expert-engineering-platform-engineer.md +32 -0
- package/agents/expert-engineering-privacy-engineer.md +40 -0
- package/agents/expert-engineering-prompt-engineer.md +203 -0
- package/agents/expert-engineering-rag-pipeline-engineer.md +40 -0
- package/agents/expert-engineering-rapid-prototyper.md +461 -0
- package/agents/expert-engineering-realtime-collaboration-engineer.md +40 -0
- package/agents/expert-engineering-rust-refactoring-specialist.md +40 -0
- package/agents/expert-engineering-search-relevance-engineer.md +40 -0
- package/agents/expert-engineering-section-508-specialist.md +40 -0
- package/agents/expert-engineering-security-engineer.md +303 -0
- package/agents/expert-engineering-senior-developer.md +177 -0
- package/agents/expert-engineering-servicenow-developer-mentor.md +32 -0
- package/agents/expert-engineering-software-architect.md +200 -0
- package/agents/expert-engineering-solidity-smart-contract-engineer.md +541 -0
- package/agents/expert-engineering-sre.md +233 -0
- package/agents/expert-engineering-technical-writer.md +409 -0
- package/agents/expert-engineering-threat-detection-engineer.md +553 -0
- package/agents/expert-engineering-universal-document-compiler.md +32 -0
- package/agents/expert-engineering-uswds-developer.md +40 -0
- package/agents/expert-engineering-video-streaming-engineer.md +40 -0
- package/agents/expert-engineering-voice-ai-integration-engineer.md +560 -0
- package/agents/expert-engineering-webassembly-engineer.md +40 -0
- package/agents/expert-engineering-wechat-mini-program-developer.md +288 -0
- package/agents/expert-engineering-wordpress-performance.md +40 -0
- package/agents/expert-engineering-wordpress-shopping-cart.md +345 -0
- package/agents/expert-esg-sustainability-officer.md +395 -0
- package/agents/expert-finance-bookkeeper-controller.md +271 -0
- package/agents/expert-finance-financial-analyst.md +244 -0
- package/agents/expert-finance-financial-forecaster.md +213 -0
- package/agents/expert-finance-fpa-analyst.md +272 -0
- package/agents/expert-finance-fraud-detector.md +241 -0
- package/agents/expert-finance-hk-stock-compliance-reviewer.md +316 -0
- package/agents/expert-finance-investment-researcher.md +283 -0
- package/agents/expert-finance-invoice-manager.md +242 -0
- package/agents/expert-finance-tax-strategist.md +250 -0
- package/agents/expert-game-audio-engineer.md +265 -0
- package/agents/expert-game-designer.md +168 -0
- package/agents/expert-gaokao-college-advisor.md +333 -0
- package/agents/expert-gis-3d-scene-developer.md +110 -0
- package/agents/expert-gis-analyst.md +90 -0
- package/agents/expert-gis-bim-specialist.md +107 -0
- package/agents/expert-gis-cartography-designer.md +149 -0
- package/agents/expert-gis-drone-reality-mapping.md +119 -0
- package/agents/expert-gis-geoai-ml-engineer.md +104 -0
- package/agents/expert-gis-geoprocessing-specialist.md +96 -0
- package/agents/expert-gis-qa-engineer.md +132 -0
- package/agents/expert-gis-solution-engineer.md +100 -0
- package/agents/expert-gis-spatial-data-engineer.md +96 -0
- package/agents/expert-gis-spatial-data-scientist.md +110 -0
- package/agents/expert-gis-technical-consultant.md +85 -0
- package/agents/expert-gis-web-gis-developer.md +107 -0
- package/agents/expert-godot-gameplay-scripter.md +335 -0
- package/agents/expert-godot-multiplayer-engineer.md +296 -0
- package/agents/expert-godot-shader-developer.md +267 -0
- package/agents/expert-government-digital-presales-consultant.md +362 -0
- package/agents/expert-grant-writer.md +510 -0
- package/agents/expert-healthcare-aging-parent-care-companion.md +40 -0
- package/agents/expert-healthcare-clinical-evidence-agent.md +40 -0
- package/agents/expert-healthcare-customer-service.md +388 -0
- package/agents/expert-healthcare-innovation-strategist.md +40 -0
- package/agents/expert-healthcare-marketing-compliance.md +394 -0
- package/agents/expert-healthcare-sovereign-health-systems-agent.md +40 -0
- package/agents/expert-hospitality-guest-services.md +597 -0
- package/agents/expert-hr-onboarding.md +450 -0
- package/agents/expert-hr-performance-reviewer.md +248 -0
- package/agents/expert-hr-recruiter.md +232 -0
- package/agents/expert-identity-graph-operator.md +270 -0
- package/agents/expert-language-translator.md +275 -0
- package/agents/expert-legal-billing-time-tracking.md +566 -0
- package/agents/expert-legal-client-intake.md +487 -0
- package/agents/expert-legal-contract-reviewer.md +240 -0
- package/agents/expert-legal-document-review.md +452 -0
- package/agents/expert-legal-policy-writer.md +308 -0
- package/agents/expert-level-designer.md +209 -0
- package/agents/expert-livestock-archive-auditor.md +135 -0
- package/agents/expert-loan-officer-assistant.md +549 -0
- package/agents/expert-lsp-index-engineer.md +334 -0
- package/agents/expert-ma-integration-manager.md +426 -0
- package/agents/expert-macos-spatial-metal-engineer.md +337 -0
- package/agents/expert-marketing-aeo-foundations.md +263 -0
- package/agents/expert-marketing-agentic-search-optimizer.md +312 -0
- package/agents/expert-marketing-ai-citation-strategist.md +169 -0
- package/agents/expert-marketing-app-store-optimizer.md +319 -0
- package/agents/expert-marketing-baidu-seo-specialist.md +220 -0
- package/agents/expert-marketing-bilibili-content-strategist.md +40 -0
- package/agents/expert-marketing-bilibili-strategist.md +194 -0
- package/agents/expert-marketing-book-co-author.md +109 -0
- package/agents/expert-marketing-carousel-growth-engine.md +215 -0
- package/agents/expert-marketing-china-ecommerce-operator.md +277 -0
- package/agents/expert-marketing-china-market-localization-strategist.md +282 -0
- package/agents/expert-marketing-content-creator.md +145 -0
- package/agents/expert-marketing-cross-border-ecommerce.md +260 -0
- package/agents/expert-marketing-daily-news-briefing.md +303 -0
- package/agents/expert-marketing-developer-community-builder.md +32 -0
- package/agents/expert-marketing-douyin-strategist.md +150 -0
- package/agents/expert-marketing-ecommerce-operator.md +216 -0
- package/agents/expert-marketing-email-strategist.md +248 -0
- package/agents/expert-marketing-global-podcast-strategist.md +204 -0
- package/agents/expert-marketing-growth-hacker.md +121 -0
- package/agents/expert-marketing-instagram-curator.md +179 -0
- package/agents/expert-marketing-knowledge-commerce-strategist.md +384 -0
- package/agents/expert-marketing-kuaishou-strategist.md +182 -0
- package/agents/expert-marketing-linkedin-content-creator.md +232 -0
- package/agents/expert-marketing-livestream-commerce-coach.md +303 -0
- package/agents/expert-marketing-multi-platform-publisher.md +216 -0
- package/agents/expert-marketing-podcast-strategist.md +278 -0
- package/agents/expert-marketing-pr-communications-manager.md +472 -0
- package/agents/expert-marketing-private-domain-operator.md +309 -0
- package/agents/expert-marketing-reddit-community-builder.md +127 -0
- package/agents/expert-marketing-search-growth-orchestrator.md +372 -0
- package/agents/expert-marketing-seo-specialist.md +298 -0
- package/agents/expert-marketing-short-video-editing-coach.md +413 -0
- package/agents/expert-marketing-social-media-strategist.md +118 -0
- package/agents/expert-marketing-tiktok-strategist.md +124 -0
- package/agents/expert-marketing-twitter-engager.md +132 -0
- package/agents/expert-marketing-video-optimization-specialist.md +128 -0
- package/agents/expert-marketing-wechat-official-account.md +158 -0
- package/agents/expert-marketing-wechat-operator.md +156 -0
- package/agents/expert-marketing-weibo-strategist.md +241 -0
- package/agents/expert-marketing-weixin-channels-strategist.md +297 -0
- package/agents/expert-marketing-x-twitter-intelligence-analyst.md +160 -0
- package/agents/expert-marketing-xiaohongshu-operator.md +139 -0
- package/agents/expert-marketing-xiaohongshu-specialist.md +151 -0
- package/agents/expert-marketing-zhihu-strategist.md +175 -0
- package/agents/expert-medical-billing-coding-specialist.md +489 -0
- package/agents/expert-narrative-designer.md +244 -0
- package/agents/expert-operations-manager.md +398 -0
- package/agents/expert-organizational-psychologist.md +390 -0
- package/agents/expert-paid-media-auditor.md +170 -0
- package/agents/expert-paid-media-creative-strategist.md +173 -0
- package/agents/expert-paid-media-paid-social-strategist.md +180 -0
- package/agents/expert-paid-media-ppc-strategist.md +180 -0
- package/agents/expert-paid-media-programmatic-buyer.md +177 -0
- package/agents/expert-paid-media-search-query-analyst.md +182 -0
- package/agents/expert-paid-media-tracking-specialist.md +199 -0
- package/agents/expert-personal-growth-mentor.md +158 -0
- package/agents/expert-product-behavioral-nudge-engine.md +246 -0
- package/agents/expert-product-dx-engineer.md +32 -0
- package/agents/expert-product-feedback-synthesizer.md +175 -0
- package/agents/expert-product-manager.md +474 -0
- package/agents/expert-product-sprint-prioritizer.md +133 -0
- package/agents/expert-product-trend-researcher.md +143 -0
- package/agents/expert-project-management-experiment-tracker.md +206 -0
- package/agents/expert-project-management-jira-workflow-steward.md +249 -0
- package/agents/expert-project-management-meeting-notes-specialist.md +94 -0
- package/agents/expert-project-management-project-shepherd.md +202 -0
- package/agents/expert-project-management-studio-operations.md +208 -0
- package/agents/expert-project-management-studio-producer.md +211 -0
- package/agents/expert-project-manager-senior.md +135 -0
- package/agents/expert-prompt-engineer.md +176 -0
- package/agents/expert-real-estate-buyer-seller.md +594 -0
- package/agents/expert-recruitment-specialist.md +49 -0
- package/agents/expert-report-distribution-agent.md +354 -0
- package/agents/expert-research-synthesist.md +40 -0
- package/agents/expert-resume-tailor.md +40 -0
- package/agents/expert-retail-customer-returns.md +564 -0
- package/agents/expert-roblox-avatar-creator.md +298 -0
- package/agents/expert-roblox-experience-designer.md +306 -0
- package/agents/expert-roblox-systems-scripter.md +325 -0
- package/agents/expert-sales-account-strategist.md +243 -0
- package/agents/expert-sales-coach.md +291 -0
- package/agents/expert-sales-data-extraction-agent.md +159 -0
- package/agents/expert-sales-deal-strategist.md +204 -0
- package/agents/expert-sales-discovery-coach.md +230 -0
- package/agents/expert-sales-engineer.md +200 -0
- package/agents/expert-sales-offer-lead-gen-strategist.md +256 -0
- package/agents/expert-sales-outbound-strategist.md +208 -0
- package/agents/expert-sales-outreach.md +40 -0
- package/agents/expert-sales-pipeline-analyst.md +284 -0
- package/agents/expert-sales-proposal-strategist.md +233 -0
- package/agents/expert-security-ai-generated-code-auditor.md +40 -0
- package/agents/expert-security-appsec-engineer.md +490 -0
- package/agents/expert-security-architect.md +303 -0
- package/agents/expert-security-blockchain-security-auditor.md +462 -0
- package/agents/expert-security-cloud-security-architect.md +522 -0
- package/agents/expert-security-compliance-auditor.md +157 -0
- package/agents/expert-security-incident-responder.md +436 -0
- package/agents/expert-security-penetration-tester.md +398 -0
- package/agents/expert-security-secrets-credential-engineer.md +40 -0
- package/agents/expert-security-senior-secops.md +751 -0
- package/agents/expert-security-threat-detection-engineer.md +533 -0
- package/agents/expert-security-threat-intelligence-analyst.md +643 -0
- package/agents/expert-specialized-ai-policy-writer.md +217 -0
- package/agents/expert-specialized-chief-of-staff.md +40 -0
- package/agents/expert-specialized-civil-engineer.md +355 -0
- package/agents/expert-specialized-codebase-archaeologist.md +40 -0
- package/agents/expert-specialized-cultural-intelligence-strategist.md +168 -0
- package/agents/expert-specialized-developer-advocate.md +334 -0
- package/agents/expert-specialized-document-generator.md +346 -0
- package/agents/expert-specialized-fedramp-rmf-compliance.md +40 -0
- package/agents/expert-specialized-focus-music-architect.md +32 -0
- package/agents/expert-specialized-french-consulting-market.md +46 -0
- package/agents/expert-specialized-korean-business-navigator.md +46 -0
- package/agents/expert-specialized-master-plan-architect.md +40 -0
- package/agents/expert-specialized-mcp-builder.md +351 -0
- package/agents/expert-specialized-meeting-assistant.md +236 -0
- package/agents/expert-specialized-model-qa.md +507 -0
- package/agents/expert-specialized-pricing-analyst.md +242 -0
- package/agents/expert-specialized-pricing-optimizer.md +254 -0
- package/agents/expert-specialized-risk-assessor.md +240 -0
- package/agents/expert-specialized-salesforce-architect.md +179 -0
- package/agents/expert-specialized-strategy-duel-agent.md +129 -0
- package/agents/expert-specialized-workflow-architect.md +596 -0
- package/agents/expert-study-abroad-advisor.md +281 -0
- package/agents/expert-supply-chain-garment-factory-planning-engineer.md +262 -0
- package/agents/expert-supply-chain-inventory-forecaster.md +212 -0
- package/agents/expert-supply-chain-route-optimizer.md +224 -0
- package/agents/expert-supply-chain-strategist.md +581 -0
- package/agents/expert-supply-chain-vendor-evaluator.md +232 -0
- package/agents/expert-support-analytics-reporter.md +364 -0
- package/agents/expert-support-executive-summary-generator.md +217 -0
- package/agents/expert-support-finance-tracker.md +447 -0
- package/agents/expert-support-infrastructure-maintainer.md +623 -0
- package/agents/expert-support-legal-compliance-checker.md +587 -0
- package/agents/expert-support-recruitment-specialist.md +508 -0
- package/agents/expert-support-support-responder.md +584 -0
- package/agents/expert-technical-artist.md +230 -0
- package/agents/expert-technical-translator-agent.md +167 -0
- package/agents/expert-terminal-integration-specialist.md +236 -0
- package/agents/expert-testing-accessibility-auditor.md +329 -0
- package/agents/expert-testing-api-tester.md +305 -0
- package/agents/expert-testing-embedded-qa-engineer.md +258 -0
- package/agents/expert-testing-evidence-collector.md +153 -0
- package/agents/expert-testing-performance-benchmarker.md +196 -0
- package/agents/expert-testing-reality-checker.md +235 -0
- package/agents/expert-testing-test-automation-engineer.md +40 -0
- package/agents/expert-testing-test-results-analyzer.md +313 -0
- package/agents/expert-testing-tool-evaluator.md +402 -0
- package/agents/expert-testing-workflow-optimizer.md +458 -0
- package/agents/expert-travel-planner.md +38 -0
- package/agents/expert-unity-architect.md +272 -0
- package/agents/expert-unity-editor-tool-developer.md +300 -0
- package/agents/expert-unity-multiplayer-engineer.md +238 -0
- package/agents/expert-unity-shader-graph-artist.md +270 -0
- package/agents/expert-unreal-multiplayer-architect.md +314 -0
- package/agents/expert-unreal-systems-engineer.md +311 -0
- package/agents/expert-unreal-technical-artist.md +256 -0
- package/agents/expert-unreal-world-builder.md +274 -0
- package/agents/expert-visionos-spatial-engineer.md +282 -0
- package/agents/expert-xr-cockpit-interaction-specialist.md +220 -0
- package/agents/expert-xr-immersive-developer.md +229 -0
- package/agents/expert-xr-interface-architect.md +253 -0
- package/agents/expert-zk-steward.md +228 -0
- package/agents/manager-academic-research.md +96 -0
- package/agents/manager-agent-governance.md +90 -0
- package/agents/manager-ai-llm.md +94 -0
- package/agents/manager-backend-architecture.md +106 -0
- package/agents/manager-business-strategy.md +102 -0
- package/agents/manager-business-support.md +96 -0
- package/agents/manager-customer-support.md +95 -0
- package/agents/manager-data-database.md +92 -0
- package/agents/manager-data-knowledge.md +88 -0
- package/agents/manager-data-testing.md +105 -0
- package/agents/manager-design-creative.md +103 -0
- package/agents/manager-devops-operations.md +92 -0
- package/agents/manager-embedded-iot.md +90 -0
- package/agents/manager-engineering-quality.md +94 -0
- package/agents/manager-finance-tax.md +99 -0
- package/agents/manager-frontend-client.md +116 -0
- package/agents/manager-game-dev.md +120 -0
- package/agents/manager-gis.md +104 -0
- package/agents/manager-government-public.md +84 -0
- package/agents/manager-healthcare.md +88 -0
- package/agents/manager-hr.md +87 -0
- package/agents/manager-language-translation.md +82 -0
- package/agents/manager-legal-compliance.md +86 -0
- package/agents/manager-marketing-growth.md +138 -0
- package/agents/manager-network-engineering.md +83 -0
- package/agents/manager-paid-media.md +92 -0
- package/agents/manager-product-management.md +90 -0
- package/agents/manager-project-management.md +94 -0
- package/agents/manager-sales-customer.md +97 -0
- package/agents/manager-security-compliance.md +109 -0
- package/agents/manager-spatial-computing.md +90 -0
- package/agents/manager-supply-chain.md +87 -0
- package/bin/cli.js +84 -0
- package/commands/wf/archive.md +111 -0
- package/commands/wf/check.md +68 -0
- package/commands/wf/deliver.md +76 -0
- package/commands/wf/design.md +56 -0
- package/commands/wf/dispatch.md +90 -0
- package/commands/wf/env.md +81 -0
- package/commands/wf/implement.md +96 -0
- package/commands/wf/plan.md +78 -0
- package/commands/wf/resume.md +59 -0
- package/commands/wf/spec.md +88 -0
- package/commands/wf/triage.md +50 -0
- package/commands/wf/verify.md +93 -0
- package/config/categories.json +557 -0
- package/config/experts.json +3318 -0
- package/config/workflow.json +848 -0
- package/context/context-manager.py +339 -0
- package/docs/workflow-fusion-design.md +239 -0
- package/hooks/claude-hooks.json +16 -0
- package/hooks/hooks.json +20 -0
- package/hooks/prepend-global-rules-reminder.mjs +342 -0
- package/icon.png +0 -0
- package/package.json +61 -3
- package/references/openspec-manual-mode.md +97 -0
- package/references/roles/analyst.md +62 -0
- package/references/roles/implementer.md +67 -0
- package/references/roles/investigator.md +88 -0
- package/references/roles/orchestrator.md +66 -0
- package/references/roles/reviewer.md +103 -0
- package/references/stage-S0-triage.md +68 -0
- package/references/stage-S1-design.md +53 -0
- package/references/stage-S2-spec.md +135 -0
- package/references/stage-S3-plan.md +84 -0
- package/references/stage-S4-env-baseline.md +81 -0
- package/references/stage-S5-implement.md +139 -0
- package/references/stage-S6-verify-review.md +80 -0
- package/references/stage-S7-deliver.md +81 -0
- package/references/stage-S8-sync-archive.md +168 -0
- package/references/workflow-tree.md +98 -0
- package/scripts/cc-uninstall.js +123 -0
- package/scripts/embedding_client.py +44 -0
- package/scripts/install-claude-code.js +477 -0
- package/scripts/install.js +1592 -0
- package/scripts/llm_client.py +202 -0
- package/scripts/openspec_engine.py +707 -0
- package/scripts/sdd/review-package +65 -0
- package/scripts/sdd/sdd-workspace +108 -0
- package/scripts/sdd/task-brief +49 -0
- package/scripts/target-menu.js +125 -0
- package/scripts/workflow_check.py +1955 -0
- package/skill_entry.py +193 -0
- package/templates/bug-report.md +86 -0
- package/templates/minimal-contract.md +54 -0
- package/templates/plan-sections.md +190 -0
- package/templates/progress.md +89 -0
- package/templates/review-report.md +51 -0
- package/templates/task-report.md +84 -0
- package/vendor/skills/LICENSE +21 -0
- package/vendor/skills/PROVENANCE.md +79 -0
- package/vendor/skills/zes-brainstorming/SKILL.md +302 -0
- package/vendor/skills/zes-brainstorming/builder-check-prompt.md +23 -0
- package/vendor/skills/zes-code-review/SKILL.md +103 -0
- package/vendor/skills/zes-finishing/SKILL.md +233 -0
- package/vendor/skills/zes-openspec-apply-change/SKILL.md +206 -0
- package/vendor/skills/zes-openspec-archive-change/SKILL.md +221 -0
- package/vendor/skills/zes-openspec-explore/SKILL.md +356 -0
- package/vendor/skills/zes-openspec-propose/SKILL.md +175 -0
- package/vendor/skills/zes-openspec-sync-specs/SKILL.md +290 -0
- package/vendor/skills/zes-openspec-update-change/SKILL.md +109 -0
- package/vendor/skills/zes-receiving-review/SKILL.md +213 -0
- package/vendor/skills/zes-sdd/SKILL.md +345 -0
- package/vendor/skills/zes-sdd/references/batching.md +11 -0
- package/vendor/skills/zes-sdd/references/cannot-verify.md +10 -0
- package/vendor/skills/zes-sdd/references/final-review.md +47 -0
- package/vendor/skills/zes-sdd/references/fix-loop.md +77 -0
- package/vendor/skills/zes-sdd/references/handling-reports.md +15 -0
- package/vendor/skills/zes-sdd/references/preflight.md +26 -0
- package/vendor/skills/zes-sdd/references/resuming.md +12 -0
- package/vendor/skills/zes-systematic-debugging/SKILL.md +291 -0
- package/vendor/skills/zes-systematic-debugging/condition-based-waiting.md +115 -0
- package/vendor/skills/zes-systematic-debugging/defense-in-depth.md +122 -0
- package/vendor/skills/zes-systematic-debugging/find-polluter.sh +72 -0
- package/vendor/skills/zes-systematic-debugging/root-cause-tracing.md +169 -0
- package/vendor/skills/zes-tdd/SKILL.md +338 -0
- package/vendor/skills/zes-tdd/writing-good-tests.md +198 -0
- package/vendor/skills/zes-verification/SKILL.md +128 -0
- package/vendor/skills/zes-writing-plans/SKILL.md +212 -0
- package/zcode_dev_workflow.py +1343 -0
- package/zcode_expert_system.py +1115 -0
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""OpenSpec 引擎 —— 内置 CLI(前三个子命令:new-change / status / instructions)。
|
|
3
|
+
|
|
4
|
+
仅使用 Python 3 标准库(json/os/re/sys/argparse/datetime/pathlib),无第三方依赖。
|
|
5
|
+
.openspec.yaml 手写/手读简单键值对,不依赖第三方 YAML 库。
|
|
6
|
+
LF 行尾,pathlib 跨平台路径。
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import re
|
|
13
|
+
import shutil
|
|
14
|
+
import sys
|
|
15
|
+
from datetime import date, datetime
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
# 四件产物及其在 change 目录下的相对路径(按 OpenSpec/S2 规格)
|
|
19
|
+
PRODUCTS = {
|
|
20
|
+
"proposal": "proposal.md",
|
|
21
|
+
"design": "design.md",
|
|
22
|
+
"tasks": "tasks.md",
|
|
23
|
+
"specs": "specs",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# I-05:归档前校验 tasks.md 实际勾选。口径与 workflow_check.count_checkboxes
|
|
27
|
+
# 一致——空框 [] 算未完成,仅 x/X 算完成([ x ] 带空格同样算 x)。
|
|
28
|
+
_TASK_LINE_PATTERN = re.compile(r"^\s*(?:[-*+]|\d{1,9}[.)])\s*\[([^\]]*)\]\s*(.*)$")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def count_task_checkboxes(text):
|
|
32
|
+
"""统计 tasks.md 勾选:返回 (done, todo)。
|
|
33
|
+
|
|
34
|
+
空框 [] 算 todo(未完成);x/X(含 [ x ] 带空格)算 done。
|
|
35
|
+
与 workflow_check.count_checkboxes 的 done/todo 口径一致,但 I-05
|
|
36
|
+
只需二分判定,不单独拆 other(异形标记 [~] 等按未完成处理,更保守)。
|
|
37
|
+
"""
|
|
38
|
+
done = todo = 0
|
|
39
|
+
for line in (text or "").splitlines():
|
|
40
|
+
m = _TASK_LINE_PATTERN.match(line)
|
|
41
|
+
if not m:
|
|
42
|
+
continue
|
|
43
|
+
mark = (m.group(1) or "").strip().lower()
|
|
44
|
+
if mark == "x":
|
|
45
|
+
done += 1
|
|
46
|
+
else:
|
|
47
|
+
todo += 1
|
|
48
|
+
return done, todo
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def change_dir(root: Path, name: str) -> Path:
|
|
52
|
+
# 库模式抛 ValueError(调用方自行处置);6 个 CLI 入口捕获后转
|
|
53
|
+
# 「error: ... + return 1」,进程退出码语义不变——勿在库函数里
|
|
54
|
+
# sys.exit,那会以 SystemExit 炸宿主进程。
|
|
55
|
+
if name == "archive":
|
|
56
|
+
raise ValueError("'archive' is a reserved container name, not a change")
|
|
57
|
+
return root / "openspec" / "changes" / name
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def write_metadata(cdir: Path, name: str) -> None:
|
|
61
|
+
"""手写 .openspec.yaml,简单键值对,LF 行尾。"""
|
|
62
|
+
lines = [
|
|
63
|
+
"schema: spec-driven",
|
|
64
|
+
f"name: {name}",
|
|
65
|
+
f"created: {date.today().isoformat()}",
|
|
66
|
+
"status: pending",
|
|
67
|
+
]
|
|
68
|
+
(cdir / ".openspec.yaml").write_text("\n".join(lines) + "\n", encoding="utf-8")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def write_status(cdir: Path, status: dict) -> None:
|
|
72
|
+
"""手写 .status.json,简单 JSON,LF 行尾。"""
|
|
73
|
+
(cdir / ".status.json").write_text(
|
|
74
|
+
json.dumps(status, ensure_ascii=False, indent=2),
|
|
75
|
+
encoding="utf-8",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def cmd_new_change(args) -> int:
|
|
80
|
+
root = Path(args.root).resolve()
|
|
81
|
+
try:
|
|
82
|
+
cdir = change_dir(root, args.name)
|
|
83
|
+
except ValueError as exc:
|
|
84
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
85
|
+
return 1
|
|
86
|
+
if cdir.exists():
|
|
87
|
+
print(f"error: change already exists: {cdir}", file=sys.stderr)
|
|
88
|
+
return 1
|
|
89
|
+
cdir.mkdir(parents=True, exist_ok=True)
|
|
90
|
+
(cdir / "specs").mkdir(exist_ok=True)
|
|
91
|
+
write_metadata(cdir, args.name)
|
|
92
|
+
write_status(cdir, {
|
|
93
|
+
"tasksCompleted": False,
|
|
94
|
+
"specsConsistent": False,
|
|
95
|
+
"testsPassed": False,
|
|
96
|
+
"reviewPassed": False,
|
|
97
|
+
"noBlockers": True,
|
|
98
|
+
"gitStatusOk": True,
|
|
99
|
+
"docsUpdated": True,
|
|
100
|
+
"parked": False,
|
|
101
|
+
})
|
|
102
|
+
print(f"change created: {cdir}")
|
|
103
|
+
return 0
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def product_state(cdir: Path, product: str) -> str:
|
|
107
|
+
"""状态只判文件是否存在(OpenSpec:status 只判文件存在,别被 done 误导)。"""
|
|
108
|
+
rel = PRODUCTS[product]
|
|
109
|
+
target = cdir / rel
|
|
110
|
+
if product == "specs":
|
|
111
|
+
# 空的 specs/ 子目录不算产物就绪;只有包含具体 spec 时才为 done
|
|
112
|
+
return "done" if (target.is_dir() and any(target.iterdir())) else "pending"
|
|
113
|
+
return "done" if target.is_file() else "pending"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def cmd_status(args) -> int:
|
|
117
|
+
root = Path(args.root).resolve()
|
|
118
|
+
try:
|
|
119
|
+
cdir = change_dir(root, args.change)
|
|
120
|
+
except ValueError as exc:
|
|
121
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
122
|
+
return 1
|
|
123
|
+
if not cdir.exists():
|
|
124
|
+
print(f"error: change not found: {cdir}", file=sys.stderr)
|
|
125
|
+
return 1
|
|
126
|
+
products = {name: product_state(cdir, name) for name in PRODUCTS}
|
|
127
|
+
result = {
|
|
128
|
+
"change": args.change,
|
|
129
|
+
"status": "pending",
|
|
130
|
+
"products": products,
|
|
131
|
+
"applyRequires": [],
|
|
132
|
+
"requires": [],
|
|
133
|
+
"artifactPaths": {},
|
|
134
|
+
}
|
|
135
|
+
# 从 .openspec.yaml 读取 requires 元数据(如果存在)
|
|
136
|
+
meta_path = cdir / ".openspec.yaml"
|
|
137
|
+
if meta_path.is_file():
|
|
138
|
+
try:
|
|
139
|
+
meta_text = meta_path.read_text(encoding="utf-8")
|
|
140
|
+
meta = {}
|
|
141
|
+
for line in meta_text.splitlines():
|
|
142
|
+
line = line.strip()
|
|
143
|
+
if ":" in line:
|
|
144
|
+
k, v = line.split(":", 1)
|
|
145
|
+
meta[k.strip()] = v.strip()
|
|
146
|
+
requires_raw = meta.get("requires", "")
|
|
147
|
+
if requires_raw:
|
|
148
|
+
result["requires"] = [r.strip() for r in requires_raw.split(",") if r.strip()]
|
|
149
|
+
apply_requires_raw = meta.get("applyRequires", "")
|
|
150
|
+
if apply_requires_raw:
|
|
151
|
+
result["applyRequires"] = [r.strip() for r in apply_requires_raw.split(",") if r.strip()]
|
|
152
|
+
except OSError:
|
|
153
|
+
pass
|
|
154
|
+
# artifactPaths:从当前 change 的 artifacts 目录构造(如果存在)
|
|
155
|
+
artifacts_dir = cdir / "artifacts"
|
|
156
|
+
if artifacts_dir.is_dir():
|
|
157
|
+
artifact_paths = {}
|
|
158
|
+
for entry in sorted(artifacts_dir.iterdir()):
|
|
159
|
+
if entry.is_file():
|
|
160
|
+
artifact_paths[entry.name] = str(entry.resolve())
|
|
161
|
+
result["artifactPaths"] = artifact_paths
|
|
162
|
+
# M2 修复:补齐 S8 delta 唯一来源 artifactPaths.specs.existingOutputPaths。
|
|
163
|
+
# 文档(config/workflow.json:336、commands/wf/archive.md:24、stage-S8)声明主控
|
|
164
|
+
# 只认此嵌套字段,但旧实现只产扁平 artifacts 映射,导致 S8 同步机制静默失效。
|
|
165
|
+
# 现从 change 的 specs/*/spec.md 收集 existingOutputPaths,与文档对齐。
|
|
166
|
+
specs_dir = cdir / "specs"
|
|
167
|
+
existing_output_paths = []
|
|
168
|
+
if specs_dir.is_dir():
|
|
169
|
+
for spec_file in sorted(specs_dir.glob("*/spec.md")):
|
|
170
|
+
existing_output_paths.append(str(spec_file.resolve()))
|
|
171
|
+
result["artifactPaths"].setdefault("specs", {})["existingOutputPaths"] = existing_output_paths
|
|
172
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
173
|
+
return 0
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def cmd_instructions(args) -> int:
|
|
177
|
+
root = Path(args.root).resolve()
|
|
178
|
+
try:
|
|
179
|
+
cdir = change_dir(root, args.change)
|
|
180
|
+
except ValueError as exc:
|
|
181
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
182
|
+
return 1
|
|
183
|
+
if not cdir.exists():
|
|
184
|
+
print(f"error: change not found: {cdir}", file=sys.stderr)
|
|
185
|
+
return 1
|
|
186
|
+
# apply 不是四件产物,而是实施模式入口(AGENTS.md:「instructions apply 取
|
|
187
|
+
# contextFiles/动态指令与 progress」)。返回实施上下文来源,不校验产物存在。
|
|
188
|
+
if args.id == "apply":
|
|
189
|
+
tasks_path = cdir / "tasks.md"
|
|
190
|
+
specs_dir = cdir / "specs"
|
|
191
|
+
result = {
|
|
192
|
+
"template": "apply",
|
|
193
|
+
"resolvedOutputPath": str(tasks_path),
|
|
194
|
+
"required": False,
|
|
195
|
+
"exists": tasks_path.is_file(),
|
|
196
|
+
"contextFiles": [str(tasks_path)] if tasks_path.is_file() else [],
|
|
197
|
+
"specsDir": str(specs_dir),
|
|
198
|
+
"note": "实施模式:按 tasks.md 逐任务最小改动并立即勾选;无计划文档、"
|
|
199
|
+
"不建 progress.md、账本即 tasks.md 勾选",
|
|
200
|
+
}
|
|
201
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
202
|
+
return 0
|
|
203
|
+
if args.id not in PRODUCTS:
|
|
204
|
+
print(f"error: unknown product id: {args.id}", file=sys.stderr)
|
|
205
|
+
return 1
|
|
206
|
+
rel = PRODUCTS[args.id]
|
|
207
|
+
target = cdir / rel
|
|
208
|
+
exists = target.is_dir() if args.id == "specs" else target.is_file()
|
|
209
|
+
result = {
|
|
210
|
+
"template": args.id,
|
|
211
|
+
"resolvedOutputPath": str(target),
|
|
212
|
+
"required": True,
|
|
213
|
+
"exists": exists,
|
|
214
|
+
}
|
|
215
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
216
|
+
return 0
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _split_sections(text: str):
|
|
220
|
+
"""按 ## 标题切分 Markdown,返回 [(header 或 None, [lines], ...)]。
|
|
221
|
+
仅做行级/段落级判断,不依赖第三方 Markdown 库。"""
|
|
222
|
+
sections = []
|
|
223
|
+
cur_header = None
|
|
224
|
+
cur_lines = []
|
|
225
|
+
for line in text.split("\n"):
|
|
226
|
+
if line.startswith("## "):
|
|
227
|
+
sections.append((cur_header, cur_lines))
|
|
228
|
+
cur_header = line[2:].strip()
|
|
229
|
+
cur_lines = []
|
|
230
|
+
else:
|
|
231
|
+
cur_lines.append(line)
|
|
232
|
+
sections.append((cur_header, cur_lines))
|
|
233
|
+
return sections
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def _section_lines(sections, header):
|
|
237
|
+
for h, lines in sections:
|
|
238
|
+
if h == header:
|
|
239
|
+
return list(lines)
|
|
240
|
+
return []
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def _has_purpose(sections) -> bool:
|
|
244
|
+
lines = _section_lines(sections, "Purpose")
|
|
245
|
+
return any(l.strip() for l in lines)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def cmd_validate_change(args) -> int:
|
|
249
|
+
"""validate --change <name>:检查四件产物是否完整,输出 JSON,rc=0 无论 valid 与否。"""
|
|
250
|
+
root = Path(args.root).resolve()
|
|
251
|
+
try:
|
|
252
|
+
cdir = change_dir(root, args.change)
|
|
253
|
+
except ValueError as exc:
|
|
254
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
255
|
+
return 1
|
|
256
|
+
if not cdir.exists():
|
|
257
|
+
print(f"error: change not found: {cdir}", file=sys.stderr)
|
|
258
|
+
return 1
|
|
259
|
+
missing = []
|
|
260
|
+
for fname in ("proposal.md", "design.md", "tasks.md"):
|
|
261
|
+
if not (cdir / fname).is_file():
|
|
262
|
+
missing.append(fname)
|
|
263
|
+
specs_dir = cdir / "specs"
|
|
264
|
+
spec_found = False
|
|
265
|
+
if specs_dir.is_dir():
|
|
266
|
+
for entry in specs_dir.iterdir():
|
|
267
|
+
if entry.is_dir() and (entry / "spec.md").is_file():
|
|
268
|
+
spec_found = True
|
|
269
|
+
break
|
|
270
|
+
if not spec_found:
|
|
271
|
+
missing.append("specs/spec.md")
|
|
272
|
+
valid = len(missing) == 0
|
|
273
|
+
print(json.dumps({"change": args.change, "valid": valid, "missing": missing},
|
|
274
|
+
ensure_ascii=False, indent=2))
|
|
275
|
+
return 0
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def _find_change_spec(cdir: Path):
|
|
279
|
+
"""在 change 目录下找 specs 产物:返回 (capability, spec_path)。找不到返回 (None, None)。"""
|
|
280
|
+
specs_dir = cdir / "specs"
|
|
281
|
+
if not specs_dir.is_dir():
|
|
282
|
+
return None, None
|
|
283
|
+
for entry in sorted(specs_dir.iterdir()):
|
|
284
|
+
if entry.is_dir() and (entry / "spec.md").is_file():
|
|
285
|
+
return entry.name, entry / "spec.md"
|
|
286
|
+
return None, None
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def _merge_delta_into_main(main_text: str, delta_text: str) -> str:
|
|
290
|
+
"""把 delta spec 合并进主 spec(行级/段落级规则)。
|
|
291
|
+
|
|
292
|
+
规则:
|
|
293
|
+
- 主 spec 的 ## Purpose 权威不动(不被 delta 覆盖)。
|
|
294
|
+
- ## Requirements:保留主 spec 既有场景,追加 delta 未提及的新场景(去重)。
|
|
295
|
+
- ## ADDED / ## MODIFIED / ## REMOVED / ## RENAMED:按段落原文合并记录。
|
|
296
|
+
- 其他未知段落:新增则追加,已存在则并入。
|
|
297
|
+
"""
|
|
298
|
+
main_secs = _split_sections(main_text or "")
|
|
299
|
+
delta_secs = _split_sections(delta_text)
|
|
300
|
+
|
|
301
|
+
main_by_header = {}
|
|
302
|
+
main_order = []
|
|
303
|
+
leading = []
|
|
304
|
+
for h, lines in main_secs:
|
|
305
|
+
if h is None:
|
|
306
|
+
leading = list(lines)
|
|
307
|
+
continue
|
|
308
|
+
if h not in main_by_header:
|
|
309
|
+
main_by_header[h] = []
|
|
310
|
+
main_order.append(h)
|
|
311
|
+
main_by_header[h].extend(lines)
|
|
312
|
+
|
|
313
|
+
result = {h: list(lines) for h, lines in main_by_header.items()}
|
|
314
|
+
result_order = list(main_order)
|
|
315
|
+
|
|
316
|
+
def _ensure(header):
|
|
317
|
+
if header not in result:
|
|
318
|
+
result[header] = []
|
|
319
|
+
result_order.append(header)
|
|
320
|
+
return result[header]
|
|
321
|
+
|
|
322
|
+
for h, lines in delta_secs:
|
|
323
|
+
if h is None:
|
|
324
|
+
continue
|
|
325
|
+
if h == "Purpose":
|
|
326
|
+
# 主 spec Purpose 权威不动
|
|
327
|
+
continue
|
|
328
|
+
if h == "Requirements":
|
|
329
|
+
dst = _ensure("Requirements")
|
|
330
|
+
for line in lines:
|
|
331
|
+
s = line.strip()
|
|
332
|
+
if s and s not in dst:
|
|
333
|
+
dst.append(s)
|
|
334
|
+
elif h.startswith("ADDED"):
|
|
335
|
+
dst = _ensure(h)
|
|
336
|
+
dst.extend(lines)
|
|
337
|
+
elif h.startswith("MODIFIED"):
|
|
338
|
+
dst = _ensure(h)
|
|
339
|
+
dst.extend(lines)
|
|
340
|
+
elif h.startswith("REMOVED"):
|
|
341
|
+
# P2-1(老板批准 2026-11-18):REMOVED 整块移除(stage-S8:29/125)。
|
|
342
|
+
# delta 中 REMOVED 段落列出的条目从主 spec 的 Requirements 中移除;
|
|
343
|
+
# REMOVED 段本身不写入主 spec(归档复验要求「REMOVED 消失」)。
|
|
344
|
+
# 旧实现 dst.extend(lines) 把 REMOVED 连同条目一起追加——语义相反。
|
|
345
|
+
dst = result.get("Requirements")
|
|
346
|
+
if dst is not None:
|
|
347
|
+
removed = {line.strip() for line in lines if line.strip()}
|
|
348
|
+
dst[:] = [ln for ln in dst if ln.strip() not in removed]
|
|
349
|
+
elif h.startswith("RENAMED"):
|
|
350
|
+
dst = _ensure(h)
|
|
351
|
+
dst.extend(lines)
|
|
352
|
+
else:
|
|
353
|
+
if h not in result:
|
|
354
|
+
result[h] = list(lines)
|
|
355
|
+
result_order.append(h)
|
|
356
|
+
else:
|
|
357
|
+
result[h].extend(lines)
|
|
358
|
+
|
|
359
|
+
out = []
|
|
360
|
+
if leading:
|
|
361
|
+
out.extend(leading)
|
|
362
|
+
for h in result_order:
|
|
363
|
+
out.append(f"## {h}")
|
|
364
|
+
out.extend(result[h])
|
|
365
|
+
return "\n".join(out).rstrip("\n") + "\n"
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def cmd_sync_specs_change(args) -> int:
|
|
369
|
+
"""sync-specs --change <name>:delta 合并进主 spec,输出 JSON,rc=0。
|
|
370
|
+
|
|
371
|
+
P0-2 安全契约:--dry-run 只计算不写入;正常执行时对主 spec 做
|
|
372
|
+
.bak-<ts> 备份后再覆盖,保证合并出错可回滚。
|
|
373
|
+
"""
|
|
374
|
+
root = Path(args.root).resolve()
|
|
375
|
+
try:
|
|
376
|
+
cdir = change_dir(root, args.change)
|
|
377
|
+
except ValueError as exc:
|
|
378
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
379
|
+
return 1
|
|
380
|
+
if not cdir.exists():
|
|
381
|
+
print(f"error: change not found: {cdir}", file=sys.stderr)
|
|
382
|
+
return 1
|
|
383
|
+
capability, delta_path = _find_change_spec(cdir)
|
|
384
|
+
if capability is None or delta_path is None:
|
|
385
|
+
print(f"error: specs product not found in change: {cdir}", file=sys.stderr)
|
|
386
|
+
return 1
|
|
387
|
+
main_dir = root / "openspec" / "specs" / capability
|
|
388
|
+
main_dir.mkdir(parents=True, exist_ok=True)
|
|
389
|
+
main_path = main_dir / "spec.md"
|
|
390
|
+
main_text = main_path.read_text(encoding="utf-8") if main_path.is_file() else ""
|
|
391
|
+
delta_text = delta_path.read_text(encoding="utf-8")
|
|
392
|
+
merged = _merge_delta_into_main(main_text, delta_text)
|
|
393
|
+
|
|
394
|
+
if args.dry_run:
|
|
395
|
+
print(json.dumps({
|
|
396
|
+
"change": args.change,
|
|
397
|
+
"capability": capability,
|
|
398
|
+
"dry_run": True,
|
|
399
|
+
"target": str(main_path),
|
|
400
|
+
}, ensure_ascii=False, indent=2))
|
|
401
|
+
return 0
|
|
402
|
+
|
|
403
|
+
# 备份主 spec(.bak-<ts>,同一目录下),覆盖写入前保留回滚点
|
|
404
|
+
backup_path = None
|
|
405
|
+
if main_path.is_file():
|
|
406
|
+
ts = datetime.now().strftime("%Y%m%d-%H%M%S%f")
|
|
407
|
+
backup_path = main_path.with_name(f"{main_path.name}.bak-{ts}")
|
|
408
|
+
backup_path.write_text(main_text, encoding="utf-8")
|
|
409
|
+
main_path.write_text(merged, encoding="utf-8")
|
|
410
|
+
print(json.dumps({
|
|
411
|
+
"change": args.change,
|
|
412
|
+
"capability": capability,
|
|
413
|
+
"merged": True,
|
|
414
|
+
"target": str(main_path),
|
|
415
|
+
"backup": str(backup_path) if backup_path else None,
|
|
416
|
+
}, ensure_ascii=False, indent=2))
|
|
417
|
+
return 0
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
def _status_flag(status: dict, *keys) -> bool:
|
|
421
|
+
for k in keys:
|
|
422
|
+
if k in status and status[k]:
|
|
423
|
+
return True
|
|
424
|
+
return False
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def cmd_archive_change(args) -> int:
|
|
428
|
+
"""archive-change <name>:七条件逐条检查后归档到 archive/YYYY-MM-DD-<change>。
|
|
429
|
+
|
|
430
|
+
P0-3 安全契约:--dry-run 只校验不移动;正常归档前对变更目录做
|
|
431
|
+
.bak-<ts> 备份,移动成功后清理备份(成功才清,失败保留供回滚)。
|
|
432
|
+
"""
|
|
433
|
+
root = Path(args.root).resolve()
|
|
434
|
+
try:
|
|
435
|
+
cdir = change_dir(root, args.name)
|
|
436
|
+
except ValueError as exc:
|
|
437
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
438
|
+
return 1
|
|
439
|
+
if not cdir.exists():
|
|
440
|
+
print(f"error: change not found: {cdir}", file=sys.stderr)
|
|
441
|
+
return 1
|
|
442
|
+
status_path = cdir / ".status.json"
|
|
443
|
+
if not status_path.is_file():
|
|
444
|
+
print(f"error: .status.json not found, archive blocked: {cdir}", file=sys.stderr)
|
|
445
|
+
return 1
|
|
446
|
+
try:
|
|
447
|
+
status = json.loads(status_path.read_text(encoding="utf-8"))
|
|
448
|
+
except (json.JSONDecodeError, OSError) as exc:
|
|
449
|
+
print(f"error: .status.json invalid: {exc}", file=sys.stderr)
|
|
450
|
+
return 1
|
|
451
|
+
|
|
452
|
+
# W8:存在 PARKED 任务,默认禁止归档
|
|
453
|
+
if _status_flag(status, "parked", "PARKED"):
|
|
454
|
+
print(f"error: PARKED tasks present, archive prohibited (W8): {cdir}", file=sys.stderr)
|
|
455
|
+
return 1
|
|
456
|
+
|
|
457
|
+
required = [
|
|
458
|
+
("tasksCompleted", "tasks_completed", "所有必须完成的任务已完成"),
|
|
459
|
+
("specsConsistent", "specs_consistent", "规格与实现一致"),
|
|
460
|
+
("testsPassed", "tests_passed", "测试验证通过"),
|
|
461
|
+
("reviewPassed", "review_passed", "代码审查通过"),
|
|
462
|
+
("noBlockers", "no_blockers", "无未解决阻断问题"),
|
|
463
|
+
("gitStatusOk", "git_status_ok", "Git 状态符合要求"),
|
|
464
|
+
("docsUpdated", "docs_updated", "必要文档已更新"),
|
|
465
|
+
]
|
|
466
|
+
failed = [label for camel, snake, label in required
|
|
467
|
+
if not _status_flag(status, camel, snake)]
|
|
468
|
+
if failed:
|
|
469
|
+
print(f"error: archive conditions not met: {', '.join(failed)}", file=sys.stderr)
|
|
470
|
+
return 1
|
|
471
|
+
|
|
472
|
+
# I-05:七标志全 true 只是手工维护的元数据,必须与 tasks.md 实际勾选
|
|
473
|
+
# 状态核对。tasks.md 存在时,有未勾选任务则拒绝归档;不存在时
|
|
474
|
+
# 无账本可查,沿用 status 标志(保持既有口径)。
|
|
475
|
+
tasks_path = cdir / "tasks.md"
|
|
476
|
+
if tasks_path.is_file():
|
|
477
|
+
try:
|
|
478
|
+
tasks_text = tasks_path.read_text(encoding="utf-8")
|
|
479
|
+
except OSError as exc:
|
|
480
|
+
print(f"error: tasks.md read failed: {exc}", file=sys.stderr)
|
|
481
|
+
return 1
|
|
482
|
+
done, todo = count_task_checkboxes(tasks_text)
|
|
483
|
+
if todo > 0:
|
|
484
|
+
print(
|
|
485
|
+
f"error: archive blocked: tasks.md has {todo} unchecked "
|
|
486
|
+
f"task(s) ({done} done)",
|
|
487
|
+
file=sys.stderr)
|
|
488
|
+
return 1
|
|
489
|
+
|
|
490
|
+
# 变更目录只允许标准产物(含引擎元数据与 artifacts);插件运行时残留
|
|
491
|
+
# (如 .mimosa)混入时拒绝归档——备份在归档成功后即删,无清理兜底
|
|
492
|
+
allowed = {"proposal.md", "design.md", "tasks.md", "specs",
|
|
493
|
+
".openspec.yaml", ".status.json", "artifacts"}
|
|
494
|
+
extras = sorted(e.name for e in cdir.iterdir() if e.name not in allowed)
|
|
495
|
+
if extras:
|
|
496
|
+
print(f"error: non-standard entries in change dir, archive blocked: "
|
|
497
|
+
f"{', '.join(extras)}: {cdir}", file=sys.stderr)
|
|
498
|
+
return 1
|
|
499
|
+
|
|
500
|
+
archive_root = root / "openspec" / "changes" / "archive"
|
|
501
|
+
archive_root.mkdir(parents=True, exist_ok=True)
|
|
502
|
+
target = archive_root / f"{date.today().isoformat()}-{args.name}"
|
|
503
|
+
if target.exists():
|
|
504
|
+
print(f"error: archive target already exists: {target}", file=sys.stderr)
|
|
505
|
+
return 1
|
|
506
|
+
|
|
507
|
+
if args.dry_run:
|
|
508
|
+
print(json.dumps({
|
|
509
|
+
"change": args.name,
|
|
510
|
+
"dry_run": True,
|
|
511
|
+
"target": str(target),
|
|
512
|
+
}, ensure_ascii=False, indent=2))
|
|
513
|
+
return 0
|
|
514
|
+
|
|
515
|
+
# 备份变更目录(.bak-<ts>),作为移动操作的回滚点
|
|
516
|
+
ts = datetime.now().strftime("%Y%m%d-%H%M%S%f")
|
|
517
|
+
backup_dir = cdir.with_name(f"{cdir.name}.bak-{ts}")
|
|
518
|
+
shutil.copytree(str(cdir), str(backup_dir))
|
|
519
|
+
|
|
520
|
+
# 归档前把元数据 status 更新为 archived(备份在前,替换失误可从 .bak 回滚)
|
|
521
|
+
meta_path = cdir / ".openspec.yaml"
|
|
522
|
+
if meta_path.is_file():
|
|
523
|
+
text = meta_path.read_text(encoding="utf-8")
|
|
524
|
+
updated = re.sub(r"^status:.*$", "status: archived",
|
|
525
|
+
text, count=1, flags=re.MULTILINE)
|
|
526
|
+
if updated != text:
|
|
527
|
+
meta_path.write_text(updated, encoding="utf-8")
|
|
528
|
+
|
|
529
|
+
try:
|
|
530
|
+
shutil.move(str(cdir), str(target))
|
|
531
|
+
except OSError as exc:
|
|
532
|
+
# 移动失败:保留备份,便于回滚(不静默失败)
|
|
533
|
+
print(f"error: archive move failed: {exc}", file=sys.stderr)
|
|
534
|
+
return 1
|
|
535
|
+
|
|
536
|
+
# 移动成功:清理备份(成功才清)
|
|
537
|
+
shutil.rmtree(str(backup_dir))
|
|
538
|
+
|
|
539
|
+
print(json.dumps({
|
|
540
|
+
"change": args.name,
|
|
541
|
+
"archived": True,
|
|
542
|
+
"target": str(target),
|
|
543
|
+
}, ensure_ascii=False, indent=2))
|
|
544
|
+
return 0
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
def cmd_validate_specs(args) -> int:
|
|
548
|
+
"""validate-specs:验证 openspec/specs/ 下所有 spec.md(Purpose 非空、退役不留空 Requirements)。"""
|
|
549
|
+
root = Path(args.root).resolve()
|
|
550
|
+
specs_root = root / "openspec" / "specs"
|
|
551
|
+
issues = []
|
|
552
|
+
if specs_root.is_dir():
|
|
553
|
+
for cap_dir in sorted(specs_root.iterdir()):
|
|
554
|
+
if not cap_dir.is_dir():
|
|
555
|
+
continue
|
|
556
|
+
spec_path = cap_dir / "spec.md"
|
|
557
|
+
if not spec_path.is_file():
|
|
558
|
+
continue
|
|
559
|
+
capability = cap_dir.name
|
|
560
|
+
text = spec_path.read_text(encoding="utf-8")
|
|
561
|
+
sections = _split_sections(text)
|
|
562
|
+
if not _has_purpose(sections):
|
|
563
|
+
issues.append(f"{capability}: 缺少非空的 ## Purpose")
|
|
564
|
+
# 能力退役:文中出现 退役/retired 时,## Requirements 不得为空
|
|
565
|
+
is_retired = ("退役" in text) or ("retired" in text.lower())
|
|
566
|
+
if is_retired:
|
|
567
|
+
req_lines = _section_lines(sections, "Requirements")
|
|
568
|
+
if not any(l.strip() for l in req_lines):
|
|
569
|
+
issues.append(f"{capability}: 已退役但 ## Requirements 为空")
|
|
570
|
+
valid = len(issues) == 0
|
|
571
|
+
print(json.dumps({"valid": valid, "issues": issues}, ensure_ascii=False, indent=2))
|
|
572
|
+
return 0
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
def cmd_list_changes(args) -> int:
|
|
576
|
+
"""list --root <根>:列出所有 change 目录及其状态,输出 JSON,rc=0。
|
|
577
|
+
|
|
578
|
+
输出:
|
|
579
|
+
{
|
|
580
|
+
"changes": [
|
|
581
|
+
{"name": "add-user-auth", "path": "...", "status": "pending", "products": {...}},
|
|
582
|
+
...
|
|
583
|
+
],
|
|
584
|
+
"root": "<根目录绝对路径>"
|
|
585
|
+
}
|
|
586
|
+
"""
|
|
587
|
+
# --root 缺省(None)时 fallback 到 cwd,与父 --root 语义一致。
|
|
588
|
+
# 旧实现直接 Path(None).resolve() 崩溃(list 必崩)。
|
|
589
|
+
root = Path(getattr(args, "root", os.getcwd()) or os.getcwd()).resolve()
|
|
590
|
+
changes_dir = root / "openspec" / "changes"
|
|
591
|
+
changes = []
|
|
592
|
+
if changes_dir.is_dir():
|
|
593
|
+
for entry in sorted(changes_dir.iterdir()):
|
|
594
|
+
if not entry.is_dir():
|
|
595
|
+
continue
|
|
596
|
+
# P1-2:archive/ 是归档容器而非 pending 变更,跳过(对齐官方 openspec 口径)
|
|
597
|
+
if entry.name == 'archive':
|
|
598
|
+
continue
|
|
599
|
+
cdir = entry
|
|
600
|
+
# 读取元数据,兼容无 .openspec.yaml 的旧 change
|
|
601
|
+
meta_path = cdir / ".openspec.yaml"
|
|
602
|
+
name = entry.name
|
|
603
|
+
status = "pending"
|
|
604
|
+
if meta_path.is_file():
|
|
605
|
+
try:
|
|
606
|
+
for line in meta_path.read_text(encoding="utf-8").splitlines():
|
|
607
|
+
line = line.strip()
|
|
608
|
+
if line.startswith("status:"):
|
|
609
|
+
status = line.split(":", 1)[1].strip()
|
|
610
|
+
break
|
|
611
|
+
except OSError:
|
|
612
|
+
pass
|
|
613
|
+
# products 状态
|
|
614
|
+
products = {name_: product_state(cdir, name_) for name_ in PRODUCTS}
|
|
615
|
+
changes.append({
|
|
616
|
+
"name": name,
|
|
617
|
+
"path": str(cdir),
|
|
618
|
+
"status": status,
|
|
619
|
+
"products": products,
|
|
620
|
+
})
|
|
621
|
+
print(json.dumps({
|
|
622
|
+
"changes": changes,
|
|
623
|
+
"root": str(root),
|
|
624
|
+
"openspec": changes_dir.is_dir(),
|
|
625
|
+
}, ensure_ascii=False, indent=2))
|
|
626
|
+
return 0
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
630
|
+
parser = argparse.ArgumentParser(prog="openspec_engine.py")
|
|
631
|
+
parser.add_argument("--root", default=os.getcwd(), help="仓库根目录(默认 cwd)")
|
|
632
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
633
|
+
|
|
634
|
+
p_new = sub.add_parser("new-change", help="创建 change 目录 + 元数据文件")
|
|
635
|
+
p_new.add_argument("name", help="change 名(kebab-case)")
|
|
636
|
+
p_new.set_defaults(func=cmd_new_change)
|
|
637
|
+
|
|
638
|
+
p_status = sub.add_parser("status", help="读取变更状态")
|
|
639
|
+
p_status.add_argument("--change", required=True, help="change 名")
|
|
640
|
+
p_status.set_defaults(func=cmd_status)
|
|
641
|
+
|
|
642
|
+
p_instr = sub.add_parser("instructions", help="读取产物模板 + resolvedOutputPath")
|
|
643
|
+
p_instr.add_argument("id", help="产物 id(proposal/design/tasks/specs)")
|
|
644
|
+
p_instr.add_argument("--change", required=True, help="change 名")
|
|
645
|
+
p_instr.set_defaults(func=cmd_instructions)
|
|
646
|
+
|
|
647
|
+
p_validate = sub.add_parser("validate", help="验证 change 四件产物完整")
|
|
648
|
+
p_validate.add_argument("--change", required=True, help="change 名")
|
|
649
|
+
p_validate.set_defaults(func=cmd_validate_change)
|
|
650
|
+
|
|
651
|
+
p_sync = sub.add_parser("sync-specs", help="delta 合并进主 spec")
|
|
652
|
+
p_sync.add_argument("--change", required=True, help="change 名")
|
|
653
|
+
p_sync.add_argument("--dry-run", action="store_true",
|
|
654
|
+
help="只计算合并结果,不写主 spec、不产生备份")
|
|
655
|
+
p_sync.set_defaults(func=cmd_sync_specs_change)
|
|
656
|
+
|
|
657
|
+
p_archive = sub.add_parser("archive-change", help="归档 change")
|
|
658
|
+
p_archive.add_argument("name", help="change 名")
|
|
659
|
+
p_archive.add_argument("--dry-run", action="store_true",
|
|
660
|
+
help="只校验七条件、目录标准性与目标路径,不移动、不备份")
|
|
661
|
+
p_archive.set_defaults(func=cmd_archive_change)
|
|
662
|
+
|
|
663
|
+
p_validatespecs = sub.add_parser("validate-specs", help="验证主 spec")
|
|
664
|
+
p_validatespecs.set_defaults(func=cmd_validate_specs)
|
|
665
|
+
|
|
666
|
+
p_list = sub.add_parser("list", help="列出所有 change 及其状态")
|
|
667
|
+
# P3-6:default=argparse.SUPPRESS,子命令未传 --root 时不覆盖顶层已设值
|
|
668
|
+
# (旧 default=None 会把顶层 --root 静默覆盖为 None,回落 cwd)。
|
|
669
|
+
# 显式传 `list --root X` 时仍生效;两者都不传时由 cmd_list_changes 用 getattr 兜底 cwd。
|
|
670
|
+
p_list.add_argument("--root", default=argparse.SUPPRESS,
|
|
671
|
+
help="仓库根目录(优先于顶层 --root;缺省用顶层 --root 或 cwd)")
|
|
672
|
+
p_list.set_defaults(func=cmd_list_changes)
|
|
673
|
+
|
|
674
|
+
return parser
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
def main(argv=None) -> int:
|
|
678
|
+
parser = build_parser()
|
|
679
|
+
args = parser.parse_args(argv)
|
|
680
|
+
return args.func(args)
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
def _force_utf8_stdout():
|
|
684
|
+
"""让 stdout/stderr 用 UTF-8 输出,避免非 UTF-8 控制台抛 UnicodeEncodeError。
|
|
685
|
+
|
|
686
|
+
中文 Windows 默认代码页 CP936 可编码 GB2312 汉字,但无法编码 emoji
|
|
687
|
+
(⚙️ U+2699)与 ⇒(U+21D2) 等符号。本脚本 :569 等处 print(json.dumps
|
|
688
|
+
(..., ensure_ascii=False)) 会把含 emoji 的路径/内容原样透出,CP936
|
|
689
|
+
终端下抛 UnicodeEncodeError,rc=1、stdout 全空。
|
|
690
|
+
|
|
691
|
+
与 zcode_expert_system.py / zcode_dev_workflow.py / skill_entry.py
|
|
692
|
+
/ scripts/workflow_check.py 的同名函数保持一致(R10 补齐最后一个入口)。
|
|
693
|
+
"""
|
|
694
|
+
for stream_name in ("stdout", "stderr"):
|
|
695
|
+
stream = getattr(sys, stream_name, None)
|
|
696
|
+
reconfigure = getattr(stream, "reconfigure", None)
|
|
697
|
+
if reconfigure is None:
|
|
698
|
+
continue
|
|
699
|
+
try:
|
|
700
|
+
reconfigure(encoding="utf-8", errors="replace")
|
|
701
|
+
except (AttributeError, ValueError, OSError):
|
|
702
|
+
pass
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
if __name__ == "__main__":
|
|
706
|
+
_force_utf8_stdout()
|
|
707
|
+
sys.exit(main())
|