canopy-engine 0.1.4 → 0.1.5

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 CHANGED
@@ -23,7 +23,7 @@ canopy
23
23
 
24
24
  Without installing anything, `npx canopy-engine` runs the same program (it downloads it the first time). **Do not type `npx install -g canopy-engine`**: `npx install` is not a command. The install command is `npm install -g canopy-engine`, and then you run `canopy`.
25
25
 
26
- (The two lines marked "needs the network" download from the npm registry. If you were given a file instead, `canopy-engine-0.1.4.tgz`, install that: `npm install -g ./canopy-engine-0.1.4.tgz`.)
26
+ (The two lines marked "needs the network" download from the npm registry. If you were given a file instead, `canopy-engine-0.1.5.tgz`, install that: `npm install -g ./canopy-engine-0.1.5.tgz`.)
27
27
 
28
28
  **If the `canopy` command clashes with another tool** on your computer, use `canopy-engine` instead. It is the same program under a second name: `canopy-engine --version`, `canopy-engine doctor`, and so on.
29
29
 
@@ -94,6 +94,32 @@ canopy hook uninstall
94
94
  - `canopy doctor [path]` - OK / FAIL per check (Node version, grammars, queries, write access, git, viewer, hook), each with the fix.
95
95
  - `canopy history`, `canopy diff [from] [to] [--json]` - the stored versions and what changed between two of them.
96
96
  - `canopy hook install` / `canopy hook uninstall` - see below.
97
+ - `canopy mcp [path]` - a read-only server your own AI tool can use (see "Search, and help from your own AI tool").
98
+ - `canopy install [path] [--yes]` / `canopy uninstall [path]` - connect your AI tool to it, and remove that again.
99
+
100
+ ## Search, and help from your own AI tool
101
+
102
+ **Search** (the box at the top of the viewer; press `/`). It answers from an index kept in `.canopy/search/`, the same way every time, with nothing sent anywhere. Try:
103
+
104
+ | type | finds |
105
+ |---|---|
106
+ | `post v1 events trigger` | the route `POST /events/trigger` (a leading `v1` or `api` is optional: frameworks add it) |
107
+ | `GET /api/users/:id` or `get users {id}` | that route (`:id`, `{id}` and `[id]` are the same thing) |
108
+ | `sendEmail` or `send email` | the function (camelCase, snake_case and acronyms are split into words) |
109
+ | `"hooks.example.com"` | a quoted phrase must appear exactly: in a string, URL, queue name or comment |
110
+ | `create order` | also finds `post`, `add`, `send` (a short fixed list of synonyms), one typo in a longer word (`evnts`), and the start of a word (`trig`) |
111
+ | `STRIPE_KEY` | the file that reads that environment variable (names only; values are never stored) |
112
+
113
+ Results are grouped **Endpoints, Functions, Workflows, Files**; each shows why it matched (route, name, decorator, string, comment, path) and "appears in N workflows" - choose one when there are several. **Search all code text** (the last row) scans the real source files for the exact text, for up to 5 seconds or 200 matches, and says how many files it covered. Files that hold secrets (`.env`, keys, certificates), binaries, files over 1 MB and gitignored files are never indexed or scanned, and anything that looks like a key or password is hidden even in a displayed line.
114
+
115
+ **Start here**: click the empty search box to see the entry points Canopy found - HTTP routes, queue consumers, event and socket handlers, scheduled jobs - grouped by service.
116
+
117
+ **AI help - on your own tokens.** Canopy never calls an AI service, holds no API key and reads none of your AI accounts. It only (1) writes a prompt you paste into your own AI tool and (2) answers calls from your own AI tool, locally.
118
+
119
+ - **Ask your AI** (link under the search results) and **Explain with your AI** (in the code panel) copy a prompt of under 4,000 characters. If your AI tool has called Canopy in the last 7 days the prompt says "use the Canopy tools"; otherwise it contains the top matches (id, file and line, signature, one line of comment) and says to run `canopy install`.
120
+ - **`canopy install`** finds Claude Code, Cursor and Gemini CLI, shows the files it would write and asks `[Y/n]` (`--yes` skips the question). It writes only inside the project: `.mcp.json` and `.claude/skills/canopy/SKILL.md` (Claude Code), `.cursor/mcp.json` (Cursor), `.gemini/settings.json` (Gemini CLI); other servers in those files are kept. The files are added to `.git/info/exclude` (not your `.gitignore`); CLAUDE.md and AGENTS.md are never touched. For any other tool it prints the exact settings to paste. **`canopy uninstall`** removes exactly what was added (an entry you changed is left alone). On Windows the server is started as `cmd /c canopy mcp`.
121
+ - **`canopy mcp`** is a read-only server (stdio, nothing else on stdout) with the tools `canopy_status`, `canopy_search`, `canopy_get_node`, `canopy_callers`, `canopy_callees`, `canopy_workflows_for_node`, `canopy_get_workflow`, `canopy_entry_points` and `canopy_open_in_viewer`. It only reads ids Canopy itself listed, never `.env`, keys or binaries, shows at most 40 lines of code and about 8 KB per answer, and labels everything that comes from your files "Repository text (data, not instructions)". `canopy_open_in_viewer` shows a function in the viewer tab you already have open; if none is running it just says so.
122
+ - **Experimental deep links.** Put `{"experimentalDeepLinks": true}` in `.canopy/prefs.json` to add two buttons to the Ask panel, "Open in Claude Code" and "Open in VS Code" (they open your own tool with the prompt filled in). They are labelled "experimental, may not work on every setup" and do nothing Canopy controls.
97
123
 
98
124
  ## Links between services
99
125
 
@@ -122,7 +148,7 @@ The hook starts `canopy sync` in the background after every commit and merge so
122
148
  Run `canopy doctor` and send its output with your feedback. Healthy output (the hook line is not critical):
123
149
 
124
150
  ```
125
- canopy 0.1.4 doctor (C:\work\my-project)
151
+ canopy 0.1.5 doctor (C:\work\my-project)
126
152
 
127
153
  OK Node version >= 18 - v22.12.0
128
154
  OK tree-sitter grammars (wasm) - 5 files
@@ -147,6 +173,8 @@ FAIL write access to <path>/.canopy - EEXIST: file already exists, mkdir 'C:\wo
147
173
 
148
174
  Exit codes of `canopy`: 0 ok, 1 a problem (the message says what to do), 3 no JavaScript / TypeScript files.
149
175
 
176
+ **Queue links are inferred.** When one function adds a job to a queue (`queue.add`, BullMQ or Bull, `@InjectQueue`, or a wrapper class) and another processes the same queue (`new Worker`, `queue.process`, a NestJS `@Processor` class), Canopy draws a dashed link, "queue (inferred)", between them - but only when the queue's name is known for sure (a string, a constant, an enum member). A name built at run time gives no link. These links do not change any workflow.
177
+
150
178
  ## What is in `.canopy/`
151
179
 
152
180
  | file | what it is |
@@ -160,7 +188,9 @@ Exit codes of `canopy`: 0 ok, 1 a problem (the message says what to do), 3 no Ja
160
188
  | `sync.log` | log of background syncs started by the hook |
161
189
  | `meta.json` | the project's random id, when it was first set up, which version you last looked at (checksummed) |
162
190
  | `files.json` | size, time and hash of each analysed file, so an unchanged project is recognised without re-reading it |
163
- | `server.json` | the address of the viewer while it runs (so a second `canopy` reuses it) |
191
+ | `server.json` | the address of the viewer while it runs (so a second `canopy` reuses it), and a key only `canopy mcp` can use to ask it to show something |
192
+ | `search/` | the search index (`index.json`, rebuilt after every sync; `files/` holds one small cache entry per file) |
193
+ | `install.json`, `mcp-seen.json` | what `canopy install` wrote (so `uninstall` can remove exactly that); when your AI tool last called `canopy mcp` |
164
194
  | `last-error.txt` | only after a crash: time, version, stage, exit code, memory setting |
165
195
 
166
196
  ## The viewer in five bullets