sinapse-ai 1.16.0 → 1.19.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/.claude/hooks/doc-first-gate.cjs +156 -0
- package/.claude/hooks/enforce-story-gate.cjs +6 -2
- package/.claude/rules/documentation-first.md +6 -0
- package/.claude/rules/hook-governance.md +1 -0
- package/.sinapse-ai/constitution.md +3 -3
- package/.sinapse-ai/core/atlas/atlas-data.js +278 -0
- package/.sinapse-ai/core/atlas/flows-pt.js +253 -0
- package/.sinapse-ai/core/atlas/flows.js +266 -0
- package/.sinapse-ai/core/atlas/index.js +62 -0
- package/.sinapse-ai/core/atlas/render-html.js +216 -0
- package/.sinapse-ai/core/atlas/render-markdown.js +313 -0
- package/.sinapse-ai/core/atlas/render-research-card.js +164 -0
- package/.sinapse-ai/core/code-intel/registry-syncer.js +5 -3
- package/.sinapse-ai/core/doctor/checks/agent-memory.js +7 -5
- package/.sinapse-ai/core/doctor/checks/claude-md.js +13 -0
- package/.sinapse-ai/core/doctor/checks/constitution-consistency.js +1 -0
- package/.sinapse-ai/core/doctor/checks/hooks-claude-count.js +11 -0
- package/.sinapse-ai/core/doctor/checks/settings-json.js +16 -2
- package/.sinapse-ai/core/doctor/index.js +27 -0
- package/.sinapse-ai/core/execution/build-orchestrator.js +192 -8
- package/.sinapse-ai/core/external-executors/delegate-cli.js +6 -2
- package/.sinapse-ai/core/health-check/checks/project/constitution-consistency.js +2 -1
- package/.sinapse-ai/core/ideation/ideation-engine.js +10 -8
- package/.sinapse-ai/core/mcp/config-migrator.js +8 -5
- package/.sinapse-ai/core/mcp/global-config-manager.js +4 -1
- package/.sinapse-ai/core/mcp/symlink-manager.js +6 -3
- package/.sinapse-ai/core/orchestration/brownfield-handler.js +5 -4
- package/.sinapse-ai/core/orchestration/build-command.js +136 -0
- package/.sinapse-ai/core/orchestration/doc-first-resolver.js +322 -0
- package/.sinapse-ai/core/orchestration/executors/epic-4-executor.js +3 -0
- package/.sinapse-ai/core/orchestration/gate-evaluator.js +58 -9
- package/.sinapse-ai/core/orchestration/route-command.js +97 -0
- package/.sinapse-ai/core/orchestration/session-state.js +19 -2
- package/.sinapse-ai/core/orchestration/terminal-spawner.js +24 -1
- package/.sinapse-ai/core/orchestration/workflow-executor.js +102 -3
- package/.sinapse-ai/core/quality-gates/focus-area-recommender.js +15 -11
- package/.sinapse-ai/core/registry/build-registry.js +3 -2
- package/.sinapse-ai/core/synapse/scripts/generate-constitution.js +1 -0
- package/.sinapse-ai/core/synapse/utils/atomic-write.js +34 -9
- package/.sinapse-ai/core-config.yaml +5 -1
- package/.sinapse-ai/data/capability-detection.js +3 -3
- package/.sinapse-ai/data/entity-registry.yaml +288 -90
- package/.sinapse-ai/data/mcp-discipline.js +1 -1
- package/.sinapse-ai/data/mcp-tool-examples.yaml +8 -8
- package/.sinapse-ai/data/tok2-validation.js +1 -1
- package/.sinapse-ai/data/tool-registry.yaml +4 -3
- package/.sinapse-ai/development/agents/snps-orqx.md +14 -5
- package/.sinapse-ai/development/scripts/migrate-task-to-v2.js +1 -1
- package/.sinapse-ai/development/scripts/validate-task-v2.js +67 -4
- package/.sinapse-ai/development/tasks/advanced-elicitation.md +3 -3
- package/.sinapse-ai/development/tasks/analyst-facilitate-brainstorming.md +3 -3
- package/.sinapse-ai/development/tasks/analyze-framework.md +1 -8
- package/.sinapse-ai/development/tasks/analyze-performance.md +1 -8
- package/.sinapse-ai/development/tasks/apply-qa-fixes.md +3 -3
- package/.sinapse-ai/development/tasks/architect-analyze-impact.md +3 -3
- package/.sinapse-ai/development/tasks/audit-codebase.md +1 -8
- package/.sinapse-ai/development/tasks/audit-tailwind-config.md +1 -4
- package/.sinapse-ai/development/tasks/audit-utilities.md +1 -8
- package/.sinapse-ai/development/tasks/bootstrap-shadcn-library.md +3 -3
- package/.sinapse-ai/development/tasks/brownfield-create-epic.md +3 -3
- package/.sinapse-ai/development/tasks/brownfield-create-story.md +3 -3
- package/.sinapse-ai/development/tasks/build-component.md +2 -5
- package/.sinapse-ai/development/tasks/calculate-roi.md +3 -3
- package/.sinapse-ai/development/tasks/ci-cd-configuration.md +1 -1
- package/.sinapse-ai/development/tasks/cleanup-utilities.md +3 -3
- package/.sinapse-ai/development/tasks/collaborative-edit.md +3 -3
- package/.sinapse-ai/development/tasks/compose-molecule.md +2 -5
- package/.sinapse-ai/development/tasks/consolidate-patterns.md +3 -3
- package/.sinapse-ai/development/tasks/correct-course.md +3 -3
- package/.sinapse-ai/development/tasks/create-brownfield-story.md +2 -5
- package/.sinapse-ai/development/tasks/create-deep-research-prompt.md +2 -5
- package/.sinapse-ai/development/tasks/create-doc.md +3 -6
- package/.sinapse-ai/development/tasks/create-next-story.md +4 -8
- package/.sinapse-ai/development/tasks/create-suite.md +2 -5
- package/.sinapse-ai/development/tasks/create-task.md +2 -5
- package/.sinapse-ai/development/tasks/create-workflow.md +2 -5
- package/.sinapse-ai/development/tasks/db-analyze-hotpaths.md +1 -8
- package/.sinapse-ai/development/tasks/db-apply-migration.md +1 -8
- package/.sinapse-ai/development/tasks/db-bootstrap.md +1 -8
- package/.sinapse-ai/development/tasks/db-domain-modeling.md +1 -8
- package/.sinapse-ai/development/tasks/db-dry-run.md +1 -8
- package/.sinapse-ai/development/tasks/db-env-check.md +1 -8
- package/.sinapse-ai/development/tasks/db-explain.md +1 -8
- package/.sinapse-ai/development/tasks/db-impersonate.md +1 -8
- package/.sinapse-ai/development/tasks/db-load-csv.md +1 -8
- package/.sinapse-ai/development/tasks/db-policy-apply.md +1 -8
- package/.sinapse-ai/development/tasks/db-rls-audit.md +1 -8
- package/.sinapse-ai/development/tasks/db-rollback.md +1 -8
- package/.sinapse-ai/development/tasks/db-run-sql.md +1 -8
- package/.sinapse-ai/development/tasks/db-schema-audit.md +1 -8
- package/.sinapse-ai/development/tasks/db-seed.md +1 -8
- package/.sinapse-ai/development/tasks/db-smoke-test.md +1 -8
- package/.sinapse-ai/development/tasks/db-snapshot.md +1 -8
- package/.sinapse-ai/development/tasks/db-squad-integration.md +1 -8
- package/.sinapse-ai/development/tasks/db-supabase-setup.md +1 -8
- package/.sinapse-ai/development/tasks/db-verify-order.md +1 -8
- package/.sinapse-ai/development/tasks/deprecate-component.md +3 -3
- package/.sinapse-ai/development/tasks/dev-apply-qa-fixes.md +3 -3
- package/.sinapse-ai/development/tasks/dev-backlog-debt.md +3 -3
- package/.sinapse-ai/development/tasks/dev-develop-story.md +1 -1
- package/.sinapse-ai/development/tasks/dev-improve-code-quality.md +3 -3
- package/.sinapse-ai/development/tasks/dev-optimize-performance.md +3 -3
- package/.sinapse-ai/development/tasks/dev-suggest-refactoring.md +3 -3
- package/.sinapse-ai/development/tasks/dev-validate-next-story.md +3 -3
- package/.sinapse-ai/development/tasks/document-project.md +3 -3
- package/.sinapse-ai/development/tasks/environment-bootstrap.md +0 -4
- package/.sinapse-ai/development/tasks/execute-checklist.md +3 -3
- package/.sinapse-ai/development/tasks/export-design-tokens-dtcg.md +3 -3
- package/.sinapse-ai/development/tasks/extend-pattern.md +1 -8
- package/.sinapse-ai/development/tasks/extract-tokens.md +3 -3
- package/.sinapse-ai/development/tasks/facilitate-brainstorming-session.md +1 -1
- package/.sinapse-ai/development/tasks/generate-ai-frontend-prompt.md +2 -5
- package/.sinapse-ai/development/tasks/generate-documentation.md +2 -5
- package/.sinapse-ai/development/tasks/generate-migration-strategy.md +2 -5
- package/.sinapse-ai/development/tasks/generate-shock-report.md +2 -5
- package/.sinapse-ai/development/tasks/github-devops-github-pr-automation.md +3 -3
- package/.sinapse-ai/development/tasks/github-devops-repository-cleanup.md +3 -3
- package/.sinapse-ai/development/tasks/github-devops-version-management.md +3 -3
- package/.sinapse-ai/development/tasks/improve-self.md +1 -16
- package/.sinapse-ai/development/tasks/index-docs.md +1 -4
- package/.sinapse-ai/development/tasks/init-project-status.md +1 -7
- package/.sinapse-ai/development/tasks/integrate-squad.md +3 -3
- package/.sinapse-ai/development/tasks/kb-mode-interaction.md +3 -3
- package/.sinapse-ai/development/tasks/learn-patterns.md +3 -3
- package/.sinapse-ai/development/tasks/modify-agent.md +1 -8
- package/.sinapse-ai/development/tasks/modify-task.md +1 -8
- package/.sinapse-ai/development/tasks/modify-workflow.md +1 -8
- package/.sinapse-ai/development/tasks/po-backlog-add.md +3 -3
- package/.sinapse-ai/development/tasks/po-manage-story-backlog.md +3 -3
- package/.sinapse-ai/development/tasks/po-pull-story-from-clickup.md +3 -3
- package/.sinapse-ai/development/tasks/po-pull-story.md +3 -3
- package/.sinapse-ai/development/tasks/po-stories-index.md +3 -3
- package/.sinapse-ai/development/tasks/po-sync-story-to-clickup.md +3 -3
- package/.sinapse-ai/development/tasks/po-sync-story.md +3 -3
- package/.sinapse-ai/development/tasks/pr-automation.md +1 -1
- package/.sinapse-ai/development/tasks/propose-modification.md +3 -3
- package/.sinapse-ai/development/tasks/qa-backlog-add-followup.md +1 -8
- package/.sinapse-ai/development/tasks/qa-create-fix-request.md +1 -4
- package/.sinapse-ai/development/tasks/qa-gate.md +1 -8
- package/.sinapse-ai/development/tasks/qa-generate-tests.md +1 -8
- package/.sinapse-ai/development/tasks/qa-nfr-assess.md +1 -8
- package/.sinapse-ai/development/tasks/qa-review-proposal.md +1 -8
- package/.sinapse-ai/development/tasks/qa-review-story.md +1 -8
- package/.sinapse-ai/development/tasks/qa-risk-profile.md +1 -8
- package/.sinapse-ai/development/tasks/qa-run-tests.md +1 -8
- package/.sinapse-ai/development/tasks/qa-test-design.md +1 -8
- package/.sinapse-ai/development/tasks/qa-trace-requirements.md +1 -8
- package/.sinapse-ai/development/tasks/release-management.md +1 -1
- package/.sinapse-ai/development/tasks/security-audit.md +1 -4
- package/.sinapse-ai/development/tasks/security-scan.md +1 -4
- package/.sinapse-ai/development/tasks/setup-database.md +2 -11
- package/.sinapse-ai/development/tasks/setup-design-system.md +2 -11
- package/.sinapse-ai/development/tasks/shard-doc.md +3 -3
- package/.sinapse-ai/development/tasks/sm-create-next-story.md +3 -3
- package/.sinapse-ai/development/tasks/spec-gather-requirements.md +11 -0
- package/.sinapse-ai/development/tasks/sync-documentation.md +1 -6
- package/.sinapse-ai/development/tasks/tailwind-upgrade.md +3 -3
- package/.sinapse-ai/development/tasks/test-as-user.md +3 -3
- package/.sinapse-ai/development/tasks/undo-last.md +2 -5
- package/.sinapse-ai/development/tasks/update-manifest.md +1 -8
- package/.sinapse-ai/development/tasks/ux-create-wireframe.md +1 -1
- package/.sinapse-ai/development/tasks/ux-ds-scan-artifact.md +3 -3
- package/.sinapse-ai/development/tasks/ux-user-research.md +3 -3
- package/.sinapse-ai/development/tasks/validate-next-story.md +1 -8
- package/.sinapse-ai/development/templates/approval-table.md +106 -0
- package/.sinapse-ai/development/templates/chrome-brain/scripts/chrome-ensure.cjs +1 -1
- package/.sinapse-ai/development/workflows/spec-pipeline.yaml +1 -0
- package/.sinapse-ai/git-hooks/post-commit +0 -0
- package/.sinapse-ai/git-hooks/pre-commit +0 -0
- package/.sinapse-ai/git-hooks/pre-push +0 -0
- package/.sinapse-ai/infrastructure/scripts/changelog-generator.js +5 -1
- package/.sinapse-ai/infrastructure/scripts/pattern-extractor.js +11 -2
- package/.sinapse-ai/infrastructure/scripts/test-utilities.js +34 -13
- package/.sinapse-ai/infrastructure/scripts/usage-analytics.js +9 -5
- package/.sinapse-ai/infrastructure/scripts/validate-claude-integration.js +10 -2
- package/.sinapse-ai/install-manifest.yaml +364 -320
- package/.sinapse-ai/lib/build.json +1 -0
- package/.sinapse-ai/product/templates/personalized-task-template-v2.md +4 -2
- package/.sinapse-ai/product/templates/prd-tmpl.yaml +6 -2
- package/.sinapse-ai/product/templates/statusline/statusline-script.js +7 -3
- package/CHANGELOG.md +85 -7
- package/README.en.md +5 -5
- package/README.md +5 -5
- package/bin/cli.js +1 -1
- package/bin/commands/install.js +288 -114
- package/bin/commands/local.js +11 -0
- package/bin/lib/command-generator.js +31 -2
- package/bin/sinapse.js +121 -0
- package/docs/README.md +1 -1
- package/docs/agent-reference-guide.md +1 -1
- package/docs/community/README-community-snippet-core.md +1 -1
- package/docs/community/README-community-snippet-mcp.md +1 -1
- package/docs/community/README-community-snippet-squads.md +1 -1
- package/docs/examples/quickstart-recording.md +1 -1
- package/docs/framework/README.md +1 -1
- package/docs/framework/architecture-overview.md +1 -0
- package/docs/framework/atlas/OPERATING-ATLAS.md +537 -0
- package/docs/framework/atlas/README.md +34 -0
- package/docs/framework/atlas/atlas-data.json +2810 -0
- package/docs/framework/atlas/atlas.html +392 -0
- package/docs/framework/coding-standards.md +1 -1
- package/docs/framework/core-architecture.md +1 -1
- package/docs/framework/guiding-principles.md +1 -1
- package/docs/framework/source-tree.md +1 -1
- package/docs/framework/tech-stack.md +1 -1
- package/docs/framework/versioning-and-releases.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/guides/agent-reference.md +1 -1
- package/docs/guides/agent-selection-guide.md +1 -1
- package/docs/guides/api-reference.md +1 -1
- package/docs/guides/contextual-greeting-system-guide.md +1 -1
- package/docs/guides/contributing-squads.md +1 -1
- package/docs/guides/development-setup.md +1 -1
- package/docs/guides/git-workflow-guide.md +1 -1
- package/docs/guides/installation-troubleshooting.md +1 -1
- package/docs/guides/llm-routing.md +1 -1
- package/docs/guides/mcp-global-setup.md +1 -1
- package/docs/guides/meta-agent-commands.md +1 -1
- package/docs/guides/project-status-feature.md +1 -1
- package/docs/guides/quality-dashboard.md +1 -1
- package/docs/guides/quality-gates.md +1 -1
- package/docs/guides/security-hardening.md +1 -1
- package/docs/guides/service-discovery.md +19 -22
- package/docs/guides/squad-examples/README.md +1 -1
- package/docs/guides/squad-migration.md +1 -1
- package/docs/guides/squads-guide.md +1 -1
- package/docs/guides/squads-overview.md +10 -13
- package/docs/guides/template-engine-v2.md +1 -1
- package/docs/guides/testing-guide.md +1 -1
- package/docs/guides/user-guide.md +30 -26
- package/docs/installation/README.md +3 -3
- package/docs/installation/faq.md +1 -1
- package/docs/installation/linux.md +2 -2
- package/docs/installation/macos.md +1 -1
- package/docs/installation/npx-install.md +1 -1
- package/docs/installation/troubleshooting.md +1 -1
- package/docs/installation/uninstallation.md +1 -1
- package/docs/installation/v4-quick-start.md +1 -1
- package/docs/installation/windows.md +2 -2
- package/docs/pt/CHANGELOG.md +1 -1
- package/docs/pt/DOCUMENTATION-ROADMAP.md +1 -1
- package/docs/pt/ENVIRONMENT.md +1 -1
- package/docs/pt/FEATURE_PROCESS.md +2 -2
- package/docs/pt/GUIDING-PRINCIPLES.md +2 -2
- package/docs/pt/agent-reference-guide.md +3 -3
- package/docs/pt/architecture/ARCHITECTURE-INDEX.md +2 -2
- package/docs/pt/architecture/ade-architecture.md +1 -1
- package/docs/pt/architecture/agent-config-audit.md +1 -1
- package/docs/pt/architecture/agent-responsibility-matrix.md +1 -1
- package/docs/pt/architecture/agent-tool-integration-guide.md +1 -1
- package/docs/pt/architecture/ci-cd.md +1 -1
- package/docs/pt/architecture/coding-standards.md +1 -1
- package/docs/pt/architecture/contribution-workflow-research.md +1 -1
- package/docs/pt/architecture/dashboard-architecture.md +1 -1
- package/docs/pt/architecture/dashboard-realtime.md +1 -1
- package/docs/pt/architecture/hcs-check-specifications.md +1 -1
- package/docs/pt/architecture/hcs-execution-modes.md +1 -1
- package/docs/pt/architecture/hcs-self-healing-spec.md +1 -1
- package/docs/pt/architecture/high-level-architecture.md +1 -1
- package/docs/pt/architecture/introduction.md +1 -1
- package/docs/pt/architecture/mcp-api-keys-management.md +3 -3
- package/docs/pt/architecture/mcp-system-diagrams.md +1 -1
- package/docs/pt/architecture/module-system.md +4 -4
- package/docs/pt/architecture/multi-repo-strategy.md +2 -2
- package/docs/pt/architecture/source-tree.md +1 -1
- package/docs/pt/architecture/squad-improvement-analysis.md +1 -1
- package/docs/pt/architecture/squad-improvement-recommended-approach.md +1 -1
- package/docs/pt/architecture/tech-stack.md +1 -1
- package/docs/pt/architecture/utility-integration-guide.md +1 -1
- package/docs/pt/code-of-conduct.md +1 -1
- package/docs/pt/community/README-community-snippet-core.md +1 -1
- package/docs/pt/community/README-community-snippet-mcp.md +2 -2
- package/docs/pt/contributing.md +7 -7
- package/docs/pt/core-architecture.md +1 -1
- package/docs/pt/docker-mcp-setup.md +1 -1
- package/docs/pt/framework/README.md +1 -1
- package/docs/pt/framework/coding-standards.md +1 -1
- package/docs/pt/framework/source-tree.md +1 -1
- package/docs/pt/framework/tech-stack.md +1 -1
- package/docs/pt/getting-started.md +1 -1
- package/docs/pt/git-workflow-guide.md +1 -1
- package/docs/pt/guides/README.md +3 -3
- package/docs/pt/guides/agent-selection-guide.md +2 -2
- package/docs/pt/guides/api-reference.md +1 -1
- package/docs/pt/guides/contextual-greeting-system-guide.md +1 -1
- package/docs/pt/guides/contributing-squads.md +1 -1
- package/docs/pt/guides/development-setup.md +1 -1
- package/docs/pt/guides/installation-troubleshooting.md +1 -1
- package/docs/pt/guides/llm-routing.md +1 -1
- package/docs/pt/guides/mcp/desktop-commander.md +1 -1
- package/docs/pt/guides/mcp/docker-gateway-tutorial.md +1 -1
- package/docs/pt/guides/mcp-global-setup.md +1 -1
- package/docs/pt/guides/project-status-feature.md +1 -1
- package/docs/pt/guides/quality-dashboard.md +1 -1
- package/docs/pt/guides/quality-gates.md +1 -1
- package/docs/pt/guides/security-hardening.md +2 -2
- package/docs/pt/guides/service-discovery.md +19 -22
- package/docs/pt/guides/squad-examples/README.md +1 -1
- package/docs/pt/guides/squad-migration.md +1 -1
- package/docs/pt/guides/squads-guide.md +1 -1
- package/docs/pt/guides/squads-overview.md +11 -13
- package/docs/pt/guides/template-engine-v2.md +1 -1
- package/docs/pt/guides/testing-guide.md +3 -3
- package/docs/pt/guides/user-guide.md +30 -26
- package/docs/pt/guides/workflows-guide.md +1 -1
- package/docs/pt/how-to-contribute-with-pull-requests.md +1 -1
- package/docs/pt/ide-integration.md +2 -2
- package/docs/pt/installation/README.md +1 -1
- package/docs/pt/installation/faq.md +1 -1
- package/docs/pt/installation/linux.md +1 -1
- package/docs/pt/installation/macos.md +1 -1
- package/docs/pt/installation/troubleshooting.md +1 -1
- package/docs/pt/installation/v4-quick-start.md +1 -1
- package/docs/pt/installation/windows.md +1 -1
- package/docs/pt/meta-agent-commands.md +1 -1
- package/docs/pt/migration-guide.md +1 -1
- package/docs/pt/npx-install.md +1 -1
- package/docs/pt/performance-tuning-guide.md +1 -1
- package/docs/pt/platforms/claude-code.md +2 -2
- package/docs/pt/roadmap.md +2 -2
- package/docs/pt/security-best-practices.md +2 -2
- package/docs/pt/security.md +1 -1
- package/docs/pt/sinapse-nomenclature-specification.md +1 -1
- package/docs/pt/troubleshooting.md +1 -1
- package/docs/pt/uninstallation.md +1 -1
- package/docs/pt/versioning-and-releases.md +1 -1
- package/docs/security/overview.md +1 -1
- package/docs/security/security-best-practices.md +2 -2
- package/docs/sinapse-workflows/README.md +1 -1
- package/package.json +2 -1
- package/packages/installer/package.json +1 -0
- package/packages/installer/src/wizard/feedback.js +18 -2
- package/packages/installer/src/wizard/i18n.js +78 -0
- package/packages/installer/src/wizard/ide-config-generator.js +14 -9
- package/packages/installer/src/wizard/index.js +16 -16
- package/packages/installer/src/wizard/validation/report-generator.js +22 -21
- package/packages/installer/src/wizard/validation/troubleshooting-system.js +19 -13
- package/scripts/gen-agent-badges.js +1 -1
- package/scripts/install-chrome-brain.sh +2 -2
- package/scripts/package-synapse.js +14 -5
- package/scripts/prepare-hooks.js +19 -0
- package/scripts/validate-agent-codenames.js +174 -0
- package/scripts/validate-all.js +1 -0
- package/scripts/validate-no-personal-leaks.js +24 -9
- package/sinapse/agents/sinapse-orqx.md +5 -5
- package/sinapse/agents/snps-orqx.md +5 -5
- package/squads/squad-brand/agents/brand-creative-engineer.md +5 -5
- package/squads/squad-brand/squad.yaml +6 -6
- package/squads/squad-content/agents/content-engineer.md +7 -7
- package/squads/squad-content/squad.yaml +5 -5
- package/squads/squad-copy/knowledge-base/consequence-headline-patterns.md +2 -2
- package/squads/squad-courses/agents/production-director.md +5 -5
- package/squads/squad-courses/squad.yaml +1 -1
- package/docs/guides/hooks-two-layers.md +0 -66
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hook: Doc-First Gate — Constitution Article III (Documentation-First), hard floor
|
|
6
|
+
*
|
|
7
|
+
* Strengthens `enforce-story-gate.cjs`. The story-gate blocks code writes when no
|
|
8
|
+
* Ready story exists — but a single stray Ready story unlocks everything, and it
|
|
9
|
+
* never requires a PRD or an epic. This gate closes that hole for the case that
|
|
10
|
+
* matters most: a BRAND-NEW project being coded with zero planning ("criar um
|
|
11
|
+
* site" → straight to code).
|
|
12
|
+
*
|
|
13
|
+
* Rule (deterministic, reuses doc-first-resolver):
|
|
14
|
+
* Block a code-path Write/Edit when ALL of:
|
|
15
|
+
* - it is NOT the SINAPSE framework's own repo (framework dev is above the
|
|
16
|
+
* story layer — Art. III exception), AND
|
|
17
|
+
* - the project is GREENFIELD (no package.json, no app code yet), AND
|
|
18
|
+
* - the doc-first gate is NOT satisfied (missing PRD / epic / Ready story).
|
|
19
|
+
* Existing projects are deferred to enforce-story-gate (no over-blocking).
|
|
20
|
+
*
|
|
21
|
+
* Escape hatch: set SINAPSE_SKIP_DOCFIRST=1 for a legitimate exception. The gate
|
|
22
|
+
* is never a prison — it makes you conscious, not stuck.
|
|
23
|
+
*
|
|
24
|
+
* Protocol (Claude Code PreToolUse): exit 0 = allow, exit 2 = block.
|
|
25
|
+
* Fail-OPEN: any parse/require/uncertainty error → allow (never blocks on a bug).
|
|
26
|
+
*
|
|
27
|
+
* @module doc-first-gate
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const fs = require('fs');
|
|
31
|
+
const path = require('path');
|
|
32
|
+
|
|
33
|
+
/** Paths that require doc-first before code changes (mirror enforce-story-gate). */
|
|
34
|
+
const CODE_PATHS = [
|
|
35
|
+
'packages/', 'src/', 'app/', 'lib/', 'bin/',
|
|
36
|
+
'components/', 'pages/', 'api/', 'services/',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/** Paths always exempt. */
|
|
40
|
+
const EXEMPT_PATHS = [
|
|
41
|
+
'.claude/', '.sinapse-ai/', '.sinapse/', '.sinapse-custom/',
|
|
42
|
+
'docs/', 'tests/', '__tests__/', 'test/',
|
|
43
|
+
'node_modules/', '.git/', 'squads/', 'outputs/',
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
/** Config files always exempt (scaffolding a project is allowed pre-docs). */
|
|
47
|
+
const EXEMPT_FILES = [
|
|
48
|
+
'package.json', 'package-lock.json', 'tsconfig.json',
|
|
49
|
+
'.env', '.env.local', '.env.example',
|
|
50
|
+
'.gitignore', '.eslintrc', '.prettierrc',
|
|
51
|
+
'README.md', 'CHANGELOG.md',
|
|
52
|
+
'jest.config.js', 'jest.config.ts',
|
|
53
|
+
'vite.config.ts', 'next.config.js', 'next.config.mjs',
|
|
54
|
+
'tailwind.config.js', 'tailwind.config.ts',
|
|
55
|
+
'postcss.config.js', 'postcss.config.cjs',
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
function projectRoot() {
|
|
59
|
+
return process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function relativize(filePath, root) {
|
|
63
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
64
|
+
const normalizedRoot = root.replace(/\\/g, '/');
|
|
65
|
+
if (normalized.startsWith(normalizedRoot)) {
|
|
66
|
+
return normalized.slice(normalizedRoot.length).replace(/^\/+/, '');
|
|
67
|
+
}
|
|
68
|
+
return normalized;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function isExempt(rel) {
|
|
72
|
+
if (EXEMPT_FILES.includes(path.basename(rel))) return true;
|
|
73
|
+
return EXEMPT_PATHS.some((ep) => rel.startsWith(ep));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function isCodePath(rel) {
|
|
77
|
+
return CODE_PATHS.some((cp) => rel.startsWith(cp));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function main() {
|
|
81
|
+
// Escape hatch — explicit, honest, never a prison.
|
|
82
|
+
if (process.env.SINAPSE_SKIP_DOCFIRST) process.exit(0);
|
|
83
|
+
|
|
84
|
+
let input;
|
|
85
|
+
try {
|
|
86
|
+
input = JSON.parse(fs.readFileSync(0, 'utf8'));
|
|
87
|
+
} catch {
|
|
88
|
+
process.exit(0); // fail-open
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const toolName = input.tool_name || '';
|
|
92
|
+
if (toolName !== 'Write' && toolName !== 'Edit' && toolName !== 'MultiEdit') {
|
|
93
|
+
process.exit(0);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const filePath = (input.tool_input || {}).file_path || '';
|
|
97
|
+
if (!filePath) process.exit(0);
|
|
98
|
+
|
|
99
|
+
const root = projectRoot();
|
|
100
|
+
const rel = relativize(filePath, root);
|
|
101
|
+
|
|
102
|
+
if (isExempt(rel)) process.exit(0);
|
|
103
|
+
if (!isCodePath(rel)) process.exit(0);
|
|
104
|
+
|
|
105
|
+
// Load the shared resolver (single source of truth with `sinapse route`).
|
|
106
|
+
// Try the project's installed copy first; fall back to the copy next to this
|
|
107
|
+
// hook (same path in a real install — `.claude/hooks` and `.sinapse-ai` are
|
|
108
|
+
// siblings — but lets the gate work when the project root is being created).
|
|
109
|
+
let resolveDocFirstState;
|
|
110
|
+
const resolverCandidates = [
|
|
111
|
+
path.join(root, '.sinapse-ai', 'core', 'orchestration', 'doc-first-resolver.js'),
|
|
112
|
+
path.join(__dirname, '..', '..', '.sinapse-ai', 'core', 'orchestration', 'doc-first-resolver.js'),
|
|
113
|
+
];
|
|
114
|
+
for (const candidate of resolverCandidates) {
|
|
115
|
+
try {
|
|
116
|
+
({ resolveDocFirstState } = require(candidate));
|
|
117
|
+
break;
|
|
118
|
+
} catch {
|
|
119
|
+
// try next candidate
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (typeof resolveDocFirstState !== 'function') {
|
|
123
|
+
process.exit(0); // resolver not installed / unreadable → fail-open
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let state;
|
|
127
|
+
try {
|
|
128
|
+
state = resolveDocFirstState({ projectRoot: root });
|
|
129
|
+
} catch {
|
|
130
|
+
process.exit(0); // fail-open
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Framework's own repo: development is above the story layer (Art. III exception).
|
|
134
|
+
if (state.maturity && state.maturity.isFrameworkRepo) process.exit(0);
|
|
135
|
+
|
|
136
|
+
// Gate already satisfied → allow.
|
|
137
|
+
if (state.gate && state.gate.satisfied) process.exit(0);
|
|
138
|
+
|
|
139
|
+
// Existing project (has code) → defer to enforce-story-gate; don't over-block.
|
|
140
|
+
if (!state.maturity || !state.maturity.isGreenfield) process.exit(0);
|
|
141
|
+
|
|
142
|
+
// Greenfield + unsatisfied gate → BLOCK.
|
|
143
|
+
const missing = (state.gate && state.gate.missing) || ['PRD', 'epic', 'story'];
|
|
144
|
+
process.stderr.write(
|
|
145
|
+
'\nDOCUMENTATION-FIRST BLOCK (Constitution Article III) — new project\n' +
|
|
146
|
+
`File: ${rel}\n` +
|
|
147
|
+
`Missing before any code: ${missing.join(', ')}.\n` +
|
|
148
|
+
'A brand-new project must have its planning documents first:\n' +
|
|
149
|
+
` • run the ${state.workflow || 'greenfield'} flow → project brief → PRD → epic → stories\n` +
|
|
150
|
+
' • see exactly what is missing: sinapse route "<what you are building>"\n' +
|
|
151
|
+
'Legitimate exception (rare): set SINAPSE_SKIP_DOCFIRST=1.\n',
|
|
152
|
+
);
|
|
153
|
+
process.exit(2);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
main();
|
|
@@ -109,8 +109,12 @@ function hasActiveStory(root) {
|
|
|
109
109
|
for (const file of files) {
|
|
110
110
|
try {
|
|
111
111
|
const content = fs.readFileSync(file, 'utf8');
|
|
112
|
-
// Look for status field in YAML frontmatter or markdown
|
|
113
|
-
|
|
112
|
+
// Look for status field in YAML frontmatter or markdown.
|
|
113
|
+
// Bounded capture (non-greedy + line-anchored): a greedy `[\w\s]*` used
|
|
114
|
+
// to cross the newline and swallow the next frontmatter key (e.g.
|
|
115
|
+
// `status: Ready\ntype: fix` → "readytypefix"), wrongly rejecting valid
|
|
116
|
+
// unquoted stories. Aligned with doc-first-resolver's matcher.
|
|
117
|
+
const statusMatch = content.match(/status:\s*["']?([A-Za-z][A-Za-z ]*?)["']?\s*(?:\r?\n|$)/i);
|
|
114
118
|
if (statusMatch) {
|
|
115
119
|
const status = statusMatch[1].toLowerCase().replace(/[\s_-]+/g, '');
|
|
116
120
|
if (VALID_STATUSES.some((vs) => vs.replace(/[\s_-]+/g, '') === status)) {
|
|
@@ -44,6 +44,12 @@ No implementation proceeds without ALL of these:
|
|
|
44
44
|
|
|
45
45
|
**Attempting to write code without a valid story → BLOCKED.**
|
|
46
46
|
|
|
47
|
+
## Enforcement model — floor-reactive by design (honest)
|
|
48
|
+
|
|
49
|
+
Doc-first is enforced by a **deterministic reactive floor**, not by proactive prose: on a build request, `sinapse route` classifies the project type and **blocks** when the required artifacts are missing (story `Ready`; epic/PRD/architecture for large projects). This floor holds even if the agent forgets the rule, and it is covered by passing tests.
|
|
50
|
+
|
|
51
|
+
Audit AF-20260629 **refuted** the earlier "prose without enforcement" hypothesis — the floor genuinely classifies and blocks. What is *not* wired into the prompt is the proactive **layer-2 conduction** (auto-walking the user through PRD → epic → story turn by turn). That layer is intentional **roadmap**, not a missing guardrail: no new always-on hook is added here by design (a reactive floor is lower-risk than a proactive prompt injector).
|
|
52
|
+
|
|
47
53
|
## Project Type Gate (NON-NEGOTIABLE)
|
|
48
54
|
|
|
49
55
|
> **Why this exists:** A bare `epic + story` pipeline is necessary but not sufficient for **large projects**. A site, landing page, SaaS platform, mobile app, or backend service needs *upstream* artifacts (project brief, PRD, architecture, design spec) **before** stories can be written meaningfully. Without this gate, the framework writes stories from a vague verbal description and produces generic / off-brand output.
|
|
@@ -25,6 +25,7 @@ paths:
|
|
|
25
25
|
| `enforce-architecture-first.cjs` | Art. III — Docs before protected code | BLOCK (exit 2) |
|
|
26
26
|
| `write-path-validation.cjs` | Convention — Warn wrong doc paths | WARN (exit 0) |
|
|
27
27
|
| `enforce-story-gate.cjs` | Art. III — Story required for code | BLOCK (exit 2) |
|
|
28
|
+
| `doc-first-gate.cjs` | Art. III — New projects need PRD + epic + story before code (greenfield only; framework repo & existing projects exempt; `SINAPSE_SKIP_DOCFIRST=1` override) | BLOCK (exit 2) |
|
|
28
29
|
| `enforce-nsn-guard.cjs` | NSN Mode — Warn on "open dashboard / follow steps manually" anti-patterns in .md/.mdx/.txt | WARN (exit 0) |
|
|
29
30
|
| `slug-validation.py` | Convention — Validate naming | WARN (exit 0) |
|
|
30
31
|
| `mind-clone-governance.py` | Cloning — DNA required | BLOCK (exit 2) |
|
|
@@ -115,7 +115,7 @@ Qualidade não é negociável. Todo código passa por múltiplos gates antes de
|
|
|
115
115
|
- MUST: Story status é "Done" ou "Ready for Review"
|
|
116
116
|
- SHOULD: Cobertura de testes não diminui
|
|
117
117
|
|
|
118
|
-
**Gate:**
|
|
118
|
+
**Gate:** `.sinapse-ai/git-hooks/pre-push` - BLOCK se qualquer check falhar (executa `npm run validate:all`, fail-closed)
|
|
119
119
|
|
|
120
120
|
---
|
|
121
121
|
|
|
@@ -155,7 +155,7 @@ Métricas do ecossistema (contagem de squads, agentes, tasks, orqx) DEVEM ser es
|
|
|
155
155
|
- **18 comandos orqx** (17 squad orqx + 1 master sinapse-orqx)
|
|
156
156
|
- **1200 tasks** (em `squads/*/tasks/`)
|
|
157
157
|
|
|
158
|
-
*Last synced: 2026-06-
|
|
158
|
+
*Last synced: 2026-06-25T17:24:32.697Z*
|
|
159
159
|
<!-- END AUTO-GENERATED COUNTS -->
|
|
160
160
|
|
|
161
161
|
|
|
@@ -389,5 +389,5 @@ Resultado: nada foi fundido. Dual register preservado. Article XI formalizado pr
|
|
|
389
389
|
|
|
390
390
|
---
|
|
391
391
|
|
|
392
|
-
*SINAPSE Constitution
|
|
392
|
+
*SINAPSE Constitution v2.2.0*
|
|
393
393
|
*CLI First | Agent-Driven | Quality First*
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atlas Data — the single source of truth for the Framework Operating Atlas.
|
|
3
|
+
*
|
|
4
|
+
* Scans the repository ONCE and returns a structured object describing how the
|
|
5
|
+
* SINAPSE framework is composed: workflows, agents, squads, orchestrators,
|
|
6
|
+
* constitutional articles, and non-negotiable rules. Both renderings — the
|
|
7
|
+
* LLM-readable markdown atlas and the visual HTML dashboard — consume this same
|
|
8
|
+
* object, so they can never drift from each other or from the repo.
|
|
9
|
+
*
|
|
10
|
+
* Pure of side effects except filesystem reads. Defensive per-file (a malformed
|
|
11
|
+
* file is skipped, never throws). Counts are derived from disk, so the atlas is
|
|
12
|
+
* always accurate (Constitution Article VII — Ecosystem Metrics Accuracy).
|
|
13
|
+
*
|
|
14
|
+
* @module core/atlas/atlas-data
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const path = require('path');
|
|
21
|
+
|
|
22
|
+
let yaml;
|
|
23
|
+
try {
|
|
24
|
+
yaml = require('js-yaml');
|
|
25
|
+
} catch {
|
|
26
|
+
yaml = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { FRAMEWORK_FLOWS } = require('./flows');
|
|
30
|
+
|
|
31
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
32
|
+
// Low-level fs helpers (defensive)
|
|
33
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
function readText(file) {
|
|
36
|
+
try {
|
|
37
|
+
return fs.readFileSync(file, 'utf8');
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function listDir(dir, kind /* 'file' | 'dir' | undefined */) {
|
|
44
|
+
try {
|
|
45
|
+
return fs
|
|
46
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
47
|
+
.filter((e) => (kind === 'file' ? e.isFile() : kind === 'dir' ? e.isDirectory() : true))
|
|
48
|
+
.map((e) => e.name);
|
|
49
|
+
} catch {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function firstMatch(content, re) {
|
|
55
|
+
const m = content.match(re);
|
|
56
|
+
return m ? m[1].trim() : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function truncate(s, n = 160) {
|
|
60
|
+
if (!s) return '';
|
|
61
|
+
const flat = String(s).replace(/\s+/g, ' ').trim();
|
|
62
|
+
return flat.length > n ? `${flat.slice(0, n - 1)}…` : flat;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
66
|
+
// Workflows
|
|
67
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
function parseWorkflow(file, source) {
|
|
70
|
+
const content = readText(file);
|
|
71
|
+
const base = path.basename(file).replace(/\.ya?ml$/i, '');
|
|
72
|
+
const entry = { id: base, name: base, description: '', type: '', source, file: relFromRoot(file) };
|
|
73
|
+
if (!content) return entry;
|
|
74
|
+
|
|
75
|
+
if (yaml) {
|
|
76
|
+
try {
|
|
77
|
+
const doc = yaml.load(content) || {};
|
|
78
|
+
const wf = doc.workflow || doc;
|
|
79
|
+
if (wf && typeof wf === 'object') {
|
|
80
|
+
entry.id = String(wf.id || base);
|
|
81
|
+
entry.name = String(wf.name || wf.id || base);
|
|
82
|
+
entry.description = truncate(wf.description || '');
|
|
83
|
+
entry.type = String(wf.type || '');
|
|
84
|
+
}
|
|
85
|
+
return entry;
|
|
86
|
+
} catch {
|
|
87
|
+
// fall through to regex
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
entry.id = firstMatch(content, /^\s*id:\s*["']?([^"'\n]+)/m) || base;
|
|
91
|
+
entry.name = firstMatch(content, /^\s*name:\s*["']?([^"'\n]+)/m) || entry.id;
|
|
92
|
+
entry.description = truncate(firstMatch(content, /^\s*description:\s*["']?([^\n]+)/m) || '');
|
|
93
|
+
return entry;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function collectWorkflows(root) {
|
|
97
|
+
const out = [];
|
|
98
|
+
const fwDir = path.join(root, '.sinapse-ai', 'development', 'workflows');
|
|
99
|
+
for (const f of listDir(fwDir, 'file').filter((n) => /\.ya?ml$/i.test(n))) {
|
|
100
|
+
out.push(parseWorkflow(path.join(fwDir, f), 'framework'));
|
|
101
|
+
}
|
|
102
|
+
const squadsDir = path.join(root, 'squads');
|
|
103
|
+
for (const squad of listDir(squadsDir, 'dir')) {
|
|
104
|
+
const wfDir = path.join(squadsDir, squad, 'workflows');
|
|
105
|
+
for (const f of listDir(wfDir, 'file').filter((n) => /\.ya?ml$/i.test(n))) {
|
|
106
|
+
const wf = parseWorkflow(path.join(wfDir, f), `squad:${squad}`);
|
|
107
|
+
wf.squad = squad;
|
|
108
|
+
out.push(wf);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
115
|
+
// Agents
|
|
116
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
117
|
+
|
|
118
|
+
function parseAgent(file, squad) {
|
|
119
|
+
const content = readText(file) || '';
|
|
120
|
+
const base = path.basename(file).replace(/\.md$/i, '');
|
|
121
|
+
|
|
122
|
+
// Agent files come in two shapes: a YAML block (agent:/persona:) and a
|
|
123
|
+
// markdown-prose card (# Agent: Name — Title, "- **ID:** ...", "- **Nome:** ...").
|
|
124
|
+
// Parse both so the atlas covers every agent.
|
|
125
|
+
const headingTitle = firstMatch(content, /^#\s*Agent:\s*[^\n—–-]+[—–-]\s*([^\n]+)/m);
|
|
126
|
+
|
|
127
|
+
const id =
|
|
128
|
+
firstMatch(content, /^\s*id:\s*["']?([A-Za-z0-9_-]+)/m) ||
|
|
129
|
+
firstMatch(content, /\*\*ID:\*\*\s*([A-Za-z0-9_-]+)/i) ||
|
|
130
|
+
base;
|
|
131
|
+
const title =
|
|
132
|
+
firstMatch(content, /^\s*title:\s*["']?([^\n"']+)/m) || headingTitle || '';
|
|
133
|
+
const role =
|
|
134
|
+
firstMatch(content, /^\s*role:\s*["']?([^\n"']+)/m) || headingTitle || '';
|
|
135
|
+
const persona =
|
|
136
|
+
firstMatch(content, /^\s*name:\s*["']?([^\n"']+)/m) ||
|
|
137
|
+
firstMatch(content, /\*\*Nome:\*\*\s*([^\n]+)/i) ||
|
|
138
|
+
'';
|
|
139
|
+
// Match the canonical counter: an orchestrator is an agent whose id/file ends
|
|
140
|
+
// in `-orqx` (the 17 squad orqx + the master). Chief/triage agents that say
|
|
141
|
+
// "Orchestrator" in their title are NOT counted (they are not -orqx files).
|
|
142
|
+
const isOrqx = /-orqx$/.test(id) || /-orqx$/.test(base);
|
|
143
|
+
return {
|
|
144
|
+
id,
|
|
145
|
+
persona: persona.trim(),
|
|
146
|
+
title: truncate(title, 80),
|
|
147
|
+
role: truncate(role, 110),
|
|
148
|
+
squad: squad || 'framework',
|
|
149
|
+
isOrqx,
|
|
150
|
+
file: relFromRoot(file),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function collectAgents(root) {
|
|
155
|
+
const out = [];
|
|
156
|
+
const fwDir = path.join(root, '.sinapse-ai', 'development', 'agents');
|
|
157
|
+
for (const f of listDir(fwDir, 'file').filter((n) => n.endsWith('.md') && !n.includes('.backup') && !n.startsWith('test-'))) {
|
|
158
|
+
out.push(parseAgent(path.join(fwDir, f), 'framework'));
|
|
159
|
+
}
|
|
160
|
+
const squadsDir = path.join(root, 'squads');
|
|
161
|
+
for (const squad of listDir(squadsDir, 'dir')) {
|
|
162
|
+
const aDir = path.join(squadsDir, squad, 'agents');
|
|
163
|
+
for (const f of listDir(aDir, 'file').filter((n) => n.endsWith('.md') && !n.includes('.backup') && !n.startsWith('test-'))) {
|
|
164
|
+
out.push(parseAgent(path.join(aDir, f), squad));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
171
|
+
// Squads, Articles, Rules
|
|
172
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
173
|
+
|
|
174
|
+
function collectSquads(root, agents, workflows) {
|
|
175
|
+
const squadsDir = path.join(root, 'squads');
|
|
176
|
+
return listDir(squadsDir, 'dir').map((squad) => {
|
|
177
|
+
const readme = readText(path.join(squadsDir, squad, 'README.md')) || '';
|
|
178
|
+
const heading = firstMatch(readme, /^#\s+(.+)$/m) || squad;
|
|
179
|
+
return {
|
|
180
|
+
id: squad,
|
|
181
|
+
name: heading.trim(),
|
|
182
|
+
agents: agents.filter((a) => a.squad === squad).length,
|
|
183
|
+
workflows: workflows.filter((w) => w.squad === squad).length,
|
|
184
|
+
orqx: agents.filter((a) => a.squad === squad && a.isOrqx).map((a) => a.id),
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function collectArticles(root) {
|
|
190
|
+
const content = readText(path.join(root, '.sinapse-ai', 'constitution.md'));
|
|
191
|
+
if (!content) return [];
|
|
192
|
+
const out = [];
|
|
193
|
+
// Articles are headings like "### III. Documentation-First Development (NON-NEGOTIABLE)"
|
|
194
|
+
// The roman numeral followed by "." distinguishes articles from other headings
|
|
195
|
+
// (e.g. "### Amendment Process").
|
|
196
|
+
const re = /^#{2,4}\s+([IVXLC]+)\.\s+([^\n(]+?)\s*(?:\(([^)]+)\))?\s*$/gim;
|
|
197
|
+
let m;
|
|
198
|
+
while ((m = re.exec(content)) !== null) {
|
|
199
|
+
out.push({
|
|
200
|
+
number: m[1].trim(),
|
|
201
|
+
title: m[2].trim(),
|
|
202
|
+
severity: (m[3] || '').trim() || 'MUST',
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function collectRules(root) {
|
|
209
|
+
const dir = path.join(root, '.claude', 'rules');
|
|
210
|
+
return listDir(dir, 'file')
|
|
211
|
+
.filter((n) => n.endsWith('.md'))
|
|
212
|
+
.map((n) => {
|
|
213
|
+
const content = readText(path.join(dir, n)) || '';
|
|
214
|
+
const heading = firstMatch(content, /^#\s+(.+)$/m) || n.replace(/\.md$/, '');
|
|
215
|
+
return { id: n.replace(/\.md$/, ''), title: truncate(heading.replace(/\s*\(.*$/, ''), 90) };
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
220
|
+
// Root helper
|
|
221
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
222
|
+
|
|
223
|
+
let ROOT = process.cwd();
|
|
224
|
+
function relFromRoot(file) {
|
|
225
|
+
return path.relative(ROOT, file).replace(/\\/g, '/');
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
229
|
+
// Public API
|
|
230
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Build the full atlas data object from the repository.
|
|
234
|
+
* @param {object} [opts]
|
|
235
|
+
* @param {string} [opts.root=process.cwd()] - Repo root.
|
|
236
|
+
* @param {string} [opts.generatedAt] - ISO timestamp to stamp (pass in; the
|
|
237
|
+
* module never calls Date.now itself so output stays deterministic for tests).
|
|
238
|
+
* @returns {object} Structured atlas data.
|
|
239
|
+
*/
|
|
240
|
+
function buildAtlasData(opts = {}) {
|
|
241
|
+
ROOT = opts.root || process.cwd();
|
|
242
|
+
|
|
243
|
+
const workflows = collectWorkflows(ROOT);
|
|
244
|
+
const agents = collectAgents(ROOT);
|
|
245
|
+
const squads = collectSquads(ROOT, agents, workflows);
|
|
246
|
+
const articles = collectArticles(ROOT);
|
|
247
|
+
const rules = collectRules(ROOT);
|
|
248
|
+
|
|
249
|
+
const frameworkAgents = agents.filter((a) => a.squad === 'framework');
|
|
250
|
+
const squadAgents = agents.filter((a) => a.squad !== 'framework');
|
|
251
|
+
const orqx = agents.filter((a) => a.isOrqx);
|
|
252
|
+
|
|
253
|
+
const counts = {
|
|
254
|
+
squads: squads.length,
|
|
255
|
+
agentsTotal: agents.length,
|
|
256
|
+
frameworkAgents: frameworkAgents.length,
|
|
257
|
+
squadAgents: squadAgents.length,
|
|
258
|
+
orqx: orqx.length,
|
|
259
|
+
workflowsTotal: workflows.length,
|
|
260
|
+
frameworkWorkflows: workflows.filter((w) => w.source === 'framework').length,
|
|
261
|
+
squadWorkflows: workflows.filter((w) => w.source !== 'framework').length,
|
|
262
|
+
articles: articles.length,
|
|
263
|
+
rules: rules.length,
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
return {
|
|
267
|
+
generatedAt: opts.generatedAt || null,
|
|
268
|
+
counts,
|
|
269
|
+
flows: FRAMEWORK_FLOWS,
|
|
270
|
+
workflows,
|
|
271
|
+
agents,
|
|
272
|
+
squads,
|
|
273
|
+
articles,
|
|
274
|
+
rules,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
module.exports = { buildAtlasData };
|