trylode 0.5.4 → 0.6.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/PERMISSIONS.md CHANGED
@@ -39,6 +39,10 @@ The same as `--gate`, for a third hook: one `Stop` entry in `.claude/settings.lo
39
39
 
40
40
  Reads `package.json`, `package-lock.json` (installed versions only), `requirements.txt` and `pyproject.toml`, never through links, and whether platform config files exist (names only). Only when the project uses a package on Lode's list, it sends `POST https://trylode.io/v1/gate?log=0` with those package names and Lode platform codes, with logging off, plus one run code with the first request (`hook`, `cli` or `ci`: the verify hook, the command, or the command in CI), of which Lode keeps only that code and the date, to count runs; and, when a platform config file was found, it reads the public change feed `https://trylode.io/api/changes.json`; never versions, paths, file contents or anything else. Installed versions are compared with the advisory ranges in Lode's answer on your machine. Exit code 1 only when a finding has a code you list with `--fail-on`; if Lode can't be reached it says so and exits 0. Environment variables it reads: `CI` (to choose the run code `ci`) and, for the hook, `CLAUDE_PROJECT_DIR` (the project folder).
41
41
 
42
+ ### Lookups: `find`, `check`, `list`, `platforms`, `stack`, `overlap`, `triage` (write nothing)
43
+
44
+ Each runs the skill's command of the same name and sends only what you look up. `find` sends `GET https://trylode.io/v1/integrations` with the platform and any category, needs, region, stack app names and framework you give. `triage` sends `GET https://trylode.io/v1/triage` with the app, the platform, the symptom code and, if given, the HTTP status class and object code; never error text or logs. `find` and `triage` also read, and `check`, `list`, `stack` and `overlap` only read, Lode's public JSON files under `https://trylode.io/api/`. `stack` also reads, in the current folder only (plain files of at most 1 MB, never through a link), the manifest file names the skill lists (`package.json`, `requirements.txt`, `pyproject.toml`, `Gemfile`, `go.mod`, variable names from `.env.example`, `vercel.json`, `netlify.toml`, `supabase/config.toml`) and sends none of them. `--share` and `--project-code` are dropped, so a lookup never sends a choice, an outcome or a manifest, and never writes a file. Choices and decision records need the skill (`npx trylode setup`), which asks first. Each lookup's user agent is `lode-skill/<version> (trylode; +https://trylode.io/agents/)`, so Lode can count lookups apart from the installed skill. Environment variables a lookup reads: `LODE_BASE` (another Lode address, for testing) and `LODE_UA` (replaces that user agent).
45
+
42
46
  ## Reads
43
47
 
44
48
  Only the files above, to see what is already there. It never follows links, never edits a file it can't parse or couldn't write back exactly (a repeated key, or a number JSON can't keep exactly), and refuses files that are links, hard links, larger than 1 MB or not plain UTF-8.
package/README.md CHANGED
@@ -7,7 +7,17 @@ npx trylode setup # shows what it would add
7
7
  npx trylode setup --yes # adds it
8
8
  ```
9
9
 
10
- It adds:
10
+ No setup needed to look something up. From any folder:
11
+
12
+ ```bash
13
+ npx trylode find vercel --category email-delivery # apps for a need on a platform, ranked by fit
14
+ npx trylode check resend vercel # one app's facts on one platform
15
+ npx trylode triage resend vercel --symptom rate-limited # sourced facts behind a failure
16
+ ```
17
+
18
+ Also `list`, `platforms`, `stack` (this folder's apps) and `overlap`. Each fact has its source link and last-verified date. Lookups write nothing and send Lode only what you look up.
19
+
20
+ Setup adds:
11
21
 
12
22
  1. **Lode's MCP server** to `.mcp.json` (Claude Code and VS Code's Copilot), `.cursor/mcp.json` (Grok Build, formerly Cursor), `.vscode/mcp.json` (VS Code), `.gemini/settings.json` (Gemini CLI) and `.codex/config.toml` (Codex, in a trusted project). Hosted, no sign-in or API key.
13
23
  2. **The rules line** to `CLAUDE.md`, `AGENTS.md` (read by Codex and Copilot), `GEMINI.md` (each created if missing; `--no-agents-md` leaves `AGENTS.md` out) and `.cursor/rules/lode.mdc` (plus `.grok/rules/lode.md` for Grok Build's terminal app when the line won't be in `AGENTS.md`). This is the step that matters most: agents reliably use a tool their instructions file tells them about.
package/bin/cli.mjs CHANGED
@@ -32,6 +32,16 @@ const USAGE = `Usage:
32
32
  code --fail-on lists (for CI); warn only without it. Sends package names on Lode's list and platform codes,
33
33
  with logging off (a verify run is counted by date and run code only). If Lode can't be reached it prints
34
34
  that and exits 0.
35
+ npx trylode find <platform> [--category c] [--needs a,b] [--region XX] [--stack a,b] [--framework f]
36
+ npx trylode check <app> [platform]
37
+ npx trylode list <platform> [--category c] [--all]
38
+ npx trylode platforms
39
+ npx trylode stack [--framework f]
40
+ npx trylode overlap <platform> --apps "A,B"
41
+ npx trylode triage <app> <platform> --symptom <code> [--status 429]
42
+ Looks up Lode's facts from any folder, with nothing installed: which apps integrate with a platform, what
43
+ syncs and which way, price by currency, plan, regions and limits, each with its source and verified date.
44
+ Sends Lode only what you look up (app, platform, needs, region, symptom code). Writes nothing.
35
45
  npx trylode remove [--yes] [--gate] [--triage] [--verify]
36
46
  Takes out only what setup (or the skill's init) added.
37
47
  --gate Removes only Lode Gate (leaves the rest of your Lode setup intact).
@@ -44,12 +54,38 @@ Setup and remove send nothing to Lode. What Lode Gate sends when it runs: PERMIS
44
54
  const GATE_OFFER = 'Optional for Claude Code: Lode Gate adds Lode\'s facts to your agent\'s context before installing a known package (never blocks). Enable with: npx trylode setup --gate --yes';
45
55
  // LOD-287 (Paul approved the wording 03-12-2026): the one line setup adds when the verify hook is not on.
46
56
  const VERIFY_OFFER = 'Optional for Claude Code: Lode verify checks this project\'s integrations against Lode\'s facts before the agent says it is done, and stops it once for each new finding. Enable with: npx trylode setup --verify --yes';
47
- // LOD-307 (Paul approved the wording 04-12-2026, plain address): adds Lode as a claude.ai connector for Claude chat and
48
- // desktop. Printed only; setup never runs it (it signs in to the user's claude.ai account).
49
- const CONNECTOR_OFFER = 'To use Lode in Claude chat and desktop, run: claude mcp add --web lode https://trylode.io/mcp';
57
+ // LOD-307 (Paul approved the wording 04-12-2026, plain address). LOD-310 (Paul approved 05-12-2026): the address carries the
58
+ // listing code claude-web, so connector connections are attributed. Printed only; setup never runs it (it signs in to the user's claude.ai account).
59
+ const CONNECTOR_OFFER = 'To use Lode in Claude chat and desktop, run: claude mcp add --web lode https://trylode.io/mcp?src=claude-web';
50
60
 
51
61
  const argv = process.argv.slice(2);
52
62
  const cmd = argv[0];
63
+
64
+ // LOD-329: one-shot lookups, so any agent with a shell can ask Lode without setup. Only the skill's read commands pass
65
+ // through; --share and --project-code are dropped, so these never send a choice or outcome and never write a file.
66
+ const LOOKUPS = ['find', 'check', 'list', 'platforms', 'stack', 'overlap', 'triage'];
67
+ const NEVER = new Set(['--share', '--project-code']);
68
+ if (LOOKUPS.includes(cmd)) {
69
+ try {
70
+ // Counted as trylode, not as the installed skill (Paul's yes 05-12-2026): the skill's user agent plus "trylode;".
71
+ // Set before the import, because the skill reads LODE_UA once when it loads; a LODE_UA already set (tests) wins.
72
+ if (!process.env.LODE_UA) {
73
+ const { readFileSync } = await import('node:fs');
74
+ const v = /export const SKILL_VERSION = '([^']+)'/.exec(readFileSync(new URL('../skill/scripts/lode.mjs', import.meta.url), 'utf8'))?.[1];
75
+ if (v) process.env.LODE_UA = `lode-skill/${v} (trylode; +https://trylode.io/agents/)`;
76
+ }
77
+ const { main } = await import('../skill/scripts/lode.mjs');
78
+ const out = String(await main([cmd, ...argv.slice(1).filter((a) => !NEVER.has(a))]));
79
+ // A command missing its arguments gets the skill's usage, which lists commands trylode doesn't run: show ours
80
+ if (out.startsWith('Usage:')) { console.log(USAGE); process.exit(1); }
81
+ // The skill's hints name its own script; here the same lookups run as npx trylode <command>
82
+ console.log(out.replace(new RegExp(`node lode\\.mjs (${LOOKUPS.join('|')})\\b`, 'g'), 'npx trylode $1'));
83
+ } catch (e) {
84
+ console.error(`trylode: ${e.message}`);
85
+ process.exit(1);
86
+ }
87
+ process.exit(0);
88
+ }
53
89
  // Only these flags are passed on; anything else is ignored. --gate is handled here (warn mode, this person only):
54
90
  // --shared and --mode are never passed through, so setup can't put the hook in a committed file (LOD-262).
55
91
  const flags = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trylode",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "One command puts Lode in your project: the MCP server, the rules line and the skill, so your coding agent checks integration facts before it adds a third-party service.",
5
5
  "type": "module",
6
6
  "bin": { "trylode": "bin/cli.mjs" },
@@ -84,7 +84,7 @@ export function loadSignals() {
84
84
 
85
85
  // ---- Step 2: the hook (PostToolUseFailure). Sends only app, platform, symptom code and status number, never the
86
86
  // output text, the command, paths, versions or the session id. Asks once per app, platform and symptom in a session.
87
- const VERSION = '2026.12.7'; // the skill's version: kept equal to SKILL_VERSION in lode.mjs by a test
87
+ const VERSION = '2026.12.8'; // the skill's version: kept equal to SKILL_VERSION in lode.mjs by a test
88
88
  // The hook ships inside the skill, so it identifies as the skill: the server already counts `lode-skill` and leaves
89
89
  // `lode-skill-test` (Lode's own tests) out of every figure. Only Lode's tests may point it at this machine.
90
90
  const BASE = (() => { const u = process.env.LODE_GATE_URL || ''; return /^http:\/\/(127\.0\.0\.1|localhost)(:\d+)?$/.test(u) ? u : 'https://trylode.io'; })();
@@ -56,7 +56,7 @@ import { pathToFileURL } from 'node:url';
56
56
  const BASE = (process.env.LODE_BASE || 'https://trylode.io').replace(/\/$/, '');
57
57
  // The skill's version (year.month.day of its last change; a test makes every change bump it), sent in the user agent
58
58
  // so Lode can count which copies agents run. Copies before 03-12-2026 all sent 0.1.
59
- export const SKILL_VERSION = '2026.12.7';
59
+ export const SKILL_VERSION = '2026.12.8';
60
60
  const UA = process.env.LODE_UA || `lode-skill/${SKILL_VERSION} (+https://trylode.io/agents/)`;
61
61
 
62
62
  export const NAMES = { xero: 'Xero', 'quickbooks-online': 'QuickBooks Online', hubspot: 'HubSpot', shopify: 'Shopify', stripe: 'Stripe', supabase: 'Supabase', vercel: 'Vercel', netlify: 'Netlify', n8n: 'n8n', lovable: 'Lovable', replit: 'Replit', linear: 'Linear', github: 'GitHub', langchain: 'LangChain', cursor: 'Grok Build', cloudflare: 'Cloudflare' };
@@ -709,7 +709,14 @@ export function parseGemfile(text) { return [...new Set([...String(text).matchAl
709
709
  export function parseGoMod(text) {
710
710
  const out = new Set();
711
711
  const t = String(text);
712
- for (const m of t.matchAll(/^require\s+\(([\s\S]*?)\)/gm)) for (const l of m[1].split('\n')) { const p = l.trim().split(/\s+/)[0]; if (p && !p.startsWith('//')) out.add(p); }
712
+ // Each require block up to its first ")": found with indexOf, so an unclosed block can't make it slow (LOD-329 review)
713
+ const re = /^require\s+\(/gm;
714
+ for (let m; (m = re.exec(t));) {
715
+ const end = t.indexOf(')', re.lastIndex);
716
+ if (end < 0) break;
717
+ for (const l of t.slice(re.lastIndex, end).split('\n')) { const p = l.trim().split(/\s+/)[0]; if (p && !p.startsWith('//')) out.add(p); }
718
+ re.lastIndex = end + 1;
719
+ }
713
720
  for (const m of t.matchAll(/^require\s+([^\s(]+)\s+/gm)) out.add(m[1]);
714
721
  return [...out];
715
722
  }
@@ -717,11 +724,15 @@ export function parseGoMod(text) {
717
724
  export function parseEnvNames(text) { return [...new Set(String(text).split('\n').map((l) => (l.match(/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/) || [])[1]).filter(Boolean))]; }
718
725
 
719
726
  export function readManifests(dir = process.cwd()) {
720
- const read = (f) => { const p = join(dir, f); return existsSync(p) ? readFileSync(p, 'utf8') : null; };
727
+ try { dir = realpathSync(dir); } catch { /* a missing folder reads as empty below */ }
728
+ // Every file in a project is untrusted (LOD-329 review): plain files only, never through a link, at most 1 MB, opened
729
+ // without blocking, so a planted link, pipe or huge file is skipped instead of followed, hung on or loaded.
730
+ const read = (f) => readProjectFile(f, { cwd: dir }).text ?? null;
721
731
  const pkg = read('package.json'), req = read('requirements.txt'), py = read('pyproject.toml'), gem = read('Gemfile'), gomod = read('go.mod'), env = read('.env.example');
732
+ const plain = (f) => { if (viaLink(join(dir, f), dir)) return false; try { return lstatSync(join(dir, f)).isFile(); } catch { return false; } };
722
733
  return {
723
734
  npm: pkg ? parsePackageJson(pkg) : [], pypi: [...(req ? parseRequirements(req) : []), ...(py ? parsePyproject(py) : [])], gem: gem ? parseGemfile(gem) : [], go: gomod ? parseGoMod(gomod) : [],
724
- env: env ? parseEnvNames(env) : [], files: MANIFESTS.filter((f) => existsSync(join(dir, f))).map((f) => f.split('\\').join('/')),
735
+ env: env ? parseEnvNames(env) : [], files: MANIFESTS.filter(plain).map((f) => f.split('\\').join('/')),
725
736
  };
726
737
  }
727
738