@selvakumaresra/specship 0.1.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/commands/ss-design-implement.md +84 -0
- package/commands/ss-design-loop.md +125 -0
- package/commands/{cg-drifted.md → ss-drifted.md} +2 -2
- package/commands/{cg-fix.md → ss-fix.md} +1 -1
- package/commands/{cg-implement.md → ss-implement.md} +1 -1
- package/commands/ss-spec-author.md +43 -0
- package/commands/ss-spec-review.md +48 -0
- package/dist/bin/node-version-check.d.ts +37 -0
- package/dist/bin/node-version-check.d.ts.map +1 -0
- package/dist/bin/node-version-check.js +79 -0
- package/dist/bin/node-version-check.js.map +1 -0
- package/dist/bin/specship.d.ts +25 -0
- package/dist/bin/specship.d.ts.map +1 -0
- package/dist/bin/specship.js +2085 -0
- package/dist/bin/specship.js.map +1 -0
- package/dist/bin/uninstall.d.ts +13 -0
- package/dist/bin/uninstall.d.ts.map +1 -0
- package/dist/bin/uninstall.js +35 -0
- package/dist/bin/uninstall.js.map +1 -0
- package/dist/context/formatter.d.ts +30 -0
- package/dist/context/formatter.d.ts.map +1 -0
- package/dist/context/formatter.js +263 -0
- package/dist/context/formatter.js.map +1 -0
- package/dist/context/index.d.ts +119 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +1289 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/markers.d.ts +19 -0
- package/dist/context/markers.d.ts.map +1 -0
- package/dist/context/markers.js +22 -0
- package/dist/context/markers.js.map +1 -0
- package/dist/db/index.d.ts +103 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +279 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +462 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +357 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +1504 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/db/schema.sql +419 -0
- package/dist/db/spec-queries.d.ts +101 -0
- package/dist/db/spec-queries.d.ts.map +1 -0
- package/dist/db/spec-queries.js +675 -0
- package/dist/db/spec-queries.js.map +1 -0
- package/dist/db/sqlite-adapter.d.ts +65 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/dist/db/sqlite-adapter.js +214 -0
- package/dist/db/sqlite-adapter.js.map +1 -0
- package/dist/designer/artifact-store.js +54 -0
- package/dist/designer/browser.js +141 -0
- package/dist/designer/cdp-ensure.js +60 -0
- package/dist/designer/cdp-env.js +18 -0
- package/dist/designer/cdp-trace.js +599 -0
- package/dist/designer/cross-platform.js +74 -0
- package/dist/designer/designer-controller.js +1413 -0
- package/dist/designer/file-panel.js +39 -0
- package/dist/designer/interstitials.js +97 -0
- package/dist/designer/oopif-reader.js +176 -0
- package/dist/designer/package-meta.js +18 -0
- package/dist/designer/preview-host.js +50 -0
- package/dist/designer/repo-root.js +31 -0
- package/dist/designer/run-state.js +353 -0
- package/dist/designer/session-store.js +59 -0
- package/dist/designer/ui-anchors.js +651 -0
- package/dist/directory.d.ts +67 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +267 -0
- package/dist/directory.js.map +1 -0
- package/dist/errors.d.ts +136 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +219 -0
- package/dist/errors.js.map +1 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/dfm-extractor.d.ts.map +1 -0
- package/dist/extraction/dfm-extractor.js +151 -0
- package/dist/extraction/dfm-extractor.js.map +1 -0
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -0
- package/dist/extraction/generated-detection.js +80 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +100 -0
- package/dist/extraction/grammars.d.ts.map +1 -0
- package/dist/extraction/grammars.js +426 -0
- package/dist/extraction/grammars.js.map +1 -0
- package/dist/extraction/index.d.ts +138 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +1394 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/extraction/languages/c-cpp.d.ts +4 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/dist/extraction/languages/c-cpp.js +171 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -0
- package/dist/extraction/languages/csharp.d.ts +3 -0
- package/dist/extraction/languages/csharp.d.ts.map +1 -0
- package/dist/extraction/languages/csharp.js +73 -0
- package/dist/extraction/languages/csharp.js.map +1 -0
- package/dist/extraction/languages/dart.d.ts +3 -0
- package/dist/extraction/languages/dart.d.ts.map +1 -0
- package/dist/extraction/languages/dart.js +192 -0
- package/dist/extraction/languages/dart.js.map +1 -0
- package/dist/extraction/languages/go.d.ts +3 -0
- package/dist/extraction/languages/go.d.ts.map +1 -0
- package/dist/extraction/languages/go.js +74 -0
- package/dist/extraction/languages/go.js.map +1 -0
- package/dist/extraction/languages/index.d.ts +10 -0
- package/dist/extraction/languages/index.d.ts.map +1 -0
- package/dist/extraction/languages/index.js +51 -0
- package/dist/extraction/languages/index.js.map +1 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/java.d.ts.map +1 -0
- package/dist/extraction/languages/java.js +70 -0
- package/dist/extraction/languages/java.js.map +1 -0
- package/dist/extraction/languages/javascript.d.ts +3 -0
- package/dist/extraction/languages/javascript.d.ts.map +1 -0
- package/dist/extraction/languages/javascript.js +90 -0
- package/dist/extraction/languages/javascript.js.map +1 -0
- package/dist/extraction/languages/kotlin.d.ts +3 -0
- package/dist/extraction/languages/kotlin.d.ts.map +1 -0
- package/dist/extraction/languages/kotlin.js +259 -0
- package/dist/extraction/languages/kotlin.js.map +1 -0
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/lua.d.ts.map +1 -0
- package/dist/extraction/languages/lua.js +150 -0
- package/dist/extraction/languages/lua.js.map +1 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/luau.d.ts.map +1 -0
- package/dist/extraction/languages/luau.js +37 -0
- package/dist/extraction/languages/luau.js.map +1 -0
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts.map +1 -0
- package/dist/extraction/languages/objc.js +133 -0
- package/dist/extraction/languages/objc.js.map +1 -0
- package/dist/extraction/languages/pascal.d.ts +3 -0
- package/dist/extraction/languages/pascal.d.ts.map +1 -0
- package/dist/extraction/languages/pascal.js +66 -0
- package/dist/extraction/languages/pascal.js.map +1 -0
- package/dist/extraction/languages/php.d.ts +3 -0
- package/dist/extraction/languages/php.d.ts.map +1 -0
- package/dist/extraction/languages/php.js +107 -0
- package/dist/extraction/languages/php.js.map +1 -0
- package/dist/extraction/languages/python.d.ts +3 -0
- package/dist/extraction/languages/python.d.ts.map +1 -0
- package/dist/extraction/languages/python.js +56 -0
- package/dist/extraction/languages/python.js.map +1 -0
- package/dist/extraction/languages/ruby.d.ts +3 -0
- package/dist/extraction/languages/ruby.d.ts.map +1 -0
- package/dist/extraction/languages/ruby.js +114 -0
- package/dist/extraction/languages/ruby.js.map +1 -0
- package/dist/extraction/languages/rust.d.ts +3 -0
- package/dist/extraction/languages/rust.d.ts.map +1 -0
- package/dist/extraction/languages/rust.js +109 -0
- package/dist/extraction/languages/rust.js.map +1 -0
- package/dist/extraction/languages/scala.d.ts +3 -0
- package/dist/extraction/languages/scala.d.ts.map +1 -0
- package/dist/extraction/languages/scala.js +139 -0
- package/dist/extraction/languages/scala.js.map +1 -0
- package/dist/extraction/languages/swift.d.ts +3 -0
- package/dist/extraction/languages/swift.d.ts.map +1 -0
- package/dist/extraction/languages/swift.js +91 -0
- package/dist/extraction/languages/swift.js.map +1 -0
- package/dist/extraction/languages/typescript.d.ts +3 -0
- package/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/dist/extraction/languages/typescript.js +129 -0
- package/dist/extraction/languages/typescript.js.map +1 -0
- package/dist/extraction/liquid-extractor.d.ts +52 -0
- package/dist/extraction/liquid-extractor.d.ts.map +1 -0
- package/dist/extraction/liquid-extractor.js +313 -0
- package/dist/extraction/liquid-extractor.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/dist/extraction/mybatis-extractor.js +198 -0
- package/dist/extraction/mybatis-extractor.js.map +1 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/parse-worker.d.ts.map +1 -0
- package/dist/extraction/parse-worker.js +94 -0
- package/dist/extraction/parse-worker.js.map +1 -0
- package/dist/extraction/specs/markdown-spec-extractor.d.ts +59 -0
- package/dist/extraction/specs/markdown-spec-extractor.d.ts.map +1 -0
- package/dist/extraction/specs/markdown-spec-extractor.js +327 -0
- package/dist/extraction/specs/markdown-spec-extractor.js.map +1 -0
- package/dist/extraction/specs/types.d.ts +39 -0
- package/dist/extraction/specs/types.d.ts.map +1 -0
- package/dist/extraction/specs/types.js +8 -0
- package/dist/extraction/specs/types.js.map +1 -0
- package/dist/extraction/svelte-extractor.d.ts +56 -0
- package/dist/extraction/svelte-extractor.d.ts.map +1 -0
- package/dist/extraction/svelte-extractor.js +272 -0
- package/dist/extraction/svelte-extractor.js.map +1 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-helpers.js +103 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +193 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-types.js +10 -0
- package/dist/extraction/tree-sitter-types.js.map +1 -0
- package/dist/extraction/tree-sitter.d.ts +317 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/dist/extraction/tree-sitter.js +3092 -0
- package/dist/extraction/tree-sitter.js.map +1 -0
- package/dist/extraction/vue-extractor.d.ts +51 -0
- package/dist/extraction/vue-extractor.d.ts.map +1 -0
- package/dist/extraction/vue-extractor.js +251 -0
- package/dist/extraction/vue-extractor.js.map +1 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/dist/extraction/wasm-runtime-flags.js +106 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/queries.d.ts +106 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +366 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/traversal.d.ts +127 -0
- package/dist/graph/traversal.d.ts.map +1 -0
- package/dist/graph/traversal.js +531 -0
- package/dist/graph/traversal.js.map +1 -0
- package/dist/index.d.ts +551 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1165 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/config-writer.d.ts +28 -0
- package/dist/installer/config-writer.d.ts.map +1 -0
- package/dist/installer/config-writer.js +91 -0
- package/dist/installer/config-writer.js.map +1 -0
- package/dist/installer/index.d.ts +92 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +416 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/instructions-template.d.ts +35 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +51 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +117 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +736 -0
- package/dist/installer/targets/claude.js.map +1 -0
- package/dist/installer/targets/registry.d.ts +19 -0
- package/dist/installer/targets/registry.d.ts.map +1 -0
- package/dist/installer/targets/registry.js +31 -0
- package/dist/installer/targets/registry.js.map +1 -0
- package/dist/installer/targets/shared.d.ts +76 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +256 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/types.d.ts +84 -0
- package/dist/installer/targets/types.d.ts.map +1 -0
- package/dist/installer/targets/types.js +12 -0
- package/dist/installer/targets/types.js.map +1 -0
- package/dist/isolation/worktree.d.ts +65 -0
- package/dist/isolation/worktree.d.ts.map +1 -0
- package/dist/isolation/worktree.js +231 -0
- package/dist/isolation/worktree.js.map +1 -0
- package/dist/mcp/daemon-paths.d.ts +46 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +125 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon.d.ts +161 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +403 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/designer-tools.d.ts +33 -0
- package/dist/mcp/designer-tools.d.ts.map +1 -0
- package/dist/mcp/designer-tools.js +313 -0
- package/dist/mcp/designer-tools.js.map +1 -0
- package/dist/mcp/engine.d.ts +105 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +270 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/index.d.ts +112 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +477 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/proxy.d.ts +81 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +510 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +18 -0
- package/dist/mcp/server-instructions.d.ts.map +1 -0
- package/dist/mcp/server-instructions.js +77 -0
- package/dist/mcp/server-instructions.js.map +1 -0
- package/dist/mcp/session.d.ts +77 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +294 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/spec-tools.d.ts +39 -0
- package/dist/mcp/spec-tools.d.ts.map +1 -0
- package/dist/mcp/spec-tools.js +326 -0
- package/dist/mcp/spec-tools.js.map +1 -0
- package/dist/mcp/tools.d.ts +404 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +3087 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +343 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +10 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +1300 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/dist/resolution/frameworks/csharp.js +241 -0
- package/dist/resolution/frameworks/csharp.js.map +1 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/dist/resolution/frameworks/drupal.js +367 -0
- package/dist/resolution/frameworks/drupal.js.map +1 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +143 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/dist/resolution/frameworks/express.js +308 -0
- package/dist/resolution/frameworks/express.js.map +1 -0
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/dist/resolution/frameworks/go.js +161 -0
- package/dist/resolution/frameworks/go.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts +48 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/dist/resolution/frameworks/index.js +161 -0
- package/dist/resolution/frameworks/index.js.map +1 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/dist/resolution/frameworks/java.js +504 -0
- package/dist/resolution/frameworks/java.js.map +1 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/dist/resolution/frameworks/laravel.js +257 -0
- package/dist/resolution/frameworks/laravel.js.map +1 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/dist/resolution/frameworks/nestjs.js +698 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/dist/resolution/frameworks/python.js +396 -0
- package/dist/resolution/frameworks/python.js.map +1 -0
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +360 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts +8 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/dist/resolution/frameworks/react.js +365 -0
- package/dist/resolution/frameworks/react.js.map +1 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/dist/resolution/frameworks/ruby.js +302 -0
- package/dist/resolution/frameworks/ruby.js.map +1 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/dist/resolution/frameworks/rust.js +304 -0
- package/dist/resolution/frameworks/rust.js.map +1 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/dist/resolution/frameworks/svelte.js +249 -0
- package/dist/resolution/frameworks/svelte.js.map +1 -0
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift.js +400 -0
- package/dist/resolution/frameworks/swift.js.map +1 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/dist/resolution/frameworks/vue.js +306 -0
- package/dist/resolution/frameworks/vue.js.map +1 -0
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +68 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -0
- package/dist/resolution/import-resolver.js +1275 -0
- package/dist/resolution/import-resolver.js.map +1 -0
- package/dist/resolution/index.d.ts +117 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +895 -0
- package/dist/resolution/index.js.map +1 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/lru-cache.d.ts.map +1 -0
- package/dist/resolution/lru-cache.js +62 -0
- package/dist/resolution/lru-cache.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +32 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -0
- package/dist/resolution/name-matcher.js +596 -0
- package/dist/resolution/name-matcher.js.map +1 -0
- package/dist/resolution/path-aliases.d.ts +68 -0
- package/dist/resolution/path-aliases.d.ts.map +1 -0
- package/dist/resolution/path-aliases.js +238 -0
- package/dist/resolution/path-aliases.js.map +1 -0
- package/dist/resolution/spec-link-resolver.d.ts +103 -0
- package/dist/resolution/spec-link-resolver.d.ts.map +1 -0
- package/dist/resolution/spec-link-resolver.js +259 -0
- package/dist/resolution/spec-link-resolver.js.map +1 -0
- package/dist/resolution/strip-comments.d.ts +27 -0
- package/dist/resolution/strip-comments.d.ts.map +1 -0
- package/dist/resolution/strip-comments.js +441 -0
- package/dist/resolution/strip-comments.js.map +1 -0
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/types.d.ts +216 -0
- package/dist/resolution/types.d.ts.map +1 -0
- package/dist/resolution/types.js +8 -0
- package/dist/resolution/types.js.map +1 -0
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/dist/resolution/workspace-packages.js +208 -0
- package/dist/resolution/workspace-packages.js.map +1 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-parser.d.ts.map +1 -0
- package/dist/search/query-parser.js +177 -0
- package/dist/search/query-parser.js.map +1 -0
- package/dist/search/query-utils.d.ts +71 -0
- package/dist/search/query-utils.d.ts.map +1 -0
- package/dist/search/query-utils.js +380 -0
- package/dist/search/query-utils.js.map +1 -0
- package/dist/server/cli.js +152 -0
- package/dist/server/index.js +12 -0
- package/dist/server/ingest/index.js +18 -0
- package/dist/server/ingest/ingestor.js +506 -0
- package/dist/server/ingest/parser.js +104 -0
- package/dist/server/ingest/pricing.js +78 -0
- package/dist/server/ingest/types.js +9 -0
- package/dist/server/ingest/watcher.js +77 -0
- package/dist/server/package.json +3 -0
- package/dist/server/project-registry.js +101 -0
- package/dist/server/routes/claude.js +868 -0
- package/dist/server/routes/graph.js +211 -0
- package/dist/server/routes/memory.js +272 -0
- package/dist/server/routes/projects.js +197 -0
- package/dist/server/routes/spec.js +265 -0
- package/dist/server/routes/status.js +112 -0
- package/dist/server/routes/workflow.js +212 -0
- package/dist/server/server.js +206 -0
- package/dist/server/static-handler.js +87 -0
- package/dist/sync/git-hooks.d.ts +45 -0
- package/dist/sync/git-hooks.d.ts.map +1 -0
- package/dist/sync/git-hooks.js +225 -0
- package/dist/sync/git-hooks.js.map +1 -0
- package/dist/sync/index.d.ts +19 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +35 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/watch-policy.d.ts +48 -0
- package/dist/sync/watch-policy.d.ts.map +1 -0
- package/dist/sync/watch-policy.js +124 -0
- package/dist/sync/watch-policy.js.map +1 -0
- package/dist/sync/watcher.d.ts +283 -0
- package/dist/sync/watcher.d.ts.map +1 -0
- package/dist/sync/watcher.js +606 -0
- package/dist/sync/watcher.js.map +1 -0
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +137 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/types.d.ts +623 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +108 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/glyphs.d.ts +42 -0
- package/dist/ui/glyphs.d.ts.map +1 -0
- package/dist/ui/glyphs.js +78 -0
- package/dist/ui/glyphs.js.map +1 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/dist/ui/shimmer-progress.js +90 -0
- package/dist/ui/shimmer-progress.js.map +1 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/dist/ui/shimmer-worker.js +118 -0
- package/dist/ui/shimmer-worker.js.map +1 -0
- package/dist/ui/types.d.ts +17 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +3 -0
- package/dist/ui/types.js.map +1 -0
- package/dist/utils.d.ts +205 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +549 -0
- package/dist/utils.js.map +1 -0
- package/dist/web/chunk-2AJCHB7P.js +1 -0
- package/dist/web/chunk-2CPLUFCH.js +2 -0
- package/dist/web/chunk-2GBEK2GM.js +1 -0
- package/dist/web/chunk-2I7L37NS.js +1 -0
- package/dist/web/chunk-2NAWAJB5.js +1 -0
- package/dist/web/chunk-2OJBIPE4.js +1 -0
- package/dist/web/chunk-2YUJNZ2Y.js +6 -0
- package/dist/web/chunk-3E2WB6D5.js +1 -0
- package/dist/web/chunk-3EBFYSCH.js +2 -0
- package/dist/web/chunk-3QCQ4BXS.js +1 -0
- package/dist/web/chunk-42XVAQ6I.js +1 -0
- package/dist/web/chunk-45QHGCB4.js +17 -0
- package/dist/web/chunk-4IMMPEYM.js +1 -0
- package/dist/web/chunk-4TJQJPCZ.js +1 -0
- package/dist/web/chunk-4WZIHTPC.js +1 -0
- package/dist/web/chunk-4YVSYOSD.js +1 -0
- package/dist/web/chunk-5BQIOYKW.js +1 -0
- package/dist/web/chunk-5HGWHUJA.js +1 -0
- package/dist/web/chunk-5Y244R4G.js +1 -0
- package/dist/web/chunk-6RRDPT5Z.js +1 -0
- package/dist/web/chunk-6VKB2ZWM.js +1 -0
- package/dist/web/chunk-7DMFVTU4.js +1 -0
- package/dist/web/chunk-7RNS77UP.js +1 -0
- package/dist/web/chunk-7SMPKVEP.js +1 -0
- package/dist/web/chunk-A5R3MJMO.js +1 -0
- package/dist/web/chunk-ASZ77FMZ.js +1 -0
- package/dist/web/chunk-AZJVTPLU.js +1 -0
- package/dist/web/chunk-B3YPFY6A.js +1 -0
- package/dist/web/chunk-BLBRMCN2.js +1 -0
- package/dist/web/chunk-BMIAXD2V.js +2 -0
- package/dist/web/chunk-BUXWEHIY.js +1 -0
- package/dist/web/chunk-BYZFQSM6.js +1 -0
- package/dist/web/chunk-D5OCNEJA.js +2 -0
- package/dist/web/chunk-DLQPZWSI.css +1 -0
- package/dist/web/chunk-DTRN7FZR.js +1 -0
- package/dist/web/chunk-DYRFLPJA.js +1 -0
- package/dist/web/chunk-E3J3CXR5.js +1 -0
- package/dist/web/chunk-E44X4RH2.js +1 -0
- package/dist/web/chunk-E73OX2P7.js +1 -0
- package/dist/web/chunk-EAXRKDLV.js +1 -0
- package/dist/web/chunk-EBKKDHYI.js +1 -0
- package/dist/web/chunk-EE7V7Q5P.js +1 -0
- package/dist/web/chunk-EKY2FUHU.js +1 -0
- package/dist/web/chunk-EMGMOEVR.js +1 -0
- package/dist/web/chunk-EP6XOPXH.js +1 -0
- package/dist/web/chunk-ESGDLJOJ.js +1 -0
- package/dist/web/chunk-ETJG7NCY.js +1 -0
- package/dist/web/chunk-EUUEFEDI.js +1 -0
- package/dist/web/chunk-FGNZDHTL.js +11 -0
- package/dist/web/chunk-FHZHD2ZG.js +1 -0
- package/dist/web/chunk-FIJW2UNJ.js +1 -0
- package/dist/web/chunk-FMV5PXRC.js +5 -0
- package/dist/web/chunk-G7VZT5KB.js +3 -0
- package/dist/web/chunk-GR72OOCN.js +1 -0
- package/dist/web/chunk-GRZYXPSO.js +7 -0
- package/dist/web/chunk-GWPVKJIY.js +1 -0
- package/dist/web/chunk-GYGPS3AN.js +1 -0
- package/dist/web/chunk-H7AF7YS4.js +1 -0
- package/dist/web/chunk-HDZDQILN.js +1 -0
- package/dist/web/chunk-HMK6UO6N.js +1 -0
- package/dist/web/chunk-HZA6NEAB.js +1 -0
- package/dist/web/chunk-IHEE5NYJ.js +1 -0
- package/dist/web/chunk-ISNEBICW.js +1 -0
- package/dist/web/chunk-J2GZVLHH.js +1 -0
- package/dist/web/chunk-JTFXTIPE.js +903 -0
- package/dist/web/chunk-L37MTFSG.js +3 -0
- package/dist/web/chunk-LB6JPLX2.js +1 -0
- package/dist/web/chunk-LNSVDHCI.js +1 -0
- package/dist/web/chunk-LVGIY3SO.js +1 -0
- package/dist/web/chunk-LXLHIHEN.js +1 -0
- package/dist/web/chunk-MC4DFIHG.js +1 -0
- package/dist/web/chunk-MVOMVPYB.js +1 -0
- package/dist/web/chunk-N6SS4G6S.js +1 -0
- package/dist/web/chunk-NTBJG6SJ.js +1 -0
- package/dist/web/chunk-NUDB3Q2Y.js +3 -0
- package/dist/web/chunk-NZEZCT65.js +1 -0
- package/dist/web/chunk-OXEF5E3E.js +1 -0
- package/dist/web/chunk-PDN6QYGJ.js +4 -0
- package/dist/web/chunk-PGGJPDJG.js +1 -0
- package/dist/web/chunk-PUYSJNJR.js +1 -0
- package/dist/web/chunk-Q2RVFS45.js +1 -0
- package/dist/web/chunk-Q7L6LLAK.js +1 -0
- package/dist/web/chunk-QCMKJIWY.js +1 -0
- package/dist/web/chunk-QH6CF3M3.js +1 -0
- package/dist/web/chunk-QQ5LD7PI.js +1 -0
- package/dist/web/chunk-QR6L3KAC.js +1 -0
- package/dist/web/chunk-R2DLK4HO.js +1 -0
- package/dist/web/chunk-R5W2MDZN.js +1 -0
- package/dist/web/chunk-RD6TVPOT.js +1 -0
- package/dist/web/chunk-RKY4EJYJ.js +1 -0
- package/dist/web/chunk-RONYWVY7.js +1 -0
- package/dist/web/chunk-RXKXYF2C.js +1 -0
- package/dist/web/chunk-SBWU7JFC.js +1 -0
- package/dist/web/chunk-SEXBRGYK.js +1 -0
- package/dist/web/chunk-SHPTC4RL.js +1 -0
- package/dist/web/chunk-SUZYBYDW.js +1 -0
- package/dist/web/chunk-SWKJRNYY.js +1 -0
- package/dist/web/chunk-T66XVKGB.js +1 -0
- package/dist/web/chunk-T7AZ65JP.js +1 -0
- package/dist/web/chunk-TCZDVOHD.js +1 -0
- package/dist/web/chunk-TPTITA3V.js +1 -0
- package/dist/web/chunk-TR335633.js +1 -0
- package/dist/web/chunk-UBOZGQNK.js +1 -0
- package/dist/web/chunk-UR5KDXPX.js +1 -0
- package/dist/web/chunk-UR6O2GEH.js +1 -0
- package/dist/web/chunk-UTNMGWTP.js +1 -0
- package/dist/web/chunk-UYC52MBC.js +1 -0
- package/dist/web/chunk-VECWMHJP.js +1 -0
- package/dist/web/chunk-VUACT35R.js +3 -0
- package/dist/web/chunk-VZI7H4SZ.js +1 -0
- package/dist/web/chunk-WAI2JMZP.js +1 -0
- package/dist/web/chunk-WB6YHOD4.js +1 -0
- package/dist/web/chunk-WBT64AWV.js +1 -0
- package/dist/web/chunk-WCKHQIYN.js +1 -0
- package/dist/web/chunk-WDU3WICG.js +1 -0
- package/dist/web/chunk-WFXJIXZE.js +4 -0
- package/dist/web/chunk-WLIMNDS3.js +1 -0
- package/dist/web/chunk-WTGYRH3Z.js +298 -0
- package/dist/web/chunk-WXTCVDTP.js +1 -0
- package/dist/web/chunk-X2HTISHL.js +1 -0
- package/dist/web/chunk-XCDHWLVH.js +1 -0
- package/dist/web/chunk-Y3H6FFUZ.js +1 -0
- package/dist/web/chunk-Y4F5ULGJ.js +1 -0
- package/dist/web/chunk-YAMRN47K.js +2 -0
- package/dist/web/chunk-YEGKAAEE.js +1 -0
- package/dist/web/chunk-YM2KU57F.js +1 -0
- package/dist/web/chunk-YRERBP6T.js +1 -0
- package/dist/web/chunk-ZLV4VCDG.js +3 -0
- package/dist/web/chunk-ZTVI5KFF.js +1 -0
- package/dist/web/favicon-16.png +0 -0
- package/dist/web/favicon-180.png +0 -0
- package/dist/web/favicon-32.png +0 -0
- package/dist/web/favicon-512.png +0 -0
- package/dist/web/favicon-small.svg +15 -0
- package/dist/web/favicon.ico +0 -0
- package/dist/web/favicon.svg +20 -0
- package/dist/web/index.html +145 -0
- package/dist/web/main-ESADRXN2.css +1 -0
- package/dist/web/main-R53HA54V.js +1 -0
- package/dist/web/media/codicon-LN6W7LCM.ttf +0 -0
- package/dist/web/styles-KSOPUVDA.css +1 -0
- package/dist/web/sw.js +69 -0
- package/dist/workflows/condition-evaluator.d.ts +75 -0
- package/dist/workflows/condition-evaluator.d.ts.map +1 -0
- package/dist/workflows/condition-evaluator.js +282 -0
- package/dist/workflows/condition-evaluator.js.map +1 -0
- package/dist/workflows/defaults/claude-design-implement.yaml +336 -0
- package/dist/workflows/defaults/index.d.ts +26 -0
- package/dist/workflows/defaults/index.d.ts.map +1 -0
- package/dist/workflows/defaults/index.js +94 -0
- package/dist/workflows/defaults/index.js.map +1 -0
- package/dist/workflows/defaults/spec-author.yaml +214 -0
- package/dist/workflows/defaults/spec-fix.yaml +110 -0
- package/dist/workflows/defaults/spec-implement.yaml +150 -0
- package/dist/workflows/defaults/spec-relink.yaml +81 -0
- package/dist/workflows/defaults/spec-verify.yaml +51 -0
- package/dist/workflows/discovery.d.ts +46 -0
- package/dist/workflows/discovery.d.ts.map +1 -0
- package/dist/workflows/discovery.js +193 -0
- package/dist/workflows/discovery.js.map +1 -0
- package/dist/workflows/executor.d.ts +83 -0
- package/dist/workflows/executor.d.ts.map +1 -0
- package/dist/workflows/executor.js +624 -0
- package/dist/workflows/executor.js.map +1 -0
- package/dist/workflows/runners/approval.d.ts +18 -0
- package/dist/workflows/runners/approval.d.ts.map +1 -0
- package/dist/workflows/runners/approval.js +34 -0
- package/dist/workflows/runners/approval.js.map +1 -0
- package/dist/workflows/runners/bash.d.ts +13 -0
- package/dist/workflows/runners/bash.d.ts.map +1 -0
- package/dist/workflows/runners/bash.js +143 -0
- package/dist/workflows/runners/bash.js.map +1 -0
- package/dist/workflows/runners/cancel.d.ts +10 -0
- package/dist/workflows/runners/cancel.d.ts.map +1 -0
- package/dist/workflows/runners/cancel.js +19 -0
- package/dist/workflows/runners/cancel.js.map +1 -0
- package/dist/workflows/runners/prompt.d.ts +28 -0
- package/dist/workflows/runners/prompt.d.ts.map +1 -0
- package/dist/workflows/runners/prompt.js +212 -0
- package/dist/workflows/runners/prompt.js.map +1 -0
- package/dist/workflows/runners/script.d.ts +17 -0
- package/dist/workflows/runners/script.d.ts.map +1 -0
- package/dist/workflows/runners/script.js +155 -0
- package/dist/workflows/runners/script.js.map +1 -0
- package/dist/workflows/runners/types.d.ts +51 -0
- package/dist/workflows/runners/types.d.ts.map +1 -0
- package/dist/workflows/runners/types.js +13 -0
- package/dist/workflows/runners/types.js.map +1 -0
- package/dist/workflows/schemas/workflow.d.ts +166 -0
- package/dist/workflows/schemas/workflow.d.ts.map +1 -0
- package/dist/workflows/schemas/workflow.js +437 -0
- package/dist/workflows/schemas/workflow.js.map +1 -0
- package/hooks/hooks.json +11 -0
- package/package.json +7 -3
- package/scripts/offline-install.sh +19 -6
- package/selectors.json +41 -0
- /package/commands/{cg-explore.md → ss-explore.md} +0 -0
- /package/commands/{cg-impact.md → ss-impact.md} +0 -0
- /package/commands/{cg-relink.md → ss-relink.md} +0 -0
- /package/commands/{cg-spec.md → ss-spec.md} +0 -0
- /package/commands/{cg-sync.md → ss-sync.md} +0 -0
- /package/commands/{cg-trace.md → ss-trace.md} +0 -0
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spec & Workflow Database Queries
|
|
4
|
+
*
|
|
5
|
+
* Prepared statements for CRUD on the v5 spec + workflow tables.
|
|
6
|
+
* Mirrors the pattern used by `QueryBuilder` in `./queries.ts`: lazy
|
|
7
|
+
* prepared statements cached per instance.
|
|
8
|
+
*
|
|
9
|
+
* Kept separate from QueryBuilder to avoid bloating that class —
|
|
10
|
+
* it's already ~1900 lines.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.SpecQueries = void 0;
|
|
14
|
+
const utils_1 = require("../utils");
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Row → object converters
|
|
17
|
+
// =============================================================================
|
|
18
|
+
function rowToSpec(row) {
|
|
19
|
+
return {
|
|
20
|
+
id: row.id,
|
|
21
|
+
kind: row.kind,
|
|
22
|
+
title: row.title,
|
|
23
|
+
body: row.body,
|
|
24
|
+
format: row.format,
|
|
25
|
+
sourcePath: row.source_path,
|
|
26
|
+
startLine: row.start_line ?? undefined,
|
|
27
|
+
endLine: row.end_line ?? undefined,
|
|
28
|
+
parentId: row.parent_id ?? undefined,
|
|
29
|
+
contentHash: row.content_hash,
|
|
30
|
+
version: row.version ?? undefined,
|
|
31
|
+
supersededBy: row.superseded_by ?? undefined,
|
|
32
|
+
owner: row.owner ?? undefined,
|
|
33
|
+
priority: row.priority ?? undefined,
|
|
34
|
+
metadata: row.metadata ? (0, utils_1.safeJsonParse)(row.metadata, undefined) : undefined,
|
|
35
|
+
createdAt: row.created_at,
|
|
36
|
+
updatedAt: row.updated_at,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function rowToSpecFile(row) {
|
|
40
|
+
return {
|
|
41
|
+
path: row.path,
|
|
42
|
+
contentHash: row.content_hash,
|
|
43
|
+
format: row.format,
|
|
44
|
+
size: row.size,
|
|
45
|
+
modifiedAt: row.modified_at,
|
|
46
|
+
indexedAt: row.indexed_at,
|
|
47
|
+
specCount: row.spec_count,
|
|
48
|
+
errors: row.errors ? (0, utils_1.safeJsonParse)(row.errors, undefined) : undefined,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function rowToSpecLink(row) {
|
|
52
|
+
return {
|
|
53
|
+
id: row.id,
|
|
54
|
+
specId: row.spec_id,
|
|
55
|
+
targetFilePath: row.target_file_path,
|
|
56
|
+
targetQualifiedName: row.target_qualified_name,
|
|
57
|
+
targetNodeKind: row.target_node_kind,
|
|
58
|
+
resolvedNodeId: row.resolved_node_id ?? undefined,
|
|
59
|
+
kind: row.kind,
|
|
60
|
+
state: row.state,
|
|
61
|
+
driftAxis: row.drift_axis ?? null,
|
|
62
|
+
specHashAtLink: row.spec_hash_at_link,
|
|
63
|
+
nodeSigAtLink: row.node_sig_at_link ?? undefined,
|
|
64
|
+
provenance: row.provenance,
|
|
65
|
+
confidence: row.confidence ?? undefined,
|
|
66
|
+
metadata: row.metadata ? (0, utils_1.safeJsonParse)(row.metadata, undefined) : undefined,
|
|
67
|
+
createdAt: row.created_at,
|
|
68
|
+
updatedAt: row.updated_at,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function rowToWorkflowRun(row) {
|
|
72
|
+
return {
|
|
73
|
+
id: row.id,
|
|
74
|
+
workflowName: row.workflow_name,
|
|
75
|
+
status: row.status,
|
|
76
|
+
inputs: row.inputs ? (0, utils_1.safeJsonParse)(row.inputs, undefined) : undefined,
|
|
77
|
+
isolationEnvId: row.isolation_env_id ?? undefined,
|
|
78
|
+
startedAt: row.started_at ?? undefined,
|
|
79
|
+
completedAt: row.completed_at ?? undefined,
|
|
80
|
+
lastActivityAt: row.last_activity_at,
|
|
81
|
+
errorMessage: row.error_message ?? undefined,
|
|
82
|
+
metadata: row.metadata ? (0, utils_1.safeJsonParse)(row.metadata, undefined) : undefined,
|
|
83
|
+
createdAt: row.created_at,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function rowToWorkflowEvent(row) {
|
|
87
|
+
return {
|
|
88
|
+
id: row.id,
|
|
89
|
+
workflowRunId: row.workflow_run_id,
|
|
90
|
+
eventType: row.event_type,
|
|
91
|
+
stepId: row.step_id ?? undefined,
|
|
92
|
+
stepKind: row.step_kind ?? undefined,
|
|
93
|
+
data: row.data ? (0, utils_1.safeJsonParse)(row.data, undefined) : undefined,
|
|
94
|
+
createdAt: row.created_at,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function rowToIsolationEnv(row) {
|
|
98
|
+
return {
|
|
99
|
+
id: row.id,
|
|
100
|
+
workflowRunId: row.workflow_run_id ?? undefined,
|
|
101
|
+
workflowName: row.workflow_name,
|
|
102
|
+
workingPath: row.working_path,
|
|
103
|
+
branchName: row.branch_name,
|
|
104
|
+
status: row.status,
|
|
105
|
+
createdAt: row.created_at,
|
|
106
|
+
destroyedAt: row.destroyed_at ?? undefined,
|
|
107
|
+
metadata: row.metadata ? (0, utils_1.safeJsonParse)(row.metadata, undefined) : undefined,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
// =============================================================================
|
|
111
|
+
// SpecQueries — CRUD for specs, spec_files, spec_links, workflow_*
|
|
112
|
+
// =============================================================================
|
|
113
|
+
class SpecQueries {
|
|
114
|
+
db;
|
|
115
|
+
stmts = {};
|
|
116
|
+
constructor(db) {
|
|
117
|
+
this.db = db;
|
|
118
|
+
}
|
|
119
|
+
// ===========================================================================
|
|
120
|
+
// Specs
|
|
121
|
+
// ===========================================================================
|
|
122
|
+
/**
|
|
123
|
+
* Insert or replace a spec row. Also inserts a virtual node projection
|
|
124
|
+
* into `nodes` with kind='spec' so graph traversal sees the spec.
|
|
125
|
+
*
|
|
126
|
+
* The virtual node's `id` is `spec:${spec.id}` (kind:hash convention from
|
|
127
|
+
* tree-sitter-helpers, but hand-built — specs don't go through tree-sitter).
|
|
128
|
+
* `qualified_name = spec.id` so SpecLinkResolver and specship_explore can
|
|
129
|
+
* find specs by their stable ID.
|
|
130
|
+
*/
|
|
131
|
+
insertSpec(spec) {
|
|
132
|
+
if (!this.stmts.insertSpec) {
|
|
133
|
+
this.stmts.insertSpec = this.db.prepare(`
|
|
134
|
+
INSERT OR REPLACE INTO specs (
|
|
135
|
+
id, kind, title, body, format, source_path, start_line, end_line,
|
|
136
|
+
parent_id, content_hash, version, superseded_by, owner, priority,
|
|
137
|
+
metadata, created_at, updated_at
|
|
138
|
+
) VALUES (
|
|
139
|
+
@id, @kind, @title, @body, @format, @sourcePath, @startLine, @endLine,
|
|
140
|
+
@parentId, @contentHash, @version, @supersededBy, @owner, @priority,
|
|
141
|
+
@metadata, @createdAt, @updatedAt
|
|
142
|
+
)
|
|
143
|
+
`);
|
|
144
|
+
}
|
|
145
|
+
this.stmts.insertSpec.run({
|
|
146
|
+
id: spec.id,
|
|
147
|
+
kind: spec.kind,
|
|
148
|
+
title: spec.title,
|
|
149
|
+
body: spec.body,
|
|
150
|
+
format: spec.format,
|
|
151
|
+
sourcePath: spec.sourcePath,
|
|
152
|
+
startLine: spec.startLine ?? null,
|
|
153
|
+
endLine: spec.endLine ?? null,
|
|
154
|
+
parentId: spec.parentId ?? null,
|
|
155
|
+
contentHash: spec.contentHash,
|
|
156
|
+
version: spec.version ?? 1,
|
|
157
|
+
supersededBy: spec.supersededBy ?? null,
|
|
158
|
+
owner: spec.owner ?? null,
|
|
159
|
+
priority: spec.priority ?? null,
|
|
160
|
+
metadata: spec.metadata ? JSON.stringify(spec.metadata) : null,
|
|
161
|
+
createdAt: spec.createdAt,
|
|
162
|
+
updatedAt: spec.updatedAt,
|
|
163
|
+
});
|
|
164
|
+
// Project a thin row into `nodes` so the spec participates in graph
|
|
165
|
+
// traversal (specship_explore, specship_node).
|
|
166
|
+
this.db
|
|
167
|
+
.prepare(`
|
|
168
|
+
INSERT OR REPLACE INTO nodes (
|
|
169
|
+
id, kind, name, qualified_name, file_path, language,
|
|
170
|
+
start_line, end_line, start_column, end_column,
|
|
171
|
+
docstring, signature, visibility,
|
|
172
|
+
is_exported, is_async, is_static, is_abstract,
|
|
173
|
+
decorators, type_parameters, updated_at
|
|
174
|
+
) VALUES (
|
|
175
|
+
@id, 'spec', @name, @qualifiedName, @filePath, 'unknown',
|
|
176
|
+
@startLine, @endLine, 0, 0,
|
|
177
|
+
NULL, @signature, NULL,
|
|
178
|
+
0, 0, 0, 0,
|
|
179
|
+
NULL, NULL, @updatedAt
|
|
180
|
+
)
|
|
181
|
+
`)
|
|
182
|
+
.run({
|
|
183
|
+
id: `spec:${spec.id}`,
|
|
184
|
+
name: spec.title,
|
|
185
|
+
qualifiedName: spec.id,
|
|
186
|
+
filePath: spec.sourcePath,
|
|
187
|
+
startLine: spec.startLine ?? 0,
|
|
188
|
+
endLine: spec.endLine ?? 0,
|
|
189
|
+
signature: spec.kind,
|
|
190
|
+
updatedAt: spec.updatedAt,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Batch-insert specs in a transaction.
|
|
195
|
+
*/
|
|
196
|
+
insertSpecsBatch(specs) {
|
|
197
|
+
if (specs.length === 0)
|
|
198
|
+
return;
|
|
199
|
+
this.db.transaction(() => {
|
|
200
|
+
for (const spec of specs)
|
|
201
|
+
this.insertSpec(spec);
|
|
202
|
+
})();
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Delete all specs for a given source file. CASCADE removes children
|
|
206
|
+
* (parent_id FK) and any spec_links to those specs.
|
|
207
|
+
*/
|
|
208
|
+
deleteSpecsByFile(sourcePath) {
|
|
209
|
+
if (!this.stmts.deleteSpecsByFile) {
|
|
210
|
+
this.stmts.deleteSpecsByFile = this.db.prepare('DELETE FROM specs WHERE source_path = ?');
|
|
211
|
+
}
|
|
212
|
+
this.db.transaction(() => {
|
|
213
|
+
// Also drop the virtual node projections for these specs.
|
|
214
|
+
this.db
|
|
215
|
+
.prepare(`DELETE FROM nodes WHERE kind = 'spec' AND file_path = ?`)
|
|
216
|
+
.run(sourcePath);
|
|
217
|
+
this.stmts.deleteSpecsByFile.run(sourcePath);
|
|
218
|
+
})();
|
|
219
|
+
}
|
|
220
|
+
/** Look up a spec by its embedded ID. */
|
|
221
|
+
getSpecById(id) {
|
|
222
|
+
if (!this.stmts.getSpecById) {
|
|
223
|
+
this.stmts.getSpecById = this.db.prepare('SELECT * FROM specs WHERE id = ?');
|
|
224
|
+
}
|
|
225
|
+
const row = this.stmts.getSpecById.get(id);
|
|
226
|
+
return row ? rowToSpec(row) : null;
|
|
227
|
+
}
|
|
228
|
+
/** All specs from a given source file, sorted by start_line. */
|
|
229
|
+
getSpecsByFile(sourcePath) {
|
|
230
|
+
if (!this.stmts.getSpecsByFile) {
|
|
231
|
+
this.stmts.getSpecsByFile = this.db.prepare(`SELECT * FROM specs WHERE source_path = ? ORDER BY start_line`);
|
|
232
|
+
}
|
|
233
|
+
const rows = this.stmts.getSpecsByFile.all(sourcePath);
|
|
234
|
+
return rows.map(rowToSpec);
|
|
235
|
+
}
|
|
236
|
+
/** Child specs of a given parent (requirements under a document, etc.). */
|
|
237
|
+
getSpecsByParent(parentId) {
|
|
238
|
+
if (!this.stmts.getSpecsByParent) {
|
|
239
|
+
this.stmts.getSpecsByParent = this.db.prepare(`SELECT * FROM specs WHERE parent_id = ? ORDER BY start_line`);
|
|
240
|
+
}
|
|
241
|
+
const rows = this.stmts.getSpecsByParent.all(parentId);
|
|
242
|
+
return rows.map(rowToSpec);
|
|
243
|
+
}
|
|
244
|
+
/** All specs (small projects only; large repos should filter). */
|
|
245
|
+
getAllSpecs() {
|
|
246
|
+
if (!this.stmts.getAllSpecs) {
|
|
247
|
+
this.stmts.getAllSpecs = this.db.prepare(`SELECT * FROM specs ORDER BY source_path, start_line`);
|
|
248
|
+
}
|
|
249
|
+
const rows = this.stmts.getAllSpecs.all();
|
|
250
|
+
return rows.map(rowToSpec);
|
|
251
|
+
}
|
|
252
|
+
// ===========================================================================
|
|
253
|
+
// Spec files
|
|
254
|
+
// ===========================================================================
|
|
255
|
+
upsertSpecFile(file) {
|
|
256
|
+
if (!this.stmts.upsertSpecFile) {
|
|
257
|
+
this.stmts.upsertSpecFile = this.db.prepare(`
|
|
258
|
+
INSERT INTO spec_files (path, content_hash, format, size, modified_at, indexed_at, spec_count, errors)
|
|
259
|
+
VALUES (@path, @contentHash, @format, @size, @modifiedAt, @indexedAt, @specCount, @errors)
|
|
260
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
261
|
+
content_hash = @contentHash,
|
|
262
|
+
format = @format,
|
|
263
|
+
size = @size,
|
|
264
|
+
modified_at = @modifiedAt,
|
|
265
|
+
indexed_at = @indexedAt,
|
|
266
|
+
spec_count = @specCount,
|
|
267
|
+
errors = @errors
|
|
268
|
+
`);
|
|
269
|
+
}
|
|
270
|
+
this.stmts.upsertSpecFile.run({
|
|
271
|
+
path: file.path,
|
|
272
|
+
contentHash: file.contentHash,
|
|
273
|
+
format: file.format,
|
|
274
|
+
size: file.size,
|
|
275
|
+
modifiedAt: file.modifiedAt,
|
|
276
|
+
indexedAt: file.indexedAt,
|
|
277
|
+
specCount: file.specCount,
|
|
278
|
+
errors: file.errors ? JSON.stringify(file.errors) : null,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
deleteSpecFile(path) {
|
|
282
|
+
this.db.transaction(() => {
|
|
283
|
+
this.deleteSpecsByFile(path);
|
|
284
|
+
if (!this.stmts.deleteSpecFile) {
|
|
285
|
+
this.stmts.deleteSpecFile = this.db.prepare('DELETE FROM spec_files WHERE path = ?');
|
|
286
|
+
}
|
|
287
|
+
this.stmts.deleteSpecFile.run(path);
|
|
288
|
+
})();
|
|
289
|
+
}
|
|
290
|
+
getSpecFileByPath(path) {
|
|
291
|
+
if (!this.stmts.getSpecFileByPath) {
|
|
292
|
+
this.stmts.getSpecFileByPath = this.db.prepare('SELECT * FROM spec_files WHERE path = ?');
|
|
293
|
+
}
|
|
294
|
+
const row = this.stmts.getSpecFileByPath.get(path);
|
|
295
|
+
return row ? rowToSpecFile(row) : null;
|
|
296
|
+
}
|
|
297
|
+
getAllSpecFiles() {
|
|
298
|
+
if (!this.stmts.getAllSpecFiles) {
|
|
299
|
+
this.stmts.getAllSpecFiles = this.db.prepare('SELECT * FROM spec_files ORDER BY path');
|
|
300
|
+
}
|
|
301
|
+
const rows = this.stmts.getAllSpecFiles.all();
|
|
302
|
+
return rows.map(rowToSpecFile);
|
|
303
|
+
}
|
|
304
|
+
// ===========================================================================
|
|
305
|
+
// Spec links — the spec ↔ code join with state
|
|
306
|
+
// ===========================================================================
|
|
307
|
+
/**
|
|
308
|
+
* Insert a fresh link. Most callers want `upsertSpecLink` (idempotent).
|
|
309
|
+
*/
|
|
310
|
+
insertSpecLink(link) {
|
|
311
|
+
if (!this.stmts.insertSpecLink) {
|
|
312
|
+
this.stmts.insertSpecLink = this.db.prepare(`
|
|
313
|
+
INSERT INTO spec_links (
|
|
314
|
+
spec_id, target_file_path, target_qualified_name, target_node_kind,
|
|
315
|
+
resolved_node_id, kind, state, drift_axis,
|
|
316
|
+
spec_hash_at_link, node_sig_at_link,
|
|
317
|
+
provenance, confidence, metadata, created_at, updated_at
|
|
318
|
+
) VALUES (
|
|
319
|
+
@specId, @targetFilePath, @targetQualifiedName, @targetNodeKind,
|
|
320
|
+
@resolvedNodeId, @kind, @state, @driftAxis,
|
|
321
|
+
@specHashAtLink, @nodeSigAtLink,
|
|
322
|
+
@provenance, @confidence, @metadata, @createdAt, @updatedAt
|
|
323
|
+
)
|
|
324
|
+
`);
|
|
325
|
+
}
|
|
326
|
+
const result = this.stmts.insertSpecLink.run({
|
|
327
|
+
specId: link.specId,
|
|
328
|
+
targetFilePath: link.targetFilePath,
|
|
329
|
+
targetQualifiedName: link.targetQualifiedName,
|
|
330
|
+
targetNodeKind: link.targetNodeKind,
|
|
331
|
+
resolvedNodeId: link.resolvedNodeId ?? null,
|
|
332
|
+
kind: link.kind,
|
|
333
|
+
state: link.state,
|
|
334
|
+
driftAxis: link.driftAxis ?? null,
|
|
335
|
+
specHashAtLink: link.specHashAtLink,
|
|
336
|
+
nodeSigAtLink: link.nodeSigAtLink ?? null,
|
|
337
|
+
provenance: link.provenance,
|
|
338
|
+
confidence: link.confidence ?? 1.0,
|
|
339
|
+
metadata: link.metadata ? JSON.stringify(link.metadata) : null,
|
|
340
|
+
createdAt: link.createdAt,
|
|
341
|
+
updatedAt: link.updatedAt,
|
|
342
|
+
});
|
|
343
|
+
return Number(result.lastInsertRowid);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Idempotent upsert keyed on logical identity
|
|
347
|
+
* (spec_id, target_file_path, target_qualified_name, kind). If a link
|
|
348
|
+
* with the same logical key exists, update it; otherwise insert. Higher
|
|
349
|
+
* provenance/confidence wins (agent-asserted overrides code-comment, etc.).
|
|
350
|
+
*
|
|
351
|
+
* Returns the link row's id.
|
|
352
|
+
*/
|
|
353
|
+
upsertSpecLink(link) {
|
|
354
|
+
const existing = this.findLogicalLink(link.specId, link.targetFilePath, link.targetQualifiedName, link.kind);
|
|
355
|
+
const now = link.updatedAt;
|
|
356
|
+
if (existing) {
|
|
357
|
+
// Only overwrite if new signal has equal or higher confidence.
|
|
358
|
+
const newConfidence = link.confidence ?? 1.0;
|
|
359
|
+
const existingConfidence = existing.confidence ?? 1.0;
|
|
360
|
+
if (newConfidence < existingConfidence) {
|
|
361
|
+
return existing.id;
|
|
362
|
+
}
|
|
363
|
+
this.db
|
|
364
|
+
.prepare(`
|
|
365
|
+
UPDATE spec_links
|
|
366
|
+
SET resolved_node_id = @resolvedNodeId,
|
|
367
|
+
state = @state,
|
|
368
|
+
drift_axis = @driftAxis,
|
|
369
|
+
spec_hash_at_link = @specHashAtLink,
|
|
370
|
+
node_sig_at_link = @nodeSigAtLink,
|
|
371
|
+
provenance = @provenance,
|
|
372
|
+
confidence = @confidence,
|
|
373
|
+
metadata = @metadata,
|
|
374
|
+
updated_at = @updatedAt
|
|
375
|
+
WHERE id = @id
|
|
376
|
+
`)
|
|
377
|
+
.run({
|
|
378
|
+
id: existing.id,
|
|
379
|
+
resolvedNodeId: link.resolvedNodeId ?? null,
|
|
380
|
+
state: link.state,
|
|
381
|
+
driftAxis: link.driftAxis ?? null,
|
|
382
|
+
specHashAtLink: link.specHashAtLink,
|
|
383
|
+
nodeSigAtLink: link.nodeSigAtLink ?? null,
|
|
384
|
+
provenance: link.provenance,
|
|
385
|
+
confidence: link.confidence ?? 1.0,
|
|
386
|
+
metadata: link.metadata ? JSON.stringify(link.metadata) : null,
|
|
387
|
+
updatedAt: now,
|
|
388
|
+
});
|
|
389
|
+
return existing.id;
|
|
390
|
+
}
|
|
391
|
+
return this.insertSpecLink(link);
|
|
392
|
+
}
|
|
393
|
+
/** Find a link by its logical identity (no node_id involved). */
|
|
394
|
+
findLogicalLink(specId, targetFilePath, targetQualifiedName, kind) {
|
|
395
|
+
const row = this.db
|
|
396
|
+
.prepare(`
|
|
397
|
+
SELECT * FROM spec_links
|
|
398
|
+
WHERE spec_id = ? AND target_file_path = ? AND target_qualified_name = ? AND kind = ?
|
|
399
|
+
LIMIT 1
|
|
400
|
+
`)
|
|
401
|
+
.get(specId, targetFilePath, targetQualifiedName, kind);
|
|
402
|
+
return row ? rowToSpecLink(row) : null;
|
|
403
|
+
}
|
|
404
|
+
deleteSpecLink(id) {
|
|
405
|
+
if (!this.stmts.deleteSpecLink) {
|
|
406
|
+
this.stmts.deleteSpecLink = this.db.prepare('DELETE FROM spec_links WHERE id = ?');
|
|
407
|
+
}
|
|
408
|
+
this.stmts.deleteSpecLink.run(id);
|
|
409
|
+
}
|
|
410
|
+
updateSpecLinkState(id, state, driftAxis = null, updatedAt = Date.now()) {
|
|
411
|
+
if (!this.stmts.updateSpecLinkState) {
|
|
412
|
+
this.stmts.updateSpecLinkState = this.db.prepare(`UPDATE spec_links SET state = ?, drift_axis = ?, updated_at = ? WHERE id = ?`);
|
|
413
|
+
}
|
|
414
|
+
this.stmts.updateSpecLinkState.run(state, driftAxis, updatedAt, id);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Update the resolved_node_id cache. Called by SpecLinkResolver after
|
|
418
|
+
* each sync. NULL means the logical target doesn't currently exist
|
|
419
|
+
* (caller should set state='orphaned' separately).
|
|
420
|
+
*/
|
|
421
|
+
updateSpecLinkResolution(id, resolvedNodeId, updatedAt = Date.now()) {
|
|
422
|
+
if (!this.stmts.updateSpecLinkResolution) {
|
|
423
|
+
this.stmts.updateSpecLinkResolution = this.db.prepare(`UPDATE spec_links SET resolved_node_id = ?, updated_at = ? WHERE id = ?`);
|
|
424
|
+
}
|
|
425
|
+
this.stmts.updateSpecLinkResolution.run(resolvedNodeId, updatedAt, id);
|
|
426
|
+
}
|
|
427
|
+
getLinkById(id) {
|
|
428
|
+
if (!this.stmts.getLinkById) {
|
|
429
|
+
this.stmts.getLinkById = this.db.prepare('SELECT * FROM spec_links WHERE id = ?');
|
|
430
|
+
}
|
|
431
|
+
const row = this.stmts.getLinkById.get(id);
|
|
432
|
+
return row ? rowToSpecLink(row) : null;
|
|
433
|
+
}
|
|
434
|
+
/** All links for a spec (e.g., for specship_spec response). */
|
|
435
|
+
getLinksBySpec(specId) {
|
|
436
|
+
if (!this.stmts.getLinksBySpec) {
|
|
437
|
+
this.stmts.getLinksBySpec = this.db.prepare(`SELECT * FROM spec_links WHERE spec_id = ? ORDER BY updated_at DESC`);
|
|
438
|
+
}
|
|
439
|
+
const rows = this.stmts.getLinksBySpec.all(specId);
|
|
440
|
+
return rows.map(rowToSpecLink);
|
|
441
|
+
}
|
|
442
|
+
/** All links pointing at a given resolved node (e.g., for specship_node response). */
|
|
443
|
+
getLinksByNode(nodeId) {
|
|
444
|
+
if (!this.stmts.getLinksByNode) {
|
|
445
|
+
this.stmts.getLinksByNode = this.db.prepare(`SELECT * FROM spec_links WHERE resolved_node_id = ? ORDER BY updated_at DESC`);
|
|
446
|
+
}
|
|
447
|
+
const rows = this.stmts.getLinksByNode.all(nodeId);
|
|
448
|
+
return rows.map(rowToSpecLink);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Links whose logical target lives in a particular file. Used by
|
|
452
|
+
* SpecLinkResolver after a file is re-extracted to know which links
|
|
453
|
+
* need re-resolution.
|
|
454
|
+
*/
|
|
455
|
+
getLinksByTargetFile(filePath) {
|
|
456
|
+
if (!this.stmts.getLinksByTargetFile) {
|
|
457
|
+
this.stmts.getLinksByTargetFile = this.db.prepare(`SELECT * FROM spec_links WHERE target_file_path = ?`);
|
|
458
|
+
}
|
|
459
|
+
const rows = this.stmts.getLinksByTargetFile.all(filePath);
|
|
460
|
+
return rows.map(rowToSpecLink);
|
|
461
|
+
}
|
|
462
|
+
/** Links by logical target identity (file + qualified_name). */
|
|
463
|
+
getLinksByLogicalTarget(filePath, qualifiedName) {
|
|
464
|
+
if (!this.stmts.getLinksByLogicalTarget) {
|
|
465
|
+
this.stmts.getLinksByLogicalTarget = this.db.prepare(`SELECT * FROM spec_links WHERE target_file_path = ? AND target_qualified_name = ?`);
|
|
466
|
+
}
|
|
467
|
+
const rows = this.stmts.getLinksByLogicalTarget.all(filePath, qualifiedName);
|
|
468
|
+
return rows.map(rowToSpecLink);
|
|
469
|
+
}
|
|
470
|
+
/** Links in one or more states — drives specship_drifted. */
|
|
471
|
+
getLinksByState(states) {
|
|
472
|
+
if (states.length === 0)
|
|
473
|
+
return [];
|
|
474
|
+
const placeholders = states.map(() => '?').join(',');
|
|
475
|
+
const rows = this.db
|
|
476
|
+
.prepare(`SELECT * FROM spec_links WHERE state IN (${placeholders}) ORDER BY updated_at DESC`)
|
|
477
|
+
.all(...states);
|
|
478
|
+
return rows.map(rowToSpecLink);
|
|
479
|
+
}
|
|
480
|
+
getAllLinks() {
|
|
481
|
+
if (!this.stmts.getAllLinks) {
|
|
482
|
+
this.stmts.getAllLinks = this.db.prepare(`SELECT * FROM spec_links ORDER BY updated_at DESC`);
|
|
483
|
+
}
|
|
484
|
+
const rows = this.stmts.getAllLinks.all();
|
|
485
|
+
return rows.map(rowToSpecLink);
|
|
486
|
+
}
|
|
487
|
+
// ===========================================================================
|
|
488
|
+
// Workflow runs
|
|
489
|
+
// ===========================================================================
|
|
490
|
+
insertWorkflowRun(run) {
|
|
491
|
+
if (!this.stmts.insertWorkflowRun) {
|
|
492
|
+
this.stmts.insertWorkflowRun = this.db.prepare(`
|
|
493
|
+
INSERT INTO workflow_runs (
|
|
494
|
+
id, workflow_name, status, inputs, isolation_env_id,
|
|
495
|
+
started_at, completed_at, last_activity_at,
|
|
496
|
+
error_message, metadata, created_at
|
|
497
|
+
) VALUES (
|
|
498
|
+
@id, @workflowName, @status, @inputs, @isolationEnvId,
|
|
499
|
+
@startedAt, @completedAt, @lastActivityAt,
|
|
500
|
+
@errorMessage, @metadata, @createdAt
|
|
501
|
+
)
|
|
502
|
+
`);
|
|
503
|
+
}
|
|
504
|
+
this.stmts.insertWorkflowRun.run({
|
|
505
|
+
id: run.id,
|
|
506
|
+
workflowName: run.workflowName,
|
|
507
|
+
status: run.status,
|
|
508
|
+
inputs: run.inputs ? JSON.stringify(run.inputs) : null,
|
|
509
|
+
isolationEnvId: run.isolationEnvId ?? null,
|
|
510
|
+
startedAt: run.startedAt ?? null,
|
|
511
|
+
completedAt: run.completedAt ?? null,
|
|
512
|
+
lastActivityAt: run.lastActivityAt,
|
|
513
|
+
errorMessage: run.errorMessage ?? null,
|
|
514
|
+
metadata: run.metadata ? JSON.stringify(run.metadata) : null,
|
|
515
|
+
createdAt: run.createdAt,
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
updateWorkflowRun(run) {
|
|
519
|
+
if (!this.stmts.updateWorkflowRun) {
|
|
520
|
+
this.stmts.updateWorkflowRun = this.db.prepare(`
|
|
521
|
+
UPDATE workflow_runs SET
|
|
522
|
+
status = @status,
|
|
523
|
+
inputs = @inputs,
|
|
524
|
+
isolation_env_id = @isolationEnvId,
|
|
525
|
+
started_at = @startedAt,
|
|
526
|
+
completed_at = @completedAt,
|
|
527
|
+
last_activity_at = @lastActivityAt,
|
|
528
|
+
error_message = @errorMessage,
|
|
529
|
+
metadata = @metadata
|
|
530
|
+
WHERE id = @id
|
|
531
|
+
`);
|
|
532
|
+
}
|
|
533
|
+
this.stmts.updateWorkflowRun.run({
|
|
534
|
+
id: run.id,
|
|
535
|
+
status: run.status,
|
|
536
|
+
inputs: run.inputs ? JSON.stringify(run.inputs) : null,
|
|
537
|
+
isolationEnvId: run.isolationEnvId ?? null,
|
|
538
|
+
startedAt: run.startedAt ?? null,
|
|
539
|
+
completedAt: run.completedAt ?? null,
|
|
540
|
+
lastActivityAt: run.lastActivityAt,
|
|
541
|
+
errorMessage: run.errorMessage ?? null,
|
|
542
|
+
metadata: run.metadata ? JSON.stringify(run.metadata) : null,
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
getWorkflowRunById(id) {
|
|
546
|
+
if (!this.stmts.getWorkflowRunById) {
|
|
547
|
+
this.stmts.getWorkflowRunById = this.db.prepare('SELECT * FROM workflow_runs WHERE id = ?');
|
|
548
|
+
}
|
|
549
|
+
const row = this.stmts.getWorkflowRunById.get(id);
|
|
550
|
+
return row ? rowToWorkflowRun(row) : null;
|
|
551
|
+
}
|
|
552
|
+
getWorkflowRunsByStatus(statuses) {
|
|
553
|
+
if (statuses.length === 0)
|
|
554
|
+
return [];
|
|
555
|
+
const placeholders = statuses.map(() => '?').join(',');
|
|
556
|
+
const rows = this.db
|
|
557
|
+
.prepare(`SELECT * FROM workflow_runs WHERE status IN (${placeholders}) ORDER BY last_activity_at DESC`)
|
|
558
|
+
.all(...statuses);
|
|
559
|
+
return rows.map(rowToWorkflowRun);
|
|
560
|
+
}
|
|
561
|
+
getWorkflowRunsByName(workflowName) {
|
|
562
|
+
if (!this.stmts.getWorkflowRunsByName) {
|
|
563
|
+
this.stmts.getWorkflowRunsByName = this.db.prepare(`SELECT * FROM workflow_runs WHERE workflow_name = ? ORDER BY last_activity_at DESC`);
|
|
564
|
+
}
|
|
565
|
+
const rows = this.stmts.getWorkflowRunsByName.all(workflowName);
|
|
566
|
+
return rows.map(rowToWorkflowRun);
|
|
567
|
+
}
|
|
568
|
+
getAllWorkflowRuns(limit = 50) {
|
|
569
|
+
const rows = this.db
|
|
570
|
+
.prepare(`SELECT * FROM workflow_runs ORDER BY last_activity_at DESC LIMIT ?`)
|
|
571
|
+
.all(limit);
|
|
572
|
+
return rows.map(rowToWorkflowRun);
|
|
573
|
+
}
|
|
574
|
+
// ===========================================================================
|
|
575
|
+
// Workflow events (fire-and-forget log)
|
|
576
|
+
// ===========================================================================
|
|
577
|
+
insertWorkflowEvent(event) {
|
|
578
|
+
if (!this.stmts.insertWorkflowEvent) {
|
|
579
|
+
this.stmts.insertWorkflowEvent = this.db.prepare(`
|
|
580
|
+
INSERT INTO workflow_events (
|
|
581
|
+
workflow_run_id, event_type, step_id, step_kind, data, created_at
|
|
582
|
+
) VALUES (@workflowRunId, @eventType, @stepId, @stepKind, @data, @createdAt)
|
|
583
|
+
`);
|
|
584
|
+
}
|
|
585
|
+
try {
|
|
586
|
+
this.stmts.insertWorkflowEvent.run({
|
|
587
|
+
workflowRunId: event.workflowRunId,
|
|
588
|
+
eventType: event.eventType,
|
|
589
|
+
stepId: event.stepId ?? null,
|
|
590
|
+
stepKind: event.stepKind ?? null,
|
|
591
|
+
data: event.data ? JSON.stringify(event.data) : null,
|
|
592
|
+
createdAt: event.createdAt,
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
catch {
|
|
596
|
+
// Fire-and-forget: never let event log failures break the executor.
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
getEventsByRun(workflowRunId, limit = 1000) {
|
|
600
|
+
if (!this.stmts.getEventsByRun) {
|
|
601
|
+
this.stmts.getEventsByRun = this.db.prepare(`SELECT * FROM workflow_events WHERE workflow_run_id = ? ORDER BY created_at ASC LIMIT ?`);
|
|
602
|
+
}
|
|
603
|
+
const rows = this.stmts.getEventsByRun.all(workflowRunId, limit);
|
|
604
|
+
return rows.map(rowToWorkflowEvent);
|
|
605
|
+
}
|
|
606
|
+
// ===========================================================================
|
|
607
|
+
// Isolation environments (git worktrees)
|
|
608
|
+
// ===========================================================================
|
|
609
|
+
insertIsolationEnv(env) {
|
|
610
|
+
if (!this.stmts.insertIsolationEnv) {
|
|
611
|
+
this.stmts.insertIsolationEnv = this.db.prepare(`
|
|
612
|
+
INSERT INTO isolation_environments (
|
|
613
|
+
id, workflow_run_id, workflow_name, working_path, branch_name,
|
|
614
|
+
status, created_at, destroyed_at, metadata
|
|
615
|
+
) VALUES (
|
|
616
|
+
@id, @workflowRunId, @workflowName, @workingPath, @branchName,
|
|
617
|
+
@status, @createdAt, @destroyedAt, @metadata
|
|
618
|
+
)
|
|
619
|
+
`);
|
|
620
|
+
}
|
|
621
|
+
this.stmts.insertIsolationEnv.run({
|
|
622
|
+
id: env.id,
|
|
623
|
+
workflowRunId: env.workflowRunId ?? null,
|
|
624
|
+
workflowName: env.workflowName,
|
|
625
|
+
workingPath: env.workingPath,
|
|
626
|
+
branchName: env.branchName,
|
|
627
|
+
status: env.status,
|
|
628
|
+
createdAt: env.createdAt,
|
|
629
|
+
destroyedAt: env.destroyedAt ?? null,
|
|
630
|
+
metadata: env.metadata ? JSON.stringify(env.metadata) : null,
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
updateIsolationEnv(env) {
|
|
634
|
+
if (!this.stmts.updateIsolationEnv) {
|
|
635
|
+
this.stmts.updateIsolationEnv = this.db.prepare(`
|
|
636
|
+
UPDATE isolation_environments SET
|
|
637
|
+
workflow_run_id = @workflowRunId,
|
|
638
|
+
status = @status,
|
|
639
|
+
destroyed_at = @destroyedAt,
|
|
640
|
+
metadata = @metadata
|
|
641
|
+
WHERE id = @id
|
|
642
|
+
`);
|
|
643
|
+
}
|
|
644
|
+
this.stmts.updateIsolationEnv.run({
|
|
645
|
+
id: env.id,
|
|
646
|
+
workflowRunId: env.workflowRunId ?? null,
|
|
647
|
+
status: env.status,
|
|
648
|
+
destroyedAt: env.destroyedAt ?? null,
|
|
649
|
+
metadata: env.metadata ? JSON.stringify(env.metadata) : null,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
getIsolationEnvById(id) {
|
|
653
|
+
if (!this.stmts.getIsolationEnvById) {
|
|
654
|
+
this.stmts.getIsolationEnvById = this.db.prepare('SELECT * FROM isolation_environments WHERE id = ?');
|
|
655
|
+
}
|
|
656
|
+
const row = this.stmts.getIsolationEnvById.get(id);
|
|
657
|
+
return row ? rowToIsolationEnv(row) : null;
|
|
658
|
+
}
|
|
659
|
+
getActiveIsolationEnvByRun(workflowRunId) {
|
|
660
|
+
if (!this.stmts.getActiveIsolationEnvByRun) {
|
|
661
|
+
this.stmts.getActiveIsolationEnvByRun = this.db.prepare(`SELECT * FROM isolation_environments WHERE workflow_run_id = ? AND status = 'active' LIMIT 1`);
|
|
662
|
+
}
|
|
663
|
+
const row = this.stmts.getActiveIsolationEnvByRun.get(workflowRunId);
|
|
664
|
+
return row ? rowToIsolationEnv(row) : null;
|
|
665
|
+
}
|
|
666
|
+
getAllActiveIsolationEnvs() {
|
|
667
|
+
if (!this.stmts.getAllActiveIsolationEnvs) {
|
|
668
|
+
this.stmts.getAllActiveIsolationEnvs = this.db.prepare(`SELECT * FROM isolation_environments WHERE status = 'active'`);
|
|
669
|
+
}
|
|
670
|
+
const rows = this.stmts.getAllActiveIsolationEnvs.all();
|
|
671
|
+
return rows.map(rowToIsolationEnv);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
exports.SpecQueries = SpecQueries;
|
|
675
|
+
//# sourceMappingURL=spec-queries.js.map
|