@hivehub/rulebook 5.5.2 → 5.8.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/commands/analysis.md +35 -35
- package/.claude/commands/continue.md +33 -33
- package/.claude/commands/rulebook-decision-create.md +55 -55
- package/.claude/commands/rulebook-decision-list.md +15 -15
- package/.claude/commands/rulebook-knowledge-add.md +41 -41
- package/.claude/commands/rulebook-knowledge-list.md +15 -15
- package/.claude/commands/rulebook-learn-capture.md +41 -48
- package/.claude/commands/rulebook-learn-list.md +13 -13
- package/.claude/commands/rulebook-memory-save.md +48 -48
- package/.claude/commands/rulebook-memory-search.md +47 -47
- package/.claude/commands/rulebook-task-apply.md +67 -67
- package/.claude/commands/rulebook-task-archive.md +94 -94
- package/.claude/commands/rulebook-task-create.md +93 -93
- package/.claude/commands/rulebook-task-list.md +42 -42
- package/.claude/commands/rulebook-task-show.md +52 -52
- package/.claude/commands/rulebook-task-validate.md +53 -53
- package/.claude-plugin/marketplace.json +28 -28
- package/.claude-plugin/plugin.json +8 -8
- package/README.md +418 -394
- package/dist/cli/commands/claude.d.ts +17 -0
- package/dist/cli/commands/claude.d.ts.map +1 -0
- package/dist/cli/commands/claude.js +56 -0
- package/dist/cli/commands/claude.js.map +1 -0
- package/dist/cli/commands/context-intelligence.d.ts +0 -1
- package/dist/cli/commands/context-intelligence.d.ts.map +1 -1
- package/dist/cli/commands/context-intelligence.js +12 -33
- package/dist/cli/commands/context-intelligence.js.map +1 -1
- package/dist/cli/commands/index.d.ts +4 -7
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +4 -7
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +58 -83
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts +0 -1
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +1 -7
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/memory.d.ts +7 -1
- package/dist/cli/commands/memory.d.ts.map +1 -1
- package/dist/cli/commands/memory.js +51 -57
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/misc.d.ts +1 -15
- package/dist/cli/commands/misc.d.ts.map +1 -1
- package/dist/cli/commands/misc.js +36 -215
- package/dist/cli/commands/misc.js.map +1 -1
- package/dist/cli/commands/plans.d.ts +0 -6
- package/dist/cli/commands/plans.d.ts.map +1 -1
- package/dist/cli/commands/plans.js +9 -77
- package/dist/cli/commands/plans.js.map +1 -1
- package/dist/cli/commands/skills.js +6 -6
- package/dist/cli/commands/skills.js.map +1 -1
- package/dist/cli/commands/task.js +4 -4
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +128 -53
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/prompts.d.ts +13 -0
- package/dist/cli/prompts.d.ts.map +1 -1
- package/dist/cli/prompts.js +107 -78
- package/dist/cli/prompts.js.map +1 -1
- package/dist/core/{claude-mcp.d.ts → claude/claude-mcp.d.ts} +9 -0
- package/dist/core/claude/claude-mcp.d.ts.map +1 -0
- package/dist/core/{claude-mcp.js → claude/claude-mcp.js} +33 -3
- package/dist/core/claude/claude-mcp.js.map +1 -0
- package/dist/core/claude/claude-md-generator.d.ts.map +1 -0
- package/dist/core/{claude-md-generator.js → claude/claude-md-generator.js} +2 -2
- package/dist/core/claude/claude-md-generator.js.map +1 -0
- package/dist/core/{claude-settings-manager.d.ts → claude/claude-settings-manager.d.ts} +12 -0
- package/dist/core/claude/claude-settings-manager.d.ts.map +1 -0
- package/dist/core/{claude-settings-manager.js → claude/claude-settings-manager.js} +81 -22
- package/dist/core/claude/claude-settings-manager.js.map +1 -0
- package/dist/core/{cli-bridge.d.ts → console/cli-bridge.d.ts} +2 -2
- package/dist/core/console/cli-bridge.d.ts.map +1 -0
- package/dist/core/{cli-bridge.js → console/cli-bridge.js} +3 -3
- package/dist/core/console/cli-bridge.js.map +1 -0
- package/dist/core/{detector.d.ts → detect/detector.d.ts} +16 -1
- package/dist/core/detect/detector.d.ts.map +1 -0
- package/dist/core/detect/detector.js +766 -0
- package/dist/core/detect/detector.js.map +1 -0
- package/dist/core/detect/library-registry.d.ts +40 -0
- package/dist/core/detect/library-registry.d.ts.map +1 -0
- package/dist/core/detect/library-registry.js +239 -0
- package/dist/core/detect/library-registry.js.map +1 -0
- package/dist/core/docs/docs-generator.d.ts.map +1 -0
- package/dist/core/{docs-generator.js → docs/docs-generator.js} +1 -1
- package/dist/core/docs/docs-generator.js.map +1 -0
- package/dist/core/docs/mcp-reference-generator.d.ts.map +1 -0
- package/dist/core/{mcp-reference-generator.js → docs/mcp-reference-generator.js} +2 -2
- package/dist/core/docs/mcp-reference-generator.js.map +1 -0
- package/dist/core/{generator.d.ts → generators/generator.d.ts} +3 -4
- package/dist/core/generators/generator.d.ts.map +1 -0
- package/dist/core/{generator.js → generators/generator.js} +42 -157
- package/dist/core/generators/generator.js.map +1 -0
- package/dist/core/{gitignore-generator.d.ts → generators/gitignore-generator.d.ts} +1 -1
- package/dist/core/generators/gitignore-generator.d.ts.map +1 -0
- package/dist/core/{gitignore-generator.js → generators/gitignore-generator.js} +1 -1
- package/dist/core/generators/gitignore-generator.js.map +1 -0
- package/dist/core/generators/minimal-scaffolder.d.ts.map +1 -0
- package/dist/core/{minimal-scaffolder.js → generators/minimal-scaffolder.js} +2 -2
- package/dist/core/generators/minimal-scaffolder.js.map +1 -0
- package/dist/core/{rules-generator.d.ts → generators/rules-generator.d.ts} +2 -6
- package/dist/core/generators/rules-generator.d.ts.map +1 -0
- package/dist/core/{rules-generator.js → generators/rules-generator.js} +41 -2
- package/dist/core/generators/rules-generator.js.map +1 -0
- package/dist/core/{workflow-generator.d.ts → generators/workflow-generator.d.ts} +1 -1
- package/dist/core/generators/workflow-generator.d.ts.map +1 -0
- package/dist/core/{workflow-generator.js → generators/workflow-generator.js} +2 -3
- package/dist/core/generators/workflow-generator.js.map +1 -0
- package/dist/core/{multi-tool-generator.d.ts → ide/multi-tool-generator.d.ts} +1 -1
- package/dist/core/ide/multi-tool-generator.d.ts.map +1 -0
- package/dist/core/{multi-tool-generator.js → ide/multi-tool-generator.js} +1 -1
- package/dist/core/ide/multi-tool-generator.js.map +1 -0
- package/dist/core/ide/opencode-generator.d.ts +72 -0
- package/dist/core/ide/opencode-generator.d.ts.map +1 -0
- package/dist/core/ide/opencode-generator.js +450 -0
- package/dist/core/ide/opencode-generator.js.map +1 -0
- package/dist/core/merger.d.ts +1 -1
- package/dist/core/merger.d.ts.map +1 -1
- package/dist/core/merger.js +5 -5
- package/dist/core/merger.js.map +1 -1
- package/dist/core/migrator.d.ts +0 -1
- package/dist/core/migrator.d.ts.map +1 -1
- package/dist/core/migrator.js +4 -29
- package/dist/core/migrator.js.map +1 -1
- package/dist/core/quality/coverage-checker.d.ts.map +1 -0
- package/dist/core/{coverage-checker.js → quality/coverage-checker.js} +2 -2
- package/dist/core/quality/coverage-checker.js.map +1 -0
- package/dist/core/quality/dependency-checker.d.ts.map +1 -0
- package/dist/core/{dependency-checker.js → quality/dependency-checker.js} +1 -1
- package/dist/core/quality/dependency-checker.js.map +1 -0
- package/dist/core/quality/doctor.d.ts.map +1 -0
- package/dist/core/{doctor.js → quality/doctor.js} +1 -67
- package/dist/core/quality/doctor.js.map +1 -0
- package/dist/core/quality/validator.d.ts.map +1 -0
- package/dist/core/{validator.js → quality/validator.js} +1 -1
- package/dist/core/quality/validator.js.map +1 -0
- package/dist/core/{skills-manager.d.ts → skills/skills-manager.d.ts} +1 -1
- package/dist/core/skills/skills-manager.d.ts.map +1 -0
- package/dist/core/{skills-manager.js → skills/skills-manager.js} +1 -25
- package/dist/core/skills/skills-manager.js.map +1 -0
- package/dist/core/{config-manager.d.ts → state/config-manager.d.ts} +1 -1
- package/dist/core/state/config-manager.d.ts.map +1 -0
- package/dist/core/{config-manager.js → state/config-manager.js} +2 -61
- package/dist/core/state/config-manager.js.map +1 -0
- package/dist/core/state/override-manager.d.ts.map +1 -0
- package/dist/core/{override-manager.js → state/override-manager.js} +1 -1
- package/dist/core/state/override-manager.js.map +1 -0
- package/dist/core/{state-writer.d.ts → state/state-writer.d.ts} +2 -3
- package/dist/core/state/state-writer.d.ts.map +1 -0
- package/dist/core/{state-writer.js → state/state-writer.js} +6 -9
- package/dist/core/state/state-writer.js.map +1 -0
- package/dist/core/state/version-bumper.d.ts.map +1 -0
- package/dist/core/{version-bumper.js → state/version-bumper.js} +1 -1
- package/dist/core/state/version-bumper.js.map +1 -0
- package/dist/core/{decision-manager.d.ts → tasks/decision-manager.d.ts} +1 -1
- package/dist/core/tasks/decision-manager.d.ts.map +1 -0
- package/dist/core/{decision-manager.js → tasks/decision-manager.js} +1 -1
- package/dist/core/tasks/decision-manager.js.map +1 -0
- package/dist/core/{knowledge-manager.d.ts → tasks/knowledge-manager.d.ts} +1 -1
- package/dist/core/tasks/knowledge-manager.d.ts.map +1 -0
- package/dist/core/{knowledge-manager.js → tasks/knowledge-manager.js} +1 -1
- package/dist/core/tasks/knowledge-manager.js.map +1 -0
- package/dist/core/{learn-manager.d.ts → tasks/learn-manager.d.ts} +1 -3
- package/dist/core/tasks/learn-manager.d.ts.map +1 -0
- package/dist/core/{learn-manager.js → tasks/learn-manager.js} +1 -39
- package/dist/core/tasks/learn-manager.js.map +1 -0
- package/dist/core/tasks/plans-manager.d.ts.map +1 -0
- package/dist/core/{plans-manager.js → tasks/plans-manager.js} +1 -1
- package/dist/core/tasks/plans-manager.js.map +1 -0
- package/dist/core/tasks/task-manager.d.ts.map +1 -0
- package/dist/core/{task-manager.js → tasks/task-manager.js} +2 -2
- package/dist/core/tasks/task-manager.js.map +1 -0
- package/dist/core/workspace/project-worker.d.ts +6 -6
- package/dist/core/workspace/project-worker.d.ts.map +1 -1
- package/dist/core/workspace/project-worker.js +6 -6
- package/dist/core/workspace/project-worker.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -176
- package/dist/index.js.map +1 -1
- package/dist/mcp/rulebook-server.d.ts.map +1 -1
- package/dist/mcp/rulebook-server.js +16 -960
- package/dist/mcp/rulebook-server.js.map +1 -1
- package/dist/memory/file-search.d.ts +43 -0
- package/dist/memory/file-search.d.ts.map +1 -0
- package/dist/memory/file-search.js +228 -0
- package/dist/memory/file-search.js.map +1 -0
- package/dist/memory/file-store.d.ts +99 -0
- package/dist/memory/file-store.d.ts.map +1 -0
- package/dist/memory/file-store.js +615 -0
- package/dist/memory/file-store.js.map +1 -0
- package/dist/memory/legacy-migrator.d.ts +27 -0
- package/dist/memory/legacy-migrator.d.ts.map +1 -0
- package/dist/memory/legacy-migrator.js +185 -0
- package/dist/memory/legacy-migrator.js.map +1 -0
- package/dist/memory/memory-manager.d.ts +25 -24
- package/dist/memory/memory-manager.d.ts.map +1 -1
- package/dist/memory/memory-manager.js +97 -140
- package/dist/memory/memory-manager.js.map +1 -1
- package/dist/memory/memory-types.d.ts +1 -1
- package/dist/memory/memory-types.d.ts.map +1 -1
- package/dist/types.d.ts +20 -118
- package/dist/types.d.ts.map +1 -1
- package/package.json +23 -27
- package/templates/agents/accessibility-reviewer.md +43 -43
- package/templates/agents/api-designer.md +42 -42
- package/templates/agents/architect.md +51 -51
- package/templates/agents/build-engineer.md +36 -36
- package/templates/agents/code-reviewer.md +47 -47
- package/templates/agents/compiler/codegen-debugger.md +34 -34
- package/templates/agents/compiler/stdlib-engineer.md +28 -28
- package/templates/agents/compiler/test-coverage-guardian.md +31 -31
- package/templates/agents/context-intelligence.md +50 -52
- package/templates/agents/database-architect.md +41 -41
- package/templates/agents/devops-engineer.md +42 -42
- package/templates/agents/docs-writer.md +38 -38
- package/templates/agents/game-engine/cpp-core-expert.md +35 -35
- package/templates/agents/game-engine/render-engineer.md +22 -22
- package/templates/agents/game-engine/shader-engineer.md +38 -38
- package/templates/agents/game-engine/systems-integration.md +43 -43
- package/templates/agents/generic/code-reviewer.md +41 -41
- package/templates/agents/generic/docs-writer.md +25 -25
- package/templates/agents/generic/project-manager.md +36 -36
- package/templates/agents/generic/researcher.md +34 -34
- package/templates/agents/generic/test-engineer.md +41 -41
- package/templates/agents/i18n-engineer.md +42 -42
- package/templates/agents/implementer.md +42 -42
- package/templates/agents/migration-engineer.md +42 -42
- package/templates/agents/mobile/platform-specialist.md +22 -22
- package/templates/agents/mobile/ui-engineer.md +22 -22
- package/templates/agents/performance-engineer.md +49 -49
- package/templates/agents/project-manager.md +215 -0
- package/templates/agents/quality-gatekeeper.md +205 -0
- package/templates/agents/refactoring-agent.md +41 -41
- package/templates/agents/researcher.md +38 -38
- package/templates/agents/security-reviewer.md +40 -40
- package/templates/agents/team-lead.md +37 -37
- package/templates/agents/tester.md +48 -48
- package/templates/agents/ux-reviewer.md +43 -43
- package/templates/agents/web-app/api-designer.md +22 -22
- package/templates/agents/web-app/backend-engineer.md +30 -30
- package/templates/agents/web-app/database-engineer.md +22 -22
- package/templates/agents/web-app/frontend-engineer.md +29 -29
- package/templates/agents/web-app/security-reviewer.md +32 -32
- package/templates/ci/rulebook-review.yml +26 -26
- package/templates/claude-workflows/bugfix.js +94 -0
- package/templates/claude-workflows/feature-pipeline.js +88 -0
- package/templates/claude-workflows/release-gate.js +64 -0
- package/templates/claude-workflows/review-fanout.js +118 -0
- package/templates/claude-workflows/rulebook-driver.js +343 -0
- package/templates/claude-workflows/spec-author.js +133 -0
- package/templates/cli/AIDER.md +49 -49
- package/templates/cli/AMAZON_Q.md +25 -25
- package/templates/cli/AUGGIE.md +32 -32
- package/templates/cli/CLAUDE.md +117 -117
- package/templates/cli/CLINE.md +99 -99
- package/templates/cli/CODEBUDDY.md +20 -20
- package/templates/cli/CODEIUM.md +20 -20
- package/templates/cli/CODEX.md +21 -21
- package/templates/cli/CONTINUE.md +34 -34
- package/templates/cli/CURSOR_CLI.md +62 -62
- package/templates/cli/FACTORY.md +18 -18
- package/templates/cli/GEMINI.md +35 -35
- package/templates/cli/KILOCODE.md +18 -18
- package/templates/cli/OPENCODE.md +85 -18
- package/templates/cli/_GENERIC_TEMPLATE.md +29 -29
- package/templates/commands/rulebook-decision-create.md +55 -55
- package/templates/commands/rulebook-decision-list.md +15 -15
- package/templates/commands/rulebook-knowledge-add.md +41 -41
- package/templates/commands/rulebook-knowledge-list.md +15 -15
- package/templates/commands/rulebook-learn-capture.md +41 -48
- package/templates/commands/rulebook-learn-list.md +13 -13
- package/templates/commands/rulebook-memory-save.md +48 -48
- package/templates/commands/rulebook-memory-search.md +47 -47
- package/templates/commands/rulebook-task-apply.md +67 -67
- package/templates/commands/rulebook-task-archive.md +94 -94
- package/templates/commands/rulebook-task-create.md +93 -93
- package/templates/commands/rulebook-task-list.md +42 -42
- package/templates/commands/rulebook-task-show.md +52 -52
- package/templates/commands/rulebook-task-validate.md +53 -53
- package/templates/compact-context/_default.md +23 -23
- package/templates/compact-context/cpp.md +26 -26
- package/templates/compact-context/go.md +26 -26
- package/templates/compact-context/python.md +26 -26
- package/templates/compact-context/rust.md +28 -28
- package/templates/compact-context/typescript.md +29 -29
- package/templates/core/AGENTS_LEAN.md +0 -14
- package/templates/core/AGENTS_OVERRIDE.md +16 -16
- package/templates/core/AGENT_AUTOMATION.md +296 -296
- package/templates/core/CLAUDE_MD_v2.md +90 -90
- package/templates/core/DAG.md +304 -304
- package/templates/core/DECISIONS.md +38 -38
- package/templates/core/DOCUMENTATION_RULES.md +36 -36
- package/templates/core/KNOWLEDGE.md +49 -49
- package/templates/core/MULTI_AGENT.md +74 -74
- package/templates/core/PLANS.md +28 -28
- package/templates/core/QUALITY_ENFORCEMENT.md +68 -68
- package/templates/core/RULEBOOK.md +1947 -1947
- package/templates/core/TIER1_PROHIBITIONS.md +154 -154
- package/templates/core/TOKEN_OPTIMIZATION.md +49 -49
- package/templates/git/CI_CD_PATTERNS.md +661 -661
- package/templates/git/GITHUB_ACTIONS.md +728 -728
- package/templates/git/GITLAB_CI.md +730 -730
- package/templates/git/GIT_WORKFLOW.md +1192 -1192
- package/templates/git/SECRETS_MANAGEMENT.md +585 -585
- package/templates/hooks/COMMIT_MSG.md +530 -530
- package/templates/hooks/POST_CHECKOUT.md +546 -546
- package/templates/hooks/PREPARE_COMMIT_MSG.md +619 -619
- package/templates/hooks/PRE_COMMIT.md +414 -414
- package/templates/hooks/PRE_PUSH.md +601 -601
- package/templates/hooks/check-context-and-handoff.sh +24 -16
- package/templates/hooks/enforce-pre-tool.sh +70 -0
- package/templates/hooks/terse-mode-tracker.sh +146 -143
- package/templates/hooks/update-check.ps1 +84 -0
- package/templates/hooks/update-check.sh +103 -0
- package/templates/ides/CONTINUE_RULES.md +16 -16
- package/templates/ides/COPILOT_INSTRUCTIONS.md +23 -23
- package/templates/ides/GEMINI_RULES.md +17 -17
- package/templates/ides/OPENCODE.md +63 -0
- package/templates/ides/WINDSURF_RULES.md +14 -14
- package/templates/languages/C.md +333 -333
- package/templates/languages/CPP.md +743 -743
- package/templates/languages/CSHARP.md +417 -417
- package/templates/languages/ELIXIR.md +454 -454
- package/templates/languages/ERLANG.md +361 -361
- package/templates/languages/GO.md +645 -645
- package/templates/languages/HASKELL.md +177 -177
- package/templates/languages/JAVA.md +607 -607
- package/templates/languages/JAVASCRIPT.md +631 -631
- package/templates/languages/JULIA.md +97 -97
- package/templates/languages/KOTLIN.md +511 -511
- package/templates/languages/LISP.md +100 -100
- package/templates/languages/LUA.md +74 -74
- package/templates/languages/OBJECTIVEC.md +90 -90
- package/templates/languages/PHP.md +416 -416
- package/templates/languages/PYTHON.md +682 -682
- package/templates/languages/RUBY.md +421 -421
- package/templates/languages/RUST.md +477 -477
- package/templates/languages/SAS.md +73 -73
- package/templates/languages/SCALA.md +348 -348
- package/templates/languages/SOLIDITY.md +580 -580
- package/templates/languages/SQL.md +137 -137
- package/templates/languages/SWIFT.md +466 -466
- package/templates/languages/TYPESCRIPT.md +591 -591
- package/templates/languages/ZIG.md +265 -265
- package/templates/libraries/go/ECHO.md +18 -0
- package/templates/libraries/go/GIN.md +18 -0
- package/templates/libraries/go/GORM.md +18 -0
- package/templates/libraries/python/DJANGO.md +18 -0
- package/templates/libraries/python/FASTAPI.md +18 -0
- package/templates/libraries/python/FLASK.md +17 -0
- package/templates/libraries/python/PYDANTIC.md +17 -0
- package/templates/libraries/python/PYTEST.md +17 -0
- package/templates/libraries/python/SQLALCHEMY.md +17 -0
- package/templates/libraries/rust/ACTIX.md +17 -0
- package/templates/libraries/rust/AXUM.md +18 -0
- package/templates/libraries/rust/SERDE.md +16 -0
- package/templates/libraries/rust/SQLX.md +17 -0
- package/templates/libraries/rust/TOKIO.md +16 -0
- package/templates/libraries/typescript/ANGULAR.md +17 -0
- package/templates/libraries/typescript/DRIZZLE.md +16 -0
- package/templates/libraries/typescript/EXPRESS.md +17 -0
- package/templates/libraries/typescript/HEROUI.md +16 -0
- package/templates/libraries/typescript/JEST.md +17 -0
- package/templates/libraries/typescript/NESTJS.md +17 -0
- package/templates/libraries/typescript/NEXT.md +18 -0
- package/templates/libraries/typescript/PRISMA.md +16 -0
- package/templates/libraries/typescript/RADIX.md +16 -0
- package/templates/libraries/typescript/REACT.md +18 -0
- package/templates/libraries/typescript/SHADCN.md +16 -0
- package/templates/libraries/typescript/SVELTE.md +16 -0
- package/templates/libraries/typescript/TAILWIND.md +16 -0
- package/templates/libraries/typescript/TRPC.md +16 -0
- package/templates/libraries/typescript/VITEST.md +17 -0
- package/templates/libraries/typescript/VUE.md +17 -0
- package/templates/libraries/typescript/ZOD.md +17 -0
- package/templates/modules/ATLASSIAN.md +255 -255
- package/templates/modules/CONTEXT7.md +54 -54
- package/templates/modules/FIGMA.md +267 -267
- package/templates/modules/GITHUB_MCP.md +64 -64
- package/templates/modules/GRAFANA.md +328 -328
- package/templates/modules/MEMORY.md +126 -126
- package/templates/modules/NOTION.md +247 -247
- package/templates/modules/PLAYWRIGHT.md +90 -90
- package/templates/modules/RULEBOOK_MCP.md +208 -208
- package/templates/modules/SERENA.md +337 -337
- package/templates/modules/SUPABASE.md +223 -223
- package/templates/modules/SYNAP.md +69 -69
- package/templates/modules/VECTORIZER.md +63 -63
- package/templates/modules/sequential-thinking.md +42 -42
- package/templates/rules/consult-analysis-before-implementing.md +23 -23
- package/templates/rules/cpp.md +46 -46
- package/templates/rules/csharp.md +44 -44
- package/templates/rules/diagnostic-first.md +39 -39
- package/templates/rules/fail-twice-escalate.md +46 -46
- package/templates/rules/follow-task-sequence.md +36 -36
- package/templates/rules/git-safety.md +29 -29
- package/templates/rules/go.md +40 -40
- package/templates/rules/incremental-implementation.md +56 -56
- package/templates/rules/incremental-tests.md +29 -29
- package/templates/rules/java.md +43 -43
- package/templates/rules/javascript.md +39 -39
- package/templates/rules/knowledge-base-usage.md +41 -41
- package/templates/rules/multi-agent-teams.md +75 -75
- package/templates/rules/no-deferred.md +31 -31
- package/templates/rules/no-shortcuts.md +30 -30
- package/templates/rules/python.md +43 -43
- package/templates/rules/research-first.md +30 -30
- package/templates/rules/respect-handoff-trigger.md +41 -41
- package/templates/rules/rust.md +40 -40
- package/templates/rules/sequential-editing.md +21 -21
- package/templates/rules/session-workflow.md +24 -24
- package/templates/rules/task-decomposition.md +32 -32
- package/templates/rules/typescript.md +40 -40
- package/templates/skills/cli/aider/SKILL.md +59 -59
- package/templates/skills/cli/amazon-q/SKILL.md +35 -35
- package/templates/skills/cli/auggie/SKILL.md +42 -42
- package/templates/skills/cli/claude/SKILL.md +42 -42
- package/templates/skills/cli/cline/SKILL.md +42 -42
- package/templates/skills/cli/codebuddy/SKILL.md +30 -30
- package/templates/skills/cli/codeium/SKILL.md +30 -30
- package/templates/skills/cli/codex/SKILL.md +31 -31
- package/templates/skills/cli/continue/SKILL.md +44 -44
- package/templates/skills/cli/cursor-cli/SKILL.md +38 -38
- package/templates/skills/cli/factory/SKILL.md +28 -28
- package/templates/skills/cli/gemini/SKILL.md +45 -45
- package/templates/skills/cli/kilocode/SKILL.md +28 -28
- package/templates/skills/cli/opencode/SKILL.md +82 -28
- package/templates/skills/core/agent-automation/SKILL.md +194 -194
- package/templates/skills/core/dag/SKILL.md +314 -314
- package/templates/skills/core/documentation-rules/SKILL.md +46 -46
- package/templates/skills/core/quality-enforcement/SKILL.md +78 -78
- package/templates/skills/core/rulebook/SKILL.md +176 -176
- package/templates/skills/core/rulebook-terse/SKILL.md +116 -116
- package/templates/skills/core/rulebook-terse-commit/SKILL.md +96 -96
- package/templates/skills/core/rulebook-terse-review/SKILL.md +112 -112
- package/templates/skills/dev/accessibility/SKILL.md +17 -17
- package/templates/skills/dev/analysis/SKILL.md +19 -19
- package/templates/skills/dev/api-design/SKILL.md +15 -15
- package/templates/skills/dev/architect/SKILL.md +17 -17
- package/templates/skills/dev/build-fix/SKILL.md +17 -17
- package/templates/skills/dev/db-design/SKILL.md +15 -15
- package/templates/skills/dev/debug/SKILL.md +16 -16
- package/templates/skills/dev/deploy/SKILL.md +17 -17
- package/templates/skills/dev/docs/SKILL.md +17 -17
- package/templates/skills/dev/handoff/SKILL.md +27 -27
- package/templates/skills/dev/migrate/SKILL.md +15 -15
- package/templates/skills/dev/perf/SKILL.md +17 -17
- package/templates/skills/dev/refactor/SKILL.md +17 -17
- package/templates/skills/dev/research/SKILL.md +14 -14
- package/templates/skills/dev/review/SKILL.md +18 -18
- package/templates/skills/dev/security-audit/SKILL.md +17 -17
- package/templates/skills/dev/spec/SKILL.md +65 -0
- package/templates/skills/ides/copilot/SKILL.md +47 -47
- package/templates/skills/ides/cursor/SKILL.md +53 -53
- package/templates/skills/ides/jetbrains-ai/SKILL.md +45 -45
- package/templates/skills/ides/replit/SKILL.md +46 -46
- package/templates/skills/ides/tabnine/SKILL.md +39 -39
- package/templates/skills/ides/vscode/SKILL.md +50 -50
- package/templates/skills/ides/windsurf/SKILL.md +46 -46
- package/templates/skills/ides/zed/SKILL.md +42 -42
- package/templates/skills/languages/c/SKILL.md +343 -343
- package/templates/skills/languages/cpp/SKILL.md +753 -753
- package/templates/skills/languages/csharp/SKILL.md +427 -427
- package/templates/skills/languages/elixir/SKILL.md +464 -464
- package/templates/skills/languages/erlang/SKILL.md +371 -371
- package/templates/skills/languages/go/SKILL.md +655 -655
- package/templates/skills/languages/haskell/SKILL.md +187 -187
- package/templates/skills/languages/java/SKILL.md +617 -617
- package/templates/skills/languages/javascript/SKILL.md +641 -641
- package/templates/skills/languages/julia/SKILL.md +107 -107
- package/templates/skills/languages/kotlin/SKILL.md +521 -521
- package/templates/skills/languages/lisp/SKILL.md +110 -110
- package/templates/skills/languages/lua/SKILL.md +84 -84
- package/templates/skills/languages/objectivec/SKILL.md +100 -100
- package/templates/skills/languages/php/SKILL.md +426 -426
- package/templates/skills/languages/python/SKILL.md +692 -692
- package/templates/skills/languages/ruby/SKILL.md +431 -431
- package/templates/skills/languages/rust/SKILL.md +487 -487
- package/templates/skills/languages/sas/SKILL.md +83 -83
- package/templates/skills/languages/scala/SKILL.md +358 -358
- package/templates/skills/languages/solidity/SKILL.md +590 -590
- package/templates/skills/languages/sql/SKILL.md +147 -147
- package/templates/skills/languages/swift/SKILL.md +476 -476
- package/templates/skills/languages/typescript/SKILL.md +302 -302
- package/templates/skills/languages/zig/SKILL.md +275 -275
- package/templates/skills/modules/atlassian/SKILL.md +265 -265
- package/templates/skills/modules/context7/SKILL.md +64 -64
- package/templates/skills/modules/figma/SKILL.md +277 -277
- package/templates/skills/modules/github-mcp/SKILL.md +74 -74
- package/templates/skills/modules/grafana/SKILL.md +338 -338
- package/templates/skills/modules/memory/SKILL.md +73 -73
- package/templates/skills/modules/notion/SKILL.md +257 -257
- package/templates/skills/modules/playwright/SKILL.md +100 -100
- package/templates/skills/modules/rulebook-mcp/SKILL.md +166 -166
- package/templates/skills/modules/serena/SKILL.md +347 -347
- package/templates/skills/modules/supabase/SKILL.md +233 -233
- package/templates/skills/modules/synap/SKILL.md +79 -79
- package/templates/skills/modules/vectorizer/SKILL.md +73 -73
- package/.claude/commands/ralph-config.md +0 -112
- package/.claude/commands/ralph-history.md +0 -110
- package/.claude/commands/ralph-init.md +0 -72
- package/.claude/commands/ralph-pause-resume.md +0 -105
- package/.claude/commands/ralph-run.md +0 -101
- package/.claude/commands/ralph-status.md +0 -76
- package/dist/agents/ralph-parser.d.ts +0 -91
- package/dist/agents/ralph-parser.d.ts.map +0 -1
- package/dist/agents/ralph-parser.js +0 -415
- package/dist/agents/ralph-parser.js.map +0 -1
- package/dist/cli/commands/analysis.d.ts +0 -8
- package/dist/cli/commands/analysis.d.ts.map +0 -1
- package/dist/cli/commands/analysis.js +0 -78
- package/dist/cli/commands/analysis.js.map +0 -1
- package/dist/cli/commands/compress.d.ts +0 -18
- package/dist/cli/commands/compress.d.ts.map +0 -1
- package/dist/cli/commands/compress.js +0 -100
- package/dist/cli/commands/compress.js.map +0 -1
- package/dist/cli/commands/ralph.d.ts +0 -45
- package/dist/cli/commands/ralph.d.ts.map +0 -1
- package/dist/cli/commands/ralph.js +0 -694
- package/dist/cli/commands/ralph.js.map +0 -1
- package/dist/cli/docs-prompts.d.ts +0 -3
- package/dist/cli/docs-prompts.d.ts.map +0 -1
- package/dist/cli/docs-prompts.js +0 -45
- package/dist/cli/docs-prompts.js.map +0 -1
- package/dist/core/agent-manager.d.ts +0 -69
- package/dist/core/agent-manager.d.ts.map +0 -1
- package/dist/core/agent-manager.js +0 -476
- package/dist/core/agent-manager.js.map +0 -1
- package/dist/core/agent-template-engine.d.ts +0 -51
- package/dist/core/agent-template-engine.d.ts.map +0 -1
- package/dist/core/agent-template-engine.js +0 -291
- package/dist/core/agent-template-engine.js.map +0 -1
- package/dist/core/analysis-manager.d.ts +0 -56
- package/dist/core/analysis-manager.d.ts.map +0 -1
- package/dist/core/analysis-manager.js +0 -218
- package/dist/core/analysis-manager.js.map +0 -1
- package/dist/core/auto-fixer.d.ts +0 -14
- package/dist/core/auto-fixer.d.ts.map +0 -1
- package/dist/core/auto-fixer.js +0 -207
- package/dist/core/auto-fixer.js.map +0 -1
- package/dist/core/changelog-generator.d.ts +0 -44
- package/dist/core/changelog-generator.d.ts.map +0 -1
- package/dist/core/changelog-generator.js +0 -222
- package/dist/core/changelog-generator.js.map +0 -1
- package/dist/core/claude-mcp.d.ts.map +0 -1
- package/dist/core/claude-mcp.js.map +0 -1
- package/dist/core/claude-md-generator.d.ts.map +0 -1
- package/dist/core/claude-md-generator.js.map +0 -1
- package/dist/core/claude-settings-manager.d.ts.map +0 -1
- package/dist/core/claude-settings-manager.js.map +0 -1
- package/dist/core/cli-bridge.d.ts.map +0 -1
- package/dist/core/cli-bridge.js.map +0 -1
- package/dist/core/compact-context-manager.d.ts +0 -34
- package/dist/core/compact-context-manager.d.ts.map +0 -1
- package/dist/core/compact-context-manager.js +0 -60
- package/dist/core/compact-context-manager.js.map +0 -1
- package/dist/core/complexity-detector.d.ts +0 -36
- package/dist/core/complexity-detector.d.ts.map +0 -1
- package/dist/core/complexity-detector.js +0 -334
- package/dist/core/complexity-detector.js.map +0 -1
- package/dist/core/compress/compressor.d.ts +0 -60
- package/dist/core/compress/compressor.d.ts.map +0 -1
- package/dist/core/compress/compressor.js +0 -232
- package/dist/core/compress/compressor.js.map +0 -1
- package/dist/core/compress/discover.d.ts +0 -19
- package/dist/core/compress/discover.d.ts.map +0 -1
- package/dist/core/compress/discover.js +0 -100
- package/dist/core/compress/discover.js.map +0 -1
- package/dist/core/compress/validator.d.ts +0 -47
- package/dist/core/compress/validator.d.ts.map +0 -1
- package/dist/core/compress/validator.js +0 -131
- package/dist/core/compress/validator.js.map +0 -1
- package/dist/core/config-manager.d.ts.map +0 -1
- package/dist/core/config-manager.js.map +0 -1
- package/dist/core/coverage-checker.d.ts.map +0 -1
- package/dist/core/coverage-checker.js.map +0 -1
- package/dist/core/cursor-mdc-generator.d.ts +0 -30
- package/dist/core/cursor-mdc-generator.d.ts.map +0 -1
- package/dist/core/cursor-mdc-generator.js +0 -98
- package/dist/core/cursor-mdc-generator.js.map +0 -1
- package/dist/core/decision-manager.d.ts.map +0 -1
- package/dist/core/decision-manager.js.map +0 -1
- package/dist/core/dependency-checker.d.ts.map +0 -1
- package/dist/core/dependency-checker.js.map +0 -1
- package/dist/core/detector.d.ts.map +0 -1
- package/dist/core/detector.js +0 -1763
- package/dist/core/detector.js.map +0 -1
- package/dist/core/docs-generator.d.ts.map +0 -1
- package/dist/core/docs-generator.js.map +0 -1
- package/dist/core/doctor.d.ts.map +0 -1
- package/dist/core/doctor.js.map +0 -1
- package/dist/core/generator.d.ts.map +0 -1
- package/dist/core/generator.js.map +0 -1
- package/dist/core/github-issues-importer.d.ts +0 -82
- package/dist/core/github-issues-importer.d.ts.map +0 -1
- package/dist/core/github-issues-importer.js +0 -161
- package/dist/core/github-issues-importer.js.map +0 -1
- package/dist/core/gitignore-generator.d.ts.map +0 -1
- package/dist/core/gitignore-generator.js.map +0 -1
- package/dist/core/health-scorer.d.ts +0 -61
- package/dist/core/health-scorer.d.ts.map +0 -1
- package/dist/core/health-scorer.js +0 -638
- package/dist/core/health-scorer.js.map +0 -1
- package/dist/core/iteration-tracker.d.ts +0 -85
- package/dist/core/iteration-tracker.d.ts.map +0 -1
- package/dist/core/iteration-tracker.js +0 -295
- package/dist/core/iteration-tracker.js.map +0 -1
- package/dist/core/knowledge-manager.d.ts.map +0 -1
- package/dist/core/knowledge-manager.js.map +0 -1
- package/dist/core/learn-manager.d.ts.map +0 -1
- package/dist/core/learn-manager.js.map +0 -1
- package/dist/core/mcp-reference-generator.d.ts.map +0 -1
- package/dist/core/mcp-reference-generator.js.map +0 -1
- package/dist/core/minimal-scaffolder.d.ts.map +0 -1
- package/dist/core/minimal-scaffolder.js.map +0 -1
- package/dist/core/modern-console.d.ts +0 -98
- package/dist/core/modern-console.d.ts.map +0 -1
- package/dist/core/modern-console.js +0 -556
- package/dist/core/modern-console.js.map +0 -1
- package/dist/core/multi-tool-generator.d.ts.map +0 -1
- package/dist/core/multi-tool-generator.js.map +0 -1
- package/dist/core/override-manager.d.ts.map +0 -1
- package/dist/core/override-manager.js.map +0 -1
- package/dist/core/plans-manager.d.ts.map +0 -1
- package/dist/core/plans-manager.js.map +0 -1
- package/dist/core/prd-generator.d.ts +0 -48
- package/dist/core/prd-generator.d.ts.map +0 -1
- package/dist/core/prd-generator.js +0 -233
- package/dist/core/prd-generator.js.map +0 -1
- package/dist/core/ralph-manager.d.ts +0 -163
- package/dist/core/ralph-manager.d.ts.map +0 -1
- package/dist/core/ralph-manager.js +0 -555
- package/dist/core/ralph-manager.js.map +0 -1
- package/dist/core/ralph-parallel.d.ts +0 -55
- package/dist/core/ralph-parallel.d.ts.map +0 -1
- package/dist/core/ralph-parallel.js +0 -201
- package/dist/core/ralph-parallel.js.map +0 -1
- package/dist/core/ralph-plan-checkpoint.d.ts +0 -58
- package/dist/core/ralph-plan-checkpoint.d.ts.map +0 -1
- package/dist/core/ralph-plan-checkpoint.js +0 -154
- package/dist/core/ralph-plan-checkpoint.js.map +0 -1
- package/dist/core/ralph-scripts.d.ts +0 -12
- package/dist/core/ralph-scripts.d.ts.map +0 -1
- package/dist/core/ralph-scripts.js +0 -50
- package/dist/core/ralph-scripts.js.map +0 -1
- package/dist/core/review-manager.d.ts +0 -74
- package/dist/core/review-manager.d.ts.map +0 -1
- package/dist/core/review-manager.js +0 -371
- package/dist/core/review-manager.js.map +0 -1
- package/dist/core/rules-generator.d.ts.map +0 -1
- package/dist/core/rules-generator.js.map +0 -1
- package/dist/core/skills-manager.d.ts.map +0 -1
- package/dist/core/skills-manager.js.map +0 -1
- package/dist/core/state-writer.d.ts.map +0 -1
- package/dist/core/state-writer.js.map +0 -1
- package/dist/core/task-manager.d.ts.map +0 -1
- package/dist/core/task-manager.js.map +0 -1
- package/dist/core/telemetry.d.ts +0 -29
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js +0 -57
- package/dist/core/telemetry.js.map +0 -1
- package/dist/core/validator.d.ts.map +0 -1
- package/dist/core/validator.js.map +0 -1
- package/dist/core/version-bumper.d.ts.map +0 -1
- package/dist/core/version-bumper.js.map +0 -1
- package/dist/core/watcher.d.ts +0 -9
- package/dist/core/watcher.d.ts.map +0 -1
- package/dist/core/watcher.js +0 -22
- package/dist/core/watcher.js.map +0 -1
- package/dist/core/workflow-generator.d.ts.map +0 -1
- package/dist/core/workflow-generator.js.map +0 -1
- package/dist/hooks/terse-activate.d.ts +0 -59
- package/dist/hooks/terse-activate.d.ts.map +0 -1
- package/dist/hooks/terse-activate.js +0 -149
- package/dist/hooks/terse-activate.js.map +0 -1
- package/dist/hooks/terse-config.d.ts +0 -51
- package/dist/hooks/terse-config.d.ts.map +0 -1
- package/dist/hooks/terse-config.js +0 -130
- package/dist/hooks/terse-config.js.map +0 -1
- package/dist/hooks/terse-mode-tracker.d.ts +0 -78
- package/dist/hooks/terse-mode-tracker.d.ts.map +0 -1
- package/dist/hooks/terse-mode-tracker.js +0 -213
- package/dist/hooks/terse-mode-tracker.js.map +0 -1
- package/dist/memory/hnsw-index.d.ts +0 -68
- package/dist/memory/hnsw-index.d.ts.map +0 -1
- package/dist/memory/hnsw-index.js +0 -544
- package/dist/memory/hnsw-index.js.map +0 -1
- package/dist/memory/memory-cache.d.ts +0 -33
- package/dist/memory/memory-cache.d.ts.map +0 -1
- package/dist/memory/memory-cache.js +0 -85
- package/dist/memory/memory-cache.js.map +0 -1
- package/dist/memory/memory-search.d.ts +0 -42
- package/dist/memory/memory-search.d.ts.map +0 -1
- package/dist/memory/memory-search.js +0 -180
- package/dist/memory/memory-search.js.map +0 -1
- package/dist/memory/memory-store.d.ts +0 -84
- package/dist/memory/memory-store.d.ts.map +0 -1
- package/dist/memory/memory-store.js +0 -566
- package/dist/memory/memory-store.js.map +0 -1
- package/dist/memory/memory-vectorizer.d.ts +0 -29
- package/dist/memory/memory-vectorizer.d.ts.map +0 -1
- package/dist/memory/memory-vectorizer.js +0 -199
- package/dist/memory/memory-vectorizer.js.map +0 -1
- package/templates/core/RALPH.md +0 -471
- package/templates/frameworks/ANGULAR.md +0 -36
- package/templates/frameworks/DJANGO.md +0 -83
- package/templates/frameworks/ELECTRON.md +0 -147
- package/templates/frameworks/FLASK.md +0 -38
- package/templates/frameworks/FLUTTER.md +0 -55
- package/templates/frameworks/JQUERY.md +0 -32
- package/templates/frameworks/LARAVEL.md +0 -38
- package/templates/frameworks/NESTJS.md +0 -43
- package/templates/frameworks/NEXTJS.md +0 -127
- package/templates/frameworks/NUXT.md +0 -40
- package/templates/frameworks/RAILS.md +0 -66
- package/templates/frameworks/REACT.md +0 -38
- package/templates/frameworks/REACT_NATIVE.md +0 -47
- package/templates/frameworks/SPRING.md +0 -39
- package/templates/frameworks/SYMFONY.md +0 -36
- package/templates/frameworks/VUE.md +0 -36
- package/templates/frameworks/ZEND.md +0 -35
- package/templates/hooks/enforce-mcp-for-tasks.sh +0 -31
- package/templates/hooks/enforce-no-deferred.sh +0 -21
- package/templates/hooks/enforce-no-shortcuts.sh +0 -31
- package/templates/ides/COPILOT.md +0 -37
- package/templates/ides/CURSOR.md +0 -43
- package/templates/ides/JETBRAINS_AI.md +0 -35
- package/templates/ides/REPLIT.md +0 -36
- package/templates/ides/TABNINE.md +0 -29
- package/templates/ides/VSCODE.md +0 -40
- package/templates/ides/WINDSURF.md +0 -36
- package/templates/ides/ZED.md +0 -32
- package/templates/ides/cursor-mdc/go.mdc +0 -24
- package/templates/ides/cursor-mdc/python.mdc +0 -24
- package/templates/ides/cursor-mdc/quality.mdc +0 -25
- package/templates/ides/cursor-mdc/ralph.mdc +0 -39
- package/templates/ides/cursor-mdc/rulebook.mdc +0 -38
- package/templates/ides/cursor-mdc/rust.mdc +0 -24
- package/templates/ides/cursor-mdc/typescript.mdc +0 -25
- package/templates/ralph/ralph-history.bat +0 -4
- package/templates/ralph/ralph-history.sh +0 -5
- package/templates/ralph/ralph-init.bat +0 -5
- package/templates/ralph/ralph-init.sh +0 -5
- package/templates/ralph/ralph-pause.bat +0 -5
- package/templates/ralph/ralph-pause.sh +0 -5
- package/templates/ralph/ralph-run.bat +0 -5
- package/templates/ralph/ralph-run.sh +0 -5
- package/templates/ralph/ralph-status.bat +0 -4
- package/templates/ralph/ralph-status.sh +0 -5
- package/templates/services/AZURE_BLOB.md +0 -184
- package/templates/services/CASSANDRA.md +0 -239
- package/templates/services/DATADOG.md +0 -26
- package/templates/services/DOCKER.md +0 -124
- package/templates/services/DOCKER_COMPOSE.md +0 -168
- package/templates/services/DYNAMODB.md +0 -308
- package/templates/services/ELASTICSEARCH.md +0 -347
- package/templates/services/GCS.md +0 -178
- package/templates/services/HELM.md +0 -194
- package/templates/services/INFLUXDB.md +0 -265
- package/templates/services/KAFKA.md +0 -341
- package/templates/services/KUBERNETES.md +0 -208
- package/templates/services/MARIADB.md +0 -183
- package/templates/services/MEMCACHED.md +0 -242
- package/templates/services/MINIO.md +0 -201
- package/templates/services/MONGODB.md +0 -268
- package/templates/services/MYSQL.md +0 -358
- package/templates/services/NEO4J.md +0 -247
- package/templates/services/OPENTELEMETRY.md +0 -25
- package/templates/services/ORACLE.md +0 -290
- package/templates/services/PINO.md +0 -24
- package/templates/services/POSTGRESQL.md +0 -326
- package/templates/services/PROMETHEUS.md +0 -33
- package/templates/services/RABBITMQ.md +0 -286
- package/templates/services/REDIS.md +0 -292
- package/templates/services/S3.md +0 -298
- package/templates/services/SENTRY.md +0 -23
- package/templates/services/SQLITE.md +0 -294
- package/templates/services/SQLSERVER.md +0 -294
- package/templates/services/WINSTON.md +0 -30
- package/templates/skills/frameworks/angular/SKILL.md +0 -46
- package/templates/skills/frameworks/django/SKILL.md +0 -93
- package/templates/skills/frameworks/electron/SKILL.md +0 -157
- package/templates/skills/frameworks/flask/SKILL.md +0 -48
- package/templates/skills/frameworks/flutter/SKILL.md +0 -65
- package/templates/skills/frameworks/jquery/SKILL.md +0 -42
- package/templates/skills/frameworks/laravel/SKILL.md +0 -48
- package/templates/skills/frameworks/nestjs/SKILL.md +0 -53
- package/templates/skills/frameworks/nextjs/SKILL.md +0 -137
- package/templates/skills/frameworks/nuxt/SKILL.md +0 -50
- package/templates/skills/frameworks/rails/SKILL.md +0 -76
- package/templates/skills/frameworks/react/SKILL.md +0 -48
- package/templates/skills/frameworks/react-native/SKILL.md +0 -57
- package/templates/skills/frameworks/spring/SKILL.md +0 -49
- package/templates/skills/frameworks/symfony/SKILL.md +0 -46
- package/templates/skills/frameworks/vue/SKILL.md +0 -46
- package/templates/skills/frameworks/zend/SKILL.md +0 -45
- package/templates/skills/services/azure-blob/SKILL.md +0 -194
- package/templates/skills/services/cassandra/SKILL.md +0 -249
- package/templates/skills/services/dynamodb/SKILL.md +0 -318
- package/templates/skills/services/elasticsearch/SKILL.md +0 -357
- package/templates/skills/services/gcs/SKILL.md +0 -188
- package/templates/skills/services/influxdb/SKILL.md +0 -275
- package/templates/skills/services/kafka/SKILL.md +0 -351
- package/templates/skills/services/mariadb/SKILL.md +0 -193
- package/templates/skills/services/memcached/SKILL.md +0 -252
- package/templates/skills/services/minio/SKILL.md +0 -211
- package/templates/skills/services/mongodb/SKILL.md +0 -278
- package/templates/skills/services/mysql/SKILL.md +0 -368
- package/templates/skills/services/neo4j/SKILL.md +0 -257
- package/templates/skills/services/oracle/SKILL.md +0 -300
- package/templates/skills/services/postgresql/SKILL.md +0 -336
- package/templates/skills/services/rabbitmq/SKILL.md +0 -296
- package/templates/skills/services/redis/SKILL.md +0 -302
- package/templates/skills/services/s3/SKILL.md +0 -308
- package/templates/skills/services/sqlite/SKILL.md +0 -304
- package/templates/skills/services/sqlserver/SKILL.md +0 -304
- package/templates/skills/workflows/ralph/SETUP.md +0 -228
- package/templates/skills/workflows/ralph/SKILL.md +0 -309
- package/templates/skills/workflows/ralph/install.sh +0 -87
- package/templates/skills/workflows/ralph/manifest.json +0 -158
- /package/dist/core/{claude-md-generator.d.ts → claude/claude-md-generator.d.ts} +0 -0
- /package/dist/core/{docs-generator.d.ts → docs/docs-generator.d.ts} +0 -0
- /package/dist/core/{mcp-reference-generator.d.ts → docs/mcp-reference-generator.d.ts} +0 -0
- /package/dist/core/{minimal-scaffolder.d.ts → generators/minimal-scaffolder.d.ts} +0 -0
- /package/dist/core/{coverage-checker.d.ts → quality/coverage-checker.d.ts} +0 -0
- /package/dist/core/{dependency-checker.d.ts → quality/dependency-checker.d.ts} +0 -0
- /package/dist/core/{doctor.d.ts → quality/doctor.d.ts} +0 -0
- /package/dist/core/{validator.d.ts → quality/validator.d.ts} +0 -0
- /package/dist/core/{override-manager.d.ts → state/override-manager.d.ts} +0 -0
- /package/dist/core/{version-bumper.d.ts → state/version-bumper.d.ts} +0 -0
- /package/dist/core/{plans-manager.d.ts → tasks/plans-manager.d.ts} +0 -0
- /package/dist/core/{task-manager.d.ts → tasks/task-manager.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-migrator.d.ts","sourceRoot":"","sources":["../../src/memory/legacy-migrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAqHD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,cAAc,CAAC,CAmDzB"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-shot legacy SQLite → markdown migrator.
|
|
3
|
+
*
|
|
4
|
+
* Lazily imported only when an existing `memory.db` is detected on the
|
|
5
|
+
* first `MemoryManager.initialize()`. Reads memories + sessions from the
|
|
6
|
+
* legacy DB (using `better-sqlite3` if available, otherwise `sql.js` as a
|
|
7
|
+
* fallback) and writes one markdown file per row via `FileStore`.
|
|
8
|
+
*
|
|
9
|
+
* After the manager renames `memory.db` → `memory.db.legacy` neither
|
|
10
|
+
* sql.js nor better-sqlite3 is loaded again at runtime. The migrator
|
|
11
|
+
* itself isolates those imports inside try-blocks so a missing native
|
|
12
|
+
* binary is non-fatal — the user keeps the markdown migration that
|
|
13
|
+
* already succeeded for the rows the fallback could read.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, readFileSync } from 'fs';
|
|
16
|
+
async function openDb(dbPath) {
|
|
17
|
+
try {
|
|
18
|
+
// better-sqlite3 is an optional native dep — keep the import indirect so
|
|
19
|
+
// tsc does not require its type declarations when the package is absent
|
|
20
|
+
// (matches the sql.js pattern below).
|
|
21
|
+
const moduleName = 'better-sqlite3';
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
const mod = await import(moduleName);
|
|
24
|
+
const Database = mod.default ?? mod;
|
|
25
|
+
const db = new Database(dbPath, { readonly: true });
|
|
26
|
+
return db;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Fall through to sql.js
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
// sql.js is deprecated as a runtime dep in v5.6 (file-based store).
|
|
33
|
+
// It is only used by the legacy migrator and only when the user has it
|
|
34
|
+
// installed locally. Indirect dynamic import keeps the TS compile clean
|
|
35
|
+
// even when the package is absent from node_modules.
|
|
36
|
+
const moduleName = 'sql.js';
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
const sqlMod = await import(moduleName);
|
|
39
|
+
const initSqlJs = sqlMod.default ?? sqlMod;
|
|
40
|
+
const SQL = await initSqlJs();
|
|
41
|
+
if (!existsSync(dbPath))
|
|
42
|
+
return null;
|
|
43
|
+
const raw = new SQL.Database(readFileSync(dbPath));
|
|
44
|
+
return {
|
|
45
|
+
prepare: (sql) => ({
|
|
46
|
+
all: (...params) => {
|
|
47
|
+
let processed = sql;
|
|
48
|
+
for (const p of params) {
|
|
49
|
+
if (p === null || p === undefined)
|
|
50
|
+
processed = processed.replace('?', 'NULL');
|
|
51
|
+
else if (typeof p === 'string')
|
|
52
|
+
processed = processed.replace('?', `'${p.replace(/'/g, "''")}'`);
|
|
53
|
+
else
|
|
54
|
+
processed = processed.replace('?', String(p));
|
|
55
|
+
}
|
|
56
|
+
const result = raw.exec(processed);
|
|
57
|
+
if (!result.length)
|
|
58
|
+
return [];
|
|
59
|
+
const cols = result[0].columns;
|
|
60
|
+
return result[0].values.map((row) => {
|
|
61
|
+
const obj = {};
|
|
62
|
+
cols.forEach((c, i) => {
|
|
63
|
+
obj[c] = row[i];
|
|
64
|
+
});
|
|
65
|
+
return obj;
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
close: () => raw.close(),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const KNOWN_TYPES = new Set([
|
|
77
|
+
'bugfix',
|
|
78
|
+
'feature',
|
|
79
|
+
'refactor',
|
|
80
|
+
'decision',
|
|
81
|
+
'discovery',
|
|
82
|
+
'change',
|
|
83
|
+
'observation',
|
|
84
|
+
]);
|
|
85
|
+
function rowToMemory(row) {
|
|
86
|
+
const id = typeof row.id === 'string' ? row.id : null;
|
|
87
|
+
const rawType = typeof row.type === 'string' ? row.type : 'observation';
|
|
88
|
+
const type = (KNOWN_TYPES.has(rawType) ? rawType : 'observation');
|
|
89
|
+
const title = typeof row.title === 'string' ? row.title : null;
|
|
90
|
+
if (!id || !title)
|
|
91
|
+
return null;
|
|
92
|
+
let tags = [];
|
|
93
|
+
try {
|
|
94
|
+
if (typeof row.tags === 'string')
|
|
95
|
+
tags = JSON.parse(row.tags);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
tags = [];
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
id,
|
|
102
|
+
type,
|
|
103
|
+
title,
|
|
104
|
+
summary: typeof row.summary === 'string' ? row.summary : undefined,
|
|
105
|
+
content: typeof row.content === 'string' ? row.content : '',
|
|
106
|
+
project: typeof row.project === 'string' ? row.project : '',
|
|
107
|
+
tags,
|
|
108
|
+
sessionId: typeof row.session_id === 'string' ? row.session_id : undefined,
|
|
109
|
+
createdAt: typeof row.created_at === 'number' ? row.created_at : Date.now(),
|
|
110
|
+
updatedAt: typeof row.updated_at === 'number' ? row.updated_at : Date.now(),
|
|
111
|
+
accessedAt: typeof row.accessed_at === 'number' ? row.accessed_at : Date.now(),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function rowToSession(row) {
|
|
115
|
+
const id = typeof row.id === 'string' ? row.id : null;
|
|
116
|
+
const startedAt = typeof row.started_at === 'number' ? row.started_at : null;
|
|
117
|
+
if (!id || startedAt === null)
|
|
118
|
+
return null;
|
|
119
|
+
const status = row.status === 'completed' ? 'completed' : 'active';
|
|
120
|
+
return {
|
|
121
|
+
id,
|
|
122
|
+
project: typeof row.project === 'string' ? row.project : '',
|
|
123
|
+
status,
|
|
124
|
+
startedAt,
|
|
125
|
+
endedAt: typeof row.ended_at === 'number' ? row.ended_at : undefined,
|
|
126
|
+
summary: typeof row.summary === 'string' ? row.summary : undefined,
|
|
127
|
+
toolCalls: typeof row.tool_calls === 'number' ? row.tool_calls : 0,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Migrate every row of a legacy memory.db into the file-based store.
|
|
132
|
+
* Idempotent against the FileStore: if a memory id already exists on disk
|
|
133
|
+
* it is overwritten with the legacy content (same id → same partition).
|
|
134
|
+
*/
|
|
135
|
+
export async function migrateLegacyDb(dbPath, fileStore) {
|
|
136
|
+
if (!existsSync(dbPath))
|
|
137
|
+
return { memories: 0, sessions: 0 };
|
|
138
|
+
const db = await openDb(dbPath);
|
|
139
|
+
if (!db)
|
|
140
|
+
return { memories: 0, sessions: 0 };
|
|
141
|
+
let memories = 0;
|
|
142
|
+
let sessions = 0;
|
|
143
|
+
try {
|
|
144
|
+
const memoryRows = db
|
|
145
|
+
.prepare(`SELECT id, type, title, content, project, tags, session_id, created_at, updated_at, accessed_at
|
|
146
|
+
FROM memories`)
|
|
147
|
+
.all();
|
|
148
|
+
for (const row of memoryRows) {
|
|
149
|
+
const m = rowToMemory(row);
|
|
150
|
+
if (!m)
|
|
151
|
+
continue;
|
|
152
|
+
await fileStore.saveMemory(m);
|
|
153
|
+
memories++;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
// memories table may not exist on partial DBs
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const sessionRows = db
|
|
161
|
+
.prepare(`SELECT id, project, status, started_at, ended_at, summary, tool_calls
|
|
162
|
+
FROM sessions`)
|
|
163
|
+
.all();
|
|
164
|
+
for (const row of sessionRows) {
|
|
165
|
+
const s = rowToSession(row);
|
|
166
|
+
if (!s)
|
|
167
|
+
continue;
|
|
168
|
+
await fileStore.saveSession(s);
|
|
169
|
+
sessions++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
// sessions table may not exist
|
|
174
|
+
}
|
|
175
|
+
if (db.close) {
|
|
176
|
+
try {
|
|
177
|
+
db.close();
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// ignore
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return { memories, sessions };
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=legacy-migrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-migrator.js","sourceRoot":"","sources":["../../src/memory/legacy-migrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAgB9C,KAAK,UAAU,MAAM,CAAC,MAAc;IAClC,IAAI,CAAC;QACH,yEAAyE;QACzE,wEAAwE;QACxE,sCAAsC;QACtC,MAAM,UAAU,GAAG,gBAAgB,CAAC;QACpC,8DAA8D;QAC9D,MAAM,GAAG,GAAQ,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QAC1C,MAA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AAI,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC;YACH,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Memory Manager -
|
|
2
|
+
* Memory Manager - File-backed orchestrator (v5.6).
|
|
3
3
|
*
|
|
4
|
-
* Public API
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Public API kept stable for callers (saveMemory, searchMemories,
|
|
5
|
+
* getTimeline, getFullDetails, startSession, endSession, getStats,
|
|
6
|
+
* cleanup, exportMemories, plus the indexer code-graph methods).
|
|
7
|
+
*
|
|
8
|
+
* Internally uses the FileStore + FileSearch implementations under
|
|
9
|
+
* `.rulebook/memory/{memories,sessions,codegraph}/...` instead of
|
|
10
|
+
* SQLite + HNSW. On startup, an existing legacy `memory.db` is
|
|
11
|
+
* auto-detected and migrated to markdown one time, then renamed to
|
|
12
|
+
* `memory.db.legacy`.
|
|
7
13
|
*/
|
|
8
14
|
import type { Memory, MemoryConfig, MemorySearchOptions, MemorySearchResult, MemorySession, MemoryStats, MemoryType, TimelineEntry } from './memory-types.js';
|
|
15
|
+
import type { CodeNode, CodeEdge } from '../core/indexer/indexer-types.js';
|
|
9
16
|
export declare class MemoryManager {
|
|
10
17
|
private store;
|
|
11
|
-
private index;
|
|
12
18
|
private search;
|
|
13
|
-
private cache;
|
|
14
19
|
private initialized;
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
private readonly
|
|
20
|
+
private migrated;
|
|
21
|
+
/** Resolved root for the file-based store (sibling of legacy `memory.db`). */
|
|
22
|
+
private readonly memoryRoot;
|
|
23
|
+
/** Path to the legacy DB file, used for one-shot migration on first init. */
|
|
24
|
+
private readonly legacyDbPath;
|
|
18
25
|
private readonly maxSizeBytes;
|
|
19
|
-
private readonly dimensions;
|
|
20
|
-
private saveCount;
|
|
21
|
-
private static readonly EVICTION_CHECK_INTERVAL;
|
|
22
26
|
constructor(projectRoot: string, config: MemoryConfig);
|
|
23
27
|
private initPromise;
|
|
24
28
|
private ensureInitialized;
|
|
25
29
|
private doInit;
|
|
26
|
-
private doInitInner;
|
|
27
|
-
/**
|
|
28
|
-
* Strip <private>...</private> tags from content before storing
|
|
29
|
-
*/
|
|
30
30
|
private filterPrivate;
|
|
31
|
-
private saveHnswIfNeeded;
|
|
32
|
-
private saveHnswToDisk;
|
|
33
31
|
saveMemory(input: {
|
|
34
32
|
type: MemoryType;
|
|
35
33
|
title: string;
|
|
@@ -47,18 +45,21 @@ export declare class MemoryManager {
|
|
|
47
45
|
startSession(project: string): Promise<MemorySession>;
|
|
48
46
|
endSession(sessionId: string, summary?: string): Promise<void>;
|
|
49
47
|
getStats(): Promise<MemoryStats>;
|
|
50
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Age-based retention. With no `maxAgeDays` arg, this is a no-op (the
|
|
50
|
+
* legacy LRU byte-budget eviction was removed in v5.6).
|
|
51
|
+
*/
|
|
52
|
+
cleanup(arg?: boolean | {
|
|
53
|
+
maxAgeDays?: number;
|
|
54
|
+
}): Promise<{
|
|
51
55
|
evictedCount: number;
|
|
52
56
|
freedBytes: number;
|
|
53
57
|
}>;
|
|
54
58
|
exportMemories(format?: 'json' | 'csv'): Promise<string>;
|
|
55
|
-
saveCodeNode(node:
|
|
56
|
-
saveCodeEdge(edge:
|
|
59
|
+
saveCodeNode(node: CodeNode): Promise<void>;
|
|
60
|
+
saveCodeEdge(edge: CodeEdge): Promise<void>;
|
|
57
61
|
deleteCodeNodesByFile(filePath: string): Promise<void>;
|
|
58
62
|
close(): Promise<void>;
|
|
59
63
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Factory function
|
|
62
|
-
*/
|
|
63
64
|
export declare function createMemoryManager(projectRoot: string, config: MemoryConfig): MemoryManager;
|
|
64
65
|
//# sourceMappingURL=memory-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-manager.d.ts","sourceRoot":"","sources":["../../src/memory/memory-manager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"memory-manager.d.ts","sourceRoot":"","sources":["../../src/memory/memory-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAO3E,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;IAEzB,8EAA8E;IAC9E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;IAQrD,OAAO,CAAC,WAAW,CAA8B;YAEnC,iBAAiB;YAWjB,MAAM;IAyBpB,OAAO,CAAC,aAAa;IAMf,UAAU,CAAC,KAAK,EAAE;QACtB,IAAI,EAAE,UAAU,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,MAAM,CA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AE5F"}
|
|
@@ -1,51 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Memory Manager -
|
|
2
|
+
* Memory Manager - File-backed orchestrator (v5.6).
|
|
3
3
|
*
|
|
4
|
-
* Public API
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Public API kept stable for callers (saveMemory, searchMemories,
|
|
5
|
+
* getTimeline, getFullDetails, startSession, endSession, getStats,
|
|
6
|
+
* cleanup, exportMemories, plus the indexer code-graph methods).
|
|
7
|
+
*
|
|
8
|
+
* Internally uses the FileStore + FileSearch implementations under
|
|
9
|
+
* `.rulebook/memory/{memories,sessions,codegraph}/...` instead of
|
|
10
|
+
* SQLite + HNSW. On startup, an existing legacy `memory.db` is
|
|
11
|
+
* auto-detected and migrated to markdown one time, then renamed to
|
|
12
|
+
* `memory.db.legacy`.
|
|
7
13
|
*/
|
|
8
14
|
import { randomUUID } from 'crypto';
|
|
9
|
-
import { existsSync
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { MemoryStore } from './memory-store.js';
|
|
15
|
-
import { vectorize } from './memory-vectorizer.js';
|
|
15
|
+
import { existsSync } from 'fs';
|
|
16
|
+
import { rename } from 'fs/promises';
|
|
17
|
+
import { join, dirname } from 'path';
|
|
18
|
+
import { FileStore } from './file-store.js';
|
|
19
|
+
import { FileSearch } from './file-search.js';
|
|
16
20
|
const DEFAULT_DB_PATH = '.rulebook/memory/memory.db';
|
|
17
|
-
const
|
|
18
|
-
const DEFAULT_MAX_SIZE = 524288000; // 500MB
|
|
19
|
-
const DEFAULT_DIMENSIONS = 256;
|
|
20
|
-
const HNSW_SAVE_THRESHOLD = 100;
|
|
21
|
+
const DEFAULT_MAX_SIZE = 524288000; // 500MB — kept for getStats compatibility
|
|
21
22
|
const PRIVATE_TAG_REGEX = /<private>[\s\S]*?<\/private>/g;
|
|
22
23
|
export class MemoryManager {
|
|
23
24
|
store = null;
|
|
24
|
-
index = null;
|
|
25
25
|
search = null;
|
|
26
|
-
cache = null;
|
|
27
26
|
initialized = false;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
migrated = false;
|
|
28
|
+
/** Resolved root for the file-based store (sibling of legacy `memory.db`). */
|
|
29
|
+
memoryRoot;
|
|
30
|
+
/** Path to the legacy DB file, used for one-shot migration on first init. */
|
|
31
|
+
legacyDbPath;
|
|
31
32
|
maxSizeBytes;
|
|
32
|
-
dimensions;
|
|
33
|
-
saveCount = 0;
|
|
34
|
-
static EVICTION_CHECK_INTERVAL = 50;
|
|
35
33
|
constructor(projectRoot, config) {
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const dbRel = config.dbPath ?? DEFAULT_DB_PATH;
|
|
35
|
+
const dbAbs = join(projectRoot, dbRel);
|
|
36
|
+
this.legacyDbPath = dbAbs;
|
|
37
|
+
this.memoryRoot = dirname(dbAbs);
|
|
38
38
|
this.maxSizeBytes = config.maxSizeBytes ?? DEFAULT_MAX_SIZE;
|
|
39
|
-
this.dimensions = config.vectorDimensions ?? DEFAULT_DIMENSIONS;
|
|
40
39
|
}
|
|
41
40
|
initPromise = null;
|
|
42
41
|
async ensureInitialized() {
|
|
43
42
|
if (this.initialized)
|
|
44
43
|
return;
|
|
45
|
-
// Deduplicate concurrent init calls (e.g. multiple tool calls hitting memory at once)
|
|
46
44
|
if (!this.initPromise) {
|
|
47
45
|
this.initPromise = this.doInit().catch((err) => {
|
|
48
|
-
// Reset so next call retries instead of getting stuck on a rejected promise
|
|
49
46
|
this.initPromise = null;
|
|
50
47
|
throw err;
|
|
51
48
|
});
|
|
@@ -53,56 +50,29 @@ export class MemoryManager {
|
|
|
53
50
|
await this.initPromise;
|
|
54
51
|
}
|
|
55
52
|
async doInit() {
|
|
56
|
-
|
|
57
|
-
const timeout = new Promise((_, reject) => setTimeout(() => reject(new Error(`Memory initialization timed out after ${INIT_TIMEOUT_MS}ms`)), INIT_TIMEOUT_MS));
|
|
58
|
-
await Promise.race([this.doInitInner(), timeout]);
|
|
59
|
-
}
|
|
60
|
-
async doInitInner() {
|
|
61
|
-
// Initialize store (loads WASM sql.js — can be slow on first load)
|
|
62
|
-
this.store = new MemoryStore(this.dbPath);
|
|
53
|
+
this.store = new FileStore(this.memoryRoot);
|
|
63
54
|
await this.store.initialize();
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
this.search = new FileSearch(this.store);
|
|
56
|
+
// One-shot legacy DB migration. The runtime never reads SQLite again.
|
|
57
|
+
if (!this.migrated && existsSync(this.legacyDbPath)) {
|
|
66
58
|
try {
|
|
67
|
-
const
|
|
68
|
-
|
|
59
|
+
const { migrateLegacyDb } = await import('./legacy-migrator.js');
|
|
60
|
+
await migrateLegacyDb(this.legacyDbPath, this.store);
|
|
61
|
+
await rename(this.legacyDbPath, this.legacyDbPath + '.legacy');
|
|
62
|
+
this.store.invalidateCaches();
|
|
69
63
|
}
|
|
70
|
-
catch {
|
|
71
|
-
|
|
64
|
+
catch (err) {
|
|
65
|
+
// Non-fatal: surface but keep the manager functional.
|
|
66
|
+
console.error('[MemoryManager] legacy DB migration failed; continuing with file-only store:', err instanceof Error ? err.message : String(err));
|
|
72
67
|
}
|
|
68
|
+
this.migrated = true;
|
|
73
69
|
}
|
|
74
|
-
else {
|
|
75
|
-
this.index = new HNSWIndex({ dimensions: this.dimensions });
|
|
76
|
-
}
|
|
77
|
-
// Initialize search and cache
|
|
78
|
-
this.search = new MemorySearch(this.store, this.index, this.dimensions);
|
|
79
|
-
this.cache = new MemoryCache(this.store, this.index, this.maxSizeBytes);
|
|
80
70
|
this.initialized = true;
|
|
81
71
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Strip <private>...</private> tags from content before storing
|
|
84
|
-
*/
|
|
85
72
|
filterPrivate(content) {
|
|
86
73
|
return content.replace(PRIVATE_TAG_REGEX, '[REDACTED]');
|
|
87
74
|
}
|
|
88
|
-
|
|
89
|
-
this.hnswInsertCount++;
|
|
90
|
-
if (this.hnswInsertCount >= HNSW_SAVE_THRESHOLD) {
|
|
91
|
-
this.saveHnswToDisk();
|
|
92
|
-
this.hnswInsertCount = 0;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
saveHnswToDisk() {
|
|
96
|
-
if (!this.index || this.index.size === 0)
|
|
97
|
-
return;
|
|
98
|
-
const dir = join(this.hnswPath, '..');
|
|
99
|
-
if (!existsSync(dir)) {
|
|
100
|
-
mkdirSync(dir, { recursive: true });
|
|
101
|
-
}
|
|
102
|
-
const buffer = this.index.serialize();
|
|
103
|
-
writeFileSync(this.hnswPath, Buffer.from(buffer));
|
|
104
|
-
}
|
|
105
|
-
// --- Public API ---
|
|
75
|
+
// ── public API ─────────────────────────────────────────────────────
|
|
106
76
|
async saveMemory(input) {
|
|
107
77
|
await this.ensureInitialized();
|
|
108
78
|
const now = Date.now();
|
|
@@ -119,35 +89,26 @@ export class MemoryManager {
|
|
|
119
89
|
updatedAt: now,
|
|
120
90
|
accessedAt: now,
|
|
121
91
|
};
|
|
122
|
-
this.store.saveMemory(memory);
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.saveHnswIfNeeded();
|
|
130
|
-
// Check cache limits periodically (not on every save — getDbSizeBytes is cheap now
|
|
131
|
-
// but eviction itself is expensive and rarely needed)
|
|
132
|
-
this.saveCount++;
|
|
133
|
-
if (this.saveCount >= MemoryManager.EVICTION_CHECK_INTERVAL) {
|
|
134
|
-
this.saveCount = 0;
|
|
135
|
-
this.cache.checkAndEvict();
|
|
92
|
+
await this.store.saveMemory(memory);
|
|
93
|
+
// Refresh the inverted-index sidecar lazily for large corpora.
|
|
94
|
+
try {
|
|
95
|
+
await this.search.maybeRebuildIndex();
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// non-fatal — search falls back to in-memory build per call
|
|
136
99
|
}
|
|
137
100
|
return memory;
|
|
138
101
|
}
|
|
139
102
|
async getMemory(id) {
|
|
140
103
|
await this.ensureInitialized();
|
|
141
|
-
const memory = this.store.getMemory(id);
|
|
142
|
-
if (memory)
|
|
143
|
-
this.store.updateAccessedAt(id);
|
|
144
|
-
}
|
|
104
|
+
const memory = await this.store.getMemory(id);
|
|
105
|
+
if (memory)
|
|
106
|
+
await this.store.updateAccessedAt(id);
|
|
145
107
|
return memory;
|
|
146
108
|
}
|
|
147
109
|
async deleteMemory(id) {
|
|
148
110
|
await this.ensureInitialized();
|
|
149
|
-
this.store.deleteMemory(id);
|
|
150
|
-
this.index.remove(id);
|
|
111
|
+
await this.store.deleteMemory(id);
|
|
151
112
|
}
|
|
152
113
|
async searchMemories(options) {
|
|
153
114
|
await this.ensureInitialized();
|
|
@@ -170,43 +131,62 @@ export class MemoryManager {
|
|
|
170
131
|
startedAt: Date.now(),
|
|
171
132
|
toolCalls: 0,
|
|
172
133
|
};
|
|
173
|
-
this.store.
|
|
134
|
+
await this.store.saveSession(session);
|
|
174
135
|
return session;
|
|
175
136
|
}
|
|
176
137
|
async endSession(sessionId, summary) {
|
|
177
138
|
await this.ensureInitialized();
|
|
178
|
-
this.store.
|
|
139
|
+
const existing = await this.store.getSession(sessionId);
|
|
140
|
+
if (!existing)
|
|
141
|
+
return;
|
|
142
|
+
existing.status = 'completed';
|
|
143
|
+
existing.endedAt = Date.now();
|
|
144
|
+
if (summary !== undefined)
|
|
145
|
+
existing.summary = summary;
|
|
146
|
+
await this.store.saveSession(existing);
|
|
179
147
|
}
|
|
180
148
|
async getStats() {
|
|
181
149
|
await this.ensureInitialized();
|
|
182
|
-
const
|
|
183
|
-
const memoryCount = this.store.getMemoryCount();
|
|
184
|
-
const sessionCount = this.store.getSessionCount();
|
|
150
|
+
const stats = await this.store.getStats();
|
|
185
151
|
return {
|
|
186
|
-
dbSizeBytes:
|
|
187
|
-
memoryCount,
|
|
188
|
-
sessionCount,
|
|
189
|
-
|
|
190
|
-
|
|
152
|
+
dbSizeBytes: stats.totalBytes,
|
|
153
|
+
memoryCount: stats.memoryCount,
|
|
154
|
+
sessionCount: stats.sessionCount,
|
|
155
|
+
fileCount: stats.fileCount,
|
|
156
|
+
oldestMemory: stats.oldestMemory,
|
|
157
|
+
newestMemory: stats.newestMemory,
|
|
191
158
|
maxSizeBytes: this.maxSizeBytes,
|
|
192
|
-
usagePercent: (
|
|
193
|
-
indexHealth: this.index.size === memoryCount
|
|
194
|
-
? 'good'
|
|
195
|
-
: Math.abs(this.index.size - memoryCount) < memoryCount * 0.1
|
|
196
|
-
? 'degraded'
|
|
197
|
-
: 'needs-rebuild',
|
|
159
|
+
usagePercent: this.maxSizeBytes > 0 ? (stats.totalBytes / this.maxSizeBytes) * 100 : 0,
|
|
198
160
|
};
|
|
199
161
|
}
|
|
200
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Age-based retention. With no `maxAgeDays` arg, this is a no-op (the
|
|
164
|
+
* legacy LRU byte-budget eviction was removed in v5.6).
|
|
165
|
+
*/
|
|
166
|
+
async cleanup(arg) {
|
|
201
167
|
await this.ensureInitialized();
|
|
202
|
-
|
|
203
|
-
|
|
168
|
+
const maxAgeDays = typeof arg === 'object' && arg !== null ? arg.maxAgeDays : undefined;
|
|
169
|
+
if (maxAgeDays === undefined || maxAgeDays <= 0) {
|
|
170
|
+
return { evictedCount: 0, freedBytes: 0 };
|
|
204
171
|
}
|
|
205
|
-
|
|
172
|
+
const cutoff = Date.now() - maxAgeDays * 24 * 60 * 60 * 1000;
|
|
173
|
+
const all = await this.store.listAllMemories();
|
|
174
|
+
let evicted = 0;
|
|
175
|
+
let freed = 0;
|
|
176
|
+
const before = (await this.store.getStats()).totalBytes;
|
|
177
|
+
for (const m of all) {
|
|
178
|
+
if (m.createdAt < cutoff) {
|
|
179
|
+
await this.store.deleteMemory(m.id);
|
|
180
|
+
evicted++;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const after = (await this.store.getStats()).totalBytes;
|
|
184
|
+
freed = Math.max(0, before - after);
|
|
185
|
+
return { evictedCount: evicted, freedBytes: freed };
|
|
206
186
|
}
|
|
207
187
|
async exportMemories(format = 'json') {
|
|
208
188
|
await this.ensureInitialized();
|
|
209
|
-
const memories = this.store.listMemories({ limit:
|
|
189
|
+
const memories = await this.store.listMemories({ limit: 10000 });
|
|
210
190
|
if (format === 'csv') {
|
|
211
191
|
const header = 'id,type,title,content,project,tags,createdAt,updatedAt';
|
|
212
192
|
const rows = memories.map((m) => `"${m.id}","${m.type}","${m.title.replace(/"/g, '""')}","${m.content.replace(/"/g, '""')}","${m.project}","${m.tags.join(';')}",${m.createdAt},${m.updatedAt}`);
|
|
@@ -214,52 +194,29 @@ export class MemoryManager {
|
|
|
214
194
|
}
|
|
215
195
|
return JSON.stringify(memories, null, 2);
|
|
216
196
|
}
|
|
217
|
-
//
|
|
197
|
+
// ── background indexer code-graph (JSONL log) ─────────────────────
|
|
218
198
|
async saveCodeNode(node) {
|
|
219
199
|
await this.ensureInitialized();
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
this.store.saveCodeNode(node);
|
|
226
|
-
// Vectorize code chunks for FTS/HNSW semantic search
|
|
227
|
-
const textToVectorize = [node.name, node.summary || '', node.content].filter(Boolean).join(' ');
|
|
228
|
-
// Important: We prepend an identifier so search knows it's a code node
|
|
229
|
-
const vecId = `__code__${node.id}`;
|
|
230
|
-
const vec = vectorize(textToVectorize, this.dimensions);
|
|
231
|
-
this.index.add(vecId, vec);
|
|
232
|
-
this.saveHnswIfNeeded();
|
|
200
|
+
const existing = await this.store.getCodeNodeHash(node.id);
|
|
201
|
+
if (existing === node.hash)
|
|
202
|
+
return;
|
|
203
|
+
await this.store.appendCodeNode(node);
|
|
233
204
|
}
|
|
234
205
|
async saveCodeEdge(edge) {
|
|
235
206
|
await this.ensureInitialized();
|
|
236
|
-
this.store.
|
|
207
|
+
await this.store.appendCodeEdge(edge);
|
|
237
208
|
}
|
|
238
209
|
async deleteCodeNodesByFile(filePath) {
|
|
239
210
|
await this.ensureInitialized();
|
|
240
|
-
|
|
241
|
-
const nodeIds = this.store.getCodeNodeIdsByFile(filePath);
|
|
242
|
-
this.store.deleteCodeNodesByFile(filePath);
|
|
243
|
-
// Remove corresponding vectors from HNSW to prevent orphan accumulation
|
|
244
|
-
for (const id of nodeIds) {
|
|
245
|
-
this.index.remove(`__code__${id}`);
|
|
246
|
-
}
|
|
211
|
+
await this.store.deleteCodeNodesByFile(filePath);
|
|
247
212
|
}
|
|
248
213
|
async close() {
|
|
249
|
-
if (this.store) {
|
|
250
|
-
this.store.close();
|
|
251
|
-
}
|
|
252
|
-
this.saveHnswToDisk();
|
|
253
214
|
this.initialized = false;
|
|
254
215
|
this.store = null;
|
|
255
|
-
this.index = null;
|
|
256
216
|
this.search = null;
|
|
257
|
-
this.
|
|
217
|
+
this.initPromise = null;
|
|
258
218
|
}
|
|
259
219
|
}
|
|
260
|
-
/**
|
|
261
|
-
* Factory function
|
|
262
|
-
*/
|
|
263
220
|
export function createMemoryManager(projectRoot, config) {
|
|
264
221
|
return new MemoryManager(projectRoot, config);
|
|
265
222
|
}
|