@selvakumaresra/specship 0.1.3 → 0.3.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 +79 -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 +2019 -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/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 +87 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +415 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/instructions-template.d.ts +18 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +21 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +98 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +639 -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 +62 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +207 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/types.d.ts +76 -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/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 +3066 -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-2DHIGIOI.js +1 -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-2OKMB4KX.js +2 -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-3SEJX2BK.js +1 -0
- package/dist/web/chunk-42XVAQ6I.js +1 -0
- package/dist/web/chunk-4IMMPEYM.js +1 -0
- package/dist/web/chunk-4N5DWG46.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-AZJVTPLU.js +1 -0
- package/dist/web/chunk-BCZM5AXU.js +1 -0
- package/dist/web/chunk-BLBRMCN2.js +1 -0
- package/dist/web/chunk-BMIAXD2V.js +2 -0
- package/dist/web/chunk-BPECIDVO.js +1 -0
- package/dist/web/chunk-BUXWEHIY.js +1 -0
- package/dist/web/chunk-BYZFQSM6.js +1 -0
- package/dist/web/chunk-DA6SNNAF.js +1 -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-FIJW2UNJ.js +1 -0
- package/dist/web/chunk-FMV5PXRC.js +5 -0
- package/dist/web/chunk-G7VZT5KB.js +3 -0
- package/dist/web/chunk-GRZYXPSO.js +7 -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-JFYVCXK3.js +1 -0
- package/dist/web/chunk-JN6W7HCN.js +17 -0
- package/dist/web/chunk-JT7P3DEK.js +6 -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-LV4G6QFG.js +2 -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-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-RAAMPHPJ.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-TWXZK6XM.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-WDU3WICG.js +1 -0
- package/dist/web/chunk-WFXJIXZE.js +4 -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-YAWCRPHV.js +1 -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-WVI3YTDU.js +1 -0
- package/dist/web/media/codicon-LN6W7LCM.ttf +0 -0
- package/dist/web/styles-KSOPUVDA.css +1 -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 +247 -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/package.json +1 -1
- package/scripts/offline-install.sh +19 -6
- /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,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fastify HTTP server for specship + SpecShip Desktop UI.
|
|
3
|
+
*
|
|
4
|
+
* Routes follow the design spec — `/api/graph/*`, `/api/spec/*`,
|
|
5
|
+
* `/api/drift`, `/api/workflows/*`, `/api/claude/*`. Each route group lives
|
|
6
|
+
* in its own file under `./routes/` and registers itself on a passed
|
|
7
|
+
* Fastify instance.
|
|
8
|
+
*
|
|
9
|
+
* Why Fastify: lighter than Express, faster, first-class TypeScript types,
|
|
10
|
+
* built-in JSON schema validation, plugins for CORS + SSE. The 30K LoC
|
|
11
|
+
* Archon UI port pulls ~20+ API routes — Fastify's plugin model keeps the
|
|
12
|
+
* registration code tidy.
|
|
13
|
+
*/
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { existsSync, promises as fs } from 'node:fs';
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
17
|
+
import Fastify from 'fastify';
|
|
18
|
+
import cors from '@fastify/cors';
|
|
19
|
+
import { startWatcher } from './ingest/index.js';
|
|
20
|
+
import { ProjectRegistry } from './project-registry.js';
|
|
21
|
+
import { makeStaticHandler } from './static-handler.js';
|
|
22
|
+
import { registerGraphRoutes } from './routes/graph.js';
|
|
23
|
+
import { registerSpecRoutes } from './routes/spec.js';
|
|
24
|
+
import { registerWorkflowRoutes } from './routes/workflow.js';
|
|
25
|
+
import { registerClaudeRoutes } from './routes/claude.js';
|
|
26
|
+
import { registerStatusRoutes } from './routes/status.js';
|
|
27
|
+
import { registerMemoryRoutes } from './routes/memory.js';
|
|
28
|
+
import { registerProjectsRoutes } from './routes/projects.js';
|
|
29
|
+
/**
|
|
30
|
+
* Lazy-import the specship core. Two delivery shapes are supported:
|
|
31
|
+
*
|
|
32
|
+
* 1. **Bundled** — the platform-specific npm tarball lays the compiled
|
|
33
|
+
* server out at `<bundle>/lib/dist/server/server.js` and the specship
|
|
34
|
+
* core at `<bundle>/lib/dist/index.js`. We try this relative path
|
|
35
|
+
* first so the bundled mode never depends on Node's package
|
|
36
|
+
* resolution finding `@selvakumaresra/specship` (it won't, the
|
|
37
|
+
* bundle stages a single package by name `@selvakumaresra/specship`).
|
|
38
|
+
*
|
|
39
|
+
* 2. **Workspace / dev** — `packages/server/dist/server.js` imports via
|
|
40
|
+
* the workspace `file:../..` dep. Falls through to the named import.
|
|
41
|
+
*
|
|
42
|
+
* The function caches the resolved module so the lookup only runs once.
|
|
43
|
+
*/
|
|
44
|
+
let cachedSpecShip = null;
|
|
45
|
+
async function loadSpecShip() {
|
|
46
|
+
if (cachedSpecShip)
|
|
47
|
+
return cachedSpecShip;
|
|
48
|
+
// Bundled mode: dist/server/server.js → ../index.js (root dist/index.js).
|
|
49
|
+
try {
|
|
50
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
51
|
+
const candidate = path.resolve(here, '..', 'index.js');
|
|
52
|
+
if (existsSync(candidate)) {
|
|
53
|
+
cachedSpecShip = (await import(pathToFileURL(candidate).href));
|
|
54
|
+
return cachedSpecShip;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch { /* fall through */ }
|
|
58
|
+
// Workspace/dev: resolve via the named dep.
|
|
59
|
+
cachedSpecShip = await import('@selvakumaresra/specship');
|
|
60
|
+
return cachedSpecShip;
|
|
61
|
+
}
|
|
62
|
+
export async function createServer(options) {
|
|
63
|
+
const host = options.host ?? '127.0.0.1';
|
|
64
|
+
const port = options.port ?? 4242;
|
|
65
|
+
const verbose = options.verbose ?? false;
|
|
66
|
+
const app = Fastify({
|
|
67
|
+
logger: verbose
|
|
68
|
+
? { transport: { target: 'pino-pretty', options: { translateTime: 'HH:MM:ss.l' } } }
|
|
69
|
+
: false,
|
|
70
|
+
});
|
|
71
|
+
if (options.cors !== false) {
|
|
72
|
+
// Permissive CORS for local dev. The server is bound to loopback by
|
|
73
|
+
// default, so the broad allowlist is fine — Browsers won't get to it
|
|
74
|
+
// from a non-localhost origin without explicit user override.
|
|
75
|
+
await app.register(cors, {
|
|
76
|
+
origin: true,
|
|
77
|
+
credentials: false,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// Lazy-load specship. Used as the open() impl for the registry, and
|
|
81
|
+
// (only when a primary path is set) to open the primary instance below.
|
|
82
|
+
const cgMod = await loadSpecShip();
|
|
83
|
+
const registry = new ProjectRegistry({ verbose }, (p) => cgMod.SpecShip.open(p));
|
|
84
|
+
// Primary project (optional). When set, specship-scoped routes default to
|
|
85
|
+
// it when no `?project=<slug>` is provided, and the analytics ingest
|
|
86
|
+
// hooks into its SQLite handle.
|
|
87
|
+
let primaryCg = null;
|
|
88
|
+
if (options.projectRoot) {
|
|
89
|
+
primaryCg = await registry.get(options.projectRoot);
|
|
90
|
+
if (!primaryCg && verbose) {
|
|
91
|
+
console.error(`[specship-server] primary project ${options.projectRoot} not initialized — booting projectless`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Start the JSONL ingest watcher in-process unless the caller already
|
|
95
|
+
// provided one or explicitly opted out. Hooks into the primary project's
|
|
96
|
+
// SQLite handle — when there's no primary, analytics endpoints will return
|
|
97
|
+
// 409 until one is set (typically the next server restart with -p).
|
|
98
|
+
let watcher = options.watcher ?? null;
|
|
99
|
+
let ownedWatcher = false;
|
|
100
|
+
if (!watcher && options.ingest !== false && primaryCg) {
|
|
101
|
+
const cgAny = primaryCg;
|
|
102
|
+
const dbHandle = cgAny.db?.getDb ? cgAny.db.getDb() : cgAny.queries?.db;
|
|
103
|
+
if (dbHandle) {
|
|
104
|
+
watcher = startWatcher(dbHandle, { verbose });
|
|
105
|
+
ownedWatcher = true;
|
|
106
|
+
if (verbose)
|
|
107
|
+
console.error('[specship-server] JSONL ingest watcher started');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (!primaryCg && options.ingest !== false && verbose) {
|
|
111
|
+
console.error('[specship-server] no primary project — analytics will be empty until one is set');
|
|
112
|
+
}
|
|
113
|
+
// Decorate the Fastify instance so route handlers can access shared state
|
|
114
|
+
// without globals or DI containers.
|
|
115
|
+
app.decorate('projects', registry);
|
|
116
|
+
app.decorate('primaryCg', primaryCg);
|
|
117
|
+
app.decorate('watcher', watcher);
|
|
118
|
+
// activeCg(req): resolve `?project=<slug>` → SpecShip instance, with the
|
|
119
|
+
// primary as fallback. Returns null when nothing is selectable; route
|
|
120
|
+
// handlers respond 409 in that case.
|
|
121
|
+
app.decorate('activeCg', async function (req) {
|
|
122
|
+
const q = (req.query ?? {});
|
|
123
|
+
if (q.project) {
|
|
124
|
+
const bySlug = await registry.getBySlug(q.project);
|
|
125
|
+
if (bySlug)
|
|
126
|
+
return bySlug;
|
|
127
|
+
}
|
|
128
|
+
if (q.projectPath) {
|
|
129
|
+
const byPath = await registry.get(q.projectPath);
|
|
130
|
+
if (byPath)
|
|
131
|
+
return byPath;
|
|
132
|
+
}
|
|
133
|
+
return primaryCg;
|
|
134
|
+
});
|
|
135
|
+
// Register route groups.
|
|
136
|
+
await registerStatusRoutes(app);
|
|
137
|
+
await registerGraphRoutes(app);
|
|
138
|
+
await registerSpecRoutes(app);
|
|
139
|
+
await registerWorkflowRoutes(app);
|
|
140
|
+
await registerClaudeRoutes(app);
|
|
141
|
+
await registerMemoryRoutes(app);
|
|
142
|
+
await registerProjectsRoutes(app);
|
|
143
|
+
// Optional: serve the built Angular UI from `webDir` and fall back to
|
|
144
|
+
// index.html for client-side routes. Must register AFTER the /api/*
|
|
145
|
+
// routes so they take precedence over the SPA wildcard.
|
|
146
|
+
if (options.webDir) {
|
|
147
|
+
const indexPath = path.join(options.webDir, 'index.html');
|
|
148
|
+
let indexBuffer = null;
|
|
149
|
+
try {
|
|
150
|
+
indexBuffer = await fs.readFile(indexPath);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
if (verbose) {
|
|
154
|
+
console.error(`[specship-server] webDir provided but index.html not found at ${indexPath} — skipping static mount`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (indexBuffer) {
|
|
158
|
+
const cachedIndex = indexBuffer;
|
|
159
|
+
const serveStatic = makeStaticHandler(options.webDir);
|
|
160
|
+
// A single 404 handler does both jobs:
|
|
161
|
+
// 1. Try the requested URL as a real file under webDir → serve it
|
|
162
|
+
// with the right content-type. Covers the SPA's chunk-*.js,
|
|
163
|
+
// styles.css, favicons, fonts, etc.
|
|
164
|
+
// 2. Fall through to index.html for any other GET so Angular's
|
|
165
|
+
// client-side router can take over (`/memory`, `/graph`, …).
|
|
166
|
+
// Non-GET methods and `/api/*` paths still 404 cleanly so the UI
|
|
167
|
+
// can surface them.
|
|
168
|
+
app.setNotFoundHandler((request, reply) => {
|
|
169
|
+
if (request.method !== 'GET') {
|
|
170
|
+
reply.code(404).send({ error: 'not found' });
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (request.url.startsWith('/api/')) {
|
|
174
|
+
reply.code(404).send({ error: 'not found' });
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const hit = serveStatic(request.url);
|
|
178
|
+
if (hit) {
|
|
179
|
+
reply.code(200).type(hit.contentType).send(hit.body);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
reply.code(200).type('text/html').send(cachedIndex);
|
|
183
|
+
});
|
|
184
|
+
if (verbose)
|
|
185
|
+
console.error(`[specship-server] serving SPA from ${options.webDir}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
await app.listen({ host, port });
|
|
189
|
+
const url = `http://${host}:${port}`;
|
|
190
|
+
return {
|
|
191
|
+
app,
|
|
192
|
+
url,
|
|
193
|
+
host,
|
|
194
|
+
port,
|
|
195
|
+
stop: async () => {
|
|
196
|
+
if (ownedWatcher && watcher) {
|
|
197
|
+
try {
|
|
198
|
+
watcher.stop();
|
|
199
|
+
}
|
|
200
|
+
catch { /* ignore */ }
|
|
201
|
+
}
|
|
202
|
+
registry.closeAll();
|
|
203
|
+
await app.close();
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-house static file serving for the desktop SPA. Replaces the
|
|
3
|
+
* `@fastify/static` plugin so we don't pull in `glob` (deprecated maintainer-side
|
|
4
|
+
* across every 10.x and 11.x release, which polluted every user's install
|
|
5
|
+
* with a deprecation warning).
|
|
6
|
+
*
|
|
7
|
+
* Usage from server.ts:
|
|
8
|
+
*
|
|
9
|
+
* const serveStatic = makeStaticHandler(options.webDir);
|
|
10
|
+
* app.setNotFoundHandler((req, reply) => {
|
|
11
|
+
* if (req.method !== 'GET' || req.url.startsWith('/api/')) {
|
|
12
|
+
* reply.code(404).send({ error: 'not found' });
|
|
13
|
+
* return;
|
|
14
|
+
* }
|
|
15
|
+
* const hit = serveStatic(req.url);
|
|
16
|
+
* if (hit) { reply.type(hit.contentType).send(hit.body); return; }
|
|
17
|
+
* reply.code(200).type('text/html').send(cachedIndex);
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* Path traversal is blocked by resolving the requested path inside webDir and
|
|
21
|
+
* rejecting anything that resolves outside.
|
|
22
|
+
*/
|
|
23
|
+
import { readFileSync, statSync } from 'node:fs';
|
|
24
|
+
import path from 'node:path';
|
|
25
|
+
const CT = {
|
|
26
|
+
'.html': 'text/html; charset=utf-8',
|
|
27
|
+
'.htm': 'text/html; charset=utf-8',
|
|
28
|
+
'.js': 'application/javascript; charset=utf-8',
|
|
29
|
+
'.mjs': 'application/javascript; charset=utf-8',
|
|
30
|
+
'.css': 'text/css; charset=utf-8',
|
|
31
|
+
'.json': 'application/json; charset=utf-8',
|
|
32
|
+
'.map': 'application/json; charset=utf-8',
|
|
33
|
+
'.svg': 'image/svg+xml',
|
|
34
|
+
'.png': 'image/png',
|
|
35
|
+
'.jpg': 'image/jpeg',
|
|
36
|
+
'.jpeg': 'image/jpeg',
|
|
37
|
+
'.gif': 'image/gif',
|
|
38
|
+
'.ico': 'image/x-icon',
|
|
39
|
+
'.webp': 'image/webp',
|
|
40
|
+
'.woff': 'font/woff',
|
|
41
|
+
'.woff2': 'font/woff2',
|
|
42
|
+
'.ttf': 'font/ttf',
|
|
43
|
+
'.otf': 'font/otf',
|
|
44
|
+
'.txt': 'text/plain; charset=utf-8',
|
|
45
|
+
'.wasm': 'application/wasm',
|
|
46
|
+
};
|
|
47
|
+
export function makeStaticHandler(rootDir) {
|
|
48
|
+
const absRoot = path.resolve(rootDir);
|
|
49
|
+
return function serveStatic(urlPath) {
|
|
50
|
+
// Strip query/hash — Fastify gives us the raw URL.
|
|
51
|
+
const qIdx = urlPath.indexOf('?');
|
|
52
|
+
const hIdx = urlPath.indexOf('#');
|
|
53
|
+
let clean = urlPath;
|
|
54
|
+
if (qIdx >= 0)
|
|
55
|
+
clean = clean.slice(0, qIdx);
|
|
56
|
+
if (hIdx >= 0)
|
|
57
|
+
clean = clean.slice(0, hIdx);
|
|
58
|
+
// Decode percent-encoding (but reject anything that throws).
|
|
59
|
+
let decoded;
|
|
60
|
+
try {
|
|
61
|
+
decoded = decodeURIComponent(clean);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
// Strip leading slash so path.resolve doesn't escape the root.
|
|
67
|
+
const rel = decoded.replace(/^\/+/, '');
|
|
68
|
+
// Resolve under root and verify containment to block ../../ traversal.
|
|
69
|
+
const candidate = path.resolve(absRoot, rel);
|
|
70
|
+
if (candidate !== absRoot && !candidate.startsWith(absRoot + path.sep)) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
let stat;
|
|
74
|
+
try {
|
|
75
|
+
stat = statSync(candidate);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (!stat.isFile())
|
|
81
|
+
return null;
|
|
82
|
+
const body = readFileSync(candidate);
|
|
83
|
+
const ext = path.extname(candidate).toLowerCase();
|
|
84
|
+
const contentType = CT[ext] ?? 'application/octet-stream';
|
|
85
|
+
return { body, contentType };
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Sync Hooks
|
|
3
|
+
*
|
|
4
|
+
* When the live file watcher is disabled (e.g. on WSL2 `/mnt/*` drives,
|
|
5
|
+
* see watch-policy.ts), the SpecShip index would otherwise go stale until
|
|
6
|
+
* the user runs `specship sync` by hand. As an opt-in alternative, we can
|
|
7
|
+
* install git hooks that refresh the index after the operations that change
|
|
8
|
+
* files on disk: commit, merge (covers `git pull`), and checkout.
|
|
9
|
+
*
|
|
10
|
+
* The hooks run `specship sync` in the background so they never block git,
|
|
11
|
+
* and are guarded by `command -v specship` so they no-op cleanly when the
|
|
12
|
+
* CLI isn't on PATH. Our snippet is delimited by marker comments so install
|
|
13
|
+
* is idempotent and removal preserves any user-authored hook content.
|
|
14
|
+
*/
|
|
15
|
+
export type GitHookName = 'post-commit' | 'post-merge' | 'post-checkout';
|
|
16
|
+
/** Hooks installed by default: commit, merge (git pull), and checkout. */
|
|
17
|
+
export declare const DEFAULT_SYNC_HOOKS: GitHookName[];
|
|
18
|
+
export interface GitHookResult {
|
|
19
|
+
/** Hook names that were created or updated. */
|
|
20
|
+
installed: GitHookName[];
|
|
21
|
+
/** Resolved hooks directory, or null when not a git repo. */
|
|
22
|
+
hooksDir: string | null;
|
|
23
|
+
/** Reason nothing happened (e.g. not a git repository). */
|
|
24
|
+
skipped?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether `projectRoot` is inside a git working tree. Returns false if git
|
|
28
|
+
* isn't installed or the path isn't a repo.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isGitRepo(projectRoot: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Install (or update) the SpecShip sync hooks in a git repository.
|
|
33
|
+
* Idempotent: re-running replaces our marker block rather than duplicating
|
|
34
|
+
* it, and any user-authored hook content is preserved.
|
|
35
|
+
*/
|
|
36
|
+
export declare function installGitSyncHook(projectRoot: string, hooks?: GitHookName[]): GitHookResult;
|
|
37
|
+
/**
|
|
38
|
+
* Remove the SpecShip sync hooks. Strips only our marker block; deletes the
|
|
39
|
+
* hook file entirely when nothing but a shebang remains, otherwise rewrites
|
|
40
|
+
* the user's content untouched.
|
|
41
|
+
*/
|
|
42
|
+
export declare function removeGitSyncHook(projectRoot: string, hooks?: GitHookName[]): GitHookResult;
|
|
43
|
+
/** Whether any SpecShip sync hook is currently installed. */
|
|
44
|
+
export declare function isSyncHookInstalled(projectRoot: string, hooks?: GitHookName[]): boolean;
|
|
45
|
+
//# sourceMappingURL=git-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-hooks.d.ts","sourceRoot":"","sources":["../../src/sync/git-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,YAAY,GAAG,eAAe,CAAC;AAEzE,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAAmD,CAAC;AAEhG,MAAM,WAAW,aAAa;IAC5B,+CAA+C;IAC/C,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAYtD;AAiED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,WAAW,EAAuB,GACxC,aAAa,CAmCf;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,WAAW,EAAuB,GACxC,aAAa,CA0Bf;AAED,6DAA6D;AAC7D,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,WAAW,EAAuB,GACxC,OAAO,CAOT"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Git Sync Hooks
|
|
4
|
+
*
|
|
5
|
+
* When the live file watcher is disabled (e.g. on WSL2 `/mnt/*` drives,
|
|
6
|
+
* see watch-policy.ts), the SpecShip index would otherwise go stale until
|
|
7
|
+
* the user runs `specship sync` by hand. As an opt-in alternative, we can
|
|
8
|
+
* install git hooks that refresh the index after the operations that change
|
|
9
|
+
* files on disk: commit, merge (covers `git pull`), and checkout.
|
|
10
|
+
*
|
|
11
|
+
* The hooks run `specship sync` in the background so they never block git,
|
|
12
|
+
* and are guarded by `command -v specship` so they no-op cleanly when the
|
|
13
|
+
* CLI isn't on PATH. Our snippet is delimited by marker comments so install
|
|
14
|
+
* is idempotent and removal preserves any user-authored hook content.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.DEFAULT_SYNC_HOOKS = void 0;
|
|
51
|
+
exports.isGitRepo = isGitRepo;
|
|
52
|
+
exports.installGitSyncHook = installGitSyncHook;
|
|
53
|
+
exports.removeGitSyncHook = removeGitSyncHook;
|
|
54
|
+
exports.isSyncHookInstalled = isSyncHookInstalled;
|
|
55
|
+
const fs = __importStar(require("fs"));
|
|
56
|
+
const path = __importStar(require("path"));
|
|
57
|
+
const child_process_1 = require("child_process");
|
|
58
|
+
const MARKER_BEGIN = '# >>> specship sync hook >>>';
|
|
59
|
+
const MARKER_END = '# <<< specship sync hook <<<';
|
|
60
|
+
/** Hooks installed by default: commit, merge (git pull), and checkout. */
|
|
61
|
+
exports.DEFAULT_SYNC_HOOKS = ['post-commit', 'post-merge', 'post-checkout'];
|
|
62
|
+
/**
|
|
63
|
+
* Whether `projectRoot` is inside a git working tree. Returns false if git
|
|
64
|
+
* isn't installed or the path isn't a repo.
|
|
65
|
+
*/
|
|
66
|
+
function isGitRepo(projectRoot) {
|
|
67
|
+
try {
|
|
68
|
+
const out = (0, child_process_1.execFileSync)('git', ['rev-parse', '--is-inside-work-tree'], {
|
|
69
|
+
cwd: projectRoot,
|
|
70
|
+
encoding: 'utf8',
|
|
71
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
72
|
+
windowsHide: true,
|
|
73
|
+
}).trim();
|
|
74
|
+
return out === 'true';
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Resolve the git hooks directory for a project, honoring `core.hooksPath`
|
|
82
|
+
* and git worktrees. Returns an absolute path, or null when not a repo.
|
|
83
|
+
*/
|
|
84
|
+
function gitHooksDir(projectRoot) {
|
|
85
|
+
try {
|
|
86
|
+
const out = (0, child_process_1.execFileSync)('git', ['rev-parse', '--git-path', 'hooks'], {
|
|
87
|
+
cwd: projectRoot,
|
|
88
|
+
encoding: 'utf8',
|
|
89
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
90
|
+
windowsHide: true,
|
|
91
|
+
}).trim();
|
|
92
|
+
if (!out)
|
|
93
|
+
return null;
|
|
94
|
+
return path.isAbsolute(out) ? out : path.resolve(projectRoot, out);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** The shell snippet (between markers) injected into each hook. */
|
|
101
|
+
function markerBlock() {
|
|
102
|
+
return [
|
|
103
|
+
MARKER_BEGIN,
|
|
104
|
+
'# Keeps the SpecShip index fresh while the live file watcher is off',
|
|
105
|
+
'# (e.g. WSL2 /mnt drives). Runs in the background so it never blocks git.',
|
|
106
|
+
'# Managed by specship; remove with `specship uninit` or delete this block.',
|
|
107
|
+
'if command -v specship >/dev/null 2>&1; then',
|
|
108
|
+
' ( specship sync >/dev/null 2>&1 & ) >/dev/null 2>&1',
|
|
109
|
+
'fi',
|
|
110
|
+
MARKER_END,
|
|
111
|
+
].join('\n');
|
|
112
|
+
}
|
|
113
|
+
/** Remove our marker block (and the marker lines) from hook content. */
|
|
114
|
+
function stripMarkerBlock(content) {
|
|
115
|
+
const lines = content.split('\n');
|
|
116
|
+
const kept = [];
|
|
117
|
+
let inBlock = false;
|
|
118
|
+
for (const line of lines) {
|
|
119
|
+
const trimmed = line.trim();
|
|
120
|
+
if (trimmed === MARKER_BEGIN) {
|
|
121
|
+
inBlock = true;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (trimmed === MARKER_END) {
|
|
125
|
+
inBlock = false;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (!inBlock)
|
|
129
|
+
kept.push(line);
|
|
130
|
+
}
|
|
131
|
+
return kept.join('\n');
|
|
132
|
+
}
|
|
133
|
+
/** Whether a hook body is just a shebang / blank lines (i.e. only ever ours). */
|
|
134
|
+
function isEffectivelyEmpty(content) {
|
|
135
|
+
return content
|
|
136
|
+
.split('\n')
|
|
137
|
+
.map((l) => l.trim())
|
|
138
|
+
.every((l) => l.length === 0 || l.startsWith('#!'));
|
|
139
|
+
}
|
|
140
|
+
function chmodExecutable(file) {
|
|
141
|
+
try {
|
|
142
|
+
fs.chmodSync(file, 0o755);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
/* chmod is a no-op / unsupported on some platforms (e.g. Windows) */
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Install (or update) the SpecShip sync hooks in a git repository.
|
|
150
|
+
* Idempotent: re-running replaces our marker block rather than duplicating
|
|
151
|
+
* it, and any user-authored hook content is preserved.
|
|
152
|
+
*/
|
|
153
|
+
function installGitSyncHook(projectRoot, hooks = exports.DEFAULT_SYNC_HOOKS) {
|
|
154
|
+
const hooksDir = gitHooksDir(projectRoot);
|
|
155
|
+
if (!hooksDir) {
|
|
156
|
+
return { installed: [], hooksDir: null, skipped: 'not a git repository' };
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
fs.mkdirSync(hooksDir, { recursive: true });
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return { installed: [], hooksDir, skipped: 'could not access the git hooks directory' };
|
|
163
|
+
}
|
|
164
|
+
const block = markerBlock();
|
|
165
|
+
const installed = [];
|
|
166
|
+
for (const hook of hooks) {
|
|
167
|
+
const file = path.join(hooksDir, hook);
|
|
168
|
+
let content;
|
|
169
|
+
if (fs.existsSync(file)) {
|
|
170
|
+
// Strip any prior block, then re-append the current one.
|
|
171
|
+
const base = stripMarkerBlock(fs.readFileSync(file, 'utf8')).replace(/\s*$/, '');
|
|
172
|
+
content = base.length > 0
|
|
173
|
+
? `${base}\n\n${block}\n`
|
|
174
|
+
: `#!/bin/sh\n${block}\n`;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
content = `#!/bin/sh\n${block}\n`;
|
|
178
|
+
}
|
|
179
|
+
fs.writeFileSync(file, content);
|
|
180
|
+
chmodExecutable(file);
|
|
181
|
+
installed.push(hook);
|
|
182
|
+
}
|
|
183
|
+
return { installed, hooksDir };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Remove the SpecShip sync hooks. Strips only our marker block; deletes the
|
|
187
|
+
* hook file entirely when nothing but a shebang remains, otherwise rewrites
|
|
188
|
+
* the user's content untouched.
|
|
189
|
+
*/
|
|
190
|
+
function removeGitSyncHook(projectRoot, hooks = exports.DEFAULT_SYNC_HOOKS) {
|
|
191
|
+
const hooksDir = gitHooksDir(projectRoot);
|
|
192
|
+
if (!hooksDir) {
|
|
193
|
+
return { installed: [], hooksDir: null, skipped: 'not a git repository' };
|
|
194
|
+
}
|
|
195
|
+
const removed = [];
|
|
196
|
+
for (const hook of hooks) {
|
|
197
|
+
const file = path.join(hooksDir, hook);
|
|
198
|
+
if (!fs.existsSync(file))
|
|
199
|
+
continue;
|
|
200
|
+
const original = fs.readFileSync(file, 'utf8');
|
|
201
|
+
if (!original.includes(MARKER_BEGIN))
|
|
202
|
+
continue;
|
|
203
|
+
const stripped = stripMarkerBlock(original);
|
|
204
|
+
if (isEffectivelyEmpty(stripped)) {
|
|
205
|
+
fs.unlinkSync(file);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
fs.writeFileSync(file, `${stripped.replace(/\s*$/, '')}\n`);
|
|
209
|
+
chmodExecutable(file);
|
|
210
|
+
}
|
|
211
|
+
removed.push(hook);
|
|
212
|
+
}
|
|
213
|
+
return { installed: removed, hooksDir };
|
|
214
|
+
}
|
|
215
|
+
/** Whether any SpecShip sync hook is currently installed. */
|
|
216
|
+
function isSyncHookInstalled(projectRoot, hooks = exports.DEFAULT_SYNC_HOOKS) {
|
|
217
|
+
const hooksDir = gitHooksDir(projectRoot);
|
|
218
|
+
if (!hooksDir)
|
|
219
|
+
return false;
|
|
220
|
+
return hooks.some((hook) => {
|
|
221
|
+
const file = path.join(hooksDir, hook);
|
|
222
|
+
return fs.existsSync(file) && fs.readFileSync(file, 'utf8').includes(MARKER_BEGIN);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=git-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-hooks.js","sourceRoot":"","sources":["../../src/sync/git-hooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BH,8BAYC;AAsED,gDAsCC;AAOD,8CA6BC;AAGD,kDAUC;AAlMD,uCAAyB;AACzB,2CAA6B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I,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC1C,CAAC;AAED,6DAA6D;AAC7D,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,QAAuB,0BAAkB;IAEzC,MAAM,QAAQ,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACvC,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Module
|
|
3
|
+
*
|
|
4
|
+
* Provides synchronization functionality for keeping the code graph
|
|
5
|
+
* up-to-date with file system changes.
|
|
6
|
+
*
|
|
7
|
+
* Components:
|
|
8
|
+
* - FileWatcher: Debounced fs.watch that auto-triggers sync on file changes
|
|
9
|
+
* - Watch policy: decides when the watcher must be disabled (e.g. WSL2 /mnt)
|
|
10
|
+
* - Git sync hooks: opt-in commit/merge/checkout hooks when watching is off
|
|
11
|
+
* - Git worktree awareness: detect when a query borrows another tree's index
|
|
12
|
+
* - Content hashing for change detection (in extraction module)
|
|
13
|
+
* - Incremental reindexing (in extraction module)
|
|
14
|
+
*/
|
|
15
|
+
export { FileWatcher, WatchOptions, PendingFile, LockUnavailableError } from './watcher';
|
|
16
|
+
export { watchDisabledReason, detectWsl } from './watch-policy';
|
|
17
|
+
export { installGitSyncHook, removeGitSyncHook, isSyncHookInstalled, isGitRepo, DEFAULT_SYNC_HOOKS, type GitHookName, type GitHookResult, } from './git-hooks';
|
|
18
|
+
export { gitWorktreeRoot, detectWorktreeIndexMismatch, worktreeMismatchWarning, worktreeMismatchNotice, type WorktreeIndexMismatch, } from './worktree';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Sync Module
|
|
4
|
+
*
|
|
5
|
+
* Provides synchronization functionality for keeping the code graph
|
|
6
|
+
* up-to-date with file system changes.
|
|
7
|
+
*
|
|
8
|
+
* Components:
|
|
9
|
+
* - FileWatcher: Debounced fs.watch that auto-triggers sync on file changes
|
|
10
|
+
* - Watch policy: decides when the watcher must be disabled (e.g. WSL2 /mnt)
|
|
11
|
+
* - Git sync hooks: opt-in commit/merge/checkout hooks when watching is off
|
|
12
|
+
* - Git worktree awareness: detect when a query borrows another tree's index
|
|
13
|
+
* - Content hashing for change detection (in extraction module)
|
|
14
|
+
* - Incremental reindexing (in extraction module)
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.worktreeMismatchNotice = exports.worktreeMismatchWarning = exports.detectWorktreeIndexMismatch = exports.gitWorktreeRoot = exports.DEFAULT_SYNC_HOOKS = exports.isGitRepo = exports.isSyncHookInstalled = exports.removeGitSyncHook = exports.installGitSyncHook = exports.detectWsl = exports.watchDisabledReason = exports.LockUnavailableError = exports.FileWatcher = void 0;
|
|
18
|
+
var watcher_1 = require("./watcher");
|
|
19
|
+
Object.defineProperty(exports, "FileWatcher", { enumerable: true, get: function () { return watcher_1.FileWatcher; } });
|
|
20
|
+
Object.defineProperty(exports, "LockUnavailableError", { enumerable: true, get: function () { return watcher_1.LockUnavailableError; } });
|
|
21
|
+
var watch_policy_1 = require("./watch-policy");
|
|
22
|
+
Object.defineProperty(exports, "watchDisabledReason", { enumerable: true, get: function () { return watch_policy_1.watchDisabledReason; } });
|
|
23
|
+
Object.defineProperty(exports, "detectWsl", { enumerable: true, get: function () { return watch_policy_1.detectWsl; } });
|
|
24
|
+
var git_hooks_1 = require("./git-hooks");
|
|
25
|
+
Object.defineProperty(exports, "installGitSyncHook", { enumerable: true, get: function () { return git_hooks_1.installGitSyncHook; } });
|
|
26
|
+
Object.defineProperty(exports, "removeGitSyncHook", { enumerable: true, get: function () { return git_hooks_1.removeGitSyncHook; } });
|
|
27
|
+
Object.defineProperty(exports, "isSyncHookInstalled", { enumerable: true, get: function () { return git_hooks_1.isSyncHookInstalled; } });
|
|
28
|
+
Object.defineProperty(exports, "isGitRepo", { enumerable: true, get: function () { return git_hooks_1.isGitRepo; } });
|
|
29
|
+
Object.defineProperty(exports, "DEFAULT_SYNC_HOOKS", { enumerable: true, get: function () { return git_hooks_1.DEFAULT_SYNC_HOOKS; } });
|
|
30
|
+
var worktree_1 = require("./worktree");
|
|
31
|
+
Object.defineProperty(exports, "gitWorktreeRoot", { enumerable: true, get: function () { return worktree_1.gitWorktreeRoot; } });
|
|
32
|
+
Object.defineProperty(exports, "detectWorktreeIndexMismatch", { enumerable: true, get: function () { return worktree_1.detectWorktreeIndexMismatch; } });
|
|
33
|
+
Object.defineProperty(exports, "worktreeMismatchWarning", { enumerable: true, get: function () { return worktree_1.worktreeMismatchWarning; } });
|
|
34
|
+
Object.defineProperty(exports, "worktreeMismatchNotice", { enumerable: true, get: function () { return worktree_1.worktreeMismatchNotice; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,qCAAyF;AAAhF,sGAAA,WAAW,OAAA;AAA6B,+GAAA,oBAAoB,OAAA;AACrE,+CAAgE;AAAvD,mHAAA,mBAAmB,OAAA;AAAE,yGAAA,SAAS,OAAA;AACvC,yCAQqB;AAPnB,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AACnB,sGAAA,SAAS,OAAA;AACT,+GAAA,kBAAkB,OAAA;AAIpB,uCAMoB;AALlB,2GAAA,eAAe,OAAA;AACf,uHAAA,2BAA2B,OAAA;AAC3B,mHAAA,uBAAuB,OAAA;AACvB,kHAAA,sBAAsB,OAAA"}
|