@nexaduo/marc 26.1125.4 → 26.1125.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 +21 -2
- package/lib/main.js +154 -38
- package/lib/style.js +72 -0
- package/package.json +1 -1
- package/release.json +3 -3
package/README.md
CHANGED
|
@@ -47,13 +47,19 @@ Then open any repository in your harness and run `/marc:tech-lead`.
|
|
|
47
47
|
- `uninstall` never removes a marketplace registration.
|
|
48
48
|
- `install` never upgrades an existing install. If the installed version differs
|
|
49
49
|
from the launcher release it prints `STALE` and exits non-zero; run `update`.
|
|
50
|
-
- `doctor` changes nothing and exits non-zero when it finds drift.
|
|
50
|
+
- `doctor` changes nothing and exits non-zero when it finds drift. Claude
|
|
51
|
+
`project` and `local` rows add the project they belong to as an extra field
|
|
52
|
+
(`~/repos/app` under your home directory, otherwise the absolute path). A harness whose only
|
|
53
|
+
problem is an older version, or a marketplace catalog still tracking `main`,
|
|
54
|
+
is `STALE`: run `npx @nexaduo/marc update`. `FAILED` means something else is
|
|
55
|
+
wrong (marketplace missing or drifted, plugin missing, release source
|
|
56
|
+
unverifiable, a native CLI error) and wins over `STALE`.
|
|
51
57
|
|
|
52
58
|
## Versions
|
|
53
59
|
|
|
54
60
|
Each npm version embeds one mARC release tag. A tag `vYY.M.D[.N]` (no leading
|
|
55
61
|
zeros) maps to npm `YY.(M*100+D).N`, where a missing `.N` is `0`. For example,
|
|
56
|
-
`v26.11.25.
|
|
62
|
+
`v26.11.25.5` is `26.1125.5` and `v26.12.1` is `26.1201.0`.
|
|
57
63
|
|
|
58
64
|
What a given package version pins:
|
|
59
65
|
|
|
@@ -70,6 +76,19 @@ trusted publisher is bound (#426); until then npm may lag the git tag. `npx` doe
|
|
|
70
76
|
`npm audit signatures` in a project that depends on the package; pinning an
|
|
71
77
|
exact version then keeps you on the release you checked.
|
|
72
78
|
|
|
79
|
+
## Console colors
|
|
80
|
+
|
|
81
|
+
Output is colored only when stdout is a terminal. Piped, redirected and CI
|
|
82
|
+
output is plain text with no escape sequences, identical to earlier releases.
|
|
83
|
+
|
|
84
|
+
- `NO_COLOR=1` (any non-empty value) turns color off.
|
|
85
|
+
- `FORCE_COLOR=1|2|3` turns it on even when piped (`2` implies 256 colors, `3`
|
|
86
|
+
truecolor); `FORCE_COLOR=0` turns it off. `NO_COLOR` wins over `FORCE_COLOR`.
|
|
87
|
+
- Truecolor is used when `COLORTERM` is `truecolor` or `24bit`, 256 colors when
|
|
88
|
+
`TERM` contains `256color`, otherwise 16 colors. `TERM=dumb` and legacy
|
|
89
|
+
Windows consoles stay plain.
|
|
90
|
+
- `COLORFGBG` ending in `7` or `15` selects a light-background palette.
|
|
91
|
+
|
|
73
92
|
## Links
|
|
74
93
|
|
|
75
94
|
- Source, docs and issues: https://github.com/NexaDuo/mARC
|
package/lib/main.js
CHANGED
|
@@ -5,6 +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 { createStyle, stripControls } from './style.js';
|
|
8
9
|
import { safeVersion, parsePlugins, describeSource, parseMarketplaces, marketplaceWarnings, marketplaceMatches, sourceHasPointer, readCatalogSource } from './lists.js';
|
|
9
10
|
|
|
10
11
|
export const HARNESSES = ['claude', 'copilot', 'codex', 'agy'];
|
|
@@ -154,11 +155,78 @@ export async function installAgy({ run, release, tmpRoot }) {
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
// Console output. Plain mode forwards every message to `log` unchanged and
|
|
159
|
+
// adds nothing; color mode re-lays the same text out with headings, prompts
|
|
160
|
+
// and a result table. Every colored fragment goes through style.paint.
|
|
161
|
+
export function makeOut(log, st) {
|
|
162
|
+
const p = st.paint;
|
|
163
|
+
const pending = new Map();
|
|
164
|
+
const last = new Map();
|
|
165
|
+
let buffering = false, group = null;
|
|
166
|
+
const put = (h, text) => {
|
|
167
|
+
if (buffering) { if (!pending.has(h)) pending.set(h, []); pending.get(h).push(text); return; }
|
|
168
|
+
if (h !== group) { if (group !== null) log(''); log(p('harness', `# ${h}`)); group = h; }
|
|
169
|
+
log(text);
|
|
170
|
+
};
|
|
171
|
+
const MARK = { info: '* ', dim: '* ', warn: '! ', error: 'x ' };
|
|
172
|
+
const pad = (v, n) => String(v) + ' '.repeat(Math.max(0, n - String(v).length));
|
|
173
|
+
return {
|
|
174
|
+
header(release, command) {
|
|
175
|
+
if (!st.enabled) return log(`mARC ${release.tag} (${release.npm}); ${command}`);
|
|
176
|
+
log(`${p('brand', 'mARC')} ${p('tag', release.tag)} ${p('dim', `(${release.npm})`)}; ${p('strong', command)}`);
|
|
177
|
+
},
|
|
178
|
+
note(text) { if (st.enabled) { log(p('dim', `* ${text}`)); log(''); } },
|
|
179
|
+
cmdLine(text) { log(st.enabled ? `${p('dim', '$ ')}${p('cmd', text)}` : text); },
|
|
180
|
+
begin(harnesses) { if (st.enabled) { buffering = true; for (const h of harnesses) pending.set(h, []); } },
|
|
181
|
+
flush() {
|
|
182
|
+
last.clear(); // pre-consent lines must not become a result detail
|
|
183
|
+
if (!buffering) return;
|
|
184
|
+
buffering = false;
|
|
185
|
+
for (const [h, lines] of pending) for (const l of lines) put(h, l);
|
|
186
|
+
pending.clear();
|
|
187
|
+
},
|
|
188
|
+
// role: info | dim | warn | error | cmd
|
|
189
|
+
line(h, role, text) {
|
|
190
|
+
if (role !== 'cmd') last.set(h, text);
|
|
191
|
+
if (!st.enabled) return log(text);
|
|
192
|
+
put(h, role === 'cmd' ? ` ${p('dim', '$ ')}${p('cmd', text)}` : ` ${p(role, MARK[role] + text)}`);
|
|
193
|
+
},
|
|
194
|
+
alt(h, plain, role, text) { this.line(h, role, st.enabled ? text : plain); },
|
|
195
|
+
remedy(h, title, cmds) {
|
|
196
|
+
if (!st.enabled) { log(title); for (const c of cmds) log(c); return; }
|
|
197
|
+
put(h, ` ${p('remedy', `+- ${title}`)}`);
|
|
198
|
+
for (const c of cmds) put(h, ` ${p('remedy', '|')} ${p('dim', '$ ')}${p('cmd', c)}`);
|
|
199
|
+
put(h, ` ${p('remedy', '+-')}`);
|
|
200
|
+
},
|
|
201
|
+
row(h, cols, drift, project) {
|
|
202
|
+
const extra = project === undefined ? '' : stripControls(project);
|
|
203
|
+
if (!st.enabled) return log(cols.join('\t') + (drift ? '\tDRIFT' : '') + (extra ? `\t${extra}` : ''));
|
|
204
|
+
const widths = [7, 10, 7, 8];
|
|
205
|
+
// Every column is painted (so sanitized) and padded on its stripped length.
|
|
206
|
+
const cell = (c, n, role) => p(role, pad(stripControls(c), n));
|
|
207
|
+
const body = cols.slice(1).map((c, i) => cell(c, widths[i + 1], 'info')).join(' ');
|
|
208
|
+
put(h, ` ${cell(cols[0], widths[0], 'harness')} ${body}${drift ? ` ${p('drift', 'DRIFT')}` : extra ? ` ${' '.repeat(5)}` : ''}${extra ? ` ${p('info', extra)}` : ''}`.trimEnd());
|
|
209
|
+
},
|
|
210
|
+
detail(h) { const t = last.get(h) || 'done';
|
|
211
|
+
return t.startsWith(`${h}: `) ? t.slice(h.length + 2) : t; },
|
|
212
|
+
results(list) {
|
|
213
|
+
if (!st.enabled) { for (const { harness, state } of list) log(`${harness}: ${state}`); return; }
|
|
214
|
+
log('');
|
|
215
|
+
log(p('dim', '* result'));
|
|
216
|
+
log(p('dim', ` ${pad('HARNESS', 7)} ${pad('STATUS', 6)} DETAIL`));
|
|
217
|
+
for (const { harness, state, detail } of list) {
|
|
218
|
+
log(` ${p('harness', pad(harness, 7))} ${p(state === 'OK' ? 'ok' : state === 'STALE' ? 'stale' : 'failed', pad(state, 6))} ${p('info', detail)}`);
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function manualRemedy(h, out, scope = 'user') {
|
|
225
|
+
out.remedy(h, `${h}: Manual remedy (review first; this removes the marketplace registration):`, [
|
|
226
|
+
`${h} plugin marketplace remove nexaduo`,
|
|
227
|
+
`${h} plugin marketplace add NexaDuo/mARC`,
|
|
228
|
+
`${h} plugin ${h === 'codex' ? 'add' : 'install'} marc@nexaduo${h === 'claude' ? ` --scope ${scope}` : ''}`,
|
|
229
|
+
]);
|
|
162
230
|
}
|
|
163
231
|
|
|
164
232
|
const sameVersion = (version, release) => `v${String(version).replace(/^v/, '')}` === release.tag;
|
|
@@ -183,55 +251,101 @@ function versionState(rows, release) {
|
|
|
183
251
|
return { found: found.join(', '), stale: rows.some(r => !r.version || !sameVersion(r.version, release)) };
|
|
184
252
|
}
|
|
185
253
|
|
|
186
|
-
|
|
254
|
+
// Project column for Claude project/local rows: ~-relative under home, else
|
|
255
|
+
// absolute. Control characters are stripped. Path semantics follow the injected
|
|
256
|
+
// platform (path.win32 vs path.posix), not the host, and the ~-relative form
|
|
257
|
+
// always uses forward slashes ("~/repos/app") on every platform.
|
|
258
|
+
export function displayProject(projectPath, home, platform = process.platform) {
|
|
259
|
+
if (typeof projectPath !== 'string' || !projectPath) return '-';
|
|
260
|
+
const P = platform === 'win32' ? path.win32 : path.posix;
|
|
261
|
+
const clean = stripControls(projectPath);
|
|
262
|
+
if (!clean) return '-';
|
|
263
|
+
const h = typeof home === 'string' ? stripControls(home) : '';
|
|
264
|
+
// A filesystem-root home would turn every path into "~/..."; print absolute.
|
|
265
|
+
if (h && P.dirname(h) !== h && P.isAbsolute(clean)) {
|
|
266
|
+
const rel = P.relative(h, clean);
|
|
267
|
+
if (rel === '') return '~';
|
|
268
|
+
if (rel !== '..' && !rel.startsWith(`..${P.sep}`) && !P.isAbsolute(rel)) return `~/${rel.split(P.sep).join('/')}`;
|
|
269
|
+
}
|
|
270
|
+
return clean;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Returns { state: OK|STALE|FAILED, detail }. STALE: the only problems are a
|
|
274
|
+
// version mismatch and/or a catalog that tracks main. Anything else is FAILED.
|
|
275
|
+
async function doctor(h, run, release, out, scope, home, platform) {
|
|
187
276
|
const rows = parsePlugins(h, await run(h, listArgs(h))).filter(p => h !== 'claude' || !scope || p.scope === scope);
|
|
188
|
-
let
|
|
189
|
-
if (!rows.length)
|
|
277
|
+
let failed = !rows.length, stale = false;
|
|
278
|
+
if (!rows.length) out.alt(h, `${h}\tmissing\t-`, 'error', `${h}: missing`);
|
|
190
279
|
for (const row of rows) {
|
|
191
280
|
const match = sameVersion(row.version, release);
|
|
192
|
-
|
|
193
|
-
|
|
281
|
+
const project = h === 'claude' && ['project', 'local'].includes(row.scope) ? displayProject(row.projectPath, home, platform) : undefined;
|
|
282
|
+
out.row(h, [h, safeVersion(row.version), row.scope || '-', row.enabled === false ? 'disabled' : 'enabled'], !match, project);
|
|
283
|
+
if (!row.version || !String(row.version).trim()) { out.line(h, 'warn', `${h}: version unreported`); failed = true; }
|
|
284
|
+
else stale ||= !match;
|
|
194
285
|
}
|
|
195
286
|
if (h !== 'agy') {
|
|
196
287
|
const markets = parseMarketplaces(h, await run(h, ['plugin', 'marketplace', 'list', '--json']));
|
|
197
288
|
const warnings = marketplaceWarnings(markets, h);
|
|
198
|
-
for (const warning of warnings) {
|
|
199
|
-
if (warnings.length) manualRemedy(h,
|
|
289
|
+
for (const warning of warnings) { out.line(h, 'warn', `${h}: ${warning}`); failed = true; }
|
|
290
|
+
if (warnings.length) manualRemedy(h, out, scope);
|
|
200
291
|
if (['codex', 'copilot'].includes(h) && markets.some(m => marketplaceMatches(h, m))) {
|
|
201
|
-
|
|
292
|
+
out.line(h, 'dim', `${h}: pin state unverifiable from native list`);
|
|
202
293
|
}
|
|
203
|
-
if (!markets.length) {
|
|
294
|
+
if (!markets.length) { out.line(h, 'warn', `${h}: nexaduo marketplace missing`); failed = true; }
|
|
204
295
|
const source = await readCatalogSource(h, markets, rows);
|
|
205
296
|
const sources = source !== null ? [source] : rows.map(r => r.source).filter(Boolean);
|
|
206
297
|
if (!sources.length) {
|
|
207
|
-
|
|
208
|
-
|
|
298
|
+
out.line(h, 'warn', `${h}: catalog pointer unavailable in native lists; cannot verify release source`);
|
|
299
|
+
failed = true;
|
|
209
300
|
} else if (!sources.every(s => sourceHasPointer(s, release.tag, h))) {
|
|
210
|
-
|
|
211
|
-
|
|
301
|
+
// STALE only when the source matches the expected release source in every
|
|
302
|
+
// field except ref; anything else (foreign repo/type/path) is FAILED.
|
|
303
|
+
if (sources.every(s => s !== null && typeof s === 'object' && sourceHasPointer({ ...s, ref: release.tag }, release.tag, h))) {
|
|
304
|
+
out.line(h, 'warn', `${h}: main-tracking with no matching release pointer; upgrade the marketplace catalog`);
|
|
305
|
+
stale = true;
|
|
306
|
+
} else {
|
|
307
|
+
out.line(h, 'warn', `${h}: marketplace source does not match the expected release source`);
|
|
308
|
+
failed = true;
|
|
309
|
+
}
|
|
212
310
|
}
|
|
213
311
|
}
|
|
214
|
-
|
|
312
|
+
if (failed) {
|
|
313
|
+
const detail = rows.length ? 'drift' : `plugin missing; run \`npx @nexaduo/marc install\``;
|
|
314
|
+
if (!rows.length) out.line(h, 'warn', `${h}: run \`npx @nexaduo/marc install\``);
|
|
315
|
+
return { state: 'FAILED', detail };
|
|
316
|
+
}
|
|
317
|
+
if (stale) {
|
|
318
|
+
out.line(h, 'warn', `${h}: out of date; run \`npx @nexaduo/marc update\``);
|
|
319
|
+
return { state: 'STALE', detail: 'out of date; run `npx @nexaduo/marc update`' };
|
|
320
|
+
}
|
|
321
|
+
return { state: 'OK', detail: 'in sync' };
|
|
215
322
|
}
|
|
216
323
|
|
|
217
324
|
export async function main(argv, { release, run = createRunner(), log = console.log,
|
|
218
|
-
isTTY = Boolean(process.stdin.isTTY), discover = h => resolveExecutable(h), confirm, cwd = process.cwd(), tmpRoot
|
|
325
|
+
isTTY = Boolean(process.stdin.isTTY), discover = h => resolveExecutable(h), confirm, cwd = process.cwd(), tmpRoot,
|
|
326
|
+
env = process.env, platform = process.platform,
|
|
327
|
+
home = (platform === 'win32' ? env.USERPROFILE || env.HOME : env.HOME || env.USERPROFILE) || os.homedir(), stdoutIsTTY = Boolean(process.stdout.isTTY),
|
|
328
|
+
style = createStyle({ env, isTTY: stdoutIsTTY, platform }) } = {}) {
|
|
219
329
|
const opts = parseArgs(argv);
|
|
220
330
|
if (opts.help) { log(HELP); return 0; }
|
|
221
331
|
if (tagToNpm(release.tag) !== release.npm) throw new Error('Invalid embedded release version');
|
|
222
332
|
if (opts.version && opts.version !== release.tag) {
|
|
223
333
|
const mapped = tagToNpm(opts.version);
|
|
224
334
|
const rest = argv.filter((v, i) => v !== '--version' && argv[i - 1] !== '--version');
|
|
225
|
-
log(`Use npx @nexaduo/marc@${mapped} ${rest.join(' ')}`);
|
|
335
|
+
makeOut(log, style).cmdLine(`Use npx @nexaduo/marc@${mapped} ${rest.join(' ')}`);
|
|
226
336
|
return 1;
|
|
227
337
|
}
|
|
228
338
|
if (!opts.yes && !isTTY && !opts.dryRun && opts.command !== 'doctor') throw new Error('Non-TTY execution requires --yes');
|
|
229
339
|
if (!opts.harnesses.length) opts.harnesses = HARNESSES.filter(h => { try { discover(h); return true; } catch { return false; } });
|
|
230
340
|
if (!opts.harnesses.length) throw new Error('No supported harness found on PATH');
|
|
231
341
|
if (opts.scope && !opts.harnesses.includes('claude')) throw new Error('--scope requires Claude');
|
|
232
|
-
|
|
342
|
+
const out = makeOut(log, style);
|
|
343
|
+
out.header(release, opts.command);
|
|
344
|
+
if (opts.dryRun) out.note('dry run: no changes will be made');
|
|
345
|
+
else if (style.enabled) log('');
|
|
346
|
+
out.begin(opts.harnesses);
|
|
233
347
|
for (const p of plan(opts)) {
|
|
234
|
-
for (const args of p.commands)
|
|
348
|
+
for (const args of p.commands) out.line(p.harness, 'cmd', `${p.harness} ${args.join(' ')}`);
|
|
235
349
|
}
|
|
236
350
|
let status = 0, claudeRows, claudeError;
|
|
237
351
|
if (opts.command === 'update' && opts.harnesses.includes('claude')) {
|
|
@@ -245,12 +359,12 @@ export async function main(argv, { release, run = createRunner(), log = console.
|
|
|
245
359
|
for (const row of claudeRows) if (row.scope !== 'user') {
|
|
246
360
|
const target = row.projectPath || cwd;
|
|
247
361
|
if (!path.isAbsolute(target)) throw new Error('Claude: invalid project path');
|
|
248
|
-
|
|
362
|
+
out.line('claude', 'warn', `Claude will edit ${path.join(target, '.claude', row.scope === 'local' ? 'settings.local.json' : 'settings.json')}`);
|
|
249
363
|
}
|
|
250
|
-
} catch (e) { claudeError = e; status = 1;
|
|
364
|
+
} catch (e) { claudeError = e; status = 1; out.line('claude', 'error', `claude: ${e.message}`); }
|
|
251
365
|
} else if (opts.harnesses.includes('claude') && opts.command !== 'doctor') {
|
|
252
366
|
const scope = opts.scope || 'user';
|
|
253
|
-
if (scope !== 'user')
|
|
367
|
+
if (scope !== 'user') out.line('claude', 'warn', `Claude may edit ${path.join(cwd, '.claude', scope === 'local' ? 'settings.local.json' : 'settings.json')} (${scope} scope)`);
|
|
254
368
|
}
|
|
255
369
|
const preRead = new Map();
|
|
256
370
|
if (opts.command === 'install') for (const h of opts.harnesses.filter(x => x !== 'agy')) {
|
|
@@ -258,22 +372,24 @@ export async function main(argv, { release, run = createRunner(), log = console.
|
|
|
258
372
|
try { preRead.set(h, { rows: installedRows(h, parsePlugins(h, await run(h, listArgs(h))), opts.scope || 'user', cwd) }); }
|
|
259
373
|
catch (e) { preRead.set(h, { error: e }); }
|
|
260
374
|
}
|
|
375
|
+
out.flush();
|
|
261
376
|
if (opts.dryRun) return status;
|
|
262
377
|
if (!opts.yes && opts.command !== 'doctor') {
|
|
263
378
|
let accepted;
|
|
264
379
|
if (confirm) accepted = await confirm();
|
|
265
380
|
else {
|
|
266
381
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
267
|
-
try { accepted = /^y(es)?$/i.test((await rl.question(
|
|
382
|
+
try { accepted = /^y(es)?$/i.test((await rl.question(`Run this plan? ${style.paint('dim', '[y/N]')} `)).trim()); } finally { rl.close(); }
|
|
268
383
|
}
|
|
269
384
|
if (!accepted) return 1;
|
|
270
385
|
}
|
|
271
386
|
const results = [];
|
|
272
387
|
for (const h of opts.harnesses) {
|
|
273
|
-
let failed = false, outcome;
|
|
388
|
+
let failed = false, outcome, threw = false, detail;
|
|
274
389
|
try {
|
|
275
390
|
if (opts.command === 'doctor') {
|
|
276
|
-
|
|
391
|
+
const d = await doctor(h, run, release, out, opts.scope, home, platform);
|
|
392
|
+
outcome = d.state === 'FAILED' ? undefined : d.state; failed = d.state === 'FAILED'; detail = d.detail;
|
|
277
393
|
} else if (h === 'agy' && ['install', 'update'].includes(opts.command)) {
|
|
278
394
|
await installAgy({ run, release, tmpRoot });
|
|
279
395
|
} else if (h === 'claude' && opts.command === 'update') {
|
|
@@ -293,7 +409,7 @@ export async function main(argv, { release, run = createRunner(), log = console.
|
|
|
293
409
|
if (!(await stat(target.cwd)).isDirectory()) throw new Error('project path is not a directory');
|
|
294
410
|
await run(h, ['plugin', 'update', ID, ...scopeArgs(target.scope)], { cwd: target.cwd });
|
|
295
411
|
} catch (e) {
|
|
296
|
-
|
|
412
|
+
out.line('claude', 'warn', `claude: warning: skipped ${target.scope} scope at ${target.cwd}: ${e.message}`);
|
|
297
413
|
failed = true;
|
|
298
414
|
}
|
|
299
415
|
}
|
|
@@ -303,24 +419,24 @@ export async function main(argv, { release, run = createRunner(), log = console.
|
|
|
303
419
|
const scope = opts.scope || 'user';
|
|
304
420
|
const markets = parseMarketplaces(h, await run(h, ['plugin', 'marketplace', 'list', '--json']));
|
|
305
421
|
if (markets.length && !markets.every(m => marketplaceMatches(h, m))) {
|
|
306
|
-
manualRemedy(h,
|
|
422
|
+
manualRemedy(h, out, opts.scope);
|
|
307
423
|
const found = markets.map(describeSource).join('; ');
|
|
308
424
|
throw new Error(`nexaduo is registered from a different or unverified source (found ${found}); registration preserved`);
|
|
309
425
|
}
|
|
310
426
|
const report = rows => {
|
|
311
|
-
if (rows.some(r => r.enabled === false))
|
|
427
|
+
if (rows.some(r => r.enabled === false)) out.line(h, 'warn', `${h}: marc is installed but disabled`);
|
|
312
428
|
const { found, stale } = versionState(rows, release);
|
|
313
429
|
if (stale) {
|
|
314
|
-
|
|
430
|
+
out.line(h, 'warn', `${h}: already installed at ${found} (launcher release ${release.tag}); run \`npx @nexaduo/marc update\``);
|
|
315
431
|
return 'STALE';
|
|
316
432
|
}
|
|
317
|
-
|
|
433
|
+
out.line(h, 'info', `${h}: already installed at ${found}`);
|
|
318
434
|
return 'OK';
|
|
319
435
|
};
|
|
320
436
|
if (pre.rows.length) outcome = report(pre.rows);
|
|
321
437
|
else {
|
|
322
438
|
if (!markets.length) await run(h, ['plugin', 'marketplace', 'add', SLUG]);
|
|
323
|
-
else
|
|
439
|
+
else out.line(h, 'dim', `${h}: nexaduo already registered from ${SLUG}; skipping add`);
|
|
324
440
|
await run(h, ['plugin', h === 'codex' ? 'add' : 'install', ID, ...(h === 'claude' ? scopeArgs(scope) : [])]);
|
|
325
441
|
const after = installedRows(h, parsePlugins(h, await run(h, listArgs(h))), scope, cwd);
|
|
326
442
|
if (!after.length) throw new Error('marc is not listed after install');
|
|
@@ -329,11 +445,11 @@ export async function main(argv, { release, run = createRunner(), log = console.
|
|
|
329
445
|
} else {
|
|
330
446
|
for (const args of plan({ ...opts, harnesses: [h] })[0].commands) await run(h, args);
|
|
331
447
|
}
|
|
332
|
-
} catch (e) {
|
|
448
|
+
} catch (e) { out.line(h, 'error', `${h}: ${e.message}`); failed = true; threw = true; }
|
|
333
449
|
const state = failed ? 'FAILED' : outcome || 'OK';
|
|
334
|
-
results.push({ harness: h, state });
|
|
450
|
+
results.push({ harness: h, state, detail: opts.command === 'doctor' && !threw ? detail : out.detail(h) });
|
|
335
451
|
if (state !== 'OK') status = 1;
|
|
336
452
|
}
|
|
337
|
-
|
|
453
|
+
out.results(results);
|
|
338
454
|
return status;
|
|
339
455
|
}
|
package/lib/style.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Console styling for the launcher. SGR sequences are only ever built from the
|
|
2
|
+
// constants below and a closed role enum; text is never interpolated into them.
|
|
3
|
+
// Plain mode (color off) returns text unchanged and adds no decoration.
|
|
4
|
+
|
|
5
|
+
// role: [truecolor rgb, 256-color index, 16-color code, light-profile code, bold]
|
|
6
|
+
const ROLES = {
|
|
7
|
+
brand: [[255, 106, 193], 205, '95', '35', true],
|
|
8
|
+
tag: [[94, 241, 255], 87, '96', '36', false],
|
|
9
|
+
dim: [[169, 169, 214], 146, '2', '2', false],
|
|
10
|
+
harness: [[184, 146, 255], 141, '94', '34', true],
|
|
11
|
+
cmd: [[94, 241, 255], 87, '96', '36', false],
|
|
12
|
+
ok: [[124, 255, 178], 121, '92', '32', true],
|
|
13
|
+
stale: [[255, 212, 121], 222, '93', '33', true],
|
|
14
|
+
failed: [[255, 106, 193], 205, '95', '35', true],
|
|
15
|
+
error: [[255, 106, 193], 205, '95', '35', true],
|
|
16
|
+
warn: [[255, 212, 121], 222, '93', '33', false],
|
|
17
|
+
remedy: [[255, 212, 121], 222, '93', '33', true],
|
|
18
|
+
drift: [[255, 212, 121], 222, '93', '33', true],
|
|
19
|
+
strong: null, // bold, default foreground
|
|
20
|
+
info: null, // terminal default foreground and weight
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// C0 (incl. ESC, TAB, CR, LF), DEL, C1, and bidi/invisible format controls.
|
|
24
|
+
// eslint-disable-next-line no-control-regex
|
|
25
|
+
const UNSAFE = /[\u0000-\u001f\u007f-\u009f\u061c\u180e\u200b-\u200f\u2028-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g;
|
|
26
|
+
export const stripControls = text => String(text ?? '').replace(UNSAFE, '');
|
|
27
|
+
|
|
28
|
+
const ON = v => v !== undefined && v !== '' && v !== '0' && v !== 'false';
|
|
29
|
+
|
|
30
|
+
export function colorDepth(env = {}) {
|
|
31
|
+
const ct = String(env.COLORTERM || '').toLowerCase();
|
|
32
|
+
if (ct === 'truecolor' || ct === '24bit') return 24;
|
|
33
|
+
if (/256color/i.test(String(env.TERM || ''))) return 8;
|
|
34
|
+
return 4;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function createStyle({ env = process.env, isTTY = Boolean(process.stdout.isTTY), platform = process.platform } = {}) {
|
|
38
|
+
const winVt = Boolean(env.WT_SESSION || env.ANSICON || env.ConEMUANSI === 'ON' || env.TERM_PROGRAM);
|
|
39
|
+
const force = env.FORCE_COLOR;
|
|
40
|
+
let enabled, depth = colorDepth(env);
|
|
41
|
+
if (env.NO_COLOR) enabled = false; // any non-empty value
|
|
42
|
+
else if (force !== undefined && force !== '') {
|
|
43
|
+
enabled = ON(force);
|
|
44
|
+
if (force === '2' && depth < 8) depth = 8;
|
|
45
|
+
if (force === '3') depth = 24;
|
|
46
|
+
} else enabled = Boolean(isTTY) && env.TERM !== 'dumb' && (platform !== 'win32' || winVt);
|
|
47
|
+
// Legacy conhost (no VT hint) cannot be assumed to do more than 16 colors.
|
|
48
|
+
if (enabled && platform === 'win32' && !winVt) depth = 4;
|
|
49
|
+
if (enabled && platform === 'win32' && !env.WT_SESSION && depth === 24) depth = 8;
|
|
50
|
+
const light = enabled && /(?:^|;)(?:7|15)$/.test(String(env.COLORFGBG || ''));
|
|
51
|
+
const code = role => {
|
|
52
|
+
if (!Object.hasOwn(ROLES, role)) throw new Error(`Unknown style role: ${role}`);
|
|
53
|
+
const spec = ROLES[role];
|
|
54
|
+
if (role === 'strong') return '1';
|
|
55
|
+
if (!spec) return '';
|
|
56
|
+
const [rgb, c256, c16, cLight, bold] = spec;
|
|
57
|
+
if (light) return `${bold ? '1;' : ''}${cLight}`;
|
|
58
|
+
const b = bold ? '1;' : '';
|
|
59
|
+
if (depth >= 24) return `${b}38;2;${rgb.join(';')}`;
|
|
60
|
+
if (depth >= 8) return `${b}38;5;${c256}`;
|
|
61
|
+
return bold ? `1;${c16}` : c16;
|
|
62
|
+
};
|
|
63
|
+
const paint = (role, text) => {
|
|
64
|
+
if (!enabled) { if (!Object.hasOwn(ROLES, role)) throw new Error(`Unknown style role: ${role}`); return text; }
|
|
65
|
+
const clean = stripControls(text);
|
|
66
|
+
const sgr = code(role);
|
|
67
|
+
return sgr ? `\x1b[${sgr}m${clean}\x1b[0m` : clean;
|
|
68
|
+
};
|
|
69
|
+
// Decoration lines exist only in color mode.
|
|
70
|
+
const deco = lines => enabled ? lines : [];
|
|
71
|
+
return { enabled, depth: depth >= 24 ? 24 : depth >= 8 ? 8 : 4, light, paint, deco };
|
|
72
|
+
}
|
package/package.json
CHANGED
package/release.json
CHANGED