@accelerationguy/accel 1.0.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.md +19 -0
- package/LICENSE +33 -0
- package/README.md +275 -0
- package/bin/install.js +661 -0
- package/docs/getting-started.md +164 -0
- package/docs/module-guide.md +139 -0
- package/modules/drive/LICENSE +21 -0
- package/modules/drive/PAUL-VS-GSD.md +171 -0
- package/modules/drive/README.md +555 -0
- package/modules/drive/assets/terminal.svg +67 -0
- package/modules/drive/bin/install.js +210 -0
- package/modules/drive/integration.js +76 -0
- package/modules/drive/package.json +38 -0
- package/modules/drive/src/commands/add-phase.md +36 -0
- package/modules/drive/src/commands/apply.md +83 -0
- package/modules/drive/src/commands/assumptions.md +37 -0
- package/modules/drive/src/commands/audit.md +57 -0
- package/modules/drive/src/commands/complete-milestone.md +36 -0
- package/modules/drive/src/commands/config.md +175 -0
- package/modules/drive/src/commands/consider-issues.md +41 -0
- package/modules/drive/src/commands/discover.md +48 -0
- package/modules/drive/src/commands/discuss-milestone.md +33 -0
- package/modules/drive/src/commands/discuss.md +34 -0
- package/modules/drive/src/commands/flows.md +73 -0
- package/modules/drive/src/commands/handoff.md +201 -0
- package/modules/drive/src/commands/help.md +525 -0
- package/modules/drive/src/commands/init.md +54 -0
- package/modules/drive/src/commands/map-codebase.md +34 -0
- package/modules/drive/src/commands/milestone.md +34 -0
- package/modules/drive/src/commands/pause.md +44 -0
- package/modules/drive/src/commands/plan-fix.md +216 -0
- package/modules/drive/src/commands/plan.md +36 -0
- package/modules/drive/src/commands/progress.md +138 -0
- package/modules/drive/src/commands/register.md +29 -0
- package/modules/drive/src/commands/remove-phase.md +37 -0
- package/modules/drive/src/commands/research-phase.md +209 -0
- package/modules/drive/src/commands/research.md +47 -0
- package/modules/drive/src/commands/resume.md +49 -0
- package/modules/drive/src/commands/status.md +78 -0
- package/modules/drive/src/commands/unify.md +87 -0
- package/modules/drive/src/commands/verify.md +60 -0
- package/modules/drive/src/references/checkpoints.md +234 -0
- package/modules/drive/src/references/context-management.md +219 -0
- package/modules/drive/src/references/git-strategy.md +206 -0
- package/modules/drive/src/references/loop-phases.md +254 -0
- package/modules/drive/src/references/plan-format.md +263 -0
- package/modules/drive/src/references/quality-principles.md +152 -0
- package/modules/drive/src/references/research-quality-control.md +247 -0
- package/modules/drive/src/references/sonarqube-integration.md +244 -0
- package/modules/drive/src/references/specialized-workflow-integration.md +186 -0
- package/modules/drive/src/references/subagent-criteria.md +179 -0
- package/modules/drive/src/references/tdd.md +219 -0
- package/modules/drive/src/references/work-units.md +161 -0
- package/modules/drive/src/rules/commands.md +108 -0
- package/modules/drive/src/rules/references.md +107 -0
- package/modules/drive/src/rules/style.md +123 -0
- package/modules/drive/src/rules/templates.md +51 -0
- package/modules/drive/src/rules/workflows.md +133 -0
- package/modules/drive/src/templates/CONTEXT.md +88 -0
- package/modules/drive/src/templates/DEBUG.md +164 -0
- package/modules/drive/src/templates/DISCOVERY.md +148 -0
- package/modules/drive/src/templates/HANDOFF.md +77 -0
- package/modules/drive/src/templates/ISSUES.md +93 -0
- package/modules/drive/src/templates/MILESTONES.md +167 -0
- package/modules/drive/src/templates/PLAN.md +328 -0
- package/modules/drive/src/templates/PROJECT.md +219 -0
- package/modules/drive/src/templates/RESEARCH.md +130 -0
- package/modules/drive/src/templates/ROADMAP.md +328 -0
- package/modules/drive/src/templates/SPECIAL-FLOWS.md +70 -0
- package/modules/drive/src/templates/STATE.md +210 -0
- package/modules/drive/src/templates/SUMMARY.md +221 -0
- package/modules/drive/src/templates/UAT-ISSUES.md +139 -0
- package/modules/drive/src/templates/codebase/architecture.md +259 -0
- package/modules/drive/src/templates/codebase/concerns.md +329 -0
- package/modules/drive/src/templates/codebase/conventions.md +311 -0
- package/modules/drive/src/templates/codebase/integrations.md +284 -0
- package/modules/drive/src/templates/codebase/stack.md +190 -0
- package/modules/drive/src/templates/codebase/structure.md +287 -0
- package/modules/drive/src/templates/codebase/testing.md +484 -0
- package/modules/drive/src/templates/config.md +181 -0
- package/modules/drive/src/templates/milestone-archive.md +236 -0
- package/modules/drive/src/templates/milestone-context.md +190 -0
- package/modules/drive/src/templates/paul-json.md +147 -0
- package/modules/drive/src/vector-config/PAUL +26 -0
- package/modules/drive/src/vector-config/PAUL.manifest +11 -0
- package/modules/drive/src/workflows/apply-phase.md +393 -0
- package/modules/drive/src/workflows/audit-plan.md +344 -0
- package/modules/drive/src/workflows/complete-milestone.md +479 -0
- package/modules/drive/src/workflows/configure-special-flows.md +283 -0
- package/modules/drive/src/workflows/consider-issues.md +172 -0
- package/modules/drive/src/workflows/create-milestone.md +268 -0
- package/modules/drive/src/workflows/debug.md +292 -0
- package/modules/drive/src/workflows/discovery.md +187 -0
- package/modules/drive/src/workflows/discuss-milestone.md +245 -0
- package/modules/drive/src/workflows/discuss-phase.md +231 -0
- package/modules/drive/src/workflows/init-project.md +698 -0
- package/modules/drive/src/workflows/map-codebase.md +459 -0
- package/modules/drive/src/workflows/pause-work.md +259 -0
- package/modules/drive/src/workflows/phase-assumptions.md +181 -0
- package/modules/drive/src/workflows/plan-phase.md +385 -0
- package/modules/drive/src/workflows/quality-gate.md +263 -0
- package/modules/drive/src/workflows/register-manifest.md +107 -0
- package/modules/drive/src/workflows/research.md +241 -0
- package/modules/drive/src/workflows/resume-project.md +200 -0
- package/modules/drive/src/workflows/roadmap-management.md +334 -0
- package/modules/drive/src/workflows/transition-phase.md +368 -0
- package/modules/drive/src/workflows/unify-phase.md +290 -0
- package/modules/drive/src/workflows/verify-work.md +241 -0
- package/modules/forge/README.md +281 -0
- package/modules/forge/bin/install.js +200 -0
- package/modules/forge/package.json +32 -0
- package/modules/forge/skillsmith/rules/checklists-rules.md +42 -0
- package/modules/forge/skillsmith/rules/context-rules.md +43 -0
- package/modules/forge/skillsmith/rules/entry-point-rules.md +44 -0
- package/modules/forge/skillsmith/rules/frameworks-rules.md +43 -0
- package/modules/forge/skillsmith/rules/tasks-rules.md +52 -0
- package/modules/forge/skillsmith/rules/templates-rules.md +43 -0
- package/modules/forge/skillsmith/skillsmith.md +82 -0
- package/modules/forge/skillsmith/tasks/audit.md +277 -0
- package/modules/forge/skillsmith/tasks/discover.md +145 -0
- package/modules/forge/skillsmith/tasks/distill.md +276 -0
- package/modules/forge/skillsmith/tasks/scaffold.md +349 -0
- package/modules/forge/specs/checklists.md +193 -0
- package/modules/forge/specs/context.md +223 -0
- package/modules/forge/specs/entry-point.md +320 -0
- package/modules/forge/specs/frameworks.md +228 -0
- package/modules/forge/specs/rules.md +245 -0
- package/modules/forge/specs/tasks.md +344 -0
- package/modules/forge/specs/templates.md +335 -0
- package/modules/forge/terminal.svg +70 -0
- package/modules/ignition/README.md +245 -0
- package/modules/ignition/bin/install.js +184 -0
- package/modules/ignition/checklists/planning-quality.md +55 -0
- package/modules/ignition/data/application/config.md +21 -0
- package/modules/ignition/data/application/guide.md +51 -0
- package/modules/ignition/data/application/skill-loadout.md +11 -0
- package/modules/ignition/data/campaign/config.md +18 -0
- package/modules/ignition/data/campaign/guide.md +36 -0
- package/modules/ignition/data/campaign/skill-loadout.md +10 -0
- package/modules/ignition/data/client/config.md +18 -0
- package/modules/ignition/data/client/guide.md +36 -0
- package/modules/ignition/data/client/skill-loadout.md +11 -0
- package/modules/ignition/data/utility/config.md +18 -0
- package/modules/ignition/data/utility/guide.md +31 -0
- package/modules/ignition/data/utility/skill-loadout.md +8 -0
- package/modules/ignition/data/workflow/config.md +19 -0
- package/modules/ignition/data/workflow/guide.md +41 -0
- package/modules/ignition/data/workflow/skill-loadout.md +10 -0
- package/modules/ignition/integration.js +54 -0
- package/modules/ignition/package.json +35 -0
- package/modules/ignition/seed.md +81 -0
- package/modules/ignition/tasks/add-type.md +164 -0
- package/modules/ignition/tasks/graduate.md +182 -0
- package/modules/ignition/tasks/ideate.md +221 -0
- package/modules/ignition/tasks/launch.md +137 -0
- package/modules/ignition/tasks/status.md +71 -0
- package/modules/ignition/templates/planning-application.md +193 -0
- package/modules/ignition/templates/planning-campaign.md +138 -0
- package/modules/ignition/templates/planning-client.md +149 -0
- package/modules/ignition/templates/planning-utility.md +112 -0
- package/modules/ignition/templates/planning-workflow.md +125 -0
- package/modules/ignition/terminal.svg +74 -0
- package/modules/mission-control/CONTEXT-CONTINUITY-SPEC.md +293 -0
- package/modules/mission-control/CONTEXT-ENGINEERING-GUIDE.md +282 -0
- package/modules/mission-control/README.md +91 -0
- package/modules/mission-control/assets/terminal.svg +80 -0
- package/modules/mission-control/examples/entities.example.json +133 -0
- package/modules/mission-control/examples/projects.example.json +318 -0
- package/modules/mission-control/examples/state.example.json +183 -0
- package/modules/mission-control/examples/vector.example.json +245 -0
- package/modules/mission-control/mission-control/checklists/install-verification.md +46 -0
- package/modules/mission-control/mission-control/frameworks/framework-registry.md +83 -0
- package/modules/mission-control/mission-control/mission-control.md +83 -0
- package/modules/mission-control/mission-control/tasks/insights.md +73 -0
- package/modules/mission-control/mission-control/tasks/install.md +194 -0
- package/modules/mission-control/mission-control/tasks/status.md +125 -0
- package/modules/mission-control/schemas/entities.schema.json +89 -0
- package/modules/mission-control/schemas/projects.schema.json +221 -0
- package/modules/mission-control/schemas/state.schema.json +108 -0
- package/modules/mission-control/schemas/vector.schema.json +200 -0
- package/modules/momentum/README.md +678 -0
- package/modules/momentum/bin/install.js +563 -0
- package/modules/momentum/integration.js +131 -0
- package/modules/momentum/package.json +42 -0
- package/modules/momentum/schemas/entities.schema.json +89 -0
- package/modules/momentum/schemas/projects.schema.json +221 -0
- package/modules/momentum/schemas/state.schema.json +108 -0
- package/modules/momentum/src/commands/audit-claude-md.md +31 -0
- package/modules/momentum/src/commands/audit.md +33 -0
- package/modules/momentum/src/commands/groom.md +35 -0
- package/modules/momentum/src/commands/history.md +27 -0
- package/modules/momentum/src/commands/pulse.md +33 -0
- package/modules/momentum/src/commands/scaffold.md +33 -0
- package/modules/momentum/src/commands/status.md +28 -0
- package/modules/momentum/src/commands/surface-convert.md +35 -0
- package/modules/momentum/src/commands/surface-create.md +34 -0
- package/modules/momentum/src/commands/surface-list.md +27 -0
- package/modules/momentum/src/commands/vector-hygiene.md +33 -0
- package/modules/momentum/src/framework/context/momentum-principles.md +71 -0
- package/modules/momentum/src/framework/frameworks/audit-strategies.md +53 -0
- package/modules/momentum/src/framework/frameworks/satellite-registration.md +44 -0
- package/modules/momentum/src/framework/tasks/audit-claude-md.md +68 -0
- package/modules/momentum/src/framework/tasks/audit.md +64 -0
- package/modules/momentum/src/framework/tasks/groom.md +164 -0
- package/modules/momentum/src/framework/tasks/history.md +34 -0
- package/modules/momentum/src/framework/tasks/pulse.md +83 -0
- package/modules/momentum/src/framework/tasks/scaffold.md +202 -0
- package/modules/momentum/src/framework/tasks/status.md +35 -0
- package/modules/momentum/src/framework/tasks/surface-convert.md +143 -0
- package/modules/momentum/src/framework/tasks/surface-create.md +184 -0
- package/modules/momentum/src/framework/tasks/surface-list.md +42 -0
- package/modules/momentum/src/framework/tasks/vector-hygiene.md +160 -0
- package/modules/momentum/src/framework/templates/workspace-json.md +96 -0
- package/modules/momentum/src/hooks/_template.py +129 -0
- package/modules/momentum/src/hooks/active-hook.py +178 -0
- package/modules/momentum/src/hooks/backlog-hook.py +115 -0
- package/modules/momentum/src/hooks/mission-control-insights.py +169 -0
- package/modules/momentum/src/hooks/momentum-pulse-check.py +351 -0
- package/modules/momentum/src/hooks/operator.py +53 -0
- package/modules/momentum/src/hooks/psmm-injector.py +67 -0
- package/modules/momentum/src/hooks/satellite-detection.py +248 -0
- package/modules/momentum/src/packages/momentum-mcp/index.js +119 -0
- package/modules/momentum/src/packages/momentum-mcp/package.json +10 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/entities.js +226 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/operator.js +106 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/projects.js +322 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/psmm.js +206 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/state.js +199 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/surfaces.js +404 -0
- package/modules/momentum/src/skill/momentum.md +111 -0
- package/modules/momentum/src/tasks/groom.md +164 -0
- package/modules/momentum/src/templates/operator.json +66 -0
- package/modules/momentum/src/templates/workspace.json +111 -0
- package/modules/momentum/terminal.svg +77 -0
- package/modules/radar/README.md +1552 -0
- package/modules/radar/commands/audit.md +233 -0
- package/modules/radar/commands/guardrails.md +194 -0
- package/modules/radar/commands/init.md +207 -0
- package/modules/radar/commands/playbook.md +176 -0
- package/modules/radar/commands/remediate.md +156 -0
- package/modules/radar/commands/report.md +172 -0
- package/modules/radar/commands/resume.md +176 -0
- package/modules/radar/commands/status.md +148 -0
- package/modules/radar/commands/transform.md +205 -0
- package/modules/radar/commands/validate.md +177 -0
- package/modules/radar/docs/ARCHITECTURE.md +336 -0
- package/modules/radar/docs/GETTING-STARTED.md +287 -0
- package/modules/radar/docs/standards/agents.md +197 -0
- package/modules/radar/docs/standards/commands.md +250 -0
- package/modules/radar/docs/standards/domains.md +191 -0
- package/modules/radar/docs/standards/personas.md +211 -0
- package/modules/radar/docs/standards/rules.md +218 -0
- package/modules/radar/docs/standards/runtime.md +445 -0
- package/modules/radar/docs/standards/schemas.md +269 -0
- package/modules/radar/docs/standards/tools.md +273 -0
- package/modules/radar/docs/standards/workflows.md +254 -0
- package/modules/radar/docs/terminal.svg +72 -0
- package/modules/radar/docs/validation/convention-compliance-report.md +183 -0
- package/modules/radar/docs/validation/cross-reference-report.md +195 -0
- package/modules/radar/docs/validation/validation-summary.md +118 -0
- package/modules/radar/docs/validation/version-manifest.yaml +363 -0
- package/modules/radar/install.sh +711 -0
- package/modules/radar/integration.js +53 -0
- package/modules/radar/src/core/agents/architect.md +25 -0
- package/modules/radar/src/core/agents/compliance-officer.md +25 -0
- package/modules/radar/src/core/agents/data-engineer.md +25 -0
- package/modules/radar/src/core/agents/devils-advocate.md +22 -0
- package/modules/radar/src/core/agents/performance-engineer.md +25 -0
- package/modules/radar/src/core/agents/principal-engineer.md +23 -0
- package/modules/radar/src/core/agents/reality-gap-analyst.md +22 -0
- package/modules/radar/src/core/agents/security-engineer.md +25 -0
- package/modules/radar/src/core/agents/senior-app-engineer.md +25 -0
- package/modules/radar/src/core/agents/sre.md +25 -0
- package/modules/radar/src/core/agents/staff-engineer.md +23 -0
- package/modules/radar/src/core/agents/test-engineer.md +25 -0
- package/modules/radar/src/core/personas/architect.md +111 -0
- package/modules/radar/src/core/personas/compliance-officer.md +104 -0
- package/modules/radar/src/core/personas/data-engineer.md +113 -0
- package/modules/radar/src/core/personas/devils-advocate.md +105 -0
- package/modules/radar/src/core/personas/performance-engineer.md +119 -0
- package/modules/radar/src/core/personas/principal-engineer.md +119 -0
- package/modules/radar/src/core/personas/reality-gap-analyst.md +111 -0
- package/modules/radar/src/core/personas/security-engineer.md +108 -0
- package/modules/radar/src/core/personas/senior-app-engineer.md +111 -0
- package/modules/radar/src/core/personas/sre.md +117 -0
- package/modules/radar/src/core/personas/staff-engineer.md +109 -0
- package/modules/radar/src/core/personas/test-engineer.md +109 -0
- package/modules/radar/src/core/workflows/disagreement-resolution.md +183 -0
- package/modules/radar/src/core/workflows/phase-0-context.md +148 -0
- package/modules/radar/src/core/workflows/phase-1-reconnaissance.md +169 -0
- package/modules/radar/src/core/workflows/phase-2-domain-audits.md +190 -0
- package/modules/radar/src/core/workflows/phase-3-cross-domain.md +177 -0
- package/modules/radar/src/core/workflows/phase-4-adversarial-review.md +165 -0
- package/modules/radar/src/core/workflows/phase-5-report.md +189 -0
- package/modules/radar/src/core/workflows/phase-checkpoint.md +222 -0
- package/modules/radar/src/core/workflows/session-handoff.md +152 -0
- package/modules/radar/src/domains/00-context.md +201 -0
- package/modules/radar/src/domains/01-architecture.md +248 -0
- package/modules/radar/src/domains/02-data.md +224 -0
- package/modules/radar/src/domains/03-correctness.md +230 -0
- package/modules/radar/src/domains/04-security.md +274 -0
- package/modules/radar/src/domains/05-compliance.md +228 -0
- package/modules/radar/src/domains/06-testing.md +228 -0
- package/modules/radar/src/domains/07-reliability.md +246 -0
- package/modules/radar/src/domains/08-performance.md +247 -0
- package/modules/radar/src/domains/09-maintainability.md +271 -0
- package/modules/radar/src/domains/10-operability.md +250 -0
- package/modules/radar/src/domains/11-change-risk.md +246 -0
- package/modules/radar/src/domains/12-team-risk.md +221 -0
- package/modules/radar/src/domains/13-risk-synthesis.md +202 -0
- package/modules/radar/src/rules/agent-boundaries.md +78 -0
- package/modules/radar/src/rules/disagreement-protocol.md +76 -0
- package/modules/radar/src/rules/epistemic-hygiene.md +78 -0
- package/modules/radar/src/schemas/confidence.md +185 -0
- package/modules/radar/src/schemas/disagreement.md +238 -0
- package/modules/radar/src/schemas/finding.md +287 -0
- package/modules/radar/src/schemas/report-section.md +150 -0
- package/modules/radar/src/schemas/signal.md +108 -0
- package/modules/radar/src/tools/checkov.md +463 -0
- package/modules/radar/src/tools/git-history.md +581 -0
- package/modules/radar/src/tools/gitleaks.md +447 -0
- package/modules/radar/src/tools/grype.md +611 -0
- package/modules/radar/src/tools/semgrep.md +378 -0
- package/modules/radar/src/tools/sonarqube.md +550 -0
- package/modules/radar/src/tools/syft.md +539 -0
- package/modules/radar/src/tools/trivy.md +439 -0
- package/modules/radar/src/transform/agents/change-risk-modeler.md +24 -0
- package/modules/radar/src/transform/agents/execution-validator.md +24 -0
- package/modules/radar/src/transform/agents/guardrail-generator.md +24 -0
- package/modules/radar/src/transform/agents/pedagogy-agent.md +24 -0
- package/modules/radar/src/transform/agents/remediation-architect.md +24 -0
- package/modules/radar/src/transform/personas/change-risk-modeler.md +95 -0
- package/modules/radar/src/transform/personas/execution-validator.md +95 -0
- package/modules/radar/src/transform/personas/guardrail-generator.md +103 -0
- package/modules/radar/src/transform/personas/pedagogy-agent.md +105 -0
- package/modules/radar/src/transform/personas/remediation-architect.md +95 -0
- package/modules/radar/src/transform/rules/change-risk-rules.md +87 -0
- package/modules/radar/src/transform/rules/safety-governance.md +87 -0
- package/modules/radar/src/transform/schemas/change-risk.md +139 -0
- package/modules/radar/src/transform/schemas/intervention-level.md +207 -0
- package/modules/radar/src/transform/schemas/playbook.md +205 -0
- package/modules/radar/src/transform/schemas/verification-plan.md +134 -0
- package/modules/radar/src/transform/workflows/phase-6-remediation.md +148 -0
- package/modules/radar/src/transform/workflows/phase-7-risk-validation.md +161 -0
- package/modules/radar/src/transform/workflows/phase-8-execution-planning.md +159 -0
- package/modules/radar/src/transform/workflows/transform-safety.md +158 -0
- package/modules/vector/.vector-template/sessions/.gitkeep +0 -0
- package/modules/vector/.vector-template/vector.json +72 -0
- package/modules/vector/AUDIT-CLAUDEMD.md +154 -0
- package/modules/vector/INSTALL.md +185 -0
- package/modules/vector/LICENSE +21 -0
- package/modules/vector/README.md +409 -0
- package/modules/vector/VECTOR-BLOCK.md +57 -0
- package/modules/vector/assets/terminal.svg +68 -0
- package/modules/vector/bin/install.js +455 -0
- package/modules/vector/bin/migrate-v1-to-v2.sh +492 -0
- package/modules/vector/commands/help.md +46 -0
- package/modules/vector/hooks/vector-hook.py +775 -0
- package/modules/vector/mcp/index.js +118 -0
- package/modules/vector/mcp/package.json +10 -0
- package/modules/vector/mcp/tools/decisions.js +269 -0
- package/modules/vector/mcp/tools/domains.js +361 -0
- package/modules/vector/mcp/tools/staging.js +252 -0
- package/modules/vector/mcp/tools/vector-json.js +647 -0
- package/modules/vector/package.json +38 -0
- package/modules/vector/schemas/vector.schema.json +237 -0
- package/package.json +39 -0
- package/shared/branding/branding.js +70 -0
- package/shared/config/defaults.json +59 -0
- package/shared/events/README.md +175 -0
- package/shared/events/event-bus.js +134 -0
- package/shared/events/event_bus.py +255 -0
- package/shared/events/integrations.js +161 -0
- package/shared/events/schemas/audit-complete.schema.json +21 -0
- package/shared/events/schemas/phase-progress.schema.json +23 -0
- package/shared/events/schemas/plan-created.schema.json +21 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector v2 JSON — Domain, rule, decision, staging, and config tools for vector.json
|
|
3
|
+
* Single consolidated file replaces manifest + domain files + decisions/*.json + staging.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
function debugLog(...args) {
|
|
10
|
+
console.error('[Vector:v2]', new Date().toISOString(), ...args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ============================================================
|
|
14
|
+
// HELPERS
|
|
15
|
+
// ============================================================
|
|
16
|
+
|
|
17
|
+
function getVectorJsonPath(workspacePath) {
|
|
18
|
+
return join(workspacePath, '.vector', 'vector.json');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function readVectorJson(workspacePath) {
|
|
22
|
+
const filepath = getVectorJsonPath(workspacePath);
|
|
23
|
+
if (!existsSync(filepath)) {
|
|
24
|
+
return { version: 1, last_modified: null, config: { devmode: false, post_compact_gate: true, global_exclude: [] }, domains: {}, staging: [] };
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(readFileSync(filepath, 'utf-8'));
|
|
28
|
+
} catch (error) {
|
|
29
|
+
debugLog('Error reading vector.json:', error.message);
|
|
30
|
+
return { version: 1, last_modified: null, config: {}, domains: {}, staging: [] };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function writeVectorJson(workspacePath, data) {
|
|
35
|
+
const filepath = getVectorJsonPath(workspacePath);
|
|
36
|
+
data.last_modified = new Date().toISOString();
|
|
37
|
+
writeFileSync(filepath, JSON.stringify(data, null, 2), 'utf-8');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function todayStr() {
|
|
41
|
+
return new Date().toISOString().split('T')[0];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function nextRuleId(rules) {
|
|
45
|
+
if (!rules || rules.length === 0) return 0;
|
|
46
|
+
return Math.max(...rules.map(r => r.id)) + 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function nextDecisionId(domainName, decisions) {
|
|
50
|
+
const prefix = `${domainName.toLowerCase()}-`;
|
|
51
|
+
let max = 0;
|
|
52
|
+
for (const d of (decisions || [])) {
|
|
53
|
+
const match = (d.id || '').match(new RegExp(`^${prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(\\d+)$`));
|
|
54
|
+
if (match) {
|
|
55
|
+
const num = parseInt(match[1], 10);
|
|
56
|
+
if (num > max) max = num;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return `${prefix}${String(max + 1).padStart(3, '0')}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function nextStagingId(staging) {
|
|
63
|
+
let max = 0;
|
|
64
|
+
for (const s of (staging || [])) {
|
|
65
|
+
const match = (s.id || '').match(/^stg-(\d+)$/);
|
|
66
|
+
if (match) {
|
|
67
|
+
const num = parseInt(match[1], 10);
|
|
68
|
+
if (num > max) max = num;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return `stg-${String(max + 1).padStart(3, '0')}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ============================================================
|
|
75
|
+
// TOOL DEFINITIONS
|
|
76
|
+
// ============================================================
|
|
77
|
+
|
|
78
|
+
export const TOOLS = [
|
|
79
|
+
// Domain operations
|
|
80
|
+
{
|
|
81
|
+
name: "vector_v2_list_domains",
|
|
82
|
+
description: "List all Vector domains from vector.json with rule counts, decision counts, state, and always_on flag.",
|
|
83
|
+
inputSchema: { type: "object", properties: {}, required: [] }
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "vector_v2_get_domain",
|
|
87
|
+
description: "Get a full domain object from vector.json including rules, decisions, recall, state.",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
domain: { type: "string", description: "Domain name (case-insensitive, e.g., 'GLOBAL', 'development')" }
|
|
92
|
+
},
|
|
93
|
+
required: ["domain"]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "vector_v2_create_domain",
|
|
98
|
+
description: "Create a new domain in vector.json with recall keywords and optional initial rules.",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
domain: { type: "string", description: "Domain name (will be uppercased)" },
|
|
103
|
+
recall: { type: "array", items: { type: "string" }, description: "Recall keyword phrases" },
|
|
104
|
+
rules: { type: "array", items: { type: "string" }, description: "Initial rule texts (optional)" }
|
|
105
|
+
},
|
|
106
|
+
required: ["domain", "recall"]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "vector_v2_toggle_domain",
|
|
111
|
+
description: "Enable or disable a domain in vector.json.",
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: "object",
|
|
114
|
+
properties: {
|
|
115
|
+
domain: { type: "string", description: "Domain name" },
|
|
116
|
+
state: { type: "string", enum: ["active", "inactive"], description: "New state" }
|
|
117
|
+
},
|
|
118
|
+
required: ["domain", "state"]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
// Rule operations
|
|
122
|
+
{
|
|
123
|
+
name: "vector_v2_add_rule",
|
|
124
|
+
description: "Add a rule to a domain in vector.json. Auto-assigns next sequential ID.",
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {
|
|
128
|
+
domain: { type: "string", description: "Domain name" },
|
|
129
|
+
text: { type: "string", description: "Rule text" },
|
|
130
|
+
source: { type: "string", enum: ["manual", "psmm", "staging"], description: "Rule origin (default: manual)" }
|
|
131
|
+
},
|
|
132
|
+
required: ["domain", "text"]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "vector_v2_remove_rule",
|
|
137
|
+
description: "Remove a rule from a domain in vector.json by rule ID.",
|
|
138
|
+
inputSchema: {
|
|
139
|
+
type: "object",
|
|
140
|
+
properties: {
|
|
141
|
+
domain: { type: "string", description: "Domain name" },
|
|
142
|
+
rule_id: { type: "integer", description: "Rule ID (integer) to remove" }
|
|
143
|
+
},
|
|
144
|
+
required: ["domain", "rule_id"]
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "vector_v2_replace_rules",
|
|
149
|
+
description: "Replace ALL rules in a domain with a new set. Wipes existing rules and writes new ones with sequential IDs. Use for bulk rule updates.",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
domain: { type: "string", description: "Domain name" },
|
|
154
|
+
rules: { type: "array", items: { type: "string" }, description: "New rule texts (replaces all existing rules)" }
|
|
155
|
+
},
|
|
156
|
+
required: ["domain", "rules"]
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
// Decision operations
|
|
160
|
+
{
|
|
161
|
+
name: "vector_v2_log_decision",
|
|
162
|
+
description: "Log a decision to a domain in vector.json. Auto-generates ID.",
|
|
163
|
+
inputSchema: {
|
|
164
|
+
type: "object",
|
|
165
|
+
properties: {
|
|
166
|
+
domain: { type: "string", description: "Domain name" },
|
|
167
|
+
decision: { type: "string", description: "What was decided" },
|
|
168
|
+
rationale: { type: "string", description: "Why this decision was made" },
|
|
169
|
+
recall: { type: "string", description: "Comma-separated recall keywords" }
|
|
170
|
+
},
|
|
171
|
+
required: ["domain", "decision", "rationale", "recall"]
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "vector_v2_search_decisions",
|
|
176
|
+
description: "Search decisions across all domains in vector.json by keyword.",
|
|
177
|
+
inputSchema: {
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: {
|
|
180
|
+
keyword: { type: "string", description: "Search keyword (case-insensitive)" }
|
|
181
|
+
},
|
|
182
|
+
required: ["keyword"]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "vector_v2_archive_decision",
|
|
187
|
+
description: "Set a decision's status to 'archived' in vector.json.",
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: "object",
|
|
190
|
+
properties: {
|
|
191
|
+
id: { type: "string", description: "Decision ID (e.g., 'global-001')" }
|
|
192
|
+
},
|
|
193
|
+
required: ["id"]
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
// Staging operations
|
|
197
|
+
{
|
|
198
|
+
name: "vector_v2_stage_proposal",
|
|
199
|
+
description: "Stage a rule proposal in vector.json staging array.",
|
|
200
|
+
inputSchema: {
|
|
201
|
+
type: "object",
|
|
202
|
+
properties: {
|
|
203
|
+
domain: { type: "string", description: "Target domain for the rule" },
|
|
204
|
+
rule_text: { type: "string", description: "Proposed rule text" },
|
|
205
|
+
rationale: { type: "string", description: "Why this rule should exist" },
|
|
206
|
+
source: { type: "string", enum: ["psmm", "decisions", "manual"], description: "Proposal origin (default: manual)" }
|
|
207
|
+
},
|
|
208
|
+
required: ["domain", "rule_text", "rationale"]
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "vector_v2_get_staged",
|
|
213
|
+
description: "List all staged rule proposals from vector.json.",
|
|
214
|
+
inputSchema: { type: "object", properties: {}, required: [] }
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "vector_v2_approve_proposal",
|
|
218
|
+
description: "Approve a staged proposal — adds rule to target domain and removes from staging.",
|
|
219
|
+
inputSchema: {
|
|
220
|
+
type: "object",
|
|
221
|
+
properties: {
|
|
222
|
+
id: { type: "string", description: "Staging entry ID (e.g., 'stg-001')" }
|
|
223
|
+
},
|
|
224
|
+
required: ["id"]
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
// Config operations
|
|
228
|
+
{
|
|
229
|
+
name: "vector_v2_get_config",
|
|
230
|
+
description: "Get Vector configuration from vector.json (devmode, post_compact_gate, global_exclude).",
|
|
231
|
+
inputSchema: { type: "object", properties: {}, required: [] }
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "vector_v2_update_config",
|
|
235
|
+
description: "Update Vector configuration fields in vector.json. Shallow merge.",
|
|
236
|
+
inputSchema: {
|
|
237
|
+
type: "object",
|
|
238
|
+
properties: {
|
|
239
|
+
data: { type: "object", description: "Config fields to update (e.g., { devmode: true })" }
|
|
240
|
+
},
|
|
241
|
+
required: ["data"]
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
|
|
246
|
+
// ============================================================
|
|
247
|
+
// TOOL HANDLERS
|
|
248
|
+
// ============================================================
|
|
249
|
+
|
|
250
|
+
// --- Domain handlers ---
|
|
251
|
+
|
|
252
|
+
async function listDomains(workspacePath) {
|
|
253
|
+
debugLog('Listing domains from vector.json');
|
|
254
|
+
const vector = readVectorJson(workspacePath);
|
|
255
|
+
const domains = [];
|
|
256
|
+
|
|
257
|
+
for (const [name, domain] of Object.entries(vector.domains || {})) {
|
|
258
|
+
domains.push({
|
|
259
|
+
domain: name,
|
|
260
|
+
state: domain.state,
|
|
261
|
+
always_on: domain.always_on || false,
|
|
262
|
+
rule_count: (domain.rules || []).length,
|
|
263
|
+
decision_count: (domain.decisions || []).length,
|
|
264
|
+
recall: domain.recall || []
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return { domains, count: domains.length };
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async function getDomain(args, workspacePath) {
|
|
272
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
273
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
274
|
+
|
|
275
|
+
debugLog('Getting domain:', domainName);
|
|
276
|
+
const vector = readVectorJson(workspacePath);
|
|
277
|
+
const domain = vector.domains[domainName];
|
|
278
|
+
|
|
279
|
+
if (!domain) {
|
|
280
|
+
throw new Error(`Domain "${domainName}" not found. Available: ${Object.keys(vector.domains).join(', ')}`);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return { domain: domainName, ...domain };
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async function createDomain(args, workspacePath) {
|
|
287
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
288
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
289
|
+
if (!args.recall || !args.recall.length) throw new Error('Missing required parameter: recall');
|
|
290
|
+
|
|
291
|
+
debugLog('Creating domain:', domainName);
|
|
292
|
+
const vector = readVectorJson(workspacePath);
|
|
293
|
+
|
|
294
|
+
if (vector.domains[domainName]) {
|
|
295
|
+
throw new Error(`Domain "${domainName}" already exists`);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const rules = (args.rules || []).map((text, i) => ({
|
|
299
|
+
id: i,
|
|
300
|
+
text,
|
|
301
|
+
added: todayStr(),
|
|
302
|
+
last_reviewed: null,
|
|
303
|
+
source: 'manual'
|
|
304
|
+
}));
|
|
305
|
+
|
|
306
|
+
vector.domains[domainName] = {
|
|
307
|
+
state: 'active',
|
|
308
|
+
always_on: false,
|
|
309
|
+
recall: args.recall,
|
|
310
|
+
exclude: [],
|
|
311
|
+
rules,
|
|
312
|
+
decisions: []
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
writeVectorJson(workspacePath, vector);
|
|
316
|
+
|
|
317
|
+
return { domain: domainName, rule_count: rules.length, recall: args.recall };
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
async function toggleDomain(args, workspacePath) {
|
|
321
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
322
|
+
const newState = args.state;
|
|
323
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
324
|
+
if (!newState) throw new Error('Missing required parameter: state');
|
|
325
|
+
|
|
326
|
+
debugLog('Toggling domain:', domainName, '→', newState);
|
|
327
|
+
const vector = readVectorJson(workspacePath);
|
|
328
|
+
|
|
329
|
+
if (!vector.domains[domainName]) {
|
|
330
|
+
throw new Error(`Domain "${domainName}" not found`);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
vector.domains[domainName].state = newState;
|
|
334
|
+
writeVectorJson(workspacePath, vector);
|
|
335
|
+
|
|
336
|
+
return { domain: domainName, state: newState };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// --- Rule handlers ---
|
|
340
|
+
|
|
341
|
+
async function addRule(args, workspacePath) {
|
|
342
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
343
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
344
|
+
if (!args.text) throw new Error('Missing required parameter: text');
|
|
345
|
+
|
|
346
|
+
debugLog('Adding rule to:', domainName);
|
|
347
|
+
const vector = readVectorJson(workspacePath);
|
|
348
|
+
|
|
349
|
+
if (!vector.domains[domainName]) {
|
|
350
|
+
throw new Error(`Domain "${domainName}" not found`);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const domain = vector.domains[domainName];
|
|
354
|
+
if (!domain.rules) domain.rules = [];
|
|
355
|
+
|
|
356
|
+
const id = nextRuleId(domain.rules);
|
|
357
|
+
const rule = {
|
|
358
|
+
id,
|
|
359
|
+
text: args.text,
|
|
360
|
+
added: todayStr(),
|
|
361
|
+
last_reviewed: null,
|
|
362
|
+
source: args.source || 'manual'
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
domain.rules.push(rule);
|
|
366
|
+
writeVectorJson(workspacePath, vector);
|
|
367
|
+
|
|
368
|
+
return { domain: domainName, rule_id: id, rule_count: domain.rules.length };
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
async function removeRule(args, workspacePath) {
|
|
372
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
373
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
374
|
+
if (args.rule_id === undefined) throw new Error('Missing required parameter: rule_id');
|
|
375
|
+
|
|
376
|
+
debugLog('Removing rule:', domainName, '#', args.rule_id);
|
|
377
|
+
const vector = readVectorJson(workspacePath);
|
|
378
|
+
|
|
379
|
+
if (!vector.domains[domainName]) {
|
|
380
|
+
throw new Error(`Domain "${domainName}" not found`);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const domain = vector.domains[domainName];
|
|
384
|
+
const idx = (domain.rules || []).findIndex(r => r.id === args.rule_id);
|
|
385
|
+
|
|
386
|
+
if (idx === -1) {
|
|
387
|
+
throw new Error(`Rule ${args.rule_id} not found in domain "${domainName}"`);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const [removed] = domain.rules.splice(idx, 1);
|
|
391
|
+
writeVectorJson(workspacePath, vector);
|
|
392
|
+
|
|
393
|
+
return { domain: domainName, removed_rule_id: removed.id, removed_text: removed.text, rule_count: domain.rules.length };
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
async function replaceDomainRules(args, workspacePath) {
|
|
397
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
398
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
399
|
+
if (!args.rules || !Array.isArray(args.rules)) throw new Error('Missing required parameter: rules (array of strings)');
|
|
400
|
+
|
|
401
|
+
debugLog('Replacing all rules in domain:', domainName);
|
|
402
|
+
const vector = readVectorJson(workspacePath);
|
|
403
|
+
|
|
404
|
+
if (!vector.domains[domainName]) {
|
|
405
|
+
throw new Error(`Domain "${domainName}" not found`);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
const oldCount = vector.domains[domainName].rules.length;
|
|
409
|
+
vector.domains[domainName].rules = args.rules.map((text, i) => ({
|
|
410
|
+
id: i,
|
|
411
|
+
text,
|
|
412
|
+
added: todayStr(),
|
|
413
|
+
last_reviewed: null,
|
|
414
|
+
source: 'manual'
|
|
415
|
+
}));
|
|
416
|
+
|
|
417
|
+
writeVectorJson(workspacePath, vector);
|
|
418
|
+
|
|
419
|
+
return { domain: domainName, old_rule_count: oldCount, new_rule_count: args.rules.length };
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// --- Decision handlers ---
|
|
423
|
+
|
|
424
|
+
async function logDecision(args, workspacePath) {
|
|
425
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
426
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
427
|
+
if (!args.decision) throw new Error('Missing required parameter: decision');
|
|
428
|
+
if (!args.rationale) throw new Error('Missing required parameter: rationale');
|
|
429
|
+
if (!args.recall) throw new Error('Missing required parameter: recall');
|
|
430
|
+
|
|
431
|
+
debugLog('Logging decision to:', domainName);
|
|
432
|
+
const vector = readVectorJson(workspacePath);
|
|
433
|
+
|
|
434
|
+
if (!vector.domains[domainName]) {
|
|
435
|
+
throw new Error(`Domain "${domainName}" not found`);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const domain = vector.domains[domainName];
|
|
439
|
+
if (!domain.decisions) domain.decisions = [];
|
|
440
|
+
|
|
441
|
+
const id = nextDecisionId(domainName, domain.decisions);
|
|
442
|
+
const recallList = args.recall.split(',').map(k => k.trim()).filter(Boolean);
|
|
443
|
+
|
|
444
|
+
const entry = {
|
|
445
|
+
id,
|
|
446
|
+
decision: args.decision,
|
|
447
|
+
rationale: args.rationale,
|
|
448
|
+
date: todayStr(),
|
|
449
|
+
source: 'manual',
|
|
450
|
+
recall: recallList,
|
|
451
|
+
status: 'active'
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
domain.decisions.push(entry);
|
|
455
|
+
writeVectorJson(workspacePath, vector);
|
|
456
|
+
|
|
457
|
+
return { id, domain: domainName, message: `Logged ${id} to ${domainName}` };
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
async function searchDecisions(args, workspacePath) {
|
|
461
|
+
const { keyword } = args;
|
|
462
|
+
if (!keyword) throw new Error('Missing required parameter: keyword');
|
|
463
|
+
|
|
464
|
+
debugLog('Searching decisions for:', keyword);
|
|
465
|
+
const vector = readVectorJson(workspacePath);
|
|
466
|
+
const lowerKeyword = keyword.toLowerCase();
|
|
467
|
+
const results = [];
|
|
468
|
+
|
|
469
|
+
for (const [domainName, domain] of Object.entries(vector.domains || {})) {
|
|
470
|
+
for (const d of (domain.decisions || [])) {
|
|
471
|
+
if (d.status === 'archived') continue;
|
|
472
|
+
|
|
473
|
+
const searchText = [
|
|
474
|
+
d.decision,
|
|
475
|
+
d.rationale,
|
|
476
|
+
...(d.recall || [])
|
|
477
|
+
].join(' ').toLowerCase();
|
|
478
|
+
|
|
479
|
+
if (searchText.includes(lowerKeyword)) {
|
|
480
|
+
results.push({ ...d, domain: domainName });
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return { keyword, count: results.length, decisions: results };
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
async function archiveDecision(args, workspacePath) {
|
|
489
|
+
const { id } = args;
|
|
490
|
+
if (!id) throw new Error('Missing required parameter: id');
|
|
491
|
+
|
|
492
|
+
debugLog('Archiving decision:', id);
|
|
493
|
+
const vector = readVectorJson(workspacePath);
|
|
494
|
+
|
|
495
|
+
// Extract domain from ID (e.g., 'global-001' → 'GLOBAL', 'hunter-exotics-003' → 'HUNTER-EXOTICS')
|
|
496
|
+
// Find the domain by checking which domain has this decision
|
|
497
|
+
let found = false;
|
|
498
|
+
for (const [domainName, domain] of Object.entries(vector.domains || {})) {
|
|
499
|
+
const decision = (domain.decisions || []).find(d => d.id === id);
|
|
500
|
+
if (decision) {
|
|
501
|
+
decision.status = 'archived';
|
|
502
|
+
found = true;
|
|
503
|
+
writeVectorJson(workspacePath, vector);
|
|
504
|
+
return { id, domain: domainName, message: `Archived ${id}` };
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (!found) {
|
|
509
|
+
throw new Error(`Decision "${id}" not found in any domain`);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// --- Staging handlers ---
|
|
514
|
+
|
|
515
|
+
async function stageProposal(args, workspacePath) {
|
|
516
|
+
const domainName = (args.domain || '').toUpperCase();
|
|
517
|
+
if (!domainName) throw new Error('Missing required parameter: domain');
|
|
518
|
+
if (!args.rule_text) throw new Error('Missing required parameter: rule_text');
|
|
519
|
+
if (!args.rationale) throw new Error('Missing required parameter: rationale');
|
|
520
|
+
|
|
521
|
+
debugLog('Staging proposal for:', domainName);
|
|
522
|
+
const vector = readVectorJson(workspacePath);
|
|
523
|
+
|
|
524
|
+
if (!vector.staging) vector.staging = [];
|
|
525
|
+
|
|
526
|
+
const id = nextStagingId(vector.staging);
|
|
527
|
+
const entry = {
|
|
528
|
+
id,
|
|
529
|
+
source_session: null,
|
|
530
|
+
proposed_domain: domainName,
|
|
531
|
+
rule_text: args.rule_text,
|
|
532
|
+
rationale: args.rationale,
|
|
533
|
+
status: 'pending',
|
|
534
|
+
created_at: new Date().toISOString(),
|
|
535
|
+
reviewed_at: null
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
vector.staging.push(entry);
|
|
539
|
+
writeVectorJson(workspacePath, vector);
|
|
540
|
+
|
|
541
|
+
return { id, domain: domainName, message: `Staged ${id} for ${domainName}` };
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
async function getStaged(workspacePath) {
|
|
545
|
+
debugLog('Getting staged proposals');
|
|
546
|
+
const vector = readVectorJson(workspacePath);
|
|
547
|
+
const staging = vector.staging || [];
|
|
548
|
+
|
|
549
|
+
const pending = staging.filter(s => s.status === 'pending');
|
|
550
|
+
const approved = staging.filter(s => s.status === 'approved');
|
|
551
|
+
const rejected = staging.filter(s => s.status === 'rejected');
|
|
552
|
+
|
|
553
|
+
return { pending_count: pending.length, approved_count: approved.length, rejected_count: rejected.length, pending, approved, rejected };
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
async function approveProposal(args, workspacePath) {
|
|
557
|
+
const { id } = args;
|
|
558
|
+
if (!id) throw new Error('Missing required parameter: id');
|
|
559
|
+
|
|
560
|
+
debugLog('Approving proposal:', id);
|
|
561
|
+
const vector = readVectorJson(workspacePath);
|
|
562
|
+
|
|
563
|
+
if (!vector.staging) vector.staging = [];
|
|
564
|
+
const idx = vector.staging.findIndex(s => s.id === id && s.status === 'pending');
|
|
565
|
+
|
|
566
|
+
if (idx === -1) {
|
|
567
|
+
throw new Error(`Pending proposal "${id}" not found`);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const proposal = vector.staging[idx];
|
|
571
|
+
const domainName = proposal.proposed_domain;
|
|
572
|
+
|
|
573
|
+
if (!vector.domains[domainName]) {
|
|
574
|
+
throw new Error(`Target domain "${domainName}" not found in vector.json`);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Add rule to target domain
|
|
578
|
+
const domain = vector.domains[domainName];
|
|
579
|
+
if (!domain.rules) domain.rules = [];
|
|
580
|
+
|
|
581
|
+
const ruleId = nextRuleId(domain.rules);
|
|
582
|
+
domain.rules.push({
|
|
583
|
+
id: ruleId,
|
|
584
|
+
text: proposal.rule_text,
|
|
585
|
+
added: todayStr(),
|
|
586
|
+
last_reviewed: null,
|
|
587
|
+
source: 'staging'
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
// Remove from staging
|
|
591
|
+
vector.staging.splice(idx, 1);
|
|
592
|
+
writeVectorJson(workspacePath, vector);
|
|
593
|
+
|
|
594
|
+
return { id, domain: domainName, rule_id: ruleId, message: `Approved ${id} → ${domainName} rule ${ruleId}` };
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// --- Config handlers ---
|
|
598
|
+
|
|
599
|
+
async function getConfig(workspacePath) {
|
|
600
|
+
debugLog('Getting config');
|
|
601
|
+
const vector = readVectorJson(workspacePath);
|
|
602
|
+
return vector.config || {};
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
async function updateConfig(args, workspacePath) {
|
|
606
|
+
const { data } = args;
|
|
607
|
+
if (!data) throw new Error('Missing required parameter: data');
|
|
608
|
+
|
|
609
|
+
debugLog('Updating config');
|
|
610
|
+
const vector = readVectorJson(workspacePath);
|
|
611
|
+
|
|
612
|
+
if (!vector.config) vector.config = {};
|
|
613
|
+
vector.config = { ...vector.config, ...data };
|
|
614
|
+
writeVectorJson(workspacePath, vector);
|
|
615
|
+
|
|
616
|
+
return vector.config;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// ============================================================
|
|
620
|
+
// HANDLER DISPATCH
|
|
621
|
+
// ============================================================
|
|
622
|
+
|
|
623
|
+
export async function handleTool(name, args, workspacePath) {
|
|
624
|
+
switch (name) {
|
|
625
|
+
// Domains
|
|
626
|
+
case 'vector_v2_list_domains': return listDomains(workspacePath);
|
|
627
|
+
case 'vector_v2_get_domain': return getDomain(args, workspacePath);
|
|
628
|
+
case 'vector_v2_create_domain': return createDomain(args, workspacePath);
|
|
629
|
+
case 'vector_v2_toggle_domain': return toggleDomain(args, workspacePath);
|
|
630
|
+
// Rules
|
|
631
|
+
case 'vector_v2_add_rule': return addRule(args, workspacePath);
|
|
632
|
+
case 'vector_v2_remove_rule': return removeRule(args, workspacePath);
|
|
633
|
+
case 'vector_v2_replace_rules': return replaceDomainRules(args, workspacePath);
|
|
634
|
+
// Decisions
|
|
635
|
+
case 'vector_v2_log_decision': return logDecision(args, workspacePath);
|
|
636
|
+
case 'vector_v2_search_decisions': return searchDecisions(args, workspacePath);
|
|
637
|
+
case 'vector_v2_archive_decision': return archiveDecision(args, workspacePath);
|
|
638
|
+
// Staging
|
|
639
|
+
case 'vector_v2_stage_proposal': return stageProposal(args, workspacePath);
|
|
640
|
+
case 'vector_v2_get_staged': return getStaged(workspacePath);
|
|
641
|
+
case 'vector_v2_approve_proposal': return approveProposal(args, workspacePath);
|
|
642
|
+
// Config
|
|
643
|
+
case 'vector_v2_get_config': return getConfig(workspacePath);
|
|
644
|
+
case 'vector_v2_update_config': return updateConfig(args, workspacePath);
|
|
645
|
+
default: return null;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vector",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Context Augmentation & Reinforcement Layer - Dynamic rules for Claude Code",
|
|
5
|
+
"bin": {
|
|
6
|
+
"vector-core": "bin/install.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"hooks",
|
|
11
|
+
"schemas",
|
|
12
|
+
"mcp",
|
|
13
|
+
".vector-template"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"claude",
|
|
17
|
+
"claude-code",
|
|
18
|
+
"ai",
|
|
19
|
+
"rules",
|
|
20
|
+
"context",
|
|
21
|
+
"vector",
|
|
22
|
+
"dynamic-rules",
|
|
23
|
+
"prompt-engineering"
|
|
24
|
+
],
|
|
25
|
+
"author": "Yogi Gnanavel <accelerationguy.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/accelerationguy/accelerate.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/accelerationguy/accelerate/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/accelerationguy/accelerate#readme",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=16.7.0"
|
|
37
|
+
}
|
|
38
|
+
}
|