opentasks 0.0.1 → 0.0.3
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 +344 -1
- package/dist/__tests__/cli-tools.test.d.ts +8 -0
- package/dist/__tests__/cli-tools.test.d.ts.map +1 -0
- package/dist/__tests__/cli-tools.test.js +546 -0
- package/dist/__tests__/cli-tools.test.js.map +1 -0
- package/dist/__tests__/cli.test.d.ts +5 -0
- package/dist/__tests__/cli.test.d.ts.map +1 -0
- package/dist/__tests__/cli.test.js +77 -0
- package/dist/__tests__/cli.test.js.map +1 -0
- package/dist/__tests__/p1-p3-gaps.test.d.ts +2 -0
- package/dist/__tests__/p1-p3-gaps.test.d.ts.map +1 -0
- package/dist/__tests__/p1-p3-gaps.test.js +463 -0
- package/dist/__tests__/p1-p3-gaps.test.js.map +1 -0
- package/dist/cli.d.ts +19 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +702 -23
- package/dist/cli.js.map +1 -1
- package/dist/client/__tests__/client-crud.test.d.ts +7 -0
- package/dist/client/__tests__/client-crud.test.d.ts.map +1 -0
- package/dist/client/__tests__/client-crud.test.js +404 -0
- package/dist/client/__tests__/client-crud.test.js.map +1 -0
- package/dist/client/__tests__/client.test.d.ts +5 -0
- package/dist/client/__tests__/client.test.d.ts.map +1 -0
- package/dist/client/__tests__/client.test.js +518 -0
- package/dist/client/__tests__/client.test.js.map +1 -0
- package/dist/client/client.d.ts +228 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +393 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +9 -0
- package/dist/client/index.js.map +1 -0
- package/dist/config/__tests__/defaults.test.d.ts +2 -0
- package/dist/config/__tests__/defaults.test.d.ts.map +1 -0
- package/dist/config/__tests__/defaults.test.js +57 -0
- package/dist/config/__tests__/defaults.test.js.map +1 -0
- package/dist/config/__tests__/env.test.d.ts +2 -0
- package/dist/config/__tests__/env.test.d.ts.map +1 -0
- package/dist/config/__tests__/env.test.js +136 -0
- package/dist/config/__tests__/env.test.js.map +1 -0
- package/dist/config/__tests__/index.test.d.ts +2 -0
- package/dist/config/__tests__/index.test.d.ts.map +1 -0
- package/dist/config/__tests__/index.test.js +113 -0
- package/dist/config/__tests__/index.test.js.map +1 -0
- package/dist/config/__tests__/loader.test.d.ts +2 -0
- package/dist/config/__tests__/loader.test.d.ts.map +1 -0
- package/dist/config/__tests__/loader.test.js +128 -0
- package/dist/config/__tests__/loader.test.js.map +1 -0
- package/dist/config/__tests__/merge.test.d.ts +2 -0
- package/dist/config/__tests__/merge.test.d.ts.map +1 -0
- package/dist/config/__tests__/merge.test.js +79 -0
- package/dist/config/__tests__/merge.test.js.map +1 -0
- package/dist/config/__tests__/schema.test.d.ts +2 -0
- package/dist/config/__tests__/schema.test.d.ts.map +1 -0
- package/dist/config/__tests__/schema.test.js +300 -0
- package/dist/config/__tests__/schema.test.js.map +1 -0
- package/dist/config/defaults.d.ts +13 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +15 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/env.d.ts +14 -0
- package/dist/config/env.d.ts.map +1 -0
- package/dist/config/env.js +130 -0
- package/dist/config/env.js.map +1 -0
- package/dist/config/errors.d.ts +21 -0
- package/dist/config/errors.d.ts.map +1 -0
- package/dist/config/errors.js +30 -0
- package/dist/config/errors.js.map +1 -0
- package/dist/config/index.d.ts +21 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +41 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +87 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/merge.d.ts +12 -0
- package/dist/config/merge.d.ts.map +1 -0
- package/dist/config/merge.js +54 -0
- package/dist/config/merge.js.map +1 -0
- package/dist/config/schema.d.ts +644 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +491 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/core/__tests__/conditional-redirects.test.d.ts +2 -0
- package/dist/core/__tests__/conditional-redirects.test.d.ts.map +1 -0
- package/dist/core/__tests__/conditional-redirects.test.js +83 -0
- package/dist/core/__tests__/conditional-redirects.test.js.map +1 -0
- package/dist/core/__tests__/connections.test.d.ts +2 -0
- package/dist/core/__tests__/connections.test.d.ts.map +1 -0
- package/dist/core/__tests__/connections.test.js +158 -0
- package/dist/core/__tests__/connections.test.js.map +1 -0
- package/dist/core/__tests__/hash.test.d.ts +2 -0
- package/dist/core/__tests__/hash.test.d.ts.map +1 -0
- package/dist/core/__tests__/hash.test.js +139 -0
- package/dist/core/__tests__/hash.test.js.map +1 -0
- package/dist/core/__tests__/id.test.d.ts +2 -0
- package/dist/core/__tests__/id.test.d.ts.map +1 -0
- package/dist/core/__tests__/id.test.js +142 -0
- package/dist/core/__tests__/id.test.js.map +1 -0
- package/dist/core/__tests__/location.test.d.ts +2 -0
- package/dist/core/__tests__/location.test.d.ts.map +1 -0
- package/dist/core/__tests__/location.test.js +77 -0
- package/dist/core/__tests__/location.test.js.map +1 -0
- package/dist/core/__tests__/merge-driver.test.d.ts +2 -0
- package/dist/core/__tests__/merge-driver.test.d.ts.map +1 -0
- package/dist/core/__tests__/merge-driver.test.js +218 -0
- package/dist/core/__tests__/merge-driver.test.js.map +1 -0
- package/dist/core/__tests__/redirects.test.d.ts +2 -0
- package/dist/core/__tests__/redirects.test.d.ts.map +1 -0
- package/dist/core/__tests__/redirects.test.js +123 -0
- package/dist/core/__tests__/redirects.test.js.map +1 -0
- package/dist/core/__tests__/resolve-location-target.test.d.ts +8 -0
- package/dist/core/__tests__/resolve-location-target.test.d.ts.map +1 -0
- package/dist/core/__tests__/resolve-location-target.test.js +303 -0
- package/dist/core/__tests__/resolve-location-target.test.js.map +1 -0
- package/dist/core/__tests__/uri.test.d.ts +2 -0
- package/dist/core/__tests__/uri.test.d.ts.map +1 -0
- package/dist/core/__tests__/uri.test.js +159 -0
- package/dist/core/__tests__/uri.test.js.map +1 -0
- package/dist/core/__tests__/worktree.test.d.ts +2 -0
- package/dist/core/__tests__/worktree.test.d.ts.map +1 -0
- package/dist/core/__tests__/worktree.test.js +120 -0
- package/dist/core/__tests__/worktree.test.js.map +1 -0
- package/dist/core/conditional-redirects.d.ts +42 -0
- package/dist/core/conditional-redirects.d.ts.map +1 -0
- package/dist/core/conditional-redirects.js +59 -0
- package/dist/core/conditional-redirects.js.map +1 -0
- package/dist/core/connections.d.ts +87 -0
- package/dist/core/connections.d.ts.map +1 -0
- package/dist/core/connections.js +160 -0
- package/dist/core/connections.js.map +1 -0
- package/dist/core/discover.d.ts +39 -0
- package/dist/core/discover.d.ts.map +1 -0
- package/dist/core/discover.js +136 -0
- package/dist/core/discover.js.map +1 -0
- package/dist/core/hash.d.ts +25 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +62 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/id.d.ts +79 -0
- package/dist/core/id.d.ts.map +1 -0
- package/dist/core/id.js +141 -0
- package/dist/core/id.js.map +1 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +24 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/location.d.ts +70 -0
- package/dist/core/location.d.ts.map +1 -0
- package/dist/core/location.js +121 -0
- package/dist/core/location.js.map +1 -0
- package/dist/core/merge-driver.d.ts +50 -0
- package/dist/core/merge-driver.d.ts.map +1 -0
- package/dist/core/merge-driver.js +258 -0
- package/dist/core/merge-driver.js.map +1 -0
- package/dist/core/redirects.d.ts +91 -0
- package/dist/core/redirects.d.ts.map +1 -0
- package/dist/core/redirects.js +113 -0
- package/dist/core/redirects.js.map +1 -0
- package/dist/core/uri.d.ts +105 -0
- package/dist/core/uri.d.ts.map +1 -0
- package/dist/core/uri.js +190 -0
- package/dist/core/uri.js.map +1 -0
- package/dist/core/worktree.d.ts +106 -0
- package/dist/core/worktree.d.ts.map +1 -0
- package/dist/core/worktree.js +394 -0
- package/dist/core/worktree.js.map +1 -0
- package/dist/daemon/__tests__/flush.test.d.ts +5 -0
- package/dist/daemon/__tests__/flush.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/flush.test.js +213 -0
- package/dist/daemon/__tests__/flush.test.js.map +1 -0
- package/dist/daemon/__tests__/integration.test.d.ts +7 -0
- package/dist/daemon/__tests__/integration.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/integration.test.js +276 -0
- package/dist/daemon/__tests__/integration.test.js.map +1 -0
- package/dist/daemon/__tests__/ipc.test.d.ts +5 -0
- package/dist/daemon/__tests__/ipc.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/ipc.test.js +314 -0
- package/dist/daemon/__tests__/ipc.test.js.map +1 -0
- package/dist/daemon/__tests__/lifecycle.test.d.ts +5 -0
- package/dist/daemon/__tests__/lifecycle.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/lifecycle.test.js +301 -0
- package/dist/daemon/__tests__/lifecycle.test.js.map +1 -0
- package/dist/daemon/__tests__/lock.test.d.ts +5 -0
- package/dist/daemon/__tests__/lock.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/lock.test.js +192 -0
- package/dist/daemon/__tests__/lock.test.js.map +1 -0
- package/dist/daemon/__tests__/methods/graph.test.d.ts +5 -0
- package/dist/daemon/__tests__/methods/graph.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/methods/graph.test.js +309 -0
- package/dist/daemon/__tests__/methods/graph.test.js.map +1 -0
- package/dist/daemon/__tests__/methods/provider.test.d.ts +7 -0
- package/dist/daemon/__tests__/methods/provider.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/methods/provider.test.js +181 -0
- package/dist/daemon/__tests__/methods/provider.test.js.map +1 -0
- package/dist/daemon/__tests__/methods/tools.test.d.ts +5 -0
- package/dist/daemon/__tests__/methods/tools.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/methods/tools.test.js +587 -0
- package/dist/daemon/__tests__/methods/tools.test.js.map +1 -0
- package/dist/daemon/__tests__/multi-location.test.d.ts +8 -0
- package/dist/daemon/__tests__/multi-location.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/multi-location.test.js +669 -0
- package/dist/daemon/__tests__/multi-location.test.js.map +1 -0
- package/dist/daemon/__tests__/registry.test.d.ts +5 -0
- package/dist/daemon/__tests__/registry.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/registry.test.js +208 -0
- package/dist/daemon/__tests__/registry.test.js.map +1 -0
- package/dist/daemon/__tests__/watcher.test.d.ts +5 -0
- package/dist/daemon/__tests__/watcher.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/watcher.test.js +234 -0
- package/dist/daemon/__tests__/watcher.test.js.map +1 -0
- package/dist/daemon/entire-linker.d.ts +68 -0
- package/dist/daemon/entire-linker.d.ts.map +1 -0
- package/dist/daemon/entire-linker.js +439 -0
- package/dist/daemon/entire-linker.js.map +1 -0
- package/dist/daemon/entire-watcher.d.ts +66 -0
- package/dist/daemon/entire-watcher.d.ts.map +1 -0
- package/dist/daemon/entire-watcher.js +258 -0
- package/dist/daemon/entire-watcher.js.map +1 -0
- package/dist/daemon/factory.d.ts +59 -0
- package/dist/daemon/factory.d.ts.map +1 -0
- package/dist/daemon/factory.js +72 -0
- package/dist/daemon/factory.js.map +1 -0
- package/dist/daemon/flush.d.ts +51 -0
- package/dist/daemon/flush.d.ts.map +1 -0
- package/dist/daemon/flush.js +89 -0
- package/dist/daemon/flush.js.map +1 -0
- package/dist/daemon/index.d.ts +39 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +24 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/ipc.d.ts +97 -0
- package/dist/daemon/ipc.d.ts.map +1 -0
- package/dist/daemon/ipc.js +304 -0
- package/dist/daemon/ipc.js.map +1 -0
- package/dist/daemon/lifecycle.d.ts +85 -0
- package/dist/daemon/lifecycle.d.ts.map +1 -0
- package/dist/daemon/lifecycle.js +754 -0
- package/dist/daemon/lifecycle.js.map +1 -0
- package/dist/daemon/location-state.d.ts +85 -0
- package/dist/daemon/location-state.d.ts.map +1 -0
- package/dist/daemon/location-state.js +291 -0
- package/dist/daemon/location-state.js.map +1 -0
- package/dist/daemon/lock.d.ts +29 -0
- package/dist/daemon/lock.d.ts.map +1 -0
- package/dist/daemon/lock.js +131 -0
- package/dist/daemon/lock.js.map +1 -0
- package/dist/daemon/methods/__tests__/graph.test.d.ts +5 -0
- package/dist/daemon/methods/__tests__/graph.test.d.ts.map +1 -0
- package/dist/daemon/methods/__tests__/graph.test.js +274 -0
- package/dist/daemon/methods/__tests__/graph.test.js.map +1 -0
- package/dist/daemon/methods/__tests__/provider.test.d.ts +5 -0
- package/dist/daemon/methods/__tests__/provider.test.d.ts.map +1 -0
- package/dist/daemon/methods/__tests__/provider.test.js +184 -0
- package/dist/daemon/methods/__tests__/provider.test.js.map +1 -0
- package/dist/daemon/methods/__tests__/tools.test.d.ts +5 -0
- package/dist/daemon/methods/__tests__/tools.test.d.ts.map +1 -0
- package/dist/daemon/methods/__tests__/tools.test.js +295 -0
- package/dist/daemon/methods/__tests__/tools.test.js.map +1 -0
- package/dist/daemon/methods/archive.d.ts +22 -0
- package/dist/daemon/methods/archive.d.ts.map +1 -0
- package/dist/daemon/methods/archive.js +107 -0
- package/dist/daemon/methods/archive.js.map +1 -0
- package/dist/daemon/methods/graph.d.ts +26 -0
- package/dist/daemon/methods/graph.d.ts.map +1 -0
- package/dist/daemon/methods/graph.js +157 -0
- package/dist/daemon/methods/graph.js.map +1 -0
- package/dist/daemon/methods/lifecycle.d.ts +54 -0
- package/dist/daemon/methods/lifecycle.d.ts.map +1 -0
- package/dist/daemon/methods/lifecycle.js +46 -0
- package/dist/daemon/methods/lifecycle.js.map +1 -0
- package/dist/daemon/methods/location.d.ts +24 -0
- package/dist/daemon/methods/location.d.ts.map +1 -0
- package/dist/daemon/methods/location.js +72 -0
- package/dist/daemon/methods/location.js.map +1 -0
- package/dist/daemon/methods/provider.d.ts +22 -0
- package/dist/daemon/methods/provider.d.ts.map +1 -0
- package/dist/daemon/methods/provider.js +72 -0
- package/dist/daemon/methods/provider.js.map +1 -0
- package/dist/daemon/methods/tools.d.ts +23 -0
- package/dist/daemon/methods/tools.d.ts.map +1 -0
- package/dist/daemon/methods/tools.js +111 -0
- package/dist/daemon/methods/tools.js.map +1 -0
- package/dist/daemon/registry.d.ts +35 -0
- package/dist/daemon/registry.d.ts.map +1 -0
- package/dist/daemon/registry.js +189 -0
- package/dist/daemon/registry.js.map +1 -0
- package/dist/daemon/types.d.ts +101 -0
- package/dist/daemon/types.d.ts.map +1 -0
- package/dist/daemon/types.js +19 -0
- package/dist/daemon/types.js.map +1 -0
- package/dist/daemon/watcher.d.ts +62 -0
- package/dist/daemon/watcher.d.ts.map +1 -0
- package/dist/daemon/watcher.js +142 -0
- package/dist/daemon/watcher.js.map +1 -0
- package/dist/graph/EdgeTypeRegistry.d.ts +134 -0
- package/dist/graph/EdgeTypeRegistry.d.ts.map +1 -0
- package/dist/graph/EdgeTypeRegistry.js +255 -0
- package/dist/graph/EdgeTypeRegistry.js.map +1 -0
- package/dist/graph/FederatedGraph.d.ts +296 -0
- package/dist/graph/FederatedGraph.d.ts.map +1 -0
- package/dist/graph/FederatedGraph.js +406 -0
- package/dist/graph/FederatedGraph.js.map +1 -0
- package/dist/graph/GraphologyAdapter.d.ts +151 -0
- package/dist/graph/GraphologyAdapter.d.ts.map +1 -0
- package/dist/graph/GraphologyAdapter.js +209 -0
- package/dist/graph/GraphologyAdapter.js.map +1 -0
- package/dist/graph/HydratingFederatedGraph.d.ts +151 -0
- package/dist/graph/HydratingFederatedGraph.d.ts.map +1 -0
- package/dist/graph/HydratingFederatedGraph.js +327 -0
- package/dist/graph/HydratingFederatedGraph.js.map +1 -0
- package/dist/graph/__tests__/EdgeTypeRegistry.test.d.ts +2 -0
- package/dist/graph/__tests__/EdgeTypeRegistry.test.d.ts.map +1 -0
- package/dist/graph/__tests__/EdgeTypeRegistry.test.js +212 -0
- package/dist/graph/__tests__/EdgeTypeRegistry.test.js.map +1 -0
- package/dist/graph/__tests__/FederatedGraph.test.d.ts +2 -0
- package/dist/graph/__tests__/FederatedGraph.test.d.ts.map +1 -0
- package/dist/graph/__tests__/FederatedGraph.test.js +661 -0
- package/dist/graph/__tests__/FederatedGraph.test.js.map +1 -0
- package/dist/graph/__tests__/GraphologyAdapter.test.d.ts +2 -0
- package/dist/graph/__tests__/GraphologyAdapter.test.d.ts.map +1 -0
- package/dist/graph/__tests__/GraphologyAdapter.test.js +326 -0
- package/dist/graph/__tests__/GraphologyAdapter.test.js.map +1 -0
- package/dist/graph/__tests__/HydratingFederatedGraph.test.d.ts +2 -0
- package/dist/graph/__tests__/HydratingFederatedGraph.test.d.ts.map +1 -0
- package/dist/graph/__tests__/HydratingFederatedGraph.test.js +587 -0
- package/dist/graph/__tests__/HydratingFederatedGraph.test.js.map +1 -0
- package/dist/graph/__tests__/debounce.test.d.ts +5 -0
- package/dist/graph/__tests__/debounce.test.d.ts.map +1 -0
- package/dist/graph/__tests__/debounce.test.js +195 -0
- package/dist/graph/__tests__/debounce.test.js.map +1 -0
- package/dist/graph/__tests__/edge-cases.test.d.ts +8 -0
- package/dist/graph/__tests__/edge-cases.test.d.ts.map +1 -0
- package/dist/graph/__tests__/edge-cases.test.js +472 -0
- package/dist/graph/__tests__/edge-cases.test.js.map +1 -0
- package/dist/graph/__tests__/expansion.test.d.ts +2 -0
- package/dist/graph/__tests__/expansion.test.d.ts.map +1 -0
- package/dist/graph/__tests__/expansion.test.js +105 -0
- package/dist/graph/__tests__/expansion.test.js.map +1 -0
- package/dist/graph/__tests__/provider-store.test.d.ts +5 -0
- package/dist/graph/__tests__/provider-store.test.d.ts.map +1 -0
- package/dist/graph/__tests__/provider-store.test.js +791 -0
- package/dist/graph/__tests__/provider-store.test.js.map +1 -0
- package/dist/graph/__tests__/query.test.d.ts +5 -0
- package/dist/graph/__tests__/query.test.d.ts.map +1 -0
- package/dist/graph/__tests__/query.test.js +774 -0
- package/dist/graph/__tests__/query.test.js.map +1 -0
- package/dist/graph/__tests__/store.test.d.ts +5 -0
- package/dist/graph/__tests__/store.test.d.ts.map +1 -0
- package/dist/graph/__tests__/store.test.js +489 -0
- package/dist/graph/__tests__/store.test.js.map +1 -0
- package/dist/graph/__tests__/sync.test.d.ts +5 -0
- package/dist/graph/__tests__/sync.test.d.ts.map +1 -0
- package/dist/graph/__tests__/sync.test.js +129 -0
- package/dist/graph/__tests__/sync.test.js.map +1 -0
- package/dist/graph/__tests__/validation.test.d.ts +2 -0
- package/dist/graph/__tests__/validation.test.d.ts.map +1 -0
- package/dist/graph/__tests__/validation.test.js +521 -0
- package/dist/graph/__tests__/validation.test.js.map +1 -0
- package/dist/graph/coordination.d.ts +190 -0
- package/dist/graph/coordination.d.ts.map +1 -0
- package/dist/graph/coordination.js +180 -0
- package/dist/graph/coordination.js.map +1 -0
- package/dist/graph/debounce.d.ts +47 -0
- package/dist/graph/debounce.d.ts.map +1 -0
- package/dist/graph/debounce.js +95 -0
- package/dist/graph/debounce.js.map +1 -0
- package/dist/graph/expansion.d.ts +64 -0
- package/dist/graph/expansion.d.ts.map +1 -0
- package/dist/graph/expansion.js +205 -0
- package/dist/graph/expansion.js.map +1 -0
- package/dist/graph/history.d.ts +186 -0
- package/dist/graph/history.d.ts.map +1 -0
- package/dist/graph/history.js +155 -0
- package/dist/graph/history.js.map +1 -0
- package/dist/graph/index.d.ts +35 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +22 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/provider-store.d.ts +211 -0
- package/dist/graph/provider-store.d.ts.map +1 -0
- package/dist/graph/provider-store.js +594 -0
- package/dist/graph/provider-store.js.map +1 -0
- package/dist/graph/query.d.ts +90 -0
- package/dist/graph/query.d.ts.map +1 -0
- package/dist/graph/query.js +463 -0
- package/dist/graph/query.js.map +1 -0
- package/dist/graph/store.d.ts +71 -0
- package/dist/graph/store.d.ts.map +1 -0
- package/dist/graph/store.js +531 -0
- package/dist/graph/store.js.map +1 -0
- package/dist/graph/sync.d.ts +48 -0
- package/dist/graph/sync.d.ts.map +1 -0
- package/dist/graph/sync.js +60 -0
- package/dist/graph/sync.js.map +1 -0
- package/dist/graph/types.d.ts +291 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +19 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/graph/validation.d.ts +26 -0
- package/dist/graph/validation.d.ts.map +1 -0
- package/dist/graph/validation.js +338 -0
- package/dist/graph/validation.js.map +1 -0
- package/dist/index.d.ts +25 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -25
- package/dist/index.js.map +1 -1
- package/dist/materialization/archiver.d.ts +12 -0
- package/dist/materialization/archiver.d.ts.map +1 -0
- package/dist/materialization/archiver.js +273 -0
- package/dist/materialization/archiver.js.map +1 -0
- package/dist/materialization/git-archive-store.d.ts +17 -0
- package/dist/materialization/git-archive-store.d.ts.map +1 -0
- package/dist/materialization/git-archive-store.js +509 -0
- package/dist/materialization/git-archive-store.js.map +1 -0
- package/dist/materialization/git-remote-store.d.ts +22 -0
- package/dist/materialization/git-remote-store.d.ts.map +1 -0
- package/dist/materialization/git-remote-store.js +448 -0
- package/dist/materialization/git-remote-store.js.map +1 -0
- package/dist/materialization/graph-id.d.ts +53 -0
- package/dist/materialization/graph-id.d.ts.map +1 -0
- package/dist/materialization/graph-id.js +163 -0
- package/dist/materialization/graph-id.js.map +1 -0
- package/dist/materialization/http-remote-store.d.ts +12 -0
- package/dist/materialization/http-remote-store.d.ts.map +1 -0
- package/dist/materialization/http-remote-store.js +143 -0
- package/dist/materialization/http-remote-store.js.map +1 -0
- package/dist/materialization/index.d.ts +15 -0
- package/dist/materialization/index.d.ts.map +1 -0
- package/dist/materialization/index.js +17 -0
- package/dist/materialization/index.js.map +1 -0
- package/dist/materialization/remote-store-factory.d.ts +17 -0
- package/dist/materialization/remote-store-factory.d.ts.map +1 -0
- package/dist/materialization/remote-store-factory.js +46 -0
- package/dist/materialization/remote-store-factory.js.map +1 -0
- package/dist/materialization/snapshot.d.ts +34 -0
- package/dist/materialization/snapshot.d.ts.map +1 -0
- package/dist/materialization/snapshot.js +177 -0
- package/dist/materialization/snapshot.js.map +1 -0
- package/dist/materialization/types.d.ts +300 -0
- package/dist/materialization/types.d.ts.map +1 -0
- package/dist/materialization/types.js +17 -0
- package/dist/materialization/types.js.map +1 -0
- package/dist/providers/__tests__/beads.test.d.ts +5 -0
- package/dist/providers/__tests__/beads.test.d.ts.map +1 -0
- package/dist/providers/__tests__/beads.test.js +591 -0
- package/dist/providers/__tests__/beads.test.js.map +1 -0
- package/dist/providers/__tests__/claude-tasks.test.d.ts +5 -0
- package/dist/providers/__tests__/claude-tasks.test.d.ts.map +1 -0
- package/dist/providers/__tests__/claude-tasks.test.js +392 -0
- package/dist/providers/__tests__/claude-tasks.test.js.map +1 -0
- package/dist/providers/__tests__/from-config.test.d.ts +5 -0
- package/dist/providers/__tests__/from-config.test.d.ts.map +1 -0
- package/dist/providers/__tests__/from-config.test.js +152 -0
- package/dist/providers/__tests__/from-config.test.js.map +1 -0
- package/dist/providers/__tests__/materialization.test.d.ts +5 -0
- package/dist/providers/__tests__/materialization.test.d.ts.map +1 -0
- package/dist/providers/__tests__/materialization.test.js +407 -0
- package/dist/providers/__tests__/materialization.test.js.map +1 -0
- package/dist/providers/__tests__/native.test.d.ts +5 -0
- package/dist/providers/__tests__/native.test.d.ts.map +1 -0
- package/dist/providers/__tests__/native.test.js +566 -0
- package/dist/providers/__tests__/native.test.js.map +1 -0
- package/dist/providers/__tests__/registry.test.d.ts +5 -0
- package/dist/providers/__tests__/registry.test.d.ts.map +1 -0
- package/dist/providers/__tests__/registry.test.js +183 -0
- package/dist/providers/__tests__/registry.test.js.map +1 -0
- package/dist/providers/beads.d.ts +46 -0
- package/dist/providers/beads.d.ts.map +1 -0
- package/dist/providers/beads.js +865 -0
- package/dist/providers/beads.js.map +1 -0
- package/dist/providers/claude-tasks.d.ts +56 -0
- package/dist/providers/claude-tasks.d.ts.map +1 -0
- package/dist/providers/claude-tasks.js +282 -0
- package/dist/providers/claude-tasks.js.map +1 -0
- package/dist/providers/entire.d.ts +88 -0
- package/dist/providers/entire.d.ts.map +1 -0
- package/dist/providers/entire.js +409 -0
- package/dist/providers/entire.js.map +1 -0
- package/dist/providers/from-config.d.ts +47 -0
- package/dist/providers/from-config.d.ts.map +1 -0
- package/dist/providers/from-config.js +150 -0
- package/dist/providers/from-config.js.map +1 -0
- package/dist/providers/index.d.ts +26 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +29 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/location.d.ts +44 -0
- package/dist/providers/location.d.ts.map +1 -0
- package/dist/providers/location.js +157 -0
- package/dist/providers/location.js.map +1 -0
- package/dist/providers/materialization.d.ts +46 -0
- package/dist/providers/materialization.d.ts.map +1 -0
- package/dist/providers/materialization.js +237 -0
- package/dist/providers/materialization.js.map +1 -0
- package/dist/providers/native.d.ts +32 -0
- package/dist/providers/native.d.ts.map +1 -0
- package/dist/providers/native.js +552 -0
- package/dist/providers/native.js.map +1 -0
- package/dist/providers/registry.d.ts +11 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +97 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/sudocode.d.ts +49 -0
- package/dist/providers/sudocode.d.ts.map +1 -0
- package/dist/providers/sudocode.js +945 -0
- package/dist/providers/sudocode.js.map +1 -0
- package/dist/providers/sync.d.ts +299 -0
- package/dist/providers/sync.d.ts.map +1 -0
- package/dist/providers/sync.js +93 -0
- package/dist/providers/sync.js.map +1 -0
- package/dist/providers/traits/RelationshipQueryable.d.ts +129 -0
- package/dist/providers/traits/RelationshipQueryable.d.ts.map +1 -0
- package/dist/providers/traits/RelationshipQueryable.js +68 -0
- package/dist/providers/traits/RelationshipQueryable.js.map +1 -0
- package/dist/providers/traits/TaskManageable.d.ts +157 -0
- package/dist/providers/traits/TaskManageable.d.ts.map +1 -0
- package/dist/providers/traits/TaskManageable.js +37 -0
- package/dist/providers/traits/TaskManageable.js.map +1 -0
- package/dist/providers/traits/Watchable.d.ts +216 -0
- package/dist/providers/traits/Watchable.d.ts.map +1 -0
- package/dist/providers/traits/Watchable.js +37 -0
- package/dist/providers/traits/Watchable.js.map +1 -0
- package/dist/providers/traits/__tests__/RelationshipQueryable.test.d.ts +2 -0
- package/dist/providers/traits/__tests__/RelationshipQueryable.test.d.ts.map +1 -0
- package/dist/providers/traits/__tests__/RelationshipQueryable.test.js +169 -0
- package/dist/providers/traits/__tests__/RelationshipQueryable.test.js.map +1 -0
- package/dist/providers/traits/__tests__/TaskManageable.test.d.ts +2 -0
- package/dist/providers/traits/__tests__/TaskManageable.test.d.ts.map +1 -0
- package/dist/providers/traits/__tests__/TaskManageable.test.js +172 -0
- package/dist/providers/traits/__tests__/TaskManageable.test.js.map +1 -0
- package/dist/providers/traits/index.d.ts +13 -0
- package/dist/providers/traits/index.d.ts.map +1 -0
- package/dist/providers/traits/index.js +10 -0
- package/dist/providers/traits/index.js.map +1 -0
- package/dist/providers/types.d.ts +284 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +30 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/schema/__tests__/validation.test.d.ts +2 -0
- package/dist/schema/__tests__/validation.test.d.ts.map +1 -0
- package/dist/schema/__tests__/validation.test.js +241 -0
- package/dist/schema/__tests__/validation.test.js.map +1 -0
- package/dist/schema/base.d.ts +68 -0
- package/dist/schema/base.d.ts.map +1 -0
- package/dist/schema/base.js +5 -0
- package/dist/schema/base.js.map +1 -0
- package/dist/schema/edges.d.ts +49 -0
- package/dist/schema/edges.d.ts.map +1 -0
- package/dist/schema/edges.js +9 -0
- package/dist/schema/edges.js.map +1 -0
- package/dist/schema/index.d.ts +11 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +8 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/nodes.d.ts +97 -0
- package/dist/schema/nodes.d.ts.map +1 -0
- package/dist/schema/nodes.js +5 -0
- package/dist/schema/nodes.js.map +1 -0
- package/dist/schema/storage.d.ts +107 -0
- package/dist/schema/storage.d.ts.map +1 -0
- package/dist/schema/storage.js +10 -0
- package/dist/schema/storage.js.map +1 -0
- package/dist/schema/validation.d.ts +61 -0
- package/dist/schema/validation.d.ts.map +1 -0
- package/dist/schema/validation.js +170 -0
- package/dist/schema/validation.js.map +1 -0
- package/dist/storage/__tests__/atomic-write.test.d.ts +5 -0
- package/dist/storage/__tests__/atomic-write.test.d.ts.map +1 -0
- package/dist/storage/__tests__/atomic-write.test.js +170 -0
- package/dist/storage/__tests__/atomic-write.test.js.map +1 -0
- package/dist/storage/__tests__/file-lock.test.d.ts +2 -0
- package/dist/storage/__tests__/file-lock.test.d.ts.map +1 -0
- package/dist/storage/__tests__/file-lock.test.js +89 -0
- package/dist/storage/__tests__/file-lock.test.js.map +1 -0
- package/dist/storage/__tests__/jsonl.test.d.ts +2 -0
- package/dist/storage/__tests__/jsonl.test.d.ts.map +1 -0
- package/dist/storage/__tests__/jsonl.test.js +228 -0
- package/dist/storage/__tests__/jsonl.test.js.map +1 -0
- package/dist/storage/__tests__/locked-writer.test.d.ts +2 -0
- package/dist/storage/__tests__/locked-writer.test.d.ts.map +1 -0
- package/dist/storage/__tests__/locked-writer.test.js +109 -0
- package/dist/storage/__tests__/locked-writer.test.js.map +1 -0
- package/dist/storage/__tests__/sqlite.test.d.ts +2 -0
- package/dist/storage/__tests__/sqlite.test.d.ts.map +1 -0
- package/dist/storage/__tests__/sqlite.test.js +470 -0
- package/dist/storage/__tests__/sqlite.test.js.map +1 -0
- package/dist/storage/atomic-write.d.ts +38 -0
- package/dist/storage/atomic-write.d.ts.map +1 -0
- package/dist/storage/atomic-write.js +83 -0
- package/dist/storage/atomic-write.js.map +1 -0
- package/dist/storage/file-lock.d.ts +66 -0
- package/dist/storage/file-lock.d.ts.map +1 -0
- package/dist/storage/file-lock.js +176 -0
- package/dist/storage/file-lock.js.map +1 -0
- package/dist/storage/index.d.ts +11 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +13 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/interface.d.ts +219 -0
- package/dist/storage/interface.d.ts.map +1 -0
- package/dist/storage/interface.js +22 -0
- package/dist/storage/interface.js.map +1 -0
- package/dist/storage/jsonl.d.ts +106 -0
- package/dist/storage/jsonl.d.ts.map +1 -0
- package/dist/storage/jsonl.js +218 -0
- package/dist/storage/jsonl.js.map +1 -0
- package/dist/storage/locked-writer.d.ts +67 -0
- package/dist/storage/locked-writer.d.ts.map +1 -0
- package/dist/storage/locked-writer.js +105 -0
- package/dist/storage/locked-writer.js.map +1 -0
- package/dist/storage/sqlite-schema.d.ts +48 -0
- package/dist/storage/sqlite-schema.d.ts.map +1 -0
- package/dist/storage/sqlite-schema.js +169 -0
- package/dist/storage/sqlite-schema.js.map +1 -0
- package/dist/storage/sqlite.d.ts +73 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +698 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/tools/__tests__/annotate.test.d.ts +5 -0
- package/dist/tools/__tests__/annotate.test.d.ts.map +1 -0
- package/dist/tools/__tests__/annotate.test.js +314 -0
- package/dist/tools/__tests__/annotate.test.js.map +1 -0
- package/dist/tools/__tests__/link.test.d.ts +5 -0
- package/dist/tools/__tests__/link.test.d.ts.map +1 -0
- package/dist/tools/__tests__/link.test.js +245 -0
- package/dist/tools/__tests__/link.test.js.map +1 -0
- package/dist/tools/__tests__/query.test.d.ts +5 -0
- package/dist/tools/__tests__/query.test.d.ts.map +1 -0
- package/dist/tools/__tests__/query.test.js +288 -0
- package/dist/tools/__tests__/query.test.js.map +1 -0
- package/dist/tools/__tests__/task.test.d.ts +5 -0
- package/dist/tools/__tests__/task.test.d.ts.map +1 -0
- package/dist/tools/__tests__/task.test.js +178 -0
- package/dist/tools/__tests__/task.test.js.map +1 -0
- package/dist/tools/annotate.d.ts +17 -0
- package/dist/tools/annotate.d.ts.map +1 -0
- package/dist/tools/annotate.js +218 -0
- package/dist/tools/annotate.js.map +1 -0
- package/dist/tools/index.d.ts +14 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +14 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/link.d.ts +17 -0
- package/dist/tools/link.d.ts.map +1 -0
- package/dist/tools/link.js +127 -0
- package/dist/tools/link.js.map +1 -0
- package/dist/tools/query.d.ts +17 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +342 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/task.d.ts +20 -0
- package/dist/tools/task.d.ts.map +1 -0
- package/dist/tools/task.js +161 -0
- package/dist/tools/task.js.map +1 -0
- package/dist/tools/types.d.ts +334 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +19 -0
- package/dist/tools/types.js.map +1 -0
- package/package.json +40 -5
package/dist/cli.js
CHANGED
|
@@ -1,40 +1,719 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* OpenTasks CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for OpenTasks.
|
|
6
|
+
* Phase 2 additions: init, connect, disconnect, connections
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
import { generateLocationIdentity } from './core/location.js';
|
|
11
|
+
import { createConnection, checkAllConnectionHealth } from './core/connections.js';
|
|
12
|
+
import { worktreeSetup, worktreeTeardown, listWorktrees, getGitCommonDir, } from './core/worktree.js';
|
|
13
|
+
import { mergeJsonl, installMergeDriver } from './core/merge-driver.js';
|
|
14
|
+
import { discoverLocations } from './core/discover.js';
|
|
15
|
+
import { OpenTasksClient } from './client/client.js';
|
|
16
|
+
const OPENTASKS_DIR = '.opentasks';
|
|
17
|
+
const CONFIG_FILE = 'config.json';
|
|
5
18
|
function printHelp() {
|
|
6
19
|
console.log(`
|
|
7
|
-
opentasks v0.0
|
|
20
|
+
opentasks v0.1.0
|
|
8
21
|
|
|
9
22
|
Usage:
|
|
10
23
|
opentasks <command> [options]
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
Tool commands (require running daemon):
|
|
26
|
+
link --from <id> --to <id> --type <type> [--remove] [--metadata <json>]
|
|
27
|
+
query <json> Query the graph (pass QueryParams as JSON)
|
|
28
|
+
annotate <json> Manage feedback (pass AnnotateParams as JSON)
|
|
29
|
+
create --type <type> --title <title> [options]
|
|
30
|
+
get <id> Get a node by ID
|
|
31
|
+
update <id> [options] Update a node
|
|
32
|
+
delete <id> [--hard] Delete a node
|
|
15
33
|
|
|
16
|
-
|
|
17
|
-
|
|
34
|
+
Create options:
|
|
35
|
+
--status <s> Status (required for tasks)
|
|
36
|
+
--content <text> Markdown content
|
|
37
|
+
--uri <uri> External URI (for external nodes)
|
|
38
|
+
--source <src> Source system (for external nodes)
|
|
39
|
+
--tags <t1,t2> Comma-separated tags
|
|
40
|
+
--priority <n> Priority 0-4
|
|
41
|
+
--parent <id> Parent node ID
|
|
42
|
+
--metadata <json> Additional metadata as JSON
|
|
43
|
+
|
|
44
|
+
Update options:
|
|
45
|
+
--title <t> Update title
|
|
46
|
+
--status <s> Update status
|
|
47
|
+
--archived Archive the node
|
|
48
|
+
--metadata <json> Update metadata (merged)
|
|
49
|
+
|
|
50
|
+
Setup commands:
|
|
51
|
+
init [--name <name>] Initialize .opentasks in current directory
|
|
52
|
+
connect <path> [--role <role>] Connect to another location
|
|
53
|
+
disconnect <hash> Disconnect from a location
|
|
54
|
+
connections List connections with health status
|
|
55
|
+
worktree setup <path> [opts] Setup a new worker worktree
|
|
56
|
+
worktree list List registered worktrees
|
|
57
|
+
worktree teardown <path|hash> Teardown a worktree
|
|
58
|
+
discover [options] Find nearby opentasks locations
|
|
59
|
+
merge-driver <O> <A> <B> JSONL merge driver (for git)
|
|
60
|
+
|
|
61
|
+
Archive commands (require running daemon with archival enabled):
|
|
62
|
+
archive list [--graph <id>] [--source <src>] List archived sessions
|
|
63
|
+
archive restore <uri> Restore a node from archive
|
|
64
|
+
archive restore --all Restore all missing nodes
|
|
65
|
+
archive push Push archive to remote
|
|
66
|
+
archive status Show archive status
|
|
67
|
+
archive node <uri> Manually archive a node
|
|
68
|
+
|
|
69
|
+
All tool commands output JSON to stdout.
|
|
18
70
|
`);
|
|
19
71
|
}
|
|
20
|
-
|
|
21
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Read config.json from .opentasks directory
|
|
74
|
+
*/
|
|
75
|
+
function readConfig(opentasksDir) {
|
|
76
|
+
const configPath = path.join(opentasksDir, CONFIG_FILE);
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Write config.json to .opentasks directory
|
|
86
|
+
*/
|
|
87
|
+
function writeConfig(opentasksDir, config) {
|
|
88
|
+
const configPath = path.join(opentasksDir, CONFIG_FILE);
|
|
89
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Initialize .opentasks directory with location identity
|
|
93
|
+
*/
|
|
94
|
+
function cmdInit(args) {
|
|
95
|
+
const nameIndex = args.indexOf('--name');
|
|
96
|
+
const name = nameIndex !== -1 ? args[nameIndex + 1] : undefined;
|
|
97
|
+
const opentasksDir = path.resolve(OPENTASKS_DIR);
|
|
98
|
+
// Create directory if it doesn't exist
|
|
99
|
+
fs.mkdirSync(opentasksDir, { recursive: true });
|
|
100
|
+
// Read existing config
|
|
101
|
+
const config = readConfig(opentasksDir);
|
|
102
|
+
// Check if already initialized
|
|
103
|
+
if (config.location) {
|
|
104
|
+
console.log('Location already initialized:');
|
|
105
|
+
const loc = config.location;
|
|
106
|
+
console.log(` hash: ${loc.hash}`);
|
|
107
|
+
console.log(` uuid: ${loc.uuid}`);
|
|
108
|
+
console.log(` name: ${loc.name}`);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
// Generate location identity
|
|
112
|
+
const identity = generateLocationIdentity(opentasksDir, name);
|
|
113
|
+
config.version = '1.0';
|
|
114
|
+
config.location = {
|
|
115
|
+
hash: identity.hash,
|
|
116
|
+
uuid: identity.uuid,
|
|
117
|
+
name: identity.name,
|
|
118
|
+
};
|
|
119
|
+
if (!config.connections) {
|
|
120
|
+
config.connections = [];
|
|
121
|
+
}
|
|
122
|
+
writeConfig(opentasksDir, config);
|
|
123
|
+
// Create graph.jsonl if it doesn't exist
|
|
124
|
+
const graphPath = path.join(opentasksDir, 'graph.jsonl');
|
|
125
|
+
if (!fs.existsSync(graphPath)) {
|
|
126
|
+
fs.writeFileSync(graphPath, '', 'utf-8');
|
|
127
|
+
}
|
|
128
|
+
// Create .gitignore for ephemeral files
|
|
129
|
+
const gitignorePath = path.join(opentasksDir, '.gitignore');
|
|
130
|
+
if (!fs.existsSync(gitignorePath)) {
|
|
131
|
+
fs.writeFileSync(gitignorePath, [
|
|
132
|
+
'cache.db',
|
|
133
|
+
'cache.db-wal',
|
|
134
|
+
'cache.db-shm',
|
|
135
|
+
'write.lock',
|
|
136
|
+
'daemon.sock',
|
|
137
|
+
'daemon.lock',
|
|
138
|
+
'',
|
|
139
|
+
].join('\n'), 'utf-8');
|
|
140
|
+
}
|
|
141
|
+
console.log('Initialized .opentasks/');
|
|
142
|
+
console.log(` hash: ${identity.hash}`);
|
|
143
|
+
console.log(` uuid: ${identity.uuid}`);
|
|
144
|
+
console.log(` name: ${identity.name}`);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Connect to another OpenTasks location
|
|
148
|
+
*/
|
|
149
|
+
function cmdConnect(args) {
|
|
150
|
+
const targetPath = args[0];
|
|
151
|
+
if (!targetPath) {
|
|
152
|
+
console.error('Usage: opentasks connect <path> [--role <role>]');
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
const roleIndex = args.indexOf('--role');
|
|
156
|
+
const role = roleIndex !== -1 ? args[roleIndex + 1] : 'peer';
|
|
157
|
+
const opentasksDir = path.resolve(OPENTASKS_DIR);
|
|
158
|
+
if (!fs.existsSync(path.join(opentasksDir, CONFIG_FILE))) {
|
|
159
|
+
console.error('Not initialized. Run `opentasks init` first.');
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const connection = createConnection(path.resolve(targetPath), role, opentasksDir);
|
|
164
|
+
const config = readConfig(opentasksDir);
|
|
165
|
+
const connections = (config.connections || []);
|
|
166
|
+
// Check for existing connection with same hash
|
|
167
|
+
const existing = connections.find((c) => c.hash === connection.hash);
|
|
168
|
+
if (existing) {
|
|
169
|
+
console.log(`Updated connection: ${connection.name} (${connection.hash})`);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
console.log(`Connected: ${connection.name} (${connection.hash})`);
|
|
173
|
+
}
|
|
174
|
+
// Add/update connection
|
|
175
|
+
const updated = connections.filter((c) => c.hash !== connection.hash);
|
|
176
|
+
updated.push(connection);
|
|
177
|
+
config.connections = updated;
|
|
178
|
+
writeConfig(opentasksDir, config);
|
|
179
|
+
console.log(` path: ${connection.path}`);
|
|
180
|
+
console.log(` role: ${connection.role}`);
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
console.error(`Failed to connect: ${error.message}`);
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Disconnect from a location
|
|
189
|
+
*/
|
|
190
|
+
function cmdDisconnect(args) {
|
|
191
|
+
const hash = args[0];
|
|
192
|
+
if (!hash) {
|
|
193
|
+
console.error('Usage: opentasks disconnect <hash>');
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
const opentasksDir = path.resolve(OPENTASKS_DIR);
|
|
197
|
+
const config = readConfig(opentasksDir);
|
|
198
|
+
const connections = (config.connections || []);
|
|
199
|
+
const found = connections.find((c) => c.hash === hash);
|
|
200
|
+
if (!found) {
|
|
201
|
+
console.error(`No connection with hash: ${hash}`);
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
config.connections = connections.filter((c) => c.hash !== hash);
|
|
205
|
+
writeConfig(opentasksDir, config);
|
|
206
|
+
console.log(`Disconnected: ${found.name} (${hash})`);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* List connections with health status
|
|
210
|
+
*/
|
|
211
|
+
function cmdConnections() {
|
|
212
|
+
const opentasksDir = path.resolve(OPENTASKS_DIR);
|
|
213
|
+
const config = readConfig(opentasksDir);
|
|
214
|
+
const connections = (config.connections || []);
|
|
215
|
+
if (connections.length === 0) {
|
|
216
|
+
console.log('No connections.');
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const statuses = checkAllConnectionHealth(connections, opentasksDir);
|
|
220
|
+
// Header
|
|
221
|
+
console.log(padRight('HASH', 12) +
|
|
222
|
+
padRight('NAME', 20) +
|
|
223
|
+
padRight('PATH', 40) +
|
|
224
|
+
padRight('ROLE', 10) +
|
|
225
|
+
'STATUS');
|
|
226
|
+
for (const status of statuses) {
|
|
227
|
+
const { connection, health } = status;
|
|
228
|
+
console.log(padRight(connection.hash, 12) +
|
|
229
|
+
padRight(connection.name, 20) +
|
|
230
|
+
padRight(connection.path, 40) +
|
|
231
|
+
padRight(connection.role, 10) +
|
|
232
|
+
health);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Setup a new worktree
|
|
237
|
+
*/
|
|
238
|
+
function cmdWorktreeSetup(args) {
|
|
239
|
+
const targetPath = args[0];
|
|
240
|
+
if (!targetPath) {
|
|
241
|
+
console.error('Usage: opentasks worktree setup <path> [--branch <name>] [--role <role>] [--redirect-to <target>] [--no-git-worktree]');
|
|
242
|
+
process.exit(1);
|
|
243
|
+
}
|
|
244
|
+
const opentasksDir = path.resolve(OPENTASKS_DIR);
|
|
245
|
+
if (!fs.existsSync(path.join(opentasksDir, CONFIG_FILE))) {
|
|
246
|
+
console.error('Not initialized. Run `opentasks init` first.');
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
const branchIndex = args.indexOf('--branch');
|
|
250
|
+
const roleIndex = args.indexOf('--role');
|
|
251
|
+
const redirectIndex = args.indexOf('--redirect-to');
|
|
252
|
+
const noGitWorktree = args.includes('--no-git-worktree');
|
|
253
|
+
try {
|
|
254
|
+
const entry = worktreeSetup(targetPath, opentasksDir, {
|
|
255
|
+
branch: branchIndex !== -1 ? args[branchIndex + 1] : undefined,
|
|
256
|
+
role: roleIndex !== -1 ? args[roleIndex + 1] : undefined,
|
|
257
|
+
redirectTo: redirectIndex !== -1 ? args[redirectIndex + 1] : undefined,
|
|
258
|
+
noGitWorktree,
|
|
259
|
+
});
|
|
260
|
+
console.log(`Worktree setup complete:`);
|
|
261
|
+
console.log(` path: ${entry.path}`);
|
|
262
|
+
console.log(` hash: ${entry.hash}`);
|
|
263
|
+
console.log(` role: ${entry.role}`);
|
|
264
|
+
console.log(` branch: ${entry.branch || '(none)'}`);
|
|
265
|
+
if (entry.redirectTarget) {
|
|
266
|
+
console.log(` redirect: → ${entry.redirectTarget}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
console.error(`Failed: ${error.message}`);
|
|
271
|
+
process.exit(1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* List registered worktrees
|
|
276
|
+
*/
|
|
277
|
+
function cmdWorktreeList() {
|
|
278
|
+
const gitCommonDir = getGitCommonDir(process.cwd());
|
|
279
|
+
if (!gitCommonDir) {
|
|
280
|
+
console.error('Not in a git repository.');
|
|
281
|
+
process.exit(1);
|
|
282
|
+
}
|
|
283
|
+
const worktrees = listWorktrees(gitCommonDir);
|
|
284
|
+
if (worktrees.length === 0) {
|
|
285
|
+
console.log('No registered worktrees.');
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
console.log(padRight('HASH', 12) +
|
|
289
|
+
padRight('PATH', 40) +
|
|
290
|
+
padRight('BRANCH', 20) +
|
|
291
|
+
padRight('ROLE', 12) +
|
|
292
|
+
'STATUS');
|
|
293
|
+
for (const wt of worktrees) {
|
|
294
|
+
console.log(padRight(wt.hash, 12) +
|
|
295
|
+
padRight(wt.path, 40) +
|
|
296
|
+
padRight(wt.branch || '(none)', 20) +
|
|
297
|
+
padRight(wt.role, 12) +
|
|
298
|
+
wt.status);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Teardown a worktree
|
|
303
|
+
*/
|
|
304
|
+
function cmdWorktreeTeardown(args) {
|
|
305
|
+
const pathOrHash = args[0];
|
|
306
|
+
if (!pathOrHash) {
|
|
307
|
+
console.error('Usage: opentasks worktree teardown <path-or-hash> [--remove-git-worktree] [--keep-data]');
|
|
308
|
+
process.exit(1);
|
|
309
|
+
}
|
|
310
|
+
const opentasksDir = path.resolve(OPENTASKS_DIR);
|
|
311
|
+
try {
|
|
312
|
+
const entry = worktreeTeardown(pathOrHash, opentasksDir, {
|
|
313
|
+
removeGitWorktree: args.includes('--remove-git-worktree'),
|
|
314
|
+
keepData: args.includes('--keep-data'),
|
|
315
|
+
});
|
|
316
|
+
if (entry) {
|
|
317
|
+
console.log(`Worktree torn down: ${entry.hash} (${entry.path})`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
console.error(`Failed: ${error.message}`);
|
|
322
|
+
process.exit(1);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* JSONL merge driver (called by git)
|
|
327
|
+
*/
|
|
328
|
+
function cmdMergeDriver(args) {
|
|
329
|
+
const [basePath, oursPath, theirsPath] = args;
|
|
330
|
+
if (!basePath || !oursPath || !theirsPath) {
|
|
331
|
+
console.error('Usage: opentasks merge-driver <base> <ours> <theirs>');
|
|
332
|
+
process.exit(1);
|
|
333
|
+
}
|
|
334
|
+
try {
|
|
335
|
+
const exitCode = mergeJsonl(basePath, oursPath, theirsPath);
|
|
336
|
+
process.exit(exitCode);
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
console.error(`Merge failed: ${error.message}`);
|
|
340
|
+
process.exit(1);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Discover nearby opentasks locations
|
|
345
|
+
*/
|
|
346
|
+
function cmdDiscover(args) {
|
|
347
|
+
const dirIndex = args.indexOf('--direction');
|
|
348
|
+
const direction = dirIndex !== -1 ? args[dirIndex + 1] : 'both';
|
|
349
|
+
const depthIndex = args.indexOf('--max-depth');
|
|
350
|
+
const maxDepth = depthIndex !== -1 ? parseInt(args[depthIndex + 1], 10) : 5;
|
|
351
|
+
if (!['up', 'down', 'both'].includes(direction)) {
|
|
352
|
+
console.error(`Invalid direction: ${direction}. Use up, down, or both.`);
|
|
353
|
+
process.exit(1);
|
|
354
|
+
}
|
|
355
|
+
const locations = discoverLocations(process.cwd(), { direction, maxDepth });
|
|
356
|
+
if (locations.length === 0) {
|
|
357
|
+
console.log('No opentasks locations found.');
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
console.log(padRight('HASH', 12) +
|
|
361
|
+
padRight('NAME', 20) +
|
|
362
|
+
padRight('PATH', 50) +
|
|
363
|
+
padRight('DIR', 8) +
|
|
364
|
+
'DEPTH');
|
|
365
|
+
for (const loc of locations) {
|
|
366
|
+
console.log(padRight(loc.hash, 12) +
|
|
367
|
+
padRight(loc.name || '(unnamed)', 20) +
|
|
368
|
+
padRight(loc.opentasksPath, 50) +
|
|
369
|
+
padRight(loc.direction, 8) +
|
|
370
|
+
String(loc.depth));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
// ============================================================================
|
|
374
|
+
// Tool Commands (daemon-connected)
|
|
375
|
+
// ============================================================================
|
|
376
|
+
/**
|
|
377
|
+
* Extract a flag value from args. Returns undefined if not present.
|
|
378
|
+
*/
|
|
379
|
+
export function getFlag(args, flag) {
|
|
380
|
+
const idx = args.indexOf(flag);
|
|
381
|
+
return idx !== -1 ? args[idx + 1] : undefined;
|
|
382
|
+
}
|
|
383
|
+
export function hasFlag(args, flag) {
|
|
384
|
+
return args.includes(flag);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Run an async command, print JSON result, handle errors.
|
|
388
|
+
*/
|
|
389
|
+
async function runToolCommand(fn) {
|
|
390
|
+
try {
|
|
391
|
+
const result = await fn();
|
|
392
|
+
console.log(JSON.stringify(result, null, 2));
|
|
393
|
+
}
|
|
394
|
+
catch (error) {
|
|
395
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
396
|
+
console.error(JSON.stringify({ error: message }));
|
|
397
|
+
process.exit(1);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
export async function cmdLink(args) {
|
|
401
|
+
const fromId = getFlag(args, '--from');
|
|
402
|
+
const toId = getFlag(args, '--to');
|
|
403
|
+
const type = getFlag(args, '--type');
|
|
404
|
+
const remove = hasFlag(args, '--remove');
|
|
405
|
+
const metadataStr = getFlag(args, '--metadata');
|
|
406
|
+
if (!fromId || !toId || !type) {
|
|
407
|
+
console.error('Usage: opentasks link --from <id> --to <id> --type <type> [--remove] [--metadata <json>]');
|
|
408
|
+
process.exit(1);
|
|
409
|
+
}
|
|
410
|
+
const client = new OpenTasksClient();
|
|
411
|
+
await runToolCommand(async () => {
|
|
412
|
+
const params = { fromId, toId, type };
|
|
413
|
+
if (remove)
|
|
414
|
+
params.remove = true;
|
|
415
|
+
if (metadataStr)
|
|
416
|
+
params.metadata = JSON.parse(metadataStr);
|
|
417
|
+
const result = await client.link(params);
|
|
418
|
+
client.disconnect();
|
|
419
|
+
return result;
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
export async function cmdQuery(args) {
|
|
423
|
+
const json = args[0];
|
|
424
|
+
if (!json) {
|
|
425
|
+
console.error("Usage: opentasks query '<json>'");
|
|
426
|
+
console.error('Example: opentasks query \'{"ready":{}}\'');
|
|
427
|
+
process.exit(1);
|
|
428
|
+
}
|
|
429
|
+
const client = new OpenTasksClient();
|
|
430
|
+
await runToolCommand(async () => {
|
|
431
|
+
const params = JSON.parse(json);
|
|
432
|
+
const result = await client.query(params);
|
|
433
|
+
client.disconnect();
|
|
434
|
+
return result;
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
export async function cmdAnnotate(args) {
|
|
438
|
+
const json = args[0];
|
|
439
|
+
if (!json) {
|
|
440
|
+
console.error("Usage: opentasks annotate '<json>'");
|
|
441
|
+
console.error('Example: opentasks annotate \'{"targetId":"s-a2b3","create":{"content":"...","type":"comment"}}\'');
|
|
442
|
+
process.exit(1);
|
|
443
|
+
}
|
|
444
|
+
const client = new OpenTasksClient();
|
|
445
|
+
await runToolCommand(async () => {
|
|
446
|
+
const params = JSON.parse(json);
|
|
447
|
+
const result = await client.annotate(params);
|
|
448
|
+
client.disconnect();
|
|
449
|
+
return result;
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
export async function cmdCreate(args) {
|
|
453
|
+
const type = getFlag(args, '--type');
|
|
454
|
+
const title = getFlag(args, '--title');
|
|
455
|
+
if (!type || !title) {
|
|
456
|
+
console.error('Usage: opentasks create --type <type> --title <title> [options]');
|
|
457
|
+
process.exit(1);
|
|
458
|
+
}
|
|
459
|
+
const params = { type, title };
|
|
460
|
+
const status = getFlag(args, '--status');
|
|
461
|
+
const content = getFlag(args, '--content');
|
|
462
|
+
const uri = getFlag(args, '--uri');
|
|
463
|
+
const source = getFlag(args, '--source');
|
|
464
|
+
const tagsStr = getFlag(args, '--tags');
|
|
465
|
+
const priorityStr = getFlag(args, '--priority');
|
|
466
|
+
const parentId = getFlag(args, '--parent');
|
|
467
|
+
const metadataStr = getFlag(args, '--metadata');
|
|
468
|
+
if (status)
|
|
469
|
+
params.status = status;
|
|
470
|
+
if (content)
|
|
471
|
+
params.content = content;
|
|
472
|
+
if (uri)
|
|
473
|
+
params.uri = uri;
|
|
474
|
+
if (source)
|
|
475
|
+
params.source = source;
|
|
476
|
+
if (tagsStr)
|
|
477
|
+
params.tags = tagsStr.split(',').map((t) => t.trim());
|
|
478
|
+
if (priorityStr)
|
|
479
|
+
params.priority = parseInt(priorityStr, 10);
|
|
480
|
+
if (parentId)
|
|
481
|
+
params.parent_id = parentId;
|
|
482
|
+
if (metadataStr)
|
|
483
|
+
params.metadata = JSON.parse(metadataStr);
|
|
484
|
+
const client = new OpenTasksClient();
|
|
485
|
+
await runToolCommand(async () => {
|
|
486
|
+
const result = await client.createNode(params);
|
|
487
|
+
client.disconnect();
|
|
488
|
+
return result;
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
export async function cmdGet(args) {
|
|
492
|
+
const id = args[0];
|
|
493
|
+
if (!id) {
|
|
494
|
+
console.error('Usage: opentasks get <id>');
|
|
495
|
+
process.exit(1);
|
|
496
|
+
}
|
|
497
|
+
const client = new OpenTasksClient();
|
|
498
|
+
await runToolCommand(async () => {
|
|
499
|
+
const result = await client.getNode(id);
|
|
500
|
+
client.disconnect();
|
|
501
|
+
return result;
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
export async function cmdUpdate(args) {
|
|
505
|
+
const id = args[0];
|
|
506
|
+
if (!id) {
|
|
507
|
+
console.error('Usage: opentasks update <id> [--title <t>] [--status <s>] [--archived] [--metadata <json>]');
|
|
508
|
+
process.exit(1);
|
|
509
|
+
}
|
|
510
|
+
const rest = args.slice(1);
|
|
511
|
+
const updates = {};
|
|
512
|
+
const title = getFlag(rest, '--title');
|
|
513
|
+
const status = getFlag(rest, '--status');
|
|
514
|
+
const metadataStr = getFlag(rest, '--metadata');
|
|
515
|
+
if (title)
|
|
516
|
+
updates.title = title;
|
|
517
|
+
if (status)
|
|
518
|
+
updates.status = status;
|
|
519
|
+
if (hasFlag(rest, '--archived'))
|
|
520
|
+
updates.archived = true;
|
|
521
|
+
if (metadataStr)
|
|
522
|
+
updates.metadata = JSON.parse(metadataStr);
|
|
523
|
+
if (Object.keys(updates).length === 0) {
|
|
524
|
+
console.error('No updates specified. Use --title, --status, --archived, or --metadata.');
|
|
525
|
+
process.exit(1);
|
|
526
|
+
}
|
|
527
|
+
const client = new OpenTasksClient();
|
|
528
|
+
await runToolCommand(async () => {
|
|
529
|
+
const result = await client.updateNode(id, updates);
|
|
530
|
+
client.disconnect();
|
|
531
|
+
return result;
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
export async function cmdDelete(args) {
|
|
535
|
+
const id = args[0];
|
|
536
|
+
if (!id) {
|
|
537
|
+
console.error('Usage: opentasks delete <id> [--hard]');
|
|
538
|
+
process.exit(1);
|
|
539
|
+
}
|
|
540
|
+
const hard = hasFlag(args, '--hard');
|
|
541
|
+
const client = new OpenTasksClient();
|
|
542
|
+
await runToolCommand(async () => {
|
|
543
|
+
await client.deleteNode(id, hard ? { hard: true } : undefined);
|
|
544
|
+
client.disconnect();
|
|
545
|
+
return { success: true, id, hard };
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
// ============================================================================
|
|
549
|
+
// Archive Commands
|
|
550
|
+
// ============================================================================
|
|
551
|
+
export async function cmdArchive(args) {
|
|
552
|
+
const subCmd = args[0];
|
|
553
|
+
const client = new OpenTasksClient();
|
|
554
|
+
switch (subCmd) {
|
|
555
|
+
case 'list': {
|
|
556
|
+
const graphId = getFlag(args.slice(1), '--graph');
|
|
557
|
+
const source = getFlag(args.slice(1), '--source');
|
|
558
|
+
const filter = {};
|
|
559
|
+
if (graphId)
|
|
560
|
+
filter.graphId = graphId;
|
|
561
|
+
if (source)
|
|
562
|
+
filter.source = source;
|
|
563
|
+
await runToolCommand(async () => {
|
|
564
|
+
const result = await client.call('archive.list', { filter });
|
|
565
|
+
client.disconnect();
|
|
566
|
+
return result;
|
|
567
|
+
});
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
case 'restore': {
|
|
571
|
+
if (hasFlag(args, '--all')) {
|
|
572
|
+
await runToolCommand(async () => {
|
|
573
|
+
const result = await client.call('archive.rematerializeAll', {});
|
|
574
|
+
client.disconnect();
|
|
575
|
+
return result;
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
const uri = args[1];
|
|
580
|
+
if (!uri || uri.startsWith('--')) {
|
|
581
|
+
console.error('Usage: opentasks archive restore <uri>');
|
|
582
|
+
console.error(' opentasks archive restore --all');
|
|
583
|
+
process.exit(1);
|
|
584
|
+
}
|
|
585
|
+
await runToolCommand(async () => {
|
|
586
|
+
const result = await client.call('archive.rematerialize', { uri });
|
|
587
|
+
client.disconnect();
|
|
588
|
+
return result;
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
case 'push': {
|
|
594
|
+
await runToolCommand(async () => {
|
|
595
|
+
const result = await client.call('archive.push', {});
|
|
596
|
+
client.disconnect();
|
|
597
|
+
return result;
|
|
598
|
+
});
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
case 'status': {
|
|
602
|
+
await runToolCommand(async () => {
|
|
603
|
+
const result = await client.call('archive.status', {});
|
|
604
|
+
client.disconnect();
|
|
605
|
+
return result;
|
|
606
|
+
});
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
case 'node': {
|
|
610
|
+
const uri = args[1];
|
|
611
|
+
if (!uri) {
|
|
612
|
+
console.error('Usage: opentasks archive node <uri>');
|
|
613
|
+
process.exit(1);
|
|
614
|
+
}
|
|
615
|
+
await runToolCommand(async () => {
|
|
616
|
+
const result = await client.call('archive.node', { uri });
|
|
617
|
+
client.disconnect();
|
|
618
|
+
return result;
|
|
619
|
+
});
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
default:
|
|
623
|
+
console.error(`Unknown archive command: ${subCmd}`);
|
|
624
|
+
console.error('Available: list, restore, push, status, node');
|
|
625
|
+
process.exit(1);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function padRight(str, len) {
|
|
629
|
+
return str.length >= len ? str + ' ' : str + ' '.repeat(len - str.length);
|
|
630
|
+
}
|
|
631
|
+
async function main() {
|
|
632
|
+
const args = process.argv.slice(2);
|
|
633
|
+
const command = args[0];
|
|
634
|
+
if (!command || command === 'help' || command === '--help') {
|
|
22
635
|
printHelp();
|
|
23
636
|
process.exit(0);
|
|
24
637
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
638
|
+
switch (command) {
|
|
639
|
+
// Tool commands (async, require daemon)
|
|
640
|
+
case 'link':
|
|
641
|
+
await cmdLink(args.slice(1));
|
|
642
|
+
break;
|
|
643
|
+
case 'query':
|
|
644
|
+
await cmdQuery(args.slice(1));
|
|
645
|
+
break;
|
|
646
|
+
case 'annotate':
|
|
647
|
+
await cmdAnnotate(args.slice(1));
|
|
648
|
+
break;
|
|
649
|
+
case 'create':
|
|
650
|
+
await cmdCreate(args.slice(1));
|
|
651
|
+
break;
|
|
652
|
+
case 'get':
|
|
653
|
+
await cmdGet(args.slice(1));
|
|
654
|
+
break;
|
|
655
|
+
case 'update':
|
|
656
|
+
await cmdUpdate(args.slice(1));
|
|
657
|
+
break;
|
|
658
|
+
case 'delete':
|
|
659
|
+
await cmdDelete(args.slice(1));
|
|
660
|
+
break;
|
|
661
|
+
// Setup commands (sync, no daemon needed)
|
|
662
|
+
case 'init':
|
|
663
|
+
cmdInit(args.slice(1));
|
|
664
|
+
try {
|
|
665
|
+
installMergeDriver(process.cwd());
|
|
666
|
+
}
|
|
667
|
+
catch {
|
|
668
|
+
// Non-fatal
|
|
669
|
+
}
|
|
670
|
+
break;
|
|
671
|
+
case 'connect':
|
|
672
|
+
cmdConnect(args.slice(1));
|
|
673
|
+
break;
|
|
674
|
+
case 'disconnect':
|
|
675
|
+
cmdDisconnect(args.slice(1));
|
|
676
|
+
break;
|
|
677
|
+
case 'connections':
|
|
678
|
+
cmdConnections();
|
|
679
|
+
break;
|
|
680
|
+
case 'worktree':
|
|
681
|
+
{
|
|
682
|
+
const subCmd = args[1];
|
|
683
|
+
switch (subCmd) {
|
|
684
|
+
case 'setup':
|
|
685
|
+
cmdWorktreeSetup(args.slice(2));
|
|
686
|
+
break;
|
|
687
|
+
case 'list':
|
|
688
|
+
cmdWorktreeList();
|
|
689
|
+
break;
|
|
690
|
+
case 'teardown':
|
|
691
|
+
cmdWorktreeTeardown(args.slice(2));
|
|
692
|
+
break;
|
|
693
|
+
default:
|
|
694
|
+
console.error(`Unknown worktree command: ${subCmd}`);
|
|
695
|
+
console.error('Available: setup, list, teardown');
|
|
696
|
+
process.exit(1);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
break;
|
|
700
|
+
case 'archive':
|
|
701
|
+
await cmdArchive(args.slice(1));
|
|
702
|
+
break;
|
|
703
|
+
case 'discover':
|
|
704
|
+
cmdDiscover(args.slice(1));
|
|
705
|
+
break;
|
|
706
|
+
case 'merge-driver':
|
|
707
|
+
cmdMergeDriver(args.slice(1));
|
|
708
|
+
break;
|
|
709
|
+
default:
|
|
710
|
+
console.error(`Unknown command: ${command}`);
|
|
711
|
+
printHelp();
|
|
29
712
|
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
const task = createTask({ title });
|
|
32
|
-
console.log("Created task:", JSON.stringify(task, null, 2));
|
|
33
|
-
process.exit(0);
|
|
34
713
|
}
|
|
35
|
-
console.error(`Unknown command: ${command}`);
|
|
36
|
-
printHelp();
|
|
37
|
-
process.exit(1);
|
|
38
714
|
}
|
|
39
|
-
|
|
715
|
+
// Only auto-run when executed directly (not when imported for testing)
|
|
716
|
+
if (!process.env.VITEST) {
|
|
717
|
+
main();
|
|
718
|
+
}
|
|
40
719
|
//# sourceMappingURL=cli.js.map
|