Skip to content

Commit 9dee1c5

Browse files
benfrank241claudeDK09876
authored
refactor(zed): port setup CLI to Node, drop the Python dependency (#2599)
* refactor(zed): port setup CLI to Node, drop the Python dependency The Zed integration is configuration-only — it writes the `context_servers` entry into Zed's settings.json and a recall/retain rule into AGENTS.md — and the MCP server it configures runs via `npx mcp-remote`, so Node.js was already a hard requirement. Requiring Python *as well* just to write two config files meant users needed two runtimes. Port the `hindsight-zed` CLI to a zero-dependency Node CLI so the integration needs only Node: - Node CLI under `src/` + `bin/hindsight-zed.js`, shipped via `package.json` (matches the existing TypeScript integrations; release-integration.yml already detects package.json for npm publishing). - Behavior-preserving: same commands (`init`/`status`/`uninstall`), flags, `--print-only`, env/file/flag config resolution, JSONC-safe settings edits, and fenced AGENTS.md rule block. - Tests ported to Node's built-in runner (`node --test`) — 21 tests. - CI (`test.yml`) updated to run `npm test` on Node 22 instead of pytest. - Removes the Python package (`hindsight_zed/`, `pyproject.toml`, `uv.lock`, Python `tests/`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(zed): make the Node package publishable by the release workflow The release workflow classifies any integration with a package.json as `type=typescript` and unconditionally runs `npm ci` + `npm run build` in the integration dir. This zero-dependency, no-build JS package had neither, so `integrations/zed/v*` would fail at release time (invisible in test CI, which only runs `npm test`): - add a no-op `build` script so `npm run build` succeeds - commit package-lock.json so `npm ci` succeeds (it refuses to run without one, even with zero deps); lockfile has no node_modules entries, so check-integration-lockfiles.sh passes trivially - drop the stray settings.json (a local `init` scaffold accidentally committed) and gitignore it Verified locally: node --test (21/21), npm ci, npm run build, and npm publish --dry-run all pass; tarball ships only bin/src/README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WEHyNxWfn1miSWRW6NUtEW * docs(zed): update setup to Node/npx (drop pip install) * refactor(zed): scope npm package as @vectorize-io/hindsight-zed Match the scoped-name convention of the other TS integrations (@vectorize-io/hindsight-ai-sdk, -chat, -openclaw). CLI/bin command stays 'hindsight-zed'; npx/global-install references updated to the scoped name. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: DK09876 <dk09876@Dikshants-MacBook-Pro.local>
1 parent a1ebb2d commit 9dee1c5

32 files changed

Lines changed: 1068 additions & 1089 deletions

.github/workflows/test.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -520,22 +520,17 @@ jobs:
520520
with:
521521
ref: ${{ github.event.pull_request.head.sha || '' }}
522522

523-
- name: Set up Python
524-
uses: actions/setup-python@v6
523+
- name: Set up Node.js
524+
uses: actions/setup-node@v6
525525
with:
526-
python-version: '3.11'
527-
528-
- name: Install package and pytest
529-
working-directory: ./hindsight-integrations/zed
530-
# Installs the package (incl. the zstandard runtime dep) so the threads.db
531-
# reader tests can decompress Zed's zstd blobs.
532-
run: pip install -e . pytest
526+
node-version: '22'
533527

534528
- name: Run tests
535529
working-directory: ./hindsight-integrations/zed
536-
# PR CI runs only the deterministic bucket; the real-LLM E2E bucket
537-
# (requires_real_llm) needs a live Hindsight server and runs separately.
538-
run: python -m pytest tests/ -v -m "not requires_real_llm"
530+
# Config-only integration with no dependencies — it uses Node's built-in
531+
# test runner. The runtime MCP bridge is `npx mcp-remote` (Node), so this
532+
# integration requires only Node.js (no Python).
533+
run: npm test
539534

540535
test-omo-integration:
541536
needs: [detect-changes]

hindsight-docs/docs-integrations/zed.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ Zed doesn't yet have native HTTP-MCP transport, so the server is connected throu
1919

2020
## Setup
2121

22+
`hindsight-zed` is a zero-dependency Node CLI — Node.js is the only requirement (already needed for the `mcp-remote` bridge). Run it straight from npm with `npx`:
23+
24+
```bash
25+
npx @vectorize-io/hindsight-zed init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-memory
26+
```
27+
28+
Or install it globally for a persistent command:
29+
2230
```bash
23-
pip install hindsight-zed
31+
npm install -g @vectorize-io/hindsight-zed
2432
hindsight-zed init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-memory
2533
```
2634

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
.venv/
2-
__pycache__/
3-
*.pyc
1+
node_modules/
2+
*.log
3+
.DS_Store
4+
5+
# Local scaffold written by `hindsight-zed init` when pointed at this dir
6+
/settings.json

hindsight-integrations/zed/README.md

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,21 @@ Zed has no pre-prompt hook, but it does support two things this integration uses
2222

2323
Zed doesn't yet have native HTTP-MCP transport, so the server is connected
2424
through the [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) stdio bridge
25-
(run via `npx`) — that means you need Node.js installed.
25+
(run via `npx`). Because that bridge already runs on Node.js, this setup tool is
26+
a Node CLI too — so **Node.js is the only requirement**.
2627

2728
## Install
2829

30+
No global install needed — run it straight from npm with `npx`:
31+
2932
```bash
30-
pip install hindsight-zed
33+
npx @vectorize-io/hindsight-zed init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-memory
34+
```
35+
36+
Or install it for a persistent command:
37+
38+
```bash
39+
npm install -g @vectorize-io/hindsight-zed
3140
hindsight-zed init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-memory
3241
```
3342

@@ -45,12 +54,14 @@ open local server).
4554
4655
## Commands
4756

48-
| Command | Description |
49-
| --- | --- |
50-
| `hindsight-zed init` | Add the MCP server + recall/retain rule |
51-
| `hindsight-zed status` | Show whether the server + rule are configured |
52-
| `hindsight-zed uninstall` | Remove the server + rule |
53-
| `hindsight-zed init --print-only` | Print the config to add manually |
57+
| Command | Description |
58+
| --------------------------------- | --------------------------------------------- |
59+
| `hindsight-zed init` | Add the MCP server + recall/retain rule |
60+
| `hindsight-zed status` | Show whether the server + rule are configured |
61+
| `hindsight-zed uninstall` | Remove the server + rule |
62+
| `hindsight-zed init --print-only` | Print the config to add manually |
63+
64+
(Prefix any of these with `npx ` if you didn't install globally.)
5465

5566
## What gets written
5667

@@ -63,12 +74,14 @@ open local server).
6374
"source": "custom",
6475
"command": "npx",
6576
"args": [
66-
"-y", "mcp-remote",
77+
"-y",
78+
"mcp-remote",
6779
"https://api.hindsight.vectorize.io/mcp/my-memory/",
68-
"--header", "Authorization: Bearer YOUR_HINDSIGHT_API_KEY"
69-
]
70-
}
71-
}
80+
"--header",
81+
"Authorization: Bearer YOUR_HINDSIGHT_API_KEY",
82+
],
83+
},
84+
},
7285
}
7386
```
7487

@@ -78,20 +91,20 @@ the start of each task and `retain` durable facts.
7891

7992
## Configuration
8093

81-
| Setting | Env var | Default |
82-
| --- | --- | --- |
83-
| API URL | `HINDSIGHT_API_URL` | `https://api.hindsight.vectorize.io` |
84-
| API token | `HINDSIGHT_API_TOKEN` | _(none; required for Cloud)_ |
85-
| Bank id | `HINDSIGHT_ZED_BANK_ID` | `zed` |
94+
| Setting | Env var | Default |
95+
| --------- | ----------------------- | ------------------------------------ |
96+
| API URL | `HINDSIGHT_API_URL` | `https://api.hindsight.vectorize.io` |
97+
| API token | `HINDSIGHT_API_TOKEN` | _(none; required for Cloud)_ |
98+
| Bank id | `HINDSIGHT_ZED_BANK_ID` | `zed` |
8699

87100
These can also live in `~/.hindsight/zed.json` (written by `init`).
88101

89102
## Development
90103

104+
Requires Node.js ≥ 18.3. There are no dependencies to install.
105+
91106
```bash
92-
uv sync
93-
uv run pytest tests -v -m 'not requires_real_llm' # deterministic suite
94-
uv run pytest tests -v -m requires_real_llm # gated MCP-endpoint check
107+
node --test # run the test suite
95108
```
96109

97110
## License
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
import { main } from "../src/cli.js";
3+
4+
process.exit(main());

hindsight-integrations/zed/hindsight_zed/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

hindsight-integrations/zed/hindsight_zed/cli.py

Lines changed: 0 additions & 173 deletions
This file was deleted.

0 commit comments

Comments
 (0)