@theholocron/cli 3.63.0 → 3.64.0

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 CHANGED
@@ -2035,12 +2035,13 @@ export class ${inputs.capabilityClass} {
2035
2035
  readonly key = "${inputs.capability}" as const;
2036
2036
  readonly providerName = "${inputs.slug}";
2037
2037
 
2038
- constructor(private readonly rest: ${clientClass}) {}
2038
+ constructor(private readonly rest: () => ${clientClass}) {}
2039
2039
 
2040
2040
  // TODO: implement the ${capabilityInterface} interface methods
2041
2041
  // (see \`packages/cli/src/capabilities/index.ts\`). Each method
2042
2042
  // should hit a specific ${inputs.vendorName} REST endpoint via
2043
- // \`this.rest.request(...)\`. Once methods are stubbed, add
2043
+ // \`this.rest().request(...)\` — call the thunk so the token is
2044
+ // resolved lazily. Once methods are stubbed, add
2044
2045
  // \`implements ${capabilityInterface}\` to the class declaration
2045
2046
  // above and remove the \`as unknown as\` cast in src/index.ts.
2046
2047
  }
@@ -2061,7 +2062,7 @@ import { stubFetch } from "./helpers.js";
2061
2062
  function makeCapability() {
2062
2063
  const stub = stubFetch([]);
2063
2064
  const rest = new ${clientClass}({ token: "t", fetch: stub.fetch });
2064
- return new ${inputs.capabilityClass}(rest);
2065
+ return new ${inputs.capabilityClass}(() => rest);
2065
2066
  }
2066
2067
 
2067
2068
  describe("${inputs.capabilityClass}", () => {
@@ -2254,17 +2255,21 @@ export interface ${inputs.vendorName}PluginOptions extends ResolveTokenInput {
2254
2255
 
2255
2256
  export interface PluginContext {
2256
2257
  options: ${inputs.vendorName}PluginOptions;
2257
- rest: ${clientClass};
2258
+ /** Memoized client — the token is resolved on first use, not at plugin load. */
2259
+ rest: () => ${clientClass};
2258
2260
  }
2259
2261
 
2260
2262
  export function createContext(options: ${inputs.vendorName}PluginOptions): PluginContext {
2261
- const token = resolveToken(options);
2262
- const restOpts: ConstructorParameters<typeof ${clientClass}>[0] = { token };
2263
- if (options.baseUrl !== undefined) restOpts.baseUrl = options.baseUrl;
2264
- if (options.fetch !== undefined) restOpts.fetch = options.fetch;
2263
+ let rest: ${clientClass} | undefined;
2265
2264
  return {
2266
2265
  options,
2267
- rest: new ${clientClass}(restOpts),
2266
+ rest: () => {
2267
+ if (rest) return rest;
2268
+ const restOpts: ConstructorParameters<typeof ${clientClass}>[0] = { token: resolveToken(options) };
2269
+ if (options.baseUrl !== undefined) restOpts.baseUrl = options.baseUrl;
2270
+ if (options.fetch !== undefined) restOpts.fetch = options.fetch;
2271
+ return (rest = new ${clientClass}(restOpts));
2272
+ },
2268
2273
  };
2269
2274
  }
2270
2275
 
@@ -3751,7 +3756,7 @@ function deriveDeployPaths(raw) {
3751
3756
  * configured. Paths are gitignored and regenerated on every setup run so the
3752
3757
  * content always reflects the current CLI version.
3753
3758
  *
3754
- * Source: .notes/ai-engineering-workflow.spec.md
3759
+ * Source: docs/wiki/specifications/ai-engineering-workflow.spec.md
3755
3760
  */
3756
3761
  const DECISIONS_TEMPLATE = "---\nid: ADR-XXXX\ntitle: \"\"\nstatus: proposed\ndate: YYYY-MM-DD\nowners: []\nspecs: []\ndiscussion:\n github:\nsupersedes: []\nsuperseded-by: []\ntags: []\n---\n\n# [Short title of the decision]\n\n- Status: [proposed | accepted | rejected | deprecated | superseded by ADR-XXXX]\n- Date: YYYY-MM-DD\n\n## Context and Problem Statement\n\n2–3 sentences describing the situation that forced this decision.\n\n## Decision Drivers\n\n- [driver 1 — a constraint, goal, or value]\n- [driver 2]\n\n## Considered Options\n\n- [Option A]\n- [Option B]\n- [Option C — do nothing]\n\n## Decision Outcome\n\nChosen option: **[Option A]**, because [one-sentence justification].\n\n### Positive Consequences\n\n- …\n\n### Negative Consequences\n\n- …\n\n## Pros and Cons of the Options\n\n### [Option A]\n\n- Good, because [argument]\n- Bad, because [argument]\n\n### [Option B]\n\n- Good, because [argument]\n- Bad, because [argument]\n";
3757
3762
  const AGENT_PROMPTS = {
@@ -5203,12 +5208,17 @@ const REGISTRY_MAP = {
5203
5208
  "@theholocron/themes": getThemes,
5204
5209
  "@theholocron/utils": getUtils
5205
5210
  };
5206
- function generateInstallBlock(pkg) {
5211
+ function generateInstallBlock(pkg, homepage = "") {
5207
5212
  const { name = "", bin, peerDependencies = {} } = pkg;
5208
5213
  const isCli = Boolean(bin);
5209
5214
  const isReact = Boolean(peerDependencies["react"]);
5215
+ const isConsumable = isCli || !pkg.private || Boolean(pkg.main) || pkg.exports !== void 0;
5210
5216
  const lines = [];
5211
5217
  lines.push("## Installation", "");
5218
+ if (!isConsumable) {
5219
+ lines.push("This repository is a workspace root — it is not published. See the", "packages under [`packages/`](./packages) for the tools it ships.");
5220
+ return lines.join("\n");
5221
+ }
5212
5222
  if (isCli) lines.push("```bash", `npm install --global ${name}`, "```");
5213
5223
  else lines.push("```bash", `pnpm install ${name}`, "```");
5214
5224
  lines.push("", "## Usage", "");
@@ -5217,8 +5227,9 @@ function generateInstallBlock(pkg) {
5217
5227
  lines.push("```bash");
5218
5228
  for (const cmd of commands) lines.push(`${cmd} --help`);
5219
5229
  lines.push("```");
5220
- } else if (isReact) lines.push("```tsx", `import { } from "${name}";`, "", "function App() {", ` return <></>;`, "}", "```");
5221
- else lines.push("```typescript", `import { } from "${name}";`, "```");
5230
+ } else if (isReact) lines.push("```tsx", `import {} from "${name}";`, "", "function App() {", ` return <></>;`, "}", "```");
5231
+ else if (homepage) lines.push(`See the [documentation](${homepage}) for the API.`);
5232
+ else lines.push("See the package documentation for the API.");
5222
5233
  return lines.join("\n");
5223
5234
  }
5224
5235
  /**
@@ -5300,9 +5311,10 @@ async function runSyncReadme(input) {
5300
5311
  };
5301
5312
  }
5302
5313
  const description = loaded.resolved.description ?? "";
5314
+ const homepage = loaded.resolved.homepage ?? pkg.homepage ?? "";
5303
5315
  const sections = generateReadme({
5304
5316
  description,
5305
- homepage: loaded.resolved.homepage ?? pkg.homepage ?? "",
5317
+ homepage,
5306
5318
  scripts: pkg.scripts ?? {},
5307
5319
  packages: pkg.name ? REGISTRY_MAP[pkg.name]?.() : void 0
5308
5320
  });
@@ -5311,7 +5323,7 @@ async function runSyncReadme(input) {
5311
5323
  development: sections.development,
5312
5324
  releases: sections.releases
5313
5325
  };
5314
- const updated = await updateReadme(repoRoot, generateInstallBlock(pkg), markerSections, dryRun, readFileFn, writeFileFn);
5326
+ const updated = await updateReadme(repoRoot, generateInstallBlock(pkg, homepage), markerSections, dryRun, readFileFn, writeFileFn);
5315
5327
  if (!updated) {
5316
5328
  print(style.warn("README.md not found or has no writable location for installation block"));
5317
5329
  logger.warn({