@vinaes/succ 1.3.19
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/LICENSE +87 -0
- package/README.md +588 -0
- package/agents/succ-checkpoint-manager.md +51 -0
- package/agents/succ-code-reviewer.md +181 -0
- package/agents/succ-context-optimizer.md +83 -0
- package/agents/succ-debug.md +224 -0
- package/agents/succ-decision-auditor.md +74 -0
- package/agents/succ-deep-search.md +41 -0
- package/agents/succ-diff-reviewer.md +123 -0
- package/agents/succ-explore.md +83 -0
- package/agents/succ-general.md +109 -0
- package/agents/succ-knowledge-indexer.md +45 -0
- package/agents/succ-knowledge-mapper.md +61 -0
- package/agents/succ-memory-curator.md +43 -0
- package/agents/succ-memory-health-monitor.md +55 -0
- package/agents/succ-pattern-detective.md +62 -0
- package/agents/succ-plan.md +172 -0
- package/agents/succ-quality-improvement-coach.md +63 -0
- package/agents/succ-readiness-improver.md +62 -0
- package/agents/succ-session-handoff-orchestrator.md +54 -0
- package/agents/succ-session-reviewer.md +46 -0
- package/agents/succ-style-tracker.md +73 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +749 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/agents-md.d.ts +16 -0
- package/dist/commands/agents-md.d.ts.map +1 -0
- package/dist/commands/agents-md.js +33 -0
- package/dist/commands/agents-md.js.map +1 -0
- package/dist/commands/analyze-agents.d.ts +20 -0
- package/dist/commands/analyze-agents.d.ts.map +1 -0
- package/dist/commands/analyze-agents.js +305 -0
- package/dist/commands/analyze-agents.js.map +1 -0
- package/dist/commands/analyze-helpers.d.ts +22 -0
- package/dist/commands/analyze-helpers.d.ts.map +1 -0
- package/dist/commands/analyze-helpers.js +38 -0
- package/dist/commands/analyze-helpers.js.map +1 -0
- package/dist/commands/analyze-profile.d.ts +53 -0
- package/dist/commands/analyze-profile.d.ts.map +1 -0
- package/dist/commands/analyze-profile.js +638 -0
- package/dist/commands/analyze-profile.js.map +1 -0
- package/dist/commands/analyze-recursive.d.ts +20 -0
- package/dist/commands/analyze-recursive.d.ts.map +1 -0
- package/dist/commands/analyze-recursive.js +326 -0
- package/dist/commands/analyze-recursive.js.map +1 -0
- package/dist/commands/analyze-utils.d.ts +83 -0
- package/dist/commands/analyze-utils.d.ts.map +1 -0
- package/dist/commands/analyze-utils.js +541 -0
- package/dist/commands/analyze-utils.js.map +1 -0
- package/dist/commands/analyze.d.ts +15 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +265 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/backfill.d.ts +22 -0
- package/dist/commands/backfill.d.ts.map +1 -0
- package/dist/commands/backfill.js +62 -0
- package/dist/commands/backfill.js.map +1 -0
- package/dist/commands/benchmark-quality.d.ts +18 -0
- package/dist/commands/benchmark-quality.d.ts.map +1 -0
- package/dist/commands/benchmark-quality.js +316 -0
- package/dist/commands/benchmark-quality.js.map +1 -0
- package/dist/commands/benchmark-sqlite-vec.d.ts +12 -0
- package/dist/commands/benchmark-sqlite-vec.d.ts.map +1 -0
- package/dist/commands/benchmark-sqlite-vec.js +281 -0
- package/dist/commands/benchmark-sqlite-vec.js.map +1 -0
- package/dist/commands/benchmark.d.ts +57 -0
- package/dist/commands/benchmark.d.ts.map +1 -0
- package/dist/commands/benchmark.js +682 -0
- package/dist/commands/benchmark.js.map +1 -0
- package/dist/commands/chat.d.ts +14 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +84 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/checkpoint.d.ts +27 -0
- package/dist/commands/checkpoint.d.ts.map +1 -0
- package/dist/commands/checkpoint.js +181 -0
- package/dist/commands/checkpoint.js.map +1 -0
- package/dist/commands/clear.d.ts +9 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +31 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/config.d.ts +26 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +247 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/consolidate.d.ts +21 -0
- package/dist/commands/consolidate.d.ts.map +1 -0
- package/dist/commands/consolidate.js +117 -0
- package/dist/commands/consolidate.js.map +1 -0
- package/dist/commands/daemon.d.ts +48 -0
- package/dist/commands/daemon.d.ts.map +1 -0
- package/dist/commands/daemon.js +218 -0
- package/dist/commands/daemon.js.map +1 -0
- package/dist/commands/embedding.d.ts +26 -0
- package/dist/commands/embedding.d.ts.map +1 -0
- package/dist/commands/embedding.js +168 -0
- package/dist/commands/embedding.js.map +1 -0
- package/dist/commands/graph.d.ts +20 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +128 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/index-code.d.ts +23 -0
- package/dist/commands/index-code.d.ts.map +1 -0
- package/dist/commands/index-code.js +218 -0
- package/dist/commands/index-code.js.map +1 -0
- package/dist/commands/index.d.ts +23 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +217 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init-templates.d.ts +21 -0
- package/dist/commands/init-templates.d.ts.map +1 -0
- package/dist/commands/init-templates.js +487 -0
- package/dist/commands/init-templates.js.map +1 -0
- package/dist/commands/init.d.ts +10 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +865 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/memories.d.ts +47 -0
- package/dist/commands/memories.d.ts.map +1 -0
- package/dist/commands/memories.js +597 -0
- package/dist/commands/memories.js.map +1 -0
- package/dist/commands/migrate.d.ts +19 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +154 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/prd.d.ts +46 -0
- package/dist/commands/prd.d.ts.map +1 -0
- package/dist/commands/prd.js +378 -0
- package/dist/commands/prd.js.map +1 -0
- package/dist/commands/precompute-context.d.ts +11 -0
- package/dist/commands/precompute-context.d.ts.map +1 -0
- package/dist/commands/precompute-context.js +12 -0
- package/dist/commands/precompute-context.js.map +1 -0
- package/dist/commands/progress.d.ts +16 -0
- package/dist/commands/progress.d.ts.map +1 -0
- package/dist/commands/progress.js +38 -0
- package/dist/commands/progress.js.map +1 -0
- package/dist/commands/reindex.d.ts +17 -0
- package/dist/commands/reindex.d.ts.map +1 -0
- package/dist/commands/reindex.js +83 -0
- package/dist/commands/reindex.js.map +1 -0
- package/dist/commands/retention.d.ts +19 -0
- package/dist/commands/retention.d.ts.map +1 -0
- package/dist/commands/retention.js +162 -0
- package/dist/commands/retention.js.map +1 -0
- package/dist/commands/score.d.ts +10 -0
- package/dist/commands/score.d.ts.map +1 -0
- package/dist/commands/score.js +28 -0
- package/dist/commands/score.js.map +1 -0
- package/dist/commands/search.d.ts +7 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +89 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/session-summary.d.ts +15 -0
- package/dist/commands/session-summary.d.ts.map +1 -0
- package/dist/commands/session-summary.js +16 -0
- package/dist/commands/session-summary.js.map +1 -0
- package/dist/commands/setup.d.ts +6 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +222 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/soul.d.ts +9 -0
- package/dist/commands/soul.d.ts.map +1 -0
- package/dist/commands/soul.js +256 -0
- package/dist/commands/soul.js.map +1 -0
- package/dist/commands/stats.d.ts +18 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +138 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +145 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/train-bpe.d.ts +8 -0
- package/dist/commands/train-bpe.d.ts.map +1 -0
- package/dist/commands/train-bpe.js +35 -0
- package/dist/commands/train-bpe.js.map +1 -0
- package/dist/commands/watch.d.ts +22 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +171 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/daemon/analyzer.d.ts +54 -0
- package/dist/daemon/analyzer.d.ts.map +1 -0
- package/dist/daemon/analyzer.js +362 -0
- package/dist/daemon/analyzer.js.map +1 -0
- package/dist/daemon/client.d.ts +87 -0
- package/dist/daemon/client.d.ts.map +1 -0
- package/dist/daemon/client.js +356 -0
- package/dist/daemon/client.js.map +1 -0
- package/dist/daemon/index.d.ts +12 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +12 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/service.d.ts +51 -0
- package/dist/daemon/service.d.ts.map +1 -0
- package/dist/daemon/service.js +1203 -0
- package/dist/daemon/service.js.map +1 -0
- package/dist/daemon/session-processor.d.ts +85 -0
- package/dist/daemon/session-processor.d.ts.map +1 -0
- package/dist/daemon/session-processor.js +571 -0
- package/dist/daemon/session-processor.js.map +1 -0
- package/dist/daemon/sessions.d.ts +62 -0
- package/dist/daemon/sessions.d.ts.map +1 -0
- package/dist/daemon/sessions.js +192 -0
- package/dist/daemon/sessions.js.map +1 -0
- package/dist/daemon/watcher.d.ts +52 -0
- package/dist/daemon/watcher.d.ts.map +1 -0
- package/dist/daemon/watcher.js +363 -0
- package/dist/daemon/watcher.js.map +1 -0
- package/dist/lib/agents-md-generator.d.ts +33 -0
- package/dist/lib/agents-md-generator.d.ts.map +1 -0
- package/dist/lib/agents-md-generator.js +156 -0
- package/dist/lib/agents-md-generator.js.map +1 -0
- package/dist/lib/ai-readiness.d.ts +132 -0
- package/dist/lib/ai-readiness.d.ts.map +1 -0
- package/dist/lib/ai-readiness.js +702 -0
- package/dist/lib/ai-readiness.js.map +1 -0
- package/dist/lib/analyze-state.d.ts +34 -0
- package/dist/lib/analyze-state.d.ts.map +1 -0
- package/dist/lib/analyze-state.js +106 -0
- package/dist/lib/analyze-state.js.map +1 -0
- package/dist/lib/benchmark.d.ts +250 -0
- package/dist/lib/benchmark.d.ts.map +1 -0
- package/dist/lib/benchmark.js +778 -0
- package/dist/lib/benchmark.js.map +1 -0
- package/dist/lib/bm25.d.ts +114 -0
- package/dist/lib/bm25.d.ts.map +1 -0
- package/dist/lib/bm25.js +727 -0
- package/dist/lib/bm25.js.map +1 -0
- package/dist/lib/bpe.d.ts +70 -0
- package/dist/lib/bpe.d.ts.map +1 -0
- package/dist/lib/bpe.js +270 -0
- package/dist/lib/bpe.js.map +1 -0
- package/dist/lib/checkpoint.d.ts +124 -0
- package/dist/lib/checkpoint.d.ts.map +1 -0
- package/dist/lib/checkpoint.js +321 -0
- package/dist/lib/checkpoint.js.map +1 -0
- package/dist/lib/chunker.d.ts +47 -0
- package/dist/lib/chunker.d.ts.map +1 -0
- package/dist/lib/chunker.js +358 -0
- package/dist/lib/chunker.js.map +1 -0
- package/dist/lib/claude-ws-transport.d.ts +76 -0
- package/dist/lib/claude-ws-transport.d.ts.map +1 -0
- package/dist/lib/claude-ws-transport.js +487 -0
- package/dist/lib/claude-ws-transport.js.map +1 -0
- package/dist/lib/compact-briefing.d.ts +22 -0
- package/dist/lib/compact-briefing.d.ts.map +1 -0
- package/dist/lib/compact-briefing.js +180 -0
- package/dist/lib/compact-briefing.js.map +1 -0
- package/dist/lib/config-defaults.d.ts +41 -0
- package/dist/lib/config-defaults.d.ts.map +1 -0
- package/dist/lib/config-defaults.js +99 -0
- package/dist/lib/config-defaults.js.map +1 -0
- package/dist/lib/config-display.d.ts +16 -0
- package/dist/lib/config-display.d.ts.map +1 -0
- package/dist/lib/config-display.js +408 -0
- package/dist/lib/config-display.js.map +1 -0
- package/dist/lib/config-types.d.ts +601 -0
- package/dist/lib/config-types.d.ts.map +1 -0
- package/dist/lib/config-types.js +7 -0
- package/dist/lib/config-types.js.map +1 -0
- package/dist/lib/config-validation.d.ts +19 -0
- package/dist/lib/config-validation.d.ts.map +1 -0
- package/dist/lib/config-validation.js +136 -0
- package/dist/lib/config-validation.js.map +1 -0
- package/dist/lib/config.d.ts +143 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +689 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/consolidate.d.ts +115 -0
- package/dist/lib/consolidate.d.ts.map +1 -0
- package/dist/lib/consolidate.js +600 -0
- package/dist/lib/consolidate.js.map +1 -0
- package/dist/lib/db/bm25-indexes.d.ts +58 -0
- package/dist/lib/db/bm25-indexes.d.ts.map +1 -0
- package/dist/lib/db/bm25-indexes.js +333 -0
- package/dist/lib/db/bm25-indexes.js.map +1 -0
- package/dist/lib/db/bpe.d.ts +18 -0
- package/dist/lib/db/bpe.d.ts.map +1 -0
- package/dist/lib/db/bpe.js +44 -0
- package/dist/lib/db/bpe.js.map +1 -0
- package/dist/lib/db/connection.d.ts +47 -0
- package/dist/lib/db/connection.d.ts.map +1 -0
- package/dist/lib/db/connection.js +114 -0
- package/dist/lib/db/connection.js.map +1 -0
- package/dist/lib/db/documents.d.ts +58 -0
- package/dist/lib/db/documents.d.ts.map +1 -0
- package/dist/lib/db/documents.js +374 -0
- package/dist/lib/db/documents.js.map +1 -0
- package/dist/lib/db/file-hash.d.ts +26 -0
- package/dist/lib/db/file-hash.d.ts.map +1 -0
- package/dist/lib/db/file-hash.js +56 -0
- package/dist/lib/db/file-hash.js.map +1 -0
- package/dist/lib/db/global-memories.d.ts +62 -0
- package/dist/lib/db/global-memories.d.ts.map +1 -0
- package/dist/lib/db/global-memories.js +173 -0
- package/dist/lib/db/global-memories.js.map +1 -0
- package/dist/lib/db/graph.d.ts +163 -0
- package/dist/lib/db/graph.d.ts.map +1 -0
- package/dist/lib/db/graph.js +488 -0
- package/dist/lib/db/graph.js.map +1 -0
- package/dist/lib/db/helpers.d.ts +13 -0
- package/dist/lib/db/helpers.d.ts.map +1 -0
- package/dist/lib/db/helpers.js +21 -0
- package/dist/lib/db/helpers.js.map +1 -0
- package/dist/lib/db/hybrid-search.d.ts +64 -0
- package/dist/lib/db/hybrid-search.d.ts.map +1 -0
- package/dist/lib/db/hybrid-search.js +549 -0
- package/dist/lib/db/hybrid-search.js.map +1 -0
- package/dist/lib/db/index.d.ts +23 -0
- package/dist/lib/db/index.d.ts.map +1 -0
- package/dist/lib/db/index.js +23 -0
- package/dist/lib/db/index.js.map +1 -0
- package/dist/lib/db/memories.d.ts +174 -0
- package/dist/lib/db/memories.d.ts.map +1 -0
- package/dist/lib/db/memories.js +866 -0
- package/dist/lib/db/memories.js.map +1 -0
- package/dist/lib/db/retention.d.ts +64 -0
- package/dist/lib/db/retention.d.ts.map +1 -0
- package/dist/lib/db/retention.js +115 -0
- package/dist/lib/db/retention.js.map +1 -0
- package/dist/lib/db/schema.d.ts +29 -0
- package/dist/lib/db/schema.d.ts.map +1 -0
- package/dist/lib/db/schema.js +832 -0
- package/dist/lib/db/schema.js.map +1 -0
- package/dist/lib/db/skills.d.ts +65 -0
- package/dist/lib/db/skills.d.ts.map +1 -0
- package/dist/lib/db/skills.js +119 -0
- package/dist/lib/db/skills.js.map +1 -0
- package/dist/lib/db/token-frequency.d.ts +34 -0
- package/dist/lib/db/token-frequency.d.ts.map +1 -0
- package/dist/lib/db/token-frequency.js +92 -0
- package/dist/lib/db/token-frequency.js.map +1 -0
- package/dist/lib/db/token-stats.d.ts +43 -0
- package/dist/lib/db/token-stats.d.ts.map +1 -0
- package/dist/lib/db/token-stats.js +59 -0
- package/dist/lib/db/token-stats.js.map +1 -0
- package/dist/lib/db/types.d.ts +57 -0
- package/dist/lib/db/types.d.ts.map +1 -0
- package/dist/lib/db/types.js +5 -0
- package/dist/lib/db/types.js.map +1 -0
- package/dist/lib/db/web-search-history.d.ts +22 -0
- package/dist/lib/db/web-search-history.d.ts.map +1 -0
- package/dist/lib/db/web-search-history.js +107 -0
- package/dist/lib/db/web-search-history.js.map +1 -0
- package/dist/lib/debug/state.d.ts +17 -0
- package/dist/lib/debug/state.d.ts.map +1 -0
- package/dist/lib/debug/state.js +131 -0
- package/dist/lib/debug/state.js.map +1 -0
- package/dist/lib/debug/types.d.ts +74 -0
- package/dist/lib/debug/types.d.ts.map +1 -0
- package/dist/lib/debug/types.js +85 -0
- package/dist/lib/debug/types.js.map +1 -0
- package/dist/lib/embedding-pool.d.ts +37 -0
- package/dist/lib/embedding-pool.d.ts.map +1 -0
- package/dist/lib/embedding-pool.js +159 -0
- package/dist/lib/embedding-pool.js.map +1 -0
- package/dist/lib/embedding-worker.d.ts +7 -0
- package/dist/lib/embedding-worker.d.ts.map +1 -0
- package/dist/lib/embedding-worker.js +49 -0
- package/dist/lib/embedding-worker.js.map +1 -0
- package/dist/lib/embeddings.d.ts +54 -0
- package/dist/lib/embeddings.d.ts.map +1 -0
- package/dist/lib/embeddings.js +437 -0
- package/dist/lib/embeddings.js.map +1 -0
- package/dist/lib/errors.d.ts +40 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +66 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/fault-logger.d.ts +35 -0
- package/dist/lib/fault-logger.d.ts.map +1 -0
- package/dist/lib/fault-logger.js +182 -0
- package/dist/lib/fault-logger.js.map +1 -0
- package/dist/lib/graph/centrality.d.ts +34 -0
- package/dist/lib/graph/centrality.d.ts.map +1 -0
- package/dist/lib/graph/centrality.js +76 -0
- package/dist/lib/graph/centrality.js.map +1 -0
- package/dist/lib/graph/cleanup.d.ts +36 -0
- package/dist/lib/graph/cleanup.d.ts.map +1 -0
- package/dist/lib/graph/cleanup.js +96 -0
- package/dist/lib/graph/cleanup.js.map +1 -0
- package/dist/lib/graph/community-detection.d.ts +61 -0
- package/dist/lib/graph/community-detection.d.ts.map +1 -0
- package/dist/lib/graph/community-detection.js +218 -0
- package/dist/lib/graph/community-detection.js.map +1 -0
- package/dist/lib/graph/contextual-proximity.d.ts +41 -0
- package/dist/lib/graph/contextual-proximity.d.ts.map +1 -0
- package/dist/lib/graph/contextual-proximity.js +125 -0
- package/dist/lib/graph/contextual-proximity.js.map +1 -0
- package/dist/lib/graph/llm-relations.d.ts +54 -0
- package/dist/lib/graph/llm-relations.d.ts.map +1 -0
- package/dist/lib/graph/llm-relations.js +265 -0
- package/dist/lib/graph/llm-relations.js.map +1 -0
- package/dist/lib/graph-export.d.ts +13 -0
- package/dist/lib/graph-export.d.ts.map +1 -0
- package/dist/lib/graph-export.js +637 -0
- package/dist/lib/graph-export.js.map +1 -0
- package/dist/lib/graph-scheduler.d.ts +7 -0
- package/dist/lib/graph-scheduler.d.ts.map +1 -0
- package/dist/lib/graph-scheduler.js +21 -0
- package/dist/lib/graph-scheduler.js.map +1 -0
- package/dist/lib/indexer.d.ts +36 -0
- package/dist/lib/indexer.d.ts.map +1 -0
- package/dist/lib/indexer.js +226 -0
- package/dist/lib/indexer.js.map +1 -0
- package/dist/lib/learning-delta.d.ts +35 -0
- package/dist/lib/learning-delta.d.ts.map +1 -0
- package/dist/lib/learning-delta.js +53 -0
- package/dist/lib/learning-delta.js.map +1 -0
- package/dist/lib/llm.d.ts +118 -0
- package/dist/lib/llm.d.ts.map +1 -0
- package/dist/lib/llm.js +439 -0
- package/dist/lib/llm.js.map +1 -0
- package/dist/lib/lock.d.ts +27 -0
- package/dist/lib/lock.d.ts.map +1 -0
- package/dist/lib/lock.js +143 -0
- package/dist/lib/lock.js.map +1 -0
- package/dist/lib/md-fetch.d.ts +61 -0
- package/dist/lib/md-fetch.d.ts.map +1 -0
- package/dist/lib/md-fetch.js +141 -0
- package/dist/lib/md-fetch.js.map +1 -0
- package/dist/lib/mmr.d.ts +29 -0
- package/dist/lib/mmr.d.ts.map +1 -0
- package/dist/lib/mmr.js +89 -0
- package/dist/lib/mmr.js.map +1 -0
- package/dist/lib/onboarding/ai-chat.d.ts +11 -0
- package/dist/lib/onboarding/ai-chat.d.ts.map +1 -0
- package/dist/lib/onboarding/ai-chat.js +85 -0
- package/dist/lib/onboarding/ai-chat.js.map +1 -0
- package/dist/lib/onboarding/index.d.ts +7 -0
- package/dist/lib/onboarding/index.d.ts.map +1 -0
- package/dist/lib/onboarding/index.js +7 -0
- package/dist/lib/onboarding/index.js.map +1 -0
- package/dist/lib/onboarding/wizard.d.ts +11 -0
- package/dist/lib/onboarding/wizard.d.ts.map +1 -0
- package/dist/lib/onboarding/wizard.js +104 -0
- package/dist/lib/onboarding/wizard.js.map +1 -0
- package/dist/lib/ort-provider.d.ts +27 -0
- package/dist/lib/ort-provider.d.ts.map +1 -0
- package/dist/lib/ort-provider.js +83 -0
- package/dist/lib/ort-provider.js.map +1 -0
- package/dist/lib/ort-session.d.ts +32 -0
- package/dist/lib/ort-session.d.ts.map +1 -0
- package/dist/lib/ort-session.js +227 -0
- package/dist/lib/ort-session.js.map +1 -0
- package/dist/lib/patterns.d.ts +43 -0
- package/dist/lib/patterns.d.ts.map +1 -0
- package/dist/lib/patterns.js +395 -0
- package/dist/lib/patterns.js.map +1 -0
- package/dist/lib/prd/codebase-context.d.ts +27 -0
- package/dist/lib/prd/codebase-context.d.ts.map +1 -0
- package/dist/lib/prd/codebase-context.js +420 -0
- package/dist/lib/prd/codebase-context.js.map +1 -0
- package/dist/lib/prd/context.d.ts +24 -0
- package/dist/lib/prd/context.d.ts.map +1 -0
- package/dist/lib/prd/context.js +68 -0
- package/dist/lib/prd/context.js.map +1 -0
- package/dist/lib/prd/executor.d.ts +52 -0
- package/dist/lib/prd/executor.d.ts.map +1 -0
- package/dist/lib/prd/executor.js +154 -0
- package/dist/lib/prd/executor.js.map +1 -0
- package/dist/lib/prd/export.d.ts +40 -0
- package/dist/lib/prd/export.d.ts.map +1 -0
- package/dist/lib/prd/export.js +511 -0
- package/dist/lib/prd/export.js.map +1 -0
- package/dist/lib/prd/gates.d.ts +30 -0
- package/dist/lib/prd/gates.d.ts.map +1 -0
- package/dist/lib/prd/gates.js +100 -0
- package/dist/lib/prd/gates.js.map +1 -0
- package/dist/lib/prd/generate.d.ts +56 -0
- package/dist/lib/prd/generate.d.ts.map +1 -0
- package/dist/lib/prd/generate.js +357 -0
- package/dist/lib/prd/generate.js.map +1 -0
- package/dist/lib/prd/parse.d.ts +21 -0
- package/dist/lib/prd/parse.d.ts.map +1 -0
- package/dist/lib/prd/parse.js +270 -0
- package/dist/lib/prd/parse.js.map +1 -0
- package/dist/lib/prd/prompt-builder.d.ts +18 -0
- package/dist/lib/prd/prompt-builder.d.ts.map +1 -0
- package/dist/lib/prd/prompt-builder.js +61 -0
- package/dist/lib/prd/prompt-builder.js.map +1 -0
- package/dist/lib/prd/runner.d.ts +54 -0
- package/dist/lib/prd/runner.d.ts.map +1 -0
- package/dist/lib/prd/runner.js +563 -0
- package/dist/lib/prd/runner.js.map +1 -0
- package/dist/lib/prd/scheduler.d.ts +27 -0
- package/dist/lib/prd/scheduler.d.ts.map +1 -0
- package/dist/lib/prd/scheduler.js +113 -0
- package/dist/lib/prd/scheduler.js.map +1 -0
- package/dist/lib/prd/state.d.ts +77 -0
- package/dist/lib/prd/state.d.ts.map +1 -0
- package/dist/lib/prd/state.js +253 -0
- package/dist/lib/prd/state.js.map +1 -0
- package/dist/lib/prd/team-runner.d.ts +48 -0
- package/dist/lib/prd/team-runner.d.ts.map +1 -0
- package/dist/lib/prd/team-runner.js +261 -0
- package/dist/lib/prd/team-runner.js.map +1 -0
- package/dist/lib/prd/types.d.ts +169 -0
- package/dist/lib/prd/types.d.ts.map +1 -0
- package/dist/lib/prd/types.js +143 -0
- package/dist/lib/prd/types.js.map +1 -0
- package/dist/lib/prd/worktree.d.ts +54 -0
- package/dist/lib/prd/worktree.d.ts.map +1 -0
- package/dist/lib/prd/worktree.js +255 -0
- package/dist/lib/prd/worktree.js.map +1 -0
- package/dist/lib/precompute-context.d.ts +48 -0
- package/dist/lib/precompute-context.d.ts.map +1 -0
- package/dist/lib/precompute-context.js +265 -0
- package/dist/lib/precompute-context.js.map +1 -0
- package/dist/lib/pricing.d.ts +60 -0
- package/dist/lib/pricing.d.ts.map +1 -0
- package/dist/lib/pricing.js +258 -0
- package/dist/lib/pricing.js.map +1 -0
- package/dist/lib/process-registry.d.ts +30 -0
- package/dist/lib/process-registry.d.ts.map +1 -0
- package/dist/lib/process-registry.js +92 -0
- package/dist/lib/process-registry.js.map +1 -0
- package/dist/lib/progress-log.d.ts +44 -0
- package/dist/lib/progress-log.d.ts.map +1 -0
- package/dist/lib/progress-log.js +58 -0
- package/dist/lib/progress-log.js.map +1 -0
- package/dist/lib/public-api.d.ts +56 -0
- package/dist/lib/public-api.d.ts.map +1 -0
- package/dist/lib/public-api.js +63 -0
- package/dist/lib/public-api.js.map +1 -0
- package/dist/lib/quality.d.ts +66 -0
- package/dist/lib/quality.d.ts.map +1 -0
- package/dist/lib/quality.js +486 -0
- package/dist/lib/quality.js.map +1 -0
- package/dist/lib/query-expansion.d.ts +16 -0
- package/dist/lib/query-expansion.d.ts.map +1 -0
- package/dist/lib/query-expansion.js +53 -0
- package/dist/lib/query-expansion.js.map +1 -0
- package/dist/lib/readiness.d.ts +35 -0
- package/dist/lib/readiness.d.ts.map +1 -0
- package/dist/lib/readiness.js +142 -0
- package/dist/lib/readiness.js.map +1 -0
- package/dist/lib/reference-embeddings.d.ts +39 -0
- package/dist/lib/reference-embeddings.d.ts.map +1 -0
- package/dist/lib/reference-embeddings.js +95 -0
- package/dist/lib/reference-embeddings.js.map +1 -0
- package/dist/lib/reflection-synthesizer.d.ts +27 -0
- package/dist/lib/reflection-synthesizer.d.ts.map +1 -0
- package/dist/lib/reflection-synthesizer.js +149 -0
- package/dist/lib/reflection-synthesizer.js.map +1 -0
- package/dist/lib/retention.d.ts +105 -0
- package/dist/lib/retention.d.ts.map +1 -0
- package/dist/lib/retention.js +246 -0
- package/dist/lib/retention.js.map +1 -0
- package/dist/lib/sensitive-filter.d.ts +34 -0
- package/dist/lib/sensitive-filter.d.ts.map +1 -0
- package/dist/lib/sensitive-filter.js +344 -0
- package/dist/lib/sensitive-filter.js.map +1 -0
- package/dist/lib/session-observations.d.ts +59 -0
- package/dist/lib/session-observations.d.ts.map +1 -0
- package/dist/lib/session-observations.js +128 -0
- package/dist/lib/session-observations.js.map +1 -0
- package/dist/lib/session-summary.d.ts +65 -0
- package/dist/lib/session-summary.d.ts.map +1 -0
- package/dist/lib/session-summary.js +344 -0
- package/dist/lib/session-summary.js.map +1 -0
- package/dist/lib/similarity-worker.d.ts +7 -0
- package/dist/lib/similarity-worker.d.ts.map +1 -0
- package/dist/lib/similarity-worker.js +36 -0
- package/dist/lib/similarity-worker.js.map +1 -0
- package/dist/lib/skills.d.ts +78 -0
- package/dist/lib/skills.d.ts.map +1 -0
- package/dist/lib/skills.js +439 -0
- package/dist/lib/skills.js.map +1 -0
- package/dist/lib/skyll-client.d.ts +59 -0
- package/dist/lib/skyll-client.d.ts.map +1 -0
- package/dist/lib/skyll-client.js +257 -0
- package/dist/lib/skyll-client.js.map +1 -0
- package/dist/lib/storage/backends/interface.d.ts +383 -0
- package/dist/lib/storage/backends/interface.d.ts.map +1 -0
- package/dist/lib/storage/backends/interface.js +12 -0
- package/dist/lib/storage/backends/interface.js.map +1 -0
- package/dist/lib/storage/backends/postgresql.d.ts +454 -0
- package/dist/lib/storage/backends/postgresql.d.ts.map +1 -0
- package/dist/lib/storage/backends/postgresql.js +2528 -0
- package/dist/lib/storage/backends/postgresql.js.map +1 -0
- package/dist/lib/storage/benchmark.d.ts +16 -0
- package/dist/lib/storage/benchmark.d.ts.map +1 -0
- package/dist/lib/storage/benchmark.js +219 -0
- package/dist/lib/storage/benchmark.js.map +1 -0
- package/dist/lib/storage/dispatcher-export.d.ts +108 -0
- package/dist/lib/storage/dispatcher-export.d.ts.map +1 -0
- package/dist/lib/storage/dispatcher-export.js +593 -0
- package/dist/lib/storage/dispatcher-export.js.map +1 -0
- package/dist/lib/storage/dispatcher.d.ts +468 -0
- package/dist/lib/storage/dispatcher.d.ts.map +1 -0
- package/dist/lib/storage/dispatcher.js +1926 -0
- package/dist/lib/storage/dispatcher.js.map +1 -0
- package/dist/lib/storage/index.d.ts +481 -0
- package/dist/lib/storage/index.d.ts.map +1 -0
- package/dist/lib/storage/index.js +727 -0
- package/dist/lib/storage/index.js.map +1 -0
- package/dist/lib/storage/migration/export-import.d.ts +133 -0
- package/dist/lib/storage/migration/export-import.d.ts.map +1 -0
- package/dist/lib/storage/migration/export-import.js +264 -0
- package/dist/lib/storage/migration/export-import.js.map +1 -0
- package/dist/lib/storage/types.d.ts +313 -0
- package/dist/lib/storage/types.d.ts.map +1 -0
- package/dist/lib/storage/types.js +30 -0
- package/dist/lib/storage/types.js.map +1 -0
- package/dist/lib/storage/vector/interface.d.ts +89 -0
- package/dist/lib/storage/vector/interface.d.ts.map +1 -0
- package/dist/lib/storage/vector/interface.js +10 -0
- package/dist/lib/storage/vector/interface.js.map +1 -0
- package/dist/lib/storage/vector/qdrant.d.ts +221 -0
- package/dist/lib/storage/vector/qdrant.d.ts.map +1 -0
- package/dist/lib/storage/vector/qdrant.js +880 -0
- package/dist/lib/storage/vector/qdrant.js.map +1 -0
- package/dist/lib/supersession.d.ts +26 -0
- package/dist/lib/supersession.d.ts.map +1 -0
- package/dist/lib/supersession.js +97 -0
- package/dist/lib/supersession.js.map +1 -0
- package/dist/lib/temporal.d.ts +140 -0
- package/dist/lib/temporal.d.ts.map +1 -0
- package/dist/lib/temporal.js +303 -0
- package/dist/lib/temporal.js.map +1 -0
- package/dist/lib/token-budget.d.ts +79 -0
- package/dist/lib/token-budget.d.ts.map +1 -0
- package/dist/lib/token-budget.js +146 -0
- package/dist/lib/token-budget.js.map +1 -0
- package/dist/lib/token-counter.d.ts +27 -0
- package/dist/lib/token-counter.d.ts.map +1 -0
- package/dist/lib/token-counter.js +52 -0
- package/dist/lib/token-counter.js.map +1 -0
- package/dist/lib/tree-sitter/chunker-ts.d.ts +24 -0
- package/dist/lib/tree-sitter/chunker-ts.d.ts.map +1 -0
- package/dist/lib/tree-sitter/chunker-ts.js +206 -0
- package/dist/lib/tree-sitter/chunker-ts.js.map +1 -0
- package/dist/lib/tree-sitter/extractor.d.ts +43 -0
- package/dist/lib/tree-sitter/extractor.d.ts.map +1 -0
- package/dist/lib/tree-sitter/extractor.js +297 -0
- package/dist/lib/tree-sitter/extractor.js.map +1 -0
- package/dist/lib/tree-sitter/index.d.ts +13 -0
- package/dist/lib/tree-sitter/index.d.ts.map +1 -0
- package/dist/lib/tree-sitter/index.js +14 -0
- package/dist/lib/tree-sitter/index.js.map +1 -0
- package/dist/lib/tree-sitter/parser.d.ts +70 -0
- package/dist/lib/tree-sitter/parser.d.ts.map +1 -0
- package/dist/lib/tree-sitter/parser.js +354 -0
- package/dist/lib/tree-sitter/parser.js.map +1 -0
- package/dist/lib/tree-sitter/public.d.ts +28 -0
- package/dist/lib/tree-sitter/public.d.ts.map +1 -0
- package/dist/lib/tree-sitter/public.js +50 -0
- package/dist/lib/tree-sitter/public.js.map +1 -0
- package/dist/lib/tree-sitter/queries.d.ts +28 -0
- package/dist/lib/tree-sitter/queries.d.ts.map +1 -0
- package/dist/lib/tree-sitter/queries.js +383 -0
- package/dist/lib/tree-sitter/queries.js.map +1 -0
- package/dist/lib/tree-sitter/types.d.ts +69 -0
- package/dist/lib/tree-sitter/types.d.ts.map +1 -0
- package/dist/lib/tree-sitter/types.js +131 -0
- package/dist/lib/tree-sitter/types.js.map +1 -0
- package/dist/lib/working-memory-pipeline.d.ts +118 -0
- package/dist/lib/working-memory-pipeline.d.ts.map +1 -0
- package/dist/lib/working-memory-pipeline.js +344 -0
- package/dist/lib/working-memory-pipeline.js.map +1 -0
- package/dist/mcp/helpers.d.ts +44 -0
- package/dist/mcp/helpers.d.ts.map +1 -0
- package/dist/mcp/helpers.js +244 -0
- package/dist/mcp/helpers.js.map +1 -0
- package/dist/mcp/index.d.ts +10 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +15 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/resources.d.ts +12 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +136 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/server.d.ts +22 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +131 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/config.d.ts +10 -0
- package/dist/mcp/tools/config.d.ts.map +1 -0
- package/dist/mcp/tools/config.js +236 -0
- package/dist/mcp/tools/config.js.map +1 -0
- package/dist/mcp/tools/dead-end.d.ts +9 -0
- package/dist/mcp/tools/dead-end.d.ts.map +1 -0
- package/dist/mcp/tools/dead-end.js +137 -0
- package/dist/mcp/tools/dead-end.js.map +1 -0
- package/dist/mcp/tools/debug.d.ts +9 -0
- package/dist/mcp/tools/debug.d.ts.map +1 -0
- package/dist/mcp/tools/debug.js +387 -0
- package/dist/mcp/tools/debug.js.map +1 -0
- package/dist/mcp/tools/graph.d.ts +9 -0
- package/dist/mcp/tools/graph.d.ts.map +1 -0
- package/dist/mcp/tools/graph.js +337 -0
- package/dist/mcp/tools/graph.js.map +1 -0
- package/dist/mcp/tools/indexing.d.ts +12 -0
- package/dist/mcp/tools/indexing.d.ts.map +1 -0
- package/dist/mcp/tools/indexing.js +289 -0
- package/dist/mcp/tools/indexing.js.map +1 -0
- package/dist/mcp/tools/memory.d.ts +14 -0
- package/dist/mcp/tools/memory.d.ts.map +1 -0
- package/dist/mcp/tools/memory.js +1170 -0
- package/dist/mcp/tools/memory.js.map +1 -0
- package/dist/mcp/tools/prd.d.ts +12 -0
- package/dist/mcp/tools/prd.d.ts.map +1 -0
- package/dist/mcp/tools/prd.js +276 -0
- package/dist/mcp/tools/prd.js.map +1 -0
- package/dist/mcp/tools/search.d.ts +9 -0
- package/dist/mcp/tools/search.d.ts.map +1 -0
- package/dist/mcp/tools/search.js +279 -0
- package/dist/mcp/tools/search.js.map +1 -0
- package/dist/mcp/tools/status.d.ts +10 -0
- package/dist/mcp/tools/status.d.ts.map +1 -0
- package/dist/mcp/tools/status.js +296 -0
- package/dist/mcp/tools/status.js.map +1 -0
- package/dist/mcp/tools/web-fetch.d.ts +10 -0
- package/dist/mcp/tools/web-fetch.d.ts.map +1 -0
- package/dist/mcp/tools/web-fetch.js +107 -0
- package/dist/mcp/tools/web-fetch.js.map +1 -0
- package/dist/mcp/tools/web-search.d.ts +14 -0
- package/dist/mcp/tools/web-search.d.ts.map +1 -0
- package/dist/mcp/tools/web-search.js +427 -0
- package/dist/mcp/tools/web-search.js.map +1 -0
- package/dist/mcp/types.d.ts +16 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +5 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/mcp-server.d.ts +9 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +9 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/prompts/analyze.d.ts +21 -0
- package/dist/prompts/analyze.d.ts.map +1 -0
- package/dist/prompts/analyze.js +27 -0
- package/dist/prompts/analyze.js.map +1 -0
- package/dist/prompts/briefing.d.ts +27 -0
- package/dist/prompts/briefing.d.ts.map +1 -0
- package/dist/prompts/briefing.js +123 -0
- package/dist/prompts/briefing.js.map +1 -0
- package/dist/prompts/chat.d.ts +8 -0
- package/dist/prompts/chat.d.ts.map +1 -0
- package/dist/prompts/chat.js +39 -0
- package/dist/prompts/chat.js.map +1 -0
- package/dist/prompts/daemon.d.ts +16 -0
- package/dist/prompts/daemon.d.ts.map +1 -0
- package/dist/prompts/daemon.js +46 -0
- package/dist/prompts/daemon.js.map +1 -0
- package/dist/prompts/extraction.d.ts +13 -0
- package/dist/prompts/extraction.d.ts.map +1 -0
- package/dist/prompts/extraction.js +93 -0
- package/dist/prompts/extraction.js.map +1 -0
- package/dist/prompts/index.d.ts +17 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +27 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/memory.d.ts +11 -0
- package/dist/prompts/memory.d.ts.map +1 -0
- package/dist/prompts/memory.js +23 -0
- package/dist/prompts/memory.js.map +1 -0
- package/dist/prompts/onboarding.d.ts +16 -0
- package/dist/prompts/onboarding.d.ts.map +1 -0
- package/dist/prompts/onboarding.js +183 -0
- package/dist/prompts/onboarding.js.map +1 -0
- package/dist/prompts/prd.d.ts +12 -0
- package/dist/prompts/prd.d.ts.map +1 -0
- package/dist/prompts/prd.js +211 -0
- package/dist/prompts/prd.js.map +1 -0
- package/dist/prompts/quality.d.ts +11 -0
- package/dist/prompts/quality.d.ts.map +1 -0
- package/dist/prompts/quality.js +11 -0
- package/dist/prompts/quality.js.map +1 -0
- package/dist/prompts/skills.d.ts +16 -0
- package/dist/prompts/skills.d.ts.map +1 -0
- package/dist/prompts/skills.js +30 -0
- package/dist/prompts/skills.js.map +1 -0
- package/hooks/succ-post-tool.cjs +227 -0
- package/hooks/succ-pre-tool.cjs +312 -0
- package/hooks/succ-session-end.cjs +85 -0
- package/hooks/succ-session-start.cjs +618 -0
- package/hooks/succ-stop-reflection.cjs +87 -0
- package/hooks/succ-user-prompt.cjs +220 -0
- package/package.json +128 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PostToolUse Hook - Auto-capture important actions
|
|
4
|
+
*
|
|
5
|
+
* Automatically saves memories for significant events:
|
|
6
|
+
* 1. Git commits - save commit message as milestone
|
|
7
|
+
* 2. New dependencies - track package additions
|
|
8
|
+
* 3. Test runs - save test results
|
|
9
|
+
* 4. File creation - note new files
|
|
10
|
+
* 5. MEMORY.md sync - auto-save bullets to long-term memory
|
|
11
|
+
* 6. Task/Explore/succ-* results - save subagent findings to long-term memory
|
|
12
|
+
*
|
|
13
|
+
* Uses daemon API for memory operations
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Parse MEMORY.md bullets, classify by section header.
|
|
21
|
+
* Returns [{ text, tags }] for each bullet worth saving.
|
|
22
|
+
*/
|
|
23
|
+
function parseMemoryMdBullets(content) {
|
|
24
|
+
const results = [];
|
|
25
|
+
let currentSection = '';
|
|
26
|
+
|
|
27
|
+
for (const line of content.split('\n')) {
|
|
28
|
+
const headerMatch = line.match(/^##\s+(.+)/);
|
|
29
|
+
if (headerMatch) {
|
|
30
|
+
currentSection = headerMatch[1].trim().toLowerCase();
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const bulletMatch = line.match(/^-\s+(.+)/);
|
|
35
|
+
if (!bulletMatch) continue;
|
|
36
|
+
|
|
37
|
+
const text = bulletMatch[1].trim();
|
|
38
|
+
if (text.length < 10) continue;
|
|
39
|
+
|
|
40
|
+
const tags = ['memory-md'];
|
|
41
|
+
if (/gotcha/i.test(currentSection)) tags.push('gotcha');
|
|
42
|
+
else if (/learning|lesson/i.test(currentSection)) tags.push('learning');
|
|
43
|
+
else if (/decision|chose/i.test(currentSection)) tags.push('decision');
|
|
44
|
+
else if (/pattern/i.test(currentSection)) tags.push('pattern');
|
|
45
|
+
else if (/change|phase/i.test(currentSection)) tags.push('changelog');
|
|
46
|
+
else tags.push('observation');
|
|
47
|
+
|
|
48
|
+
results.push({ text, tags });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return results;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let input = '';
|
|
55
|
+
process.stdin.setEncoding('utf8');
|
|
56
|
+
process.stdin.on('readable', () => {
|
|
57
|
+
let chunk;
|
|
58
|
+
while ((chunk = process.stdin.read()) !== null) {
|
|
59
|
+
input += chunk;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
process.stdin.on('end', async () => {
|
|
64
|
+
try {
|
|
65
|
+
const hookInput = JSON.parse(input);
|
|
66
|
+
let projectDir = hookInput.cwd || process.cwd();
|
|
67
|
+
|
|
68
|
+
// Windows path fix
|
|
69
|
+
if (process.platform === 'win32' && /^\/[a-z]\//.test(projectDir)) {
|
|
70
|
+
projectDir = projectDir[1].toUpperCase() + ':' + projectDir.slice(2);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Skip if succ is not initialized in this project
|
|
74
|
+
if (!fs.existsSync(path.join(projectDir, '.succ'))) {
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const toolName = hookInput.tool_name || '';
|
|
79
|
+
const toolInput = hookInput.tool_input || {};
|
|
80
|
+
const toolOutput = hookInput.tool_output || hookInput.tool_response || '';
|
|
81
|
+
const wasSuccess = !hookInput.tool_error;
|
|
82
|
+
|
|
83
|
+
if (!wasSuccess) {
|
|
84
|
+
process.exit(0);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Read daemon port
|
|
88
|
+
let daemonPort = null;
|
|
89
|
+
try {
|
|
90
|
+
const portFile = path.join(projectDir, '.succ', '.tmp', 'daemon.port');
|
|
91
|
+
if (fs.existsSync(portFile)) {
|
|
92
|
+
daemonPort = parseInt(fs.readFileSync(portFile, 'utf8').trim(), 10);
|
|
93
|
+
}
|
|
94
|
+
} catch {}
|
|
95
|
+
|
|
96
|
+
if (!daemonPort) {
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Helper to save memory via daemon API
|
|
101
|
+
const succRemember = async (content, tagsStr) => {
|
|
102
|
+
try {
|
|
103
|
+
await fetch(`http://127.0.0.1:${daemonPort}/api/remember`, {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
headers: { 'Content-Type': 'application/json' },
|
|
106
|
+
body: JSON.stringify({
|
|
107
|
+
content: content,
|
|
108
|
+
tags: tagsStr.split(','),
|
|
109
|
+
source: 'auto-capture',
|
|
110
|
+
}),
|
|
111
|
+
signal: AbortSignal.timeout(3000),
|
|
112
|
+
});
|
|
113
|
+
} catch {}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Pattern 1: Git Commits
|
|
117
|
+
if (toolName === 'Bash' && toolInput.command) {
|
|
118
|
+
const cmd = toolInput.command;
|
|
119
|
+
|
|
120
|
+
if (/git\s+commit/i.test(cmd) && wasSuccess) {
|
|
121
|
+
const msgMatch = cmd.match(/-m\s+["']([^"']+)["']/);
|
|
122
|
+
if (msgMatch) {
|
|
123
|
+
await succRemember('Committed: ' + msgMatch[1], 'git,commit,milestone');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// npm/yarn install detection
|
|
128
|
+
if (/(?:npm|yarn|pnpm)\s+(?:install|add)\s+(\S+)/i.test(cmd) && wasSuccess) {
|
|
129
|
+
const pkgMatch = cmd.match(/(?:npm|yarn|pnpm)\s+(?:install|add)\s+(\S+)/i);
|
|
130
|
+
if (pkgMatch && pkgMatch[1] && !pkgMatch[1].startsWith('-')) {
|
|
131
|
+
await succRemember('Added dependency: ' + pkgMatch[1], 'dependency,package');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Test run detection
|
|
136
|
+
if (/(?:npm\s+test|yarn\s+test|pytest|jest|vitest)/i.test(cmd)) {
|
|
137
|
+
const passed = /pass|success|ok|✓/i.test(toolOutput);
|
|
138
|
+
const failed = /fail|error|✗|✘/i.test(toolOutput);
|
|
139
|
+
|
|
140
|
+
if (passed && !failed) {
|
|
141
|
+
await succRemember('Tests passed after changes', 'test,success');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Pattern 2: File Creation
|
|
147
|
+
if (toolName === 'Write' && toolInput.file_path && wasSuccess) {
|
|
148
|
+
const filePath = toolInput.file_path;
|
|
149
|
+
const relativePath = path.relative(projectDir, filePath);
|
|
150
|
+
|
|
151
|
+
if (
|
|
152
|
+
!relativePath.includes('node_modules') &&
|
|
153
|
+
!relativePath.includes('.tmp') &&
|
|
154
|
+
!relativePath.startsWith('.') &&
|
|
155
|
+
/\.(ts|tsx|js|jsx|py|go|rs|md)$/.test(relativePath)
|
|
156
|
+
) {
|
|
157
|
+
const content = toolInput.content || '';
|
|
158
|
+
if (content.length < 5000) {
|
|
159
|
+
await succRemember('Created file: ' + relativePath, 'file,created');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Pattern 3: Task/Explore results → save subagent findings to long-term memory
|
|
165
|
+
if (toolName === 'Task' && toolInput.subagent_type) {
|
|
166
|
+
const agentType = toolInput.subagent_type;
|
|
167
|
+
// Capture Explore, Plan, feature-dev, and all succ-* agents
|
|
168
|
+
if (/^(Explore|Plan|feature-dev|succ-)/.test(agentType)) {
|
|
169
|
+
// Extract clean text from agent response (strip JSON wrapper with status/prompt/agentId)
|
|
170
|
+
let text = '';
|
|
171
|
+
try {
|
|
172
|
+
const parsed = typeof toolOutput === 'string' ? JSON.parse(toolOutput) : toolOutput;
|
|
173
|
+
if (parsed && Array.isArray(parsed.content)) {
|
|
174
|
+
// Claude SDK format: { status, prompt, agentId, content: [{ type: "text", text: "..." }] }
|
|
175
|
+
text = parsed.content
|
|
176
|
+
.filter(c => c.type === 'text' && c.text)
|
|
177
|
+
.map(c => c.text)
|
|
178
|
+
.join('\n\n');
|
|
179
|
+
} else if (typeof parsed === 'string') {
|
|
180
|
+
text = parsed;
|
|
181
|
+
}
|
|
182
|
+
} catch {
|
|
183
|
+
text = typeof toolOutput === 'string' ? toolOutput : '';
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (text.length > 50 && text.length < 20000) {
|
|
187
|
+
// Skip if succ-* agent already saved to memory (avoid duplicates)
|
|
188
|
+
const agentAlreadySaved = /^succ-/.test(agentType) &&
|
|
189
|
+
/succ_remember|saved to memory|memory \(id:/i.test(text);
|
|
190
|
+
if (!agentAlreadySaved) {
|
|
191
|
+
const desc = (toolInput.description || '').slice(0, 100);
|
|
192
|
+
const content = `[${agentType}] ${desc}\n\n${text.slice(0, 3000)}`;
|
|
193
|
+
await succRemember(content, `subagent,${agentType.toLowerCase()},auto-capture`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Pattern 4: MEMORY.md sync → save bullets to long-term memory (parallel)
|
|
200
|
+
if ((toolName === 'Edit' || toolName === 'Write') && toolInput.file_path && wasSuccess) {
|
|
201
|
+
if (path.basename(toolInput.file_path) === 'MEMORY.md') {
|
|
202
|
+
try {
|
|
203
|
+
const memContent = fs.readFileSync(toolInput.file_path, 'utf8');
|
|
204
|
+
const bullets = parseMemoryMdBullets(memContent);
|
|
205
|
+
if (bullets.length > 0) {
|
|
206
|
+
await Promise.allSettled(bullets.map(bullet =>
|
|
207
|
+
fetch(`http://127.0.0.1:${daemonPort}/api/remember`, {
|
|
208
|
+
method: 'POST',
|
|
209
|
+
headers: { 'Content-Type': 'application/json' },
|
|
210
|
+
body: JSON.stringify({
|
|
211
|
+
content: bullet.text,
|
|
212
|
+
tags: bullet.tags,
|
|
213
|
+
source: 'memory-md-sync',
|
|
214
|
+
}),
|
|
215
|
+
signal: AbortSignal.timeout(5000),
|
|
216
|
+
}).catch(() => {})
|
|
217
|
+
));
|
|
218
|
+
}
|
|
219
|
+
} catch {}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
process.exit(0);
|
|
224
|
+
} catch (err) {
|
|
225
|
+
process.exit(0);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PreToolUse Hook — Command safety guard + commit context injection
|
|
4
|
+
*
|
|
5
|
+
* Fires before every Bash tool call. Three features:
|
|
6
|
+
*
|
|
7
|
+
* 1. Command safety guard — blocks dangerous git/filesystem/database/docker commands
|
|
8
|
+
* Config: commandSafetyGuard.mode = 'deny' | 'ask' | 'off' (default: 'deny')
|
|
9
|
+
* Config: commandSafetyGuard.allowlist = string[]
|
|
10
|
+
* Config: commandSafetyGuard.customPatterns = [{ pattern: "regex", reason: "why" }]
|
|
11
|
+
*
|
|
12
|
+
* 2. Commit guidelines injection — injects co-author format into context
|
|
13
|
+
* when Claude is about to run git commit
|
|
14
|
+
* Config: includeCoAuthoredBy (default: true)
|
|
15
|
+
*
|
|
16
|
+
* 3. Pre-commit diff review reminder — injects reminder to run diff-reviewer
|
|
17
|
+
* Config: preCommitReview (default: false)
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
const path = require('path');
|
|
22
|
+
|
|
23
|
+
// ─── Dangerous command patterns ──────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
const DANGEROUS_PATTERNS = [
|
|
26
|
+
// ── Git — data loss ──
|
|
27
|
+
{ pattern: /\bgit\s+reset\s+--hard\b/, reason: 'git reset --hard destroys uncommitted changes. Use git stash first.' },
|
|
28
|
+
{ pattern: /\bgit\s+reset\s+--merge\b/, reason: 'git reset --merge can destroy uncommitted changes.' },
|
|
29
|
+
{ pattern: /\bgit\s+checkout\s+--\s/, reason: 'git checkout -- discards file modifications. Use git stash first.' },
|
|
30
|
+
{ pattern: /\bgit\s+checkout\s+\.\s*($|[;&|])/, reason: 'git checkout . discards all modifications. Use git stash first.' },
|
|
31
|
+
{ pattern: /\bgit\s+restore\s+--staged\s+--worktree\b/, reason: 'git restore --staged --worktree discards both staged and unstaged changes.' },
|
|
32
|
+
{ pattern: /\bgit\s+clean\s+-[a-zA-Z]*f/, reason: 'git clean -f permanently deletes untracked files.' },
|
|
33
|
+
{ pattern: /\bgit\s+push\s+.*--force(?!-with-lease)\b/, reason: 'git push --force rewrites remote history. Use --force-with-lease instead.' },
|
|
34
|
+
{ pattern: /\bgit\s+push\s+-f\b/, reason: 'git push -f rewrites remote history. Use --force-with-lease instead.' },
|
|
35
|
+
{ pattern: /\bgit\s+branch\s+-D\b/, reason: 'git branch -D force-deletes without merge verification. Use -d for safe delete.' },
|
|
36
|
+
{ pattern: /\bgit\s+stash\s+drop\b/, reason: 'git stash drop permanently destroys stashed work.' },
|
|
37
|
+
{ pattern: /\bgit\s+stash\s+clear\b/, reason: 'git stash clear destroys ALL stashed work.' },
|
|
38
|
+
{ pattern: /\bgit\s+rebase\s+-i\b/, reason: 'git rebase -i requires interactive terminal (not available in hooks).' },
|
|
39
|
+
{ pattern: /\bgit\s+reflog\s+expire\s+--expire=now\b/, reason: 'git reflog expire --expire=now permanently removes recovery points.' },
|
|
40
|
+
|
|
41
|
+
// ── Filesystem — data loss ──
|
|
42
|
+
{ pattern: /\brm\s+.*\.succ\b/, reason: '.succ/ contains your memory, brain vault, and config. This would destroy all succ data.' },
|
|
43
|
+
{ pattern: /\brm\s+-[a-zA-Z]*r[a-zA-Z]*f[a-zA-Z]*\b/, reason: 'rm -rf can permanently delete files. Verify the target path.', checkPath: true },
|
|
44
|
+
{ pattern: /\brm\s+-[a-zA-Z]*f[a-zA-Z]*r[a-zA-Z]*\b/, reason: 'rm -fr can permanently delete files. Verify the target path.', checkPath: true },
|
|
45
|
+
|
|
46
|
+
// ── Docker — container/image/volume destruction ──
|
|
47
|
+
{ pattern: /\bdocker\s+system\s+prune\b/, reason: 'docker system prune removes all unused containers, networks, images, and optionally volumes.' },
|
|
48
|
+
{ pattern: /\bdocker\s+volume\s+prune\b/, reason: 'docker volume prune removes all unused volumes (potential data loss).' },
|
|
49
|
+
{ pattern: /\bdocker\s+rm\s+-f\b/, reason: 'docker rm -f force-removes running containers without graceful shutdown.' },
|
|
50
|
+
{ pattern: /\bdocker\s+rmi\s+-f\b/, reason: 'docker rmi -f force-removes images that may be in use.' },
|
|
51
|
+
{ pattern: /\bdocker-compose\s+down\s+-v\b/, reason: 'docker-compose down -v removes named volumes (database data loss).' },
|
|
52
|
+
{ pattern: /\bdocker\s+compose\s+down\s+-v\b/, reason: 'docker compose down -v removes named volumes (database data loss).' },
|
|
53
|
+
|
|
54
|
+
// ── SQLite — database destruction ──
|
|
55
|
+
{ pattern: /\bsqlite3?\b.*\bDROP\s+TABLE\b/i, reason: 'DROP TABLE permanently deletes a SQLite table and all its data.' },
|
|
56
|
+
{ pattern: /\bsqlite3?\b.*\bDROP\s+DATABASE\b/i, reason: 'DROP DATABASE permanently deletes the entire SQLite database.' },
|
|
57
|
+
{ pattern: /\bsqlite3?\b.*\bDELETE\s+FROM\s+\w+\s*;/i, reason: 'DELETE FROM without WHERE deletes all rows in a SQLite table.' },
|
|
58
|
+
{ pattern: /\bsqlite3?\b.*\bTRUNCATE\b/i, reason: 'TRUNCATE removes all data from a SQLite table.' },
|
|
59
|
+
|
|
60
|
+
// ── PostgreSQL — database destruction ──
|
|
61
|
+
{ pattern: /\bpsql\b.*\bDROP\s+TABLE\b/i, reason: 'DROP TABLE permanently deletes a PostgreSQL table and all its data.' },
|
|
62
|
+
{ pattern: /\bpsql\b.*\bDROP\s+DATABASE\b/i, reason: 'DROP DATABASE permanently deletes the entire PostgreSQL database.' },
|
|
63
|
+
{ pattern: /\bpsql\b.*\bDELETE\s+FROM\s+\w+\s*;/i, reason: 'DELETE FROM without WHERE deletes all rows in a PostgreSQL table.' },
|
|
64
|
+
{ pattern: /\bpsql\b.*\bTRUNCATE\b/i, reason: 'TRUNCATE removes all data from a PostgreSQL table.' },
|
|
65
|
+
{ pattern: /\bdropdb\b/, reason: 'dropdb permanently deletes a PostgreSQL database.' },
|
|
66
|
+
{ pattern: /\bdropuser\b/, reason: 'dropuser permanently deletes a PostgreSQL user/role.' },
|
|
67
|
+
|
|
68
|
+
// ── Qdrant — vector database destruction ──
|
|
69
|
+
{ pattern: /\bcurl\b.*\bqdrant\b.*\bDELETE\b/i, reason: 'DELETE on Qdrant API can remove collections or points permanently.' },
|
|
70
|
+
{ pattern: /\bcurl\b.*\b:6333\b.*\bDELETE\b/i, reason: 'DELETE on Qdrant port 6333 can remove collections or points permanently.' },
|
|
71
|
+
{ pattern: /\bcurl\b.*\b:6334\b.*\bDELETE\b/i, reason: 'DELETE on Qdrant gRPC port can remove data permanently.' },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
// Paths where rm -rf is considered safe (normalized, lowercase)
|
|
75
|
+
const SAFE_RM_PATHS = [
|
|
76
|
+
'/tmp', '/var/tmp',
|
|
77
|
+
'node_modules', 'dist', 'build', '.cache',
|
|
78
|
+
'__pycache__', '.pytest_cache', '.tox',
|
|
79
|
+
'target/debug', 'target/release',
|
|
80
|
+
'.next', '.nuxt', '.turbo', 'coverage',
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
// Prefixes that indicate the command is data, not execution
|
|
84
|
+
const DATA_PREFIXES = [
|
|
85
|
+
/^\s*(?:#|\/\/)/, // comments
|
|
86
|
+
/^\s*echo\b/, // echo
|
|
87
|
+
/^\s*printf\b/, // printf
|
|
88
|
+
/^\s*cat\s*<</, // heredoc (cat <<)
|
|
89
|
+
/^\s*grep\b/, // grep
|
|
90
|
+
/^\s*rg\b/, // ripgrep
|
|
91
|
+
/^\s*ag\b/, // silver searcher
|
|
92
|
+
/^\s*(?:"|').*(?:"|')\s*$/,// quoted string
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
96
|
+
|
|
97
|
+
function loadConfig(projectDir) {
|
|
98
|
+
const defaults = {
|
|
99
|
+
commandSafetyGuard: { mode: 'deny', allowlist: [], customPatterns: [] },
|
|
100
|
+
includeCoAuthoredBy: true,
|
|
101
|
+
preCommitReview: false,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const configPaths = [
|
|
105
|
+
path.join(projectDir, '.succ', 'config.json'),
|
|
106
|
+
path.join(require('os').homedir(), '.succ', 'config.json'),
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
for (const configPath of configPaths) {
|
|
110
|
+
if (fs.existsSync(configPath)) {
|
|
111
|
+
try {
|
|
112
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
113
|
+
|
|
114
|
+
// Command safety guard
|
|
115
|
+
if (config.commandSafetyGuard) {
|
|
116
|
+
if (config.commandSafetyGuard.mode) {
|
|
117
|
+
defaults.commandSafetyGuard.mode = config.commandSafetyGuard.mode;
|
|
118
|
+
}
|
|
119
|
+
if (Array.isArray(config.commandSafetyGuard.allowlist)) {
|
|
120
|
+
defaults.commandSafetyGuard.allowlist = config.commandSafetyGuard.allowlist;
|
|
121
|
+
}
|
|
122
|
+
if (Array.isArray(config.commandSafetyGuard.customPatterns)) {
|
|
123
|
+
defaults.commandSafetyGuard.customPatterns = config.commandSafetyGuard.customPatterns;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (config.includeCoAuthoredBy === false) {
|
|
128
|
+
defaults.includeCoAuthoredBy = false;
|
|
129
|
+
}
|
|
130
|
+
if (config.preCommitReview === true) {
|
|
131
|
+
defaults.preCommitReview = true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
break;
|
|
135
|
+
} catch {
|
|
136
|
+
// Ignore parse errors
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return defaults;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function isDataContext(command) {
|
|
145
|
+
const trimmed = command.trim();
|
|
146
|
+
return DATA_PREFIXES.some(prefix => prefix.test(trimmed));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function isRmPathSafe(command) {
|
|
150
|
+
const match = command.match(/\brm\s+-[a-zA-Z]*(?:rf|fr)[a-zA-Z]*\s+(.+?)(?:\s*[;&|]|$)/);
|
|
151
|
+
if (!match) return false;
|
|
152
|
+
|
|
153
|
+
const target = match[1].trim().replace(/["']/g, '');
|
|
154
|
+
const normalized = target.toLowerCase().replace(/\\/g, '/');
|
|
155
|
+
|
|
156
|
+
return SAFE_RM_PATHS.some(safe => {
|
|
157
|
+
if (normalized === safe || normalized.endsWith('/' + safe)) return true;
|
|
158
|
+
if (safe === '/tmp' && normalized.startsWith('/tmp/')) return true;
|
|
159
|
+
if (safe === '/var/tmp' && normalized.startsWith('/var/tmp/')) return true;
|
|
160
|
+
return false;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function checkDangerous(command, config) {
|
|
165
|
+
if (config.commandSafetyGuard.mode === 'off') return null;
|
|
166
|
+
|
|
167
|
+
// Check allowlist first
|
|
168
|
+
const allowlist = config.commandSafetyGuard.allowlist || [];
|
|
169
|
+
for (const allowed of allowlist) {
|
|
170
|
+
if (command.includes(allowed)) return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Skip if command is in a data context
|
|
174
|
+
if (isDataContext(command)) return null;
|
|
175
|
+
|
|
176
|
+
// Check built-in patterns
|
|
177
|
+
for (const { pattern, reason, checkPath } of DANGEROUS_PATTERNS) {
|
|
178
|
+
if (pattern.test(command)) {
|
|
179
|
+
if (checkPath && isRmPathSafe(command)) continue;
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
reason,
|
|
183
|
+
mode: config.commandSafetyGuard.mode,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Check user-defined custom patterns (blacklist)
|
|
189
|
+
const customPatterns = config.commandSafetyGuard.customPatterns || [];
|
|
190
|
+
for (const custom of customPatterns) {
|
|
191
|
+
try {
|
|
192
|
+
const regex = new RegExp(custom.pattern, custom.flags || '');
|
|
193
|
+
if (regex.test(command)) {
|
|
194
|
+
return {
|
|
195
|
+
reason: custom.reason || `Blocked by custom pattern: ${custom.pattern}`,
|
|
196
|
+
mode: config.commandSafetyGuard.mode,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
} catch {
|
|
200
|
+
// Invalid regex in config — skip silently
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function buildCommitContext(config) {
|
|
208
|
+
const parts = [];
|
|
209
|
+
|
|
210
|
+
if (config.includeCoAuthoredBy) {
|
|
211
|
+
parts.push(`<commit-format>
|
|
212
|
+
Footer order (succ always LAST):
|
|
213
|
+
1. Generated with [Claude Code]
|
|
214
|
+
2. via [Happy] (if used)
|
|
215
|
+
3. powered by [succ](https://succ.ai)
|
|
216
|
+
|
|
217
|
+
Co-Authored-By order (succ always LAST):
|
|
218
|
+
1. Co-Authored-By: Claude <noreply@anthropic.com>
|
|
219
|
+
2. Co-Authored-By: Happy <yesreply@happy.engineering> (if used)
|
|
220
|
+
3. Co-Authored-By: succ <mindpalace@succ.ai>
|
|
221
|
+
</commit-format>`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (config.preCommitReview) {
|
|
225
|
+
parts.push(`<pre-commit-review>
|
|
226
|
+
STOP. Before committing, you MUST run the succ-diff-reviewer agent first.
|
|
227
|
+
Use: Task tool with subagent_type="succ-diff-reviewer"
|
|
228
|
+
Prompt: "Review the staged git diff for bugs, security issues, and regressions before commit"
|
|
229
|
+
|
|
230
|
+
If diff-reviewer finds CRITICAL issues — do NOT commit until fixed.
|
|
231
|
+
If diff-reviewer finds HIGH issues — warn the user before committing.
|
|
232
|
+
MEDIUM and below — commit is OK, mention findings in summary.
|
|
233
|
+
</pre-commit-review>`);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return parts.join('\n');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ─── Main ────────────────────────────────────────────────────────────
|
|
240
|
+
|
|
241
|
+
let input = '';
|
|
242
|
+
process.stdin.setEncoding('utf8');
|
|
243
|
+
process.stdin.on('readable', () => {
|
|
244
|
+
let chunk;
|
|
245
|
+
while ((chunk = process.stdin.read()) !== null) {
|
|
246
|
+
input += chunk;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
process.stdin.on('end', () => {
|
|
251
|
+
try {
|
|
252
|
+
const hookInput = JSON.parse(input);
|
|
253
|
+
let projectDir = hookInput.cwd || process.cwd();
|
|
254
|
+
|
|
255
|
+
// Windows path fix
|
|
256
|
+
if (process.platform === 'win32' && /^\/[a-z]\//.test(projectDir)) {
|
|
257
|
+
projectDir = projectDir[1].toUpperCase() + ':' + projectDir.slice(2);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Skip if this is a service session (daemon, reflection agent, etc.)
|
|
261
|
+
if (process.env.SUCC_SERVICE_SESSION === '1') {
|
|
262
|
+
process.exit(0);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Skip if succ is not initialized
|
|
266
|
+
if (!fs.existsSync(path.join(projectDir, '.succ'))) {
|
|
267
|
+
process.exit(0);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const command = hookInput.tool_input?.command || '';
|
|
271
|
+
if (!command) {
|
|
272
|
+
process.exit(0);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const config = loadConfig(projectDir);
|
|
276
|
+
|
|
277
|
+
// 1. Command safety guard
|
|
278
|
+
const dangerousResult = checkDangerous(command, config);
|
|
279
|
+
if (dangerousResult) {
|
|
280
|
+
const output = {
|
|
281
|
+
hookSpecificOutput: {
|
|
282
|
+
hookEventName: 'PreToolUse',
|
|
283
|
+
permissionDecision: dangerousResult.mode === 'ask' ? 'ask' : 'deny',
|
|
284
|
+
permissionDecisionReason: `[succ guard] ${dangerousResult.reason}`,
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
console.log(JSON.stringify(output));
|
|
288
|
+
process.exit(0);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// 2. Git commit — inject guidelines + diff review reminder
|
|
292
|
+
if (/\bgit\s+commit\b/.test(command)) {
|
|
293
|
+
const additionalContext = buildCommitContext(config);
|
|
294
|
+
if (additionalContext) {
|
|
295
|
+
const output = {
|
|
296
|
+
hookSpecificOutput: {
|
|
297
|
+
hookEventName: 'PreToolUse',
|
|
298
|
+
additionalContext,
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
console.log(JSON.stringify(output));
|
|
302
|
+
process.exit(0);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// No action needed
|
|
307
|
+
process.exit(0);
|
|
308
|
+
} catch {
|
|
309
|
+
// Fail-open: don't block on hook errors
|
|
310
|
+
process.exit(0);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* SessionEnd Hook - Notify daemon to process session
|
|
4
|
+
*
|
|
5
|
+
* Minimal hook that just tells daemon to:
|
|
6
|
+
* 1. Unregister the session
|
|
7
|
+
* 2. Process transcript asynchronously (summarize, extract learnings, save to memory)
|
|
8
|
+
*
|
|
9
|
+
* All heavy lifting is done by daemon after hook exits.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
let input = '';
|
|
16
|
+
process.stdin.setEncoding('utf8');
|
|
17
|
+
process.stdin.on('readable', () => {
|
|
18
|
+
let chunk;
|
|
19
|
+
while ((chunk = process.stdin.read()) !== null) {
|
|
20
|
+
input += chunk;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
process.stdin.on('end', async () => {
|
|
25
|
+
try {
|
|
26
|
+
const hookInput = JSON.parse(input);
|
|
27
|
+
let projectDir = hookInput.cwd || process.cwd();
|
|
28
|
+
|
|
29
|
+
// Windows path fix
|
|
30
|
+
if (process.platform === 'win32' && /^\/[a-z]\//.test(projectDir)) {
|
|
31
|
+
projectDir = projectDir[1].toUpperCase() + ':' + projectDir.slice(2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Skip if succ is not initialized in this project
|
|
35
|
+
if (!fs.existsSync(path.join(projectDir, '.succ'))) {
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Read daemon port
|
|
40
|
+
const portFile = path.join(projectDir, '.succ', '.tmp', 'daemon.port');
|
|
41
|
+
let daemonPort = null;
|
|
42
|
+
try {
|
|
43
|
+
if (fs.existsSync(portFile)) {
|
|
44
|
+
daemonPort = parseInt(fs.readFileSync(portFile, 'utf8').trim(), 10);
|
|
45
|
+
}
|
|
46
|
+
} catch {}
|
|
47
|
+
|
|
48
|
+
if (!daemonPort) {
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Get session info
|
|
53
|
+
const transcriptPath = hookInput.transcript_path || '';
|
|
54
|
+
const sessionId = transcriptPath ? path.basename(transcriptPath, '.jsonl') : null;
|
|
55
|
+
|
|
56
|
+
if (!sessionId) {
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Skip reflection for service sessions (internal Claude calls from succ)
|
|
61
|
+
// This prevents infinite loop: session-end -> processSessionEnd -> runClaudeCLI -> session-end -> ...
|
|
62
|
+
const isServiceSession = process.env.SUCC_SERVICE_SESSION === '1';
|
|
63
|
+
|
|
64
|
+
// Tell daemon to unregister and process session
|
|
65
|
+
// Daemon will handle transcript parsing, summarization, and memory saving asynchronously
|
|
66
|
+
try {
|
|
67
|
+
await fetch(`http://127.0.0.1:${daemonPort}/api/session/unregister`, {
|
|
68
|
+
method: 'POST',
|
|
69
|
+
headers: { 'Content-Type': 'application/json' },
|
|
70
|
+
body: JSON.stringify({
|
|
71
|
+
session_id: sessionId,
|
|
72
|
+
transcript_path: transcriptPath,
|
|
73
|
+
run_reflection: !isServiceSession, // Don't run reflection for service sessions
|
|
74
|
+
}),
|
|
75
|
+
signal: AbortSignal.timeout(5000),
|
|
76
|
+
});
|
|
77
|
+
} catch {
|
|
78
|
+
// Daemon communication failed, exit anyway
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
process.exit(0);
|
|
82
|
+
} catch (err) {
|
|
83
|
+
process.exit(0);
|
|
84
|
+
}
|
|
85
|
+
});
|