homegraph 1.2.0 → 1.5.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/README.md +48 -11
- package/dist/bin/homegraph.js +298 -72
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +117 -11
- package/dist/context/index.js.map +1 -1
- package/dist/db/index.d.ts +207 -6
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +461 -20
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +19 -1
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +157 -3
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +426 -9
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +32 -1
- package/dist/db/sqlite-adapter.d.ts +24 -17
- package/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.js +292 -36
- package/dist/db/sqlite-adapter.js.map +1 -1
- package/dist/db/wal-valve.d.ts +119 -0
- package/dist/db/wal-valve.d.ts.map +1 -0
- package/dist/db/wal-valve.js +290 -0
- package/dist/db/wal-valve.js.map +1 -0
- package/dist/directory.d.ts +9 -5
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +210 -19
- package/dist/directory.js.map +1 -1
- package/dist/extraction/arkts-batch-worker.js +3 -2
- package/dist/extraction/arkts-batch-worker.js.map +1 -1
- package/dist/extraction/cfml-extractor.d.ts +107 -0
- package/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/dist/extraction/cfml-extractor.js +494 -0
- package/dist/extraction/cfml-extractor.js.map +1 -0
- package/dist/extraction/default-ignore.d.ts +39 -0
- package/dist/extraction/default-ignore.d.ts.map +1 -0
- package/dist/extraction/default-ignore.js +221 -0
- package/dist/extraction/default-ignore.js.map +1 -0
- package/dist/extraction/grammars.d.ts +25 -1
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +177 -24
- package/dist/extraction/grammars.js.map +1 -1
- package/dist/extraction/index.d.ts +52 -14
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +521 -314
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +90 -6
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1579 -128
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts +42 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +369 -4
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/cfquery.d.ts +12 -0
- package/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/dist/extraction/languages/cfquery.js +28 -0
- package/dist/extraction/languages/cfquery.js.map +1 -0
- package/dist/extraction/languages/cfscript.d.ts +3 -0
- package/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/dist/extraction/languages/cfscript.js +73 -0
- package/dist/extraction/languages/cfscript.js.map +1 -0
- package/dist/extraction/languages/cobol.d.ts +33 -0
- package/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/dist/extraction/languages/cobol.js +499 -0
- package/dist/extraction/languages/cobol.js.map +1 -0
- package/dist/extraction/languages/erlang.d.ts +3 -0
- package/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/dist/extraction/languages/erlang.js +350 -0
- package/dist/extraction/languages/erlang.js.map +1 -0
- package/dist/extraction/languages/index.d.ts.map +1 -1
- package/dist/extraction/languages/index.js +16 -0
- package/dist/extraction/languages/index.js.map +1 -1
- package/dist/extraction/languages/nix.d.ts +3 -0
- package/dist/extraction/languages/nix.d.ts.map +1 -0
- package/dist/extraction/languages/nix.js +294 -0
- package/dist/extraction/languages/nix.js.map +1 -0
- package/dist/extraction/languages/solidity.d.ts +3 -0
- package/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/dist/extraction/languages/solidity.js +293 -0
- package/dist/extraction/languages/solidity.js.map +1 -0
- package/dist/extraction/languages/terraform.d.ts +3 -0
- package/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/dist/extraction/languages/terraform.js +641 -0
- package/dist/extraction/languages/terraform.js.map +1 -0
- package/dist/extraction/languages/vbnet.d.ts +11 -0
- package/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/dist/extraction/languages/vbnet.js +141 -0
- package/dist/extraction/languages/vbnet.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +30 -10
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/dist/extraction/mybatis-extractor.js +140 -38
- package/dist/extraction/mybatis-extractor.js.map +1 -1
- package/dist/extraction/parse-pool.d.ts +27 -1
- package/dist/extraction/parse-pool.d.ts.map +1 -1
- package/dist/extraction/parse-pool.js +75 -7
- package/dist/extraction/parse-pool.js.map +1 -1
- package/dist/extraction/parse-worker.js +9 -2
- package/dist/extraction/parse-worker.js.map +1 -1
- package/dist/extraction/store-worker.d.ts +20 -0
- package/dist/extraction/store-worker.d.ts.map +1 -0
- package/dist/extraction/store-worker.js +102 -0
- package/dist/extraction/store-worker.js.map +1 -0
- package/dist/extraction/store-writer.d.ts +48 -0
- package/dist/extraction/store-writer.d.ts.map +1 -0
- package/dist/extraction/store-writer.js +167 -0
- package/dist/extraction/store-writer.js.map +1 -0
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/dist/extraction/tree-sitter-helpers.js +1 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/dist/extraction/tree-sitter-types.d.ts +3 -1
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +38 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +801 -10
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +14 -4
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/dist/extraction/wasm-runtime-flags.js +55 -7
- package/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +1 -1
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +74 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +436 -55
- package/dist/index.js.map +1 -1
- package/dist/installer/index.d.ts +42 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +97 -2
- package/dist/installer/index.js.map +1 -1
- package/dist/mcp/daemon.d.ts +25 -3
- package/dist/mcp/daemon.d.ts.map +1 -1
- package/dist/mcp/daemon.js +62 -8
- package/dist/mcp/daemon.js.map +1 -1
- package/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/dist/mcp/dynamic-boundaries.js +2 -1
- package/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/dist/mcp/early-ppid.d.ts +26 -0
- package/dist/mcp/early-ppid.d.ts.map +1 -0
- package/dist/mcp/early-ppid.js +29 -0
- package/dist/mcp/early-ppid.js.map +1 -0
- package/dist/mcp/engine.d.ts +4 -5
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +27 -1
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +41 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/liveness-watchdog.d.ts +18 -1
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/dist/mcp/liveness-watchdog.js +73 -13
- package/dist/mcp/liveness-watchdog.js.map +1 -1
- package/dist/mcp/memory-budget.d.ts +30 -0
- package/dist/mcp/memory-budget.d.ts.map +1 -0
- package/dist/mcp/memory-budget.js +123 -0
- package/dist/mcp/memory-budget.js.map +1 -0
- package/dist/mcp/proxy.d.ts.map +1 -1
- package/dist/mcp/proxy.js +88 -4
- package/dist/mcp/proxy.js.map +1 -1
- package/dist/mcp/query-cache.d.ts +35 -4
- package/dist/mcp/query-cache.d.ts.map +1 -1
- package/dist/mcp/query-cache.js +89 -19
- package/dist/mcp/query-cache.js.map +1 -1
- package/dist/mcp/query-pool.d.ts +46 -12
- package/dist/mcp/query-pool.d.ts.map +1 -1
- package/dist/mcp/query-pool.js +100 -23
- package/dist/mcp/query-pool.js.map +1 -1
- package/dist/mcp/query-worker.d.ts +2 -2
- package/dist/mcp/query-worker.js +2 -2
- package/dist/mcp/server-instructions.d.ts +4 -27
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +39 -84
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/session.d.ts +14 -0
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +28 -1
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/startup-handshake.d.ts +44 -0
- package/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/dist/mcp/startup-handshake.js +73 -0
- package/dist/mcp/startup-handshake.js.map +1 -0
- package/dist/mcp/tools.d.ts +104 -4
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +2432 -217
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transport.d.ts.map +1 -1
- package/dist/mcp/transport.js +18 -0
- package/dist/mcp/transport.js.map +1 -1
- package/dist/project-config.d.ts +38 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +101 -2
- package/dist/project-config.js.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.js +178 -146
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/dist/resolution/callback-synthesizer.d.ts +54 -10
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +1299 -257
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/cooperative-yield.d.ts +10 -2
- package/dist/resolution/cooperative-yield.d.ts.map +1 -1
- package/dist/resolution/cooperative-yield.js +6 -4
- package/dist/resolution/cooperative-yield.js.map +1 -1
- package/dist/resolution/frameworks/cics.d.ts +20 -0
- package/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/dist/resolution/frameworks/cics.js +90 -0
- package/dist/resolution/frameworks/cics.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/dist/resolution/frameworks/go.js +29 -6
- package/dist/resolution/frameworks/go.js.map +1 -1
- package/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/dist/resolution/frameworks/index.js +3 -0
- package/dist/resolution/frameworks/index.js.map +1 -1
- package/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/dist/resolution/frameworks/java.js +14 -6
- package/dist/resolution/frameworks/java.js.map +1 -1
- package/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/dist/resolution/frameworks/terraform.js +277 -0
- package/dist/resolution/frameworks/terraform.js.map +1 -0
- package/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
- package/dist/resolution/goframe-synthesizer.js +8 -3
- package/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/dist/resolution/import-resolver.d.ts +9 -3
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +295 -11
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +146 -8
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +1089 -131
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/memory-budget.d.ts +48 -0
- package/dist/resolution/memory-budget.d.ts.map +1 -0
- package/dist/resolution/memory-budget.js +162 -0
- package/dist/resolution/memory-budget.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +12 -4
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +793 -130
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/resolver-pool.d.ts +106 -0
- package/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/dist/resolution/resolver-pool.js +344 -0
- package/dist/resolution/resolver-pool.js.map +1 -0
- package/dist/resolution/resolver-worker.d.ts +17 -0
- package/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/dist/resolution/resolver-worker.js +141 -0
- package/dist/resolution/resolver-worker.js.map +1 -0
- package/dist/resolution/strip-comments.d.ts +1 -1
- package/dist/resolution/strip-comments.d.ts.map +1 -1
- package/dist/resolution/strip-comments.js +49 -0
- package/dist/resolution/strip-comments.js.map +1 -1
- package/dist/resolution/types.d.ts +32 -0
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/resolution/workspace-packages.d.ts +10 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/dist/resolution/workspace-packages.js +142 -4
- package/dist/resolution/workspace-packages.js.map +1 -1
- package/dist/search/identifier-segments.d.ts +60 -0
- package/dist/search/identifier-segments.d.ts.map +1 -0
- package/dist/search/identifier-segments.js +176 -0
- package/dist/search/identifier-segments.js.map +1 -0
- package/dist/search/query-utils.d.ts +201 -0
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +919 -2
- package/dist/search/query-utils.js.map +1 -1
- package/dist/spec/build/diff-parser.d.ts +55 -0
- package/dist/spec/build/diff-parser.d.ts.map +1 -0
- package/dist/spec/build/diff-parser.js +205 -0
- package/dist/spec/build/diff-parser.js.map +1 -0
- package/dist/spec/build/git-scanner.d.ts +93 -0
- package/dist/spec/build/git-scanner.d.ts.map +1 -0
- package/dist/spec/build/git-scanner.js +254 -0
- package/dist/spec/build/git-scanner.js.map +1 -0
- package/dist/spec/build/pipeline.d.ts +54 -0
- package/dist/spec/build/pipeline.d.ts.map +1 -0
- package/dist/spec/build/pipeline.js +170 -0
- package/dist/spec/build/pipeline.js.map +1 -0
- package/dist/spec/build/scan.d.ts +48 -0
- package/dist/spec/build/scan.d.ts.map +1 -0
- package/dist/spec/build/scan.js +89 -0
- package/dist/spec/build/scan.js.map +1 -0
- package/dist/spec/build/scope-resolver.d.ts +50 -0
- package/dist/spec/build/scope-resolver.d.ts.map +1 -0
- package/dist/spec/build/scope-resolver.js +105 -0
- package/dist/spec/build/scope-resolver.js.map +1 -0
- package/dist/spec/build/spec-extractor.d.ts +74 -0
- package/dist/spec/build/spec-extractor.d.ts.map +1 -0
- package/dist/spec/build/spec-extractor.js +344 -0
- package/dist/spec/build/spec-extractor.js.map +1 -0
- package/dist/spec/config.d.ts +35 -1
- package/dist/spec/config.d.ts.map +1 -1
- package/dist/spec/config.js +30 -5
- package/dist/spec/config.js.map +1 -1
- package/dist/spec/db/fts.d.ts.map +1 -1
- package/dist/spec/db/fts.js +19 -50
- package/dist/spec/db/fts.js.map +1 -1
- package/dist/spec/db/index.d.ts +5 -3
- package/dist/spec/db/index.d.ts.map +1 -1
- package/dist/spec/db/index.js +16 -1
- package/dist/spec/db/index.js.map +1 -1
- package/dist/spec/db/persist.d.ts +45 -0
- package/dist/spec/db/persist.d.ts.map +1 -0
- package/dist/spec/db/persist.js +66 -0
- package/dist/spec/db/persist.js.map +1 -0
- package/dist/spec/db/relations.d.ts +80 -1
- package/dist/spec/db/relations.d.ts.map +1 -1
- package/dist/spec/db/relations.js +175 -4
- package/dist/spec/db/relations.js.map +1 -1
- package/dist/spec/db/schema.d.ts +4 -0
- package/dist/spec/db/schema.d.ts.map +1 -1
- package/dist/spec/db/schema.js +4 -0
- package/dist/spec/db/schema.js.map +1 -1
- package/dist/spec/db/schema.sql +5 -1
- package/dist/spec/db/spec-node.d.ts +5 -0
- package/dist/spec/db/spec-node.d.ts.map +1 -1
- package/dist/spec/db/spec-node.js +11 -5
- package/dist/spec/db/spec-node.js.map +1 -1
- package/dist/spec/db/sql-utils.d.ts +11 -0
- package/dist/spec/db/sql-utils.d.ts.map +1 -0
- package/dist/spec/db/sql-utils.js +19 -0
- package/dist/spec/db/sql-utils.js.map +1 -0
- package/dist/spec/evolve/cluster-context.d.ts +30 -0
- package/dist/spec/evolve/cluster-context.d.ts.map +1 -0
- package/dist/spec/evolve/cluster-context.js +78 -0
- package/dist/spec/evolve/cluster-context.js.map +1 -0
- package/dist/spec/evolve/commit-spec-analyzer.d.ts +51 -0
- package/dist/spec/evolve/commit-spec-analyzer.d.ts.map +1 -0
- package/dist/spec/evolve/commit-spec-analyzer.js +88 -0
- package/dist/spec/evolve/commit-spec-analyzer.js.map +1 -0
- package/dist/spec/evolve/commit-spec-persister.d.ts +53 -0
- package/dist/spec/evolve/commit-spec-persister.d.ts.map +1 -0
- package/dist/spec/evolve/commit-spec-persister.js +93 -0
- package/dist/spec/evolve/commit-spec-persister.js.map +1 -0
- package/dist/spec/evolve/impact-locator.d.ts +23 -7
- package/dist/spec/evolve/impact-locator.d.ts.map +1 -1
- package/dist/spec/evolve/impact-locator.js +58 -14
- package/dist/spec/evolve/impact-locator.js.map +1 -1
- package/dist/spec/evolve/pipeline.d.ts +62 -25
- package/dist/spec/evolve/pipeline.d.ts.map +1 -1
- package/dist/spec/evolve/pipeline.js +436 -457
- package/dist/spec/evolve/pipeline.js.map +1 -1
- package/dist/spec/evolve/spec-rewriter.d.ts +13 -13
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -1
- package/dist/spec/evolve/spec-rewriter.js +45 -45
- package/dist/spec/evolve/spec-rewriter.js.map +1 -1
- package/dist/spec/git/commits.d.ts +85 -0
- package/dist/spec/git/commits.d.ts.map +1 -0
- package/dist/spec/git/commits.js +218 -0
- package/dist/spec/git/commits.js.map +1 -0
- package/dist/spec/git/exec.d.ts +13 -0
- package/dist/spec/git/exec.d.ts.map +1 -0
- package/dist/spec/git/exec.js +19 -0
- package/dist/spec/git/exec.js.map +1 -0
- package/dist/spec/git/index.d.ts +9 -0
- package/dist/spec/git/index.d.ts.map +1 -0
- package/dist/spec/git/index.js +22 -0
- package/dist/spec/git/index.js.map +1 -0
- package/dist/spec/git-utils.d.ts +8 -0
- package/dist/spec/git-utils.d.ts.map +1 -0
- package/dist/spec/git-utils.js +14 -0
- package/dist/spec/git-utils.js.map +1 -0
- package/dist/spec/graph/index.d.ts +8 -0
- package/dist/spec/graph/index.d.ts.map +1 -0
- package/dist/spec/graph/index.js +17 -0
- package/dist/spec/graph/index.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +6 -35
- package/dist/spec/graph/queries.d.ts.map +1 -1
- package/dist/spec/graph/queries.js +71 -248
- package/dist/spec/graph/queries.js.map +1 -1
- package/dist/spec/llm/agent-client.d.ts +59 -0
- package/dist/spec/llm/agent-client.d.ts.map +1 -0
- package/dist/spec/llm/agent-client.js +213 -0
- package/dist/spec/llm/agent-client.js.map +1 -0
- package/dist/spec/llm/agents/claude-code.d.ts +32 -0
- package/dist/spec/llm/agents/claude-code.d.ts.map +1 -0
- package/dist/spec/llm/agents/claude-code.js +125 -0
- package/dist/spec/llm/agents/claude-code.js.map +1 -0
- package/dist/spec/llm/agents/codex.d.ts +32 -0
- package/dist/spec/llm/agents/codex.d.ts.map +1 -0
- package/dist/spec/llm/agents/codex.js +145 -0
- package/dist/spec/llm/agents/codex.js.map +1 -0
- package/dist/spec/llm/agents/detect-utils.d.ts +28 -0
- package/dist/spec/llm/agents/detect-utils.d.ts.map +1 -0
- package/dist/spec/llm/agents/detect-utils.js +91 -0
- package/dist/spec/llm/agents/detect-utils.js.map +1 -0
- package/dist/spec/llm/agents/deveco-code.d.ts +33 -0
- package/dist/spec/llm/agents/deveco-code.d.ts.map +1 -0
- package/dist/spec/llm/agents/deveco-code.js +165 -0
- package/dist/spec/llm/agents/deveco-code.js.map +1 -0
- package/dist/spec/llm/agents/index.d.ts +31 -0
- package/dist/spec/llm/agents/index.d.ts.map +1 -0
- package/dist/spec/llm/agents/index.js +65 -0
- package/dist/spec/llm/agents/index.js.map +1 -0
- package/dist/spec/llm/agents/types.d.ts +76 -0
- package/dist/spec/llm/agents/types.d.ts.map +1 -0
- package/dist/spec/llm/agents/types.js +15 -0
- package/dist/spec/llm/agents/types.js.map +1 -0
- package/dist/spec/llm/client.d.ts +31 -11
- package/dist/spec/llm/client.d.ts.map +1 -1
- package/dist/spec/llm/client.js +143 -81
- package/dist/spec/llm/client.js.map +1 -1
- package/dist/spec/llm/factory.d.ts +41 -0
- package/dist/spec/llm/factory.d.ts.map +1 -0
- package/dist/spec/llm/factory.js +80 -0
- package/dist/spec/llm/factory.js.map +1 -0
- package/dist/spec/llm/prompts.d.ts +24 -8
- package/dist/spec/llm/prompts.d.ts.map +1 -1
- package/dist/spec/llm/prompts.js +100 -50
- package/dist/spec/llm/prompts.js.map +1 -1
- package/dist/spec/llm/retry.d.ts +53 -0
- package/dist/spec/llm/retry.d.ts.map +1 -0
- package/dist/spec/llm/retry.js +153 -0
- package/dist/spec/llm/retry.js.map +1 -0
- package/dist/spec/mine/clusterer.d.ts +63 -0
- package/dist/spec/mine/clusterer.d.ts.map +1 -0
- package/dist/spec/mine/clusterer.js +904 -0
- package/dist/spec/mine/clusterer.js.map +1 -0
- package/dist/spec/mine/clustering/features.d.ts +38 -0
- package/dist/spec/mine/clustering/features.d.ts.map +1 -0
- package/dist/spec/mine/clustering/features.js +108 -0
- package/dist/spec/mine/clustering/features.js.map +1 -0
- package/dist/spec/mine/clustering/index.d.ts +62 -0
- package/dist/spec/mine/clustering/index.d.ts.map +1 -0
- package/dist/spec/mine/clustering/index.js +259 -0
- package/dist/spec/mine/clustering/index.js.map +1 -0
- package/dist/spec/mine/clustering/leiden.d.ts +61 -0
- package/dist/spec/mine/clustering/leiden.d.ts.map +1 -0
- package/dist/spec/mine/clustering/leiden.js +489 -0
- package/dist/spec/mine/clustering/leiden.js.map +1 -0
- package/dist/spec/mine/clustering/text-similarity.d.ts +22 -0
- package/dist/spec/mine/clustering/text-similarity.d.ts.map +1 -0
- package/dist/spec/mine/clustering/text-similarity.js +98 -0
- package/dist/spec/mine/clustering/text-similarity.js.map +1 -0
- package/dist/spec/mine/generator.d.ts +54 -0
- package/dist/spec/mine/generator.d.ts.map +1 -0
- package/dist/spec/mine/generator.js +267 -0
- package/dist/spec/mine/generator.js.map +1 -0
- package/dist/spec/mine/persist.d.ts +37 -0
- package/dist/spec/mine/persist.d.ts.map +1 -0
- package/dist/spec/mine/persist.js +170 -0
- package/dist/spec/mine/persist.js.map +1 -0
- package/dist/spec/mine/pipeline.d.ts +41 -0
- package/dist/spec/mine/pipeline.d.ts.map +1 -0
- package/dist/spec/mine/pipeline.js +236 -0
- package/dist/spec/mine/pipeline.js.map +1 -0
- package/dist/spec/mine/progress-handler.d.ts +22 -0
- package/dist/spec/mine/progress-handler.d.ts.map +1 -0
- package/dist/spec/mine/progress-handler.js +108 -0
- package/dist/spec/mine/progress-handler.js.map +1 -0
- package/dist/spec/mine/progress.d.ts +23 -0
- package/dist/spec/mine/progress.d.ts.map +1 -0
- package/dist/spec/mine/progress.js +12 -0
- package/dist/spec/mine/progress.js.map +1 -0
- package/dist/spec/mine/scanner.d.ts +59 -0
- package/dist/spec/mine/scanner.d.ts.map +1 -0
- package/dist/spec/mine/scanner.js +383 -0
- package/dist/spec/mine/scanner.js.map +1 -0
- package/dist/spec/types.d.ts +32 -0
- package/dist/spec/types.d.ts.map +1 -1
- package/dist/spec/ui/index.d.ts +9 -0
- package/dist/spec/ui/index.d.ts.map +1 -0
- package/dist/spec/ui/index.js +16 -0
- package/dist/spec/ui/index.js.map +1 -0
- package/dist/spec/ui/progress-handler.d.ts +33 -0
- package/dist/spec/ui/progress-handler.d.ts.map +1 -0
- package/dist/spec/ui/progress-handler.js +132 -0
- package/dist/spec/ui/progress-handler.js.map +1 -0
- package/dist/spec/ui/progress.d.ts +24 -0
- package/dist/spec/ui/progress.d.ts.map +1 -0
- package/dist/spec/ui/progress.js +13 -0
- package/dist/spec/ui/progress.js.map +1 -0
- package/dist/spec/utils/fs.d.ts +45 -0
- package/dist/spec/utils/fs.d.ts.map +1 -0
- package/dist/spec/utils/fs.js +163 -0
- package/dist/spec/utils/fs.js.map +1 -0
- package/dist/spec/utils/index.d.ts +12 -0
- package/dist/spec/utils/index.d.ts.map +1 -0
- package/dist/spec/utils/index.js +26 -0
- package/dist/spec/utils/index.js.map +1 -0
- package/dist/spec/utils/meta.d.ts +32 -0
- package/dist/spec/utils/meta.d.ts.map +1 -0
- package/dist/spec/utils/meta.js +122 -0
- package/dist/spec/utils/meta.js.map +1 -0
- package/dist/spec/utils/truncate.d.ts +86 -0
- package/dist/spec/utils/truncate.d.ts.map +1 -0
- package/dist/spec/utils/truncate.js +172 -0
- package/dist/spec/utils/truncate.js.map +1 -0
- package/dist/spec/utils.d.ts +4 -16
- package/dist/spec/utils.d.ts.map +1 -1
- package/dist/spec/utils.js +6 -58
- package/dist/spec/utils.js.map +1 -1
- package/dist/sync/git-hooks.d.ts.map +1 -1
- package/dist/sync/git-hooks.js +2 -0
- package/dist/sync/git-hooks.js.map +1 -1
- package/dist/sync/watcher.d.ts +35 -6
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +127 -17
- package/dist/sync/watcher.js.map +1 -1
- package/dist/sync/worktree.d.ts.map +1 -1
- package/dist/sync/worktree.js +5 -0
- package/dist/sync/worktree.js.map +1 -1
- package/dist/telemetry/index.js +3 -3
- package/dist/telemetry/index.js.map +1 -1
- package/dist/types.d.ts +22 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/dist/upgrade/index.d.ts +32 -0
- package/dist/upgrade/index.d.ts.map +1 -1
- package/dist/upgrade/index.js +162 -14
- package/dist/upgrade/index.js.map +1 -1
- package/dist/upgrade/remove-binary.d.ts +87 -0
- package/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/dist/upgrade/remove-binary.js +289 -0
- package/dist/upgrade/remove-binary.js.map +1 -0
- package/dist/upgrade/update-check.d.ts +92 -0
- package/dist/upgrade/update-check.d.ts.map +1 -0
- package/dist/upgrade/update-check.js +258 -0
- package/dist/upgrade/update-check.js.map +1 -0
- package/package.json +6 -2
- package/scripts/agent-eval/run-all.sh +6 -0
- package/scripts/build-bundle.sh +5 -0
- package/scripts/npm-shim.js +8 -1
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/data/agents.json +0 -109
- package/scripts/exp_boundary_eval/data/experiments.json +0 -140
- package/scripts/qa_eval/README.md +0 -407
- package/scripts/qa_eval/_test_deveco_probe.py +0 -41
- package/scripts/qa_eval/agent_runner.py +0 -526
- package/scripts/qa_eval/data/.gitignore +0 -4
- package/scripts/qa_eval/data/test-set.jsonl +0 -2
- package/scripts/qa_eval/eval_metrics.py +0 -274
- package/scripts/qa_eval/external_agent.py +0 -976
- package/scripts/qa_eval/llm_config.py +0 -92
- package/scripts/qa_eval/memory_monitor.py +0 -132
- package/scripts/qa_eval/my_answer_accuracy.py +0 -187
- package/scripts/qa_eval/requirements.txt +0 -2
- package/scripts/qa_eval/run_pipeline.py +0 -804
- package/scripts/qa_eval/stats_efficiency.py +0 -279
- package/scripts/qa_eval/stats_scores.py +0 -207
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-handler.js","sourceRoot":"","sources":["../../../src/spec/ui/progress-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAiHH,sDAQC;AAGD,8DAEC;AAGD,gEAEC;AA/HD,8EAA8E;AAC9E,8DAA8D;AAC9D,8EAA8E;AAE9E,oCAAoC;AACvB,QAAA,iBAAiB,GAA2B;IACvD,QAAQ,EAAI,oBAAoB;IAChC,UAAU,EAAE,oBAAoB;IAChC,UAAU,EAAE,oBAAoB;IAChC,UAAU,EAAE,oBAAoB;IAChC,IAAI,EAAQ,oBAAoB;CACjC,CAAC;AAEF,qCAAqC;AACxB,QAAA,kBAAkB,GAA2B;IACxD,QAAQ,EAAI,oBAAoB;IAChC,UAAU,EAAE,oBAAoB;IAChC,IAAI,EAAQ,oBAAoB;CACjC,CAAC;AAEF,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,wEAAwE;AACxE,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,gBAAgB,CAAC,MAA8B;IACtD,IAAI,SAAS,GAAG,EAAE,CAAC;IAEnB,OAAO,CAAC,CAAC,EAAE,EAAE;QACX,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;YACvB,kEAAkE;YAClE,yEAAyE;YACzE,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK;gBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACrD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC1B,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC;YACpB,0EAA0E;YAC1E,IAAI,OAAO,CAAC,MAAM,CAAC,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C,CAAC;YACzE,CAAC;QACH,CAAC;aAAM,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACrB,6DAA6D;YAC7D,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,IAAuB,EACvB,MAA8B;IAE9B,IAAI,IAAI,KAAK,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC3C,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC;AAED,mEAAmE;AACnE,SAAgB,yBAAyB,CAAC,IAAuB;IAC/D,OAAO,qBAAqB,CAAC,IAAI,EAAE,yBAAiB,CAAC,CAAC;AACxD,CAAC;AAED,oEAAoE;AACpE,SAAgB,0BAA0B,CAAC,IAAuB;IAChE,OAAO,qBAAqB,CAAC,IAAI,EAAE,0BAAkB,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic progress-reporting types shared by the spec pipelines
|
|
3
|
+
* (build / mine / evolve).
|
|
4
|
+
*
|
|
5
|
+
* Each phase callback reports current/total progress with an optional
|
|
6
|
+
* human-readable message. The callback is purely advisory — `onProgress`
|
|
7
|
+
* is always optional and a missing callback just means "no output."
|
|
8
|
+
*
|
|
9
|
+
* @module spec/ui/progress
|
|
10
|
+
*/
|
|
11
|
+
/** One progress tick from any phase of a pipeline. */
|
|
12
|
+
export interface ProgressTick<P extends string = string> {
|
|
13
|
+
/** Current pipeline phase (pipeline-defined). */
|
|
14
|
+
phase: P;
|
|
15
|
+
/** Current item index (1-based). 0 means the phase just started. */
|
|
16
|
+
current: number;
|
|
17
|
+
/** Total items in this phase. 0 means the total is unknown / not meaningful. */
|
|
18
|
+
total: number;
|
|
19
|
+
/** Optional human-readable label (e.g. commit hash, specId). */
|
|
20
|
+
message?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Callback signature for progress reporting. */
|
|
23
|
+
export type ProgressCallback<P extends string = string> = (tick: ProgressTick<P>) => void;
|
|
24
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/spec/ui/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,sDAAsD;AACtD,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACrD,iDAAiD;IACjD,KAAK,EAAE,CAAC,CAAC;IACT,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iDAAiD;AACjD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic progress-reporting types shared by the spec pipelines
|
|
4
|
+
* (build / mine / evolve).
|
|
5
|
+
*
|
|
6
|
+
* Each phase callback reports current/total progress with an optional
|
|
7
|
+
* human-readable message. The callback is purely advisory — `onProgress`
|
|
8
|
+
* is always optional and a missing callback just means "no output."
|
|
9
|
+
*
|
|
10
|
+
* @module spec/ui/progress
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/spec/ui/progress.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec file-system utilities — file I/O, spec discovery, DB path resolution.
|
|
3
|
+
*
|
|
4
|
+
* @module spec/utils/fs
|
|
5
|
+
*/
|
|
6
|
+
export interface SpecEntry {
|
|
7
|
+
specId: string;
|
|
8
|
+
entryType: 'directory' | 'file';
|
|
9
|
+
path: string;
|
|
10
|
+
}
|
|
11
|
+
/** Root directory for spec data, relative to the repository root. */
|
|
12
|
+
export declare const SPEC_DATA_DIR = ".homegraph/commit4spec";
|
|
13
|
+
/**
|
|
14
|
+
* Read a UTF-8 file synchronously.
|
|
15
|
+
*
|
|
16
|
+
* Returns `null` for ENOENT (not found), EISDIR (is a directory), or EACCES
|
|
17
|
+
* (permission denied). Other errors propagate.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readFileContent(filePath: string): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Write a UTF-8 file synchronously, creating parent directories as needed.
|
|
22
|
+
*
|
|
23
|
+
* Parent directories are created with `fs.mkdirSync({ recursive: true })`.
|
|
24
|
+
* If the parent exists but is not a directory the underlying error propagates.
|
|
25
|
+
*/
|
|
26
|
+
export declare function writeFileContent(filePath: string, content: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Discover specs in a storage directory.
|
|
29
|
+
*
|
|
30
|
+
* A "spec" is any `.md` file OR any subdirectory. For `.md` files the
|
|
31
|
+
* `specId` is the basename without the extension. For subdirectories the
|
|
32
|
+
* `specId` is the directory name.
|
|
33
|
+
*
|
|
34
|
+
* Returns an empty array when `specStoragePath` does not exist or is not a
|
|
35
|
+
* directory.
|
|
36
|
+
*/
|
|
37
|
+
export declare function discoverSpecs(specStoragePath: string): SpecEntry[];
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the database path: `{repoPath}/${SPEC_DATA_DIR}/commit4spec.db`.
|
|
40
|
+
*
|
|
41
|
+
* Also ensures the `${SPEC_DATA_DIR}` directory exists and contains a
|
|
42
|
+
* `.gitignore` with `"*"` so the database never gets committed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveDbPath(repoPath: string): string;
|
|
45
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/spec/utils/fs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,WAAW,GAAG,MAAM,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,qEAAqE;AACrE,eAAO,MAAM,aAAa,2BAA2B,CAAC;AAMtD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS/D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMxE;AAMD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,EAAE,CA6BlE;AAMD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAyBtD"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spec file-system utilities — file I/O, spec discovery, DB path resolution.
|
|
4
|
+
*
|
|
5
|
+
* @module spec/utils/fs
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.SPEC_DATA_DIR = void 0;
|
|
42
|
+
exports.readFileContent = readFileContent;
|
|
43
|
+
exports.writeFileContent = writeFileContent;
|
|
44
|
+
exports.discoverSpecs = discoverSpecs;
|
|
45
|
+
exports.resolveDbPath = resolveDbPath;
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const errors_1 = require("../../errors");
|
|
49
|
+
// =============================================================================
|
|
50
|
+
// Constants
|
|
51
|
+
// =============================================================================
|
|
52
|
+
/** Root directory for spec data, relative to the repository root. */
|
|
53
|
+
exports.SPEC_DATA_DIR = '.homegraph/commit4spec';
|
|
54
|
+
// =============================================================================
|
|
55
|
+
// File I/O
|
|
56
|
+
// =============================================================================
|
|
57
|
+
/**
|
|
58
|
+
* Read a UTF-8 file synchronously.
|
|
59
|
+
*
|
|
60
|
+
* Returns `null` for ENOENT (not found), EISDIR (is a directory), or EACCES
|
|
61
|
+
* (permission denied). Other errors propagate.
|
|
62
|
+
*/
|
|
63
|
+
function readFileContent(filePath) {
|
|
64
|
+
try {
|
|
65
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
if (err.code === 'ENOENT' || err.code === 'EISDIR' || err.code === 'EACCES') {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Write a UTF-8 file synchronously, creating parent directories as needed.
|
|
76
|
+
*
|
|
77
|
+
* Parent directories are created with `fs.mkdirSync({ recursive: true })`.
|
|
78
|
+
* If the parent exists but is not a directory the underlying error propagates.
|
|
79
|
+
*/
|
|
80
|
+
function writeFileContent(filePath, content) {
|
|
81
|
+
const dir = path.dirname(filePath);
|
|
82
|
+
if (dir && dir !== '.') {
|
|
83
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
84
|
+
}
|
|
85
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
86
|
+
}
|
|
87
|
+
// =============================================================================
|
|
88
|
+
// Spec discovery
|
|
89
|
+
// =============================================================================
|
|
90
|
+
/**
|
|
91
|
+
* Discover specs in a storage directory.
|
|
92
|
+
*
|
|
93
|
+
* A "spec" is any `.md` file OR any subdirectory. For `.md` files the
|
|
94
|
+
* `specId` is the basename without the extension. For subdirectories the
|
|
95
|
+
* `specId` is the directory name.
|
|
96
|
+
*
|
|
97
|
+
* Returns an empty array when `specStoragePath` does not exist or is not a
|
|
98
|
+
* directory.
|
|
99
|
+
*/
|
|
100
|
+
function discoverSpecs(specStoragePath) {
|
|
101
|
+
let entries;
|
|
102
|
+
try {
|
|
103
|
+
entries = fs.readdirSync(specStoragePath, { withFileTypes: true });
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// Non-existent or not a directory → empty list
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
const result = [];
|
|
110
|
+
for (const entry of entries) {
|
|
111
|
+
if (entry.isDirectory()) {
|
|
112
|
+
result.push({
|
|
113
|
+
specId: entry.name,
|
|
114
|
+
entryType: 'directory',
|
|
115
|
+
path: path.join(specStoragePath, entry.name),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
119
|
+
result.push({
|
|
120
|
+
specId: entry.name.slice(0, -3), // strip ".md"
|
|
121
|
+
entryType: 'file',
|
|
122
|
+
path: path.join(specStoragePath, entry.name),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// Symlinks, other file types, and dot-files are silently skipped.
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
// =============================================================================
|
|
130
|
+
// Database path resolution
|
|
131
|
+
// =============================================================================
|
|
132
|
+
/**
|
|
133
|
+
* Resolve the database path: `{repoPath}/${SPEC_DATA_DIR}/commit4spec.db`.
|
|
134
|
+
*
|
|
135
|
+
* Also ensures the `${SPEC_DATA_DIR}` directory exists and contains a
|
|
136
|
+
* `.gitignore` with `"*"` so the database never gets committed.
|
|
137
|
+
*/
|
|
138
|
+
function resolveDbPath(repoPath) {
|
|
139
|
+
const commit4specDir = path.join(repoPath, exports.SPEC_DATA_DIR);
|
|
140
|
+
const gitignorePath = path.join(commit4specDir, '.gitignore');
|
|
141
|
+
const dbPath = path.join(commit4specDir, 'commit4spec.db');
|
|
142
|
+
// Ensure ${SPEC_DATA_DIR} directory exists
|
|
143
|
+
try {
|
|
144
|
+
fs.mkdirSync(commit4specDir, { recursive: true });
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// Directory may already exist; ok.
|
|
148
|
+
}
|
|
149
|
+
// Write .gitignore if it doesn't exist
|
|
150
|
+
if (!fs.existsSync(gitignorePath)) {
|
|
151
|
+
try {
|
|
152
|
+
fs.writeFileSync(gitignorePath, '*\n', 'utf-8');
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
(0, errors_1.logWarn)(`Failed to write ${exports.SPEC_DATA_DIR}/.gitignore`, {
|
|
156
|
+
path: gitignorePath,
|
|
157
|
+
error: err instanceof Error ? err.message : String(err),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return dbPath;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/spec/utils/fs.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCH,0CASC;AAQD,4CAMC;AAgBD,sCA6BC;AAYD,sCAyBC;AAxID,uCAAyB;AACzB,2CAA6B;AAC7B,yCAAuC;AAYvC,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,qEAAqE;AACxD,QAAA,aAAa,GAAG,wBAAwB,CAAC;AAEtD,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC9C,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC5E,OAA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C;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec utility functions — barrel export.
|
|
3
|
+
*
|
|
4
|
+
* Replaces `file_utils.py`, `meta.py`, and `truncate.py` from Python
|
|
5
|
+
* Commit4Spec. Consumers can keep importing from `../spec/utils`.
|
|
6
|
+
*
|
|
7
|
+
* @module spec/utils
|
|
8
|
+
*/
|
|
9
|
+
export { SPEC_DATA_DIR, SpecEntry, readFileContent, writeFileContent, discoverSpecs, resolveDbPath, } from './fs';
|
|
10
|
+
export { SpecMeta, readMeta, writeMeta, } from './meta';
|
|
11
|
+
export { BudgetProfile, truncateCodeDiff, truncateText, truncateSubtitles, computeBudgetProfile, } from './truncate';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spec/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,MAAM,MAAM,CAAC;AAEd,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spec utility functions — barrel export.
|
|
4
|
+
*
|
|
5
|
+
* Replaces `file_utils.py`, `meta.py`, and `truncate.py` from Python
|
|
6
|
+
* Commit4Spec. Consumers can keep importing from `../spec/utils`.
|
|
7
|
+
*
|
|
8
|
+
* @module spec/utils
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.computeBudgetProfile = exports.truncateSubtitles = exports.truncateText = exports.truncateCodeDiff = exports.writeMeta = exports.readMeta = exports.resolveDbPath = exports.discoverSpecs = exports.writeFileContent = exports.readFileContent = exports.SPEC_DATA_DIR = void 0;
|
|
12
|
+
var fs_1 = require("./fs");
|
|
13
|
+
Object.defineProperty(exports, "SPEC_DATA_DIR", { enumerable: true, get: function () { return fs_1.SPEC_DATA_DIR; } });
|
|
14
|
+
Object.defineProperty(exports, "readFileContent", { enumerable: true, get: function () { return fs_1.readFileContent; } });
|
|
15
|
+
Object.defineProperty(exports, "writeFileContent", { enumerable: true, get: function () { return fs_1.writeFileContent; } });
|
|
16
|
+
Object.defineProperty(exports, "discoverSpecs", { enumerable: true, get: function () { return fs_1.discoverSpecs; } });
|
|
17
|
+
Object.defineProperty(exports, "resolveDbPath", { enumerable: true, get: function () { return fs_1.resolveDbPath; } });
|
|
18
|
+
var meta_1 = require("./meta");
|
|
19
|
+
Object.defineProperty(exports, "readMeta", { enumerable: true, get: function () { return meta_1.readMeta; } });
|
|
20
|
+
Object.defineProperty(exports, "writeMeta", { enumerable: true, get: function () { return meta_1.writeMeta; } });
|
|
21
|
+
var truncate_1 = require("./truncate");
|
|
22
|
+
Object.defineProperty(exports, "truncateCodeDiff", { enumerable: true, get: function () { return truncate_1.truncateCodeDiff; } });
|
|
23
|
+
Object.defineProperty(exports, "truncateText", { enumerable: true, get: function () { return truncate_1.truncateText; } });
|
|
24
|
+
Object.defineProperty(exports, "truncateSubtitles", { enumerable: true, get: function () { return truncate_1.truncateSubtitles; } });
|
|
25
|
+
Object.defineProperty(exports, "computeBudgetProfile", { enumerable: true, get: function () { return truncate_1.computeBudgetProfile; } });
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/spec/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,2BAOc;AANZ,mGAAA,aAAa,OAAA;AAEb,qGAAA,eAAe,OAAA;AACf,sGAAA,gBAAgB,OAAA;AAChB,mGAAA,aAAa,OAAA;AACb,mGAAA,aAAa,OAAA;AAGf,+BAIgB;AAFd,gGAAA,QAAQ,OAAA;AACR,iGAAA,SAAS,OAAA;AAGX,uCAMoB;AAJlB,4GAAA,gBAAgB,OAAA;AAChB,wGAAA,YAAY,OAAA;AACZ,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec meta.json read/write — the incremental-anchor file under
|
|
3
|
+
* `${SPEC_DATA_DIR}/meta.json`.
|
|
4
|
+
*
|
|
5
|
+
* @module spec/utils/meta
|
|
6
|
+
*/
|
|
7
|
+
export interface SpecMeta {
|
|
8
|
+
repoPath: string;
|
|
9
|
+
specStoragePath: string;
|
|
10
|
+
currentCommitID?: string;
|
|
11
|
+
createdAt?: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Read `${SPEC_DATA_DIR}/meta.json` from `repoPath`.
|
|
16
|
+
*
|
|
17
|
+
* Returns `null` when the file is missing, unreadable, or contains invalid
|
|
18
|
+
* JSON or a JSON value that is not a plain object.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readMeta(repoPath: string): SpecMeta | null;
|
|
21
|
+
/**
|
|
22
|
+
* Write `${SPEC_DATA_DIR}/meta.json` to `repoPath`.
|
|
23
|
+
*
|
|
24
|
+
* If existing meta has a `createdAt` field it is preserved; otherwise the
|
|
25
|
+
* current time is used as the creation timestamp. `updatedAt` is always set
|
|
26
|
+
* to the current time. The `${SPEC_DATA_DIR}` directory is created if it does
|
|
27
|
+
* not exist.
|
|
28
|
+
*
|
|
29
|
+
* Returns the full `SpecMeta` that was written.
|
|
30
|
+
*/
|
|
31
|
+
export declare function writeMeta(repoPath: string, specStoragePath: string, currentCommitID?: string): SpecMeta;
|
|
32
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/spec/utils/meta.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CA8C1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,eAAe,CAAC,EAAE,MAAM,GACvB,QAAQ,CAsBV"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spec meta.json read/write — the incremental-anchor file under
|
|
4
|
+
* `${SPEC_DATA_DIR}/meta.json`.
|
|
5
|
+
*
|
|
6
|
+
* @module spec/utils/meta
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.readMeta = readMeta;
|
|
43
|
+
exports.writeMeta = writeMeta;
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
const errors_1 = require("../../errors");
|
|
47
|
+
const fs_1 = require("./fs");
|
|
48
|
+
// =============================================================================
|
|
49
|
+
// Meta read / write
|
|
50
|
+
// =============================================================================
|
|
51
|
+
/**
|
|
52
|
+
* Read `${SPEC_DATA_DIR}/meta.json` from `repoPath`.
|
|
53
|
+
*
|
|
54
|
+
* Returns `null` when the file is missing, unreadable, or contains invalid
|
|
55
|
+
* JSON or a JSON value that is not a plain object.
|
|
56
|
+
*/
|
|
57
|
+
function readMeta(repoPath) {
|
|
58
|
+
const metaPath = path.join(repoPath, fs_1.SPEC_DATA_DIR, 'meta.json');
|
|
59
|
+
let raw;
|
|
60
|
+
try {
|
|
61
|
+
raw = fs.readFileSync(metaPath, 'utf-8');
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
let parsed;
|
|
67
|
+
try {
|
|
68
|
+
parsed = JSON.parse(raw);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
(0, errors_1.logWarn)(`Ignoring ${fs_1.SPEC_DATA_DIR}/meta.json: not valid JSON`, {
|
|
72
|
+
path: metaPath,
|
|
73
|
+
});
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
77
|
+
(0, errors_1.logWarn)(`Ignoring ${fs_1.SPEC_DATA_DIR}/meta.json: top-level value must be a JSON object`, { path: metaPath });
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const obj = parsed;
|
|
81
|
+
// Validate required string fields
|
|
82
|
+
if (typeof obj.repoPath !== 'string' || typeof obj.specStoragePath !== 'string') {
|
|
83
|
+
(0, errors_1.logWarn)(`Ignoring ${fs_1.SPEC_DATA_DIR}/meta.json: repoPath and specStoragePath must be strings`, { path: metaPath });
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
repoPath: obj.repoPath,
|
|
88
|
+
specStoragePath: obj.specStoragePath,
|
|
89
|
+
currentCommitID: typeof obj.currentCommitID === 'string' ? obj.currentCommitID : undefined,
|
|
90
|
+
createdAt: typeof obj.createdAt === 'string' ? obj.createdAt : undefined,
|
|
91
|
+
updatedAt: typeof obj.updatedAt === 'string' ? obj.updatedAt : new Date().toISOString(),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Write `${SPEC_DATA_DIR}/meta.json` to `repoPath`.
|
|
96
|
+
*
|
|
97
|
+
* If existing meta has a `createdAt` field it is preserved; otherwise the
|
|
98
|
+
* current time is used as the creation timestamp. `updatedAt` is always set
|
|
99
|
+
* to the current time. The `${SPEC_DATA_DIR}` directory is created if it does
|
|
100
|
+
* not exist.
|
|
101
|
+
*
|
|
102
|
+
* Returns the full `SpecMeta` that was written.
|
|
103
|
+
*/
|
|
104
|
+
function writeMeta(repoPath, specStoragePath, currentCommitID) {
|
|
105
|
+
const metaDir = path.join(repoPath, fs_1.SPEC_DATA_DIR);
|
|
106
|
+
const metaPath = path.join(metaDir, 'meta.json');
|
|
107
|
+
const now = new Date().toISOString();
|
|
108
|
+
// Preserve createdAt from existing meta; use now for new files
|
|
109
|
+
const existing = readMeta(repoPath);
|
|
110
|
+
const createdAt = (existing?.createdAt) || now;
|
|
111
|
+
const meta = {
|
|
112
|
+
repoPath,
|
|
113
|
+
specStoragePath,
|
|
114
|
+
currentCommitID,
|
|
115
|
+
createdAt,
|
|
116
|
+
updatedAt: now,
|
|
117
|
+
};
|
|
118
|
+
fs.mkdirSync(metaDir, { recursive: true });
|
|
119
|
+
fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2) + '\n', 'utf-8');
|
|
120
|
+
return meta;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/spec/utils/meta.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,4BA8CC;AAYD,8BA0BC;AA/GD,uCAAyB;AACzB,2CAA6B;AAC7B,yCAAuC;AACvC,6BAAqC;AAcrC,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,QAAgB;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAa,EAAE,WAAW,CAAC,CAAC;IAEjE,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC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C,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACxF,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,SAAS,CACvB,QAAgB,EAChB,eAAuB,EACvB,eAAwB;IAExB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAa,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAEjD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAErC,+DAA+D;IAC/D,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,GAAG,CAAC;IAE/C,MAAM,IAAI,GAAa;QACrB,QAAQ;QACR,eAAe;QACf,eAAe;QACf,SAAS;QACT,SAAS,EAAE,GAAG;KACf,CAAC;IAEF,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1E,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec truncation utilities and prompt-budget profiles — newline-aware text
|
|
3
|
+
* truncation, unified-diff truncation, subtitles capping, and the scale-based
|
|
4
|
+
* budget tiers used when serialising spec contexts for LLM/CLI output.
|
|
5
|
+
*
|
|
6
|
+
* @module spec/utils/truncate
|
|
7
|
+
*/
|
|
8
|
+
export interface BudgetProfile {
|
|
9
|
+
tier: 'tiny' | 'small' | 'medium' | 'large' | 'vlarge';
|
|
10
|
+
maxFragments: number;
|
|
11
|
+
maxContents: number;
|
|
12
|
+
contentBudget: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Truncate a unified diff at a sensible boundary.
|
|
16
|
+
*
|
|
17
|
+
* The algorithm prefers semantic boundaries to keep diffs readable:
|
|
18
|
+
*
|
|
19
|
+
* 1. If the diff is shorter than `maxChars` (default 3800), return it unchanged.
|
|
20
|
+
* 2. Try: find the **last** `@@` hunk header in the trailing 50% portion of
|
|
21
|
+
* the diff and cut right before it.
|
|
22
|
+
* 3. Fallback: find the **last** newline in the trailing 80% portion and cut
|
|
23
|
+
* after it.
|
|
24
|
+
* 4. Hard fallback: cut exactly at `maxChars`.
|
|
25
|
+
*
|
|
26
|
+
* Always appends `" …(truncated)"` when truncation occurs.
|
|
27
|
+
*
|
|
28
|
+
* @param diff - The unified diff text to truncate.
|
|
29
|
+
* @param maxChars - Maximum allowed characters (including suffix). Default 3800.
|
|
30
|
+
* @returns The (possibly truncated) diff text.
|
|
31
|
+
*/
|
|
32
|
+
export declare function truncateCodeDiff(diff: string, maxChars?: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Truncate plain text with newline-awareness.
|
|
35
|
+
*
|
|
36
|
+
* When the text is longer than `maxChars`, it is cut at the last newline
|
|
37
|
+
* found before `maxChars` (minus the suffix length). If no suitable newline
|
|
38
|
+
* exists, a hard cut is made.
|
|
39
|
+
*
|
|
40
|
+
* The suffix `" …(truncated)"` is appended only when truncation occurs.
|
|
41
|
+
*
|
|
42
|
+
* @param text - The text to truncate.
|
|
43
|
+
* @param maxChars - Maximum allowed characters (including suffix).
|
|
44
|
+
* @returns The (possibly truncated) text.
|
|
45
|
+
*/
|
|
46
|
+
export declare function truncateText(text: string, maxChars: number): string;
|
|
47
|
+
/**
|
|
48
|
+
* Truncate a subtitles array.
|
|
49
|
+
*
|
|
50
|
+
* 1. If the array has more than `maxEntries`, it is sliced to `maxEntries`.
|
|
51
|
+
* 2. Each remaining entry that exceeds `maxChars` is individually truncated
|
|
52
|
+
* via `truncateText`.
|
|
53
|
+
*
|
|
54
|
+
* Entries that already fit within both limits are left unchanged.
|
|
55
|
+
*
|
|
56
|
+
* @param subtitles - Array of subtitle strings.
|
|
57
|
+
* @param maxChars - Maximum characters per entry (including suffix).
|
|
58
|
+
* @param maxEntries - Maximum number of entries to keep.
|
|
59
|
+
* @returns The truncated subtitles array (always a new array).
|
|
60
|
+
*/
|
|
61
|
+
export declare function truncateSubtitles(subtitles: string[], maxChars: number, maxEntries: number): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Compute a budget profile based on spec and optional fragment counts.
|
|
64
|
+
*
|
|
65
|
+
* The profile determines how many fragments, contents, and characters the
|
|
66
|
+
* pipeline should budget when building LLM prompts. Higher counts produce
|
|
67
|
+
* tighter budgets to keep prompts manageable.
|
|
68
|
+
*
|
|
69
|
+
* Thresholds (matching `truncate.py:38-57`):
|
|
70
|
+
*
|
|
71
|
+
* | specCount | tier | maxFragments | maxContents | contentBudget |
|
|
72
|
+
* |-----------|---------|--------------|-------------|---------------|
|
|
73
|
+
* | ≤ 3 | tiny | 12 | 16 | 48000 |
|
|
74
|
+
* | ≤ 8 | small | 10 | 14 | 40000 |
|
|
75
|
+
* | ≤ 15 | medium | 8 | 12 | 32000 |
|
|
76
|
+
* | ≤ 30 | large | 6 | 10 | 24000 |
|
|
77
|
+
* | > 30 | vlarge | 0 | 0 | 16000 |
|
|
78
|
+
*
|
|
79
|
+
* The `vlarge` tier disables fragment/contents inclusion entirely (0 values).
|
|
80
|
+
*
|
|
81
|
+
* @param specCount - Number of specs in the knowledge graph.
|
|
82
|
+
* @param fragmentCount - (Unused) reserved for future per-fragment weighting.
|
|
83
|
+
* @returns The budget profile for the given scale.
|
|
84
|
+
*/
|
|
85
|
+
export declare function computeBudgetProfile(specCount: number, _fragmentCount?: number): BudgetProfile;
|
|
86
|
+
//# sourceMappingURL=truncate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../../src/spec/utils/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAaD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAa,GAAG,MAAM,CA6C9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAMV;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,cAAc,CAAC,EAAE,MAAM,GACtB,aAAa,CAcf"}
|