ai-delivery-workflow 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -14
- package/bin/ai-delivery.mjs +181 -6
- package/bin/benchmark-autonomy.mjs +217 -0
- package/bin/release-check.mjs +382 -0
- package/docs/CLI-PARAMETER-REFERENCE.zh-CN.md +346 -0
- package/docs/CODEGRAPH-INTEGRATION.zh-CN.md +89 -0
- package/docs/DUAL-REPOSITORY-WORKSPACE.zh-CN.md +2 -2
- package/docs/EVOLUTION-MAINTENANCE.zh-CN.md +7 -7
- package/docs/EVOLUTION-USER-GUIDE.zh-CN.md +2 -2
- package/docs/FILE-REFERENCE.zh-CN.md +120 -39
- package/docs/MAINTENANCE-VERIFICATION.zh-CN.md +51 -0
- package/docs/MOCK-SYSTEM.zh-CN.md +141 -0
- package/docs/NPM-RELEASE-MANAGEMENT.zh-CN.md +106 -0
- package/docs/PROJECT-MANUAL.zh-CN.md +154 -95
- package/docs/PROTOTYPE-MIGRATION.zh-CN.md +164 -0
- package/docs/STATE-CLI-MAINTENANCE.zh-CN.md +35 -17
- package/docs/STATE-CLI-USER-GUIDE.zh-CN.md +115 -39
- package/docs/VIEWER-MAINTENANCE.zh-CN.md +101 -324
- package/docs/VIEWER-USER-GUIDE.zh-CN.md +68 -190
- package/docs/adr/0001-prototype-first-ui-governance.md +3 -0
- package/docs/adr/0002-microcks-as-default-mock-system.md +3 -0
- package/docs/adr/0003-workflow-manager-governed-control-surface.md +46 -0
- package/docs/adr/0004-operational-carbon-visual-standard.md +9 -0
- package/docs/adr/0005-prototype-management-as-routed-pages.md +7 -0
- package/docs/agents/domain.md +12 -0
- package/docs/agents/issue-tracker.md +27 -0
- package/docs/agents/triage-labels.md +11 -0
- package/docs/agents/workflow-manager-acceptance-matrix.md +93 -0
- package/docs/agents/workflow-manager-agent-interface.md +145 -0
- package/docs/agents/workflow-manager-current-state.md +205 -0
- package/lib/artifact-files.mjs +47 -0
- package/lib/codegraph.mjs +405 -0
- package/lib/delivery-state.mjs +3079 -198
- package/lib/frontend-guard.mjs +288 -0
- package/lib/fs-utils.mjs +53 -0
- package/lib/history-anchor.mjs +98 -0
- package/lib/mock-scenario-pack.mjs +687 -0
- package/lib/mock-system.mjs +897 -0
- package/lib/npm-package-result.mjs +11 -0
- package/lib/png-evidence.mjs +149 -0
- package/lib/project-bootstrap.mjs +96 -55
- package/lib/project-installer.mjs +1484 -164
- package/lib/project-migration.mjs +1193 -0
- package/lib/prototype-migration.mjs +713 -0
- package/lib/prototype-page-review.mjs +384 -0
- package/lib/prototype-review-target.mjs +334 -0
- package/lib/prototype-revision.mjs +812 -0
- package/lib/stable-value.mjs +15 -0
- package/lib/toml-hooks.mjs +69 -0
- package/lib/ui-acceptance.mjs +565 -0
- package/lib/visual-standard.mjs +232 -0
- package/lib/workflow-manager-contracts.mjs +367 -0
- package/lib/workflow-manager-facts.mjs +778 -0
- package/lib/workflow-manager-governance.mjs +514 -0
- package/lib/workflow-manager-mock.mjs +183 -0
- package/lib/workflow-manager-prototypes.mjs +1847 -0
- package/lib/workflow-manager-public/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/lib/workflow-manager-public/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/lib/workflow-manager-public/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/lib/workflow-manager-public/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/lib/workflow-manager-public/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/lib/workflow-manager-public/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/lib/workflow-manager-public/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/lib/workflow-manager-public/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/lib/workflow-manager-public/assets/index-Chlg6r8f.css +1 -0
- package/lib/workflow-manager-public/assets/index-E-hGB5ZD.js +13 -0
- package/lib/workflow-manager-public/fonts/OFL-1.1.txt +90 -0
- package/lib/workflow-manager-public/index.html +14 -0
- package/lib/workflow-manager-systems.mjs +519 -0
- package/lib/workflow-manager-transaction.mjs +397 -0
- package/lib/workflow-manager.mjs +745 -0
- package/package.json +8 -2
- package/skills/ai-delivery-assemble-release/agents/openai.yaml +3 -3
- package/skills/ai-delivery-assemble-release/assets/release-material-index.csv +1 -1
- package/skills/ai-delivery-assemble-release/assets/version-inclusion.csv +1 -1
- package/skills/ai-delivery-bootstrap/SKILL.md +4 -4
- package/skills/ai-delivery-bootstrap/agents/openai.yaml +3 -3
- package/skills/ai-delivery-bootstrap/references/bootstrap-contract.md +4 -2
- package/skills/ai-delivery-checkpoint-task/SKILL.md +17 -3
- package/skills/ai-delivery-checkpoint-task/agents/openai.yaml +3 -3
- package/skills/ai-delivery-checkpoint-task/assets/runtime-template/task.json +7 -1
- package/skills/ai-delivery-checkpoint-task/references/checkpoint-contract.md +22 -8
- package/skills/ai-delivery-checkpoint-task/scripts/hook-event.mjs +91 -0
- package/skills/ai-delivery-checkpoint-task/scripts/task-state.mjs +1086 -51
- package/skills/ai-delivery-close-version/SKILL.md +9 -8
- package/skills/ai-delivery-close-version/agents/openai.yaml +3 -3
- package/skills/ai-delivery-close-version/assets/version-lineage.yaml +1 -1
- package/skills/ai-delivery-close-version/references/version-closeout-contract.md +2 -2
- package/skills/ai-delivery-define-product/SKILL.md +8 -4
- package/skills/ai-delivery-define-product/agents/openai.yaml +4 -4
- package/skills/ai-delivery-define-product/references/product-contract.md +2 -2
- package/skills/ai-delivery-deploy-production/agents/openai.yaml +3 -3
- package/skills/ai-delivery-design-architecture/SKILL.md +9 -5
- package/skills/ai-delivery-design-architecture/assets/architecture-template/prototype-architecture-validation.yaml +16 -16
- package/skills/ai-delivery-design-architecture/references/architecture-contract.md +1 -1
- package/skills/ai-delivery-design-experience/SKILL.md +36 -30
- package/skills/ai-delivery-design-experience/agents/openai.yaml +4 -4
- package/skills/ai-delivery-design-experience/assets/experience-template/LEGACY-COMPATIBILITY.md +16 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/design-reference-selection.yaml +32 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/experience-baseline.yaml +2 -2
- package/skills/ai-delivery-design-experience/assets/experience-template/formal-ui-confirmation.yaml +16 -3
- package/skills/ai-delivery-design-experience/assets/experience-template/frontend-change-scope.yaml +30 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/interaction-contract.csv +1 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/mock-admin-export.yaml +8 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/mock-scenario-mappings.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/mock-scenario-pack-request.yaml +24 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/product-prototype-reconciliation.yaml +2 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-adjustment-log.csv +1 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-component-bindings.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-component-candidates.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-components.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-confirmation.yaml +18 -18
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-data-contracts.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-impact-assessment.yaml +5 -5
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-implementation-bindings.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-manifest.yaml +2 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-pages.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-product-coverage.csv +1 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-comments.csv +1 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-decision.yaml +13 -12
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-scenes.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-sessions.csv +1 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-unit-pages.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-units.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-revision.yaml +88 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-routes.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-set.yaml +2 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-source-inspection-snapshots.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-terminals.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-tool-candidates.csv +1 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-tool-selection.yaml +2 -3
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-traceability.csv +1 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype-trigger-conditions.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/prototype.yaml +6 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/ui-framework-selection.yaml +17 -1
- package/skills/ai-delivery-design-experience/assets/experience-template/ui-handoff.yaml +6 -5
- package/skills/ai-delivery-design-experience/assets/experience-template/ui-mapping.csv +1 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/visual-direction.yaml +4 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/visual-reference-manifest.yaml +23 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/visual-reference.html +163 -0
- package/skills/ai-delivery-design-experience/assets/experience-template/visual-system-confirmation.yaml +11 -0
- package/skills/ai-delivery-design-experience/references/experience-contract.md +26 -27
- package/skills/ai-delivery-design-experience/references/prototype-management-contract.md +42 -21
- package/skills/ai-delivery-design-tests/SKILL.md +13 -7
- package/skills/ai-delivery-design-tests/assets/test-design-template/prototype-test-scope.csv +1 -1
- package/skills/ai-delivery-design-tests/assets/test-design-template/prototype-test-validation.yaml +17 -16
- package/skills/ai-delivery-design-tests/references/test-design-contract.md +7 -5
- package/skills/ai-delivery-develop-iteration/SKILL.md +18 -11
- package/skills/ai-delivery-develop-iteration/agents/openai.yaml +3 -3
- package/skills/ai-delivery-develop-iteration/assets/development-template/candidate-manifest.yaml +36 -0
- package/skills/ai-delivery-develop-iteration/assets/development-template/task-prototype-traceability.csv +1 -1
- package/skills/ai-delivery-develop-iteration/references/development-contract.md +5 -3
- package/skills/ai-delivery-evolve-workflow/agents/openai.yaml +3 -3
- package/skills/ai-delivery-execute-test/SKILL.md +6 -2
- package/skills/ai-delivery-execute-test/agents/openai.yaml +4 -4
- package/skills/ai-delivery-execute-work-package/SKILL.md +10 -3
- package/skills/ai-delivery-execute-work-package/agents/openai.yaml +4 -4
- package/skills/ai-delivery-execute-work-package/references/work-package-contract.md +1 -1
- package/skills/ai-delivery-manage-git/agents/openai.yaml +3 -3
- package/skills/ai-delivery-manage-standards/agents/openai.yaml +4 -4
- package/skills/ai-delivery-orchestrate/SKILL.md +47 -29
- package/skills/ai-delivery-orchestrate/agents/openai.yaml +3 -3
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/control/migrations/.gitkeep +0 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/control/repairs/.gitkeep +0 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/delivery/project.yaml +1 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/delivery/workflow-state.yaml +2 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/frontend-guard/frontend-guard.mjs +50 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/hooks/hook-event.mjs +91 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/manager/manager.mjs +64 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/manager/start.cmd +4 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/manager/start.ps1 +2 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/{viewer → manager}/start.sh +1 -1
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/mock/mock.mjs +50 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/ui-acceptance/ui-acceptance.mjs +37 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/AGENTS.md +32 -6
- package/skills/ai-delivery-orchestrate/assets/project-template/gitignore.template +1 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/CONTRIBUTING.md +25 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/LICENSE +21 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/README.md +250 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/UPSTREAM.yaml +19 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/airbnb/DESIGN.md +545 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/airbnb/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/airtable/DESIGN.md +554 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/airtable/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/apple/DESIGN.md +562 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/apple/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/binance/DESIGN.md +634 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/binance/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/bmw/DESIGN.md +544 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/bmw/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/bmw-m/DESIGN.md +503 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/bmw-m/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/bugatti/DESIGN.md +454 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/bugatti/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/cal/DESIGN.md +542 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/cal/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/claude/DESIGN.md +589 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/claude/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/clay/DESIGN.md +541 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/clay/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/clickhouse/DESIGN.md +544 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/clickhouse/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/cohere/DESIGN.md +451 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/cohere/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/coinbase/DESIGN.md +570 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/coinbase/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/composio/DESIGN.md +506 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/composio/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/cursor/DESIGN.md +537 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/cursor/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/dell-1996/DESIGN.md +632 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/dell-1996/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/elevenlabs/DESIGN.md +504 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/elevenlabs/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/expo/DESIGN.md +526 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/expo/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/ferrari/DESIGN.md +531 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/ferrari/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/figma/DESIGN.md +578 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/figma/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/framer/DESIGN.md +544 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/framer/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/hashicorp/DESIGN.md +575 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/hashicorp/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/hp/DESIGN.md +670 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/hp/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/ibm/DESIGN.md +550 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/ibm/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/intercom/DESIGN.md +546 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/intercom/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/kraken/DESIGN.md +125 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/kraken/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/lamborghini/DESIGN.md +288 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/lamborghini/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/linear.app/DESIGN.md +548 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/linear.app/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/lovable/DESIGN.md +298 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/lovable/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mastercard/DESIGN.md +365 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mastercard/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/meta/DESIGN.md +683 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/meta/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/minimax/DESIGN.md +746 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/minimax/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mintlify/DESIGN.md +852 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mintlify/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/miro/DESIGN.md +825 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/miro/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mistral.ai/DESIGN.md +773 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mistral.ai/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mongodb/DESIGN.md +767 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/mongodb/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/nike/DESIGN.md +575 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/nike/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/nintendo-2001/DESIGN.md +649 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/nintendo-2001/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/notion/DESIGN.md +821 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/notion/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/nvidia/DESIGN.md +640 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/nvidia/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/ollama/DESIGN.md +539 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/ollama/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/opencode.ai/DESIGN.md +521 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/opencode.ai/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/pinterest/DESIGN.md +597 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/pinterest/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/playstation/DESIGN.md +661 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/playstation/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/posthog/DESIGN.md +690 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/posthog/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/raycast/DESIGN.md +669 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/raycast/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/renault/DESIGN.md +589 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/renault/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/replicate/DESIGN.md +616 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/replicate/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/resend/DESIGN.md +585 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/resend/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/revolut/DESIGN.md +636 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/revolut/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/runwayml/DESIGN.md +244 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/runwayml/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/sanity/DESIGN.md +357 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/sanity/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/sentry/DESIGN.md +551 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/sentry/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/shopify/DESIGN.md +516 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/shopify/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/slack/DESIGN.md +482 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/spacex/DESIGN.md +363 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/spacex/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/spotify/DESIGN.md +246 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/spotify/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/starbucks/DESIGN.md +580 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/starbucks/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/stripe/DESIGN.md +487 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/stripe/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/supabase/DESIGN.md +462 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/supabase/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/superhuman/DESIGN.md +448 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/superhuman/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/tesla/DESIGN.md +286 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/tesla/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/theverge/DESIGN.md +339 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/theverge/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/together.ai/DESIGN.md +633 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/together.ai/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/uber/DESIGN.md +636 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/uber/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/vercel/DESIGN.md +736 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/vercel/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/vodafone/DESIGN.md +538 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/vodafone/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/voltagent/DESIGN.md +521 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/voltagent/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/warp/DESIGN.md +526 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/warp/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/webflow/DESIGN.md +588 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/webflow/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/wired/DESIGN.md +497 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/wired/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/wise/DESIGN.md +544 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/wise/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/x.ai/DESIGN.md +465 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/x.ai/README.md +5 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/zapier/DESIGN.md +537 -0
- package/skills/ai-delivery-orchestrate/assets/project-template/ref/ui/design-md/zapier/README.md +5 -0
- package/skills/ai-delivery-orchestrate/references/formal-state-contract.md +65 -20
- package/skills/ai-delivery-orchestrate/references/workflow-model.md +7 -5
- package/skills/ai-delivery-orchestrate-release/SKILL.md +2 -2
- package/skills/ai-delivery-orchestrate-release/agents/openai.yaml +4 -4
- package/skills/ai-delivery-orchestrate-release/references/release-workflow-contract.md +1 -1
- package/skills/ai-delivery-plan-iteration/SKILL.md +11 -4
- package/skills/ai-delivery-plan-iteration/agents/openai.yaml +4 -4
- package/skills/ai-delivery-plan-iteration/assets/planning-template/scope-manifest.yaml +17 -0
- package/skills/ai-delivery-plan-iteration/assets/planning-template/slice-prototype-traceability.csv +1 -1
- package/skills/ai-delivery-plan-iteration/references/planning-contract.md +8 -2
- package/skills/ai-delivery-prepare-platform/SKILL.md +5 -1
- package/skills/ai-delivery-prepare-platform/agents/openai.yaml +4 -4
- package/skills/ai-delivery-prepare-release/agents/openai.yaml +4 -4
- package/skills/ai-delivery-review-change/SKILL.md +14 -4
- package/skills/ai-delivery-review-change/agents/openai.yaml +4 -4
- package/skills/ai-delivery-review-change/references/review-contract.md +6 -0
- package/skills/ai-delivery-triage-failure/SKILL.md +5 -1
- package/skills/ai-delivery-triage-failure/agents/openai.yaml +4 -4
- package/skills/ai-delivery-validate-artifacts/SKILL.md +6 -3
- package/skills/ai-delivery-validate-artifacts/agents/openai.yaml +4 -4
- package/skills/ai-delivery-validate-artifacts/references/artifact-contract.md +13 -13
- package/skills/ai-delivery-verify-candidate/SKILL.md +13 -6
- package/skills/ai-delivery-verify-candidate/agents/openai.yaml +3 -3
- package/skills/ai-delivery-verify-candidate/assets/verification-template/ui-acceptance-request.yaml +19 -0
- package/skills/ai-delivery-verify-candidate/assets/verification-template/ui-acceptance-results.yaml +53 -0
- package/skills/ai-delivery-verify-candidate/references/candidate-verification-contract.md +10 -2
- package/skills/ai-delivery-verify-production/agents/openai.yaml +3 -3
- package/skills/ai-delivery-design-experience/assets/experience-template/low-fidelity-confirmation.yaml +0 -32
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/public/app.js +0 -546
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/public/index.html +0 -199
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/public/styles.css +0 -529
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/server.mjs +0 -780
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/start.cmd +0 -4
- package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/start.ps1 +0 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
IBM Plex Font Software
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
The license is copied below and is also available at:
|
|
5
|
+
https://openfontlicense.org
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply to any
|
|
25
|
+
document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may include
|
|
30
|
+
source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components
|
|
36
|
+
as distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical writer
|
|
44
|
+
or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION & CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
48
|
+
copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components, in
|
|
53
|
+
Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or in
|
|
59
|
+
the appropriate machine-readable metadata fields within text or binary
|
|
60
|
+
files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name
|
|
65
|
+
as presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any Modified
|
|
69
|
+
Version, except to acknowledge the contribution(s) of the Copyright
|
|
70
|
+
Holder(s) and the Author(s) or with their explicit written permission.
|
|
71
|
+
|
|
72
|
+
5) The Font Software, modified or unmodified, in part or in whole, must be
|
|
73
|
+
distributed entirely under this license, and must not be distributed under
|
|
74
|
+
any other license. The requirement for fonts to remain under this license
|
|
75
|
+
does not apply to any document created using the Font Software.
|
|
76
|
+
|
|
77
|
+
TERMINATION
|
|
78
|
+
This license becomes null and void if any of the above conditions are not
|
|
79
|
+
met.
|
|
80
|
+
|
|
81
|
+
DISCLAIMER
|
|
82
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
83
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
84
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
85
|
+
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
86
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
87
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
88
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
89
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
|
90
|
+
DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta name="color-scheme" content="light" />
|
|
7
|
+
<title>工作流管理器</title>
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-E-hGB5ZD.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Chlg6r8f.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import {
|
|
8
|
+
abortWorkflowManagerExternalEffect,
|
|
9
|
+
beginWorkflowManagerExternalEffect,
|
|
10
|
+
commitWorkflowManagerAction,
|
|
11
|
+
completeWorkflowManagerExternalEffect,
|
|
12
|
+
preflightWorkflowManagerAction,
|
|
13
|
+
publishWorkflowManagerExternalEffect,
|
|
14
|
+
} from "./workflow-manager-transaction.mjs";
|
|
15
|
+
|
|
16
|
+
const runtimeRoot = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const installedYaml = path.join(runtimeRoot, "..", "state", "vendor", "yaml", "dist", "index.js");
|
|
18
|
+
const require = createRequire(import.meta.url);
|
|
19
|
+
const YAML = require(fs.existsSync(installedYaml) ? installedYaml : "yaml");
|
|
20
|
+
|
|
21
|
+
export const WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION = "workflow-manager.systems.v1";
|
|
22
|
+
const REGISTRY_RELATIVE = ".workflow/project-systems/registry.yaml";
|
|
23
|
+
const EVENTS_RELATIVE = ".workflow/control/events/workflow-manager-events.jsonl";
|
|
24
|
+
const RECEIPTS_RELATIVE = ".workflow/control/receipts";
|
|
25
|
+
|
|
26
|
+
function sha256(value) {
|
|
27
|
+
return crypto.createHash("sha256").update(value).digest("hex");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function atomicWrite(file, content) {
|
|
31
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
32
|
+
const temporary = `${file}.${process.pid}.${crypto.randomUUID()}.tmp`;
|
|
33
|
+
try {
|
|
34
|
+
fs.writeFileSync(temporary, content, "utf8");
|
|
35
|
+
fs.renameSync(temporary, file);
|
|
36
|
+
} finally {
|
|
37
|
+
fs.rmSync(temporary, { force: true });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function canonical(value) {
|
|
42
|
+
return YAML.stringify(value, { lineWidth: 0 });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function registryChecksum(registry) {
|
|
46
|
+
const copy = structuredClone(registry);
|
|
47
|
+
delete copy.checksum;
|
|
48
|
+
return sha256(canonical(copy));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function rootPath(projectRoot) {
|
|
52
|
+
return path.resolve(projectRoot);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function inside(root, candidate) {
|
|
56
|
+
const relative = path.relative(root, candidate);
|
|
57
|
+
return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function contained(root, relative, label) {
|
|
61
|
+
if (typeof relative !== "string" || !relative.trim() || relative.includes("\0")
|
|
62
|
+
|| path.posix.isAbsolute(relative) || relative.includes("\\")
|
|
63
|
+
|| path.posix.normalize(relative) !== relative) {
|
|
64
|
+
throw new Error(`${label} must be a normalized project-relative POSIX path`);
|
|
65
|
+
}
|
|
66
|
+
const absolute = path.resolve(root, ...relative.split("/"));
|
|
67
|
+
if (!inside(root, absolute)) throw new Error(`${label} escapes project root: ${relative}`);
|
|
68
|
+
return absolute;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function currentBranch(root) {
|
|
72
|
+
const result = spawnSync("git", ["branch", "--show-current"], {
|
|
73
|
+
cwd: root, encoding: "utf8", windowsHide: true,
|
|
74
|
+
});
|
|
75
|
+
return result.status === 0 ? result.stdout.trim() || null : null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function registryFile(root) {
|
|
79
|
+
return contained(root, REGISTRY_RELATIVE, "Project System Registry path");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function readRegistry(root) {
|
|
83
|
+
const file = registryFile(root);
|
|
84
|
+
if (!fs.existsSync(file)) return null;
|
|
85
|
+
let registry;
|
|
86
|
+
try { registry = YAML.parse(fs.readFileSync(file, "utf8")); } catch (error) {
|
|
87
|
+
throw new Error(`Project System Registry is invalid YAML: ${error.message}`);
|
|
88
|
+
}
|
|
89
|
+
if (!registry || registry.schema_version !== 1 || typeof registry.registry_id !== "string"
|
|
90
|
+
|| !Number.isInteger(registry.revision) || registry.revision < 0 || !Array.isArray(registry.systems)) {
|
|
91
|
+
throw new Error("Project System Registry must declare schema_version 1, registry_id, revision, and systems");
|
|
92
|
+
}
|
|
93
|
+
const checksum = registryChecksum(registry);
|
|
94
|
+
if (!/^[a-f0-9]{64}$/.test(String(registry.checksum || "")) || registry.checksum !== checksum) {
|
|
95
|
+
throw new Error("Project System Registry checksum is missing or does not match its content");
|
|
96
|
+
}
|
|
97
|
+
return { file, registry, checksum };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function systemPaths(root, system) {
|
|
101
|
+
const initialization = system.initialization || {};
|
|
102
|
+
const scriptsRoot = initialization.scripts_root || null;
|
|
103
|
+
const dockerFiles = Array.isArray(system.docker_files) ? system.docker_files : [];
|
|
104
|
+
if (scriptsRoot) contained(root, scriptsRoot, `${system.system_id} scripts_root`);
|
|
105
|
+
for (const file of dockerFiles) {
|
|
106
|
+
contained(root, file, `${system.system_id} docker file`);
|
|
107
|
+
const name = path.posix.basename(file).toLowerCase();
|
|
108
|
+
if (!(name === "dockerfile" || name.endsWith(".dockerfile")
|
|
109
|
+
|| name.endsWith(".compose.yaml") || name.endsWith(".compose.yml")
|
|
110
|
+
|| name === "compose.yaml" || name === "compose.yml")) {
|
|
111
|
+
throw new Error(`${system.system_id} docker file must be a registered Dockerfile or Compose YAML: ${file}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const startupSource = system.start?.source;
|
|
115
|
+
if (system.implementation_status === "implemented" && typeof startupSource === "string"
|
|
116
|
+
&& startupSource.startsWith(".workflow/") && !dockerFiles.includes(startupSource)) {
|
|
117
|
+
throw new Error(`${system.system_id} Docker startup source must be listed in docker_files`);
|
|
118
|
+
}
|
|
119
|
+
for (const importRoot of initialization.import_roots || []) {
|
|
120
|
+
contained(root, importRoot, `${system.system_id} initialization import_root`);
|
|
121
|
+
}
|
|
122
|
+
for (const script of Array.isArray(initialization.scripts) ? initialization.scripts : []) {
|
|
123
|
+
if (script.path) {
|
|
124
|
+
const absolute = contained(root, script.path, `${system.system_id} initialization script`);
|
|
125
|
+
if (scriptsRoot && !inside(contained(root, scriptsRoot, "scripts_root"), absolute)) {
|
|
126
|
+
throw new Error(`${system.system_id} initialization script is outside scripts_root: ${script.path}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function branchControl(system, branch) {
|
|
133
|
+
const policy = system.branch_policy || "current-branch-only";
|
|
134
|
+
if (system.implementation_status !== "implemented") {
|
|
135
|
+
return { available: false, reason: "system-not-implemented" };
|
|
136
|
+
}
|
|
137
|
+
if (policy === "read-only") return { available: false, reason: "branch-read-only" };
|
|
138
|
+
if (policy === "current-branch-only" && system.registered_branch && branch !== system.registered_branch) {
|
|
139
|
+
return { available: false, reason: "different-branch" };
|
|
140
|
+
}
|
|
141
|
+
return { available: true, reason: null };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function preview(root, relative) {
|
|
145
|
+
const file = contained(root, relative, "Docker source");
|
|
146
|
+
if (!fs.existsSync(file) || !fs.statSync(file).isFile()) {
|
|
147
|
+
return { path: relative, exists: false, checksum: null, content: null };
|
|
148
|
+
}
|
|
149
|
+
const bytes = fs.readFileSync(file);
|
|
150
|
+
if (bytes.length > 2 * 1024 * 1024) return { path: relative, exists: true, too_large: true, checksum: sha256(bytes), content: null };
|
|
151
|
+
return { path: relative, exists: true, checksum: sha256(bytes), content: bytes.toString("utf8") };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function inspectWorkflowManagerSystems(projectRoot, options = {}) {
|
|
155
|
+
const root = rootPath(projectRoot);
|
|
156
|
+
const loaded = readRegistry(root);
|
|
157
|
+
if (!loaded) return {
|
|
158
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION,
|
|
159
|
+
registration_status: "not-registered", registry: null, systems: [], current_branch: options.branch || currentBranch(root),
|
|
160
|
+
};
|
|
161
|
+
const branch = options.branch || currentBranch(root);
|
|
162
|
+
const systems = loaded.registry.systems.map((system) => {
|
|
163
|
+
if (!system || typeof system.system_id !== "string") throw new Error("Project System Registry system_id is required");
|
|
164
|
+
systemPaths(root, system);
|
|
165
|
+
const control = branchControl(system, branch);
|
|
166
|
+
const dockerSources = (Array.isArray(system.docker_files) ? system.docker_files : [])
|
|
167
|
+
.map((file) => preview(root, file));
|
|
168
|
+
const scripts = Array.isArray(system.initialization?.scripts) ? system.initialization.scripts.map((script) => ({
|
|
169
|
+
...script,
|
|
170
|
+
checksum: script.path && fs.existsSync(contained(root, script.path, "script"))
|
|
171
|
+
? sha256(fs.readFileSync(contained(root, script.path, "script"))) : script.checksum || null,
|
|
172
|
+
content: script.path && fs.existsSync(contained(root, script.path, "script"))
|
|
173
|
+
&& fs.statSync(contained(root, script.path, "script")).size <= 2 * 1024 * 1024
|
|
174
|
+
? fs.readFileSync(contained(root, script.path, "script"), "utf8") : null,
|
|
175
|
+
too_large: script.path && fs.existsSync(contained(root, script.path, "script"))
|
|
176
|
+
? fs.statSync(contained(root, script.path, "script")).size > 2 * 1024 * 1024 : false,
|
|
177
|
+
mutability: control.available ? "editable-with-plan" : "derived-read-only",
|
|
178
|
+
})) : [];
|
|
179
|
+
return {
|
|
180
|
+
system_id: system.system_id, name: system.name || system.system_id, kind: system.kind || "system",
|
|
181
|
+
implementation_status: system.implementation_status || "planned", status: system.implementation_status || "planned",
|
|
182
|
+
branch_policy: system.branch_policy || "current-branch-only", registered_branch: system.registered_branch || null,
|
|
183
|
+
control, start: system.start || { method: "docker", source: "workflow-default" },
|
|
184
|
+
health: system.health || null, docker_sources: dockerSources,
|
|
185
|
+
initialization: { scripts_root: system.initialization?.scripts_root || null, scripts },
|
|
186
|
+
mutability: "derived-read-only",
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION, registration_status: "registered", current_branch: branch,
|
|
191
|
+
registry: { schema_version: loaded.registry.schema_version, registry_id: loaded.registry.registry_id,
|
|
192
|
+
revision: loaded.registry.revision, checksum: loaded.checksum, path: REGISTRY_RELATIVE },
|
|
193
|
+
systems,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function lifecycleCommand(system, operation) {
|
|
198
|
+
const source = system.start?.source;
|
|
199
|
+
if ((system.start?.method || "docker") !== "docker" || typeof source !== "string"
|
|
200
|
+
|| !/\.compose\.ya?ml$|(^|\/)compose\.ya?ml$/i.test(source)) {
|
|
201
|
+
throw new Error(`System ${system.system_id} lifecycle requires a registered Docker Compose source`);
|
|
202
|
+
}
|
|
203
|
+
const tails = {
|
|
204
|
+
start: ["up", "-d"],
|
|
205
|
+
stop: ["stop"],
|
|
206
|
+
restart: ["restart"],
|
|
207
|
+
status: ["ps", "--format", "json"],
|
|
208
|
+
};
|
|
209
|
+
if (!tails[operation]) throw new Error(`Unsupported Project System lifecycle operation: ${operation}`);
|
|
210
|
+
return { executable: "docker", args: ["compose", "-f", source, ...tails[operation]] };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function lifecycleRequestChecksum(systemId, input, command, registry) {
|
|
214
|
+
return sha256(JSON.stringify({
|
|
215
|
+
system_id: systemId,
|
|
216
|
+
operation: input.operation,
|
|
217
|
+
branch: input.branch,
|
|
218
|
+
expected_registry_revision: input.expected_registry_revision,
|
|
219
|
+
expected_registry_checksum: input.expected_registry_checksum || null,
|
|
220
|
+
idempotency_key: input.idempotency_key || null,
|
|
221
|
+
command,
|
|
222
|
+
registry_checksum: registry.checksum,
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function planWorkflowManagerSystemLifecycle(projectRoot, systemId, input = {}) {
|
|
227
|
+
const root = rootPath(projectRoot);
|
|
228
|
+
const loaded = readRegistry(root);
|
|
229
|
+
if (!loaded) return {
|
|
230
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION,
|
|
231
|
+
action: "plan-system-lifecycle", outcome: "not-registered", registration_status: "not-registered",
|
|
232
|
+
};
|
|
233
|
+
const system = findSystem(loaded, systemId);
|
|
234
|
+
const branch = input.branch || currentBranch(root);
|
|
235
|
+
const control = branchControl(system, branch);
|
|
236
|
+
if (!control.available) throw new Error(`System ${systemId} is read-only: ${control.reason}`);
|
|
237
|
+
if (input.expected_registry_revision !== loaded.registry.revision) throw new Error("Project System Registry revision mismatch");
|
|
238
|
+
if (input.expected_registry_checksum && input.expected_registry_checksum !== loaded.checksum) {
|
|
239
|
+
throw new Error("Project System Registry checksum mismatch");
|
|
240
|
+
}
|
|
241
|
+
const command = lifecycleCommand(system, input.operation);
|
|
242
|
+
const composeFile = contained(root, system.start.source, "Docker Compose source");
|
|
243
|
+
if (!fs.existsSync(composeFile) || !fs.statSync(composeFile).isFile()) {
|
|
244
|
+
throw new Error(`Registered Docker Compose source is missing: ${system.start.source}`);
|
|
245
|
+
}
|
|
246
|
+
const composeChecksum = sha256(fs.readFileSync(composeFile));
|
|
247
|
+
const result = {
|
|
248
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION,
|
|
249
|
+
action: "plan-system-lifecycle",
|
|
250
|
+
outcome: "planned",
|
|
251
|
+
system_id: systemId,
|
|
252
|
+
operation: input.operation,
|
|
253
|
+
branch,
|
|
254
|
+
engine: "docker-compose",
|
|
255
|
+
command,
|
|
256
|
+
compose_source: system.start.source,
|
|
257
|
+
compose_checksum: composeChecksum,
|
|
258
|
+
expected_registry_revision: input.expected_registry_revision,
|
|
259
|
+
expected_registry_checksum: input.expected_registry_checksum || loaded.checksum,
|
|
260
|
+
idempotency_key: input.idempotency_key || null,
|
|
261
|
+
affected_identities: [{ system_id: systemId }],
|
|
262
|
+
mutability: "plan-only",
|
|
263
|
+
};
|
|
264
|
+
result.plan_checksum = sha256(JSON.stringify({
|
|
265
|
+
...result,
|
|
266
|
+
plan_checksum: undefined,
|
|
267
|
+
request_checksum: lifecycleRequestChecksum(systemId, { ...input, branch }, command, loaded),
|
|
268
|
+
}));
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function parseLifecycleStatus(stdout) {
|
|
273
|
+
const text = String(stdout || "").trim();
|
|
274
|
+
if (!text) return { running: false, healthy: false, services: [] };
|
|
275
|
+
const documents = text.startsWith("[") ? JSON.parse(text) : text.split(/\r?\n/).filter(Boolean).map((line) => JSON.parse(line));
|
|
276
|
+
const services = (Array.isArray(documents) ? documents : [documents]).map((item) => ({
|
|
277
|
+
service: item.Service || item.Name || item.service || null,
|
|
278
|
+
state: item.State || item.Status || item.state || null,
|
|
279
|
+
health: item.Health || item.health || null,
|
|
280
|
+
}));
|
|
281
|
+
const running = services.length > 0 && services.every((item) => /running|up/i.test(String(item.state || "")));
|
|
282
|
+
const healthy = running && services.every((item) => !item.health || /healthy/i.test(String(item.health)));
|
|
283
|
+
return { running, healthy, services };
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export function applyWorkflowManagerSystemLifecycle(projectRoot, systemId, input = {}, options = {}) {
|
|
287
|
+
const root = rootPath(projectRoot);
|
|
288
|
+
const replay = existingReceipt(root, input.idempotency_key);
|
|
289
|
+
if (replay && new Set(["system-lifecycle", "system-lifecycle-apply"]).has(replay.action)) {
|
|
290
|
+
if (replay.plan_checksum !== input.expected_plan_checksum) {
|
|
291
|
+
throw new Error("Project System lifecycle idempotency key was already used for a different plan");
|
|
292
|
+
}
|
|
293
|
+
return { schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION, outcome: "idempotent-replay", receipt: replay };
|
|
294
|
+
}
|
|
295
|
+
const plan = planWorkflowManagerSystemLifecycle(root, systemId, input);
|
|
296
|
+
if (!input.expected_plan_checksum || input.expected_plan_checksum !== plan.plan_checksum) {
|
|
297
|
+
throw new Error("Project System lifecycle plan checksum mismatch");
|
|
298
|
+
}
|
|
299
|
+
const action = "system-lifecycle-apply";
|
|
300
|
+
const pending = beginWorkflowManagerExternalEffect(root, {
|
|
301
|
+
action, subject: systemId, input, planChecksum: plan.plan_checksum,
|
|
302
|
+
});
|
|
303
|
+
if (pending.record.status === "succeeded" || pending.record.status === "delivered") {
|
|
304
|
+
const recovered = publishWorkflowManagerExternalEffect(root, {
|
|
305
|
+
action, subject: systemId, input, planChecksum: plan.plan_checksum,
|
|
306
|
+
transactionHooks: options.transactionHooks, recovered: pending.record.status === "succeeded",
|
|
307
|
+
});
|
|
308
|
+
return {
|
|
309
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION,
|
|
310
|
+
outcome: recovered.outcome,
|
|
311
|
+
plan,
|
|
312
|
+
result: recovered.result,
|
|
313
|
+
receipt: recovered.receipt,
|
|
314
|
+
event: recovered.event || null,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
const runner = options.runner || ((executable, args, settings) => spawnSync(executable, args, {
|
|
318
|
+
...settings, encoding: "utf8", windowsHide: true, shell: false,
|
|
319
|
+
}));
|
|
320
|
+
let executed;
|
|
321
|
+
try {
|
|
322
|
+
executed = runner(plan.command.executable, plan.command.args, { cwd: root });
|
|
323
|
+
if (executed.error) throw new Error(`Docker Compose lifecycle failed: ${executed.error.message}`);
|
|
324
|
+
if (executed.status !== 0) throw new Error(`Docker Compose lifecycle failed: ${String(executed.stderr || "").trim() || `exit ${executed.status}`}`);
|
|
325
|
+
} catch (error) {
|
|
326
|
+
abortWorkflowManagerExternalEffect(pending);
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
const result = input.operation === "status"
|
|
330
|
+
? parseLifecycleStatus(executed.stdout)
|
|
331
|
+
: { running: input.operation !== "stop", healthy: null, services: [], output: String(executed.stdout || "").trim() || null };
|
|
332
|
+
const completed = completeWorkflowManagerExternalEffect(pending, {
|
|
333
|
+
result,
|
|
334
|
+
detail: {
|
|
335
|
+
system_id: systemId,
|
|
336
|
+
operation: input.operation,
|
|
337
|
+
branch: plan.branch,
|
|
338
|
+
compose_checksum: plan.compose_checksum,
|
|
339
|
+
affected_identities: plan.affected_identities,
|
|
340
|
+
},
|
|
341
|
+
receiptPrefix: "WMS",
|
|
342
|
+
eventType: "workflow-manager.system-lifecycle-applied",
|
|
343
|
+
});
|
|
344
|
+
const recorded = publishWorkflowManagerExternalEffect(root, {
|
|
345
|
+
action, subject: systemId, input, planChecksum: plan.plan_checksum,
|
|
346
|
+
transactionHooks: options.transactionHooks,
|
|
347
|
+
});
|
|
348
|
+
return {
|
|
349
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION,
|
|
350
|
+
outcome: recorded.outcome,
|
|
351
|
+
plan,
|
|
352
|
+
result,
|
|
353
|
+
receipt: recorded.receipt,
|
|
354
|
+
event: recorded.event,
|
|
355
|
+
outbox_status: completed.record.status,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function findSystem(loaded, systemId) {
|
|
360
|
+
const system = loaded.registry.systems.find((item) => item?.system_id === systemId);
|
|
361
|
+
if (!system) throw new Error(`Project System is not registered: ${systemId}`);
|
|
362
|
+
systemPaths(path.dirname(path.dirname(path.dirname(loaded.file))), system);
|
|
363
|
+
return system;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function existingReceipt(root, idempotencyKey) {
|
|
367
|
+
if (!idempotencyKey || !fs.existsSync(path.join(root, RECEIPTS_RELATIVE))) return null;
|
|
368
|
+
for (const name of fs.readdirSync(path.join(root, RECEIPTS_RELATIVE))) {
|
|
369
|
+
if (!name.endsWith(".json")) continue;
|
|
370
|
+
try {
|
|
371
|
+
const receipt = JSON.parse(fs.readFileSync(path.join(root, RECEIPTS_RELATIVE, name), "utf8"));
|
|
372
|
+
if (receipt.idempotency_key === idempotencyKey) return receipt;
|
|
373
|
+
} catch { /* ignore unrelated receipts */ }
|
|
374
|
+
}
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function scriptTarget(root, system, input) {
|
|
379
|
+
const scriptsRoot = system.initialization?.scripts_root;
|
|
380
|
+
if (!scriptsRoot) throw new Error(`System ${system.system_id} does not declare initialization scripts_root`);
|
|
381
|
+
const rootDir = contained(root, scriptsRoot, "initialization scripts_root");
|
|
382
|
+
const declared = (system.initialization?.scripts || []).find((script) => script.script_id === input.script_id);
|
|
383
|
+
const relative = input.path || declared?.path || `${scriptsRoot}/${input.script_id}.sql`;
|
|
384
|
+
const target = contained(root, relative, "initialization script path");
|
|
385
|
+
if (!inside(rootDir, target)) throw new Error("Initialization script path must remain inside the declared scripts root");
|
|
386
|
+
return { relative, target, declared };
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function scriptContent(root, input) {
|
|
390
|
+
if (typeof input.content === "string") return input.content;
|
|
391
|
+
if (input.source_path) {
|
|
392
|
+
const source = contained(root, input.source_path, "initialization import source");
|
|
393
|
+
if (!fs.existsSync(source) || !fs.statSync(source).isFile()) throw new Error(`Initialization import source is missing: ${input.source_path}`);
|
|
394
|
+
return fs.readFileSync(source, "utf8");
|
|
395
|
+
}
|
|
396
|
+
throw new Error("Initialization script requires content or project-relative source_path");
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function requireImportAllowed(root, system, sourcePath) {
|
|
400
|
+
if (!sourcePath) return;
|
|
401
|
+
const source = contained(root, sourcePath, "initialization import source");
|
|
402
|
+
const roots = (system.initialization?.import_roots || []).map((item) =>
|
|
403
|
+
contained(root, item, "initialization import_root"));
|
|
404
|
+
if (!roots.some((importRoot) => inside(importRoot, source))) {
|
|
405
|
+
throw new Error("Initialization import source must remain inside registry-declared import_roots");
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function requestChecksum(systemId, input, pathRef, content) {
|
|
410
|
+
return sha256(JSON.stringify({ system_id: systemId, script_id: input.script_id,
|
|
411
|
+
path: pathRef, content, actor: input.actor || "agent:workflow-manager", branch: input.branch || null }));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export function planWorkflowManagerInitializationScript(projectRoot, systemId, input = {}) {
|
|
415
|
+
const root = rootPath(projectRoot); const loaded = readRegistry(root);
|
|
416
|
+
if (!loaded) return { schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION, outcome: "not-registered", registration_status: "not-registered", action: "plan-initialization-script" };
|
|
417
|
+
const system = findSystem(loaded, systemId); const branch = input.branch || currentBranch(root); const control = branchControl(system, branch);
|
|
418
|
+
if (!control.available) throw new Error(`System ${systemId} is read-only: ${control.reason}`);
|
|
419
|
+
requireImportAllowed(root, system, input.source_path);
|
|
420
|
+
const target = scriptTarget(root, system, input); const content = scriptContent(root, input); const checksum = sha256(content);
|
|
421
|
+
const currentChecksum = fs.existsSync(target.target) ? sha256(fs.readFileSync(target.target)) : null;
|
|
422
|
+
return {
|
|
423
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION, action: "plan-initialization-script", system_id: systemId,
|
|
424
|
+
script_id: input.script_id, path: target.relative, branch, expected_registry_revision: input.expected_registry_revision,
|
|
425
|
+
current_registry_revision: loaded.registry.revision, expected_registry_checksum: input.expected_registry_checksum || loaded.checksum,
|
|
426
|
+
current_registry_checksum: loaded.checksum, expected_script_checksum: currentChecksum,
|
|
427
|
+
planned_script_checksum: checksum, idempotency_key: input.idempotency_key || null,
|
|
428
|
+
affected_identities: [{ system_id: systemId, script_id: input.script_id }],
|
|
429
|
+
content_bytes: Buffer.byteLength(content), mutability: "plan-only",
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export function applyWorkflowManagerInitializationScript(projectRoot, systemId, input = {}, options = {}) {
|
|
434
|
+
const root = rootPath(projectRoot); const loaded = readRegistry(root);
|
|
435
|
+
if (!loaded) return { schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION, outcome: "not-registered", registration_status: "not-registered", action: "apply-initialization-script" };
|
|
436
|
+
const system = findSystem(loaded, systemId); const branch = input.branch || currentBranch(root); const control = branchControl(system, branch);
|
|
437
|
+
if (!control.available) throw new Error(`System ${systemId} is read-only: ${control.reason}`);
|
|
438
|
+
requireImportAllowed(root, system, input.source_path);
|
|
439
|
+
const target = scriptTarget(root, system, input); const content = scriptContent(root, input); const checksum = sha256(content);
|
|
440
|
+
const request = requestChecksum(systemId, { ...input, branch }, target.relative, content);
|
|
441
|
+
const transactionInput = {
|
|
442
|
+
system_id: systemId,
|
|
443
|
+
script_id: input.script_id,
|
|
444
|
+
name: input.name || input.script_id,
|
|
445
|
+
path: target.relative,
|
|
446
|
+
source_path: input.source_path || null,
|
|
447
|
+
content,
|
|
448
|
+
actor: input.actor,
|
|
449
|
+
branch,
|
|
450
|
+
idempotency_key: input.idempotency_key,
|
|
451
|
+
};
|
|
452
|
+
const sharedReplay = preflightWorkflowManagerAction(root, {
|
|
453
|
+
action: "apply-initialization-script",
|
|
454
|
+
subject: `${systemId}:${input.script_id}`,
|
|
455
|
+
input: transactionInput,
|
|
456
|
+
});
|
|
457
|
+
if (sharedReplay) return { schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION, outcome: "idempotent-replay", receipt: sharedReplay, result: sharedReplay.result };
|
|
458
|
+
const replay = existingReceipt(root, input.idempotency_key);
|
|
459
|
+
if (replay) {
|
|
460
|
+
if (replay.request_checksum !== request) throw new Error("Idempotency key was already used for a different request");
|
|
461
|
+
return { schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION, outcome: "idempotent-replay", receipt: replay };
|
|
462
|
+
}
|
|
463
|
+
if (input.expected_registry_revision !== loaded.registry.revision) throw new Error("Project System Registry revision mismatch");
|
|
464
|
+
if (input.expected_registry_checksum && input.expected_registry_checksum !== loaded.checksum) throw new Error("Project System Registry checksum mismatch");
|
|
465
|
+
const actual = fs.existsSync(target.target) ? sha256(fs.readFileSync(target.target)) : null;
|
|
466
|
+
if (input.expected_script_checksum && input.expected_script_checksum !== actual) throw new Error("Initialization script checksum mismatch");
|
|
467
|
+
const next = structuredClone(loaded.registry); next.revision += 1; const entry = next.systems.find((item) => item.system_id === systemId);
|
|
468
|
+
entry.initialization ||= { scripts_root: system.initialization.scripts_root, scripts: [] }; entry.initialization.scripts ||= [];
|
|
469
|
+
const script = entry.initialization.scripts.find((item) => item.script_id === input.script_id) || { script_id: input.script_id, name: input.name || input.script_id, path: target.relative };
|
|
470
|
+
script.path = target.relative;
|
|
471
|
+
script.name = input.name || script.name || input.script_id;
|
|
472
|
+
script.checksum = checksum;
|
|
473
|
+
if (input.source_path) script.source_path = input.source_path;
|
|
474
|
+
else delete script.source_path;
|
|
475
|
+
if (!entry.initialization.scripts.includes(script)) entry.initialization.scripts.push(script);
|
|
476
|
+
delete next.checksum; next.checksum = registryChecksum(next);
|
|
477
|
+
const result = {
|
|
478
|
+
system_id: systemId,
|
|
479
|
+
script_id: input.script_id,
|
|
480
|
+
path: target.relative,
|
|
481
|
+
source_path: input.source_path || null,
|
|
482
|
+
script_checksum: checksum,
|
|
483
|
+
current_registry_revision: next.revision,
|
|
484
|
+
current_registry_checksum: next.checksum,
|
|
485
|
+
};
|
|
486
|
+
const recorded = commitWorkflowManagerAction(root, {
|
|
487
|
+
action: "apply-initialization-script",
|
|
488
|
+
subject: `${systemId}:${input.script_id}`,
|
|
489
|
+
input: transactionInput,
|
|
490
|
+
result,
|
|
491
|
+
detail: {
|
|
492
|
+
system_id: systemId,
|
|
493
|
+
script_id: input.script_id,
|
|
494
|
+
path: target.relative,
|
|
495
|
+
branch,
|
|
496
|
+
expected_registry_revision: loaded.registry.revision,
|
|
497
|
+
expected_registry_checksum: loaded.checksum,
|
|
498
|
+
current_registry_revision: next.revision,
|
|
499
|
+
current_registry_checksum: next.checksum,
|
|
500
|
+
script_checksum: checksum,
|
|
501
|
+
affected_identities: [{ system_id: systemId, script_id: input.script_id }],
|
|
502
|
+
},
|
|
503
|
+
writes: [
|
|
504
|
+
{ file: target.target, content },
|
|
505
|
+
{ file: loaded.file, content: canonical(next) },
|
|
506
|
+
],
|
|
507
|
+
receiptPrefix: "WMS",
|
|
508
|
+
eventType: "workflow-manager.initialization-script-applied",
|
|
509
|
+
transactionHooks: options.transactionHooks,
|
|
510
|
+
});
|
|
511
|
+
return {
|
|
512
|
+
schema_version: WORKFLOW_MANAGER_SYSTEMS_SCHEMA_VERSION,
|
|
513
|
+
outcome: recorded.outcome,
|
|
514
|
+
action: "apply-initialization-script",
|
|
515
|
+
receipt: recorded.receipt,
|
|
516
|
+
event: recorded.event,
|
|
517
|
+
...result,
|
|
518
|
+
};
|
|
519
|
+
}
|