trylode 0.5.2 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trylode",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
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" },
@@ -16,7 +16,7 @@ secrets. Privacy policy: https://trylode.io/privacy/
16
16
  | `stack` | `package.json`, `requirements.txt`, `pyproject.toml`, `Gemfile`, `go.mod`, variable NAMES in `.env.example`, `vercel.json`, `netlify.toml`, `supabase/config.toml` | with `--share`: the app and platform codes found, the framework | nothing |
17
17
  | `triage` | nothing | the app, platform, one fixed symptom code, the HTTP status if given (only its class is kept) and the `--object` code if given (sent only when it is one of the platform's object codes, otherwise not sent); with `--share`: the outcome code and the `--switched-to` app | nothing |
18
18
  | `watch` (`watch`, `watch changes`, `watch stop`) | `lode-integrations.json`, `.lode/watch.json` and an existing `.gitignore` (never through links; a file not in the expected shape is refused) | `watch`: only with `--share`, the Lode ids of the integrations still kept in `lode-integrations.json` (at most 50); Lode makes a fresh random watch code, unless `--project-code` asks it to use the file's own project code; the watch code and token on later updates. `watch changes` and `watch stop`: the watch code and the token only. Lode keeps the list of ids until the watch is stopped; `stop` deletes it | `watch --share`: `.lode/watch.json` (mode 0600: the watch code and the secret token Lode returns once; the `.lode` folder is made if missing) and, only when a `.gitignore` already exists, one appended `.lode/` line; `watch stop` removes the token file |
19
- | `init` | `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.gemini/settings.json`, `.codex/config.toml`, `.claude/lode-init.json`, `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursor/rules/lode.mdc`, `.grok/rules/lode.md` (only when the rules line won't be in `AGENTS.md`), and with `--no-agents-md` `.github/copilot-instructions.md` | nothing | only with `--yes`, only inside a project folder and never through links: one `lode` entry in those MCP files (`--client claude`, `cursor`, `vscode`, `gemini` or `codex` picks one client; in `.codex/config.toml` it is one marked `[mcp_servers.lode]` block added at the end, and a file that already names a `lode` server or has an inline `mcp_servers` table is left alone), a copy of this skill in `.claude/skills/`, the Lode rules lines (check integrations with Lode; record integration decisions in `docs/adr/`) as one marked block at the end of `CLAUDE.md`, `AGENTS.md` and `GEMINI.md` (each created if missing; `AGENTS.md` left out with `--no-agents-md`, which writes the line to `.github/copilot-instructions.md` instead; `.grok/rules/lode.md` gets it whenever it won't be in `AGENTS.md`, and is removed only if unchanged and the note says init created it) and as `.cursor/rules/lode.mdc` (left out with `--no-rules`), and a note of what was added in `.claude/lode-init.json`; a file it can't parse is left alone; `init --remove --yes` undoes only what init added (the rules block only when unchanged); with `--src setup` (used by `npx trylode setup`) the entry's address is `https://trylode.io/mcp?src=setup`, and `--remove` recognises either address |
19
+ | `init` | `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.gemini/settings.json`, `.codex/config.toml`, `.claude/lode-init.json`, `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursor/rules/lode.mdc`, `.grok/rules/lode.md` (only when the rules line won't be in `AGENTS.md`), and with `--no-agents-md` `.github/copilot-instructions.md` | nothing | only with `--yes`, only inside a project folder and never through links: one `lode` entry in those MCP files (`--client claude`, `cursor`, `vscode`, `gemini` or `codex` picks one client; in `.codex/config.toml` it is one marked `[mcp_servers.lode]` block added at the end, and a file that already names a `lode` server or has an inline `mcp_servers` table is left alone), a copy of this skill in `.claude/skills/`, the Lode rules lines (check integrations with Lode; record integration decisions in `docs/adr/`) as one marked block at the end of `CLAUDE.md`, `AGENTS.md` and `GEMINI.md` (each created if missing; `AGENTS.md` left out with `--no-agents-md`, which writes the line to `.github/copilot-instructions.md` instead; `.grok/rules/lode.md` gets it whenever it won't be in `AGENTS.md`, and is removed only if unchanged and the note says init created it) and as `.cursor/rules/lode.mdc` (left out with `--no-rules`), and a note of what was added in `.claude/lode-init.json`; a file it can't parse is left alone; run again, it updates a rules block or rule file that exactly matches one an earlier init writes (`.grok/rules/lode.md` only when the note says init created it) to the current one; `init --remove --yes` undoes only what init added (the rules block only when unchanged); with `--src setup` (used by `npx trylode setup`) the entry's address is `https://trylode.io/mcp?src=setup`, and `--remove` recognises either address |
20
20
  | `init --gate` (Lode Gate, opt-in) | `.claude/settings.local.json` (or `.claude/settings.json` with `--shared`), `.claude/lode-init.json`, `.claude/.gitignore`, the Gate files already in `.claude/skills/lode-integration-check/` | nothing | only with `--yes`, only inside a project folder and never through links: one PreToolUse hook entry in that settings file (by default only for you: Claude Code keeps `settings.local.json` out of git; `--shared` gives it to everyone who opens the project), a copy of this skill with `gate.mjs` and `gate-packages.json` in `.claude/skills/` (it never overwrites a file, and refuses if Gate files already there differ from its own), two lines at the end of `.claude/.gitignore` inside a git repository (a comment and `settings.local.json`, so the hook file is never committed; `--remove` takes out exactly those two), and a note in `.claude/lode-init.json`; `init --gate --remove --yes` deletes only the files it copied, unchanged, from its fixed list |
21
21
  | Gate hook (`scripts/gate.mjs`, runs before each shell command once switched on) | the shell command Claude is about to run and the session id (on your machine only; the id is used only to name the temp file below), the project folder (`CLAUDE_PROJECT_DIR`, else the working folder), whether `vercel.json`, `.vercel/project.json`, `netlify.toml`, `supabase/config.toml`, `wrangler.toml`, `wrangler.json` or `wrangler.jsonc` exist there (names only, never contents), `gate-packages.json`, and `LODE_GATE_LOG` | only when the command installs a package on Lode's list: those package names, the package manager, the platform codes found, the mode and a random code for the Claude Code session; never the command, versions, paths, file contents or the session id; with `LODE_GATE_LOG=0` Lode keeps nothing except the daily rate-limit count | a random session code in your temp folder (tidied after a day) |
22
22
  | `init --triage` (the failure hook, opt-in) | the same files as `init --gate`, for the failure hook's own entry | nothing | only with `--yes`, under the same rules as `init --gate`: one `PostToolUseFailure` hook entry in `.claude/settings.local.json` (or `.claude/settings.json` with `--shared`), `failure-hook.mjs` and `failure-signals.json` copied with this skill, the same `.claude/.gitignore` lines and a note in `.claude/lode-init.json`; `init --triage --remove --yes` undoes only that |
@@ -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.5'; // the skill's version: kept equal to SKILL_VERSION in lode.mjs by a test
87
+ const VERSION = '2026.12.6'; // 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.5';
59
+ export const SKILL_VERSION = '2026.12.6';
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' };
@@ -1328,10 +1328,15 @@ async function initCmd({ client = 'all', yes = false, remove = false, gate = fal
1328
1328
  if (lookalike) { refused.push(`${t.file}: has a lode:rules block that isn't the one lode init writes, so it was left alone.`); continue; }
1329
1329
  if (remove) { if (block) plan.push({ do: 'rules-remove', file: t.file, f, text, st: r.st, kind: 'md', block }); continue; }
1330
1330
  if (text == null && !t.create) continue;
1331
+ // LOD-315 (Paul, 05-12-2026): an exact earlier Lode block is updated in place to the current one; nothing else changes
1332
+ if (block && block !== RULES_BLOCK && block !== crlf(RULES_BLOCK)) { plan.push({ do: 'rules-upgrade', file: t.file, f, text, st: r.st, kind: 'md', next: text.replace(block, () => (block.includes('\r\n') ? crlf(RULES_BLOCK) : RULES_BLOCK)) }); continue; }
1331
1333
  if (text != null && (block || text.includes(RULE) || text.includes(RULE_V1))) continue;
1332
1334
  plan.push({ do: 'rules-add', file: t.file, f, text, st: r.st, kind: 'md' });
1333
1335
  } else if (text == null) { if (!remove) plan.push({ do: 'rules-add', file: t.file, f, text, kind: t.kind }); }
1334
- else if (KNOWN_MDCS.some((m) => text === m || text === crlf(m))) { if (remove) plan.push({ do: 'rules-remove', file: t.file, f, text, st: r.st, kind: t.kind }); }
1336
+ else if (KNOWN_MDCS.some((m) => text === m || text === crlf(m))) {
1337
+ if (remove) plan.push({ do: 'rules-remove', file: t.file, f, text, st: r.st, kind: t.kind });
1338
+ else if (text !== RULES_MDC && text !== crlf(RULES_MDC)) plan.push({ do: 'rules-upgrade', file: t.file, f, text, st: r.st, kind: t.kind, next: text.includes('\r\n') ? crlf(RULES_MDC) : RULES_MDC });
1339
+ }
1335
1340
  else refused.push(`${t.file}: isn't the rule file lode init writes, so it was left alone.`);
1336
1341
  }
1337
1342
  // LOD-306 (Paul, 04-12-2026): Grok Build's terminal app (grok) does not read .mdc rules; it reads *.md in
@@ -1354,6 +1359,7 @@ async function initCmd({ client = 'all', yes = false, remove = false, gate = fal
1354
1359
  else if (!covered) {
1355
1360
  if (g.text == null) plan.push({ do: 'rules-add', file: grokRel, f: path.join(cwd, grokRel), text: null, kind: 'grok' });
1356
1361
  else if (!isOurs(g.text)) refused.push(`${grokRel}: isn't the rule file lode init writes, so it was left alone.`);
1362
+ else if (marker.grok_rules === true && g.text !== RULES_BLOCK && g.text !== crlf(RULES_BLOCK)) plan.push({ do: 'rules-upgrade', file: grokRel, f: path.join(cwd, grokRel), text: g.text, st: g.st, kind: 'grok', next: g.text.includes('\r\n') ? crlf(RULES_BLOCK) : RULES_BLOCK });
1357
1363
  }
1358
1364
  }
1359
1365
  }
@@ -1397,6 +1403,7 @@ async function initCmd({ client = 'all', yes = false, remove = false, gate = fal
1397
1403
  : p.do === 'rules-add' && p.kind === 'toml' ? ` ${p.file}: ${p.text == null ? 'create it with' : 'add, at the end,'} one server "lode" -> ${serverUrl}${p.text == null ? '' : '; nothing else in the file changes'} (Codex reads it in a trusted project)`
1398
1404
  : p.do === 'rules-remove' && p.kind === 'toml' ? ` ${p.file}: remove the "lode" server lode init added (nothing else in the file changes)`
1399
1405
  : p.do === 'rules-add' ? ` ${p.file}: ${p.text == null ? 'create it with' : 'add, at the end,'} the Lode rules lines (the agent checks Lode before it adds an integration, and writes a decision record in docs/adr/)${p.text == null ? '' : '; nothing else in the file changes'}`
1406
+ : p.do === 'rules-upgrade' ? ` ${p.file}: update the Lode rules ${p.kind === 'md' ? 'block' : 'file'} an earlier lode init added to the current one, which adds the decision-record line${p.kind === 'md' ? ' (nothing else in the file changes)' : ''}`
1400
1407
  : p.do === 'rules-remove' ? ` ${p.file}: remove the Lode rules ${p.kind === 'md' ? 'line' : 'file'} lode init added${p.kind === 'md' ? ' (nothing else in the file changes)' : ''}`
1401
1408
  : p.do === 'copy-skill' ? ` ${p.file}/: copy the Lode Integration Check skill (SKILL.md, PERMISSIONS.md, scripts/lode.mjs; no dependencies, nothing runs on install)`
1402
1409
  : ` ${p.file}/: delete the skill files lode init copied, if unchanged`);
@@ -1433,7 +1440,8 @@ async function initCmd({ client = 'all', yes = false, remove = false, gate = fal
1433
1440
  return;
1434
1441
  }
1435
1442
  let next = '';
1436
- if (p.kind === 'md' || p.kind === 'toml') {
1443
+ if (p.do === 'rules-upgrade') next = p.next;
1444
+ else if (p.kind === 'md' || p.kind === 'toml') {
1437
1445
  const lead = ['\r\n\r\n', '\n\n'].find((l) => p.text.includes(l + p.block));
1438
1446
  next = lead ? p.text.replace(lead + p.block, lead.slice(0, lead.length / 2)) : p.text.replace(p.block, '');
1439
1447
  }
@@ -1457,13 +1465,13 @@ async function initCmd({ client = 'all', yes = false, remove = false, gate = fal
1457
1465
  if (p.created && !Object.keys(next[p.key] ?? {}).length && Object.keys(next).length === 1) fs.rmSync(p.f); else write(p, next);
1458
1466
  marker.added = (marker.added || []).filter((a) => a.file !== p.file);
1459
1467
  }
1460
- if (p.do === 'rules-add' || p.do === 'rules-remove') {
1468
+ if (p.do === 'rules-add' || p.do === 'rules-remove' || p.do === 'rules-upgrade') {
1461
1469
  // A failure here is reported, never thrown, so the marker for the steps already done is still written
1462
1470
  try {
1463
1471
  rulesWrite(p);
1464
1472
  if (p.kind === 'toml') marker.added = [...(marker.added || []).filter((a) => a.file !== p.file), ...(p.do === 'rules-add' ? [{ file: p.file, created: p.text == null, toml: true }] : [])];
1465
1473
  // Security review 04-12-2026: the .grok file is removed only when the marker says init created it
1466
- if (p.kind === 'grok') { if (p.do === 'rules-add') marker.grok_rules = true; else delete marker.grok_rules; }
1474
+ if (p.kind === 'grok') { if (p.do === 'rules-add') marker.grok_rules = true; else if (p.do === 'rules-remove') delete marker.grok_rules; }
1467
1475
  } catch (e) { failed.push(` ${p.file}: not changed (${e.code || e.message}).`); }
1468
1476
  }
1469
1477
  if (p.do === 'copy-skill') {