godpowers 0.15.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/AGENTS.md +37 -0
- package/CHANGELOG.md +639 -0
- package/INSPIRATION.md +52 -0
- package/LICENSE +21 -0
- package/README.md +232 -0
- package/SKILL.md +500 -0
- package/agents/god-archaeologist.md +139 -0
- package/agents/god-architect.md +92 -0
- package/agents/god-auditor.md +150 -0
- package/agents/god-browser-tester.md +144 -0
- package/agents/god-context-writer.md +137 -0
- package/agents/god-coordinator.md +138 -0
- package/agents/god-debt-assessor.md +132 -0
- package/agents/god-debugger.md +77 -0
- package/agents/god-deploy-engineer.md +87 -0
- package/agents/god-deps-auditor.md +111 -0
- package/agents/god-design-reviewer.md +137 -0
- package/agents/god-designer.md +171 -0
- package/agents/god-docs-writer.md +102 -0
- package/agents/god-executor.md +76 -0
- package/agents/god-explorer.md +110 -0
- package/agents/god-harden-auditor.md +163 -0
- package/agents/god-incident-investigator.md +144 -0
- package/agents/god-launch-strategist.md +103 -0
- package/agents/god-migration-strategist.md +126 -0
- package/agents/god-observability-engineer.md +76 -0
- package/agents/god-orchestrator.md +728 -0
- package/agents/god-org-context-loader.md +124 -0
- package/agents/god-planner.md +73 -0
- package/agents/god-pm.md +105 -0
- package/agents/god-quality-reviewer.md +74 -0
- package/agents/god-reconciler.md +230 -0
- package/agents/god-reconstructor.md +124 -0
- package/agents/god-repo-scaffolder.md +60 -0
- package/agents/god-retrospective.md +109 -0
- package/agents/god-roadmap-reconciler.md +123 -0
- package/agents/god-roadmap-updater.md +89 -0
- package/agents/god-roadmapper.md +82 -0
- package/agents/god-spec-reviewer.md +70 -0
- package/agents/god-spike-runner.md +119 -0
- package/agents/god-stack-selector.md +93 -0
- package/agents/god-standards-check.md +132 -0
- package/agents/god-storyteller.md +116 -0
- package/agents/god-updater.md +174 -0
- package/bin/install.js +514 -0
- package/extensions/data-pack/README.md +33 -0
- package/extensions/data-pack/agents/god-dashboard-builder.md +66 -0
- package/extensions/data-pack/agents/god-etl-engineer.md +64 -0
- package/extensions/data-pack/agents/god-ml-feature-engineer.md +66 -0
- package/extensions/data-pack/manifest.yaml +39 -0
- package/extensions/data-pack/package.json +42 -0
- package/extensions/data-pack/skills/god-dashboard.md +28 -0
- package/extensions/data-pack/skills/god-etl.md +28 -0
- package/extensions/data-pack/skills/god-ml-feature.md +28 -0
- package/extensions/data-pack/workflows/dashboard-arc.yaml +13 -0
- package/extensions/data-pack/workflows/etl-arc.yaml +13 -0
- package/extensions/data-pack/workflows/ml-feature-arc.yaml +13 -0
- package/extensions/launch-pack/README.md +36 -0
- package/extensions/launch-pack/agents/god-indie-hackers-strategist.md +128 -0
- package/extensions/launch-pack/agents/god-oss-release-strategist.md +125 -0
- package/extensions/launch-pack/agents/god-product-hunt-strategist.md +118 -0
- package/extensions/launch-pack/agents/god-show-hn-strategist.md +113 -0
- package/extensions/launch-pack/manifest.yaml +45 -0
- package/extensions/launch-pack/package.json +41 -0
- package/extensions/launch-pack/skills/god-indie-hackers.md +39 -0
- package/extensions/launch-pack/skills/god-oss-release.md +43 -0
- package/extensions/launch-pack/skills/god-product-hunt.md +41 -0
- package/extensions/launch-pack/skills/god-show-hn.md +40 -0
- package/extensions/launch-pack/workflows/indie-hackers.yaml +13 -0
- package/extensions/launch-pack/workflows/oss-release.yaml +13 -0
- package/extensions/launch-pack/workflows/product-hunt.yaml +13 -0
- package/extensions/launch-pack/workflows/show-hn.yaml +13 -0
- package/extensions/security-pack/README.md +48 -0
- package/extensions/security-pack/agents/god-hipaa-auditor.md +117 -0
- package/extensions/security-pack/agents/god-pci-auditor.md +100 -0
- package/extensions/security-pack/agents/god-soc2-auditor.md +107 -0
- package/extensions/security-pack/manifest.yaml +39 -0
- package/extensions/security-pack/package.json +42 -0
- package/extensions/security-pack/skills/god-hipaa-audit.md +41 -0
- package/extensions/security-pack/skills/god-pci-audit.md +40 -0
- package/extensions/security-pack/skills/god-soc2-audit.md +42 -0
- package/extensions/security-pack/workflows/hipaa-arc.yaml +15 -0
- package/extensions/security-pack/workflows/pci-arc.yaml +15 -0
- package/extensions/security-pack/workflows/soc2-arc.yaml +15 -0
- package/hooks/pre-tool-use.sh +40 -0
- package/hooks/session-start.sh +74 -0
- package/lib/README.md +28 -0
- package/lib/agent-browser-driver.js +215 -0
- package/lib/agent-cache.js +194 -0
- package/lib/agent-validator.js +275 -0
- package/lib/artifact-diff.js +168 -0
- package/lib/artifact-linter.js +142 -0
- package/lib/awesome-design.js +312 -0
- package/lib/browser-bridge.js +209 -0
- package/lib/budget.js +215 -0
- package/lib/checkpoint.js +390 -0
- package/lib/code-scanner.js +262 -0
- package/lib/context-budget.js +170 -0
- package/lib/context-writer.js +348 -0
- package/lib/cost-tracker.js +325 -0
- package/lib/cross-artifact-impact.js +162 -0
- package/lib/cross-repo-linkage.js +150 -0
- package/lib/design-detector.js +167 -0
- package/lib/design-spec.js +348 -0
- package/lib/drift-detector.js +212 -0
- package/lib/event-reader.js +174 -0
- package/lib/events.js +183 -0
- package/lib/extensions.js +257 -0
- package/lib/have-nots-validator.js +647 -0
- package/lib/impact.js +314 -0
- package/lib/impeccable-bridge.js +139 -0
- package/lib/intent.js +177 -0
- package/lib/linkage.js +232 -0
- package/lib/meta-linter.js +263 -0
- package/lib/multi-repo-detector.js +182 -0
- package/lib/otel-exporter.js +308 -0
- package/lib/recipes.js +186 -0
- package/lib/reverse-sync.js +332 -0
- package/lib/review-required.js +224 -0
- package/lib/router.js +278 -0
- package/lib/runtime-audit.js +455 -0
- package/lib/runtime-test.js +309 -0
- package/lib/skillui-bridge.js +216 -0
- package/lib/state-lock.js +201 -0
- package/lib/state.js +142 -0
- package/lib/story-validator.js +301 -0
- package/lib/suite-state.js +220 -0
- package/lib/workflow-parser.js +109 -0
- package/lib/workflow-runner.js +221 -0
- package/package.json +63 -0
- package/references/HAVE-NOTS.md +573 -0
- package/references/building/BUILD-ANTIPATTERNS.md +102 -0
- package/references/building/BUILD-VERTICAL-SLICES.md +75 -0
- package/references/building/BUILD-WAVES.md +61 -0
- package/references/building/README.md +17 -0
- package/references/design/COLOR.md +122 -0
- package/references/design/DESIGN-ANATOMY.md +121 -0
- package/references/design/DESIGN-ANTIPATTERNS.md +108 -0
- package/references/design/INTERACTION.md +148 -0
- package/references/design/MOTION.md +120 -0
- package/references/design/RESPONSIVE.md +157 -0
- package/references/design/SPATIAL.md +109 -0
- package/references/design/TYPOGRAPHY.md +121 -0
- package/references/design/UX-WRITING.md +135 -0
- package/references/orchestration/MODE-DETECTION.md +74 -0
- package/references/orchestration/README.md +18 -0
- package/references/orchestration/SCALE-DETECTION.md +81 -0
- package/references/planning/ARCH-ANATOMY.md +143 -0
- package/references/planning/ARCH-ANTIPATTERNS.md +52 -0
- package/references/planning/PRD-ANATOMY.md +117 -0
- package/references/planning/PRD-ANTIPATTERNS.md +138 -0
- package/references/planning/README.md +16 -0
- package/references/planning/ROADMAP-ANATOMY.md +43 -0
- package/references/planning/ROADMAP-ANTIPATTERNS.md +94 -0
- package/references/planning/STACK-ANATOMY.md +60 -0
- package/references/planning/STACK-ANTIPATTERNS.md +95 -0
- package/references/shared/GLOSSARY.md +80 -0
- package/references/shared/ORCHESTRATORS.md +76 -0
- package/references/shared/README.md +14 -0
- package/references/shipping/DEPLOY-ANTIPATTERNS.md +64 -0
- package/references/shipping/DEPLOY-PATTERNS.md +110 -0
- package/references/shipping/HARDEN-ANTIPATTERNS.md +66 -0
- package/references/shipping/HARDEN-OWASP-WORKSHEETS.md +89 -0
- package/references/shipping/LAUNCH-ANTIPATTERNS.md +68 -0
- package/references/shipping/OBSERVE-ANTIPATTERNS.md +62 -0
- package/references/shipping/OBSERVE-SLO-EXAMPLES.md +107 -0
- package/references/shipping/README.md +18 -0
- package/routing/god-add-backlog.yaml +24 -0
- package/routing/god-add-tests.yaml +27 -0
- package/routing/god-add-todo.yaml +24 -0
- package/routing/god-agent-audit.yaml +24 -0
- package/routing/god-arch.yaml +46 -0
- package/routing/god-archaeology.yaml +28 -0
- package/routing/god-audit.yaml +32 -0
- package/routing/god-budget.yaml +24 -0
- package/routing/god-build-agent.yaml +24 -0
- package/routing/god-build.yaml +46 -0
- package/routing/god-cache-clear.yaml +24 -0
- package/routing/god-check-todos.yaml +24 -0
- package/routing/god-context-scan.yaml +24 -0
- package/routing/god-context.yaml +44 -0
- package/routing/god-cost.yaml +24 -0
- package/routing/god-debug.yaml +28 -0
- package/routing/god-deploy.yaml +34 -0
- package/routing/god-design-impact.yaml +25 -0
- package/routing/god-design.yaml +67 -0
- package/routing/god-discuss.yaml +27 -0
- package/routing/god-docs.yaml +33 -0
- package/routing/god-doctor.yaml +27 -0
- package/routing/god-explore.yaml +27 -0
- package/routing/god-extension-add.yaml +24 -0
- package/routing/god-extension-info.yaml +24 -0
- package/routing/god-extension-list.yaml +24 -0
- package/routing/god-extension-remove.yaml +24 -0
- package/routing/god-extract-learnings.yaml +24 -0
- package/routing/god-fast.yaml +27 -0
- package/routing/god-feature.yaml +34 -0
- package/routing/god-graph.yaml +24 -0
- package/routing/god-harden.yaml +41 -0
- package/routing/god-help.yaml +27 -0
- package/routing/god-hotfix.yaml +34 -0
- package/routing/god-hygiene.yaml +28 -0
- package/routing/god-init.yaml +37 -0
- package/routing/god-intel.yaml +24 -0
- package/routing/god-launch.yaml +41 -0
- package/routing/god-lifecycle.yaml +27 -0
- package/routing/god-link.yaml +24 -0
- package/routing/god-lint.yaml +24 -0
- package/routing/god-list-assumptions.yaml +27 -0
- package/routing/god-locate.yaml +24 -0
- package/routing/god-logs.yaml +24 -0
- package/routing/god-map-codebase.yaml +24 -0
- package/routing/god-metrics.yaml +24 -0
- package/routing/god-mode.yaml +31 -0
- package/routing/god-next.yaml +27 -0
- package/routing/god-note.yaml +24 -0
- package/routing/god-observe.yaml +34 -0
- package/routing/god-org-context.yaml +28 -0
- package/routing/god-party.yaml +24 -0
- package/routing/god-pause-work.yaml +27 -0
- package/routing/god-plant-seed.yaml +24 -0
- package/routing/god-postmortem.yaml +34 -0
- package/routing/god-pr-branch.yaml +25 -0
- package/routing/god-prd.yaml +49 -0
- package/routing/god-quick.yaml +28 -0
- package/routing/god-reconcile.yaml +48 -0
- package/routing/god-reconstruct.yaml +36 -0
- package/routing/god-redo.yaml +27 -0
- package/routing/god-refactor.yaml +36 -0
- package/routing/god-repair.yaml +27 -0
- package/routing/god-repo.yaml +35 -0
- package/routing/god-restore.yaml +27 -0
- package/routing/god-resume-work.yaml +27 -0
- package/routing/god-review-changes.yaml +25 -0
- package/routing/god-review.yaml +28 -0
- package/routing/god-roadmap-check.yaml +39 -0
- package/routing/god-roadmap-update.yaml +37 -0
- package/routing/god-roadmap.yaml +42 -0
- package/routing/god-rollback.yaml +27 -0
- package/routing/god-scan.yaml +24 -0
- package/routing/god-set-profile.yaml +24 -0
- package/routing/god-settings.yaml +24 -0
- package/routing/god-skip.yaml +27 -0
- package/routing/god-smite.yaml +29 -0
- package/routing/god-spike.yaml +35 -0
- package/routing/god-sprint.yaml +25 -0
- package/routing/god-stack.yaml +41 -0
- package/routing/god-standards.yaml +24 -0
- package/routing/god-status.yaml +27 -0
- package/routing/god-stories.yaml +24 -0
- package/routing/god-story-build.yaml +25 -0
- package/routing/god-story-close.yaml +25 -0
- package/routing/god-story-verify.yaml +25 -0
- package/routing/god-story.yaml +24 -0
- package/routing/god-suite-init.yaml +24 -0
- package/routing/god-suite-patch.yaml +25 -0
- package/routing/god-suite-release.yaml +25 -0
- package/routing/god-suite-status.yaml +25 -0
- package/routing/god-suite-sync.yaml +25 -0
- package/routing/god-sync.yaml +33 -0
- package/routing/god-tech-debt.yaml +32 -0
- package/routing/god-test-extension.yaml +24 -0
- package/routing/god-test-runtime.yaml +25 -0
- package/routing/god-thread.yaml +24 -0
- package/routing/god-trace.yaml +24 -0
- package/routing/god-undo.yaml +27 -0
- package/routing/god-update-deps.yaml +39 -0
- package/routing/god-upgrade.yaml +33 -0
- package/routing/god-version.yaml +24 -0
- package/routing/god-workstream.yaml +24 -0
- package/routing/god.yaml +24 -0
- package/routing/recipes/add-feature-defer-current-milestone.yaml +21 -0
- package/routing/recipes/add-feature-future-conditional.yaml +21 -0
- package/routing/recipes/add-feature-mid-arc-pause.yaml +33 -0
- package/routing/recipes/add-feature-next-milestone.yaml +23 -0
- package/routing/recipes/add-feature-parallel.yaml +29 -0
- package/routing/recipes/add-feature-prd-update.yaml +21 -0
- package/routing/recipes/add-feature-small.yaml +24 -0
- package/routing/recipes/add-feature-tiny.yaml +24 -0
- package/routing/recipes/bluefield-org-aware.yaml +27 -0
- package/routing/recipes/broken-install.yaml +22 -0
- package/routing/recipes/brownfield-onboarding.yaml +32 -0
- package/routing/recipes/bug-no-urgency.yaml +21 -0
- package/routing/recipes/capture-idea.yaml +22 -0
- package/routing/recipes/capture-todo.yaml +21 -0
- package/routing/recipes/clean-pr.yaml +21 -0
- package/routing/recipes/code-cleanup.yaml +23 -0
- package/routing/recipes/docs-drift.yaml +21 -0
- package/routing/recipes/existing-codebase-onboarding.yaml +32 -0
- package/routing/recipes/extract-learnings.yaml +22 -0
- package/routing/recipes/greenfield-fast.yaml +25 -0
- package/routing/recipes/greenfield-manual.yaml +32 -0
- package/routing/recipes/greenfield-with-ideation.yaml +29 -0
- package/routing/recipes/incident-postmortem.yaml +24 -0
- package/routing/recipes/major-framework-upgrade.yaml +23 -0
- package/routing/recipes/monthly-deps.yaml +22 -0
- package/routing/recipes/multi-repo-suite.yaml +56 -0
- package/routing/recipes/parallel-engineers.yaml +26 -0
- package/routing/recipes/pause-handoff.yaml +21 -0
- package/routing/recipes/production-broken.yaml +26 -0
- package/routing/recipes/rerun-tier.yaml +21 -0
- package/routing/recipes/returning-after-break.yaml +31 -0
- package/routing/recipes/state-drift.yaml +21 -0
- package/routing/recipes/undo-last.yaml +21 -0
- package/routing/recipes/weekly-health-check.yaml +24 -0
- package/routing/recipes/whats-next.yaml +22 -0
- package/routing/recipes/where-am-i.yaml +21 -0
- package/schema/events.v1.json +63 -0
- package/schema/extension-manifest.v1.json +84 -0
- package/schema/intent.v1.yaml.json +116 -0
- package/schema/recipe.v1.json +120 -0
- package/schema/routing.v1.json +163 -0
- package/schema/state.v1.json +146 -0
- package/schema/workflow.v1.json +96 -0
- package/skills/god-add-backlog.md +40 -0
- package/skills/god-add-tests.md +53 -0
- package/skills/god-add-todo.md +32 -0
- package/skills/god-agent-audit.md +87 -0
- package/skills/god-arch.md +81 -0
- package/skills/god-archaeology.md +48 -0
- package/skills/god-audit.md +65 -0
- package/skills/god-budget.md +103 -0
- package/skills/god-build-agent.md +91 -0
- package/skills/god-build.md +90 -0
- package/skills/god-cache-clear.md +75 -0
- package/skills/god-check-todos.md +42 -0
- package/skills/god-context-scan.md +125 -0
- package/skills/god-context.md +147 -0
- package/skills/god-cost.md +118 -0
- package/skills/god-debug.md +30 -0
- package/skills/god-deploy.md +76 -0
- package/skills/god-design-impact.md +86 -0
- package/skills/god-design.md +275 -0
- package/skills/god-discuss.md +46 -0
- package/skills/god-docs.md +81 -0
- package/skills/god-doctor.md +94 -0
- package/skills/god-explore.md +50 -0
- package/skills/god-export-otel.md +87 -0
- package/skills/god-extension-add.md +79 -0
- package/skills/god-extension-info.md +75 -0
- package/skills/god-extension-list.md +55 -0
- package/skills/god-extension-remove.md +66 -0
- package/skills/god-extract-learnings.md +60 -0
- package/skills/god-fast.md +47 -0
- package/skills/god-feature.md +114 -0
- package/skills/god-graph.md +56 -0
- package/skills/god-harden.md +106 -0
- package/skills/god-help.md +66 -0
- package/skills/god-hotfix.md +139 -0
- package/skills/god-hygiene.md +104 -0
- package/skills/god-init.md +161 -0
- package/skills/god-intel.md +36 -0
- package/skills/god-launch.md +86 -0
- package/skills/god-lifecycle.md +119 -0
- package/skills/god-link.md +90 -0
- package/skills/god-lint.md +128 -0
- package/skills/god-list-assumptions.md +56 -0
- package/skills/god-locate.md +97 -0
- package/skills/god-logs.md +57 -0
- package/skills/god-map-codebase.md +45 -0
- package/skills/god-metrics.md +51 -0
- package/skills/god-mode.md +159 -0
- package/skills/god-next.md +257 -0
- package/skills/god-note.md +39 -0
- package/skills/god-observe.md +76 -0
- package/skills/god-org-context.md +81 -0
- package/skills/god-party.md +87 -0
- package/skills/god-pause-work.md +64 -0
- package/skills/god-plant-seed.md +59 -0
- package/skills/god-postmortem.md +103 -0
- package/skills/god-pr-branch.md +50 -0
- package/skills/god-prd.md +90 -0
- package/skills/god-quick.md +50 -0
- package/skills/god-reconcile.md +90 -0
- package/skills/god-reconstruct.md +72 -0
- package/skills/god-redo.md +73 -0
- package/skills/god-refactor.md +137 -0
- package/skills/god-repair.md +82 -0
- package/skills/god-repo.md +49 -0
- package/skills/god-restore.md +91 -0
- package/skills/god-resume-work.md +42 -0
- package/skills/god-review-changes.md +93 -0
- package/skills/god-review.md +52 -0
- package/skills/god-roadmap-check.md +66 -0
- package/skills/god-roadmap-update.md +64 -0
- package/skills/god-roadmap.md +77 -0
- package/skills/god-rollback.md +88 -0
- package/skills/god-scan.md +106 -0
- package/skills/god-set-profile.md +58 -0
- package/skills/god-settings.md +44 -0
- package/skills/god-skip.md +78 -0
- package/skills/god-smite.md +86 -0
- package/skills/god-spike.md +120 -0
- package/skills/god-sprint.md +77 -0
- package/skills/god-stack.md +74 -0
- package/skills/god-standards.md +62 -0
- package/skills/god-status.md +99 -0
- package/skills/god-stories.md +60 -0
- package/skills/god-story-build.md +76 -0
- package/skills/god-story-close.md +82 -0
- package/skills/god-story-verify.md +71 -0
- package/skills/god-story.md +55 -0
- package/skills/god-suite-init.md +75 -0
- package/skills/god-suite-patch.md +64 -0
- package/skills/god-suite-release.md +58 -0
- package/skills/god-suite-status.md +63 -0
- package/skills/god-suite-sync.md +49 -0
- package/skills/god-sync.md +102 -0
- package/skills/god-tech-debt.md +56 -0
- package/skills/god-test-extension.md +87 -0
- package/skills/god-test-runtime.md +144 -0
- package/skills/god-thread.md +39 -0
- package/skills/god-trace.md +50 -0
- package/skills/god-undo.md +68 -0
- package/skills/god-update-deps.md +134 -0
- package/skills/god-upgrade.md +139 -0
- package/skills/god-version.md +37 -0
- package/skills/god-workstream.md +61 -0
- package/skills/god.md +207 -0
- package/templates/ARCH.md +99 -0
- package/templates/DEPS-AUDIT.md +66 -0
- package/templates/DESIGN.md +71 -0
- package/templates/DOCS-UPDATE-LOG.md +64 -0
- package/templates/HARDEN-FINDINGS.md +69 -0
- package/templates/MIGRATION.md +86 -0
- package/templates/POSTMORTEM.md +88 -0
- package/templates/PRD.md +80 -0
- package/templates/PROGRESS.md +49 -0
- package/templates/ROADMAP.md +47 -0
- package/templates/SPIKE.md +72 -0
- package/templates/STACK-DECISION.md +61 -0
- package/workflows/audit-only.yaml +22 -0
- package/workflows/bluefield-arc.yaml +87 -0
- package/workflows/brownfield-arc.yaml +44 -0
- package/workflows/deps-audit.yaml +56 -0
- package/workflows/docs-arc.yaml +22 -0
- package/workflows/feature-arc.yaml +59 -0
- package/workflows/full-arc.yaml +84 -0
- package/workflows/hotfix-arc.yaml +59 -0
- package/workflows/hygiene.yaml +43 -0
- package/workflows/migration-arc.yaml +73 -0
- package/workflows/postmortem.yaml +31 -0
- package/workflows/refactor-arc.yaml +59 -0
- package/workflows/spike.yaml +23 -0
package/lib/router.js
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router
|
|
3
|
+
*
|
|
4
|
+
* Query routing definitions to:
|
|
5
|
+
* - Find prerequisites for a command
|
|
6
|
+
* - Suggest next command after success
|
|
7
|
+
* - Identify auto-completable prerequisites
|
|
8
|
+
* - Identify when standards checks should run
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { parseSimpleYaml } = require('./intent');
|
|
14
|
+
const state = require('./state');
|
|
15
|
+
|
|
16
|
+
const ROUTING_DIR = path.join(__dirname, '..', 'routing');
|
|
17
|
+
|
|
18
|
+
let _cache = null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Load all routing files into a map keyed by command.
|
|
22
|
+
*/
|
|
23
|
+
function loadAll() {
|
|
24
|
+
if (_cache) return _cache;
|
|
25
|
+
const result = {};
|
|
26
|
+
if (!fs.existsSync(ROUTING_DIR)) return result;
|
|
27
|
+
|
|
28
|
+
for (const file of fs.readdirSync(ROUTING_DIR)) {
|
|
29
|
+
if (!file.endsWith('.yaml')) continue;
|
|
30
|
+
const content = fs.readFileSync(path.join(ROUTING_DIR, file), 'utf8');
|
|
31
|
+
const parsed = parseSimpleYaml(content);
|
|
32
|
+
if (parsed.metadata && parsed.metadata.command) {
|
|
33
|
+
result[parsed.metadata.command] = parsed;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_cache = result;
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get routing for a specific command.
|
|
42
|
+
*/
|
|
43
|
+
function getRouting(command) {
|
|
44
|
+
const all = loadAll();
|
|
45
|
+
return all[command] || null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Check prerequisites for a command against current project state.
|
|
50
|
+
* Returns { satisfied, missing[], autoCompletable[] }
|
|
51
|
+
*/
|
|
52
|
+
function checkPrerequisites(command, projectRoot) {
|
|
53
|
+
const routing = getRouting(command);
|
|
54
|
+
if (!routing) return { satisfied: true, missing: [], autoCompletable: [] };
|
|
55
|
+
|
|
56
|
+
const required = (routing.prerequisites && routing.prerequisites.required) || [];
|
|
57
|
+
const missing = [];
|
|
58
|
+
const autoCompletable = [];
|
|
59
|
+
|
|
60
|
+
for (const prereq of required) {
|
|
61
|
+
const ok = evaluateCheck(prereq.check, projectRoot);
|
|
62
|
+
if (!ok) {
|
|
63
|
+
missing.push(prereq.check);
|
|
64
|
+
if (prereq['auto-complete']) {
|
|
65
|
+
autoCompletable.push({
|
|
66
|
+
check: prereq.check,
|
|
67
|
+
autoCompleteCommand: prereq['auto-complete'],
|
|
68
|
+
humanRequired: prereq['human-required'] !== false
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
satisfied: missing.length === 0,
|
|
76
|
+
missing,
|
|
77
|
+
autoCompletable
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Evaluate a single check predicate against the project state.
|
|
83
|
+
* Predicates: file:path, state:dotted.path == value, env:VAR
|
|
84
|
+
*/
|
|
85
|
+
function evaluateCheck(check, projectRoot) {
|
|
86
|
+
// file:path
|
|
87
|
+
if (check.startsWith('file:')) {
|
|
88
|
+
const filePath = check.slice(5).trim();
|
|
89
|
+
return fs.existsSync(path.join(projectRoot, filePath));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// state:dotted.path == value
|
|
93
|
+
if (check.startsWith('state:')) {
|
|
94
|
+
const expr = check.slice(6).trim();
|
|
95
|
+
const match = expr.match(/^([\w.-]+)\s*==\s*(.+)$/);
|
|
96
|
+
if (!match) return false;
|
|
97
|
+
const [, dottedPath, expected] = match;
|
|
98
|
+
const s = state.read(projectRoot);
|
|
99
|
+
if (!s) return false;
|
|
100
|
+
const actual = dottedPath.split('.').reduce((acc, k) => (acc ? acc[k] : undefined), s.tiers || s);
|
|
101
|
+
return actual === expected || actual === parseValue(expected);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// OR conditions
|
|
105
|
+
if (check.includes(' OR ')) {
|
|
106
|
+
return check.split(' OR ').some(part => evaluateCheck(part.trim(), projectRoot));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// mode-A-greenfield: pass-through hint, treat as satisfiable
|
|
110
|
+
if (check.includes('greenfield') || check.includes('mode-A')) {
|
|
111
|
+
return !fs.existsSync(path.join(projectRoot, '.godpowers'));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// unknown check: assume satisfied to not block legitimate work
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function parseValue(s) {
|
|
119
|
+
s = s.trim();
|
|
120
|
+
if (s === 'true') return true;
|
|
121
|
+
if (s === 'false') return false;
|
|
122
|
+
if (s === 'null') return null;
|
|
123
|
+
if (/^\d+$/.test(s)) return parseInt(s, 10);
|
|
124
|
+
return s;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Get the recommended next command after a successful run.
|
|
129
|
+
* If conditional-next is declared, evaluates each branch's condition
|
|
130
|
+
* against the project; returns the first matching next. Falls back
|
|
131
|
+
* to next-recommended when no condition matches.
|
|
132
|
+
*
|
|
133
|
+
* Conditions evaluated:
|
|
134
|
+
* ui-detected - lib/design-detector.isUiProject(projectRoot).required
|
|
135
|
+
* no-ui-detected - !lib/design-detector.isUiProject(projectRoot).required
|
|
136
|
+
* impeccable-installed - lib/impeccable-bridge.isInstalled()
|
|
137
|
+
* suite-mode - lib/multi-repo-detector.detect().isMultiRepo
|
|
138
|
+
*/
|
|
139
|
+
function getNextCommand(command, opts = {}) {
|
|
140
|
+
const routing = getRouting(command);
|
|
141
|
+
if (!routing) return null;
|
|
142
|
+
const sp = routing['success-path'] || {};
|
|
143
|
+
|
|
144
|
+
// Check conditional-next first
|
|
145
|
+
if (Array.isArray(sp['conditional-next']) && opts.projectRoot) {
|
|
146
|
+
for (const branch of sp['conditional-next']) {
|
|
147
|
+
if (evaluateNextCondition(branch.condition, opts.projectRoot)) {
|
|
148
|
+
return branch.next;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return sp['next-recommended'] || null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Evaluate a routing condition against the project state.
|
|
157
|
+
*/
|
|
158
|
+
function evaluateNextCondition(cond, projectRoot) {
|
|
159
|
+
if (!cond || !projectRoot) return false;
|
|
160
|
+
try {
|
|
161
|
+
if (cond === 'ui-detected') {
|
|
162
|
+
const detector = require('./design-detector');
|
|
163
|
+
return detector.isUiProject(projectRoot).required;
|
|
164
|
+
}
|
|
165
|
+
if (cond === 'no-ui-detected') {
|
|
166
|
+
const detector = require('./design-detector');
|
|
167
|
+
return !detector.isUiProject(projectRoot).required;
|
|
168
|
+
}
|
|
169
|
+
if (cond === 'impeccable-installed') {
|
|
170
|
+
const bridge = require('./impeccable-bridge');
|
|
171
|
+
return bridge.isInstalled(projectRoot);
|
|
172
|
+
}
|
|
173
|
+
if (cond === 'suite-mode') {
|
|
174
|
+
const detector = require('./multi-repo-detector');
|
|
175
|
+
return detector.detect(projectRoot).isMultiRepo;
|
|
176
|
+
}
|
|
177
|
+
} catch (e) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get alternatives with their conditions.
|
|
185
|
+
*/
|
|
186
|
+
function getAlternatives(command) {
|
|
187
|
+
const routing = getRouting(command);
|
|
188
|
+
if (!routing) return [];
|
|
189
|
+
return (routing['success-path'] && routing['success-path'].alternatives) || [];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get standards check requirements for a command.
|
|
194
|
+
*/
|
|
195
|
+
function getStandards(command) {
|
|
196
|
+
const routing = getRouting(command);
|
|
197
|
+
if (!routing || !routing.standards) return null;
|
|
198
|
+
return routing.standards;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Get the list of agents this command spawns (primary + secondary).
|
|
203
|
+
*/
|
|
204
|
+
function getSpawnedAgents(command) {
|
|
205
|
+
const routing = getRouting(command);
|
|
206
|
+
if (!routing || !routing.execution) return [];
|
|
207
|
+
const primary = routing.execution.spawns || [];
|
|
208
|
+
const secondary = routing.execution['secondary-spawns'] || [];
|
|
209
|
+
return [...primary, ...secondary];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* For a given current project state, suggest the next logical command.
|
|
214
|
+
* Uses /god-next routing logic.
|
|
215
|
+
*/
|
|
216
|
+
function suggestNext(projectRoot) {
|
|
217
|
+
const s = state.read(projectRoot);
|
|
218
|
+
if (!s) return { command: '/god-init', reason: 'No project initialized' };
|
|
219
|
+
|
|
220
|
+
const tiers = s.tiers || {};
|
|
221
|
+
|
|
222
|
+
// Tier 1
|
|
223
|
+
if (subStepStatus(tiers, 'tier-1', 'prd') !== 'done')
|
|
224
|
+
return { command: '/god-prd', reason: 'PRD pending', tier: 'tier-1' };
|
|
225
|
+
if (subStepStatus(tiers, 'tier-1', 'arch') !== 'done')
|
|
226
|
+
return { command: '/god-arch', reason: 'Architecture pending (PRD complete)', tier: 'tier-1' };
|
|
227
|
+
if (subStepStatus(tiers, 'tier-1', 'roadmap') !== 'done')
|
|
228
|
+
return { command: '/god-roadmap', reason: 'Roadmap pending', tier: 'tier-1' };
|
|
229
|
+
if (subStepStatus(tiers, 'tier-1', 'stack') !== 'done')
|
|
230
|
+
return { command: '/god-stack', reason: 'Stack pending', tier: 'tier-1' };
|
|
231
|
+
|
|
232
|
+
// Tier 2
|
|
233
|
+
if (subStepStatus(tiers, 'tier-2', 'repo') !== 'done')
|
|
234
|
+
return { command: '/god-repo', reason: 'Repo not scaffolded', tier: 'tier-2' };
|
|
235
|
+
if (subStepStatus(tiers, 'tier-2', 'build') !== 'done')
|
|
236
|
+
return { command: '/god-build', reason: 'Build pending', tier: 'tier-2' };
|
|
237
|
+
|
|
238
|
+
// Tier 3
|
|
239
|
+
if (subStepStatus(tiers, 'tier-3', 'deploy') !== 'done')
|
|
240
|
+
return { command: '/god-deploy', reason: 'Deploy pipeline not set up', tier: 'tier-3' };
|
|
241
|
+
if (subStepStatus(tiers, 'tier-3', 'observe') !== 'done')
|
|
242
|
+
return { command: '/god-observe', reason: 'Observability not wired', tier: 'tier-3' };
|
|
243
|
+
if (subStepStatus(tiers, 'tier-3', 'harden') !== 'done')
|
|
244
|
+
return { command: '/god-harden', reason: 'Security review pending', tier: 'tier-3' };
|
|
245
|
+
if (subStepStatus(tiers, 'tier-3', 'launch') !== 'done')
|
|
246
|
+
return { command: '/god-launch', reason: 'Launch pending', tier: 'tier-3' };
|
|
247
|
+
|
|
248
|
+
// Steady state
|
|
249
|
+
return {
|
|
250
|
+
command: null,
|
|
251
|
+
reason: 'Project in steady state. Use /god-feature, /god-hotfix, /god-hygiene, etc.',
|
|
252
|
+
tier: 'steady-state'
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function subStepStatus(tiers, tierKey, subKey) {
|
|
257
|
+
return tiers[tierKey] && tiers[tierKey][subKey] && tiers[tierKey][subKey].status;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Clear cached routing (for tests).
|
|
262
|
+
*/
|
|
263
|
+
function clearCache() {
|
|
264
|
+
_cache = null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
module.exports = {
|
|
268
|
+
loadAll,
|
|
269
|
+
getRouting,
|
|
270
|
+
checkPrerequisites,
|
|
271
|
+
getNextCommand,
|
|
272
|
+
getAlternatives,
|
|
273
|
+
getStandards,
|
|
274
|
+
getSpawnedAgents,
|
|
275
|
+
suggestNext,
|
|
276
|
+
evaluateCheck,
|
|
277
|
+
clearCache
|
|
278
|
+
};
|