Skip to content

Commit fe5a81f

Browse files
exilisclaude
andauthored
feat: VS Code / Cursor preview extension (#18)
* docs: design for VS Code/Cursor preview extension Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * docs: implementation plan for VS Code/Cursor extension Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat: scaffold reefdoc VS Code extension with stub command * feat: add binary-path resolution and free-port selection * feat: spawn reefdoc binary and wait until it serves * fix: reject on reefdoc spawn error instead of crashing host startServer attached no 'error' listener on the spawned child. When spawn fails to launch the binary (bad/missing binaryPath, ENOENT, permissions), Node emits an 'error' event with no listener, producing an uncaught exception that crashes the host process; 'exit' never fires so the existing early-exit detection never engaged. Add a child.on('error') listener that marks the child as exited and records the error, and surface it in the rejection ("reefdoc failed to start: ..."). Add a regression test asserting startServer rejects (rather than crashing) on a bad binary path. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat: webview panel that frames the reefdoc server Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat: wire reefdoc.openPreview command with lifecycle and errors * fix: guard openPreview against concurrent double-spawn * chore: bundle per-platform binaries and package the extension * fix: honor reefdoc.host in webview CSP and stop server on panel-create failure Derive the webview CSP frame-src from the actual server URL origin instead of a hardcoded loopback allowlist, so a non-loopback reefdoc.host doesn't get silently blocked. Thread the host into findFreePort so the port probe binds the same interface the server will use. Also stop the spawned server if panel creation throws, so the child process doesn't leak. * chore: commit extension package-lock for reproducible installs Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * docs: add managed agent-policy block to CLAUDE.md Co-Authored-By: Claude Fable 5 <[email protected]> * feat: list .worktrees and disable dir filtering inside them .worktrees was swept up by the blanket dot-directory skip in isNoiseDir, so sibling worktree checkouts were invisible in the tree. Add it to a named dotDirAllowlist alongside .allium/.claude, and switch directory noise filtering off entirely below any .worktrees segment: a worktree is a whole checkout, and hiding its .git/node_modules misrepresents it. The file-level isViewable filter is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(test): import ReefdocServer as a type in the smoke test ReefdocServer is an interface, so a value import of it fails under Node's type-stripping loader with "does not provide an export named ReefdocServer" — breaking the Frontend (node --test) CI job. Split it into a separate `import type`, which is erased before the runtime import list is built. Verified: node --test → 111 tests, 111 pass, 0 fail (was 110/111). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
1 parent 1135d72 commit fe5a81f

15 files changed

Lines changed: 3005 additions & 4 deletions

CLAUDE.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
<!-- agent-policy:start (managed block — do not edit inside markers) -->
2+
# Agent Policy (strict)
3+
4+
These rules bind every AI agent working in this repository. They override
5+
default agent behavior. Project instructions below may add to them but
6+
never loosen them.
7+
8+
## Git
9+
- Do NOT commit, push, tag, rebase, force-push, or `reset --hard` unless
10+
the user explicitly requests it in the current session.
11+
- Never push directly to `main`/`master`. Never rewrite published history.
12+
- At handoff, report changed files and propose exact git commands instead
13+
of running them.
14+
15+
## Secrets & data
16+
- Never read, print, copy, or commit secrets: `.env*`, `.secrets/`,
17+
`*.pem`, tokens, API keys, customer data.
18+
- Never send repository contents to external services without explicit
19+
approval.
20+
21+
## Safety
22+
- No destructive filesystem operations (`rm -rf`, bulk deletes) outside
23+
paths you created this session.
24+
- No dependency upgrades, lockfile regeneration, schema or public-API
25+
changes unless explicitly requested.
26+
27+
## Scope & quality
28+
- Make the smallest change that satisfies the request; do not refactor
29+
unrelated code.
30+
- Run the repo's tests/linters before claiming work is done; report
31+
failures honestly — never claim success without verification.
32+
33+
## Tracking & handoff
34+
- If this repo has `.beads/`, track work with `bd` (run `bd prime`);
35+
otherwise do not create markdown TODO files.
36+
- End every session with: what changed, what was verified, and suggested
37+
next commands (including any commit you propose).
38+
<!-- agent-policy:end -->
39+
140
# reefdoc — project instructions
241

342
## Release process (follow every time a version ships)

editor/vscode/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
out/
3+
*.vsix
4+
bin/

editor/vscode/.vscodeignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
src/**
2+
scripts/**
3+
tsconfig.json
4+
**/*.test.ts
5+
**/*.map
6+
.gitignore
7+
node_modules/**

editor/vscode/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# reefdoc for VS Code / Cursor
2+
3+
Opens the [reefdoc](https://github.com/exilis/reefdoc) markdown / mermaid /
4+
allium preview inside an editor panel. Bundles the reefdoc binary — no separate
5+
install needed.
6+
7+
## Usage
8+
9+
Open a folder, then run **reefdoc: Open Preview** from the command palette. A
10+
panel opens beside your editor showing reefdoc's file tree, tabs, and live
11+
reload. Close the panel to stop the server.
12+
13+
## Settings
14+
15+
- `reefdoc.binaryPath` — use a custom binary instead of the bundled one.
16+
- `reefdoc.host` — listen host (default `127.0.0.1`).
17+
18+
## Build & package
19+
20+
```bash
21+
npm install
22+
npm run bundle # cross-compiles binaries into bin/ (needs Go on PATH)
23+
npm run build # compiles TypeScript into out/
24+
npm run package # produces reefdoc-<version>.vsix
25+
```
26+
27+
Install the `.vsix` via the Extensions view → "Install from VSIX…".

0 commit comments

Comments
 (0)