@theholocron/cli 5.0.0-alpha.240 → 5.0.0-alpha.242

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
@@ -324,7 +324,7 @@ setup --hooks` / `--no-hooks` override per run. Bypass one push with `git push
324
324
  export default defineConfig({
325
325
  tasks: ["test", "lint", "typecheck"],
326
326
  // syncScripts: false, // disable the step
327
- // holocronScript: "node packages/cli/dist/cli.mjs", // override the "holocron" entry
327
+ // holocronScript: "node cli/cli/dist/cli.mjs", // override the "holocron" entry
328
328
  providers: { source: "github" },
329
329
  });
330
330
  ```
package/dist/cli.mjs CHANGED
@@ -6186,7 +6186,7 @@ export class ${inputs.capabilityClass} {
6186
6186
  constructor(private readonly rest: () => ${clientClass}) {}
6187
6187
 
6188
6188
  // TODO: implement the ${capabilityInterface} interface methods
6189
- // (see \`packages/cli/src/capabilities/index.ts\`). Each method
6189
+ // (see \`cli/cli/src/capabilities/index.ts\`). Each method
6190
6190
  // should hit a specific ${inputs.vendorName} REST endpoint via
6191
6191
  // \`this.rest().request(...)\` — call the thunk so the token is
6192
6192
  // resolved lazily. Once methods are stubbed, add
@@ -6904,7 +6904,7 @@ export default defineConfig({
6904
6904
  *
6905
6905
  * Flow:
6906
6906
  * 1. Preflight — verify CWD is a workspace root (pnpm-workspace.yaml
6907
- * + packages/ dir present).
6907
+ * + a package directory).
6908
6908
  * 2. Slug collision — plugins/holocron-plugin-<slug>/ must not exist.
6909
6909
  * 3. Capability sanity — must be one of the 14 known keys; warn for
6910
6910
  * many-cardinality caps.
@@ -7148,7 +7148,7 @@ function trimTrailingSlashes(url) {
7148
7148
  return out;
7149
7149
  }
7150
7150
  function validateCapability(capability, print) {
7151
- if (!(capability in CARDINALITY)) throw new PluginCreateError(`\`${capability}\` is not a known capability. See \`packages/cli/src/capabilities/index.ts\`.`);
7151
+ if (!(capability in CARDINALITY)) throw new PluginCreateError(`\`${capability}\` is not a known capability. See \`cli/cli/src/capabilities/index.ts\`.`);
7152
7152
  if (CARDINALITY[capability] === "many") print(` ! ${capability} is a many-cardinality capability — multiple providers can be active at once. Confirm your config wiring accordingly.`);
7153
7153
  }
7154
7154
  function defaultWrite(filepath, content) {
@@ -9113,16 +9113,17 @@ async function runNpmBumpVersions(input) {
9113
9113
  const print = input.print ?? ((line) => console.log(line));
9114
9114
  const logger = input.logger ?? getLogger();
9115
9115
  const cwd = input.cwd ?? process.cwd();
9116
- const { version, dryRun = false } = input;
9116
+ const { version, dryRun = false, group } = input;
9117
9117
  const readFile = input.readFile ?? ((p) => readFileSync(p, "utf8"));
9118
9118
  const writeFile = input.writeFile ?? ((p, c) => writeFileSync(p, c));
9119
9119
  const listDir = input.listDir ?? ((p) => readdirSync(p));
9120
9120
  const isDir = input.isDir ?? ((p) => statSync(p).isDirectory());
9121
9121
  const bumped = [];
9122
9122
  const skipped = [];
9123
- print(`Bumping monorepo to ${version}${dryRun ? " (dry-run)" : ""}…`);
9123
+ print(`Bumping ${group ? `group ${group}` : "monorepo"} to ${version}${dryRun ? " (dry-run)" : ""}…`);
9124
9124
  logger.info({
9125
9125
  version,
9126
+ group,
9126
9127
  dryRun: dryRun || void 0
9127
9128
  }, "npm bump-versions: start");
9128
9129
  function bumpFile(absPath, label) {
@@ -9143,11 +9144,12 @@ async function runNpmBumpVersions(input) {
9143
9144
  print(` ${dryRun ? "~" : "✓"} ${label}: ${old} → ${version}`);
9144
9145
  bumped.push(label);
9145
9146
  }
9146
- bumpFile(join(cwd, "package.json"), "root");
9147
+ if (!group) bumpFile(join(cwd, "package.json"), "root");
9147
9148
  const listed = /* @__PURE__ */ new Set();
9148
9149
  const workspace = discoverWorkspacePackages(cwd, {
9149
9150
  readFile,
9150
9151
  readText: readFile,
9152
+ ...group ? { group } : {},
9151
9153
  listDirs: (dir) => {
9152
9154
  let names;
9153
9155
  try {
@@ -9166,6 +9168,21 @@ async function runNpmBumpVersions(input) {
9166
9168
  });
9167
9169
  }
9168
9170
  });
9171
+ if (group && workspace.length === 0) {
9172
+ const message = `no packages in group "${group}"`;
9173
+ print(` ✗ ${message}`);
9174
+ logger.info({
9175
+ version,
9176
+ group,
9177
+ status: "fail"
9178
+ }, "npm bump-versions: done");
9179
+ return {
9180
+ status: "fail",
9181
+ bumped,
9182
+ skipped,
9183
+ message
9184
+ };
9185
+ }
9169
9186
  const found = new Set(workspace.map((entry) => entry.dir));
9170
9187
  for (const dir of listed) if (!found.has(dir)) print(` ! skipping ${relative(resolve(cwd), dir)}: no package.json or malformed JSON`);
9171
9188
  for (const { dir, relativeDir, manifest } of workspace) {
@@ -9194,6 +9211,9 @@ async function runNpmBumpVersions(input) {
9194
9211
  const npmBumpVersionsArgs = (y) => y.positional("new-version", {
9195
9212
  type: "string",
9196
9213
  describe: "Version to set (e.g., 4.2.0 or 2.0.0-alpha.1)"
9214
+ }).option("group", {
9215
+ type: "string",
9216
+ describe: "Only this version group's packages: a folder of the repo (clients, observability). The root package.json is left alone. Omitted, the root and every workspace package move together."
9197
9217
  });
9198
9218
  //#endregion
9199
9219
  //#region src/commands/npm-bump-versions/npm-bump-versions.command.ts
@@ -9206,7 +9226,8 @@ const npmBumpVersionsCommand = {
9206
9226
  if ((await runNpmBumpVersions({
9207
9227
  version: newVersion,
9208
9228
  cwd: argv.cwd,
9209
- dryRun: argv.dryRun
9229
+ dryRun: argv.dryRun,
9230
+ ...argv.group ? { group: argv.group } : {}
9210
9231
  })).status === "fail") process.exitCode = 1;
9211
9232
  }
9212
9233
  };
@@ -9264,9 +9285,17 @@ const defaultLogin = async (cwd) => {
9264
9285
  * package. Single package (it declares none -- no `pnpm-workspace.yaml`, or one
9265
9286
  * listing only private members like a docs site): the root `package.json`.
9266
9287
  * Callers keep the public ones.
9288
+ *
9289
+ * With a `group` (a folder of the repo, `clients`), only that group's packages,
9290
+ * and never the root `package.json`: a group that has no packages has nothing to
9291
+ * publish, not a single-package repo.
9267
9292
  */
9268
- function discoverManifests(cwd) {
9269
- const workspace = discoverWorkspacePackages(cwd);
9293
+ function discoverManifests(cwd, group) {
9294
+ const workspace = discoverWorkspacePackages(cwd, { ...group === void 0 ? {} : { group } });
9295
+ if (group !== void 0) return workspace.map(({ manifest, relativeDir }) => ({
9296
+ manifest,
9297
+ dir: `./${relativeDir}`
9298
+ }));
9270
9299
  if (!workspace.some(({ manifest }) => !manifest.private)) {
9271
9300
  const manifest = readPackageJsonSync(cwd);
9272
9301
  return manifest ? [{
@@ -9287,8 +9316,8 @@ function discoverManifests(cwd) {
9287
9316
  * mode needs both to check `npm view <pkg>@<version>` and publish one
9288
9317
  * workspace at a time.
9289
9318
  */
9290
- function discoverPublicPackageEntries(cwd) {
9291
- return discoverManifests(cwd).flatMap(({ manifest, dir }) => !manifest.private && manifest.name && manifest.version ? [{
9319
+ function discoverPublicPackageEntries(cwd, group) {
9320
+ return discoverManifests(cwd, group).flatMap(({ manifest, dir }) => !manifest.private && manifest.name && manifest.version ? [{
9292
9321
  name: manifest.name,
9293
9322
  version: manifest.version,
9294
9323
  dir
@@ -9401,8 +9430,8 @@ async function resolveRepoIdentity(cwd, exec) {
9401
9430
  * invocation below so a repo with several package roots is covered the same as
9402
9431
  * a `packages/*`-only one.
9403
9432
  */
9404
- function workspaceFilterArgs(cwd) {
9405
- const found = discoverWorkspacePackages(cwd).filter(({ manifest }) => !manifest.private);
9433
+ function workspaceFilterArgs(cwd, group) {
9434
+ const found = discoverWorkspacePackages(cwd, { ...group === void 0 ? {} : { group } }).filter(({ manifest }) => !manifest.private);
9406
9435
  const globs = resolveWorkspaceGlobs(cwd).include.filter((glob) => found.some(({ relativeDir }) => glob.endsWith("/*") ? relativeDir.startsWith(glob.slice(0, -1)) : relativeDir === glob));
9407
9436
  return globs.length > 0 ? ["-r", ...globs.map((glob) => `--filter=./${glob}`)] : [];
9408
9437
  }
@@ -9423,7 +9452,7 @@ function workspaceFilterArgs(cwd) {
9423
9452
  *
9424
9453
  * $ pnpm install --frozen-lockfile
9425
9454
  * $ pnpm build
9426
- * $ pnpm exec tsx packages/cli/src/cli.ts package publish --initial
9455
+ * $ pnpm exec tsx cli/cli/src/cli.ts package publish --initial
9427
9456
  *
9428
9457
  * `npm login --auth-type=web` runs automatically the first time — no
9429
9458
  * separate manual step. `pnpm install` + `pnpm build` stay outside the
@@ -9482,7 +9511,7 @@ async function runPublish(input = {}) {
9482
9511
  if ((await login(cwd)).exitCode !== 0) {
9483
9512
  const message = "npm login failed. Run `npm login --auth-type=web` (or `npm login`) manually, then re-run.";
9484
9513
  print(` ✗ ${message}`);
9485
- const packageNames = (input.packages ?? discoverPublicPackageEntries(cwd)).map((e) => e.name);
9514
+ const packageNames = (input.packages ?? discoverPublicPackageEntries(cwd, input.group)).map((e) => e.name);
9486
9515
  logger.warn({ reason: "npm login failed" }, "publish --initial: done");
9487
9516
  return {
9488
9517
  status: "fail",
@@ -9494,7 +9523,7 @@ async function runPublish(input = {}) {
9494
9523
  if (whoami.exitCode !== 0) {
9495
9524
  const message = "npm login completed but `npm whoami` still fails — check your npm account.";
9496
9525
  print(` ✗ ${message}`);
9497
- const packageNames = (input.packages ?? discoverPublicPackageEntries(cwd)).map((e) => e.name);
9526
+ const packageNames = (input.packages ?? discoverPublicPackageEntries(cwd, input.group)).map((e) => e.name);
9498
9527
  logger.warn({ reason: "npm whoami still fails after login" }, "publish --initial: done");
9499
9528
  return {
9500
9529
  status: "fail",
@@ -9507,7 +9536,7 @@ async function runPublish(input = {}) {
9507
9536
  print(style.dim(` ✓ authed as ${whoamiName}`));
9508
9537
  print("");
9509
9538
  if (otp) print(style.dim(` otp: <${otp.length} chars>`));
9510
- const discoveredEntries = input.packages ?? discoverPublicPackageEntries(cwd);
9539
+ const discoveredEntries = input.packages ?? discoverPublicPackageEntries(cwd, input.group);
9511
9540
  const nameWidth = Math.max(0, ...discoveredEntries.map((e) => e.name.length));
9512
9541
  const dirWidth = Math.max(0, ...discoveredEntries.map((e) => e.dir.length));
9513
9542
  const newEntries = input.packages ? [...discoveredEntries] : await filterNewPackages(discoveredEntries, cwd, exec, print, nameWidth, dirWidth);
@@ -9542,7 +9571,7 @@ async function runPublish(input = {}) {
9542
9571
  };
9543
9572
  }
9544
9573
  const publishArgs = [
9545
- ...workspaceFilterArgs(cwd).length > 0 ? ["-r", ...packageNames.map((name) => `--filter=${name}`)] : [],
9574
+ ...workspaceFilterArgs(cwd, input.group).length > 0 ? ["-r", ...packageNames.map((name) => `--filter=${name}`)] : [],
9546
9575
  "publish",
9547
9576
  "--access",
9548
9577
  "public",
@@ -9577,7 +9606,7 @@ async function runPublish(input = {}) {
9577
9606
  if (publish.stdout.includes("EOTP") || publish.stderr.includes("EOTP")) {
9578
9607
  print("");
9579
9608
  print(" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:");
9580
- print(` pnpm exec tsx packages/cli/src/cli.ts package publish --initial --otp <6-digit-code>`);
9609
+ print(` pnpm exec tsx cli/cli/src/cli.ts package publish --initial --otp <6-digit-code>`);
9581
9610
  }
9582
9611
  for (const entry of newEntries) print(statusRow("fail", [
9583
9612
  pad(entry.name, nameWidth),
@@ -9639,10 +9668,11 @@ async function runSteadyPublish(input = {}) {
9639
9668
  const exec = input.exec ?? defaultExec$1;
9640
9669
  const provenance = input.provenance ?? true;
9641
9670
  const skipAlreadyPublished = input.skipAlreadyPublished ?? false;
9642
- const entries = input.packages ?? discoverPublicPackageEntries(cwd);
9671
+ const entries = input.packages ?? discoverPublicPackageEntries(cwd, input.group);
9643
9672
  const packageNames = entries.map((e) => e.name);
9644
9673
  print(`Holocron publish${dryRun ? " (dry-run)" : ""}`);
9645
9674
  print(` cwd: ${cwd}`);
9675
+ if (input.group) print(` group: ${input.group}`);
9646
9676
  print(` tag: ${tag}`);
9647
9677
  print(` provenance: ${provenance}`);
9648
9678
  if (skipAlreadyPublished) print(" skip-already-published: true");
@@ -9678,7 +9708,7 @@ async function runSteadyPublish(input = {}) {
9678
9708
  if (skipAlreadyPublished) for (const entry of entries) print(` … would check ${entry.name}@${entry.version}, publish if not already on npm`);
9679
9709
  else {
9680
9710
  const args = [
9681
- ...workspaceFilterArgs(cwd),
9711
+ ...workspaceFilterArgs(cwd, input.group),
9682
9712
  "publish",
9683
9713
  ...baseFlags,
9684
9714
  ...otpFlags
@@ -9753,7 +9783,7 @@ async function runSteadyPublish(input = {}) {
9753
9783
  }
9754
9784
  print(" → publishing all public @theholocron/* packages…");
9755
9785
  const publish = await exec("pnpm", [
9756
- ...workspaceFilterArgs(cwd),
9786
+ ...workspaceFilterArgs(cwd, input.group),
9757
9787
  "publish",
9758
9788
  ...baseFlags,
9759
9789
  ...otpFlags
@@ -9790,8 +9820,8 @@ async function runSteadyPublish(input = {}) {
9790
9820
  //#endregion
9791
9821
  //#region src/commands/publish/discover-public-packages.ts
9792
9822
  /** The names of `discoverPublicPackageEntries`' packages, without requiring a version. */
9793
- function discoverPublicPackages(cwd) {
9794
- return discoverManifests(cwd).flatMap(({ manifest }) => !manifest.private && manifest.name ? [manifest.name] : []);
9823
+ function discoverPublicPackages(cwd, group) {
9824
+ return discoverManifests(cwd, group).flatMap(({ manifest }) => !manifest.private && manifest.name ? [manifest.name] : []);
9795
9825
  }
9796
9826
  //#endregion
9797
9827
  //#region src/commands/publish/is-eotp.ts
@@ -9837,7 +9867,7 @@ async function runSyncTrust(input) {
9837
9867
  const repo = input.repo ?? "theholocron/holocron";
9838
9868
  const dryRun = input.dryRun ?? false;
9839
9869
  const exec = input.exec ?? defaultExec$1;
9840
- const packageNames = input.packages ?? discoverPublicPackages(cwd);
9870
+ const packageNames = input.packages ?? discoverPublicPackages(cwd, input.group);
9841
9871
  const npm = "npx";
9842
9872
  const npmArgs = ["-y", "npm@latest"];
9843
9873
  print(`Holocron publish --sync-trust${dryRun ? " (dry-run)" : ""}`);
@@ -10004,6 +10034,9 @@ const publishArgs = (y) => y.option("initial", {
10004
10034
  }).option("repo", {
10005
10035
  type: "string",
10006
10036
  describe: "owner/repo for Trusted Publisher config (--sync-trust). Defaults to theholocron/holocron."
10037
+ }).option("group", {
10038
+ type: "string",
10039
+ describe: "Only this version group's packages: a folder of the repo (clients, observability). Omitted, every public package in the workspace."
10007
10040
  }).option("provenance", {
10008
10041
  type: "boolean",
10009
10042
  default: true,
@@ -10033,6 +10066,7 @@ const publishCommand = {
10033
10066
  oldFile,
10034
10067
  newFile,
10035
10068
  dryRun: argv.dryRun,
10069
+ ...argv.group ? { group: argv.group } : {},
10036
10070
  ...argv.repo ? { repo: argv.repo } : {}
10037
10071
  })).status === "fail") process.exitCode = 1;
10038
10072
  return;
@@ -10041,6 +10075,7 @@ const publishCommand = {
10041
10075
  const report = await runPublish({
10042
10076
  cwd: argv.cwd,
10043
10077
  dryRun: argv.dryRun,
10078
+ ...argv.group ? { group: argv.group } : {},
10044
10079
  ...argv.tag ? { tag: argv.tag } : {},
10045
10080
  ...otp ? { otp } : {}
10046
10081
  });
@@ -10053,6 +10088,7 @@ const publishCommand = {
10053
10088
  dryRun: argv.dryRun,
10054
10089
  provenance: argv.provenance,
10055
10090
  skipAlreadyPublished: argv.skipAlreadyPublished,
10091
+ ...argv.group ? { group: argv.group } : {},
10056
10092
  ...argv.tag ? { tag: argv.tag } : {},
10057
10093
  ...otp ? { otp } : {}
10058
10094
  })).status === "fail") process.exitCode = 1;
@@ -11707,11 +11743,11 @@ async function updateSkillsGitignore(gitignorePath, skills, symlinkFn) {
11707
11743
  * one central place.
11708
11744
  */
11709
11745
  const { workflowHeader: workflowHeader$1 } = createHeader({
11710
- source: "packages/cli/src/commands/setup/run-setup.ts",
11746
+ source: "cli/cli/src/commands/setup/run-setup.ts",
11711
11747
  tool: "holocron repo setup"
11712
11748
  });
11713
11749
  const { workflowHeader: thinCallerHeader } = createHeader({
11714
- source: "packages/astromech/src/thin-callers.ts",
11750
+ source: "cli/astromech/src/thin-callers.ts",
11715
11751
  tool: "holocron repo setup"
11716
11752
  });
11717
11753
  async function runSetup(input) {
@@ -12516,7 +12552,7 @@ function generateInstallBlock(pkg, homepage = "") {
12516
12552
  const lines = [];
12517
12553
  lines.push("## Installation", "");
12518
12554
  if (!isConsumable) {
12519
- lines.push("This repository is a workspace root — it is not published. See the", "packages under [`packages/`](./packages) for the tools it ships.");
12555
+ lines.push("This repository is a workspace root — it is not published. See the", "workspace packages for the tools it ships.");
12520
12556
  return lines.join("\n");
12521
12557
  }
12522
12558
  if (isCli) lines.push("```bash", `npm install --global ${name}`, "```");
@@ -12871,7 +12907,7 @@ async function runSyncWiki(input) {
12871
12907
  //#endregion
12872
12908
  //#region src/commands/sync/sync.ts
12873
12909
  const { workflowHeader } = createHeader({
12874
- source: "packages/astromech/src/thin-callers.ts",
12910
+ source: "cli/astromech/src/thin-callers.ts",
12875
12911
  tool: "holocron repo sync"
12876
12912
  });
12877
12913
  const SYNC_STEPS = [
@@ -13409,7 +13445,7 @@ async function mergePackageJsonScripts(repoRoot, desired, turboEligible) {
13409
13445
  * Matches the exact shape `packageScripts()` generates for `taskName` —
13410
13446
  * `<bin> run <taskName> --`, `<bin>` normally `holocron` but substitutable
13411
13447
  * (`holocronScript`, itself allowed to be multi-word, e.g. `"node
13412
- packages/cli/dist/cli.mjs"` — see its own test). Checking the *suffix*
13448
+ cli/cli/dist/cli.mjs"` — see its own test). Checking the *suffix*
13413
13449
  * rather than the whole string means an old wrapper survives a
13414
13450
  * `holocronScript` rename intact — it's still recognized as a wrapper (safe
13415
13451
  * to update to the new one), not mistaken for a real command.