@theholocron/cli 5.0.0-alpha.250 → 5.0.0-alpha.252

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
@@ -223,7 +223,7 @@ properties; properties are never a second editable source of truth):
223
223
  | `holocron_compliance` | `"compliant" \| "non-compliant"` against a minimal `source` + `ci` baseline |
224
224
 
225
225
  Field definitions and derivation heuristics:
226
- `.notes/tech-holocron-platform.spec.md` → "Custom-properties sync — field
226
+ `docs/wiki/specifications/tech-holocron-platform.spec.md` → "Custom-properties sync — field
227
227
  definitions (#677)".
228
228
 
229
229
  The four derived fields' pure computation —
package/dist/cli.mjs CHANGED
@@ -29,8 +29,6 @@ import { findRootSync, isWorkspaceRoot, walkFilesSync } from "@theholocron/fs-ut
29
29
  import { access, copyFile, mkdir, open, readFile, readdir, realpath, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
30
30
  import { createServer } from "node:http";
31
31
  import { stringifyJson } from "@theholocron/json-utils";
32
- import { generateReadme } from "@theholocron/components-doc/markdown";
33
- import { getClients, getConfigs, getDocs, getPlugins, getSkills, getThemes, getUtils } from "@theholocron/registry-doc";
34
32
  import { lintCommitMsgFile } from "@theholocron/astromech/lint";
35
33
  import { createGitHubClient } from "@theholocron/github-client";
36
34
  // src/env/env.ts
@@ -12351,18 +12349,69 @@ const setupCommand = {
12351
12349
  })).summary.fail > 0) process.exitCode = 1;
12352
12350
  }
12353
12351
  };
12352
+ // src/commands/sync-readme/generate-readme.ts
12353
+ const SCRIPT_ORDER = [
12354
+ "build",
12355
+ "dev",
12356
+ "preview",
12357
+ "start",
12358
+ "docs:dev",
12359
+ "docs:build",
12360
+ "docs:preview",
12361
+ "lint",
12362
+ "test",
12363
+ "test:coverage",
12364
+ "test:storybook",
12365
+ "test:cypress",
12366
+ "typecheck",
12367
+ "audit"
12368
+ ];
12369
+ const SCRIPT_ALLOWLIST = new Set(SCRIPT_ORDER);
12370
+ function generateReadme(config) {
12371
+ return {
12372
+ description: config.description,
12373
+ ...config.packages !== void 0 && { packages: generatePackages(config.packages) },
12374
+ ...config.installation !== void 0 && { installation: generateInstallation(config.installation) },
12375
+ development: generateDevelopment(config.scripts),
12376
+ releases: generateReleases(config.homepage)
12377
+ };
12378
+ }
12379
+ function generatePackages(packages) {
12380
+ return `| Package | Docs | npm |\n|---|---|---|\n${Object.values(packages).map((entry) => `| \`${entry.package}\` | [Docs](${entry.docsUrl}) | [npm](${entry.npmUrl}) |`).join("\n")}`;
12381
+ }
12382
+ function generateInstallation(packageName) {
12383
+ return `\`\`\`sh\npnpm add ${packageName}\n\`\`\``;
12384
+ }
12385
+ function generateDevelopment(scripts) {
12386
+ return `| Script | Command |\n|---|---|\n${SCRIPT_ORDER.filter((name) => SCRIPT_ALLOWLIST.has(name) && name in scripts).map((name) => `| \`pnpm ${name}\` | \`${scripts[name]}\` |`).join("\n")}`;
12387
+ }
12388
+ function generateReleases(homepage) {
12389
+ return `Automated via [semantic-release](https://semantic-release.gitbook.io/semantic-release/).\nSee the [releases page](${homepage.replace(/\/$/, "")}/releases) and [CHANGELOG.md](./CHANGELOG.md).`;
12390
+ }
12391
+ // src/commands/sync-readme/workspace-packages.ts
12392
+ const NPM_BASE = "https://www.npmjs.com/package";
12393
+ /**
12394
+ * The public packages of the repo's workspace, as the rows of the README's
12395
+ * packages table: the name, its `homepage` as the docs link, and its npm page.
12396
+ *
12397
+ * `undefined` when the workspace has no public package (a single-package repo
12398
+ * has no table to show).
12399
+ */
12400
+ function workspacePackages$1(repoRoot, discover = discoverWorkspacePackages) {
12401
+ const rows = discover(repoRoot).flatMap(({ name, manifest }) => name && !manifest.private ? [{
12402
+ name,
12403
+ homepage: typeof manifest.homepage === "string" ? manifest.homepage : ""
12404
+ }] : []).sort((a, b) => a.name.localeCompare(b.name));
12405
+ if (rows.length === 0) return void 0;
12406
+ return Object.fromEntries(rows.map(({ name, homepage }) => [name, {
12407
+ package: name,
12408
+ docsUrl: homepage,
12409
+ npmUrl: `${NPM_BASE}/${name}`
12410
+ }]));
12411
+ }
12354
12412
  // src/commands/sync-readme/sync-readme.ts
12355
12413
  const MARKER_INSTALL_START = "<!-- holocron:installation -->";
12356
12414
  const MARKER_INSTALL_END = "<!-- /holocron:installation -->";
12357
- const REGISTRY_MAP = {
12358
- "@theholocron/clients": getClients,
12359
- "@theholocron/configs": getConfigs,
12360
- "@theholocron/docs": getDocs,
12361
- "@theholocron/holocron": getPlugins,
12362
- "@theholocron/skills": getSkills,
12363
- "@theholocron/themes": getThemes,
12364
- "@theholocron/utils": getUtils
12365
- };
12366
12415
  function generateInstallBlock(pkg, homepage = "") {
12367
12416
  const { name = "", bin, peerDependencies = {} } = pkg;
12368
12417
  const isCli = Boolean(bin);
@@ -12444,7 +12493,7 @@ async function updateIndexMdxDescription(repoRoot, description, dryRun, readFile
12444
12493
  if (updated !== content && !dryRun) await writeFileFn(mdxPath, updated, "utf8");
12445
12494
  }
12446
12495
  async function runSyncReadme(input) {
12447
- const { loaded, context, print = console.log, readFileFn = readFile, writeFileFn = writeFile } = input;
12496
+ const { loaded, context, print = console.log, readFileFn = readFile, writeFileFn = writeFile, discoverFn } = input;
12448
12497
  const logger = input.logger ?? getLogger();
12449
12498
  const { repoRoot, dryRun = false } = context;
12450
12499
  const namespaces = loaded.resolved.env?.namespaces ?? [];
@@ -12467,13 +12516,11 @@ async function runSyncReadme(input) {
12467
12516
  }
12468
12517
  const description = loaded.resolved.description ?? "";
12469
12518
  const homepage = loaded.resolved.homepage ?? pkg.homepage ?? "";
12470
- const scripts = pkg.scripts ?? {};
12471
- const packages = pkg.name ? REGISTRY_MAP[pkg.name]?.() : void 0;
12472
12519
  const sections = generateReadme({
12473
12520
  description,
12474
12521
  homepage,
12475
- scripts,
12476
- packages
12522
+ scripts: pkg.scripts ?? {},
12523
+ packages: workspacePackages$1(repoRoot, discoverFn)
12477
12524
  });
12478
12525
  const markerSections = {
12479
12526
  ...sections.packages !== void 0 && { packages: sections.packages },