@vpxa/aikit 0.1.1
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 +21 -0
- package/README.md +1207 -0
- package/bin/aikit.mjs +10 -0
- package/package.json +92 -0
- package/packages/aikit-client/dist/direct-client.d.ts +37 -0
- package/packages/aikit-client/dist/direct-client.js +1 -0
- package/packages/aikit-client/dist/index.d.ts +5 -0
- package/packages/aikit-client/dist/index.js +1 -0
- package/packages/aikit-client/dist/mcp-client.d.ts +19 -0
- package/packages/aikit-client/dist/mcp-client.js +4 -0
- package/packages/aikit-client/dist/parsers.d.ts +35 -0
- package/packages/aikit-client/dist/parsers.js +2 -0
- package/packages/aikit-client/dist/types.d.ts +62 -0
- package/packages/aikit-client/dist/types.js +1 -0
- package/packages/analyzers/dist/blast-radius-analyzer.d.ts +19 -0
- package/packages/analyzers/dist/blast-radius-analyzer.js +6 -0
- package/packages/analyzers/dist/dependency-analyzer.d.ts +32 -0
- package/packages/analyzers/dist/dependency-analyzer.js +8 -0
- package/packages/analyzers/dist/diagram-generator.d.ts +16 -0
- package/packages/analyzers/dist/diagram-generator.js +2 -0
- package/packages/analyzers/dist/entry-point-analyzer.d.ts +40 -0
- package/packages/analyzers/dist/entry-point-analyzer.js +4 -0
- package/packages/analyzers/dist/index.d.ts +12 -0
- package/packages/analyzers/dist/index.js +1 -0
- package/packages/analyzers/dist/knowledge-producer.d.ts +40 -0
- package/packages/analyzers/dist/knowledge-producer.js +26 -0
- package/packages/analyzers/dist/pattern-analyzer.d.ts +15 -0
- package/packages/analyzers/dist/pattern-analyzer.js +2 -0
- package/packages/analyzers/dist/regex-call-graph.d.ts +10 -0
- package/packages/analyzers/dist/regex-call-graph.js +1 -0
- package/packages/analyzers/dist/structure-analyzer.d.ts +19 -0
- package/packages/analyzers/dist/structure-analyzer.js +4 -0
- package/packages/analyzers/dist/symbol-analyzer.d.ts +14 -0
- package/packages/analyzers/dist/symbol-analyzer.js +9 -0
- package/packages/analyzers/dist/ts-call-graph.d.ts +29 -0
- package/packages/analyzers/dist/ts-call-graph.js +1 -0
- package/packages/analyzers/dist/types.d.ts +110 -0
- package/packages/analyzers/dist/types.js +1 -0
- package/packages/chunker/dist/call-graph-extractor.d.ts +25 -0
- package/packages/chunker/dist/call-graph-extractor.js +1 -0
- package/packages/chunker/dist/chunker-factory.d.ts +19 -0
- package/packages/chunker/dist/chunker-factory.js +1 -0
- package/packages/chunker/dist/chunker.interface.d.ts +13 -0
- package/packages/chunker/dist/chunker.interface.js +1 -0
- package/packages/chunker/dist/code-chunker.d.ts +17 -0
- package/packages/chunker/dist/code-chunker.js +11 -0
- package/packages/chunker/dist/extractors/call-extractor.d.ts +24 -0
- package/packages/chunker/dist/extractors/call-extractor.js +1 -0
- package/packages/chunker/dist/extractors/entry-point-detector.d.ts +14 -0
- package/packages/chunker/dist/extractors/entry-point-detector.js +1 -0
- package/packages/chunker/dist/extractors/import-extractor.d.ts +14 -0
- package/packages/chunker/dist/extractors/import-extractor.js +1 -0
- package/packages/chunker/dist/extractors/pattern-detector.d.ts +14 -0
- package/packages/chunker/dist/extractors/pattern-detector.js +1 -0
- package/packages/chunker/dist/extractors/scope-resolver.d.ts +26 -0
- package/packages/chunker/dist/extractors/scope-resolver.js +1 -0
- package/packages/chunker/dist/extractors/symbol-extractor.d.ts +14 -0
- package/packages/chunker/dist/extractors/symbol-extractor.js +3 -0
- package/packages/chunker/dist/extractors/types.d.ts +44 -0
- package/packages/chunker/dist/extractors/types.js +1 -0
- package/packages/chunker/dist/generic-chunker.d.ts +15 -0
- package/packages/chunker/dist/generic-chunker.js +5 -0
- package/packages/chunker/dist/index.d.ts +19 -0
- package/packages/chunker/dist/index.js +1 -0
- package/packages/chunker/dist/markdown-chunker.d.ts +17 -0
- package/packages/chunker/dist/markdown-chunker.js +3 -0
- package/packages/chunker/dist/wasm/languages.d.ts +18 -0
- package/packages/chunker/dist/wasm/languages.js +1 -0
- package/packages/chunker/dist/wasm/query-executor.d.ts +70 -0
- package/packages/chunker/dist/wasm/query-executor.js +1 -0
- package/packages/chunker/dist/wasm/runtime.d.ts +44 -0
- package/packages/chunker/dist/wasm/runtime.js +1 -0
- package/packages/chunker/dist/wasm/types.d.ts +84 -0
- package/packages/chunker/dist/wasm/types.js +1 -0
- package/packages/chunker/dist/wasm-chunker.d.ts +23 -0
- package/packages/chunker/dist/wasm-chunker.js +6 -0
- package/packages/chunker/src/queries/go/calls.scm +11 -0
- package/packages/chunker/src/queries/go/entry-points.scm +20 -0
- package/packages/chunker/src/queries/go/imports.scm +6 -0
- package/packages/chunker/src/queries/go/patterns.scm +25 -0
- package/packages/chunker/src/queries/go/symbols.scm +26 -0
- package/packages/chunker/src/queries/java/calls.scm +10 -0
- package/packages/chunker/src/queries/java/entry-points.scm +27 -0
- package/packages/chunker/src/queries/java/imports.scm +11 -0
- package/packages/chunker/src/queries/java/patterns.scm +27 -0
- package/packages/chunker/src/queries/java/symbols.scm +28 -0
- package/packages/chunker/src/queries/javascript/calls.scm +21 -0
- package/packages/chunker/src/queries/javascript/entry-points.scm +31 -0
- package/packages/chunker/src/queries/javascript/imports.scm +32 -0
- package/packages/chunker/src/queries/javascript/patterns.scm +28 -0
- package/packages/chunker/src/queries/javascript/symbols.scm +52 -0
- package/packages/chunker/src/queries/python/calls.scm +11 -0
- package/packages/chunker/src/queries/python/entry-points.scm +21 -0
- package/packages/chunker/src/queries/python/imports.scm +14 -0
- package/packages/chunker/src/queries/python/patterns.scm +25 -0
- package/packages/chunker/src/queries/python/symbols.scm +17 -0
- package/packages/chunker/src/queries/rust/calls.scm +20 -0
- package/packages/chunker/src/queries/rust/entry-points.scm +7 -0
- package/packages/chunker/src/queries/rust/imports.scm +26 -0
- package/packages/chunker/src/queries/rust/patterns.scm +18 -0
- package/packages/chunker/src/queries/rust/symbols.scm +73 -0
- package/packages/chunker/src/queries/typescript/calls.scm +21 -0
- package/packages/chunker/src/queries/typescript/entry-points.scm +48 -0
- package/packages/chunker/src/queries/typescript/imports.scm +35 -0
- package/packages/chunker/src/queries/typescript/patterns.scm +47 -0
- package/packages/chunker/src/queries/typescript/symbols.scm +79 -0
- package/packages/chunker/wasm/tree-sitter-c.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-cpp.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-go.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-java.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-javascript.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-kotlin.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-php.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-python.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-ruby.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-rust.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-scala.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-swift.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-typescript.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter.wasm +0 -0
- package/packages/cli/dist/aikit-init.d.ts +54 -0
- package/packages/cli/dist/aikit-init.js +1 -0
- package/packages/cli/dist/commands/analyze.d.ts +6 -0
- package/packages/cli/dist/commands/analyze.js +2 -0
- package/packages/cli/dist/commands/context-cmds.d.ts +6 -0
- package/packages/cli/dist/commands/context-cmds.js +1 -0
- package/packages/cli/dist/commands/environment.d.ts +6 -0
- package/packages/cli/dist/commands/environment.js +1 -0
- package/packages/cli/dist/commands/execution.d.ts +6 -0
- package/packages/cli/dist/commands/execution.js +1 -0
- package/packages/cli/dist/commands/flow.d.ts +6 -0
- package/packages/cli/dist/commands/flow.js +1 -0
- package/packages/cli/dist/commands/graph.d.ts +6 -0
- package/packages/cli/dist/commands/graph.js +6 -0
- package/packages/cli/dist/commands/init/adapters.d.ts +28 -0
- package/packages/cli/dist/commands/init/adapters.js +1 -0
- package/packages/cli/dist/commands/init/config.d.ts +10 -0
- package/packages/cli/dist/commands/init/config.js +3 -0
- package/packages/cli/dist/commands/init/constants.d.ts +41 -0
- package/packages/cli/dist/commands/init/constants.js +1 -0
- package/packages/cli/dist/commands/init/curated.d.ts +7 -0
- package/packages/cli/dist/commands/init/curated.js +1 -0
- package/packages/cli/dist/commands/init/frontmatter.d.ts +54 -0
- package/packages/cli/dist/commands/init/frontmatter.js +2 -0
- package/packages/cli/dist/commands/init/index.d.ts +36 -0
- package/packages/cli/dist/commands/init/index.js +5 -0
- package/packages/cli/dist/commands/init/manifest.d.ts +71 -0
- package/packages/cli/dist/commands/init/manifest.js +1 -0
- package/packages/cli/dist/commands/init/scaffold.d.ts +46 -0
- package/packages/cli/dist/commands/init/scaffold.js +1 -0
- package/packages/cli/dist/commands/init/templates.d.ts +9 -0
- package/packages/cli/dist/commands/init/templates.js +194 -0
- package/packages/cli/dist/commands/init/user.d.ts +61 -0
- package/packages/cli/dist/commands/init/user.js +5 -0
- package/packages/cli/dist/commands/knowledge.d.ts +6 -0
- package/packages/cli/dist/commands/knowledge.js +1 -0
- package/packages/cli/dist/commands/search.d.ts +6 -0
- package/packages/cli/dist/commands/search.js +1 -0
- package/packages/cli/dist/commands/system.d.ts +6 -0
- package/packages/cli/dist/commands/system.js +4 -0
- package/packages/cli/dist/commands/upgrade.d.ts +6 -0
- package/packages/cli/dist/commands/upgrade.js +1 -0
- package/packages/cli/dist/commands/workspace.d.ts +6 -0
- package/packages/cli/dist/commands/workspace.js +1 -0
- package/packages/cli/dist/context.d.ts +7 -0
- package/packages/cli/dist/context.js +1 -0
- package/packages/cli/dist/helpers.d.ts +55 -0
- package/packages/cli/dist/helpers.js +5 -0
- package/packages/cli/dist/index.d.ts +10 -0
- package/packages/cli/dist/index.js +3 -0
- package/packages/cli/dist/types.d.ts +9 -0
- package/packages/cli/dist/types.js +1 -0
- package/packages/core/dist/constants.d.ts +74 -0
- package/packages/core/dist/constants.js +1 -0
- package/packages/core/dist/content-detector.d.ts +13 -0
- package/packages/core/dist/content-detector.js +1 -0
- package/packages/core/dist/errors.d.ts +20 -0
- package/packages/core/dist/errors.js +1 -0
- package/packages/core/dist/global-registry.d.ts +63 -0
- package/packages/core/dist/global-registry.js +1 -0
- package/packages/core/dist/index.d.ts +7 -0
- package/packages/core/dist/index.js +1 -0
- package/packages/core/dist/logger.d.ts +32 -0
- package/packages/core/dist/logger.js +1 -0
- package/packages/core/dist/types.d.ts +133 -0
- package/packages/core/dist/types.js +1 -0
- package/packages/dashboard/dist/assets/index-BjA4YODs.js +21 -0
- package/packages/dashboard/dist/assets/index-BjA4YODs.js.map +1 -0
- package/packages/dashboard/dist/assets/index-CHpVij2M.css +1 -0
- package/packages/dashboard/dist/index.html +18 -0
- package/packages/elicitation/dist/build.d.ts +14 -0
- package/packages/elicitation/dist/build.js +1 -0
- package/packages/elicitation/dist/fields.d.ts +32 -0
- package/packages/elicitation/dist/fields.js +1 -0
- package/packages/elicitation/dist/index.d.ts +5 -0
- package/packages/elicitation/dist/index.js +1 -0
- package/packages/elicitation/dist/normalize.d.ts +15 -0
- package/packages/elicitation/dist/normalize.js +1 -0
- package/packages/elicitation/dist/types.d.ts +88 -0
- package/packages/elicitation/dist/types.js +1 -0
- package/packages/embeddings/dist/embedder.interface.d.ts +26 -0
- package/packages/embeddings/dist/embedder.interface.js +1 -0
- package/packages/embeddings/dist/index.d.ts +3 -0
- package/packages/embeddings/dist/index.js +1 -0
- package/packages/embeddings/dist/onnx-embedder.d.ts +22 -0
- package/packages/embeddings/dist/onnx-embedder.js +1 -0
- package/packages/enterprise-bridge/dist/cache.d.ts +28 -0
- package/packages/enterprise-bridge/dist/cache.js +1 -0
- package/packages/enterprise-bridge/dist/er-client.d.ts +37 -0
- package/packages/enterprise-bridge/dist/er-client.js +1 -0
- package/packages/enterprise-bridge/dist/evolution-collector.d.ts +62 -0
- package/packages/enterprise-bridge/dist/evolution-collector.js +1 -0
- package/packages/enterprise-bridge/dist/index.d.ts +8 -0
- package/packages/enterprise-bridge/dist/index.js +1 -0
- package/packages/enterprise-bridge/dist/policy-store.d.ts +45 -0
- package/packages/enterprise-bridge/dist/policy-store.js +1 -0
- package/packages/enterprise-bridge/dist/push-adapter.d.ts +23 -0
- package/packages/enterprise-bridge/dist/push-adapter.js +1 -0
- package/packages/enterprise-bridge/dist/result-merger.d.ts +14 -0
- package/packages/enterprise-bridge/dist/result-merger.js +1 -0
- package/packages/enterprise-bridge/dist/types.d.ts +81 -0
- package/packages/enterprise-bridge/dist/types.js +1 -0
- package/packages/flows/dist/adapters/claude-plugin.d.ts +12 -0
- package/packages/flows/dist/adapters/claude-plugin.js +1 -0
- package/packages/flows/dist/adapters/copilot.d.ts +10 -0
- package/packages/flows/dist/adapters/copilot.js +1 -0
- package/packages/flows/dist/adapters/index.d.ts +11 -0
- package/packages/flows/dist/adapters/index.js +1 -0
- package/packages/flows/dist/adapters/native.d.ts +10 -0
- package/packages/flows/dist/adapters/native.js +1 -0
- package/packages/flows/dist/builtins.d.ts +16 -0
- package/packages/flows/dist/builtins.js +1 -0
- package/packages/flows/dist/foundation.d.ts +20 -0
- package/packages/flows/dist/foundation.js +11 -0
- package/packages/flows/dist/git.d.ts +34 -0
- package/packages/flows/dist/git.js +1 -0
- package/packages/flows/dist/index.d.ts +12 -0
- package/packages/flows/dist/index.js +1 -0
- package/packages/flows/dist/loader.d.ts +13 -0
- package/packages/flows/dist/loader.js +2 -0
- package/packages/flows/dist/registry.d.ts +23 -0
- package/packages/flows/dist/registry.js +1 -0
- package/packages/flows/dist/state-machine.d.ts +23 -0
- package/packages/flows/dist/state-machine.js +1 -0
- package/packages/flows/dist/symlinks.d.ts +17 -0
- package/packages/flows/dist/symlinks.js +1 -0
- package/packages/flows/dist/types.d.ts +112 -0
- package/packages/flows/dist/types.js +1 -0
- package/packages/indexer/dist/file-hasher.d.ts +13 -0
- package/packages/indexer/dist/file-hasher.js +1 -0
- package/packages/indexer/dist/filesystem-crawler.d.ts +29 -0
- package/packages/indexer/dist/filesystem-crawler.js +1 -0
- package/packages/indexer/dist/graph-extractor.d.ts +18 -0
- package/packages/indexer/dist/graph-extractor.js +1 -0
- package/packages/indexer/dist/hash-cache.d.ts +24 -0
- package/packages/indexer/dist/hash-cache.js +1 -0
- package/packages/indexer/dist/incremental-indexer.d.ts +56 -0
- package/packages/indexer/dist/incremental-indexer.js +1 -0
- package/packages/indexer/dist/index.d.ts +6 -0
- package/packages/indexer/dist/index.js +1 -0
- package/packages/present/dist/index.html +709 -0
- package/packages/server/dist/api.d.ts +3 -0
- package/packages/server/dist/api.js +1 -0
- package/packages/server/dist/auto-gc.d.ts +30 -0
- package/packages/server/dist/auto-gc.js +1 -0
- package/packages/server/dist/completions.d.ts +14 -0
- package/packages/server/dist/completions.js +1 -0
- package/packages/server/dist/config.d.ts +14 -0
- package/packages/server/dist/config.js +1 -0
- package/packages/server/dist/cross-workspace.d.ts +43 -0
- package/packages/server/dist/cross-workspace.js +1 -0
- package/packages/server/dist/curated-manager.d.ts +92 -0
- package/packages/server/dist/curated-manager.js +5 -0
- package/packages/server/dist/dashboard-static.d.ts +27 -0
- package/packages/server/dist/dashboard-static.js +1 -0
- package/packages/server/dist/elicitor.d.ts +18 -0
- package/packages/server/dist/elicitor.js +1 -0
- package/packages/server/dist/index.d.ts +1 -0
- package/packages/server/dist/index.js +1 -0
- package/packages/server/dist/mcp-logging.d.ts +11 -0
- package/packages/server/dist/mcp-logging.js +1 -0
- package/packages/server/dist/output-schemas.d.ts +242 -0
- package/packages/server/dist/output-schemas.js +1 -0
- package/packages/server/dist/prompts.d.ts +13 -0
- package/packages/server/dist/prompts.js +13 -0
- package/packages/server/dist/replay-interceptor.d.ts +23 -0
- package/packages/server/dist/replay-interceptor.js +1 -0
- package/packages/server/dist/resource-links.d.ts +34 -0
- package/packages/server/dist/resource-links.js +1 -0
- package/packages/server/dist/resources/curated-resources.d.ts +13 -0
- package/packages/server/dist/resources/curated-resources.js +2 -0
- package/packages/server/dist/resources/resource-notifier.d.ts +45 -0
- package/packages/server/dist/resources/resource-notifier.js +1 -0
- package/packages/server/dist/resources/resources.d.ts +8 -0
- package/packages/server/dist/resources/resources.js +2 -0
- package/packages/server/dist/sampling.d.ts +41 -0
- package/packages/server/dist/sampling.js +2 -0
- package/packages/server/dist/server.d.ts +47 -0
- package/packages/server/dist/server.js +3 -0
- package/packages/server/dist/structured-content-guard.d.ts +26 -0
- package/packages/server/dist/structured-content-guard.js +1 -0
- package/packages/server/dist/task-manager.d.ts +40 -0
- package/packages/server/dist/task-manager.js +1 -0
- package/packages/server/dist/tool-metadata.d.ts +38 -0
- package/packages/server/dist/tool-metadata.js +1 -0
- package/packages/server/dist/tool-prefix.d.ts +12 -0
- package/packages/server/dist/tool-prefix.js +1 -0
- package/packages/server/dist/tools/analyze.tools.d.ts +14 -0
- package/packages/server/dist/tools/analyze.tools.js +8 -0
- package/packages/server/dist/tools/audit.tool.d.ts +8 -0
- package/packages/server/dist/tools/audit.tool.js +1 -0
- package/packages/server/dist/tools/brainstorm.tool.d.ts +7 -0
- package/packages/server/dist/tools/brainstorm.tool.js +9 -0
- package/packages/server/dist/tools/bridge.tools.d.ts +34 -0
- package/packages/server/dist/tools/bridge.tools.js +15 -0
- package/packages/server/dist/tools/context.tools.d.ts +15 -0
- package/packages/server/dist/tools/context.tools.js +10 -0
- package/packages/server/dist/tools/evolution.tools.d.ts +7 -0
- package/packages/server/dist/tools/evolution.tools.js +5 -0
- package/packages/server/dist/tools/execution.tools.d.ts +14 -0
- package/packages/server/dist/tools/execution.tools.js +4 -0
- package/packages/server/dist/tools/flow.tools.d.ts +7 -0
- package/packages/server/dist/tools/flow.tools.js +1 -0
- package/packages/server/dist/tools/forge.tools.d.ts +13 -0
- package/packages/server/dist/tools/forge.tools.js +10 -0
- package/packages/server/dist/tools/forget.tool.d.ts +8 -0
- package/packages/server/dist/tools/forget.tool.js +1 -0
- package/packages/server/dist/tools/graph.tool.d.ts +7 -0
- package/packages/server/dist/tools/graph.tool.js +5 -0
- package/packages/server/dist/tools/infra.tools.d.ts +10 -0
- package/packages/server/dist/tools/infra.tools.js +5 -0
- package/packages/server/dist/tools/list.tool.d.ts +7 -0
- package/packages/server/dist/tools/list.tool.js +2 -0
- package/packages/server/dist/tools/lookup.tool.d.ts +7 -0
- package/packages/server/dist/tools/lookup.tool.js +3 -0
- package/packages/server/dist/tools/manipulation.tools.d.ts +10 -0
- package/packages/server/dist/tools/manipulation.tools.js +4 -0
- package/packages/server/dist/tools/onboard.tool.d.ts +9 -0
- package/packages/server/dist/tools/onboard.tool.js +2 -0
- package/packages/server/dist/tools/persistence.tools.d.ts +10 -0
- package/packages/server/dist/tools/persistence.tools.js +5 -0
- package/packages/server/dist/tools/policy.tools.d.ts +7 -0
- package/packages/server/dist/tools/policy.tools.js +3 -0
- package/packages/server/dist/tools/present/browser.d.ts +4 -0
- package/packages/server/dist/tools/present/browser.js +93 -0
- package/packages/server/dist/tools/present/helpers.d.ts +18 -0
- package/packages/server/dist/tools/present/helpers.js +1 -0
- package/packages/server/dist/tools/present/html.d.ts +18 -0
- package/packages/server/dist/tools/present/html.js +5 -0
- package/packages/server/dist/tools/present/index.d.ts +2 -0
- package/packages/server/dist/tools/present/index.js +1 -0
- package/packages/server/dist/tools/present/markdown.d.ts +17 -0
- package/packages/server/dist/tools/present/markdown.js +8 -0
- package/packages/server/dist/tools/present/templates.d.ts +14 -0
- package/packages/server/dist/tools/present/templates.js +472 -0
- package/packages/server/dist/tools/present/tool.d.ts +27 -0
- package/packages/server/dist/tools/present/tool.js +19 -0
- package/packages/server/dist/tools/present-blocks.d.ts +46 -0
- package/packages/server/dist/tools/present-blocks.js +27 -0
- package/packages/server/dist/tools/present-charts.d.ts +31 -0
- package/packages/server/dist/tools/present-charts.js +34 -0
- package/packages/server/dist/tools/present-theme.d.ts +14 -0
- package/packages/server/dist/tools/present-theme.js +395 -0
- package/packages/server/dist/tools/present-utils.d.ts +11 -0
- package/packages/server/dist/tools/present-utils.js +1 -0
- package/packages/server/dist/tools/present.tool.d.ts +2 -0
- package/packages/server/dist/tools/present.tool.js +1 -0
- package/packages/server/dist/tools/produce.tool.d.ts +7 -0
- package/packages/server/dist/tools/produce.tool.js +4 -0
- package/packages/server/dist/tools/read.tool.d.ts +7 -0
- package/packages/server/dist/tools/read.tool.js +2 -0
- package/packages/server/dist/tools/reindex.tool.d.ts +11 -0
- package/packages/server/dist/tools/reindex.tool.js +3 -0
- package/packages/server/dist/tools/remember.tool.d.ts +9 -0
- package/packages/server/dist/tools/remember.tool.js +4 -0
- package/packages/server/dist/tools/replay.tool.d.ts +6 -0
- package/packages/server/dist/tools/replay.tool.js +3 -0
- package/packages/server/dist/tools/restore.tool.d.ts +6 -0
- package/packages/server/dist/tools/restore.tool.js +3 -0
- package/packages/server/dist/tools/search.tool.d.ts +11 -0
- package/packages/server/dist/tools/search.tool.js +10 -0
- package/packages/server/dist/tools/status.tool.d.ts +20 -0
- package/packages/server/dist/tools/status.tool.js +3 -0
- package/packages/server/dist/tools/update.tool.d.ts +8 -0
- package/packages/server/dist/tools/update.tool.js +1 -0
- package/packages/server/dist/tools/utility.tools.d.ts +15 -0
- package/packages/server/dist/tools/utility.tools.js +13 -0
- package/packages/server/dist/version-check.d.ts +32 -0
- package/packages/server/dist/version-check.js +1 -0
- package/packages/store/dist/graph-store.interface.d.ts +118 -0
- package/packages/store/dist/graph-store.interface.js +1 -0
- package/packages/store/dist/index.d.ts +6 -0
- package/packages/store/dist/index.js +1 -0
- package/packages/store/dist/lance-store.d.ts +44 -0
- package/packages/store/dist/lance-store.js +1 -0
- package/packages/store/dist/sqlite-graph-store.d.ts +45 -0
- package/packages/store/dist/sqlite-graph-store.js +58 -0
- package/packages/store/dist/store-factory.d.ts +12 -0
- package/packages/store/dist/store-factory.js +1 -0
- package/packages/store/dist/store.interface.d.ts +54 -0
- package/packages/store/dist/store.interface.js +1 -0
- package/packages/tools/dist/audit.d.ts +65 -0
- package/packages/tools/dist/audit.js +6 -0
- package/packages/tools/dist/batch.d.ts +23 -0
- package/packages/tools/dist/batch.js +1 -0
- package/packages/tools/dist/changelog.d.ts +36 -0
- package/packages/tools/dist/changelog.js +2 -0
- package/packages/tools/dist/check.d.ts +48 -0
- package/packages/tools/dist/check.js +2 -0
- package/packages/tools/dist/checkpoint.d.ts +19 -0
- package/packages/tools/dist/checkpoint.js +1 -0
- package/packages/tools/dist/codemod.d.ts +39 -0
- package/packages/tools/dist/codemod.js +2 -0
- package/packages/tools/dist/compact.d.ts +41 -0
- package/packages/tools/dist/compact.js +3 -0
- package/packages/tools/dist/config-extractor.d.ts +9 -0
- package/packages/tools/dist/config-extractor.js +7 -0
- package/packages/tools/dist/data-transform.d.ts +12 -0
- package/packages/tools/dist/data-transform.js +1 -0
- package/packages/tools/dist/dead-symbols.d.ts +28 -0
- package/packages/tools/dist/dead-symbols.js +2 -0
- package/packages/tools/dist/delegate.d.ts +36 -0
- package/packages/tools/dist/delegate.js +1 -0
- package/packages/tools/dist/diagram-builder.d.ts +9 -0
- package/packages/tools/dist/diagram-builder.js +9 -0
- package/packages/tools/dist/diff-parse.d.ts +28 -0
- package/packages/tools/dist/diff-parse.js +3 -0
- package/packages/tools/dist/digest.d.ts +50 -0
- package/packages/tools/dist/digest.js +6 -0
- package/packages/tools/dist/dogfood-log.d.ts +49 -0
- package/packages/tools/dist/dogfood-log.js +2 -0
- package/packages/tools/dist/encode.d.ts +16 -0
- package/packages/tools/dist/encode.js +1 -0
- package/packages/tools/dist/env-info.d.ts +30 -0
- package/packages/tools/dist/env-info.js +1 -0
- package/packages/tools/dist/eval.d.ts +15 -0
- package/packages/tools/dist/eval.js +2 -0
- package/packages/tools/dist/evidence-map.d.ts +92 -0
- package/packages/tools/dist/evidence-map.js +2 -0
- package/packages/tools/dist/file-cache.d.ts +41 -0
- package/packages/tools/dist/file-cache.js +3 -0
- package/packages/tools/dist/file-summary.d.ts +52 -0
- package/packages/tools/dist/file-summary.js +2 -0
- package/packages/tools/dist/file-walk.d.ts +6 -0
- package/packages/tools/dist/file-walk.js +1 -0
- package/packages/tools/dist/find-examples.d.ts +29 -0
- package/packages/tools/dist/find-examples.js +3 -0
- package/packages/tools/dist/find.d.ts +49 -0
- package/packages/tools/dist/find.js +1 -0
- package/packages/tools/dist/forge-classify.d.ts +44 -0
- package/packages/tools/dist/forge-classify.js +2 -0
- package/packages/tools/dist/forge-ground.d.ts +61 -0
- package/packages/tools/dist/forge-ground.js +1 -0
- package/packages/tools/dist/git-context.d.ts +25 -0
- package/packages/tools/dist/git-context.js +3 -0
- package/packages/tools/dist/graph-query.d.ts +86 -0
- package/packages/tools/dist/graph-query.js +1 -0
- package/packages/tools/dist/guide.d.ts +25 -0
- package/packages/tools/dist/guide.js +1 -0
- package/packages/tools/dist/health.d.ts +16 -0
- package/packages/tools/dist/health.js +2 -0
- package/packages/tools/dist/http-request.d.ts +25 -0
- package/packages/tools/dist/http-request.js +1 -0
- package/packages/tools/dist/index.d.ts +57 -0
- package/packages/tools/dist/index.js +1 -0
- package/packages/tools/dist/lane.d.ts +41 -0
- package/packages/tools/dist/lane.js +6 -0
- package/packages/tools/dist/measure.d.ts +42 -0
- package/packages/tools/dist/measure.js +2 -0
- package/packages/tools/dist/onboard-utils.d.ts +12 -0
- package/packages/tools/dist/onboard-utils.js +1 -0
- package/packages/tools/dist/onboard.d.ts +50 -0
- package/packages/tools/dist/onboard.js +18 -0
- package/packages/tools/dist/parse-output.d.ts +82 -0
- package/packages/tools/dist/parse-output.js +2 -0
- package/packages/tools/dist/path-resolver.d.ts +14 -0
- package/packages/tools/dist/path-resolver.js +1 -0
- package/packages/tools/dist/process-manager.d.ts +20 -0
- package/packages/tools/dist/process-manager.js +1 -0
- package/packages/tools/dist/queue.d.ts +40 -0
- package/packages/tools/dist/queue.js +1 -0
- package/packages/tools/dist/regex-test.d.ts +33 -0
- package/packages/tools/dist/regex-test.js +1 -0
- package/packages/tools/dist/regex-utils.d.ts +8 -0
- package/packages/tools/dist/regex-utils.js +1 -0
- package/packages/tools/dist/rename.d.ts +31 -0
- package/packages/tools/dist/rename.js +2 -0
- package/packages/tools/dist/replay.d.ts +59 -0
- package/packages/tools/dist/replay.js +4 -0
- package/packages/tools/dist/response-envelope.d.ts +43 -0
- package/packages/tools/dist/response-envelope.js +1 -0
- package/packages/tools/dist/restore-points.d.ts +22 -0
- package/packages/tools/dist/restore-points.js +1 -0
- package/packages/tools/dist/schema-validate.d.ts +25 -0
- package/packages/tools/dist/schema-validate.js +1 -0
- package/packages/tools/dist/scope-map.d.ts +51 -0
- package/packages/tools/dist/scope-map.js +1 -0
- package/packages/tools/dist/snippet.d.ts +35 -0
- package/packages/tools/dist/snippet.js +1 -0
- package/packages/tools/dist/stash.d.ts +14 -0
- package/packages/tools/dist/stash.js +1 -0
- package/packages/tools/dist/stratum-card.d.ts +30 -0
- package/packages/tools/dist/stratum-card.js +4 -0
- package/packages/tools/dist/symbol.d.ts +45 -0
- package/packages/tools/dist/symbol.js +3 -0
- package/packages/tools/dist/synthesis-engine.d.ts +13 -0
- package/packages/tools/dist/synthesis-engine.js +6 -0
- package/packages/tools/dist/test-run.d.ts +28 -0
- package/packages/tools/dist/test-run.js +2 -0
- package/packages/tools/dist/text-utils.d.ts +24 -0
- package/packages/tools/dist/text-utils.js +2 -0
- package/packages/tools/dist/time-utils.d.ts +20 -0
- package/packages/tools/dist/time-utils.js +1 -0
- package/packages/tools/dist/trace.d.ts +29 -0
- package/packages/tools/dist/trace.js +2 -0
- package/packages/tools/dist/truncation.d.ts +33 -0
- package/packages/tools/dist/truncation.js +7 -0
- package/packages/tools/dist/watch.d.ts +32 -0
- package/packages/tools/dist/watch.js +1 -0
- package/packages/tools/dist/web-fetch.d.ts +47 -0
- package/packages/tools/dist/web-fetch.js +8 -0
- package/packages/tools/dist/web-search.d.ts +25 -0
- package/packages/tools/dist/web-search.js +1 -0
- package/packages/tools/dist/workset.d.ts +47 -0
- package/packages/tools/dist/workset.js +1 -0
- package/packages/tui/dist/App-DU2KEylW.js +2 -0
- package/packages/tui/dist/App.d.ts +13 -0
- package/packages/tui/dist/App.js +2 -0
- package/packages/tui/dist/CuratedPanel-BIamXLNy.js +2 -0
- package/packages/tui/dist/LogPanel-Bo8a8QXB.js +3 -0
- package/packages/tui/dist/SearchPanel-CpJGczAc.js +2 -0
- package/packages/tui/dist/StatusPanel-BAbUxyqQ.js +2 -0
- package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
- package/packages/tui/dist/devtools-DMOZMn70.js +7 -0
- package/packages/tui/dist/hooks/useKBClient.d.ts +9 -0
- package/packages/tui/dist/hooks/useKBClient.js +2 -0
- package/packages/tui/dist/hooks/usePolling.d.ts +8 -0
- package/packages/tui/dist/hooks/usePolling.js +2 -0
- package/packages/tui/dist/index-BXafekwr.d.ts +64 -0
- package/packages/tui/dist/index.d.ts +7 -0
- package/packages/tui/dist/index.js +2 -0
- package/packages/tui/dist/jsx-runtime-y6Gdq5PZ.js +294 -0
- package/packages/tui/dist/panels/CuratedPanel.d.ts +7 -0
- package/packages/tui/dist/panels/CuratedPanel.js +2 -0
- package/packages/tui/dist/panels/LogPanel.d.ts +7 -0
- package/packages/tui/dist/panels/LogPanel.js +2 -0
- package/packages/tui/dist/panels/SearchPanel.d.ts +7 -0
- package/packages/tui/dist/panels/SearchPanel.js +2 -0
- package/packages/tui/dist/panels/StatusPanel.d.ts +7 -0
- package/packages/tui/dist/panels/StatusPanel.js +2 -0
- package/packages/tui/dist/react-D__J1GQe.js +24 -0
- package/packages/tui/dist/useKBClient-C35iA4uG.js +2 -0
- package/packages/tui/dist/usePolling-BbjnRWgx.js +2 -0
- package/scaffold/README.md +192 -0
- package/scaffold/adapters/claude-code.mjs +56 -0
- package/scaffold/adapters/copilot.mjs +270 -0
- package/scaffold/definitions/agents.mjs +189 -0
- package/scaffold/definitions/bodies.mjs +487 -0
- package/scaffold/definitions/hooks.mjs +43 -0
- package/scaffold/definitions/models.mjs +56 -0
- package/scaffold/definitions/plugins.mjs +38 -0
- package/scaffold/definitions/prompts.mjs +145 -0
- package/scaffold/definitions/protocols.mjs +679 -0
- package/scaffold/definitions/tools.mjs +229 -0
- package/scaffold/flows/aikit-advanced/flow.json +60 -0
- package/scaffold/flows/aikit-advanced/skills/execute/SKILL.md +124 -0
- package/scaffold/flows/aikit-advanced/skills/plan/SKILL.md +100 -0
- package/scaffold/flows/aikit-advanced/skills/spec/SKILL.md +100 -0
- package/scaffold/flows/aikit-advanced/skills/task/SKILL.md +99 -0
- package/scaffold/flows/aikit-advanced/skills/verify/SKILL.md +122 -0
- package/scaffold/flows/aikit-basic/flow.json +36 -0
- package/scaffold/flows/aikit-basic/skills/assess/SKILL.md +82 -0
- package/scaffold/flows/aikit-basic/skills/implement/SKILL.md +105 -0
- package/scaffold/flows/aikit-basic/skills/verify/SKILL.md +96 -0
- package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +21 -0
- package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +21 -0
- package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +12 -0
- package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +12 -0
- package/scaffold/general/agents/Debugger.agent.md +34 -0
- package/scaffold/general/agents/Documenter.agent.md +53 -0
- package/scaffold/general/agents/Explorer.agent.md +63 -0
- package/scaffold/general/agents/Frontend.agent.md +29 -0
- package/scaffold/general/agents/Implementer.agent.md +33 -0
- package/scaffold/general/agents/Orchestrator.agent.md +149 -0
- package/scaffold/general/agents/Planner.agent.md +79 -0
- package/scaffold/general/agents/README.md +57 -0
- package/scaffold/general/agents/Refactor.agent.md +36 -0
- package/scaffold/general/agents/Researcher-Alpha.agent.md +20 -0
- package/scaffold/general/agents/Researcher-Beta.agent.md +20 -0
- package/scaffold/general/agents/Researcher-Delta.agent.md +20 -0
- package/scaffold/general/agents/Researcher-Gamma.agent.md +20 -0
- package/scaffold/general/agents/Security.agent.md +55 -0
- package/scaffold/general/agents/_shared/architect-reviewer-base.md +60 -0
- package/scaffold/general/agents/_shared/code-agent-base.md +262 -0
- package/scaffold/general/agents/_shared/code-reviewer-base.md +64 -0
- package/scaffold/general/agents/_shared/decision-protocol.md +27 -0
- package/scaffold/general/agents/_shared/forge-protocol.md +90 -0
- package/scaffold/general/agents/_shared/researcher-base.md +101 -0
- package/scaffold/general/agents/templates/adr-template.md +28 -0
- package/scaffold/general/agents/templates/execution-state.md +26 -0
- package/scaffold/general/prompts/ask.prompt.md +21 -0
- package/scaffold/general/prompts/debug.prompt.md +25 -0
- package/scaffold/general/prompts/design.prompt.md +23 -0
- package/scaffold/general/prompts/implement.prompt.md +26 -0
- package/scaffold/general/prompts/plan.prompt.md +25 -0
- package/scaffold/general/prompts/review.prompt.md +32 -0
- package/scaffold/general/skills/adr-skill/SKILL.md +329 -0
- package/scaffold/general/skills/adr-skill/assets/templates/adr-madr.md +89 -0
- package/scaffold/general/skills/adr-skill/assets/templates/adr-readme.md +20 -0
- package/scaffold/general/skills/adr-skill/assets/templates/adr-simple.md +46 -0
- package/scaffold/general/skills/adr-skill/references/adr-conventions.md +95 -0
- package/scaffold/general/skills/adr-skill/references/examples.md +193 -0
- package/scaffold/general/skills/adr-skill/references/review-checklist.md +77 -0
- package/scaffold/general/skills/adr-skill/references/template-variants.md +52 -0
- package/scaffold/general/skills/adr-skill/scripts/bootstrap_adr.js +259 -0
- package/scaffold/general/skills/adr-skill/scripts/new_adr.js +391 -0
- package/scaffold/general/skills/adr-skill/scripts/set_adr_status.js +169 -0
- package/scaffold/general/skills/aikit/SKILL.md +521 -0
- package/scaffold/general/skills/brainstorming/SKILL.md +259 -0
- package/scaffold/general/skills/brainstorming/scripts/frame-template.html +365 -0
- package/scaffold/general/skills/brainstorming/scripts/helper.js +216 -0
- package/scaffold/general/skills/brainstorming/scripts/server.cjs +9 -0
- package/scaffold/general/skills/brainstorming/scripts/server.src.cjs +249 -0
- package/scaffold/general/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/scaffold/general/skills/brainstorming/visual-companion.md +430 -0
- package/scaffold/general/skills/c4-architecture/SKILL.md +295 -0
- package/scaffold/general/skills/c4-architecture/references/advanced-patterns.md +552 -0
- package/scaffold/general/skills/c4-architecture/references/c4-syntax.md +492 -0
- package/scaffold/general/skills/c4-architecture/references/common-mistakes.md +437 -0
- package/scaffold/general/skills/lesson-learned/SKILL.md +105 -0
- package/scaffold/general/skills/lesson-learned/references/anti-patterns.md +55 -0
- package/scaffold/general/skills/lesson-learned/references/se-principles.md +109 -0
- package/scaffold/general/skills/multi-agents-development/SKILL.md +435 -0
- package/scaffold/general/skills/multi-agents-development/architecture-review-prompt.md +81 -0
- package/scaffold/general/skills/multi-agents-development/code-quality-review-prompt.md +91 -0
- package/scaffold/general/skills/multi-agents-development/implementer-prompt.md +93 -0
- package/scaffold/general/skills/multi-agents-development/parallel-dispatch-example.md +167 -0
- package/scaffold/general/skills/multi-agents-development/spec-review-prompt.md +81 -0
- package/scaffold/general/skills/present/SKILL.md +424 -0
- package/scaffold/general/skills/requirements-clarity/SKILL.md +324 -0
- package/scaffold/general/skills/session-handoff/SKILL.md +189 -0
- package/scaffold/general/skills/session-handoff/references/handoff-template.md +139 -0
- package/scaffold/general/skills/session-handoff/references/resume-checklist.md +80 -0
- package/scaffold/general/skills/session-handoff/scripts/check_staleness.js +269 -0
- package/scaffold/general/skills/session-handoff/scripts/create_handoff.js +299 -0
- package/scaffold/general/skills/session-handoff/scripts/list_handoffs.js +113 -0
- package/scaffold/general/skills/session-handoff/scripts/validate_handoff.js +241 -0
- package/scaffold/generate.mjs +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{estimateTokens as e}from"./text-utils.js";import{evidenceMap as t}from"./evidence-map.js";import{fileSummary as n}from"./file-summary.js";import{forgeClassify as r}from"./forge-classify.js";import{scopeMap as i}from"./scope-map.js";const a={floor:{ground:`Parasitic — read target file only`,build:`Implement directly`,break:`Skip`,evidenceMap:`Not required`,gate:`Self-certify`},standard:{ground:`Scope map + blast radius + constraint seed`,build:`TDD — test first, then implement`,break:`Error paths + edge cases`,evidenceMap:`3-8 critical-path entries`,gate:`YIELD/HOLD evaluation`},critical:{ground:`Full scope map + blast radius + trace + patterns + constraint pack`,build:`TDD + contract verification + cross-service validation`,break:`Error paths + edge cases + security dimensions + data-flow verification`,evidenceMap:`Comprehensive — all critical-path claims with receipts`,gate:`Strict YIELD/HOLD/HARD_BLOCK evaluation`}};async function o(e,t,n){let r=n.maxConstraints??3,i=await s(n),a=await u(n.files);if(i.tier===`floor`)return _({tier:i.tier,classifyTriggers:i.classifyTriggers,scopeMap:null,typedUnknownSeeds:i.typedUnknownSeeds,constraints:[],fileSummaries:a,evidenceMapTaskId:null,ceremony:i.ceremony});let[o,d,p]=await Promise.all([c(e,t,n.task,i.tier),l(e,t,n.task,r),f(n.rootPath,n.taskId??v(n.task),i.tier)]);return _({tier:i.tier,classifyTriggers:i.classifyTriggers,scopeMap:o,typedUnknownSeeds:i.typedUnknownSeeds,constraints:d,fileSummaries:a,evidenceMapTaskId:p,ceremony:i.ceremony})}async function s(e){if(e.forceTier)return{tier:e.forceTier,classifyTriggers:[],typedUnknownSeeds:[],ceremony:g(e.forceTier)};try{let t=await r({files:e.files,task:e.task,rootPath:e.rootPath});return{tier:t.tier,classifyTriggers:t.triggers,typedUnknownSeeds:t.typedUnknownSeeds,ceremony:t.ceremony}}catch{return{tier:`standard`,classifyTriggers:[],typedUnknownSeeds:[],ceremony:g(`standard`)}}}async function c(e,t,n,r){try{return await i(e,t,{task:n,maxFiles:r===`critical`?20:10})}catch{return null}}async function l(e,t,n,r){try{let i=`decision pattern convention ${n}`,a=typeof e.embedQuery==`function`?await e.embedQuery(i):await e.embed(i);return(await t.search(a,{limit:r,origin:`curated`})).slice(0,r).map(e=>p(e))}catch{return[]}}async function u(e){return Promise.all(e.map(async e=>d(e)))}async function d(e){try{return h(await n({path:e}))}catch(t){return{path:e,exports:[],functions:[],lines:0,error:t instanceof Error?t.message:`Unable to summarize file`}}}async function f(e,n,r){try{return t({action:`create`,taskId:n,tier:r},e),n}catch{return null}}function p(e){return{source:e.record.sourcePath,snippet:m(e.record.content),relevance:e.score}}function m(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=200?t:`${t.slice(0,197).trimEnd()}...`}function h(e){return{path:e.path,exports:e.exports,functions:e.functions.map(e=>e.name),lines:e.lines}}function g(e){return{...a[e]}}function _(t){return{...t,estimatedTokens:e(JSON.stringify(t))}}function v(e){let t=e.toLowerCase().replace(/[^a-z0-9\s]/g,` `).split(/\s+/).filter(Boolean).slice(0,5).join(`-`),n=Date.now().toString(36);return`${t||`task`}-${n}`}export{o as forgeGround};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region packages/tools/src/git-context.d.ts
|
|
2
|
+
interface GitContextOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
commitCount?: number;
|
|
5
|
+
includeDiff?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface GitContextResult {
|
|
8
|
+
gitRoot: string;
|
|
9
|
+
branch: string;
|
|
10
|
+
status: {
|
|
11
|
+
staged: string[];
|
|
12
|
+
modified: string[];
|
|
13
|
+
untracked: string[];
|
|
14
|
+
};
|
|
15
|
+
recentCommits: Array<{
|
|
16
|
+
hash: string;
|
|
17
|
+
message: string;
|
|
18
|
+
author: string;
|
|
19
|
+
date: string;
|
|
20
|
+
}>;
|
|
21
|
+
diff?: string;
|
|
22
|
+
}
|
|
23
|
+
declare function gitContext(options?: GitContextOptions): Promise<GitContextResult>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { GitContextOptions, GitContextResult, gitContext };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{execFile as e}from"node:child_process";import{promisify as t}from"node:util";const n=t(e);async function r(e,t){try{let{stdout:r}=await n(`git`,e,{cwd:t,timeout:15e3});return r.toString().trim()}catch{return``}}async function i(e={}){let t=e.cwd??process.cwd(),n=e.commitCount??5,i=await r([`rev-parse`,`--show-toplevel`],t);if(!i)return{gitRoot:t,branch:`unknown`,status:{staged:[],modified:[],untracked:[]},recentCommits:[]};let a=i,[o,s,c,l]=await Promise.all([r([`rev-parse`,`--abbrev-ref`,`HEAD`],a),r([`status`,`--porcelain`],a),r([`log`,`--max-count=${n}`,`--format=%h|%s|%an|%ai`],a),e.includeDiff?r([`diff`,`--stat`,`--no-color`],a):Promise.resolve(``)]),u=[],d=[],f=[];for(let e of s.split(`
|
|
2
|
+
`).filter(Boolean)){let t=e[0],n=e[1],r=e.slice(3).trim();t!==` `&&t!==`?`&&u.push(r),(n===`M`||n===`D`)&&d.push(r),t===`?`&&f.push(r)}let p=c.split(`
|
|
3
|
+
`).filter(Boolean).map(e=>{let[t,n,r,i]=e.split(`|`);return{hash:t,message:n,author:r,date:i}});return{gitRoot:i,branch:o||`unknown`,status:{staged:u,modified:d,untracked:f},recentCommits:p,diff:l||void 0}}export{i as gitContext};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { GraphEdge, GraphNode, GraphStats, GraphTraversalResult, GraphValidationResult, IGraphStore } from "../../store/dist/index.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/tools/src/graph-query.d.ts
|
|
4
|
+
interface GraphQueryOptions {
|
|
5
|
+
/** Action: query nodes, traverse from a node, get stats, or add data */
|
|
6
|
+
action: 'find_nodes' | 'find_edges' | 'neighbors' | 'traverse' | 'stats' | 'validate' | 'add' | 'delete' | 'clear';
|
|
7
|
+
/** Node type filter (for find_nodes) */
|
|
8
|
+
nodeType?: string;
|
|
9
|
+
/** Name pattern (LIKE %pattern%) for find_nodes */
|
|
10
|
+
namePattern?: string;
|
|
11
|
+
/** Source path filter */
|
|
12
|
+
sourcePath?: string;
|
|
13
|
+
/** Node ID for neighbors/traverse/delete */
|
|
14
|
+
nodeId?: string;
|
|
15
|
+
/** Edge type filter */
|
|
16
|
+
edgeType?: string;
|
|
17
|
+
/** From node ID (for find_edges) */
|
|
18
|
+
fromId?: string;
|
|
19
|
+
/** To node ID (for find_edges) */
|
|
20
|
+
toId?: string;
|
|
21
|
+
/** Traversal direction */
|
|
22
|
+
direction?: 'outgoing' | 'incoming' | 'both';
|
|
23
|
+
/** Max traversal depth (default: 2) */
|
|
24
|
+
maxDepth?: number;
|
|
25
|
+
/** Max results (default: 50) */
|
|
26
|
+
limit?: number;
|
|
27
|
+
/** Nodes to add (for action=add) */
|
|
28
|
+
nodes?: Array<{
|
|
29
|
+
id?: string;
|
|
30
|
+
type: string;
|
|
31
|
+
name: string;
|
|
32
|
+
properties?: Record<string, unknown>;
|
|
33
|
+
sourceRecordId?: string;
|
|
34
|
+
sourcePath?: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Edges to add (for action=add) */
|
|
37
|
+
edges?: Array<{
|
|
38
|
+
id?: string;
|
|
39
|
+
fromId: string;
|
|
40
|
+
toId: string;
|
|
41
|
+
type: string;
|
|
42
|
+
weight?: number;
|
|
43
|
+
properties?: Record<string, unknown>;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
interface GraphQueryResult {
|
|
47
|
+
action: string;
|
|
48
|
+
nodes?: GraphNode[];
|
|
49
|
+
edges?: GraphEdge[];
|
|
50
|
+
stats?: GraphStats;
|
|
51
|
+
validation?: GraphValidationResult;
|
|
52
|
+
nodesAdded?: number;
|
|
53
|
+
edgesAdded?: number;
|
|
54
|
+
deleted?: number;
|
|
55
|
+
summary: string;
|
|
56
|
+
}
|
|
57
|
+
declare function graphQuery(graphStore: IGraphStore, options: GraphQueryOptions): Promise<GraphQueryResult>;
|
|
58
|
+
interface GraphAugmentOptions {
|
|
59
|
+
/** Max graph hops from each vector hit (default: 1) */
|
|
60
|
+
hops?: number;
|
|
61
|
+
/** Edge type filter for graph expansion */
|
|
62
|
+
edgeType?: string;
|
|
63
|
+
/** Max graph nodes per vector hit (default: 5) */
|
|
64
|
+
maxPerHit?: number;
|
|
65
|
+
}
|
|
66
|
+
interface GraphAugmentedResult {
|
|
67
|
+
/** Original search result record ID */
|
|
68
|
+
recordId: string;
|
|
69
|
+
/** Original similarity score */
|
|
70
|
+
score: number;
|
|
71
|
+
/** Source path of the matched record */
|
|
72
|
+
sourcePath: string;
|
|
73
|
+
/** Graph nodes connected to this record (via sourceRecordId) */
|
|
74
|
+
graphContext: GraphTraversalResult;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Augment vector search results with graph context.
|
|
78
|
+
* For each search hit, finds linked graph nodes and traverses their connections.
|
|
79
|
+
*/
|
|
80
|
+
declare function graphAugmentSearch(graphStore: IGraphStore, hits: Array<{
|
|
81
|
+
recordId: string;
|
|
82
|
+
score: number;
|
|
83
|
+
sourcePath: string;
|
|
84
|
+
}>, options?: GraphAugmentOptions): Promise<GraphAugmentedResult[]>;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { GraphAugmentOptions, GraphAugmentedResult, GraphQueryOptions, GraphQueryResult, graphAugmentSearch, graphQuery };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createHash as e}from"node:crypto";function t(t,...n){return`${t}_${e(`sha256`).update(n.join(`|`)).digest(`hex`).slice(0,12)}`}async function n(e,n){let{action:r}=n;switch(r){case`find_nodes`:{let t=await e.findNodes({type:n.nodeType,namePattern:n.namePattern,sourcePath:n.sourcePath,limit:n.limit});return{action:r,nodes:t,summary:`Found ${t.length} node(s)${n.nodeType?` of type "${n.nodeType}"`:``}${n.namePattern?` matching "${n.namePattern}"`:``}`}}case`find_edges`:{let t=await e.findEdges({type:n.edgeType,fromId:n.fromId,toId:n.toId,limit:n.limit});return{action:r,edges:t,summary:`Found ${t.length} edge(s)${n.edgeType?` of type "${n.edgeType}"`:``}`}}case`neighbors`:{if(!n.nodeId)return{action:r,summary:`Error: nodeId is required for neighbors action`};let t=await e.getNeighbors(n.nodeId,{edgeType:n.edgeType,direction:n.direction,limit:n.limit});return{action:r,nodes:t.nodes,edges:t.edges,summary:`Found ${t.nodes.length} neighbor(s) and ${t.edges.length} edge(s) for node "${n.nodeId}"`}}case`traverse`:{if(!n.nodeId)return{action:r,summary:`Error: nodeId is required for traverse action`};let t=await e.traverse(n.nodeId,{edgeType:n.edgeType,maxDepth:n.maxDepth,direction:n.direction,limit:n.limit});return{action:r,nodes:t.nodes,edges:t.edges,summary:`Traversed ${t.nodes.length} node(s) and ${t.edges.length} edge(s) from "${n.nodeId}" (depth=${n.maxDepth??2})`}}case`stats`:{let t=await e.getStats();return{action:r,stats:t,summary:`Graph: ${t.nodeCount} nodes, ${t.edgeCount} edges. Types: ${Object.entries(t.nodeTypes).map(([e,t])=>`${e}(${t})`).join(`, `)||`none`}`}}case`validate`:{let t=await e.validate();return{action:r,validation:t,stats:t.stats,summary:t.valid?`Graph validation passed: ${t.stats.nodeCount} nodes, ${t.stats.edgeCount} edges, ${t.orphanNodes.length} orphan node(s)`:`Graph validation found ${t.danglingEdges.length} dangling edge(s) and ${t.orphanNodes.length} orphan node(s)`}}case`add`:{let i=0,a=0;if(n.nodes&&n.nodes.length>0){let r=n.nodes.map(e=>({id:e.id??t(`node`,e.type,e.name),type:e.type,name:e.name,properties:e.properties??{},sourceRecordId:e.sourceRecordId,sourcePath:e.sourcePath,createdAt:new Date().toISOString()}));await e.upsertNodes(r),i=r.length}if(n.edges&&n.edges.length>0){let r=n.edges.map(e=>({id:e.id??t(`edge`,e.fromId,e.toId,e.type),fromId:e.fromId,toId:e.toId,type:e.type,weight:e.weight,properties:e.properties}));await e.upsertEdges(r),a=r.length}return{action:r,nodesAdded:i,edgesAdded:a,summary:`Added ${i} node(s) and ${a} edge(s) to the graph`}}case`delete`:if(n.nodeId)return await e.deleteNode(n.nodeId),{action:r,deleted:1,summary:`Deleted node "${n.nodeId}" and its edges`};if(n.sourcePath){let t=await e.deleteBySourcePath(n.sourcePath);return{action:r,deleted:t,summary:`Deleted ${t} node(s) from source "${n.sourcePath}"`}}return{action:r,summary:`Error: nodeId or sourcePath required for delete action`};case`clear`:{let t=await e.getStats();return await e.clear(),{action:r,deleted:t.nodeCount,summary:`Cleared graph: removed ${t.nodeCount} node(s) and ${t.edgeCount} edge(s)`}}default:return{action:r,summary:`Unknown action: ${r}`}}}async function r(e,t,n){let r=n?.hops??1,i=n?.maxPerHit??5,a=[];for(let o of t)try{let t=await e.findNodes({sourcePath:o.sourcePath}),s=[],c=[],l=new Set,u=new Set;for(let a of t.slice(0,i))if(!l.has(a.id)&&(l.add(a.id),s.push(a),r>0)){let t=await e.traverse(a.id,{maxDepth:r,edgeType:n?.edgeType,limit:i});for(let e of t.nodes)l.has(e.id)||(l.add(e.id),s.push(e));for(let e of t.edges)u.has(e.id)||(u.add(e.id),c.push(e))}a.push({recordId:o.recordId,score:o.score,sourcePath:o.sourcePath,graphContext:{nodes:s,edges:c}})}catch{a.push({recordId:o.recordId,score:o.score,sourcePath:o.sourcePath,graphContext:{nodes:[],edges:[]}})}return a}export{r as graphAugmentSearch,n as graphQuery};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region packages/tools/src/guide.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Tool discovery — recommends MCP tools and workflows for a given goal.
|
|
4
|
+
*
|
|
5
|
+
* Uses keyword matching against predefined workflow templates.
|
|
6
|
+
* No embeddings required — pure string matching for instant results.
|
|
7
|
+
*/
|
|
8
|
+
interface GuideRecommendation {
|
|
9
|
+
tool: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
order: number;
|
|
12
|
+
suggestedArgs?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface GuideResult {
|
|
15
|
+
workflow: string;
|
|
16
|
+
description: string;
|
|
17
|
+
tools: GuideRecommendation[];
|
|
18
|
+
alternativeWorkflows: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Match a goal description to the best workflow and return tool recommendations.
|
|
22
|
+
*/
|
|
23
|
+
declare function guide(goal: string, maxRecommendations?: number): GuideResult;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { GuideRecommendation, GuideResult, guide };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=[{name:`onboard`,description:`First-time codebase exploration and understanding`,keywords:[`onboard`,`new project`,`understand`,`explore`,`first time`,`getting started`,`learn`,`overview`],tools:[{tool:`status`,reason:`Check index health and record count`,order:1},{tool:`onboard`,reason:`Run all analysis tools in one command`,order:2,suggestedArgs:{path:`.`}},{tool:`search`,reason:`Find specific topics of interest`,order:3},{tool:`graph`,reason:`Explore module relationships`,order:4,suggestedArgs:{action:`stats`}}]},{name:`audit`,description:`Assess project health, quality, and structure`,keywords:[`audit`,`health`,`quality`,`assess`,`review project`,`check quality`,`code quality`,`tech debt`],tools:[{tool:`status`,reason:`Check index freshness`,order:1},{tool:`audit`,reason:`Unified audit report with score and recommendations`,order:2,suggestedArgs:{detail:`summary`}},{tool:`check`,reason:`Typecheck + lint validation`,order:3},{tool:`health`,reason:`Detailed health checks on package.json, tsconfig, etc.`,order:4}]},{name:`bugfix`,description:`Diagnose and fix a bug or failing test`,keywords:[`bug`,`fix`,`debug`,`error`,`failing`,`broken`,`crash`,`wrong`,`issue`,`problem`,`not working`],tools:[{tool:`parse_output`,reason:`Parse error output from build tools (tsc, vitest, biome)`,order:1},{tool:`symbol`,reason:`Find definition and all references of the failing symbol`,order:2},{tool:`trace`,reason:`Trace call chain backward from the failure point`,order:3,suggestedArgs:{direction:`backward`}},{tool:`search`,reason:`Search for related patterns or similar fixes`,order:4},{tool:`test_run`,reason:`Re-run tests after fix`,order:5}]},{name:`implement`,description:`Add a new feature or implement a change`,keywords:[`implement`,`add feature`,`new feature`,`build`,`create`,`add`,`develop`,`write code`],tools:[{tool:`scope_map`,reason:`Generate a reading plan for affected files`,order:1},{tool:`search`,reason:`Find related patterns and prior art`,order:2},{tool:`find`,reason:`Find usage examples of similar patterns`,order:3,suggestedArgs:{mode:`examples`}},{tool:`check`,reason:`Validate after implementation`,order:4},{tool:`test_run`,reason:`Run tests to verify`,order:5},{tool:`blast_radius`,reason:`Check impact of changes`,order:6}]},{name:`refactor`,description:`Restructure or clean up existing code`,keywords:[`refactor`,`restructure`,`clean up`,`reorganize`,`rename`,`move`,`extract`,`DRY`,`dead code`],tools:[{tool:`dead_symbols`,reason:`Find unused exports to remove`,order:1},{tool:`symbol`,reason:`Find all references before renaming`,order:2},{tool:`blast_radius`,reason:`Assess impact before making changes`,order:3},{tool:`rename`,reason:`Safe cross-file rename`,order:4},{tool:`check`,reason:`Validate after refactoring`,order:5},{tool:`test_run`,reason:`Ensure no regressions`,order:6}]},{name:`search`,description:`Find specific code, patterns, or information`,keywords:[`find`,`search`,`where`,`locate`,`look for`,`grep`,`which file`,`how does`],tools:[{tool:`search`,reason:`Hybrid semantic + keyword search`,order:1},{tool:`find`,reason:`Federated search with glob and regex`,order:2},{tool:`symbol`,reason:`Resolve a specific symbol definition and references`,order:3},{tool:`graph`,reason:`Explore entity relationships`,order:4,suggestedArgs:{action:`neighbors`}}]},{name:`context`,description:`Compress or manage context for efficient LLM interaction`,keywords:[`context`,`compress`,`summarize`,`too long`,`token`,`budget`,`reduce`,`compact`],tools:[{tool:`file_summary`,reason:`Quick structural overview without reading full file`,order:1},{tool:`compact`,reason:`Compress file to relevant sections`,order:2,suggestedArgs:{segmentation:`paragraph`}},{tool:`digest`,reason:`Compress multiple sources into budgeted summary`,order:3},{tool:`stratum_card`,reason:`Generate reusable context cards`,order:4}]},{name:`memory`,description:`Manage persistent knowledge across sessions`,keywords:[`memory`,`remember`,`persist`,`save`,`recall`,`decision`,`convention`,`session`,`checkpoint`],tools:[{tool:`list`,reason:`See all stored knowledge entries`,order:1},{tool:`search`,reason:`Search curated knowledge`,order:2,suggestedArgs:{origin:`curated`}},{tool:`remember`,reason:`Store a new decision or pattern`,order:3},{tool:`checkpoint`,reason:`Save/restore session progress`,order:4},{tool:`stash`,reason:`Temporary key-value storage within session`,order:5}]},{name:`validate`,description:`Run checks, tests, and validation`,keywords:[`validate`,`check`,`test`,`lint`,`typecheck`,`verify`,`CI`,`pass`,`run tests`],tools:[{tool:`check`,reason:`Typecheck + lint in one call`,order:1,suggestedArgs:{detail:`errors`}},{tool:`test_run`,reason:`Run tests with structured output`,order:2},{tool:`health`,reason:`Project health assessment`,order:3}]},{name:`analyze`,description:`Deep analysis of codebase structure, dependencies, or patterns`,keywords:[`analyze`,`dependency`,`structure`,`pattern`,`architecture`,`diagram`,`entry point`,`import`],tools:[{tool:`analyze_structure`,reason:`Project structure overview`,order:1},{tool:`analyze_dependencies`,reason:`Dependency graph and analysis`,order:2},{tool:`analyze_patterns`,reason:`Detect code patterns and conventions`,order:3},{tool:`analyze_entry_points`,reason:`Find handlers, exports, and entry points`,order:4},{tool:`analyze_diagram`,reason:`Generate Mermaid diagrams`,order:5}]},{name:`upgrade`,description:`Update KB agents, prompts, skills, and scaffold to the latest version (user-level and workspace-level)`,keywords:[`upgrade`,`update`,`version`,`scaffold`,`outdated`,`mismatch`,`deploy`,`install`,`refresh`],tools:[{tool:`status`,reason:`Check current versions and detect mismatches — auto-triggers upgrade when a version mismatch is found`,order:1},{tool:`reindex`,reason:`Refresh the index after the upgrade completes`,order:2},{tool:`produce_knowledge`,reason:`Regenerate codebase analysis with updated tooling`,order:3,suggestedArgs:{path:`.`}}]}];function t(t,n=5){let r=t.toLowerCase(),i=e.map(e=>{let t=0;for(let n of e.keywords)r.includes(n)&&(t+=n.includes(` `)?2:1);return{workflow:e,score:t}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score),a=e.find(e=>e.name===`search`)??e[0],o=i[0]?.workflow??a,s=i.slice(1,4).map(e=>e.workflow.name).filter(e=>e!==o.name);return{workflow:o.name,description:o.description,tools:o.tools.slice(0,n),alternativeWorkflows:s}}export{t as guide};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region packages/tools/src/health.d.ts
|
|
2
|
+
interface HealthCheck {
|
|
3
|
+
name: string;
|
|
4
|
+
status: 'pass' | 'warn' | 'fail';
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
interface HealthResult {
|
|
8
|
+
path: string;
|
|
9
|
+
checks: HealthCheck[];
|
|
10
|
+
score: number;
|
|
11
|
+
summary: string;
|
|
12
|
+
}
|
|
13
|
+
/** Run project health checks on a directory. */
|
|
14
|
+
declare function health(rootPath?: string): HealthResult;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { HealthCheck, HealthResult, health };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{extname as e,join as t,relative as n,resolve as r}from"node:path";import{existsSync as i,readFileSync as a,readdirSync as o,statSync as s}from"node:fs";function c(e){let n=r(e??process.cwd()),o=[],c=t(n,`package.json`);if(i(c)){o.push({name:`package.json`,status:`pass`,message:`Found`});try{let e=JSON.parse(a(c,`utf-8`));e.name?o.push({name:`package.name`,status:`pass`,message:e.name}):o.push({name:`package.name`,status:`warn`,message:`Missing package name`});let t=e.scripts??{};for(let e of[`build`,`test`,`lint`])t[e]?o.push({name:`script:${e}`,status:`pass`,message:t[e]}):o.push({name:`script:${e}`,status:`warn`,message:`No "${e}" script defined`});e.type===`module`?o.push({name:`esm`,status:`pass`,message:`ESM ("type": "module")`}):e.type===`commonjs`?o.push({name:`esm`,status:`pass`,message:`CJS ("type": "commonjs")`}):o.push({name:`esm`,status:`warn`,message:`No "type" field — defaults to CJS`}),e.engines?.node?o.push({name:`engines.node`,status:`pass`,message:e.engines.node}):o.push({name:`engines.node`,status:`warn`,message:`No Node.js engine constraint`})}catch{o.push({name:`package.json`,status:`fail`,message:`Failed to parse package.json`})}}else o.push({name:`package.json`,status:`fail`,message:`Missing — not a Node.js project`});let f=t(n,`tsconfig.json`);i(f)?o.push({name:`tsconfig.json`,status:`pass`,message:`Found`}):o.push({name:`tsconfig.json`,status:`warn`,message:`Missing`});let p=t(n,`.gitignore`);if(i(p)){let e=a(p,`utf-8`),t=e.includes(`node_modules`),n=e.includes(`dist`);t&&n?o.push({name:`.gitignore`,status:`pass`,message:`Includes node_modules and dist`}):o.push({name:`.gitignore`,status:`warn`,message:`Missing: ${t?``:`node_modules `}${n?``:`dist`}`.trim()})}else o.push({name:`.gitignore`,status:`warn`,message:`Missing`});let h=[`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`].find(e=>i(t(n,e)));h?o.push({name:`lockfile`,status:`pass`,message:h}):o.push({name:`lockfile`,status:`warn`,message:`No lock file found`});let g=t(n,`README.md`);if(i(g)){let e=a(g,`utf-8`).length;o.push({name:`README.md`,status:e>100?`pass`:`warn`,message:e>100?`Found (${e} chars)`:`Found but very short`})}else o.push({name:`README.md`,status:`warn`,message:`Missing`});if(i(t(n,`LICENSE`))||i(t(n,`LICENSE.md`))?o.push({name:`LICENSE`,status:`pass`,message:`Found`}):o.push({name:`LICENSE`,status:`warn`,message:`Missing`}),i(f))try{let e=a(f,`utf-8`).replace(/\/\/.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``);JSON.parse(e).compilerOptions?.strict===!0?o.push({name:`typescript.strict`,status:`pass`,message:`strict: true`}):o.push({name:`typescript.strict`,status:`warn`,message:`strict mode not enabled in tsconfig.json`})}catch{}if(i(c))try{let e=JSON.parse(a(c,`utf-8`));e.exports?o.push({name:`package.exports`,status:`pass`,message:`Has exports field`}):e.workspaces||i(t(n,`pnpm-workspace.yaml`))||o.push({name:`package.exports`,status:`warn`,message:`Missing — consider adding exports field for explicit public API`});let r=l(n,e);r.length>0&&u(n,r,o)}catch{}let _=t(n,`dist`),v=t(n,`src`);if(i(_)&&i(v))try{let e=s(_).mtimeMs;d(v)>e?o.push({name:`build.freshness`,status:`warn`,message:`Source files are newer than dist/ — rebuild may be needed`}):o.push({name:`build.freshness`,status:`pass`,message:`Build output is fresh`})}catch{}if(i(v)){let e=m(v);if(e.length===0)o.push({name:`circular_deps`,status:`pass`,message:`No circular imports detected`});else{let t=e.slice(0,3).map(e=>e.join(` → `));o.push({name:`circular_deps`,status:`warn`,message:`${e.length} circular import(s): ${t.join(`; `)}${e.length>3?` (+${e.length-3} more)`:``}`})}}let y=o.length,b=o.filter(e=>e.status===`pass`).length,x=o.filter(e=>e.status===`fail`).length;return{path:n,checks:o,score:y>0?Math.round(b/y*100):0,summary:x>0?`${x} critical issue(s), ${y-b-x} warning(s)`:y-b>0?`${y-b} warning(s)`:`All checks passed`}}function l(e,n){let r=[];Array.isArray(n.workspaces)?r.push(...n.workspaces):n.workspaces&&typeof n.workspaces==`object`&&Array.isArray(n.workspaces.packages)&&r.push(...n.workspaces.packages);let s=t(e,`pnpm-workspace.yaml`);if(i(s)){let e=a(s,`utf-8`);for(let t of e.split(`
|
|
2
|
+
`)){let e=t.match(/^\s*-\s+['"]?([^'"#\s]+)['"]?\s*$/);e&&r.push(e[1])}}let c=[];for(let n of r)if(n.endsWith(`/*`)||n.endsWith(`/**`)){let r=t(e,n.replace(/\/\*+$/,``));if(i(r))try{for(let e of o(r,{withFileTypes:!0}))e.isDirectory()&&i(t(r,e.name,`package.json`))&&c.push(t(r,e.name))}catch{}}else{let r=t(e,n);i(t(r,`package.json`))&&c.push(r)}return c}function u(e,n,r){let i=0,o=0,s=new Map;for(let e of n)try{let n=JSON.parse(a(t(e,`package.json`),`utf-8`));n.scripts?.test||i++,!n.exports&&!n.main&&o++;let r={...n.dependencies,...n.devDependencies};for(let e of Object.values(r))if(typeof e==`string`&&e.startsWith(`workspace:`)){let t=e.startsWith(`workspace:*`)?`workspace:*`:e.startsWith(`workspace:^`)?`workspace:^`:`workspace:~`;s.set(t,(s.get(t)??0)+1)}}catch{}if(i>0?r.push({name:`workspace.test-scripts`,status:`warn`,message:`${i}/${n.length} workspace packages missing test script`}):r.push({name:`workspace.test-scripts`,status:`pass`,message:`All ${n.length} workspace packages have test scripts`}),o>0?r.push({name:`workspace.exports`,status:`warn`,message:`${o}/${n.length} packages missing exports field`}):n.length>0&&r.push({name:`workspace.exports`,status:`pass`,message:`All ${n.length} packages have exports or main field`}),s.size>1){let e=[...s.entries()].map(([e,t])=>`${e} (${t})`).join(`, `);r.push({name:`workspace.protocol`,status:`warn`,message:`Mixed workspace protocols: ${e} — consider standardizing`})}else if(s.size===1){let[e]=s.keys();r.push({name:`workspace.protocol`,status:`pass`,message:`Consistent workspace protocol: ${e}`})}}function d(e){let n=0;try{for(let r of o(e,{withFileTypes:!0})){if(r.name.startsWith(`.`)||r.name===`node_modules`)continue;let i=t(e,r.name);n=r.isDirectory()?Math.max(n,d(i)):Math.max(n,s(i).mtimeMs)}}catch{}return n}const f=/(?:import|export)\s+.*?from\s+['"](\.[^'"]+)['"]/g,p=new Set([`.ts`,`.tsx`,`.mts`]);function m(e){let t=new Map;h(e,e,t);let n=[],r=new Set,i=new Set;function a(e,o){if(i.has(e)){let t=o.indexOf(e);t>=0&&n.push(o.slice(t).concat(e));return}if(!r.has(e)){r.add(e),i.add(e),o.push(e);for(let n of t.get(e)??[])a(n,o);o.pop(),i.delete(e)}}for(let e of t.keys())a(e,[]);return n}function h(r,i,c){let l;try{l=o(r)}catch{return}for(let o of l){if(o.startsWith(`.`)||o===`node_modules`||o===`__tests__`)continue;let l=t(r,o);try{if(s(l).isDirectory())h(l,i,c);else if(p.has(e(o))){let e=n(i,l).replace(/\\/g,`/`),t=a(l,`utf-8`),o=[];for(let e of t.matchAll(f)){let t=e[1],n=g(r,t,i);n&&o.push(n)}c.set(e,o)}}catch{}}}function g(e,t,i){let a=r(e,t);for(let e of[`.ts`,`.tsx`,`.mts`,`.js`,`.mjs`,``])return n(i,e?a.replace(/\.[^.]+$/,``)+e:a).replace(/\\/g,`/`).replace(/\.js$/,`.ts`).replace(/\.mjs$/,`.mts`);return null}export{c as health};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region packages/tools/src/http-request.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* aikit_http — Make HTTP requests for API testing and debugging.
|
|
4
|
+
*/
|
|
5
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
|
|
6
|
+
interface HttpRequestOptions {
|
|
7
|
+
url: string;
|
|
8
|
+
method?: HttpMethod;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
body?: string;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
}
|
|
13
|
+
interface HttpRequestResult {
|
|
14
|
+
status: number;
|
|
15
|
+
statusText: string;
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
body: string;
|
|
18
|
+
durationMs: number;
|
|
19
|
+
contentType: string;
|
|
20
|
+
sizeBytes: number;
|
|
21
|
+
truncated: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare function httpRequest(options: HttpRequestOptions): Promise<HttpRequestResult>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { HttpMethod, HttpRequestOptions, HttpRequestResult, httpRequest };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{headTailTruncate as e}from"./truncation.js";const t=5e4;async function n(n){let{url:r,method:i=`GET`,headers:a={},body:o,timeout:s=15e3}=n,c=new URL(r);if(c.protocol!==`http:`&&c.protocol!==`https:`)throw Error(`Unsupported protocol: ${c.protocol} — only http/https allowed`);let l=c.hostname;if(l===`169.254.169.254`||l===`metadata.google.internal`||l.startsWith(`fd`)||/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(l)||l===`0.0.0.0`||l===`[::]`)throw Error(`Blocked request to private/metadata address: ${l}`);let u=new AbortController,d=setTimeout(()=>u.abort(),s),f=Date.now(),p;try{p=await fetch(r,{method:i,headers:{"User-Agent":`aikit-http/1.0`,...a},body:i!==`GET`&&i!==`HEAD`?o:void 0,signal:u.signal,redirect:`follow`})}finally{clearTimeout(d)}let m=Date.now()-f,h=await p.text(),g=p.headers.get(`content-type`)??``,_=h;if(g.includes(`json`))try{_=JSON.stringify(JSON.parse(h),null,2)}catch{}let v=!1;_.length>t&&(_=e(_,t),v=!0);let y={};return p.headers.forEach((e,t)=>{y[t]=e}),{status:p.status,statusText:p.statusText,headers:y,body:_,durationMs:m,contentType:g,sizeBytes:h.length,truncated:v}}export{n as httpRequest};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { KBError, KBErrorCode, KBNextHint, KBResponse, KBResponseMeta, errorResponse, okResponse } from "./response-envelope.js";
|
|
2
|
+
import { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit } from "./audit.js";
|
|
3
|
+
import { BatchOperation, BatchOptions, BatchResult, batch } from "./batch.js";
|
|
4
|
+
import { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog } from "./changelog.js";
|
|
5
|
+
import { ParsedError, ParsedGitStatus, ParsedOutput, ParsedTestResult, ParsedTestSummary, parseBiome, parseGitStatus, parseOutput, parseTsc, parseVitest } from "./parse-output.js";
|
|
6
|
+
import { CheckOptions, CheckResult, CheckSummaryResult, check, summarizeCheckResult } from "./check.js";
|
|
7
|
+
import { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave } from "./checkpoint.js";
|
|
8
|
+
import { CodemodChange, CodemodOptions, CodemodResult, CodemodRule, codemod } from "./codemod.js";
|
|
9
|
+
import { FileCache, FileCacheEntry, FileCacheStats } from "./file-cache.js";
|
|
10
|
+
import { CompactOptions, CompactResult, compact } from "./compact.js";
|
|
11
|
+
import { TransformOptions, TransformResult, dataTransform } from "./data-transform.js";
|
|
12
|
+
import { DeadSymbol, DeadSymbolOptions, DeadSymbolResult, findDeadSymbols } from "./dead-symbols.js";
|
|
13
|
+
import { DelegateOptions, DelegateResult, delegate, delegateListModels } from "./delegate.js";
|
|
14
|
+
import { DiffChange, DiffFile, DiffHunk, DiffParseOptions, diffParse } from "./diff-parse.js";
|
|
15
|
+
import { DigestFieldEntry, DigestOptions, DigestResult, DigestSource, digest } from "./digest.js";
|
|
16
|
+
import { DogfoodLogEntry, DogfoodLogGroupedEntry, DogfoodLogOptions, DogfoodLogResult, dogfoodLog } from "./dogfood-log.js";
|
|
17
|
+
import { EncodeOperation, EncodeOptions, EncodeResult, encode } from "./encode.js";
|
|
18
|
+
import { EnvInfoOptions, EnvInfoResult, envInfo } from "./env-info.js";
|
|
19
|
+
import { EvalOptions, EvalResult, evaluate } from "./eval.js";
|
|
20
|
+
import { EvidenceEntry, EvidenceMapAction, EvidenceMapResult, EvidenceMapState, EvidenceStatus, ForgeTier, GateDecision, GateResult, SafetyGate, SafetyGateResult, UnknownType, autoClaimTestFailures, evidenceMap } from "./evidence-map.js";
|
|
21
|
+
import { FileSummaryOptions, FileSummaryResult, fileSummary } from "./file-summary.js";
|
|
22
|
+
import { Example, FindExamplesOptions, FindExamplesResult, findExamples } from "./find-examples.js";
|
|
23
|
+
import { FindOptions, FindResult, FindResults, find } from "./find.js";
|
|
24
|
+
import { ClassifyTrigger, ForgeClassifyCeremony, ForgeClassifyOptions, ForgeClassifyResult, TypedUnknownSeed, forgeClassify } from "./forge-classify.js";
|
|
25
|
+
import { ScopeMapEntry, ScopeMapOptions, ScopeMapResult, scopeMap } from "./scope-map.js";
|
|
26
|
+
import { ConstraintRef, ForgeGroundOptions, ForgeGroundResult, forgeGround } from "./forge-ground.js";
|
|
27
|
+
import { GitContextOptions, GitContextResult, gitContext } from "./git-context.js";
|
|
28
|
+
import { GraphAugmentOptions, GraphAugmentedResult, GraphQueryOptions, GraphQueryResult, graphAugmentSearch, graphQuery } from "./graph-query.js";
|
|
29
|
+
import { GuideRecommendation, GuideResult, guide } from "./guide.js";
|
|
30
|
+
import { HealthCheck, HealthResult, health } from "./health.js";
|
|
31
|
+
import { HttpMethod, HttpRequestOptions, HttpRequestResult, httpRequest } from "./http-request.js";
|
|
32
|
+
import { LaneDiffEntry, LaneDiffResult, LaneMergeResult, LaneMeta, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus } from "./lane.js";
|
|
33
|
+
import { FileMetrics, MeasureOptions, MeasureResult, analyzeFile, measure } from "./measure.js";
|
|
34
|
+
import { OnboardMode, OnboardOptions, OnboardResult, OnboardStepResult, onboard } from "./onboard.js";
|
|
35
|
+
import { resolvePath } from "./path-resolver.js";
|
|
36
|
+
import { ManagedProcess, processList, processLogs, processStart, processStatus, processStop } from "./process-manager.js";
|
|
37
|
+
import { QueueItem, QueueState, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush } from "./queue.js";
|
|
38
|
+
import { RegexTestOptions, RegexTestResult, regexTest } from "./regex-test.js";
|
|
39
|
+
import { escapeRegExp } from "./regex-utils.js";
|
|
40
|
+
import { RenameChange, RenameOptions, RenameResult, rename } from "./rename.js";
|
|
41
|
+
import { ReplayEntry, ReplayOptions, replayAppend, replayCapture, replayClear, replayList, replayTrim } from "./replay.js";
|
|
42
|
+
import { RestorePoint, createRestorePoint, listRestorePoints, restoreFromPoint } from "./restore-points.js";
|
|
43
|
+
import { SchemaValidateOptions, SchemaValidateResult, ValidationError, schemaValidate } from "./schema-validate.js";
|
|
44
|
+
import { Snippet, SnippetAction, SnippetOptions, SnippetResult, snippet } from "./snippet.js";
|
|
45
|
+
import { StashEntry, stashClear, stashDelete, stashGet, stashList, stashSet } from "./stash.js";
|
|
46
|
+
import { StratumCard, StratumCardOptions, StratumCardResult, stratumCard } from "./stratum-card.js";
|
|
47
|
+
import { SymbolGraphContext, SymbolInfo, SymbolOptions, symbol } from "./symbol.js";
|
|
48
|
+
import { TestRunOptions, TestRunResult, classifyExitCode, testRun } from "./test-run.js";
|
|
49
|
+
import { bookendReorder, cosineSimilarity, estimateTokens, segment } from "./text-utils.js";
|
|
50
|
+
import { TimeOptions, TimeResult, timeUtils } from "./time-utils.js";
|
|
51
|
+
import { TraceNode, TraceOptions, TraceResult, trace } from "./trace.js";
|
|
52
|
+
import { headTailTruncate, paragraphTruncate, truncateToTokenBudget } from "./truncation.js";
|
|
53
|
+
import { WatchEvent, WatchHandle, WatchOptions, watchList, watchStart, watchStop } from "./watch.js";
|
|
54
|
+
import { WebFetchMode, WebFetchOptions, WebFetchResult, webFetch } from "./web-fetch.js";
|
|
55
|
+
import { WebSearchOptions, WebSearchResult, WebSearchResultItem, parseSearchResults, webSearch } from "./web-search.js";
|
|
56
|
+
import { Workset, addToWorkset, deleteWorkset, getWorkset, listWorksets, removeFromWorkset, saveWorkset } from "./workset.js";
|
|
57
|
+
export { type AuditCheck, type AuditData, type AuditOptions, type AuditRecommendation, type BatchOperation, type BatchOptions, type BatchResult, type ChangelogEntry, type ChangelogFormat, type ChangelogOptions, type ChangelogResult, type CheckOptions, type CheckResult, type CheckSummaryResult, type Checkpoint, type ClassifyTrigger, type CodemodChange, type CodemodOptions, type CodemodResult, type CodemodRule, type CompactOptions, type CompactResult, type ConstraintRef, type DeadSymbol, type DeadSymbolOptions, type DeadSymbolResult, type DelegateOptions, type DelegateResult, type DiffChange, type DiffFile, type DiffHunk, type DiffParseOptions, type DigestFieldEntry, type DigestOptions, type DigestResult, type DigestSource, type DogfoodLogEntry, type DogfoodLogGroupedEntry, type DogfoodLogOptions, type DogfoodLogResult, type EncodeOperation, type EncodeOptions, type EncodeResult, type EnvInfoOptions, type EnvInfoResult, type EvalOptions, type EvalResult, type EvidenceEntry, type EvidenceMapAction, type EvidenceMapResult, type EvidenceMapState, type EvidenceStatus, type Example, FileCache, type FileCacheEntry, type FileCacheStats, type FileMetrics, type FileSummaryOptions, type FileSummaryResult, type FindExamplesOptions, type FindExamplesResult, type FindOptions, type FindResult, type FindResults, type ForgeClassifyCeremony, type ForgeClassifyOptions, type ForgeClassifyResult, type ForgeGroundOptions, type ForgeGroundResult, type ForgeTier, type GateDecision, type GateResult, type GitContextOptions, type GitContextResult, type GraphAugmentOptions, type GraphAugmentedResult, type GraphQueryOptions, type GraphQueryResult, type GuideRecommendation, type GuideResult, type HealthCheck, type HealthResult, type HttpMethod, type HttpRequestOptions, type HttpRequestResult, type KBError, type KBErrorCode, type KBNextHint, type KBResponse, type KBResponseMeta, type LaneDiffEntry, type LaneDiffResult, type LaneMergeResult, type LaneMeta, type ManagedProcess, type MeasureOptions, type MeasureResult, type OnboardMode, type OnboardOptions, type OnboardResult, type OnboardStepResult, type ParsedError, type ParsedGitStatus, type ParsedOutput, type ParsedTestResult, type ParsedTestSummary, type QueueItem, type QueueState, type RegexTestOptions, type RegexTestResult, type RenameChange, type RenameOptions, type RenameResult, type ReplayEntry, type ReplayOptions, type RestorePoint, type SafetyGate, type SafetyGateResult, type SchemaValidateOptions, type SchemaValidateResult, type ScopeMapEntry, type ScopeMapOptions, type ScopeMapResult, type Snippet, type SnippetAction, type SnippetOptions, type SnippetResult, type StashEntry, type StratumCard, type StratumCardOptions, type StratumCardResult, type SymbolGraphContext, type SymbolInfo, type SymbolOptions, type TestRunOptions, type TestRunResult, type TimeOptions, type TimeResult, type TraceNode, type TraceOptions, type TraceResult, type TransformOptions, type TransformResult, type TypedUnknownSeed, type UnknownType, type ValidationError, type WatchEvent, type WatchHandle, type WatchOptions, type WebFetchMode, type WebFetchOptions, type WebFetchResult, type WebSearchOptions, type WebSearchResult, type WebSearchResultItem, type Workset, addToWorkset, analyzeFile, audit, autoClaimTestFailures, batch, bookendReorder, changelog, check, checkpointLatest, checkpointList, checkpointLoad, checkpointSave, classifyExitCode, codemod, compact, cosineSimilarity, createRestorePoint, dataTransform, delegate, delegateListModels, deleteWorkset, diffParse, digest, dogfoodLog, encode, envInfo, errorResponse, escapeRegExp, estimateTokens, evaluate, evidenceMap, fileSummary, find, findDeadSymbols, findExamples, forgeClassify, forgeGround, formatChangelog, getWorkset, gitContext, graphAugmentSearch, graphQuery, guide, headTailTruncate, health, httpRequest, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus, listRestorePoints, listWorksets, measure, okResponse, onboard, paragraphTruncate, parseBiome, parseGitStatus, parseOutput, parseSearchResults, parseTsc, parseVitest, processList, processLogs, processStart, processStatus, processStop, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush, regexTest, removeFromWorkset, rename, replayAppend, replayCapture, replayClear, replayList, replayTrim, resolvePath, restoreFromPoint, saveWorkset, schemaValidate, scopeMap, segment, snippet, stashClear, stashDelete, stashGet, stashList, stashSet, stratumCard, summarizeCheckResult, symbol, testRun, timeUtils, trace, truncateToTokenBudget, watchList, watchStart, watchStop, webFetch, webSearch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseBiome as e,parseGitStatus as t,parseOutput as n,parseTsc as r,parseVitest as i}from"./parse-output.js";import{check as a,summarizeCheckResult as o}from"./check.js";import{escapeRegExp as s}from"./regex-utils.js";import{findDeadSymbols as c}from"./dead-symbols.js";import{health as l}from"./health.js";import{resolvePath as u}from"./path-resolver.js";import{bookendReorder as d,cosineSimilarity as f,estimateTokens as p,segment as m}from"./text-utils.js";import{errorResponse as h,okResponse as g}from"./response-envelope.js";import{audit as _}from"./audit.js";import{batch as v}from"./batch.js";import{changelog as y,formatChangelog as b}from"./changelog.js";import{checkpointLatest as x,checkpointList as S,checkpointLoad as C,checkpointSave as w}from"./checkpoint.js";import{createRestorePoint as T,listRestorePoints as E,restoreFromPoint as D}from"./restore-points.js";import{codemod as O}from"./codemod.js";import{compact as k}from"./compact.js";import{dataTransform as A}from"./data-transform.js";import{delegate as j,delegateListModels as M}from"./delegate.js";import{diffParse as N}from"./diff-parse.js";import{digest as P}from"./digest.js";import{dogfoodLog as F}from"./dogfood-log.js";import{encode as I}from"./encode.js";import{envInfo as L}from"./env-info.js";import{evaluate as R}from"./eval.js";import{autoClaimTestFailures as z,evidenceMap as B}from"./evidence-map.js";import{FileCache as V}from"./file-cache.js";import{fileSummary as H}from"./file-summary.js";import{findExamples as U}from"./find-examples.js";import{find as W}from"./find.js";import{forgeClassify as G}from"./forge-classify.js";import{scopeMap as K}from"./scope-map.js";import{forgeGround as q}from"./forge-ground.js";import{gitContext as J}from"./git-context.js";import{graphAugmentSearch as Y,graphQuery as X}from"./graph-query.js";import{guide as Z}from"./guide.js";import{headTailTruncate as Q,paragraphTruncate as $,truncateToTokenBudget as ee}from"./truncation.js";import{httpRequest as te}from"./http-request.js";import{laneCreate as ne,laneDiff as re,laneDiscard as ie,laneList as ae,laneMerge as oe,laneStatus as se}from"./lane.js";import{analyzeFile as ce,measure as le}from"./measure.js";import{onboard as ue}from"./onboard.js";import{processList as de,processLogs as fe,processStart as pe,processStatus as me,processStop as he}from"./process-manager.js";import{queueClear as ge,queueCreate as _e,queueDelete as ve,queueDone as ye,queueFail as be,queueGet as xe,queueList as Se,queueNext as Ce,queuePush as we}from"./queue.js";import{regexTest as Te}from"./regex-test.js";import{rename as Ee}from"./rename.js";import{replayAppend as De,replayCapture as Oe,replayClear as ke,replayList as Ae,replayTrim as je}from"./replay.js";import{schemaValidate as Me}from"./schema-validate.js";import{snippet as Ne}from"./snippet.js";import{stashClear as Pe,stashDelete as Fe,stashGet as Ie,stashList as Le,stashSet as Re}from"./stash.js";import{stratumCard as ze}from"./stratum-card.js";import{symbol as Be}from"./symbol.js";import{classifyExitCode as Ve,testRun as He}from"./test-run.js";import{timeUtils as Ue}from"./time-utils.js";import{trace as We}from"./trace.js";import{watchList as Ge,watchStart as Ke,watchStop as qe}from"./watch.js";import{webFetch as Je}from"./web-fetch.js";import{parseSearchResults as Ye,webSearch as Xe}from"./web-search.js";import{addToWorkset as Ze,deleteWorkset as Qe,getWorkset as $e,listWorksets as et,removeFromWorkset as tt,saveWorkset as nt}from"./workset.js";export{V as FileCache,Ze as addToWorkset,ce as analyzeFile,_ as audit,z as autoClaimTestFailures,v as batch,d as bookendReorder,y as changelog,a as check,x as checkpointLatest,S as checkpointList,C as checkpointLoad,w as checkpointSave,Ve as classifyExitCode,O as codemod,k as compact,f as cosineSimilarity,T as createRestorePoint,A as dataTransform,j as delegate,M as delegateListModels,Qe as deleteWorkset,N as diffParse,P as digest,F as dogfoodLog,I as encode,L as envInfo,h as errorResponse,s as escapeRegExp,p as estimateTokens,R as evaluate,B as evidenceMap,H as fileSummary,W as find,c as findDeadSymbols,U as findExamples,G as forgeClassify,q as forgeGround,b as formatChangelog,$e as getWorkset,J as gitContext,Y as graphAugmentSearch,X as graphQuery,Z as guide,Q as headTailTruncate,l as health,te as httpRequest,ne as laneCreate,re as laneDiff,ie as laneDiscard,ae as laneList,oe as laneMerge,se as laneStatus,E as listRestorePoints,et as listWorksets,le as measure,g as okResponse,ue as onboard,$ as paragraphTruncate,e as parseBiome,t as parseGitStatus,n as parseOutput,Ye as parseSearchResults,r as parseTsc,i as parseVitest,de as processList,fe as processLogs,pe as processStart,me as processStatus,he as processStop,ge as queueClear,_e as queueCreate,ve as queueDelete,ye as queueDone,be as queueFail,xe as queueGet,Se as queueList,Ce as queueNext,we as queuePush,Te as regexTest,tt as removeFromWorkset,Ee as rename,De as replayAppend,Oe as replayCapture,ke as replayClear,Ae as replayList,je as replayTrim,u as resolvePath,D as restoreFromPoint,nt as saveWorkset,Me as schemaValidate,K as scopeMap,m as segment,Ne as snippet,Pe as stashClear,Fe as stashDelete,Ie as stashGet,Le as stashList,Re as stashSet,ze as stratumCard,o as summarizeCheckResult,Be as symbol,He as testRun,Ue as timeUtils,We as trace,ee as truncateToTokenBudget,Ge as watchList,Ke as watchStart,qe as watchStop,Je as webFetch,Xe as webSearch};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region packages/tools/src/lane.d.ts
|
|
2
|
+
interface LaneMeta {
|
|
3
|
+
name: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
sourceFiles: string[];
|
|
6
|
+
rootPath: string;
|
|
7
|
+
}
|
|
8
|
+
interface LaneDiffEntry {
|
|
9
|
+
file: string;
|
|
10
|
+
status: 'modified' | 'added' | 'deleted' | 'unchanged';
|
|
11
|
+
diff?: string;
|
|
12
|
+
}
|
|
13
|
+
interface LaneDiffResult {
|
|
14
|
+
name: string;
|
|
15
|
+
entries: LaneDiffEntry[];
|
|
16
|
+
modified: number;
|
|
17
|
+
added: number;
|
|
18
|
+
deleted: number;
|
|
19
|
+
}
|
|
20
|
+
interface LaneMergeResult {
|
|
21
|
+
name: string;
|
|
22
|
+
filesMerged: number;
|
|
23
|
+
files: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create an isolated lane by copying specified files into `.aikit-state/lanes/<name>/`.
|
|
27
|
+
* Files are stored with their relative paths preserved.
|
|
28
|
+
*/
|
|
29
|
+
declare function laneCreate(name: string, files: string[], cwd?: string): LaneMeta;
|
|
30
|
+
/** List all active lanes. */
|
|
31
|
+
declare function laneList(cwd?: string): LaneMeta[];
|
|
32
|
+
/** Get the status of a lane — which files are modified, added, deleted. */
|
|
33
|
+
declare function laneStatus(name: string, cwd?: string): LaneDiffResult;
|
|
34
|
+
/** Generate a unified diff for modified files in a lane. */
|
|
35
|
+
declare function laneDiff(name: string, cwd?: string): LaneDiffResult;
|
|
36
|
+
/** Merge lane files back to the original locations. */
|
|
37
|
+
declare function laneMerge(name: string, cwd?: string): LaneMergeResult;
|
|
38
|
+
/** Discard a lane entirely. */
|
|
39
|
+
declare function laneDiscard(name: string, cwd?: string): boolean;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { LaneDiffEntry, LaneDiffResult, LaneMergeResult, LaneMeta, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{join as e,relative as t,resolve as n}from"node:path";import{cpSync as r,existsSync as i,mkdirSync as a,readFileSync as o,readdirSync as s,rmSync as c,statSync as l,writeFileSync as u}from"node:fs";import{AIKIT_PATHS as d}from"../../core/dist/index.js";const f=`${d.state}/lanes`,p=`.lane-meta.json`;function m(e){return n(e??process.cwd(),f)}function h(e,t){let r=m(t),i=n(r,e);if(!i.startsWith(n(r)))throw Error(`Invalid lane name: "${e}"`);return i}function g(t,n){let r=e(h(t,n),p);if(!i(r))throw Error(`Lane "${t}" does not exist`);try{return JSON.parse(o(r,`utf-8`))}catch{throw Error(`Lane "${t}" has corrupted metadata`)}}function _(o,s,c){let l=c??process.cwd(),d=h(o,c);if(i(d))throw Error(`Lane "${o}" already exists`);a(d,{recursive:!0});let f=[];for(let o of s){let s=n(l,o);if(!i(s))throw Error(`Source file does not exist: ${o}`);let c=t(l,s).replace(/\\/g,`/`),u=e(d,c);a(e(u,`..`),{recursive:!0}),r(s,u),f.push(c)}let m={name:o,createdAt:new Date().toISOString(),sourceFiles:f,rootPath:l};return u(e(d,p),`${JSON.stringify(m,null,2)}\n`,`utf-8`),m}function v(t){let n=m(t);if(!i(n))return[];let r=s(n),a=[];for(let t of r){let r=e(n,t,p);if(i(r))try{a.push(JSON.parse(o(r,`utf-8`)))}catch{}}return a}function y(t,r){let a=g(t,r),s=h(t,r),c=a.rootPath,l=[];for(let t of a.sourceFiles){let r=n(c,t),a=e(s,t);if(!i(a)){l.push({file:t,status:`deleted`});continue}if(!i(r)){l.push({file:t,status:`added`});continue}o(r,`utf-8`)===o(a,`utf-8`)?l.push({file:t,status:`unchanged`}):l.push({file:t,status:`modified`})}let u=C(s);for(let e of u)a.sourceFiles.includes(e)||l.push({file:e,status:`added`});return{name:t,entries:l,modified:l.filter(e=>e.status===`modified`).length,added:l.filter(e=>e.status===`added`).length,deleted:l.filter(e=>e.status===`deleted`).length}}function b(t,r){let a=g(t,r),s=h(t,r),c=a.rootPath,l=[],u=new Set(a.sourceFiles);for(let e of C(s))u.add(e);for(let t of u){let r=n(c,t),a=e(s,t),u=i(r),d=i(a);if(!d&&u){l.push({file:t,status:`deleted`});continue}if(d&&!u){let e=o(a,`utf-8`);l.push({file:t,status:`added`,diff:e.split(`
|
|
2
|
+
`).map(e=>`+${e}`).join(`
|
|
3
|
+
`)});continue}if(!d||!u)continue;let f=o(r,`utf-8`),p=o(a,`utf-8`);f===p?l.push({file:t,status:`unchanged`}):l.push({file:t,status:`modified`,diff:w(f,p)})}return{name:t,entries:l,modified:l.filter(e=>e.status===`modified`).length,added:l.filter(e=>e.status===`added`).length,deleted:l.filter(e=>e.status===`deleted`).length}}function x(t,o){let s=g(t,o),l=h(t,o),u=s.rootPath,d=[],f=new Set(s.sourceFiles);for(let e of C(l))f.add(e);for(let t of f){let o=e(l,t);if(!i(o))continue;let s=n(u,t);a(e(s,`..`),{recursive:!0}),r(o,s),d.push(t)}return c(l,{recursive:!0,force:!0}),{name:t,filesMerged:d.length,files:d}}function S(e,t){let n=h(e,t);return i(n)?(c(n,{recursive:!0,force:!0}),!0):!1}function C(n){let r=[];function a(i){for(let o of s(i)){if(o===p)continue;let s=e(i,o);l(s).isDirectory()?a(s):r.push(t(n,s).replace(/\\/g,`/`))}}return i(n)&&a(n),r.sort()}function w(e,t){let n=e.split(`
|
|
4
|
+
`),r=t.split(`
|
|
5
|
+
`),i=[],a=Math.max(n.length,r.length);for(let e=0;e<a;e++){let t=n[e],a=r[e];t===a?i.push(` ${t??``}`):(t!==void 0&&i.push(`-${t}`),a!==void 0&&i.push(`+${a}`))}return i.join(`
|
|
6
|
+
`)}export{_ as laneCreate,b as laneDiff,S as laneDiscard,v as laneList,x as laneMerge,y as laneStatus};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region packages/tools/src/measure.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* aikit_measure — Code complexity and size metrics.
|
|
4
|
+
*/
|
|
5
|
+
interface MeasureOptions {
|
|
6
|
+
path: string;
|
|
7
|
+
extensions?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface FileMetrics {
|
|
10
|
+
path: string;
|
|
11
|
+
lines: {
|
|
12
|
+
total: number;
|
|
13
|
+
code: number;
|
|
14
|
+
blank: number;
|
|
15
|
+
comment: number;
|
|
16
|
+
};
|
|
17
|
+
complexity: number;
|
|
18
|
+
/** AST-based cognitive complexity that weights nested branches higher (available when WASM is active) */
|
|
19
|
+
cognitiveComplexity?: number;
|
|
20
|
+
functions: number;
|
|
21
|
+
imports: number;
|
|
22
|
+
exports: number;
|
|
23
|
+
}
|
|
24
|
+
interface MeasureResult {
|
|
25
|
+
files: FileMetrics[];
|
|
26
|
+
summary: {
|
|
27
|
+
totalFiles: number;
|
|
28
|
+
totalLines: number;
|
|
29
|
+
totalCodeLines: number;
|
|
30
|
+
avgComplexity: number;
|
|
31
|
+
maxComplexity: {
|
|
32
|
+
file: string;
|
|
33
|
+
value: number;
|
|
34
|
+
};
|
|
35
|
+
totalFunctions: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
declare function measure(options: MeasureOptions): Promise<MeasureResult>;
|
|
39
|
+
/** Exported for unit testing */
|
|
40
|
+
declare function analyzeFile(path: string, content: string): FileMetrics;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { FileMetrics, MeasureOptions, MeasureResult, analyzeFile, measure };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{extname as e,join as t,relative as n}from"node:path";import{SUPPORTED_EXTENSIONS as r,WasmRuntime as i}from"../../chunker/dist/index.js";import{readFileSync as a,readdirSync as o,statSync as s}from"node:fs";const c=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`cdk.out`,`.cache`]),l=[/\bif\s*\(/g,/\belse\s+if\b/g,/\bfor\s*\(/g,/\bwhile\s*\(/g,/\bcase\s+/g,/\bcatch\s*\(/g,/&&/g,/\|\|/g,/\?\?/g];async function u(t){let{path:r,extensions:i=[`.ts`,`.tsx`,`.js`,`.jsx`]}=t,o=h(r,i),s=[];for(let t of o){let r=a(t,`utf8`),i=d(n(process.cwd(),t),r),o=await m(r,e(t));o!==void 0&&(i.cognitiveComplexity=o),s.push(i)}s.sort((e,t)=>t.complexity-e.complexity);let c=s.reduce((e,t)=>e+t.lines.total,0),l=s.reduce((e,t)=>e+t.lines.code,0),u=s.reduce((e,t)=>e+t.complexity,0),f=s.reduce((e,t)=>e+t.functions,0),p=s[0]??{path:``,complexity:0};return{files:s,summary:{totalFiles:s.length,totalLines:c,totalCodeLines:l,avgComplexity:s.length>0?Math.round(u/s.length*10)/10:0,maxComplexity:{file:p.path,value:p.complexity},totalFunctions:f}}}function d(e,t){let n=t.split(`
|
|
2
|
+
`),r=0,i=0,a=!1;for(let e of n){let t=e.trim();if(t===``){r++;continue}if(a){i++,t.includes(`*/`)&&(a=!1);continue}if(t.startsWith(`//`)){i++;continue}t.startsWith(`/*`)&&(i++,a=!t.includes(`*/`))}let o=1;for(let e of l){let n=t.match(e);n&&(o+=n.length)}let s=(t.match(/\bfunction\b/g)?.length??0)+(t.match(/=>\s*[{(]/g)?.length??0),c=t.match(/^\s*import\s/gm)?.length??0,u=t.match(/^\s*export\s/gm)?.length??0;return{path:e,lines:{total:n.length,code:n.length-r-i,blank:r,comment:i},complexity:o,functions:s,imports:c,exports:u}}const f=new Set(`if_statement.for_statement.for_in_statement.while_statement.do_statement.switch_case.catch_clause.ternary_expression.if_statement.for_statement.while_statement.except_clause.list_comprehension.if_statement.for_statement.enhanced_for_statement.while_statement.catch_clause.ternary_expression.if_statement.for_statement.select_statement.if_expression.for_expression.while_expression.match_arm`.split(`.`)),p=new Set([`if_statement`,`if_expression`,`for_statement`,`for_in_statement`,`enhanced_for_statement`,`for_expression`,`while_statement`,`while_expression`,`do_statement`,`switch_statement`,`match_expression`,`try_statement`,`catch_clause`,`except_clause`,`lambda`,`lambda_expression`,`arrow_function`]);async function m(e,t){let n=i.get();if(!(!n||!r.has(t)))try{let r=await n.parse(e,t);if(!r)return;let i=0;function a(e,t){let n=f.has(e.type),r=p.has(e.type);n&&(i+=1+t);let o=r?t+1:t;for(let t=0;t<e.childCount;t++){let n=e.child(t);n&&a(n,o)}}return a(r.rootNode,0),i}catch{return}}function h(n,r){try{if(s(n).isFile())return[n]}catch{throw Error(`Path not found: ${n}`)}let i=[];function a(n){for(let l of o(n)){if(c.has(l))continue;let o=t(n,l);s(o).isDirectory()?a(o):r.includes(e(l).toLowerCase())&&i.push(o)}}return a(n),i.sort(),i}export{d as analyzeFile,u as measure};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region packages/tools/src/onboard-utils.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Shared utilities for onboard sub-modules.
|
|
4
|
+
*/
|
|
5
|
+
declare const TEST_SEGMENTS: Set<string>;
|
|
6
|
+
declare function isTestPath(filePath: string): boolean;
|
|
7
|
+
/** Get the package key for grouping: detects monorepo, Java, and flat structures */
|
|
8
|
+
declare function getPackageKey(fp: string): string;
|
|
9
|
+
/** Try to match extensionless import path to actual source file */
|
|
10
|
+
declare function resolveExtensionlessPath(nf: string, exportsByFile: Map<string, unknown>): string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { TEST_SEGMENTS, getPackageKey, isTestPath, resolveExtensionlessPath };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=new Set([`test`,`tests`,`__tests__`,`spec`,`specs`,`__mocks__`,`__fixtures__`,`fixtures`,`test-utils`]);function t(t){return t.replace(/\\/g,`/`).split(`/`).some(t=>e.has(t))||/\.(test|spec)\.[jt]sx?$/.test(t)||/Test\.java$/.test(t)}function n(e){let t=e.split(`/`);if(t.length>=2&&[`packages`,`services`,`providers`,`apps`,`libs`].includes(t[0]))return`${t[0]}/${t[1]}`;let n=t.indexOf(`java`),r=t.indexOf(`kotlin`),i=n>=0?n:r;if(i>=0&&i+2<t.length){let e=t.slice(i+1);return[`com`,`org`,`net`,`io`,`dev`].includes(e[0])&&e.length>=3?e.slice(0,3).join(`/`):e.slice(0,2).join(`/`)}return t[0]===`src`&&t.length>=3?`${t[0]}/${t[1]}`:t[0]}function r(e,t){if(t.has(e))return e;for(let n of[`.ts`,`.tsx`,`.js`,`.jsx`])if(t.has(`${e}${n}`))return`${e}${n}`;return t.has(`${e}/index.ts`)?`${e}/index.ts`:e}export{e as TEST_SEGMENTS,n as getPackageKey,t as isTestPath,r as resolveExtensionlessPath};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region packages/tools/src/onboard.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* aikit_onboard — First-time codebase onboarding in a single command.
|
|
4
|
+
*
|
|
5
|
+
* Runs all analysis tools in parallel and optionally writes structured
|
|
6
|
+
* output to `.ai/kb/` for human-readable reference.
|
|
7
|
+
*
|
|
8
|
+
* Analyses: structure, dependencies, entry-points, symbols, patterns, diagram.
|
|
9
|
+
*/
|
|
10
|
+
type OnboardMode = 'memory' | 'generate';
|
|
11
|
+
interface OnboardOptions {
|
|
12
|
+
/** Root path to analyze */
|
|
13
|
+
path: string;
|
|
14
|
+
/** Output mode: 'memory' (KB only) or 'generate' (write to .ai/kb/) */
|
|
15
|
+
mode?: OnboardMode;
|
|
16
|
+
/** Output directory for generate mode (default: '<path>/.ai/kb') */
|
|
17
|
+
outDir?: string;
|
|
18
|
+
}
|
|
19
|
+
interface OnboardStepResult {
|
|
20
|
+
name: string;
|
|
21
|
+
status: 'success' | 'failed';
|
|
22
|
+
output: string;
|
|
23
|
+
durationMs: number;
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
interface OnboardResult {
|
|
27
|
+
/** Root path that was analyzed */
|
|
28
|
+
path: string;
|
|
29
|
+
/** Mode used */
|
|
30
|
+
mode: OnboardMode;
|
|
31
|
+
/** Results for each analysis step */
|
|
32
|
+
steps: OnboardStepResult[];
|
|
33
|
+
/** Output directory (only set in generate mode) */
|
|
34
|
+
outDir?: string;
|
|
35
|
+
/** Total duration in ms */
|
|
36
|
+
totalDurationMs: number;
|
|
37
|
+
/** Auto-generated knowledge entries for curated store persistence */
|
|
38
|
+
autoRemember?: Array<{
|
|
39
|
+
title: string;
|
|
40
|
+
content: string;
|
|
41
|
+
category: string;
|
|
42
|
+
tags: string[];
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Run all onboarding analyses in parallel and return combined results.
|
|
47
|
+
*/
|
|
48
|
+
declare function onboard(options: OnboardOptions): Promise<OnboardResult>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { OnboardMode, OnboardOptions, OnboardResult, OnboardStepResult, onboard };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{extractConfigValues as e}from"./config-extractor.js";import{buildDiagrams as t}from"./diagram-builder.js";import{buildCodeMap as n,buildSynthesisGuide as r}from"./synthesis-engine.js";import{DependencyAnalyzer as i,DiagramGenerator as a,EntryPointAnalyzer as o,PatternAnalyzer as ee,StructureAnalyzer as s,SymbolAnalyzer as c,extractRegexCallGraph as l,extractTsCallGraph as u}from"../../analyzers/dist/index.js";import{basename as d,join as f,resolve as p}from"node:path";import{existsSync as m,mkdirSync as h,readdirSync as g,rmSync as _,writeFileSync as v}from"node:fs";import{AIKIT_PATHS as y}from"../../core/dist/index.js";const b={structure:`Project Structure`,dependencies:`Dependencies`,"entry-points":`Entry Points`,symbols:`Symbols`,patterns:`Patterns`,diagram:`C4 Container Diagram`,"code-map":`Code Map (Module Graph)`,"config-values":`Configuration Values`,"synthesis-guide":`Synthesis Guide`,"api-surface":`API Surface`,"type-inventory":`Type Inventory`};function x(e){let t=e.get(`symbols`);if(!t?.symbols?.length)return`# API Surface
|
|
2
|
+
|
|
3
|
+
*No symbol data available.*
|
|
4
|
+
`;let n=t.symbols.filter(e=>e.exported);if(n.length===0)return`# API Surface
|
|
5
|
+
|
|
6
|
+
*No exported symbols found.*
|
|
7
|
+
`;let r=new Map;for(let e of n){let t=r.get(e.filePath)??[];t.push(e),r.set(e.filePath,t)}let i=[`# API Surface
|
|
8
|
+
`];for(let[e,t]of[...r.entries()].sort(([e],[t])=>e.localeCompare(t))){i.push(`## ${e}\n`);for(let e of t){e.decorators?.length&&i.push(e.decorators.join(` `));let t=e.signature??``,n=e.returnType?`: ${e.returnType}`:``;if(e.kind===`function`||e.kind===`method`)i.push(`### \`${e.name}${t}${n}\``);else if(e.kind===`class`)i.push(`### class \`${e.name}\`${t?` ${t}`:``}`);else if(e.kind===`interface`||e.kind===`type`){let t=e.typeBody?` ${e.typeBody}`:``;i.push(`### ${e.kind} \`${e.name}\`${t}`)}else i.push(`### ${e.kind} \`${e.name}\`${t?`: ${t}`:``}`);e.jsdoc&&i.push(`> ${e.jsdoc}`),i.push(``)}}let a=i.join(`
|
|
9
|
+
`);return a.length>1e5?`${a.slice(0,1e5)}\n\n*[truncated]*`:a}function S(e){let t=e.get(`symbols`);if(!t?.symbols?.length)return`# Type Inventory
|
|
10
|
+
|
|
11
|
+
*No symbol data available.*
|
|
12
|
+
`;let n=t.symbols.filter(e=>e.exported&&(e.kind===`interface`||e.kind===`type`||e.kind===`enum`));if(n.length===0)return`# Type Inventory
|
|
13
|
+
|
|
14
|
+
*No exported types/interfaces found.*
|
|
15
|
+
`;let r=new Map;for(let e of n){let t=r.get(e.filePath)??[];t.push(e),r.set(e.filePath,t)}let i=[`# Type Inventory
|
|
16
|
+
`];for(let[e,t]of[...r.entries()].sort(([e],[t])=>e.localeCompare(t))){i.push(`## ${e}\n`);for(let e of t){let t=e.typeBody??`*body not available*`;e.jsdoc&&i.push(`> ${e.jsdoc}`),i.push(`### ${e.kind} \`${e.name}\``),i.push("```"),i.push(t),i.push("```\n")}}let a=i.join(`
|
|
17
|
+
`);return a.length>1e5?`${a.slice(0,1e5)}\n\n*[truncated]*`:a}async function C(C){let w=Date.now(),T=p(C.path),E=d(T),D=C.mode??`generate`,O=C.outDir??f(T,y.aiKb),k=new s,A=new i,j=new c,M=new ee,N=new o,P=new a,F=[{name:`structure`,fn:()=>k.analyze(T,{format:`markdown`,maxDepth:3,sourceOnly:!0})},{name:`dependencies`,fn:()=>A.analyze(T,{format:`markdown`})},{name:`entry-points`,fn:()=>N.analyze(T)},{name:`symbols`,fn:()=>j.analyze(T,{format:`markdown`})},{name:`patterns`,fn:()=>M.analyze(T)},{name:`diagram`,fn:()=>P.analyze(T,{diagramType:`architecture`})}],I=await Promise.allSettled(F.map(async e=>{let t=Date.now(),n=await e.fn();return{name:e.name,result:n,durationMs:Date.now()-t}})),L=[],R=new Map,z=new Map;for(let e of I)if(e.status===`fulfilled`){let{name:t,result:n,durationMs:r}=e.value,i=n;L.push({name:t,status:`success`,output:i.output,durationMs:r}),R.set(t,i.output),z.set(t,i.data)}else{let t=e.reason,n=F[I.indexOf(e)].name;L.push({name:n,status:`failed`,output:``,durationMs:0,error:t.message})}let B=Date.now(),V=null;try{let e=await u(T);if((!e||e.edges.length===0)&&(e=await l(T)),e&&e.edges.length>0){V=new Map;for(let t of e.edges){let e=V.get(t.from);e||(e=new Map,V.set(t.from,e));let n=e.get(t.to);if(n)for(let e of t.symbols)n.includes(e)||n.push(e);else e.set(t.to,[...t.symbols])}}}catch{}let H=Date.now()-B,U=Date.now(),W=n(z,E,V),G=Date.now()-U+H;if(L.push({name:`code-map`,status:`success`,output:W,durationMs:G}),R.set(`code-map`,W),V&&V.size>0){let e=t(V,z,E),n=L.find(e=>e.name===`diagram`);n&&(n.output=e,R.set(`diagram`,e))}let K=Date.now(),q=await e(T,E),J=Date.now()-K;L.push({name:`config-values`,status:`success`,output:q,durationMs:J}),R.set(`config-values`,q);let Y=r(L,D,E,z);L.push({name:`synthesis-guide`,status:`success`,output:Y,durationMs:0}),R.set(`synthesis-guide`,Y);let X=x(z);L.push({name:`api-surface`,status:`success`,output:X,durationMs:0}),R.set(`api-surface`,X);let Z=S(z);if(L.push({name:`type-inventory`,status:`success`,output:Z,durationMs:0}),R.set(`type-inventory`,Z),D===`generate`){if(m(O))for(let e of g(O))(e.endsWith(`.md`)||e.endsWith(`.json`))&&_(f(O,e),{force:!0});h(O,{recursive:!0});let e=new Date().toISOString();for(let[t,n]of R){let r=f(O,`${t}.md`),i=n.replaceAll(T,E);v(r,`<!-- Generated: ${e} -->\n<!-- Project: ${E} -->\n<!-- Source: ${T} -->\n\n`+i,`utf-8`)}let t=[`<!-- Generated: ${e} -->`,`<!-- Project: ${E} -->`,`<!-- Source: ${T} -->`,``,`# ${E} — Codebase Knowledge`,``,`## Contents`,``];for(let e of L){let n=`${e.name}.md`,r=b[e.name]??e.name,i=e.status===`success`?`✓`:`✗`,a=e.durationMs>0?` (${e.durationMs}ms)`:``;t.push(`- ${i} [${r}](./${n})${a}`)}t.push(``),v(f(O,`README.md`),t.join(`
|
|
18
|
+
`),`utf-8`)}let Q=[];Q.push({title:`Onboard: ${E} project overview`,content:Y.slice(0,2e3),category:`conventions`,tags:[`onboard`,`project-overview`,E]});let $=L.find(e=>e.name===`patterns`);return $?.status===`success`&&$.output&&Q.push({title:`Onboard: ${E} detected patterns`,content:$.output.slice(0,1500),category:`patterns`,tags:[`onboard`,`patterns`,E]}),q&&Q.push({title:`Onboard: ${E} config and commands`,content:q.slice(0,1500),category:`conventions`,tags:[`onboard`,`config`,`commands`,E]}),{path:T,mode:D,steps:L,outDir:D===`generate`?O:void 0,totalDurationMs:Date.now()-w,autoRemember:Q}}export{C as onboard};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region packages/tools/src/parse-output.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* aikit_parse_output — Structured parsers for common build tool output.
|
|
4
|
+
*
|
|
5
|
+
* Converts noisy text output from tsc, vitest, biome, and git status
|
|
6
|
+
* into structured JSON that LLM agents can act on directly.
|
|
7
|
+
*/
|
|
8
|
+
interface ParsedError {
|
|
9
|
+
file: string;
|
|
10
|
+
line?: number;
|
|
11
|
+
column?: number;
|
|
12
|
+
severity: 'error' | 'warning' | 'info';
|
|
13
|
+
code?: string;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
interface ParsedTestResult {
|
|
17
|
+
name: string;
|
|
18
|
+
file?: string;
|
|
19
|
+
status: 'pass' | 'fail' | 'skip';
|
|
20
|
+
duration?: number;
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
interface ParsedTestSummary {
|
|
24
|
+
tests: ParsedTestResult[];
|
|
25
|
+
passed: number;
|
|
26
|
+
failed: number;
|
|
27
|
+
skipped: number;
|
|
28
|
+
duration?: number;
|
|
29
|
+
suites?: number;
|
|
30
|
+
}
|
|
31
|
+
interface ParsedGitStatus {
|
|
32
|
+
staged: Array<{
|
|
33
|
+
status: string;
|
|
34
|
+
file: string;
|
|
35
|
+
}>;
|
|
36
|
+
unstaged: Array<{
|
|
37
|
+
status: string;
|
|
38
|
+
file: string;
|
|
39
|
+
}>;
|
|
40
|
+
untracked: string[];
|
|
41
|
+
branch?: string;
|
|
42
|
+
}
|
|
43
|
+
type ParsedOutput = {
|
|
44
|
+
tool: 'tsc';
|
|
45
|
+
errors: ParsedError[];
|
|
46
|
+
} | {
|
|
47
|
+
tool: 'vitest';
|
|
48
|
+
summary: ParsedTestSummary;
|
|
49
|
+
} | {
|
|
50
|
+
tool: 'biome';
|
|
51
|
+
errors: ParsedError[];
|
|
52
|
+
} | {
|
|
53
|
+
tool: 'git-status';
|
|
54
|
+
status: ParsedGitStatus;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Parse `tsc` output into structured errors.
|
|
58
|
+
*
|
|
59
|
+
* Example line: `src/foo.ts(10,5): error TS2339: Property 'x' does not exist`
|
|
60
|
+
*/
|
|
61
|
+
declare function parseTsc(output: string): ParsedError[];
|
|
62
|
+
/**
|
|
63
|
+
* Parse vitest run output into structured test results.
|
|
64
|
+
*/
|
|
65
|
+
declare function parseVitest(output: string): ParsedTestSummary;
|
|
66
|
+
/**
|
|
67
|
+
* Parse biome check/lint output into structured errors.
|
|
68
|
+
*
|
|
69
|
+
* Example: `src/foo.ts:10:5 lint/suspicious/noDoubleEquals ━━━`
|
|
70
|
+
* ` × Use === instead of ==`
|
|
71
|
+
*/
|
|
72
|
+
declare function parseBiome(output: string): ParsedError[];
|
|
73
|
+
/**
|
|
74
|
+
* Parse `git status --porcelain=v1 -b` output into structured status.
|
|
75
|
+
*/
|
|
76
|
+
declare function parseGitStatus(output: string): ParsedGitStatus;
|
|
77
|
+
/**
|
|
78
|
+
* Auto-detect the tool from output content and parse accordingly.
|
|
79
|
+
*/
|
|
80
|
+
declare function parseOutput(output: string, tool?: string): ParsedOutput;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { ParsedError, ParsedGitStatus, ParsedOutput, ParsedTestResult, ParsedTestSummary, parseBiome, parseGitStatus, parseOutput, parseTsc, parseVitest };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){let t=[];for(let n of e.matchAll(/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+(TS\d+):\s+(.+)$/gm))t.push({file:n[1],line:Number.parseInt(n[2],10),column:Number.parseInt(n[3],10),severity:n[4],code:n[5],message:n[6]});if(t.length===0)for(let n of e.matchAll(/^(.+?):(\d+):(\d+)\s+-\s+(error|warning)\s+(TS\d+):\s+(.+)$/gm))t.push({file:n[1],line:Number.parseInt(n[2],10),column:Number.parseInt(n[3],10),severity:n[4],code:n[5],message:n[6]});return t}function t(e){return e.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,``)}function n(e){let n=t(e),r=[];for(let e of n.matchAll(/^\s*([✓✕×-])\s+(.+?)(?:\s+(\d+)ms)?$/gm)){let t=e[1],n=t===`✓`?`pass`:t===`-`?`skip`:`fail`;r.push({name:e[2].trim(),status:n,duration:e[3]?Number.parseInt(e[3],10):void 0})}for(let e of n.matchAll(/^\s*([✓✕×])\s+(\S+\.test\.\w+)\s+\((\d+)\s+tests?\)\s*(\d+ms)?$/gm)){let t=e[1]===`✓`?`pass`:`fail`;r.push({name:e[2],file:e[2],status:t,duration:e[4]?Number.parseInt(e[4],10):void 0})}let i=/Tests\s+(?:(\d+)\s+passed)?(?:\s*\|\s*)?(?:(\d+)\s+failed)?(?:\s*\|\s*)?(?:(\d+)\s+skipped)?\s*\((\d+)\)/.exec(n),a=i?Number.parseInt(i[1]??`0`,10):r.filter(e=>e.status===`pass`).length,o=i?Number.parseInt(i[2]??`0`,10):r.filter(e=>e.status===`fail`).length,s=i?Number.parseInt(i[3]??`0`,10):r.filter(e=>e.status===`skip`).length,c=/Duration\s+(\d+(?:\.\d+)?)(?:ms|s)/.exec(n),l=c?c[0].includes(`s`)&&!c[0].includes(`ms`)?Number.parseFloat(c[1])*1e3:Number.parseFloat(c[1]):void 0,u=/Test Files\s+(\d+)\s+passed/.exec(n);return{tests:r,passed:a,failed:o,skipped:s,duration:l,suites:u?Number.parseInt(u[1],10):void 0}}function r(e){let t=[];for(let n of e.matchAll(/^(.+?):(\d+):(\d+)\s+([\w/]+)\s+━+$/gm)){let r=n[1],i=Number.parseInt(n[2],10),a=Number.parseInt(n[3],10),o=n[4],s=e.slice((n.index??0)+n[0].length,(n.index??0)+n[0].length+500),c=/^\s*[×!i]\s+(.+)$/m.exec(s),l=c?c[1].trim():o,u=o.includes(`lint`)?`warning`:`error`;t.push({file:r,line:i,column:a,severity:u,code:o,message:l})}return t}function i(e){let t=[],n=[],r=[],i;for(let o of e.split(`
|
|
2
|
+
`)){if(!o)continue;if(o.startsWith(`## `)){i=o.slice(3).split(`...`)[0];continue}let e=o[0],s=o[1],c=o.slice(3).trim();e===`?`&&s===`?`?r.push(c):(e!==` `&&e!==`?`&&t.push({status:a(e),file:c}),s!==` `&&s!==`?`&&n.push({status:a(s),file:c}))}return{staged:t,unstaged:n,untracked:r,branch:i}}function a(e){return{M:`modified`,A:`added`,D:`deleted`,R:`renamed`,C:`copied`,U:`unmerged`}[e]??e}function o(t,a){let o=a??s(t);switch(o){case`tsc`:return{tool:`tsc`,errors:e(t)};case`vitest`:return{tool:`vitest`,summary:n(t)};case`biome`:return{tool:`biome`,errors:r(t)};case`git-status`:return{tool:`git-status`,status:i(t)};default:throw Error(`Unknown tool: ${o}. Supported: tsc, vitest, biome, git-status`)}}function s(e){return e.includes(`error TS`)||/\(\d+,\d+\):\s+error/.test(e)?`tsc`:e.includes(`vitest`)||e.includes(`Test Files`)||e.includes(`✓`)?`vitest`:e.includes(`biome`)||/\w+\/\w+\s+━+/.test(e)?`biome`:/^##\s/.test(e)||/^[MADRCU?! ]{2}\s/.test(e)?`git-status`:`unknown`}export{r as parseBiome,i as parseGitStatus,o as parseOutput,e as parseTsc,n as parseVitest};
|