@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,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector Domains — Domain CRUD tools
|
|
3
|
+
* Migrated from DRL-engine MCP, renamed drl_* → vector_* for Accelerate
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { readFileSync, existsSync, readdirSync, writeFileSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
const VECTOR_FOLDER = '.vector';
|
|
10
|
+
|
|
11
|
+
function debugLog(...args) {
|
|
12
|
+
console.error('[Vector:domains]', new Date().toISOString(), ...args);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// ============================================================
|
|
16
|
+
// FILE PARSING
|
|
17
|
+
// ============================================================
|
|
18
|
+
|
|
19
|
+
function findVectorFiles(workspacePath) {
|
|
20
|
+
const files = {};
|
|
21
|
+
const vectorPath = join(workspacePath, VECTOR_FOLDER);
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
if (!existsSync(vectorPath)) {
|
|
25
|
+
debugLog('Vector folder not found:', vectorPath);
|
|
26
|
+
return files;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const entries = readdirSync(vectorPath);
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
if (!entry.startsWith('.') && !entry.startsWith('sessions') && !entry.startsWith('skool')) {
|
|
32
|
+
files[entry] = join(vectorPath, entry);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
debugLog('Error reading Vector folder:', error.message);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return files;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function applyManifestEntry(domains, key, value) {
|
|
43
|
+
const suffixes = [
|
|
44
|
+
{ suffix: '_STATE', len: 6, handler: (d, v) => { d.state = ['active', 'true', 'yes', '1'].includes(v.toLowerCase()); } },
|
|
45
|
+
{ suffix: '_ALWAYS_ON', len: 10, handler: (d, v) => { d.always_on = ['true', 'yes', '1'].includes(v.toLowerCase()); } },
|
|
46
|
+
{ suffix: '_RECALL', len: 7, handler: (d, v) => { d.recall = v; } }
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
for (const { suffix, len, handler } of suffixes) {
|
|
50
|
+
if (key.endsWith(suffix)) {
|
|
51
|
+
const domain = key.slice(0, -len);
|
|
52
|
+
if (!domains[domain]) domains[domain] = {};
|
|
53
|
+
handler(domains[domain], value);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function parseManifest(filepath) {
|
|
60
|
+
const domains = {};
|
|
61
|
+
if (!existsSync(filepath)) return domains;
|
|
62
|
+
|
|
63
|
+
const content = readFileSync(filepath, 'utf-8');
|
|
64
|
+
for (const line of content.split('\n')) {
|
|
65
|
+
const trimmed = line.trim();
|
|
66
|
+
if (!trimmed || trimmed.startsWith('#') || !trimmed.includes('=')) continue;
|
|
67
|
+
const [key, value] = trimmed.split('=', 2);
|
|
68
|
+
applyManifestEntry(domains, key.trim(), value.trim());
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return domains;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function parseDomainRules(filepath, domainName) {
|
|
75
|
+
const rules = [];
|
|
76
|
+
if (!existsSync(filepath)) return rules;
|
|
77
|
+
|
|
78
|
+
const content = readFileSync(filepath, 'utf-8');
|
|
79
|
+
const prefix = `${domainName}_RULE_`;
|
|
80
|
+
|
|
81
|
+
for (const line of content.split('\n')) {
|
|
82
|
+
const trimmed = line.trim();
|
|
83
|
+
if (!trimmed || trimmed.startsWith('#') || !trimmed.includes('=')) continue;
|
|
84
|
+
const [key, value] = trimmed.split('=', 2);
|
|
85
|
+
const k = key.trim();
|
|
86
|
+
const v = value.trim();
|
|
87
|
+
|
|
88
|
+
if (k.startsWith(prefix) && v) {
|
|
89
|
+
const num = Number.parseInt(k.replace(prefix, ''), 10);
|
|
90
|
+
rules.push({ num, text: v });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
rules.sort((a, b) => a.num - b.num);
|
|
95
|
+
return rules;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ============================================================
|
|
99
|
+
// TOOL DEFINITIONS
|
|
100
|
+
// ============================================================
|
|
101
|
+
|
|
102
|
+
export const TOOLS = [
|
|
103
|
+
{
|
|
104
|
+
name: "vector_list_domains",
|
|
105
|
+
description: "List all available Vector domains with state from manifest.",
|
|
106
|
+
inputSchema: { type: "object", properties: {} }
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "vector_get_domain_rules",
|
|
110
|
+
description: "Load rules for a specific Vector domain. Use when user intent matches domain recall keywords.",
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: "object",
|
|
113
|
+
properties: {
|
|
114
|
+
domain: { type: "string", description: "Domain name (e.g., 'PROJECTS', 'CONTENT'). Case-insensitive." }
|
|
115
|
+
},
|
|
116
|
+
required: ["domain"]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "vector_create_domain",
|
|
121
|
+
description: "Create a new Vector domain with file and manifest entry.",
|
|
122
|
+
inputSchema: {
|
|
123
|
+
type: "object",
|
|
124
|
+
properties: {
|
|
125
|
+
domain: { type: "string", description: "Domain name in UPPERCASE (e.g., 'TESTING')" },
|
|
126
|
+
description: { type: "string", description: "Brief description of when this domain applies" },
|
|
127
|
+
recall: { type: "string", description: "Comma-separated recall keywords that trigger this domain" },
|
|
128
|
+
rules: { type: "array", items: { type: "string" }, description: "Array of rule strings (Rule 0 auto-generated from description)" }
|
|
129
|
+
},
|
|
130
|
+
required: ["domain", "description", "recall", "rules"]
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "vector_toggle_domain",
|
|
135
|
+
description: "Enable or disable a Vector domain by updating the manifest.",
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: "object",
|
|
138
|
+
properties: {
|
|
139
|
+
domain: { type: "string", description: "Domain name to toggle (e.g., 'PROJECTS')" },
|
|
140
|
+
state: { type: "string", enum: ["active", "inactive"], description: "New state" }
|
|
141
|
+
},
|
|
142
|
+
required: ["domain", "state"]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "vector_get_manifest",
|
|
147
|
+
description: "Get current Vector manifest showing all domains, states, and recall keywords.",
|
|
148
|
+
inputSchema: { type: "object", properties: {} }
|
|
149
|
+
}
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
// ============================================================
|
|
153
|
+
// TOOL HANDLERS
|
|
154
|
+
// ============================================================
|
|
155
|
+
|
|
156
|
+
export async function handleTool(name, args, workspacePath) {
|
|
157
|
+
switch (name) {
|
|
158
|
+
case "vector_list_domains": return listDomains(workspacePath);
|
|
159
|
+
case "vector_get_domain_rules": return getDomainRules(args, workspacePath);
|
|
160
|
+
case "vector_create_domain": return createDomain(args, workspacePath);
|
|
161
|
+
case "vector_toggle_domain": return toggleDomain(args, workspacePath);
|
|
162
|
+
case "vector_get_manifest": return getManifest(workspacePath);
|
|
163
|
+
default: return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function listDomains(workspacePath) {
|
|
168
|
+
const files = findVectorFiles(workspacePath);
|
|
169
|
+
debugLog('Listing domains');
|
|
170
|
+
|
|
171
|
+
const domainFiles = Object.entries(files)
|
|
172
|
+
.filter(([type]) => type !== 'manifest' && type !== 'context')
|
|
173
|
+
.map(([type, filepath]) => ({
|
|
174
|
+
domain: type.toUpperCase(),
|
|
175
|
+
file: `.vector/${type}`,
|
|
176
|
+
path: filepath
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
success: true,
|
|
181
|
+
workspace: workspacePath,
|
|
182
|
+
domain_count: domainFiles.length,
|
|
183
|
+
domains: domainFiles,
|
|
184
|
+
special_files: {
|
|
185
|
+
manifest: files.manifest || null,
|
|
186
|
+
context: files.context || null
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function getDomainRules(args, workspacePath) {
|
|
192
|
+
const domain = args.domain.toUpperCase();
|
|
193
|
+
const files = findVectorFiles(workspacePath);
|
|
194
|
+
debugLog('Getting rules for domain:', domain);
|
|
195
|
+
|
|
196
|
+
let domainFile = files[domain.toLowerCase()];
|
|
197
|
+
let isCommandExtraction = false;
|
|
198
|
+
|
|
199
|
+
if (!domainFile && files.commands) {
|
|
200
|
+
debugLog('No dedicated file, checking commands file for:', domain);
|
|
201
|
+
domainFile = files.commands;
|
|
202
|
+
isCommandExtraction = true;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (!domainFile) {
|
|
206
|
+
return {
|
|
207
|
+
success: false,
|
|
208
|
+
error: `Domain file not found: .vector/${domain.toLowerCase()}`,
|
|
209
|
+
available_domains: Object.keys(files).filter(k => k !== 'manifest' && k !== 'context')
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const rules = parseDomainRules(domainFile, domain);
|
|
214
|
+
|
|
215
|
+
if (rules.length === 0) {
|
|
216
|
+
return {
|
|
217
|
+
success: false,
|
|
218
|
+
error: `No ${domain}_RULE_* entries found`,
|
|
219
|
+
domain
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const formatted = rules.map(r => `[${domain}] Rule ${r.num}: ${r.text}`);
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
success: true,
|
|
227
|
+
domain,
|
|
228
|
+
rule_count: rules.length,
|
|
229
|
+
rules: formatted,
|
|
230
|
+
source: isCommandExtraction ? 'commands' : 'dedicated',
|
|
231
|
+
instruction: `${domain} rules loaded. Apply these rules to the current context.`
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async function createDomain(args, workspacePath) {
|
|
236
|
+
const domain = args.domain.toUpperCase();
|
|
237
|
+
const domainLower = domain.toLowerCase();
|
|
238
|
+
const { description, recall, rules = [] } = args;
|
|
239
|
+
const files = findVectorFiles(workspacePath);
|
|
240
|
+
|
|
241
|
+
debugLog('Creating domain:', domain);
|
|
242
|
+
|
|
243
|
+
if (files[domainLower]) {
|
|
244
|
+
return { success: false, error: `Domain already exists: ${domain}`, existing_file: files[domainLower] };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!files.manifest) {
|
|
248
|
+
return { success: false, error: 'Manifest not found' };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const domainFilePath = join(workspacePath, VECTOR_FOLDER, domainLower);
|
|
252
|
+
|
|
253
|
+
let domainContent = `# Dynamic Rules Loader V2 - ${domain} Domain
|
|
254
|
+
# ${'='.repeat(40)}
|
|
255
|
+
# ${description}
|
|
256
|
+
#
|
|
257
|
+
# Domain Configuration (synced with .vector/manifest)
|
|
258
|
+
${domain}_STATE=active
|
|
259
|
+
${domain}_ALWAYS_ON=false
|
|
260
|
+
|
|
261
|
+
# Rule 0: Self-referencing relevance instruction
|
|
262
|
+
${domain}_RULE_0=${domain} rules apply when ${description.toLowerCase()}. If these rules are loaded but the request doesn't involve this domain, note that ${domain} rules are active but may not be needed.
|
|
263
|
+
|
|
264
|
+
# ============================================================================
|
|
265
|
+
# ${domain} Rules
|
|
266
|
+
# ============================================================================
|
|
267
|
+
`;
|
|
268
|
+
|
|
269
|
+
for (let i = 0; i < rules.length; i++) {
|
|
270
|
+
domainContent += `${domain}_RULE_${i + 1}=${rules[i]}\n`;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
writeFileSync(domainFilePath, domainContent, 'utf-8');
|
|
274
|
+
|
|
275
|
+
const manifestContent = readFileSync(files.manifest, 'utf-8');
|
|
276
|
+
const manifestEntry = `
|
|
277
|
+
# ============================================================================
|
|
278
|
+
# ${domain} - ${description}
|
|
279
|
+
# ============================================================================
|
|
280
|
+
${domain}_STATE=active
|
|
281
|
+
${domain}_ALWAYS_ON=false
|
|
282
|
+
${domain}_RECALL=${recall}
|
|
283
|
+
# ${domain}_EXCLUDE=
|
|
284
|
+
`;
|
|
285
|
+
|
|
286
|
+
writeFileSync(files.manifest, manifestContent + manifestEntry, 'utf-8');
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
success: true,
|
|
290
|
+
domain,
|
|
291
|
+
domain_file: domainFilePath,
|
|
292
|
+
rule_count: rules.length + 1,
|
|
293
|
+
recall_keywords: recall,
|
|
294
|
+
message: `Domain ${domain} created. File: .vector/${domainLower}, Manifest updated.`
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
async function toggleDomain(args, workspacePath) {
|
|
299
|
+
const domain = args.domain.toUpperCase();
|
|
300
|
+
const newState = args.state.toLowerCase();
|
|
301
|
+
const files = findVectorFiles(workspacePath);
|
|
302
|
+
|
|
303
|
+
debugLog('Toggling domain:', domain, 'to', newState);
|
|
304
|
+
|
|
305
|
+
if (!files.manifest) {
|
|
306
|
+
return { success: false, error: 'Manifest not found' };
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const content = readFileSync(files.manifest, 'utf-8');
|
|
310
|
+
const lines = content.split('\n');
|
|
311
|
+
const stateKey = `${domain}_STATE`;
|
|
312
|
+
let found = false;
|
|
313
|
+
|
|
314
|
+
const newLines = lines.map(line => {
|
|
315
|
+
if (line.trim().startsWith(stateKey + '=')) {
|
|
316
|
+
found = true;
|
|
317
|
+
return `${stateKey}=${newState}`;
|
|
318
|
+
}
|
|
319
|
+
return line;
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
if (!found) {
|
|
323
|
+
return { success: false, error: `Domain not found in manifest: ${domain}` };
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
writeFileSync(files.manifest, newLines.join('\n'), 'utf-8');
|
|
327
|
+
|
|
328
|
+
return {
|
|
329
|
+
success: true,
|
|
330
|
+
domain,
|
|
331
|
+
new_state: newState,
|
|
332
|
+
message: `${domain} is now ${newState}. Change persisted to manifest.`
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async function getManifest(workspacePath) {
|
|
337
|
+
const files = findVectorFiles(workspacePath);
|
|
338
|
+
debugLog('Getting manifest');
|
|
339
|
+
|
|
340
|
+
if (!files.manifest) {
|
|
341
|
+
return { success: false, error: 'Manifest not found' };
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const domains = parseManifest(files.manifest);
|
|
345
|
+
|
|
346
|
+
const formatted = {};
|
|
347
|
+
for (const [name, config] of Object.entries(domains)) {
|
|
348
|
+
formatted[name] = {
|
|
349
|
+
state: config.state ? 'active' : 'inactive',
|
|
350
|
+
always_on: config.always_on || false,
|
|
351
|
+
recall: config.recall || ''
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return {
|
|
356
|
+
success: true,
|
|
357
|
+
manifest_path: files.manifest,
|
|
358
|
+
domain_count: Object.keys(domains).length,
|
|
359
|
+
domains: formatted
|
|
360
|
+
};
|
|
361
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector Staging — Rule proposal staging pipeline (legacy v1 file-based)
|
|
3
|
+
* Stage, review, approve/kill rule proposals before they become Vector rules
|
|
4
|
+
*
|
|
5
|
+
* Note: v2 users should use vector_v2_stage_proposal / vector_v2_approve_proposal
|
|
6
|
+
* from vector-json.js, which stages directly in vector.json.
|
|
7
|
+
* This file provides backward compatibility for v1 flat-file setups.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFileSync, writeFileSync, existsSync, appendFileSync, mkdirSync } from 'fs';
|
|
11
|
+
import { join, dirname } from 'path';
|
|
12
|
+
|
|
13
|
+
const VALID_SOURCES = ['psmm', 'decisions', 'manual'];
|
|
14
|
+
|
|
15
|
+
function debugLog(...args) {
|
|
16
|
+
console.error('[Vector:staging]', new Date().toISOString(), ...args);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getStagingPath(workspacePath) {
|
|
20
|
+
return join(workspacePath, '.vector', 'staging.json');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function readStaging(workspacePath) {
|
|
24
|
+
const filepath = getStagingPath(workspacePath);
|
|
25
|
+
if (!existsSync(filepath)) {
|
|
26
|
+
return { proposals: [] };
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(readFileSync(filepath, 'utf-8'));
|
|
30
|
+
} catch (error) {
|
|
31
|
+
debugLog('Error reading staging.json:', error.message);
|
|
32
|
+
return { proposals: [] };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function writeStaging(workspacePath, data) {
|
|
37
|
+
const filepath = getStagingPath(workspacePath);
|
|
38
|
+
const dir = dirname(filepath);
|
|
39
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
40
|
+
writeFileSync(filepath, JSON.stringify(data, null, 2), 'utf-8');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function nextProposalId(proposals) {
|
|
44
|
+
if (proposals.length === 0) return 'prop-001';
|
|
45
|
+
const nums = proposals.map(p => parseInt(p.id.replace('prop-', ''), 10)).filter(n => !isNaN(n));
|
|
46
|
+
const max = nums.length > 0 ? Math.max(...nums) : 0;
|
|
47
|
+
return `prop-${String(max + 1).padStart(3, '0')}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ============================================================
|
|
51
|
+
// TOOL DEFINITIONS
|
|
52
|
+
// ============================================================
|
|
53
|
+
|
|
54
|
+
export const TOOLS = [
|
|
55
|
+
{
|
|
56
|
+
name: "vector_stage_proposal",
|
|
57
|
+
description: "Stage a new Vector rule proposal for review. Sources: psmm, decisions, manual.",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
domain: { type: "string", description: "Target domain (e.g., 'GLOBAL', 'DEVELOPMENT')" },
|
|
62
|
+
rule_text: { type: "string", description: "The proposed rule text" },
|
|
63
|
+
rationale: { type: "string", description: "Why this rule should exist" },
|
|
64
|
+
source: { type: "string", enum: VALID_SOURCES, description: "Where this proposal came from" }
|
|
65
|
+
},
|
|
66
|
+
required: ["domain", "rule_text", "rationale", "source"]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "vector_get_staged",
|
|
71
|
+
description: "List all pending rule proposals in the staging pipeline.",
|
|
72
|
+
inputSchema: { type: "object", properties: {} }
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "vector_approve_proposal",
|
|
76
|
+
description: "Approve a staged proposal — writes the rule to the target domain file and removes from staging.",
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
id: { type: "string", description: "Proposal ID (e.g., 'prop-001')" }
|
|
81
|
+
},
|
|
82
|
+
required: ["id"]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "vector_kill_proposal",
|
|
87
|
+
description: "Delete a staged proposal permanently.",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
id: { type: "string", description: "Proposal ID to delete" }
|
|
92
|
+
},
|
|
93
|
+
required: ["id"]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "vector_archive_proposal",
|
|
98
|
+
description: "Archive a proposal — keeps it for reference but doesn't activate as a rule.",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
id: { type: "string", description: "Proposal ID to archive" }
|
|
103
|
+
},
|
|
104
|
+
required: ["id"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
// ============================================================
|
|
110
|
+
// TOOL HANDLERS
|
|
111
|
+
// ============================================================
|
|
112
|
+
|
|
113
|
+
export async function handleTool(name, args, workspacePath) {
|
|
114
|
+
switch (name) {
|
|
115
|
+
case "vector_stage_proposal": return stageProposal(args, workspacePath);
|
|
116
|
+
case "vector_get_staged": return getStaged(workspacePath);
|
|
117
|
+
case "vector_approve_proposal": return approveProposal(args, workspacePath);
|
|
118
|
+
case "vector_kill_proposal": return killProposal(args, workspacePath);
|
|
119
|
+
case "vector_archive_proposal": return archiveProposal(args, workspacePath);
|
|
120
|
+
default: return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function stageProposal(args, workspacePath) {
|
|
125
|
+
const { domain, rule_text, rationale, source } = args;
|
|
126
|
+
|
|
127
|
+
if (!VALID_SOURCES.includes(source)) {
|
|
128
|
+
return { success: false, error: `Invalid source: ${source}. Valid: ${VALID_SOURCES.join(', ')}` };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
debugLog('Staging proposal for domain:', domain);
|
|
132
|
+
|
|
133
|
+
const data = readStaging(workspacePath);
|
|
134
|
+
const id = nextProposalId(data.proposals);
|
|
135
|
+
const date = new Date().toISOString().split('T')[0];
|
|
136
|
+
|
|
137
|
+
const proposal = {
|
|
138
|
+
id,
|
|
139
|
+
proposed: date,
|
|
140
|
+
source,
|
|
141
|
+
domain: domain.toUpperCase(),
|
|
142
|
+
rule_text,
|
|
143
|
+
rationale,
|
|
144
|
+
status: 'pending'
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
data.proposals.push(proposal);
|
|
148
|
+
writeStaging(workspacePath, data);
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
success: true,
|
|
152
|
+
id,
|
|
153
|
+
domain: proposal.domain,
|
|
154
|
+
message: `Staged ${id} for ${proposal.domain}: "${rule_text.slice(0, 60)}..."`
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function getStaged(workspacePath) {
|
|
159
|
+
debugLog('Getting staged proposals');
|
|
160
|
+
const data = readStaging(workspacePath);
|
|
161
|
+
|
|
162
|
+
const pending = data.proposals.filter(p => p.status === 'pending');
|
|
163
|
+
const archived = data.proposals.filter(p => p.status === 'archived');
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
success: true,
|
|
167
|
+
pending_count: pending.length,
|
|
168
|
+
archived_count: archived.length,
|
|
169
|
+
pending,
|
|
170
|
+
archived
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function approveProposal(args, workspacePath) {
|
|
175
|
+
const { id } = args;
|
|
176
|
+
debugLog('Approving proposal:', id);
|
|
177
|
+
|
|
178
|
+
const data = readStaging(workspacePath);
|
|
179
|
+
const idx = data.proposals.findIndex(p => p.id === id && p.status === 'pending');
|
|
180
|
+
|
|
181
|
+
if (idx === -1) {
|
|
182
|
+
return { success: false, error: `Pending proposal not found: ${id}` };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const proposal = data.proposals[idx];
|
|
186
|
+
const domain = proposal.domain;
|
|
187
|
+
const domainLower = domain.toLowerCase();
|
|
188
|
+
|
|
189
|
+
// Find the domain file
|
|
190
|
+
const domainFilePath = join(workspacePath, '.vector', domainLower);
|
|
191
|
+
|
|
192
|
+
if (!existsSync(domainFilePath)) {
|
|
193
|
+
return { success: false, error: `Domain file not found: .vector/${domainLower}` };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Read domain file and find next rule number
|
|
197
|
+
const content = readFileSync(domainFilePath, 'utf-8');
|
|
198
|
+
const ruleRegex = new RegExp(`${domain}_RULE_(\\d+)`, 'g');
|
|
199
|
+
const ruleNums = [...content.matchAll(ruleRegex)].map(m => parseInt(m[1], 10));
|
|
200
|
+
const nextNum = ruleNums.length > 0 ? Math.max(...ruleNums) + 1 : 1;
|
|
201
|
+
|
|
202
|
+
// Append the new rule
|
|
203
|
+
const ruleLine = `${domain}_RULE_${nextNum}=${proposal.rule_text}\n`;
|
|
204
|
+
appendFileSync(domainFilePath, ruleLine, 'utf-8');
|
|
205
|
+
|
|
206
|
+
// Remove from staging
|
|
207
|
+
data.proposals.splice(idx, 1);
|
|
208
|
+
writeStaging(workspacePath, data);
|
|
209
|
+
|
|
210
|
+
return {
|
|
211
|
+
success: true,
|
|
212
|
+
id,
|
|
213
|
+
domain,
|
|
214
|
+
rule_number: nextNum,
|
|
215
|
+
message: `Approved ${id} → ${domain}_RULE_${nextNum} written to .vector/${domainLower}`
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
async function killProposal(args, workspacePath) {
|
|
220
|
+
const { id } = args;
|
|
221
|
+
debugLog('Killing proposal:', id);
|
|
222
|
+
|
|
223
|
+
const data = readStaging(workspacePath);
|
|
224
|
+
const idx = data.proposals.findIndex(p => p.id === id);
|
|
225
|
+
|
|
226
|
+
if (idx === -1) {
|
|
227
|
+
return { success: false, error: `Proposal not found: ${id}` };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
data.proposals.splice(idx, 1);
|
|
231
|
+
writeStaging(workspacePath, data);
|
|
232
|
+
|
|
233
|
+
return { success: true, message: `Deleted proposal ${id}` };
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async function archiveProposal(args, workspacePath) {
|
|
237
|
+
const { id } = args;
|
|
238
|
+
debugLog('Archiving proposal:', id);
|
|
239
|
+
|
|
240
|
+
const data = readStaging(workspacePath);
|
|
241
|
+
const proposal = data.proposals.find(p => p.id === id && p.status === 'pending');
|
|
242
|
+
|
|
243
|
+
if (!proposal) {
|
|
244
|
+
return { success: false, error: `Pending proposal not found: ${id}` };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
proposal.status = 'archived';
|
|
248
|
+
proposal.archived_date = new Date().toISOString().split('T')[0];
|
|
249
|
+
writeStaging(workspacePath, data);
|
|
250
|
+
|
|
251
|
+
return { success: true, message: `Archived proposal ${id}` };
|
|
252
|
+
}
|