@theholocron/cli 5.0.0-alpha.255 → 5.0.0-alpha.257
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/dist/cli.mjs +446 -21
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-BK5cc9WI.d.mts → index-CdeSuXXV.d.mts} +2 -0
- package/dist/index.d.mts +3 -1
- package/dist/presets.d.mts +1 -1
- package/package.json +8 -8
package/dist/cli.mjs
CHANGED
|
@@ -9924,6 +9924,10 @@ const probeArgs = (y) => y.positional("provider", {
|
|
|
9924
9924
|
}).positional("probe", {
|
|
9925
9925
|
type: "string",
|
|
9926
9926
|
describe: "Which probe to run (omit to list the provider's)"
|
|
9927
|
+
}).positional("args", {
|
|
9928
|
+
type: "string",
|
|
9929
|
+
array: true,
|
|
9930
|
+
describe: "Arguments for the probe (`probe deps who <name>`)"
|
|
9927
9931
|
}).option("yes", {
|
|
9928
9932
|
type: "boolean",
|
|
9929
9933
|
default: false,
|
|
@@ -10152,6 +10156,385 @@ function coreProbes(loader, builtIn = /* @__PURE__ */ new Map()) {
|
|
|
10152
10156
|
}
|
|
10153
10157
|
} };
|
|
10154
10158
|
}
|
|
10159
|
+
// src/commands/probe/deps/check-deps.ts
|
|
10160
|
+
/** Problems with the current state of the workspace against the catalog rule, as human-readable lines. */
|
|
10161
|
+
function checkDeps(p) {
|
|
10162
|
+
const problems = [];
|
|
10163
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
10164
|
+
for (const row of p.rows) {
|
|
10165
|
+
if (!row.catalog) continue;
|
|
10166
|
+
for (const e of row.edges) {
|
|
10167
|
+
if (e.spec.startsWith("catalog:")) referenced.add(`${e.spec.slice(8) || "default"}|${row.name}`);
|
|
10168
|
+
if (e.section === "peerDependencies" && !e.spec.startsWith("catalog:")) continue;
|
|
10169
|
+
const expected = row.catalog === "default" ? "catalog:" : `catalog:${row.catalog}`;
|
|
10170
|
+
if (!e.spec.startsWith("catalog:")) problems.push(`${e.file}: ${e.section}.${row.name} is "${e.spec}"; use "${expected}" (${row.catalog} catalog)`);
|
|
10171
|
+
else if (e.spec !== expected && e.spec !== "catalog:default") problems.push(`${e.file}: ${e.section}.${row.name} is "${e.spec}"; it belongs in ${expected}`);
|
|
10172
|
+
}
|
|
10173
|
+
}
|
|
10174
|
+
for (const [catalog, entries] of Object.entries(p.catalogs)) for (const name of Object.keys(entries)) if (!referenced.has(`${catalog}|${name}`)) problems.push(`pnpm-workspace.yaml: ${catalog} catalog entry "${name}" is not used`);
|
|
10175
|
+
return [...problems, ...p.flags];
|
|
10176
|
+
}
|
|
10177
|
+
// src/commands/probe/deps/constants.ts
|
|
10178
|
+
/** Sections whose versions come from a catalog. Peers keep their own compatibility ranges. */
|
|
10179
|
+
const CATALOG_SECTIONS = [
|
|
10180
|
+
"dependencies",
|
|
10181
|
+
"devDependencies",
|
|
10182
|
+
"optionalDependencies"
|
|
10183
|
+
];
|
|
10184
|
+
/** Catalogs that are not a group's own dependencies. */
|
|
10185
|
+
const SPECIAL_CATALOGS = ["peers"];
|
|
10186
|
+
/** The scope of this org's own packages. */
|
|
10187
|
+
const SCOPE = "@theholocron/";
|
|
10188
|
+
// src/commands/probe/deps/group-of.ts
|
|
10189
|
+
/** The group of a workspace folder: its top-level directory, or `root`. */
|
|
10190
|
+
function groupOf(dir) {
|
|
10191
|
+
return dir.split("/")[0] || "root";
|
|
10192
|
+
}
|
|
10193
|
+
// src/commands/probe/deps/collect-edges.ts
|
|
10194
|
+
/** Every dependency edge in the workspace: one per manifest entry that is not a `workspace:` link. */
|
|
10195
|
+
function collectEdges(root, dirs) {
|
|
10196
|
+
const edges = [];
|
|
10197
|
+
const inRepo = /* @__PURE__ */ new Set();
|
|
10198
|
+
const manifests = dirs.map((dir) => {
|
|
10199
|
+
const json = JSON.parse(readFileSync(join(root, dir, "package.json"), "utf8"));
|
|
10200
|
+
if (json.name) inRepo.add(json.name);
|
|
10201
|
+
return {
|
|
10202
|
+
dir,
|
|
10203
|
+
file: dir === "" ? "package.json" : `${dir}/package.json`,
|
|
10204
|
+
json
|
|
10205
|
+
};
|
|
10206
|
+
});
|
|
10207
|
+
const sections = [...CATALOG_SECTIONS, "peerDependencies"];
|
|
10208
|
+
for (const { dir, file, json } of manifests) for (const section of sections) {
|
|
10209
|
+
const entries = json[section] ?? {};
|
|
10210
|
+
for (const [name, spec] of Object.entries(entries)) {
|
|
10211
|
+
const range = String(spec);
|
|
10212
|
+
if (range.startsWith("workspace:")) continue;
|
|
10213
|
+
edges.push({
|
|
10214
|
+
name,
|
|
10215
|
+
spec: range,
|
|
10216
|
+
section,
|
|
10217
|
+
pkg: json.name ?? "(root)",
|
|
10218
|
+
dir,
|
|
10219
|
+
group: groupOf(dir),
|
|
10220
|
+
file
|
|
10221
|
+
});
|
|
10222
|
+
}
|
|
10223
|
+
}
|
|
10224
|
+
return {
|
|
10225
|
+
edges,
|
|
10226
|
+
inRepo
|
|
10227
|
+
};
|
|
10228
|
+
}
|
|
10229
|
+
// src/commands/probe/deps/parse-catalogs.ts
|
|
10230
|
+
/** Parse the `catalog:` and `catalogs:` blocks of `pnpm-workspace.yaml` (the generated, flat format). */
|
|
10231
|
+
function parseCatalogs(text) {
|
|
10232
|
+
const catalogs = { default: {} };
|
|
10233
|
+
let current = null;
|
|
10234
|
+
let inCatalogs = false;
|
|
10235
|
+
for (const raw of text.split("\n")) {
|
|
10236
|
+
if (raw.trim() === "" || raw.trimStart().startsWith("#")) continue;
|
|
10237
|
+
if (/^catalog:\s*$/.test(raw)) {
|
|
10238
|
+
current = "default";
|
|
10239
|
+
inCatalogs = false;
|
|
10240
|
+
continue;
|
|
10241
|
+
}
|
|
10242
|
+
if (/^catalogs:\s*$/.test(raw)) {
|
|
10243
|
+
current = null;
|
|
10244
|
+
inCatalogs = true;
|
|
10245
|
+
continue;
|
|
10246
|
+
}
|
|
10247
|
+
if (/^\S/.test(raw)) {
|
|
10248
|
+
current = null;
|
|
10249
|
+
inCatalogs = false;
|
|
10250
|
+
continue;
|
|
10251
|
+
}
|
|
10252
|
+
const named = inCatalogs ? raw.match(/^ {2}([A-Za-z0-9_-]+):\s*$/) : null;
|
|
10253
|
+
if (named?.[1]) {
|
|
10254
|
+
current = named[1];
|
|
10255
|
+
catalogs[current] ??= {};
|
|
10256
|
+
continue;
|
|
10257
|
+
}
|
|
10258
|
+
const entry = raw.match(/^\s+("[^"]+"|[^\s:][^:]*?):\s*(.+?)\s*$/);
|
|
10259
|
+
if (entry?.[1] && entry[2] && current) (catalogs[current] ??= {})[entry[1].replace(/^"|"$/g, "")] = entry[2].replace(/^"|"$/g, "");
|
|
10260
|
+
}
|
|
10261
|
+
return catalogs;
|
|
10262
|
+
}
|
|
10263
|
+
// src/commands/probe/deps/pick-range.ts
|
|
10264
|
+
/** `^1.2.3`, `~1.2.3`, `1.2.3`, `>=1.2.3` -> [1, 2, 3]; null for anything else. */
|
|
10265
|
+
function minVersion(range) {
|
|
10266
|
+
const m = range.match(/^[\^~>=\s]*(\d+)\.(\d+)\.(\d+)/) ?? range.match(/^[\^~>=\s]*(\d+)(?:\.(\d+))?(?:\.x)?\s*$/);
|
|
10267
|
+
return m ? [
|
|
10268
|
+
Number(m[1]),
|
|
10269
|
+
Number(m[2] ?? 0),
|
|
10270
|
+
Number(m[3] ?? 0)
|
|
10271
|
+
] : null;
|
|
10272
|
+
}
|
|
10273
|
+
function majorsDiffer(ranges) {
|
|
10274
|
+
return new Set(ranges.map((r) => minVersion(r)?.[0])).size > 1;
|
|
10275
|
+
}
|
|
10276
|
+
/** The highest of several ranges by minimum version, and whether they disagree on the major. */
|
|
10277
|
+
function pickRange(ranges, preferred) {
|
|
10278
|
+
const unique = [...new Set(ranges)];
|
|
10279
|
+
if (preferred && unique.includes(preferred)) return {
|
|
10280
|
+
range: preferred,
|
|
10281
|
+
majorConflict: majorsDiffer(unique)
|
|
10282
|
+
};
|
|
10283
|
+
const parsed = unique.map((r) => ({
|
|
10284
|
+
r,
|
|
10285
|
+
v: minVersion(r)
|
|
10286
|
+
}));
|
|
10287
|
+
if (parsed.some((p) => !p.v)) return {
|
|
10288
|
+
range: unique[0],
|
|
10289
|
+
majorConflict: unique.length > 1,
|
|
10290
|
+
unparsed: true
|
|
10291
|
+
};
|
|
10292
|
+
parsed.sort((a, b) => {
|
|
10293
|
+
const [x, y] = [a.v, b.v];
|
|
10294
|
+
for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return y[i] - x[i];
|
|
10295
|
+
return 0;
|
|
10296
|
+
});
|
|
10297
|
+
return {
|
|
10298
|
+
range: parsed[0]?.r ?? "",
|
|
10299
|
+
majorConflict: majorsDiffer(unique)
|
|
10300
|
+
};
|
|
10301
|
+
}
|
|
10302
|
+
// src/commands/probe/deps/target-catalog.ts
|
|
10303
|
+
/** Where a third-party dependency belongs, from the groups that use it (peers do not count). */
|
|
10304
|
+
function targetCatalog(groups) {
|
|
10305
|
+
const real = [...groups].filter((g) => g !== "root");
|
|
10306
|
+
if (groups.size > 1 && real.length !== 1) return "default";
|
|
10307
|
+
if (real.length === 1 && groups.size === 1) return real[0];
|
|
10308
|
+
return "default";
|
|
10309
|
+
}
|
|
10310
|
+
// src/commands/probe/deps/workspace-dirs.ts
|
|
10311
|
+
/** The workspace package folders, from the `packages:` globs (`dir` or `dir/*`), plus the root (`""`). */
|
|
10312
|
+
function workspaceDirs(root, yamlText) {
|
|
10313
|
+
const packagesBlock = yamlText.split(/^packages:\s*$/m)[1]?.split(/^\S/m)[0] ?? "";
|
|
10314
|
+
const dirs = [""];
|
|
10315
|
+
for (const line of packagesBlock.split("\n")) {
|
|
10316
|
+
const glob = line.match(/^\s+-\s+"?([^"\n]+?)"?\s*$/)?.[1];
|
|
10317
|
+
if (!glob || glob.startsWith("!")) continue;
|
|
10318
|
+
if (glob.endsWith("/*")) {
|
|
10319
|
+
const base = glob.slice(0, -2);
|
|
10320
|
+
if (!existsSync(join(root, base))) continue;
|
|
10321
|
+
for (const entry of readdirSync(join(root, base), { withFileTypes: true })) if (entry.isDirectory() && existsSync(join(root, base, entry.name, "package.json"))) dirs.push(`${base}/${entry.name}`);
|
|
10322
|
+
} else if (existsSync(join(root, glob, "package.json"))) dirs.push(glob);
|
|
10323
|
+
}
|
|
10324
|
+
return dirs;
|
|
10325
|
+
}
|
|
10326
|
+
// src/commands/probe/deps/plan-deps.ts
|
|
10327
|
+
function resolveSpec(spec, name, catalogs) {
|
|
10328
|
+
if (!spec.startsWith("catalog:")) return spec;
|
|
10329
|
+
return catalogs[spec.slice(8) || "default"]?.[name];
|
|
10330
|
+
}
|
|
10331
|
+
/**
|
|
10332
|
+
* Reads every workspace manifest and `pnpm-workspace.yaml` live and works out, for every dependency, the catalog it
|
|
10333
|
+
* belongs in and its range, plus the entries that need a human look.
|
|
10334
|
+
*/
|
|
10335
|
+
function planDeps(root) {
|
|
10336
|
+
const yamlText = readFileSync(join(root, "pnpm-workspace.yaml"), "utf8");
|
|
10337
|
+
const catalogs = parseCatalogs(yamlText);
|
|
10338
|
+
const dirs = workspaceDirs(root, yamlText);
|
|
10339
|
+
const { edges, inRepo } = collectEdges(root, dirs);
|
|
10340
|
+
const byName = /* @__PURE__ */ new Map();
|
|
10341
|
+
const flags = [];
|
|
10342
|
+
for (const edge of edges) {
|
|
10343
|
+
if (inRepo.has(edge.name) && edge.section !== "peerDependencies") {
|
|
10344
|
+
flags.push(`${edge.file}: ${edge.section}.${edge.name} is "${edge.spec}", but it is a workspace package; use "workspace:^"`);
|
|
10345
|
+
continue;
|
|
10346
|
+
}
|
|
10347
|
+
const entry = byName.get(edge.name) ?? {
|
|
10348
|
+
name: edge.name,
|
|
10349
|
+
edges: [],
|
|
10350
|
+
groups: /* @__PURE__ */ new Set()
|
|
10351
|
+
};
|
|
10352
|
+
entry.edges.push(edge);
|
|
10353
|
+
if (edge.section !== "peerDependencies") entry.groups.add(edge.group);
|
|
10354
|
+
byName.set(edge.name, entry);
|
|
10355
|
+
}
|
|
10356
|
+
const wanted = {};
|
|
10357
|
+
const rows = [];
|
|
10358
|
+
for (const entry of [...byName.values()].sort((a, b) => a.name.localeCompare(b.name))) {
|
|
10359
|
+
const isScoped = entry.name.startsWith(SCOPE);
|
|
10360
|
+
const nonPeer = entry.edges.filter((e) => e.section !== "peerDependencies");
|
|
10361
|
+
const peers = entry.edges.filter((e) => e.section === "peerDependencies");
|
|
10362
|
+
let target;
|
|
10363
|
+
if (isScoped && nonPeer.length === 0) target = "peers";
|
|
10364
|
+
else if (nonPeer.length === 0) {
|
|
10365
|
+
rows.push({
|
|
10366
|
+
name: entry.name,
|
|
10367
|
+
catalog: null,
|
|
10368
|
+
range: null,
|
|
10369
|
+
groups: [],
|
|
10370
|
+
edges: entry.edges
|
|
10371
|
+
});
|
|
10372
|
+
continue;
|
|
10373
|
+
} else target = targetCatalog(entry.groups);
|
|
10374
|
+
const usedFrom = isScoped && nonPeer.length === 0 ? peers : nonPeer;
|
|
10375
|
+
const ranges = [];
|
|
10376
|
+
for (const e of usedFrom) {
|
|
10377
|
+
const range = resolveSpec(e.spec, e.name, catalogs);
|
|
10378
|
+
if (range === void 0) flags.push(`${e.file}: ${entry.name} -> ${e.spec} has no catalog entry`);
|
|
10379
|
+
else ranges.push(range);
|
|
10380
|
+
}
|
|
10381
|
+
const { range, majorConflict, unparsed } = pickRange(ranges, catalogs[target]?.[entry.name] ?? (target === "default" ? void 0 : catalogs["default"]?.[entry.name]));
|
|
10382
|
+
if (majorConflict) flags.push(`${entry.name}: ranges disagree on the major version: ${[...new Set(ranges)].join(" | ")}`);
|
|
10383
|
+
if (unparsed) flags.push(`${entry.name}: a range is not plain semver: ${[...new Set(ranges)].join(" | ")}`);
|
|
10384
|
+
(wanted[target] ??= {})[entry.name] = range;
|
|
10385
|
+
rows.push({
|
|
10386
|
+
name: entry.name,
|
|
10387
|
+
catalog: target,
|
|
10388
|
+
range,
|
|
10389
|
+
groups: [...entry.groups].sort(),
|
|
10390
|
+
edges: entry.edges
|
|
10391
|
+
});
|
|
10392
|
+
}
|
|
10393
|
+
return {
|
|
10394
|
+
root,
|
|
10395
|
+
dirs,
|
|
10396
|
+
catalogs,
|
|
10397
|
+
wanted,
|
|
10398
|
+
rows,
|
|
10399
|
+
flags
|
|
10400
|
+
};
|
|
10401
|
+
}
|
|
10402
|
+
// src/commands/probe/deps/report-deps.ts
|
|
10403
|
+
const kindOf = (section) => section === "peerDependencies" ? "peer" : section === "devDependencies" ? "dev" : "prod";
|
|
10404
|
+
/** Every package that uses a dependency, with how. */
|
|
10405
|
+
function usersOf(row) {
|
|
10406
|
+
const byPkg = /* @__PURE__ */ new Map();
|
|
10407
|
+
for (const e of row.edges) {
|
|
10408
|
+
const kinds = byPkg.get(e.pkg) ?? /* @__PURE__ */ new Set();
|
|
10409
|
+
kinds.add(kindOf(e.section));
|
|
10410
|
+
byPkg.set(e.pkg, kinds);
|
|
10411
|
+
}
|
|
10412
|
+
return [...byPkg.entries()].map(([pkg, kinds]) => ({
|
|
10413
|
+
pkg,
|
|
10414
|
+
kinds: [...kinds]
|
|
10415
|
+
}));
|
|
10416
|
+
}
|
|
10417
|
+
/** One section per dependency matching `filter`: where its version lives and every package that uses it. */
|
|
10418
|
+
function detail(p, filter) {
|
|
10419
|
+
const rows = p.rows.filter((r) => r.name.includes(filter));
|
|
10420
|
+
if (rows.length === 0) return `No dependency matches "${filter}".\n`;
|
|
10421
|
+
const lines = [];
|
|
10422
|
+
const short = (pkg) => pkg.replace(SCOPE, "");
|
|
10423
|
+
for (const r of rows) {
|
|
10424
|
+
const where = r.catalog === null ? "peer ranges only (not in a catalog)" : r.catalog === "default" ? "catalog: (default)" : `catalog:${r.catalog}`;
|
|
10425
|
+
lines.push(`### ${r.name}${r.range ? ` ${r.range}` : ""} (${where})`, "");
|
|
10426
|
+
const byGroup = /* @__PURE__ */ new Map();
|
|
10427
|
+
for (const e of r.edges) {
|
|
10428
|
+
const entry = byGroup.get(e.group) ?? /* @__PURE__ */ new Map();
|
|
10429
|
+
const kinds = entry.get(e.pkg) ?? /* @__PURE__ */ new Set();
|
|
10430
|
+
kinds.add(kindOf(e.section));
|
|
10431
|
+
entry.set(e.pkg, kinds);
|
|
10432
|
+
byGroup.set(e.group, entry);
|
|
10433
|
+
}
|
|
10434
|
+
for (const [group, pkgs] of [...byGroup].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
10435
|
+
const list = [...pkgs].map(([pkg, kinds]) => `${short(pkg)} (${[...kinds].join("+")})`).join(", ");
|
|
10436
|
+
lines.push(`- **${group}**: ${list}`);
|
|
10437
|
+
}
|
|
10438
|
+
lines.push("");
|
|
10439
|
+
}
|
|
10440
|
+
return lines.join("\n");
|
|
10441
|
+
}
|
|
10442
|
+
const TITLES = {
|
|
10443
|
+
default: "Shared (default `catalog:`)",
|
|
10444
|
+
peers: "Peer floors (minimum versions the plugins accept)"
|
|
10445
|
+
};
|
|
10446
|
+
/** The markdown report, grouped by catalog; with `filter`, the users of the matching dependencies. */
|
|
10447
|
+
function reportDeps(p, filter) {
|
|
10448
|
+
if (filter) return detail(p, filter);
|
|
10449
|
+
const lines = ["# Dependencies", ""];
|
|
10450
|
+
const special = SPECIAL_CATALOGS;
|
|
10451
|
+
const order = [
|
|
10452
|
+
"default",
|
|
10453
|
+
...Object.keys(p.wanted).filter((c) => c !== "default" && !special.includes(c)).sort(),
|
|
10454
|
+
...SPECIAL_CATALOGS
|
|
10455
|
+
];
|
|
10456
|
+
for (const catalog of order) {
|
|
10457
|
+
const rows = p.rows.filter((r) => r.catalog === catalog);
|
|
10458
|
+
if (rows.length === 0) continue;
|
|
10459
|
+
const spec = catalog === "default" ? "catalog:" : `catalog:${catalog}`;
|
|
10460
|
+
lines.push(`## ${TITLES[catalog] ?? `${catalog} (\`${spec}\`)`}`, "", "| Dependency | Range | Used by |", "| --- | --- | --- |");
|
|
10461
|
+
for (const r of rows) {
|
|
10462
|
+
const groups = [...new Set(r.edges.map((e) => e.group))].sort();
|
|
10463
|
+
lines.push(`| \`${r.name}\` | \`${r.range}\` | ${usersOf(r).length} in ${groups.join(", ")} |`);
|
|
10464
|
+
}
|
|
10465
|
+
lines.push("");
|
|
10466
|
+
}
|
|
10467
|
+
const peerOnly = p.rows.filter((r) => r.catalog === null);
|
|
10468
|
+
if (peerOnly.length > 0) {
|
|
10469
|
+
lines.push("## Peer ranges only (not in a catalog)", "", "| Dependency | Ranges | Peer of |", "| --- | --- | --- |");
|
|
10470
|
+
for (const r of peerOnly) lines.push(`| \`${r.name}\` | ${[...new Set(r.edges.map((e) => `\`${e.spec}\``))].join(", ")} | ${r.edges.length} |`);
|
|
10471
|
+
lines.push("");
|
|
10472
|
+
}
|
|
10473
|
+
return lines.join("\n");
|
|
10474
|
+
}
|
|
10475
|
+
// src/commands/probe/deps/deps-probes.ts
|
|
10476
|
+
/** The group of probes that report who uses which dependency and enforce the catalog rule. */
|
|
10477
|
+
const DEPS_PROVIDER = "deps";
|
|
10478
|
+
/**
|
|
10479
|
+
* `deps report` prints every dependency with its catalog, range and how widely it is used; `deps who <name>` lists the
|
|
10480
|
+
* packages using the dependencies whose name contains `<name>`, by group; `deps check` fails for each dependency that
|
|
10481
|
+
* breaks the catalog rule written at the top of `pnpm-workspace.yaml` (CI runs it). Everything is read live from the
|
|
10482
|
+
* workspace manifests and `pnpm-workspace.yaml` on each run; nothing is cached.
|
|
10483
|
+
*/
|
|
10484
|
+
function depsProbes(repoRoot, print = (text) => console.log(text)) {
|
|
10485
|
+
return {
|
|
10486
|
+
report: {
|
|
10487
|
+
summary: "Print every dependency with its catalog, range and who uses it (markdown).",
|
|
10488
|
+
writes: false,
|
|
10489
|
+
async run(ctx) {
|
|
10490
|
+
print(reportDeps(planDeps(repoRoot)));
|
|
10491
|
+
ctx.say({
|
|
10492
|
+
status: "ok",
|
|
10493
|
+
label: "report",
|
|
10494
|
+
detail: "printed above"
|
|
10495
|
+
});
|
|
10496
|
+
}
|
|
10497
|
+
},
|
|
10498
|
+
who: {
|
|
10499
|
+
summary: "List the packages that use a dependency, by group: `probe deps who <name>`.",
|
|
10500
|
+
writes: false,
|
|
10501
|
+
async run(ctx) {
|
|
10502
|
+
const name = ctx.args?.[0];
|
|
10503
|
+
if (!name) {
|
|
10504
|
+
ctx.say({
|
|
10505
|
+
status: "fail",
|
|
10506
|
+
label: "who",
|
|
10507
|
+
detail: "name a dependency: probe deps who <name>"
|
|
10508
|
+
});
|
|
10509
|
+
return;
|
|
10510
|
+
}
|
|
10511
|
+
print(reportDeps(planDeps(repoRoot), name));
|
|
10512
|
+
ctx.say({
|
|
10513
|
+
status: "ok",
|
|
10514
|
+
label: "who",
|
|
10515
|
+
detail: `printed above for "${name}"`
|
|
10516
|
+
});
|
|
10517
|
+
}
|
|
10518
|
+
},
|
|
10519
|
+
check: {
|
|
10520
|
+
summary: "Fail for each dependency that breaks the catalog rule (CI runs this).",
|
|
10521
|
+
writes: false,
|
|
10522
|
+
async run(ctx) {
|
|
10523
|
+
const p = planDeps(repoRoot);
|
|
10524
|
+
const problems = checkDeps(p);
|
|
10525
|
+
for (const line of problems) ctx.say({
|
|
10526
|
+
status: "fail",
|
|
10527
|
+
label: line
|
|
10528
|
+
});
|
|
10529
|
+
if (problems.length === 0) ctx.say({
|
|
10530
|
+
status: "ok",
|
|
10531
|
+
label: `${p.rows.filter((r) => r.catalog).length} dependencies`,
|
|
10532
|
+
detail: "all in the right catalog"
|
|
10533
|
+
});
|
|
10534
|
+
}
|
|
10535
|
+
}
|
|
10536
|
+
};
|
|
10537
|
+
}
|
|
10155
10538
|
// src/commands/probe/docs-coverage/count-symbols.ts
|
|
10156
10539
|
/** TypeDoc's `ReflectionKind` numbers for the kinds that should be documented, by name. */
|
|
10157
10540
|
const KINDS = {
|
|
@@ -10529,6 +10912,7 @@ async function runProbe(input) {
|
|
|
10529
10912
|
};
|
|
10530
10913
|
const ctx = {
|
|
10531
10914
|
dryRun: input.dryRun,
|
|
10915
|
+
args: input.args ?? [],
|
|
10532
10916
|
say: emit,
|
|
10533
10917
|
secret: (value) => {
|
|
10534
10918
|
if (value) secrets.add(value);
|
|
@@ -10592,6 +10976,7 @@ async function runProbeCommand(input) {
|
|
|
10592
10976
|
groups.set(CORE_PROVIDER, coreProbes(loader, /* @__PURE__ */ new Map([[COMLINK_PROVIDER, comlink]])));
|
|
10593
10977
|
groups.set(COMLINK_PROVIDER, comlink);
|
|
10594
10978
|
groups.set(DOCS_PROVIDER, docsCoverageProbes(input.context.repoRoot, input.typedoc));
|
|
10979
|
+
groups.set(DEPS_PROVIDER, depsProbes(input.context.repoRoot, print));
|
|
10595
10980
|
if (!input.provider) {
|
|
10596
10981
|
if (input.pick) await input.pick(groups);
|
|
10597
10982
|
else for (const line of listProbes(groups)) print(line);
|
|
@@ -10616,6 +11001,7 @@ async function runProbeCommand(input) {
|
|
|
10616
11001
|
name: `${input.provider} ${input.probe}`,
|
|
10617
11002
|
provider: input.provider,
|
|
10618
11003
|
probeName: input.probe,
|
|
11004
|
+
args: input.args ?? [],
|
|
10619
11005
|
probe,
|
|
10620
11006
|
dryRun: input.dryRun ?? false,
|
|
10621
11007
|
yes: input.yes ?? false,
|
|
@@ -10628,7 +11014,7 @@ async function runProbeCommand(input) {
|
|
|
10628
11014
|
}
|
|
10629
11015
|
// src/commands/probe/probe.command.ts
|
|
10630
11016
|
const probeCommand = {
|
|
10631
|
-
command: "probe [provider] [probe]",
|
|
11017
|
+
command: "probe [provider] [probe] [args..]",
|
|
10632
11018
|
describe: "Poke a live provider on purpose: inspect it, or run a proof that cleans up after itself",
|
|
10633
11019
|
builder: probeArgs,
|
|
10634
11020
|
handler: async (argv) => {
|
|
@@ -10646,6 +11032,7 @@ const probeCommand = {
|
|
|
10646
11032
|
},
|
|
10647
11033
|
...argv.provider ? { provider: argv.provider } : {},
|
|
10648
11034
|
...argv.probe ? { probe: argv.probe } : {},
|
|
11035
|
+
...argv.args?.length ? { args: argv.args.map(String) } : {},
|
|
10649
11036
|
dryRun: argv.dryRun,
|
|
10650
11037
|
yes: argv.yes,
|
|
10651
11038
|
...process.stdin.isTTY ? { pick: (groups) => launchMenu(buildProbeMenuEntries(groups), argv, "probe — choose a provider:", "Run `holocron probe` to list the probes.", ["probe"]) } : {}
|
|
@@ -10901,6 +11288,19 @@ function withAutoPreviewDeployPaths(tasks, gitRoot) {
|
|
|
10901
11288
|
};
|
|
10902
11289
|
});
|
|
10903
11290
|
}
|
|
11291
|
+
// src/commands/thin-caller-file/thin-caller-file.ts
|
|
11292
|
+
const { workflowHeader: workflowHeader$1 } = createHeader({
|
|
11293
|
+
source: "cli/astromech/src/thin-callers.ts",
|
|
11294
|
+
tool: "holocron repo sync"
|
|
11295
|
+
});
|
|
11296
|
+
/**
|
|
11297
|
+
* The text of a generated thin-caller workflow: the AUTO-GENERATED header, the `# Source package:` marker (see
|
|
11298
|
+
* `resolvePkgRelPath`) and the workflow itself. Both `repo setup` and `repo sync` write their workflows through
|
|
11299
|
+
* this, so the file is the same whichever command wrote it.
|
|
11300
|
+
*/
|
|
11301
|
+
function thinCallerFile(pkgRelPath, content) {
|
|
11302
|
+
return `${workflowHeader$1()}# Source package: ${pkgRelPath}\n\n${content}`;
|
|
11303
|
+
}
|
|
10904
11304
|
// src/commands/workflow-source-marker/workflow-source-marker.ts
|
|
10905
11305
|
/** `# Source package: <path>` line at the head of a generated thin-caller workflow — see {@link resolvePkgRelPath}. */
|
|
10906
11306
|
const SOURCE_PACKAGE_MARKER = /^# Source package: (.+)$/m;
|
|
@@ -11517,6 +11917,25 @@ async function installEngineeringStructure({ repoRoot }) {
|
|
|
11517
11917
|
for (const [path, content] of writes) if (await writeIfAbsent(path, content)) results.push(path.replace(repoRoot + "/", ""));
|
|
11518
11918
|
return results.length > 0 ? `created: ${results.join(", ")}` : "all files already exist — nothing to write";
|
|
11519
11919
|
}
|
|
11920
|
+
// src/commands/setup/own-catalog-packages/own-catalog-packages.ts
|
|
11921
|
+
/**
|
|
11922
|
+
* The packages of this workspace that a pnpm catalog also lists: the minimum versions a plugin accepts
|
|
11923
|
+
* as a peer, say. Dependabot reads every catalog entry as an ordinary dependency and would raise it to the
|
|
11924
|
+
* latest release, but such an entry is a compatibility floor that is raised by hand, and the package itself
|
|
11925
|
+
* is linked with `workspace:`. A package from outside the workspace in a catalog is left out, so it keeps
|
|
11926
|
+
* getting updates. Sorted; `[]` when there is no `pnpm-workspace.yaml`.
|
|
11927
|
+
*/
|
|
11928
|
+
function ownCatalogPackages(repoRoot) {
|
|
11929
|
+
let yaml;
|
|
11930
|
+
try {
|
|
11931
|
+
yaml = readFileSync(join(repoRoot, "pnpm-workspace.yaml"), "utf8");
|
|
11932
|
+
} catch {
|
|
11933
|
+
return [];
|
|
11934
|
+
}
|
|
11935
|
+
const listed = new Set(Object.values(parseCatalogs(yaml)).flatMap((catalog) => Object.keys(catalog)));
|
|
11936
|
+
const own = discoverWorkspacePackages(repoRoot).flatMap(({ name }) => name && listed.has(name) ? [name] : []);
|
|
11937
|
+
return [...new Set(own)].sort();
|
|
11938
|
+
}
|
|
11520
11939
|
// src/commands/setup/repo-settings.ts
|
|
11521
11940
|
const BALANCED_REPO_SETTINGS = {
|
|
11522
11941
|
allow_squash_merge: true,
|
|
@@ -11723,11 +12142,14 @@ async function installSkills({ agent, skills, repoRoot }) {
|
|
|
11723
12142
|
}
|
|
11724
12143
|
}
|
|
11725
12144
|
}
|
|
11726
|
-
if (installed.length > 0 || stale.length > 0 || missing.length > 0 || externalFailed.length > 0)
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
12145
|
+
if (installed.length > 0 || stale.length > 0 || missing.length > 0 || externalFailed.length > 0) {
|
|
12146
|
+
const managed = /* @__PURE__ */ new Set([
|
|
12147
|
+
...installed,
|
|
12148
|
+
...missing,
|
|
12149
|
+
...externalFailed
|
|
12150
|
+
]);
|
|
12151
|
+
await updateSkillsGitignore(gitignorePath, skills.filter((name) => managed.has(name)), symlinkFn);
|
|
12152
|
+
}
|
|
11731
12153
|
const parts = [`installed ${installed.length}`];
|
|
11732
12154
|
if (stale.length > 0) parts.push(`pruned: ${stale.join(", ")}`);
|
|
11733
12155
|
if (externalStale.length > 0) parts.push(`stale: ${externalStale.join(", ")} (run \`holocron skills update\` to refresh)`);
|
|
@@ -11791,14 +12213,10 @@ async function updateSkillsGitignore(gitignorePath, skills, symlinkFn) {
|
|
|
11791
12213
|
* extensible but pushes the same knowledge into N plugins instead of
|
|
11792
12214
|
* one central place.
|
|
11793
12215
|
*/
|
|
11794
|
-
const { workflowHeader
|
|
12216
|
+
const { workflowHeader } = createHeader({
|
|
11795
12217
|
source: "cli/cli/src/commands/setup/run-setup.ts",
|
|
11796
12218
|
tool: "holocron repo setup"
|
|
11797
12219
|
});
|
|
11798
|
-
const { workflowHeader: thinCallerHeader } = createHeader({
|
|
11799
|
-
source: "cli/astromech/src/thin-callers.ts",
|
|
11800
|
-
tool: "holocron repo setup"
|
|
11801
|
-
});
|
|
11802
12220
|
async function runSetup(input) {
|
|
11803
12221
|
const print = input.print ?? ((line) => console.log(line));
|
|
11804
12222
|
const logger = getLogger();
|
|
@@ -11895,7 +12313,7 @@ async function runSetup(input) {
|
|
|
11895
12313
|
const step = content.includes("workflows/preview.yml@main") ? `write workflow ${name} (with preview)` : `write workflow ${name}`;
|
|
11896
12314
|
steps.push(await runStep("source", step, dryRun, async () => {
|
|
11897
12315
|
await assertNoPackageCollision(name, setupPkgRelPath, filename, () => source.readWorkflowFile(filename));
|
|
11898
|
-
await source.writeWorkflowFile(filename,
|
|
12316
|
+
await source.writeWorkflowFile(filename, thinCallerFile(setupPkgRelPath, content));
|
|
11899
12317
|
}));
|
|
11900
12318
|
print(formatStep(steps[steps.length - 1]));
|
|
11901
12319
|
}
|
|
@@ -11910,11 +12328,11 @@ async function runSetup(input) {
|
|
|
11910
12328
|
if (loader.has("source") && effectivePreset !== "none") {
|
|
11911
12329
|
const source = loader.get("source");
|
|
11912
12330
|
steps.push(await runStep("source", "write .github/dependabot.yml", dryRun, async () => {
|
|
11913
|
-
await source.writeRepoFile(".github/dependabot.yml", createDependabot());
|
|
12331
|
+
await source.writeRepoFile(".github/dependabot.yml", createDependabot({ ignore: ownCatalogPackages(input.context.repoRoot) }));
|
|
11914
12332
|
}));
|
|
11915
12333
|
print(formatStep(steps[steps.length - 1]));
|
|
11916
12334
|
steps.push(await runStep("source", "write .github/dco.yml", dryRun, async () => {
|
|
11917
|
-
await source.writeRepoFile(".github/dco.yml", `${workflowHeader
|
|
12335
|
+
await source.writeRepoFile(".github/dco.yml", `${workflowHeader()}${dco_default}`);
|
|
11918
12336
|
}));
|
|
11919
12337
|
print(formatStep(steps[steps.length - 1]));
|
|
11920
12338
|
}
|
|
@@ -12999,10 +13417,6 @@ async function runSyncWiki(input) {
|
|
|
12999
13417
|
}
|
|
13000
13418
|
}
|
|
13001
13419
|
// src/commands/sync/sync.ts
|
|
13002
|
-
const { workflowHeader } = createHeader({
|
|
13003
|
-
source: "cli/astromech/src/thin-callers.ts",
|
|
13004
|
-
tool: "holocron repo sync"
|
|
13005
|
-
});
|
|
13006
13420
|
const SYNC_STEPS = [
|
|
13007
13421
|
"labels",
|
|
13008
13422
|
"properties",
|
|
@@ -13325,7 +13739,7 @@ async function runSync(input) {
|
|
|
13325
13739
|
const step = `sync workflow ${name}${content.includes("workflows/preview.yml@main") ? " (with preview)" : ""}`;
|
|
13326
13740
|
steps.push(await runSyncStep("local", step, dryRun, async () => {
|
|
13327
13741
|
await assertNoPackageCollision(name, pkgRelPath, filename, () => readExistingWorkflowFile(gitRoot, filename));
|
|
13328
|
-
await writeWorkflowFile(gitRoot, filename,
|
|
13742
|
+
await writeWorkflowFile(gitRoot, filename, thinCallerFile(pkgRelPath, content));
|
|
13329
13743
|
}));
|
|
13330
13744
|
print(formatSyncStep(steps[steps.length - 1]));
|
|
13331
13745
|
}
|
|
@@ -14161,6 +14575,13 @@ const runArgs = (y) => y.positional("task", {
|
|
|
14161
14575
|
}).option("filter", {
|
|
14162
14576
|
type: "string",
|
|
14163
14577
|
describe: "turbo --filter=<pkg> passthrough (monorepo)."
|
|
14578
|
+
}).option("affected", {
|
|
14579
|
+
type: "boolean",
|
|
14580
|
+
default: false,
|
|
14581
|
+
describe: "Run only the packages changed since --base, and their dependents (turbo --affected)."
|
|
14582
|
+
}).option("base", {
|
|
14583
|
+
type: "string",
|
|
14584
|
+
describe: "Git ref --affected compares against. Falls back to TURBO_SCM_BASE."
|
|
14164
14585
|
});
|
|
14165
14586
|
// src/commands/run/run.command.ts
|
|
14166
14587
|
const runCommand = {
|
|
@@ -14193,7 +14614,9 @@ const runCommand = {
|
|
|
14193
14614
|
}).ci({
|
|
14194
14615
|
dryRun: argv.dryRun,
|
|
14195
14616
|
scope: argv.all ? "all" : "required",
|
|
14196
|
-
...argv.filter ? { filter: argv.filter } : {}
|
|
14617
|
+
...argv.filter ? { filter: argv.filter } : {},
|
|
14618
|
+
...argv.affected ? { affected: true } : {},
|
|
14619
|
+
...argv.base ? { base: argv.base } : {}
|
|
14197
14620
|
}).status === "fail") process.exitCode = 1;
|
|
14198
14621
|
return;
|
|
14199
14622
|
}
|
|
@@ -14207,7 +14630,9 @@ const runCommand = {
|
|
|
14207
14630
|
passthrough,
|
|
14208
14631
|
dryRun: argv.dryRun,
|
|
14209
14632
|
required: argv.required,
|
|
14210
|
-
...argv.filter ? { filter: argv.filter } : {}
|
|
14633
|
+
...argv.filter ? { filter: argv.filter } : {},
|
|
14634
|
+
...argv.affected ? { affected: true } : {},
|
|
14635
|
+
...argv.base ? { base: argv.base } : {}
|
|
14211
14636
|
});
|
|
14212
14637
|
if (report.status === "fail" || report.status === "unknown") process.exitCode = 1;
|
|
14213
14638
|
}
|