@nexaduo/marc 26.1125.3 → 26.1125.4

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
@@ -32,7 +32,7 @@ Then open any repository in your harness and run `/marc:tech-lead`.
32
32
  | `--harness <claude\|copilot\|codex\|agy>` | Act only on the named harness; repeat for several. Default: every harness on `PATH` |
33
33
  | `--scope <user\|project\|local>` | Claude Code only: the scope to install, update or uninstall |
34
34
  | `--version <tag>` | Must equal the release embedded in this package; otherwise prints the matching `npx` command and exits |
35
- | `--dry-run` | Print the plan and change nothing |
35
+ | `--dry-run` | Print the plan and change nothing (`install` still runs the read-only `plugin list` first) |
36
36
  | `--yes` | Skip the confirmation prompt. Required for `install`, `update` and `uninstall` when not in a terminal; `doctor` and `--dry-run` never need it |
37
37
 
38
38
  ## What it does, and what it doesn't
@@ -45,13 +45,15 @@ Then open any repository in your harness and run `/marc:tech-lead`.
45
45
  - Antigravity installs from a shallow clone of the release tag, checked against
46
46
  the commit embedded in this package, then deletes the clone.
47
47
  - `uninstall` never removes a marketplace registration.
48
+ - `install` never upgrades an existing install. If the installed version differs
49
+ from the launcher release it prints `STALE` and exits non-zero; run `update`.
48
50
  - `doctor` changes nothing and exits non-zero when it finds drift.
49
51
 
50
52
  ## Versions
51
53
 
52
54
  Each npm version embeds one mARC release tag. A tag `vYY.M.D[.N]` (no leading
53
55
  zeros) maps to npm `YY.(M*100+D).N`, where a missing `.N` is `0`. For example,
54
- `v26.11.25.3` is `26.1125.3` and `v26.12.1` is `26.1201.0`.
56
+ `v26.11.25.4` is `26.1125.4` and `v26.12.1` is `26.1201.0`.
55
57
 
56
58
  What a given package version pins:
57
59
 
@@ -63,8 +65,8 @@ What a given package version pins:
63
65
 
64
66
  Use the latest package to keep every harness on the same release.
65
67
 
66
- Releases from `26.1125.3` on are published from GitHub Actions with npm
67
- provenance. `npx` does not verify provenance for you. To check it, run
68
+ Releases are published from GitHub Actions with npm provenance once the npm
69
+ trusted publisher is bound (#426); until then npm may lag the git tag. `npx` does not verify provenance for you. To check it, run
68
70
  `npm audit signatures` in a project that depends on the package; pinning an
69
71
  exact version then keeps you on the release you checked.
70
72
 
package/lib/lists.js CHANGED
@@ -1,4 +1,6 @@
1
1
  const VERSION = /\b(?:v)?([0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}(?:\.[0-9]+)?)\b/;
2
+ // Native CLI output is untrusted: print only a VERSION-shaped value.
3
+ export const safeVersion = v => /^v?[0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}(?:\.[0-9]+)?$/.test(String(v ?? '')) ? String(v).replace(/^v/, '') : 'unknown';
2
4
  const stripAnsi = s => s.replace(/\x1b\[[0-9;]*m/g, '');
3
5
 
4
6
  export function parsePlugins(harness, output) {
@@ -14,6 +16,8 @@ export function parsePlugins(harness, output) {
14
16
  if (!version) throw new Error('Cannot read Copilot plugin version');
15
17
  result.push({ version, scope: '', enabled: !/disabled|enabled:\s*false/i.test(block), source: block.match(/Source:\s*(.+)/i)?.[1] });
16
18
  }
19
+ // Other plugins listed (name@market headers) but not mARC: nothing installed.
20
+ if (!result.length && blocks.some(b => /^.*\b[A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\b/.test(b))) return [];
17
21
  if (!result.length && !/plugins?\s*:\s*0/i.test(text)) throw new Error('Unrecognized Copilot plugin list');
18
22
  return result;
19
23
  }
@@ -67,6 +71,20 @@ export function marketplaceMatches(harness, market) {
67
71
  return source.source === 'github' && source.repo === 'NexaDuo/mARC';
68
72
  }
69
73
 
74
+ // Human-readable "sourceType: X, source: Y" for a marketplace row, with control
75
+ // characters stripped (native CLI output is untrusted text).
76
+ export function describeSource(market) {
77
+ const clean = v => String(v ?? '').replace(/[\p{Cc}\p{Cf}\u2028\u2029]/gu, '').slice(0, 200);
78
+ const raw = market.marketplaceSource ?? market.source;
79
+ let type, value;
80
+ if (raw && typeof raw === 'object') {
81
+ type = raw.sourceType ?? raw.source;
82
+ value = raw.sourceType ? raw.source : raw.repo ?? raw.url ?? raw.path;
83
+ } else if (market.repo ?? market.url ?? market.path) { type = raw; value = market.repo ?? market.url ?? market.path; }
84
+ else value = raw;
85
+ return [type != null && `sourceType: ${clean(type)}`, `source: ${clean(value) || 'unknown'}`].filter(Boolean).join(', ');
86
+ }
87
+
70
88
  export function marketplaceWarnings(marketplaces, harness) {
71
89
  const warnings = [];
72
90
  if (marketplaces.some(marketplacePinned)) warnings.push('legacy-pinned marketplace; manual re-registration required');
package/lib/main.js CHANGED
@@ -5,7 +5,7 @@ import path from 'node:path';
5
5
  import { createInterface } from 'node:readline/promises';
6
6
  import { createRunner, resolveExecutable, safeValue } from './process.js';
7
7
  import { tagToNpm } from './version.js';
8
- import { parsePlugins, parseMarketplaces, marketplaceWarnings, marketplaceMatches, sourceHasPointer, readCatalogSource } from './lists.js';
8
+ import { safeVersion, parsePlugins, describeSource, parseMarketplaces, marketplaceWarnings, marketplaceMatches, sourceHasPointer, readCatalogSource } from './lists.js';
9
9
 
10
10
  export const HARNESSES = ['claude', 'copilot', 'codex', 'agy'];
11
11
  const SCOPES = ['user', 'project', 'local'];
@@ -15,6 +15,8 @@ const HELP = `Usage: marc install|update|doctor|uninstall [--yes] [--dry-run]
15
15
  [--harness claude|copilot|codex|agy]... [--scope user|project|local]
16
16
  [--version <embedded-tag>]
17
17
  No --harness: use every harness found on PATH. Node >=20 required.
18
+ install reads the native plugin list (read-only) before consent, also in --dry-run, and again after installing.
19
+ install never upgrades: an existing install that differs from this release is reported STALE (run update).
18
20
  --scope applies to Claude only. Non-TTY install/update/uninstall requires --yes
19
21
  (doctor and --dry-run never change anything and need no --yes).
20
22
  The package release selects the tag; another tag prints its npx command.`;
@@ -61,8 +63,9 @@ export function plan(opts) {
61
63
  }
62
64
  else if (h === 'agy' && opts.command !== 'uninstall') commands.push(['plugin', 'list', '--json'], ['<verified shallow tag clone and reinstall; preserve enablement>']);
63
65
  else if (opts.command === 'install') {
64
- commands.push(['plugin', 'marketplace', 'list', '--json'], ['plugin', 'marketplace', 'add', SLUG]);
66
+ commands.push(listArgs(h), ['plugin', 'marketplace', 'list', '--json'], ['plugin', 'marketplace', 'add', SLUG]);
65
67
  commands.push(['plugin', h === 'codex' ? 'add' : 'install', ID, ...(h === 'claude' ? scopeArgs(opts.scope || 'user') : [])]);
68
+ commands.push(listArgs(h)); // re-list after install to confirm the version
66
69
  } else if (opts.command === 'update') {
67
70
  if (h === 'claude') commands.push(listArgs(h));
68
71
  commands.push(['plugin', 'marketplace', h === 'codex' ? 'upgrade' : 'update', 'nexaduo']);
@@ -158,13 +161,35 @@ function manualRemedy(h, log, scope = 'user') {
158
161
  log(`${h} plugin ${h === 'codex' ? 'add' : 'install'} marc@nexaduo${h === 'claude' ? ` --scope ${scope}` : ''}`);
159
162
  }
160
163
 
164
+ const sameVersion = (version, release) => `v${String(version).replace(/^v/, '')}` === release.tag;
165
+
166
+ // Rows that count as "already installed" for this request. Claude is
167
+ // scope-aware; project/local rows from other repos never count.
168
+ function samePath(a, b) {
169
+ try { return realpathSync.native(a) === realpathSync.native(b); }
170
+ catch { return path.resolve(a) === path.resolve(b); }
171
+ }
172
+ function installedRows(h, rows, scope, cwd) {
173
+ if (h !== 'claude') return rows;
174
+ // A Claude row with no scope field is a user-scope install.
175
+ return rows.filter(r => (r.scope || 'user') === scope && (scope === 'user' ||
176
+ (typeof r.projectPath === 'string' && path.isAbsolute(r.projectPath) && samePath(r.projectPath, cwd))));
177
+ }
178
+
179
+ // Compare installed rows with the launcher release. Returns the versions found
180
+ // and whether any of them differs.
181
+ function versionState(rows, release) {
182
+ const found = [...new Set(rows.map(r => safeVersion(r.version)))];
183
+ return { found: found.join(', '), stale: rows.some(r => !r.version || !sameVersion(r.version, release)) };
184
+ }
185
+
161
186
  async function doctor(h, run, release, log, scope) {
162
187
  const rows = parsePlugins(h, await run(h, listArgs(h))).filter(p => h !== 'claude' || !scope || p.scope === scope);
163
188
  let drift = !rows.length;
164
189
  if (!rows.length) log(`${h}\tmissing\t-`);
165
190
  for (const row of rows) {
166
- const match = `v${String(row.version).replace(/^v/, '')}` === release.tag;
167
- log(`${h}\t${row.version || 'unknown'}\t${row.scope || '-'}\t${row.enabled === false ? 'disabled' : 'enabled'}${match ? '' : '\tDRIFT'}`);
191
+ const match = sameVersion(row.version, release);
192
+ log(`${h}\t${safeVersion(row.version)}\t${row.scope || '-'}\t${row.enabled === false ? 'disabled' : 'enabled'}${match ? '' : '\tDRIFT'}`);
168
193
  drift ||= !match;
169
194
  }
170
195
  if (h !== 'agy') {
@@ -227,6 +252,12 @@ export async function main(argv, { release, run = createRunner(), log = console.
227
252
  const scope = opts.scope || 'user';
228
253
  if (scope !== 'user') log(`Claude may edit ${path.join(cwd, '.claude', scope === 'local' ? 'settings.local.json' : 'settings.json')} (${scope} scope)`);
229
254
  }
255
+ const preRead = new Map();
256
+ if (opts.command === 'install') for (const h of opts.harnesses.filter(x => x !== 'agy')) {
257
+ // Read-only: installed rows decide whether install has anything to do.
258
+ try { preRead.set(h, { rows: installedRows(h, parsePlugins(h, await run(h, listArgs(h))), opts.scope || 'user', cwd) }); }
259
+ catch (e) { preRead.set(h, { error: e }); }
260
+ }
230
261
  if (opts.dryRun) return status;
231
262
  if (!opts.yes && opts.command !== 'doctor') {
232
263
  let accepted;
@@ -239,7 +270,7 @@ export async function main(argv, { release, run = createRunner(), log = console.
239
270
  }
240
271
  const results = [];
241
272
  for (const h of opts.harnesses) {
242
- let failed = false;
273
+ let failed = false, outcome;
243
274
  try {
244
275
  if (opts.command === 'doctor') {
245
276
  failed = Boolean(await doctor(h, run, release, log, opts.scope));
@@ -267,21 +298,42 @@ export async function main(argv, { release, run = createRunner(), log = console.
267
298
  }
268
299
  }
269
300
  } else if (opts.command === 'install') {
301
+ const pre = preRead.get(h);
302
+ if (pre.error) throw pre.error;
303
+ const scope = opts.scope || 'user';
270
304
  const markets = parseMarketplaces(h, await run(h, ['plugin', 'marketplace', 'list', '--json']));
271
305
  if (markets.length && !markets.every(m => marketplaceMatches(h, m))) {
272
306
  manualRemedy(h, log, opts.scope);
273
- throw new Error('nexaduo is registered from a different or unverified source; registration preserved');
307
+ const found = markets.map(describeSource).join('; ');
308
+ throw new Error(`nexaduo is registered from a different or unverified source (found ${found}); registration preserved`);
309
+ }
310
+ const report = rows => {
311
+ if (rows.some(r => r.enabled === false)) log(`${h}: marc is installed but disabled`);
312
+ const { found, stale } = versionState(rows, release);
313
+ if (stale) {
314
+ log(`${h}: already installed at ${found} (launcher release ${release.tag}); run \`npx @nexaduo/marc update\``);
315
+ return 'STALE';
316
+ }
317
+ log(`${h}: already installed at ${found}`);
318
+ return 'OK';
319
+ };
320
+ if (pre.rows.length) outcome = report(pre.rows);
321
+ else {
322
+ if (!markets.length) await run(h, ['plugin', 'marketplace', 'add', SLUG]);
323
+ else log(`${h}: nexaduo already registered from ${SLUG}; skipping add`);
324
+ await run(h, ['plugin', h === 'codex' ? 'add' : 'install', ID, ...(h === 'claude' ? scopeArgs(scope) : [])]);
325
+ const after = installedRows(h, parsePlugins(h, await run(h, listArgs(h))), scope, cwd);
326
+ if (!after.length) throw new Error('marc is not listed after install');
327
+ outcome = report(after);
274
328
  }
275
- if (!markets.length) await run(h, ['plugin', 'marketplace', 'add', SLUG]);
276
- else log(`${h}: nexaduo already registered from ${SLUG}; skipping add`);
277
- await run(h, ['plugin', h === 'codex' ? 'add' : 'install', ID, ...(h === 'claude' ? scopeArgs(opts.scope || 'user') : [])]);
278
329
  } else {
279
330
  for (const args of plan({ ...opts, harnesses: [h] })[0].commands) await run(h, args);
280
331
  }
281
332
  } catch (e) { log(`${h}: ${e.message}`); failed = true; }
282
- results.push({ harness: h, failed });
283
- if (failed) status = 1;
333
+ const state = failed ? 'FAILED' : outcome || 'OK';
334
+ results.push({ harness: h, state });
335
+ if (state !== 'OK') status = 1;
284
336
  }
285
- for (const { harness, failed } of results) log(`${harness}: ${failed ? 'FAILED' : 'OK'}`);
337
+ for (const { harness, state } of results) log(`${harness}: ${state}`);
286
338
  return status;
287
339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexaduo/marc",
3
- "version": "26.1125.3",
3
+ "version": "26.1125.4",
4
4
  "description": "Install and update mARC through native harness plugin CLIs",
5
5
  "type": "module",
6
6
  "bin": {"marc": "bin/marc.js"},
package/release.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tag": "v26.11.25.3",
3
- "sha": "dc609f2b1fd4db7073a3470764577d117c868760",
4
- "npm": "26.1125.3"
2
+ "tag": "v26.11.25.4",
3
+ "sha": "9bc9282fc2ebda73cf5d5dcf71bab18bf1fd5fc2",
4
+ "npm": "26.1125.4"
5
5
  }