@theholocron/cli 5.0.0-alpha.157 → 5.0.0-alpha.159
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.map +1 -1
- package/package.json +3 -3
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":["getKeyringToken","deriveDefaults","defaultImporter","SKIP_DIRS","defaultWalkFiles","SKIP_DIRS","defaultWalkFiles","preflight","defaultExec","render","render","render","render","render","render","render","render","render","render","render","render","render","render","render","render","render","renderPackageJson","renderTsconfigJson","renderVitestConfig","renderEslintConfig","renderTsdownConfig","renderReadme","renderAuth","renderRest","renderVerifyToken","renderPluginIndex","renderCapability","renderHelpers","renderAuthTest","renderRestTest","renderVerifyTokenTest","renderCapabilityTest","renderIndexTest","renderValidateScript","defaultExec","printNextSteps","defaultExec","defaultExec","defaultExec","defaultExec","ProviderApiError","ProviderApiError","workflowHeader","dcoConfig","FETCH_TIMEOUT_MS"],"sources":["../src/env/env.ts","../src/auth/keyring/keyring.ts","../src/auth/auth-resolver/auth-resolver.ts","../src/auth/token-args/token-args.ts","../src/plugin/capabilities/capabilities.ts","../src/config/config/config.ts","../src/config/load-config/load-config.ts","../src/commands/contexts/contexts.ts","../src/ui/non-interactive-error/non-interactive-error.ts","../src/ui/json-view/json-view.ts","../src/ui/menu/menu.ts","../src/ui/open-path/open-path.ts","../src/ui/progress/progress.ts","../src/ui/prompt-positionals/prompt-positionals.ts","../src/ui/style/style.ts","../src/ui/status-row/status-row.ts","../src/observability/logger/logger.ts","../src/plugin/loader/loader.ts","../src/plugin/run-check/run-check.ts","../src/plugin/workspace/workspace.ts","../src/commands/auth/auth.ts","../src/commands/cleanup-preview/cleanup-preview.ts","../src/commands/clone/clone.ts","../src/commands/deploy/deploy.ts","../src/commands/doctor/doctor.ts","../src/commands/monitoring-check/monitoring-check.ts","../src/commands/new/new.ts","../src/commands/npm-bump-versions/npm-bump-versions.ts","../src/commands/plugin-create/template-inputs/template-inputs.ts","../src/commands/plugin-create/templates/auth.ts","../src/commands/plugin-create/templates/auth-test.ts","../src/commands/plugin-create/templates/capability.ts","../src/commands/plugin-create/templates/capability-test.ts","../src/commands/plugin-create/templates/eslint-config.ts","../src/commands/plugin-create/templates/helpers.ts","../src/commands/plugin-create/templates/index-test.ts","../src/commands/plugin-create/templates/package-json.ts","../src/commands/plugin-create/templates/plugin-index.ts","../src/commands/plugin-create/templates/readme.ts","../src/commands/plugin-create/templates/rest.ts","../src/commands/plugin-create/templates/rest-test.ts","../src/commands/plugin-create/templates/tsconfig-json.ts","../src/commands/plugin-create/templates/tsdown-config.ts","../src/commands/plugin-create/templates/validate-script.ts","../src/commands/plugin-create/templates/verify-token.ts","../src/commands/plugin-create/templates/verify-token-test.ts","../src/commands/plugin-create/templates/vitest-config.ts","../src/commands/plugin-create/index.ts","../src/commands/publish/default-exec.ts","../src/commands/publish/default-login.ts","../src/commands/publish/has-packages-dir.ts","../src/commands/publish/has-plugins-dir.ts","../src/commands/publish/discover-manifests.ts","../src/commands/publish/discover-public-packages.ts","../src/commands/publish/print-next-steps.ts","../src/commands/publish/resolve-repo-name.ts","../src/commands/publish/workspace-filter-args.ts","../src/commands/publish/run-publish/run-publish.ts","../src/commands/publish/discover-public-package-entries.ts","../src/commands/publish/run-steady-publish/run-steady-publish.ts","../src/commands/publish/is-eotp.ts","../src/commands/publish/parse-json.ts","../src/commands/publish/run-sync-trust/run-sync-trust.ts","../src/commands/secret-set/secret-set.ts","../src/commands/secrets-sync/secrets-sync.ts","../src/commands/setup/derived-properties/derived-properties.ts","../src/commands/setup/labels.ts","../src/templates/dco.yml","../src/commands/setup/agent-prompts-data.ts","../src/commands/setup/agent-prompts.ts","../src/commands/setup/branch-protection.ts","../src/commands/setup/engineering.ts","../src/commands/setup/repo-settings.ts","../src/commands/setup/run-step/run-step.ts","../src/commands/setup/skills/skills.ts","../src/commands/setup/run-setup.ts","../src/commands/skills/skills.ts","../src/commands/sync-readme/sync-readme.ts","../src/commands/sync-wiki/sync-wiki.ts","../src/commands/sync/sync.ts","../src/observability/resolve-telemetry/resolve-telemetry.ts","../src/observability/telemetry/telemetry.ts","../src/commands/sync-github/sync-github.ts","../src/commands/upgrade-deps/upgrade-deps.ts","../src/commands/upgrade-node/upgrade-node.ts","../src/interactive-menu/child-argv/child-argv.ts","../src/interactive-menu/command-registry/command-registry.ts","../src/interactive-menu/menu-items/menu-items.ts","../src/interactive-menu/launch-menu/launch-menu.ts","../src/interactive-menu/run-menu-entries/run-menu-entries.ts","../src/update-notifier/update-notifier.ts","../src/cli.ts"],"sourcesContent":["import { createEnvLookup, withEnvPrefix } from \"@theholocron/env-utils\";\n\nexport type { EnvLookup as CliEnv } from \"@theholocron/env-utils\";\n\n/** Singleton env for simple global lookups throughout the CLI. */\nexport const env = createEnvLookup();\n\n/**\n * `get(\"KEY\")` tries `HOLOCRON_KEY` first, then `KEY`. Use it for settings that\n * have both a Holocron-namespaced override and a vendor-native name; do not use\n * it for `HOLOCRON_*` variables that have no bare fallback (`HOLOCRON_ORG`,\n * `HOLOCRON_LOG_LEVEL`, …), where the bare name would be wrong.\n */\nexport const holocronEnv = withEnvPrefix(env, \"HOLOCRON\");\n\n/**\n * Create an injectable env for commands that accept a fake env in tests.\n * Pass `input.env` when available, falls back to `process.env`.\n */\nexport function makeEnv(source?: Record<string, string | undefined>) {\n\treturn createEnvLookup(source);\n}\n","/**\n * Keyring-backed bootstrap credential store.\n *\n * Every holocron plugin's bootstrap token (the one it needs before it\n * can talk to its vendor's API) can be stored in the OS keyring under\n * a single reverse-DNS service scope. Managed via `holocron auth`\n * subcommands; consulted at position 4 in every plugin's auth\n * precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).\n *\n * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.\n *\n * Failure model: keyring access is best-effort. Platforms without a\n * supported credential store (some Linux CI images, sandboxed\n * environments) will throw from the underlying library. Every export\n * here catches and returns a null/empty result rather than propagating\n * — the plugin's precedence chain then falls through to\n * env-var-only paths, which is exactly how CI is meant to work.\n */\n\nimport { Entry, findCredentials } from \"@napi-rs/keyring\";\n\nconst SERVICE = \"com.theholocron.cli\";\n\n/**\n * Store or overwrite a bootstrap token for a provider. Returns true on\n * success, false when the underlying keyring is unsupported or errored.\n */\nexport function setToken(provider: string, token: string): boolean {\n\ttry {\n\t\tnew Entry(SERVICE, provider).setPassword(token);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Read the bootstrap token for a provider. Returns `null` for both\n * \"not stored\" and \"keyring unavailable\" — callers can treat them the\n * same way (fall through to env-var precedence).\n */\nexport function getToken(provider: string): string | null {\n\ttry {\n\t\treturn new Entry(SERVICE, provider).getPassword();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Delete a stored token. Returns true when a token was removed, false\n * when there was nothing to delete or the keyring is unavailable.\n * Distinguishing the two cases isn't worth the surface area — the\n * command output makes the situation clear either way.\n */\nexport function deleteToken(provider: string): boolean {\n\ttry {\n\t\treturn new Entry(SERVICE, provider).deletePassword();\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * List provider slugs with a stored token in this service scope.\n * Uses the library's `findCredentials(service)` — supported on all\n * platforms the underlying credential store supports.\n */\nexport function listStoredProviders(): string[] {\n\ttry {\n\t\treturn findCredentials(SERVICE).map((c) => c.account);\n\t} catch {\n\t\treturn [];\n\t}\n}\n","// Re-exported from @theholocron/http — the canonical home for HTTP primitives.\n// createResolveToken is wrapped here to inject the keyring backend so plugins\n// don't need to pass it explicitly.\nimport { AuthError, createResolveToken as _createResolveToken, type ResolveTokenInput } from \"@theholocron/http-client\";\n\nimport { makeEnv } from \"../../env/index.js\";\nimport { getToken as getKeyringToken } from \"../keyring/index.js\";\nimport type { FeatureResolverConfig, ResolveTokenConfig } from \"./auth-resolver.type.js\";\n\nexport { AuthError, type ResolveTokenInput };\n\n/** Wraps `createResolveToken` from `@theholocron/http` and injects the\n * system keyring so plugins stay at a one-liner call site. */\nexport function createResolveToken(config: ResolveTokenConfig): (input?: ResolveTokenInput) => string {\n\treturn _createResolveToken({ ...config, getKeyringToken });\n}\n\n/**\n * Build a strict, single-feature token resolver.\n *\n * Resolution chain: `--token flag → envName env var → keyring(keyringKey)`.\n * No broad-token fallback — if the feature-specific token is absent the\n * operation fails with a message naming the exact env var to set.\n */\nexport function createFeatureResolver(config: FeatureResolverConfig): (input?: ResolveTokenInput) => string {\n\treturn function resolveFeatureToken(input: ResolveTokenInput = {}): string {\n\t\tconst env = makeEnv(input.env);\n\t\tconst keyring = input.keyring ?? getKeyringToken;\n\t\tconst token = input.cliToken || env.get(config.envName) || keyring(config.keyringKey);\n\t\tif (!token) {\n\t\t\tthrow new AuthError(\n\t\t\t\t`no GitHub token found for this operation. Pass --token <PAT>, ` +\n\t\t\t\t\t`set ${config.envName}, or run: holocron auth set ${config.keyringKey} <PAT>`\n\t\t\t);\n\t\t}\n\t\treturn token;\n\t};\n}\n","import type { ParsedTokenArgs } from \"./token-args.type.js\";\n\nexport class TokenParseError extends Error {\n\toverride name = \"TokenParseError\";\n}\n\n/**\n * Converts raw --token CLI values into a typed result.\n *\n * Bare form: --token ghp_xxx → { cliToken: \"ghp_xxx\" }\n * Keyed form: --token github=ghp_xxx → { cliTokens: { github: \"ghp_xxx\" } }\n * Mixed: --token github=ghp_xxx --token v_yyy\n * → { cliToken: \"v_yyy\", cliTokens: { github: \"ghp_xxx\" } }\n *\n * Values may contain \"=\" (e.g. base64 strings) — only the first \"=\" is treated as a separator.\n */\nexport function parseTokenArgs(tokens: string[]): ParsedTokenArgs {\n\tif (tokens.length === 0) return {};\n\n\tconst cliTokens: Record<string, string> = {};\n\tconst bare: string[] = [];\n\n\tfor (const raw of tokens) {\n\t\tconst eqIdx = raw.indexOf(\"=\");\n\n\t\tif (eqIdx === -1) {\n\t\t\tbare.push(raw);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst vendor = raw.slice(0, eqIdx);\n\t\tconst value = raw.slice(eqIdx + 1);\n\n\t\tif (vendor.trim() === \"\") {\n\t\t\tthrow new TokenParseError(`invalid --token value \"${raw}\": vendor name must not be empty`);\n\t\t}\n\t\tif (/\\s/.test(vendor)) {\n\t\t\tthrow new TokenParseError(`invalid --token value \"${raw}\": vendor name must not contain whitespace`);\n\t\t}\n\t\tif (value === \"\") {\n\t\t\tthrow new TokenParseError(`invalid --token value \"${raw}\": token value must not be empty`);\n\t\t}\n\n\t\tcliTokens[vendor] = value;\n\t}\n\n\tif (bare.length > 1) {\n\t\tthrow new TokenParseError(\n\t\t\t`only one bare --token value is allowed; got ${bare.length.toString()} — use vendor=value form for multiple tokens`\n\t\t);\n\t}\n\n\tconst result: ParsedTokenArgs = {};\n\tif (bare.length === 1) result.cliToken = bare[0];\n\tif (Object.keys(cliTokens).length > 0) result.cliTokens = cliTokens;\n\treturn result;\n}\n","import type { CapabilityKey, Cardinality, CardinalityFor } from \"./capabilities.type.js\";\n\nexport const CARDINALITY = {\n\tsource: \"single\",\n\tci: \"single\",\n\tsecrets: \"single\",\n\tenvironments: \"single\",\n\tissues: \"single\",\n\tdeployment: \"single\",\n\tstorage: \"single\",\n\tauth: \"single\",\n\tvault: \"single\",\n\tdns: \"single\",\n\ttooling: \"many\",\n\tnotifications: \"many\",\n\tanalytics: \"many\",\n\terrors: \"single\",\n\tlogs: \"single\",\n\tmonitoring: \"single\",\n\twiki: \"single\",\n\tworkers: \"single\",\n} as const satisfies Record<CapabilityKey, Cardinality>;\n\n/**\n * No capabilities are strictly required — repos without secrets (e.g. org\n * community health repos) legitimately omit vault. Plugins validate their\n * own requirements at call time.\n */\nexport const REQUIRED_CAPABILITIES: readonly CapabilityKey[] = [] as const;\n\nexport { ProviderApiError } from \"@theholocron/http-client\";\n\nexport class WebhookVerificationError extends Error {\n\toverride name = \"WebhookVerificationError\";\n}\n\nexport function isMulti<K extends CapabilityKey>(key: K): CardinalityFor<K> extends \"many\" ? true : false {\n\treturn (CARDINALITY[key] === \"many\") as CardinalityFor<K> extends \"many\" ? true : false;\n}\n","import {\n\ttype CapabilityKey,\n\tCARDINALITY,\n\ttype PagesConfig,\n\tREQUIRED_CAPABILITIES,\n\ttype TeamEntry,\n\ttype TeamPermission,\n} from \"../../plugin/capabilities/index.js\";\nimport type {\n\tHolocronConfig,\n\tProviderOptions,\n\tRawProviderEntry,\n\tResolvedHolocronConfig,\n\tResolvedProviderEntry,\n\tResolvedProvidersConfig,\n\tResolvedTuple,\n} from \"./config.type.js\";\n\nexport type { PagesConfig, TeamEntry, TeamPermission };\n\n// ───────────────────────────────────────────────────────────────────────\n// Errors\n// ───────────────────────────────────────────────────────────────────────\n\nexport class ConfigError extends Error {\n\toverride name = \"ConfigError\";\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Helpers\n// ───────────────────────────────────────────────────────────────────────\n\nconst PLUGIN_PREFIX = \"@theholocron/holocron-plugin-\";\nconst COMMUNITY_PREFIX = \"holocron-plugin-\";\n\n/**\n * Resolve `\"github\"` → `\"@theholocron/holocron-plugin-github\"`.\n * Fully-qualified names (scoped or not) are honored verbatim, which\n * is how third-party plugins published outside the org work.\n */\nexport function resolvePluginPackage(provider: string): string {\n\tif (!provider) throw new ConfigError(\"provider name is empty\");\n\tif (provider.startsWith(\"@\")) return provider;\n\tif (provider.startsWith(COMMUNITY_PREFIX)) return provider;\n\tif (provider.includes(\"/\")) return provider;\n\treturn PLUGIN_PREFIX + provider;\n}\n\n/** A bare `[provider, options]` tuple, with both elements present? */\nfunction isOptionsTuple(value: unknown): value is [string, ProviderOptions] {\n\tif (!Array.isArray(value)) return false;\n\tif (value.length !== 2) return false;\n\tif (typeof value[0] !== \"string\") return false;\n\tconst opt = value[1];\n\treturn typeof opt === \"object\" && opt !== null && !Array.isArray(opt);\n}\n\nfunction normalizeEntry(entry: string | [string, ProviderOptions]): ResolvedTuple {\n\tif (typeof entry === \"string\") {\n\t\treturn { provider: entry, packageName: resolvePluginPackage(entry), options: {} };\n\t}\n\tconst [provider, options] = entry;\n\treturn { provider, packageName: resolvePluginPackage(provider), options };\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Parse / resolve\n// ───────────────────────────────────────────────────────────────────────\n\nexport function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry {\n\tconst cardinality = CARDINALITY[key];\n\n\t// Single short form: \"github\"\n\tif (typeof raw === \"string\") {\n\t\tif (cardinality === \"many\") {\n\t\t\tthrow new ConfigError(`\\`${key}\\` accepts multiple providers; wrap a single one in an array: [\"${raw}\"]`);\n\t\t}\n\t\treturn { cardinality: \"single\", tuple: normalizeEntry(raw) };\n\t}\n\n\tif (!Array.isArray(raw)) {\n\t\tthrow new ConfigError(`\\`${key}\\` entry must be a string or array, got ${typeof raw}`);\n\t}\n\n\t// Single options tuple: [\"vercel\", { team: \"rando\" }]\n\tif (isOptionsTuple(raw)) {\n\t\tif (cardinality === \"many\") {\n\t\t\t// Same shape, but cardinality forces multi — promote to one-element list\n\t\t\treturn { cardinality: \"many\", tuples: [normalizeEntry(raw)] };\n\t\t}\n\t\treturn { cardinality: \"single\", tuple: normalizeEntry(raw) };\n\t}\n\n\t// Multi list — array of strings, tuples, or a mix\n\tif (cardinality === \"single\") {\n\t\tthrow new ConfigError(\n\t\t\t`\\`${key}\\` accepts exactly one provider; got a multi-provider list with ${raw.length} entries`\n\t\t);\n\t}\n\n\tconst tuples = raw.map((entry, idx) => {\n\t\tif (typeof entry === \"string\") return normalizeEntry(entry);\n\t\tif (isOptionsTuple(entry)) return normalizeEntry(entry);\n\t\tthrow new ConfigError(`\\`${key}[${idx}]\\` must be a provider string or [provider, options] tuple`);\n\t});\n\n\treturn { cardinality: \"many\", tuples };\n}\n\nexport function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig {\n\tif (!raw.name) {\n\t\tthrow new ConfigError(\"`name` is required\");\n\t}\n\tif (!raw.providers || typeof raw.providers !== \"object\") {\n\t\tthrow new ConfigError(\"`providers` block is required\");\n\t}\n\n\tconst providers: ResolvedProvidersConfig = {};\n\tfor (const [key, entry] of Object.entries(raw.providers)) {\n\t\tif (entry === undefined) continue;\n\t\tproviders[key as CapabilityKey] = resolveEntry(key as CapabilityKey, entry as RawProviderEntry);\n\t}\n\n\tfor (const required of REQUIRED_CAPABILITIES) {\n\t\tif (!providers[required]) {\n\t\t\tthrow new ConfigError(`required capability \\`${required}\\` is missing from providers`);\n\t\t}\n\t}\n\n\t// Validate docs and narrow build to required\n\tlet docs: PagesConfig | undefined;\n\tif (raw.docs !== undefined) {\n\t\tif (!raw.docs.build) {\n\t\t\tthrow new ConfigError(\"`docs.build` is required when `docs` is set\");\n\t\t}\n\t\tdocs = raw.docs as PagesConfig;\n\t}\n\n\t// Derive homepage from docs.domain when not explicitly set\n\tconst homepage = raw.homepage ?? (docs?.domain ? `https://${docs.domain}/` : undefined);\n\n\treturn {\n\t\tname: raw.name,\n\t\tdescription: raw.description,\n\t\thomepage,\n\t\torg: raw.org,\n\t\tdomain: raw.domain,\n\t\trepo: raw.repo,\n\t\ttasks: raw.tasks,\n\t\tsyncScripts: raw.syncScripts,\n\t\tholocronScript: raw.holocronScript,\n\t\textraRequiredChecks: raw.extraRequiredChecks,\n\t\thooks: raw.hooks,\n\t\tproviders,\n\t\tapps: raw.apps ?? [],\n\t\tdoctor: raw.doctor ?? {},\n\t\tagent: raw.agent,\n\t\tskills: raw.skills,\n\t\tdocs,\n\t\tenv: raw.env,\n\t\tlog: raw.log,\n\t\ttelemetry: raw.telemetry,\n\t\teslint: raw.eslint,\n\t};\n}\n","/**\n * `holocron.config.{ts,js,mjs,cjs,json}` loader.\n *\n * File discovery + module loading (typed configs via `tsx`, no build\n * step) is delegated to `@theholocron/datapad`. This module keeps the\n * holocron-specific parts: filling `name` / `repo.name` defaults and\n * running the config through `resolveConfig`.\n *\n * Probe order is TS-first (`.ts` → `.js` → `.mjs` → `.cjs` → `.json`) —\n * see ADR-0010 / issue #75 / #81.\n */\n\nimport { basename, dirname } from \"node:path\";\n\nimport { loadTasksConfig } from \"@theholocron/astromech/config\";\nimport { ConfigFileError, loadConfigFile, type Loaded } from \"@theholocron/datapad\";\nimport { readGitRemote } from \"@theholocron/git-utils\";\nimport { readPackageJson } from \"@theholocron/pkg-utils\";\n\nimport { type HolocronConfig, resolveConfig } from \"../config/index.js\";\nimport type { LoadedConfig } from \"./load-config.type.js\";\n\nexport { ConfigFileError } from \"@theholocron/datapad\";\n\n/**\n * Read + parse + resolve `holocron.config.*` starting from the given\n * directory, walking up through ancestors to the nearest `.git` boundary\n * when `cwd` itself has no match — every command is usable from any\n * subdirectory of a repo, not only its exact root (see\n * `@theholocron/datapad`'s own doc comment for the stop conditions).\n * Throws {@link ConfigFileError} when nothing is found or a file cannot\n * be loaded, or `ConfigError` when the config fails schema checks.\n */\nexport async function loadConfig(cwd: string): Promise<LoadedConfig> {\n\tconst found = await loadConfigFile<HolocronConfig>({ cwd, name: \"holocron\", walkUp: true });\n\tif (!found) {\n\t\tthrow new ConfigFileError(\n\t\t\t`no holocron.config.{ts,js,mjs,cjs,json} found in ${cwd}. Create one — see the README for the schema.`\n\t\t);\n\t}\n\tconst withDefaults = await deriveDefaults(found);\n\treturn { resolved: resolveConfig(withDefaults), filepath: found.filepath };\n}\n\nasync function deriveDefaults(found: Loaded<HolocronConfig>): Promise<HolocronConfig> {\n\tconst configDir = dirname(found.filepath);\n\tconst result = { ...found.config };\n\tif (!result.name) {\n\t\tresult.name = (await readPackageJsonName(configDir)) ?? basename(configDir);\n\t}\n\tif (result.repo && !result.repo.name) {\n\t\tconst remote = await readGitRemote(configDir);\n\t\t// `repo.name` holds GitHub coordinates (owner/repo); a remote on any other host leaves it unset.\n\t\tif (remote?.host === \"github.com\") result.repo = { ...result.repo, name: remote.slug };\n\t}\n\n\t// Layer in the task manifest. `holocron.config`'s `tasks` key is one input;\n\t// a dedicated `astromech.config.{ts,js,mjs,json}` is merged on top (it wins\n\t// on scalars, task arrays concatenate). Doing it here keeps `holocron repo setup`\n\t// / `sync` / `doctor` on the same manifest that `holocron run` / `holocron\n\t// ci` resolve directly via `loadTasksConfig` — handed the file already loaded\n\t// above so it isn't found and loaded a second time.\n\tconst manifest = await loadTasksConfig(configDir, { holocron: found });\n\tif (manifest.tasks) result.tasks = manifest.tasks;\n\tif (manifest.syncScripts !== undefined) result.syncScripts = manifest.syncScripts;\n\tif (manifest.holocronScript !== undefined) result.holocronScript = manifest.holocronScript;\n\tif (manifest.hooks !== undefined) result.hooks = manifest.hooks;\n\tif (manifest.extraRequiredChecks) {\n\t\tresult.extraRequiredChecks = [...(result.extraRequiredChecks ?? []), ...manifest.extraRequiredChecks];\n\t}\n\n\treturn result;\n}\n\nasync function readPackageJsonName(dir: string): Promise<string | undefined> {\n\tconst name = (await readPackageJson(dir))?.name;\n\treturn name === undefined ? undefined : name.replace(/^@[^/]+\\//, \"\");\n}\n","import type { ExecutionContext } from \"./contexts.type.js\";\n\n/**\n * Command → context. Keys are the full command path as it lands in\n * yargs' `argv._` (`\"auth set\"`, `\"repo upgrade node\"`), the bare verb\n * otherwise; a longer, more specific key wins over its parent.\n *\n * - **`global`** — needs nothing but the CLI binary. Works anywhere.\n * - **`repo-aware`** — reads `./holocron.config` + `./package.json`\n * relative to cwd, but never touches the plugin loader.\n * - **`workspace`** — needs the configured providers' plugin packages to\n * resolve (devDeps in a repo, or `pnpm exec`).\n */\nexport const COMMAND_CONTEXTS = {\n\tclone: \"global\",\n\t\"new repo\": \"global\",\n\t\"new plugin\": \"global\",\n\t\"repo upgrade node\": \"global\",\n\t\"repo upgrade deps\": \"global\",\n\t\"auth set\": \"global\",\n\t\"auth unset\": \"global\",\n\t\"auth list\": \"global\",\n\t// `auth check` loads a plugin to verify, but degrades to \"token present,\n\t// verification skipped\" when the plugin isn't resolvable — so it's usable\n\t// from a global install. See `runAuthCheck`.\n\t\"auth check\": \"global\",\n\t\"package bump-versions\": \"global\",\n\t\"package publish\": \"global\",\n\t\"skills install\": \"global\",\n\t\"skills remove\": \"global\",\n\t\"skills update\": \"global\",\n\t// The `.husky/commit-msg` hook: works from a bare install, no holocron.config.\n\t\"run lint commit-msg\": \"global\",\n\n\trun: \"repo-aware\",\n\t\"run ci\": \"repo-aware\",\n\t// Reads each package's `holocron.config` and runs `pnpm --filter <pkg> delivery.deploy`\n\t// — no plugins of its own (the package's deploy script resolves them).\n\t\"deploy on-release\": \"repo-aware\",\n\t\"config show\": \"repo-aware\",\n\t// Writes README + package.json metadata from config; never loads a plugin.\n\t\"repo sync readme\": \"repo-aware\",\n\n\tdoctor: \"workspace\",\n\t\"repo setup\": \"workspace\",\n\t\"secrets set\": \"workspace\",\n\t\"secrets sync\": \"workspace\",\n\tdeploy: \"workspace\",\n\t\"deploy cleanup-preview\": \"workspace\",\n\t\"monitoring check\": \"workspace\",\n\t\"repo sync\": \"workspace\",\n\t// Pushes generated templates to theholocron/.github — needs the holocron\n\t// monorepo checkout (not plugins), so only ever run with `pnpm exec`.\n\t\"sync github\": \"workspace\",\n} as const satisfies Record<string, ExecutionContext>;\n\n/**\n * The context for a command name from `argv._`. Falls back to the leading\n * verb (`\"auth foo\"` → `\"auth\"`) and finally `undefined` for a name the\n * map doesn't know — callers treat unknown as \"don't guard\".\n */\nexport function contextForCommand(name: string): ExecutionContext | undefined {\n\tconst map = COMMAND_CONTEXTS as Record<string, ExecutionContext>;\n\tconst tokens = name.split(\" \").filter(Boolean);\n\t// Longest prefix wins: `repo sync labels` → `repo sync`, `run lint commit-msg` stays exact.\n\tfor (let n = tokens.length; n > 0; n--) {\n\t\tconst ctx = map[tokens.slice(0, n).join(\" \")];\n\t\tif (ctx) return ctx;\n\t}\n\treturn undefined;\n}\n\n/** Command names in a given context, in registration order. */\nexport function commandsInContext(context: ExecutionContext): string[] {\n\treturn Object.entries(COMMAND_CONTEXTS)\n\t\t.filter(([, c]) => c === context)\n\t\t.map(([name]) => name);\n}\n","/**\n * Raised when a prompt is needed but stdin isn't a TTY. A non-TTY run (CI, a\n * script, a pipe) throws this instead of hanging on `@inquirer/prompts`, which\n * otherwise throws its own `ExitPromptError` the moment stdin closes. `cli.ts`'s\n * `USER_FACING_ERRORS` catch prints the message cleanly.\n */\nexport class NonInteractiveError extends Error {\n\toverride name = \"NonInteractiveError\";\n}\n","import chalk from \"chalk\";\n\nimport { NonInteractiveError } from \"../non-interactive-error/index.js\";\nimport type { Container, Key, Line, Path, RenderOptions, ViewJsonOptions, ViewState } from \"./json-view.type.js\";\n\nfunction isContainer(value: unknown): value is Container {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction childrenOf(value: Container): [string, unknown][] {\n\treturn Array.isArray(value) ? value.map((v, i): [string, unknown] => [String(i), v]) : Object.entries(value);\n}\n\nfunction scalar(value: unknown): string {\n\tif (typeof value === \"string\") return chalk.green(JSON.stringify(value));\n\tif (typeof value === \"number\") return chalk.yellow(String(value));\n\tif (typeof value === \"boolean\") return chalk.magenta(String(value));\n\treturn chalk.dim(String(value === undefined ? null : value));\n}\n\nfunction summary(value: Container): string {\n\tconst n = childrenOf(value).length;\n\tconst unit = Array.isArray(value) ? (n === 1 ? \"item\" : \"items\") : n === 1 ? \"key\" : \"keys\";\n\treturn chalk.dim(Array.isArray(value) ? `[… ${n} ${unit}]` : `{… ${n} ${unit}}`);\n}\n\n/**\n * Paths of every container deeper than `depth` levels are left out, so those\n * render collapsed. `depth: 0` collapses the root; `Infinity` expands all.\n */\nexport function expandToDepth(value: unknown, depth: number): Set<Path> {\n\tconst out = new Set<Path>();\n\tconst walk = (v: unknown, path: Path, level: number): void => {\n\t\tif (!isContainer(v) || level >= depth) return;\n\t\tout.add(path);\n\t\tfor (const [k, child] of childrenOf(v)) walk(child, `${path}/${k}`, level + 1);\n\t};\n\twalk(value, \"\", 0);\n\treturn out;\n}\n\n/** Flatten `value` into the lines visible under `expanded`. Pure — no I/O. */\nexport function renderTree(value: unknown, { expanded }: RenderOptions): Line[] {\n\tconst lines: Line[] = [];\n\tconst walk = (v: unknown, path: Path, level: number, label: string, trailing: string): void => {\n\t\tconst indent = \" \".repeat(level);\n\t\tconst prefix = `${indent}${label}`;\n\t\tif (!isContainer(v)) {\n\t\t\tlines.push({ path, text: `${prefix}${scalar(v)}${trailing}`, foldable: false, expanded: false, level });\n\t\t\treturn;\n\t\t}\n\t\tconst kids = childrenOf(v);\n\t\tconst [open, close] = Array.isArray(v) ? [\"[\", \"]\"] : [\"{\", \"}\"];\n\t\tif (kids.length === 0) {\n\t\t\tlines.push({ path, text: `${prefix}${open}${close}${trailing}`, foldable: false, expanded: false, level });\n\t\t\treturn;\n\t\t}\n\t\tif (!expanded.has(path)) {\n\t\t\tlines.push({ path, text: `${prefix}${summary(v)}${trailing}`, foldable: true, expanded: false, level });\n\t\t\treturn;\n\t\t}\n\t\tlines.push({ path, text: `${prefix}${open}`, foldable: true, expanded: true, level });\n\t\tkids.forEach(([k, child], i) => {\n\t\t\tconst comma = i < kids.length - 1 ? \",\" : \"\";\n\t\t\tconst childLabel = Array.isArray(v) ? \"\" : `${chalk.cyan(JSON.stringify(k))}: `;\n\t\t\twalk(child, `${path}/${k}`, level + 1, childLabel, comma);\n\t\t});\n\t\tlines.push({\n\t\t\tpath: `${path}#close`,\n\t\t\ttext: `${indent}${close}${trailing}`,\n\t\t\tfoldable: false,\n\t\t\texpanded: false,\n\t\t\tlevel,\n\t\t});\n\t};\n\twalk(value, \"\", 0, \"\", \"\");\n\treturn lines;\n}\n\n/** Pure key reducer: `(state, key) -> state`. `rows` is the viewport height. */\nexport function reduceKey(state: ViewState, key: Key, value: unknown, rows: number): ViewState {\n\tconst lines = renderTree(value, { expanded: state.expanded });\n\tconst cur = lines[state.cursor];\n\tlet { cursor } = state;\n\tconst expanded = new Set(state.expanded);\n\tswitch (key) {\n\t\tcase \"up\":\n\t\t\tcursor = Math.max(0, cursor - 1);\n\t\t\tbreak;\n\t\tcase \"down\":\n\t\t\tcursor = Math.min(lines.length - 1, cursor + 1);\n\t\t\tbreak;\n\t\tcase \"right\":\n\t\t\tif (cur?.foldable) expanded.add(cur.path);\n\t\t\tbreak;\n\t\tcase \"left\":\n\t\t\tif (cur?.foldable && cur.expanded) expanded.delete(cur.path);\n\t\t\telse if (cur) {\n\t\t\t\tconst parent = lines.findLastIndex(\n\t\t\t\t\t(l, i) => i < cursor && l.foldable && l.expanded && l.level < cur.level\n\t\t\t\t);\n\t\t\t\tif (parent >= 0) cursor = parent;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"expandAll\":\n\t\t\treturn { cursor, top: state.top, expanded: expandToDepth(value, Infinity) };\n\t\tcase \"collapseAll\":\n\t\t\treturn { cursor: 0, top: 0, expanded: new Set() };\n\t\tcase \"quit\":\n\t\t\tbreak;\n\t}\n\tconst count = renderTree(value, { expanded }).length;\n\tcursor = Math.min(cursor, count - 1);\n\tlet top = state.top;\n\tif (cursor < top) top = cursor;\n\tif (cursor >= top + rows) top = cursor - rows + 1;\n\treturn { cursor, top: Math.max(0, top), expanded };\n}\n\nconst KEYMAP: Record<string, Key> = {\n\t\"\\u001b[A\": \"up\",\n\tk: \"up\",\n\t\"\\u001b[B\": \"down\",\n\tj: \"down\",\n\t\"\\u001b[C\": \"right\",\n\tl: \"right\",\n\t\"\\r\": \"right\",\n\t\" \": \"right\",\n\t\"\\u001b[D\": \"left\",\n\th: \"left\",\n\tE: \"expandAll\",\n\tC: \"collapseAll\",\n\tq: \"quit\",\n\t\"\\u001b\": \"quit\",\n\t\"\\u0003\": \"quit\",\n};\n\nfunction draw(out: NodeJS.WriteStream, value: unknown, state: ViewState, rows: number): void {\n\tconst lines = renderTree(value, { expanded: state.expanded });\n\tconst view = lines.slice(state.top, state.top + rows).map((l, i) => {\n\t\tconst marker = l.foldable ? (l.expanded ? \"▾ \" : \"▸ \") : \" \";\n\t\tconst row = `${marker}${l.text}`;\n\t\treturn state.top + i === state.cursor ? chalk.inverse(row) : row;\n\t});\n\tconst footer = chalk.dim(`${state.cursor + 1}/${lines.length} ↑↓ move →/⏎ expand ← collapse E/C all q quit`);\n\tout.write(`\\u001b[H\\u001b[J${view.join(\"\\n\")}\\n${footer}`);\n}\n\nasync function runInteractive(value: unknown, depth: number): Promise<void> {\n\tconst { stdin, stdout } = process;\n\tif (!stdin.isTTY || !stdout.isTTY) {\n\t\tthrow new NonInteractiveError(\"--interactive needs a TTY on stdin and stdout.\");\n\t}\n\tconst rows = (): number => Math.max(3, (stdout.rows ?? 24) - 1);\n\tlet state: ViewState = { cursor: 0, top: 0, expanded: expandToDepth(value, depth) };\n\tconst wasRaw = stdin.isRaw;\n\tstdin.setRawMode(true);\n\tstdin.resume();\n\tstdout.write(\"\\u001b[?1049h\\u001b[?25l\");\n\tconst redraw = (): void => draw(stdout, value, state, rows());\n\tstdout.on(\"resize\", redraw);\n\ttry {\n\t\tredraw();\n\t\tawait new Promise<void>((resolve) => {\n\t\t\tconst onData = (buf: Buffer): void => {\n\t\t\t\tconst key = KEYMAP[buf.toString()];\n\t\t\t\tif (key === \"quit\") {\n\t\t\t\t\tstdin.off(\"data\", onData);\n\t\t\t\t\tresolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (key) {\n\t\t\t\t\tstate = reduceKey(state, key, value, rows());\n\t\t\t\t\tredraw();\n\t\t\t\t}\n\t\t\t};\n\t\t\tstdin.on(\"data\", onData);\n\t\t});\n\t} finally {\n\t\tstdout.off(\"resize\", redraw);\n\t\tstdout.write(\"\\u001b[?25h\\u001b[?1049l\");\n\t\tstdin.setRawMode(wasRaw);\n\t\tstdin.pause();\n\t}\n}\n\n/**\n * Print `value` as JSON. Non-TTY stdout always gets plain, valid\n * `JSON.stringify` output (so `| jq` and redirects keep working); a TTY gets a\n * coloured tree, collapsed past `depth`. `interactive` opens a folding viewer (the default on a TTY).\n */\nexport async function viewJson(value: unknown, options: ViewJsonOptions = {}): Promise<void> {\n\tconst depth = options.depth ?? Infinity;\n\tconst interactive =\n\t\toptions.interactive ?? (options.depth === undefined && Boolean(process.stdin.isTTY && process.stdout.isTTY));\n\tif (interactive) return runInteractive(value, options.depth ?? 1);\n\tif (!process.stdout.isTTY) {\n\t\tconsole.log(JSON.stringify(value, null, 2));\n\t\treturn;\n\t}\n\tconst lines = renderTree(value, { expanded: expandToDepth(value, depth) });\n\tconsole.log(lines.map((l) => l.text).join(\"\\n\"));\n}\n","import search from \"@inquirer/search\";\n\nimport type { MenuItem } from \"./menu.type.js\";\n\n/**\n * Searchable autocomplete over one menu level's `items`. `select()` would work too\n * at these list sizes, but `search()` degrades gracefully as the surface grows and\n * costs nothing when it doesn't. Resolves to the picked item's `value`.\n */\nexport async function pickMenuItem(items: MenuItem[], message = \"What would you like to do?\"): Promise<string> {\n\treturn search<string>({\n\t\tmessage,\n\t\tsource: (term) => searchChoices(items, term),\n\t});\n}\n\n/**\n * `@inquirer/search`'s `source` callback, factored out as a plain function —\n * unit-testable directly instead of only through a mocked `search()` call.\n * Empty/undefined `term` (nothing typed yet) returns every item.\n */\nexport function searchChoices(\n\titems: MenuItem[],\n\tterm: string | undefined\n): Array<{ name: string; value: string; description: string }> {\n\tconst needle = term?.toLowerCase();\n\tconst pool = !needle ? items : items.filter((i) => i.haystack.includes(needle));\n\t// Name-prefix hits, then other name hits, then description-only hits (stable, so\n\t// registry order holds within each bucket): typing `repo` should land on the `repo`\n\t// group, not on `clone` whose description says \"repo\", and `up` on `upgrade`, not `setup`.\n\tconst rank = (i: MenuItem): number => {\n\t\tif (!needle) return 0;\n\t\tconst name = i.name.toLowerCase();\n\t\treturn name.startsWith(needle) ? 0 : name.includes(needle) ? 1 : 2;\n\t};\n\treturn [...pool]\n\t\t.sort((a, b) => rank(a) - rank(b))\n\t\t.map((i) => ({ name: i.name, value: i.value, description: i.description }));\n}\n","import { spawn } from \"node:child_process\";\n\n/** Platform-appropriate command to open a path in the OS's file browser. */\nfunction openCommand(path: string): { cmd: string; args: string[] } {\n\tif (process.platform === \"darwin\") return { cmd: \"open\", args: [path] };\n\tif (process.platform === \"win32\") return { cmd: \"cmd\", args: [\"/c\", \"start\", \"\", path] };\n\treturn { cmd: \"xdg-open\", args: [path] };\n}\n\n/**\n * Open `path` in the OS's default file browser (Finder / Explorer /\n * whatever `xdg-open` resolves to on Linux). Fire-and-forget — detached so\n * it outlives this process, and never throws when the opener binary isn't\n * on PATH (e.g. no `xdg-open` in a minimal container).\n */\nexport function openPath(path: string): void {\n\tconst { cmd, args } = openCommand(path);\n\tconst child = spawn(cmd, args, { stdio: \"ignore\", detached: true });\n\tchild.on(\"error\", () => {});\n\tchild.unref();\n}\n","import ora from \"ora\";\n\n/**\n * Runs `fn`, showing an ora spinner for its duration in TTY environments.\n * In non-TTY environments (CI, pipes, tests) the spinner is skipped entirely.\n */\nexport async function withSpinner<T>(label: string, fn: () => Promise<T>): Promise<T> {\n\tif (!process.stdout.isTTY) {\n\t\treturn fn();\n\t}\n\tconst spinner = ora(label).start();\n\ttry {\n\t\tconst result = await fn();\n\t\tspinner.succeed();\n\t\treturn result;\n\t} catch (err) {\n\t\tspinner.fail();\n\t\tthrow err;\n\t}\n}\n","import { input, select } from \"@inquirer/prompts\";\n\nimport { NonInteractiveError } from \"../non-interactive-error/index.js\";\nimport type { PositionalCommand } from \"./prompt-positionals.type.js\";\n\n/**\n * For each of `entry.positionals` not already present in `argv`, prompts for\n * it (`input()` or `select()`, per the positional's `type`) and returns the\n * resolved values in positional order — ready to append to a spawned child's\n * argv, or to use directly in the current handler (Layer 3).\n *\n * Throws {@link NonInteractiveError} the first time it would need to prompt\n * on a non-TTY stdin, and again if a `select` positional's choices resolve\n * empty (nothing to pick from — e.g. `auth unset` with no stored tokens).\n */\nexport async function promptForPositionals(entry: PositionalCommand, argv: Record<string, unknown>): Promise<string[]> {\n\tconst out: string[] = [];\n\tfor (const positional of entry.positionals) {\n\t\tconst existing = argv[positional.key];\n\t\tif (existing !== undefined && existing !== \"\") {\n\t\t\tout.push(String(existing));\n\t\t\tcontinue;\n\t\t}\n\t\tif (!process.stdin.isTTY) {\n\t\t\tthrow new NonInteractiveError(\n\t\t\t\t`\\`${entry.name}\\` needs \"${positional.key}\" — pass it directly: holocron ${entry.name} <${positional.cliArg ?? positional.key}>`\n\t\t\t);\n\t\t}\n\t\tif (positional.type === \"select\") {\n\t\t\tconst choices =\n\t\t\t\ttypeof positional.choices === \"function\" ? positional.choices() : (positional.choices ?? []);\n\t\t\tif (choices.length === 0) {\n\t\t\t\tthrow new NonInteractiveError(\n\t\t\t\t\t`\\`${entry.name}\\`: no ${positional.key} to choose from — nothing stored yet`\n\t\t\t\t);\n\t\t\t}\n\t\t\tout.push(await select({ message: positional.message, choices: choices.map((c) => ({ value: c })) }));\n\t\t} else {\n\t\t\tout.push(\n\t\t\t\tawait input({\n\t\t\t\t\tmessage: positional.message,\n\t\t\t\t\t...(positional.validate ? { validate: positional.validate } : {}),\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}\n\treturn out;\n}\n","import chalk from \"chalk\";\n\nexport const style = {\n\tsuccess: (msg: string) => `${chalk.green(\"✓\")} ${msg}`,\n\twarn: (msg: string) => `${chalk.yellow(\"⚠\")} ${msg}`,\n\tfail: (msg: string) => `${chalk.red(\"✗\")} ${msg}`,\n\tstep: (msg: string) => `${chalk.cyan(\"→\")} ${msg}`,\n\t/** A dim `·` marker for a row that's neither a pass nor a failure — loaded but inactive, or skipped. */\n\tskip: (msg: string) => chalk.dim(`· ${msg}`),\n\thint: (msg: string) => chalk.dim(msg),\n\tdim: (msg: string) => chalk.dim(msg),\n\theader: (msg: string) => chalk.bold(msg),\n};\n","import { style } from \"../style/index.js\";\nimport type { RowStatus } from \"./status-row.type.js\";\n\n/** Right-pads `s` to `width` with spaces — never truncates. */\nexport function pad(s: string, width: number): string {\n\treturn s.length >= width ? s : s + \" \".repeat(width - s.length);\n}\n\n/**\n * One row of a status report: a 2-space indent, the status icon (✓ / ✗ / ·),\n * then `columns` joined with a two-space gap (blank columns dropped, so a\n * row that has nothing for its last column doesn't trail whitespace).\n * Column padding (`pad`) is the caller's job — `doctor` pads capability and\n * provider to a fixed width; `clone`'s repo names and paths don't, since\n * they vary too widely for fixed-width alignment to read cleanly.\n *\n * Shared by `doctor` (capability / provider / message) and `clone` (repo /\n * destination / reason) so every status table in the CLI reads the same way.\n */\nexport function statusRow(status: RowStatus, columns: string[]): string {\n\tconst joined = columns.filter((c) => c.length > 0).join(\" \");\n\tconst styled =\n\t\tstatus === \"ok\" ? style.success(joined) : status === \"fail\" ? style.fail(joined) : style.skip(joined);\n\treturn ` ${styled}`;\n}\n","/**\n * CLI-side wiring for `@theholocron/observability/logger`.\n *\n * `logger` is the operational-output channel — internal state, debug\n * traces, errors, structured context that routes to Axiom. It runs in\n * parallel to `print` (user-facing UX output) and does not replace it.\n */\n\nimport type { Logger, LogLevel } from \"@theholocron/observability/core\";\nimport {\n\ttype AxiomTransportConfig,\n\tcreateLogger,\n\tisCI,\n\tparseLogLevel,\n\tresolveAxiomFromEnv,\n} from \"@theholocron/observability/logger\";\n\nimport { getToken } from \"../../auth/index.js\";\nimport { contextForCommand } from \"../../commands/contexts/index.js\";\nimport { env, holocronEnv } from \"../../env/index.js\";\nimport { style } from \"../../ui/index.js\";\nimport type { BuildCliLoggerOpts } from \"./logger.type.js\";\n\n/**\n * Dataset for `global`-context commands (`clone`, `auth set`, `upgrade\n * node`, …) — ADR-0012. These commands aren't \"about\" any repo, so their\n * logs must never depend on `$PWD` or which repo's `.envrc` happens to be\n * active; they always ship to holocron's own dataset instead of whatever\n * `HOLOCRON_AXIOM_DATASET` resolves to locally. Mirrors\n * `resolve-telemetry.ts`'s `FALLBACK_DSN` — a holocron-owned default, not a\n * per-repo override.\n */\nexport const GLOBAL_AXIOM_DATASET = \"holocron-global\";\n\n/**\n * Resolve the explicit level to hand to `createLogger`, in priority order:\n *\n * 1. `--log <level>` 2. `--verbose` → `\"debug\"` 3. `--quiet` → `\"error\"`\n * 4. `HOLOCRON_LOG_LEVEL` env var\n * 5. `holocron.config` `log.level` (`configLevel`)\n *\n * Returns `undefined` when nothing applies — `createLogger` then defaults\n * to `\"info\"`. Resolving the full chain here (rather than passing\n * `configLevel` straight through) keeps config below the env var.\n */\nexport function resolveLogLevel(\n\targv: { verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\tconfigLevel?: LogLevel\n): LogLevel | undefined {\n\tif (argv.log) return argv.log;\n\tif (argv.verbose) return \"debug\";\n\tif (argv.quiet) return \"error\";\n\treturn parseLogLevel(env.get(\"HOLOCRON_LOG_LEVEL\")) ?? configLevel;\n}\n\n/**\n * Resolve whether human-visible console output (pretty or NDJSON) should run\n * at all, independent of level — the `@theholocron/observability`\n * `consoleOutput` override.\n *\n * Local/interactive runs are quiet by default: any raw structured logger\n * output (colorized or not) stays off regardless of the resolved level,\n * unless the user explicitly asked to see it via `--log <level>`,\n * `--verbose`, or `--quiet`. CI is untouched either way — returning\n * `undefined` there preserves `createLogger`'s own `ci`/`tty`\n * auto-detection exactly, so CI's existing NDJSON-to-stdout behavior is\n * unaffected by this flag.\n */\nexport function resolveConsoleOutput(argv: {\n\tverbose?: boolean;\n\tquiet?: boolean;\n\tlog?: LogLevel;\n}): boolean | undefined {\n\tif (argv.log || argv.verbose || argv.quiet) return true;\n\treturn isCI() ? undefined : false;\n}\n\nlet root: { logger: Logger; runId: string } | undefined;\nlet rootLevel: LogLevel | undefined;\nlet rootCommand: string | undefined;\nlet rootAxiomKey: string | undefined;\n\n/**\n * Resolve Axiom credentials for the CLI.\n *\n * A `global`-context command (ADR-0012) always resolves to\n * {@link GLOBAL_AXIOM_DATASET}, ignoring `HOLOCRON_AXIOM_DATASET` /\n * `AXIOM_DATASET` / `holocron.config` `log.axiom.dataset` entirely — it\n * isn't \"about\" any repo, so the active directory's dataset is never the\n * right answer. Everything else keeps the existing chain: env vars win\n * (same contract as `@theholocron/observability`'s `resolveAxiomFromEnv`),\n * falling back to the CLI-only bridge that pairs the OS-keyring token\n * (`axiom.<org>` then bare `axiom`) with a dataset from\n * `HOLOCRON_AXIOM_DATASET` / `AXIOM_DATASET` or `log.axiom.dataset`.\n * Returns `undefined` unless both a token and a dataset are found.\n */\nfunction resolveCliAxiom(opts: BuildCliLoggerOpts): AxiomTransportConfig | undefined {\n\tconst isGlobal = contextForCommand(opts.command ?? rootCommand ?? \"\") === \"global\";\n\n\tif (!isGlobal) {\n\t\tconst fromEnv = resolveAxiomFromEnv();\n\t\tif (fromEnv) return fromEnv;\n\t}\n\n\tconst dataset = isGlobal ? GLOBAL_AXIOM_DATASET : (holocronEnv.get(\"AXIOM_DATASET\") ?? opts.configAxiomDataset);\n\tif (!dataset) return undefined;\n\n\tconst org = opts.org ?? env.get(\"HOLOCRON_ORG\");\n\tconst token = holocronEnv.get(\"AXIOM_TOKEN\") || (org ? getToken(`axiom.${org}`) : null) || getToken(\"axiom\");\n\treturn token ? { dataset, token } : undefined;\n}\n\n/**\n * The process-wide root logger. Built once (from `cli.ts`'s middleware,\n * with the command name + flags + env). Rebuilt at most once more when a\n * command's handler supplies `holocron.config` context the flag/env-only\n * first pass could not have known — `log.level` (unless `--verbose` /\n * `--quiet` already fixed it) or `log.axiom.dataset` + the resolved org\n * for a keyring-backed Axiom transport. That rebuild generates a fresh\n * `runId`, which is harmless: nothing logs between the middleware and the\n * handler.\n */\nexport function buildCliLogger(\n\targv: { verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\topts: BuildCliLoggerOpts = {}\n): { logger: Logger; runId: string } {\n\tconst { command, configLevel } = opts;\n\tif (command) rootCommand = command;\n\tconst level = resolveLogLevel(argv, configLevel);\n\tconst consoleOutput = resolveConsoleOutput(argv);\n\tconst axiom = resolveCliAxiom(opts);\n\tconst axiomKey = axiom?.dataset;\n\tconst rebuildForConfig =\n\t\tconfigLevel !== undefined && level !== rootLevel && !argv.verbose && !argv.quiet && !argv.log;\n\tconst rebuildForAxiom = axiomKey !== undefined && axiomKey !== rootAxiomKey;\n\tif (!root || rebuildForConfig || rebuildForAxiom) {\n\t\tconst built = createLogger({\n\t\t\t...(level ? { level } : {}),\n\t\t\t...(axiom ? { axiom } : {}),\n\t\t\t...(consoleOutput !== undefined ? { consoleOutput } : {}),\n\t\t});\n\t\troot = {\n\t\t\tlogger: rootCommand ? built.logger.child({ command: rootCommand }) : built.logger,\n\t\t\trunId: built.runId,\n\t\t};\n\t\trootLevel = level;\n\t\trootAxiomKey = axiomKey;\n\t}\n\treturn root;\n}\n\n/**\n * Lazily-memoized `Logger` for module-level call sites with no `argv` in\n * scope — notably yargs' own `.fail()` handler, which fires on a\n * pre-middleware validation failure (a missing required argument, an\n * unknown command) and therefore runs before `buildCliLogger` has ever\n * built the real root. Without an explicit `consoleOutput` here, that\n * fallback would use `createLogger`'s bare auto-detection (pretty on any\n * local TTY) and leak a structured block even though no flag asked for one\n * — so it resolves the same \"quiet unless CI\" default `buildCliLogger`\n * would, as if no flags were passed.\n */\nexport function getLogger(): Logger {\n\treturn (root ??= createLogger({ consoleOutput: resolveConsoleOutput({}) })).logger;\n}\n\n/**\n * Report a fatal, command-ending CLI error: always printed to the console\n * (regardless of `consoleOutput` suppression) via `style.fail`, and also\n * sent through the structured logger for Axiom/telemetry visibility.\n *\n * Use this when a handler is returning or exiting right here with nothing\n * else for the user to see — a resolved `--token` failure, a yargs\n * validation failure, a thrown domain error. Don't use it for a per-step\n * warning inside a multi-step orchestrator that already prints its own\n * `ok / fail / skip` summary — that summary is the user-facing signal;\n * the per-step reason belongs in the structured log alone.\n */\nexport function reportError(message: string, log: Logger = getLogger()): void {\n\tconsole.error(style.fail(message));\n\tlog.error(message);\n}\n\n/** The current root logger's correlation id, if a root has been built. */\nexport function getRunId(): string | undefined {\n\treturn root?.runId;\n}\n\n/** Test hook — drop the memoized root so the next call rebuilds it. */\nexport function resetCliLogger(): void {\n\troot = undefined;\n\trootLevel = undefined;\n\trootCommand = undefined;\n\trootAxiomKey = undefined;\n}\n","/**\n * `PluginLoader` — loads provider plugins per the resolved config and\n * builds a typed capability registry the runtime can query.\n *\n * Flow:\n * 1. Walk `config.providers[*]` from `resolveConfig()`\n * 2. For each entry, dynamic-import the resolved package name\n * (`@theholocron/holocron-plugin-<provider>` by default)\n * 3. Call the package's exported `createPlugin(options)` to get a\n * plugin object whose `capabilities` map holds factories\n * 4. Invoke the matching capability factory and stash the impl in\n * the registry — single-cardinality entries hold one impl,\n * many-cardinality entries hold an array\n *\n * A package may instead export a capability config (see\n * `CapabilityConfigPackage` in config.ts). The loader detects the shape\n * at import time and re-resolves to the underlying plugin, merging the\n * preset options with any per-project overrides from the config file\n * (project options win, mirroring ESLint's `extends` precedence).\n *\n * Loader keeps NO knowledge of vendor tokens. Each plugin reads its\n * own env vars (`HOLOCRON_ADMIN_TOKEN`, `HOLOCRON_VERCEL_TOKEN`, etc.)\n * inside its `createPlugin`. That keeps the loader vendor-agnostic\n * and the auth story per-plugin explicit.\n *\n * `importer` is injectable so tests don't need real network or\n * sibling packages installed.\n */\n\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport {\n\ttype CapabilityConfigPackage,\n\ttype ResolvedHolocronConfig,\n\ttype ResolvedTuple,\n\tresolvePluginPackage,\n} from \"../../config/config/index.js\";\nimport {\n\ttype CapabilityKey,\n\tCARDINALITY,\n\ttype CardinalityFor,\n\ttype ResolvedCapability,\n} from \"../capabilities/index.js\";\nimport type { PluginImporter, PluginLoadFailure, PluginModule, RuntimeContext } from \"./loader.type.js\";\n\nexport class LoaderError extends Error {\n\toverride name = \"LoaderError\";\n}\n\nexport class PluginLoader {\n\tprivate readonly registry = new Map<CapabilityKey, unknown>();\n\tprivate readonly failures: PluginLoadFailure[] = [];\n\n\tconstructor(\n\t\tprivate readonly config: ResolvedHolocronConfig,\n\t\tprivate readonly context: RuntimeContext,\n\t\tprivate readonly importer: PluginImporter = defaultImporter\n\t) {}\n\n\t/**\n\t * Imports every configured plugin and builds the capability registry.\n\t *\n\t * Never throws for a single plugin's failure — a missing vendor token,\n\t * an uninstalled package, or an unimplemented capability records a\n\t * {@link PluginLoadFailure} and the load continues. This is the\n\t * \"soft-skip over hard-fail\" contract: a command that needs a\n\t * capability learns it is absent via `has()` / `get()` (which\n\t * re-surfaces the original error), and orchestrators report the skip\n\t * in their summary. Inspect {@link loadFailures} for the full list.\n\t */\n\tasync load(): Promise<void> {\n\t\tconst entries = Object.entries(this.config.providers) as Array<\n\t\t\t[CapabilityKey, ResolvedHolocronConfig[\"providers\"][CapabilityKey]]\n\t\t>;\n\n\t\tfor (const [key, entry] of entries) {\n\t\t\tif (!entry) continue;\n\t\t\tif (entry.cardinality === \"single\") {\n\t\t\t\ttry {\n\t\t\t\t\tthis.registry.set(key, await this.loadOne(key, entry.tuple));\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthis.recordFailure(key, entry.tuple, err);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst impls: unknown[] = [];\n\t\t\t\tfor (const tuple of entry.tuples) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\timpls.push(await this.loadOne(key, tuple));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tthis.recordFailure(key, tuple, err);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (impls.length > 0) this.registry.set(key, impls);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate recordFailure(key: CapabilityKey, tuple: ResolvedTuple, err: unknown): void {\n\t\tthis.failures.push({\n\t\t\tkey,\n\t\t\tprovider: tuple.provider,\n\t\t\tpackageName: tuple.packageName,\n\t\t\terror: err instanceof Error ? err : new Error(String(err)),\n\t\t});\n\t}\n\n\t/** Providers that failed to load during {@link load}. Empty on a clean load. */\n\tloadFailures(): readonly PluginLoadFailure[] {\n\t\treturn this.failures;\n\t}\n\n\t/**\n\t * Type-safe lookup. Single-cardinality keys return one impl;\n\t * many-cardinality keys return an array. `ResolvedCapability<K>`\n\t * encodes the split via the `CARDINALITY` map.\n\t */\n\tget<K extends CapabilityKey>(key: K): ResolvedCapability<K> {\n\t\tconst impl = this.registry.get(key);\n\t\tif (impl === undefined) {\n\t\t\t// If the plugin was configured but failed to load, re-surface the\n\t\t\t// original error (e.g. `AuthError: no Vercel token found`) rather\n\t\t\t// than a generic \"not loaded\" — single-capability commands then\n\t\t\t// give the operator an actionable message.\n\t\t\tconst failure = this.failures.find((f) => f.key === key);\n\t\t\tif (failure) throw failure.error;\n\t\t\tthrow new LoaderError(`capability \\`${key}\\` is not loaded — is it declared in holocron.config.json?`);\n\t\t}\n\t\treturn impl as ResolvedCapability<K>;\n\t}\n\n\t/** Whether a capability has been loaded. */\n\thas<K extends CapabilityKey>(key: K): boolean {\n\t\treturn this.registry.has(key);\n\t}\n\n\t/** All capability keys currently loaded. Useful for the doctor command. */\n\tloadedKeys(): CapabilityKey[] {\n\t\treturn Array.from(this.registry.keys());\n\t}\n\n\t/** Internal — invoke a plugin's capability factory and return the impl. */\n\tprivate async loadOne(key: CapabilityKey, tuple: ResolvedTuple): Promise<unknown> {\n\t\tconst mod = await this.importer(tuple.packageName).catch((err: unknown) => {\n\t\t\tthrow new LoaderError(\n\t\t\t\t`failed to import \\`${tuple.packageName}\\` for capability \\`${key}\\`: ${errorMessage(err)}`\n\t\t\t);\n\t\t});\n\n\t\t// Plugin package: exports createPlugin(opts) → { capabilities }\n\t\tif (isPluginModule(mod)) {\n\t\t\t// Resolve the effective token for this specific plugin.\n\t\t\t// cliTokens[provider] wins over the bare cliToken fallback.\n\t\t\tconst effectiveToken = this.context.cliTokens?.[tuple.provider] ?? this.context.cliToken;\n\n\t\t\t// Precedence (later wins): project-level defaults from config →\n\t\t\t// runtime context (CLI flags: --repo, --token) → per-plugin\n\t\t\t// resolved token → tuple options (per-plugin overrides in config).\n\t\t\t// cliTokens is explicitly cleared so the map never reaches plugins.\n\t\t\tconst plugin = mod.createPlugin({\n\t\t\t\t...this.projectDefaults(),\n\t\t\t\t...this.context,\n\t\t\t\t...(effectiveToken !== undefined ? { cliToken: effectiveToken } : {}),\n\t\t\t\tcliTokens: undefined,\n\t\t\t\t...tuple.options,\n\t\t\t});\n\t\t\tconst factory = plugin.capabilities[key];\n\t\t\tif (typeof factory !== \"function\") {\n\t\t\t\tthrow new LoaderError(`\\`${tuple.packageName}\\` does not implement the \\`${key}\\` capability`);\n\t\t\t}\n\t\t\treturn factory();\n\t\t}\n\n\t\t// Capability config package: default export is { provider, options? }.\n\t\t// Re-resolve to the underlying plugin; preset options are the base,\n\t\t// per-project tuple options override them (ESLint extends precedence).\n\t\tif (isCapabilityConfigModule(mod)) {\n\t\t\tconst cap = (mod as { default: CapabilityConfigPackage }).default;\n\t\t\treturn this.loadOne(key, {\n\t\t\t\tprovider: cap.provider,\n\t\t\t\tpackageName: resolvePluginPackage(cap.provider),\n\t\t\t\toptions: { ...cap.options, ...tuple.options },\n\t\t\t});\n\t\t}\n\n\t\tthrow new LoaderError(\n\t\t\t`\\`${tuple.packageName}\\` does not export \\`createPlugin(options)\\` or a capability config ({ provider, options? })`\n\t\t);\n\t}\n\n\t/**\n\t * Project-level defaults that get merged into every plugin's options\n\t * unless overridden by the CLI context or per-plugin tuple options.\n\t * See `docs/wiki/specifications/tech-setup-and-config.spec.md` §Design.\n\t */\n\tprivate projectDefaults(): Partial<RuntimeContext> {\n\t\tconst defaults: Partial<RuntimeContext> = {};\n\t\tif (this.config.repo?.name) defaults.repo = this.config.repo.name;\n\t\treturn defaults;\n\t}\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\n/** Default importer — resolves from cwd first so the global CLI finds project plugins. */\nconst defaultImporter: PluginImporter = async (pkg) => {\n\ttry {\n\t\tconst localRequire = createRequire(process.cwd() + \"/\");\n\t\tconst resolved = localRequire.resolve(pkg);\n\t\treturn import(pathToFileURL(resolved).href);\n\t} catch {\n\t\treturn import(pkg);\n\t}\n};\n\nfunction isPluginModule(mod: unknown): mod is PluginModule {\n\treturn typeof (mod as PluginModule).createPlugin === \"function\";\n}\n\nfunction isCapabilityConfigModule(mod: unknown): mod is { default: CapabilityConfigPackage } {\n\tconst def = (mod as { default?: unknown }).default;\n\treturn typeof (def as CapabilityConfigPackage)?.provider === \"string\";\n}\n\n/** Convenience re-export so callers can compute counts without importing CARDINALITY directly. */\nexport function cardinalityOf<K extends CapabilityKey>(key: K): CardinalityFor<K> {\n\treturn CARDINALITY[key];\n}\n","/**\n * Runs a `MonitoringCheckInput` directly over HTTP, with no vendor API\n * call at all — the local counterpart to a provider's `ensureCheck()`.\n *\n * Exists for `holocron monitoring check <url>` (holocron#1010): testing\n * a PR's Vercel preview deployment against the exact same check\n * definitions already configured for production in `holocron.config.ts`,\n * without creating a persistent resource on the vendor's platform for an\n * ephemeral, per-PR run.\n *\n * No comparison logic exists anywhere else in this codebase to reuse —\n * Checkly's own API evaluates `assertions` server-side, so this is a\n * fresh implementation of the same vendor-neutral vocabulary\n * (`MonitoringAssertionSource`/`MonitoringAssertionComparison`) `src/\n * plugin/capabilities.ts` already defines. The `shouldFail` semantics\n * mirror Checkly's documented platform behavior (ADR-0013): a response\n * status >= 400 is an automatic failure unless the check's own healthy\n * response is itself an error status.\n *\n * Hardening, all driven by this running against a URL the triggering\n * event controls (a PR's preview deployment), not a trusted static\n * config value (sourcery review on holocron#1011):\n * - `redirect: \"manual\"` — a check never follows a redirect to\n * whatever host the response names. The 3xx itself is what gets\n * evaluated; that's also more correct for a monitoring check\n * anyway (silently following would hide a real regression).\n * - A request deadline (`AbortSignal.timeout`) — a preview that\n * accepts the request but never finishes can't hang the check (or\n * the ones after it) past the timeout.\n * - The body is only read when an assertion actually needs it, and\n * even then capped at `maxBodyBytes` — an attacker-reachable\n * endpoint can't use an unbounded response to exhaust the runner.\n */\n\nimport type {\n\tMonitoringAssertion,\n\tMonitoringAssertionComparison,\n\tMonitoringCheckInput,\n} from \"../capabilities/index.js\";\nimport type { CheckRunResult, RunCheckOptions } from \"./run-check.type.js\";\n\nexport async function runCheckAgainstUrl(\n\tinput: MonitoringCheckInput,\n\topts: RunCheckOptions = {}\n): Promise<CheckRunResult> {\n\tconst doFetch = opts.fetch ?? fetch;\n\tconst url = resolveUrl(input.url, opts.url);\n\tconst method = input.method ?? \"GET\";\n\t// GET/HEAD with a body throws a TypeError at the Fetch layer — the\n\t// config type permits the combination, but neither method has body\n\t// semantics, so the body is simply not meaningful to send for them.\n\tconst hasBody = input.body !== undefined && method !== \"GET\" && method !== \"HEAD\";\n\tconst needsBody = (input.assertions ?? []).some((a) => a.source === \"body\");\n\tconst start = Date.now();\n\n\tlet response: Response;\n\tlet bodyText = \"\";\n\ttry {\n\t\tresponse = await doFetch(url, {\n\t\t\tmethod,\n\t\t\t...(hasBody ? { body: input.body } : {}),\n\t\t\tredirect: \"manual\",\n\t\t\tsignal: AbortSignal.timeout(opts.timeoutMs ?? 10_000),\n\t\t});\n\t\tif (needsBody) bodyText = await readBodyCapped(response, opts.maxBodyBytes ?? 1_000_000);\n\t} catch (err) {\n\t\treturn { passed: false, failures: [], requestError: requestErrorMessage(err) };\n\t}\n\tconst responseTimeMs = Date.now() - start;\n\n\tconst failures: string[] = [];\n\n\t// Mirrors Checkly's own platform-level classification (ADR-0013): a\n\t// >=400 response is a failure before any assertion runs, unless the\n\t// check's own healthy response IS an error status.\n\tif (!input.shouldFail && response.status >= 400) {\n\t\tfailures.push(`HTTP ${response.status} (>= 400 counts as a failure unless \\`shouldFail\\` is set)`);\n\t}\n\n\tfor (const assertion of input.assertions ?? []) {\n\t\tconst actual = extractActual(assertion, { response, bodyText, responseTimeMs });\n\t\tif (!evaluate(assertion.comparison, actual, assertion.target)) {\n\t\t\tfailures.push(\n\t\t\t\t`${assertion.source} ${assertion.comparison} \"${assertion.target ?? \"\"}\" — got \"${truncate(actual)}\"`\n\t\t\t);\n\t\t}\n\t}\n\n\treturn { passed: failures.length === 0, status: response.status, responseTimeMs, failures };\n}\n\n/** Swaps in `overrideUrl`'s origin, keeping `originalUrl`'s own path + query. */\nfunction resolveUrl(originalUrl: string, overrideUrl: string | undefined): string {\n\tif (!overrideUrl) return originalUrl;\n\tconst original = new URL(originalUrl);\n\tconst resolved = new URL(overrideUrl);\n\tresolved.pathname = original.pathname;\n\tresolved.search = original.search;\n\treturn resolved.toString();\n}\n\nfunction requestErrorMessage(err: unknown): string {\n\tif (err instanceof Error) {\n\t\treturn err.name === \"TimeoutError\" ? `request timed out: ${err.message}` : err.message;\n\t}\n\treturn String(err);\n}\n\n/** Reads up to `maxBytes` of the response body, discarding the rest — a large/unending body can't exhaust memory. */\nasync function readBodyCapped(response: Response, maxBytes: number): Promise<string> {\n\tif (!response.body) return \"\";\n\tconst reader = response.body.getReader();\n\tconst chunks: Uint8Array[] = [];\n\tlet total = 0;\n\ttry {\n\t\tfor (;;) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tconst remaining = maxBytes - total;\n\t\t\tif (remaining <= 0) break;\n\t\t\tconst stored = value.length > remaining ? value.slice(0, remaining) : value;\n\t\t\tchunks.push(stored);\n\t\t\ttotal += stored.length;\n\t\t}\n\t} finally {\n\t\tawait reader.cancel().catch(() => {});\n\t}\n\treturn Buffer.concat(chunks.map((c) => Buffer.from(c))).toString(\"utf8\");\n}\n\n/** Keeps a failure message readable when `actual` is a full HTML/JSON response body. */\nfunction truncate(value: string, max = 200): string {\n\treturn value.length > max ? `${value.slice(0, max)}…` : value;\n}\n\nfunction extractActual(\n\tassertion: MonitoringAssertion,\n\tctx: { response: Response; bodyText: string; responseTimeMs: number }\n): string {\n\tswitch (assertion.source) {\n\t\tcase \"status_code\":\n\t\t\treturn String(ctx.response.status);\n\t\tcase \"response_time\":\n\t\t\treturn String(ctx.responseTimeMs);\n\t\tcase \"body\":\n\t\t\treturn ctx.bodyText;\n\t\tcase \"header\": {\n\t\t\t// Headers.get(\"\") throws (empty string is an invalid header\n\t\t\t// name per the Fetch spec) — short-circuit before calling it.\n\t\t\tconst name = assertion.property ?? \"\";\n\t\t\treturn name ? (ctx.response.headers.get(name) ?? \"\") : \"\";\n\t\t}\n\t}\n}\n\nfunction evaluate(comparison: MonitoringAssertionComparison, actual: string, target: string | undefined): boolean {\n\tconst t = target ?? \"\";\n\tswitch (comparison) {\n\t\tcase \"equals\":\n\t\t\treturn actual === t;\n\t\tcase \"not_equals\":\n\t\t\treturn actual !== t;\n\t\tcase \"contains\":\n\t\t\treturn actual.includes(t);\n\t\tcase \"not_contains\":\n\t\t\treturn !actual.includes(t);\n\t\tcase \"greater_than\":\n\t\t\treturn Number(actual) > Number(t);\n\t\tcase \"less_than\":\n\t\t\treturn Number(actual) < Number(t);\n\t}\n}\n","/**\n * The `workspace`-context guard.\n *\n * A `workspace` command (`sync`, `setup`, `doctor`, …) needs the\n * configured providers' `@theholocron/holocron-plugin-*` packages to\n * resolve. From a bare `npm i -g @theholocron/cli` they don't, and the\n * {@link PluginLoader} — which soft-skips every failure — leaves the\n * command with an empty registry and a stack of `Cannot find package`\n * errors.\n *\n * {@link assertPluginsResolvable} turns that specific situation (every\n * provider failed, and every failure is a module-resolution failure)\n * into one actionable {@link WorkspaceContextError} the CLI prints\n * instead of a stack trace. Any other mix — some plugins loaded, or a\n * failure that's an auth/token error rather than a missing package —\n * is left alone for the command's own soft-skip reporting.\n *\n * Spec: `docs/wiki/specifications/tech-cli-execution-contexts.spec.md`\n * (theholocron/holocron#576).\n */\n\nimport { LoaderError, type PluginLoader } from \"../loader/index.js\";\n\n/**\n * Raised when a `workspace` command runs somewhere its provider plugins\n * cannot be resolved — the \"you're on a global install\" case. Carries the\n * unresolved package names so the message can be specific.\n */\nexport class WorkspaceContextError extends Error {\n\toverride name = \"WorkspaceContextError\";\n\treadonly command: string;\n\treadonly packages: readonly string[];\n\n\tconstructor(command: string, packages: readonly string[]) {\n\t\tconst [first, ...rest] = packages;\n\t\tconst subject =\n\t\t\trest.length > 0\n\t\t\t\t? `${first} (and ${rest.length} other${rest.length === 1 ? \"\" : \"s\"})`\n\t\t\t\t: (first ?? \"its plugins\");\n\t\tsuper(\n\t\t\t`\\`${command}\\` needs ${subject}, but no plugin package resolves here.\\n` +\n\t\t\t\t`Run it from a repo that has the \\`@theholocron/holocron-plugin-*\\` packages as devDependencies, ` +\n\t\t\t\t`or \\`pnpm exec holocron ${command}\\`. A global install can't resolve them — see ` +\n\t\t\t\t`https://theholocron.github.io/holocron/execution-contexts`\n\t\t);\n\t\tthis.command = command;\n\t\tthis.packages = packages;\n\t}\n}\n\n/**\n * A raw \"package isn't installed here\" error from `import()` /\n * `require.resolve` — `ERR_MODULE_NOT_FOUND` / `MODULE_NOT_FOUND`, or the\n * \"Cannot find package/module\" message Node prints for it.\n */\nexport function isModuleNotFound(err: unknown): boolean {\n\tif (!(err instanceof Error)) return false;\n\tconst code = (err as NodeJS.ErrnoException).code;\n\tif (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") return true;\n\treturn /Cannot find (?:package|module)|MODULE_NOT_FOUND/.test(err.message);\n}\n\n/** Did this failure come from the dynamic `import()` not finding the package? */\nfunction isImportFailure(err: Error): boolean {\n\treturn err instanceof LoaderError && err.message.startsWith(\"failed to import\");\n}\n\n/**\n * Throw {@link WorkspaceContextError} when a loaded `PluginLoader` shows\n * the global-install signature: nothing in the registry, at least one\n * failure, and *every* failure is a missing-package error. A no-op in\n * every other case (some capability loaded, non-import failure, or no\n * providers configured at all).\n *\n * Call it right after `await loader.load()` in a `workspace` command.\n */\nexport function assertPluginsResolvable(loader: PluginLoader, command: string): void {\n\tif (loader.loadedKeys().length > 0) return;\n\tconst failures = loader.loadFailures();\n\tif (failures.length === 0) return;\n\tif (!failures.every((f) => isImportFailure(f.error))) return;\n\n\tconst packages = [...new Set(failures.map((f) => f.packageName))];\n\tthrow new WorkspaceContextError(command, packages);\n}\n","/**\n * `holocron auth <subcommand>` — manage bootstrap credentials in the\n * OS keyring.\n *\n * Subcommands:\n * auth set <provider> [token] verify + store\n * auth unset <provider> remove\n * auth check <provider> re-verify a stored token\n * auth list every provider with a stored entry\n *\n * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md`.\n *\n * Verification lives in each plugin as a top-level `verifyToken(token)`\n * export. The auth command dynamically imports\n * `@theholocron/holocron-plugin-<provider>` and calls it. Plugins that\n * don't export `verifyToken` can still store — with a warning — because\n * \"no verify path\" shouldn't block credential storage.\n */\n\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { withEnvPrefix } from \"@theholocron/env-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { deleteToken, getToken, listStoredProviders, setToken } from \"../../auth/index.js\";\nimport { resolvePluginPackage } from \"../../config/index.js\";\nimport { makeEnv } from \"../../env/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { isModuleNotFound } from \"../../plugin/index.js\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport type {\n\tAuthCommandStatus,\n\tAuthImporter,\n\tAuthPluginModule,\n\tRunAuthCheckInput,\n\tRunAuthListInput,\n\tRunAuthSetInput,\n\tRunAuthUnsetInput,\n} from \"./auth.type.js\";\n\nconst defaultImporter: AuthImporter = async (pkg) => {\n\ttry {\n\t\tconst localRequire = createRequire(process.cwd() + \"/\");\n\t\tconst resolved = localRequire.resolve(pkg);\n\t\treturn (await import(pathToFileURL(resolved).href)) as AuthPluginModule;\n\t} catch {\n\t\treturn (await import(pkg)) as AuthPluginModule;\n\t}\n};\n\n// ── Token resolution ─────────────────────────────────────────────────\n\n/**\n * Resolve a token from (positional → HOLOCRON_<X> → vendor-native env).\n * Keyring is NOT consulted here — `auth set` writes TO the keyring, so\n * pulling FROM it would just re-store the same value.\n */\nexport function resolveAuthSetToken(input: {\n\tprovider: string;\n\tpositional?: string;\n\tenv?: NodeJS.ProcessEnv;\n}): string | null {\n\tconst e = withEnvPrefix(makeEnv(input.env), \"HOLOCRON\");\n\treturn input.positional || e.get(`${input.provider.toUpperCase()}_TOKEN`) || null;\n}\n\nexport async function runAuthSet(input: RunAuthSetInput): Promise<AuthCommandStatus> {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst importer = input.importer ?? defaultImporter;\n\tconst { provider } = input;\n\tconst keyringKey = input.org ? `${provider}.${input.org}` : provider;\n\n\tconst token = resolveAuthSetToken({ provider, positional: input.positional, env: input.env });\n\n\t// Feature sub-keys (e.g. \"github.read\") are stored directly — there is no\n\t// per-feature plugin package to load for verification.\n\tconst isFeatureKey = provider.includes(\".\");\n\tconst packageName = isFeatureKey ? null : resolvePluginPackage(provider);\n\n\tif (!token) {\n\t\tprint(style.fail(`no token supplied for \\`${keyringKey}\\`.`));\n\t\tprint(style.hint(` pass as positional arg: holocron auth set ${provider} <token>`));\n\t\tif (!isFeatureKey) {\n\t\t\tprint(\n\t\t\t\tstyle.hint(` or via env: HOLOCRON_${provider.toUpperCase()}_TOKEN / ${provider.toUpperCase()}_TOKEN`)\n\t\t\t);\n\t\t\tconst hint = await tryLoadHint(importer, packageName!);\n\t\t\tif (hint) {\n\t\t\t\tprint(style.hint(` hint: ${hint}`));\n\t\t\t}\n\t\t}\n\t\tlogger.warn({ provider, keyringKey, reason: \"no token supplied\" }, `auth set: ${keyringKey}`);\n\t\treturn { status: \"fail\", message: \"no token supplied\" };\n\t}\n\n\t// Verify via the plugin if it exports verifyToken (skipped for feature sub-keys).\n\tlet subject: string | undefined;\n\tif (!isFeatureKey && packageName) {\n\t\ttry {\n\t\t\tconst module = await importer(packageName);\n\t\t\tif (typeof module.verifyToken === \"function\") {\n\t\t\t\tconst verified = await module.verifyToken(token);\n\t\t\t\tif (!verified.ok) {\n\t\t\t\t\tprint(style.fail(`token rejected by ${provider}: ${verified.message}`));\n\t\t\t\t\tif (module.AUTH_HINT) print(style.hint(` hint: ${module.AUTH_HINT}`));\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t{ provider, keyringKey, verified: false, reason: verified.message },\n\t\t\t\t\t\t`auth set: ${keyringKey}`\n\t\t\t\t\t);\n\t\t\t\t\treturn { status: \"fail\", message: verified.message };\n\t\t\t\t}\n\t\t\t\tsubject = verified.subject;\n\t\t\t} else {\n\t\t\t\tprint(style.warn(`${provider} plugin has no verifyToken; storing without verification`));\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst msg = errorMessage(err);\n\t\t\tprint(style.warn(`cannot verify token — failed to load ${packageName}: ${msg}`));\n\t\t\tprint(\n\t\t\t\tstyle.hint(` storing token anyway; run 'holocron auth check ${provider}' once the plugin is installed`)\n\t\t\t);\n\t\t}\n\t}\n\n\tconst stored = setToken(keyringKey, token);\n\tif (!stored) {\n\t\tprint(style.fail(`keyring unavailable — token not stored. Use env vars instead.`));\n\t\tlogger.warn({ provider, keyringKey, reason: \"keyring unavailable\" }, `auth set: ${keyringKey}`);\n\t\treturn { status: \"fail\", message: \"keyring unavailable\" };\n\t}\n\n\tprint(style.success(`stored ${keyringKey} token${subject ? ` (${subject})` : \"\"}`));\n\tlogger.info(\n\t\t{ provider, keyringKey, verified: subject !== undefined, ...(subject ? { subject } : {}), status: \"ok\" },\n\t\t`auth set: ${keyringKey}`\n\t);\n\treturn { status: \"ok\", ...(subject ? { message: subject } : {}) };\n}\n\nexport function runAuthUnset(input: RunAuthUnsetInput): AuthCommandStatus {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst removed = deleteToken(input.provider);\n\tif (removed) {\n\t\tprint(style.success(`removed ${input.provider} token`));\n\t\tlogger.info({ provider: input.provider, status: \"ok\" }, `auth unset: ${input.provider}`);\n\t\treturn { status: \"ok\" };\n\t}\n\tprint(style.dim(`no stored token for ${input.provider}`));\n\tlogger.info({ provider: input.provider, status: \"skip\" }, `auth unset: ${input.provider}`);\n\treturn { status: \"skip\", message: \"nothing to remove\" };\n}\n\nexport async function runAuthCheck(input: RunAuthCheckInput): Promise<AuthCommandStatus> {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst importer = input.importer ?? defaultImporter;\n\tconst { provider } = input;\n\tconst keyringKey = input.org ? `${provider}.${input.org}` : provider;\n\n\tconst token = getToken(keyringKey);\n\tif (!token) {\n\t\tprint(style.dim(`no stored token for ${keyringKey}`));\n\t\tlogger.info({ provider, keyringKey, status: \"skip\", reason: \"no stored token\" }, `auth check: ${keyringKey}`);\n\t\treturn { status: \"skip\", message: \"no stored token\" };\n\t}\n\n\t// Feature sub-keys have no plugin to verify against — report stored only.\n\tif (provider.includes(\".\")) {\n\t\tprint(style.success(`${keyringKey}: token stored (feature key — no plugin verification)`));\n\t\treturn { status: \"ok\", message: \"stored\" };\n\t}\n\n\tconst packageName = resolvePluginPackage(provider);\n\ttry {\n\t\tconst module = await importer(packageName);\n\t\tif (typeof module.verifyToken !== \"function\") {\n\t\t\tprint(style.warn(`${keyringKey}: token stored (plugin has no verifyToken; can't confirm validity)`));\n\t\t\treturn { status: \"ok\", message: \"stored, unverified\" };\n\t\t}\n\t\tconst verify = () => module.verifyToken!(token);\n\t\tconst verified =\n\t\t\tinput.showSpinner !== false ? await withSpinner(`Verifying ${keyringKey} token…`, verify) : await verify();\n\t\tif (verified.ok) {\n\t\t\tprint(style.success(`${keyringKey}: ok — ${verified.subject}`));\n\t\t\tlogger.info(\n\t\t\t\t{ provider, keyringKey, verified: true, subject: verified.subject, status: \"ok\" },\n\t\t\t\t`auth check: ${keyringKey}`\n\t\t\t);\n\t\t\treturn { status: \"ok\", message: verified.subject };\n\t\t}\n\t\tprint(style.fail(`${keyringKey}: rejected — ${verified.message}`));\n\t\tif (module.AUTH_HINT) print(style.hint(` hint: ${module.AUTH_HINT}`));\n\t\tlogger.warn(\n\t\t\t{ provider, keyringKey, verified: false, reason: verified.message, status: \"fail\" },\n\t\t\t`auth check: ${keyringKey}`\n\t\t);\n\t\treturn { status: \"fail\", message: verified.message };\n\t} catch (err) {\n\t\tconst msg = errorMessage(err);\n\t\t// Global install: the plugin package isn't resolvable here. `auth set` /\n\t\t// `auth list` already work plugin-free — `auth check` degrades to the\n\t\t// same \"we have a token, we just can't confirm it\" report rather than\n\t\t// failing outright (theholocron/holocron#576).\n\t\tif (isModuleNotFound(err)) {\n\t\t\tprint(style.warn(`${keyringKey}: token present — verification skipped (plugin not available here)`));\n\t\t\tlogger.info(\n\t\t\t\t{ provider, keyringKey, status: \"ok\", reason: \"plugin not resolvable\" },\n\t\t\t\t`auth check: ${keyringKey}`\n\t\t\t);\n\t\t\treturn { status: \"ok\", message: \"stored, unverified (plugin not available)\" };\n\t\t}\n\t\tprint(style.fail(`${keyringKey}: cannot verify — ${msg}`));\n\t\tlogger.warn({ provider, keyringKey, reason: msg, status: \"fail\" }, `auth check: ${keyringKey}`);\n\t\treturn { status: \"fail\", message: msg };\n\t}\n}\n\nexport async function runAuthList(input: RunAuthListInput = {}): Promise<AuthCommandStatus> {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst importer = input.importer ?? defaultImporter;\n\tconst providers = listStoredProviders();\n\n\tif (providers.length === 0) {\n\t\tprint(style.dim(\"no stored tokens.\"));\n\t\tprint(style.hint(\"run: holocron auth set <provider> <token>\"));\n\t\tlogger.info({ providers: 0 }, \"auth list: done\");\n\t\treturn { status: \"ok\", message: \"none\" };\n\t}\n\n\tlet ok = 0;\n\tlet fail = 0;\n\tfor (const provider of providers.sort()) {\n\t\tconst check = await runAuthCheck({ provider, importer, print: () => {}, logger, showSpinner: false });\n\t\tconst label = `${provider}${check.message ? ` — ${check.message}` : \"\"}`;\n\t\tif (check.status === \"ok\") {\n\t\t\tok += 1;\n\t\t\tprint(` ${style.success(label)}`);\n\t\t} else if (check.status === \"fail\") {\n\t\t\tfail += 1;\n\t\t\tprint(` ${style.fail(label)}`);\n\t\t} else print(` ${style.dim(`· ${label}`)}`);\n\t}\n\tlogger.info({ providers: providers.length, ok, fail }, \"auth list: done\");\n\treturn { status: \"ok\" };\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\nasync function tryLoadHint(importer: AuthImporter, packageName: string): Promise<string | null> {\n\ttry {\n\t\tconst module = await importer(packageName);\n\t\treturn module.AUTH_HINT ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import { checkbox } from \"@inquirer/prompts\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Deployment,\n\ttype DeploymentRecord,\n\tPluginLoader,\n\ttype PullRequest,\n\ttype Source,\n} from \"../../plugin/index.js\";\nimport { style } from \"../../ui/index.js\";\nimport type { CleanupPreviewReport, RunCleanupPreviewInput } from \"./cleanup-preview.type.js\";\n\nfunction prStateLabel(pr: PullRequest): string {\n\tif (pr.merged) return style.success(\"merged\");\n\tif (pr.state === \"closed\") return style.dim(\"closed (not merged)\");\n\treturn style.warn(\"open\");\n}\n\nexport async function runCleanupPreview(input: RunCleanupPreviewInput): Promise<CleanupPreviewReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\t// c8 ignore next -- real PluginLoader construction is integration-level; unit tests always supply loader\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"deploy cleanup-preview\");\n\tlogger.info({ pr: input.prNumber, project: input.project }, \"cleanup-preview: start\");\n\n\t// ── 1. Look up the PR ───────────────────────────────────────────────\n\tif (!loader.has(\"source\")) {\n\t\tthrow new Error(\"source capability is not configured — add a source provider to holocron.config.json\");\n\t}\n\tconst source = loader.get(\"source\") as Source;\n\tif (!source.getPullRequest) {\n\t\tthrow new Error(`${source.providerName} source provider does not support getPullRequest`);\n\t}\n\n\tlet pr: PullRequest;\n\ttry {\n\t\tpr = await source.getPullRequest(input.prNumber, input.repo);\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tthrow new Error(`Failed to fetch PR #${input.prNumber}: ${message}`, { cause: err });\n\t}\n\n\t// Derive the Cloudflare branch alias from the repo name and PR number.\n\t// Matches the convention the deploy-preview workflow uses:\n\t// --branch ${{ github.event.repository.name }}-pr-${{ github.event.pull_request.number }}\n\tconst repoName = (input.repo ?? input.loaded.resolved.repo?.name ?? \"\").split(\"/\").pop()!;\n\tconst branch = `${repoName}-pr-${pr.number}`;\n\n\tprint(\"\");\n\tprint(`${style.header(`PR #${pr.number}`)} — ${pr.title}`);\n\tprint(` Status : ${prStateLabel(pr)} | Branch : ${style.dim(pr.branch)}`);\n\tprint(` URL : ${style.dim(pr.url)}`);\n\tprint(` CF alias : ${style.dim(branch)}`);\n\tprint(\"\");\n\n\t// ── 2. List deployments ─────────────────────────────────────────────\n\tif (!loader.has(\"deployment\")) {\n\t\tthrow new Error(\"deployment capability is not configured — add a deployment provider to holocron.config.json\");\n\t}\n\tconst deploy = loader.get(\"deployment\") as Deployment;\n\tif (!deploy.listPreviewDeployments || !deploy.deletePreviewDeployments) {\n\t\tthrow new Error(`${deploy.providerName} deployment provider does not support preview cleanup`);\n\t}\n\n\tlet deployments: DeploymentRecord[];\n\ttry {\n\t\tdeployments = await deploy.listPreviewDeployments(input.project, branch);\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tthrow new Error(`Failed to list deployments: ${message}`, { cause: err });\n\t}\n\n\tif (deployments.length === 0) {\n\t\tprint(style.dim(`No deployments found for branch ${branch}.`));\n\t\tlogger.info({ pr: pr.number, branch, found: 0, deleted: 0, status: \"none\" }, \"cleanup-preview: done\");\n\t\treturn { pr, branch, found: 0, deleted: 0, status: \"none\" };\n\t}\n\n\tprint(`Found ${deployments.length} deployment${deployments.length === 1 ? \"\" : \"s\"} for ${style.dim(branch)}:`);\n\tprint(\"\");\n\n\tif (pr.state === \"open\") {\n\t\tprint(\n\t\t\tstyle.warn(\n\t\t\t\t`PR #${pr.number} is still open. Deleting its preview deployments will break the live preview link.`\n\t\t\t)\n\t\t);\n\t\tprint(style.warn(\"Nothing is pre-selected — check the deployments you want to remove.\"));\n\t\tprint(\"\");\n\t}\n\n\t// ── 3. Interactive selection ────────────────────────────────────────\n\tconst choices = deployments.map((d) => {\n\t\tconst label = d.id.includes(\":\") ? d.id.split(\":\").pop()! : d.id;\n\t\tconst date = d.createdAt ? style.dim(d.createdAt.slice(0, 10)) : \"\";\n\t\treturn {\n\t\t\tname: `${label} ${date} ${style.dim(d.url)}`,\n\t\t\tvalue: d.id,\n\t\t\tchecked: pr.state !== \"open\",\n\t\t};\n\t});\n\n\tlet selected: string[];\n\ttry {\n\t\tselected = await checkbox({\n\t\t\tmessage: \"Select deployments to delete (space to toggle, a to select all, enter to confirm):\",\n\t\t\tchoices,\n\t\t});\n\t} catch {\n\t\t// Ctrl-C\n\t\tprint(style.dim(\"Aborted.\"));\n\t\treturn { pr, branch, found: deployments.length, deleted: 0, status: \"aborted\" };\n\t}\n\n\tif (selected.length === 0) {\n\t\tprint(style.dim(\"Nothing selected — no deployments deleted.\"));\n\t\treturn { pr, branch, found: deployments.length, deleted: 0, status: \"aborted\" };\n\t}\n\n\t// ── 4. Delete ───────────────────────────────────────────────────────\n\tprint(\"\");\n\ttry {\n\t\tconst count = await deploy.deletePreviewDeployments(input.project, selected);\n\t\tprint(style.success(`Deleted ${count} deployment${count === 1 ? \"\" : \"s\"}.`));\n\t\tlogger.info(\n\t\t\t{ pr: pr.number, branch, found: deployments.length, deleted: count, status: \"ok\" },\n\t\t\t\"cleanup-preview: done\"\n\t\t);\n\t\treturn { pr, branch, found: deployments.length, deleted: count, status: \"ok\" };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(style.fail(message));\n\t\tlogger.warn(\n\t\t\t{ pr: pr.number, branch, found: deployments.length, reason: message, status: \"fail\" },\n\t\t\t\"cleanup-preview: done\"\n\t\t);\n\t\treturn { pr, branch, found: deployments.length, deleted: 0, status: \"fail\", message };\n\t}\n}\n","import { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join, resolve } from \"node:path\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { statusRow, style } from \"../../ui/index.js\";\nimport type { CloneReport, CloneTarget, ExecFn, GitHubRepo, RunCloneInput, WholeOrgScope } from \"./clone.type.js\";\n\n/**\n * Accepts a bare org (`\"theholocron\"`) — clones every repo in it — or an\n * `org/repo` coordinate (`\"theholocron/new-repo\"`) — clones just that one\n * repo. The repo half is never silently discarded: if it's there, it's used.\n * A trailing slash with nothing after it (`\"theholocron/\"`) is treated the\n * same as a bare org.\n */\nexport function parseCloneTarget(raw: string): CloneTarget {\n\tconst trimmed = raw.trim();\n\tconst slash = trimmed.indexOf(\"/\");\n\tif (slash === -1) return { org: trimmed };\n\tconst org = trimmed.slice(0, slash);\n\tconst repo = trimmed.slice(slash + 1);\n\treturn repo ? { org, repo } : { org };\n}\n\nfunction encodeTokenForGitHttpAuth(token: string): string {\n\tconst trimmed = token.trim();\n\tif (!trimmed) throw new Error(\"empty token\");\n\t// eslint-disable-next-line no-control-regex\n\tif (/[\\u0000-\\u001F\\u007F\\s]/.test(trimmed)) {\n\t\tthrow new Error(\"token contains whitespace or control characters\");\n\t}\n\treturn encodeURIComponent(trimmed);\n}\n\n/** Strip a leading dot so a hidden repo (e.g. `.github`) is still visible in Finder once cloned. */\nfunction repoDirName(repo: GitHubRepo): string {\n\treturn repo.name.startsWith(\".\") ? repo.name.slice(1) : repo.name;\n}\n\nasync function listOrgRepos(org: string, token: string, fetchFn: typeof globalThis.fetch): Promise<GitHubRepo[]> {\n\tconst repos: GitHubRepo[] = [];\n\tlet url: string | null = `https://api.github.com/orgs/${org}/repos?per_page=100&type=all`;\n\n\twhile (url) {\n\t\tconst res = await fetchFn(url, {\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${token}`,\n\t\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t\t},\n\t\t});\n\n\t\tif (!res.ok) {\n\t\t\tthrow new Error(`GitHub API ${res.status}: ${res.statusText} — check that the token has org:read scope`);\n\t\t}\n\n\t\trepos.push(...((await res.json()) as GitHubRepo[]));\n\n\t\tconst link = res.headers.get(\"link\");\n\t\tconst next = link?.match(/<([^>]+)>;\\s*rel=\"next\"/);\n\t\turl = next ? next[1] : null;\n\t}\n\n\treturn repos;\n}\n\nasync function getRepo(\n\torg: string,\n\trepo: string,\n\ttoken: string,\n\tfetchFn: typeof globalThis.fetch\n): Promise<GitHubRepo> {\n\tconst res = await fetchFn(`https://api.github.com/repos/${org}/${repo}`, {\n\t\theaders: {\n\t\t\tAuthorization: `Bearer ${token}`,\n\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t},\n\t});\n\n\tif (res.status === 404) {\n\t\tthrow new Error(`${org}/${repo} not found — check the repo name and that the token can see it`);\n\t}\n\tif (!res.ok) {\n\t\tthrow new Error(`GitHub API ${res.status}: ${res.statusText} — check that the token has repo:read scope`);\n\t}\n\n\treturn (await res.json()) as GitHubRepo;\n}\n\nexport async function runClone(input: RunCloneInput): Promise<CloneReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst fetchFn = input.fetch ?? globalThis.fetch;\n\tconst dryRun = input.dryRun ?? false;\n\tconst targetDir = resolve(input.dir ?? join(homedir(), \"Code\", input.org));\n\tlogger.info({ org: input.org, repo: input.repo, targetDir, dryRun: dryRun || undefined }, \"clone: start\");\n\tconst exec: ExecFn =\n\t\tinput.exec ??\n\t\t((cmd, args, opts) => {\n\t\t\tconst r = spawnSync(cmd, args, { cwd: opts.cwd, stdio: \"inherit\" });\n\t\t\treturn { status: r.status };\n\t\t});\n\n\tprint(\"\");\n\n\tif (!existsSync(targetDir)) {\n\t\tif (dryRun) {\n\t\t\tprint(style.dim(` would create ${targetDir}`));\n\t\t} else {\n\t\t\tmkdirSync(targetDir, { recursive: true });\n\t\t}\n\t}\n\n\tlet repos: GitHubRepo[];\n\ttry {\n\t\trepos = input.repo\n\t\t\t? [await getRepo(input.org, input.repo, input.token, fetchFn)]\n\t\t\t: await listOrgRepos(input.org, input.token, fetchFn);\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tlogger.warn({ org: input.org, repo: input.repo, reason: message }, \"clone: failed to list repos\");\n\t\treturn { status: \"fail\", cloned: 0, skipped: 0, failed: 0, message };\n\t}\n\n\tif (!input.repo && !dryRun && input.confirmWholeOrg) {\n\t\tconst alreadyCloned = repos.filter((r) => existsSync(join(targetDir, repoDirName(r)))).length;\n\t\tconst scope: WholeOrgScope = { total: repos.length, alreadyCloned, toClone: repos.length - alreadyCloned };\n\t\tconst proceed = await input.confirmWholeOrg(scope);\n\t\tif (!proceed) {\n\t\t\tprint(style.dim(\" aborted — nothing cloned\"));\n\t\t\tlogger.info({ org: input.org, ...scope }, \"clone: aborted by user\");\n\t\t\treturn { status: \"aborted\", cloned: 0, skipped: 0, failed: 0, message: \"aborted by user\" };\n\t\t}\n\t}\n\n\tlet cloned = 0;\n\tlet skipped = 0;\n\tlet failed = 0;\n\n\tfor (const repo of repos) {\n\t\tconst dest = join(targetDir, repoDirName(repo));\n\n\t\tif (existsSync(dest)) {\n\t\t\tprint(statusRow(\"skip\", [repo.full_name, dest, \"already exists\"]));\n\t\t\tskipped++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (dryRun) {\n\t\t\tprint(style.dim(` would clone ${repo.full_name} → ${dest}`));\n\t\t\tcloned++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tprint(style.step(` clone ${repo.full_name} → ${dest}`));\n\t\tconst { clone_url } = repo;\n\t\tif (!clone_url.startsWith(\"https://github.com/\")) {\n\t\t\tprint(statusRow(\"fail\", [repo.full_name, dest, `unexpected clone URL: ${clone_url}`]));\n\t\t\tfailed++;\n\t\t\tcontinue;\n\t\t}\n\t\tlet encodedToken: string;\n\t\ttry {\n\t\t\tencodedToken = encodeTokenForGitHttpAuth(input.token);\n\t\t} catch (err) {\n\t\t\tprint(statusRow(\"fail\", [repo.full_name, dest, `invalid token format: ${errorMessage(err)}`]));\n\t\t\tfailed++;\n\t\t\tcontinue;\n\t\t}\n\t\tconst authedUrl = `https://x-access-token:${encodedToken}@github.com/${clone_url.slice(\"https://github.com/\".length)}`;\n\t\tconst result = exec(\"git\", [\"clone\", \"--\", authedUrl, dest], { cwd: targetDir });\n\n\t\tif (result.status !== 0) {\n\t\t\tprint(statusRow(\"fail\", [repo.full_name, dest]));\n\t\t\tfailed++;\n\t\t} else {\n\t\t\tprint(statusRow(\"ok\", [repo.full_name, dest]));\n\t\t\tcloned++;\n\t\t}\n\t}\n\n\tconst summary = `${cloned} cloned, ${failed} failed, ${skipped} skipped`;\n\tprint(\"\");\n\tprint(\n\t\tdryRun\n\t\t\t? style.dim(` dry-run: ${summary}`)\n\t\t\t: failed > 0\n\t\t\t\t? style.fail(` ${summary}`)\n\t\t\t\t: style.success(` ${summary}`)\n\t);\n\n\tconst status = dryRun ? \"dry-run\" : failed > 0 ? \"fail\" : \"ok\";\n\tlogger[failed > 0 ? \"warn\" : \"info\"](\n\t\t{ org: input.org, repo: input.repo, status, cloned, skipped, failed },\n\t\t\"clone: done\"\n\t);\n\n\tif (input.confirmOpen) {\n\t\tconst openTarget = input.repo ? join(targetDir, repoDirName(repos[0]!)) : targetDir;\n\t\tif (existsSync(openTarget)) await input.confirmOpen(openTarget, dryRun && cloned > 0);\n\t}\n\n\treturn { status, cloned, skipped, failed };\n}\n","/**\n * `holocron deploy` — trigger a deployment via the configured\n * `deployment` capability.\n *\n * Two modes, one command: `runDeploy` (the default — a Git branch,\n * `triggerDeployment()`) and `runDeployFromFiles` (`--files <dir>` —\n * a local directory of source files, `deployFunction()`, no linked\n * repo required — for a consumer with no Git history to deploy from,\n * e.g. Sentinel, shipped as an npm package). Separate functions, not\n * one branching `runDeploy`, because their inputs genuinely differ\n * (`branch` vs `dir`) and their result shapes differ too\n * (`DeploymentRecord` carries `status`/`branch`; `DeployFunctionResult`\n * is deliberately minimal, same as `DeployScriptResult` for Workers).\n *\n * Errors clearly when `deployment` isn't loaded (no provider declared\n * in `holocron.config.json`), or when the configured provider doesn't\n * implement `deployFunction` (it's optional on `Deployment` — not\n * every provider has a files-based deploy API).\n *\n * Dry-run skips the actual deploy call but still verifies the\n * deployment capability (and, for `--files`, `deployFunction`) is\n * present, so operators can sanity-check the wiring without spinning\n * up a build.\n *\n * **Both modes wait for the deployment to finish** (holocron#911): a\n * provider accepting the upload/trigger is not the deployment succeeding.\n * Vercel builds asynchronously — an `npm install` failure there leaves\n * the deployment in `ERROR` while production keeps serving the previous\n * one, and this command used to report `ok` regardless (found live:\n * Sentinel's holocron#910 deploy \"succeeded\" in CI, never went live). So\n * after triggering, {@link waitForDeployment} polls\n * `Deployment.getDeployment()` until a terminal state; only `ready` is\n * `ok`, while `error` / `cancelled` / a timeout are `fail` (non-zero exit\n * via `cli.ts`).\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { relative, sep } from \"node:path\";\n\nimport { walkFilesSync } from \"@theholocron/fs-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { assertPluginsResolvable, type Deployment, type DeploymentRecord, PluginLoader } from \"../../plugin/index.js\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport type {\n\tDeployFilesReport,\n\tDeployReport,\n\tDeployWaitOptions,\n\tRunDeployFromFilesInput,\n\tRunDeployInput,\n} from \"./deploy.type.js\";\n\nconst DEFAULT_WAIT_TIMEOUT_MS = 10 * 60_000;\nconst DEFAULT_WAIT_INTERVAL_MS = 5_000;\n\nconst TERMINAL_STATUSES: ReadonlySet<DeploymentRecord[\"status\"]> = new Set([\"ready\", \"error\", \"cancelled\"]);\n\n/**\n * Polls `getDeployment(id)` until the deployment reaches a terminal status\n * (`ready` / `error` / `cancelled`). Throws on timeout — the caller turns\n * that into a `fail` report, same as a provider throwing mid-trigger.\n */\nexport async function waitForDeployment(\n\tdeploy: Deployment,\n\tdeploymentId: string,\n\toptions: DeployWaitOptions = {}\n): Promise<DeploymentRecord> {\n\tconst timeoutMs = options.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;\n\tconst intervalMs = options.intervalMs ?? DEFAULT_WAIT_INTERVAL_MS;\n\tconst sleep = options.sleep ?? ((ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)));\n\tconst now = options.now ?? Date.now;\n\n\tconst deadline = now() + timeoutMs;\n\tfor (;;) {\n\t\tconst record = await deploy.getDeployment(deploymentId);\n\t\tif (TERMINAL_STATUSES.has(record.status)) return record;\n\t\tif (now() >= deadline) {\n\t\t\tthrow new Error(\n\t\t\t\t`deployment ${deploymentId} still ${record.status} after ${Math.round(timeoutMs / 1000)}s — check the provider's dashboard`\n\t\t\t);\n\t\t}\n\t\tawait sleep(intervalMs);\n\t}\n}\n\n/** One terminal, non-ready record as a single human-readable failure line. */\nfunction terminalFailure(record: DeploymentRecord): string {\n\treturn `deployment ${record.id} ended ${record.status}${record.errorMessage ? `: ${record.errorMessage}` : \"\"}`;\n}\n\n/**\n * Provider `url` fields (Vercel's REST API, at least) come back as bare\n * hostnames — `\"my-app.vercel.app\"`, no scheme — which terminals don't\n * linkify and browsers won't navigate to unmodified. Printed output\n * should be a URL a human can click/paste; structured log fields keep\n * the raw provider value as-is.\n */\nfunction withScheme(url: string): string {\n\treturn /^https?:\\/\\//.test(url) ? url : `https://${url}`;\n}\n\nexport async function runDeploy(input: RunDeployInput): Promise<DeployReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"deploy\");\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tlogger.info(\n\t\t{\n\t\t\tbranch: input.branch,\n\t\t\ttarget: input.target ?? \"preview\",\n\t\t\tprojectId: input.projectId,\n\t\t\tdryRun: dryRun || undefined,\n\t\t},\n\t\t\"deploy: start\"\n\t);\n\n\tprint(\n\t\tstyle.header(\n\t\t\t`Holocron deploy — branch=${input.branch}${\n\t\t\t\tinput.target ? `, target=${input.target}` : \" (preview)\"\n\t\t\t}${dryRun ? \" (dry-run)\" : \"\"}`\n\t\t)\n\t);\n\n\tif (!loader.has(\"deployment\")) {\n\t\tthrow new Error(\n\t\t\t\"deployment capability is not configured — add a `deployment` provider to holocron.config.json\"\n\t\t);\n\t}\n\tconst deploy = loader.get(\"deployment\") as Deployment;\n\n\tif (dryRun) {\n\t\tconst message = `would: ${deploy.providerName}.triggerDeployment(projectId=${input.projectId}, branch=${input.branch}${\n\t\t\tinput.target ? `, target=${input.target}` : \"\"\n\t\t})`;\n\t\tprint(` ${style.dim(`… ${message}`)}`);\n\t\treturn { deployment: null, status: \"dry-run\", message };\n\t}\n\n\ttry {\n\t\tconst triggered = await withSpinner(\n\t\t\t`Deploying ${input.branch}${input.target ? ` → ${input.target}` : \"\"}…`,\n\t\t\t() =>\n\t\t\t\tdeploy.triggerDeployment({\n\t\t\t\t\tprojectId: input.projectId,\n\t\t\t\t\tbranch: input.branch,\n\t\t\t\t\t...(input.target ? { target: input.target } : {}),\n\t\t\t\t})\n\t\t);\n\t\tlogger.info({ status: triggered.status, url: triggered.url, id: triggered.id }, \"deploy: triggered\");\n\t\tconst record = TERMINAL_STATUSES.has(triggered.status)\n\t\t\t? triggered\n\t\t\t: await withSpinner(`Waiting for ${withScheme(triggered.url)} to finish…`, () =>\n\t\t\t\t\twaitForDeployment(deploy, triggered.id, input.wait)\n\t\t\t\t);\n\t\tif (record.status !== \"ready\") {\n\t\t\tconst message = terminalFailure(record);\n\t\t\tprint(` ${style.fail(`${message} — ${withScheme(triggered.url)}`)}`);\n\t\t\tlogger.warn({ id: record.id, status: record.status, reason: record.errorMessage }, \"deploy: failed\");\n\t\t\treturn { deployment: record, status: \"fail\", message };\n\t\t}\n\t\tprint(` ${style.success(`${record.status} — ${withScheme(triggered.url)}`)}`);\n\t\tlogger.info({ status: record.status, url: triggered.url, id: record.id }, \"deploy: ready\");\n\t\treturn { deployment: record, status: \"ok\" };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ${style.fail(message)}`);\n\t\tlogger.warn({ branch: input.branch, reason: message }, \"deploy: failed\");\n\t\treturn { deployment: null, status: \"fail\", message };\n\t}\n}\n\n// Deliberately no \"dist\" here, unlike holocron new repo's own file-walker this\n// was modeled on: --files exists specifically to deploy build output, so\n// a directory literally named \"dist\" is exactly what a caller usually\n// means to include, not exclude.\nconst SKIP_DIRS = [\".git\", \"node_modules\", \".turbo\"];\n\nconst defaultWalkFiles = (dir: string): string[] => walkFilesSync(dir, { skip: SKIP_DIRS });\n\n/** `holocron deploy --files <dir>` — the non-git counterpart to `runDeploy`. */\nexport async function runDeployFromFiles(input: RunDeployFromFilesInput): Promise<DeployFilesReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"deploy\");\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst walkFiles = input.walkFiles ?? defaultWalkFiles;\n\tconst readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\n\tconst files: Record<string, string> = {};\n\tfor (const abs of walkFiles(input.dir)) {\n\t\tconst rel = relative(input.dir, abs).split(sep).join(\"/\");\n\t\tfiles[rel] = readFile(abs);\n\t}\n\tconst fileCount = Object.keys(files).length;\n\n\tlogger.info(\n\t\t{\n\t\t\tdir: input.dir,\n\t\t\tfileCount,\n\t\t\ttarget: input.target ?? \"preview\",\n\t\t\tprojectId: input.projectId,\n\t\t\tdryRun: dryRun || undefined,\n\t\t},\n\t\t\"deploy: start (files)\"\n\t);\n\n\tprint(\n\t\tstyle.header(\n\t\t\t`Holocron deploy — files=${input.dir} (${fileCount} file${fileCount === 1 ? \"\" : \"s\"})${\n\t\t\t\tinput.target ? `, target=${input.target}` : \" (preview)\"\n\t\t\t}${dryRun ? \" (dry-run)\" : \"\"}`\n\t\t)\n\t);\n\n\tif (!loader.has(\"deployment\")) {\n\t\tthrow new Error(\n\t\t\t\"deployment capability is not configured — add a `deployment` provider to holocron.config.json\"\n\t\t);\n\t}\n\tconst deploy = loader.get(\"deployment\") as Deployment;\n\tif (!deploy.deployFunction) {\n\t\tthrow new Error(\n\t\t\t`deployment provider \"${deploy.providerName}\" does not support deploying from files — deployFunction() is not implemented`\n\t\t);\n\t}\n\n\tif (dryRun) {\n\t\tconst message = `would: ${deploy.providerName}.deployFunction(projectId=${input.projectId}, files=${fileCount}${\n\t\t\tinput.target ? `, target=${input.target}` : \"\"\n\t\t})`;\n\t\tprint(` ${style.dim(`… ${message}`)}`);\n\t\treturn { deployment: null, status: \"dry-run\", message };\n\t}\n\n\ttry {\n\t\tconst result = await withSpinner(\n\t\t\t`Deploying ${fileCount} file${fileCount === 1 ? \"\" : \"s\"} from ${input.dir}…`,\n\t\t\t() => deploy.deployFunction!(input.projectId, { files, ...(input.target ? { target: input.target } : {}) })\n\t\t);\n\t\tlogger.info({ url: result.url, id: result.deploymentId }, \"deploy: triggered (files)\");\n\t\tconst record = await withSpinner(`Waiting for ${withScheme(result.url)} to finish…`, () =>\n\t\t\twaitForDeployment(deploy, result.deploymentId, input.wait)\n\t\t);\n\t\tif (record.status !== \"ready\") {\n\t\t\tconst message = terminalFailure(record);\n\t\t\tprint(` ${style.fail(`${message} — ${withScheme(result.url)}`)}`);\n\t\t\tlogger.warn(\n\t\t\t\t{ id: record.id, status: record.status, reason: record.errorMessage },\n\t\t\t\t\"deploy: failed (files)\"\n\t\t\t);\n\t\t\treturn { deployment: result, status: \"fail\", message };\n\t\t}\n\t\tprint(` ${style.success(withScheme(result.url))}`);\n\t\tlogger.info({ url: result.url, id: result.deploymentId }, \"deploy: ready (files)\");\n\t\treturn { deployment: result, status: \"ok\" };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ${style.fail(message)}`);\n\t\tlogger.warn({ dir: input.dir, reason: message }, \"deploy: failed (files)\");\n\t\treturn { deployment: null, status: \"fail\", message };\n\t}\n}\n","/**\n * `holocron doctor` — load the config, instantiate every capability,\n * print a per-capability readiness report.\n *\n * Each capability gets a smoke check appropriate to its surface:\n * source → `whoami()`\n * issues → `doctor()` (rich report)\n * secrets → `listSecrets({ kind: 'repo' })`\n * ci → `listRuns({ limit: 1 })`\n * errors → `describe()`\n * logs → `whoami()` (dataset reachability) or `describe()`\n * others → just \"loaded\" (no smoke endpoint defined yet)\n *\n * Output is plain text via a passed-in `print` function so tests can\n * capture lines without ANSI / spinner noise.\n */\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Auth,\n\tCARDINALITY,\n\ttype Ci,\n\ttype Deployment,\n\ttype Dns,\n\ttype Environments,\n\ttype Errors,\n\ttype Issues,\n\ttype Logs,\n\ttype Monitoring,\n\tPluginLoader,\n\ttype Secrets,\n\ttype Source,\n\ttype Vault,\n\ttype Workers,\n} from \"../../plugin/index.js\";\nimport { pad, statusRow, style, withSpinner } from \"../../ui/index.js\";\nimport type { DoctorReport, DoctorRow, DoctorStatus, RunDoctorInput } from \"./doctor.type.js\";\n\nexport async function runDoctor(input: RunDoctorInput): Promise<DoctorReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait withSpinner(\"Loading plugins…\", () => loader.load());\n\t// A global install has no plugin packages to resolve — say so plainly\n\t// instead of printing a report that's all \"Cannot find package\" rows.\n\tassertPluginsResolvable(loader, \"doctor\");\n\n\tconst rows: DoctorRow[] = [];\n\tconst config = input.loaded.resolved;\n\n\tprint(\"\");\n\tprint(style.dim(` config: ${input.loaded.filepath}`));\n\tprint(\"\");\n\n\t// Providers that never loaded (missing token, package not installed) —\n\t// the most actionable rows in the report.\n\tfor (const failure of loader.loadFailures()) {\n\t\trows.push({\n\t\t\tcapability: failure.key,\n\t\t\tprovider: failure.provider,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: failure.error.message,\n\t\t});\n\t}\n\n\tfor (const key of loader.loadedKeys()) {\n\t\tconst cardinality = CARDINALITY[key];\n\t\tconst entry = config.providers[key];\n\t\tconst providers =\n\t\t\tentry?.cardinality === \"many\"\n\t\t\t\t? entry.tuples.map((t) => t.provider)\n\t\t\t\t: entry?.cardinality === \"single\"\n\t\t\t\t\t? [entry.tuple.provider]\n\t\t\t\t\t: [];\n\n\t\tif (cardinality === \"many\") {\n\t\t\tconst impls = loader.get(key) as unknown as unknown[];\n\t\t\timpls.forEach((_impl, idx) => {\n\t\t\t\trows.push({\n\t\t\t\t\tcapability: key,\n\t\t\t\t\tprovider: providers[idx] ?? \"?\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"loaded (no smoke check defined for this capability)\",\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\tconst impl = loader.get(key) as unknown;\n\t\t\tconst row = await smokeCheck(key, providers[0] ?? \"?\", impl);\n\t\t\trows.push(row);\n\t\t}\n\t}\n\n\tconst log = getLogger();\n\t// Render rows\n\tfor (const row of rows) {\n\t\tlog[row.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{ capability: row.capability, provider: row.provider, status: row.status, detail: row.message },\n\t\t\t`doctor: ${row.capability}`\n\t\t);\n\t\tprint(statusRow(row.status, [`${pad(row.capability, 14)} via ${pad(row.provider, 14)}`, row.message]));\n\t}\n\n\tconst summary = rows.reduce(\n\t\t(acc, r) => {\n\t\t\tacc[r.status] += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0 }\n\t);\n\n\tconst summaryLine = `${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`;\n\tprint(\"\");\n\tprint(style.header(summaryLine));\n\n\treturn { rows, summary };\n}\n\n// ── smoke checks ────────────────────────────────────────────────────\n\nasync function smokeCheck(key: string, provider: string, impl: unknown): Promise<DoctorRow> {\n\ttry {\n\t\tswitch (key) {\n\t\t\tcase \"source\": {\n\t\t\t\tconst result = await (impl as Source).whoami();\n\t\t\t\treturn mk(key, provider, \"ok\", `whoami: ${result.login}`);\n\t\t\t}\n\t\t\tcase \"issues\": {\n\t\t\t\tconst report = await (impl as Issues).doctor();\n\t\t\t\treturn mk(\n\t\t\t\t\tkey,\n\t\t\t\t\tprovider,\n\t\t\t\t\t\"ok\",\n\t\t\t\t\t`${report.authedAs} / ${report.projectLabel} (${countResolvedLifecycle(report)})`\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"secrets\": {\n\t\t\t\tconst names = await (impl as Secrets).listSecrets({ kind: \"repo\" });\n\t\t\t\treturn mk(key, provider, \"ok\", `repo secrets: ${names.length} configured`);\n\t\t\t}\n\t\t\tcase \"ci\": {\n\t\t\t\tconst runs = await (impl as Ci).listRuns({ limit: 1 });\n\t\t\t\treturn mk(\n\t\t\t\t\tkey,\n\t\t\t\t\tprovider,\n\t\t\t\t\t\"ok\",\n\t\t\t\t\truns.length === 0 ? \"no recent runs\" : `most recent: ${runs[0]!.workflowName} (${runs[0]!.status})`\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"vault\": {\n\t\t\t\tconst keys = await (impl as Vault).list();\n\t\t\t\treturn mk(key, provider, \"ok\", `${keys.length} keys available`);\n\t\t\t}\n\t\t\tcase \"deployment\": {\n\t\t\t\tconst projects = await (impl as Deployment).listProjects();\n\t\t\t\treturn mk(key, provider, \"ok\", `${projects.length} project(s) visible`);\n\t\t\t}\n\t\t\tcase \"environments\": {\n\t\t\t\tconst envs = await (impl as Environments).listEnvironments();\n\t\t\t\treturn mk(key, provider, \"ok\", `${envs.length} environment(s) configured`);\n\t\t\t}\n\t\t\tcase \"dns\": {\n\t\t\t\tconst dns = impl as Dns;\n\t\t\t\tif (dns.whoami) {\n\t\t\t\t\tconst who = await dns.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", `${who.zones} zone(s) visible`);\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t\t}\n\t\t\tcase \"workers\": {\n\t\t\t\tconst workers = impl as Workers;\n\t\t\t\tif (workers.whoami) {\n\t\t\t\t\tconst who = await workers.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", `${who.scripts} script(s) visible`);\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t\t}\n\t\t\tcase \"auth\": {\n\t\t\t\tconst desc = await (impl as Auth).describe();\n\t\t\t\treturn mk(key, provider, \"ok\", `provider: ${desc.provider}; env keys: ${desc.envKeys.join(\", \")}`);\n\t\t\t}\n\t\t\tcase \"errors\": {\n\t\t\t\tconst desc = await (impl as Errors).describe();\n\t\t\t\treturn mk(key, provider, \"ok\", `provider: ${desc.provider}; env keys: ${desc.envKeys.join(\", \")}`);\n\t\t\t}\n\t\t\tcase \"logs\": {\n\t\t\t\tconst logs = impl as Logs;\n\t\t\t\tconst desc = await logs.describe();\n\t\t\t\tif (logs.whoami) {\n\t\t\t\t\tconst who = await logs.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", `dataset: ${who.dataset}`);\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"ok\", `provider: ${desc.provider}; env keys: ${desc.envKeys.join(\", \")}`);\n\t\t\t}\n\t\t\tcase \"monitoring\": {\n\t\t\t\tconst monitoring = impl as Monitoring;\n\t\t\t\tif (monitoring.whoami) {\n\t\t\t\t\tconst who = await monitoring.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", who.ok ? \"token verified\" : \"token check failed\");\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t}\n\t} catch (err) {\n\t\treturn mk(key, provider, \"fail\", errorMessage(err));\n\t}\n}\n\nfunction countResolvedLifecycle(report: Awaited<ReturnType<Issues[\"doctor\"]>>): string {\n\tconst resolved = report.lifecycle.filter((l) => l.resolved).length;\n\treturn `${resolved}/${report.lifecycle.length} lifecycle slots ready`;\n}\n\nfunction mk(capability: string, provider: string, status: DoctorStatus, message: string): DoctorRow {\n\treturn { capability, provider, status, message };\n}\n","import { getLogger } from \"../../observability/logger/index.js\";\nimport { assertPluginsResolvable, type Monitoring, PluginLoader, runCheckAgainstUrl } from \"../../plugin/index.js\";\nimport type {\n\tMonitoringCheckReport,\n\tMonitoringCheckSummary,\n\tRunMonitoringCheckInput,\n} from \"./monitoring-check.type.js\";\n\nexport async function runMonitoringCheck(input: RunMonitoringCheckInput): Promise<MonitoringCheckReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"monitoring check\");\n\n\t// `get()` re-surfaces the monitoring provider's own load error (a bad\n\t// token, a constructor throw, …) when it was configured but failed to\n\t// load — never swallowed behind a generic \"not configured\" message,\n\t// which would send an operator chasing the wrong fix.\n\tconst monitoring = loader.get(\"monitoring\") as Monitoring;\n\tconst run = input.runCheck ?? runCheckAgainstUrl;\n\n\tprint(`Holocron monitoring check — against ${input.url}`);\n\n\tif (monitoring.checks.length === 0) {\n\t\tconst message = \"no monitoring checks configured — nothing to validate\";\n\t\tprint(`✗ ${message}`);\n\t\tlogger.warn({ url: input.url }, \"monitoring check: no checks configured\");\n\t\treturn { status: \"fail\", checks: [] };\n\t}\n\n\tconst checks: MonitoringCheckSummary[] = [];\n\tfor (const checkInput of monitoring.checks) {\n\t\tconst result = await run(checkInput, { url: input.url });\n\t\tif (result.requestError) {\n\t\t\tprint(` ✗ ${checkInput.name} (request failed: ${result.requestError})`);\n\t\t\tchecks.push({ name: checkInput.name, passed: false, failures: [], requestError: result.requestError });\n\t\t} else if (result.passed) {\n\t\t\tprint(` ✓ ${checkInput.name}`);\n\t\t\tchecks.push({ name: checkInput.name, passed: true, failures: [] });\n\t\t} else {\n\t\t\tprint(` ✗ ${checkInput.name}`);\n\t\t\tfor (const failure of result.failures) print(` ${failure}`);\n\t\t\tchecks.push({ name: checkInput.name, passed: false, failures: result.failures });\n\t\t}\n\t}\n\n\tconst failCount = checks.filter((c) => !c.passed).length;\n\tconst status = failCount === 0 ? \"ok\" : \"fail\";\n\tprint(`${status === \"ok\" ? \"✓\" : \"✗\"} ${checks.length - failCount} passed, ${failCount} failed`);\n\tlogger.info({ url: input.url, total: checks.length, failed: failCount, status }, \"monitoring check: done\");\n\treturn { status, checks };\n}\n","/**\n * `holocron new repo <type> <name>` — create a GitHub repo from a template and\n * bootstrap it by replacing all template-slug casing variants with the new\n * project name, then generate a `holocron.config.ts` from the answers given\n * during the interactive wizard.\n *\n * Flow:\n * 1. Preflight — verify `gh` CLI is available.\n * 2. Resolve type, name, description, homepage, vault/deployment/agent options.\n * 3. `gh repo create <org>/<name> --template <org>/<type>-template --private --clone`\n * → clones to `<cwd>/<name>/`\n * 4. Detect template slug from cloned package.json.\n * 5. Replace all casing variants of the slug across every text file.\n * 6. Replace `<description>` and `<homepage>` placeholders.\n * 7. Generate and write `holocron.config.ts` based on wizard answers.\n * 8. Commit the patched files (-s for DCO).\n * 9. Unless --no-verify: `pnpm install` in the new repo.\n * 10. Print next steps.\n */\n\nimport { execFileSync, spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { walkFilesSync } from \"@theholocron/fs-utils\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { env } from \"../../env/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type { HolocronConfigOptions, NewReport, RunNewInput } from \"./new.type.js\";\n\nexport class NewError extends Error {\n\toverride name = \"NewError\";\n}\n\n// ── Case derivation ───────────────────────────────────────────────────\n\nfunction cap(word: string): string {\n\treturn word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n}\n\n/**\n * Derive all common casing variants of a kebab-case slug (e.g.\n * \"cli-template\") and map each to the corresponding form of a\n * kebab-case name (e.g. \"my-tool\").\n *\n * Returns search→replacement pairs, deduplicating single-word slugs\n * that would otherwise produce identical entries.\n */\nexport function deriveVariants(slug: string, name: string): Array<[string, string]> {\n\tconst sw = slug.split(\"-\");\n\tconst nw = name.split(\"-\");\n\n\tconst pairs: Array<[string, string]> = [\n\t\t[slug, name],\n\t\t[sw.join(\"_\"), nw.join(\"_\")],\n\t\t[sw.join(\"_\").toUpperCase(), nw.join(\"_\").toUpperCase()],\n\t\t[sw.map(cap).join(\"\"), nw.map(cap).join(\"\")],\n\t\t[sw[0]!.toLowerCase() + sw.slice(1).map(cap).join(\"\"), nw[0]!.toLowerCase() + nw.slice(1).map(cap).join(\"\")],\n\t\t[sw.map(cap).join(\" \"), nw.map(cap).join(\" \")],\n\t];\n\n\tconst seen = new Set<string>();\n\treturn pairs.filter(([s]) => {\n\t\tif (seen.has(s)) return false;\n\t\tseen.add(s);\n\t\treturn true;\n\t});\n}\n\n// ── Input helpers ─────────────────────────────────────────────────────\n\n/** Validate a repo name: must be lowercase kebab-case. Returns `true` on success or an error string. */\nexport function validateRepoName(v: string): true | string {\n\treturn /^[a-z][a-z0-9-]*$/.test(v.trim()) ? true : \"Must be lowercase kebab-case (e.g. my-tool)\";\n}\n\n/** Parse a comma-separated topics string into a trimmed, non-empty array. */\nexport function parseTopics(raw: string | undefined): string[] {\n\treturn raw\n\t\t? String(raw)\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((t) => t.trim())\n\t\t\t\t.filter(Boolean)\n\t\t: [];\n}\n\n/**\n * Generate the content of `holocron.config.ts` for a newly-scaffolded repo.\n * Uses the `node()` preset from `@theholocron/holocron-config` as the baseline\n * and layers in the provider/agent choices made during the wizard.\n */\nexport function generateHolocronConfig(opts: HolocronConfigOptions): string {\n\tconst lines: string[] = [\n\t\t`import { defineConfig } from \"@theholocron/cli\";`,\n\t\t`import { compose, node, typecheck } from \"@theholocron/holocron-config\";`,\n\t\t``,\n\t\t// `compose(node(), typecheck())` is the org baseline preset — the full\n\t\t// task manifest (lint/test/typecheck required, security/review/… ) rides\n\t\t// in via `...preset`, so `holocron repo setup` can derive CodeQL mode and the\n\t\t// required-check contexts. See theholocron/holocron#642.\n\t\t`const preset = compose(node(), typecheck());`,\n\t\t`export default defineConfig({`,\n\t\t`\\t...preset,`,\n\t];\n\n\tif (opts.description) lines.push(`\\tdescription: ${JSON.stringify(opts.description)},`);\n\tif (opts.homepage) lines.push(`\\thomepage: ${JSON.stringify(opts.homepage)},`);\n\n\tconst topics = opts.topics?.length ? opts.topics : [];\n\tconst hasRuntimeOverride = opts.runtimeEnvironment != null && opts.runtimeEnvironment !== \"node\";\n\tconst hasFullRepo = opts.org != null;\n\n\tif (hasFullRepo) {\n\t\t// Full explicit repo block when org is known (always the case from the CLI).\n\t\tconst repoName = `${opts.org}/${opts.name}`;\n\t\tlines.push(`\\trepo: {`);\n\t\tlines.push(`\\t\\t...preset.repo,`);\n\t\tlines.push(`\\t\\tname: ${JSON.stringify(repoName)},`);\n\t\tlines.push(`\\t\\tteams: [{ slug: \"gatekeepers\", permission: \"maintain\" }],`);\n\t\tlines.push(`\\t\\ttopics: ${JSON.stringify(topics)},`);\n\t\tif (opts.protection && opts.protection !== \"strict\") {\n\t\t\tlines.push(`\\t\\tprotection: ${JSON.stringify(opts.protection)},`);\n\t\t}\n\t\tconst propParts: string[] = [];\n\t\tif (hasRuntimeOverride) propParts.push(`runtime_environment: ${JSON.stringify(opts.runtimeEnvironment)}`);\n\t\tif (opts.openSource === false) propParts.push(`open_source: false`);\n\t\tif (opts.usesExternalPackages === false) propParts.push(`uses_external_packages: false`);\n\t\tif (propParts.length > 0) {\n\t\t\tlines.push(`\\t\\tproperties: { ...preset.repo?.properties, ${propParts.join(\", \")} },`);\n\t\t}\n\t\tlines.push(`\\t},`);\n\t} else if (topics.length > 0 || hasRuntimeOverride) {\n\t\tlines.push(`\\trepo: {`);\n\t\tlines.push(`\\t\\t...preset.repo,`);\n\t\tif (topics.length > 0) lines.push(`\\t\\ttopics: ${JSON.stringify(topics)},`);\n\t\tif (hasRuntimeOverride) {\n\t\t\tlines.push(\n\t\t\t\t`\\t\\tproperties: { ...preset.repo?.properties, runtime_environment: ${JSON.stringify(opts.runtimeEnvironment)} },`\n\t\t\t);\n\t\t}\n\t\tlines.push(`\\t},`);\n\t}\n\t// else: `...preset` already carries `repo` — no explicit block needed.\n\n\tconst hasVault = opts.vaultProvider && opts.vaultProvider !== \"none\";\n\tconst hasDeployment = opts.deploymentProvider && opts.deploymentProvider !== \"none\";\n\n\tif (hasVault || hasDeployment) {\n\t\tlines.push(`\\tproviders: {`);\n\t\tlines.push(`\\t\\t...preset.providers,`);\n\t\tif (opts.vaultProvider === \"doppler\") {\n\t\t\tconst proj = JSON.stringify(opts.vaultProject ?? opts.name);\n\t\t\tconst cfg = JSON.stringify(opts.vaultConfig ?? \"dev\");\n\t\t\tlines.push(`\\t\\tvault: [\"doppler\", { project: ${proj}, config: ${cfg} }],`);\n\t\t} else if (opts.vaultProvider === \"1password\") {\n\t\t\tconst vault = JSON.stringify(opts.vaultProject ?? opts.name);\n\t\t\tlines.push(`\\t\\tvault: [\"1password\", { vault: ${vault} }],`);\n\t\t} else if (opts.vaultProvider === \"infisical\") {\n\t\t\tconst proj = JSON.stringify(opts.vaultProject ?? opts.name);\n\t\t\tlines.push(`\\t\\tvault: [\"infisical\", { project: ${proj} }],`);\n\t\t}\n\t\tif (opts.deploymentProvider === \"vercel\") {\n\t\t\tlines.push(`\\t\\tdeployment: \"vercel\",`);\n\t\t}\n\t\tlines.push(`\\t},`);\n\t}\n\t// else: `...preset` already carries `providers`.\n\n\tif (opts.agent && opts.agent !== \"none\") {\n\t\tlines.push(`\\tagent: ${JSON.stringify(opts.agent)},`);\n\t}\n\n\tif (opts.skills?.length) {\n\t\tlines.push(`\\tskills: ${JSON.stringify(opts.skills)},`);\n\t}\n\n\tlines.push(`});`);\n\tlines.push(``);\n\n\treturn lines.join(\"\\n\");\n}\n\n// ── File discovery ────────────────────────────────────────────────────\n\nconst SKIP_DIRS = [\".git\", \"node_modules\", \"dist\", \".turbo\"];\n\nconst defaultWalkFiles = (dir: string): string[] => walkFilesSync(dir, { skip: SKIP_DIRS });\n\nfunction isBinary(content: string): boolean {\n\tfor (let i = 0; i < Math.min(content.length, 8000); i++) {\n\t\tif (content.charCodeAt(i) === 0) return true;\n\t}\n\treturn false;\n}\n\n// ── Patching ──────────────────────────────────────────────────────────\n\nfunction patchFiles(\n\tdir: string,\n\tvariants: Array<[string, string]>,\n\tdescription: string | undefined,\n\thomepage: string | undefined,\n\truntimeEnvironment: string | undefined,\n\tprint: (line: string) => void,\n\treadFn: (p: string) => string,\n\twriteFn: (p: string, c: string) => void,\n\twalkFn: (d: string) => string[]\n): string[] {\n\tconst patched: string[] = [];\n\tfor (const filepath of walkFn(dir)) {\n\t\tlet content: string;\n\t\ttry {\n\t\t\tcontent = readFn(filepath);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (isBinary(content)) continue;\n\n\t\tconst original = content;\n\t\tfor (const [search, replacement] of variants) {\n\t\t\tcontent = content.split(search).join(replacement);\n\t\t}\n\t\tif (description !== undefined) {\n\t\t\tcontent = content.split(\"<description>\").join(description);\n\t\t\t// Also replace the content of <!-- holocron:description --> blocks so\n\t\t\t// the README description marker is updated even when the template has\n\t\t\t// real prose rather than a bare <description> placeholder.\n\t\t\tcontent = content.replace(\n\t\t\t\t/(<!-- holocron:description -->)[\\s\\S]*?(<!-- \\/holocron:description -->)/g,\n\t\t\t\t`$1\\n${description}\\n$2`\n\t\t\t);\n\t\t}\n\t\tif (homepage !== undefined) {\n\t\t\tcontent = content.split(\"<homepage>\").join(homepage);\n\t\t}\n\t\tif (runtimeEnvironment !== undefined) {\n\t\t\tcontent = content.split(\"<runtime_environment>\").join(runtimeEnvironment);\n\t\t}\n\t\t// Strip template-only blocks — sections relevant only to the template\n\t\t// repo itself (e.g. \"Getting Started\" scaffolding instructions) that\n\t\t// should not appear in projects generated from the template.\n\t\tcontent = content.replace(\n\t\t\t/\\n?<!-- holocron:template-only -->[\\s\\S]*?<!-- \\/holocron:template-only -->\\n?/g,\n\t\t\t\"\"\n\t\t);\n\n\t\tif (content !== original) {\n\t\t\twriteFn(filepath, content);\n\t\t\tprint(` ✓ ${path.relative(dir, filepath)}`);\n\t\t\tpatched.push(filepath);\n\t\t}\n\t}\n\treturn patched;\n}\n\n// ── Preflight ─────────────────────────────────────────────────────────\n\nfunction preflight(): void {\n\tconst result = spawnSync(\"gh\", [\"--version\"], { encoding: \"utf8\" });\n\tif (result.error != null || result.status !== 0) {\n\t\tthrow new NewError(\"`gh` CLI is not installed or not on PATH. Install it from https://cli.github.com\");\n\t}\n}\n\n// ── Defaults ──────────────────────────────────────────────────────────\n\nfunction defaultExec(\n\tcmd: string,\n\targs: string[],\n\topts: { cwd: string; stdio: \"inherit\"; env?: Record<string, string> }\n): void {\n\texecFileSync(cmd, args, {\n\t\tcwd: opts.cwd,\n\t\tstdio: opts.stdio,\n\t\t...(opts.env && Object.keys(opts.env).length > 0 ? { env: { ...process.env, ...opts.env } } : {}),\n\t});\n}\n\nfunction keychainLookup(key: string): string | undefined {\n\tconst result = spawnSync(\"security\", [\"find-generic-password\", \"-s\", \"com.theholocron.cli\", \"-a\", key, \"-w\"], {\n\t\tencoding: \"utf8\",\n\t});\n\treturn result.status === 0 ? result.stdout?.trim() || undefined : undefined;\n}\n\nfunction defaultReadFile(filepath: string): string {\n\treturn readFileSync(filepath, \"utf-8\");\n}\n\nfunction defaultWriteFile(filepath: string, content: string): void {\n\tmkdirSync(path.dirname(filepath), { recursive: true });\n\twriteFileSync(filepath, content, \"utf-8\");\n}\n\n// ── Orchestrator ──────────────────────────────────────────────────────\n\nexport async function runNew(input: RunNewInput): Promise<NewReport> {\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst org = input.org ?? \"theholocron\";\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst execFn = input.exec ?? defaultExec;\n\tconst readFn = input.readFile ?? defaultReadFile;\n\tconst writeFn = input.writeFile ?? defaultWriteFile;\n\tconst walkFn = input.walkFiles ?? defaultWalkFiles;\n\n\tpreflight();\n\n\tconst templateRepo = `${org}/${input.type}-template`;\n\tconst newRepo = `${org}/${input.name}`;\n\tconst repoDir = path.join(cwd, input.name);\n\tlogger.info({ repo: newRepo, template: templateRepo, dryRun: input.dryRun || undefined }, \"new: start\");\n\n\tif (input.dryRun) {\n\t\tprint(` Would create ${newRepo} from template ${templateRepo}`);\n\t\tprint(` Would clone to ${repoDir}`);\n\t\tprint(` Would patch all casing variants of \"${input.type}-template\" → \"${input.name}\"`);\n\t\tif (input.description) print(` Would replace <description> → \"${input.description}\"`);\n\t\tif (input.homepage) print(` Would replace <homepage> → \"${input.homepage}\"`);\n\t\tif (input.runtimeEnvironment) print(` Would replace <runtime_environment> → \"${input.runtimeEnvironment}\"`);\n\t\tprint(` Would generate holocron.config.ts`);\n\t\tlogger.info({ repo: newRepo, status: \"dry-run\" }, \"new: done\");\n\t\treturn { status: \"dry-run\" };\n\t}\n\n\tif (existsSync(repoDir)) {\n\t\tthrow new NewError(`\\`${repoDir}\\` already exists — delete it or pick a different name.`);\n\t}\n\n\tprint(` Creating ${newRepo} from template ${templateRepo}…`);\n\tconst visibility = input.openSource ? \"--public\" : \"--private\";\n\ttry {\n\t\texecFn(\"gh\", [\"repo\", \"create\", newRepo, `--template=${templateRepo}`, visibility, \"--clone\"], {\n\t\t\tcwd,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t} catch (err) {\n\t\tthrow new NewError(`gh repo create failed: ${errorMessage(err)}`);\n\t}\n\n\tif (input.isTemplate) {\n\t\ttry {\n\t\t\texecFn(\"gh\", [\"repo\", \"edit\", newRepo, \"--template=true\"], { cwd, stdio: \"inherit\" });\n\t\t} catch {\n\t\t\t// non-fatal — template flag can be set manually in repo settings\n\t\t}\n\t}\n\n\t// gh repo create --template does not reliably honor --public/--private on all\n\t// plan/org combinations, so set visibility explicitly after creation.\n\ttry {\n\t\texecFn(\"gh\", [\"repo\", \"edit\", newRepo, `--visibility=${input.openSource ? \"public\" : \"private\"}`], {\n\t\t\tcwd,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t} catch {\n\t\t// non-fatal — visibility can be changed manually in repo settings\n\t}\n\n\t// Detect template slug from cloned package.json\n\tlet templateSlug = `${input.type}-template`;\n\tconst pkgJsonPath = path.join(repoDir, \"package.json\");\n\tif (existsSync(pkgJsonPath)) {\n\t\ttry {\n\t\t\tconst pkg = JSON.parse(readFn(pkgJsonPath)) as { name?: string };\n\t\t\tif (typeof pkg.name === \"string\") {\n\t\t\t\ttemplateSlug = pkg.name.split(\"/\").at(-1) || templateSlug;\n\t\t\t}\n\t\t} catch {\n\t\t\t// fall back to derived slug\n\t\t}\n\t}\n\n\tprint(` Detected template slug: ${templateSlug}`);\n\tprint(` Patching files…`);\n\n\tconst variants = deriveVariants(templateSlug, input.name);\n\t// Prepend the full org/slug pair so GitHub URLs and scoped package names\n\t// use the correct org. Must come before the slug-only pairs so it takes\n\t// priority — e.g. \"@theholocron/node-template\" becomes \"@<org>/<name>\"\n\t// rather than \"@theholocron/<name>\".\n\tvariants.unshift([`theholocron/${templateSlug}`, `${org}/${input.name}`]);\n\tconst filesPatched = patchFiles(\n\t\trepoDir,\n\t\tvariants,\n\t\tinput.description,\n\t\tinput.homepage,\n\t\tinput.runtimeEnvironment,\n\t\tprint,\n\t\treadFn,\n\t\twriteFn,\n\t\twalkFn\n\t);\n\n\tprint(` ${filesPatched.length} file${filesPatched.length === 1 ? \"\" : \"s\"} patched`);\n\n\t// Always overwrite description and homepage in package.json directly,\n\t// regardless of whether the template used placeholders or real values.\n\tif (input.description !== undefined || input.homepage !== undefined) {\n\t\ttry {\n\t\t\tconst raw = readFn(pkgJsonPath);\n\t\t\tconst pkg = JSON.parse(raw) as Record<string, unknown>;\n\t\t\tif (input.description !== undefined) pkg[\"description\"] = input.description;\n\t\t\tif (input.homepage !== undefined) pkg[\"homepage\"] = input.homepage;\n\t\t\twriteFn(pkgJsonPath, stringifyJson(pkg, { like: raw }));\n\t\t\tprint(` ✓ package.json (description/homepage)`);\n\t\t} catch {\n\t\t\t// non-fatal — placeholder replacement already covered it\n\t\t}\n\t}\n\n\t// Update the root tsconfig.json \"display\" field by parsing the JSON directly\n\t// rather than relying on a <display_name> placeholder. Templates can use their\n\t// real human-readable display name; we always overwrite it with the title-case\n\t// of the new repo name on scaffolding.\n\tconst displayName = input.name.split(\"-\").map(cap).join(\" \");\n\tconst rootTsconfigPath = path.join(repoDir, \"tsconfig.json\");\n\ttry {\n\t\tconst rawTsconfig = readFn(rootTsconfigPath);\n\t\tconst tsconfig = JSON.parse(rawTsconfig) as Record<string, unknown>;\n\t\tif (typeof tsconfig[\"display\"] === \"string\") {\n\t\t\ttsconfig[\"display\"] = displayName;\n\t\t\twriteFn(rootTsconfigPath, stringifyJson(tsconfig, { like: rawTsconfig }));\n\t\t\tprint(` ✓ tsconfig.json (display)`);\n\t\t}\n\t} catch {\n\t\t// non-fatal — no tsconfig or no display field\n\t}\n\n\t// Generate and write holocron.config.ts\n\tconst configContent = generateHolocronConfig({\n\t\tname: input.name,\n\t\ttype: input.type,\n\t\torg,\n\t\tdescription: input.description,\n\t\thomepage: input.homepage,\n\t\tvaultProvider: input.vaultProvider,\n\t\tvaultProject: input.vaultProject,\n\t\tvaultConfig: input.vaultConfig,\n\t\tdeploymentProvider: input.deploymentProvider,\n\t\tagent: input.agent,\n\t\truntimeEnvironment: input.runtimeEnvironment,\n\t\tprotection: input.protection,\n\t\topenSource: input.openSource,\n\t\tusesExternalPackages: input.usesExternalPackages,\n\t\ttopics: input.topics,\n\t\tskills: input.skills,\n\t});\n\tconst configPath = path.join(repoDir, \"holocron.config.ts\");\n\twriteFn(configPath, configContent);\n\tprint(` Generated holocron.config.ts`);\n\n\texecFn(\"git\", [\"add\", \"-A\"], { cwd: repoDir, stdio: \"inherit\" });\n\texecFn(\"git\", [\"commit\", \"-s\", \"-m\", `chore: bootstrap from ${templateSlug}`], {\n\t\tcwd: repoDir,\n\t\tstdio: \"inherit\",\n\t});\n\n\tif (!input.noVerify) {\n\t\tprint(\"\");\n\t\tprint(\" Installing dependencies…\");\n\t\ttry {\n\t\t\texecFn(\"pnpm\", [\"install\"], { cwd: repoDir, stdio: \"inherit\" });\n\t\t} catch (err) {\n\t\t\tprint(` ✗ pnpm install failed — ${errorMessage(err)}`);\n\t\t\treturn {\n\t\t\t\tstatus: \"fail\",\n\t\t\t\trepoDir,\n\t\t\t\tfilesPatched,\n\t\t\t\tmessage: \"pnpm install failed; inspect output above\",\n\t\t\t};\n\t\t}\n\n\t\tprint(\"\");\n\t\tprint(\" Running holocron repo setup…\");\n\t\ttry {\n\t\t\tconst setupArgs: string[] = [\"setup\"];\n\t\t\tconst setupEnv: Record<string, string> = {};\n\n\t\t\t// Admin token: drives rulesets, repo settings, workflows, Pages.\n\t\t\t// Prefer the value forwarded via --token; fall back to keychain.\n\t\t\tconst adminToken = input.token ?? keychainLookup(\"github.admin\");\n\t\t\tif (adminToken) setupArgs.push(\"--token\", adminToken);\n\n\t\t\t// Org token: drives team assignments and custom properties.\n\t\t\t// Skip keychain if already in env (subprocess inherits it anyway).\n\t\t\tif (!env.get(\"HOLOCRON_ORG_TOKEN\")) {\n\t\t\t\tconst orgToken = keychainLookup(\"github.org\");\n\t\t\t\tif (orgToken) setupEnv[\"HOLOCRON_ORG_TOKEN\"] = orgToken;\n\t\t\t}\n\n\t\t\t// Deploy token: drives GitHub Pages configuration.\n\t\t\tif (!env.get(\"HOLOCRON_DEPLOY_TOKEN\")) {\n\t\t\t\tconst deployToken = keychainLookup(\"github.deploy\");\n\t\t\t\tif (deployToken) setupEnv[\"HOLOCRON_DEPLOY_TOKEN\"] = deployToken;\n\t\t\t}\n\n\t\t\texecFn(\"holocron\", setupArgs, { cwd: repoDir, stdio: \"inherit\", env: setupEnv });\n\t\t} catch {\n\t\t\tprint(\" ✗ holocron repo setup failed — run it manually after checking your config\");\n\t\t}\n\t}\n\n\tprint(\"\");\n\tprint(` Scaffolded ${newRepo} (${filesPatched.length} file${filesPatched.length === 1 ? \"\" : \"s\"} patched).`);\n\tprint(\"\");\n\tprint(\" Next:\");\n\tprint(` 1. cd ${repoDir}`);\n\tif (input.noVerify) {\n\t\tprint(` 2. pnpm install`);\n\t\tprint(` 3. holocron repo setup # wire up secrets, teams, labels, etc.`);\n\t\tprint(` 4. git push -u origin HEAD`);\n\t} else {\n\t\tprint(` 2. git push -u origin HEAD`);\n\t}\n\n\tlogger.info({ repo: newRepo, repoDir, filesPatched, status: \"ok\" }, \"new: done\");\n\treturn { status: \"ok\", repoDir, filesPatched };\n}\n","import { readdirSync, readFileSync, statSync, writeFileSync } from \"node:fs\";\nimport { join, relative, resolve } from \"node:path\";\n\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { listWorkspacePackagesSync } from \"@theholocron/pkg-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type { NpmBumpVersionsReport, RunNpmBumpVersionsInput } from \"./npm-bump-versions.type.js\";\n\nexport async function runNpmBumpVersions(input: RunNpmBumpVersionsInput): Promise<NpmBumpVersionsReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst { version, dryRun = false } = input;\n\tconst readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\tconst writeFile = input.writeFile ?? ((p: string, c: string) => writeFileSync(p, c));\n\tconst listDir = input.listDir ?? ((p: string) => readdirSync(p) as string[]);\n\tconst isDir = input.isDir ?? ((p: string) => statSync(p).isDirectory());\n\n\tconst bumped: string[] = [];\n\tconst skipped: string[] = [];\n\n\tprint(`Bumping monorepo to ${version}${dryRun ? \" (dry-run)\" : \"\"}…`);\n\tlogger.info({ version, dryRun: dryRun || undefined }, \"npm bump-versions: start\");\n\n\tfunction bumpFile(absPath: string, label: string): void {\n\t\tlet pkg: Record<string, unknown>;\n\t\tlet raw: string;\n\t\ttry {\n\t\t\traw = readFile(absPath);\n\t\t\tpkg = JSON.parse(raw) as Record<string, unknown>;\n\t\t} catch {\n\t\t\tprint(` ✗ could not parse ${label}`);\n\t\t\treturn;\n\t\t}\n\t\tconst old = pkg.version as string;\n\t\tif (!dryRun) {\n\t\t\tpkg.version = version;\n\t\t\twriteFile(absPath, stringifyJson(pkg, { like: raw }));\n\t\t}\n\t\tprint(` ${dryRun ? \"~\" : \"✓\"} ${label}: ${old} → ${version}`);\n\t\tbumped.push(label);\n\t}\n\n\t// Root is always bumped — private means \"don't publish\", not \"don't version\".\n\tbumpFile(join(cwd, \"package.json\"), \"root\");\n\n\t// Each root no-ops safely when its dir doesn't exist — a single-package\n\t// repo with neither just gets the root bump.\n\tconst listed = new Set<string>();\n\tconst workspace = listWorkspacePackagesSync(cwd, {\n\t\treadFile,\n\t\tlistDirs: (dir) => {\n\t\t\tlet names: string[];\n\t\t\ttry {\n\t\t\t\tnames = listDir(dir);\n\t\t\t} catch {\n\t\t\t\tthrow Object.assign(new Error(`ENOENT: ${dir}`), { code: \"ENOENT\" });\n\t\t\t}\n\t\t\treturn names.filter((name) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (!isDir(join(dir, name))) return false;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tlisted.add(join(dir, name));\n\t\t\t\treturn true;\n\t\t\t});\n\t\t},\n\t});\n\tconst found = new Set(workspace.map((entry) => entry.dir));\n\tfor (const dir of listed) {\n\t\tif (!found.has(dir)) print(` ! skipping ${relative(resolve(cwd), dir)}: no package.json or malformed JSON`);\n\t}\n\tfor (const { dir, relativeDir, manifest } of workspace) {\n\t\tif (manifest.private) {\n\t\t\tprint(` · skipping private package ${relativeDir}`);\n\t\t\tskipped.push(relativeDir);\n\t\t\tcontinue;\n\t\t}\n\t\tbumpFile(join(dir, \"package.json\"), relativeDir);\n\t}\n\n\tconst status = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ version, status, bumped: bumped.length, skipped: skipped.length }, \"npm bump-versions: done\");\n\treturn { status, bumped, skipped };\n}\n","/**\n * Shared input record for every template module.\n *\n * Every template exports `(inputs: TemplateInputs) => string` and reads\n * from this record. Keeping the surface small + typechecked lets the\n * templates stay dumb string builders while the command layer handles\n * normalization + defaulting from user input.\n */\n\nimport type { CapabilityKey } from \"../../../plugin/index.js\";\nimport type { TemplateInputs } from \"./template-inputs.type.js\";\n\n/** Derive the standard defaults from a slug + vendor name. */\nexport function deriveDefaults(input: {\n\tslug: string;\n\tvendorName: string;\n\tcapability: CapabilityKey;\n}): Pick<TemplateInputs, \"vendorUpper\" | \"capabilityClass\" | \"tokenEnv\" | \"transport\"> {\n\tconst vendorUpper = input.slug.toUpperCase().replace(/-/g, \"_\");\n\tconst capability = input.capability;\n\tconst capabilityClass = `${input.vendorName}${capability.charAt(0).toUpperCase() + capability.slice(1)}`;\n\treturn {\n\t\tvendorUpper,\n\t\tcapabilityClass,\n\t\ttokenEnv: `HOLOCRON_${vendorUpper}_TOKEN`,\n\t\ttransport: \"rest\",\n\t};\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `import { AuthError, createResolveToken, type ResolveTokenInput } from \"@theholocron/cli\";\n\nexport { AuthError };\nexport type { ResolveTokenInput };\n\nexport const resolveToken = createResolveToken({\n\\tenvName: \"${inputs.tokenEnv}\",\n\\tvendorEnvName: \"${inputs.vendorEnv}\",\n\\tkeyringService: \"${inputs.slug}\",\n\\terrorMessage:\n\\t\\t\"no ${inputs.vendorName} token found. Pass --token <TOKEN>, set ${inputs.tokenEnv} / ${inputs.vendorEnv}, \" +\n\\t\\t\"or run: holocron auth set ${inputs.slug} <TOKEN>\",\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { AuthError, resolveToken } from \"../auth.js\";\n\nconst noKeyring = () => null;\n\ndescribe(\"resolveToken\", () => {\n\tit(\"prefers --token over env vars + keyring\", () => {\n\t\texpect(\n\t\t\tresolveToken({\n\t\t\t\tcliToken: \"flag\",\n\t\t\t\tenv: { ${inputs.tokenEnv}: \"hlc\", ${inputs.vendorEnv}: \"vendor\" },\n\t\t\t\tkeyring: () => \"kr\",\n\t\t\t})\n\t\t).toBe(\"flag\");\n\t});\n\n\tit(\"prefers ${inputs.tokenEnv} over ${inputs.vendorEnv}\", () => {\n\t\texpect(\n\t\t\tresolveToken({\n\t\t\t\tenv: { ${inputs.tokenEnv}: \"hlc\", ${inputs.vendorEnv}: \"vendor\" },\n\t\t\t\tkeyring: noKeyring,\n\t\t\t})\n\t\t).toBe(\"hlc\");\n\t});\n\n\tit(\"falls back to ${inputs.vendorEnv} when ${inputs.tokenEnv} is unset\", () => {\n\t\texpect(resolveToken({ env: { ${inputs.vendorEnv}: \"vendor\" }, keyring: noKeyring })).toBe(\"vendor\");\n\t});\n\n\tit(\"falls back to keyring when env vars are unset\", () => {\n\t\texpect(resolveToken({ env: {}, keyring: (p) => (p === \"${inputs.slug}\" ? \"kr\" : null) })).toBe(\"kr\");\n\t});\n\n\tit(\"throws AuthError with a helpful message when nothing is set\", () => {\n\t\tconst err = (() => {\n\t\t\ttry {\n\t\t\t\tresolveToken({ env: {}, keyring: noKeyring });\n\t\t\t} catch (e) {\n\t\t\t\treturn e;\n\t\t\t}\n\t\t})();\n\t\texpect(err).toBeInstanceOf(AuthError);\n\t\texpect((err as Error).message).toMatch(/${inputs.tokenEnv}/);\n\t\texpect((err as Error).message).toMatch(/holocron auth set ${inputs.slug}/);\n\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst clientClass = `${inputs.vendorName}RestClient`;\n\tconst capabilityInterface = inputs.capability.charAt(0).toUpperCase() + inputs.capability.slice(1);\n\treturn `/**\n * \\`${inputs.capability}\\` capability for ${inputs.vendorName}.\n *\n * Methods are STUBS — implement them against ${inputs.vendorName}'s\n * REST API per the \\`${capabilityInterface}\\` interface contract in\n * \\`@theholocron/cli\\`.\n *\n * TODO once you've stubbed the interface methods, restore the type\n * import + \\`implements\\` clause:\n * import type { ${capabilityInterface} } from \"@theholocron/cli\";\n * export class ${inputs.capabilityClass} implements ${capabilityInterface} { ... }\n */\n\nimport type { ${clientClass} } from \"../rest.js\";\n\nexport class ${inputs.capabilityClass} {\n\treadonly key = \"${inputs.capability}\" as const;\n\treadonly providerName = \"${inputs.slug}\";\n\n\tconstructor(private readonly rest: () => ${clientClass}) {}\n\n\t// TODO: implement the ${capabilityInterface} interface methods\n\t// (see \\`packages/cli/src/capabilities/index.ts\\`). Each method\n\t// should hit a specific ${inputs.vendorName} REST endpoint via\n\t// \\`this.rest().request(...)\\` — call the thunk so the token is\n\t// resolved lazily. Once methods are stubbed, add\n\t// \\`implements ${capabilityInterface}\\` to the class declaration\n\t// above and remove the \\`as unknown as\\` cast in src/index.ts.\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { ${inputs.capabilityClass} } from \"../capabilities/${inputs.capability}.js\";\nimport { ${factoryName} } from \"../rest.js\";\nimport { stubFetch } from \"./helpers.js\";\n\n// Stub client used by the constructor smoke test. Real capability\n// tests replace this with per-method stubs once implementations land.\nfunction makeCapability() {\n\tconst stub = stubFetch([]);\n\tconst rest = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\treturn new ${inputs.capabilityClass}(() => rest);\n}\n\ndescribe(\"${inputs.capabilityClass}\", () => {\n\tit(\"constructs with a REST client\", () => {\n\t\texpect(makeCapability().key).toBe(\"${inputs.capability}\");\n\t});\n\n\t// TODO: implement one test per ${inputs.capability} capability method\n\t// as you fill in the class stubs. See other plugins for reference\n\t// patterns:\n\t// - REST behaviors (URL / method / body / query) via \\`stub.calls\\`\n\t// - Error paths via \\`stubFetch([{ status: 4xx, body: {...} }])\\`\n\t// - Idempotency (409 handling for ensure* methods, if applicable)\n\tit.todo(\"implement per-method tests\");\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import type { Linter } from \"eslint\";\n\nimport root from \"../../eslint.config.js\";\n\nexport default [...root, { ignores: [\"dist/**\", \"coverage/**\"] }] satisfies Linter.Config[];\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { vi, type Mock } from \"vitest\";\n\nexport interface FetchCall {\n\turl: string;\n\tmethod: string;\n\theaders: Record<string, string>;\n\tbody: unknown;\n}\n\nexport interface FetchStub {\n\tfetch: typeof fetch;\n\tcalls: FetchCall[];\n\tmock: Mock;\n}\n\nexport function stubFetch(responses: Array<{ status?: number; body?: unknown; text?: string }>): FetchStub {\n\tconst calls: FetchCall[] = [];\n\tlet i = 0;\n\tconst mock = vi.fn(async (input: string | URL, init?: RequestInit) => {\n\t\tconst url = typeof input === \"string\" ? input : input.toString();\n\t\tconst body = typeof init?.body === \"string\" ? safeJsonParse(init.body) : (init?.body ?? null);\n\t\tcalls.push({\n\t\t\turl,\n\t\t\tmethod: (init?.method ?? \"GET\").toUpperCase(),\n\t\t\theaders: (init?.headers as Record<string, string>) ?? {},\n\t\t\tbody,\n\t\t});\n\t\tconst next = responses[i++] ?? { status: 200, body: {} };\n\t\tconst status = next.status ?? 200;\n\t\tif (status === 204 || status === 205 || status === 304) {\n\t\t\treturn new Response(null, { status });\n\t\t}\n\t\tconst text = next.text ?? (typeof next.body === \"string\" ? next.body : JSON.stringify(next.body ?? {}));\n\t\treturn new Response(text, { status });\n\t});\n\treturn { fetch: mock as unknown as typeof fetch, calls, mock };\n}\n\nfunction safeJsonParse(s: string): unknown {\n\ttry {\n\t\treturn JSON.parse(s);\n\t} catch {\n\t\treturn s;\n\t}\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { AUTH_HINT, createPlugin } from \"../index.js\";\nimport { stubFetch } from \"./helpers.js\";\n\ndescribe(\"createPlugin\", () => {\n\tit(\"wires the ${inputs.capability} capability against the given fetch + token\", () => {\n\t\tconst stub = stubFetch([]);\n\t\tconst plugin = createPlugin({\n\t\t\tcliToken: \"test-token\",\n\t\t\tfetch: stub.fetch,\n\t\t});\n\t\texpect(plugin.name).toBe(\"@theholocron/holocron-plugin-${inputs.slug}\");\n\t\texpect(typeof plugin.capabilities.${inputs.capability}).toBe(\"function\");\n\t});\n});\n\ndescribe(\"AUTH_HINT\", () => {\n\tit(\"mentions the holocron auth set command\", () => {\n\t\texpect(AUTH_HINT).toMatch(/holocron auth set ${inputs.slug}/);\n\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst keywords = [inputs.capability, \"holocron\", \"plugin\", inputs.slug].sort((a, b) => a.localeCompare(b));\n\treturn (\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tname: `@theholocron/holocron-plugin-${inputs.slug}`,\n\t\t\t\tversion: \"2.0.0-alpha.1\",\n\t\t\t\tdescription: `Holocron plugin for ${inputs.vendorName}. Implements the ${inputs.capability} capability against ${inputs.vendorName}'s REST API, plus exports verifyToken + AUTH_HINT for \\`holocron auth\\`.`,\n\t\t\t\tkeywords,\n\t\t\t\thomepage: `https://github.com/theholocron/holocron/tree/main/plugins/holocron-plugin-${inputs.slug}#readme`,\n\t\t\t\tbugs: \"https://github.com/theholocron/holocron/issues\",\n\t\t\t\trepository: {\n\t\t\t\t\ttype: \"git\",\n\t\t\t\t\turl: \"git+https://github.com/theholocron/holocron.git\",\n\t\t\t\t\tdirectory: `plugins/holocron-plugin-${inputs.slug}`,\n\t\t\t\t},\n\t\t\t\tlicense: \"MIT\",\n\t\t\t\tauthor: \"Newton Koumantzelis\",\n\t\t\t\tsideEffects: false,\n\t\t\t\ttype: \"module\",\n\t\t\t\texports: {\n\t\t\t\t\t\".\": {\n\t\t\t\t\t\ttypes: \"./dist/index.d.mts\",\n\t\t\t\t\t\timport: \"./dist/index.mjs\",\n\t\t\t\t\t\tdefault: \"./dist/index.mjs\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tscripts: {\n\t\t\t\t\t// delivery.build stays a direct tool invocation, never `holocron\n\t\t\t\t\t// run` — it's what produces the holocron binary, so it can never\n\t\t\t\t\t// depend on holocron already existing. The other three tasks are\n\t\t\t\t\t// safe to gateway through holocron: this template already\n\t\t\t\t\t// declares @theholocron/cli as a real devDependency below, giving\n\t\t\t\t\t// turbo the edge it needs to build cli (and transitively\n\t\t\t\t\t// astromech) before this package's own script ever runs.\n\t\t\t\t\t\"delivery.build\": \"tsdown\",\n\t\t\t\t\t\"sourceQuality.staticAnalysis\": \"holocron run sourceQuality.staticAnalysis --\",\n\t\t\t\t\t\"verification.typeSafety\": \"holocron run verification.typeSafety --\",\n\t\t\t\t\t\"verification.unitTests\": \"holocron run verification.unitTests --\",\n\t\t\t\t\t\"test:watch\": \"vitest\",\n\t\t\t\t\tvalidate: \"tsx scripts/validate.mjs\",\n\t\t\t\t},\n\t\t\t\tpeerDependencies: { \"@theholocron/cli\": \"workspace:*\", \"@theholocron/misc-utils\": \"catalog:utils\" },\n\t\t\t\tdevDependencies: {\n\t\t\t\t\t\"@theholocron/cli\": \"workspace:*\",\n\t\t\t\t\t\"@theholocron/misc-utils\": \"catalog:utils\",\n\t\t\t\t\t\"@theholocron/tsconfig\": \"catalog:configs\",\n\t\t\t\t\t\"@types/node\": \"catalog:\",\n\t\t\t\t\t\"@vitest/coverage-v8\": \"catalog:\",\n\t\t\t\t\teslint: \"catalog:\",\n\t\t\t\t\tglobals: \"catalog:\",\n\t\t\t\t\ttsdown: \"catalog:\",\n\t\t\t\t\ttsx: \"catalog:\",\n\t\t\t\t\ttypescript: \"catalog:\",\n\t\t\t\t\tvitest: \"catalog:\",\n\t\t\t\t},\n\t\t\t\tengines: { node: \">=22\" },\n\t\t\t\tpublishConfig: { access: \"public\" },\n\t\t\t\tfiles: [\"dist\"],\n\t\t\t},\n\t\t\tnull,\n\t\t\t2\n\t\t) + \"\\n\"\n\t);\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst clientClass = `${inputs.vendorName}RestClient`;\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\t// Camel-case capability name is used as the factory function name.\n\tconst capabilityInterface = inputs.capability.charAt(0).toUpperCase() + inputs.capability.slice(1);\n\treturn `/**\n * \\`@theholocron/holocron-plugin-${inputs.slug}\\` — entrypoint.\n *\n * Implements the \\`${inputs.capability}\\` capability against ${inputs.vendorName}'s\n * REST API. Also exports \\`verifyToken\\` + \\`AUTH_HINT\\` for\n * \\`holocron auth\\`. See README for auth + config docs.\n *\n * TODO: once you fill in the ${inputs.capabilityClass} methods and add\n * \\`implements ${capabilityInterface}\\` to the class, add the type import:\n * import type { ${capabilityInterface} } from \"@theholocron/cli\";\n * and set \\`: ${capabilityInterface}\\` as the factory return type below.\n */\n\nimport { resolveToken, type ResolveTokenInput } from \"./auth.js\";\nimport { ${inputs.capabilityClass} } from \"./capabilities/${inputs.capability}.js\";\nimport { ${factoryName}, type ${clientClass} } from \"./rest.js\";\n\nexport interface ${inputs.vendorName}PluginOptions extends ResolveTokenInput {\n\t/** Override base URL for tests. */\n\tbaseUrl?: string;\n\t/** Override \\`fetch\\` for tests. */\n\tfetch?: typeof fetch;\n}\n\nexport interface PluginContext {\n\toptions: ${inputs.vendorName}PluginOptions;\n\t/** Memoized client — the token is resolved on first use, not at plugin load. */\n\trest: () => ${clientClass};\n}\n\nexport function createContext(options: ${inputs.vendorName}PluginOptions): PluginContext {\n\tlet rest: ${clientClass} | undefined;\n\treturn {\n\t\toptions,\n\t\trest: () => {\n\t\t\tif (rest) return rest;\n\t\t\tconst restOpts: { token: string; baseUrl?: string; fetch?: typeof fetch } = {\n\t\t\t\ttoken: resolveToken(options),\n\t\t\t};\n\t\t\tif (options.baseUrl !== undefined) restOpts.baseUrl = options.baseUrl;\n\t\t\tif (options.fetch !== undefined) restOpts.fetch = options.fetch;\n\t\t\treturn (rest = ${factoryName}(restOpts));\n\t\t},\n\t};\n}\n\nexport function ${inputs.capability}(ctx: PluginContext) {\n\t// Return type inferred at scaffold time — the class doesn't yet\n\t// \\`implements ${capabilityInterface}\\`. Add the type import + the\n\t// \\`: ${capabilityInterface}\\` annotation once methods are stubbed.\n\treturn new ${inputs.capabilityClass}(ctx.rest);\n}\n\nexport function createPlugin(options: ${inputs.vendorName}PluginOptions) {\n\tconst ctx = createContext(options);\n\treturn {\n\t\tname: \"@theholocron/holocron-plugin-${inputs.slug}\",\n\t\tcapabilities: {\n\t\t\t${inputs.capability}: () => ${inputs.capability}(ctx),\n\t\t},\n\t};\n}\n\n/**\n * One-line hint printed by \\`holocron auth set ${inputs.slug}\\` when no\n * token is supplied or the supplied token is rejected. Edit this to\n * point operators at the specific ${inputs.vendorName} docs path for\n * generating a token.\n */\nexport const AUTH_HINT =\n\t\"generate a ${inputs.vendorName} API token, then run: holocron auth set ${inputs.slug} <TOKEN>\";\n\n// ── Public re-exports ────────────────────────────────────────────────\n\nexport * from \"./auth.js\";\nexport { type ${clientClass}, ${factoryName} } from \"./rest.js\";\nexport { ${inputs.capabilityClass} } from \"./capabilities/${inputs.capability}.js\";\nexport { verifyToken } from \"./verify-token.js\";\nexport type { VerifyTokenFailure, VerifyTokenResult, VerifyTokenSuccess } from \"@theholocron/cli\";\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `<!-- editorconfig-checker-disable-file -->\n\n# \\`@theholocron/holocron-plugin-${inputs.slug}\\`\n\n${inputs.vendorName} plugin for [Holocron](../cli). Implements the\n\\`${inputs.capability}\\` capability against [${inputs.vendorName}'s REST API](${inputs.baseUrl}),\nplus exports \\`verifyToken\\` + \\`AUTH_HINT\\` for use by \\`holocron auth\\`.\n\n## Install\n\n\\`\\`\\`bash\npnpm add -D @theholocron/holocron-plugin-${inputs.slug}@alpha\n\\`\\`\\`\n\n## Auth\n\nToken resolution order (matches the standard 4-step precedence set by\n\\`docs/wiki/specifications/tech-auth-bootstrap.spec.md\\`):\n\n1. \\`--token <TOKEN>\\` flag on the holocron invocation\n2. \\`${inputs.tokenEnv}\\` env var (preferred — explicit intent)\n3. \\`${inputs.vendorEnv}\\` env var (${inputs.vendorName}-native)\n4. **Keyring** — \\`com.theholocron.cli\\` service, account \\`${inputs.slug}\\`\n5. \\`AuthError\\` naming all four options + the bootstrap hint\n\n## Setup\n\n\\`\\`\\`bash\n# Generate a ${inputs.vendorName} API token (see vendor docs), then:\nholocron auth set ${inputs.slug} <TOKEN>\nholocron auth check ${inputs.slug} # verify\n\\`\\`\\`\n\n## Config\n\n\\`\\`\\`jsonc\n{\n\t\"providers\": {\n\t\t\"${inputs.capability}\": \"${inputs.slug}\",\n\t},\n}\n\\`\\`\\`\n\nPlugin options extend \\`ResolveTokenInput\\` — add whatever ${inputs.vendorName}-\nspecific options you need here (project id, workspace slug, etc.) via\nthe tuple form:\n\n\\`\\`\\`jsonc\n{\n\t\"providers\": {\n\t\t\"${inputs.capability}\": [\"${inputs.slug}\", { \"baseUrl\": \"${inputs.baseUrl}\" }],\n\t},\n}\n\\`\\`\\`\n\n## What's implemented\n\nTODO: fill in as capability methods land.\n\n## Status\n\n**\\`v2.0.0-alpha.1\\`** — scaffolded via \\`holocron new plugin\\`.\nNot yet published; capability methods are stubs.\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\tconst clientType = `${inputs.vendorName}RestClient`;\n\treturn `import { createRestClient, type RestClient } from \"@theholocron/cli\";\n\nexport type { RestClient };\n\n/**\n * TODO: narrow this to the specific ${inputs.vendorName} endpoints this\n * plugin's capability needs (see \\`@theholocron/holocron-plugin-axiom\\`'s\n * \\`rest.ts\\` for the pattern: an interface with one method per endpoint,\n * built internally via \\`createRestClient\\`). Starts as an alias for the\n * generic client so the scaffold compiles end to end immediately.\n */\nexport type ${clientType} = RestClient;\n\nexport function ${factoryName}(opts: {\n\\ttoken: string;\n\\tbaseUrl?: string;\n\\tfetch?: typeof fetch;\n}): ${clientType} {\n\\treturn createRestClient({\n\\t\\tbaseUrl: opts.baseUrl ?? \"${inputs.baseUrl}\",\n\\t\\ttoken: opts.token,\n\\t\\tvendor: \"${inputs.vendorName}\",\n\\t\\tfetch: opts.fetch,\n\\t});\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\treturn `import { ProviderApiError } from \"@theholocron/cli\";\nimport { describe, expect, it } from \"vitest\";\n\nimport { ${factoryName} } from \"../rest.js\";\nimport { stubFetch } from \"./helpers.js\";\n\ndescribe(\"${factoryName}\", () => {\n\\tit(\"sends bearer + accept headers and returns the parsed body\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 200, body: { ok: true } }]);\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\\t\\tconst res = await client.request<{ ok: boolean }>(\"/me\");\n\\t\\texpect(res.ok).toBe(true);\n\\t\\texpect(stub.calls[0]?.headers[\"authorization\"]).toBe(\"Bearer t\");\n\\t\\texpect(stub.calls[0]?.headers[\"accept\"]).toBe(\"application/json\");\n\\t});\n\n\\tit(\"serializes body as JSON and sets content-type when present\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 200, body: {} }]);\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\\t\\tawait client.request<unknown>(\"/resource\", { method: \"POST\", body: { name: \"demo\" } });\n\\t\\texpect(stub.calls[0]?.method).toBe(\"POST\");\n\\t\\texpect(stub.calls[0]?.headers[\"content-type\"]).toBe(\"application/json\");\n\\t\\texpect(stub.calls[0]?.body).toEqual({ name: \"demo\" });\n\\t});\n\n\\tit(\"returns undefined on 204\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 204 }]);\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\\t\\texpect(await client.request<unknown>(\"/whatever\")).toBeUndefined();\n\\t});\n\n\\tit(\"throws ProviderApiError with the HTTP status on non-2xx\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 401, body: { messages: [\"invalid\"] } }]);\n\\t\\tconst client = ${factoryName}({ token: \"bad\", fetch: stub.fetch });\n\\t\\tconst err = await client.request<unknown>(\"/me\").catch((e: unknown) => e);\n\\t\\texpect(err).toBeInstanceOf(ProviderApiError);\n\\t\\texpect((err as ProviderApiError).status).toBe(401);\n\\t});\n\n\\tit(\"wraps transport-level failures with status 0\", async () => {\n\\t\\tconst throwing: typeof fetch = async () => { throw new TypeError(\"fetch failed\"); };\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: throwing });\n\\t\\tconst err = await client.request<unknown>(\"/me\").catch((e: unknown) => e);\n\\t\\texpect(err).toBeInstanceOf(ProviderApiError);\n\\t\\texpect((err as ProviderApiError).status).toBe(0);\n\\t});\n\n\\tit(\"trims trailing slashes from the base URL\", () => {\n\\t\\tconst client = ${factoryName}({ token: \"t\", baseUrl: \"${inputs.baseUrl}//\" });\n\\t\\texpect(client.baseUrl).toBe(\"${inputs.baseUrl}\");\n\\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn (\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tdisplay: `Holocron Plugin: ${inputs.vendorName}`,\n\t\t\t\textends: \"@theholocron/tsconfig/node-lts\",\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\tbaseUrl: \"./\",\n\t\t\t\t\toutDir: \"./dist\",\n\t\t\t\t\tpaths: { \"@/*\": [\"./src/*\"] },\n\t\t\t\t},\n\t\t\t\tinclude: [\"src/**/*.ts\"],\n\t\t\t\texclude: [\"node_modules\", \"dist\"],\n\t\t\t},\n\t\t\tnull,\n\t\t\t2\n\t\t) + \"\\n\"\n\t);\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { defineConfig } from \"tsdown\";\n\nexport default defineConfig({\n\tentry: [\"src/index.ts\"],\n\tformat: \"esm\",\n\tdts: true,\n\tclean: true,\n\tdeps: { neverBundle: [/^@theholocron\\\\//] },\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\n/**\n * Scaffolds `scripts/validate.mjs` — a smoke-test the operator runs\n * against a live vendor account to verify the plugin's REST endpoints,\n * auth, and response parsing all work in reality (the unit tests only\n * exercise stubbed HTTP responses). READ-ONLY BY DESIGN.\n *\n * Convention: every plugin ships this script + a matching `validate`\n * entry in `package.json`'s scripts block, so operators run\n * `pnpm --filter @theholocron/holocron-plugin-<slug> validate`.\n * Capability-specific args (project id, workspace, etc.) come from\n * positional command-line arguments; the plugin author fills in the\n * exact shape per their vendor.\n *\n * Includes a `hintFor(message)` helper the operator customizes with\n * vendor-specific \"here's the likely fix\" guidance for common error\n * shapes (401 / 403 / 404 / network / 5xx). Points users at docs and\n * setup steps rather than leaving them staring at a raw stack trace.\n */\nexport function render(inputs: TemplateInputs): string {\n\treturn `#!/usr/bin/env node\n/**\n * Read-only smoke test for @theholocron/holocron-plugin-${inputs.slug} against\n * a live ${inputs.vendorName} account.\n *\n * READ-ONLY BY DESIGN. Never calls write(), or bootstrap methods\n * (\\`ensureProject\\`, \\`ensureEnvironment\\`, etc.). Any ERROR line means\n * the plugin needs adjusting — the \\`hintFor\\` helper below points at\n * the most likely fix per error shape.\n *\n * Auth: reads the ${inputs.vendorName} token from holocron's keyring —\n * you must have run \\`pnpm holocron auth set ${inputs.slug} <TOKEN>\\` first.\n *\n * Usage:\n * pnpm --filter @theholocron/holocron-plugin-${inputs.slug} validate <arg1> [arg2] ...\n *\n * TODO: replace the positional args below with whatever your\n * capability's methods need (e.g., project id, environment slug,\n * secret name). Adapt the test steps to your capability's method\n * surface. Model on \\`plugins/holocron-plugin-infisical/scripts/validate.mjs\\`.\n */\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- filled in by operator\nimport { AuthError, createPlugin, resolveToken, verifyToken } from \"../src/index.ts\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nconst args = process.argv.slice(2);\n\nif (args.length === 0) {\n\tconsole.error(\"usage: pnpm --filter @theholocron/holocron-plugin-${inputs.slug} validate <args>\");\n\tprocess.exit(2);\n}\n\n// Use the plugin's own auth resolution so the validate script honors\n// the same 4-step precedence as the plugin's runtime:\n// --token → ${inputs.tokenEnv} → ${inputs.vendorEnv} → keyring\n// (--token isn't available here since this is a bare Node script;\n// the other three all work.)\nlet token;\ntry {\n\ttoken = resolveToken();\n} catch (err) {\n\tif (err instanceof AuthError) {\n\t\tconsole.error(err.message);\n\t\tconsole.error(\" see: plugins/holocron-plugin-${inputs.slug}/README.md#setup\");\n\t\tprocess.exit(2);\n\t}\n\tthrow err;\n}\n\nconsole.log(\"Validating @theholocron/holocron-plugin-${inputs.slug} (READ-ONLY)\");\nconsole.log(\"\");\n\n// ── 1. verifyToken ─────────────────────────────────────────────────\nconsole.log(\"[1/N] verifyToken\");\nconst verifyResult = await verifyToken(token);\nconsole.log(\\` \\${verifyResult.ok ? \"✓\" : \"✗\"} \\${JSON.stringify(verifyResult)}\\`);\nif (!verifyResult.ok) {\n\tconst hint = hintFor(verifyResult.message);\n\tif (hint) console.log(\\` hint: \\${hint}\\`);\n}\nconsole.log(\"\");\n\n// ── 2..N. capability method calls ──────────────────────────────────\n// TODO: implement one \\`runStep\\`-wrapped call per meaningful read-side\n// capability method. Model on the infisical validate.mjs. Never call\n// write / ensure* / other mutating paths.\n//\n// Example:\n// console.log(\"[2/N] vault.list()\");\n// await runStep(async () => {\n// const keys = await vault.list();\n// console.log(\\` ✓ \\${keys.length} secrets\\`);\n// });\n\nconsole.log(\"Done. Fill in capability method calls above before shipping.\");\n\n// ── helpers ────────────────────────────────────────────────────────\n\n/** Wrap a capability call, print ERROR + hint on failure. */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- called once a real capability check replaces the TODO example above\nasync function runStep(body) {\n\ttry {\n\t\tawait body();\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tconsole.log(\\` ✗ ERROR: \\${message}\\`);\n\t\tconst hint = hintFor(message);\n\t\tif (hint) console.log(\\` hint: \\${hint}\\`);\n\t}\n}\n\n/**\n * Point the operator at the most likely fix based on the error shape.\n * Generic defaults below — CUSTOMIZE per your vendor's docs URLs and\n * common permission/config gotchas.\n */\nfunction hintFor(message) {\n\tif (/→ 401/.test(message)) {\n\t\treturn \"token invalid — regenerate per ${inputs.vendorName}'s docs (see README §Setup)\";\n\t}\n\tif (/→ 403/.test(message)) {\n\t\treturn \"token authenticates but lacks scope — check the token/identity has permissions on the resource\";\n\t}\n\tif (/→ 404/.test(message)) {\n\t\treturn \"endpoint or resource not found — verify your positional args match a real resource\";\n\t}\n\tif (/fetch failed|status: 0|network/i.test(message)) {\n\t\treturn \"network error — check the base URL (${inputs.baseUrl}) and connectivity\";\n\t}\n\tif (/→ 5\\\\d\\\\d/.test(message)) {\n\t\treturn \"server error — vendor-side. Retry, and check the vendor's status page if persistent\";\n\t}\n\treturn null;\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\treturn `/**\n * \\`verifyToken\\` — plugin-level export used by \\`holocron auth set\\` +\n * \\`holocron auth check\\`. Hits a lightweight whoami-style endpoint\n * and translates the response into the normalized \\`VerifyTokenResult\\`\n * shape.\n *\n * Kept as a standalone function (not a capability method) so the auth\n * command can call it without initializing the full plugin — plugin\n * construction requires an already-resolved token, which is exactly\n * what we don't have yet at bootstrap time.\n *\n * TODO: replace \\`/me\\` with the ${inputs.vendorName} equivalent of a\n * \"check my token\" endpoint. Common shapes: \\`/user\\`, \\`/whoami\\`,\n * \\`/me\\`, \\`/account\\`.\n */\n\nimport type { VerifyTokenResult } from \"@theholocron/cli\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { ${factoryName} } from \"./rest.js\";\n\ninterface MeResponse {\n\t/** Adjust to whatever ${inputs.vendorName}'s whoami endpoint returns. */\n\tname?: string;\n\temail?: string;\n\tid?: string;\n}\n\nexport interface VerifyTokenOptions {\n\tbaseUrl?: string;\n\tfetch?: typeof fetch;\n}\n\nexport async function verifyToken(token: string, opts: VerifyTokenOptions = {}): Promise<VerifyTokenResult> {\n\tconst restOpts: { token: string; baseUrl?: string; fetch?: typeof fetch } = { token };\n\tif (opts.baseUrl !== undefined) restOpts.baseUrl = opts.baseUrl;\n\tif (opts.fetch !== undefined) restOpts.fetch = opts.fetch;\n\tconst rest = ${factoryName}(restOpts);\n\ttry {\n\t\tconst me = await rest.request<MeResponse>(\"/me\");\n\t\t// Optional chaining because \\`me\\` is \\`undefined\\` on 204 / empty body.\n\t\tconst subject = me?.email ?? me?.name ?? me?.id ?? \"unknown\";\n\t\treturn { ok: true, subject: \\`user @ \\${subject}\\` };\n\t} catch (err) {\n\t\treturn { ok: false, message: errorMessage(err) };\n\t}\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { verifyToken } from \"../verify-token.js\";\nimport { stubFetch } from \"./helpers.js\";\n\ndescribe(\"verifyToken\", () => {\n\tit(\"returns ok with a subject when /me returns 200\", async () => {\n\t\tconst stub = stubFetch([{ status: 200, body: { email: \"user@example.com\" } }]);\n\t\tconst result = await verifyToken(\"token\", { fetch: stub.fetch });\n\t\texpect(result.ok).toBe(true);\n\t\texpect((result as { ok: boolean; subject?: string }).subject).toMatch(/user@example.com/);\n\t});\n\n\tit(\"returns ok:false with the error message on 401\", async () => {\n\t\tconst stub = stubFetch([{ status: 401, body: { messages: [\"Invalid token\"] } }]);\n\t\tconst result = await verifyToken(\"bad\", { fetch: stub.fetch });\n\t\texpect(result.ok).toBe(false);\n\t\texpect((result as { ok: boolean; message?: string }).message).toMatch(/→ 401/);\n\t});\n\n\tit(\"returns ok:false when the network layer throws\", async () => {\n\t\tconst throwing: typeof fetch = async () => {\n\t\t\tthrow new TypeError(\"network down\");\n\t\t};\n\t\tconst result = await verifyToken(\"t\", { fetch: throwing });\n\t\texpect(result.ok).toBe(false);\n\t\texpect((result as { ok: boolean; message?: string }).message).toMatch(/network down/);\n\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { defineConfig } from \"vitest/config\";\n\nexport default defineConfig({\n\ttest: {\n\t\tenvironment: \"node\",\n\t\tglobals: false,\n\t\tcoverage: {\n\t\t\tprovider: \"v8\",\n\t\t\treporter: [\"text\", \"html\", \"json-summary\"],\n\t\t\tinclude: [\"src/**/*.ts\"],\n\t\t\texclude: [\"src/**/__tests__/**\", \"src/**/*.test.ts\", \"src/index.ts\"],\n\t\t\tthresholds: { lines: 0, functions: 0, branches: 0, statements: 0 },\n\t\t},\n\t},\n});\n`;\n}\n","/**\n * `holocron new plugin <slug> <vendor>` — scaffold a new plugin\n * package matching the proven template.\n *\n * Design: see `docs/wiki/specifications/tool-plugin-create.spec.md`.\n *\n * Flow:\n * 1. Preflight — verify CWD is a workspace root (pnpm-workspace.yaml\n * + packages/ dir present).\n * 2. Slug collision — plugins/holocron-plugin-<slug>/ must not exist.\n * 3. Capability sanity — must be one of the 14 known keys; warn for\n * many-cardinality caps.\n * 4. Generate — for each template, write to\n * plugins/holocron-plugin-<slug>/<path>.\n * 5. Verify (unless --no-verify) — runs pnpm install +\n * pnpm --filter <pkg> typecheck lint test.\n * 6. Print next steps.\n */\n\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { type CapabilityKey, CARDINALITY } from \"../../plugin/index.js\";\nimport type {\n\tPluginCreateReport,\n\tPluginCreateWizardArgs,\n\tPluginCreateWizardPrompts,\n\tRunPluginCreateInput,\n\tTemplateEntry,\n} from \"./index.type.js\";\nimport { deriveDefaults, type TemplateInputs } from \"./template-inputs/index.js\";\nimport { render as renderAuth } from \"./templates/auth.js\";\nimport { render as renderAuthTest } from \"./templates/auth-test.js\";\nimport { render as renderCapability } from \"./templates/capability.js\";\nimport { render as renderCapabilityTest } from \"./templates/capability-test.js\";\nimport { render as renderEslintConfig } from \"./templates/eslint-config.js\";\nimport { render as renderHelpers } from \"./templates/helpers.js\";\nimport { render as renderIndexTest } from \"./templates/index-test.js\";\nimport { render as renderPackageJson } from \"./templates/package-json.js\";\nimport { render as renderPluginIndex } from \"./templates/plugin-index.js\";\nimport { render as renderReadme } from \"./templates/readme.js\";\nimport { render as renderRest } from \"./templates/rest.js\";\nimport { render as renderRestTest } from \"./templates/rest-test.js\";\nimport { render as renderTsconfigJson } from \"./templates/tsconfig-json.js\";\nimport { render as renderTsdownConfig } from \"./templates/tsdown-config.js\";\nimport { render as renderValidateScript } from \"./templates/validate-script.js\";\nimport { render as renderVerifyToken } from \"./templates/verify-token.js\";\nimport { render as renderVerifyTokenTest } from \"./templates/verify-token-test.js\";\nimport { render as renderVitestConfig } from \"./templates/vitest-config.js\";\n\n/**\n * Resolve `capability`, `vendorEnv`, and `baseUrl` from argv or by calling\n * the supplied prompt functions for any that are absent. Extracted from\n * `cli.ts` so the resolution logic is unit-testable.\n */\nexport async function resolvePluginCreateInputs(\n\targs: PluginCreateWizardArgs,\n\tprompts: PluginCreateWizardPrompts\n): Promise<{ capability: CapabilityKey; vendorEnv: string; baseUrl: string }> {\n\tconst capability = (args.capability ?? (await prompts.selectCapability())) as CapabilityKey;\n\tconst vendorEnv = args.vendorEnv ?? (await prompts.inputVendorEnv());\n\tconst baseUrl = args.baseUrl ?? (await prompts.inputBaseUrl());\n\treturn { capability, vendorEnv, baseUrl };\n}\n\nexport class PluginCreateError extends Error {\n\toverride name = \"PluginCreateError\";\n}\n\nconst TEMPLATES: TemplateEntry[] = [\n\t// Config (5)\n\t{ path: \"package.json\", render: renderPackageJson },\n\t{ path: \"tsconfig.json\", render: renderTsconfigJson },\n\t{ path: \"vitest.config.ts\", render: renderVitestConfig },\n\t{ path: \"eslint.config.ts\", render: renderEslintConfig },\n\t{ path: \"tsdown.config.ts\", render: renderTsdownConfig },\n\t// Docs (1)\n\t{ path: \"README.md\", render: renderReadme },\n\t// Source (5) — capability path uses the dynamic capability slug.\n\t{ path: \"src/auth.ts\", render: renderAuth },\n\t{ path: \"src/rest.ts\", render: renderRest },\n\t{ path: \"src/verify-token.ts\", render: renderVerifyToken },\n\t{ path: \"src/index.ts\", render: renderPluginIndex },\n\t{ path: \"src/capabilities/{{capability}}.ts\", render: renderCapability },\n\t// Tests (6)\n\t{ path: \"src/__tests__/helpers.ts\", render: renderHelpers },\n\t{ path: \"src/__tests__/auth.test.ts\", render: renderAuthTest },\n\t{ path: \"src/__tests__/rest.test.ts\", render: renderRestTest },\n\t{ path: \"src/__tests__/verify-token.test.ts\", render: renderVerifyTokenTest },\n\t{ path: \"src/__tests__/{{capability}}.test.ts\", render: renderCapabilityTest },\n\t{ path: \"src/__tests__/index.test.ts\", render: renderIndexTest },\n\t// Live-account validation script (1) — read-only smoke test.\n\t{ path: \"scripts/validate.mjs\", render: renderValidateScript },\n];\n\n/** Replace `{{capability}}` in a template path with the actual capability key. */\nfunction resolvePath(template: string, inputs: TemplateInputs): string {\n\treturn template.replace(/\\{\\{capability\\}\\}/g, inputs.capability);\n}\n\n// ── Orchestrator ────────────────────────────────────────────────────\n\nexport function runPluginCreate(input: RunPluginCreateInput): PluginCreateReport {\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst write = input.writeFile ?? defaultWrite;\n\n\tpreflight(cwd);\n\tvalidateSlug(input.slug);\n\tvalidateVendorName(input.vendorName);\n\n\tconst packageDir = path.join(cwd, \"plugins\", `holocron-plugin-${input.slug}`);\n\tif (existsSync(packageDir)) {\n\t\tthrow new PluginCreateError(`\\`${packageDir}\\` already exists — edit in place or pick a different slug.`);\n\t}\n\n\tvalidateCapability(input.capability, print);\n\n\tconst derived = deriveDefaults({\n\t\tslug: input.slug,\n\t\tvendorName: input.vendorName,\n\t\tcapability: input.capability,\n\t});\n\tconst inputs: TemplateInputs = {\n\t\tslug: input.slug,\n\t\tvendorName: input.vendorName,\n\t\tvendorUpper: derived.vendorUpper,\n\t\tcapability: input.capability,\n\t\tcapabilityClass: derived.capabilityClass,\n\t\ttokenEnv: input.tokenEnv ?? derived.tokenEnv,\n\t\tvendorEnv: input.vendorEnv,\n\t\t// Normalize: strip trailing slashes so the embedded value in the\n\t\t// generated rest-test.ts matches what the client trims at runtime.\n\t\tbaseUrl: trimTrailingSlashes(input.baseUrl),\n\t\ttransport: derived.transport,\n\t};\n\n\tconst filesWritten: string[] = [];\n\tprint(`Scaffolding @theholocron/holocron-plugin-${inputs.slug}${input.dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` → ${packageDir}`);\n\tlogger.info(\n\t\t{ slug: inputs.slug, capability: inputs.capability, dryRun: input.dryRun || undefined },\n\t\t\"plugin create: start\"\n\t);\n\tfor (const template of TEMPLATES) {\n\t\tconst resolvedPath = resolvePath(template.path, inputs);\n\t\tconst filepath = path.join(packageDir, resolvedPath);\n\t\tconst content = template.render(inputs);\n\t\tif (input.dryRun) {\n\t\t\tprint(` … would write ${resolvedPath} (${content.length} bytes)`);\n\t\t} else {\n\t\t\twrite(filepath, content);\n\t\t\tprint(` ✓ ${resolvedPath}`);\n\t\t}\n\t\tfilesWritten.push(resolvedPath);\n\t}\n\n\tif (!input.dryRun && !input.noVerify) {\n\t\tconst execFn = input.exec ?? defaultExec;\n\t\tconst pkg = `@theholocron/holocron-plugin-${inputs.slug}`;\n\t\tprint(\"\");\n\t\tprint(\" Verifying scaffold…\");\n\t\ttry {\n\t\t\texecFn(\"pnpm\", [\"install\", \"--frozen-lockfile=false\"], { cwd, stdio: \"inherit\" });\n\t\t\texecFn(\"pnpm\", [\"--filter\", pkg, \"verification.typeSafety\"], { cwd, stdio: \"inherit\" });\n\t\t\texecFn(\"pnpm\", [\"--filter\", pkg, \"sourceQuality.staticAnalysis\"], { cwd, stdio: \"inherit\" });\n\t\t\texecFn(\"pnpm\", [\"--filter\", pkg, \"verification.unitTests\"], { cwd, stdio: \"inherit\" });\n\t\t\tprint(\" ✓ scaffold verified\");\n\t\t} catch (err) {\n\t\t\tconst message = errorMessage(err);\n\t\t\tprint(` ✗ verify failed — ${message}`);\n\t\t\tlogger.warn(\n\t\t\t\t{ slug: inputs.slug, files: filesWritten.length, reason: message, status: \"fail\" },\n\t\t\t\t\"plugin create: done\"\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tstatus: \"fail\",\n\t\t\t\tpackagePath: packageDir,\n\t\t\t\tfilesWritten,\n\t\t\t\tmessage: \"post-scaffold verify failed; inspect output above\",\n\t\t\t};\n\t\t}\n\t}\n\n\tif (!input.dryRun) {\n\t\tprintNextSteps(print, inputs);\n\t}\n\n\tlogger.info(\n\t\t{\n\t\t\tslug: inputs.slug,\n\t\t\tcapability: inputs.capability,\n\t\t\tfiles: filesWritten.length,\n\t\t\tstatus: input.dryRun ? \"dry-run\" : \"ok\",\n\t\t},\n\t\t\"plugin create: done\"\n\t);\n\treturn { status: \"ok\", packagePath: packageDir, filesWritten };\n}\n\n// ── Internals ───────────────────────────────────────────────────────\n\nfunction preflight(cwd: string): void {\n\tif (!existsSync(path.join(cwd, \"pnpm-workspace.yaml\"))) {\n\t\tthrow new PluginCreateError(\n\t\t\t`\\`pnpm-workspace.yaml\\` not found in \\`${cwd}\\`. Run \\`holocron new plugin\\` from the monorepo root.`\n\t\t);\n\t}\n\tif (!existsSync(path.join(cwd, \"packages\"))) {\n\t\tthrow new PluginCreateError(`\\`packages/\\` directory not found in \\`${cwd}\\`.`);\n\t}\n}\n\n/**\n * npm-package-name conventions: kebab-case, starts with lowercase\n * letter. Rejecting numeric-prefixed slugs also sidesteps the\n * `env.HOLOCRON_1FOO_TOKEN` invalid-identifier trap in the auth\n * template.\n */\nconst SLUG_RE = /^[a-z][a-z0-9-]*$/;\n\nfunction validateSlug(slug: string): void {\n\tif (!SLUG_RE.test(slug)) {\n\t\tthrow new PluginCreateError(\n\t\t\t`invalid slug \"${slug}\" — must be kebab-case: lowercase letter followed by lowercase letters, digits, or hyphens. ` +\n\t\t\t\t`Examples: \"clerk\", \"cloud-flare\", \"doppler\".`\n\t\t);\n\t}\n}\n\n/** PascalCase — starts with uppercase, alphanumeric only. */\nconst VENDOR_NAME_RE = /^[A-Z][a-zA-Z0-9]*$/;\n\nfunction validateVendorName(name: string): void {\n\tif (!VENDOR_NAME_RE.test(name)) {\n\t\tthrow new PluginCreateError(\n\t\t\t`invalid vendor name \"${name}\" — must be PascalCase: starts with uppercase, alphanumeric only. ` +\n\t\t\t\t`Examples: \"Clerk\", \"CloudFlare\", \"Doppler\".`\n\t\t);\n\t}\n}\n\n/**\n * Trim trailing slashes with a plain loop (no regex — matches the\n * rest.ts template's own trimming to stay ReDoS-safe under CodeQL).\n */\nfunction trimTrailingSlashes(url: string): string {\n\tlet out = url;\n\twhile (out.endsWith(\"/\")) out = out.slice(0, -1);\n\treturn out;\n}\n\nfunction validateCapability(capability: CapabilityKey, print: (line: string) => void): void {\n\tif (!(capability in CARDINALITY)) {\n\t\tthrow new PluginCreateError(\n\t\t\t`\\`${capability}\\` is not a known capability. See \\`packages/cli/src/capabilities/index.ts\\`.`\n\t\t);\n\t}\n\tif (CARDINALITY[capability] === \"many\") {\n\t\tprint(\n\t\t\t` ! ${capability} is a many-cardinality capability — multiple providers can be active at once. ` +\n\t\t\t\t\"Confirm your config wiring accordingly.\"\n\t\t);\n\t}\n}\n\nfunction defaultWrite(filepath: string, content: string): void {\n\tmkdirSync(path.dirname(filepath), { recursive: true });\n\twriteFileSync(filepath, content, \"utf8\");\n}\n\nfunction defaultExec(cmd: string, args: string[], opts: { cwd: string; stdio: \"inherit\" }): void {\n\texecFileSync(cmd, args, { cwd: opts.cwd, stdio: opts.stdio });\n}\n\nfunction printNextSteps(print: (line: string) => void, inputs: TemplateInputs): void {\n\tprint(\"\");\n\tprint(` Scaffolded @theholocron/holocron-plugin-${inputs.slug} (18 files).`);\n\tprint(\"\");\n\tprint(\" Next:\");\n\tprint(\n\t\t` 1. pnpm install # picks up the workspace package`\n\t);\n\tprint(` 2. pnpm --filter @theholocron/holocron-plugin-${inputs.slug} typecheck # green`);\n\tprint(` 3. pnpm --filter @theholocron/holocron-plugin-${inputs.slug} lint # green`);\n\tprint(\n\t\t` 4. pnpm --filter @theholocron/holocron-plugin-${inputs.slug} test # green (stubs pass, real tests are it.todo)`\n\t);\n\tprint(` 5. Implement ${inputs.capabilityClass} methods in src/capabilities/${inputs.capability}.ts`);\n\tprint(` 6. Replace it.todo(...) with real tests in src/__tests__/${inputs.capability}.test.ts`);\n\tprint(\" 7. Commit + push when capability is functionally complete.\");\n}\n","import { spawnSync } from \"node:child_process\";\n\nimport type { RunPublishInput } from \"./run-publish/index.js\";\n\nexport const defaultExec: NonNullable<RunPublishInput[\"exec\"]> = async (cmd, args, opts) => {\n\tconst result = spawnSync(cmd, args, {\n\t\tcwd: opts.cwd,\n\t\tencoding: \"utf8\",\n\t\tstdio: [\"inherit\", \"pipe\", \"pipe\"],\n\t});\n\treturn {\n\t\texitCode: result.status ?? -1,\n\t\tstdout: result.stdout ?? \"\",\n\t\tstderr: result.stderr ?? \"\",\n\t};\n};\n","import { spawnSync } from \"node:child_process\";\n\nimport type { RunPublishInput } from \"./run-publish/index.js\";\n\n/**\n * Fully interactive — `npm login --auth-type=web` prints a URL and waits for\n * the browser flow to complete; the operator needs to see that live, so all\n * three stdio streams are inherited (unlike `defaultExec`, which pipes\n * stdout/stderr for capture).\n */\nexport const defaultLogin: NonNullable<RunPublishInput[\"login\"]> = async (cwd) => {\n\tconst result = spawnSync(\"npm\", [\"login\", \"--auth-type=web\"], { cwd, stdio: \"inherit\" });\n\treturn { exitCode: result.status ?? -1 };\n};\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport function hasPackagesDir(cwd: string): boolean {\n\treturn existsSync(join(cwd, \"packages\"));\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/** `plugins/` — vendor capability providers, split from `packages/` as a sibling workspace root (#993). */\nexport function hasPluginsDir(cwd: string): boolean {\n\treturn existsSync(join(cwd, \"plugins\"));\n}\n","import { listWorkspacePackagesSync, type PackageJson, readPackageJsonSync } from \"@theholocron/pkg-utils\";\n\nimport { hasPackagesDir } from \"./has-packages-dir.js\";\nimport { hasPluginsDir } from \"./has-plugins-dir.js\";\n\n/**\n * Monorepo (`packages/` and/or `plugins/` present): every workspace under\n * either. Single package (neither dir present): the root `package.json`.\n * Callers keep the public ones.\n */\nexport function discoverManifests(cwd: string): { manifest: PackageJson; dir: string }[] {\n\tif (!hasPackagesDir(cwd) && !hasPluginsDir(cwd)) {\n\t\tconst manifest = readPackageJsonSync(cwd);\n\t\treturn manifest ? [{ manifest, dir: \".\" }] : [];\n\t}\n\treturn listWorkspacePackagesSync(cwd).map(({ manifest, relativeDir }) => ({ manifest, dir: `./${relativeDir}` }));\n}\n","import { discoverManifests } from \"./discover-manifests.js\";\n\n/** The names of `discoverPublicPackageEntries`' packages, without requiring a version. */\nexport function discoverPublicPackages(cwd: string): readonly string[] {\n\treturn discoverManifests(cwd).flatMap(({ manifest }) =>\n\t\t!manifest.private && manifest.name ? [manifest.name] : []\n\t);\n}\n","import type { CliEnv } from \"../../env/index.js\";\nimport type { PublishPrint } from \"./publish.type.js\";\n\nexport function printNextSteps(\n\tprint: PublishPrint,\n\tenv: CliEnv,\n\tpackageNames: readonly string[],\n\trepoName: string\n): void {\n\tprint(\"\");\n\tprint(\" → next: configure Trusted Publisher for each package on npm:\");\n\tfor (const name of packageNames) {\n\t\tprint(` https://www.npmjs.com/package/${name}/access`);\n\t}\n\tprint(` Publisher: GitHub Actions Org: theholocron Repo: ${repoName} Workflow: delivery.publish.yml`);\n\n\tif (env.get(\"NPM_TOKEN\")) {\n\t\tprint(\"\");\n\t\tprint(\" → cleanup: $NPM_TOKEN was used. Revoke it now (no API for self-revoke; UI-only):\");\n\t\tprint(\" https://www.npmjs.com/settings/~/tokens\");\n\t}\n}\n","import { readGitRemote } from \"@theholocron/git-utils\";\n\nimport type { RunPublishInput } from \"./run-publish/index.js\";\n\nexport async function resolveRepoName(cwd: string, exec: NonNullable<RunPublishInput[\"exec\"]>): Promise<string> {\n\tconst remote = await readGitRemote(cwd, {\n\t\texec: async (args, options) => {\n\t\t\tconst result = await exec(\"git\", args, options);\n\t\t\tif (result.exitCode !== 0) throw new Error(`git ${args.join(\" \")} exited ${result.exitCode}`);\n\t\t\treturn result.stdout;\n\t\t},\n\t});\n\treturn remote?.repo ?? \"unknown\";\n}\n","import { hasPackagesDir } from \"./has-packages-dir.js\";\nimport { hasPluginsDir } from \"./has-plugins-dir.js\";\n\n/**\n * `-r --filter=./packages/* --filter=./plugins/*` — whichever workspace\n * roots exist. Empty (single-package repo, no `-r`) when neither does.\n * Shared by every `pnpm publish` invocation below so a repo with only\n * `plugins/*` (or both) is covered the same as `packages/*`-only.\n */\nexport function workspaceFilterArgs(cwd: string): string[] {\n\tconst filters: string[] = [];\n\tif (hasPackagesDir(cwd)) filters.push(\"--filter=./packages/*\");\n\tif (hasPluginsDir(cwd)) filters.push(\"--filter=./plugins/*\");\n\treturn filters.length > 0 ? [\"-r\", ...filters] : [];\n}\n","/**\n * `holocron package publish --initial` — bottles up the chicken-and-egg bootstrap\n * that every new npm-published holocron monorepo hits.\n *\n * npm requires a package to exist before Trusted Publishing can be\n * configured on it. So the first publish has to happen outside the OIDC\n * flow — a browser-auth session (`npm login --auth-type=web`) or an\n * ephemeral automation token. This command drives the login step itself\n * (when `npm whoami` shows you're not authenticated), runs the publish\n * step, and tells you exactly what to do next.\n *\n * Workflow:\n *\n * $ pnpm install --frozen-lockfile\n * $ pnpm build\n * $ pnpm exec tsx packages/cli/src/cli.ts package publish --initial\n *\n * `npm login --auth-type=web` runs automatically the first time — no\n * separate manual step. `pnpm install` + `pnpm build` stay outside the\n * command (no pnpm-inside-pnpm).\n *\n * `--initial` is required today — this command only implements the\n * bootstrap publish. A non-initial `holocron package publish` (for a manual publish\n * outside the semantic-release/OIDC steady state) isn't built yet; the flag\n * exists so the surface doesn't need another rename when it is.\n *\n * If `NPM_TOKEN` is detected in env, the command prints a final\n * \"revoke this token at <url>\" reminder — same pattern as `rando vc\n * setup` for the ephemeral GH admin PAT.\n */\n\nimport { makeEnv } from \"../../../env/index.js\";\nimport { getLogger } from \"../../../observability/logger/index.js\";\nimport { defaultExec } from \"../default-exec.js\";\nimport { defaultLogin } from \"../default-login.js\";\nimport { discoverPublicPackages } from \"../discover-public-packages.js\";\nimport { printNextSteps } from \"../print-next-steps.js\";\nimport type { PublishReport } from \"../publish.type.js\";\nimport { resolveRepoName } from \"../resolve-repo-name.js\";\nimport { workspaceFilterArgs } from \"../workspace-filter-args.js\";\nimport type { RunPublishInput } from \"./run-publish.type.js\";\n\nexport async function runPublish(input: RunPublishInput = {}): Promise<PublishReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst tag = input.tag ?? \"alpha\";\n\tconst dryRun = input.dryRun ?? false;\n\tconst otp = input.otp;\n\tconst env = makeEnv(input.env);\n\tconst exec = input.exec ?? defaultExec;\n\tconst login = input.login ?? defaultLogin;\n\n\t// Two repo layouts: a monorepo (`packages/*` and/or `plugins/*`, this\n\t// repo's own shape) and a single package at the root (most\n\t// `node-template` scaffolds — neither dir). `pnpm -r --filter=./packages/*`\n\t// silently matches zero workspaces in the latter and exits 0 — build the\n\t// right invocation for whichever layout is on disk. Shared between\n\t// dry-run preview and the real call so what we print is exactly what\n\t// we'd run.\n\tconst publishArgs = [\n\t\t...workspaceFilterArgs(cwd),\n\t\t\"publish\",\n\t\t\"--access\",\n\t\t\"public\",\n\t\t\"--no-git-checks\",\n\t\t\"--tag\",\n\t\ttag,\n\t\t...(otp ? [\"--otp\", otp] : []),\n\t];\n\n\tprint(`Holocron publish --initial${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` cwd: ${cwd}`);\n\tprint(` tag: ${tag}`);\n\tlogger.info({ tag, dryRun: dryRun || undefined }, \"publish --initial: start\");\n\tif (otp) print(` otp: <${otp.length} chars>`);\n\tprint(\"\");\n\n\t// ── 1. Verify npm auth — log in automatically if not ────────────────\n\tprint(\" → verifying npm auth (`npm whoami`)…\");\n\tlet whoami = await exec(\"npm\", [\"whoami\"], { cwd });\n\tif (whoami.exitCode !== 0) {\n\t\tprint(\" not authenticated — running `npm login --auth-type=web`…\");\n\t\tlogger.info({}, \"publish --initial: npm login\");\n\t\tconst loginResult = await login(cwd);\n\t\tif (loginResult.exitCode !== 0) {\n\t\t\tconst message = \"npm login failed. Run `npm login --auth-type=web` (or `npm login`) manually, then re-run.\";\n\t\t\tprint(` ✗ ${message}`);\n\t\t\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\t\t\tlogger.warn({ reason: \"npm login failed\" }, \"publish --initial: done\");\n\t\t\treturn { status: \"fail\", message, packageNames };\n\t\t}\n\t\twhoami = await exec(\"npm\", [\"whoami\"], { cwd });\n\t\tif (whoami.exitCode !== 0) {\n\t\t\tconst message = \"npm login completed but `npm whoami` still fails — check your npm account.\";\n\t\t\tprint(` ✗ ${message}`);\n\t\t\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\t\t\tlogger.warn({ reason: \"npm whoami still fails after login\" }, \"publish --initial: done\");\n\t\t\treturn { status: \"fail\", message, packageNames };\n\t\t}\n\t}\n\tconst whoamiName = whoami.stdout.trim() || \"<unknown>\";\n\tprint(` ✓ authed as ${whoamiName}`);\n\n\t// ── 2. Resolve dynamic values needed for next-steps ─────────────────\n\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\tconst repoName = input.repoName ?? (await resolveRepoName(cwd, exec));\n\n\t// A `pnpm --filter=./packages/*` (or a bare `pnpm publish`) that matches\n\t// nothing still exits 0 — catch the no-op before it's mistaken for\n\t// success. Applies to dry-run too: the point is to diagnose the\n\t// misconfiguration, not just the real publish.\n\tif (packageNames.length === 0) {\n\t\tconst message = \"nothing to publish (no packages/*, plugins/*, or root package.json is private or unnamed)\";\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ reason: message }, \"publish --initial: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\n\t// ── 3. Publish ──────────────────────────────────────────────────────\n\tif (dryRun) {\n\t\tprint(\"\");\n\t\tprint(\" … (dry-run) skipping actual publish\");\n\t\tprint(` would run: pnpm ${publishArgs.join(\" \")}`);\n\t\tprintNextSteps(print, env, packageNames, repoName);\n\t\tlogger.info({ tag, status: \"dry-run\", packages: packageNames.length }, \"publish --initial: done\");\n\t\treturn { status: \"dry-run\", message: \"dry-run — no publish executed\", packageNames };\n\t}\n\n\tprint(\"\");\n\tprint(\" → publishing all public @theholocron/* packages…\");\n\tconst publish = await exec(\"pnpm\", publishArgs, { cwd });\n\tif (publish.exitCode !== 0) {\n\t\tconst message = `publish failed (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || \"no output\"}`;\n\t\tprint(` ✗ ${message}`);\n\t\t// Detect EOTP and surface the --otp hint right at the failure.\n\t\tif (publish.stdout.includes(\"EOTP\") || publish.stderr.includes(\"EOTP\")) {\n\t\t\tprint(\"\");\n\t\t\tprint(\" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:\");\n\t\t\tprint(` pnpm exec tsx packages/cli/src/cli.ts package publish --initial --otp <6-digit-code>`);\n\t\t}\n\t\tlogger.warn({ tag, reason: message }, \"publish --initial: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\tprint(\" ✓ publish complete\");\n\n\t// ── 4. Next-step reminders ──────────────────────────────────────────\n\tprintNextSteps(print, env, packageNames, repoName);\n\tlogger.info({ tag, status: \"ok\", packages: packageNames.length }, \"publish --initial: done\");\n\treturn { status: \"ok\", packageNames };\n}\n","import { discoverManifests } from \"./discover-manifests.js\";\nimport type { PublicPackageEntry } from \"./public-package-entry.type.js\";\n\n/**\n * Every public package (`!private && name`) with its version and a\n * `pnpm --filter`-ready path — {@link runSteadyPublish}'s `skipAlreadyPublished`\n * mode needs both to check `npm view <pkg>@<version>` and publish one\n * workspace at a time.\n */\nexport function discoverPublicPackageEntries(cwd: string): readonly PublicPackageEntry[] {\n\treturn discoverManifests(cwd).flatMap(({ manifest, dir }) =>\n\t\t!manifest.private && manifest.name && manifest.version\n\t\t\t? [{ name: manifest.name, version: manifest.version, dir }]\n\t\t\t: []\n\t);\n}\n","import { getLogger } from \"../../../observability/logger/index.js\";\nimport { defaultExec } from \"../default-exec.js\";\nimport { discoverPublicPackageEntries } from \"../discover-public-package-entries.js\";\nimport type { PublishReport } from \"../publish.type.js\";\nimport { workspaceFilterArgs } from \"../workspace-filter-args.js\";\nimport type { RunSteadyPublishInput } from \"./run-steady-publish.type.js\";\n\n/**\n * `holocron package publish` (no `--initial`) — the steady-state publish\n * `exec.publishCmd` in `release.config.ts` should call, replacing each\n * repo's hand-typed `pnpm -r --filter=./packages/* publish ...` shell (which\n * differs, today, only in monorepo-vs-single-package, provenance on/off, and\n * whether a repo needs to skip already-published packages) with one uniform\n * invocation. Part of the config-resolution workstream, #676 — see\n * `.notes/tech-config-resolution.spec.md`.\n *\n * Deliberately does not do the `--initial` bootstrap dance (npm\n * login-if-needed, Trusted Publisher next-steps printout) — a steady-state\n * publish runs in CI, authenticated via OIDC automatically, no interactive\n * step involved. Reuses `workspaceFilterArgs()`'s monorepo-vs-single-package\n * detection rather than duplicating it.\n */\nexport async function runSteadyPublish(input: RunSteadyPublishInput = {}): Promise<PublishReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst tag = input.tag ?? \"latest\";\n\tconst dryRun = input.dryRun ?? false;\n\tconst otp = input.otp;\n\tconst exec = input.exec ?? defaultExec;\n\tconst provenance = input.provenance ?? true;\n\tconst skipAlreadyPublished = input.skipAlreadyPublished ?? false;\n\tconst entries = input.packages ?? discoverPublicPackageEntries(cwd);\n\tconst packageNames = entries.map((e) => e.name);\n\n\tprint(`Holocron publish${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` cwd: ${cwd}`);\n\tprint(` tag: ${tag}`);\n\tprint(` provenance: ${provenance}`);\n\tif (skipAlreadyPublished) print(\" skip-already-published: true\");\n\tlogger.info({ tag, provenance, skipAlreadyPublished, dryRun: dryRun || undefined }, \"publish: start\");\n\tif (otp) print(` otp: <${otp.length} chars>`);\n\tprint(\"\");\n\n\tif (entries.length === 0) {\n\t\tconst message = \"nothing to publish (no packages/*, plugins/*, or root package.json is private or unnamed)\";\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ reason: message }, \"publish: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\n\tconst baseFlags = [\"--access\", \"public\", \"--no-git-checks\", \"--tag\", tag, ...(provenance ? [\"--provenance\"] : [])];\n\tconst otpFlags = otp ? [\"--otp\", otp] : [];\n\n\tif (dryRun) {\n\t\tprint(\"\");\n\t\tif (skipAlreadyPublished) {\n\t\t\tfor (const entry of entries) {\n\t\t\t\tprint(` … would check ${entry.name}@${entry.version}, publish if not already on npm`);\n\t\t\t}\n\t\t} else {\n\t\t\tconst args = [...workspaceFilterArgs(cwd), \"publish\", ...baseFlags, ...otpFlags];\n\t\t\tprint(` … (dry-run) skipping actual publish`);\n\t\t\tprint(` would run: pnpm ${args.join(\" \")}`);\n\t\t}\n\t\tlogger.info({ tag, status: \"dry-run\", packages: entries.length }, \"publish: done\");\n\t\treturn { status: \"dry-run\", message: \"dry-run — no publish executed\", packageNames };\n\t}\n\n\tif (skipAlreadyPublished) {\n\t\tprint(\" → publishing packages not already on npm…\");\n\t\tfor (const entry of entries) {\n\t\t\tconst view = await exec(\"npm\", [\"view\", `${entry.name}@${entry.version}`, \"version\"], { cwd });\n\t\t\tif (view.exitCode === 0 && view.stdout.trim()) {\n\t\t\t\tprint(` skip ${entry.name}@${entry.version} (already published)`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst publish = await exec(\"pnpm\", [\"--filter\", entry.dir, \"publish\", ...baseFlags, ...otpFlags], { cwd });\n\t\t\tif (publish.exitCode !== 0) {\n\t\t\t\tconst message = `publish failed for ${entry.name}@${entry.version} (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || \"no output\"}`;\n\t\t\t\tprint(` ✗ ${message}`);\n\t\t\t\tlogger.warn({ tag, package: entry.name, reason: message }, \"publish: done\");\n\t\t\t\treturn { status: \"fail\", message, packageNames };\n\t\t\t}\n\t\t\tprint(` ✓ ${entry.name}@${entry.version}`);\n\t\t}\n\t\tlogger.info({ tag, status: \"ok\", packages: entries.length }, \"publish: done\");\n\t\treturn { status: \"ok\", packageNames };\n\t}\n\n\tprint(\" → publishing all public @theholocron/* packages…\");\n\tconst args = [...workspaceFilterArgs(cwd), \"publish\", ...baseFlags, ...otpFlags];\n\tconst publish = await exec(\"pnpm\", args, { cwd });\n\tif (publish.exitCode !== 0) {\n\t\tconst message = `publish failed (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || \"no output\"}`;\n\t\tprint(` ✗ ${message}`);\n\t\tif (publish.stdout.includes(\"EOTP\") || publish.stderr.includes(\"EOTP\")) {\n\t\t\tprint(\"\");\n\t\t\tprint(\" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:\");\n\t\t\tprint(` pnpm exec holocron package publish --otp <6-digit-code>`);\n\t\t}\n\t\tlogger.warn({ tag, reason: message }, \"publish: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\tprint(\" ✓ publish complete\");\n\tlogger.info({ tag, status: \"ok\", packages: entries.length }, \"publish: done\");\n\treturn { status: \"ok\", packageNames };\n}\n","import type { NpmTrustError } from \"./run-sync-trust/index.js\";\n\nexport function isEotp(parsed: unknown): boolean {\n\treturn (\n\t\ttypeof parsed === \"object\" &&\n\t\tparsed !== null &&\n\t\t\"error\" in parsed &&\n\t\t(parsed as NpmTrustError).error?.code === \"EOTP\"\n\t);\n}\n","export function parseJson(raw: string): unknown {\n\ttry {\n\t\treturn JSON.parse(raw) as unknown;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n","import { getLogger } from \"../../../observability/logger/index.js\";\nimport { defaultExec } from \"../default-exec.js\";\nimport { discoverPublicPackages } from \"../discover-public-packages.js\";\nimport { isEotp } from \"../is-eotp.js\";\nimport { parseJson } from \"../parse-json.js\";\nimport type {\n\tNpmTrustEntry,\n\tNpmTrustError,\n\tRunSyncTrustInput,\n\tSyncTrustPackageResult,\n\tSyncTrustReport,\n} from \"./run-sync-trust.type.js\";\n\n/**\n * `holocron package publish --sync-trust <old-file> <new-file>` — bulk-migrates npm\n * Trusted Publisher (OIDC) config to a new workflow filename across every\n * public package. See issue #689 / `scripts/npm-trust-migrate.sh` (the\n * shell-script prototype this supersedes) for the full \"why\": npm ties\n * Trusted Publisher to a workflow FILENAME per package, so renaming the\n * release workflow breaks OIDC publish (`ENEEDAUTH`) until every package's\n * config is updated to match.\n *\n * Requires npm@11.15.0+ (`npm trust`) — always shells out through\n * `npx -y npm@latest` regardless of the locally-installed npm version.\n *\n * npm's `trust` mutations — and reads, once a short-lived OTP grant lapses —\n * require a fresh interactive browser 2FA approval (an `EOTP` error with an\n * `authUrl`). No token bypasses this (npm's own docs: Granular Access Tokens\n * with the bypass-2FA option are explicitly unsupported for trust commands).\n * This command can't drive that browser step itself, so on the first `EOTP`\n * it stops immediately, prints the `authUrl`, and returns — the operator\n * approves it and re-runs; already-migrated packages are skipped on the next\n * pass, so it's safe to resume from wherever it stopped.\n */\nexport async function runSyncTrust(input: RunSyncTrustInput): Promise<SyncTrustReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst repo = input.repo ?? \"theholocron/holocron\";\n\tconst dryRun = input.dryRun ?? false;\n\tconst exec = input.exec ?? defaultExec;\n\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\tconst npm = \"npx\";\n\tconst npmArgs = [\"-y\", \"npm@latest\"];\n\n\tprint(`Holocron publish --sync-trust${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` ${input.oldFile} -> ${input.newFile} (repo: ${repo})`);\n\tprint(` ${packageNames.length} public packages`);\n\tprint(\"\");\n\tlogger.info({ oldFile: input.oldFile, newFile: input.newFile, packages: packageNames.length }, \"sync-trust: start\");\n\n\tif (packageNames.length === 0) {\n\t\tconst message = \"nothing to sync (no packages/*, plugins/*, or root package.json is private or unnamed)\";\n\t\tprint(` ✗ ${message}`);\n\t\treturn { status: \"fail\", message, packages: [] };\n\t}\n\n\tif (dryRun) {\n\t\tfor (const name of packageNames) print(` … would sync ${name}`);\n\t\treturn { status: \"dry-run\", message: \"dry-run — no npm calls made\", packages: [] };\n\t}\n\n\tconst results: SyncTrustPackageResult[] = [];\n\n\tfor (const name of packageNames) {\n\t\tprint(`=== ${name} ===`);\n\t\tconst listResult = await exec(npm, [...npmArgs, \"trust\", \"list\", name, \"--json\"], { cwd });\n\t\tconst parsed = parseJson(listResult.stdout);\n\n\t\tif (isEotp(parsed)) {\n\t\t\tconst authUrl = (parsed as NpmTrustError).error?.authUrl ?? \"\";\n\t\t\tprint(` needs fresh 2FA — open and approve: ${authUrl}`);\n\t\t\tprint(\" then re-run; already-migrated packages are skipped.\");\n\t\t\tresults.push({ name, status: \"needs-auth\", message: authUrl });\n\t\t\tlogger.warn({ package: name, authUrl }, \"sync-trust: needs auth, stopping\");\n\t\t\treturn { status: \"fail\", message: \"npm 2FA grant needed — see printed authUrl\", packages: results };\n\t\t}\n\n\t\tconst entry = parsed as NpmTrustEntry;\n\t\tif (entry.file === input.newFile) {\n\t\t\tprint(` already on ${input.newFile}, skipping`);\n\t\t\tresults.push({ name, status: \"skipped\" });\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (entry.id) {\n\t\t\tprint(` revoking existing trust (file=${entry.file ?? \"?\"}, id=${entry.id})`);\n\t\t\tconst revoke = await exec(npm, [...npmArgs, \"trust\", \"revoke\", name, \"--id\", entry.id, \"-y\"], { cwd });\n\t\t\tif (revoke.exitCode !== 0 && isEotp(parseJson(revoke.stdout))) {\n\t\t\t\tconst authUrl = (parseJson(revoke.stdout) as NpmTrustError).error?.authUrl ?? \"\";\n\t\t\t\tprint(` needs fresh 2FA — open and approve: ${authUrl}`);\n\t\t\t\tresults.push({ name, status: \"needs-auth\", message: authUrl });\n\t\t\t\treturn { status: \"fail\", message: \"npm 2FA grant needed — see printed authUrl\", packages: results };\n\t\t\t}\n\t\t} else {\n\t\t\tprint(\" no existing trust config found\");\n\t\t}\n\n\t\tprint(` creating trust: ${input.newFile}`);\n\t\tconst create = await exec(\n\t\t\tnpm,\n\t\t\t[\n\t\t\t\t...npmArgs,\n\t\t\t\t\"trust\",\n\t\t\t\t\"github\",\n\t\t\t\tname,\n\t\t\t\t\"--repo\",\n\t\t\t\trepo,\n\t\t\t\t\"--file\",\n\t\t\t\tinput.newFile,\n\t\t\t\t\"--allow-publish\",\n\t\t\t\t\"--allow-stage-publish\",\n\t\t\t\t\"-y\",\n\t\t\t],\n\t\t\t{ cwd }\n\t\t);\n\t\tif (create.exitCode === 0) {\n\t\t\tprint(\" ✓ ok\");\n\t\t\tresults.push({ name, status: \"ok\" });\n\t\t} else {\n\t\t\tconst createParsed = parseJson(create.stdout);\n\t\t\tif (isEotp(createParsed)) {\n\t\t\t\tconst authUrl = (createParsed as NpmTrustError).error?.authUrl ?? \"\";\n\t\t\t\tprint(` needs fresh 2FA — open and approve: ${authUrl}`);\n\t\t\t\tresults.push({ name, status: \"needs-auth\", message: authUrl });\n\t\t\t\treturn { status: \"fail\", message: \"npm 2FA grant needed — see printed authUrl\", packages: results };\n\t\t\t}\n\t\t\tconst message = create.stderr.trim() || create.stdout.trim() || `exit ${create.exitCode}`;\n\t\t\tprint(` ✗ FAILED: ${message}`);\n\t\t\tresults.push({ name, status: \"fail\", message });\n\t\t}\n\t}\n\n\tconst failed = results.filter((r) => r.status === \"fail\");\n\tlogger.info({ ok: results.filter((r) => r.status === \"ok\").length, failed: failed.length }, \"sync-trust: done\");\n\treturn {\n\t\tstatus: failed.length > 0 ? \"fail\" : \"ok\",\n\t\t...(failed.length > 0 ? { message: `${failed.length} package(s) failed` } : {}),\n\t\tpackages: results,\n\t};\n}\n","/**\n * `holocron secrets set` — one-shot single-secret push.\n *\n * Complements `holocron secrets sync` (bulk vault → destinations) for\n * ad-hoc scenarios:\n * - Bootstrap secrets (e.g., NPM_TOKEN on theholocron/holocron itself\n * before the rest of the setup exists)\n * - One-off rotations that don't warrant a vault sync\n * - Setting secrets the vault doesn't track\n *\n * Value source resolution (in priority order):\n * 1. Positional `value` argument\n * 2. `--from-stdin` reads from stdin\n * 3. `--from-env <NAME>` reads from the named env var\n * 4. Implicit: env var matching the secret name (e.g., `NPM_TOKEN`)\n *\n * Errors clearly when no value can be sourced.\n */\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { env } from \"../../env/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { assertPluginsResolvable, PluginLoader, type Secrets, type SecretScope } from \"../../plugin/index.js\";\nimport type { RunSecretSetInput, SecretSetReport } from \"./secret-set.type.js\";\n\nexport async function runSecretSet(input: RunSecretSetInput): Promise<SecretSetReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"secrets set\");\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst scope: SecretScope = input.scope ?? { kind: \"repo\" };\n\n\tif (!loader.has(\"secrets\")) {\n\t\tthrow new Error(\"`secrets` capability is not configured — add a `secrets` provider to holocron.config.json\");\n\t}\n\n\t// Resolve the value to push, surfacing a clear error when none can be sourced.\n\tconst value = await resolveValue(input);\n\tif (!value) {\n\t\tthrow new Error(\n\t\t\t`no value for secret \\`${input.name}\\` — pass it positionally, via --from-stdin, --from-env <NAME>, or set $${input.name} in the environment`\n\t\t);\n\t}\n\n\tprint(`Holocron secret set — ${input.name} (${describeScope(scope)})${dryRun ? \" (dry-run)\" : \"\"}`);\n\n\tif (dryRun) {\n\t\tconst message = `would: secrets.setSecret(${describeScope(scope)}, ${input.name}, <${value.length} chars>)`;\n\t\tprint(` … ${message}`);\n\t\treturn { status: \"dry-run\", name: input.name, scope, message };\n\t}\n\n\ttry {\n\t\tconst secrets = loader.get(\"secrets\") as Secrets;\n\t\tawait secrets.setSecret(scope, input.name, value);\n\t\tprint(` ✓ set ${input.name} via ${secrets.providerName}`);\n\t\t// `name` is a secret NAME, never the value.\n\t\tlogger.info(\n\t\t\t{ key: input.name, scope: describeScope(scope), provider: secrets.providerName, status: \"ok\" },\n\t\t\t`secret set: ${input.name}`\n\t\t);\n\t\treturn { status: \"ok\", name: input.name, scope };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ key: input.name, scope: describeScope(scope), reason: message }, `secret set: ${input.name}`);\n\t\treturn { status: \"fail\", name: input.name, scope, message };\n\t}\n}\n\n// ── helpers ──────────────────────────────────────────────────────────\n\nasync function resolveValue(input: RunSecretSetInput): Promise<string | undefined> {\n\tif (input.value) return input.value;\n\tif (input.fromStdin) {\n\t\tconst reader = input.readStdin ?? defaultReadStdin;\n\t\tconst text = await reader();\n\t\treturn text.replace(/\\r?\\n$/, \"\"); // trim trailing newline\n\t}\n\tif (input.fromEnv) {\n\t\treturn env.get(input.fromEnv);\n\t}\n\t// Implicit: env var with the same name as the secret.\n\treturn env.get(input.name);\n}\n\nasync function defaultReadStdin(): Promise<string> {\n\tconst chunks: Buffer[] = [];\n\treturn new Promise<string>((resolve, reject) => {\n\t\tprocess.stdin.on(\"data\", (chunk: Buffer) => chunks.push(chunk));\n\t\tprocess.stdin.on(\"end\", () => resolve(Buffer.concat(chunks).toString(\"utf8\")));\n\t\tprocess.stdin.on(\"error\", reject);\n\t});\n}\n\nfunction describeScope(scope: SecretScope): string {\n\tif (scope.kind === \"repo\") return \"scope=repo\";\n\tif (scope.kind === \"environment\") return `scope=environment:${scope.name}`;\n\treturn `scope=organization:${scope.name}`;\n}\n","/**\n * `holocron secrets sync` — vault → destinations.\n *\n * Reads a named environment from the configured `vault` (1P\n * Environment / similar) as KEY=VALUE pairs, then fans those values\n * out to the configured destinations:\n *\n * - `secrets` capability (e.g., GH Actions secrets) — repo-scope\n * - `deployment` capability (e.g., Vercel env vars) — per-target\n * - local `.env` file (optional, planned for v5.1 — currently skipped\n * with a soft \"not yet\" note)\n *\n * Per-secret routing rules:\n *\n * - All keys go to `deployment` for each target the caller asks for\n * (defaults: production + preview)\n * - `secrets` (GH Actions) defaults to every key, repo-scoped — but a\n * caller can pass `githubSecretKeys` (an allowlist, from repeatable\n * `--github-secret KEY` CLI values) to restrict `secrets` to only\n * those keys, and `githubSecretScope` (same `{ kind }` shape `secret\n * set`'s own `--scope repo|env=NAME|org=NAME` parses to) to apply one\n * scope to all of them. A key not in the allowlist is skipped for\n * `secrets` entirely — still synced to `deployment` if configured.\n * Needed for a vault holding a mix of deploy-only secrets and one\n * CI-consumed, org-wide secret (holocron#781's Sentinel case: 4\n * Vercel-only keys + one org-scoped Axiom ingest token\n * `theholocron/.github`'s dispatched-check workflow also reads).\n *\n * The vault MUST implement `readEnvironment(envId)` (optional method).\n * If it doesn't, the command errors with a hint to populate the keys\n * individually via `holocron secrets set` (also planned for v5.1).\n */\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Deployment,\n\ttype DeploymentTarget,\n\tPluginLoader,\n\ttype Secrets,\n\ttype SecretScope,\n\ttype Vault,\n} from \"../../plugin/index.js\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport type { RunSecretsSyncInput, SyncReport, SyncRow } from \"./secrets-sync.type.js\";\n\nexport async function runSecretsSync(input: RunSecretsSyncInput): Promise<SyncReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait withSpinner(\"Loading plugins…\", () => loader.load());\n\tassertPluginsResolvable(loader, \"secrets sync\");\n\n\tlogger.info(\n\t\t{ environment: input.environmentId, dryRun: (input.context.dryRun ?? false) || undefined },\n\t\t\"secrets sync: start\"\n\t);\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst targets = input.targets ?? ([\"production\", \"preview\"] as DeploymentTarget[]);\n\n\tprint(style.header(`Holocron secrets sync — environment ${input.environmentId}${dryRun ? \" (dry-run)\" : \"\"}`));\n\tprint(style.dim(` vault: ${vaultProviderName(loader)}`));\n\tprint(\"\");\n\n\t// ── Read the vault ─────────────────────────────────────────────────\n\tconst vault = loader.get(\"vault\") as Vault;\n\tif (!vault.readEnvironment) {\n\t\tthrow new Error(\n\t\t\t`vault provider (${vault.providerName}) does not implement readEnvironment — sync needs bulk env reads`\n\t\t);\n\t}\n\tconst envVars = await withSpinner(`Reading vault environment ${input.environmentId}…`, () =>\n\t\tvault.readEnvironment!(input.environmentId)\n\t);\n\tconst keys = Object.keys(envVars).sort();\n\tprint(style.step(`read ${keys.length} keys from vault`));\n\tprint(\"\");\n\n\tconst rows: SyncRow[] = [];\n\n\t// ── Push to `secrets` (CI/Actions secrets) ─────────────────────────\n\tif (loader.has(\"secrets\")) {\n\t\tconst secrets = loader.get(\"secrets\") as Secrets;\n\t\tconst scope = input.githubSecretScope ?? { kind: \"repo\" };\n\t\tconst allowedKeys = input.githubSecretKeys ? new Set(input.githubSecretKeys) : undefined;\n\t\tprint(style.step(\"secrets\"));\n\t\tfor (const key of keys) {\n\t\t\t// No allowlist → every key (original default). With one → only\n\t\t\t// listed keys; an unlisted key is skipped for `secrets` entirely\n\t\t\t// (still reaches `deployment` above, if configured).\n\t\t\tif (allowedKeys && !allowedKeys.has(key)) continue;\n\n\t\t\trows.push(\n\t\t\t\tawait runRow(`secrets:${secrets.providerName}`, scopeLabel(scope), key, dryRun, async () => {\n\t\t\t\t\tawait secrets.setSecret(scope, key, envVars[key]!);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatRow(rows[rows.length - 1]!));\n\t\t}\n\t}\n\n\t// ── Push to `deployment` (Vercel env vars) ─────────────────────────\n\tif (loader.has(\"deployment\")) {\n\t\tconst deploy = loader.get(\"deployment\") as Deployment;\n\t\tif (!input.projectId) {\n\t\t\tprint(style.step(\"deployment\"));\n\t\t\tconst row: SyncRow = {\n\t\t\t\tdestination: `deployment:${deploy.providerName}`,\n\t\t\t\tscope: \"no projectId\",\n\t\t\t\tkey: \"(all)\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"projectId required for deployment env-var sync (pass --project-id)\",\n\t\t\t};\n\t\t\trows.push(row);\n\t\t\tprint(formatRow(row));\n\t\t} else {\n\t\t\tfor (const target of targets) {\n\t\t\t\tprint(style.step(`deployment (target=${target})`));\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\trows.push(\n\t\t\t\t\t\tawait runRow(`deployment:${deploy.providerName}`, `target=${target}`, key, dryRun, async () => {\n\t\t\t\t\t\t\tawait deploy.setEnvVar(input.projectId!, target, key, envVars[key]!);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatRow(rows[rows.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const r of rows) {\n\t\t// `key` is a secret NAME, never a value — safe to log. The logger also\n\t\t// redacts `secrets[*].value` shapes as defence in depth.\n\t\tlogger[r.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{\n\t\t\t\tdestination: r.destination,\n\t\t\t\tscope: r.scope,\n\t\t\t\tkey: r.key,\n\t\t\t\tstatus: r.status,\n\t\t\t\t...(r.message ? { detail: r.message } : {}),\n\t\t\t},\n\t\t\t`secrets sync: ${r.key} → ${r.destination}`\n\t\t);\n\t}\n\n\tconst summary = rows.reduce(\n\t\t(acc, r) => {\n\t\t\tif (r.status === \"ok\") acc.ok += 1;\n\t\t\telse if (r.status === \"fail\") acc.fail += 1;\n\t\t\telse if (r.status === \"skip\") acc.skip += 1;\n\t\t\telse if (r.status === \"dry-run\") acc.dryRun += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0, dryRun: 0 }\n\t);\n\n\tlogger[summary.fail > 0 ? \"warn\" : \"info\"]({ ...summary, keys: rows.length }, \"secrets sync: done\");\n\n\tprint(\"\");\n\tconst summaryLine = `${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${\n\t\tdryRun ? `, ${summary.dryRun} would-do` : \"\"\n\t}`;\n\tprint(summary.fail > 0 ? style.fail(summaryLine) : style.success(summaryLine));\n\n\treturn { rows, summary };\n}\n\n// ── helpers ──────────────────────────────────────────────────────────\n\nasync function runRow(\n\tdestination: string,\n\tscope: string,\n\tkey: string,\n\tdryRun: boolean,\n\tbody: () => Promise<void>\n): Promise<SyncRow> {\n\tif (dryRun) {\n\t\treturn { destination, scope, key, status: \"dry-run\" };\n\t}\n\ttry {\n\t\tawait body();\n\t\treturn { destination, scope, key, status: \"ok\" };\n\t} catch (err) {\n\t\treturn {\n\t\t\tdestination,\n\t\t\tscope,\n\t\t\tkey,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n\nfunction formatRow(row: SyncRow): string {\n\tconst detail = row.message ? style.dim(` (${row.message})`) : \"\";\n\tconst label = `${row.key}${detail}`;\n\tif (row.status === \"ok\") return ` ${style.success(label)}`;\n\tif (row.status === \"fail\") return ` ${style.fail(label)}`;\n\tif (row.status === \"dry-run\") return ` ${style.dim(`… ${label}`)}`;\n\treturn ` ${style.dim(`· ${label}`)}`;\n}\n\nfunction scopeLabel(scope: SecretScope): string {\n\tif (scope.kind === \"repo\") return \"scope=repo\";\n\tif (scope.kind === \"organization\") return `scope=organization,org=${scope.name}`;\n\treturn `scope=environment,env=${scope.name}`;\n}\n\nfunction vaultProviderName(loader: PluginLoader): string {\n\tif (!loader.has(\"vault\")) return \"<missing>\";\n\treturn (loader.get(\"vault\") as Vault).providerName;\n}\n","import { join } from \"node:path\";\n\nimport type { WorkspacePackage } from \"@theholocron/astromech\";\nimport { readPackageJson } from \"@theholocron/pkg-utils\";\n\nimport type { ResolvedProvidersConfig } from \"../../../config/index.js\";\nimport type { DeriveProfileInput, HolocronProfile, PackageJsonLike } from \"./derived-properties.type.js\";\n\n/**\n * Repo archetype, in priority order:\n * 1. `*-template` repo name → `template` (independent of package shape).\n * 2. Monorepo whose primary published artifact is a CLI (some workspace\n * package has `bin`) → `platform` — matches `holocron` itself: the CLI is\n * the deliverable, the plugin packages are supporting infrastructure for\n * it, not separate products.\n * 3. Monorepo with no CLI but at least one non-private workspace package →\n * `library` — matches `clients`/`configs`/`utils`/`themes`/\n * `observability`: a family of published packages, none of them a CLI.\n * Checked *before* falling into the root-package branch below, because\n * these repos' own root `package.json` is private and often carries\n * `@theholocron/astro-config` for a docs site built from the monorepo\n * root — without this check they'd wrongly resolve to `docs` off that\n * root-level signal alone, when the docs site is a secondary concern of\n * a library collection, not what the repo fundamentally is.\n * 4. Single-package repo with `package.json#bin` → `cli`.\n * 5. Docs-only site (astro/starlight present, root package private, no\n * publishable exports) → `docs`.\n * 6. Private, non-publishable, non-docs → `app`.\n * 7. Otherwise, a single publishable package → `library`.\n */\nexport function deriveProfile(input: DeriveProfileInput): HolocronProfile {\n\tif (/-template$/.test(input.repoName)) return \"template\";\n\n\tif (input.isMonorepo) {\n\t\tconst hasPublishedCli = input.workspacePackageJsons.some((pkg) => Boolean(pkg.bin));\n\t\tif (hasPublishedCli) return \"platform\";\n\n\t\tconst hasPublishedLibrary = input.workspacePackageJsons.some((pkg) => pkg.private !== true);\n\t\tif (hasPublishedLibrary) return \"library\";\n\t}\n\n\tconst pkg = input.rootPackageJson;\n\tif (pkg?.bin) return \"cli\";\n\n\tconst deps = { ...pkg?.dependencies, ...pkg?.devDependencies };\n\tconst isDocsSite = Boolean(deps[\"@theholocron/astro-config\"] || deps[\"astro\"]);\n\tif (pkg?.private && isDocsSite) return \"docs\";\n\tif (pkg?.private) return \"app\";\n\n\treturn \"library\";\n}\n\nconst KNOWN_STACK_DEPS = [\n\t\"next\",\n\t\"vite\",\n\t\"astro\",\n\t\"tsdown\",\n\t\"rollup\",\n\t\"webpack\",\n\t\"storybook\",\n\t\"vitest\",\n\t\"playwright\",\n\t\"turbo\",\n] as const;\n\n/**\n * Detected build/framework tooling — the literal \"does this repo need\n * next/vite/tsdown\" signal `holocron.config.ts` has no field for today\n * (framework choice isn't a config concept, unlike `providers`/`tasks`).\n * Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new\n * frameworks show up rather than trying to detect anything on npm.\n */\nexport function deriveStack(pkg: PackageJsonLike | null): string[] {\n\tconst deps = { ...pkg?.dependencies, ...pkg?.devDependencies };\n\treturn KNOWN_STACK_DEPS.filter((name) => name in deps);\n}\n\n/** The provider capability keys actually wired in `providers: {}` — zero heuristics. */\nexport function deriveCapabilities(providers: ResolvedProvidersConfig | undefined): string[] {\n\treturn Object.keys(providers ?? {}).sort();\n}\n\n/**\n * `source` + `ci` are the minimal baseline every repo `holocron repo setup`\n * touches wires — every `holocron.config.ts` in this org already satisfies\n * this, so `non-compliant` here means drift (a provider manually removed\n * after setup), not an unmet aspirational policy. Deliberately not a richer\n * per-profile policy yet (e.g. \"a `library` must have `deployment`\") — that's\n * a Phase B (GitHub App) refinement once it can post *why* on a check run.\n */\nconst REQUIRED_BASELINE = [\"source\", \"ci\"] as const;\n\nexport function deriveCompliance(capabilities: readonly string[]): \"compliant\" | \"non-compliant\" {\n\treturn REQUIRED_BASELINE.every((key) => capabilities.includes(key)) ? \"compliant\" : \"non-compliant\";\n}\n\n/**\n * The Phase B refinement `deriveCompliance()`'s own doc comment names —\n * *why* a repo is non-compliant, not just that it is. `[]` when compliant.\n * Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one\n * table, not two independently-maintained baselines.\n */\nexport function missingCapabilities(capabilities: readonly string[]): string[] {\n\treturn REQUIRED_BASELINE.filter((key) => !capabilities.includes(key));\n}\n\n/**\n * Reads each workspace package's actual `package.json` content (not just\n * `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s\n * `platform` detection needs `bin`, which that helper doesn't carry).\n * Missing/invalid files are skipped, matching `readWorkspacePackages()`'s\n * own soft-fail behavior.\n */\nexport async function readWorkspacePackageJsons(\n\trepoRoot: string,\n\tworkspacePackages: readonly WorkspacePackage[]\n): Promise<PackageJsonLike[]> {\n\tconst results: PackageJsonLike[] = [];\n\tfor (const { slug, dir = \"packages\" } of workspacePackages) {\n\t\t// no package.json or invalid JSON — skipped, same as readWorkspacePackages().\n\t\tconst pkg = await readPackageJson(join(repoRoot, dir, slug));\n\t\tif (pkg) results.push(pkg);\n\t}\n\treturn results;\n}\n","export const CANONICAL_LABELS = [\n\t{ name: \"bug\", color: \"d73a4a\", description: \"Something isn't working\" },\n\t{ name: \"chore\", color: \"ededed\", description: \"Maintenance, no user-facing change\" },\n\t{ name: \"ci\", color: \"0075ca\", description: \"CI/CD pipeline changes\" },\n\t{ name: \"dependencies\", color: \"0366d6\", description: \"Dependency update\" },\n\t{ name: \"documentation\", color: \"0075ca\", description: \"Documentation only\" },\n\t{ name: \"duplicate\", color: \"cfd3d7\", description: \"Already reported\" },\n\t{ name: \"enhancement\", color: \"a2eeef\", description: \"New feature or request\" },\n\t{ name: \"good first issue\", color: \"7057ff\", description: \"Good for newcomers\" },\n\t{ name: \"help wanted\", color: \"008672\", description: \"Extra attention needed\" },\n\t{ name: \"invalid\", color: \"e4e669\", description: \"Doesn't seem right\" },\n\t{ name: \"performance\", color: \"fbca04\", description: \"Performance improvement\" },\n\t{ name: \"question\", color: \"d876e3\", description: \"Further information requested\" },\n\t{ name: \"refactor\", color: \"cfd3d7\", description: \"Code restructuring\" },\n\t{ name: \"released\", color: \"ededed\", description: \"Included in a release\" },\n\t{ name: \"test\", color: \"bfd4f2\", description: \"Test-related changes\" },\n\t{ name: \"triage\", color: \"e4e669\", description: \"Needs investigation\" },\n\t{ name: \"wontfix\", color: \"ffffff\", description: \"Won't be addressed\" },\n] as const;\n\nexport const STALE_LABELS = [\n\t\"github_actions\",\n\t\"javascript\",\n\t\"autorelease: pending\",\n\t\"autorelease: tagged\",\n\t\"released on @alpha\",\n];\n","allowRemediationCommits:\n individual: true\n","/**\n * Canonical AI engineering workflow role prompts.\n *\n * Written to `.agents/prompts/<role>.md` by `holocron repo setup` when `agent` is\n * configured. Paths are gitignored and regenerated on every setup run so the\n * content always reflects the current CLI version.\n *\n * Source: docs/wiki/specifications/ai-engineering-workflow.spec.md\n */\n\nexport const AGENT_PROMPTS: Record<string, string> = {\n\t\"discovery.md\": `# Discovery Agent\n\nYou are performing engineering discovery.\n\nYour goal is to understand the problem and the existing system before\nproposing implementation changes.\n\nRead the relevant issue, repository code, documentation, specifications,\nand ADRs.\n\nInvestigate:\n- current behavior\n- relevant architecture\n- dependencies\n- constraints\n- existing patterns\n- affected packages/services\n- compatibility concerns\n- security concerns\n- operational concerns\n\nDo not implement anything.\nDo not assume the proposed solution is correct.\n\nProduce:\n1. Problem summary\n2. Current system behavior\n3. Relevant architecture\n4. Constraints\n5. Systems/packages likely affected\n6. Unknowns or open questions\n7. Risks\n8. Decisions that may require architectural discussion\n9. Recommended next step\n\nIf you discover a meaningful architectural choice, explicitly identify it\nrather than silently making the decision.\n`,\n\n\t\"design.md\": `# Design Agent\n\nYou are acting as a software architect.\n\nUsing the issue, discovery findings, existing architecture, specifications,\nand ADRs, propose a design for this change.\n\nDo not write implementation code.\n\nIdentify the important engineering decisions required.\n\nFor each meaningful decision:\n1. Explain the decision that must be made.\n2. Describe viable alternatives.\n3. Explain advantages and disadvantages.\n4. Identify operational and maintenance consequences.\n5. Recommend an approach and explain why.\n\nTreat existing accepted ADRs as architectural constraints.\nDo not contradict an accepted ADR without explicitly identifying the conflict.\n\nAt the end, produce:\n- Recommended design\n- Open questions\n- Decisions requiring ADRs\n- Decisions that are implementation details and do not require ADRs\n- Suggested specification scope\n\nDo not create ADRs merely because a choice exists. An ADR is warranted only\nwhen the decision is significant enough that a future engineer may reasonably\nask why one approach was selected over another.\n`,\n\n\t\"discussion.md\": `# Discussion / RFC Agent\n\nConvert the design analysis into a GitHub Discussion suitable for engineering\nreview.\n\nInclude:\n\n# Problem\n# Context\n# Constraints\n\n# Options\nFor each option:\n- description\n- advantages\n- disadvantages\n- operational consequences\n- implementation complexity\n\n# Recommended Direction\nState the recommendation clearly as a proposal, not a decision.\n\n# Open Questions\n# Decision Requested\n\nAvoid implementation-level details unless they materially affect the\narchitectural choice.\n`,\n\n\t\"adr.md\": `# ADR Author\n\nCreate an Architecture Decision Record from the accepted engineering decision.\n\nUse the accepted GitHub Discussion as the primary source of decision history.\n\nCapture the final architectural conclusion, not the full discussion.\n\nInclude:\n- Title\n- Status\n- Date\n- Context\n- Decision\n- Rationale\n- Alternatives considered\n- Consequences\n- Related issue, Discussion, and specifications\n\nClearly distinguish between the final decision, supporting rationale, and\nalternatives that were rejected.\n\nDo not introduce new architectural decisions.\n\nIf the Discussion does not contain enough information to state a decision\nconfidently, identify the missing information instead of inventing it.\n\n## Format\n\nUse MADR format. Start from the \\`adr\\` skill's template,\n\\`.agents/skills/adr/assets/template.md\\`, and number the record sequentially.\n\\`holocron repo setup\\` installs that skill when \\`adr\\` is listed under\n\\`skills\\` in \\`holocron.config\\` — if the file is missing, add it there and\nre-run setup.\n\n\\`\\`\\`sh\ncp .agents/skills/adr/assets/template.md docs/wiki/decisions/000N-short-title.md\n\\`\\`\\`\n\nSave to \\`docs/wiki/decisions/NNNN-<slug>.md\\`.\n`,\n\n\t\"spec.md\": `# Specification Agent\n\nYou are acting as a technical specification author.\n\nCreate a specification for the requested capability using:\n- the GitHub issue\n- accepted design decisions\n- accepted ADRs\n- existing system behavior\n- relevant repository documentation\n\nTreat accepted ADRs as architectural constraints.\n\nThe specification should describe WHAT the system must do, not how to implement it.\n\nInclude:\n- Objective\n- Background\n- Goals / Non-goals\n- Existing behavior\n- Required behavior\n- Interfaces\n- Data model\n- Validation\n- State transitions\n- Error handling\n- Authorization / security\n- Observability\n- Compatibility requirements\n- Edge cases\n- Testing requirements\n- Acceptance criteria\n- Related ADRs and issues\n\nThe specification should be detailed enough that another engineer or AI agent\ncould implement the feature without seeing the original planning conversation.\n\nIMPORTANT: Do not silently make new architectural decisions. If the specification\nrequires a decision that has not been established, mark it as an unresolved\ndesign question and surface it for discussion.\n\n## Process rule\n\nFile a GitHub issue BEFORE writing the spec. The spec's frontmatter \\`issue:\\`\nfield must reference it. Order: Issue → Spec → PR → Review → merge.\n`,\n\n\t\"implementation-plan.md\": `# Implementation Planner\n\nYou are acting as an implementation planner.\n\nTreat the accepted specification and ADRs as authoritative.\n\nInspect the repository and produce a concrete implementation plan for\nsatisfying the specification. Do not redesign the feature.\n\nIdentify:\n- packages/services affected\n- files likely affected\n- new files required\n- schema changes and migrations\n- API changes\n- configuration changes\n- tests required\n- observability changes\n- documentation changes\n- deployment or rollout requirements\n\nProduce an ordered implementation plan. Each step should include:\n1. Goal\n2. Files or modules affected\n3. Expected change\n4. Tests required\n5. Dependencies on earlier steps\n\nIdentify tasks that can safely be implemented in parallel.\n\nIf repository reality conflicts with the specification or ADRs, stop that\nportion of the plan and explicitly describe the conflict. Do not silently\nalter the design to work around it.\n`,\n\n\t\"implement.md\": `# Implementation Agent\n\nYou are implementing an accepted engineering specification.\n\nAuthority order:\n1. Accepted ADRs\n2. Accepted specification\n3. Approved implementation plan\n4. Existing repository conventions\n\nImplement the approved plan.\n\nDo not change product behavior described by the specification.\nDo not contradict accepted ADRs.\nDo not introduce new architectural patterns unless required by the specification.\nFollow existing repository conventions where they do not conflict with the spec.\n\nFor each implementation step:\n- make the required change\n- add or update tests\n- preserve backward compatibility where required\n- add appropriate observability\n- update relevant documentation\n\nIf you discover that repository reality makes the specification impossible or\nrequires a new architectural decision:\n\nSTOP that portion of implementation.\n\nDescribe:\n- what the specification requires\n- what the repository currently supports\n- why they conflict\n- what decision is required\n\nDo not silently invent a new design.\n`,\n\n\t\"review.md\": `# Review Agent\n\nYou are acting as an independent engineering reviewer.\n\nReview the implementation against:\n1. The GitHub issue\n2. Accepted ADRs\n3. The accepted specification\n4. The implementation plan\n5. Repository conventions\n\nDo not assume the implementation is correct simply because tests pass.\n\nEvaluate:\n\n## Specification Compliance\nIdentify every requirement in the specification and determine whether it is\nimplemented.\n\n## ADR Compliance\nIdentify any behavior or architecture that conflicts with accepted ADRs.\n\n## Correctness\nLook for logical errors, invalid state transitions, race conditions, missing\nvalidation, and incorrect assumptions.\n\n## Security\nReview authentication, authorization, data exposure, input handling, and\ntrust boundaries.\n\n## Failure Behavior\nReview errors, retries, partial failures, rollback behavior, and recovery.\n\n## Observability\nConfirm appropriate logs, metrics, traces, and diagnostic information.\n\n## Compatibility\nCheck backward compatibility and migration behavior.\n\n## Testing\nIdentify missing test cases — especially failure paths, boundary conditions,\nauthorization, state transitions, concurrency, and regression cases.\n\n## Scope\nIdentify unrelated changes or unnecessary complexity.\n\nProduce findings ordered by severity. For each finding include:\n- severity\n- location\n- violated requirement or principle\n- explanation\n- recommended correction\n\nFinally provide:\n- specification requirements fully satisfied\n- specification requirements partially satisfied\n- specification requirements missing\n- ADR violations\n- overall recommendation\n`,\n\n\t\"verify.md\": `# Verification Agent\n\nVerify this implementation against the accepted specification.\n\nTreat each acceptance criterion as independently testable.\n\nCreate a requirement matrix containing:\n- requirement\n- implementation location\n- test coverage\n- status (PASS | PARTIAL | FAIL | NOT TESTED)\n- notes\n\nDo not infer compliance merely because related code exists.\nVerify the actual behavior where possible.\nIdentify any specification language that is ambiguous or impossible to verify.\n`,\n};\n\nexport const DECISIONS_README = `# Decisions\n\nArchitectural Decision Records live here. Each file captures one architectural\ndecision, the options that were considered, and the rationale for the choice made.\n\n## Creating a new decision\n\nStart from the template that ships with the \\`adr\\` skill,\n\\`.agents/skills/adr/assets/template.md\\` (installed by \\`holocron repo setup\\`\nwhen \\`adr\\` is listed under \\`skills\\` in \\`holocron.config\\`), and number the\nrecord sequentially:\n\n\\`\\`\\`sh\ncp .agents/skills/adr/assets/template.md docs/wiki/decisions/000N-short-title.md\n\\`\\`\\`\n\n\\`madr\\` has no CLI — creation is manual. Frontmatter is validated in CI\nvia \\`scripts/validate-adrs.mjs\\` (runs as part of the Lint workflow).\n\n## Status values\n\n| Status | Meaning |\n| ------------ | --------------------------------------------- |\n| \\`proposed\\` | Under discussion — not yet accepted |\n| \\`accepted\\` | In effect |\n| \\`rejected\\` | Considered and declined |\n| \\`deprecated\\` | Was accepted; no longer relevant |\n| \\`superseded\\` | Replaced by a later decision (link in frontmatter) |\n\n## Index\n\n| ID | Title | Status |\n| -- | ----- | ------ |\n`;\n\nexport const STANDARDS_README = `# Standards\n\nOrg-wide engineering standards — conventions, practices, and guidelines that\napply across all repos in the org.\n\n> **Drafts** live in \\`.notes/\\` until accepted, then graduate here.\n`;\n\nexport const SPECIFICATIONS_README = `# Specifications\n\nAccepted specs for planned or in-progress features. Each spec captures what\nthe system must do — not how to implement it.\n\n> **Drafts** live in \\`.notes/*.spec.md\\` until accepted, then graduate here.\n`;\n","import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { updateGitignore } from \"@theholocron/git-utils\";\n\nimport { AGENT_PROMPTS } from \"./agent-prompts-data.js\";\n\nconst AGENTS_PROMPTS_ROOT = \".agents/prompts\";\nconst PROMPTS_GITIGNORE_START = \"# managed by holocron setup — prompts\";\nconst PROMPTS_GITIGNORE_END = \"# end managed by holocron setup — prompts\";\n\nexport async function installAgentPrompts({ repoRoot }: { repoRoot: string }): Promise<string> {\n\tconst promptsDir = join(repoRoot, AGENTS_PROMPTS_ROOT);\n\tawait mkdir(promptsDir, { recursive: true });\n\n\tfor (const [filename, content] of Object.entries(AGENT_PROMPTS)) {\n\t\tawait writeFile(join(promptsDir, filename), content, \"utf8\");\n\t}\n\n\tawait updateGitignore(join(repoRoot, \".gitignore\"), {\n\t\tstart: PROMPTS_GITIGNORE_START,\n\t\tend: PROMPTS_GITIGNORE_END,\n\t\tlines: [`/${AGENTS_PROMPTS_ROOT}/`],\n\t});\n\n\treturn `wrote ${Object.keys(AGENT_PROMPTS).length} prompt files to ${AGENTS_PROMPTS_ROOT}/`;\n}\n","import { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { ProviderApiError, type Source } from \"../../plugin/index.js\";\nimport type { SetupStepResult } from \"./run-step/index.js\";\n\nexport const RULESET_NAME = \"holocron-default-branch\";\n\nexport function buildClassicProtectionPayload(requiredChecks: string[] = []): Record<string, unknown> {\n\treturn {\n\t\trequired_status_checks: requiredChecks.length > 0 ? { strict: false, contexts: requiredChecks } : null,\n\t\tenforce_admins: false,\n\t\trequired_pull_request_reviews: {\n\t\t\trequired_approving_review_count: 0,\n\t\t\tdismiss_stale_reviews: false,\n\t\t\trequire_code_owner_reviews: false,\n\t\t},\n\t\trestrictions: null,\n\t\tallow_force_pushes: false,\n\t\tallow_deletions: false,\n\t};\n}\n\nexport function buildRulesetPayload(requiredChecks: string[] = []): Record<string, unknown> {\n\tconst rules: Record<string, unknown>[] = [\n\t\t{ type: \"deletion\" },\n\t\t{ type: \"non_fast_forward\" },\n\t\t{\n\t\t\ttype: \"pull_request\",\n\t\t\tparameters: {\n\t\t\t\trequired_approving_review_count: 0,\n\t\t\t\tdismiss_stale_reviews_on_push: false,\n\t\t\t\trequire_code_owner_review: false,\n\t\t\t\trequire_last_push_approval: false,\n\t\t\t\trequired_review_thread_resolution: true,\n\t\t\t\t// GitHub defaults this to `true`. It bumps the required approval\n\t\t\t\t// count to 1 for a PR with unverified / unattributed commits —\n\t\t\t\t// which, with `required_approving_review_count: 0` and a single\n\t\t\t\t// maintainer, is an unsatisfiable block (the author can't\n\t\t\t\t// self-approve). Admin bypass already covers the real risk.\n\t\t\t\trequire_extra_approval_for_unattributed_changes: false,\n\t\t\t},\n\t\t},\n\t];\n\tif (requiredChecks.length > 0) {\n\t\trules.push({\n\t\t\ttype: \"required_status_checks\",\n\t\t\tparameters: {\n\t\t\t\trequired_status_checks: requiredChecks.map((context) => ({ context })),\n\t\t\t\tstrict_required_status_checks_policy: false,\n\t\t\t},\n\t\t});\n\t}\n\treturn {\n\t\tname: RULESET_NAME,\n\t\ttarget: \"branch\",\n\t\tenforcement: \"active\",\n\t\t// Repository admins (role 4) can bypass — required for semantic-release\n\t\t// and other automation that pushes directly to the default branch.\n\t\tbypass_actors: [{ actor_id: 4, actor_type: \"RepositoryRole\", bypass_mode: \"always\" }],\n\t\tconditions: { ref_name: { include: [\"~DEFAULT_BRANCH\"], exclude: [] } },\n\t\trules,\n\t};\n}\n\n// Tries the modern Rulesets API first, falls back to classic branch protection\n// if rulesets return 403 (requires GitHub Team+ on private repos), and gracefully\n// skips if both APIs are unavailable (GitHub Free on private repos).\nexport async function upsertBranchProtection(\n\tsource: Source,\n\tdryRun: boolean,\n\trequiredChecks: string[]\n): Promise<SetupStepResult> {\n\tconst step = `upsert ruleset ${RULESET_NAME}`;\n\tif (dryRun) return { capability: \"source\", step, status: \"dry-run\" };\n\n\t// Attempt 1: modern rulesets\n\ttry {\n\t\tconst existing = await source.listRulesets();\n\t\tconst found = existing.find((r) => r.name === RULESET_NAME);\n\t\tif (found) {\n\t\t\tawait source.updateRuleset(found.id, buildRulesetPayload(requiredChecks));\n\t\t\treturn { capability: \"source\", step, status: \"ok\", message: \"updated\" };\n\t\t}\n\t\tawait source.createRuleset(buildRulesetPayload(requiredChecks));\n\t\treturn { capability: \"source\", step, status: \"ok\", message: \"created\" };\n\t} catch (err) {\n\t\tif (!(err instanceof ProviderApiError) || err.status !== 403) {\n\t\t\treturn {\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep,\n\t\t\t\tstatus: \"fail\",\n\t\t\t\tmessage: errorMessage(err),\n\t\t\t};\n\t\t}\n\t}\n\n\t// Attempt 2: classic branch protection (free-plan fallback)\n\ttry {\n\t\tconst repo = await source.getRepo();\n\t\tawait source.protectBranch(repo.defaultBranch, buildClassicProtectionPayload(requiredChecks));\n\t\treturn { capability: \"source\", step, status: \"ok\", message: `classic protection on ${repo.defaultBranch}` };\n\t} catch (err) {\n\t\tif (err instanceof ProviderApiError && err.status === 403) {\n\t\t\treturn {\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep,\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"branch protection unavailable on private repos without GitHub Pro/Team\",\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tcapability: \"source\",\n\t\t\tstep,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n","import { access, mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport { DECISIONS_README, SPECIFICATIONS_README, STANDARDS_README } from \"./agent-prompts-data.js\";\n\nasync function writeIfAbsent(filePath: string, content: string): Promise<boolean> {\n\ttry {\n\t\tawait access(filePath);\n\t\treturn false; // already exists — skip\n\t} catch {\n\t\tawait mkdir(dirname(filePath), { recursive: true });\n\t\tawait writeFile(filePath, content, \"utf8\");\n\t\treturn true;\n\t}\n}\n\nexport async function installEngineeringStructure({ repoRoot }: { repoRoot: string }): Promise<string> {\n\tconst results: string[] = [];\n\n\tconst writes: Array<[string, string]> = [\n\t\t[join(repoRoot, \"docs/wiki/decisions/README.md\"), DECISIONS_README],\n\t\t[join(repoRoot, \"docs/wiki/standards/README.md\"), STANDARDS_README],\n\t\t[join(repoRoot, \"docs/wiki/specifications/README.md\"), SPECIFICATIONS_README],\n\t];\n\n\tfor (const [path, content] of writes) {\n\t\tconst wrote = await writeIfAbsent(path, content);\n\t\tif (wrote) results.push(path.replace(repoRoot + \"/\", \"\"));\n\t}\n\n\treturn results.length > 0 ? `created: ${results.join(\", \")}` : \"all files already exist — nothing to write\";\n}\n","import type { RepoSettings } from \"../../plugin/index.js\";\n\nexport const BALANCED_REPO_SETTINGS: RepoSettings = {\n\tallow_squash_merge: true,\n\tallow_merge_commit: false,\n\tallow_rebase_merge: false,\n\tallow_auto_merge: true,\n\tallow_update_branch: true,\n\tdelete_branch_on_merge: true,\n\thas_issues: true,\n\thas_discussions: true,\n\thas_projects: true,\n\thas_wiki: false,\n\t// web_commit_signoff_required is intentionally omitted: GitHub rejects this\n\t// field when the organization already enforces it at org level (422). Org-level\n\t// enforcement already covers every repo — no per-repo override is needed.\n};\n","import { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../../observability/logger/index.js\";\nimport { ProviderApiError } from \"../../../plugin/index.js\";\n\nexport async function runStep(\n\tcapability: string,\n\tstep: string,\n\tdryRun: boolean,\n\tbody: () => Promise<string | void>,\n\topts: { skipCodes?: number[] } = {}\n): Promise<SetupStepResult> {\n\tconst result = await execStep(capability, step, dryRun, body, opts);\n\tconst { status, message, reason } = result;\n\tgetLogger()[status === \"fail\" ? \"warn\" : \"info\"](\n\t\t{ capability, step, status, ...(message ? { detail: message } : {}), ...(reason ? { reason } : {}) },\n\t\t`${capability}.${step}`\n\t);\n\treturn result;\n}\n\nasync function execStep(\n\tcapability: string,\n\tstep: string,\n\tdryRun: boolean,\n\tbody: () => Promise<string | void>,\n\topts: { skipCodes?: number[] } = {}\n): Promise<SetupStepResult> {\n\tif (dryRun) {\n\t\treturn { capability, step, status: \"dry-run\" };\n\t}\n\ttry {\n\t\tconst note = await body();\n\t\tconst result: SetupStepResult = { capability, step, status: \"ok\" };\n\t\tif (typeof note === \"string\") result.message = note;\n\t\treturn result;\n\t} catch (err) {\n\t\tif (err instanceof ProviderApiError) {\n\t\t\tif (err.status !== undefined && opts.skipCodes?.includes(err.status)) {\n\t\t\t\treturn { capability, step, status: \"skip\", message: err.message };\n\t\t\t}\n\t\t\tif (err.status === 403) {\n\t\t\t\tconst reason = classify403(err);\n\t\t\t\t// Plan-restriction 403s mean the feature is unavailable on the current\n\t\t\t\t// plan — not a setup failure, just a capability gap. Report as skip.\n\t\t\t\treturn { capability, step, status: reason === \"plan\" ? \"skip\" : \"fail\", message: err.message, reason };\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tcapability,\n\t\t\tstep,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n\nexport function classify403(err: ProviderApiError): FailReason {\n\tconst detailText =\n\t\ttypeof err.details === \"string\"\n\t\t\t? err.details\n\t\t\t: typeof err.details === \"object\" && err.details !== null && \"message\" in err.details\n\t\t\t\t? String((err.details as { message?: unknown }).message)\n\t\t\t\t: \"\";\n\tconst text = `${err.message} ${detailText}`.toLowerCase();\n\tif (\n\t\ttext.includes(\"advanced security\") ||\n\t\ttext.includes(\"not enabled for this repository\") ||\n\t\ttext.includes(\"upgrade\") ||\n\t\ttext.includes(\"not available on\")\n\t) {\n\t\treturn \"plan\";\n\t}\n\treturn \"permissions\";\n}\n\nimport { style } from \"../../../ui/index.js\";\nimport type { FailReason, SetupStepResult } from \"./run-step.type.js\";\n\nexport function formatStep(step: SetupStepResult): string {\n\tconst tag = step.reason === \"permissions\" ? \" [permissions]\" : step.reason === \"plan\" ? \" [plan restriction]\" : \"\";\n\tconst detail = step.message ? style.dim(` (${step.message})`) : \"\";\n\tconst label = `${step.step}${tag}${detail}`;\n\tif (step.status === \"ok\") return ` ${style.success(label)}`;\n\tif (step.status === \"fail\") return ` ${style.fail(label)}`;\n\tif (step.status === \"dry-run\") return ` ${style.dim(`… ${label}`)}`;\n\treturn ` ${style.dim(`· ${label}`)}`;\n}\n","import { spawnSync } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { copyFile, mkdir, readdir, readFile, rm, stat, symlink, unlink, writeFile } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, relative } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { updateGitignore } from \"@theholocron/git-utils\";\n\nimport type { SkillLockEntry, SkillsLock } from \"./skills.type.js\";\n\nasync function fetchExternalSkill(entry: SkillLockEntry): Promise<{ content: string; stale: boolean }> {\n\tif (entry.sourceType !== \"github\") {\n\t\t/* c8 ignore next */\n\t\tthrow new Error(`unsupported sourceType: ${entry.sourceType}`);\n\t}\n\tconst url = `https://raw.githubusercontent.com/${entry.source}/HEAD/${entry.skillPath}`;\n\tconst res = await fetch(url);\n\tif (!res.ok) throw new Error(`HTTP ${res.status} fetching ${url}`);\n\tconst content = await res.text();\n\tconst stale = !!entry.computedHash && createHash(\"sha256\").update(content).digest(\"hex\") !== entry.computedHash;\n\treturn { content, stale };\n}\n\nconst AGENTS_SKILLS_ROOT = \".agents/skills\";\n\n/** Relative path of the agent-specific symlink. undefined = unsupported agent. */\nexport const AGENT_SYMLINK_PATHS: Partial<Record<string, (name: string) => string>> = {\n\tclaude: (name) => `.claude/skills/${name}`,\n};\n\nconst GITIGNORE_BLOCK_START = \"# managed by holocron setup — skills\";\n// Safety invariant: GITIGNORE_BLOCK_START must NOT be a substring of\n// GITIGNORE_BLOCK_END. The \"# end \" prefix currently guarantees this — if\n// either string is edited, verify the invariant still holds so that\n// indexOf(GITIGNORE_BLOCK_START) cannot match inside the end marker.\nconst GITIGNORE_BLOCK_END = \"# end managed by holocron setup — skills\";\n\nexport async function installSkills({\n\tagent,\n\tskills,\n\trepoRoot,\n}: {\n\tagent: string;\n\tskills: string[];\n\trepoRoot: string;\n}): Promise<string> {\n\tconst symlinkFn = AGENT_SYMLINK_PATHS[agent];\n\tif (!symlinkFn) {\n\t\treturn `agent \"${agent}\" has no known skill install path — skipping`;\n\t}\n\n\tconst require = createRequire(pathToFileURL(join(repoRoot, \"package.json\")));\n\tlet skillsRoot: string;\n\ttry {\n\t\tskillsRoot = dirname(require.resolve(\"@theholocron/skills/package.json\"));\n\t} catch {\n\t\tconst result = spawnSync(\"pnpm\", [\"add\", \"-D\", \"@theholocron/skills\"], {\n\t\t\tcwd: repoRoot,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t\tif (result.status !== 0) {\n\t\t\tthrow new Error(\"failed to auto-install @theholocron/skills\");\n\t\t}\n\t\ttry {\n\t\t\tskillsRoot = dirname(require.resolve(\"@theholocron/skills/package.json\"));\n\t\t} catch {\n\t\t\tthrow new Error(\"failed to auto-install @theholocron/skills\");\n\t\t}\n\t}\n\n\tconst gitignorePath = join(repoRoot, \".gitignore\");\n\tconst existingContent = await readFile(gitignorePath, \"utf8\").catch(() => \"\");\n\tconst previouslyInstalled = parsePreviousSkills(existingContent, symlinkFn);\n\tconst currentSet = new Set(skills);\n\tconst stale = previouslyInstalled.filter((n) => !currentSet.has(n));\n\tfor (const name of stale) {\n\t\tawait rm(join(repoRoot, symlinkFn(name)), { force: true }).catch(() => undefined);\n\t\tawait rm(join(repoRoot, AGENTS_SKILLS_ROOT, name), { recursive: true, force: true }).catch(() => undefined);\n\t}\n\n\tconst installed: string[] = [];\n\tconst missing: string[] = [];\n\n\tfor (const name of skills) {\n\t\tconst srcDir = join(skillsRoot, \"src\", name);\n\n\t\ttry {\n\t\t\tawait stat(srcDir);\n\t\t} catch {\n\t\t\tmissing.push(name);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst agentsDir = join(repoRoot, AGENTS_SKILLS_ROOT, name);\n\t\tawait copyDirRecursive(srcDir, agentsDir);\n\n\t\tconst symlinkPath = join(repoRoot, symlinkFn(name));\n\t\tawait mkdir(dirname(symlinkPath), { recursive: true });\n\t\ttry {\n\t\t\tawait unlink(symlinkPath);\n\t\t} catch {\n\t\t\t// didn't exist — that's fine\n\t\t}\n\t\tawait symlink(relative(dirname(symlinkPath), agentsDir).replace(/\\\\/g, \"/\"), symlinkPath);\n\n\t\tinstalled.push(name);\n\t}\n\n\tconst externalFailed: string[] = [];\n\tconst externalStale: string[] = [];\n\tif (missing.length > 0) {\n\t\tlet lock: SkillsLock | null = null;\n\t\ttry {\n\t\t\tlock = JSON.parse(await readFile(join(skillsRoot, \"skills-lock.json\"), \"utf8\")) as SkillsLock;\n\t\t} catch {\n\t\t\t// No lock file or parse error — all missing remain unknown.\n\t\t}\n\t\tif (lock?.skills) {\n\t\t\tfor (const name of [...missing]) {\n\t\t\t\tconst entry = lock.skills[name];\n\t\t\t\tif (!entry) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst { content, stale: isStale } = await fetchExternalSkill(entry);\n\t\t\t\t\tconst agentsDir = join(repoRoot, AGENTS_SKILLS_ROOT, name);\n\t\t\t\t\tawait mkdir(agentsDir, { recursive: true });\n\t\t\t\t\tawait writeFile(join(agentsDir, \"SKILL.md\"), content);\n\t\t\t\t\tconst symlinkPath = join(repoRoot, symlinkFn(name));\n\t\t\t\t\tawait mkdir(dirname(symlinkPath), { recursive: true });\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait unlink(symlinkPath);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// didn't exist — that's fine\n\t\t\t\t\t}\n\t\t\t\t\tawait symlink(relative(dirname(symlinkPath), agentsDir).replace(/\\\\/g, \"/\"), symlinkPath);\n\t\t\t\t\tmissing.splice(missing.indexOf(name), 1);\n\t\t\t\t\tinstalled.push(name);\n\t\t\t\t\tif (isStale) externalStale.push(name);\n\t\t\t\t} catch {\n\t\t\t\t\tmissing.splice(missing.indexOf(name), 1);\n\t\t\t\t\texternalFailed.push(name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (installed.length > 0 || stale.length > 0 || missing.length > 0 || externalFailed.length > 0) {\n\t\tawait updateSkillsGitignore(gitignorePath, [...installed, ...missing, ...externalFailed], symlinkFn);\n\t}\n\n\tconst parts: string[] = [`installed ${installed.length}`];\n\tif (stale.length > 0) parts.push(`pruned: ${stale.join(\", \")}`);\n\tif (externalStale.length > 0)\n\t\tparts.push(`stale: ${externalStale.join(\", \")} (run \\`holocron skills update\\` to refresh)`);\n\tif (externalFailed.length > 0) parts.push(`fetch failed: ${externalFailed.join(\", \")}`);\n\tif (missing.length > 0) parts.push(`unknown: ${missing.join(\", \")}`);\n\treturn parts.join(\"; \");\n}\n\n/**\n * The skill names a previous `holocron setup` recorded in the `.gitignore`\n * managed block. A block missing its end marker (hand-edited, truncated) runs\n * only to the next blank line — the same rule `updateGitignore` uses to\n * replace it — so user-written ignore rules further down are never mistaken\n * for installed skills and pruned.\n */\nexport function parsePreviousSkills(gitignoreContent: string, symlinkFn: (n: string) => string): string[] {\n\tconst startIdx = gitignoreContent.indexOf(GITIGNORE_BLOCK_START);\n\tif (startIdx === -1) return [];\n\tconst endIdx = gitignoreContent.indexOf(GITIGNORE_BLOCK_END, startIdx);\n\tconst blankAt = /\\r?\\n[ \\t]*\\r?\\n/.exec(gitignoreContent.slice(startIdx));\n\tconst blankIdx = blankAt ? startIdx + blankAt.index : -1;\n\t// Complete only if the end marker comes before any blank line.\n\tconst complete = endIdx !== -1 && (blankIdx === -1 || endIdx < blankIdx);\n\tconst blockEnd = complete ? endIdx : blankIdx === -1 ? gitignoreContent.length : blankIdx;\n\tconst block = gitignoreContent.slice(startIdx, blockEnd);\n\tconst placeholder = \"__placeholder__\";\n\tconst symlinkPrefix = `/${symlinkFn(placeholder)}`.replace(placeholder, \"\");\n\treturn block\n\t\t.split(/\\r?\\n/)\n\t\t.filter((line) => line.startsWith(symlinkPrefix))\n\t\t.map((line) => line.slice(symlinkPrefix.length));\n}\n\nasync function copyDirRecursive(src: string, dest: string): Promise<void> {\n\tawait mkdir(dest, { recursive: true });\n\tconst entries = await readdir(src, { withFileTypes: true });\n\tfor (const entry of entries) {\n\t\tconst srcPath = join(src, entry.name);\n\t\tconst destPath = join(dest, entry.name);\n\t\tif (entry.isDirectory()) {\n\t\t\tawait copyDirRecursive(srcPath, destPath);\n\t\t} else {\n\t\t\tawait copyFile(srcPath, destPath);\n\t\t}\n\t}\n}\n\nasync function updateSkillsGitignore(\n\tgitignorePath: string,\n\tskills: string[],\n\tsymlinkFn: (name: string) => string\n): Promise<void> {\n\tawait updateGitignore(gitignorePath, {\n\t\tstart: GITIGNORE_BLOCK_START,\n\t\tend: GITIGNORE_BLOCK_END,\n\t\tlines: [`/${AGENTS_SKILLS_ROOT}/`, ...skills.map((n) => `/${symlinkFn(n)}`)],\n\t});\n}\n","/**\n * `holocron repo setup` — orchestrates per-capability setup actions across\n * every plugin loaded from `holocron.config.json`.\n *\n * Per CLAUDE.md soft-skip: each step is wrapped in a try/catch and\n * failures don't abort subsequent capabilities. The summary at the end\n * reports counts so the operator can see what worked + what didn't.\n *\n * Per the Standards: when `ctx.dryRun` is true, mutating calls are\n * replaced with \"would\" log lines. Read-only probes (e.g.,\n * `vault.list`) still run so the operator sees real state.\n *\n * The orchestrator knows about specific capability methods by name\n * (e.g., `source.enableVulnerabilityAlerts`). This deliberate coupling\n * makes the \"what does setup do\" contract explicit and concrete —\n * decoupling via a per-capability `setupSteps()` method would be more\n * extensible but pushes the same knowledge into N plugins instead of\n * one central place.\n */\n\nimport { access, readFile, writeFile } from \"node:fs/promises\";\nimport { basename, join } from \"node:path\";\n\nimport {\n\tcreateAlexignore,\n\tcreateAlexrc,\n\tcreateAstromech,\n\tcreateCommitMsg,\n\tcreateDependabot,\n\tcreateDevmoji,\n\tcreateEditorconfig,\n\tcreateEditorconfigChecker,\n\tcreateHeader,\n\tcreateLabeler,\n\tcreatePreCommit,\n\tcreatePrepareCommitMsg,\n\tcreatePrePush,\n\tcreateYamlignore,\n\tcreateYamllint,\n\textractPreviewConfig,\n\tKNOWN_WORKFLOWS,\n\treadWorkspacePackages,\n} from \"@theholocron/astromech\";\nimport type { TasksConfig } from \"@theholocron/astromech/config\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { AuthError, createFeatureResolver } from \"../../auth/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Auth,\n\ttype Deployment,\n\ttype Dns,\n\ttype DnsRecordRequest,\n\ttype Environments,\n\ttype Errors,\n\ttype Logs,\n\ttype Monitoring,\n\tPluginLoader,\n\ttype Secrets,\n\ttype Source,\n\ttype Tooling,\n\ttype Vault,\n\ttype Wiki,\n\ttype Workers,\n} from \"../../plugin/index.js\";\nimport dcoConfig from \"../../templates/dco.yml\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport { installAgentPrompts } from \"./agent-prompts.js\";\nimport { upsertBranchProtection } from \"./branch-protection.js\";\nimport {\n\tderiveCapabilities,\n\tderiveCompliance,\n\tderiveProfile,\n\tderiveStack,\n\treadWorkspacePackageJsons,\n} from \"./derived-properties/index.js\";\nimport { installEngineeringStructure } from \"./engineering.js\";\nimport { CANONICAL_LABELS, STALE_LABELS } from \"./labels.js\";\nimport { BALANCED_REPO_SETTINGS } from \"./repo-settings.js\";\nimport { formatStep, type RunSetupInput, runStep, type SetupReport, type SetupStepResult } from \"./run-step/index.js\";\nimport { AGENT_SYMLINK_PATHS, installSkills } from \"./skills/index.js\";\n\nconst { workflowHeader } = createHeader({\n\tsource: \"packages/cli/src/commands/setup/run-setup.ts\",\n\ttool: \"holocron repo setup\",\n});\n// Thin-caller workflow content comes from astromech.thinCallers(), not this\n// file — a separate binding so its header points contributors at the actual\n// template/generation logic (packages/astromech/src/thin-callers.ts), same as\n// the workflowHeader() calls further down that write genuinely cli-owned\n// templates (dco.yml).\nconst { workflowHeader: thinCallerHeader } = createHeader({\n\tsource: \"packages/astromech/src/thin-callers.ts\",\n\ttool: \"holocron repo setup\",\n});\n\nexport async function runSetup(input: RunSetupInput): Promise<SetupReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait withSpinner(\"Loading plugins…\", () => loader.load());\n\tassertPluginsResolvable(loader, \"repo setup\");\n\n\tconst config = input.loaded.resolved;\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst steps: SetupStepResult[] = [];\n\tconst repo = config.repo;\n\tconst effectivePreset = repo?.protection;\n\n\t// Git hooks: `--hooks`/`--no-hooks` wins, then `config.hooks`, then default\n\t// on for `protection: \"strict\"`.\n\tconst hooksEnabled =\n\t\tinput.hooks ??\n\t\t(typeof config.hooks === \"boolean\"\n\t\t\t? config.hooks\n\t\t\t: typeof config.hooks === \"object\"\n\t\t\t\t? config.hooks.prePush !== false\n\t\t\t\t: effectivePreset === \"strict\");\n\n\tprint(style.header(`Holocron setup — ${config.name}${dryRun ? \" (dry-run)\" : \"\"}`));\n\tprint(style.dim(` config: ${input.loaded.filepath}`));\n\tprint(\"\");\n\n\t// ── source: security toggles + repo policy ──────────────────────────\n\tif (loader.has(\"source\")) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tprint(style.step(\"source\"));\n\t\tconst SECURITY_SKIP_CODES: Partial<Record<string, number[]>> = {\n\t\t\tenableSecretScanning: [422],\n\t\t\tenablePrivateVulnerabilityReporting: [404],\n\t\t};\n\t\tfor (const method of [\n\t\t\t\"enableVulnerabilityAlerts\",\n\t\t\t\"enableAutomatedSecurityFixes\",\n\t\t\t\"enableSecretScanning\",\n\t\t\t\"enablePrivateVulnerabilityReporting\",\n\t\t\t\"enableDependencyGraph\",\n\t\t] as const) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\n\t\t\t\t\t\"source\",\n\t\t\t\t\tmethod,\n\t\t\t\t\tdryRun,\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\tawait source[method]();\n\t\t\t\t\t},\n\t\t\t\t\t{ skipCodes: SECURITY_SKIP_CODES[method] }\n\t\t\t\t)\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst usesAdvancedCodeQL = (config.tasks ?? [])\n\t\t\t.map((e) => (typeof e === \"string\" ? e : e.name))\n\t\t\t.includes(\"security.codeScanning\");\n\t\tsteps.push(\n\t\t\tawait runStep(\n\t\t\t\t\"source\",\n\t\t\t\tusesAdvancedCodeQL ? \"disableDefaultCodeScanning\" : \"enableCodeScanning\",\n\t\t\t\tdryRun,\n\t\t\t\tasync () => {\n\t\t\t\t\tif (usesAdvancedCodeQL) {\n\t\t\t\t\t\tawait source.disableDefaultCodeScanning();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn await source.enableCodeScanning();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\tif (effectivePreset && effectivePreset !== \"none\") {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"updateRepoSettings\", dryRun, async () => {\n\t\t\t\t\tawait source.updateRepoSettings({\n\t\t\t\t\t\t...BALANCED_REPO_SETTINGS,\n\t\t\t\t\t\t...(repo?.defaultBranch ? { default_branch: repo.defaultBranch } : {}),\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\tconst tasksConfig: TasksConfig = { tasks: config.tasks as TasksConfig[\"tasks\"] };\n\t\t\tif (config.extraRequiredChecks) tasksConfig.extraRequiredChecks = config.extraRequiredChecks;\n\t\t\tconst requiredChecks =\n\t\t\t\teffectivePreset === \"strict\"\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t\"DCO\",\n\t\t\t\t\t\t\t...createAstromech({\n\t\t\t\t\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\t\t\t\t\tconfig: tasksConfig,\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t}).requiredChecks(),\n\t\t\t\t\t\t]\n\t\t\t\t\t: [];\n\t\t\tsteps.push(await upsertBranchProtection(source, dryRun, requiredChecks));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── source: workflow thin wrappers ──────────────────────────────────\n\tconst tasks = config.tasks;\n\tif (loader.has(\"source\") && tasks && tasks.length > 0) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tprint(style.step(\"workflows\"));\n\n\t\t// astromech renders every thin caller from the manifest (lint linter set,\n\t\t// deploy paths, deploy+preview) and validates it — a bad manifest throws\n\t\t// here, aborting setup, same as before. Iterate the manifest (not the map)\n\t\t// so step reporting keeps the config's order.\n\t\tconst files = createAstromech({\n\t\t\tcwd: input.context.repoRoot,\n\t\t\tconfig: { tasks: tasks as TasksConfig[\"tasks\"] },\n\t\t\torgContext: { org: config.org, domain: config.domain },\n\t\t\tlogger,\n\t\t}).thinCallers();\n\n\t\tfor (const entry of tasks) {\n\t\t\tconst name = typeof entry === \"string\" ? entry : entry.name;\n\t\t\t// knowledge.docs / knowledge.components have no static\n\t\t\t// WORKFLOW_TEMPLATES entry (their content is always\n\t\t\t// combined-generated, astromech.ts) — not in KNOWN_WORKFLOWS, but\n\t\t\t// not \"unknown\" either.\n\t\t\tconst isCombinedContentOnly = name === \"knowledge.docs\" || name === \"knowledge.components\";\n\n\t\t\tif (!KNOWN_WORKFLOWS.has(name) && !isCombinedContentOnly) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: `write workflow ${name}`,\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: `unknown workflow \"${name}\" — no template available`,\n\t\t\t\t});\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// The combined-content family (delivery.deploy, knowledge.docs,\n\t\t\t// knowledge.components) all key their generated file by task name\n\t\t\t// already — no special-casing needed, unlike the old hardcoded\n\t\t\t// \"deploy.yml\" filename.\n\t\t\tconst filename = `${name}.yml`;\n\t\t\tconst content = files.get(filename);\n\t\t\tif (content === undefined) continue; // ci: false — nothing to write\n\n\t\t\tconst withPreview = content.includes(\"workflows/preview.yml@main\");\n\t\t\tconst step = withPreview ? `write workflow ${name} (with preview)` : `write workflow ${name}`;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", step, dryRun, async () => {\n\t\t\t\t\tawait source.writeWorkflowFile(filename, `${thinCallerHeader()}${content}`);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── source: labeler config ───────────────────────────────────────────\n\tif (\n\t\tloader.has(\"source\") &&\n\t\t(config.tasks ?? []).map((e) => (typeof e === \"string\" ? e : e.name)).includes(\"bookkeeping\")\n\t) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .github/labeler.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".github/labeler.yml\", createLabeler());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── source: dependabot + dco config ─────────────────────────────────\n\tif (loader.has(\"source\") && effectivePreset !== \"none\") {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .github/dependabot.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".github/dependabot.yml\", createDependabot());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .github/dco.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".github/dco.yml\", `${workflowHeader()}${dcoConfig}`);\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── source: static config files ──────────────────────────────────────\n\tif (loader.has(\"source\")) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .alexrc.json\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".alexrc.json\", createAlexrc());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .alexignore\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".alexignore\", createAlexignore());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .yamllint.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".yamllint.yml\", createYamllint());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .yamlignore\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".yamlignore\", createYamlignore());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .editorconfig\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".editorconfig\", createEditorconfig());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .editorconfig-checker.json\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".editorconfig-checker.json\", createEditorconfigChecker());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write devmoji.config.cjs\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\"devmoji.config.cjs\", createDevmoji());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .husky/prepare-commit-msg\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".husky/prepare-commit-msg\", createPrepareCommitMsg());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .husky/commit-msg\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".husky/commit-msg\", createCommitMsg(config.holocronScript));\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tif (hooksEnabled) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"write .husky/pre-push\", dryRun, async () => {\n\t\t\t\t\tawait source.writeRepoFile(\".husky/pre-push\", createPrePush(config.holocronScript));\n\t\t\t\t\treturn \"runs `holocron run ci` before push — bypass with `git push --no-verify`\";\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"write .husky/pre-commit\", dryRun, async () => {\n\t\t\t\t\tawait source.writeRepoFile(\".husky/pre-commit\", createPreCommit());\n\t\t\t\t\treturn \"runs GitLeaks (staged-only) + lint-staged before commit\";\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tif (config.syncScripts !== false) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"set package.json prepare script\", dryRun, async () => {\n\t\t\t\t\t\treturn (await ensurePrepareScript(input.context.repoRoot))\n\t\t\t\t\t\t\t? \"prepare now runs husky\"\n\t\t\t\t\t\t\t: \"already runs husky\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep: \"write .husky/pre-push\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"git hooks disabled\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep: \"write .husky/pre-commit\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"git hooks disabled\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t\t{\n\t\t\tconst configuredWorkflowNames = (config.tasks ?? []).map((e) => (typeof e === \"string\" ? e : e.name));\n\t\t\tconst hasTestWorkflow = configuredWorkflowNames.includes(\"verification.unitTests\");\n\t\t\tconst existing = await readFile(join(input.context.repoRoot, \"codecov.yml\"), \"utf8\").catch(() => null);\n\t\t\tif (!hasTestWorkflow && existing == null) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: \"write codecov.yml\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no test workflow configured\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"write codecov.yml\", dryRun, async () => {\n\t\t\t\t\t\tconst content = createAstromech({ cwd: input.context.repoRoot, logger }).codecovConfig(\n\t\t\t\t\t\t\texisting\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait source.writeRepoFile(\"codecov.yml\", content);\n\t\t\t\t\t\tconst packageCount = readWorkspacePackages(input.context.repoRoot).length;\n\t\t\t\t\t\treturn packageCount > 0 ? `${packageCount} components` : \"no components\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t\t{\n\t\t\tconst astromechTurbo = createAstromech({\n\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\tconfig: { tasks: config.tasks as TasksConfig[\"tasks\"] },\n\t\t\t\tlogger,\n\t\t\t});\n\t\t\tconst content = astromechTurbo.turboConfig();\n\n\t\t\tif (content === null) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: \"write turbo.json\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no fan-out-eligible tasks configured\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"write turbo.json\", dryRun, async () => {\n\t\t\t\t\t\tawait source.writeRepoFile(\"turbo.json\", content);\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\t\t// #692: a root that's genuinely a directly-buildable package (not\n\t\t\t\t// just an orchestrator) silently vanishes from `turbo run <task>`\n\t\t\t\t// once turbo.json exists, unless it's an explicit workspace\n\t\t\t\t// member — fix pnpm-workspace.yaml in the same step that\n\t\t\t\t// introduces the risk.\n\t\t\t\tconst rootPkgRaw = await readFile(join(input.context.repoRoot, \"package.json\"), \"utf8\").catch(\n\t\t\t\t\t() => null\n\t\t\t\t);\n\t\t\t\tconst rootPkg = rootPkgRaw ? (JSON.parse(rootPkgRaw) as { scripts?: Record<string, string> }) : null;\n\t\t\t\tconst workspaceYaml = await readFile(join(input.context.repoRoot, \"pnpm-workspace.yaml\"), \"utf8\").catch(\n\t\t\t\t\t() => \"\"\n\t\t\t\t);\n\t\t\t\tconst rootScripts = rootPkg?.scripts ?? {};\n\t\t\t\tconst workspaceFix = astromechTurbo.ensureRootWorkspaceMember(workspaceYaml, rootScripts);\n\t\t\t\tif (workspaceFix.changed) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runStep(\n\t\t\t\t\t\t\t\"source\",\n\t\t\t\t\t\t\t\"fix pnpm-workspace.yaml (root workspace member, #692)\",\n\t\t\t\t\t\t\tdryRun,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tawait source.writeRepoFile(\"pnpm-workspace.yaml\", workspaceFix.content);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// turbo.json alone is inert without turbo itself installed — see\n\t\t\t\t// ensureTurboDependency()'s own docstring for how this was found.\n\t\t\t\tif (rootPkgRaw) {\n\t\t\t\t\tconst depFix = astromechTurbo.ensureTurboDependency(rootPkgRaw, workspaceFix.content);\n\t\t\t\t\tif (depFix.changed) {\n\t\t\t\t\t\tsteps.push(\n\t\t\t\t\t\t\tawait runStep(\"source\", \"add turbo devDependency\", dryRun, async () => {\n\t\t\t\t\t\t\t\tawait source.writeRepoFile(\"package.json\", depFix.content);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (source.syncLabels) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"sync labels\", dryRun, async () => {\n\t\t\t\t\treturn source.syncLabels!(CANONICAL_LABELS, STALE_LABELS);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst properties: Record<string, string | string[]> = {};\n\n\t\tif (effectivePreset && effectivePreset !== \"none\")\n\t\t\tproperties[\"holocron_branch_protection_level\"] = effectivePreset;\n\n\t\tconst isMonorepo = await access(join(input.context.repoRoot, \"pnpm-workspace.yaml\"))\n\t\t\t.then(() => true)\n\t\t\t.catch(() => false);\n\t\tproperties[\"monorepo\"] = String(isMonorepo);\n\n\t\tconst manual = repo?.properties ?? {};\n\t\tif (manual.lifecycle) properties[\"lifecycle\"] = manual.lifecycle;\n\t\tif (manual.open_source !== undefined) properties[\"open_source\"] = String(manual.open_source);\n\t\tif (manual.runtime_environment) properties[\"runtime_environment\"] = manual.runtime_environment;\n\t\tif (manual.uses_external_packages !== undefined)\n\t\t\tproperties[\"uses_external_packages\"] = String(manual.uses_external_packages);\n\n\t\t// #677 — derived fields, distinct from the manual ones above: signal\n\t\t// that isn't an explicit holocron.config.ts field today (framework\n\t\t// choice, repo archetype, capability drift).\n\t\t{\n\t\t\tconst rootPackageJson = await readFile(join(input.context.repoRoot, \"package.json\"), \"utf8\")\n\t\t\t\t.then((raw) => JSON.parse(raw) as Parameters<typeof deriveStack>[0])\n\t\t\t\t.catch(() => null);\n\t\t\tconst workspacePackages = readWorkspacePackages(input.context.repoRoot);\n\t\t\tconst workspacePackageJsons = await readWorkspacePackageJsons(input.context.repoRoot, workspacePackages);\n\t\t\tproperties[\"holocron_profile\"] = deriveProfile({\n\t\t\t\trootPackageJson,\n\t\t\t\trepoName: basename(input.context.repoRoot),\n\t\t\t\tisMonorepo,\n\t\t\t\tworkspacePackageJsons,\n\t\t\t});\n\t\t\tproperties[\"holocron_stack\"] = deriveStack(rootPackageJson);\n\t\t\tconst capabilities = deriveCapabilities(config.providers);\n\t\t\tproperties[\"holocron_capabilities\"] = capabilities;\n\t\t\tproperties[\"holocron_compliance\"] = deriveCompliance(capabilities);\n\t\t}\n\n\t\tif (source.syncProperties) {\n\t\t\tsteps.push(await runStep(\"source\", \"sync properties\", dryRun, () => source.syncProperties!(properties)));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst topics = repo?.topics ?? [];\n\t\tif (topics.length > 0 && source.syncTopics) {\n\t\t\tsteps.push(await runStep(\"source\", \"sync topics\", dryRun, () => source.syncTopics!(topics)));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (config.description && source.syncDescription) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"sync description\", dryRun, () => source.syncDescription!(config.description!))\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (config.homepage && source.syncHomepage) {\n\t\t\tsteps.push(await runStep(\"source\", \"sync homepage\", dryRun, () => source.syncHomepage!(config.homepage!)));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst teams = repo?.teams ?? [];\n\t\tif (teams.length > 0) {\n\t\t\tif (source.syncTeams) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"sync teams\", dryRun, () => source.syncTeams!(teams), { skipCodes: [422] })\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\t\tconst repoCoord = input.context.repo ?? repo?.name ?? \"\";\n\t\t\t\tconst org = repoCoord.includes(\"/\") ? repoCoord.split(\"/\")[0]! : \"\";\n\t\t\t\tconst writeableTeams = teams\n\t\t\t\t\t.map((t) => (typeof t === \"string\" ? { slug: t, permission: \"push\" as const } : t))\n\t\t\t\t\t.filter((t) => [\"push\", \"maintain\", \"admin\"].includes(t.permission));\n\t\t\t\tif (org && writeableTeams.length > 0) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runStep(\"source\", \"write .github/CODEOWNERS\", dryRun, async () => {\n\t\t\t\t\t\t\tconst content = writeableTeams.map((t) => `* @${org}/${t.slug}`).join(\"\\n\") + \"\\n\";\n\t\t\t\t\t\t\tawait source.writeRepoFile(\".github/CODEOWNERS\", content);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: \"sync teams\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"provider does not implement syncTeams\",\n\t\t\t\t});\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── environments ────────────────────────────────────────────────────\n\tif (loader.has(\"environments\")) {\n\t\tconst envs = loader.get(\"environments\") as Environments;\n\t\tprint(style.step(\"environments\"));\n\t\tfor (const envName of [\"staging\", \"production\"]) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"environments\", `upsert ${envName}`, dryRun, async () => {\n\t\t\t\t\tawait envs.upsertEnvironment({ name: envName });\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── docs: configure GitHub Pages ────────────────────────────────────\n\tif (loader.has(\"source\") && config.docs) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tconst resolveDeployToken = createFeatureResolver({\n\t\t\tenvName: \"HOLOCRON_DEPLOY_TOKEN\",\n\t\t\tkeyringKey: \"github.deploy\",\n\t\t});\n\t\tlet deployToken: string | undefined;\n\t\ttry {\n\t\t\tdeployToken = resolveDeployToken({ keyring: input.keyring });\n\t\t} catch (err) {\n\t\t\tif (!(err instanceof AuthError)) throw err;\n\t\t}\n\t\tprint(style.step(\"docs\"));\n\t\tif (!deployToken) {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep: \"configure GitHub Pages\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"no deploy token found — set HOLOCRON_DEPLOY_TOKEN or run: holocron auth set github.deploy <PAT>\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t} else if (source.configurePages) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"configure GitHub Pages\", dryRun, async () => {\n\t\t\t\t\tawait source.configurePages!(config.docs!, deployToken);\n\t\t\t\t\tconst parts: string[] = [config.docs!.build];\n\t\t\t\t\tif (config.docs!.domain) parts.push(`domain: ${config.docs!.domain}`);\n\t\t\t\t\tif (config.docs!.https) parts.push(\"https: enforced\");\n\t\t\t\t\treturn parts.join(\", \");\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── wiki: provision engineering wiki config ──────────────────────────\n\tif (loader.has(\"wiki\")) {\n\t\tconst wiki = loader.get(\"wiki\") as Wiki;\n\t\tprint(style.step(\"wiki\"));\n\t\tsteps.push(\n\t\t\tawait runStep(\"wiki\", \"provision wiki config\", dryRun, async () => {\n\t\t\t\treturn await wiki.provision({ name: config.name });\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\tconst wikiDns = wiki.dnsRecord?.();\n\t\tconst wikiProxy = wiki.proxyConfig?.();\n\t\tif (wikiDns && loader.has(\"dns\")) {\n\t\t\tconst dns = loader.get(\"dns\") as Dns;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"dns\", `upsertRecord ${wikiDns.record.name}`, dryRun, async () => {\n\t\t\t\t\tawait dns.upsertRecord(wikiDns.zone, {\n\t\t\t\t\t\t...wikiDns.record,\n\t\t\t\t\t\tttl: 1,\n\t\t\t\t\t\t...(wikiProxy ? { proxied: true } : {}),\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (wikiProxy && wikiDns && loader.has(\"workers\")) {\n\t\t\tconst workers = loader.get(\"workers\") as Workers;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"workers\", `upsertProxy ${wikiDns.record.name}`, dryRun, async () => {\n\t\t\t\t\tawait workers.upsertProxy(wikiDns.record.name, wikiProxy);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── deployment: ensure project + preview infrastructure ─────────────\n\tif (loader.has(\"deployment\")) {\n\t\tconst deploy = loader.get(\"deployment\") as Deployment;\n\t\tprint(style.step(\"deployment\"));\n\n\t\t// delivery.deploy, knowledge.docs, and knowledge.components all share the\n\t\t// same combined production+preview mechanism (astromech.ts) — any one of\n\t\t// them can carry the preview config that drives project/DNS provisioning.\n\t\tconst deployEntry = (config.tasks ?? [])\n\t\t\t.map((e) => (typeof e === \"string\" ? { name: e } : e))\n\t\t\t.find(\n\t\t\t\t(e) => e.name === \"delivery.deploy\" || e.name === \"knowledge.docs\" || e.name === \"knowledge.components\"\n\t\t\t);\n\t\tconst previewCfg = deployEntry?.with\n\t\t\t? extractPreviewConfig(deployEntry.with as Record<string, unknown>, {\n\t\t\t\t\torg: config.org,\n\t\t\t\t\tdomain: config.domain,\n\t\t\t\t})\n\t\t\t: null;\n\t\tconst ensureCustomDomain = async (projectId: string, hostname: string) => {\n\t\t\tif (!deploy.ensureCustomDomain) return;\n\t\t\tconst customDomainDns = { value: null as DnsRecordRequest | null };\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"deployment\", `ensureCustomDomain ${hostname}`, dryRun, async () => {\n\t\t\t\t\tcustomDomainDns.value = await deploy.ensureCustomDomain!(projectId, hostname);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\tif (customDomainDns.value && loader.has(\"dns\")) {\n\t\t\t\tconst dns = loader.get(\"dns\") as Dns;\n\t\t\t\tconst dnsRecord = customDomainDns.value;\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"dns\", `upsertRecord ${dnsRecord.record.name}`, dryRun, async () => {\n\t\t\t\t\t\tawait dns.upsertRecord(dnsRecord.zone, { ...dnsRecord.record, ttl: 1 });\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t};\n\n\t\tif (!previewCfg) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"deployment\", `ensureProject ${config.name}`, dryRun, async () => {\n\t\t\t\t\tawait deploy.ensureProject({ name: config.name });\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tif (deploy.domain) {\n\t\t\t\tawait ensureCustomDomain(config.name, deploy.domain);\n\t\t\t}\n\t\t}\n\n\t\tif (previewCfg) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"deployment\", `ensureProject ${previewCfg.project}`, dryRun, async () => {\n\t\t\t\t\tawait deploy.ensureProject({ name: previewCfg.project });\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (previewCfg?.domain) {\n\t\t\tawait ensureCustomDomain(previewCfg.project, previewCfg.domain);\n\t\t}\n\n\t\t// Cloudflare Pages doesn't expose its DNS challenge, so retain its\n\t\t// provider-specific apex + wildcard records. Other providers return\n\t\t// their required record from ensureCustomDomain() above.\n\t\tif (previewCfg?.domain && deploy.providerName === \"cloudflare\" && loader.has(\"dns\")) {\n\t\t\tconst dns = loader.get(\"dns\") as Dns;\n\t\t\tconst wildcardDomain = `*.${previewCfg.domain}`;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"dns\", `upsertRecord ${previewCfg.domain}`, dryRun, async () => {\n\t\t\t\t\tawait dns.upsertRecord(previewCfg.domain!, {\n\t\t\t\t\t\ttype: \"CNAME\",\n\t\t\t\t\t\tname: previewCfg.domain!,\n\t\t\t\t\t\tcontent: `${previewCfg.project}.pages.dev`,\n\t\t\t\t\t\tttl: 1,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"dns\", `upsertRecord ${wildcardDomain}`, dryRun, async () => {\n\t\t\t\t\tawait dns.upsertRecord(previewCfg.domain!, {\n\t\t\t\t\t\ttype: \"CNAME\",\n\t\t\t\t\t\tname: wildcardDomain,\n\t\t\t\t\t\tcontent: `${previewCfg.project}.pages.dev`,\n\t\t\t\t\t\tttl: 1,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── auth: ensure webhook app (optional method) ──────────────────────\n\tif (loader.has(\"auth\")) {\n\t\tconst auth = loader.get(\"auth\") as Auth;\n\t\tprint(style.step(\"auth\"));\n\t\tif (auth.ensureWebhookApp) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"auth\", \"ensureWebhookApp\", dryRun, async () => {\n\t\t\t\t\tconst result = await auth.ensureWebhookApp!();\n\t\t\t\t\treturn `webhook ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"auth\",\n\t\t\t\tstep: \"ensureWebhookApp\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"provider does not implement ensureWebhookApp\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── vault: bootstrap project + configs, then read-only probe ───────\n\tif (loader.has(\"vault\")) {\n\t\tconst vault = loader.get(\"vault\") as Vault;\n\t\tprint(style.step(\"vault\"));\n\n\t\tif (vault.ensureProject) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"vault\", `ensureProject ${config.name}`, dryRun, async () => {\n\t\t\t\t\tconst result = await vault.ensureProject!(config.name);\n\t\t\t\t\treturn `project ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (vault.ensureEnvironment) {\n\t\t\tfor (const envName of [\"dev\", \"stg\", \"prd\"]) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"vault\", `ensureEnvironment ${envName}`, dryRun, async () => {\n\t\t\t\t\t\tconst result = await vault.ensureEnvironment!(config.name, envName);\n\t\t\t\t\t\treturn `${envName} ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst keys = await vault.list();\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"vault\",\n\t\t\t\tstep: \"list\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\tmessage: `${keys.length} keys available`,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"vault\",\n\t\t\t\tstep: \"list\",\n\t\t\t\tstatus: \"fail\",\n\t\t\t\tmessage: errorMessage(err),\n\t\t\t});\n\t\t}\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── errors: provision the tracker project + push the DSN to secrets ─\n\tif (loader.has(\"errors\")) {\n\t\tconst errors = loader.get(\"errors\") as Errors;\n\t\tprint(style.step(\"errors\"));\n\n\t\tif (errors.ensureProject) {\n\t\t\tlet dsn: string | undefined;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"errors\", `ensureProject ${config.name}`, dryRun, async () => {\n\t\t\t\t\tconst result = await errors.ensureProject!({ name: config.name });\n\t\t\t\t\tdsn = result.dsn;\n\t\t\t\t\treturn `project ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\tif (dsn && loader.has(\"secrets\")) {\n\t\t\t\tconst secrets = loader.get(\"secrets\") as Secrets;\n\t\t\t\tconst { envKeys } = await errors.describe();\n\t\t\t\tfor (const key of envKeys) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runStep(\"errors\", `secrets set ${key}`, dryRun, async () => {\n\t\t\t\t\t\t\tawait secrets.setSecret({ kind: \"repo\" }, key, dsn!);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── logs: provision the aggregation datasets ───────────────────────\n\tif (loader.has(\"logs\")) {\n\t\tconst logs = loader.get(\"logs\") as Logs;\n\t\tprint(style.step(\"logs\"));\n\n\t\tif (logs.ensureDataset) {\n\t\t\tfor (const dataset of [\"holocron-ci\", \"holocron-local\"]) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"logs\", `ensureDataset ${dataset}`, dryRun, async () => {\n\t\t\t\t\t\tconst result = await logs.ensureDataset!(dataset);\n\t\t\t\t\t\treturn `${dataset} ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── monitoring: ensure each configured check exists ─────────────────\n\tif (loader.has(\"monitoring\")) {\n\t\tconst monitoring = loader.get(\"monitoring\") as Monitoring;\n\t\tprint(style.step(\"monitoring\"));\n\n\t\tfor (const checkInput of monitoring.checks) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"monitoring\", `ensureCheck ${checkInput.name}`, dryRun, async () => {\n\t\t\t\t\tconst result = await monitoring.ensureCheck(checkInput);\n\t\t\t\t\treturn `${checkInput.name} ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── tooling: sync each (many cardinality) ───────────────────────────\n\tif (loader.has(\"tooling\")) {\n\t\tconst tools = loader.get(\"tooling\") as Tooling[];\n\t\tprint(style.step(\"tooling\"));\n\t\tfor (const tool of tools) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"tooling\", `${tool.providerName}.sync`, dryRun, async () => {\n\t\t\t\t\tawait tool.sync();\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── skills: install agent skills from registry ──────────────────────\n\tif (config.skills && config.skills.length > 0 && config.agent) {\n\t\tprint(style.step(\"skills\"));\n\t\tif (!(config.agent in AGENT_SYMLINK_PATHS)) {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"skills\",\n\t\t\t\tstep: \"install skills\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: `agent \"${config.agent}\" has no known skill install path`,\n\t\t\t});\n\t\t} else {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"skills\", \"install skills\", dryRun, async () => {\n\t\t\t\t\treturn await installSkills({\n\t\t\t\t\t\tagent: config.agent!,\n\t\t\t\t\t\tskills: config.skills!,\n\t\t\t\t\t\trepoRoot: input.context.repoRoot,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── prompts: write agent role prompts to .agents/prompts/ ────────────\n\tif (config.agent) {\n\t\tprint(style.step(\"prompts\"));\n\t\tsteps.push(\n\t\t\tawait runStep(\"prompts\", \"install agent prompts\", dryRun, async () => {\n\t\t\t\treturn await installAgentPrompts({ repoRoot: input.context.repoRoot });\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── engineering: provision docs/decisions/ and docs/engineering/ ─────\n\tif (config.docs) {\n\t\tprint(style.step(\"engineering\"));\n\t\tsteps.push(\n\t\t\tawait runStep(\"engineering\", \"provision engineering structure\", dryRun, async () => {\n\t\t\t\treturn await installEngineeringStructure({ repoRoot: input.context.repoRoot });\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\tconst summary = steps.reduce(\n\t\t(acc, s) => {\n\t\t\tif (s.status === \"ok\") acc.ok += 1;\n\t\t\telse if (s.status === \"fail\") acc.fail += 1;\n\t\t\telse if (s.status === \"skip\") acc.skip += 1;\n\t\t\telse if (s.status === \"dry-run\") acc.dryRun += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0, dryRun: 0 }\n\t);\n\n\tprint(\"\");\n\tconst summaryLine = ` ${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${\n\t\tdryRun ? `, ${summary.dryRun} would-do` : \"\"\n\t}`;\n\tprint(summary.fail > 0 ? style.fail(summaryLine.trim()) : style.success(summaryLine.trim()));\n\n\tconst skippedSteps = steps.filter((s) => s.status === \"skip\");\n\tif (skippedSteps.length > 0) {\n\t\tprint(\"\");\n\t\tprint(style.hint(\" Skipped:\"));\n\t\tfor (const s of skippedSteps) {\n\t\t\t/* v8 ignore next -- all skip steps set message; empty fallback is defensive */\n\t\t\tprint(style.hint(` · ${s.step}${s.message ? ` (${s.message})` : \"\"}`));\n\t\t}\n\t}\n\n\tif (steps.some((s) => s.reason === \"permissions\")) {\n\t\tprint(\"\");\n\t\tprint(style.warn(\"Some steps failed with 403 (insufficient token permissions).\"));\n\t\tprint(style.hint(\" Repo-scoped operations (rulesets, settings, workflows) require a\"));\n\t\tprint(style.hint(\" fine-grained PAT passed via --token or HOLOCRON_ADMIN_TOKEN:\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" · Administration — read and write\"));\n\t\tprint(style.hint(\" · Code scanning alerts — read and write\"));\n\t\tprint(style.hint(\" · Contents — read and write\"));\n\t\tprint(style.hint(\" · Secret scanning alerts — read and write\"));\n\t\tprint(style.hint(\" · Workflows — read and write\"));\n\t\tprint(style.hint(\" · Metadata — read (added automatically)\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" Org-scoped operations (teams, custom properties) require\"));\n\t\tprint(style.hint(\" HOLOCRON_ORG_TOKEN — a fine-grained PAT with resource owner set to the org:\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" · Administration — read and write (repository permission)\"));\n\t\tprint(style.hint(\" · Members — read (organization permission)\"));\n\t\tprint(style.hint(\" · Organization custom properties — read and write (organization permission)\"));\n\t\tprint(style.hint(\" · Metadata — read (repository permission, auto-included)\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" Create tokens at: https://github.com/settings/personal-access-tokens/new\"));\n\t\tprint(style.hint(\" Then re-run: holocron repo setup --token <your-admin-pat>\"));\n\t\tprint(style.hint(\" Store org token: HOLOCRON_ORG_TOKEN env var or keyring key github.org\"));\n\t}\n\n\treturn { steps, summary };\n}\n\n/**\n * Ensure `package.json#scripts.prepare` runs `husky` so git hooks register on\n * install. Merge-only: an existing `prepare` that does more than husky (e.g.\n * `turbo run build` — needed where root config files import a workspace\n * package's `dist/`, theholocron/holocron#654) is preserved and husky is\n * appended. Leaves every other script untouched. Returns `true` when it wrote\n * a change, `false` when already runs husky or there is no `package.json`.\n */\nasync function ensurePrepareScript(repoRoot: string): Promise<boolean> {\n\tconst pkgPath = join(repoRoot, \"package.json\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(pkgPath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\tconst pkg = JSON.parse(content) as { scripts?: Record<string, string> };\n\tconst scripts = pkg.scripts ?? {};\n\tconst current = scripts.prepare?.trim() ?? \"\";\n\t// Already invokes husky (bare, or as a step in a chain) → nothing to do.\n\tif (/(^|[\\s&|;])husky($|[\\s&|;])/.test(current)) return false;\n\tscripts.prepare = current ? `${current} && husky` : \"husky\";\n\tpkg.scripts = scripts;\n\tawait writeFile(pkgPath, stringifyJson(pkg, { like: content }), \"utf8\");\n\treturn true;\n}\n","/**\n * `holocron skills` — install, remove, and update agent skills from @theholocron/skills.\n *\n * Unlike `holocron repo setup`, this command is purely local (no GitHub token\n * required). It reads `agent` and `skills` from the config and installs\n * the listed skills into `.agents/skills/<name>/` with a symlink at the\n * agent-specific path (e.g. `.claude/skills/<name>` for Claude Code).\n *\n * `holocron skills remove [name]` and `holocron skills update [name]` delegate\n * to the corresponding `npx skills` subcommands from the upstream skills CLI.\n */\n\nimport { spawnSync } from \"node:child_process\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { installSkills } from \"../setup/index.js\";\nimport type {\n\tExecFn,\n\tRunSkillsInput,\n\tRunSkillsRemoveInput,\n\tRunSkillsUpdateInput,\n\tSkillsRemoveReport,\n\tSkillsUpdateReport,\n} from \"./skills.type.js\";\n\nconst defaultExec: ExecFn = (cmd, args, opts) => {\n\tconst result = spawnSync(cmd, args, { cwd: opts.cwd, stdio: \"inherit\" });\n\treturn { exitCode: result.status ?? -1 };\n};\n\nexport async function runSkillsInstall(input: RunSkillsInput): Promise<void> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst config = input.loaded.resolved;\n\n\tif (!config.agent || !config.skills?.length) {\n\t\tprint(\"Nothing to install — set `agent` and `skills` in holocron.config.ts\");\n\t\tlogger.info({ status: \"skip\", reason: \"no agent/skills configured\" }, \"skills install: done\");\n\t\treturn;\n\t}\n\n\tif (input.context.dryRun) {\n\t\tprint(`Would install ${config.skills.length} skill(s) for agent: ${config.agent}`);\n\t\tfor (const name of config.skills) {\n\t\t\tprint(` → would install: ${name}`);\n\t\t}\n\t\tlogger.info({ agent: config.agent, skills: config.skills, status: \"dry-run\" }, \"skills install: done\");\n\t\treturn;\n\t}\n\n\tprint(`Installing ${config.skills.length} skill(s) for agent: ${config.agent}`);\n\tlogger.info({ agent: config.agent, count: config.skills.length }, \"skills install: start\");\n\ttry {\n\t\tconst result = await installSkills({\n\t\t\tagent: config.agent,\n\t\t\tskills: config.skills,\n\t\t\trepoRoot: input.context.repoRoot,\n\t\t});\n\t\tprint(` → ${result}`);\n\t\tlogger.info({ agent: config.agent, skills: config.skills, status: \"ok\" }, \"skills install: done\");\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ agent: config.agent, reason: message, status: \"fail\" }, \"skills install: done\");\n\t}\n}\n\nexport function runSkillsRemove(input: RunSkillsRemoveInput): SkillsRemoveReport {\n\tconst { dryRun, repoRoot } = input.context;\n\tconst exec = input.exec ?? defaultExec;\n\tconst logger = input.logger ?? getLogger();\n\tconst args = [\"skills\", \"remove\", ...(input.names ?? [])];\n\n\tif (dryRun) {\n\t\tlogger.info({ argv: args }, `Would run: npx ${args.join(\" \")}`);\n\t\treturn { status: \"dry-run\" };\n\t}\n\n\tconst { exitCode } = exec(\"npx\", args, { cwd: repoRoot });\n\treturn { status: exitCode === 0 ? \"ok\" : \"fail\" };\n}\n\nexport function runSkillsUpdate(input: RunSkillsUpdateInput): SkillsUpdateReport {\n\tconst { dryRun, repoRoot } = input.context;\n\tconst exec = input.exec ?? defaultExec;\n\tconst logger = input.logger ?? getLogger();\n\tconst args = [\"skills\", \"update\", ...(input.name ? [input.name] : [])];\n\n\tif (dryRun) {\n\t\tlogger.info({ argv: args }, `Would run: npx ${args.join(\" \")}`);\n\t\treturn { status: \"dry-run\" };\n\t}\n\n\tconst { exitCode } = exec(\"npx\", args, { cwd: repoRoot });\n\treturn { status: exitCode === 0 ? \"ok\" : \"fail\" };\n}\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { generateReadme, type PackagesRegistry } from \"@theholocron/components-doc/markdown\";\nimport { getClients, getConfigs, getDocs, getPlugins, getSkills, getThemes, getUtils } from \"@theholocron/registry-doc\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { style } from \"../../ui/index.js\";\nimport type { PackageJson, RunSyncReadmeInput, SyncReadmeReport } from \"./sync-readme.type.js\";\n\nconst MARKER_INSTALL_START = \"<!-- holocron:installation -->\";\nconst MARKER_INSTALL_END = \"<!-- /holocron:installation -->\";\n\nconst REGISTRY_MAP: Record<string, () => PackagesRegistry> = {\n\t\"@theholocron/clients\": getClients,\n\t\"@theholocron/configs\": getConfigs,\n\t\"@theholocron/docs\": getDocs,\n\t\"@theholocron/holocron\": getPlugins,\n\t\"@theholocron/skills\": getSkills,\n\t\"@theholocron/themes\": getThemes,\n\t\"@theholocron/utils\": getUtils,\n};\n\nfunction generateInstallBlock(pkg: PackageJson, homepage = \"\"): string {\n\tconst { name = \"\", bin, peerDependencies = {} } = pkg;\n\tconst isCli = Boolean(bin);\n\tconst isReact = Boolean(peerDependencies[\"react\"]);\n\t// A private package with no bin and nothing importable (no `main`, no\n\t// `exports`) is a workspace root or template — not something to `pnpm\n\t// install` or `import` from.\n\tconst isConsumable = isCli || !pkg.private || Boolean(pkg.main) || pkg.exports !== undefined;\n\tconst lines: string[] = [];\n\n\tlines.push(\"## Installation\", \"\");\n\n\tif (!isConsumable) {\n\t\tlines.push(\n\t\t\t\"This repository is a workspace root — it is not published. See the\",\n\t\t\t\"packages under [`packages/`](./packages) for the tools it ships.\"\n\t\t);\n\t\treturn lines.join(\"\\n\");\n\t}\n\n\tif (isCli) {\n\t\tlines.push(\"```bash\", `npm install --global ${name}`, \"```\");\n\t} else {\n\t\tlines.push(\"```bash\", `pnpm install ${name}`, \"```\");\n\t}\n\n\tlines.push(\"\", \"## Usage\", \"\");\n\n\tif (isCli) {\n\t\tconst commands =\n\t\t\ttypeof bin === \"string\" ? [name.split(\"/\").at(-1)!] : Object.keys(bin as Record<string, string>);\n\t\tlines.push(\"```bash\");\n\t\tfor (const cmd of commands) {\n\t\t\tlines.push(`${cmd} --help`);\n\t\t}\n\t\tlines.push(\"```\");\n\t} else if (isReact) {\n\t\tlines.push(\"```tsx\", `import {} from \"${name}\";`, \"\", \"function App() {\", ` return <></>;`, \"}\", \"```\");\n\t} else if (homepage) {\n\t\t// Exports aren't known at sync time — link the docs rather than emit a\n\t\t// meaningless empty-brace import.\n\t\tlines.push(`See the [documentation](${homepage}) for the API.`);\n\t} else {\n\t\tlines.push(\"See the package documentation for the API.\");\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Replace content between `<!-- holocron:marker -->` / `<!-- /holocron:marker -->` tags.\n * Returns the updated README string, or the original if the marker pair is absent.\n */\nfunction replaceMarkerBlock(readme: string, marker: string, content: string): string {\n\tconst start = `<!-- holocron:${marker} -->`;\n\tconst end = `<!-- /holocron:${marker} -->`;\n\tconst lines = readme.split(\"\\n\");\n\tconst startIdx = lines.findIndex((l) => l.trim() === start);\n\tconst endIdx = lines.findIndex((l) => l.trim() === end);\n\tif (startIdx === -1 || endIdx === -1 || endIdx <= startIdx) return readme;\n\tlines.splice(startIdx + 1, endIdx - startIdx - 1, \"\", ...content.split(\"\\n\"), \"\");\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Apply all README updates in a single read-write cycle.\n * Returns true if the README was found (even if no changes were needed).\n */\nasync function updateReadme(\n\trepoRoot: string,\n\tinstallBlock: string,\n\tsections: Record<string, string>,\n\tdryRun: boolean,\n\treadFileFn: (path: string, encoding: BufferEncoding) => Promise<string>,\n\twriteFileFn: (path: string, content: string, encoding: BufferEncoding) => Promise<void>\n): Promise<boolean> {\n\tconst readmePath = join(repoRoot, \"README.md\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFileFn(readmePath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\n\tlet updated = content;\n\n\t// Replace existing marker blocks for generated sections\n\tfor (const [marker, text] of Object.entries(sections)) {\n\t\tupdated = replaceMarkerBlock(updated, marker, text);\n\t}\n\n\t// Replace or insert installation block\n\tconst lines = updated.split(\"\\n\");\n\tconst startIdx = lines.findIndex((l) => l.trim() === MARKER_INSTALL_START);\n\tconst endIdx = lines.findIndex((l) => l.trim() === MARKER_INSTALL_END);\n\tconst blockLines = installBlock.split(\"\\n\");\n\n\tif (startIdx !== -1 && endIdx !== -1 && endIdx > startIdx) {\n\t\tlines.splice(startIdx + 1, endIdx - startIdx - 1, \"\", ...blockLines, \"\");\n\t\tupdated = lines.join(\"\\n\");\n\t} else {\n\t\tconst descEnd = lines.findIndex((l) => l.trim() === \"<!-- /holocron:description -->\");\n\t\tconst insertAfter = descEnd !== -1 ? descEnd : lines.findIndex((l) => /^# /.test(l));\n\t\tif (insertAfter === -1) return false;\n\t\tlines.splice(insertAfter + 1, 0, \"\", MARKER_INSTALL_START, \"\", ...blockLines, \"\", MARKER_INSTALL_END);\n\t\tupdated = lines.join(\"\\n\");\n\t}\n\n\tif (!dryRun) {\n\t\tawait writeFileFn(readmePath, updated, \"utf8\");\n\t}\n\treturn true;\n}\n\nasync function updateIndexMdxDescription(\n\trepoRoot: string,\n\tdescription: string,\n\tdryRun: boolean,\n\treadFileFn: (path: string, encoding: BufferEncoding) => Promise<string>,\n\twriteFileFn: (path: string, content: string, encoding: BufferEncoding) => Promise<void>\n): Promise<void> {\n\tconst mdxPath = join(repoRoot, \"docs\", \"src\", \"content\", \"docs\", \"index.mdx\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFileFn(mdxPath, \"utf8\");\n\t} catch {\n\t\treturn; // file doesn't exist — skip silently\n\t}\n\tconst updated = content.replace(/^(description:\\s*).*$/m, `$1${description}`);\n\tif (updated !== content && !dryRun) {\n\t\tawait writeFileFn(mdxPath, updated, \"utf8\");\n\t}\n}\n\nexport async function runSyncReadme(input: RunSyncReadmeInput): Promise<SyncReadmeReport> {\n\tconst { loaded, context, print = console.log, readFileFn = readFile, writeFileFn = writeFile } = input;\n\tconst logger = input.logger ?? getLogger();\n\n\tconst { repoRoot, dryRun = false } = context;\n\n\tconst namespaces = loaded.resolved.env?.namespaces ?? [];\n\n\tprint(style.header(`Syncing README installation block${dryRun ? \" (dry-run)\" : \"\"}…`));\n\tif (namespaces.length > 0) {\n\t\tprint(style.hint(` namespaces: ${namespaces.join(\", \")}`));\n\t}\n\n\t// Read package.json\n\tlet pkg: PackageJson;\n\ttry {\n\t\tconst raw = await readFileFn(join(repoRoot, \"package.json\"), \"utf8\");\n\t\tpkg = JSON.parse(raw) as PackageJson;\n\t} catch {\n\t\tlogger.warn({ repoRoot, reason: \"could not read package.json\" }, \"sync readme: done\");\n\t\treturn { status: \"fail\", updated: false, message: \"Could not read package.json\" };\n\t}\n\n\t// Assemble generated sections (4.3)\n\tconst description = loaded.resolved.description ?? \"\";\n\tconst homepage = loaded.resolved.homepage ?? pkg.homepage ?? \"\";\n\tconst scripts = pkg.scripts ?? {};\n\tconst packages = pkg.name ? REGISTRY_MAP[pkg.name]?.() : undefined;\n\n\tconst sections = generateReadme({ description, homepage, scripts, packages });\n\tconst markerSections: Record<string, string> = {\n\t\t...(sections.packages !== undefined && { packages: sections.packages }),\n\t\tdevelopment: sections.development,\n\t\treleases: sections.releases,\n\t};\n\n\t// Single read-write pass for all README changes\n\tconst installBlock = generateInstallBlock(pkg, homepage);\n\tconst updated = await updateReadme(repoRoot, installBlock, markerSections, dryRun, readFileFn, writeFileFn);\n\n\tif (!updated) {\n\t\tprint(style.warn(\"README.md not found or has no writable location for installation block\"));\n\t\tlogger.warn({ repoRoot, reason: \"README.md not found / no marker block\" }, \"sync readme: done\");\n\t\treturn { status: \"fail\", updated: false, message: \"README.md update failed\" };\n\t}\n\n\t// Update docs/src/content/docs/index.mdx frontmatter description (4.4)\n\tif (description) {\n\t\tawait updateIndexMdxDescription(repoRoot, description, dryRun, readFileFn, writeFileFn);\n\t}\n\n\tprint(dryRun ? style.hint(\" would update README.md\") : style.success(\" updated README.md\"));\n\tconst status = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ repoRoot, status, updated }, \"sync readme: done\");\n\treturn { status, updated };\n}\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { firstEnv } from \"@theholocron/env-utils\";\nimport { createRestClient } from \"@theholocron/http-client\";\n\nimport { env } from \"../../env/index.js\";\nimport type { SetupStepResult } from \"../setup/index.js\";\nimport type { FileContents, OrgRepo, RunSyncWikiInput, WikiRepo } from \"./sync-wiki.type.js\";\n\n// ---------------------------------------------------------------------------\n// Token resolution\n// ---------------------------------------------------------------------------\n\nfunction resolveToken(input: RunSyncWikiInput): string | undefined {\n\treturn input.token ?? input.context.cliToken ?? firstEnv(env, [\"HOLOCRON_READ_TOKEN\", \"GH_TOKEN\", \"GITHUB_TOKEN\"]);\n}\n\n// ---------------------------------------------------------------------------\n// Config parsing helpers\n// ---------------------------------------------------------------------------\n\nfunction deriveBasepath(domain: string | undefined, repoName: string): string {\n\tif (domain) {\n\t\tconst slashIdx = domain.indexOf(\"/\");\n\t\tif (slashIdx !== -1) return domain.slice(slashIdx + 1);\n\t}\n\treturn repoName;\n}\n\nfunction toNavLabel(basepath: string): string {\n\treturn basepath\n\t\t.split(\"-\")\n\t\t.map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n\t\t.join(\" \");\n}\n\nfunction extractFromJson(raw: string, repoName: string): WikiRepo | null {\n\tlet config: Record<string, unknown>;\n\ttry {\n\t\tconfig = JSON.parse(raw) as Record<string, unknown>;\n\t} catch {\n\t\treturn null;\n\t}\n\tconst providers = config.providers as Record<string, unknown> | undefined;\n\tif (!providers?.wiki) return null;\n\n\tconst wikiEntry = providers.wiki;\n\tlet domain: string | undefined;\n\n\tif (Array.isArray(wikiEntry) && wikiEntry.length === 2) {\n\t\tconst opts = wikiEntry[1] as Record<string, unknown>;\n\t\tdomain = typeof opts.domain === \"string\" ? opts.domain : undefined;\n\t}\n\n\tconst basepath = deriveBasepath(domain, repoName);\n\treturn { displayName: toNavLabel(basepath), basepath, ...(domain ? { domain } : {}) };\n}\n\nfunction extractFromTs(raw: string, repoName: string): WikiRepo | null {\n\tconst hasWikiProvider = /providers\\s*:\\s*\\{[^}]*\\bwiki\\b/s.test(raw);\n\tconst hasWikiPreset = /\\bwikiCapability\\b|\\bwiki\\s*\\(\\s*\\)/.test(raw);\n\t/* c8 ignore next */\n\tif (!hasWikiProvider && !hasWikiPreset) return null;\n\n\tconst domainMatch = raw.match(/\\bdomain\\s*:\\s*[\"']([^\"']+)[\"']/);\n\tconst domain = domainMatch?.[1];\n\n\tconst basepath = deriveBasepath(domain, repoName);\n\treturn { displayName: toNavLabel(basepath), basepath, ...(domain ? { domain } : {}) };\n}\n\n// ---------------------------------------------------------------------------\n// Discovery\n// ---------------------------------------------------------------------------\n\nexport async function discoverWikiRepos(\n\torg: string,\n\ttoken: string,\n\tfetchFn?: typeof globalThis.fetch\n): Promise<WikiRepo[]> {\n\tconst rest = createRestClient({\n\t\tbaseUrl: \"https://api.github.com\",\n\t\ttoken,\n\t\textraHeaders: {\n\t\t\taccept: \"application/vnd.github+json\",\n\t\t\t\"x-github-api-version\": \"2022-11-28\",\n\t\t},\n\t\tvendor: \"GitHub\",\n\t\tfetch: fetchFn,\n\t});\n\n\tconst allRepos: OrgRepo[] = [];\n\tlet page = 1;\n\twhile (true) {\n\t\tconst batch = await rest.request<OrgRepo[]>(`/orgs/${org}/repos`, {\n\t\t\tquery: { per_page: \"100\", page: String(page), type: \"all\" },\n\t\t});\n\t\tallRepos.push(...batch);\n\t\tif (batch.length < 100) break;\n\t\tpage++;\n\t}\n\n\tconst repos: WikiRepo[] = [];\n\n\tfor (const repo of allRepos.filter((r) => !r.archived)) {\n\t\tlet found: WikiRepo | null = null;\n\n\t\ttry {\n\t\t\tconst contents = await rest.request<FileContents>(`/repos/${repo.full_name}/contents/holocron.config.json`);\n\t\t\tif (contents.encoding === \"base64\") {\n\t\t\t\tconst raw = Buffer.from(contents.content.replace(/\\s/g, \"\"), \"base64\").toString(\"utf8\");\n\t\t\t\tfound = extractFromJson(raw, repo.name);\n\t\t\t}\n\t\t} catch {\n\t\t\t// no JSON config — try TS\n\t\t}\n\n\t\tif (!found) {\n\t\t\ttry {\n\t\t\t\tconst contents = await rest.request<FileContents>(\n\t\t\t\t\t`/repos/${repo.full_name}/contents/holocron.config.ts`\n\t\t\t\t);\n\t\t\t\tif (contents.encoding === \"base64\") {\n\t\t\t\t\tconst raw = Buffer.from(contents.content.replace(/\\s/g, \"\"), \"base64\").toString(\"utf8\");\n\t\t\t\t\tfound = extractFromTs(raw, repo.name);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// no config found — skip\n\t\t\t}\n\t\t}\n\n\t\tif (found) repos.push(found);\n\t}\n\n\trepos.sort((a, b) => a.basepath.localeCompare(b.basepath));\n\treturn repos;\n}\n\n// ---------------------------------------------------------------------------\n// navbar-links block builder\n// ---------------------------------------------------------------------------\n\n/**\n * Builds the complete navbar-links YAML block for a given repo.\n *\n * Includes:\n * - A GitHub button linking to the repo itself (always first)\n * - A single \"Wiki\" dropdown containing minimal links to every other\n * wiki-enabled repo (excluding self), keeping the navbar uncluttered\n * regardless of how many repos are in the org.\n *\n * The block is replaced wholesale on each sync so removed/added wikis\n * stay in sync automatically.\n */\nexport function buildNavbarLinks(repos: WikiRepo[], currentBasepath: string, repoFullName: string): string {\n\tconst lines = [`navbar-links:`, ` - type: github`, ` value: https://github.com/${repoFullName}`];\n\n\tconst others = repos.filter((r) => r.basepath !== currentBasepath);\n\tif (others.length > 0) {\n\t\tlines.push(` - type: dropdown`, ` text: Other Projects`, ` icon: fa-duotone fa-book`, ` links:`);\n\t\tfor (const repo of others) {\n\t\t\tconst url = repo.domain ? `https://${repo.domain}` : `https://wiki.theholocron.dev/${repo.basepath}`;\n\t\t\tlines.push(` - href: ${url}`, ` text: ${repo.displayName}`);\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// fern/docs.yml updater\n// ---------------------------------------------------------------------------\n\n/**\n * Idempotently ensures `edit-this-page:` (inside instances) is present and\n * replaces `navbar-links:` with the provided shared block.\n *\n * Returns true when the file was modified.\n * Throws when fern/docs.yml does not exist.\n */\nexport async function mergeWikiConfig(\n\tdocsYmlPath: string,\n\tconfig: { owner: string; repoName: string; navbarBlock: string }\n): Promise<boolean> {\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(docsYmlPath, \"utf8\");\n\t} catch {\n\t\tthrow new Error(`fern/docs.yml not found at ${docsYmlPath}`);\n\t}\n\n\tlet updated = content;\n\n\t// 1. Ensure edit-this-page: is nested inside the instances block entry.\n\tif (!updated.includes(\"edit-this-page:\")) {\n\t\tconst editBlock = [\n\t\t\t` edit-this-page:`,\n\t\t\t` github:`,\n\t\t\t` owner: ${config.owner}`,\n\t\t\t` repo: ${config.repoName}`,\n\t\t\t` branch: main`,\n\t\t].join(\"\\n\");\n\n\t\tif (/^ {4}multi-source: true$/m.test(updated)) {\n\t\t\tupdated = updated.replace(/^( {4}multi-source: true)$/m, `$1\\n${editBlock}`);\n\t\t} else if (/^ {4}custom-domain: .+$/m.test(updated)) {\n\t\t\tupdated = updated.replace(/^( {4}custom-domain: .+)$/m, `$1\\n${editBlock}`);\n\t\t} else {\n\t\t\t// Fallback: insert after the \" - url:\" list item line\n\t\t\tupdated = updated.replace(/^( {2}- url: .+)$/m, `$1\\n${editBlock}`);\n\t\t}\n\t}\n\n\t// 2. Replace navbar-links: wholesale so removed/added wikis stay in sync.\n\tconst navbarRe = /^navbar-links:(?:\\n[ \\t][^\\n]*)*/m;\n\tif (navbarRe.test(updated)) {\n\t\tupdated = updated.replace(navbarRe, config.navbarBlock);\n\t} else if (/^colors:/m.test(updated)) {\n\t\tupdated = updated.replace(/^(colors:)/m, `${config.navbarBlock}\\n\\n$1`);\n\t} else {\n\t\tupdated = updated.trimEnd() + \"\\n\\n\" + config.navbarBlock + \"\\n\";\n\t}\n\n\tif (updated !== content) {\n\t\tawait writeFile(docsYmlPath, updated, \"utf8\");\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// ---------------------------------------------------------------------------\n// Validate\n// ---------------------------------------------------------------------------\n\n/**\n * Checks that fern/docs.yml has the required wiki header fields.\n * Returns a list of missing field names; empty means valid.\n */\nexport async function validateWikiConfig(docsYmlPath: string): Promise<string[]> {\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(docsYmlPath, \"utf8\");\n\t} catch {\n\t\treturn [\"fern/docs.yml not found\"];\n\t}\n\n\tconst missing: string[] = [];\n\tif (!content.includes(\"edit-this-page:\")) missing.push(\"edit-this-page\");\n\tif (!content.includes(\"navbar-links:\")) missing.push(\"navbar-links\");\n\treturn missing;\n}\n\n// ---------------------------------------------------------------------------\n// runSyncWiki\n// ---------------------------------------------------------------------------\n\nexport async function runSyncWiki(input: RunSyncWikiInput): Promise<SetupStepResult> {\n\tconst config = input.loaded.resolved;\n\tconst dryRun = input.context.dryRun ?? false;\n\n\tif (!config.providers.wiki) {\n\t\treturn { capability: \"local\", step: \"sync wiki\", status: \"skip\", message: \"no wiki provider configured\" };\n\t}\n\n\tconst rawRepo = input.context.repo ?? config.repo?.name;\n\tif (!rawRepo) {\n\t\treturn { capability: \"local\", step: \"sync wiki\", status: \"skip\", message: \"no repo configured\" };\n\t}\n\n\tconst [owner, repoName] = rawRepo.split(\"/\") as [string, string | undefined];\n\tif (!owner || !repoName) {\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"skip\",\n\t\t\tmessage: \"repo must be owner/name format\",\n\t\t};\n\t}\n\n\tconst org = config.org ?? owner;\n\n\tconst token = resolveToken(input);\n\tif (!token) {\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"skip\",\n\t\t\tmessage: \"no GitHub token available (set HOLOCRON_READ_TOKEN or GH_TOKEN)\",\n\t\t};\n\t}\n\n\tif (dryRun) {\n\t\treturn { capability: \"local\", step: \"sync wiki\", status: \"dry-run\" };\n\t}\n\n\tconst docsYmlPath = join(input.context.repoRoot, \"fern\", \"docs.yml\");\n\n\ttry {\n\t\tconst repos = await discoverWikiRepos(org, token, input.fetch);\n\n\t\t// Derive the current repo's basepath from its own wiki config so we\n\t\t// can exclude it from the nav links it renders for itself.\n\t\t// config.providers.wiki is already resolved to { tuple: { options } } form.\n\t\tconst wikiOpts = (config.providers.wiki as unknown as { tuple?: { options?: Record<string, unknown> } })?.tuple\n\t\t\t?.options;\n\t\tconst domain = typeof wikiOpts?.domain === \"string\" ? wikiOpts.domain : undefined;\n\t\tconst currentBasepath = deriveBasepath(domain, repoName);\n\n\t\tconst navbarBlock = buildNavbarLinks(repos, currentBasepath, rawRepo);\n\n\t\tconst changed = await mergeWikiConfig(docsYmlPath, { owner, repoName, navbarBlock });\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"ok\",\n\t\t\tmessage: changed ? `updated (${repos.length} wiki repos discovered)` : \"already up to date\",\n\t\t};\n\t} catch (err) {\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: err instanceof Error ? err.message : /* c8 ignore next */ String(err),\n\t\t};\n\t}\n}\n","import { randomUUID } from \"node:crypto\";\nimport { realpathSync } from \"node:fs\";\nimport { access, mkdir, readFile, rename, writeFile } from \"node:fs/promises\";\nimport { basename, join } from \"node:path\";\n\nimport { createAstromech, createHeader, KNOWN_WORKFLOWS, readWorkspacePackages } from \"@theholocron/astromech\";\nimport type { TasksConfig } from \"@theholocron/astromech/config\";\nimport { findRootSync } from \"@theholocron/fs-utils\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { PluginLoader, type Source } from \"../../plugin/index.js\";\nimport {\n\tCANONICAL_LABELS,\n\tderiveCapabilities,\n\tderiveCompliance,\n\tderiveProfile,\n\tderiveStack,\n\treadWorkspacePackageJsons,\n\ttype SetupReport,\n\ttype SetupStepResult,\n\tSTALE_LABELS,\n} from \"../setup/index.js\";\n\n// The only content this file ever prefixes with workflowHeader() is thin-caller\n// workflow content from astromech.thinCallers() — sync.ts just writes it. The\n// actual template/generation logic a contributor would edit lives there.\nconst { workflowHeader } = createHeader({\n\tsource: \"packages/astromech/src/thin-callers.ts\",\n\ttool: \"holocron repo sync\",\n});\nimport { runSyncReadme } from \"../sync-readme/index.js\";\nimport { runSyncWiki } from \"../sync-wiki/index.js\";\nimport type { RunSyncInput, SyncStep } from \"./sync.type.js\";\n\nexport const SYNC_STEPS = [\n\t\"labels\",\n\t\"properties\",\n\t\"teams\",\n\t\"topics\",\n\t\"keywords\",\n\t\"description\",\n\t\"homepage\",\n\t\"readme\",\n\t\"workflows\",\n\t\"scripts\",\n\t\"turbo\",\n\t\"wiki\",\n] as const;\n\n// Steps that write to the local filesystem only — no provider token needed.\nconst LOCAL_STEPS = new Set<SyncStep>([\n\t\"keywords\",\n\t\"description\",\n\t\"homepage\",\n\t\"readme\",\n\t\"workflows\",\n\t\"scripts\",\n\t\"turbo\",\n\t\"wiki\",\n]);\n\nexport async function runSync(input: RunSyncInput): Promise<SetupReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\n\tconst config = input.loaded.resolved;\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst requestedSteps = input.steps;\n\tconst steps: SetupStepResult[] = [];\n\t// `--cwd` picks which holocron.config.ts to load — for a monorepo\n\t// subpackage (e.g. packages/sentinel) that's NOT the git repo root.\n\t// Anything inherently repo-wide (.github/workflows, turbo.json,\n\t// pnpm-workspace.yaml, the root package.json's own devDependencies,\n\t// \"is this repo a monorepo\") must resolve against the real root or it\n\t// silently writes into a GitHub-invisible nested .github/ instead\n\t// (holocron#1014) — package-local writes (this package's own\n\t// package.json scripts/keywords/description, its own README) stay\n\t// keyed to `input.context.repoRoot` (= --cwd) unchanged below.\n\t// `fallback: \"start\"` means this always resolves to a string (the start dir when\n\t// there is no `.git` above it); the declared `string | undefined` is the no-fallback case.\n\tconst gitRoot = findRootSync(input.context.repoRoot, \".git\", { fallback: \"start\", realpath: true }) as string;\n\t// `findRootSync` (with `realpath`) resolves symlinks and relative segments internally; a\n\t// plain `===` against the raw, unresolved `input.context.repoRoot`\n\t// would mark a real root invocation as a subpackage whenever --cwd's\n\t// spelling differs at all from gitRoot's resolved form (e.g. `--cwd\n\t// ./` at the actual root) — resolved once here for that comparison.\n\t// Falls back to the raw value on a nonexistent path (tests routinely\n\t// use a synthetic `repoRoot` like `\"/tmp/test\"` that's never actually\n\t// created) — same soft-skip `fallback: \"start\"` keeps.\n\tlet resolvedRepoRoot: string;\n\ttry {\n\t\tresolvedRepoRoot = realpathSync(input.context.repoRoot);\n\t} catch {\n\t\tresolvedRepoRoot = input.context.repoRoot;\n\t}\n\n\tlogger.info({ config: config.name, steps: requestedSteps ?? \"all\", dryRun: dryRun || undefined }, \"sync: start\");\n\n\t// `load()` soft-skips any plugin it can't load (missing token, package\n\t// not installed). Remote steps then push a `skip` result when\n\t// `source` is absent; local steps (keywords, description, readme…)\n\t// write to disk regardless.\n\tawait loader.load();\n\tfor (const failure of loader.loadFailures()) {\n\t\tlogger.warn(\n\t\t\t{ capability: failure.key, provider: failure.provider, reason: failure.error.message },\n\t\t\t`sync: plugin ${failure.provider} unavailable`\n\t\t);\n\t}\n\n\tprint(`Holocron sync — ${config.name}${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` config: ${input.loaded.filepath}`);\n\tprint(\"\");\n\n\tif (loader.has(\"source\")) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tprint(\" → source\");\n\n\t\tfor (const stepName of SYNC_STEPS) {\n\t\t\tif (requestedSteps !== undefined && !requestedSteps.includes(stepName)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Local steps are handled below, outside this block.\n\t\t\tif (LOCAL_STEPS.has(stepName)) continue;\n\n\t\t\tif (stepName === \"labels\") {\n\t\t\t\tif (source.syncLabels) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\"source\", \"sync labels\", dryRun, () =>\n\t\t\t\t\t\t\tsource.syncLabels!(CANONICAL_LABELS, STALE_LABELS)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync labels\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncLabels\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (stepName === \"properties\") {\n\t\t\t\tif (source.syncProperties) {\n\t\t\t\t\tconst repo = config.repo;\n\t\t\t\t\tconst properties: Record<string, string | string[]> = {};\n\t\t\t\t\tconst effectivePreset = repo?.protection;\n\t\t\t\t\tif (effectivePreset && effectivePreset !== \"none\")\n\t\t\t\t\t\tproperties[\"holocron_branch_protection_level\"] = effectivePreset;\n\t\t\t\t\tconst isMonorepo = await access(join(gitRoot, \"pnpm-workspace.yaml\"))\n\t\t\t\t\t\t.then(() => true)\n\t\t\t\t\t\t.catch(() => false);\n\t\t\t\t\tproperties[\"monorepo\"] = String(isMonorepo);\n\t\t\t\t\tconst manual = repo?.properties ?? {};\n\t\t\t\t\tif (manual.lifecycle) properties[\"lifecycle\"] = manual.lifecycle;\n\t\t\t\t\tif (manual.open_source !== undefined) properties[\"open_source\"] = String(manual.open_source);\n\t\t\t\t\tif (manual.runtime_environment) properties[\"runtime_environment\"] = manual.runtime_environment;\n\t\t\t\t\tif (manual.uses_external_packages !== undefined)\n\t\t\t\t\t\tproperties[\"uses_external_packages\"] = String(manual.uses_external_packages);\n\n\t\t\t\t\t// #677 — derived fields, distinct from the manual ones above: signal\n\t\t\t\t\t// that isn't an explicit holocron.config.ts field today (framework\n\t\t\t\t\t// choice, repo archetype, capability drift).\n\t\t\t\t\t{\n\t\t\t\t\t\tconst rootPackageJson = await readFile(join(gitRoot, \"package.json\"), \"utf8\")\n\t\t\t\t\t\t\t.then((raw) => JSON.parse(raw) as Parameters<typeof deriveStack>[0])\n\t\t\t\t\t\t\t.catch(() => null);\n\t\t\t\t\t\tconst workspacePackages = readWorkspacePackages(gitRoot);\n\t\t\t\t\t\tconst workspacePackageJsons = await readWorkspacePackageJsons(gitRoot, workspacePackages);\n\t\t\t\t\t\tproperties[\"holocron_profile\"] = deriveProfile({\n\t\t\t\t\t\t\trootPackageJson,\n\t\t\t\t\t\t\trepoName: basename(gitRoot),\n\t\t\t\t\t\t\tisMonorepo,\n\t\t\t\t\t\t\tworkspacePackageJsons,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tproperties[\"holocron_stack\"] = deriveStack(rootPackageJson);\n\t\t\t\t\t\tconst capabilities = deriveCapabilities(config.providers);\n\t\t\t\t\t\tproperties[\"holocron_capabilities\"] = capabilities;\n\t\t\t\t\t\tproperties[\"holocron_compliance\"] = deriveCompliance(capabilities);\n\t\t\t\t\t}\n\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\"source\", \"sync properties\", dryRun, () => source.syncProperties!(properties))\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync properties\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncProperties\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (stepName === \"teams\") {\n\t\t\t\tconst teams = config.repo?.teams ?? [];\n\t\t\t\tif (teams.length === 0) {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync teams\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"no teams configured\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else if (source.syncTeams) {\n\t\t\t\t\tsteps.push(await runSyncStep(\"source\", \"sync teams\", dryRun, () => source.syncTeams!(teams)));\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\n\t\t\t\t\tconst repoCoord = input.context.repo ?? config.repo?.name ?? \"\";\n\t\t\t\t\tconst org = repoCoord.includes(\"/\") ? repoCoord.split(\"/\")[0]! : \"\";\n\t\t\t\t\tconst writeableTeams = teams\n\t\t\t\t\t\t.map((t) => (typeof t === \"string\" ? { slug: t, permission: \"push\" as const } : t))\n\t\t\t\t\t\t.filter((t) => [\"push\", \"maintain\", \"admin\"].includes(t.permission));\n\t\t\t\t\tif (org && writeableTeams.length > 0) {\n\t\t\t\t\t\tsteps.push(\n\t\t\t\t\t\t\tawait runSyncStep(\"source\", \"write .github/CODEOWNERS\", dryRun, async () => {\n\t\t\t\t\t\t\t\tconst content = writeableTeams.map((t) => `* @${org}/${t.slug}`).join(\"\\n\") + \"\\n\";\n\t\t\t\t\t\t\t\tawait source.writeRepoFile(\".github/CODEOWNERS\", content);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync teams\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncTeams\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (stepName === \"topics\") {\n\t\t\t\tconst topics = config.repo?.topics ?? [];\n\t\t\t\tif (topics.length === 0) {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync topics\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"no topics configured\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else if (source.syncTopics) {\n\t\t\t\t\tsteps.push(await runSyncStep(\"source\", \"sync topics\", dryRun, () => source.syncTopics!(topics)));\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync topics\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncTopics\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Report unknown step names\n\t\tif (requestedSteps) {\n\t\t\tfor (const name of requestedSteps) {\n\t\t\t\tif (!(SYNC_STEPS as ReadonlyArray<string>).includes(name)) {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: `sync ${name}`,\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: `unknown step \"${name}\"`,\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── local-only steps (no provider token required) ──────────────────\n\t// keywords, description, homepage, readme, and workflows write to local\n\t// files and optionally push to GitHub when source is loaded. They run\n\t// outside the `if (loader.has(\"source\"))` block so they work without a token.\n\n\tfor (const stepName of [\n\t\t\"keywords\",\n\t\t\"description\",\n\t\t\"homepage\",\n\t\t\"readme\",\n\t\t\"workflows\",\n\t\t\"scripts\",\n\t\t\"turbo\",\n\t\t\"wiki\",\n\t] as const) {\n\t\tif (requestedSteps !== undefined && !requestedSteps.includes(stepName)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (stepName === \"keywords\") {\n\t\t\tconst topics = config.repo?.topics ?? [];\n\t\t\tif (topics.length === 0) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync keywords\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no topics configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync keywords\", dryRun, async () => {\n\t\t\t\t\t\tconst wrote = await writePackageJsonField(input.context.repoRoot, \"keywords\", topics);\n\t\t\t\t\t\treturn wrote\n\t\t\t\t\t\t\t? `${topics.length} keywords written`\n\t\t\t\t\t\t\t: `${topics.length} topics (no package.json)`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"description\") {\n\t\t\tconst description = config.description;\n\t\t\tif (!description) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync description\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no description configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tconst source = loader.has(\"source\") ? (loader.get(\"source\") as Source) : null;\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync description\", dryRun, async () => {\n\t\t\t\t\t\tconst pkgWrote = await writePackageJsonField(\n\t\t\t\t\t\t\tinput.context.repoRoot,\n\t\t\t\t\t\t\t\"description\",\n\t\t\t\t\t\t\tdescription\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst readmeWrote = await updateReadmeDescription(input.context.repoRoot, description);\n\t\t\t\t\t\tif (source?.syncDescription) {\n\t\t\t\t\t\t\tawait source.syncDescription(description);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst parts: string[] = [];\n\t\t\t\t\t\tif (pkgWrote) parts.push(\"package.json\");\n\t\t\t\t\t\tif (readmeWrote) parts.push(\"README.md\");\n\t\t\t\t\t\tif (source?.syncDescription) parts.push(\"GitHub\");\n\t\t\t\t\t\treturn parts.length > 0 ? parts.join(\", \") + \" updated\" : \"description synced\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"homepage\") {\n\t\t\tconst homepage = config.homepage;\n\t\t\tif (!homepage) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync homepage\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no homepage configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tconst source = loader.has(\"source\") ? (loader.get(\"source\") as Source) : null;\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync homepage\", dryRun, async () => {\n\t\t\t\t\t\tconst pkgWrote = await writePackageJsonField(input.context.repoRoot, \"homepage\", homepage);\n\t\t\t\t\t\tif (source?.syncHomepage) {\n\t\t\t\t\t\t\tawait source.syncHomepage(homepage);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst parts: string[] = [];\n\t\t\t\t\t\tif (pkgWrote) parts.push(\"package.json\");\n\t\t\t\t\t\tif (source?.syncHomepage) parts.push(\"GitHub\");\n\t\t\t\t\t\treturn parts.length > 0 ? parts.join(\", \") + \" updated\" : \"homepage synced\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"readme\") {\n\t\t\tconst report = await runSyncReadme({ loaded: input.loaded, context: input.context, print: () => {} });\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"local\",\n\t\t\t\tstep: \"sync readme\",\n\t\t\t\tstatus: report.status === \"ok\" ? \"ok\" : report.status === \"dry-run\" ? \"dry-run\" : \"skip\",\n\t\t\t\t...(report.message ? { message: report.message } : {}),\n\t\t\t});\n\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (stepName === \"workflows\") {\n\t\t\tconst taskEntries = config.tasks ?? [];\n\t\t\tif (taskEntries.length === 0) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync workflows\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no tasks configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\t// astromech renders every thin caller from the manifest (lint linter\n\t\t\t\t// set, deploy paths, deploy+preview). Iterate the manifest (not the\n\t\t\t\t// map) so step reporting keeps the config's order.\n\t\t\t\tconst files = createAstromech({\n\t\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\t\tconfig: { tasks: config.tasks as TasksConfig[\"tasks\"] },\n\t\t\t\t\torgContext: { org: config.org, domain: config.domain },\n\t\t\t\t\tlogger,\n\t\t\t\t}).thinCallers();\n\n\t\t\t\tfor (const entry of taskEntries) {\n\t\t\t\t\tconst name = typeof entry === \"string\" ? entry : entry.name;\n\t\t\t\t\t// knowledge.docs / knowledge.components have no static\n\t\t\t\t\t// WORKFLOW_TEMPLATES entry (their content is always\n\t\t\t\t\t// combined-generated, astromech.ts) — not in KNOWN_WORKFLOWS,\n\t\t\t\t\t// but not \"unknown\" either.\n\t\t\t\t\tconst isCombinedContentOnly = name === \"knowledge.docs\" || name === \"knowledge.components\";\n\n\t\t\t\t\tif (!KNOWN_WORKFLOWS.has(name) && !isCombinedContentOnly) {\n\t\t\t\t\t\tsteps.push({\n\t\t\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\t\t\tstep: `sync workflow ${name}`,\n\t\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\t\tmessage: `unknown workflow \"${name}\" — no template available`,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// The combined-content family (delivery.deploy, knowledge.docs,\n\t\t\t\t\t// knowledge.components) all key their generated file by task\n\t\t\t\t\t// name already — no special-casing needed.\n\t\t\t\t\t// Keyed by task name alone, regardless of which package's\n\t\t\t\t\t// --cwd generated it — two different subpackages opting\n\t\t\t\t\t// into the same generic task name would overwrite each\n\t\t\t\t\t// other's file here, and package-relative paths baked\n\t\t\t\t\t// into a template wouldn't get rebased for a non-root\n\t\t\t\t\t// --cwd. Tracked as #1026; not yet a real collision since\n\t\t\t\t\t// Sentinel's two --cwd-scoped tasks are both task-name-\n\t\t\t\t\t// unique and carry no repo-root-relative content.\n\t\t\t\t\tconst filename = `${name}.yml`;\n\t\t\t\t\tconst content = files.get(filename);\n\t\t\t\t\tif (content === undefined) continue; // ci: false — nothing to write\n\n\t\t\t\t\tconst withPreview = content.includes(\"workflows/preview.yml@main\");\n\t\t\t\t\tconst step = `sync workflow ${name}${withPreview ? \" (with preview)\" : \"\"}`;\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\"local\", step, dryRun, async () => {\n\t\t\t\t\t\t\tawait writeWorkflowFile(gitRoot, filename, `${workflowHeader()}${content}`);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"scripts\") {\n\t\t\tif (config.syncScripts === false) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync scripts\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"syncScripts: false\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tconst tasksConfig: TasksConfig = { tasks: config.tasks as TasksConfig[\"tasks\"] };\n\t\t\t\tif (config.holocronScript !== undefined) tasksConfig.holocronScript = config.holocronScript;\n\t\t\t\tconst astromechScripts = createAstromech({\n\t\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\t\tconfig: tasksConfig,\n\t\t\t\t\tlogger,\n\t\t\t\t});\n\t\t\t\tconst desired = astromechScripts.packageScripts();\n\t\t\t\t// #747: which of `desired`'s keys turbo.json would fan out — the\n\t\t\t\t// only ones an existing direct-tool root script is ever protected\n\t\t\t\t// for. See mergePackageJsonScripts()'s own docstring.\n\t\t\t\tconst turboContent = astromechScripts.turboConfig();\n\t\t\t\tconst turboEligible = new Set<string>(\n\t\t\t\t\tturboContent\n\t\t\t\t\t\t? Object.keys((JSON.parse(turboContent) as { tasks: Record<string, unknown> }).tasks)\n\t\t\t\t\t\t: []\n\t\t\t\t);\n\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync scripts\", dryRun, async () => {\n\t\t\t\t\t\tconst changed = await mergePackageJsonScripts(input.context.repoRoot, desired, turboEligible);\n\t\t\t\t\t\tif (changed === null) return \"no package.json\";\n\t\t\t\t\t\tif (changed.length === 0) return `${Object.keys(desired).length} scripts already current`;\n\t\t\t\t\t\treturn `${changed.join(\", \")} set`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"turbo\") {\n\t\t\t// turbo.json, pnpm-workspace.yaml, and the root package.json's own\n\t\t\t// devDependencies are each a single, whole-workspace file — one\n\t\t\t// subpackage's holocron.config.ts can't correctly own writing\n\t\t\t// them (which other subpackage's tasks would it be allowed to\n\t\t\t// clobber?). A monorepo subpackage sync (holocron#1014's exact\n\t\t\t// shape — --cwd resolves to a package, not the git root) skips\n\t\t\t// this entire step rather than guessing at a merge semantic; the\n\t\t\t// repo's own root-level sync run (where --cwd IS gitRoot) is the\n\t\t\t// one place these get written.\n\t\t\tif (resolvedRepoRoot !== gitRoot) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync turbo.json\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"--cwd is a monorepo subpackage, not the git root — run from the root to sync turbo.json\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst astromechTurbo = createAstromech({\n\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\tconfig: { tasks: config.tasks as TasksConfig[\"tasks\"] },\n\t\t\t\tlogger,\n\t\t\t});\n\t\t\tconst content = astromechTurbo.turboConfig();\n\n\t\t\tif (content === null) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync turbo.json\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no fan-out-eligible tasks configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync turbo.json\", dryRun, async () => {\n\t\t\t\t\t\tawait writeFile(join(gitRoot, \"turbo.json\"), content, \"utf8\");\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\n\t\t\t\t// #692: fix pnpm-workspace.yaml in the same step that introduces\n\t\t\t\t// the risk — see run-setup.ts's identical wiring for the full\n\t\t\t\t// explanation.\n\t\t\t\tconst rootPkgRaw = await readFile(join(gitRoot, \"package.json\"), \"utf8\").catch(() => null);\n\t\t\t\tconst rootPkg = rootPkgRaw ? (JSON.parse(rootPkgRaw) as { scripts?: Record<string, string> }) : null;\n\t\t\t\tconst workspaceYaml = await readFile(join(gitRoot, \"pnpm-workspace.yaml\"), \"utf8\").catch(() => \"\");\n\t\t\t\tconst rootScripts = rootPkg?.scripts ?? {};\n\t\t\t\tconst workspaceFix = astromechTurbo.ensureRootWorkspaceMember(workspaceYaml, rootScripts);\n\t\t\t\tif (workspaceFix.changed) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\n\t\t\t\t\t\t\t\"local\",\n\t\t\t\t\t\t\t\"fix pnpm-workspace.yaml (root workspace member, #692)\",\n\t\t\t\t\t\t\tdryRun,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tawait writeFile(join(gitRoot, \"pnpm-workspace.yaml\"), workspaceFix.content, \"utf8\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\n\t\t\t\t// turbo.json alone is inert without turbo itself installed —\n\t\t\t\t// see ensureTurboDependency()'s own docstring for how this was\n\t\t\t\t// found (a global-version fallback that silently broke on an\n\t\t\t\t// unrelated turbo install).\n\t\t\t\tif (rootPkgRaw) {\n\t\t\t\t\tconst depFix = astromechTurbo.ensureTurboDependency(rootPkgRaw, workspaceFix.content);\n\t\t\t\t\tif (depFix.changed) {\n\t\t\t\t\t\tsteps.push(\n\t\t\t\t\t\t\tawait runSyncStep(\"local\", \"add turbo devDependency\", dryRun, async () => {\n\t\t\t\t\t\t\t\tawait writeFile(join(gitRoot, \"package.json\"), depFix.content, \"utf8\");\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"wiki\") {\n\t\t\t// fern/docs.yml is repo-wide, same category as turbo.json —\n\t\t\t// runSyncWiki resolves it via context.repoRoot, so a monorepo\n\t\t\t// subpackage sync needs gitRoot there instead, or it looks for\n\t\t\t// (and fails to find) packages/<pkg>/fern/docs.yml.\n\t\t\tconst result = await runSyncWiki({\n\t\t\t\tloaded: input.loaded,\n\t\t\t\tcontext: { ...input.context, repoRoot: gitRoot },\n\t\t\t});\n\t\t\tsteps.push(result);\n\t\t\tprint(formatSyncStep(result));\n\t\t}\n\t}\n\n\tfor (const s of steps) {\n\t\tlogger[s.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{ capability: s.capability, step: s.step, status: s.status, ...(s.message ? { detail: s.message } : {}) },\n\t\t\t`sync: ${s.step}`\n\t\t);\n\t}\n\n\tconst summary = steps.reduce(\n\t\t(acc, s) => {\n\t\t\tif (s.status === \"ok\") acc.ok += 1;\n\t\t\telse if (s.status === \"fail\") acc.fail += 1;\n\t\t\telse if (s.status === \"skip\") acc.skip += 1;\n\t\t\telse if (s.status === \"dry-run\") acc.dryRun += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0, dryRun: 0 }\n\t);\n\n\tlogger[summary.fail > 0 ? \"warn\" : \"info\"]({ ...summary }, \"sync: done\");\n\n\tprint(\"\");\n\tprint(\n\t\t` ${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${\n\t\t\tdryRun ? `, ${summary.dryRun} would-do` : \"\"\n\t\t}`\n\t);\n\n\treturn { steps, summary };\n}\n\nasync function runSyncStep(\n\tcapability: string,\n\tstep: string,\n\tdryRun: boolean,\n\tbody: () => Promise<string | void>\n): Promise<SetupStepResult> {\n\tif (dryRun) {\n\t\treturn { capability, step, status: \"dry-run\" };\n\t}\n\ttry {\n\t\tconst note = await body();\n\t\tconst result: SetupStepResult = { capability, step, status: \"ok\" };\n\t\tif (typeof note === \"string\") result.message = note;\n\t\treturn result;\n\t} catch (err) {\n\t\treturn {\n\t\t\tcapability,\n\t\t\tstep,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n\nfunction formatSyncStep(step: SetupStepResult): string {\n\tconst icon = step.status === \"ok\" ? \"✓\" : step.status === \"fail\" ? \"✗\" : step.status === \"dry-run\" ? \"…\" : \"·\";\n\tconst detail = step.message ? ` (${step.message})` : \"\";\n\treturn ` ${icon} ${step.step}${detail}`;\n}\n\nasync function writePackageJsonField(repoRoot: string, field: string, value: unknown): Promise<boolean> {\n\tconst pkgPath = join(repoRoot, \"package.json\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(pkgPath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\tconst pkg = JSON.parse(content) as Record<string, unknown>;\n\tpkg[field] = value;\n\tawait writeFile(pkgPath, stringifyJson(pkg, { like: content }), \"utf8\");\n\treturn true;\n}\n\n/**\n * Merge `desired` script entries into `package.json#scripts` — sets only the\n * listed keys, never touches the rest. Returns the sorted list of keys that\n * drifted (empty when all current), or `null` when there is no `package.json`.\n *\n * `turboEligible` (#747): task names `turbo.json` fans out — the same set\n * {@link EnsureRootWorkspaceMemberResult} above already keys off. For those\n * only, an *existing* script that isn't the generated `holocron run <task>\n * --` wrapper is left untouched: root may genuinely be a directly-buildable\n * package (not an orchestrator) with its own real command (`tsc --noEmit`,\n * `vitest run`, …) for that task. Overwriting it would silently discard the\n * real command and, once `turbo.json` exists and root is a real workspace\n * member (#692), reintroduce infinite recursion — `turbo run <task>` →\n * root's own `<task>` script → the wrapper → `holocron run <task>` sees\n * `turbo.json` still defines the task → `turbo run <task>` again, forever.\n * Every other key (non-turbo tasks, `holocron`, `prepare`, …) has no\n * legitimate direct-command alternative and stays fully generator-owned.\n */\nasync function mergePackageJsonScripts(\n\trepoRoot: string,\n\tdesired: Record<string, string>,\n\tturboEligible: ReadonlySet<string>\n): Promise<string[] | null> {\n\tconst pkgPath = join(repoRoot, \"package.json\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(pkgPath, \"utf8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tconst pkg = JSON.parse(content) as Record<string, unknown>;\n\tconst scripts = (pkg.scripts ?? {}) as Record<string, string>;\n\tconst changed: string[] = [];\n\tfor (const [name, command] of Object.entries(desired)) {\n\t\tconst existing = scripts[name];\n\t\tif (turboEligible.has(name) && existing !== undefined && !isGeneratedRunWrapper(existing, name)) continue;\n\t\tif (existing !== command) {\n\t\t\tscripts[name] = command;\n\t\t\tchanged.push(name);\n\t\t}\n\t}\n\tif (changed.length === 0) return [];\n\tpkg.scripts = scripts;\n\tawait writeFile(pkgPath, stringifyJson(pkg, { like: content }), \"utf8\");\n\treturn changed.sort();\n}\n\n/**\n * Matches the exact shape `packageScripts()` generates for `taskName` —\n * `<bin> run <taskName> --`, `<bin>` normally `holocron` but substitutable\n * (`holocronScript`, itself allowed to be multi-word, e.g. `\"node\npackages/cli/dist/cli.mjs\"` — see its own test). Checking the *suffix*\n * rather than the whole string means an old wrapper survives a\n * `holocronScript` rename intact — it's still recognized as a wrapper (safe\n * to update to the new one), not mistaken for a real command.\n */\nfunction isGeneratedRunWrapper(command: string, taskName: string): boolean {\n\treturn command.endsWith(` run ${taskName} --`);\n}\n\nconst README_DESC_START = \"<!-- holocron:description -->\";\nconst README_DESC_END = \"<!-- /holocron:description -->\";\n\nasync function updateReadmeDescription(repoRoot: string, description: string): Promise<boolean> {\n\tconst readmePath = join(repoRoot, \"README.md\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(readmePath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\tconst lines = content.split(\"\\n\");\n\n\tconst startIdx = lines.findIndex((l) => l.trim() === README_DESC_START);\n\tconst endIdx = lines.findIndex((l) => l.trim() === README_DESC_END);\n\tif (startIdx !== -1) {\n\t\tif (endIdx === -1 || endIdx <= startIdx) return false;\n\t\tlines.splice(startIdx + 1, endIdx - startIdx - 1, description);\n\t\tawait writeFile(readmePath, lines.join(\"\\n\"), \"utf8\");\n\t\treturn true;\n\t}\n\n\tconst h1Index = lines.findIndex((l) => /^# /.test(l));\n\tif (h1Index === -1) return false;\n\n\tlines.splice(h1Index + 1, 0, \"\", README_DESC_START, description, README_DESC_END);\n\tawait writeFile(readmePath, lines.join(\"\\n\"), \"utf8\");\n\treturn true;\n}\n\n/**\n * Writes via a temp file + rename in the same directory, not a direct\n * `writeFile` — a monorepo subpackage sync can target the same root-level\n * file a root sync (or another subpackage's sync) also writes, and a\n * process killed mid-write would otherwise leave the live GitHub Actions\n * workflow truncated until some later sync happens to restore it. A same-\n * directory rename is atomic on POSIX filesystems, so readers only ever\n * see the old complete content or the new complete content, never a\n * partial write.\n */\nasync function writeWorkflowFile(repoRoot: string, filename: string, content: string): Promise<void> {\n\tconst dir = join(repoRoot, \".github\", \"workflows\");\n\tawait mkdir(dir, { recursive: true });\n\tconst tmpPath = join(dir, `.${filename}.${randomUUID()}.tmp`);\n\tawait writeFile(tmpPath, content, \"utf8\");\n\tawait rename(tmpPath, join(dir, filename));\n}\n","/**\n * Holocron-specific credential resolution for the telemetry sinks — the env\n * chain plus Holocron's own shipped fallbacks. This is **CLI policy**, not part\n * of the portable adapter set: `sentry-sink.ts` / `posthog-sink.ts` take a\n * resolved DSN / key and never read the environment. When the adapters move to\n * `@theholocron/observability` (#635) this module stays here.\n *\n * errors: HOLOCRON_SENTRY_DSN → SENTRY_DSN → FALLBACK_DSN\n * analytics: HOLOCRON_POSTHOG_PROJECT_TOKEN → POSTHOG_PROJECT_TOKEN → FALLBACK_POSTHOG_PROJECT_TOKEN\n * host: HOLOCRON_POSTHOG_HOST → POSTHOG_HOST → DEFAULT_POSTHOG_HOST\n *\n * The `SENTRY_DSN` / `POSTHOG_PROJECT_TOKEN` fallbacks are the vendor-native\n * names a consumer repo sets to route CLI telemetry to its own project. The\n * built-in fallbacks are ingest-only keys — publishable by design, same risk\n * model as ADR-0007 / ADR-0008.\n */\n\nimport { holocronEnv } from \"../../env/index.js\";\n\n/** Holocron's own Sentry project — the fallback when no env var points elsewhere. */\nconst FALLBACK_DSN = \"https://95cbb72ad5636c94e119a5405ee8f55f@o4508238154104832.ingest.us.sentry.io/4511810950791168\";\n\n/** Holocron's own PostHog project write key — ingest-only. */\nconst FALLBACK_POSTHOG_PROJECT_TOKEN = \"phc_AC4vFCvYzwnzmG7Vg5nEc3PZKZztoPyfKp4Lb9BbXcLK\"; // gitleaks:allow\n\nconst DEFAULT_POSTHOG_HOST = \"https://us.i.posthog.com\";\n\n/** Resolve the Sentry DSN. `\"\"` → error telemetry disabled. */\nexport function resolveDsn(): string {\n\treturn holocronEnv.get(\"SENTRY_DSN\") ?? FALLBACK_DSN;\n}\n\n/** Resolve the PostHog project key. `\"\"` → usage analytics disabled. */\nexport function resolvePostHogKey(): string {\n\treturn holocronEnv.get(\"POSTHOG_PROJECT_TOKEN\") ?? FALLBACK_POSTHOG_PROJECT_TOKEN;\n}\n\n/** Resolve the PostHog ingest host. */\nexport function resolvePostHogHost(): string {\n\treturn holocronEnv.get(\"POSTHOG_HOST\") ?? DEFAULT_POSTHOG_HOST;\n}\n","/**\n * CLI self-telemetry orchestration — errors (Sentry), usage analytics (PostHog).\n *\n * This module holds *no* vendor SDK import. Each concern sits behind an\n * interface from `@theholocron/observability` ({@link ErrorSink} /\n * {@link AnalyticsSink}); the `SentrySink` / `PostHogSink` adapters there are\n * the only `@sentry/node` / `posthog-node` call sites, and a `Noop*Sink` is\n * installed when telemetry is off. Same seam the package's `Logger` uses for\n * Pino.\n *\n * Activation is env-var + shipped-fallback, resolved here (`resolve-telemetry.ts`)\n * and passed to the sink — the adapters read no environment. The single kill\n * switch is `HOLOCRON_TELEMETRY=false` (legacy alias `NO_HOLOCRON_TELEMETRY`);\n * see ADR-0007 / ADR-0008.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { hostname, userInfo } from \"node:os\";\n\nimport { PostHogSink } from \"@theholocron/observability/analytics\";\nimport {\n\ttype AnalyticsSink,\n\ttype CommandSpan,\n\ttype ErrorSink,\n\tNoopAnalyticsSink,\n\tNoopErrorSink,\n\tredactObject,\n} from \"@theholocron/observability/core\";\nimport { SentrySink } from \"@theholocron/observability/errors\";\n\nimport type { TelemetryConfig } from \"../../config/index.js\";\nimport { env } from \"../../env/index.js\";\nimport { getRunId } from \"../logger/index.js\";\nimport { resolveDsn, resolvePostHogHost, resolvePostHogKey } from \"../resolve-telemetry/index.js\";\n\n// ── sinks ────────────────────────────────────────────────────────────────────\n\nlet errors: ErrorSink = new NoopErrorSink();\nlet analytics: AnalyticsSink = new NoopAnalyticsSink();\n\n// ── gate ─────────────────────────────────────────────────────────────────────\n\n/**\n * The shared opt-out. `HOLOCRON_TELEMETRY=false` (going-forward) or\n * `NO_HOLOCRON_TELEMETRY` (any truthy value, back-compat) disables all sinks.\n */\nfunction isEnabled(): boolean {\n\treturn env.get(\"HOLOCRON_TELEMETRY\") !== \"false\" && !env.get(\"NO_HOLOCRON_TELEMETRY\");\n}\n\n// ── identity ─────────────────────────────────────────────────────────────────\n\nlet commandStartedAt = 0;\nlet currentCommand = \"unknown\";\nlet lastErrorType: string | undefined;\nlet currentSpan: CommandSpan | undefined;\n\n/**\n * Anonymous, stable per-machine id — `sha256(hostname + username)` truncated\n * (ADR-0008). One-way: no raw hostname or username is ever transmitted.\n */\nfunction machineId(): string {\n\ttry {\n\t\treturn createHash(\"sha256\").update(`${hostname()} ${userInfo().username}`).digest(\"hex\").slice(0, 32);\n\t} catch {\n\t\treturn \"unknown\";\n\t}\n}\n\n/** Properties every analytics event carries — pivot key to the Axiom trace. */\nfunction baseProps(): Record<string, unknown> {\n\tconst runId = getRunId();\n\treturn {\n\t\tcommand: currentCommand,\n\t\tci: Boolean(env.get(\"CI\")),\n\t\t...(runId ? { runId } : {}),\n\t};\n}\n\n// ── lifecycle ────────────────────────────────────────────────────────────────\n\nexport function init(version: string): void {\n\tconst dsn = resolveDsn();\n\tif (isEnabled() && dsn !== \"\") {\n\t\terrors = new SentrySink();\n\t\terrors.init({\n\t\t\tdsn,\n\t\t\trelease: `holocron@${version}`,\n\t\t\tenvironment: env.get(\"CI\") ? \"ci\" : \"local\",\n\t\t\ttags: { os: process.platform, node: process.version, ci: String(Boolean(env.get(\"CI\"))) },\n\t\t});\n\t}\n\tconst posthogKey = resolvePostHogKey();\n\tif (isEnabled() && posthogKey !== \"\") {\n\t\tanalytics = new PostHogSink({ key: posthogKey, host: resolvePostHogHost() });\n\t\tanalytics.identify(machineId(), {\n\t\t\tci: Boolean(env.get(\"CI\")),\n\t\t\tos: process.platform,\n\t\t\tnode: process.version,\n\t\t\tcli: version,\n\t\t\t...(env.get(\"HOLOCRON_ORG\") ? { org: env.get(\"HOLOCRON_ORG\") } : {}),\n\t\t});\n\t}\n}\n\n/**\n * Apply the `telemetry` config block — the committed override layer, run once\n * per command *after* config loads (so it lands after {@link init}). Env still\n * wins: this only ever *narrows* what `init` turned on, never re-enables.\n *\n * - `enabled: false` → swap both sinks to no-ops for the rest of the run.\n * - `analytics: \"none\"` → drop usage analytics only; error reporting stays.\n *\n * A live sink is drained best-effort before it is dropped so an in-flight\n * Sentry session / PostHog queue still leaves the process cleanly.\n */\nexport function applyConfig(cfg: TelemetryConfig | undefined): void {\n\tif (!cfg) return;\n\n\t// Best-effort drain — never let a rejected close() surface as an unhandled\n\t// rejection from this sync path.\n\tconst drain = (p: Promise<unknown>): void => {\n\t\tp.catch(() => {});\n\t};\n\n\tif (cfg.enabled === false) {\n\t\tdrain(errors.flush());\n\t\tdrain(analytics.shutdown());\n\t\terrors = new NoopErrorSink();\n\t\tanalytics = new NoopAnalyticsSink();\n\t\treturn;\n\t}\n\n\tif (cfg.analytics === \"none\") {\n\t\tdrain(analytics.shutdown());\n\t\tanalytics = new NoopAnalyticsSink();\n\t}\n}\n\n/** Capture a PostHog event. Every `properties` object runs through the scrubber. */\nexport function event(name: string, properties: Record<string, unknown> = {}): void {\n\tanalytics.capture(machineId(), name, redactObject({ ...baseProps(), ...properties }));\n}\n\nexport function startCommand(name: string): (ok: boolean) => void {\n\tcurrentCommand = name;\n\tcommandStartedAt = Date.now();\n\tlastErrorType = undefined;\n\tcurrentSpan = errors.startSpan(name);\n\n\tevent(\"command_started\", { dry_run: process.argv.includes(\"--dry-run\") });\n\n\treturn (ok: boolean) => {\n\t\tcurrentSpan?.setStatus(ok);\n\t\tcurrentSpan?.end();\n\t\tevent(ok ? \"command_completed\" : \"command_failed\", {\n\t\t\tstatus: ok ? \"ok\" : \"fail\",\n\t\t\tduration_ms: Date.now() - commandStartedAt,\n\t\t\t...(ok || !lastErrorType ? {} : { error_type: lastErrorType }),\n\t\t});\n\t};\n}\n\nexport function captureException(err: unknown): void {\n\tlastErrorType = err instanceof Error ? err.constructor.name : \"Error\";\n\terrors.captureException(err);\n}\n\nexport function endSession(): void {\n\terrors.endSession();\n}\n\nexport async function flush(): Promise<void> {\n\tawait errors.flush();\n\tawait analytics.shutdown();\n\terrors = new NoopErrorSink();\n\tanalytics = new NoopAnalyticsSink();\n}\n\n// ── test hook ────────────────────────────────────────────────────────────────\n\n/** Drop the sinks + command state back to their no-op defaults. */\nexport function resetTelemetry(): void {\n\terrors = new NoopErrorSink();\n\tanalytics = new NoopAnalyticsSink();\n\tcommandStartedAt = 0;\n\tcurrentCommand = \"unknown\";\n\tlastErrorType = undefined;\n\tcurrentSpan = undefined;\n}\n","import { createHash } from \"node:crypto\";\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nimport { reusableTemplates } from \"@theholocron/astromech\";\nimport { createGitHubClient } from \"@theholocron/github-client\";\nimport { ProviderApiError } from \"@theholocron/http-client\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { event as telemetryEvent } from \"../../observability/telemetry/index.js\";\nimport type { FileBatch, RunSyncGithubInput, SyncGithubReport } from \"./sync-github.type.js\";\n\nconst DEFAULT_REPO = \"theholocron/.github\";\n\n/**\n * The file set `sync-github` pushes to `theholocron/.github` — the reusable\n * `workflow_call` implementations, composite actions and starter-workflow\n * metadata, generated by `@theholocron/astromech`. Secondary repos get nothing:\n * their thin callers are managed by `holocron repo sync --steps workflows`, which\n * executes the resolved config (regex parsing here can't resolve preset spreads\n * like `...tasks` from `nodeDocs()` — see issue #464).\n */\nfunction buildBatch(repo: string): FileBatch {\n\tif (repo !== DEFAULT_REPO) return [];\n\treturn [...reusableTemplates()].map(([path, content]) => ({ path, content }));\n}\n\n/** Git blob SHA: sha1(\"blob {len}\\0{content}\") — used to detect unchanged files. */\nexport function gitBlobSha(content: string): string {\n\tconst buf = Buffer.from(content, \"utf8\");\n\treturn createHash(\"sha1\").update(`blob ${buf.length}\\0`).update(buf).digest(\"hex\");\n}\n\nexport async function runSyncGithub(input: RunSyncGithubInput): Promise<SyncGithubReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst repo = input.repo ?? DEFAULT_REPO;\n\tconst { token, dryRun = false, branch, createPr = false } = input;\n\tconst message = input.message ?? `chore: sync from theholocron/holocron`;\n\n\tconst client = createGitHubClient({ token, fetch: input.fetch });\n\n\tprint(`holocron sync github${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` repo: ${repo}`);\n\tif (branch) print(` branch: ${branch}`);\n\tprint(\"\");\n\n\tlogger.info({ repo, branch, createPr: createPr || undefined, dryRun: dryRun || undefined }, \"sync-github: start\");\n\n\t/** Single exit point — one structured line per invocation, whatever the path. */\n\tconst done = (r: SyncGithubReport): SyncGithubReport => {\n\t\tlogger[r.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{\n\t\t\t\trepo,\n\t\t\t\tstatus: r.status,\n\t\t\t\tcreated: r.created,\n\t\t\t\tupdated: r.updated,\n\t\t\t\tunchanged: r.unchanged,\n\t\t\t\t...(r.message ? { reason: r.message } : {}),\n\t\t\t\t...(r.prUrl ? { pr: r.prUrl } : {}),\n\t\t\t},\n\t\t\t\"sync-github: done\"\n\t\t);\n\t\ttelemetryEvent(\"sync_github_run\", {\n\t\t\trepo,\n\t\t\tstatus: r.status,\n\t\t\t...(branch ? { branch } : {}),\n\t\t\trepos_targeted: 1,\n\t\t\tfiles_changed: r.created + r.updated,\n\t\t\tpr_opened: Boolean(r.prUrl),\n\t\t});\n\t\treturn r;\n\t};\n\n\t// ── output-dir: write all files to disk without any API calls ───────────\n\tif (input.outputDir) {\n\t\tconst batch = buildBatch(repo);\n\t\tfor (const file of batch) {\n\t\t\tconst dest = join(input.outputDir, file.path);\n\t\t\tmkdirSync(dirname(dest), { recursive: true });\n\t\t\twriteFileSync(dest, file.content, \"utf8\");\n\t\t}\n\t\tprint(` ${batch.length} files written to ${input.outputDir}`);\n\t\treturn done({ status: \"ok\", created: batch.length, updated: 0, unchanged: 0 });\n\t}\n\n\t// ── 1. Resolve target branch ─────────────────────────────────────────────\n\tlet targetBranch = branch;\n\tlet defaultBranch: string | undefined;\n\tif (!targetBranch || createPr) {\n\t\ttry {\n\t\t\tconst repoData = await client.repos.getRepo(repo);\n\t\t\tdefaultBranch = repoData.default_branch;\n\t\t\tif (!targetBranch) targetBranch = defaultBranch;\n\t\t} catch {\n\t\t\tconst msg = \"failed to fetch repo metadata\";\n\t\t\tprint(` ✗ ${msg}`);\n\t\t\treturn done({ status: \"fail\", created: 0, updated: 0, unchanged: 0, message: msg });\n\t\t}\n\t}\n\n\t// ── 2. Get HEAD commit → base tree ───────────────────────────────────────\n\tconst baseBranch = createPr && defaultBranch ? defaultBranch : targetBranch!;\n\tlet headSha: string;\n\tlet baseTreeSha: string;\n\tlet existingBlobs: Map<string, string>;\n\ttry {\n\t\tconst ref = await client.git.getRef(repo, baseBranch);\n\t\theadSha = ref.object.sha;\n\t\tconst commit = await client.git.getCommit(repo, headSha);\n\t\tbaseTreeSha = commit.tree.sha;\n\t\tconst treeData = await client.git.getTree(repo, baseTreeSha, true);\n\t\texistingBlobs = new Map(treeData.tree.filter((i) => i.type === \"blob\").map((i) => [i.path, i.sha]));\n\t} catch (err) {\n\t\tconst msg = err instanceof Error ? err.message : `Branch ${baseBranch} not found`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created: 0, updated: 0, unchanged: 0, message: msg });\n\t}\n\n\t// ── 3. Build file batch ─────────────────────────────────────────────────\n\t// Secondary-repo thin callers are managed by `holocron repo sync --steps workflows`.\n\tconst batch = buildBatch(repo);\n\n\t// ── 5. Detect changes ────────────────────────────────────────────────────\n\tlet created = 0;\n\tlet updated = 0;\n\tlet unchanged = 0;\n\tconst changedFiles: Array<{ path: string; content: string }> = [];\n\n\tfor (const file of batch) {\n\t\tconst localSha = gitBlobSha(file.content);\n\t\tconst existingSha = existingBlobs.get(file.path);\n\n\t\tif (existingSha === localSha) {\n\t\t\tprint(` · unchanged ${file.path}`);\n\t\t\tunchanged++;\n\t\t} else if (existingSha) {\n\t\t\tprint(` ${dryRun ? \"~\" : \"✓\"} updated ${file.path}`);\n\t\t\tlogger.debug({ file: file.path, change: \"updated\" }, \"sync-github: file\");\n\t\t\tupdated++;\n\t\t\tif (!dryRun) changedFiles.push(file);\n\t\t} else {\n\t\t\tprint(` ${dryRun ? \"~\" : \"✓\"} created ${file.path}`);\n\t\t\tlogger.debug({ file: file.path, change: \"created\" }, \"sync-github: file\");\n\t\t\tcreated++;\n\t\t\tif (!dryRun) changedFiles.push(file);\n\t\t}\n\t}\n\n\tprint(\"\");\n\tprint(` ${created} created, ${updated} updated, ${unchanged} unchanged`);\n\n\tif (dryRun || changedFiles.length === 0) {\n\t\treturn done({ status: dryRun ? \"dry-run\" : \"ok\", created, updated, unchanged });\n\t}\n\n\t// ── 6. Create blobs for changed files ────────────────────────────────────\n\tconst treeEntries: Array<{ path: string; mode: string; type: string; sha: string }> = [];\n\tfor (const file of changedFiles) {\n\t\ttry {\n\t\t\tconst blob = await client.git.createBlob(repo, file.content);\n\t\t\ttreeEntries.push({ path: file.path, mode: \"100644\", type: \"blob\", sha: blob.sha });\n\t\t} catch (err) {\n\t\t\tconst msg = `failed to create blob for ${file.path}: ${errorMessage(err)}`;\n\t\t\tprint(` ✗ ${msg}`);\n\t\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t\t}\n\t}\n\n\t// ── 7. Create tree ───────────────────────────────────────────────────────\n\tlet newTreeSha: string;\n\ttry {\n\t\tconst newTree = await client.git.createTree(repo, treeEntries, baseTreeSha);\n\t\tnewTreeSha = newTree.sha;\n\t} catch (err) {\n\t\tconst msg = `failed to create tree: ${errorMessage(err)}`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t}\n\n\t// ── 8. Create commit ─────────────────────────────────────────────────────\n\tlet newCommitSha: string;\n\ttry {\n\t\tconst newCommit = await client.git.createCommit(repo, message, newTreeSha, [headSha]);\n\t\tnewCommitSha = newCommit.sha;\n\t} catch (err) {\n\t\tconst msg = `failed to create commit: ${errorMessage(err)}`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t}\n\n\t// ── 9. Update (or create) branch ref ────────────────────────────────────\n\ttry {\n\t\tif (createPr && branch) {\n\t\t\ttry {\n\t\t\t\tawait client.git.createRef(repo, `refs/heads/${branch}`, newCommitSha);\n\t\t\t} catch (err) {\n\t\t\t\tif (!(err instanceof ProviderApiError) || err.status !== 422) throw err;\n\t\t\t\t// Branch already exists from a previous partial run — force-update it.\n\t\t\t\tawait client.git.updateRef(repo, `heads/${branch}`, newCommitSha, true);\n\t\t\t}\n\t\t} else {\n\t\t\tawait client.git.updateRef(repo, `heads/${targetBranch!}`, newCommitSha);\n\t\t}\n\t} catch (err) {\n\t\tconst msg = `failed to update ref: ${errorMessage(err)}`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t}\n\n\t// ── 10. Open PR if requested ─────────────────────────────────────────────\n\tlet prUrl: string | undefined;\n\tif (branch && createPr && !dryRun) {\n\t\ttry {\n\t\t\tconst pr = await client.git.createPull(repo, {\n\t\t\t\ttitle: message.split(\"\\n\")[0]!,\n\t\t\t\thead: branch,\n\t\t\t\tbase: \"main\",\n\t\t\t\tbody: \"Auto-generated by `holocron sync github`. Review and merge to apply template updates.\",\n\t\t\t});\n\t\t\tprUrl = pr.html_url;\n\t\t\tprint(` → PR opened: ${prUrl}`);\n\t\t} catch (err) {\n\t\t\tconst alreadyExists =\n\t\t\t\terr instanceof ProviderApiError && err.status === 422 && String(err.details).includes(\"already exists\");\n\t\t\tif (alreadyExists) {\n\t\t\t\tprint(` → PR already open for ${branch} — branch updated, ready to merge`);\n\t\t\t} else {\n\t\t\t\tprint(` ⚠ PR creation failed: ${errorMessage(err)}`);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn done({ status: \"ok\", created, updated, unchanged, prUrl });\n}\n","/**\n * `holocron repo upgrade deps` — bring a repo's `@theholocron/*` dependency pins and\n * its `holocron.config.ts` up to the current major.\n *\n * Two concerns:\n *\n * 1. **Catalog pins.** Every `@theholocron/*` entry in `pnpm-workspace.yaml`\n * (`catalog:` and every named `catalogs.*`) is bumped to the latest published\n * version, preserving the range prefix (`^` / `~`). Never downgrades.\n * 2. **`holocron.config.ts` migration.** `@theholocron/holocron-config@8`\n * dropped the 7.x preset shape (`const { repo, workflows, providers } =\n * node()` + `repo.requiredChecks` + `workflows:`) for a composed-preset\n * (`const preset = node()` + `...preset` + `tasks:` + `extraRequiredChecks:`).\n * This applies the mechanical transforms and flags anything that needs a\n * human eye.\n *\n * After running, `pnpm install && holocron run ci`.\n */\n\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type {\n\tCatalogBump,\n\tConfigMigration,\n\tFetchLatest,\n\tRunUpgradeDepsInput,\n\tUpgradeDepsReport,\n\tUpgradeDepsStatus,\n} from \"./upgrade-deps.type.js\";\n\nconst FETCH_TIMEOUT_MS = 4000;\n\n/** Resolve a package's `latest` dist-tag from the npm registry. */\nexport const fetchLatestFromNpm: FetchLatest = async (pkg) => {\n\ttry {\n\t\tconst res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`, {\n\t\t\tsignal: AbortSignal.timeout(FETCH_TIMEOUT_MS),\n\t\t\theaders: { accept: \"application/vnd.npm.install-v1+json\" },\n\t\t});\n\t\tif (!res.ok) return null;\n\t\tconst data = (await res.json()) as { \"dist-tags\"?: Record<string, string> };\n\t\treturn data[\"dist-tags\"]?.[\"latest\"] ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n// ── semver (just enough) ─────────────────────────────────────────────────────\n\n/** `a > b` for `x.y.z` release versions (prerelease tags are ignored). */\nexport function gt(a: string, b: string): boolean {\n\tconst pa = a.split(\".\").map((n) => parseInt(n, 10));\n\tconst pb = b.split(\".\").map((n) => parseInt(n, 10));\n\tfor (let i = 0; i < 3; i++) {\n\t\tconst x = pa[i] ?? 0;\n\t\tconst y = pb[i] ?? 0;\n\t\tif (x !== y) return x > y;\n\t}\n\treturn false;\n}\n\n// ── 1. catalog pins ──────────────────────────────────────────────────────────\n\nconst CATALOG_LINE = /^(\\s*['\"]?)(@theholocron\\/[a-z0-9-]+)(['\"]?\\s*:\\s*['\"]?)([~^]?)(\\d+\\.\\d+\\.\\d+[\\w.-]*)(['\"]?\\s*)$/;\n\n/**\n * Rewrite every `@theholocron/*` pin in a `pnpm-workspace.yaml` to `latest`,\n * keeping the range prefix. `latest` is looked up once per package.\n */\nexport async function bumpCatalogs(\n\tcontent: string,\n\tfetchLatest: FetchLatest\n): Promise<{ content: string; bumps: CatalogBump[] }> {\n\tconst lines = content.split(\"\\n\");\n\tconst wanted = new Set<string>();\n\tfor (const line of lines) {\n\t\tconst m = CATALOG_LINE.exec(line);\n\t\tif (m) wanted.add(m[2]!);\n\t}\n\n\tconst latest = new Map<string, string | null>();\n\tawait Promise.all(\n\t\t[...wanted].map(async (pkg) => {\n\t\t\tlatest.set(pkg, await fetchLatest(pkg));\n\t\t})\n\t);\n\n\tconst bumps: CatalogBump[] = [];\n\tconst out = lines.map((line) => {\n\t\tconst m = CATALOG_LINE.exec(line);\n\t\tif (!m) return line;\n\t\tconst [, pre, pkg, mid, prefix, current, post] = m;\n\t\tconst next = latest.get(pkg!);\n\t\tif (!next || next === current || !gt(next, current!)) return line;\n\t\tbumps.push({ pkg: pkg!, from: current!, to: next });\n\t\treturn `${pre}${pkg}${mid}${prefix}${next}${post}`;\n\t});\n\n\treturn { content: out.join(\"\\n\"), bumps };\n}\n\n/** True if the file still uses the 7.x preset shape. */\nexport function isLegacyConfig(content: string): boolean {\n\t// Only the 7.x markers count: a `workflows:` key, a `...repo.requiredChecks`\n\t// spread, or a preset destructure that pulls `workflows`. A config already on\n\t// `compose()` + `tasks:` + `extraRequiredChecks:` that merely destructures\n\t// `{ repo, providers }` is valid 8.x — touching it strands `...tasks` /\n\t// `...extraRequiredChecks` on the removed binding.\n\treturn (\n\t\t/\\.\\.\\.repo\\.requiredChecks/.test(content) ||\n\t\t/^\\s*workflows\\s*:/m.test(content) ||\n\t\t/const\\s*\\{[^}]*\\bworkflows\\b[^}]*\\}\\s*=\\s*(compose\\(|[a-zA-Z]+\\()/.test(content)\n\t);\n}\n\n/**\n * Apply the mechanical 7.x → 8.x transforms to a `holocron.config.ts`. Best\n * effort — the result should always be reviewed and run through `holocron run ci`.\n */\nexport function migrateConfig(content: string): ConfigMigration {\n\tconst transforms: string[] = [];\n\tconst warnings: string[] = [];\n\tlet s = content;\n\n\tif (!isLegacyConfig(s)) {\n\t\treturn { content, changed: false, transforms, warnings };\n\t}\n\n\t// `const { repo, workflows, ... } = <preset>;` → `const preset = <preset>;`\n\tlet destructured: string[] = [];\n\ts = s.replace(\n\t\t/const\\s*\\{([^}]*)\\}\\s*=\\s*((?:compose\\([\\s\\S]*?\\)|[a-zA-Z]+\\([\\s\\S]*?\\)))\\s*;/,\n\t\t(_m, names: string, expr: string) => {\n\t\t\tdestructured = names\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((n) => n.trim().split(\":\")[0]!.trim())\n\t\t\t\t.filter(Boolean);\n\t\t\ttransforms.push(\"destructured preset → `const preset = …`\");\n\t\t\treturn `const preset = ${expr.trim()};`;\n\t\t}\n\t);\n\n\t// Any binding that was destructured and is still spread bare (`...tasks`,\n\t// `...extraRequiredChecks`, …) now has to come off `preset`.\n\tfor (const name of destructured) {\n\t\tif (name === \"repo\" || name === \"providers\" || name === \"workflows\") continue; // handled explicitly below\n\t\tconst bare = new RegExp(`\\\\.\\\\.\\\\.${name}\\\\b(?!\\\\.)`, \"g\");\n\t\tif (bare.test(s)) {\n\t\t\ts = s.replace(bare, `...preset.${name}`);\n\t\t\ttransforms.push(`\\`...${name}\\` → \\`...preset.${name}\\``);\n\t\t}\n\t}\n\n\t// Inject `...preset,` as the first key of defineConfig({ … })\n\tif (/const preset =/.test(s) && !/\\.\\.\\.preset\\b/.test(s)) {\n\t\ts = s.replace(/(defineConfig\\(\\{\\s*\\n)/, `$1\\t...preset,\\n`);\n\t\ttransforms.push(\"spread `...preset` into defineConfig()\");\n\t}\n\n\t// Drop the top-level destructure pass-throughs — `...preset` covers them.\n\ts = s.replace(/^\\torg,\\n/m, \"\");\n\ts = s.replace(/^\\tdomain,\\n/m, \"\");\n\ts = s.replace(/^\\tdocs,\\n/m, \"\");\n\n\t// Spread renames\n\tif (/\\.\\.\\.repo\\.properties/.test(s)) {\n\t\ts = s.replace(/\\.\\.\\.repo\\.properties/g, \"...preset.repo?.properties\");\n\t\ttransforms.push(\"`...repo.properties` → `...preset.repo?.properties`\");\n\t}\n\tif (/([{[,]\\s*)\\.\\.\\.repo\\b(?!\\.)/.test(s)) {\n\t\ts = s.replace(/([{[,]\\s*)\\.\\.\\.repo\\b(?!\\.)/g, \"$1...preset.repo\");\n\t\ttransforms.push(\"`...repo` → `...preset.repo`\");\n\t}\n\tif (/\\.\\.\\.providers\\b/.test(s)) {\n\t\ts = s.replace(/\\.\\.\\.providers\\b/g, \"...preset.providers\");\n\t\ttransforms.push(\"`...providers` → `...preset.providers`\");\n\t}\n\n\t// `repo.requiredChecks` is gone — the derived checks come from `tasks`.\n\t// Pull the custom entries out to a top-level `extraRequiredChecks`.\n\tconst rc = /(\\n\\s*)requiredChecks\\s*:\\s*\\[\\s*\\n?\\s*\\.\\.\\.repo\\.requiredChecks\\s*,?\\s*([\\s\\S]*?)\\n\\s*\\]\\s*,/.exec(s);\n\tif (rc) {\n\t\tconst custom = rc[2]!.trim().replace(/,\\s*$/, \"\");\n\t\ts = s.replace(rc[0], \"\");\n\t\tif (custom) {\n\t\t\tconst block = `\\textraRequiredChecks: [\\n\\t\\t${custom\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.map((l) => l.trim())\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\\t\\t\")}\\n\\t],\\n`;\n\t\t\ts = s.replace(/(defineConfig\\(\\{\\s*\\n(?:\\t\\.\\.\\.preset,\\n)?)/, `$1${block}`);\n\t\t\ttransforms.push(\"`repo.requiredChecks` custom entries → top-level `extraRequiredChecks`\");\n\t\t\twarnings.push(\"check the moved `extraRequiredChecks` — the preset already contributes lint/test/typecheck\");\n\t\t} else {\n\t\t\ts = s.replace(/,(\\s*)\\.\\.\\.repo\\.requiredChecks/g, \"$1\");\n\t\t\ttransforms.push(\"dropped `...repo.requiredChecks`\");\n\t\t}\n\t}\n\n\t// `workflows:` → `tasks:` (`...workflows` → `...preset.tasks`)\n\tif (/^\\s*workflows\\s*:/m.test(s)) {\n\t\ts = s.replace(/(\\n\\s*)workflows(\\s*:\\s*\\[)/, \"$1tasks$2\");\n\t\ts = s.replace(/\\.\\.\\.workflows\\b/g, \"...preset.tasks\");\n\t\ttransforms.push(\"`workflows:` → `tasks:` (`...workflows` → `...preset.tasks`)\");\n\t\twarnings.push(\n\t\t\t\"review the `tasks` array — a bare workflow name that should gate merges now needs `{ name, required: true }`\"\n\t\t);\n\t}\n\n\treturn { content: s, changed: s !== content, transforms, warnings };\n}\n\nexport async function runUpgradeDeps(input: RunUpgradeDepsInput = {}): Promise<UpgradeDepsReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst dryRun = input.dryRun ?? false;\n\tconst pinsOnly = input.pinsOnly ?? false;\n\tconst _readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\tconst _writeFile = input.writeFile ?? ((p: string, c: string) => writeFileSync(p, c));\n\tconst fetchLatest = input.fetchLatest ?? fetchLatestFromNpm;\n\n\tlogger.info({ dryRun: dryRun || undefined, pinsOnly: pinsOnly || undefined }, \"upgrade deps: start\");\n\tprint(`Upgrading @theholocron/* dependencies${dryRun ? \" (dry-run)\" : \"\"}…`);\n\n\t// ── 1. catalog pins ──\n\tconst wsPath = join(cwd, \"pnpm-workspace.yaml\");\n\tlet bumps: CatalogBump[] = [];\n\ttry {\n\t\tconst ws = _readFile(wsPath);\n\t\tconst result = await bumpCatalogs(ws, fetchLatest);\n\t\tbumps = result.bumps;\n\t\tif (bumps.length > 0) {\n\t\t\tif (!dryRun) _writeFile(wsPath, result.content);\n\t\t\tprint(\"\");\n\t\t\tprint(` pnpm-workspace.yaml — ${bumps.length} pin${bumps.length === 1 ? \"\" : \"s\"}`);\n\t\t\tfor (const b of bumps) print(` ${dryRun ? \"~\" : \"✓\"} ${b.pkg} ${b.from} → ${b.to}`);\n\t\t} else {\n\t\t\tprint(\" · pnpm-workspace.yaml — @theholocron/* pins already current\");\n\t\t}\n\t} catch {\n\t\tprint(\" · no pnpm-workspace.yaml — skipping catalog pins\");\n\t}\n\n\t// ── 2. holocron.config.ts migration ──\n\tlet configMigrated = false;\n\tlet configWarnings: string[] = [];\n\tif (!pinsOnly) {\n\t\tfor (const name of [\"holocron.config.ts\", \"holocron.config.js\"]) {\n\t\t\tlet cfg: string;\n\t\t\ttry {\n\t\t\t\tcfg = _readFile(join(cwd, name));\n\t\t\t} catch {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst m = migrateConfig(cfg);\n\t\t\tif (!m.changed) {\n\t\t\t\tprint(` · ${name} — already on the current preset API`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!dryRun) _writeFile(join(cwd, name), m.content);\n\t\t\tconfigMigrated = true;\n\t\t\tconfigWarnings = m.warnings;\n\t\t\tprint(\"\");\n\t\t\tprint(` ${name} — ${dryRun ? \"would migrate\" : \"migrated\"} to the 8.x preset API`);\n\t\t\tfor (const t of m.transforms) print(` ${dryRun ? \"~\" : \"✓\"} ${t}`);\n\t\t\tfor (const w of m.warnings) print(` ⚠ ${w}`);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprint(\"\");\n\tif (bumps.length === 0 && !configMigrated) {\n\t\tprint(\"Nothing to do — already up to date.\");\n\t} else {\n\t\tprint(`Next: ${dryRun ? \"run without --dry-run, then \" : \"\"}\\`pnpm install && holocron run ci\\``);\n\t\tif (configMigrated) print(\" review holocron.config.ts before committing.\");\n\t}\n\n\tconst status: UpgradeDepsStatus = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ bumps: bumps.length, configMigrated, warnings: configWarnings.length, status }, \"upgrade deps: done\");\n\treturn { status, bumps, configMigrated, configWarnings };\n}\n","import { readFileSync, writeFileSync } from \"node:fs\";\nimport { basename, join, resolve, sep } from \"node:path\";\n\nimport { walkFilesSync } from \"@theholocron/fs-utils\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type { Pattern, RunUpgradeNodeInput, UpgradeNodeReport } from \"./upgrade-node.type.js\";\n\n// Directories to skip when walking the repo tree\nconst SKIP_DIRS = [\"node_modules\", \".git\", \"dist\", \"coverage\", \"build\", \".turbo\", \".next\", \"out\"];\n\n// ── per-file-type patch functions ─────────────────────────────────────────────\n// Each returns the new file content, or null if nothing in that file changed.\n\nfunction patchPackageJson(content: string, from: number, to: number): string | null {\n\tlet pkg: Record<string, unknown>;\n\ttry {\n\t\tpkg = JSON.parse(content) as Record<string, unknown>;\n\t} catch {\n\t\treturn null;\n\t}\n\n\tlet changed = false;\n\n\tconst engines = pkg.engines as Record<string, string> | undefined;\n\tif (engines?.node && /^>=\\d+(?:\\.0\\.0)?$/.test(engines.node)) {\n\t\tconst major = parseInt(engines.node.match(/\\d+/)![0]!, 10);\n\t\tif (major === from) {\n\t\t\tengines.node = `>=${to}.0.0`;\n\t\t\tchanged = true;\n\t\t}\n\t}\n\n\tfor (const field of [\"devDependencies\", \"dependencies\"] as const) {\n\t\tconst deps = pkg[field] as Record<string, string> | undefined;\n\t\tif (!deps?.[\"@types/node\"]) continue;\n\t\t// Only update exact semver ranges; leave catalog: pins alone\n\t\tif (deps[\"@types/node\"] === `^${from}.0.0`) {\n\t\t\tdeps[\"@types/node\"] = `^${to}.0.0`;\n\t\t\tchanged = true;\n\t\t}\n\t}\n\n\treturn changed ? stringifyJson(pkg, { like: content }) : null;\n}\n\nfunction patchYaml(content: string, from: number, to: number): string | null {\n\t// node-version: 20 / node-version: '20' / node-version: \"20\"\n\tconst updated = content.replace(/node-version:\\s+['\"]?(\\d+)['\"]?/g, (match, ver) =>\n\t\tver === String(from) ? match.replace(String(from), String(to)) : match\n\t);\n\treturn updated !== content ? updated : null;\n}\n\nfunction patchPinFile(content: string, from: number, to: number): string | null {\n\t// .nvmrc / .node-version — \"20\" or \"20.x.y\" on the first line\n\tconst trimmed = content.trim();\n\tif (trimmed === String(from) || trimmed.startsWith(`${from}.`)) {\n\t\treturn `${to}\\n`;\n\t}\n\treturn null;\n}\n\nfunction patchDockerfile(content: string, from: number, to: number): string | null {\n\t// FROM node:20 / FROM node:20-alpine / FROM node:20.11.0\n\tconst updated = content.replace(/^(FROM\\s+node:)(\\d+)/gm, (match, prefix, ver) =>\n\t\tver === String(from) ? `${prefix}${to}` : match\n\t);\n\treturn updated !== content ? updated : null;\n}\n\nfunction patchToolVersions(content: string, from: number, to: number): string | null {\n\t// nodejs 20 / nodejs 20.11.0\n\tconst updated = content.replace(/^(nodejs\\s+)(\\d+)/gm, (match, prefix, ver) =>\n\t\tver === String(from) ? `${prefix}${to}` : match\n\t);\n\treturn updated !== content ? updated : null;\n}\n\nconst PATTERNS: Pattern[] = [\n\t{ matches: (n) => n === \"package.json\", patch: patchPackageJson },\n\t{ matches: (n) => n.endsWith(\".yml\") || n.endsWith(\".yaml\"), patch: patchYaml },\n\t{ matches: (n) => n === \".nvmrc\" || n === \".node-version\", patch: patchPinFile },\n\t{ matches: (n) => n === \"Dockerfile\" || n.startsWith(\"Dockerfile.\"), patch: patchDockerfile },\n\t{ matches: (n) => n === \".tool-versions\", patch: patchToolVersions },\n];\n\n// ── auto-detect current major from the repo ───────────────────────────────────\n\nfunction detectFrom(cwd: string, _readFile: (p: string) => string): number | null {\n\tfor (const name of [\".nvmrc\", \".node-version\"]) {\n\t\ttry {\n\t\t\tconst major = parseInt(_readFile(join(cwd, name)).trim(), 10);\n\t\t\tif (!isNaN(major)) return major;\n\t\t} catch {\n\t\t\t/* absent */\n\t\t}\n\t}\n\ttry {\n\t\tconst pkg = JSON.parse(_readFile(join(cwd, \"package.json\"))) as Record<string, unknown>;\n\t\tconst node = (pkg.engines as Record<string, string> | undefined)?.node;\n\t\tif (node) {\n\t\t\tconst m = node.match(/(\\d+)/);\n\t\t\tif (m) return parseInt(m[1]!, 10);\n\t\t}\n\t} catch {\n\t\t/* absent */\n\t}\n\treturn null;\n}\n\n// ── default file walker ───────────────────────────────────────────────────────\n\nconst defaultWalkFiles = (dir: string): string[] => walkFilesSync(dir, { skip: SKIP_DIRS });\n\nexport async function runUpgradeNode(input: RunUpgradeNodeInput): Promise<UpgradeNodeReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst { to, dryRun = false, extra = [] } = input;\n\tconst _readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\tconst _writeFile = input.writeFile ?? ((p: string, c: string) => writeFileSync(p, c));\n\tconst _walkFiles = input.walkFiles ?? defaultWalkFiles;\n\n\t// Read the tree first: an unreadable directory is its own failure, not\n\t// \"couldn't detect the version\" or \"already up to date\".\n\tlet walked: string[];\n\ttry {\n\t\twalked = _walkFiles(cwd);\n\t} catch (error) {\n\t\tconst message = `could not read ${cwd}: ${errorMessage(error)}`;\n\t\tlogger.warn({ to, reason: message }, \"upgrade node: done\");\n\t\treturn { status: \"fail\", updated: [], message };\n\t}\n\n\tconst from = input.from ?? detectFrom(cwd, _readFile);\n\tif (from === null) {\n\t\tconst message = \"could not detect current Node version — pass --from <major>\";\n\t\tlogger.warn({ to, reason: message }, \"upgrade node: done\");\n\t\treturn { status: \"fail\", updated: [], message };\n\t}\n\n\tlogger.info({ from, to, dryRun: dryRun || undefined }, \"upgrade node: start\");\n\n\tif (from === to) {\n\t\tprint(`Already at Node.js ${to} — nothing to do.`);\n\t\tlogger.info({ from, to, updated: 0, status: \"ok\" }, \"upgrade node: done\");\n\t\treturn { status: \"ok\", updated: [] };\n\t}\n\n\tprint(`Upgrading Node.js ${from} → ${to}${dryRun ? \" (dry-run)\" : \"\"}…`);\n\n\tconst updated: string[] = [];\n\tconst root = resolve(cwd);\n\tconst scanned = [...walked, ...extra.map((p) => join(cwd, p))];\n\n\tfor (const abs of scanned) {\n\t\tconst name = basename(abs);\n\t\tconst pattern = PATTERNS.find((p) => p.matches(name));\n\t\tif (!pattern) continue;\n\n\t\tlet content: string;\n\t\ttry {\n\t\t\tcontent = _readFile(abs);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst patched = pattern.patch(content, from, to);\n\t\tif (patched === null) continue;\n\n\t\tconst absolute = resolve(abs);\n\t\tconst rel = absolute.startsWith(root + sep) ? absolute.slice(root.length + 1) : abs;\n\t\tif (!dryRun) _writeFile(abs, patched);\n\t\tprint(` ${dryRun ? \"~\" : \"✓\"} ${rel}`);\n\t\tlogger.debug({ file: rel, from, to }, \"upgrade node: patched\");\n\t\tupdated.push(rel);\n\t}\n\n\tif (updated.length === 0) {\n\t\tprint(` · no files contained Node.js ${from} pins`);\n\t}\n\n\tconst status = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ from, to, updated: updated.length, status }, \"upgrade node: done\");\n\treturn { status, updated };\n}\n","import type { CommandEntry } from \"../command-registry/index.js\";\n\n/**\n * `--token` (repeatable), `--org`, `--cwd`, `--dry-run` — the global flags a\n * menu-launched child should inherit from the parent invocation. Everything\n * else (command-specific options) was never captured by the top-level `$0`\n * handler in the first place, so there's nothing else to forward.\n *\n * `dryRunOverride`, when passed, wins over `argv.dryRun` — `launchMenu`'s\n * dry-run offer needs to force `--dry-run` on for the preview spawn and\n * force it back off for the real-run spawn that follows, regardless of\n * what was on the original invocation.\n */\nexport function forwardedFlags(argv: Record<string, unknown>, dryRunOverride?: boolean): string[] {\n\tconst out: string[] = [];\n\tconst tokens = argv.token as string[] | undefined;\n\tfor (const t of tokens ?? []) out.push(\"--token\", t);\n\tif (typeof argv.org === \"string\") out.push(\"--org\", argv.org);\n\tif (typeof argv.cwd === \"string\") out.push(\"--cwd\", argv.cwd);\n\tif (dryRunOverride ?? argv.dryRun === true) out.push(\"--dry-run\");\n\treturn out;\n}\n\n/** `entry.spawnArgs` if set, else `entry.name` split into tokens — resolved positionals appended, then forwarded flags. */\nexport function buildChildArgv(\n\tentry: CommandEntry,\n\tpositionals: string[],\n\tparentArgv: Record<string, unknown>,\n\tdryRunOverride?: boolean\n): string[] {\n\treturn [\n\t\t...(entry.spawnArgs ?? entry.name.split(\" \")),\n\t\t...positionals,\n\t\t...forwardedFlags(parentArgv, dryRunOverride),\n\t];\n}\n","import { listStoredProviders } from \"../../auth/index.js\";\nimport type { CommandEntry } from \"./command-registry.type.js\";\n\nconst numeric = (value: string): boolean | string => (/^\\d+$/.test(value) ? true : \"enter a number\");\n\n/**\n * The full command surface, hand-maintained in parallel with `cli.ts`'s\n * yargs registrations (this module does not introspect yargs at runtime).\n * `run <task>` has no entry here at all — `cli.ts`'s `$0` handler merges in\n * {@link buildRunMenuEntries}'s dynamically-built ones instead, since the\n * task namespace is this repo's own resolved manifest, not a static set\n * this module can hand-enumerate the way every other entry's positionals\n * are. `job` and `passthrough` stay un-prompted either way; picking a task\n * and running it plain covers the common case, and typing\n * `holocron run <task> <job> -- <args>` directly is one step away for\n * everything else. `run lint commit-msg <file>` stays excluded entirely:\n * it's invoked exclusively from `.husky/commit-msg \"$1\"`, never typed by a\n * human.\n */\nexport const COMMAND_REGISTRY: CommandEntry[] = [\n\t{\n\t\tname: \"clone\",\n\t\tdescription: \"Clone a single repo (org/repo) or every repo in an org (org)\",\n\t\tpositionals: [\n\t\t\t{\n\t\t\t\tkey: \"target\",\n\t\t\t\tmessage: \"org/repo to clone (or a bare org to clone every repo in it):\",\n\t\t\t\ttype: \"input\",\n\t\t\t\tvalidate: (v) => v.trim().length > 0 || \"org/repo or org is required\",\n\t\t\t},\n\t\t],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"doctor\",\n\t\tdescription: \"Load the config and run a smoke check against every provider\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo setup\",\n\t\tdescription: \"Apply infra setup actions across every configured capability\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"secrets set\",\n\t\tdescription: \"Set a single secret via the configured `secrets` capability\",\n\t\tpositionals: [{ key: \"name\", message: \"Secret name:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"secrets sync\",\n\t\tdescription: \"Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars\",\n\t\tpositionals: [{ key: \"environmentId\", message: \"Vault environment id:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"deploy\",\n\t\tdescription: \"Trigger a deployment via the configured `deployment` capability\",\n\t\tpositionals: [{ key: \"branch\", message: \"Branch to deploy:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"deploy cleanup-preview\",\n\t\tdescription: \"List and delete Cloudflare Pages preview deployments for a GitHub PR\",\n\t\tpositionals: [{ key: \"pr\", message: \"PR number:\", type: \"input\", validate: numeric }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"deploy on-release\",\n\t\tdescription: \"Deploy every workspace package whose delivery.deploy task is `on: release`\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"monitoring check\",\n\t\tdescription: \"Run every configured `monitoring` check against a given URL instead of its own configured url\",\n\t\tpositionals: [{ key: \"url\", message: \"URL to test against:\", type: \"input\" }],\n\t\tsupportsDryRun: false,\n\t},\n\t{\n\t\tname: \"package bump-versions\",\n\t\tdescription: \"Bump all non-private package versions in lockstep (semantic-release prepareCmd)\",\n\t\tpositionals: [{ key: \"newVersion\", cliArg: \"new-version\", message: \"New version:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"package publish\",\n\t\tdescription: \"Publish @theholocron/* packages to npm\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo sync\",\n\t\tdescription:\n\t\t\t\"Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"run ci\",\n\t\tdescription: \"Run the merge-gating checks locally, in CI order — 'will CI pass?'\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"sync github\",\n\t\tdescription: \"Sync workflow templates and composite actions to theholocron/.github\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo sync readme\",\n\t\tdescription: \"Sync the Installation + Usage block in README.md from package.json\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{ name: \"config show\", description: \"Print the resolved holocron config\", positionals: [] },\n\t{\n\t\tname: \"new repo\",\n\t\tdescription: \"Scaffold a new repo from a GitHub template (e.g. cli, react, nextjs, node, monorepo, base)\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"new plugin\",\n\t\tdescription: \"Scaffold a new @theholocron/holocron-plugin-<slug> package\",\n\t\tpositionals: [\n\t\t\t{ key: \"slug\", message: \"Package slug (kebab-case):\", type: \"input\" },\n\t\t\t{ key: \"vendor\", message: \"Vendor display name (PascalCase):\", type: \"input\" },\n\t\t],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"skills install\",\n\t\tdescription: \"Copy skills from @theholocron/skills into .agents/ with agent symlinks\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"skills remove\",\n\t\tdescription: \"Remove installed skills via npx skills remove\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"skills update\",\n\t\tdescription: \"Update installed skills to their latest upstream versions via npx skills update\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo upgrade node\",\n\t\tdescription: \"Scan the repo and update every Node.js version pin to a new major\",\n\t\tpositionals: [{ key: \"to\", message: \"Target Node.js major version:\", type: \"input\", validate: numeric }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo upgrade deps\",\n\t\tdescription: \"Bump every @theholocron/* pin to latest and migrate holocron.config.ts to the current preset API\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"auth set\",\n\t\tdescription: \"Verify + store a bootstrap token for a provider\",\n\t\tpositionals: [{ key: \"provider\", message: \"Provider name:\", type: \"input\" }],\n\t},\n\t{\n\t\tname: \"auth unset\",\n\t\tdescription: \"Remove a stored bootstrap token\",\n\t\tpositionals: [{ key: \"provider\", message: \"Provider:\", type: \"select\", choices: listStoredProviders }],\n\t},\n\t{\n\t\tname: \"auth check\",\n\t\tdescription: \"Re-verify a stored bootstrap token\",\n\t\tpositionals: [{ key: \"provider\", message: \"Provider:\", type: \"select\", choices: listStoredProviders }],\n\t},\n\t{\n\t\tname: \"auth list\",\n\t\tdescription: \"List every provider with a stored bootstrap token\",\n\t\tpositionals: [],\n\t},\n];\n\n/** Look up a {@link CommandEntry} by its full name — for Layer 3 call sites in `cli.ts`. */\nexport function getEntry(name: string): CommandEntry {\n\tconst entry = COMMAND_REGISTRY.find((e) => e.name === name);\n\tif (!entry) throw new Error(`interactive-menu: no COMMAND_REGISTRY entry named \"${name}\"`);\n\treturn entry;\n}\n","import type { MenuItem } from \"../../ui/index.js\";\nimport type { CommandEntry } from \"../command-registry/index.js\";\n\n/** Prefix of a menu item's `value` that opens a submenu rather than running a command. */\nexport const GROUP = \"group:\";\n/** The \"← back\" item's value; only offered below the first level. */\nexport const BACK = \"back\";\n\n/**\n * One level of the menu, derived from the registered command names: the next word\n * of every entry under `path` (`[]` is the top). A word is\n *\n * - a **command** when nothing is nested under it (`doctor`);\n * - a **group** when commands are nested under it (`repo` → `repo setup`, `repo sync`, …),\n * which can nest as deep as the names go (`repo upgrade` → `repo upgrade node`);\n *\n * Every row is a single word, never a \"<command> <subcommand>\" path: `config show` is\n * `config ›` then `show`, even when a group holds just one command.\n *\n * A path that is itself runnable (`repo sync`, `deploy`) gets a leading \"<word> (run it)\" item.\n * Registration order is kept.\n */\nexport function menuItems(entries: CommandEntry[], path: string[] = []): MenuItem[] {\n\tconst prefix = path.join(\" \");\n\tconst own = prefix ? entries.find((e) => e.name === prefix) : undefined;\n\tconst under = prefix ? entries.filter((e) => e.name.startsWith(`${prefix} `)) : entries;\n\tconst haystackOf = (list: CommandEntry[]): string =>\n\t\tlist.map((e) => `${e.name} ${e.description}`.toLowerCase()).join(\" \");\n\n\tconst items: MenuItem[] = [];\n\tif (own) {\n\t\titems.push({\n\t\t\tname: `${path[path.length - 1]!} (run it)`,\n\t\t\tvalue: own.name,\n\t\t\tdescription: own.description,\n\t\t\thaystack: haystackOf([own]),\n\t\t});\n\t}\n\tconst words = [...new Set(under.map((e) => e.name.split(\" \")[path.length]!))];\n\tfor (const word of words) {\n\t\tconst full = [...path, word].join(\" \");\n\t\tconst family = under.filter((e) => e.name === full || e.name.startsWith(`${full} `));\n\t\tconst self = family.find((e) => e.name === full);\n\t\tconst nested = family.filter((e) => e.name !== full);\n\t\tif (nested.length === 0 && self) {\n\t\t\titems.push({ name: word, value: full, description: self.description, haystack: haystackOf([self]) });\n\t\t} else {\n\t\t\tconst children = [...new Set(nested.map((e) => e.name.split(\" \")[path.length + 1]!))];\n\t\t\titems.push({\n\t\t\t\tname: `${word} ›`,\n\t\t\t\tvalue: `${GROUP}${full}`,\n\t\t\t\tdescription: children.join(\", \"),\n\t\t\t\thaystack: haystackOf(family),\n\t\t\t});\n\t\t}\n\t}\n\treturn items;\n}\n","import { spawn } from \"node:child_process\";\n\nimport { confirm } from \"@inquirer/prompts\";\n\nimport { NonInteractiveError, pickMenuItem, promptForPositionals } from \"../../ui/index.js\";\nimport { buildChildArgv } from \"../child-argv/index.js\";\nimport type { CommandEntry } from \"../command-registry/index.js\";\nimport { BACK, GROUP, menuItems } from \"../menu-items/index.js\";\n\n/**\n * Set on a dry-run preview child's env ({@link spawnChild}'s `extraEnv`) so\n * its handler knows this specific `--dry-run` came from `launchMenu`'s own\n * preview-then-ask flow, not a direct `holocron <cmd> --dry-run` invocation.\n * A handler that supports it uses this — never bare `argv.dryRun` — to\n * decide whether to report {@link DRY_RUN_NOOP_EXIT_CODE}: that exit code\n * only has special meaning to `launchMenu` itself, so a direct/scripted\n * `--dry-run` call must never produce it — doing so unconditionally would\n * silently change the public exit-code contract for a successful dry run.\n */\nexport const DRY_RUN_PREVIEW_ENV_VAR = \"HOLOCRON_DRY_RUN_PREVIEW\";\n\n/**\n * Reserved exit code a dry-run-capable handler may use — only when {@link\n * DRY_RUN_PREVIEW_ENV_VAR} is set — to report \"ran clean, nothing would\n * change.\" `launchMenu` treats it as success but skips the \"proceed with\n * the real run?\" question, since there's nothing for the real run to do\n * either.\n */\nexport const DRY_RUN_NOOP_EXIT_CODE = 2;\n\n/**\n * Spawn `holocron <...args>` inheriting stdio; resolve with its exit code.\n *\n * `NO_UPDATE_NOTIFIER` is forced on in the child's env — the parent's own\n * update-notifier tail still runs after this resolves (see `launchMenu`'s\n * docstring), so without this the freshly-spawned child independently runs\n * its own `checkForUpdates()` too and the notice prints twice: once from\n * the child right after its command output, once more from the parent\n * once the child exits. `extraEnv` layers on top — used only for {@link\n * DRY_RUN_PREVIEW_ENV_VAR} on the dry-run preview spawn.\n */\nfunction spawnChild(args: string[], extraEnv?: Record<string, string>): Promise<number> {\n\treturn new Promise((resolve) => {\n\t\tconst child = spawn(process.execPath, [process.argv[1]!, ...args], {\n\t\t\tstdio: \"inherit\",\n\t\t\tenv: { ...process.env, NO_UPDATE_NOTIFIER: \"1\", ...extraEnv },\n\t\t});\n\t\tchild.on(\"exit\", (code) => resolve(code ?? 0));\n\t\tchild.on(\"error\", () => resolve(1));\n\t});\n}\n\n/**\n * Whether `launchMenu` should auto-preview a picked command before running\n * it for real — only when the command's handler actually honours\n * `--dry-run` ({@link CommandEntry.supportsDryRun}) and the top-level\n * invocation didn't pass `--skip-dry-run` to opt out of the preview\n * entirely (an escape hatch for \"I already know what I want, skip\n * straight to the real run\").\n */\nexport function shouldPreviewDryRun(entry: CommandEntry, parentArgv: Record<string, unknown>): boolean {\n\treturn Boolean(entry.supportsDryRun) && parentArgv.skipDryRun !== true;\n}\n\n/**\n * Layers 1 and 2: walk the nested menu over `entries` (starting at `startPath`,\n * `[]` for the top), prompt for the picked command's required positionals, spawn\n * it as a fresh `holocron` invocation, and set `process.exitCode` from the child —\n * the caller (a `$0` handler in `cli.ts`) returns normally afterward so the\n * parent's own telemetry flush / update-notifier tail still runs. The parent's\n * own `command_completed` event fires with command name \"unknown\" (the middleware\n * ran before any command was picked) — left as-is rather than suppressed; it's a\n * real, useful signal (\"the menu got used\").\n *\n * Picking a group opens its submenu, which has a \"← back\" item; a command ends\n * the walk. See {@link menuItems} for how a level is built.\n *\n * For a command that honours `--dry-run` ({@link CommandEntry.supportsDryRun})\n * and wasn't opted out via `--skip-dry-run` ({@link shouldPreviewDryRun}),\n * this always previews first — a dry run doesn't mutate anything, so\n * there's nothing to ask permission for. A preview that exits non-zero\n * stops here; one that reports {@link DRY_RUN_NOOP_EXIT_CODE} (nothing\n * would change) stops here too, skipping the follow-up question since the\n * real run would have nothing to do either. Otherwise it asks \"proceed\n * with the real run?\" before the real spawn — the one actual decision\n * left to make, since this one does mutate something.\n */\nexport async function launchMenu(\n\tentries: CommandEntry[],\n\tparentArgv: Record<string, unknown>,\n\tpickMessage?: string,\n\tnonInteractiveMessage = \"Run `holocron --help` to see available commands.\",\n\tstartPath: string[] = []\n): Promise<void> {\n\tif (!process.stdin.isTTY) {\n\t\tthrow new NonInteractiveError(nonInteractiveMessage);\n\t}\n\tconst stack: string[][] = [startPath];\n\tlet picked: CommandEntry | undefined;\n\twhile (!picked) {\n\t\tconst path = stack[stack.length - 1]!;\n\t\tconst items = menuItems(entries, path);\n\t\tif (stack.length > 1) {\n\t\t\titems.push({ name: \"← back\", value: BACK, description: \"Return to the previous menu\", haystack: \"back\" });\n\t\t}\n\t\tconst message = stack.length === 1 ? pickMessage : `${path.join(\" \")} — choose a subcommand:`;\n\t\tconst value = await pickMenuItem(items, message);\n\t\tif (value === BACK) {\n\t\t\tstack.pop();\n\t\t} else if (value.startsWith(GROUP)) {\n\t\t\tstack.push(value.slice(GROUP.length).split(\" \"));\n\t\t} else {\n\t\t\t// `value` is drawn from `items`, which are built from `entries`, so this is always defined.\n\t\t\tpicked = entries.find((e) => e.name === value);\n\t\t}\n\t}\n\tconst positionals = await promptForPositionals(picked, {});\n\n\tif (shouldPreviewDryRun(picked, parentArgv)) {\n\t\tconst dryExit = await spawnChild(buildChildArgv(picked, positionals, parentArgv, true), {\n\t\t\t[DRY_RUN_PREVIEW_ENV_VAR]: \"1\",\n\t\t});\n\t\tif (dryExit === DRY_RUN_NOOP_EXIT_CODE) {\n\t\t\tprocess.exitCode = 0;\n\t\t\treturn;\n\t\t}\n\t\tif (dryExit !== 0) {\n\t\t\tprocess.exitCode = dryExit;\n\t\t\treturn;\n\t\t}\n\t\tconst proceed = await confirm({ message: \"Dry run complete — proceed with the real run?\", default: false });\n\t\tif (!proceed) {\n\t\t\tprocess.exitCode = 0;\n\t\t\treturn;\n\t\t}\n\t\tprocess.exitCode = await spawnChild(buildChildArgv(picked, positionals, parentArgv, false));\n\t\treturn;\n\t}\n\n\tprocess.exitCode = await spawnChild(buildChildArgv(picked, positionals, parentArgv));\n}\n","import { createAstromech } from \"@theholocron/astromech\";\nimport { loadTasksConfig } from \"@theholocron/astromech/config\";\n\nimport type { CommandEntry } from \"../command-registry/index.js\";\n\n/**\n * This repo's own resolved task manifest, filtered to what's actually\n * runnable locally — `Astromech.runnableTasks()`, reused rather than\n * reimplemented (deliberately *not* `packageScripts()`, whose\n * `syncScripts: false` short-circuit returns `{}` for repos — this one\n * included — that opt out of generated `package.json` scripts but still\n * have real runnable tasks). Empty (never throws) when there's no config to\n * resolve — feeds {@link buildRunMenuEntries}, which renders an empty list\n * as \"run ›\" simply having no children.\n */\nexport async function listRunnableTasks(argv: Record<string, unknown>): Promise<string[]> {\n\tconst cwd = typeof argv.cwd === \"string\" ? argv.cwd : process.cwd();\n\tconst config = await loadTasksConfig(cwd).catch(() => undefined);\n\treturn createAstromech({ cwd, config }).runnableTasks();\n}\n\n/**\n * Namespace display order for the `run` menu — deliberately its own thing,\n * not `@theholocron/astromech`'s `CI_ORDER`: that one is tuned for \"cheapest\n * signal first\" in an automated gate, a different goal from \"how a person\n * would naturally work through a repo\" (build it, clean up its style, check\n * it's secure, test it, validate it, document it). A namespace absent here\n * (a repo-specific one this list doesn't know about) sorts after every\n * named one, in whatever order it was first seen.\n */\nconst RUN_MENU_NAMESPACE_ORDER = [\"delivery\", \"sourceQuality\", \"security\", \"verification\", \"platform\", \"knowledge\"];\n\n/**\n * Splits `taskNames` (`\"sourceQuality.staticAnalysis\"`, …) into namespace\n * groups, ordered by {@link RUN_MENU_NAMESPACE_ORDER} — insertion order\n * within each group is `taskNames`' own order (already declaration order,\n * from {@link listRunnableTasks}). A name with no `.` at all (defensive;\n * every real registry task has a namespace) is its own bucket, keyed by the\n * full name, sorted after every namespaced group.\n */\nfunction groupByNamespace(taskNames: string[]): Map<string, string[]> {\n\tconst groups = new Map<string, string[]>();\n\tfor (const name of taskNames) {\n\t\tconst dot = name.indexOf(\".\");\n\t\tconst key = dot === -1 ? name : name.slice(0, dot);\n\t\tconst list = groups.get(key);\n\t\tif (list) list.push(name);\n\t\telse groups.set(key, [name]);\n\t}\n\tconst ordered = new Map<string, string[]>();\n\tconst byMenuOrder = (a: string, b: string) => {\n\t\tconst ia = RUN_MENU_NAMESPACE_ORDER.indexOf(a);\n\t\tconst ib = RUN_MENU_NAMESPACE_ORDER.indexOf(b);\n\t\tif (ia !== -1 || ib !== -1) return (ia === -1 ? Infinity : ia) - (ib === -1 ? Infinity : ib);\n\t\treturn 0; // neither is known — keep Map's own insertion (first-seen) order\n\t};\n\tfor (const key of [...groups.keys()].sort(byMenuOrder)) ordered.set(key, groups.get(key)!);\n\treturn ordered;\n}\n\n/**\n * Dynamically-built `run` sub-entries for every locally-runnable task\n * ({@link listRunnableTasks}), grouped by namespace and merged into\n * `COMMAND_REGISTRY` at `cli.ts`'s `$0` call site — not a registry entry\n * itself, since the task set is per-repo, not a static surface this module\n * can hand-enumerate.\n *\n * Each namespace becomes a group with a leading \"<namespace> (run it)\" item\n * (`holocron run <namespace>` — every task in it, via\n * `Astromech.runGroup()`) alongside each of its individual tasks, the exact\n * same \"a group that's also runnable\" shape `menuItems` already renders for\n * `repo sync` / `deploy` — reached here for free by using a space, not the\n * task's own `.`, between namespace and leaf in `name` (`spawnArgs` carries\n * the real dotted invocation `buildChildArgv` actually spawns).\n */\nexport function buildRunMenuEntries(taskNames: string[]): CommandEntry[] {\n\tconst entries: CommandEntry[] = [];\n\tfor (const [namespace, tasks] of groupByNamespace(taskNames)) {\n\t\tconst isRealNamespace = tasks[0] !== namespace || tasks.length > 1;\n\t\tif (isRealNamespace) {\n\t\t\tentries.push({\n\t\t\t\tname: `run ${namespace}`,\n\t\t\t\tdescription: `Run every ${namespace}.* task in sequence`,\n\t\t\t\tpositionals: [],\n\t\t\t\tsupportsDryRun: true,\n\t\t\t\tspawnArgs: [\"run\", namespace],\n\t\t\t});\n\t\t}\n\t\tfor (const task of tasks) {\n\t\t\tconst leaf = task === namespace ? namespace : task.slice(namespace.length + 1);\n\t\t\tentries.push({\n\t\t\t\tname: isRealNamespace ? `run ${namespace} ${leaf}` : `run ${leaf}`,\n\t\t\t\tdescription: `Run ${task}`,\n\t\t\t\tpositionals: [],\n\t\t\t\tsupportsDryRun: true,\n\t\t\t\tspawnArgs: [\"run\", task],\n\t\t\t});\n\t\t}\n\t}\n\treturn entries;\n}\n","import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport chalk from \"chalk\";\n\nimport { env } from \"../env/index.js\";\nimport type { CacheEntry } from \"./update-notifier.type.js\";\n\nconst PACKAGE_NAME = \"@theholocron/cli\";\nconst CACHE_TTL_MS = 24 * 60 * 60 * 1000;\nconst FETCH_TIMEOUT_MS = 3000;\n\nfunction getCacheDir(): string {\n\treturn env.get(\"HOLOCRON_CACHE_DIR\") ?? join(homedir(), \".cache\", \"holocron\");\n}\n\nfunction getCachePath(): string {\n\treturn join(getCacheDir(), \"update-check.json\");\n}\n\nfunction readCache(): CacheEntry | null {\n\ttry {\n\t\treturn JSON.parse(readFileSync(getCachePath(), \"utf8\")) as CacheEntry;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction writeCache(entry: CacheEntry): void {\n\ttry {\n\t\tmkdirSync(getCacheDir(), { recursive: true });\n\t\twriteFileSync(getCachePath(), JSON.stringify(entry));\n\t} catch {\n\t\t// silently ignore — update check is best-effort\n\t}\n}\n\nasync function fetchLatestVersion(channel: string): Promise<string | null> {\n\ttry {\n\t\tconst res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}`, {\n\t\t\tsignal: AbortSignal.timeout(FETCH_TIMEOUT_MS),\n\t\t});\n\t\tif (!res.ok) return null;\n\t\tconst data = (await res.json()) as { \"dist-tags\": Record<string, string> };\n\t\treturn data[\"dist-tags\"][channel] ?? data[\"dist-tags\"][\"latest\"] ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction getChannel(version: string): string {\n\tconst match = /^[^-]+-([a-zA-Z]+)/.exec(version);\n\treturn match?.[1] ?? \"latest\";\n}\n\nexport function isUpdateAvailable(current: string, latest: string): boolean {\n\tconst normalize = (v: string) => v.replace(/^v/, \"\");\n\tconst c = normalize(current);\n\tconst l = normalize(latest);\n\tif (c === l) return false;\n\n\tconst splitPre = (v: string): [string, string] => {\n\t\tconst idx = v.indexOf(\"-\");\n\t\treturn idx === -1 ? [v, \"\"] : [v.slice(0, idx), v.slice(idx + 1)];\n\t};\n\n\tconst [cRelease, cPre] = splitPre(c);\n\tconst [lRelease, lPre] = splitPre(l);\n\n\tconst parseRelease = (r: string) => r.split(\".\").map(Number);\n\tconst cParts = parseRelease(cRelease);\n\tconst lParts = parseRelease(lRelease);\n\n\tfor (let i = 0; i < Math.max(cParts.length, lParts.length); i++) {\n\t\tconst cv = cParts[i] ?? 0;\n\t\tconst lv = lParts[i] ?? 0;\n\t\tif (lv > cv) return true;\n\t\tif (lv < cv) return false;\n\t}\n\n\t// Release parts equal — compare prerelease\n\tif (!lPre && cPre) return true; // stable > prerelease\n\tif (lPre && !cPre) return false; // prerelease < stable\n\n\t// Both prerelease — compare segment by segment\n\tconst cPreParts = cPre.split(\".\");\n\tconst lPreParts = lPre.split(\".\");\n\tfor (let i = 0; i < Math.max(cPreParts.length, lPreParts.length); i++) {\n\t\tconst cv = cPreParts[i] ?? \"\";\n\t\tconst lv = lPreParts[i] ?? \"\";\n\t\tconst cvNum = Number(cv);\n\t\tconst lvNum = Number(lv);\n\t\tif (!isNaN(cvNum) && !isNaN(lvNum)) {\n\t\t\tif (lvNum > cvNum) return true;\n\t\t\tif (lvNum < cvNum) return false;\n\t\t} else {\n\t\t\tif (lv > cv) return true;\n\t\t\tif (lv < cv) return false;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction formatNotice(current: string, latest: string): string {\n\tconst installCmd = `npm install -g ${PACKAGE_NAME}`;\n\t// Measure raw strings before applying chalk so we avoid control-char regexes.\n\tconst raw1 = `Update available: ${current} → ${latest}`;\n\tconst raw2 = `Run ${installCmd} to update`;\n\tconst width = Math.max(raw1.length, raw2.length) + 4;\n\tconst bar = chalk.yellow(\"─\".repeat(width));\n\tconst border = chalk.yellow(\"│\");\n\tconst pad = (raw: string, styled: string) => `${border} ${styled}${\" \".repeat(width - 2 - raw.length)} ${border}`;\n\treturn [\n\t\t\"\",\n\t\tchalk.yellow(`╭${bar}╮`),\n\t\tpad(raw1, `Update available: ${chalk.dim(current)} → ${chalk.green(latest)}`),\n\t\tpad(raw2, `Run ${chalk.cyan(installCmd)} to update`),\n\t\tchalk.yellow(`╰${bar}╯`),\n\t\t\"\",\n\t].join(\"\\n\");\n}\n\nexport async function checkForUpdates(currentVersion: string): Promise<(() => void) | null> {\n\tif (env.get(\"CI\") || env.get(\"NO_UPDATE_NOTIFIER\")) return null;\n\n\tconst channel = getChannel(currentVersion);\n\tconst cache = readCache();\n\tconst now = Date.now();\n\n\tlet latestVersion: string | null = null;\n\n\tif (cache && now - cache.checkedAt < CACHE_TTL_MS) {\n\t\tlatestVersion = cache.latestVersion;\n\t} else {\n\t\tlatestVersion = await fetchLatestVersion(channel);\n\t\tif (latestVersion) writeCache({ latestVersion, checkedAt: now });\n\t}\n\n\tif (!latestVersion || !isUpdateAvailable(currentVersion, latestVersion)) return null;\n\n\treturn () => {\n\t\tprocess.stderr.write(formatNotice(currentVersion, latestVersion as string) + \"\\n\");\n\t};\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { confirm, input, select } from \"@inquirer/prompts\";\nimport { createAstromech, deployOnRelease } from \"@theholocron/astromech\";\nimport { loadTasksConfig } from \"@theholocron/astromech/config\";\nimport { lintCommitMsgFile } from \"@theholocron/astromech/lint\";\nimport { LOG_LEVELS, type LogLevel } from \"@theholocron/observability/core\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport {\n\tAuthError,\n\tcreateFeatureResolver,\n\ttype ParsedTokenArgs,\n\tparseTokenArgs,\n\tTokenParseError,\n} from \"./auth/index.js\";\nimport { runAuthCheck, runAuthList, runAuthSet, runAuthUnset } from \"./commands/auth/index.js\";\nimport { runCleanupPreview } from \"./commands/cleanup-preview/index.js\";\nimport { parseCloneTarget, runClone, type WholeOrgScope } from \"./commands/clone/index.js\";\nimport { commandsInContext } from \"./commands/contexts/index.js\";\nimport { runDeploy, runDeployFromFiles } from \"./commands/deploy/index.js\";\nimport { runDoctor } from \"./commands/doctor/index.js\";\nimport { runMonitoringCheck } from \"./commands/monitoring-check/index.js\";\nimport { NewError, parseTopics, runNew, validateRepoName } from \"./commands/new/index.js\";\nimport { runNpmBumpVersions } from \"./commands/npm-bump-versions/index.js\";\nimport { PluginCreateError, resolvePluginCreateInputs, runPluginCreate } from \"./commands/plugin-create/index.js\";\nimport { runPublish, runSteadyPublish, runSyncTrust } from \"./commands/publish/index.js\";\nimport { runSecretSet } from \"./commands/secret-set/index.js\";\nimport { runSecretsSync } from \"./commands/secrets-sync/index.js\";\nimport { runSetup } from \"./commands/setup/index.js\";\nimport { runSkillsInstall, runSkillsRemove, runSkillsUpdate } from \"./commands/skills/index.js\";\nimport { runSync } from \"./commands/sync/index.js\";\nimport { runSyncGithub } from \"./commands/sync-github/index.js\";\nimport { runSyncReadme } from \"./commands/sync-readme/index.js\";\nimport { runUpgradeDeps } from \"./commands/upgrade-deps/index.js\";\nimport { runUpgradeNode } from \"./commands/upgrade-node/index.js\";\nimport { loadConfig, type TelemetryConfig } from \"./config/index.js\";\nimport { env } from \"./env/index.js\";\nimport {\n\tbuildRunMenuEntries,\n\tCOMMAND_REGISTRY,\n\tDRY_RUN_NOOP_EXIT_CODE,\n\tDRY_RUN_PREVIEW_ENV_VAR,\n\tgetEntry,\n\tlaunchMenu,\n\tlistRunnableTasks,\n} from \"./interactive-menu/index.js\";\nimport { buildCliLogger, type BuildCliLoggerOpts, getRunId, reportError } from \"./observability/logger/index.js\";\nimport {\n\tapplyConfig,\n\tcaptureException,\n\tendSession,\n\tflush,\n\tinit,\n\tstartCommand,\n} from \"./observability/telemetry/index.js\";\nimport { CARDINALITY } from \"./plugin/index.js\";\nimport { NonInteractiveError, openPath, promptForPositionals, style, viewJson } from \"./ui/index.js\";\nimport { checkForUpdates } from \"./update-notifier/index.js\";\n\nconst resolveCloneToken = createFeatureResolver({ envName: \"HOLOCRON_READ_TOKEN\", keyringKey: \"github.read\" });\nconst resolveSyncToken = createFeatureResolver({ envName: \"HOLOCRON_SYNC_TOKEN\", keyringKey: \"github.sync\" });\n\n/**\n * Error class names whose `.message` is a complete, actionable sentence —\n * the top-level catch prints it and suppresses the stack trace.\n */\nconst USER_FACING_ERRORS = new Set([\"WorkspaceContextError\", \"ConfigFileError\", \"NonInteractiveError\"]);\n\nconst { version: CLI_VERSION } = JSON.parse(readFileSync(new URL(\"../package.json\", import.meta.url), \"utf-8\")) as {\n\tversion: string;\n};\n\n/** Whether to print the correlation id at command end (`--debug` / `--verbose`). */\nlet printRunId = false;\n\n/**\n * Resolves the active org in priority order:\n * 1. `--org` CLI flag\n * 2. `HOLOCRON_ORG` env var\n * 3. `org` from `holocron.config.ts`\n */\nfunction resolveOrg(argv: { org?: string }, config: { org?: string }): string | undefined {\n\treturn argv.org ?? env.get(\"HOLOCRON_ORG\") ?? config.org;\n}\n\n/**\n * Print the dim version line once per terminal session — keyed by the\n * parent shell's PID, since that's stable across repeated bare `holocron`\n * invocations in the same shell but changes in a new tab/window. A marker\n * file in the OS tmpdir tracks whether this shell has already seen it, so\n * re-running `holocron` doesn't repeat the line every time.\n */\nfunction printVersionHeaderOnce(): void {\n\tconst marker = join(tmpdir(), `.holocron-version-shown-${process.ppid}`);\n\tif (existsSync(marker)) return;\n\tconsole.log(style.dim(`v${CLI_VERSION}`));\n\twriteFileSync(marker, \"\");\n}\n\n/**\n * `buildCliLogger` options derived from a loaded `holocron.config` — the\n * level, the Axiom dataset, and the resolved org for a keyring-backed\n * Axiom token. Used by every handler that has already called `loadConfig`.\n */\nfunction cliLoggerOpts(\n\targv: { org?: string; verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\tresolved: { org?: string; log?: { level?: LogLevel; axiom?: { dataset?: string } } }\n): BuildCliLoggerOpts {\n\treturn {\n\t\tconfigLevel: resolved.log?.level,\n\t\tconfigAxiomDataset: resolved.log?.axiom?.dataset,\n\t\torg: resolveOrg(argv, resolved),\n\t};\n}\n\n/**\n * Fold a loaded `holocron.config` into the running process: reconfigure the\n * logger from `log:`, then apply the `telemetry:` override layer. Every handler\n * that has called `loadConfig` runs this, so a repo's `telemetry.enabled: false`\n * (or `analytics: \"none\"`) is honoured for that command. Env still wins —\n * `applyConfig` only narrows what `init` already turned on.\n */\nfunction applyResolvedConfig(\n\targv: { org?: string; verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\tresolved: {\n\t\torg?: string;\n\t\tlog?: { level?: LogLevel; axiom?: { dataset?: string } };\n\t\ttelemetry?: TelemetryConfig;\n\t}\n): void {\n\tbuildCliLogger(argv, cliLoggerOpts(argv, resolved));\n\tapplyConfig(resolved.telemetry);\n}\n\n/** Parses --token values and returns the context spread, or null on parse error (exits with code 1). */\nfunction tokenContext(rawTokens: string[] | undefined): ParsedTokenArgs | null {\n\tif (!rawTokens?.length) return {};\n\ttry {\n\t\treturn parseTokenArgs(rawTokens);\n\t} catch (err) {\n\t\tif (err instanceof TokenParseError) {\n\t\t\treportError(`--token: ${err.message}`);\n\t\t\tprocess.exitCode = 1;\n\t\t\treturn null;\n\t\t}\n\t\tthrow err;\n\t}\n}\n\n/** Layer 2: a bare group command (`holocron repo`, `holocron repo upgrade`, …) opens the menu at that level. */\nasync function launchGroupMenu(parent: string, argv: Record<string, unknown>): Promise<void> {\n\tawait launchMenu(\n\t\tCOMMAND_REGISTRY,\n\t\targv,\n\t\t`${parent} — choose a subcommand:`,\n\t\t`Run \\`holocron ${parent} --help\\` to see available ${parent} subcommands.`,\n\t\tparent.split(\" \")\n\t);\n}\n\ninit(CLI_VERSION);\nconst updateCheckPromise = checkForUpdates(CLI_VERSION);\n\nlet finishCommand: (ok: boolean) => void = () => {};\n/** Set by `.fail()` once it has printed an error, so the outer catch doesn't repeat it. */\nlet errorReported = false;\n\ntry {\n\tawait yargs(hideBin(process.argv))\n\t\t.scriptName(\"\")\n\t\t.usage(\"holocron <command> [options]\")\n\t\t.version(CLI_VERSION)\n\t\t.alias(\"version\", \"v\")\n\t\t// Keep everything after `--` in `argv['--']` instead of folding it into\n\t\t// `argv._`. `holocron run <task> [job] -- <args>` forwards `<args>` to the\n\t\t// underlying tool (`lhci autorun --config=…`, `turbo run build -- …`); the\n\t\t// telemetry command name reads `argv._` and must not pick these up.\n\t\t.parserConfiguration({ \"populate--\": true })\n\t\t// ── global options (apply to every subcommand) ──────────────────────\n\t\t.option(\"dry-run\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe:\n\t\t\t\t\"Print what would be mutated without calling capability mutators. \" +\n\t\t\t\t\"Commands branch on this; read-only commands ignore it.\",\n\t\t})\n\t\t.option(\"skip-dry-run\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe:\n\t\t\t\t\"Interactive mode only: skip the automatic dry-run preview for a \" +\n\t\t\t\t\"dry-run-capable command and run for real immediately.\",\n\t\t})\n\t\t.option(\"token\", {\n\t\t\ttype: \"string\",\n\t\t\tarray: true,\n\t\t\tdescribe:\n\t\t\t\t\"Vendor token override for plugins. \" +\n\t\t\t\t\"Bare form: --token <value> (fallback for all plugins, single-plugin commands). \" +\n\t\t\t\t\"Keyed form: --token vendor=value (targets a specific provider; repeat for each). \" +\n\t\t\t\t\"Example: --token github=ghp_xxx --token vercel=v_yyy\",\n\t\t})\n\t\t.option(\"org\", {\n\t\t\ttype: \"string\",\n\t\t\tdescribe:\n\t\t\t\t\"Active org name for namespaced keyring lookup. \" +\n\t\t\t\t\"Overrides HOLOCRON_ORG env var and the `org` field in holocron.config.ts. \" +\n\t\t\t\t\"Example: --org theholocron\",\n\t\t})\n\t\t.option(\"cwd\", {\n\t\t\ttype: \"string\",\n\t\t\tdefault: process.cwd(),\n\t\t\tdescribe: \"Directory to search for holocron.config.json\",\n\t\t})\n\t\t.option(\"verbose\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe: \"Set the log level to debug — full structured operational output.\",\n\t\t})\n\t\t.option(\"debug\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe: \"Print the run ID at command end for Axiom lookup. Does not change the log level.\",\n\t\t})\n\t\t.option(\"quiet\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe: \"Set the log level to error — suppress info and warn.\",\n\t\t})\n\t\t.option(\"log\", {\n\t\t\ttype: \"string\",\n\t\t\tchoices: LOG_LEVELS,\n\t\t\tdescribe:\n\t\t\t\t\"Show structured logger output at this level. Local/interactive runs are \" +\n\t\t\t\t\"quiet by default (no console output regardless of level) — this opts back in.\",\n\t\t})\n\t\t.middleware((argv) => {\n\t\t\tconst name = (argv._ as string[]).slice(0, 3).join(\" \") || \"unknown\";\n\t\t\tprintRunId = Boolean(argv.debug || argv.verbose);\n\t\t\t// Establish the root logger first (command name + flags + env) so its\n\t\t\t// `runId` is available to tag telemetry events. Handlers that load a\n\t\t\t// config call `buildCliLogger(argv, { configLevel })` again to fold in\n\t\t\t// the lowest-priority level + Axiom-dataset sources.\n\t\t\tbuildCliLogger(argv, { command: name, org: argv.org });\n\t\t\tfinishCommand = startCommand(name);\n\t\t})\n\t\t// ── commands ────────────────────────────────────────────────────────\n\t\t.command(\n\t\t\t\"clone [target]\",\n\t\t\t\"Clone a single repo (org/repo) or every repo in an org (org)\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.positional(\"target\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"org/repo to clone, or a bare org to clone every repo in it (confirms first).\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"dir\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"Parent directory to clone into (default: ~/Code/<org>)\",\n\t\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\tif (!tokens) return;\n\t\t\t\tlet token: string;\n\t\t\t\ttry {\n\t\t\t\t\ttoken = resolveCloneToken({ cliToken: tokens.cliTokens?.[\"github\"] ?? tokens.cliToken });\n\t\t\t\t} catch (err) {\n\t\t\t\t\treportError(`clone: ${err instanceof AuthError ? err.message : String(err)}`);\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst [targetInput] = await promptForPositionals(getEntry(\"clone\"), argv as Record<string, unknown>);\n\t\t\t\tconst { org, repo } = parseCloneTarget(targetInput);\n\t\t\t\tconst report = await runClone({\n\t\t\t\t\torg,\n\t\t\t\t\t...(repo ? { repo } : {}),\n\t\t\t\t\ttoken,\n\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t...(argv.dir ? { dir: argv.dir } : {}),\n\t\t\t\t\t...(!repo\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tconfirmWholeOrg: async ({ total, alreadyCloned, toClone }: WholeOrgScope) => {\n\t\t\t\t\t\t\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\t\t\t\t\t\t\tthrow new NonInteractiveError(\n\t\t\t\t\t\t\t\t\t\t\t`clone: cloning every repo in \"${org}\" needs interactive confirmation — ` +\n\t\t\t\t\t\t\t\t\t\t\t\t`run this from a terminal, or pass a specific org/repo instead`\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (toClone === 0) return true;\n\t\t\t\t\t\t\t\t\treturn confirm({\n\t\t\t\t\t\t\t\t\t\tmessage: `${org} has ${total} repos — ${alreadyCloned} already cloned locally, ${toClone} new. Clone them all?`,\n\t\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tconfirmOpen: async (openTarget: string, moreToCome: boolean) => {\n\t\t\t\t\t\tif (!process.stdin.isTTY) return;\n\t\t\t\t\t\t// A menu-launched preview with something it would actually clone\n\t\t\t\t\t\t// is about to ask \"proceed with the real run?\" — defer to there\n\t\t\t\t\t\t// instead of asking twice for the same directory. A direct\n\t\t\t\t\t\t// --dry-run invocation (no menu involved) has no such follow-up,\n\t\t\t\t\t\t// so it still asks now.\n\t\t\t\t\t\tif (moreToCome && env.get(DRY_RUN_PREVIEW_ENV_VAR) === \"1\") return;\n\t\t\t\t\t\tif (await confirm({ message: `Open ${openTarget}?`, default: false })) openPath(openTarget);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\tif (report.message) reportError(`clone: ${report.message}`);\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t} else if (\n\t\t\t\t\treport.status === \"dry-run\" &&\n\t\t\t\t\treport.cloned === 0 &&\n\t\t\t\t\tenv.get(DRY_RUN_PREVIEW_ENV_VAR) === \"1\"\n\t\t\t\t) {\n\t\t\t\t\tprocess.exitCode = DRY_RUN_NOOP_EXIT_CODE;\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"doctor\",\n\t\t\t\"Load the config and run a smoke check against every provider\",\n\t\t\t(y) =>\n\t\t\t\ty.option(\"repo\", {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdescribe: 'Repo coords (\"owner/name\"). Defaults to plugin-specific resolution.',\n\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\tif (!tokens) return;\n\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\tconst report = await runDoctor({\n\t\t\t\t\tloaded,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo } : {}),\n\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"skills\",\n\t\t\t\"Manage agent skills from the @theholocron/skills registry\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"install\",\n\t\t\t\t\t\t\"Copy skills from @theholocron/skills into .agents/ with agent symlinks\",\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tawait runSkillsInstall({ loaded, context: { repoRoot: argv.cwd, dryRun: argv.dryRun } });\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"remove [names..]\",\n\t\t\t\t\t\t\"Remove installed skills via npx skills remove\",\n\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\tyy.positional(\"names\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tarray: true,\n\t\t\t\t\t\t\t\tdescribe: \"Skill name(s) to remove (omit to remove all installed skills)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t(argv) => {\n\t\t\t\t\t\t\tconst report = runSkillsRemove({\n\t\t\t\t\t\t\t\tcontext: { repoRoot: argv.cwd, dryRun: argv.dryRun },\n\t\t\t\t\t\t\t\t...(argv.names?.length ? { names: argv.names as string[] } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"update [name]\",\n\t\t\t\t\t\t\"Update installed skills to their latest upstream versions via npx skills update\",\n\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\tyy.positional(\"name\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tdescribe: \"Skill name to update (omit to update all installed skills)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t(argv) => {\n\t\t\t\t\t\t\tconst report = runSkillsUpdate({\n\t\t\t\t\t\t\t\tcontext: { repoRoot: argv.cwd, dryRun: argv.dryRun },\n\t\t\t\t\t\t\t\t...(argv.name ? { name: argv.name as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"skills\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"run <task> [job] [passthrough..]\",\n\t\t\t\"Run a task locally (test, typecheck, lint, build, audit) — figures out turbo / the tool / the package manager. `run ci` runs every merge-gating check; `run lint commit-msg <file>` lints a commit message.\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.positional(\"task\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Task name (test, typecheck, lint, build, audit, or `ci` for the merge-gating suite). See `holocron run --help`.\",\n\t\t\t\t\t})\n\t\t\t\t\t.positional(\"job\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Sub-job within the task (e.g. `holocron run audit performance`, `holocron run lint commit-msg <file>`). Omit to run every job.\",\n\t\t\t\t\t})\n\t\t\t\t\t.positional(\"passthrough\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tarray: true,\n\t\t\t\t\t\tdescribe: \"Args forwarded to the tool — put them after `--`.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"required\", {\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescribe: \"Fail (exit 1) if this repo has no such task, instead of skipping.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"all\", {\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescribe: \"With `run ci`: run every `ci: true` task, not just the required ones.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"filter\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"turbo --filter=<pkg> passthrough (monorepo).\",\n\t\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\t// The specific command key (not just `run`) so `contexts.ts` can scope the\n\t\t\t\t// commit-msg hook to the global dataset and `run ci` to the repo's (ADR-0012).\n\t\t\t\tconst commandKey =\n\t\t\t\t\targv.task === \"ci\"\n\t\t\t\t\t\t? \"run ci\"\n\t\t\t\t\t\t: argv.task === \"lint\" && argv.job === \"commit-msg\"\n\t\t\t\t\t\t\t? \"run lint commit-msg\"\n\t\t\t\t\t\t\t: \"run\";\n\t\t\t\tconst { logger } = buildCliLogger(argv, { command: commandKey });\n\t\t\t\tconst passthrough = [\n\t\t\t\t\t...((argv.passthrough as string[] | undefined) ?? []),\n\t\t\t\t\t...((argv[\"--\"] as string[] | undefined) ?? []),\n\t\t\t\t];\n\t\t\t\t// `run lint commit-msg <file>` is the `.husky/commit-msg` hook: a real\n\t\t\t\t// commit-message linter, not astromech's filesystem-driven `lint` task.\n\t\t\t\tif (argv.task === \"lint\" && argv.job === \"commit-msg\") {\n\t\t\t\t\tconst file = passthrough[0];\n\t\t\t\t\tif (!file) {\n\t\t\t\t\t\treportError(\"run lint commit-msg: missing <file> (the commit message file git passes as $1).\");\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await lintCommitMsgFile(file, argv.cwd as string);\n\t\t\t\t\tif (!result.valid) {\n\t\t\t\t\t\tfor (const violation of result.violations) {\n\t\t\t\t\t\t\tconsole.error(`✖ ${violation.rule}: ${violation.message}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// `ci` isn't a manifest task: it's the merge-gating suite, in CI order.\n\t\t\t\tif (argv.task === \"ci\") {\n\t\t\t\t\tconst ciConfig = await loadTasksConfig(argv.cwd as string).catch(() => undefined);\n\t\t\t\t\tconst report = createAstromech({ cwd: argv.cwd, logger, config: ciConfig }).ci({\n\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\tscope: argv.all ? \"all\" : \"required\",\n\t\t\t\t\t\t...(argv.filter ? { filter: argv.filter as string } : {}),\n\t\t\t\t\t});\n\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// The task manifest drives `lint`'s linter set; other tasks are\n\t\t\t\t// filesystem-driven and ignore it. Missing / unparseable config → undefined.\n\t\t\t\tconst config = await loadTasksConfig(argv.cwd as string).catch(() => undefined);\n\t\t\t\tconst astromech = createAstromech({ cwd: argv.cwd, logger, config });\n\t\t\t\tconst report = astromech.run(argv.task as string, {\n\t\t\t\t\t...(argv.job !== undefined ? { job: argv.job as string } : {}),\n\t\t\t\t\tpassthrough,\n\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\trequired: argv.required,\n\t\t\t\t\t...(argv.filter ? { filter: argv.filter as string } : {}),\n\t\t\t\t});\n\t\t\t\tif (report.status === \"fail\" || report.status === \"unknown\") process.exitCode = 1;\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"config show\",\n\t\t\t\"Print the resolved holocron config\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.option(\"depth\", {\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdescribe: \"Collapse objects/arrays nested deeper than N levels (TTY output only)\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"interactive\", {\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Browse the config in a foldable tree (default on a TTY; --no-interactive for static output)\",\n\t\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\tawait viewJson(loaded.resolved, { depth: argv.depth, interactive: argv.interactive });\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"auth <subcommand>\",\n\t\t\t\"Manage bootstrap credentials in the OS keyring\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"set [provider] [value]\",\n\t\t\t\t\t\t\"Verify + store a bootstrap token for a provider\",\n\t\t\t\t\t\t(yy) => yy.positional(\"provider\", { type: \"string\" }).positional(\"value\", { type: \"string\" }),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [provider] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"auth set\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst result = await runAuthSet({\n\t\t\t\t\t\t\t\tprovider: provider!,\n\t\t\t\t\t\t\t\t...(argv.value ? { positional: argv.value as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.org ? { org: argv.org as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (result.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"unset [provider]\",\n\t\t\t\t\t\t\"Remove a stored bootstrap token\",\n\t\t\t\t\t\t(yy) => yy.positional(\"provider\", { type: \"string\" }),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [provider] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"auth unset\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\trunAuthUnset({ provider: provider! });\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"check [provider]\",\n\t\t\t\t\t\t\"Re-verify a stored bootstrap token\",\n\t\t\t\t\t\t(yy) => yy.positional(\"provider\", { type: \"string\" }),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [provider] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"auth check\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst result = await runAuthCheck({\n\t\t\t\t\t\t\t\tprovider: provider!,\n\t\t\t\t\t\t\t\t...(argv.org ? { org: argv.org as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (result.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"list\",\n\t\t\t\t\t\t\"List every provider with a stored bootstrap token\",\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\tawait runAuthList();\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"auth\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"$0\",\n\t\t\tfalse,\n\t\t\t() => {},\n\t\t\tasync (argv) => {\n\t\t\t\tprintVersionHeaderOnce();\n\t\t\t\tconst runEntries = buildRunMenuEntries(await listRunnableTasks(argv));\n\t\t\t\tawait launchMenu([...COMMAND_REGISTRY, ...runEntries], argv);\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"repo\",\n\t\t\t\"Set up, sync and upgrade the current repo\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"setup\",\n\t\t\t\t\t\t\"Apply infra setup actions across every configured capability\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: 'Repo coords (\"owner/name\"). Defaults to plugin-specific resolution.',\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"hooks\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Install git hooks (.husky/pre-push → holocron run ci). Default: on for protection:'strict'. --no-hooks to skip.\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSetup({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo } : {}),\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t...(argv.hooks !== undefined ? { hooks: argv.hooks as boolean } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"sync [steps..]\",\n\t\t\t\t\t\t\"Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"readme\",\n\t\t\t\t\t\t\t\t\t\"Sync the Installation + Usage block in README.md from package.json\",\n\t\t\t\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\t\t\t\ty.option(\"dry-run\", {\n\t\t\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\t\t\tdescribe: \"Print what would change without writing\",\n\t\t\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\t\t\t\tconst report = await runSyncReadme({\n\t\t\t\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\t\t\t\tcontext: { repoRoot: argv.cwd, dryRun: argv.dryRun },\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\t\t\tif (report.message) reportError(`repo sync readme: ${report.message}`);\n\t\t\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.positional(\"steps\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tarray: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Steps to run: labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki (default: all)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: 'Repo coords (\"owner/name\"). Defaults to plugin-specific resolution.',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSync({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo } : {}),\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t...(argv.steps && argv.steps.length > 0 ? { steps: argv.steps as string[] } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"upgrade\",\n\t\t\t\t\t\t\"Upgrade toolchain version pins across the repo\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"node [to]\",\n\t\t\t\t\t\t\t\t\t\"Scan the repo and update every Node.js version pin to a new major\",\n\t\t\t\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\t\t\t\tyy\n\t\t\t\t\t\t\t\t\t\t\t.positional(\"to\", {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\t\t\t\tdescribe: \"Target Node.js major version (e.g., 22)\",\n\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t.option(\"from\", {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"Current major version to replace. Auto-detected from .nvmrc / engines.node when omitted.\",\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tconst [to] = await promptForPositionals(\n\t\t\t\t\t\t\t\t\t\t\tgetEntry(\"repo upgrade node\"),\n\t\t\t\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t// Read upgrade.node.extra from holocron.config.json if present.\n\t\t\t\t\t\t\t\t\t\t// We read the raw file directly rather than through loadConfig because\n\t\t\t\t\t\t\t\t\t\t// the upgrade config is not part of the plugin schema.\n\t\t\t\t\t\t\t\t\t\tlet extra: string[] = [];\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tconst raw = readFileSync(join(argv.cwd, \"holocron.config.json\"), \"utf8\");\n\t\t\t\t\t\t\t\t\t\t\tconst cfg = JSON.parse(raw) as { upgrade?: { node?: { extra?: unknown } } };\n\t\t\t\t\t\t\t\t\t\t\tconst extraRaw = cfg.upgrade?.node?.extra;\n\t\t\t\t\t\t\t\t\t\t\tif (Array.isArray(extraRaw)) {\n\t\t\t\t\t\t\t\t\t\t\t\textra = extraRaw as string[];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t\t\t/* no config or no upgrade section — fine */\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst report = await runUpgradeNode({\n\t\t\t\t\t\t\t\t\t\t\tto: Number(to),\n\t\t\t\t\t\t\t\t\t\t\t...(argv.from != null ? { from: argv.from as number } : {}),\n\t\t\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t\t\textra,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\t\t\tif (report.message) reportError(`upgrade node: ${report.message}`);\n\t\t\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"deps\",\n\t\t\t\t\t\t\t\t\t\"Bump every @theholocron/* pin to latest and migrate holocron.config.ts to the current preset API\",\n\t\t\t\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\t\t\t\tyy.option(\"pins-only\", {\n\t\t\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\t\t\"Only bump the catalog pins — skip the holocron.config.ts migration\",\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tconst report = await runUpgradeDeps({\n\t\t\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t\t\tpinsOnly: argv.pinsOnly as boolean,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\t\t\tif (report.message) reportError(`upgrade deps: ${report.message}`);\n\t\t\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t() => {},\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tawait launchGroupMenu(\"repo upgrade\", argv);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t() => {}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"repo\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"new\",\n\t\t\t\"Scaffold a new repo or plugin\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"repo [type] [name]\",\n\t\t\t\t\t\t\"Scaffold a new repo from a GitHub template (e.g. cli, react, nextjs, node, monorepo, base)\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"type\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Template type — maps to theholocron/<type>-template \" +\n\t\t\t\t\t\t\t\t\t\t\"(e.g. cli, react, nextjs, node, monorepo, base)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.positional(\"name\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"New repo name (kebab-case, e.g. my-tool)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"description\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Short description — replaces <description> placeholders in the template\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"homepage\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Homepage URL — replaces <homepage> placeholders and appears in holocron.config.ts\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"vault\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vault provider: none, doppler, 1password, infisical\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"deployment\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Deployment provider: none, vercel\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"agent\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"AI agent: claude, none\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"runtime-environment\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Runtime environment: node, browser, universal, none\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"topics\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Comma-separated repo topics (e.g. typescript,nodejs)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"protection\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Branch protection level: strict, balanced, minimal\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"open-source\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Whether the repo is open source (default: true)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"uses-external-packages\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Whether the repo calls external APIs or services (default: true)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"skills\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Comma-separated agent skill names (e.g. git-safety,pr-workflow)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"is-template\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Mark the new repo as a GitHub template repository\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"org\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"theholocron\",\n\t\t\t\t\t\t\t\t\tdescribe: \"GitHub org that owns the template and will own the new repo\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"verify\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Run pnpm install + holocron repo setup after bootstrapping (--no-verify skips)\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\t\tconst adminToken = tokens.cliTokens?.[\"github\"] ?? tokens.cliToken;\n\n\t\t\t\t\t\t\t\tlet type = argv.type as string | undefined;\n\t\t\t\t\t\t\t\tlet name = argv.name as string | undefined;\n\t\t\t\t\t\t\t\tlet description = argv.description as string | undefined;\n\t\t\t\t\t\t\t\tlet homepage = argv.homepage as string | undefined;\n\t\t\t\t\t\t\t\tlet vaultProvider = argv.vault as string | undefined;\n\t\t\t\t\t\t\t\tlet vaultProject: string | undefined;\n\t\t\t\t\t\t\t\tlet vaultConfig: string | undefined;\n\t\t\t\t\t\t\t\tlet deploymentProvider = argv.deployment as string | undefined;\n\t\t\t\t\t\t\t\tlet agent = argv.agent as string | undefined;\n\t\t\t\t\t\t\t\tlet runtimeEnvironment = argv.runtimeEnvironment as string | undefined;\n\t\t\t\t\t\t\t\tlet topics: string[] = parseTopics(argv.topics as string | undefined);\n\t\t\t\t\t\t\t\tlet protection = argv.protection as string | undefined;\n\t\t\t\t\t\t\t\tlet openSource = argv.openSource as boolean | undefined;\n\t\t\t\t\t\t\t\tlet usesExternalPackages = argv.usesExternalPackages as boolean | undefined;\n\t\t\t\t\t\t\t\tlet skills: string[] = parseTopics(argv.skills as string | undefined);\n\t\t\t\t\t\t\t\tconst isTemplate = argv.isTemplate as boolean | undefined;\n\n\t\t\t\t\t\t\t\t// Interactive wizard — skip any field already supplied as a CLI arg\n\t\t\t\t\t\t\t\tif (!type) {\n\t\t\t\t\t\t\t\t\ttype = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Template type:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"node — Node.js library or tool\", value: \"node\" },\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: \"cli — CLI application (inquirer, chalk, yargs)\",\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: \"cli\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"monorepo — Turbo monorepo\", value: \"monorepo\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"react — React component library\", value: \"react\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"nextjs — Next.js application\", value: \"nextjs\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"base — Minimal repo (no package.json)\", value: \"base\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!name) {\n\t\t\t\t\t\t\t\t\tname = await input({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Repo name (kebab-case):\",\n\t\t\t\t\t\t\t\t\t\tvalidate: validateRepoName,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tname = name.trim();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (description === undefined) {\n\t\t\t\t\t\t\t\t\tdescription = await input({ message: \"Short description:\" });\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (homepage === undefined) {\n\t\t\t\t\t\t\t\t\tconst raw = await input({ message: \"Homepage URL (optional, Enter to skip):\" });\n\t\t\t\t\t\t\t\t\thomepage = raw.trim() || undefined;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!runtimeEnvironment) {\n\t\t\t\t\t\t\t\t\truntimeEnvironment = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Runtime environment:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"node — Node.js process\", value: \"node\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"browser — Browser only\", value: \"browser\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"universal — Node.js + browser\", value: \"universal\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"none — No runtime (docs, config, etc.)\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\tdefault: type === \"base\" ? \"none\" : \"node\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!vaultProvider) {\n\t\t\t\t\t\t\t\t\tvaultProvider = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Vault provider:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"None\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Doppler\", value: \"doppler\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"1Password\", value: \"1password\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Infisical\", value: \"infisical\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (vaultProvider === \"doppler\") {\n\t\t\t\t\t\t\t\t\tvaultProject = await input({ message: \"Doppler project name:\", default: name });\n\t\t\t\t\t\t\t\t\tvaultConfig = await input({ message: \"Doppler config:\", default: \"dev\" });\n\t\t\t\t\t\t\t\t} else if (vaultProvider === \"1password\" || vaultProvider === \"infisical\") {\n\t\t\t\t\t\t\t\t\tvaultProject = await input({\n\t\t\t\t\t\t\t\t\t\tmessage: `${vaultProvider === \"1password\" ? \"1Password vault\" : \"Infisical project\"} name:`,\n\t\t\t\t\t\t\t\t\t\tdefault: name,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!deploymentProvider) {\n\t\t\t\t\t\t\t\t\tdeploymentProvider = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Deployment provider:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"None\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Vercel\", value: \"vercel\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!agent) {\n\t\t\t\t\t\t\t\t\tagent = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"AI agent:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Claude\", value: \"claude\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"None\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (topics.length === 0) {\n\t\t\t\t\t\t\t\t\tconst raw = await input({ message: \"Topics (comma-separated, optional):\" });\n\t\t\t\t\t\t\t\t\ttopics = parseTopics(raw);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!protection) {\n\t\t\t\t\t\t\t\t\tprotection = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Branch protection:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"strict — required reviews + passing checks\", value: \"strict\" },\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: \"balanced — required reviews, flexible checks\",\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: \"balanced\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"minimal — branch protection only\", value: \"minimal\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (openSource === undefined) {\n\t\t\t\t\t\t\t\t\tconst ans = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Open source?\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Yes\", value: \"yes\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"No\", value: \"no\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\topenSource = ans === \"yes\";\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (usesExternalPackages === undefined) {\n\t\t\t\t\t\t\t\t\tconst ans = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Uses external APIs or services?\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Yes\", value: \"yes\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"No\", value: \"no\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tusesExternalPackages = ans === \"yes\";\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (skills.length === 0) {\n\t\t\t\t\t\t\t\t\tconst raw = await input({ message: \"Agent skills (comma-separated, optional):\" });\n\t\t\t\t\t\t\t\t\tskills = parseTopics(raw);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!type) {\n\t\t\t\t\t\t\t\t\treportError(\"new: template type is required\");\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!name) {\n\t\t\t\t\t\t\t\t\treportError(\"new: repo name is required\");\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst report = await runNew({\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tdescription: description || undefined,\n\t\t\t\t\t\t\t\t\thomepage,\n\t\t\t\t\t\t\t\t\tvaultProvider:\n\t\t\t\t\t\t\t\t\t\t(vaultProvider as \"doppler\" | \"1password\" | \"infisical\" | \"none\") ?? \"none\",\n\t\t\t\t\t\t\t\t\tvaultProject,\n\t\t\t\t\t\t\t\t\tvaultConfig,\n\t\t\t\t\t\t\t\t\tdeploymentProvider: (deploymentProvider as \"vercel\" | \"none\") ?? \"none\",\n\t\t\t\t\t\t\t\t\tagent: (agent as \"claude\" | \"none\") ?? \"claude\",\n\t\t\t\t\t\t\t\t\truntimeEnvironment:\n\t\t\t\t\t\t\t\t\t\t(runtimeEnvironment as \"node\" | \"browser\" | \"universal\" | \"none\") ?? \"node\",\n\t\t\t\t\t\t\t\t\tprotection: protection ?? \"strict\",\n\t\t\t\t\t\t\t\t\topenSource: openSource ?? true,\n\t\t\t\t\t\t\t\t\tusesExternalPackages: usesExternalPackages ?? true,\n\t\t\t\t\t\t\t\t\ttopics,\n\t\t\t\t\t\t\t\t\tskills,\n\t\t\t\t\t\t\t\t\tisTemplate,\n\t\t\t\t\t\t\t\t\torg: argv.org,\n\t\t\t\t\t\t\t\t\ttoken: adminToken,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\tnoVerify: !argv.verify,\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tif (err instanceof NewError) {\n\t\t\t\t\t\t\t\t\treportError(`new: ${err.message}`);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"plugin [slug] [vendor]\",\n\t\t\t\t\t\t\"Scaffold a new @theholocron/holocron-plugin-<slug> package\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"slug\", { type: \"string\", describe: \"Package slug (kebab-case)\" })\n\t\t\t\t\t\t\t\t.positional(\"vendor\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vendor display name (PascalCase)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"capability\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Capability key: source|ci|secrets|environments|issues|deployment|storage|auth|vault|dns|tooling|notifications|analytics|errors|logs|wiki|workers\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"token-env\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Holocron env var name (defaults to HOLOCRON_<VENDOR>_TOKEN)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"vendor-env\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vendor-native env var name\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"base-url\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"REST base URL\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"verify\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Run post-scaffold pnpm install + typecheck + lint + test (default true; --no-verify skips)\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst [slug, vendor] = await promptForPositionals(\n\t\t\t\t\t\t\t\t\tgetEntry(\"new plugin\"),\n\t\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst { capability, vendorEnv, baseUrl } = await resolvePluginCreateInputs(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcapability: argv.capability as string | undefined,\n\t\t\t\t\t\t\t\t\t\tvendorEnv: argv.vendorEnv as string | undefined,\n\t\t\t\t\t\t\t\t\t\tbaseUrl: argv.baseUrl as string | undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tselectCapability: () =>\n\t\t\t\t\t\t\t\t\t\t\tselect({\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"Capability:\",\n\t\t\t\t\t\t\t\t\t\t\t\tchoices: Object.keys(CARDINALITY).map((k) => ({ name: k, value: k })),\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tinputVendorEnv: () =>\n\t\t\t\t\t\t\t\t\t\t\tinput({\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: `Vendor-native env var for the ${vendor} token (e.g. MYVENDOR_API_KEY):`,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tinputBaseUrl: () =>\n\t\t\t\t\t\t\t\t\t\t\tinput({\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: `REST base URL for the ${vendor} API (e.g. https://api.myvendor.com):`,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst report = runPluginCreate({\n\t\t\t\t\t\t\t\t\tslug: slug!,\n\t\t\t\t\t\t\t\t\tvendorName: vendor!,\n\t\t\t\t\t\t\t\t\tcapability,\n\t\t\t\t\t\t\t\t\tvendorEnv,\n\t\t\t\t\t\t\t\t\tbaseUrl,\n\t\t\t\t\t\t\t\t\t...(argv.tokenEnv ? { tokenEnv: argv.tokenEnv as string } : {}),\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t// Yargs: `--no-verify` flips `argv.verify` to false. We pass\n\t\t\t\t\t\t\t\t\t// the inverse to preserve the internal `noVerify` naming.\n\t\t\t\t\t\t\t\t\tnoVerify: !argv.verify,\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tif (err instanceof PluginCreateError) {\n\t\t\t\t\t\t\t\t\treportError(`plugin create: ${err.message}`);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"new\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"secrets\",\n\t\t\t\"Set secrets and sync vault environments\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"set [name] [value]\",\n\t\t\t\t\t\t\"Set a single secret via the configured `secrets` capability\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"name\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Secret name (e.g., NPM_TOKEN)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.positional(\"value\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Secret value (positional). If omitted, sources from --from-stdin, --from-env, or env var matching <name>.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"from-stdin\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe: \"Read the secret value from stdin\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"from-env\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Read the secret value from the named env var (otherwise: env var matching <name>)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"scope\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"repo\",\n\t\t\t\t\t\t\t\t\tdescribe: 'Scope: \"repo\" (default), \"env=<name>\", or \"org=<name>\"',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst [name] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"secrets set\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst scopeArg = argv.scope as string;\n\t\t\t\t\t\t\tconst scope = parseScope(scopeArg);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSecretSet({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tname: name!,\n\t\t\t\t\t\t\t\t...(argv.value ? { value: argv.value as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.fromStdin ? { fromStdin: true } : {}),\n\t\t\t\t\t\t\t\t...(argv.fromEnv ? { fromEnv: argv.fromEnv as string } : {}),\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"sync [environmentId]\",\n\t\t\t\t\t\t\"Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"environmentId\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vault environment id to read (1P Environment id, etc.)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"project-id\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Deployment project id (e.g., Vercel prj_*). Required when deployment is loaded.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"target\", {\n\t\t\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\t\t\tdefault: [\"production\", \"preview\"] as Array<\n\t\t\t\t\t\t\t\t\t\t\"development\" | \"preview\" | \"production\"\n\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\tdescribe: \"Deployment targets to sync to. Defaults to production + preview.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"github-secret\", {\n\t\t\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Vault key(s) to push to GH Actions secrets (repeatable). Omit to push every key.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"github-secret-scope\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"repo\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t'Scope applied to every --github-secret key: \"repo\" (default), \"env=<name>\", or \"org=<name>\".',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst githubSecretScope = parseScope(argv.githubSecretScope as string);\n\t\t\t\t\t\t\tconst [environmentId] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"secrets sync\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSecretsSync({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tenvironmentId: environmentId!,\n\t\t\t\t\t\t\t\t...(argv.projectId ? { projectId: argv.projectId } : {}),\n\t\t\t\t\t\t\t\t...(argv.githubSecret?.length\n\t\t\t\t\t\t\t\t\t? { githubSecretKeys: argv.githubSecret as string[] }\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\tgithubSecretScope,\n\t\t\t\t\t\t\t\ttargets: argv.target as Array<\"development\" | \"preview\" | \"production\">,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"secrets\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"sync\",\n\t\t\t\"Sync generated files to other repos\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"github\",\n\t\t\t\t\t\t\"Sync workflow templates and composite actions to theholocron/.github\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"theholocron/.github\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Target org/repo (default: theholocron/.github)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"branch\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Push to this branch instead of the default branch (enables PR-based workflow for protected repos)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"pr\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe: \"Open a PR after pushing to --branch (no-op without --branch)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"message\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Commit message (default: chore: sync from theholocron/holocron)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"output-dir\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Write generated files to this local directory instead of pushing (for validation)\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst outputDir = argv[\"output-dir\"] as string | undefined;\n\t\t\t\t\t\t\tconst parsed = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!parsed) return;\n\t\t\t\t\t\t\tlet token: string;\n\t\t\t\t\t\t\tif (outputDir) {\n\t\t\t\t\t\t\t\ttoken = \"no-token-needed\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\ttoken = resolveSyncToken({\n\t\t\t\t\t\t\t\t\t\tcliToken: parsed.cliTokens?.[\"github\"] ?? parsed.cliToken,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t\treportError(`sync-github: ${err instanceof AuthError ? err.message : String(err)}`);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst report = await runSyncGithub({\n\t\t\t\t\t\t\t\ttoken,\n\t\t\t\t\t\t\t\trepo: argv.repo,\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t...(argv.branch ? { branch: argv.branch } : {}),\n\t\t\t\t\t\t\t\t...(argv.pr ? { createPr: true } : {}),\n\t\t\t\t\t\t\t\t...(argv.message ? { message: argv.message } : {}),\n\t\t\t\t\t\t\t\t...(outputDir ? { outputDir } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"sync\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"package\",\n\t\t\t\"Version and publish workspace packages\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"bump-versions [new-version]\",\n\t\t\t\t\t\t\"Bump all non-private package versions in lockstep (semantic-release prepareCmd)\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty.positional(\"new-version\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tdescribe: \"Version to set (e.g., 4.2.0 or 2.0.0-alpha.1)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [newVersion] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"package bump-versions\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst report = await runNpmBumpVersions({\n\t\t\t\t\t\t\t\tversion: newVersion!,\n\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"publish\",\n\t\t\t\t\t\t\"Publish @theholocron/* packages to npm\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"initial\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"One-shot bootstrap publish for trusted-publishing-eligible packages (npm needs the \" +\n\t\t\t\t\t\t\t\t\t\t\"package to exist before Trusted Publishing can be configured for it). Skips the \" +\n\t\t\t\t\t\t\t\t\t\t\"steady-state OIDC path below — use only for a package's very first publish.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"tag\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"npm distribution tag. Defaults to alpha for --initial, latest for a steady-state publish.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"otp\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"One-time password from your authenticator (required if npm needs 2FA for writes)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"sync-trust\", {\n\t\t\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Migrate npm Trusted Publisher config to a new workflow filename across every public \" +\n\t\t\t\t\t\t\t\t\t\t\"package: --sync-trust <old-file> <new-file>. See issue #689 — npm requires fresh \" +\n\t\t\t\t\t\t\t\t\t\t\"interactive 2FA per package; re-run after approving the printed authUrl if it stops early.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"owner/repo for Trusted Publisher config (--sync-trust). Defaults to theholocron/holocron.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"provenance\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Publish with --provenance (steady-state only). Default on — free under CI/OIDC.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"skip-already-published\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Steady-state only: check `npm view <pkg>@<version>` before publishing each package and \" +\n\t\t\t\t\t\t\t\t\t\t\"skip it if that exact version already exists, instead of one bulk publish. For repos \" +\n\t\t\t\t\t\t\t\t\t\t\"that ship many independently-versioned packages where a release doesn't bump every one.\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tif (argv.syncTrust) {\n\t\t\t\t\t\t\t\tconst [oldFile, newFile] = argv.syncTrust as [string?, string?];\n\t\t\t\t\t\t\t\tif (!oldFile || !newFile) {\n\t\t\t\t\t\t\t\t\treportError(\n\t\t\t\t\t\t\t\t\t\t\"publish --sync-trust requires exactly two values: <old-file> <new-file>\"\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst report = await runSyncTrust({\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\toldFile,\n\t\t\t\t\t\t\t\t\tnewFile,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo as string } : {}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (argv.initial) {\n\t\t\t\t\t\t\t\tconst report = await runPublish({\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.tag ? { tag: argv.tag as string } : {}),\n\t\t\t\t\t\t\t\t\t...(argv.otp ? { otp: argv.otp as string } : {}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst report = await runSteadyPublish({\n\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\tprovenance: argv.provenance as boolean,\n\t\t\t\t\t\t\t\tskipAlreadyPublished: argv.skipAlreadyPublished as boolean,\n\t\t\t\t\t\t\t\t...(argv.tag ? { tag: argv.tag as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.otp ? { otp: argv.otp as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"package\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"deploy [branch]\",\n\t\t\t\"Trigger a deployment via the configured `deployment` capability\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"cleanup-preview [pr]\",\n\t\t\t\t\t\t\"List and delete Cloudflare Pages preview deployments for a GitHub PR\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"pr\", {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tdescribe: \"PR number to clean up\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"project\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t\t\t\t\tdescribe: \"Cloudflare Pages project name (e.g. theholocron-preview)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"GitHub repo as owner/name — defaults to the repo in holocron.config\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst [pr] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"deploy cleanup-preview\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runCleanupPreview({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprNumber: Number(pr),\n\t\t\t\t\t\t\t\tproject: argv.project as string,\n\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"on-release\",\n\t\t\t\t\t\t\"Deploy every workspace package whose delivery.deploy task is `on: release` — run by the delivery.publish workflow's deploy job\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"channel\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"The release's channel: its prerelease identifier (`alpha`); empty or `main` for a stable release.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"from\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"The previous release's commit, to diff against. Omit when there is none.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"to\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"The release commit. Default HEAD.\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst report = await deployOnRelease({\n\t\t\t\t\t\t\t\tcwd: argv.cwd as string,\n\t\t\t\t\t\t\t\tchannel: argv.channel as string,\n\t\t\t\t\t\t\t\t// An empty value (an unset workflow output) means \"not given\".\n\t\t\t\t\t\t\t\t...(argv.from ? { from: argv.from as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.to ? { to: argv.to as string } : {}),\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\tprint: (line) => console.log(line),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.positional(\"branch\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"Git branch to deploy (omit when using --files)\",\n\t\t\t\t\t})\n\t\t\t\t\t// Not `demandOption`: yargs would make every nested subcommand\n\t\t\t\t\t// (`deploy on-release`, `deploy cleanup-preview`) inherit it. The\n\t\t\t\t\t// handler below enforces it for the trigger itself.\n\t\t\t\t\t.option(\"project-id\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"Deployment project id (required to trigger a deployment, e.g. Vercel prj_*)\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"target\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tchoices: [\"production\", \"staging\"] as const,\n\t\t\t\t\t\tdescribe: \"Named environment to deploy into. Omit for a branch preview.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"files\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Deploy from a local directory of source files instead of a Git branch — calls deployFunction(), no linked repo required. Conflicts with `branch`.\",\n\t\t\t\t\t})\n\t\t\t\t\t.conflicts(\"files\", \"branch\"),\n\t\t\tasync (argv) => {\n\t\t\t\tif (!argv.projectId) {\n\t\t\t\t\treportError(\"deploy: missing required argument --project-id\");\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\tif (!tokens) return;\n\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\tconst context = {\n\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t...tokens,\n\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t};\n\n\t\t\t\tif (argv.files) {\n\t\t\t\t\tconst report = await runDeployFromFiles({\n\t\t\t\t\t\tloaded,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tprojectId: argv.projectId as string,\n\t\t\t\t\t\tdir: argv.files as string,\n\t\t\t\t\t\t...(argv.target ? { target: argv.target as \"production\" | \"staging\" } : {}),\n\t\t\t\t\t});\n\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [branch] = await promptForPositionals(getEntry(\"deploy\"), argv as Record<string, unknown>);\n\t\t\t\tconst report = await runDeploy({\n\t\t\t\t\tloaded,\n\t\t\t\t\tcontext,\n\t\t\t\t\tprojectId: argv.projectId as string,\n\t\t\t\t\tbranch: branch!,\n\t\t\t\t\t...(argv.target ? { target: argv.target as \"production\" | \"staging\" } : {}),\n\t\t\t\t});\n\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"monitoring\",\n\t\t\t\"Run monitoring checks ad hoc, outside the configured provider\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"check <url>\",\n\t\t\t\t\t\t\"Run every configured `monitoring` check against a given URL instead of its own configured url\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty.positional(\"url\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tdescribe: \"URL to test every configured check against (e.g. a PR's preview deployment)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst [url] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"monitoring check\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runMonitoringCheck({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\turl: url!,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"monitoring\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.strict()\n\t\t.help()\n\t\t.epilogue(\n\t\t\t\"Execution contexts:\\n\" +\n\t\t\t\t` global works from a bare 'npm i -g': ${commandsInContext(\"global\").join(\", \")}\\n` +\n\t\t\t\t` repo-aware needs ./holocron.config in cwd: ${commandsInContext(\"repo-aware\").join(\", \")}\\n` +\n\t\t\t\t` workspace also needs the plugin packages: ${commandsInContext(\"workspace\").join(\", \")}\\n` +\n\t\t\t\t\" https://theholocron.github.io/holocron/execution-contexts\"\n\t\t)\n\t\t.fail((msg, err) => {\n\t\t\t// A user-facing error (a `workspace` command with no resolvable\n\t\t\t// plugins, a missing `holocron.config`) — its message is the whole\n\t\t\t// story. Print that: no usage dump, no stack trace.\n\t\t\tif (err instanceof Error && USER_FACING_ERRORS.has(err.name)) {\n\t\t\t\tcaptureException(err);\n\t\t\t\treportError(err.message);\n\t\t\t\terrorReported = true;\n\t\t\t\tprocess.exitCode = 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Anything else a handler threw: hand back to the outer catch so\n\t\t\t// telemetry + the generic path own it.\n\t\t\tif (err) throw err;\n\t\t\t// A yargs validation failure (unknown command, missing positional):\n\t\t\t// keep yargs' own message.\n\t\t\treportError(msg);\n\t\t\terrorReported = true;\n\t\t\tprocess.exitCode = 1;\n\t\t})\n\t\t.parse();\n} catch (err) {\n\tcaptureException(err);\n\t// User-facing errors carry a self-contained message — print it instead of\n\t// letting a raw stack trace escape (unless `.fail()` already did).\n\tif (!errorReported && err instanceof Error && USER_FACING_ERRORS.has(err.name)) {\n\t\treportError(err.message);\n\t}\n\tif (!process.exitCode) process.exitCode = 1;\n}\n\nfinishCommand(!process.exitCode);\nendSession();\n// `--debug` / `--verbose`: surface the correlation id for Axiom lookup. This is\n// user-facing reference output (print semantics); cli.ts has no `print` injection.\nconst rid = getRunId();\nif (printRunId && rid) console.log(`Run ID: ${rid}`);\nconst notify = await updateCheckPromise;\nnotify?.();\nawait flush();\n\n/**\n * Parse `--scope` strings: `repo` | `env=NAME` | `org=NAME`.\n */\nfunction parseScope(\n\ts: string\n): { kind: \"repo\" } | { kind: \"environment\"; name: string } | { kind: \"organization\"; name: string } {\n\tif (s === \"repo\") return { kind: \"repo\" };\n\tif (s.startsWith(\"env=\")) return { kind: \"environment\", name: s.slice(\"env=\".length) };\n\tif (s.startsWith(\"org=\")) return { kind: \"organization\", name: s.slice(\"org=\".length) };\n\tthrow new Error(`invalid --scope \"${s}\" — expected \"repo\", \"env=<name>\", or \"org=<name>\"`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAa,MAAM,gBAAgB;;;;;;;AAQnC,MAAa,cAAc,cAAc,KAAK,UAAU;;;;;AAMxD,SAAgB,QAAQ,QAA6C;CACpE,OAAO,gBAAgB,MAAM;AAC9B;;;;;;;;;;;;;;;;;;;;;ACAA,MAAM,UAAU;;;;;AAMhB,SAAg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I,EAAE,WAAW,MAAM,GAAG,OAAO;EAAE,MAAM;EAAgB,MAAM,EAAE,MAAM,CAAa;CAAE;CACtF,MAAM,IAAI,MAAM,oBAAoB,EAAE,mDAAmD;AAC1F"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["getKeyringToken","deriveDefaults","defaultImporter","SKIP_DIRS","defaultWalkFiles","SKIP_DIRS","defaultWalkFiles","preflight","defaultExec","render","render","render","render","render","render","render","render","render","render","render","render","render","render","render","render","render","renderPackageJson","renderTsconfigJson","renderVitestConfig","renderEslintConfig","renderTsdownConfig","renderReadme","renderAuth","renderRest","renderVerifyToken","renderPluginIndex","renderCapability","renderHelpers","renderAuthTest","renderRestTest","renderVerifyTokenTest","renderCapabilityTest","renderIndexTest","renderValidateScript","defaultExec","printNextSteps","defaultExec","defaultExec","defaultExec","defaultExec","ProviderApiError","ProviderApiError","workflowHeader","dcoConfig","FETCH_TIMEOUT_MS"],"sources":["../src/env/env.ts","../src/auth/keyring/keyring.ts","../src/auth/auth-resolver/auth-resolver.ts","../src/auth/token-args/token-args.ts","../src/plugin/capabilities/capabilities.ts","../src/config/config/config.ts","../src/config/load-config/load-config.ts","../src/commands/contexts/contexts.ts","../src/ui/non-interactive-error/non-interactive-error.ts","../src/ui/json-view/json-view.ts","../src/ui/menu/menu.ts","../src/ui/open-path/open-path.ts","../src/ui/progress/progress.ts","../src/ui/prompt-positionals/prompt-positionals.ts","../src/ui/style/style.ts","../src/ui/status-row/status-row.ts","../src/observability/logger/logger.ts","../src/plugin/loader/loader.ts","../src/plugin/run-check/run-check.ts","../src/plugin/workspace/workspace.ts","../src/commands/auth/auth.ts","../src/commands/cleanup-preview/cleanup-preview.ts","../src/commands/clone/clone.ts","../src/commands/deploy/deploy.ts","../src/commands/doctor/doctor.ts","../src/commands/monitoring-check/monitoring-check.ts","../src/commands/new/new.ts","../src/commands/npm-bump-versions/npm-bump-versions.ts","../src/commands/plugin-create/template-inputs/template-inputs.ts","../src/commands/plugin-create/templates/auth.ts","../src/commands/plugin-create/templates/auth-test.ts","../src/commands/plugin-create/templates/capability.ts","../src/commands/plugin-create/templates/capability-test.ts","../src/commands/plugin-create/templates/eslint-config.ts","../src/commands/plugin-create/templates/helpers.ts","../src/commands/plugin-create/templates/index-test.ts","../src/commands/plugin-create/templates/package-json.ts","../src/commands/plugin-create/templates/plugin-index.ts","../src/commands/plugin-create/templates/readme.ts","../src/commands/plugin-create/templates/rest.ts","../src/commands/plugin-create/templates/rest-test.ts","../src/commands/plugin-create/templates/tsconfig-json.ts","../src/commands/plugin-create/templates/tsdown-config.ts","../src/commands/plugin-create/templates/validate-script.ts","../src/commands/plugin-create/templates/verify-token.ts","../src/commands/plugin-create/templates/verify-token-test.ts","../src/commands/plugin-create/templates/vitest-config.ts","../src/commands/plugin-create/index.ts","../src/commands/publish/default-exec.ts","../src/commands/publish/default-login.ts","../src/commands/publish/has-packages-dir.ts","../src/commands/publish/has-plugins-dir.ts","../src/commands/publish/discover-manifests.ts","../src/commands/publish/discover-public-packages.ts","../src/commands/publish/print-next-steps.ts","../src/commands/publish/resolve-repo-name.ts","../src/commands/publish/workspace-filter-args.ts","../src/commands/publish/run-publish/run-publish.ts","../src/commands/publish/discover-public-package-entries.ts","../src/commands/publish/run-steady-publish/run-steady-publish.ts","../src/commands/publish/is-eotp.ts","../src/commands/publish/parse-json.ts","../src/commands/publish/run-sync-trust/run-sync-trust.ts","../src/commands/secret-set/secret-set.ts","../src/commands/secrets-sync/secrets-sync.ts","../src/commands/setup/derived-properties/derived-properties.ts","../src/commands/setup/labels.ts","../src/templates/dco.yml","../src/commands/setup/agent-prompts-data.ts","../src/commands/setup/agent-prompts.ts","../src/commands/setup/branch-protection.ts","../src/commands/setup/engineering.ts","../src/commands/setup/repo-settings.ts","../src/commands/setup/run-step/run-step.ts","../src/commands/setup/skills/skills.ts","../src/commands/setup/run-setup.ts","../src/commands/skills/skills.ts","../src/commands/sync-readme/sync-readme.ts","../src/commands/sync-wiki/sync-wiki.ts","../src/commands/sync/sync.ts","../src/observability/resolve-telemetry/resolve-telemetry.ts","../src/observability/telemetry/telemetry.ts","../src/commands/sync-github/sync-github.ts","../src/commands/upgrade-deps/upgrade-deps.ts","../src/commands/upgrade-node/upgrade-node.ts","../src/interactive-menu/child-argv/child-argv.ts","../src/interactive-menu/command-registry/command-registry.ts","../src/interactive-menu/menu-items/menu-items.ts","../src/interactive-menu/launch-menu/launch-menu.ts","../src/interactive-menu/run-menu-entries/run-menu-entries.ts","../src/update-notifier/update-notifier.ts","../src/cli.ts"],"sourcesContent":["import { createEnvLookup, withEnvPrefix } from \"@theholocron/env-utils\";\n\nexport type { EnvLookup as CliEnv } from \"@theholocron/env-utils\";\n\n/** Singleton env for simple global lookups throughout the CLI. */\nexport const env = createEnvLookup();\n\n/**\n * `get(\"KEY\")` tries `HOLOCRON_KEY` first, then `KEY`. Use it for settings that\n * have both a Holocron-namespaced override and a vendor-native name; do not use\n * it for `HOLOCRON_*` variables that have no bare fallback (`HOLOCRON_ORG`,\n * `HOLOCRON_LOG_LEVEL`, …), where the bare name would be wrong.\n */\nexport const holocronEnv = withEnvPrefix(env, \"HOLOCRON\");\n\n/**\n * Create an injectable env for commands that accept a fake env in tests.\n * Pass `input.env` when available, falls back to `process.env`.\n */\nexport function makeEnv(source?: Record<string, string | undefined>) {\n\treturn createEnvLookup(source);\n}\n","/**\n * Keyring-backed bootstrap credential store.\n *\n * Every holocron plugin's bootstrap token (the one it needs before it\n * can talk to its vendor's API) can be stored in the OS keyring under\n * a single reverse-DNS service scope. Managed via `holocron auth`\n * subcommands; consulted at position 4 in every plugin's auth\n * precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).\n *\n * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.\n *\n * Failure model: keyring access is best-effort. Platforms without a\n * supported credential store (some Linux CI images, sandboxed\n * environments) will throw from the underlying library. Every export\n * here catches and returns a null/empty result rather than propagating\n * — the plugin's precedence chain then falls through to\n * env-var-only paths, which is exactly how CI is meant to work.\n */\n\nimport { Entry, findCredentials } from \"@napi-rs/keyring\";\n\nconst SERVICE = \"com.theholocron.cli\";\n\n/**\n * Store or overwrite a bootstrap token for a provider. Returns true on\n * success, false when the underlying keyring is unsupported or errored.\n */\nexport function setToken(provider: string, token: string): boolean {\n\ttry {\n\t\tnew Entry(SERVICE, provider).setPassword(token);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Read the bootstrap token for a provider. Returns `null` for both\n * \"not stored\" and \"keyring unavailable\" — callers can treat them the\n * same way (fall through to env-var precedence).\n */\nexport function getToken(provider: string): string | null {\n\ttry {\n\t\treturn new Entry(SERVICE, provider).getPassword();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Delete a stored token. Returns true when a token was removed, false\n * when there was nothing to delete or the keyring is unavailable.\n * Distinguishing the two cases isn't worth the surface area — the\n * command output makes the situation clear either way.\n */\nexport function deleteToken(provider: string): boolean {\n\ttry {\n\t\treturn new Entry(SERVICE, provider).deletePassword();\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * List provider slugs with a stored token in this service scope.\n * Uses the library's `findCredentials(service)` — supported on all\n * platforms the underlying credential store supports.\n */\nexport function listStoredProviders(): string[] {\n\ttry {\n\t\treturn findCredentials(SERVICE).map((c) => c.account);\n\t} catch {\n\t\treturn [];\n\t}\n}\n","// Re-exported from @theholocron/http — the canonical home for HTTP primitives.\n// createResolveToken is wrapped here to inject the keyring backend so plugins\n// don't need to pass it explicitly.\nimport { AuthError, createResolveToken as _createResolveToken, type ResolveTokenInput } from \"@theholocron/http-client\";\n\nimport { makeEnv } from \"../../env/index.js\";\nimport { getToken as getKeyringToken } from \"../keyring/index.js\";\nimport type { FeatureResolverConfig, ResolveTokenConfig } from \"./auth-resolver.type.js\";\n\nexport { AuthError, type ResolveTokenInput };\n\n/** Wraps `createResolveToken` from `@theholocron/http` and injects the\n * system keyring so plugins stay at a one-liner call site. */\nexport function createResolveToken(config: ResolveTokenConfig): (input?: ResolveTokenInput) => string {\n\treturn _createResolveToken({ ...config, getKeyringToken });\n}\n\n/**\n * Build a strict, single-feature token resolver.\n *\n * Resolution chain: `--token flag → envName env var → keyring(keyringKey)`.\n * No broad-token fallback — if the feature-specific token is absent the\n * operation fails with a message naming the exact env var to set.\n */\nexport function createFeatureResolver(config: FeatureResolverConfig): (input?: ResolveTokenInput) => string {\n\treturn function resolveFeatureToken(input: ResolveTokenInput = {}): string {\n\t\tconst env = makeEnv(input.env);\n\t\tconst keyring = input.keyring ?? getKeyringToken;\n\t\tconst token = input.cliToken || env.get(config.envName) || keyring(config.keyringKey);\n\t\tif (!token) {\n\t\t\tthrow new AuthError(\n\t\t\t\t`no GitHub token found for this operation. Pass --token <PAT>, ` +\n\t\t\t\t\t`set ${config.envName}, or run: holocron auth set ${config.keyringKey} <PAT>`\n\t\t\t);\n\t\t}\n\t\treturn token;\n\t};\n}\n","import type { ParsedTokenArgs } from \"./token-args.type.js\";\n\nexport class TokenParseError extends Error {\n\toverride name = \"TokenParseError\";\n}\n\n/**\n * Converts raw --token CLI values into a typed result.\n *\n * Bare form: --token ghp_xxx → { cliToken: \"ghp_xxx\" }\n * Keyed form: --token github=ghp_xxx → { cliTokens: { github: \"ghp_xxx\" } }\n * Mixed: --token github=ghp_xxx --token v_yyy\n * → { cliToken: \"v_yyy\", cliTokens: { github: \"ghp_xxx\" } }\n *\n * Values may contain \"=\" (e.g. base64 strings) — only the first \"=\" is treated as a separator.\n */\nexport function parseTokenArgs(tokens: string[]): ParsedTokenArgs {\n\tif (tokens.length === 0) return {};\n\n\tconst cliTokens: Record<string, string> = {};\n\tconst bare: string[] = [];\n\n\tfor (const raw of tokens) {\n\t\tconst eqIdx = raw.indexOf(\"=\");\n\n\t\tif (eqIdx === -1) {\n\t\t\tbare.push(raw);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst vendor = raw.slice(0, eqIdx);\n\t\tconst value = raw.slice(eqIdx + 1);\n\n\t\tif (vendor.trim() === \"\") {\n\t\t\tthrow new TokenParseError(`invalid --token value \"${raw}\": vendor name must not be empty`);\n\t\t}\n\t\tif (/\\s/.test(vendor)) {\n\t\t\tthrow new TokenParseError(`invalid --token value \"${raw}\": vendor name must not contain whitespace`);\n\t\t}\n\t\tif (value === \"\") {\n\t\t\tthrow new TokenParseError(`invalid --token value \"${raw}\": token value must not be empty`);\n\t\t}\n\n\t\tcliTokens[vendor] = value;\n\t}\n\n\tif (bare.length > 1) {\n\t\tthrow new TokenParseError(\n\t\t\t`only one bare --token value is allowed; got ${bare.length.toString()} — use vendor=value form for multiple tokens`\n\t\t);\n\t}\n\n\tconst result: ParsedTokenArgs = {};\n\tif (bare.length === 1) result.cliToken = bare[0];\n\tif (Object.keys(cliTokens).length > 0) result.cliTokens = cliTokens;\n\treturn result;\n}\n","import type { CapabilityKey, Cardinality, CardinalityFor } from \"./capabilities.type.js\";\n\nexport const CARDINALITY = {\n\tsource: \"single\",\n\tci: \"single\",\n\tsecrets: \"single\",\n\tenvironments: \"single\",\n\tissues: \"single\",\n\tdeployment: \"single\",\n\tstorage: \"single\",\n\tauth: \"single\",\n\tvault: \"single\",\n\tdns: \"single\",\n\ttooling: \"many\",\n\tnotifications: \"many\",\n\tanalytics: \"many\",\n\terrors: \"single\",\n\tlogs: \"single\",\n\tmonitoring: \"single\",\n\twiki: \"single\",\n\tworkers: \"single\",\n} as const satisfies Record<CapabilityKey, Cardinality>;\n\n/**\n * No capabilities are strictly required — repos without secrets (e.g. org\n * community health repos) legitimately omit vault. Plugins validate their\n * own requirements at call time.\n */\nexport const REQUIRED_CAPABILITIES: readonly CapabilityKey[] = [] as const;\n\nexport { ProviderApiError } from \"@theholocron/http-client\";\n\nexport class WebhookVerificationError extends Error {\n\toverride name = \"WebhookVerificationError\";\n}\n\nexport function isMulti<K extends CapabilityKey>(key: K): CardinalityFor<K> extends \"many\" ? true : false {\n\treturn (CARDINALITY[key] === \"many\") as CardinalityFor<K> extends \"many\" ? true : false;\n}\n","import {\n\ttype CapabilityKey,\n\tCARDINALITY,\n\ttype PagesConfig,\n\tREQUIRED_CAPABILITIES,\n\ttype TeamEntry,\n\ttype TeamPermission,\n} from \"../../plugin/capabilities/index.js\";\nimport type {\n\tHolocronConfig,\n\tProviderOptions,\n\tRawProviderEntry,\n\tResolvedHolocronConfig,\n\tResolvedProviderEntry,\n\tResolvedProvidersConfig,\n\tResolvedTuple,\n} from \"./config.type.js\";\n\nexport type { PagesConfig, TeamEntry, TeamPermission };\n\n// ───────────────────────────────────────────────────────────────────────\n// Errors\n// ───────────────────────────────────────────────────────────────────────\n\nexport class ConfigError extends Error {\n\toverride name = \"ConfigError\";\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Helpers\n// ───────────────────────────────────────────────────────────────────────\n\nconst PLUGIN_PREFIX = \"@theholocron/holocron-plugin-\";\nconst COMMUNITY_PREFIX = \"holocron-plugin-\";\n\n/**\n * Resolve `\"github\"` → `\"@theholocron/holocron-plugin-github\"`.\n * Fully-qualified names (scoped or not) are honored verbatim, which\n * is how third-party plugins published outside the org work.\n */\nexport function resolvePluginPackage(provider: string): string {\n\tif (!provider) throw new ConfigError(\"provider name is empty\");\n\tif (provider.startsWith(\"@\")) return provider;\n\tif (provider.startsWith(COMMUNITY_PREFIX)) return provider;\n\tif (provider.includes(\"/\")) return provider;\n\treturn PLUGIN_PREFIX + provider;\n}\n\n/** A bare `[provider, options]` tuple, with both elements present? */\nfunction isOptionsTuple(value: unknown): value is [string, ProviderOptions] {\n\tif (!Array.isArray(value)) return false;\n\tif (value.length !== 2) return false;\n\tif (typeof value[0] !== \"string\") return false;\n\tconst opt = value[1];\n\treturn typeof opt === \"object\" && opt !== null && !Array.isArray(opt);\n}\n\nfunction normalizeEntry(entry: string | [string, ProviderOptions]): ResolvedTuple {\n\tif (typeof entry === \"string\") {\n\t\treturn { provider: entry, packageName: resolvePluginPackage(entry), options: {} };\n\t}\n\tconst [provider, options] = entry;\n\treturn { provider, packageName: resolvePluginPackage(provider), options };\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Parse / resolve\n// ───────────────────────────────────────────────────────────────────────\n\nexport function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry {\n\tconst cardinality = CARDINALITY[key];\n\n\t// Single short form: \"github\"\n\tif (typeof raw === \"string\") {\n\t\tif (cardinality === \"many\") {\n\t\t\tthrow new ConfigError(`\\`${key}\\` accepts multiple providers; wrap a single one in an array: [\"${raw}\"]`);\n\t\t}\n\t\treturn { cardinality: \"single\", tuple: normalizeEntry(raw) };\n\t}\n\n\tif (!Array.isArray(raw)) {\n\t\tthrow new ConfigError(`\\`${key}\\` entry must be a string or array, got ${typeof raw}`);\n\t}\n\n\t// Single options tuple: [\"vercel\", { team: \"rando\" }]\n\tif (isOptionsTuple(raw)) {\n\t\tif (cardinality === \"many\") {\n\t\t\t// Same shape, but cardinality forces multi — promote to one-element list\n\t\t\treturn { cardinality: \"many\", tuples: [normalizeEntry(raw)] };\n\t\t}\n\t\treturn { cardinality: \"single\", tuple: normalizeEntry(raw) };\n\t}\n\n\t// Multi list — array of strings, tuples, or a mix\n\tif (cardinality === \"single\") {\n\t\tthrow new ConfigError(\n\t\t\t`\\`${key}\\` accepts exactly one provider; got a multi-provider list with ${raw.length} entries`\n\t\t);\n\t}\n\n\tconst tuples = raw.map((entry, idx) => {\n\t\tif (typeof entry === \"string\") return normalizeEntry(entry);\n\t\tif (isOptionsTuple(entry)) return normalizeEntry(entry);\n\t\tthrow new ConfigError(`\\`${key}[${idx}]\\` must be a provider string or [provider, options] tuple`);\n\t});\n\n\treturn { cardinality: \"many\", tuples };\n}\n\nexport function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig {\n\tif (!raw.name) {\n\t\tthrow new ConfigError(\"`name` is required\");\n\t}\n\tif (!raw.providers || typeof raw.providers !== \"object\") {\n\t\tthrow new ConfigError(\"`providers` block is required\");\n\t}\n\n\tconst providers: ResolvedProvidersConfig = {};\n\tfor (const [key, entry] of Object.entries(raw.providers)) {\n\t\tif (entry === undefined) continue;\n\t\tproviders[key as CapabilityKey] = resolveEntry(key as CapabilityKey, entry as RawProviderEntry);\n\t}\n\n\tfor (const required of REQUIRED_CAPABILITIES) {\n\t\tif (!providers[required]) {\n\t\t\tthrow new ConfigError(`required capability \\`${required}\\` is missing from providers`);\n\t\t}\n\t}\n\n\t// Validate docs and narrow build to required\n\tlet docs: PagesConfig | undefined;\n\tif (raw.docs !== undefined) {\n\t\tif (!raw.docs.build) {\n\t\t\tthrow new ConfigError(\"`docs.build` is required when `docs` is set\");\n\t\t}\n\t\tdocs = raw.docs as PagesConfig;\n\t}\n\n\t// Derive homepage from docs.domain when not explicitly set\n\tconst homepage = raw.homepage ?? (docs?.domain ? `https://${docs.domain}/` : undefined);\n\n\treturn {\n\t\tname: raw.name,\n\t\tdescription: raw.description,\n\t\thomepage,\n\t\torg: raw.org,\n\t\tdomain: raw.domain,\n\t\trepo: raw.repo,\n\t\ttasks: raw.tasks,\n\t\tsyncScripts: raw.syncScripts,\n\t\tholocronScript: raw.holocronScript,\n\t\textraRequiredChecks: raw.extraRequiredChecks,\n\t\thooks: raw.hooks,\n\t\tproviders,\n\t\tapps: raw.apps ?? [],\n\t\tdoctor: raw.doctor ?? {},\n\t\tagent: raw.agent,\n\t\tskills: raw.skills,\n\t\tdocs,\n\t\tenv: raw.env,\n\t\tlog: raw.log,\n\t\ttelemetry: raw.telemetry,\n\t\teslint: raw.eslint,\n\t};\n}\n","/**\n * `holocron.config.{ts,js,mjs,cjs,json}` loader.\n *\n * File discovery + module loading (typed configs via `tsx`, no build\n * step) is delegated to `@theholocron/datapad`. This module keeps the\n * holocron-specific parts: filling `name` / `repo.name` defaults and\n * running the config through `resolveConfig`.\n *\n * Probe order is TS-first (`.ts` → `.js` → `.mjs` → `.cjs` → `.json`) —\n * see ADR-0010 / issue #75 / #81.\n */\n\nimport { basename, dirname } from \"node:path\";\n\nimport { loadTasksConfig } from \"@theholocron/astromech/config\";\nimport { ConfigFileError, loadConfigFile, type Loaded } from \"@theholocron/datapad\";\nimport { readGitRemote } from \"@theholocron/git-utils\";\nimport { readPackageJson } from \"@theholocron/pkg-utils\";\n\nimport { type HolocronConfig, resolveConfig } from \"../config/index.js\";\nimport type { LoadedConfig } from \"./load-config.type.js\";\n\nexport { ConfigFileError } from \"@theholocron/datapad\";\n\n/**\n * Read + parse + resolve `holocron.config.*` starting from the given\n * directory, walking up through ancestors to the nearest `.git` boundary\n * when `cwd` itself has no match — every command is usable from any\n * subdirectory of a repo, not only its exact root (see\n * `@theholocron/datapad`'s own doc comment for the stop conditions).\n * Throws {@link ConfigFileError} when nothing is found or a file cannot\n * be loaded, or `ConfigError` when the config fails schema checks.\n */\nexport async function loadConfig(cwd: string): Promise<LoadedConfig> {\n\tconst found = await loadConfigFile<HolocronConfig>({ cwd, name: \"holocron\", walkUp: true });\n\tif (!found) {\n\t\tthrow new ConfigFileError(\n\t\t\t`no holocron.config.{ts,js,mjs,cjs,json} found in ${cwd}. Create one — see the README for the schema.`\n\t\t);\n\t}\n\tconst withDefaults = await deriveDefaults(found);\n\treturn { resolved: resolveConfig(withDefaults), filepath: found.filepath };\n}\n\nasync function deriveDefaults(found: Loaded<HolocronConfig>): Promise<HolocronConfig> {\n\tconst configDir = dirname(found.filepath);\n\tconst result = { ...found.config };\n\tif (!result.name) {\n\t\tresult.name = (await readPackageJsonName(configDir)) ?? basename(configDir);\n\t}\n\tif (result.repo && !result.repo.name) {\n\t\tconst remote = await readGitRemote(configDir);\n\t\t// `repo.name` holds GitHub coordinates (owner/repo); a remote on any other host leaves it unset.\n\t\tif (remote?.host === \"github.com\") result.repo = { ...result.repo, name: remote.slug };\n\t}\n\n\t// Layer in the task manifest. `holocron.config`'s `tasks` key is one input;\n\t// a dedicated `astromech.config.{ts,js,mjs,json}` is merged on top (it wins\n\t// on scalars, task arrays concatenate). Doing it here keeps `holocron repo setup`\n\t// / `sync` / `doctor` on the same manifest that `holocron run` / `holocron\n\t// ci` resolve directly via `loadTasksConfig` — handed the file already loaded\n\t// above so it isn't found and loaded a second time.\n\tconst manifest = await loadTasksConfig(configDir, { holocron: found });\n\tif (manifest.tasks) result.tasks = manifest.tasks;\n\tif (manifest.syncScripts !== undefined) result.syncScripts = manifest.syncScripts;\n\tif (manifest.holocronScript !== undefined) result.holocronScript = manifest.holocronScript;\n\tif (manifest.hooks !== undefined) result.hooks = manifest.hooks;\n\tif (manifest.extraRequiredChecks) {\n\t\tresult.extraRequiredChecks = [...(result.extraRequiredChecks ?? []), ...manifest.extraRequiredChecks];\n\t}\n\n\treturn result;\n}\n\nasync function readPackageJsonName(dir: string): Promise<string | undefined> {\n\tconst name = (await readPackageJson(dir))?.name;\n\treturn name === undefined ? undefined : name.replace(/^@[^/]+\\//, \"\");\n}\n","import type { ExecutionContext } from \"./contexts.type.js\";\n\n/**\n * Command → context. Keys are the full command path as it lands in\n * yargs' `argv._` (`\"auth set\"`, `\"repo upgrade node\"`), the bare verb\n * otherwise; a longer, more specific key wins over its parent.\n *\n * - **`global`** — needs nothing but the CLI binary. Works anywhere.\n * - **`repo-aware`** — reads `./holocron.config` + `./package.json`\n * relative to cwd, but never touches the plugin loader.\n * - **`workspace`** — needs the configured providers' plugin packages to\n * resolve (devDeps in a repo, or `pnpm exec`).\n */\nexport const COMMAND_CONTEXTS = {\n\tclone: \"global\",\n\t\"new repo\": \"global\",\n\t\"new plugin\": \"global\",\n\t\"repo upgrade node\": \"global\",\n\t\"repo upgrade deps\": \"global\",\n\t\"auth set\": \"global\",\n\t\"auth unset\": \"global\",\n\t\"auth list\": \"global\",\n\t// `auth check` loads a plugin to verify, but degrades to \"token present,\n\t// verification skipped\" when the plugin isn't resolvable — so it's usable\n\t// from a global install. See `runAuthCheck`.\n\t\"auth check\": \"global\",\n\t\"package bump-versions\": \"global\",\n\t\"package publish\": \"global\",\n\t\"skills install\": \"global\",\n\t\"skills remove\": \"global\",\n\t\"skills update\": \"global\",\n\t// The `.husky/commit-msg` hook: works from a bare install, no holocron.config.\n\t\"run lint commit-msg\": \"global\",\n\n\trun: \"repo-aware\",\n\t\"run ci\": \"repo-aware\",\n\t// Reads each package's `holocron.config` and runs `pnpm --filter <pkg> delivery.deploy`\n\t// — no plugins of its own (the package's deploy script resolves them).\n\t\"deploy on-release\": \"repo-aware\",\n\t\"config show\": \"repo-aware\",\n\t// Writes README + package.json metadata from config; never loads a plugin.\n\t\"repo sync readme\": \"repo-aware\",\n\n\tdoctor: \"workspace\",\n\t\"repo setup\": \"workspace\",\n\t\"secrets set\": \"workspace\",\n\t\"secrets sync\": \"workspace\",\n\tdeploy: \"workspace\",\n\t\"deploy cleanup-preview\": \"workspace\",\n\t\"monitoring check\": \"workspace\",\n\t\"repo sync\": \"workspace\",\n\t// Pushes generated templates to theholocron/.github — needs the holocron\n\t// monorepo checkout (not plugins), so only ever run with `pnpm exec`.\n\t\"sync github\": \"workspace\",\n} as const satisfies Record<string, ExecutionContext>;\n\n/**\n * The context for a command name from `argv._`. Falls back to the leading\n * verb (`\"auth foo\"` → `\"auth\"`) and finally `undefined` for a name the\n * map doesn't know — callers treat unknown as \"don't guard\".\n */\nexport function contextForCommand(name: string): ExecutionContext | undefined {\n\tconst map = COMMAND_CONTEXTS as Record<string, ExecutionContext>;\n\tconst tokens = name.split(\" \").filter(Boolean);\n\t// Longest prefix wins: `repo sync labels` → `repo sync`, `run lint commit-msg` stays exact.\n\tfor (let n = tokens.length; n > 0; n--) {\n\t\tconst ctx = map[tokens.slice(0, n).join(\" \")];\n\t\tif (ctx) return ctx;\n\t}\n\treturn undefined;\n}\n\n/** Command names in a given context, in registration order. */\nexport function commandsInContext(context: ExecutionContext): string[] {\n\treturn Object.entries(COMMAND_CONTEXTS)\n\t\t.filter(([, c]) => c === context)\n\t\t.map(([name]) => name);\n}\n","/**\n * Raised when a prompt is needed but stdin isn't a TTY. A non-TTY run (CI, a\n * script, a pipe) throws this instead of hanging on `@inquirer/prompts`, which\n * otherwise throws its own `ExitPromptError` the moment stdin closes. `cli.ts`'s\n * `USER_FACING_ERRORS` catch prints the message cleanly.\n */\nexport class NonInteractiveError extends Error {\n\toverride name = \"NonInteractiveError\";\n}\n","import chalk from \"chalk\";\n\nimport { NonInteractiveError } from \"../non-interactive-error/index.js\";\nimport type { Container, Key, Line, Path, RenderOptions, ViewJsonOptions, ViewState } from \"./json-view.type.js\";\n\nfunction isContainer(value: unknown): value is Container {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction childrenOf(value: Container): [string, unknown][] {\n\treturn Array.isArray(value) ? value.map((v, i): [string, unknown] => [String(i), v]) : Object.entries(value);\n}\n\nfunction scalar(value: unknown): string {\n\tif (typeof value === \"string\") return chalk.green(JSON.stringify(value));\n\tif (typeof value === \"number\") return chalk.yellow(String(value));\n\tif (typeof value === \"boolean\") return chalk.magenta(String(value));\n\treturn chalk.dim(String(value === undefined ? null : value));\n}\n\nfunction summary(value: Container): string {\n\tconst n = childrenOf(value).length;\n\tconst unit = Array.isArray(value) ? (n === 1 ? \"item\" : \"items\") : n === 1 ? \"key\" : \"keys\";\n\treturn chalk.dim(Array.isArray(value) ? `[… ${n} ${unit}]` : `{… ${n} ${unit}}`);\n}\n\n/**\n * Paths of every container deeper than `depth` levels are left out, so those\n * render collapsed. `depth: 0` collapses the root; `Infinity` expands all.\n */\nexport function expandToDepth(value: unknown, depth: number): Set<Path> {\n\tconst out = new Set<Path>();\n\tconst walk = (v: unknown, path: Path, level: number): void => {\n\t\tif (!isContainer(v) || level >= depth) return;\n\t\tout.add(path);\n\t\tfor (const [k, child] of childrenOf(v)) walk(child, `${path}/${k}`, level + 1);\n\t};\n\twalk(value, \"\", 0);\n\treturn out;\n}\n\n/** Flatten `value` into the lines visible under `expanded`. Pure — no I/O. */\nexport function renderTree(value: unknown, { expanded }: RenderOptions): Line[] {\n\tconst lines: Line[] = [];\n\tconst walk = (v: unknown, path: Path, level: number, label: string, trailing: string): void => {\n\t\tconst indent = \" \".repeat(level);\n\t\tconst prefix = `${indent}${label}`;\n\t\tif (!isContainer(v)) {\n\t\t\tlines.push({ path, text: `${prefix}${scalar(v)}${trailing}`, foldable: false, expanded: false, level });\n\t\t\treturn;\n\t\t}\n\t\tconst kids = childrenOf(v);\n\t\tconst [open, close] = Array.isArray(v) ? [\"[\", \"]\"] : [\"{\", \"}\"];\n\t\tif (kids.length === 0) {\n\t\t\tlines.push({ path, text: `${prefix}${open}${close}${trailing}`, foldable: false, expanded: false, level });\n\t\t\treturn;\n\t\t}\n\t\tif (!expanded.has(path)) {\n\t\t\tlines.push({ path, text: `${prefix}${summary(v)}${trailing}`, foldable: true, expanded: false, level });\n\t\t\treturn;\n\t\t}\n\t\tlines.push({ path, text: `${prefix}${open}`, foldable: true, expanded: true, level });\n\t\tkids.forEach(([k, child], i) => {\n\t\t\tconst comma = i < kids.length - 1 ? \",\" : \"\";\n\t\t\tconst childLabel = Array.isArray(v) ? \"\" : `${chalk.cyan(JSON.stringify(k))}: `;\n\t\t\twalk(child, `${path}/${k}`, level + 1, childLabel, comma);\n\t\t});\n\t\tlines.push({\n\t\t\tpath: `${path}#close`,\n\t\t\ttext: `${indent}${close}${trailing}`,\n\t\t\tfoldable: false,\n\t\t\texpanded: false,\n\t\t\tlevel,\n\t\t});\n\t};\n\twalk(value, \"\", 0, \"\", \"\");\n\treturn lines;\n}\n\n/** Pure key reducer: `(state, key) -> state`. `rows` is the viewport height. */\nexport function reduceKey(state: ViewState, key: Key, value: unknown, rows: number): ViewState {\n\tconst lines = renderTree(value, { expanded: state.expanded });\n\tconst cur = lines[state.cursor];\n\tlet { cursor } = state;\n\tconst expanded = new Set(state.expanded);\n\tswitch (key) {\n\t\tcase \"up\":\n\t\t\tcursor = Math.max(0, cursor - 1);\n\t\t\tbreak;\n\t\tcase \"down\":\n\t\t\tcursor = Math.min(lines.length - 1, cursor + 1);\n\t\t\tbreak;\n\t\tcase \"right\":\n\t\t\tif (cur?.foldable) expanded.add(cur.path);\n\t\t\tbreak;\n\t\tcase \"left\":\n\t\t\tif (cur?.foldable && cur.expanded) expanded.delete(cur.path);\n\t\t\telse if (cur) {\n\t\t\t\tconst parent = lines.findLastIndex(\n\t\t\t\t\t(l, i) => i < cursor && l.foldable && l.expanded && l.level < cur.level\n\t\t\t\t);\n\t\t\t\tif (parent >= 0) cursor = parent;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"expandAll\":\n\t\t\treturn { cursor, top: state.top, expanded: expandToDepth(value, Infinity) };\n\t\tcase \"collapseAll\":\n\t\t\treturn { cursor: 0, top: 0, expanded: new Set() };\n\t\tcase \"quit\":\n\t\t\tbreak;\n\t}\n\tconst count = renderTree(value, { expanded }).length;\n\tcursor = Math.min(cursor, count - 1);\n\tlet top = state.top;\n\tif (cursor < top) top = cursor;\n\tif (cursor >= top + rows) top = cursor - rows + 1;\n\treturn { cursor, top: Math.max(0, top), expanded };\n}\n\nconst KEYMAP: Record<string, Key> = {\n\t\"\\u001b[A\": \"up\",\n\tk: \"up\",\n\t\"\\u001b[B\": \"down\",\n\tj: \"down\",\n\t\"\\u001b[C\": \"right\",\n\tl: \"right\",\n\t\"\\r\": \"right\",\n\t\" \": \"right\",\n\t\"\\u001b[D\": \"left\",\n\th: \"left\",\n\tE: \"expandAll\",\n\tC: \"collapseAll\",\n\tq: \"quit\",\n\t\"\\u001b\": \"quit\",\n\t\"\\u0003\": \"quit\",\n};\n\nfunction draw(out: NodeJS.WriteStream, value: unknown, state: ViewState, rows: number): void {\n\tconst lines = renderTree(value, { expanded: state.expanded });\n\tconst view = lines.slice(state.top, state.top + rows).map((l, i) => {\n\t\tconst marker = l.foldable ? (l.expanded ? \"▾ \" : \"▸ \") : \" \";\n\t\tconst row = `${marker}${l.text}`;\n\t\treturn state.top + i === state.cursor ? chalk.inverse(row) : row;\n\t});\n\tconst footer = chalk.dim(`${state.cursor + 1}/${lines.length} ↑↓ move →/⏎ expand ← collapse E/C all q quit`);\n\tout.write(`\\u001b[H\\u001b[J${view.join(\"\\n\")}\\n${footer}`);\n}\n\nasync function runInteractive(value: unknown, depth: number): Promise<void> {\n\tconst { stdin, stdout } = process;\n\tif (!stdin.isTTY || !stdout.isTTY) {\n\t\tthrow new NonInteractiveError(\"--interactive needs a TTY on stdin and stdout.\");\n\t}\n\tconst rows = (): number => Math.max(3, (stdout.rows ?? 24) - 1);\n\tlet state: ViewState = { cursor: 0, top: 0, expanded: expandToDepth(value, depth) };\n\tconst wasRaw = stdin.isRaw;\n\tstdin.setRawMode(true);\n\tstdin.resume();\n\tstdout.write(\"\\u001b[?1049h\\u001b[?25l\");\n\tconst redraw = (): void => draw(stdout, value, state, rows());\n\tstdout.on(\"resize\", redraw);\n\ttry {\n\t\tredraw();\n\t\tawait new Promise<void>((resolve) => {\n\t\t\tconst onData = (buf: Buffer): void => {\n\t\t\t\tconst key = KEYMAP[buf.toString()];\n\t\t\t\tif (key === \"quit\") {\n\t\t\t\t\tstdin.off(\"data\", onData);\n\t\t\t\t\tresolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (key) {\n\t\t\t\t\tstate = reduceKey(state, key, value, rows());\n\t\t\t\t\tredraw();\n\t\t\t\t}\n\t\t\t};\n\t\t\tstdin.on(\"data\", onData);\n\t\t});\n\t} finally {\n\t\tstdout.off(\"resize\", redraw);\n\t\tstdout.write(\"\\u001b[?25h\\u001b[?1049l\");\n\t\tstdin.setRawMode(wasRaw);\n\t\tstdin.pause();\n\t}\n}\n\n/**\n * Print `value` as JSON. Non-TTY stdout always gets plain, valid\n * `JSON.stringify` output (so `| jq` and redirects keep working); a TTY gets a\n * coloured tree, collapsed past `depth`. `interactive` opens a folding viewer (the default on a TTY).\n */\nexport async function viewJson(value: unknown, options: ViewJsonOptions = {}): Promise<void> {\n\tconst depth = options.depth ?? Infinity;\n\tconst interactive =\n\t\toptions.interactive ?? (options.depth === undefined && Boolean(process.stdin.isTTY && process.stdout.isTTY));\n\tif (interactive) return runInteractive(value, options.depth ?? 1);\n\tif (!process.stdout.isTTY) {\n\t\tconsole.log(JSON.stringify(value, null, 2));\n\t\treturn;\n\t}\n\tconst lines = renderTree(value, { expanded: expandToDepth(value, depth) });\n\tconsole.log(lines.map((l) => l.text).join(\"\\n\"));\n}\n","import search from \"@inquirer/search\";\n\nimport type { MenuItem } from \"./menu.type.js\";\n\n/**\n * Searchable autocomplete over one menu level's `items`. `select()` would work too\n * at these list sizes, but `search()` degrades gracefully as the surface grows and\n * costs nothing when it doesn't. Resolves to the picked item's `value`.\n */\nexport async function pickMenuItem(items: MenuItem[], message = \"What would you like to do?\"): Promise<string> {\n\treturn search<string>({\n\t\tmessage,\n\t\tsource: (term) => searchChoices(items, term),\n\t});\n}\n\n/**\n * `@inquirer/search`'s `source` callback, factored out as a plain function —\n * unit-testable directly instead of only through a mocked `search()` call.\n * Empty/undefined `term` (nothing typed yet) returns every item.\n */\nexport function searchChoices(\n\titems: MenuItem[],\n\tterm: string | undefined\n): Array<{ name: string; value: string; description: string }> {\n\tconst needle = term?.toLowerCase();\n\tconst pool = !needle ? items : items.filter((i) => i.haystack.includes(needle));\n\t// Name-prefix hits, then other name hits, then description-only hits (stable, so\n\t// registry order holds within each bucket): typing `repo` should land on the `repo`\n\t// group, not on `clone` whose description says \"repo\", and `up` on `upgrade`, not `setup`.\n\tconst rank = (i: MenuItem): number => {\n\t\tif (!needle) return 0;\n\t\tconst name = i.name.toLowerCase();\n\t\treturn name.startsWith(needle) ? 0 : name.includes(needle) ? 1 : 2;\n\t};\n\treturn [...pool]\n\t\t.sort((a, b) => rank(a) - rank(b))\n\t\t.map((i) => ({ name: i.name, value: i.value, description: i.description }));\n}\n","import { spawn } from \"node:child_process\";\n\n/** Platform-appropriate command to open a path in the OS's file browser. */\nfunction openCommand(path: string): { cmd: string; args: string[] } {\n\tif (process.platform === \"darwin\") return { cmd: \"open\", args: [path] };\n\tif (process.platform === \"win32\") return { cmd: \"cmd\", args: [\"/c\", \"start\", \"\", path] };\n\treturn { cmd: \"xdg-open\", args: [path] };\n}\n\n/**\n * Open `path` in the OS's default file browser (Finder / Explorer /\n * whatever `xdg-open` resolves to on Linux). Fire-and-forget — detached so\n * it outlives this process, and never throws when the opener binary isn't\n * on PATH (e.g. no `xdg-open` in a minimal container).\n */\nexport function openPath(path: string): void {\n\tconst { cmd, args } = openCommand(path);\n\tconst child = spawn(cmd, args, { stdio: \"ignore\", detached: true });\n\tchild.on(\"error\", () => {});\n\tchild.unref();\n}\n","import ora from \"ora\";\n\n/**\n * Runs `fn`, showing an ora spinner for its duration in TTY environments.\n * In non-TTY environments (CI, pipes, tests) the spinner is skipped entirely.\n */\nexport async function withSpinner<T>(label: string, fn: () => Promise<T>): Promise<T> {\n\tif (!process.stdout.isTTY) {\n\t\treturn fn();\n\t}\n\tconst spinner = ora(label).start();\n\ttry {\n\t\tconst result = await fn();\n\t\tspinner.succeed();\n\t\treturn result;\n\t} catch (err) {\n\t\tspinner.fail();\n\t\tthrow err;\n\t}\n}\n","import { input, select } from \"@inquirer/prompts\";\n\nimport { NonInteractiveError } from \"../non-interactive-error/index.js\";\nimport type { PositionalCommand } from \"./prompt-positionals.type.js\";\n\n/**\n * For each of `entry.positionals` not already present in `argv`, prompts for\n * it (`input()` or `select()`, per the positional's `type`) and returns the\n * resolved values in positional order — ready to append to a spawned child's\n * argv, or to use directly in the current handler (Layer 3).\n *\n * Throws {@link NonInteractiveError} the first time it would need to prompt\n * on a non-TTY stdin, and again if a `select` positional's choices resolve\n * empty (nothing to pick from — e.g. `auth unset` with no stored tokens).\n */\nexport async function promptForPositionals(entry: PositionalCommand, argv: Record<string, unknown>): Promise<string[]> {\n\tconst out: string[] = [];\n\tfor (const positional of entry.positionals) {\n\t\tconst existing = argv[positional.key];\n\t\tif (existing !== undefined && existing !== \"\") {\n\t\t\tout.push(String(existing));\n\t\t\tcontinue;\n\t\t}\n\t\tif (!process.stdin.isTTY) {\n\t\t\tthrow new NonInteractiveError(\n\t\t\t\t`\\`${entry.name}\\` needs \"${positional.key}\" — pass it directly: holocron ${entry.name} <${positional.cliArg ?? positional.key}>`\n\t\t\t);\n\t\t}\n\t\tif (positional.type === \"select\") {\n\t\t\tconst choices =\n\t\t\t\ttypeof positional.choices === \"function\" ? positional.choices() : (positional.choices ?? []);\n\t\t\tif (choices.length === 0) {\n\t\t\t\tthrow new NonInteractiveError(\n\t\t\t\t\t`\\`${entry.name}\\`: no ${positional.key} to choose from — nothing stored yet`\n\t\t\t\t);\n\t\t\t}\n\t\t\tout.push(await select({ message: positional.message, choices: choices.map((c) => ({ value: c })) }));\n\t\t} else {\n\t\t\tout.push(\n\t\t\t\tawait input({\n\t\t\t\t\tmessage: positional.message,\n\t\t\t\t\t...(positional.validate ? { validate: positional.validate } : {}),\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}\n\treturn out;\n}\n","import chalk from \"chalk\";\n\nexport const style = {\n\tsuccess: (msg: string) => `${chalk.green(\"✓\")} ${msg}`,\n\twarn: (msg: string) => `${chalk.yellow(\"⚠\")} ${msg}`,\n\tfail: (msg: string) => `${chalk.red(\"✗\")} ${msg}`,\n\tstep: (msg: string) => `${chalk.cyan(\"→\")} ${msg}`,\n\t/** A dim `·` marker for a row that's neither a pass nor a failure — loaded but inactive, or skipped. */\n\tskip: (msg: string) => chalk.dim(`· ${msg}`),\n\thint: (msg: string) => chalk.dim(msg),\n\tdim: (msg: string) => chalk.dim(msg),\n\theader: (msg: string) => chalk.bold(msg),\n};\n","import { style } from \"../style/index.js\";\nimport type { RowStatus } from \"./status-row.type.js\";\n\n/** Right-pads `s` to `width` with spaces — never truncates. */\nexport function pad(s: string, width: number): string {\n\treturn s.length >= width ? s : s + \" \".repeat(width - s.length);\n}\n\n/**\n * One row of a status report: a 2-space indent, the status icon (✓ / ✗ / ·),\n * then `columns` joined with a two-space gap (blank columns dropped, so a\n * row that has nothing for its last column doesn't trail whitespace).\n * Column padding (`pad`) is the caller's job — `doctor` pads capability and\n * provider to a fixed width; `clone`'s repo names and paths don't, since\n * they vary too widely for fixed-width alignment to read cleanly.\n *\n * Shared by `doctor` (capability / provider / message) and `clone` (repo /\n * destination / reason) so every status table in the CLI reads the same way.\n */\nexport function statusRow(status: RowStatus, columns: string[]): string {\n\tconst joined = columns.filter((c) => c.length > 0).join(\" \");\n\tconst styled =\n\t\tstatus === \"ok\" ? style.success(joined) : status === \"fail\" ? style.fail(joined) : style.skip(joined);\n\treturn ` ${styled}`;\n}\n","/**\n * CLI-side wiring for `@theholocron/observability/logger`.\n *\n * `logger` is the operational-output channel — internal state, debug\n * traces, errors, structured context that routes to Axiom. It runs in\n * parallel to `print` (user-facing UX output) and does not replace it.\n */\n\nimport type { Logger, LogLevel } from \"@theholocron/observability/core\";\nimport {\n\ttype AxiomTransportConfig,\n\tcreateLogger,\n\tisCI,\n\tparseLogLevel,\n\tresolveAxiomFromEnv,\n} from \"@theholocron/observability/logger\";\n\nimport { getToken } from \"../../auth/index.js\";\nimport { contextForCommand } from \"../../commands/contexts/index.js\";\nimport { env, holocronEnv } from \"../../env/index.js\";\nimport { style } from \"../../ui/index.js\";\nimport type { BuildCliLoggerOpts } from \"./logger.type.js\";\n\n/**\n * Dataset for `global`-context commands (`clone`, `auth set`, `upgrade\n * node`, …) — ADR-0012. These commands aren't \"about\" any repo, so their\n * logs must never depend on `$PWD` or which repo's `.envrc` happens to be\n * active; they always ship to holocron's own dataset instead of whatever\n * `HOLOCRON_AXIOM_DATASET` resolves to locally. Mirrors\n * `resolve-telemetry.ts`'s `FALLBACK_DSN` — a holocron-owned default, not a\n * per-repo override.\n */\nexport const GLOBAL_AXIOM_DATASET = \"holocron-global\";\n\n/**\n * Resolve the explicit level to hand to `createLogger`, in priority order:\n *\n * 1. `--log <level>` 2. `--verbose` → `\"debug\"` 3. `--quiet` → `\"error\"`\n * 4. `HOLOCRON_LOG_LEVEL` env var\n * 5. `holocron.config` `log.level` (`configLevel`)\n *\n * Returns `undefined` when nothing applies — `createLogger` then defaults\n * to `\"info\"`. Resolving the full chain here (rather than passing\n * `configLevel` straight through) keeps config below the env var.\n */\nexport function resolveLogLevel(\n\targv: { verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\tconfigLevel?: LogLevel\n): LogLevel | undefined {\n\tif (argv.log) return argv.log;\n\tif (argv.verbose) return \"debug\";\n\tif (argv.quiet) return \"error\";\n\treturn parseLogLevel(env.get(\"HOLOCRON_LOG_LEVEL\")) ?? configLevel;\n}\n\n/**\n * Resolve whether human-visible console output (pretty or NDJSON) should run\n * at all, independent of level — the `@theholocron/observability`\n * `consoleOutput` override.\n *\n * Local/interactive runs are quiet by default: any raw structured logger\n * output (colorized or not) stays off regardless of the resolved level,\n * unless the user explicitly asked to see it via `--log <level>`,\n * `--verbose`, or `--quiet`. CI is untouched either way — returning\n * `undefined` there preserves `createLogger`'s own `ci`/`tty`\n * auto-detection exactly, so CI's existing NDJSON-to-stdout behavior is\n * unaffected by this flag.\n */\nexport function resolveConsoleOutput(argv: {\n\tverbose?: boolean;\n\tquiet?: boolean;\n\tlog?: LogLevel;\n}): boolean | undefined {\n\tif (argv.log || argv.verbose || argv.quiet) return true;\n\treturn isCI() ? undefined : false;\n}\n\nlet root: { logger: Logger; runId: string } | undefined;\nlet rootLevel: LogLevel | undefined;\nlet rootCommand: string | undefined;\nlet rootAxiomKey: string | undefined;\n\n/**\n * Resolve Axiom credentials for the CLI.\n *\n * A `global`-context command (ADR-0012) always resolves to\n * {@link GLOBAL_AXIOM_DATASET}, ignoring `HOLOCRON_AXIOM_DATASET` /\n * `AXIOM_DATASET` / `holocron.config` `log.axiom.dataset` entirely — it\n * isn't \"about\" any repo, so the active directory's dataset is never the\n * right answer. Everything else keeps the existing chain: env vars win\n * (same contract as `@theholocron/observability`'s `resolveAxiomFromEnv`),\n * falling back to the CLI-only bridge that pairs the OS-keyring token\n * (`axiom.<org>` then bare `axiom`) with a dataset from\n * `HOLOCRON_AXIOM_DATASET` / `AXIOM_DATASET` or `log.axiom.dataset`.\n * Returns `undefined` unless both a token and a dataset are found.\n */\nfunction resolveCliAxiom(opts: BuildCliLoggerOpts): AxiomTransportConfig | undefined {\n\tconst isGlobal = contextForCommand(opts.command ?? rootCommand ?? \"\") === \"global\";\n\n\tif (!isGlobal) {\n\t\tconst fromEnv = resolveAxiomFromEnv();\n\t\tif (fromEnv) return fromEnv;\n\t}\n\n\tconst dataset = isGlobal ? GLOBAL_AXIOM_DATASET : (holocronEnv.get(\"AXIOM_DATASET\") ?? opts.configAxiomDataset);\n\tif (!dataset) return undefined;\n\n\tconst org = opts.org ?? env.get(\"HOLOCRON_ORG\");\n\tconst token = holocronEnv.get(\"AXIOM_TOKEN\") || (org ? getToken(`axiom.${org}`) : null) || getToken(\"axiom\");\n\treturn token ? { dataset, token } : undefined;\n}\n\n/**\n * The process-wide root logger. Built once (from `cli.ts`'s middleware,\n * with the command name + flags + env). Rebuilt at most once more when a\n * command's handler supplies `holocron.config` context the flag/env-only\n * first pass could not have known — `log.level` (unless `--verbose` /\n * `--quiet` already fixed it) or `log.axiom.dataset` + the resolved org\n * for a keyring-backed Axiom transport. That rebuild generates a fresh\n * `runId`, which is harmless: nothing logs between the middleware and the\n * handler.\n */\nexport function buildCliLogger(\n\targv: { verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\topts: BuildCliLoggerOpts = {}\n): { logger: Logger; runId: string } {\n\tconst { command, configLevel } = opts;\n\tif (command) rootCommand = command;\n\tconst level = resolveLogLevel(argv, configLevel);\n\tconst consoleOutput = resolveConsoleOutput(argv);\n\tconst axiom = resolveCliAxiom(opts);\n\tconst axiomKey = axiom?.dataset;\n\tconst rebuildForConfig =\n\t\tconfigLevel !== undefined && level !== rootLevel && !argv.verbose && !argv.quiet && !argv.log;\n\tconst rebuildForAxiom = axiomKey !== undefined && axiomKey !== rootAxiomKey;\n\tif (!root || rebuildForConfig || rebuildForAxiom) {\n\t\tconst built = createLogger({\n\t\t\t...(level ? { level } : {}),\n\t\t\t...(axiom ? { axiom } : {}),\n\t\t\t...(consoleOutput !== undefined ? { consoleOutput } : {}),\n\t\t});\n\t\troot = {\n\t\t\tlogger: rootCommand ? built.logger.child({ command: rootCommand }) : built.logger,\n\t\t\trunId: built.runId,\n\t\t};\n\t\trootLevel = level;\n\t\trootAxiomKey = axiomKey;\n\t}\n\treturn root;\n}\n\n/**\n * Lazily-memoized `Logger` for module-level call sites with no `argv` in\n * scope — notably yargs' own `.fail()` handler, which fires on a\n * pre-middleware validation failure (a missing required argument, an\n * unknown command) and therefore runs before `buildCliLogger` has ever\n * built the real root. Without an explicit `consoleOutput` here, that\n * fallback would use `createLogger`'s bare auto-detection (pretty on any\n * local TTY) and leak a structured block even though no flag asked for one\n * — so it resolves the same \"quiet unless CI\" default `buildCliLogger`\n * would, as if no flags were passed.\n */\nexport function getLogger(): Logger {\n\treturn (root ??= createLogger({ consoleOutput: resolveConsoleOutput({}) })).logger;\n}\n\n/**\n * Report a fatal, command-ending CLI error: always printed to the console\n * (regardless of `consoleOutput` suppression) via `style.fail`, and also\n * sent through the structured logger for Axiom/telemetry visibility.\n *\n * Use this when a handler is returning or exiting right here with nothing\n * else for the user to see — a resolved `--token` failure, a yargs\n * validation failure, a thrown domain error. Don't use it for a per-step\n * warning inside a multi-step orchestrator that already prints its own\n * `ok / fail / skip` summary — that summary is the user-facing signal;\n * the per-step reason belongs in the structured log alone.\n */\nexport function reportError(message: string, log: Logger = getLogger()): void {\n\tconsole.error(style.fail(message));\n\tlog.error(message);\n}\n\n/** The current root logger's correlation id, if a root has been built. */\nexport function getRunId(): string | undefined {\n\treturn root?.runId;\n}\n\n/** Test hook — drop the memoized root so the next call rebuilds it. */\nexport function resetCliLogger(): void {\n\troot = undefined;\n\trootLevel = undefined;\n\trootCommand = undefined;\n\trootAxiomKey = undefined;\n}\n","/**\n * `PluginLoader` — loads provider plugins per the resolved config and\n * builds a typed capability registry the runtime can query.\n *\n * Flow:\n * 1. Walk `config.providers[*]` from `resolveConfig()`\n * 2. For each entry, dynamic-import the resolved package name\n * (`@theholocron/holocron-plugin-<provider>` by default)\n * 3. Call the package's exported `createPlugin(options)` to get a\n * plugin object whose `capabilities` map holds factories\n * 4. Invoke the matching capability factory and stash the impl in\n * the registry — single-cardinality entries hold one impl,\n * many-cardinality entries hold an array\n *\n * A package may instead export a capability config (see\n * `CapabilityConfigPackage` in config.ts). The loader detects the shape\n * at import time and re-resolves to the underlying plugin, merging the\n * preset options with any per-project overrides from the config file\n * (project options win, mirroring ESLint's `extends` precedence).\n *\n * Loader keeps NO knowledge of vendor tokens. Each plugin reads its\n * own env vars (`HOLOCRON_ADMIN_TOKEN`, `HOLOCRON_VERCEL_TOKEN`, etc.)\n * inside its `createPlugin`. That keeps the loader vendor-agnostic\n * and the auth story per-plugin explicit.\n *\n * `importer` is injectable so tests don't need real network or\n * sibling packages installed.\n */\n\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport {\n\ttype CapabilityConfigPackage,\n\ttype ResolvedHolocronConfig,\n\ttype ResolvedTuple,\n\tresolvePluginPackage,\n} from \"../../config/config/index.js\";\nimport {\n\ttype CapabilityKey,\n\tCARDINALITY,\n\ttype CardinalityFor,\n\ttype ResolvedCapability,\n} from \"../capabilities/index.js\";\nimport type { PluginImporter, PluginLoadFailure, PluginModule, RuntimeContext } from \"./loader.type.js\";\n\nexport class LoaderError extends Error {\n\toverride name = \"LoaderError\";\n}\n\nexport class PluginLoader {\n\tprivate readonly registry = new Map<CapabilityKey, unknown>();\n\tprivate readonly failures: PluginLoadFailure[] = [];\n\n\tconstructor(\n\t\tprivate readonly config: ResolvedHolocronConfig,\n\t\tprivate readonly context: RuntimeContext,\n\t\tprivate readonly importer: PluginImporter = defaultImporter\n\t) {}\n\n\t/**\n\t * Imports every configured plugin and builds the capability registry.\n\t *\n\t * Never throws for a single plugin's failure — a missing vendor token,\n\t * an uninstalled package, or an unimplemented capability records a\n\t * {@link PluginLoadFailure} and the load continues. This is the\n\t * \"soft-skip over hard-fail\" contract: a command that needs a\n\t * capability learns it is absent via `has()` / `get()` (which\n\t * re-surfaces the original error), and orchestrators report the skip\n\t * in their summary. Inspect {@link loadFailures} for the full list.\n\t */\n\tasync load(): Promise<void> {\n\t\tconst entries = Object.entries(this.config.providers) as Array<\n\t\t\t[CapabilityKey, ResolvedHolocronConfig[\"providers\"][CapabilityKey]]\n\t\t>;\n\n\t\tfor (const [key, entry] of entries) {\n\t\t\tif (!entry) continue;\n\t\t\tif (entry.cardinality === \"single\") {\n\t\t\t\ttry {\n\t\t\t\t\tthis.registry.set(key, await this.loadOne(key, entry.tuple));\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthis.recordFailure(key, entry.tuple, err);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst impls: unknown[] = [];\n\t\t\t\tfor (const tuple of entry.tuples) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\timpls.push(await this.loadOne(key, tuple));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tthis.recordFailure(key, tuple, err);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (impls.length > 0) this.registry.set(key, impls);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate recordFailure(key: CapabilityKey, tuple: ResolvedTuple, err: unknown): void {\n\t\tthis.failures.push({\n\t\t\tkey,\n\t\t\tprovider: tuple.provider,\n\t\t\tpackageName: tuple.packageName,\n\t\t\terror: err instanceof Error ? err : new Error(String(err)),\n\t\t});\n\t}\n\n\t/** Providers that failed to load during {@link load}. Empty on a clean load. */\n\tloadFailures(): readonly PluginLoadFailure[] {\n\t\treturn this.failures;\n\t}\n\n\t/**\n\t * Type-safe lookup. Single-cardinality keys return one impl;\n\t * many-cardinality keys return an array. `ResolvedCapability<K>`\n\t * encodes the split via the `CARDINALITY` map.\n\t */\n\tget<K extends CapabilityKey>(key: K): ResolvedCapability<K> {\n\t\tconst impl = this.registry.get(key);\n\t\tif (impl === undefined) {\n\t\t\t// If the plugin was configured but failed to load, re-surface the\n\t\t\t// original error (e.g. `AuthError: no Vercel token found`) rather\n\t\t\t// than a generic \"not loaded\" — single-capability commands then\n\t\t\t// give the operator an actionable message.\n\t\t\tconst failure = this.failures.find((f) => f.key === key);\n\t\t\tif (failure) throw failure.error;\n\t\t\tthrow new LoaderError(`capability \\`${key}\\` is not loaded — is it declared in holocron.config.json?`);\n\t\t}\n\t\treturn impl as ResolvedCapability<K>;\n\t}\n\n\t/** Whether a capability has been loaded. */\n\thas<K extends CapabilityKey>(key: K): boolean {\n\t\treturn this.registry.has(key);\n\t}\n\n\t/** All capability keys currently loaded. Useful for the doctor command. */\n\tloadedKeys(): CapabilityKey[] {\n\t\treturn Array.from(this.registry.keys());\n\t}\n\n\t/** Internal — invoke a plugin's capability factory and return the impl. */\n\tprivate async loadOne(key: CapabilityKey, tuple: ResolvedTuple): Promise<unknown> {\n\t\tconst mod = await this.importer(tuple.packageName).catch((err: unknown) => {\n\t\t\tthrow new LoaderError(\n\t\t\t\t`failed to import \\`${tuple.packageName}\\` for capability \\`${key}\\`: ${errorMessage(err)}`\n\t\t\t);\n\t\t});\n\n\t\t// Plugin package: exports createPlugin(opts) → { capabilities }\n\t\tif (isPluginModule(mod)) {\n\t\t\t// Resolve the effective token for this specific plugin.\n\t\t\t// cliTokens[provider] wins over the bare cliToken fallback.\n\t\t\tconst effectiveToken = this.context.cliTokens?.[tuple.provider] ?? this.context.cliToken;\n\n\t\t\t// Precedence (later wins): project-level defaults from config →\n\t\t\t// runtime context (CLI flags: --repo, --token) → per-plugin\n\t\t\t// resolved token → tuple options (per-plugin overrides in config).\n\t\t\t// cliTokens is explicitly cleared so the map never reaches plugins.\n\t\t\tconst plugin = mod.createPlugin({\n\t\t\t\t...this.projectDefaults(),\n\t\t\t\t...this.context,\n\t\t\t\t...(effectiveToken !== undefined ? { cliToken: effectiveToken } : {}),\n\t\t\t\tcliTokens: undefined,\n\t\t\t\t...tuple.options,\n\t\t\t});\n\t\t\tconst factory = plugin.capabilities[key];\n\t\t\tif (typeof factory !== \"function\") {\n\t\t\t\tthrow new LoaderError(`\\`${tuple.packageName}\\` does not implement the \\`${key}\\` capability`);\n\t\t\t}\n\t\t\treturn factory();\n\t\t}\n\n\t\t// Capability config package: default export is { provider, options? }.\n\t\t// Re-resolve to the underlying plugin; preset options are the base,\n\t\t// per-project tuple options override them (ESLint extends precedence).\n\t\tif (isCapabilityConfigModule(mod)) {\n\t\t\tconst cap = (mod as { default: CapabilityConfigPackage }).default;\n\t\t\treturn this.loadOne(key, {\n\t\t\t\tprovider: cap.provider,\n\t\t\t\tpackageName: resolvePluginPackage(cap.provider),\n\t\t\t\toptions: { ...cap.options, ...tuple.options },\n\t\t\t});\n\t\t}\n\n\t\tthrow new LoaderError(\n\t\t\t`\\`${tuple.packageName}\\` does not export \\`createPlugin(options)\\` or a capability config ({ provider, options? })`\n\t\t);\n\t}\n\n\t/**\n\t * Project-level defaults that get merged into every plugin's options\n\t * unless overridden by the CLI context or per-plugin tuple options.\n\t * See `docs/wiki/specifications/tech-setup-and-config.spec.md` §Design.\n\t */\n\tprivate projectDefaults(): Partial<RuntimeContext> {\n\t\tconst defaults: Partial<RuntimeContext> = {};\n\t\tif (this.config.repo?.name) defaults.repo = this.config.repo.name;\n\t\treturn defaults;\n\t}\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\n/** Default importer — resolves from cwd first so the global CLI finds project plugins. */\nconst defaultImporter: PluginImporter = async (pkg) => {\n\ttry {\n\t\tconst localRequire = createRequire(process.cwd() + \"/\");\n\t\tconst resolved = localRequire.resolve(pkg);\n\t\treturn import(pathToFileURL(resolved).href);\n\t} catch {\n\t\treturn import(pkg);\n\t}\n};\n\nfunction isPluginModule(mod: unknown): mod is PluginModule {\n\treturn typeof (mod as PluginModule).createPlugin === \"function\";\n}\n\nfunction isCapabilityConfigModule(mod: unknown): mod is { default: CapabilityConfigPackage } {\n\tconst def = (mod as { default?: unknown }).default;\n\treturn typeof (def as CapabilityConfigPackage)?.provider === \"string\";\n}\n\n/** Convenience re-export so callers can compute counts without importing CARDINALITY directly. */\nexport function cardinalityOf<K extends CapabilityKey>(key: K): CardinalityFor<K> {\n\treturn CARDINALITY[key];\n}\n","/**\n * Runs a `MonitoringCheckInput` directly over HTTP, with no vendor API\n * call at all — the local counterpart to a provider's `ensureCheck()`.\n *\n * Exists for `holocron monitoring check <url>` (holocron#1010): testing\n * a PR's Vercel preview deployment against the exact same check\n * definitions already configured for production in `holocron.config.ts`,\n * without creating a persistent resource on the vendor's platform for an\n * ephemeral, per-PR run.\n *\n * No comparison logic exists anywhere else in this codebase to reuse —\n * Checkly's own API evaluates `assertions` server-side, so this is a\n * fresh implementation of the same vendor-neutral vocabulary\n * (`MonitoringAssertionSource`/`MonitoringAssertionComparison`) `src/\n * plugin/capabilities.ts` already defines. The `shouldFail` semantics\n * mirror Checkly's documented platform behavior (ADR-0013): a response\n * status >= 400 is an automatic failure unless the check's own healthy\n * response is itself an error status.\n *\n * Hardening, all driven by this running against a URL the triggering\n * event controls (a PR's preview deployment), not a trusted static\n * config value (sourcery review on holocron#1011):\n * - `redirect: \"manual\"` — a check never follows a redirect to\n * whatever host the response names. The 3xx itself is what gets\n * evaluated; that's also more correct for a monitoring check\n * anyway (silently following would hide a real regression).\n * - A request deadline (`AbortSignal.timeout`) — a preview that\n * accepts the request but never finishes can't hang the check (or\n * the ones after it) past the timeout.\n * - The body is only read when an assertion actually needs it, and\n * even then capped at `maxBodyBytes` — an attacker-reachable\n * endpoint can't use an unbounded response to exhaust the runner.\n */\n\nimport type {\n\tMonitoringAssertion,\n\tMonitoringAssertionComparison,\n\tMonitoringCheckInput,\n} from \"../capabilities/index.js\";\nimport type { CheckRunResult, RunCheckOptions } from \"./run-check.type.js\";\n\nexport async function runCheckAgainstUrl(\n\tinput: MonitoringCheckInput,\n\topts: RunCheckOptions = {}\n): Promise<CheckRunResult> {\n\tconst doFetch = opts.fetch ?? fetch;\n\tconst url = resolveUrl(input.url, opts.url);\n\tconst method = input.method ?? \"GET\";\n\t// GET/HEAD with a body throws a TypeError at the Fetch layer — the\n\t// config type permits the combination, but neither method has body\n\t// semantics, so the body is simply not meaningful to send for them.\n\tconst hasBody = input.body !== undefined && method !== \"GET\" && method !== \"HEAD\";\n\tconst needsBody = (input.assertions ?? []).some((a) => a.source === \"body\");\n\tconst start = Date.now();\n\n\tlet response: Response;\n\tlet bodyText = \"\";\n\ttry {\n\t\tresponse = await doFetch(url, {\n\t\t\tmethod,\n\t\t\t...(hasBody ? { body: input.body } : {}),\n\t\t\tredirect: \"manual\",\n\t\t\tsignal: AbortSignal.timeout(opts.timeoutMs ?? 10_000),\n\t\t});\n\t\tif (needsBody) bodyText = await readBodyCapped(response, opts.maxBodyBytes ?? 1_000_000);\n\t} catch (err) {\n\t\treturn { passed: false, failures: [], requestError: requestErrorMessage(err) };\n\t}\n\tconst responseTimeMs = Date.now() - start;\n\n\tconst failures: string[] = [];\n\n\t// Mirrors Checkly's own platform-level classification (ADR-0013): a\n\t// >=400 response is a failure before any assertion runs, unless the\n\t// check's own healthy response IS an error status.\n\tif (!input.shouldFail && response.status >= 400) {\n\t\tfailures.push(`HTTP ${response.status} (>= 400 counts as a failure unless \\`shouldFail\\` is set)`);\n\t}\n\n\tfor (const assertion of input.assertions ?? []) {\n\t\tconst actual = extractActual(assertion, { response, bodyText, responseTimeMs });\n\t\tif (!evaluate(assertion.comparison, actual, assertion.target)) {\n\t\t\tfailures.push(\n\t\t\t\t`${assertion.source} ${assertion.comparison} \"${assertion.target ?? \"\"}\" — got \"${truncate(actual)}\"`\n\t\t\t);\n\t\t}\n\t}\n\n\treturn { passed: failures.length === 0, status: response.status, responseTimeMs, failures };\n}\n\n/** Swaps in `overrideUrl`'s origin, keeping `originalUrl`'s own path + query. */\nfunction resolveUrl(originalUrl: string, overrideUrl: string | undefined): string {\n\tif (!overrideUrl) return originalUrl;\n\tconst original = new URL(originalUrl);\n\tconst resolved = new URL(overrideUrl);\n\tresolved.pathname = original.pathname;\n\tresolved.search = original.search;\n\treturn resolved.toString();\n}\n\nfunction requestErrorMessage(err: unknown): string {\n\tif (err instanceof Error) {\n\t\treturn err.name === \"TimeoutError\" ? `request timed out: ${err.message}` : err.message;\n\t}\n\treturn String(err);\n}\n\n/** Reads up to `maxBytes` of the response body, discarding the rest — a large/unending body can't exhaust memory. */\nasync function readBodyCapped(response: Response, maxBytes: number): Promise<string> {\n\tif (!response.body) return \"\";\n\tconst reader = response.body.getReader();\n\tconst chunks: Uint8Array[] = [];\n\tlet total = 0;\n\ttry {\n\t\tfor (;;) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tconst remaining = maxBytes - total;\n\t\t\tif (remaining <= 0) break;\n\t\t\tconst stored = value.length > remaining ? value.slice(0, remaining) : value;\n\t\t\tchunks.push(stored);\n\t\t\ttotal += stored.length;\n\t\t}\n\t} finally {\n\t\tawait reader.cancel().catch(() => {});\n\t}\n\treturn Buffer.concat(chunks.map((c) => Buffer.from(c))).toString(\"utf8\");\n}\n\n/** Keeps a failure message readable when `actual` is a full HTML/JSON response body. */\nfunction truncate(value: string, max = 200): string {\n\treturn value.length > max ? `${value.slice(0, max)}…` : value;\n}\n\nfunction extractActual(\n\tassertion: MonitoringAssertion,\n\tctx: { response: Response; bodyText: string; responseTimeMs: number }\n): string {\n\tswitch (assertion.source) {\n\t\tcase \"status_code\":\n\t\t\treturn String(ctx.response.status);\n\t\tcase \"response_time\":\n\t\t\treturn String(ctx.responseTimeMs);\n\t\tcase \"body\":\n\t\t\treturn ctx.bodyText;\n\t\tcase \"header\": {\n\t\t\t// Headers.get(\"\") throws (empty string is an invalid header\n\t\t\t// name per the Fetch spec) — short-circuit before calling it.\n\t\t\tconst name = assertion.property ?? \"\";\n\t\t\treturn name ? (ctx.response.headers.get(name) ?? \"\") : \"\";\n\t\t}\n\t}\n}\n\nfunction evaluate(comparison: MonitoringAssertionComparison, actual: string, target: string | undefined): boolean {\n\tconst t = target ?? \"\";\n\tswitch (comparison) {\n\t\tcase \"equals\":\n\t\t\treturn actual === t;\n\t\tcase \"not_equals\":\n\t\t\treturn actual !== t;\n\t\tcase \"contains\":\n\t\t\treturn actual.includes(t);\n\t\tcase \"not_contains\":\n\t\t\treturn !actual.includes(t);\n\t\tcase \"greater_than\":\n\t\t\treturn Number(actual) > Number(t);\n\t\tcase \"less_than\":\n\t\t\treturn Number(actual) < Number(t);\n\t}\n}\n","/**\n * The `workspace`-context guard.\n *\n * A `workspace` command (`sync`, `setup`, `doctor`, …) needs the\n * configured providers' `@theholocron/holocron-plugin-*` packages to\n * resolve. From a bare `npm i -g @theholocron/cli` they don't, and the\n * {@link PluginLoader} — which soft-skips every failure — leaves the\n * command with an empty registry and a stack of `Cannot find package`\n * errors.\n *\n * {@link assertPluginsResolvable} turns that specific situation (every\n * provider failed, and every failure is a module-resolution failure)\n * into one actionable {@link WorkspaceContextError} the CLI prints\n * instead of a stack trace. Any other mix — some plugins loaded, or a\n * failure that's an auth/token error rather than a missing package —\n * is left alone for the command's own soft-skip reporting.\n *\n * Spec: `docs/wiki/specifications/tech-cli-execution-contexts.spec.md`\n * (theholocron/holocron#576).\n */\n\nimport { LoaderError, type PluginLoader } from \"../loader/index.js\";\n\n/**\n * Raised when a `workspace` command runs somewhere its provider plugins\n * cannot be resolved — the \"you're on a global install\" case. Carries the\n * unresolved package names so the message can be specific.\n */\nexport class WorkspaceContextError extends Error {\n\toverride name = \"WorkspaceContextError\";\n\treadonly command: string;\n\treadonly packages: readonly string[];\n\n\tconstructor(command: string, packages: readonly string[]) {\n\t\tconst [first, ...rest] = packages;\n\t\tconst subject =\n\t\t\trest.length > 0\n\t\t\t\t? `${first} (and ${rest.length} other${rest.length === 1 ? \"\" : \"s\"})`\n\t\t\t\t: (first ?? \"its plugins\");\n\t\tsuper(\n\t\t\t`\\`${command}\\` needs ${subject}, but no plugin package resolves here.\\n` +\n\t\t\t\t`Run it from a repo that has the \\`@theholocron/holocron-plugin-*\\` packages as devDependencies, ` +\n\t\t\t\t`or \\`pnpm exec holocron ${command}\\`. A global install can't resolve them — see ` +\n\t\t\t\t`https://theholocron.github.io/holocron/execution-contexts`\n\t\t);\n\t\tthis.command = command;\n\t\tthis.packages = packages;\n\t}\n}\n\n/**\n * A raw \"package isn't installed here\" error from `import()` /\n * `require.resolve` — `ERR_MODULE_NOT_FOUND` / `MODULE_NOT_FOUND`, or the\n * \"Cannot find package/module\" message Node prints for it.\n */\nexport function isModuleNotFound(err: unknown): boolean {\n\tif (!(err instanceof Error)) return false;\n\tconst code = (err as NodeJS.ErrnoException).code;\n\tif (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") return true;\n\treturn /Cannot find (?:package|module)|MODULE_NOT_FOUND/.test(err.message);\n}\n\n/** Did this failure come from the dynamic `import()` not finding the package? */\nfunction isImportFailure(err: Error): boolean {\n\treturn err instanceof LoaderError && err.message.startsWith(\"failed to import\");\n}\n\n/**\n * Throw {@link WorkspaceContextError} when a loaded `PluginLoader` shows\n * the global-install signature: nothing in the registry, at least one\n * failure, and *every* failure is a missing-package error. A no-op in\n * every other case (some capability loaded, non-import failure, or no\n * providers configured at all).\n *\n * Call it right after `await loader.load()` in a `workspace` command.\n */\nexport function assertPluginsResolvable(loader: PluginLoader, command: string): void {\n\tif (loader.loadedKeys().length > 0) return;\n\tconst failures = loader.loadFailures();\n\tif (failures.length === 0) return;\n\tif (!failures.every((f) => isImportFailure(f.error))) return;\n\n\tconst packages = [...new Set(failures.map((f) => f.packageName))];\n\tthrow new WorkspaceContextError(command, packages);\n}\n","/**\n * `holocron auth <subcommand>` — manage bootstrap credentials in the\n * OS keyring.\n *\n * Subcommands:\n * auth set <provider> [token] verify + store\n * auth unset <provider> remove\n * auth check <provider> re-verify a stored token\n * auth list every provider with a stored entry\n *\n * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md`.\n *\n * Verification lives in each plugin as a top-level `verifyToken(token)`\n * export. The auth command dynamically imports\n * `@theholocron/holocron-plugin-<provider>` and calls it. Plugins that\n * don't export `verifyToken` can still store — with a warning — because\n * \"no verify path\" shouldn't block credential storage.\n */\n\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { withEnvPrefix } from \"@theholocron/env-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { deleteToken, getToken, listStoredProviders, setToken } from \"../../auth/index.js\";\nimport { resolvePluginPackage } from \"../../config/index.js\";\nimport { makeEnv } from \"../../env/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { isModuleNotFound } from \"../../plugin/index.js\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport type {\n\tAuthCommandStatus,\n\tAuthImporter,\n\tAuthPluginModule,\n\tRunAuthCheckInput,\n\tRunAuthListInput,\n\tRunAuthSetInput,\n\tRunAuthUnsetInput,\n} from \"./auth.type.js\";\n\nconst defaultImporter: AuthImporter = async (pkg) => {\n\ttry {\n\t\tconst localRequire = createRequire(process.cwd() + \"/\");\n\t\tconst resolved = localRequire.resolve(pkg);\n\t\treturn (await import(pathToFileURL(resolved).href)) as AuthPluginModule;\n\t} catch {\n\t\treturn (await import(pkg)) as AuthPluginModule;\n\t}\n};\n\n// ── Token resolution ─────────────────────────────────────────────────\n\n/**\n * Resolve a token from (positional → HOLOCRON_<X> → vendor-native env).\n * Keyring is NOT consulted here — `auth set` writes TO the keyring, so\n * pulling FROM it would just re-store the same value.\n */\nexport function resolveAuthSetToken(input: {\n\tprovider: string;\n\tpositional?: string;\n\tenv?: NodeJS.ProcessEnv;\n}): string | null {\n\tconst e = withEnvPrefix(makeEnv(input.env), \"HOLOCRON\");\n\treturn input.positional || e.get(`${input.provider.toUpperCase()}_TOKEN`) || null;\n}\n\nexport async function runAuthSet(input: RunAuthSetInput): Promise<AuthCommandStatus> {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst importer = input.importer ?? defaultImporter;\n\tconst { provider } = input;\n\tconst keyringKey = input.org ? `${provider}.${input.org}` : provider;\n\n\tconst token = resolveAuthSetToken({ provider, positional: input.positional, env: input.env });\n\n\t// Feature sub-keys (e.g. \"github.read\") are stored directly — there is no\n\t// per-feature plugin package to load for verification.\n\tconst isFeatureKey = provider.includes(\".\");\n\tconst packageName = isFeatureKey ? null : resolvePluginPackage(provider);\n\n\tif (!token) {\n\t\tprint(style.fail(`no token supplied for \\`${keyringKey}\\`.`));\n\t\tprint(style.hint(` pass as positional arg: holocron auth set ${provider} <token>`));\n\t\tif (!isFeatureKey) {\n\t\t\tprint(\n\t\t\t\tstyle.hint(` or via env: HOLOCRON_${provider.toUpperCase()}_TOKEN / ${provider.toUpperCase()}_TOKEN`)\n\t\t\t);\n\t\t\tconst hint = await tryLoadHint(importer, packageName!);\n\t\t\tif (hint) {\n\t\t\t\tprint(style.hint(` hint: ${hint}`));\n\t\t\t}\n\t\t}\n\t\tlogger.warn({ provider, keyringKey, reason: \"no token supplied\" }, `auth set: ${keyringKey}`);\n\t\treturn { status: \"fail\", message: \"no token supplied\" };\n\t}\n\n\t// Verify via the plugin if it exports verifyToken (skipped for feature sub-keys).\n\tlet subject: string | undefined;\n\tif (!isFeatureKey && packageName) {\n\t\ttry {\n\t\t\tconst module = await importer(packageName);\n\t\t\tif (typeof module.verifyToken === \"function\") {\n\t\t\t\tconst verified = await module.verifyToken(token);\n\t\t\t\tif (!verified.ok) {\n\t\t\t\t\tprint(style.fail(`token rejected by ${provider}: ${verified.message}`));\n\t\t\t\t\tif (module.AUTH_HINT) print(style.hint(` hint: ${module.AUTH_HINT}`));\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t{ provider, keyringKey, verified: false, reason: verified.message },\n\t\t\t\t\t\t`auth set: ${keyringKey}`\n\t\t\t\t\t);\n\t\t\t\t\treturn { status: \"fail\", message: verified.message };\n\t\t\t\t}\n\t\t\t\tsubject = verified.subject;\n\t\t\t} else {\n\t\t\t\tprint(style.warn(`${provider} plugin has no verifyToken; storing without verification`));\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst msg = errorMessage(err);\n\t\t\tprint(style.warn(`cannot verify token — failed to load ${packageName}: ${msg}`));\n\t\t\tprint(\n\t\t\t\tstyle.hint(` storing token anyway; run 'holocron auth check ${provider}' once the plugin is installed`)\n\t\t\t);\n\t\t}\n\t}\n\n\tconst stored = setToken(keyringKey, token);\n\tif (!stored) {\n\t\tprint(style.fail(`keyring unavailable — token not stored. Use env vars instead.`));\n\t\tlogger.warn({ provider, keyringKey, reason: \"keyring unavailable\" }, `auth set: ${keyringKey}`);\n\t\treturn { status: \"fail\", message: \"keyring unavailable\" };\n\t}\n\n\tprint(style.success(`stored ${keyringKey} token${subject ? ` (${subject})` : \"\"}`));\n\tlogger.info(\n\t\t{ provider, keyringKey, verified: subject !== undefined, ...(subject ? { subject } : {}), status: \"ok\" },\n\t\t`auth set: ${keyringKey}`\n\t);\n\treturn { status: \"ok\", ...(subject ? { message: subject } : {}) };\n}\n\nexport function runAuthUnset(input: RunAuthUnsetInput): AuthCommandStatus {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst removed = deleteToken(input.provider);\n\tif (removed) {\n\t\tprint(style.success(`removed ${input.provider} token`));\n\t\tlogger.info({ provider: input.provider, status: \"ok\" }, `auth unset: ${input.provider}`);\n\t\treturn { status: \"ok\" };\n\t}\n\tprint(style.dim(`no stored token for ${input.provider}`));\n\tlogger.info({ provider: input.provider, status: \"skip\" }, `auth unset: ${input.provider}`);\n\treturn { status: \"skip\", message: \"nothing to remove\" };\n}\n\nexport async function runAuthCheck(input: RunAuthCheckInput): Promise<AuthCommandStatus> {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst importer = input.importer ?? defaultImporter;\n\tconst { provider } = input;\n\tconst keyringKey = input.org ? `${provider}.${input.org}` : provider;\n\n\tconst token = getToken(keyringKey);\n\tif (!token) {\n\t\tprint(style.dim(`no stored token for ${keyringKey}`));\n\t\tlogger.info({ provider, keyringKey, status: \"skip\", reason: \"no stored token\" }, `auth check: ${keyringKey}`);\n\t\treturn { status: \"skip\", message: \"no stored token\" };\n\t}\n\n\t// Feature sub-keys have no plugin to verify against — report stored only.\n\tif (provider.includes(\".\")) {\n\t\tprint(style.success(`${keyringKey}: token stored (feature key — no plugin verification)`));\n\t\treturn { status: \"ok\", message: \"stored\" };\n\t}\n\n\tconst packageName = resolvePluginPackage(provider);\n\ttry {\n\t\tconst module = await importer(packageName);\n\t\tif (typeof module.verifyToken !== \"function\") {\n\t\t\tprint(style.warn(`${keyringKey}: token stored (plugin has no verifyToken; can't confirm validity)`));\n\t\t\treturn { status: \"ok\", message: \"stored, unverified\" };\n\t\t}\n\t\tconst verify = () => module.verifyToken!(token);\n\t\tconst verified =\n\t\t\tinput.showSpinner !== false ? await withSpinner(`Verifying ${keyringKey} token…`, verify) : await verify();\n\t\tif (verified.ok) {\n\t\t\tprint(style.success(`${keyringKey}: ok — ${verified.subject}`));\n\t\t\tlogger.info(\n\t\t\t\t{ provider, keyringKey, verified: true, subject: verified.subject, status: \"ok\" },\n\t\t\t\t`auth check: ${keyringKey}`\n\t\t\t);\n\t\t\treturn { status: \"ok\", message: verified.subject };\n\t\t}\n\t\tprint(style.fail(`${keyringKey}: rejected — ${verified.message}`));\n\t\tif (module.AUTH_HINT) print(style.hint(` hint: ${module.AUTH_HINT}`));\n\t\tlogger.warn(\n\t\t\t{ provider, keyringKey, verified: false, reason: verified.message, status: \"fail\" },\n\t\t\t`auth check: ${keyringKey}`\n\t\t);\n\t\treturn { status: \"fail\", message: verified.message };\n\t} catch (err) {\n\t\tconst msg = errorMessage(err);\n\t\t// Global install: the plugin package isn't resolvable here. `auth set` /\n\t\t// `auth list` already work plugin-free — `auth check` degrades to the\n\t\t// same \"we have a token, we just can't confirm it\" report rather than\n\t\t// failing outright (theholocron/holocron#576).\n\t\tif (isModuleNotFound(err)) {\n\t\t\tprint(style.warn(`${keyringKey}: token present — verification skipped (plugin not available here)`));\n\t\t\tlogger.info(\n\t\t\t\t{ provider, keyringKey, status: \"ok\", reason: \"plugin not resolvable\" },\n\t\t\t\t`auth check: ${keyringKey}`\n\t\t\t);\n\t\t\treturn { status: \"ok\", message: \"stored, unverified (plugin not available)\" };\n\t\t}\n\t\tprint(style.fail(`${keyringKey}: cannot verify — ${msg}`));\n\t\tlogger.warn({ provider, keyringKey, reason: msg, status: \"fail\" }, `auth check: ${keyringKey}`);\n\t\treturn { status: \"fail\", message: msg };\n\t}\n}\n\nexport async function runAuthList(input: RunAuthListInput = {}): Promise<AuthCommandStatus> {\n\tconst print = input.print ?? ((l: string) => console.log(l));\n\tconst logger = input.logger ?? getLogger();\n\tconst importer = input.importer ?? defaultImporter;\n\tconst providers = listStoredProviders();\n\n\tif (providers.length === 0) {\n\t\tprint(style.dim(\"no stored tokens.\"));\n\t\tprint(style.hint(\"run: holocron auth set <provider> <token>\"));\n\t\tlogger.info({ providers: 0 }, \"auth list: done\");\n\t\treturn { status: \"ok\", message: \"none\" };\n\t}\n\n\tlet ok = 0;\n\tlet fail = 0;\n\tfor (const provider of providers.sort()) {\n\t\tconst check = await runAuthCheck({ provider, importer, print: () => {}, logger, showSpinner: false });\n\t\tconst label = `${provider}${check.message ? ` — ${check.message}` : \"\"}`;\n\t\tif (check.status === \"ok\") {\n\t\t\tok += 1;\n\t\t\tprint(` ${style.success(label)}`);\n\t\t} else if (check.status === \"fail\") {\n\t\t\tfail += 1;\n\t\t\tprint(` ${style.fail(label)}`);\n\t\t} else print(` ${style.dim(`· ${label}`)}`);\n\t}\n\tlogger.info({ providers: providers.length, ok, fail }, \"auth list: done\");\n\treturn { status: \"ok\" };\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\nasync function tryLoadHint(importer: AuthImporter, packageName: string): Promise<string | null> {\n\ttry {\n\t\tconst module = await importer(packageName);\n\t\treturn module.AUTH_HINT ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import { checkbox } from \"@inquirer/prompts\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Deployment,\n\ttype DeploymentRecord,\n\tPluginLoader,\n\ttype PullRequest,\n\ttype Source,\n} from \"../../plugin/index.js\";\nimport { style } from \"../../ui/index.js\";\nimport type { CleanupPreviewReport, RunCleanupPreviewInput } from \"./cleanup-preview.type.js\";\n\nfunction prStateLabel(pr: PullRequest): string {\n\tif (pr.merged) return style.success(\"merged\");\n\tif (pr.state === \"closed\") return style.dim(\"closed (not merged)\");\n\treturn style.warn(\"open\");\n}\n\nexport async function runCleanupPreview(input: RunCleanupPreviewInput): Promise<CleanupPreviewReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\t// c8 ignore next -- real PluginLoader construction is integration-level; unit tests always supply loader\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"deploy cleanup-preview\");\n\tlogger.info({ pr: input.prNumber, project: input.project }, \"cleanup-preview: start\");\n\n\t// ── 1. Look up the PR ───────────────────────────────────────────────\n\tif (!loader.has(\"source\")) {\n\t\tthrow new Error(\"source capability is not configured — add a source provider to holocron.config.json\");\n\t}\n\tconst source = loader.get(\"source\") as Source;\n\tif (!source.getPullRequest) {\n\t\tthrow new Error(`${source.providerName} source provider does not support getPullRequest`);\n\t}\n\n\tlet pr: PullRequest;\n\ttry {\n\t\tpr = await source.getPullRequest(input.prNumber, input.repo);\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tthrow new Error(`Failed to fetch PR #${input.prNumber}: ${message}`, { cause: err });\n\t}\n\n\t// Derive the Cloudflare branch alias from the repo name and PR number.\n\t// Matches the convention the deploy-preview workflow uses:\n\t// --branch ${{ github.event.repository.name }}-pr-${{ github.event.pull_request.number }}\n\tconst repoName = (input.repo ?? input.loaded.resolved.repo?.name ?? \"\").split(\"/\").pop()!;\n\tconst branch = `${repoName}-pr-${pr.number}`;\n\n\tprint(\"\");\n\tprint(`${style.header(`PR #${pr.number}`)} — ${pr.title}`);\n\tprint(` Status : ${prStateLabel(pr)} | Branch : ${style.dim(pr.branch)}`);\n\tprint(` URL : ${style.dim(pr.url)}`);\n\tprint(` CF alias : ${style.dim(branch)}`);\n\tprint(\"\");\n\n\t// ── 2. List deployments ─────────────────────────────────────────────\n\tif (!loader.has(\"deployment\")) {\n\t\tthrow new Error(\"deployment capability is not configured — add a deployment provider to holocron.config.json\");\n\t}\n\tconst deploy = loader.get(\"deployment\") as Deployment;\n\tif (!deploy.listPreviewDeployments || !deploy.deletePreviewDeployments) {\n\t\tthrow new Error(`${deploy.providerName} deployment provider does not support preview cleanup`);\n\t}\n\n\tlet deployments: DeploymentRecord[];\n\ttry {\n\t\tdeployments = await deploy.listPreviewDeployments(input.project, branch);\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tthrow new Error(`Failed to list deployments: ${message}`, { cause: err });\n\t}\n\n\tif (deployments.length === 0) {\n\t\tprint(style.dim(`No deployments found for branch ${branch}.`));\n\t\tlogger.info({ pr: pr.number, branch, found: 0, deleted: 0, status: \"none\" }, \"cleanup-preview: done\");\n\t\treturn { pr, branch, found: 0, deleted: 0, status: \"none\" };\n\t}\n\n\tprint(`Found ${deployments.length} deployment${deployments.length === 1 ? \"\" : \"s\"} for ${style.dim(branch)}:`);\n\tprint(\"\");\n\n\tif (pr.state === \"open\") {\n\t\tprint(\n\t\t\tstyle.warn(\n\t\t\t\t`PR #${pr.number} is still open. Deleting its preview deployments will break the live preview link.`\n\t\t\t)\n\t\t);\n\t\tprint(style.warn(\"Nothing is pre-selected — check the deployments you want to remove.\"));\n\t\tprint(\"\");\n\t}\n\n\t// ── 3. Interactive selection ────────────────────────────────────────\n\tconst choices = deployments.map((d) => {\n\t\tconst label = d.id.includes(\":\") ? d.id.split(\":\").pop()! : d.id;\n\t\tconst date = d.createdAt ? style.dim(d.createdAt.slice(0, 10)) : \"\";\n\t\treturn {\n\t\t\tname: `${label} ${date} ${style.dim(d.url)}`,\n\t\t\tvalue: d.id,\n\t\t\tchecked: pr.state !== \"open\",\n\t\t};\n\t});\n\n\tlet selected: string[];\n\ttry {\n\t\tselected = await checkbox({\n\t\t\tmessage: \"Select deployments to delete (space to toggle, a to select all, enter to confirm):\",\n\t\t\tchoices,\n\t\t});\n\t} catch {\n\t\t// Ctrl-C\n\t\tprint(style.dim(\"Aborted.\"));\n\t\treturn { pr, branch, found: deployments.length, deleted: 0, status: \"aborted\" };\n\t}\n\n\tif (selected.length === 0) {\n\t\tprint(style.dim(\"Nothing selected — no deployments deleted.\"));\n\t\treturn { pr, branch, found: deployments.length, deleted: 0, status: \"aborted\" };\n\t}\n\n\t// ── 4. Delete ───────────────────────────────────────────────────────\n\tprint(\"\");\n\ttry {\n\t\tconst count = await deploy.deletePreviewDeployments(input.project, selected);\n\t\tprint(style.success(`Deleted ${count} deployment${count === 1 ? \"\" : \"s\"}.`));\n\t\tlogger.info(\n\t\t\t{ pr: pr.number, branch, found: deployments.length, deleted: count, status: \"ok\" },\n\t\t\t\"cleanup-preview: done\"\n\t\t);\n\t\treturn { pr, branch, found: deployments.length, deleted: count, status: \"ok\" };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(style.fail(message));\n\t\tlogger.warn(\n\t\t\t{ pr: pr.number, branch, found: deployments.length, reason: message, status: \"fail\" },\n\t\t\t\"cleanup-preview: done\"\n\t\t);\n\t\treturn { pr, branch, found: deployments.length, deleted: 0, status: \"fail\", message };\n\t}\n}\n","import { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join, resolve } from \"node:path\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { statusRow, style } from \"../../ui/index.js\";\nimport type { CloneReport, CloneTarget, ExecFn, GitHubRepo, RunCloneInput, WholeOrgScope } from \"./clone.type.js\";\n\n/**\n * Accepts a bare org (`\"theholocron\"`) — clones every repo in it — or an\n * `org/repo` coordinate (`\"theholocron/new-repo\"`) — clones just that one\n * repo. The repo half is never silently discarded: if it's there, it's used.\n * A trailing slash with nothing after it (`\"theholocron/\"`) is treated the\n * same as a bare org.\n */\nexport function parseCloneTarget(raw: string): CloneTarget {\n\tconst trimmed = raw.trim();\n\tconst slash = trimmed.indexOf(\"/\");\n\tif (slash === -1) return { org: trimmed };\n\tconst org = trimmed.slice(0, slash);\n\tconst repo = trimmed.slice(slash + 1);\n\treturn repo ? { org, repo } : { org };\n}\n\nfunction encodeTokenForGitHttpAuth(token: string): string {\n\tconst trimmed = token.trim();\n\tif (!trimmed) throw new Error(\"empty token\");\n\t// eslint-disable-next-line no-control-regex\n\tif (/[\\u0000-\\u001F\\u007F\\s]/.test(trimmed)) {\n\t\tthrow new Error(\"token contains whitespace or control characters\");\n\t}\n\treturn encodeURIComponent(trimmed);\n}\n\n/** Strip a leading dot so a hidden repo (e.g. `.github`) is still visible in Finder once cloned. */\nfunction repoDirName(repo: GitHubRepo): string {\n\treturn repo.name.startsWith(\".\") ? repo.name.slice(1) : repo.name;\n}\n\nasync function listOrgRepos(org: string, token: string, fetchFn: typeof globalThis.fetch): Promise<GitHubRepo[]> {\n\tconst repos: GitHubRepo[] = [];\n\tlet url: string | null = `https://api.github.com/orgs/${org}/repos?per_page=100&type=all`;\n\n\twhile (url) {\n\t\tconst res = await fetchFn(url, {\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${token}`,\n\t\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t\t},\n\t\t});\n\n\t\tif (!res.ok) {\n\t\t\tthrow new Error(`GitHub API ${res.status}: ${res.statusText} — check that the token has org:read scope`);\n\t\t}\n\n\t\trepos.push(...((await res.json()) as GitHubRepo[]));\n\n\t\tconst link = res.headers.get(\"link\");\n\t\tconst next = link?.match(/<([^>]+)>;\\s*rel=\"next\"/);\n\t\turl = next ? next[1] : null;\n\t}\n\n\treturn repos;\n}\n\nasync function getRepo(\n\torg: string,\n\trepo: string,\n\ttoken: string,\n\tfetchFn: typeof globalThis.fetch\n): Promise<GitHubRepo> {\n\tconst res = await fetchFn(`https://api.github.com/repos/${org}/${repo}`, {\n\t\theaders: {\n\t\t\tAuthorization: `Bearer ${token}`,\n\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t},\n\t});\n\n\tif (res.status === 404) {\n\t\tthrow new Error(`${org}/${repo} not found — check the repo name and that the token can see it`);\n\t}\n\tif (!res.ok) {\n\t\tthrow new Error(`GitHub API ${res.status}: ${res.statusText} — check that the token has repo:read scope`);\n\t}\n\n\treturn (await res.json()) as GitHubRepo;\n}\n\nexport async function runClone(input: RunCloneInput): Promise<CloneReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst fetchFn = input.fetch ?? globalThis.fetch;\n\tconst dryRun = input.dryRun ?? false;\n\tconst targetDir = resolve(input.dir ?? join(homedir(), \"Code\", input.org));\n\tlogger.info({ org: input.org, repo: input.repo, targetDir, dryRun: dryRun || undefined }, \"clone: start\");\n\tconst exec: ExecFn =\n\t\tinput.exec ??\n\t\t((cmd, args, opts) => {\n\t\t\tconst r = spawnSync(cmd, args, { cwd: opts.cwd, stdio: \"inherit\" });\n\t\t\treturn { status: r.status };\n\t\t});\n\n\tprint(\"\");\n\n\tif (!existsSync(targetDir)) {\n\t\tif (dryRun) {\n\t\t\tprint(style.dim(` would create ${targetDir}`));\n\t\t} else {\n\t\t\tmkdirSync(targetDir, { recursive: true });\n\t\t}\n\t}\n\n\tlet repos: GitHubRepo[];\n\ttry {\n\t\trepos = input.repo\n\t\t\t? [await getRepo(input.org, input.repo, input.token, fetchFn)]\n\t\t\t: await listOrgRepos(input.org, input.token, fetchFn);\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tlogger.warn({ org: input.org, repo: input.repo, reason: message }, \"clone: failed to list repos\");\n\t\treturn { status: \"fail\", cloned: 0, skipped: 0, failed: 0, message };\n\t}\n\n\tif (!input.repo && !dryRun && input.confirmWholeOrg) {\n\t\tconst alreadyCloned = repos.filter((r) => existsSync(join(targetDir, repoDirName(r)))).length;\n\t\tconst scope: WholeOrgScope = { total: repos.length, alreadyCloned, toClone: repos.length - alreadyCloned };\n\t\tconst proceed = await input.confirmWholeOrg(scope);\n\t\tif (!proceed) {\n\t\t\tprint(style.dim(\" aborted — nothing cloned\"));\n\t\t\tlogger.info({ org: input.org, ...scope }, \"clone: aborted by user\");\n\t\t\treturn { status: \"aborted\", cloned: 0, skipped: 0, failed: 0, message: \"aborted by user\" };\n\t\t}\n\t}\n\n\tlet cloned = 0;\n\tlet skipped = 0;\n\tlet failed = 0;\n\n\tfor (const repo of repos) {\n\t\tconst dest = join(targetDir, repoDirName(repo));\n\n\t\tif (existsSync(dest)) {\n\t\t\tprint(statusRow(\"skip\", [repo.full_name, dest, \"already exists\"]));\n\t\t\tskipped++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (dryRun) {\n\t\t\tprint(style.dim(` would clone ${repo.full_name} → ${dest}`));\n\t\t\tcloned++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tprint(style.step(` clone ${repo.full_name} → ${dest}`));\n\t\tconst { clone_url } = repo;\n\t\tif (!clone_url.startsWith(\"https://github.com/\")) {\n\t\t\tprint(statusRow(\"fail\", [repo.full_name, dest, `unexpected clone URL: ${clone_url}`]));\n\t\t\tfailed++;\n\t\t\tcontinue;\n\t\t}\n\t\tlet encodedToken: string;\n\t\ttry {\n\t\t\tencodedToken = encodeTokenForGitHttpAuth(input.token);\n\t\t} catch (err) {\n\t\t\tprint(statusRow(\"fail\", [repo.full_name, dest, `invalid token format: ${errorMessage(err)}`]));\n\t\t\tfailed++;\n\t\t\tcontinue;\n\t\t}\n\t\tconst authedUrl = `https://x-access-token:${encodedToken}@github.com/${clone_url.slice(\"https://github.com/\".length)}`;\n\t\tconst result = exec(\"git\", [\"clone\", \"--\", authedUrl, dest], { cwd: targetDir });\n\n\t\tif (result.status !== 0) {\n\t\t\tprint(statusRow(\"fail\", [repo.full_name, dest]));\n\t\t\tfailed++;\n\t\t} else {\n\t\t\tprint(statusRow(\"ok\", [repo.full_name, dest]));\n\t\t\tcloned++;\n\t\t}\n\t}\n\n\tconst summary = `${cloned} cloned, ${failed} failed, ${skipped} skipped`;\n\tprint(\"\");\n\tprint(\n\t\tdryRun\n\t\t\t? style.dim(` dry-run: ${summary}`)\n\t\t\t: failed > 0\n\t\t\t\t? style.fail(` ${summary}`)\n\t\t\t\t: style.success(` ${summary}`)\n\t);\n\n\tconst status = dryRun ? \"dry-run\" : failed > 0 ? \"fail\" : \"ok\";\n\tlogger[failed > 0 ? \"warn\" : \"info\"](\n\t\t{ org: input.org, repo: input.repo, status, cloned, skipped, failed },\n\t\t\"clone: done\"\n\t);\n\n\tif (input.confirmOpen) {\n\t\tconst openTarget = input.repo ? join(targetDir, repoDirName(repos[0]!)) : targetDir;\n\t\tif (existsSync(openTarget)) await input.confirmOpen(openTarget, dryRun && cloned > 0);\n\t}\n\n\treturn { status, cloned, skipped, failed };\n}\n","/**\n * `holocron deploy` — trigger a deployment via the configured\n * `deployment` capability.\n *\n * Two modes, one command: `runDeploy` (the default — a Git branch,\n * `triggerDeployment()`) and `runDeployFromFiles` (`--files <dir>` —\n * a local directory of source files, `deployFunction()`, no linked\n * repo required — for a consumer with no Git history to deploy from,\n * e.g. Sentinel, shipped as an npm package). Separate functions, not\n * one branching `runDeploy`, because their inputs genuinely differ\n * (`branch` vs `dir`) and their result shapes differ too\n * (`DeploymentRecord` carries `status`/`branch`; `DeployFunctionResult`\n * is deliberately minimal, same as `DeployScriptResult` for Workers).\n *\n * Errors clearly when `deployment` isn't loaded (no provider declared\n * in `holocron.config.json`), or when the configured provider doesn't\n * implement `deployFunction` (it's optional on `Deployment` — not\n * every provider has a files-based deploy API).\n *\n * Dry-run skips the actual deploy call but still verifies the\n * deployment capability (and, for `--files`, `deployFunction`) is\n * present, so operators can sanity-check the wiring without spinning\n * up a build.\n *\n * **Both modes wait for the deployment to finish** (holocron#911): a\n * provider accepting the upload/trigger is not the deployment succeeding.\n * Vercel builds asynchronously — an `npm install` failure there leaves\n * the deployment in `ERROR` while production keeps serving the previous\n * one, and this command used to report `ok` regardless (found live:\n * Sentinel's holocron#910 deploy \"succeeded\" in CI, never went live). So\n * after triggering, {@link waitForDeployment} polls\n * `Deployment.getDeployment()` until a terminal state; only `ready` is\n * `ok`, while `error` / `cancelled` / a timeout are `fail` (non-zero exit\n * via `cli.ts`).\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { relative, sep } from \"node:path\";\n\nimport { walkFilesSync } from \"@theholocron/fs-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { assertPluginsResolvable, type Deployment, type DeploymentRecord, PluginLoader } from \"../../plugin/index.js\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport type {\n\tDeployFilesReport,\n\tDeployReport,\n\tDeployWaitOptions,\n\tRunDeployFromFilesInput,\n\tRunDeployInput,\n} from \"./deploy.type.js\";\n\nconst DEFAULT_WAIT_TIMEOUT_MS = 10 * 60_000;\nconst DEFAULT_WAIT_INTERVAL_MS = 5_000;\n\nconst TERMINAL_STATUSES: ReadonlySet<DeploymentRecord[\"status\"]> = new Set([\"ready\", \"error\", \"cancelled\"]);\n\n/**\n * Polls `getDeployment(id)` until the deployment reaches a terminal status\n * (`ready` / `error` / `cancelled`). Throws on timeout — the caller turns\n * that into a `fail` report, same as a provider throwing mid-trigger.\n */\nexport async function waitForDeployment(\n\tdeploy: Deployment,\n\tdeploymentId: string,\n\toptions: DeployWaitOptions = {}\n): Promise<DeploymentRecord> {\n\tconst timeoutMs = options.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;\n\tconst intervalMs = options.intervalMs ?? DEFAULT_WAIT_INTERVAL_MS;\n\tconst sleep = options.sleep ?? ((ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)));\n\tconst now = options.now ?? Date.now;\n\n\tconst deadline = now() + timeoutMs;\n\tfor (;;) {\n\t\tconst record = await deploy.getDeployment(deploymentId);\n\t\tif (TERMINAL_STATUSES.has(record.status)) return record;\n\t\tif (now() >= deadline) {\n\t\t\tthrow new Error(\n\t\t\t\t`deployment ${deploymentId} still ${record.status} after ${Math.round(timeoutMs / 1000)}s — check the provider's dashboard`\n\t\t\t);\n\t\t}\n\t\tawait sleep(intervalMs);\n\t}\n}\n\n/** One terminal, non-ready record as a single human-readable failure line. */\nfunction terminalFailure(record: DeploymentRecord): string {\n\treturn `deployment ${record.id} ended ${record.status}${record.errorMessage ? `: ${record.errorMessage}` : \"\"}`;\n}\n\n/**\n * Provider `url` fields (Vercel's REST API, at least) come back as bare\n * hostnames — `\"my-app.vercel.app\"`, no scheme — which terminals don't\n * linkify and browsers won't navigate to unmodified. Printed output\n * should be a URL a human can click/paste; structured log fields keep\n * the raw provider value as-is.\n */\nfunction withScheme(url: string): string {\n\treturn /^https?:\\/\\//.test(url) ? url : `https://${url}`;\n}\n\nexport async function runDeploy(input: RunDeployInput): Promise<DeployReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"deploy\");\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tlogger.info(\n\t\t{\n\t\t\tbranch: input.branch,\n\t\t\ttarget: input.target ?? \"preview\",\n\t\t\tprojectId: input.projectId,\n\t\t\tdryRun: dryRun || undefined,\n\t\t},\n\t\t\"deploy: start\"\n\t);\n\n\tprint(\n\t\tstyle.header(\n\t\t\t`Holocron deploy — branch=${input.branch}${\n\t\t\t\tinput.target ? `, target=${input.target}` : \" (preview)\"\n\t\t\t}${dryRun ? \" (dry-run)\" : \"\"}`\n\t\t)\n\t);\n\n\tif (!loader.has(\"deployment\")) {\n\t\tthrow new Error(\n\t\t\t\"deployment capability is not configured — add a `deployment` provider to holocron.config.json\"\n\t\t);\n\t}\n\tconst deploy = loader.get(\"deployment\") as Deployment;\n\n\tif (dryRun) {\n\t\tconst message = `would: ${deploy.providerName}.triggerDeployment(projectId=${input.projectId}, branch=${input.branch}${\n\t\t\tinput.target ? `, target=${input.target}` : \"\"\n\t\t})`;\n\t\tprint(` ${style.dim(`… ${message}`)}`);\n\t\treturn { deployment: null, status: \"dry-run\", message };\n\t}\n\n\ttry {\n\t\tconst triggered = await withSpinner(\n\t\t\t`Deploying ${input.branch}${input.target ? ` → ${input.target}` : \"\"}…`,\n\t\t\t() =>\n\t\t\t\tdeploy.triggerDeployment({\n\t\t\t\t\tprojectId: input.projectId,\n\t\t\t\t\tbranch: input.branch,\n\t\t\t\t\t...(input.target ? { target: input.target } : {}),\n\t\t\t\t})\n\t\t);\n\t\tlogger.info({ status: triggered.status, url: triggered.url, id: triggered.id }, \"deploy: triggered\");\n\t\tconst record = TERMINAL_STATUSES.has(triggered.status)\n\t\t\t? triggered\n\t\t\t: await withSpinner(`Waiting for ${withScheme(triggered.url)} to finish…`, () =>\n\t\t\t\t\twaitForDeployment(deploy, triggered.id, input.wait)\n\t\t\t\t);\n\t\tif (record.status !== \"ready\") {\n\t\t\tconst message = terminalFailure(record);\n\t\t\tprint(` ${style.fail(`${message} — ${withScheme(triggered.url)}`)}`);\n\t\t\tlogger.warn({ id: record.id, status: record.status, reason: record.errorMessage }, \"deploy: failed\");\n\t\t\treturn { deployment: record, status: \"fail\", message };\n\t\t}\n\t\tprint(` ${style.success(`${record.status} — ${withScheme(triggered.url)}`)}`);\n\t\tlogger.info({ status: record.status, url: triggered.url, id: record.id }, \"deploy: ready\");\n\t\treturn { deployment: record, status: \"ok\" };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ${style.fail(message)}`);\n\t\tlogger.warn({ branch: input.branch, reason: message }, \"deploy: failed\");\n\t\treturn { deployment: null, status: \"fail\", message };\n\t}\n}\n\n// Deliberately no \"dist\" here, unlike holocron new repo's own file-walker this\n// was modeled on: --files exists specifically to deploy build output, so\n// a directory literally named \"dist\" is exactly what a caller usually\n// means to include, not exclude.\nconst SKIP_DIRS = [\".git\", \"node_modules\", \".turbo\"];\n\nconst defaultWalkFiles = (dir: string): string[] => walkFilesSync(dir, { skip: SKIP_DIRS });\n\n/** `holocron deploy --files <dir>` — the non-git counterpart to `runDeploy`. */\nexport async function runDeployFromFiles(input: RunDeployFromFilesInput): Promise<DeployFilesReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"deploy\");\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst walkFiles = input.walkFiles ?? defaultWalkFiles;\n\tconst readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\n\tconst files: Record<string, string> = {};\n\tfor (const abs of walkFiles(input.dir)) {\n\t\tconst rel = relative(input.dir, abs).split(sep).join(\"/\");\n\t\tfiles[rel] = readFile(abs);\n\t}\n\tconst fileCount = Object.keys(files).length;\n\n\tlogger.info(\n\t\t{\n\t\t\tdir: input.dir,\n\t\t\tfileCount,\n\t\t\ttarget: input.target ?? \"preview\",\n\t\t\tprojectId: input.projectId,\n\t\t\tdryRun: dryRun || undefined,\n\t\t},\n\t\t\"deploy: start (files)\"\n\t);\n\n\tprint(\n\t\tstyle.header(\n\t\t\t`Holocron deploy — files=${input.dir} (${fileCount} file${fileCount === 1 ? \"\" : \"s\"})${\n\t\t\t\tinput.target ? `, target=${input.target}` : \" (preview)\"\n\t\t\t}${dryRun ? \" (dry-run)\" : \"\"}`\n\t\t)\n\t);\n\n\tif (!loader.has(\"deployment\")) {\n\t\tthrow new Error(\n\t\t\t\"deployment capability is not configured — add a `deployment` provider to holocron.config.json\"\n\t\t);\n\t}\n\tconst deploy = loader.get(\"deployment\") as Deployment;\n\tif (!deploy.deployFunction) {\n\t\tthrow new Error(\n\t\t\t`deployment provider \"${deploy.providerName}\" does not support deploying from files — deployFunction() is not implemented`\n\t\t);\n\t}\n\n\tif (dryRun) {\n\t\tconst message = `would: ${deploy.providerName}.deployFunction(projectId=${input.projectId}, files=${fileCount}${\n\t\t\tinput.target ? `, target=${input.target}` : \"\"\n\t\t})`;\n\t\tprint(` ${style.dim(`… ${message}`)}`);\n\t\treturn { deployment: null, status: \"dry-run\", message };\n\t}\n\n\ttry {\n\t\tconst result = await withSpinner(\n\t\t\t`Deploying ${fileCount} file${fileCount === 1 ? \"\" : \"s\"} from ${input.dir}…`,\n\t\t\t() => deploy.deployFunction!(input.projectId, { files, ...(input.target ? { target: input.target } : {}) })\n\t\t);\n\t\tlogger.info({ url: result.url, id: result.deploymentId }, \"deploy: triggered (files)\");\n\t\tconst record = await withSpinner(`Waiting for ${withScheme(result.url)} to finish…`, () =>\n\t\t\twaitForDeployment(deploy, result.deploymentId, input.wait)\n\t\t);\n\t\tif (record.status !== \"ready\") {\n\t\t\tconst message = terminalFailure(record);\n\t\t\tprint(` ${style.fail(`${message} — ${withScheme(result.url)}`)}`);\n\t\t\tlogger.warn(\n\t\t\t\t{ id: record.id, status: record.status, reason: record.errorMessage },\n\t\t\t\t\"deploy: failed (files)\"\n\t\t\t);\n\t\t\treturn { deployment: result, status: \"fail\", message };\n\t\t}\n\t\tprint(` ${style.success(withScheme(result.url))}`);\n\t\tlogger.info({ url: result.url, id: result.deploymentId }, \"deploy: ready (files)\");\n\t\treturn { deployment: result, status: \"ok\" };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ${style.fail(message)}`);\n\t\tlogger.warn({ dir: input.dir, reason: message }, \"deploy: failed (files)\");\n\t\treturn { deployment: null, status: \"fail\", message };\n\t}\n}\n","/**\n * `holocron doctor` — load the config, instantiate every capability,\n * print a per-capability readiness report.\n *\n * Each capability gets a smoke check appropriate to its surface:\n * source → `whoami()`\n * issues → `doctor()` (rich report)\n * secrets → `listSecrets({ kind: 'repo' })`\n * ci → `listRuns({ limit: 1 })`\n * errors → `describe()`\n * logs → `whoami()` (dataset reachability) or `describe()`\n * others → just \"loaded\" (no smoke endpoint defined yet)\n *\n * Output is plain text via a passed-in `print` function so tests can\n * capture lines without ANSI / spinner noise.\n */\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Auth,\n\tCARDINALITY,\n\ttype Ci,\n\ttype Deployment,\n\ttype Dns,\n\ttype Environments,\n\ttype Errors,\n\ttype Issues,\n\ttype Logs,\n\ttype Monitoring,\n\tPluginLoader,\n\ttype Secrets,\n\ttype Source,\n\ttype Vault,\n\ttype Workers,\n} from \"../../plugin/index.js\";\nimport { pad, statusRow, style, withSpinner } from \"../../ui/index.js\";\nimport type { DoctorReport, DoctorRow, DoctorStatus, RunDoctorInput } from \"./doctor.type.js\";\n\nexport async function runDoctor(input: RunDoctorInput): Promise<DoctorReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait withSpinner(\"Loading plugins…\", () => loader.load());\n\t// A global install has no plugin packages to resolve — say so plainly\n\t// instead of printing a report that's all \"Cannot find package\" rows.\n\tassertPluginsResolvable(loader, \"doctor\");\n\n\tconst rows: DoctorRow[] = [];\n\tconst config = input.loaded.resolved;\n\n\tprint(\"\");\n\tprint(style.dim(` config: ${input.loaded.filepath}`));\n\tprint(\"\");\n\n\t// Providers that never loaded (missing token, package not installed) —\n\t// the most actionable rows in the report.\n\tfor (const failure of loader.loadFailures()) {\n\t\trows.push({\n\t\t\tcapability: failure.key,\n\t\t\tprovider: failure.provider,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: failure.error.message,\n\t\t});\n\t}\n\n\tfor (const key of loader.loadedKeys()) {\n\t\tconst cardinality = CARDINALITY[key];\n\t\tconst entry = config.providers[key];\n\t\tconst providers =\n\t\t\tentry?.cardinality === \"many\"\n\t\t\t\t? entry.tuples.map((t) => t.provider)\n\t\t\t\t: entry?.cardinality === \"single\"\n\t\t\t\t\t? [entry.tuple.provider]\n\t\t\t\t\t: [];\n\n\t\tif (cardinality === \"many\") {\n\t\t\tconst impls = loader.get(key) as unknown as unknown[];\n\t\t\timpls.forEach((_impl, idx) => {\n\t\t\t\trows.push({\n\t\t\t\t\tcapability: key,\n\t\t\t\t\tprovider: providers[idx] ?? \"?\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"loaded (no smoke check defined for this capability)\",\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\tconst impl = loader.get(key) as unknown;\n\t\t\tconst row = await smokeCheck(key, providers[0] ?? \"?\", impl);\n\t\t\trows.push(row);\n\t\t}\n\t}\n\n\tconst log = getLogger();\n\t// Render rows\n\tfor (const row of rows) {\n\t\tlog[row.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{ capability: row.capability, provider: row.provider, status: row.status, detail: row.message },\n\t\t\t`doctor: ${row.capability}`\n\t\t);\n\t\tprint(statusRow(row.status, [`${pad(row.capability, 14)} via ${pad(row.provider, 14)}`, row.message]));\n\t}\n\n\tconst summary = rows.reduce(\n\t\t(acc, r) => {\n\t\t\tacc[r.status] += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0 }\n\t);\n\n\tconst summaryLine = `${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`;\n\tprint(\"\");\n\tprint(style.header(summaryLine));\n\n\treturn { rows, summary };\n}\n\n// ── smoke checks ────────────────────────────────────────────────────\n\nasync function smokeCheck(key: string, provider: string, impl: unknown): Promise<DoctorRow> {\n\ttry {\n\t\tswitch (key) {\n\t\t\tcase \"source\": {\n\t\t\t\tconst result = await (impl as Source).whoami();\n\t\t\t\treturn mk(key, provider, \"ok\", `whoami: ${result.login}`);\n\t\t\t}\n\t\t\tcase \"issues\": {\n\t\t\t\tconst report = await (impl as Issues).doctor();\n\t\t\t\treturn mk(\n\t\t\t\t\tkey,\n\t\t\t\t\tprovider,\n\t\t\t\t\t\"ok\",\n\t\t\t\t\t`${report.authedAs} / ${report.projectLabel} (${countResolvedLifecycle(report)})`\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"secrets\": {\n\t\t\t\tconst names = await (impl as Secrets).listSecrets({ kind: \"repo\" });\n\t\t\t\treturn mk(key, provider, \"ok\", `repo secrets: ${names.length} configured`);\n\t\t\t}\n\t\t\tcase \"ci\": {\n\t\t\t\tconst runs = await (impl as Ci).listRuns({ limit: 1 });\n\t\t\t\treturn mk(\n\t\t\t\t\tkey,\n\t\t\t\t\tprovider,\n\t\t\t\t\t\"ok\",\n\t\t\t\t\truns.length === 0 ? \"no recent runs\" : `most recent: ${runs[0]!.workflowName} (${runs[0]!.status})`\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"vault\": {\n\t\t\t\tconst keys = await (impl as Vault).list();\n\t\t\t\treturn mk(key, provider, \"ok\", `${keys.length} keys available`);\n\t\t\t}\n\t\t\tcase \"deployment\": {\n\t\t\t\tconst projects = await (impl as Deployment).listProjects();\n\t\t\t\treturn mk(key, provider, \"ok\", `${projects.length} project(s) visible`);\n\t\t\t}\n\t\t\tcase \"environments\": {\n\t\t\t\tconst envs = await (impl as Environments).listEnvironments();\n\t\t\t\treturn mk(key, provider, \"ok\", `${envs.length} environment(s) configured`);\n\t\t\t}\n\t\t\tcase \"dns\": {\n\t\t\t\tconst dns = impl as Dns;\n\t\t\t\tif (dns.whoami) {\n\t\t\t\t\tconst who = await dns.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", `${who.zones} zone(s) visible`);\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t\t}\n\t\t\tcase \"workers\": {\n\t\t\t\tconst workers = impl as Workers;\n\t\t\t\tif (workers.whoami) {\n\t\t\t\t\tconst who = await workers.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", `${who.scripts} script(s) visible`);\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t\t}\n\t\t\tcase \"auth\": {\n\t\t\t\tconst desc = await (impl as Auth).describe();\n\t\t\t\treturn mk(key, provider, \"ok\", `provider: ${desc.provider}; env keys: ${desc.envKeys.join(\", \")}`);\n\t\t\t}\n\t\t\tcase \"errors\": {\n\t\t\t\tconst desc = await (impl as Errors).describe();\n\t\t\t\treturn mk(key, provider, \"ok\", `provider: ${desc.provider}; env keys: ${desc.envKeys.join(\", \")}`);\n\t\t\t}\n\t\t\tcase \"logs\": {\n\t\t\t\tconst logs = impl as Logs;\n\t\t\t\tconst desc = await logs.describe();\n\t\t\t\tif (logs.whoami) {\n\t\t\t\t\tconst who = await logs.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", `dataset: ${who.dataset}`);\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"ok\", `provider: ${desc.provider}; env keys: ${desc.envKeys.join(\", \")}`);\n\t\t\t}\n\t\t\tcase \"monitoring\": {\n\t\t\t\tconst monitoring = impl as Monitoring;\n\t\t\t\tif (monitoring.whoami) {\n\t\t\t\t\tconst who = await monitoring.whoami();\n\t\t\t\t\treturn mk(key, provider, who.ok ? \"ok\" : \"fail\", who.ok ? \"token verified\" : \"token check failed\");\n\t\t\t\t}\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn mk(key, provider, \"skip\", \"loaded (no smoke check defined for this capability)\");\n\t\t}\n\t} catch (err) {\n\t\treturn mk(key, provider, \"fail\", errorMessage(err));\n\t}\n}\n\nfunction countResolvedLifecycle(report: Awaited<ReturnType<Issues[\"doctor\"]>>): string {\n\tconst resolved = report.lifecycle.filter((l) => l.resolved).length;\n\treturn `${resolved}/${report.lifecycle.length} lifecycle slots ready`;\n}\n\nfunction mk(capability: string, provider: string, status: DoctorStatus, message: string): DoctorRow {\n\treturn { capability, provider, status, message };\n}\n","import { getLogger } from \"../../observability/logger/index.js\";\nimport { assertPluginsResolvable, type Monitoring, PluginLoader, runCheckAgainstUrl } from \"../../plugin/index.js\";\nimport type {\n\tMonitoringCheckReport,\n\tMonitoringCheckSummary,\n\tRunMonitoringCheckInput,\n} from \"./monitoring-check.type.js\";\n\nexport async function runMonitoringCheck(input: RunMonitoringCheckInput): Promise<MonitoringCheckReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"monitoring check\");\n\n\t// `get()` re-surfaces the monitoring provider's own load error (a bad\n\t// token, a constructor throw, …) when it was configured but failed to\n\t// load — never swallowed behind a generic \"not configured\" message,\n\t// which would send an operator chasing the wrong fix.\n\tconst monitoring = loader.get(\"monitoring\") as Monitoring;\n\tconst run = input.runCheck ?? runCheckAgainstUrl;\n\n\tprint(`Holocron monitoring check — against ${input.url}`);\n\n\tif (monitoring.checks.length === 0) {\n\t\tconst message = \"no monitoring checks configured — nothing to validate\";\n\t\tprint(`✗ ${message}`);\n\t\tlogger.warn({ url: input.url }, \"monitoring check: no checks configured\");\n\t\treturn { status: \"fail\", checks: [] };\n\t}\n\n\tconst checks: MonitoringCheckSummary[] = [];\n\tfor (const checkInput of monitoring.checks) {\n\t\tconst result = await run(checkInput, { url: input.url });\n\t\tif (result.requestError) {\n\t\t\tprint(` ✗ ${checkInput.name} (request failed: ${result.requestError})`);\n\t\t\tchecks.push({ name: checkInput.name, passed: false, failures: [], requestError: result.requestError });\n\t\t} else if (result.passed) {\n\t\t\tprint(` ✓ ${checkInput.name}`);\n\t\t\tchecks.push({ name: checkInput.name, passed: true, failures: [] });\n\t\t} else {\n\t\t\tprint(` ✗ ${checkInput.name}`);\n\t\t\tfor (const failure of result.failures) print(` ${failure}`);\n\t\t\tchecks.push({ name: checkInput.name, passed: false, failures: result.failures });\n\t\t}\n\t}\n\n\tconst failCount = checks.filter((c) => !c.passed).length;\n\tconst status = failCount === 0 ? \"ok\" : \"fail\";\n\tprint(`${status === \"ok\" ? \"✓\" : \"✗\"} ${checks.length - failCount} passed, ${failCount} failed`);\n\tlogger.info({ url: input.url, total: checks.length, failed: failCount, status }, \"monitoring check: done\");\n\treturn { status, checks };\n}\n","/**\n * `holocron new repo <type> <name>` — create a GitHub repo from a template and\n * bootstrap it by replacing all template-slug casing variants with the new\n * project name, then generate a `holocron.config.ts` from the answers given\n * during the interactive wizard.\n *\n * Flow:\n * 1. Preflight — verify `gh` CLI is available.\n * 2. Resolve type, name, description, homepage, vault/deployment/agent options.\n * 3. `gh repo create <org>/<name> --template <org>/<type>-template --private --clone`\n * → clones to `<cwd>/<name>/`\n * 4. Detect template slug from cloned package.json.\n * 5. Replace all casing variants of the slug across every text file.\n * 6. Replace `<description>` and `<homepage>` placeholders.\n * 7. Generate and write `holocron.config.ts` based on wizard answers.\n * 8. Commit the patched files (-s for DCO).\n * 9. Unless --no-verify: `pnpm install` in the new repo.\n * 10. Print next steps.\n */\n\nimport { execFileSync, spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { walkFilesSync } from \"@theholocron/fs-utils\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { env } from \"../../env/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type { HolocronConfigOptions, NewReport, RunNewInput } from \"./new.type.js\";\n\nexport class NewError extends Error {\n\toverride name = \"NewError\";\n}\n\n// ── Case derivation ───────────────────────────────────────────────────\n\nfunction cap(word: string): string {\n\treturn word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n}\n\n/**\n * Derive all common casing variants of a kebab-case slug (e.g.\n * \"cli-template\") and map each to the corresponding form of a\n * kebab-case name (e.g. \"my-tool\").\n *\n * Returns search→replacement pairs, deduplicating single-word slugs\n * that would otherwise produce identical entries.\n */\nexport function deriveVariants(slug: string, name: string): Array<[string, string]> {\n\tconst sw = slug.split(\"-\");\n\tconst nw = name.split(\"-\");\n\n\tconst pairs: Array<[string, string]> = [\n\t\t[slug, name],\n\t\t[sw.join(\"_\"), nw.join(\"_\")],\n\t\t[sw.join(\"_\").toUpperCase(), nw.join(\"_\").toUpperCase()],\n\t\t[sw.map(cap).join(\"\"), nw.map(cap).join(\"\")],\n\t\t[sw[0]!.toLowerCase() + sw.slice(1).map(cap).join(\"\"), nw[0]!.toLowerCase() + nw.slice(1).map(cap).join(\"\")],\n\t\t[sw.map(cap).join(\" \"), nw.map(cap).join(\" \")],\n\t];\n\n\tconst seen = new Set<string>();\n\treturn pairs.filter(([s]) => {\n\t\tif (seen.has(s)) return false;\n\t\tseen.add(s);\n\t\treturn true;\n\t});\n}\n\n// ── Input helpers ─────────────────────────────────────────────────────\n\n/** Validate a repo name: must be lowercase kebab-case. Returns `true` on success or an error string. */\nexport function validateRepoName(v: string): true | string {\n\treturn /^[a-z][a-z0-9-]*$/.test(v.trim()) ? true : \"Must be lowercase kebab-case (e.g. my-tool)\";\n}\n\n/** Parse a comma-separated topics string into a trimmed, non-empty array. */\nexport function parseTopics(raw: string | undefined): string[] {\n\treturn raw\n\t\t? String(raw)\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((t) => t.trim())\n\t\t\t\t.filter(Boolean)\n\t\t: [];\n}\n\n/**\n * Generate the content of `holocron.config.ts` for a newly-scaffolded repo.\n * Uses the `node()` preset from `@theholocron/holocron-config` as the baseline\n * and layers in the provider/agent choices made during the wizard.\n */\nexport function generateHolocronConfig(opts: HolocronConfigOptions): string {\n\tconst lines: string[] = [\n\t\t`import { defineConfig } from \"@theholocron/cli\";`,\n\t\t`import { compose, node, typecheck } from \"@theholocron/holocron-config\";`,\n\t\t``,\n\t\t// `compose(node(), typecheck())` is the org baseline preset — the full\n\t\t// task manifest (lint/test/typecheck required, security/review/… ) rides\n\t\t// in via `...preset`, so `holocron repo setup` can derive CodeQL mode and the\n\t\t// required-check contexts. See theholocron/holocron#642.\n\t\t`const preset = compose(node(), typecheck());`,\n\t\t`export default defineConfig({`,\n\t\t`\\t...preset,`,\n\t];\n\n\tif (opts.description) lines.push(`\\tdescription: ${JSON.stringify(opts.description)},`);\n\tif (opts.homepage) lines.push(`\\thomepage: ${JSON.stringify(opts.homepage)},`);\n\n\tconst topics = opts.topics?.length ? opts.topics : [];\n\tconst hasRuntimeOverride = opts.runtimeEnvironment != null && opts.runtimeEnvironment !== \"node\";\n\tconst hasFullRepo = opts.org != null;\n\n\tif (hasFullRepo) {\n\t\t// Full explicit repo block when org is known (always the case from the CLI).\n\t\tconst repoName = `${opts.org}/${opts.name}`;\n\t\tlines.push(`\\trepo: {`);\n\t\tlines.push(`\\t\\t...preset.repo,`);\n\t\tlines.push(`\\t\\tname: ${JSON.stringify(repoName)},`);\n\t\tlines.push(`\\t\\tteams: [{ slug: \"gatekeepers\", permission: \"maintain\" }],`);\n\t\tlines.push(`\\t\\ttopics: ${JSON.stringify(topics)},`);\n\t\tif (opts.protection && opts.protection !== \"strict\") {\n\t\t\tlines.push(`\\t\\tprotection: ${JSON.stringify(opts.protection)},`);\n\t\t}\n\t\tconst propParts: string[] = [];\n\t\tif (hasRuntimeOverride) propParts.push(`runtime_environment: ${JSON.stringify(opts.runtimeEnvironment)}`);\n\t\tif (opts.openSource === false) propParts.push(`open_source: false`);\n\t\tif (opts.usesExternalPackages === false) propParts.push(`uses_external_packages: false`);\n\t\tif (propParts.length > 0) {\n\t\t\tlines.push(`\\t\\tproperties: { ...preset.repo?.properties, ${propParts.join(\", \")} },`);\n\t\t}\n\t\tlines.push(`\\t},`);\n\t} else if (topics.length > 0 || hasRuntimeOverride) {\n\t\tlines.push(`\\trepo: {`);\n\t\tlines.push(`\\t\\t...preset.repo,`);\n\t\tif (topics.length > 0) lines.push(`\\t\\ttopics: ${JSON.stringify(topics)},`);\n\t\tif (hasRuntimeOverride) {\n\t\t\tlines.push(\n\t\t\t\t`\\t\\tproperties: { ...preset.repo?.properties, runtime_environment: ${JSON.stringify(opts.runtimeEnvironment)} },`\n\t\t\t);\n\t\t}\n\t\tlines.push(`\\t},`);\n\t}\n\t// else: `...preset` already carries `repo` — no explicit block needed.\n\n\tconst hasVault = opts.vaultProvider && opts.vaultProvider !== \"none\";\n\tconst hasDeployment = opts.deploymentProvider && opts.deploymentProvider !== \"none\";\n\n\tif (hasVault || hasDeployment) {\n\t\tlines.push(`\\tproviders: {`);\n\t\tlines.push(`\\t\\t...preset.providers,`);\n\t\tif (opts.vaultProvider === \"doppler\") {\n\t\t\tconst proj = JSON.stringify(opts.vaultProject ?? opts.name);\n\t\t\tconst cfg = JSON.stringify(opts.vaultConfig ?? \"dev\");\n\t\t\tlines.push(`\\t\\tvault: [\"doppler\", { project: ${proj}, config: ${cfg} }],`);\n\t\t} else if (opts.vaultProvider === \"1password\") {\n\t\t\tconst vault = JSON.stringify(opts.vaultProject ?? opts.name);\n\t\t\tlines.push(`\\t\\tvault: [\"1password\", { vault: ${vault} }],`);\n\t\t} else if (opts.vaultProvider === \"infisical\") {\n\t\t\tconst proj = JSON.stringify(opts.vaultProject ?? opts.name);\n\t\t\tlines.push(`\\t\\tvault: [\"infisical\", { project: ${proj} }],`);\n\t\t}\n\t\tif (opts.deploymentProvider === \"vercel\") {\n\t\t\tlines.push(`\\t\\tdeployment: \"vercel\",`);\n\t\t}\n\t\tlines.push(`\\t},`);\n\t}\n\t// else: `...preset` already carries `providers`.\n\n\tif (opts.agent && opts.agent !== \"none\") {\n\t\tlines.push(`\\tagent: ${JSON.stringify(opts.agent)},`);\n\t}\n\n\tif (opts.skills?.length) {\n\t\tlines.push(`\\tskills: ${JSON.stringify(opts.skills)},`);\n\t}\n\n\tlines.push(`});`);\n\tlines.push(``);\n\n\treturn lines.join(\"\\n\");\n}\n\n// ── File discovery ────────────────────────────────────────────────────\n\nconst SKIP_DIRS = [\".git\", \"node_modules\", \"dist\", \".turbo\"];\n\nconst defaultWalkFiles = (dir: string): string[] => walkFilesSync(dir, { skip: SKIP_DIRS });\n\nfunction isBinary(content: string): boolean {\n\tfor (let i = 0; i < Math.min(content.length, 8000); i++) {\n\t\tif (content.charCodeAt(i) === 0) return true;\n\t}\n\treturn false;\n}\n\n// ── Patching ──────────────────────────────────────────────────────────\n\nfunction patchFiles(\n\tdir: string,\n\tvariants: Array<[string, string]>,\n\tdescription: string | undefined,\n\thomepage: string | undefined,\n\truntimeEnvironment: string | undefined,\n\tprint: (line: string) => void,\n\treadFn: (p: string) => string,\n\twriteFn: (p: string, c: string) => void,\n\twalkFn: (d: string) => string[]\n): string[] {\n\tconst patched: string[] = [];\n\tfor (const filepath of walkFn(dir)) {\n\t\tlet content: string;\n\t\ttry {\n\t\t\tcontent = readFn(filepath);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (isBinary(content)) continue;\n\n\t\tconst original = content;\n\t\tfor (const [search, replacement] of variants) {\n\t\t\tcontent = content.split(search).join(replacement);\n\t\t}\n\t\tif (description !== undefined) {\n\t\t\tcontent = content.split(\"<description>\").join(description);\n\t\t\t// Also replace the content of <!-- holocron:description --> blocks so\n\t\t\t// the README description marker is updated even when the template has\n\t\t\t// real prose rather than a bare <description> placeholder.\n\t\t\tcontent = content.replace(\n\t\t\t\t/(<!-- holocron:description -->)[\\s\\S]*?(<!-- \\/holocron:description -->)/g,\n\t\t\t\t`$1\\n${description}\\n$2`\n\t\t\t);\n\t\t}\n\t\tif (homepage !== undefined) {\n\t\t\tcontent = content.split(\"<homepage>\").join(homepage);\n\t\t}\n\t\tif (runtimeEnvironment !== undefined) {\n\t\t\tcontent = content.split(\"<runtime_environment>\").join(runtimeEnvironment);\n\t\t}\n\t\t// Strip template-only blocks — sections relevant only to the template\n\t\t// repo itself (e.g. \"Getting Started\" scaffolding instructions) that\n\t\t// should not appear in projects generated from the template.\n\t\tcontent = content.replace(\n\t\t\t/\\n?<!-- holocron:template-only -->[\\s\\S]*?<!-- \\/holocron:template-only -->\\n?/g,\n\t\t\t\"\"\n\t\t);\n\n\t\tif (content !== original) {\n\t\t\twriteFn(filepath, content);\n\t\t\tprint(` ✓ ${path.relative(dir, filepath)}`);\n\t\t\tpatched.push(filepath);\n\t\t}\n\t}\n\treturn patched;\n}\n\n// ── Preflight ─────────────────────────────────────────────────────────\n\nfunction preflight(): void {\n\tconst result = spawnSync(\"gh\", [\"--version\"], { encoding: \"utf8\" });\n\tif (result.error != null || result.status !== 0) {\n\t\tthrow new NewError(\"`gh` CLI is not installed or not on PATH. Install it from https://cli.github.com\");\n\t}\n}\n\n// ── Defaults ──────────────────────────────────────────────────────────\n\nfunction defaultExec(\n\tcmd: string,\n\targs: string[],\n\topts: { cwd: string; stdio: \"inherit\"; env?: Record<string, string> }\n): void {\n\texecFileSync(cmd, args, {\n\t\tcwd: opts.cwd,\n\t\tstdio: opts.stdio,\n\t\t...(opts.env && Object.keys(opts.env).length > 0 ? { env: { ...process.env, ...opts.env } } : {}),\n\t});\n}\n\nfunction keychainLookup(key: string): string | undefined {\n\tconst result = spawnSync(\"security\", [\"find-generic-password\", \"-s\", \"com.theholocron.cli\", \"-a\", key, \"-w\"], {\n\t\tencoding: \"utf8\",\n\t});\n\treturn result.status === 0 ? result.stdout?.trim() || undefined : undefined;\n}\n\nfunction defaultReadFile(filepath: string): string {\n\treturn readFileSync(filepath, \"utf-8\");\n}\n\nfunction defaultWriteFile(filepath: string, content: string): void {\n\tmkdirSync(path.dirname(filepath), { recursive: true });\n\twriteFileSync(filepath, content, \"utf-8\");\n}\n\n// ── Orchestrator ──────────────────────────────────────────────────────\n\nexport async function runNew(input: RunNewInput): Promise<NewReport> {\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst org = input.org ?? \"theholocron\";\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst execFn = input.exec ?? defaultExec;\n\tconst readFn = input.readFile ?? defaultReadFile;\n\tconst writeFn = input.writeFile ?? defaultWriteFile;\n\tconst walkFn = input.walkFiles ?? defaultWalkFiles;\n\n\tpreflight();\n\n\tconst templateRepo = `${org}/${input.type}-template`;\n\tconst newRepo = `${org}/${input.name}`;\n\tconst repoDir = path.join(cwd, input.name);\n\tlogger.info({ repo: newRepo, template: templateRepo, dryRun: input.dryRun || undefined }, \"new: start\");\n\n\tif (input.dryRun) {\n\t\tprint(` Would create ${newRepo} from template ${templateRepo}`);\n\t\tprint(` Would clone to ${repoDir}`);\n\t\tprint(` Would patch all casing variants of \"${input.type}-template\" → \"${input.name}\"`);\n\t\tif (input.description) print(` Would replace <description> → \"${input.description}\"`);\n\t\tif (input.homepage) print(` Would replace <homepage> → \"${input.homepage}\"`);\n\t\tif (input.runtimeEnvironment) print(` Would replace <runtime_environment> → \"${input.runtimeEnvironment}\"`);\n\t\tprint(` Would generate holocron.config.ts`);\n\t\tlogger.info({ repo: newRepo, status: \"dry-run\" }, \"new: done\");\n\t\treturn { status: \"dry-run\" };\n\t}\n\n\tif (existsSync(repoDir)) {\n\t\tthrow new NewError(`\\`${repoDir}\\` already exists — delete it or pick a different name.`);\n\t}\n\n\tprint(` Creating ${newRepo} from template ${templateRepo}…`);\n\tconst visibility = input.openSource ? \"--public\" : \"--private\";\n\ttry {\n\t\texecFn(\"gh\", [\"repo\", \"create\", newRepo, `--template=${templateRepo}`, visibility, \"--clone\"], {\n\t\t\tcwd,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t} catch (err) {\n\t\tthrow new NewError(`gh repo create failed: ${errorMessage(err)}`);\n\t}\n\n\tif (input.isTemplate) {\n\t\ttry {\n\t\t\texecFn(\"gh\", [\"repo\", \"edit\", newRepo, \"--template=true\"], { cwd, stdio: \"inherit\" });\n\t\t} catch {\n\t\t\t// non-fatal — template flag can be set manually in repo settings\n\t\t}\n\t}\n\n\t// gh repo create --template does not reliably honor --public/--private on all\n\t// plan/org combinations, so set visibility explicitly after creation.\n\ttry {\n\t\texecFn(\"gh\", [\"repo\", \"edit\", newRepo, `--visibility=${input.openSource ? \"public\" : \"private\"}`], {\n\t\t\tcwd,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t} catch {\n\t\t// non-fatal — visibility can be changed manually in repo settings\n\t}\n\n\t// Detect template slug from cloned package.json\n\tlet templateSlug = `${input.type}-template`;\n\tconst pkgJsonPath = path.join(repoDir, \"package.json\");\n\tif (existsSync(pkgJsonPath)) {\n\t\ttry {\n\t\t\tconst pkg = JSON.parse(readFn(pkgJsonPath)) as { name?: string };\n\t\t\tif (typeof pkg.name === \"string\") {\n\t\t\t\ttemplateSlug = pkg.name.split(\"/\").at(-1) || templateSlug;\n\t\t\t}\n\t\t} catch {\n\t\t\t// fall back to derived slug\n\t\t}\n\t}\n\n\tprint(` Detected template slug: ${templateSlug}`);\n\tprint(` Patching files…`);\n\n\tconst variants = deriveVariants(templateSlug, input.name);\n\t// Prepend the full org/slug pair so GitHub URLs and scoped package names\n\t// use the correct org. Must come before the slug-only pairs so it takes\n\t// priority — e.g. \"@theholocron/node-template\" becomes \"@<org>/<name>\"\n\t// rather than \"@theholocron/<name>\".\n\tvariants.unshift([`theholocron/${templateSlug}`, `${org}/${input.name}`]);\n\tconst filesPatched = patchFiles(\n\t\trepoDir,\n\t\tvariants,\n\t\tinput.description,\n\t\tinput.homepage,\n\t\tinput.runtimeEnvironment,\n\t\tprint,\n\t\treadFn,\n\t\twriteFn,\n\t\twalkFn\n\t);\n\n\tprint(` ${filesPatched.length} file${filesPatched.length === 1 ? \"\" : \"s\"} patched`);\n\n\t// Always overwrite description and homepage in package.json directly,\n\t// regardless of whether the template used placeholders or real values.\n\tif (input.description !== undefined || input.homepage !== undefined) {\n\t\ttry {\n\t\t\tconst raw = readFn(pkgJsonPath);\n\t\t\tconst pkg = JSON.parse(raw) as Record<string, unknown>;\n\t\t\tif (input.description !== undefined) pkg[\"description\"] = input.description;\n\t\t\tif (input.homepage !== undefined) pkg[\"homepage\"] = input.homepage;\n\t\t\twriteFn(pkgJsonPath, stringifyJson(pkg, { like: raw }));\n\t\t\tprint(` ✓ package.json (description/homepage)`);\n\t\t} catch {\n\t\t\t// non-fatal — placeholder replacement already covered it\n\t\t}\n\t}\n\n\t// Update the root tsconfig.json \"display\" field by parsing the JSON directly\n\t// rather than relying on a <display_name> placeholder. Templates can use their\n\t// real human-readable display name; we always overwrite it with the title-case\n\t// of the new repo name on scaffolding.\n\tconst displayName = input.name.split(\"-\").map(cap).join(\" \");\n\tconst rootTsconfigPath = path.join(repoDir, \"tsconfig.json\");\n\ttry {\n\t\tconst rawTsconfig = readFn(rootTsconfigPath);\n\t\tconst tsconfig = JSON.parse(rawTsconfig) as Record<string, unknown>;\n\t\tif (typeof tsconfig[\"display\"] === \"string\") {\n\t\t\ttsconfig[\"display\"] = displayName;\n\t\t\twriteFn(rootTsconfigPath, stringifyJson(tsconfig, { like: rawTsconfig }));\n\t\t\tprint(` ✓ tsconfig.json (display)`);\n\t\t}\n\t} catch {\n\t\t// non-fatal — no tsconfig or no display field\n\t}\n\n\t// Generate and write holocron.config.ts\n\tconst configContent = generateHolocronConfig({\n\t\tname: input.name,\n\t\ttype: input.type,\n\t\torg,\n\t\tdescription: input.description,\n\t\thomepage: input.homepage,\n\t\tvaultProvider: input.vaultProvider,\n\t\tvaultProject: input.vaultProject,\n\t\tvaultConfig: input.vaultConfig,\n\t\tdeploymentProvider: input.deploymentProvider,\n\t\tagent: input.agent,\n\t\truntimeEnvironment: input.runtimeEnvironment,\n\t\tprotection: input.protection,\n\t\topenSource: input.openSource,\n\t\tusesExternalPackages: input.usesExternalPackages,\n\t\ttopics: input.topics,\n\t\tskills: input.skills,\n\t});\n\tconst configPath = path.join(repoDir, \"holocron.config.ts\");\n\twriteFn(configPath, configContent);\n\tprint(` Generated holocron.config.ts`);\n\n\texecFn(\"git\", [\"add\", \"-A\"], { cwd: repoDir, stdio: \"inherit\" });\n\texecFn(\"git\", [\"commit\", \"-s\", \"-m\", `chore: bootstrap from ${templateSlug}`], {\n\t\tcwd: repoDir,\n\t\tstdio: \"inherit\",\n\t});\n\n\tif (!input.noVerify) {\n\t\tprint(\"\");\n\t\tprint(\" Installing dependencies…\");\n\t\ttry {\n\t\t\texecFn(\"pnpm\", [\"install\"], { cwd: repoDir, stdio: \"inherit\" });\n\t\t} catch (err) {\n\t\t\tprint(` ✗ pnpm install failed — ${errorMessage(err)}`);\n\t\t\treturn {\n\t\t\t\tstatus: \"fail\",\n\t\t\t\trepoDir,\n\t\t\t\tfilesPatched,\n\t\t\t\tmessage: \"pnpm install failed; inspect output above\",\n\t\t\t};\n\t\t}\n\n\t\tprint(\"\");\n\t\tprint(\" Running holocron repo setup…\");\n\t\ttry {\n\t\t\tconst setupArgs: string[] = [\"setup\"];\n\t\t\tconst setupEnv: Record<string, string> = {};\n\n\t\t\t// Admin token: drives rulesets, repo settings, workflows, Pages.\n\t\t\t// Prefer the value forwarded via --token; fall back to keychain.\n\t\t\tconst adminToken = input.token ?? keychainLookup(\"github.admin\");\n\t\t\tif (adminToken) setupArgs.push(\"--token\", adminToken);\n\n\t\t\t// Org token: drives team assignments and custom properties.\n\t\t\t// Skip keychain if already in env (subprocess inherits it anyway).\n\t\t\tif (!env.get(\"HOLOCRON_ORG_TOKEN\")) {\n\t\t\t\tconst orgToken = keychainLookup(\"github.org\");\n\t\t\t\tif (orgToken) setupEnv[\"HOLOCRON_ORG_TOKEN\"] = orgToken;\n\t\t\t}\n\n\t\t\t// Deploy token: drives GitHub Pages configuration.\n\t\t\tif (!env.get(\"HOLOCRON_DEPLOY_TOKEN\")) {\n\t\t\t\tconst deployToken = keychainLookup(\"github.deploy\");\n\t\t\t\tif (deployToken) setupEnv[\"HOLOCRON_DEPLOY_TOKEN\"] = deployToken;\n\t\t\t}\n\n\t\t\texecFn(\"holocron\", setupArgs, { cwd: repoDir, stdio: \"inherit\", env: setupEnv });\n\t\t} catch {\n\t\t\tprint(\" ✗ holocron repo setup failed — run it manually after checking your config\");\n\t\t}\n\t}\n\n\tprint(\"\");\n\tprint(` Scaffolded ${newRepo} (${filesPatched.length} file${filesPatched.length === 1 ? \"\" : \"s\"} patched).`);\n\tprint(\"\");\n\tprint(\" Next:\");\n\tprint(` 1. cd ${repoDir}`);\n\tif (input.noVerify) {\n\t\tprint(` 2. pnpm install`);\n\t\tprint(` 3. holocron repo setup # wire up secrets, teams, labels, etc.`);\n\t\tprint(` 4. git push -u origin HEAD`);\n\t} else {\n\t\tprint(` 2. git push -u origin HEAD`);\n\t}\n\n\tlogger.info({ repo: newRepo, repoDir, filesPatched, status: \"ok\" }, \"new: done\");\n\treturn { status: \"ok\", repoDir, filesPatched };\n}\n","import { readdirSync, readFileSync, statSync, writeFileSync } from \"node:fs\";\nimport { join, relative, resolve } from \"node:path\";\n\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { listWorkspacePackagesSync } from \"@theholocron/pkg-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type { NpmBumpVersionsReport, RunNpmBumpVersionsInput } from \"./npm-bump-versions.type.js\";\n\nexport async function runNpmBumpVersions(input: RunNpmBumpVersionsInput): Promise<NpmBumpVersionsReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst { version, dryRun = false } = input;\n\tconst readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\tconst writeFile = input.writeFile ?? ((p: string, c: string) => writeFileSync(p, c));\n\tconst listDir = input.listDir ?? ((p: string) => readdirSync(p) as string[]);\n\tconst isDir = input.isDir ?? ((p: string) => statSync(p).isDirectory());\n\n\tconst bumped: string[] = [];\n\tconst skipped: string[] = [];\n\n\tprint(`Bumping monorepo to ${version}${dryRun ? \" (dry-run)\" : \"\"}…`);\n\tlogger.info({ version, dryRun: dryRun || undefined }, \"npm bump-versions: start\");\n\n\tfunction bumpFile(absPath: string, label: string): void {\n\t\tlet pkg: Record<string, unknown>;\n\t\tlet raw: string;\n\t\ttry {\n\t\t\traw = readFile(absPath);\n\t\t\tpkg = JSON.parse(raw) as Record<string, unknown>;\n\t\t} catch {\n\t\t\tprint(` ✗ could not parse ${label}`);\n\t\t\treturn;\n\t\t}\n\t\tconst old = pkg.version as string;\n\t\tif (!dryRun) {\n\t\t\tpkg.version = version;\n\t\t\twriteFile(absPath, stringifyJson(pkg, { like: raw }));\n\t\t}\n\t\tprint(` ${dryRun ? \"~\" : \"✓\"} ${label}: ${old} → ${version}`);\n\t\tbumped.push(label);\n\t}\n\n\t// Root is always bumped — private means \"don't publish\", not \"don't version\".\n\tbumpFile(join(cwd, \"package.json\"), \"root\");\n\n\t// Each root no-ops safely when its dir doesn't exist — a single-package\n\t// repo with neither just gets the root bump.\n\tconst listed = new Set<string>();\n\tconst workspace = listWorkspacePackagesSync(cwd, {\n\t\treadFile,\n\t\tlistDirs: (dir) => {\n\t\t\tlet names: string[];\n\t\t\ttry {\n\t\t\t\tnames = listDir(dir);\n\t\t\t} catch {\n\t\t\t\tthrow Object.assign(new Error(`ENOENT: ${dir}`), { code: \"ENOENT\" });\n\t\t\t}\n\t\t\treturn names.filter((name) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (!isDir(join(dir, name))) return false;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tlisted.add(join(dir, name));\n\t\t\t\treturn true;\n\t\t\t});\n\t\t},\n\t});\n\tconst found = new Set(workspace.map((entry) => entry.dir));\n\tfor (const dir of listed) {\n\t\tif (!found.has(dir)) print(` ! skipping ${relative(resolve(cwd), dir)}: no package.json or malformed JSON`);\n\t}\n\tfor (const { dir, relativeDir, manifest } of workspace) {\n\t\tif (manifest.private) {\n\t\t\tprint(` · skipping private package ${relativeDir}`);\n\t\t\tskipped.push(relativeDir);\n\t\t\tcontinue;\n\t\t}\n\t\tbumpFile(join(dir, \"package.json\"), relativeDir);\n\t}\n\n\tconst status = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ version, status, bumped: bumped.length, skipped: skipped.length }, \"npm bump-versions: done\");\n\treturn { status, bumped, skipped };\n}\n","/**\n * Shared input record for every template module.\n *\n * Every template exports `(inputs: TemplateInputs) => string` and reads\n * from this record. Keeping the surface small + typechecked lets the\n * templates stay dumb string builders while the command layer handles\n * normalization + defaulting from user input.\n */\n\nimport type { CapabilityKey } from \"../../../plugin/index.js\";\nimport type { TemplateInputs } from \"./template-inputs.type.js\";\n\n/** Derive the standard defaults from a slug + vendor name. */\nexport function deriveDefaults(input: {\n\tslug: string;\n\tvendorName: string;\n\tcapability: CapabilityKey;\n}): Pick<TemplateInputs, \"vendorUpper\" | \"capabilityClass\" | \"tokenEnv\" | \"transport\"> {\n\tconst vendorUpper = input.slug.toUpperCase().replace(/-/g, \"_\");\n\tconst capability = input.capability;\n\tconst capabilityClass = `${input.vendorName}${capability.charAt(0).toUpperCase() + capability.slice(1)}`;\n\treturn {\n\t\tvendorUpper,\n\t\tcapabilityClass,\n\t\ttokenEnv: `HOLOCRON_${vendorUpper}_TOKEN`,\n\t\ttransport: \"rest\",\n\t};\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `import { AuthError, createResolveToken, type ResolveTokenInput } from \"@theholocron/cli\";\n\nexport { AuthError };\nexport type { ResolveTokenInput };\n\nexport const resolveToken = createResolveToken({\n\\tenvName: \"${inputs.tokenEnv}\",\n\\tvendorEnvName: \"${inputs.vendorEnv}\",\n\\tkeyringService: \"${inputs.slug}\",\n\\terrorMessage:\n\\t\\t\"no ${inputs.vendorName} token found. Pass --token <TOKEN>, set ${inputs.tokenEnv} / ${inputs.vendorEnv}, \" +\n\\t\\t\"or run: holocron auth set ${inputs.slug} <TOKEN>\",\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { AuthError, resolveToken } from \"../auth.js\";\n\nconst noKeyring = () => null;\n\ndescribe(\"resolveToken\", () => {\n\tit(\"prefers --token over env vars + keyring\", () => {\n\t\texpect(\n\t\t\tresolveToken({\n\t\t\t\tcliToken: \"flag\",\n\t\t\t\tenv: { ${inputs.tokenEnv}: \"hlc\", ${inputs.vendorEnv}: \"vendor\" },\n\t\t\t\tkeyring: () => \"kr\",\n\t\t\t})\n\t\t).toBe(\"flag\");\n\t});\n\n\tit(\"prefers ${inputs.tokenEnv} over ${inputs.vendorEnv}\", () => {\n\t\texpect(\n\t\t\tresolveToken({\n\t\t\t\tenv: { ${inputs.tokenEnv}: \"hlc\", ${inputs.vendorEnv}: \"vendor\" },\n\t\t\t\tkeyring: noKeyring,\n\t\t\t})\n\t\t).toBe(\"hlc\");\n\t});\n\n\tit(\"falls back to ${inputs.vendorEnv} when ${inputs.tokenEnv} is unset\", () => {\n\t\texpect(resolveToken({ env: { ${inputs.vendorEnv}: \"vendor\" }, keyring: noKeyring })).toBe(\"vendor\");\n\t});\n\n\tit(\"falls back to keyring when env vars are unset\", () => {\n\t\texpect(resolveToken({ env: {}, keyring: (p) => (p === \"${inputs.slug}\" ? \"kr\" : null) })).toBe(\"kr\");\n\t});\n\n\tit(\"throws AuthError with a helpful message when nothing is set\", () => {\n\t\tconst err = (() => {\n\t\t\ttry {\n\t\t\t\tresolveToken({ env: {}, keyring: noKeyring });\n\t\t\t} catch (e) {\n\t\t\t\treturn e;\n\t\t\t}\n\t\t})();\n\t\texpect(err).toBeInstanceOf(AuthError);\n\t\texpect((err as Error).message).toMatch(/${inputs.tokenEnv}/);\n\t\texpect((err as Error).message).toMatch(/holocron auth set ${inputs.slug}/);\n\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst clientClass = `${inputs.vendorName}RestClient`;\n\tconst capabilityInterface = inputs.capability.charAt(0).toUpperCase() + inputs.capability.slice(1);\n\treturn `/**\n * \\`${inputs.capability}\\` capability for ${inputs.vendorName}.\n *\n * Methods are STUBS — implement them against ${inputs.vendorName}'s\n * REST API per the \\`${capabilityInterface}\\` interface contract in\n * \\`@theholocron/cli\\`.\n *\n * TODO once you've stubbed the interface methods, restore the type\n * import + \\`implements\\` clause:\n * import type { ${capabilityInterface} } from \"@theholocron/cli\";\n * export class ${inputs.capabilityClass} implements ${capabilityInterface} { ... }\n */\n\nimport type { ${clientClass} } from \"../rest.js\";\n\nexport class ${inputs.capabilityClass} {\n\treadonly key = \"${inputs.capability}\" as const;\n\treadonly providerName = \"${inputs.slug}\";\n\n\tconstructor(private readonly rest: () => ${clientClass}) {}\n\n\t// TODO: implement the ${capabilityInterface} interface methods\n\t// (see \\`packages/cli/src/capabilities/index.ts\\`). Each method\n\t// should hit a specific ${inputs.vendorName} REST endpoint via\n\t// \\`this.rest().request(...)\\` — call the thunk so the token is\n\t// resolved lazily. Once methods are stubbed, add\n\t// \\`implements ${capabilityInterface}\\` to the class declaration\n\t// above and remove the \\`as unknown as\\` cast in src/index.ts.\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { ${inputs.capabilityClass} } from \"../capabilities/${inputs.capability}.js\";\nimport { ${factoryName} } from \"../rest.js\";\nimport { stubFetch } from \"./helpers.js\";\n\n// Stub client used by the constructor smoke test. Real capability\n// tests replace this with per-method stubs once implementations land.\nfunction makeCapability() {\n\tconst stub = stubFetch([]);\n\tconst rest = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\treturn new ${inputs.capabilityClass}(() => rest);\n}\n\ndescribe(\"${inputs.capabilityClass}\", () => {\n\tit(\"constructs with a REST client\", () => {\n\t\texpect(makeCapability().key).toBe(\"${inputs.capability}\");\n\t});\n\n\t// TODO: implement one test per ${inputs.capability} capability method\n\t// as you fill in the class stubs. See other plugins for reference\n\t// patterns:\n\t// - REST behaviors (URL / method / body / query) via \\`stub.calls\\`\n\t// - Error paths via \\`stubFetch([{ status: 4xx, body: {...} }])\\`\n\t// - Idempotency (409 handling for ensure* methods, if applicable)\n\tit.todo(\"implement per-method tests\");\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import type { Linter } from \"eslint\";\n\nimport root from \"../../eslint.config.js\";\n\nexport default [...root, { ignores: [\"dist/**\", \"coverage/**\"] }] satisfies Linter.Config[];\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { vi, type Mock } from \"vitest\";\n\nexport interface FetchCall {\n\turl: string;\n\tmethod: string;\n\theaders: Record<string, string>;\n\tbody: unknown;\n}\n\nexport interface FetchStub {\n\tfetch: typeof fetch;\n\tcalls: FetchCall[];\n\tmock: Mock;\n}\n\nexport function stubFetch(responses: Array<{ status?: number; body?: unknown; text?: string }>): FetchStub {\n\tconst calls: FetchCall[] = [];\n\tlet i = 0;\n\tconst mock = vi.fn(async (input: string | URL, init?: RequestInit) => {\n\t\tconst url = typeof input === \"string\" ? input : input.toString();\n\t\tconst body = typeof init?.body === \"string\" ? safeJsonParse(init.body) : (init?.body ?? null);\n\t\tcalls.push({\n\t\t\turl,\n\t\t\tmethod: (init?.method ?? \"GET\").toUpperCase(),\n\t\t\theaders: (init?.headers as Record<string, string>) ?? {},\n\t\t\tbody,\n\t\t});\n\t\tconst next = responses[i++] ?? { status: 200, body: {} };\n\t\tconst status = next.status ?? 200;\n\t\tif (status === 204 || status === 205 || status === 304) {\n\t\t\treturn new Response(null, { status });\n\t\t}\n\t\tconst text = next.text ?? (typeof next.body === \"string\" ? next.body : JSON.stringify(next.body ?? {}));\n\t\treturn new Response(text, { status });\n\t});\n\treturn { fetch: mock as unknown as typeof fetch, calls, mock };\n}\n\nfunction safeJsonParse(s: string): unknown {\n\ttry {\n\t\treturn JSON.parse(s);\n\t} catch {\n\t\treturn s;\n\t}\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { AUTH_HINT, createPlugin } from \"../index.js\";\nimport { stubFetch } from \"./helpers.js\";\n\ndescribe(\"createPlugin\", () => {\n\tit(\"wires the ${inputs.capability} capability against the given fetch + token\", () => {\n\t\tconst stub = stubFetch([]);\n\t\tconst plugin = createPlugin({\n\t\t\tcliToken: \"test-token\",\n\t\t\tfetch: stub.fetch,\n\t\t});\n\t\texpect(plugin.name).toBe(\"@theholocron/holocron-plugin-${inputs.slug}\");\n\t\texpect(typeof plugin.capabilities.${inputs.capability}).toBe(\"function\");\n\t});\n});\n\ndescribe(\"AUTH_HINT\", () => {\n\tit(\"mentions the holocron auth set command\", () => {\n\t\texpect(AUTH_HINT).toMatch(/holocron auth set ${inputs.slug}/);\n\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst keywords = [inputs.capability, \"holocron\", \"plugin\", inputs.slug].sort((a, b) => a.localeCompare(b));\n\treturn (\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tname: `@theholocron/holocron-plugin-${inputs.slug}`,\n\t\t\t\tversion: \"2.0.0-alpha.1\",\n\t\t\t\tdescription: `Holocron plugin for ${inputs.vendorName}. Implements the ${inputs.capability} capability against ${inputs.vendorName}'s REST API, plus exports verifyToken + AUTH_HINT for \\`holocron auth\\`.`,\n\t\t\t\tkeywords,\n\t\t\t\thomepage: `https://github.com/theholocron/holocron/tree/main/plugins/holocron-plugin-${inputs.slug}#readme`,\n\t\t\t\tbugs: \"https://github.com/theholocron/holocron/issues\",\n\t\t\t\trepository: {\n\t\t\t\t\ttype: \"git\",\n\t\t\t\t\turl: \"git+https://github.com/theholocron/holocron.git\",\n\t\t\t\t\tdirectory: `plugins/holocron-plugin-${inputs.slug}`,\n\t\t\t\t},\n\t\t\t\tlicense: \"MIT\",\n\t\t\t\tauthor: \"Newton Koumantzelis\",\n\t\t\t\tsideEffects: false,\n\t\t\t\ttype: \"module\",\n\t\t\t\texports: {\n\t\t\t\t\t\".\": {\n\t\t\t\t\t\ttypes: \"./dist/index.d.mts\",\n\t\t\t\t\t\timport: \"./dist/index.mjs\",\n\t\t\t\t\t\tdefault: \"./dist/index.mjs\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tscripts: {\n\t\t\t\t\t// delivery.build stays a direct tool invocation, never `holocron\n\t\t\t\t\t// run` — it's what produces the holocron binary, so it can never\n\t\t\t\t\t// depend on holocron already existing. The other three tasks are\n\t\t\t\t\t// safe to gateway through holocron: this template already\n\t\t\t\t\t// declares @theholocron/cli as a real devDependency below, giving\n\t\t\t\t\t// turbo the edge it needs to build cli (and transitively\n\t\t\t\t\t// astromech) before this package's own script ever runs.\n\t\t\t\t\t\"delivery.build\": \"tsdown\",\n\t\t\t\t\t\"sourceQuality.staticAnalysis\": \"holocron run sourceQuality.staticAnalysis --\",\n\t\t\t\t\t\"verification.typeSafety\": \"holocron run verification.typeSafety --\",\n\t\t\t\t\t\"verification.unitTests\": \"holocron run verification.unitTests --\",\n\t\t\t\t\t\"test:watch\": \"vitest\",\n\t\t\t\t\tvalidate: \"tsx scripts/validate.mjs\",\n\t\t\t\t},\n\t\t\t\tpeerDependencies: { \"@theholocron/cli\": \"workspace:*\", \"@theholocron/misc-utils\": \"catalog:utils\" },\n\t\t\t\tdevDependencies: {\n\t\t\t\t\t\"@theholocron/cli\": \"workspace:*\",\n\t\t\t\t\t\"@theholocron/misc-utils\": \"catalog:utils\",\n\t\t\t\t\t\"@theholocron/tsconfig\": \"catalog:configs\",\n\t\t\t\t\t\"@types/node\": \"catalog:\",\n\t\t\t\t\t\"@vitest/coverage-v8\": \"catalog:\",\n\t\t\t\t\teslint: \"catalog:\",\n\t\t\t\t\tglobals: \"catalog:\",\n\t\t\t\t\ttsdown: \"catalog:\",\n\t\t\t\t\ttsx: \"catalog:\",\n\t\t\t\t\ttypescript: \"catalog:\",\n\t\t\t\t\tvitest: \"catalog:\",\n\t\t\t\t},\n\t\t\t\tengines: { node: \">=22\" },\n\t\t\t\tpublishConfig: { access: \"public\" },\n\t\t\t\tfiles: [\"dist\"],\n\t\t\t},\n\t\t\tnull,\n\t\t\t2\n\t\t) + \"\\n\"\n\t);\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst clientClass = `${inputs.vendorName}RestClient`;\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\t// Camel-case capability name is used as the factory function name.\n\tconst capabilityInterface = inputs.capability.charAt(0).toUpperCase() + inputs.capability.slice(1);\n\treturn `/**\n * \\`@theholocron/holocron-plugin-${inputs.slug}\\` — entrypoint.\n *\n * Implements the \\`${inputs.capability}\\` capability against ${inputs.vendorName}'s\n * REST API. Also exports \\`verifyToken\\` + \\`AUTH_HINT\\` for\n * \\`holocron auth\\`. See README for auth + config docs.\n *\n * TODO: once you fill in the ${inputs.capabilityClass} methods and add\n * \\`implements ${capabilityInterface}\\` to the class, add the type import:\n * import type { ${capabilityInterface} } from \"@theholocron/cli\";\n * and set \\`: ${capabilityInterface}\\` as the factory return type below.\n */\n\nimport { resolveToken, type ResolveTokenInput } from \"./auth.js\";\nimport { ${inputs.capabilityClass} } from \"./capabilities/${inputs.capability}.js\";\nimport { ${factoryName}, type ${clientClass} } from \"./rest.js\";\n\nexport interface ${inputs.vendorName}PluginOptions extends ResolveTokenInput {\n\t/** Override base URL for tests. */\n\tbaseUrl?: string;\n\t/** Override \\`fetch\\` for tests. */\n\tfetch?: typeof fetch;\n}\n\nexport interface PluginContext {\n\toptions: ${inputs.vendorName}PluginOptions;\n\t/** Memoized client — the token is resolved on first use, not at plugin load. */\n\trest: () => ${clientClass};\n}\n\nexport function createContext(options: ${inputs.vendorName}PluginOptions): PluginContext {\n\tlet rest: ${clientClass} | undefined;\n\treturn {\n\t\toptions,\n\t\trest: () => {\n\t\t\tif (rest) return rest;\n\t\t\tconst restOpts: { token: string; baseUrl?: string; fetch?: typeof fetch } = {\n\t\t\t\ttoken: resolveToken(options),\n\t\t\t};\n\t\t\tif (options.baseUrl !== undefined) restOpts.baseUrl = options.baseUrl;\n\t\t\tif (options.fetch !== undefined) restOpts.fetch = options.fetch;\n\t\t\treturn (rest = ${factoryName}(restOpts));\n\t\t},\n\t};\n}\n\nexport function ${inputs.capability}(ctx: PluginContext) {\n\t// Return type inferred at scaffold time — the class doesn't yet\n\t// \\`implements ${capabilityInterface}\\`. Add the type import + the\n\t// \\`: ${capabilityInterface}\\` annotation once methods are stubbed.\n\treturn new ${inputs.capabilityClass}(ctx.rest);\n}\n\nexport function createPlugin(options: ${inputs.vendorName}PluginOptions) {\n\tconst ctx = createContext(options);\n\treturn {\n\t\tname: \"@theholocron/holocron-plugin-${inputs.slug}\",\n\t\tcapabilities: {\n\t\t\t${inputs.capability}: () => ${inputs.capability}(ctx),\n\t\t},\n\t};\n}\n\n/**\n * One-line hint printed by \\`holocron auth set ${inputs.slug}\\` when no\n * token is supplied or the supplied token is rejected. Edit this to\n * point operators at the specific ${inputs.vendorName} docs path for\n * generating a token.\n */\nexport const AUTH_HINT =\n\t\"generate a ${inputs.vendorName} API token, then run: holocron auth set ${inputs.slug} <TOKEN>\";\n\n// ── Public re-exports ────────────────────────────────────────────────\n\nexport * from \"./auth.js\";\nexport { type ${clientClass}, ${factoryName} } from \"./rest.js\";\nexport { ${inputs.capabilityClass} } from \"./capabilities/${inputs.capability}.js\";\nexport { verifyToken } from \"./verify-token.js\";\nexport type { VerifyTokenFailure, VerifyTokenResult, VerifyTokenSuccess } from \"@theholocron/cli\";\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn `<!-- editorconfig-checker-disable-file -->\n\n# \\`@theholocron/holocron-plugin-${inputs.slug}\\`\n\n${inputs.vendorName} plugin for [Holocron](../cli). Implements the\n\\`${inputs.capability}\\` capability against [${inputs.vendorName}'s REST API](${inputs.baseUrl}),\nplus exports \\`verifyToken\\` + \\`AUTH_HINT\\` for use by \\`holocron auth\\`.\n\n## Install\n\n\\`\\`\\`bash\npnpm add -D @theholocron/holocron-plugin-${inputs.slug}@alpha\n\\`\\`\\`\n\n## Auth\n\nToken resolution order (matches the standard 4-step precedence set by\n\\`docs/wiki/specifications/tech-auth-bootstrap.spec.md\\`):\n\n1. \\`--token <TOKEN>\\` flag on the holocron invocation\n2. \\`${inputs.tokenEnv}\\` env var (preferred — explicit intent)\n3. \\`${inputs.vendorEnv}\\` env var (${inputs.vendorName}-native)\n4. **Keyring** — \\`com.theholocron.cli\\` service, account \\`${inputs.slug}\\`\n5. \\`AuthError\\` naming all four options + the bootstrap hint\n\n## Setup\n\n\\`\\`\\`bash\n# Generate a ${inputs.vendorName} API token (see vendor docs), then:\nholocron auth set ${inputs.slug} <TOKEN>\nholocron auth check ${inputs.slug} # verify\n\\`\\`\\`\n\n## Config\n\n\\`\\`\\`jsonc\n{\n\t\"providers\": {\n\t\t\"${inputs.capability}\": \"${inputs.slug}\",\n\t},\n}\n\\`\\`\\`\n\nPlugin options extend \\`ResolveTokenInput\\` — add whatever ${inputs.vendorName}-\nspecific options you need here (project id, workspace slug, etc.) via\nthe tuple form:\n\n\\`\\`\\`jsonc\n{\n\t\"providers\": {\n\t\t\"${inputs.capability}\": [\"${inputs.slug}\", { \"baseUrl\": \"${inputs.baseUrl}\" }],\n\t},\n}\n\\`\\`\\`\n\n## What's implemented\n\nTODO: fill in as capability methods land.\n\n## Status\n\n**\\`v2.0.0-alpha.1\\`** — scaffolded via \\`holocron new plugin\\`.\nNot yet published; capability methods are stubs.\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\tconst clientType = `${inputs.vendorName}RestClient`;\n\treturn `import { createRestClient, type RestClient } from \"@theholocron/cli\";\n\nexport type { RestClient };\n\n/**\n * TODO: narrow this to the specific ${inputs.vendorName} endpoints this\n * plugin's capability needs (see \\`@theholocron/holocron-plugin-axiom\\`'s\n * \\`rest.ts\\` for the pattern: an interface with one method per endpoint,\n * built internally via \\`createRestClient\\`). Starts as an alias for the\n * generic client so the scaffold compiles end to end immediately.\n */\nexport type ${clientType} = RestClient;\n\nexport function ${factoryName}(opts: {\n\\ttoken: string;\n\\tbaseUrl?: string;\n\\tfetch?: typeof fetch;\n}): ${clientType} {\n\\treturn createRestClient({\n\\t\\tbaseUrl: opts.baseUrl ?? \"${inputs.baseUrl}\",\n\\t\\ttoken: opts.token,\n\\t\\tvendor: \"${inputs.vendorName}\",\n\\t\\tfetch: opts.fetch,\n\\t});\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\treturn `import { ProviderApiError } from \"@theholocron/cli\";\nimport { describe, expect, it } from \"vitest\";\n\nimport { ${factoryName} } from \"../rest.js\";\nimport { stubFetch } from \"./helpers.js\";\n\ndescribe(\"${factoryName}\", () => {\n\\tit(\"sends bearer + accept headers and returns the parsed body\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 200, body: { ok: true } }]);\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\\t\\tconst res = await client.request<{ ok: boolean }>(\"/me\");\n\\t\\texpect(res.ok).toBe(true);\n\\t\\texpect(stub.calls[0]?.headers[\"authorization\"]).toBe(\"Bearer t\");\n\\t\\texpect(stub.calls[0]?.headers[\"accept\"]).toBe(\"application/json\");\n\\t});\n\n\\tit(\"serializes body as JSON and sets content-type when present\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 200, body: {} }]);\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\\t\\tawait client.request<unknown>(\"/resource\", { method: \"POST\", body: { name: \"demo\" } });\n\\t\\texpect(stub.calls[0]?.method).toBe(\"POST\");\n\\t\\texpect(stub.calls[0]?.headers[\"content-type\"]).toBe(\"application/json\");\n\\t\\texpect(stub.calls[0]?.body).toEqual({ name: \"demo\" });\n\\t});\n\n\\tit(\"returns undefined on 204\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 204 }]);\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: stub.fetch });\n\\t\\texpect(await client.request<unknown>(\"/whatever\")).toBeUndefined();\n\\t});\n\n\\tit(\"throws ProviderApiError with the HTTP status on non-2xx\", async () => {\n\\t\\tconst stub = stubFetch([{ status: 401, body: { messages: [\"invalid\"] } }]);\n\\t\\tconst client = ${factoryName}({ token: \"bad\", fetch: stub.fetch });\n\\t\\tconst err = await client.request<unknown>(\"/me\").catch((e: unknown) => e);\n\\t\\texpect(err).toBeInstanceOf(ProviderApiError);\n\\t\\texpect((err as ProviderApiError).status).toBe(401);\n\\t});\n\n\\tit(\"wraps transport-level failures with status 0\", async () => {\n\\t\\tconst throwing: typeof fetch = async () => { throw new TypeError(\"fetch failed\"); };\n\\t\\tconst client = ${factoryName}({ token: \"t\", fetch: throwing });\n\\t\\tconst err = await client.request<unknown>(\"/me\").catch((e: unknown) => e);\n\\t\\texpect(err).toBeInstanceOf(ProviderApiError);\n\\t\\texpect((err as ProviderApiError).status).toBe(0);\n\\t});\n\n\\tit(\"trims trailing slashes from the base URL\", () => {\n\\t\\tconst client = ${factoryName}({ token: \"t\", baseUrl: \"${inputs.baseUrl}//\" });\n\\t\\texpect(client.baseUrl).toBe(\"${inputs.baseUrl}\");\n\\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\treturn (\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tdisplay: `Holocron Plugin: ${inputs.vendorName}`,\n\t\t\t\textends: \"@theholocron/tsconfig/node-lts\",\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\tbaseUrl: \"./\",\n\t\t\t\t\toutDir: \"./dist\",\n\t\t\t\t\tpaths: { \"@/*\": [\"./src/*\"] },\n\t\t\t\t},\n\t\t\t\tinclude: [\"src/**/*.ts\"],\n\t\t\t\texclude: [\"node_modules\", \"dist\"],\n\t\t\t},\n\t\t\tnull,\n\t\t\t2\n\t\t) + \"\\n\"\n\t);\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { defineConfig } from \"tsdown\";\n\nexport default defineConfig({\n\tentry: [\"src/index.ts\"],\n\tformat: \"esm\",\n\tdts: true,\n\tclean: true,\n\tdeps: { neverBundle: [/^@theholocron\\\\//] },\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\n/**\n * Scaffolds `scripts/validate.mjs` — a smoke-test the operator runs\n * against a live vendor account to verify the plugin's REST endpoints,\n * auth, and response parsing all work in reality (the unit tests only\n * exercise stubbed HTTP responses). READ-ONLY BY DESIGN.\n *\n * Convention: every plugin ships this script + a matching `validate`\n * entry in `package.json`'s scripts block, so operators run\n * `pnpm --filter @theholocron/holocron-plugin-<slug> validate`.\n * Capability-specific args (project id, workspace, etc.) come from\n * positional command-line arguments; the plugin author fills in the\n * exact shape per their vendor.\n *\n * Includes a `hintFor(message)` helper the operator customizes with\n * vendor-specific \"here's the likely fix\" guidance for common error\n * shapes (401 / 403 / 404 / network / 5xx). Points users at docs and\n * setup steps rather than leaving them staring at a raw stack trace.\n */\nexport function render(inputs: TemplateInputs): string {\n\treturn `#!/usr/bin/env node\n/**\n * Read-only smoke test for @theholocron/holocron-plugin-${inputs.slug} against\n * a live ${inputs.vendorName} account.\n *\n * READ-ONLY BY DESIGN. Never calls write(), or bootstrap methods\n * (\\`ensureProject\\`, \\`ensureEnvironment\\`, etc.). Any ERROR line means\n * the plugin needs adjusting — the \\`hintFor\\` helper below points at\n * the most likely fix per error shape.\n *\n * Auth: reads the ${inputs.vendorName} token from holocron's keyring —\n * you must have run \\`pnpm holocron auth set ${inputs.slug} <TOKEN>\\` first.\n *\n * Usage:\n * pnpm --filter @theholocron/holocron-plugin-${inputs.slug} validate <arg1> [arg2] ...\n *\n * TODO: replace the positional args below with whatever your\n * capability's methods need (e.g., project id, environment slug,\n * secret name). Adapt the test steps to your capability's method\n * surface. Model on \\`plugins/holocron-plugin-infisical/scripts/validate.mjs\\`.\n */\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- filled in by operator\nimport { AuthError, createPlugin, resolveToken, verifyToken } from \"../src/index.ts\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nconst args = process.argv.slice(2);\n\nif (args.length === 0) {\n\tconsole.error(\"usage: pnpm --filter @theholocron/holocron-plugin-${inputs.slug} validate <args>\");\n\tprocess.exit(2);\n}\n\n// Use the plugin's own auth resolution so the validate script honors\n// the same 4-step precedence as the plugin's runtime:\n// --token → ${inputs.tokenEnv} → ${inputs.vendorEnv} → keyring\n// (--token isn't available here since this is a bare Node script;\n// the other three all work.)\nlet token;\ntry {\n\ttoken = resolveToken();\n} catch (err) {\n\tif (err instanceof AuthError) {\n\t\tconsole.error(err.message);\n\t\tconsole.error(\" see: plugins/holocron-plugin-${inputs.slug}/README.md#setup\");\n\t\tprocess.exit(2);\n\t}\n\tthrow err;\n}\n\nconsole.log(\"Validating @theholocron/holocron-plugin-${inputs.slug} (READ-ONLY)\");\nconsole.log(\"\");\n\n// ── 1. verifyToken ─────────────────────────────────────────────────\nconsole.log(\"[1/N] verifyToken\");\nconst verifyResult = await verifyToken(token);\nconsole.log(\\` \\${verifyResult.ok ? \"✓\" : \"✗\"} \\${JSON.stringify(verifyResult)}\\`);\nif (!verifyResult.ok) {\n\tconst hint = hintFor(verifyResult.message);\n\tif (hint) console.log(\\` hint: \\${hint}\\`);\n}\nconsole.log(\"\");\n\n// ── 2..N. capability method calls ──────────────────────────────────\n// TODO: implement one \\`runStep\\`-wrapped call per meaningful read-side\n// capability method. Model on the infisical validate.mjs. Never call\n// write / ensure* / other mutating paths.\n//\n// Example:\n// console.log(\"[2/N] vault.list()\");\n// await runStep(async () => {\n// const keys = await vault.list();\n// console.log(\\` ✓ \\${keys.length} secrets\\`);\n// });\n\nconsole.log(\"Done. Fill in capability method calls above before shipping.\");\n\n// ── helpers ────────────────────────────────────────────────────────\n\n/** Wrap a capability call, print ERROR + hint on failure. */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- called once a real capability check replaces the TODO example above\nasync function runStep(body) {\n\ttry {\n\t\tawait body();\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tconsole.log(\\` ✗ ERROR: \\${message}\\`);\n\t\tconst hint = hintFor(message);\n\t\tif (hint) console.log(\\` hint: \\${hint}\\`);\n\t}\n}\n\n/**\n * Point the operator at the most likely fix based on the error shape.\n * Generic defaults below — CUSTOMIZE per your vendor's docs URLs and\n * common permission/config gotchas.\n */\nfunction hintFor(message) {\n\tif (/→ 401/.test(message)) {\n\t\treturn \"token invalid — regenerate per ${inputs.vendorName}'s docs (see README §Setup)\";\n\t}\n\tif (/→ 403/.test(message)) {\n\t\treturn \"token authenticates but lacks scope — check the token/identity has permissions on the resource\";\n\t}\n\tif (/→ 404/.test(message)) {\n\t\treturn \"endpoint or resource not found — verify your positional args match a real resource\";\n\t}\n\tif (/fetch failed|status: 0|network/i.test(message)) {\n\t\treturn \"network error — check the base URL (${inputs.baseUrl}) and connectivity\";\n\t}\n\tif (/→ 5\\\\d\\\\d/.test(message)) {\n\t\treturn \"server error — vendor-side. Retry, and check the vendor's status page if persistent\";\n\t}\n\treturn null;\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(inputs: TemplateInputs): string {\n\tconst factoryName = `create${inputs.vendorName}RestClient`;\n\treturn `/**\n * \\`verifyToken\\` — plugin-level export used by \\`holocron auth set\\` +\n * \\`holocron auth check\\`. Hits a lightweight whoami-style endpoint\n * and translates the response into the normalized \\`VerifyTokenResult\\`\n * shape.\n *\n * Kept as a standalone function (not a capability method) so the auth\n * command can call it without initializing the full plugin — plugin\n * construction requires an already-resolved token, which is exactly\n * what we don't have yet at bootstrap time.\n *\n * TODO: replace \\`/me\\` with the ${inputs.vendorName} equivalent of a\n * \"check my token\" endpoint. Common shapes: \\`/user\\`, \\`/whoami\\`,\n * \\`/me\\`, \\`/account\\`.\n */\n\nimport type { VerifyTokenResult } from \"@theholocron/cli\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { ${factoryName} } from \"./rest.js\";\n\ninterface MeResponse {\n\t/** Adjust to whatever ${inputs.vendorName}'s whoami endpoint returns. */\n\tname?: string;\n\temail?: string;\n\tid?: string;\n}\n\nexport interface VerifyTokenOptions {\n\tbaseUrl?: string;\n\tfetch?: typeof fetch;\n}\n\nexport async function verifyToken(token: string, opts: VerifyTokenOptions = {}): Promise<VerifyTokenResult> {\n\tconst restOpts: { token: string; baseUrl?: string; fetch?: typeof fetch } = { token };\n\tif (opts.baseUrl !== undefined) restOpts.baseUrl = opts.baseUrl;\n\tif (opts.fetch !== undefined) restOpts.fetch = opts.fetch;\n\tconst rest = ${factoryName}(restOpts);\n\ttry {\n\t\tconst me = await rest.request<MeResponse>(\"/me\");\n\t\t// Optional chaining because \\`me\\` is \\`undefined\\` on 204 / empty body.\n\t\tconst subject = me?.email ?? me?.name ?? me?.id ?? \"unknown\";\n\t\treturn { ok: true, subject: \\`user @ \\${subject}\\` };\n\t} catch (err) {\n\t\treturn { ok: false, message: errorMessage(err) };\n\t}\n}\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { describe, expect, it } from \"vitest\";\n\nimport { verifyToken } from \"../verify-token.js\";\nimport { stubFetch } from \"./helpers.js\";\n\ndescribe(\"verifyToken\", () => {\n\tit(\"returns ok with a subject when /me returns 200\", async () => {\n\t\tconst stub = stubFetch([{ status: 200, body: { email: \"user@example.com\" } }]);\n\t\tconst result = await verifyToken(\"token\", { fetch: stub.fetch });\n\t\texpect(result.ok).toBe(true);\n\t\texpect((result as { ok: boolean; subject?: string }).subject).toMatch(/user@example.com/);\n\t});\n\n\tit(\"returns ok:false with the error message on 401\", async () => {\n\t\tconst stub = stubFetch([{ status: 401, body: { messages: [\"Invalid token\"] } }]);\n\t\tconst result = await verifyToken(\"bad\", { fetch: stub.fetch });\n\t\texpect(result.ok).toBe(false);\n\t\texpect((result as { ok: boolean; message?: string }).message).toMatch(/→ 401/);\n\t});\n\n\tit(\"returns ok:false when the network layer throws\", async () => {\n\t\tconst throwing: typeof fetch = async () => {\n\t\t\tthrow new TypeError(\"network down\");\n\t\t};\n\t\tconst result = await verifyToken(\"t\", { fetch: throwing });\n\t\texpect(result.ok).toBe(false);\n\t\texpect((result as { ok: boolean; message?: string }).message).toMatch(/network down/);\n\t});\n});\n`;\n}\n","import type { TemplateInputs } from \"../template-inputs/index.js\";\n\nexport function render(_inputs: TemplateInputs): string {\n\treturn `import { defineConfig } from \"vitest/config\";\n\nexport default defineConfig({\n\ttest: {\n\t\tenvironment: \"node\",\n\t\tglobals: false,\n\t\tcoverage: {\n\t\t\tprovider: \"v8\",\n\t\t\treporter: [\"text\", \"html\", \"json-summary\"],\n\t\t\tinclude: [\"src/**/*.ts\"],\n\t\t\texclude: [\"src/**/__tests__/**\", \"src/**/*.test.ts\", \"src/index.ts\"],\n\t\t\tthresholds: { lines: 0, functions: 0, branches: 0, statements: 0 },\n\t\t},\n\t},\n});\n`;\n}\n","/**\n * `holocron new plugin <slug> <vendor>` — scaffold a new plugin\n * package matching the proven template.\n *\n * Design: see `docs/wiki/specifications/tool-plugin-create.spec.md`.\n *\n * Flow:\n * 1. Preflight — verify CWD is a workspace root (pnpm-workspace.yaml\n * + packages/ dir present).\n * 2. Slug collision — plugins/holocron-plugin-<slug>/ must not exist.\n * 3. Capability sanity — must be one of the 14 known keys; warn for\n * many-cardinality caps.\n * 4. Generate — for each template, write to\n * plugins/holocron-plugin-<slug>/<path>.\n * 5. Verify (unless --no-verify) — runs pnpm install +\n * pnpm --filter <pkg> typecheck lint test.\n * 6. Print next steps.\n */\n\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { type CapabilityKey, CARDINALITY } from \"../../plugin/index.js\";\nimport type {\n\tPluginCreateReport,\n\tPluginCreateWizardArgs,\n\tPluginCreateWizardPrompts,\n\tRunPluginCreateInput,\n\tTemplateEntry,\n} from \"./index.type.js\";\nimport { deriveDefaults, type TemplateInputs } from \"./template-inputs/index.js\";\nimport { render as renderAuth } from \"./templates/auth.js\";\nimport { render as renderAuthTest } from \"./templates/auth-test.js\";\nimport { render as renderCapability } from \"./templates/capability.js\";\nimport { render as renderCapabilityTest } from \"./templates/capability-test.js\";\nimport { render as renderEslintConfig } from \"./templates/eslint-config.js\";\nimport { render as renderHelpers } from \"./templates/helpers.js\";\nimport { render as renderIndexTest } from \"./templates/index-test.js\";\nimport { render as renderPackageJson } from \"./templates/package-json.js\";\nimport { render as renderPluginIndex } from \"./templates/plugin-index.js\";\nimport { render as renderReadme } from \"./templates/readme.js\";\nimport { render as renderRest } from \"./templates/rest.js\";\nimport { render as renderRestTest } from \"./templates/rest-test.js\";\nimport { render as renderTsconfigJson } from \"./templates/tsconfig-json.js\";\nimport { render as renderTsdownConfig } from \"./templates/tsdown-config.js\";\nimport { render as renderValidateScript } from \"./templates/validate-script.js\";\nimport { render as renderVerifyToken } from \"./templates/verify-token.js\";\nimport { render as renderVerifyTokenTest } from \"./templates/verify-token-test.js\";\nimport { render as renderVitestConfig } from \"./templates/vitest-config.js\";\n\n/**\n * Resolve `capability`, `vendorEnv`, and `baseUrl` from argv or by calling\n * the supplied prompt functions for any that are absent. Extracted from\n * `cli.ts` so the resolution logic is unit-testable.\n */\nexport async function resolvePluginCreateInputs(\n\targs: PluginCreateWizardArgs,\n\tprompts: PluginCreateWizardPrompts\n): Promise<{ capability: CapabilityKey; vendorEnv: string; baseUrl: string }> {\n\tconst capability = (args.capability ?? (await prompts.selectCapability())) as CapabilityKey;\n\tconst vendorEnv = args.vendorEnv ?? (await prompts.inputVendorEnv());\n\tconst baseUrl = args.baseUrl ?? (await prompts.inputBaseUrl());\n\treturn { capability, vendorEnv, baseUrl };\n}\n\nexport class PluginCreateError extends Error {\n\toverride name = \"PluginCreateError\";\n}\n\nconst TEMPLATES: TemplateEntry[] = [\n\t// Config (5)\n\t{ path: \"package.json\", render: renderPackageJson },\n\t{ path: \"tsconfig.json\", render: renderTsconfigJson },\n\t{ path: \"vitest.config.ts\", render: renderVitestConfig },\n\t{ path: \"eslint.config.ts\", render: renderEslintConfig },\n\t{ path: \"tsdown.config.ts\", render: renderTsdownConfig },\n\t// Docs (1)\n\t{ path: \"README.md\", render: renderReadme },\n\t// Source (5) — capability path uses the dynamic capability slug.\n\t{ path: \"src/auth.ts\", render: renderAuth },\n\t{ path: \"src/rest.ts\", render: renderRest },\n\t{ path: \"src/verify-token.ts\", render: renderVerifyToken },\n\t{ path: \"src/index.ts\", render: renderPluginIndex },\n\t{ path: \"src/capabilities/{{capability}}.ts\", render: renderCapability },\n\t// Tests (6)\n\t{ path: \"src/__tests__/helpers.ts\", render: renderHelpers },\n\t{ path: \"src/__tests__/auth.test.ts\", render: renderAuthTest },\n\t{ path: \"src/__tests__/rest.test.ts\", render: renderRestTest },\n\t{ path: \"src/__tests__/verify-token.test.ts\", render: renderVerifyTokenTest },\n\t{ path: \"src/__tests__/{{capability}}.test.ts\", render: renderCapabilityTest },\n\t{ path: \"src/__tests__/index.test.ts\", render: renderIndexTest },\n\t// Live-account validation script (1) — read-only smoke test.\n\t{ path: \"scripts/validate.mjs\", render: renderValidateScript },\n];\n\n/** Replace `{{capability}}` in a template path with the actual capability key. */\nfunction resolvePath(template: string, inputs: TemplateInputs): string {\n\treturn template.replace(/\\{\\{capability\\}\\}/g, inputs.capability);\n}\n\n// ── Orchestrator ────────────────────────────────────────────────────\n\nexport function runPluginCreate(input: RunPluginCreateInput): PluginCreateReport {\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst write = input.writeFile ?? defaultWrite;\n\n\tpreflight(cwd);\n\tvalidateSlug(input.slug);\n\tvalidateVendorName(input.vendorName);\n\n\tconst packageDir = path.join(cwd, \"plugins\", `holocron-plugin-${input.slug}`);\n\tif (existsSync(packageDir)) {\n\t\tthrow new PluginCreateError(`\\`${packageDir}\\` already exists — edit in place or pick a different slug.`);\n\t}\n\n\tvalidateCapability(input.capability, print);\n\n\tconst derived = deriveDefaults({\n\t\tslug: input.slug,\n\t\tvendorName: input.vendorName,\n\t\tcapability: input.capability,\n\t});\n\tconst inputs: TemplateInputs = {\n\t\tslug: input.slug,\n\t\tvendorName: input.vendorName,\n\t\tvendorUpper: derived.vendorUpper,\n\t\tcapability: input.capability,\n\t\tcapabilityClass: derived.capabilityClass,\n\t\ttokenEnv: input.tokenEnv ?? derived.tokenEnv,\n\t\tvendorEnv: input.vendorEnv,\n\t\t// Normalize: strip trailing slashes so the embedded value in the\n\t\t// generated rest-test.ts matches what the client trims at runtime.\n\t\tbaseUrl: trimTrailingSlashes(input.baseUrl),\n\t\ttransport: derived.transport,\n\t};\n\n\tconst filesWritten: string[] = [];\n\tprint(`Scaffolding @theholocron/holocron-plugin-${inputs.slug}${input.dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` → ${packageDir}`);\n\tlogger.info(\n\t\t{ slug: inputs.slug, capability: inputs.capability, dryRun: input.dryRun || undefined },\n\t\t\"plugin create: start\"\n\t);\n\tfor (const template of TEMPLATES) {\n\t\tconst resolvedPath = resolvePath(template.path, inputs);\n\t\tconst filepath = path.join(packageDir, resolvedPath);\n\t\tconst content = template.render(inputs);\n\t\tif (input.dryRun) {\n\t\t\tprint(` … would write ${resolvedPath} (${content.length} bytes)`);\n\t\t} else {\n\t\t\twrite(filepath, content);\n\t\t\tprint(` ✓ ${resolvedPath}`);\n\t\t}\n\t\tfilesWritten.push(resolvedPath);\n\t}\n\n\tif (!input.dryRun && !input.noVerify) {\n\t\tconst execFn = input.exec ?? defaultExec;\n\t\tconst pkg = `@theholocron/holocron-plugin-${inputs.slug}`;\n\t\tprint(\"\");\n\t\tprint(\" Verifying scaffold…\");\n\t\ttry {\n\t\t\texecFn(\"pnpm\", [\"install\", \"--frozen-lockfile=false\"], { cwd, stdio: \"inherit\" });\n\t\t\texecFn(\"pnpm\", [\"--filter\", pkg, \"verification.typeSafety\"], { cwd, stdio: \"inherit\" });\n\t\t\texecFn(\"pnpm\", [\"--filter\", pkg, \"sourceQuality.staticAnalysis\"], { cwd, stdio: \"inherit\" });\n\t\t\texecFn(\"pnpm\", [\"--filter\", pkg, \"verification.unitTests\"], { cwd, stdio: \"inherit\" });\n\t\t\tprint(\" ✓ scaffold verified\");\n\t\t} catch (err) {\n\t\t\tconst message = errorMessage(err);\n\t\t\tprint(` ✗ verify failed — ${message}`);\n\t\t\tlogger.warn(\n\t\t\t\t{ slug: inputs.slug, files: filesWritten.length, reason: message, status: \"fail\" },\n\t\t\t\t\"plugin create: done\"\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tstatus: \"fail\",\n\t\t\t\tpackagePath: packageDir,\n\t\t\t\tfilesWritten,\n\t\t\t\tmessage: \"post-scaffold verify failed; inspect output above\",\n\t\t\t};\n\t\t}\n\t}\n\n\tif (!input.dryRun) {\n\t\tprintNextSteps(print, inputs);\n\t}\n\n\tlogger.info(\n\t\t{\n\t\t\tslug: inputs.slug,\n\t\t\tcapability: inputs.capability,\n\t\t\tfiles: filesWritten.length,\n\t\t\tstatus: input.dryRun ? \"dry-run\" : \"ok\",\n\t\t},\n\t\t\"plugin create: done\"\n\t);\n\treturn { status: \"ok\", packagePath: packageDir, filesWritten };\n}\n\n// ── Internals ───────────────────────────────────────────────────────\n\nfunction preflight(cwd: string): void {\n\tif (!existsSync(path.join(cwd, \"pnpm-workspace.yaml\"))) {\n\t\tthrow new PluginCreateError(\n\t\t\t`\\`pnpm-workspace.yaml\\` not found in \\`${cwd}\\`. Run \\`holocron new plugin\\` from the monorepo root.`\n\t\t);\n\t}\n\tif (!existsSync(path.join(cwd, \"packages\"))) {\n\t\tthrow new PluginCreateError(`\\`packages/\\` directory not found in \\`${cwd}\\`.`);\n\t}\n}\n\n/**\n * npm-package-name conventions: kebab-case, starts with lowercase\n * letter. Rejecting numeric-prefixed slugs also sidesteps the\n * `env.HOLOCRON_1FOO_TOKEN` invalid-identifier trap in the auth\n * template.\n */\nconst SLUG_RE = /^[a-z][a-z0-9-]*$/;\n\nfunction validateSlug(slug: string): void {\n\tif (!SLUG_RE.test(slug)) {\n\t\tthrow new PluginCreateError(\n\t\t\t`invalid slug \"${slug}\" — must be kebab-case: lowercase letter followed by lowercase letters, digits, or hyphens. ` +\n\t\t\t\t`Examples: \"clerk\", \"cloud-flare\", \"doppler\".`\n\t\t);\n\t}\n}\n\n/** PascalCase — starts with uppercase, alphanumeric only. */\nconst VENDOR_NAME_RE = /^[A-Z][a-zA-Z0-9]*$/;\n\nfunction validateVendorName(name: string): void {\n\tif (!VENDOR_NAME_RE.test(name)) {\n\t\tthrow new PluginCreateError(\n\t\t\t`invalid vendor name \"${name}\" — must be PascalCase: starts with uppercase, alphanumeric only. ` +\n\t\t\t\t`Examples: \"Clerk\", \"CloudFlare\", \"Doppler\".`\n\t\t);\n\t}\n}\n\n/**\n * Trim trailing slashes with a plain loop (no regex — matches the\n * rest.ts template's own trimming to stay ReDoS-safe under CodeQL).\n */\nfunction trimTrailingSlashes(url: string): string {\n\tlet out = url;\n\twhile (out.endsWith(\"/\")) out = out.slice(0, -1);\n\treturn out;\n}\n\nfunction validateCapability(capability: CapabilityKey, print: (line: string) => void): void {\n\tif (!(capability in CARDINALITY)) {\n\t\tthrow new PluginCreateError(\n\t\t\t`\\`${capability}\\` is not a known capability. See \\`packages/cli/src/capabilities/index.ts\\`.`\n\t\t);\n\t}\n\tif (CARDINALITY[capability] === \"many\") {\n\t\tprint(\n\t\t\t` ! ${capability} is a many-cardinality capability — multiple providers can be active at once. ` +\n\t\t\t\t\"Confirm your config wiring accordingly.\"\n\t\t);\n\t}\n}\n\nfunction defaultWrite(filepath: string, content: string): void {\n\tmkdirSync(path.dirname(filepath), { recursive: true });\n\twriteFileSync(filepath, content, \"utf8\");\n}\n\nfunction defaultExec(cmd: string, args: string[], opts: { cwd: string; stdio: \"inherit\" }): void {\n\texecFileSync(cmd, args, { cwd: opts.cwd, stdio: opts.stdio });\n}\n\nfunction printNextSteps(print: (line: string) => void, inputs: TemplateInputs): void {\n\tprint(\"\");\n\tprint(` Scaffolded @theholocron/holocron-plugin-${inputs.slug} (18 files).`);\n\tprint(\"\");\n\tprint(\" Next:\");\n\tprint(\n\t\t` 1. pnpm install # picks up the workspace package`\n\t);\n\tprint(` 2. pnpm --filter @theholocron/holocron-plugin-${inputs.slug} typecheck # green`);\n\tprint(` 3. pnpm --filter @theholocron/holocron-plugin-${inputs.slug} lint # green`);\n\tprint(\n\t\t` 4. pnpm --filter @theholocron/holocron-plugin-${inputs.slug} test # green (stubs pass, real tests are it.todo)`\n\t);\n\tprint(` 5. Implement ${inputs.capabilityClass} methods in src/capabilities/${inputs.capability}.ts`);\n\tprint(` 6. Replace it.todo(...) with real tests in src/__tests__/${inputs.capability}.test.ts`);\n\tprint(\" 7. Commit + push when capability is functionally complete.\");\n}\n","import { spawnSync } from \"node:child_process\";\n\nimport type { RunPublishInput } from \"./run-publish/index.js\";\n\nexport const defaultExec: NonNullable<RunPublishInput[\"exec\"]> = async (cmd, args, opts) => {\n\tconst result = spawnSync(cmd, args, {\n\t\tcwd: opts.cwd,\n\t\tencoding: \"utf8\",\n\t\tstdio: [\"inherit\", \"pipe\", \"pipe\"],\n\t});\n\treturn {\n\t\texitCode: result.status ?? -1,\n\t\tstdout: result.stdout ?? \"\",\n\t\tstderr: result.stderr ?? \"\",\n\t};\n};\n","import { spawnSync } from \"node:child_process\";\n\nimport type { RunPublishInput } from \"./run-publish/index.js\";\n\n/**\n * Fully interactive — `npm login --auth-type=web` prints a URL and waits for\n * the browser flow to complete; the operator needs to see that live, so all\n * three stdio streams are inherited (unlike `defaultExec`, which pipes\n * stdout/stderr for capture).\n */\nexport const defaultLogin: NonNullable<RunPublishInput[\"login\"]> = async (cwd) => {\n\tconst result = spawnSync(\"npm\", [\"login\", \"--auth-type=web\"], { cwd, stdio: \"inherit\" });\n\treturn { exitCode: result.status ?? -1 };\n};\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport function hasPackagesDir(cwd: string): boolean {\n\treturn existsSync(join(cwd, \"packages\"));\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/** `plugins/` — vendor capability providers, split from `packages/` as a sibling workspace root (#993). */\nexport function hasPluginsDir(cwd: string): boolean {\n\treturn existsSync(join(cwd, \"plugins\"));\n}\n","import { listWorkspacePackagesSync, type PackageJson, readPackageJsonSync } from \"@theholocron/pkg-utils\";\n\nimport { hasPackagesDir } from \"./has-packages-dir.js\";\nimport { hasPluginsDir } from \"./has-plugins-dir.js\";\n\n/**\n * Monorepo (`packages/` and/or `plugins/` present): every workspace under\n * either. Single package (neither dir present): the root `package.json`.\n * Callers keep the public ones.\n */\nexport function discoverManifests(cwd: string): { manifest: PackageJson; dir: string }[] {\n\tif (!hasPackagesDir(cwd) && !hasPluginsDir(cwd)) {\n\t\tconst manifest = readPackageJsonSync(cwd);\n\t\treturn manifest ? [{ manifest, dir: \".\" }] : [];\n\t}\n\treturn listWorkspacePackagesSync(cwd).map(({ manifest, relativeDir }) => ({ manifest, dir: `./${relativeDir}` }));\n}\n","import { discoverManifests } from \"./discover-manifests.js\";\n\n/** The names of `discoverPublicPackageEntries`' packages, without requiring a version. */\nexport function discoverPublicPackages(cwd: string): readonly string[] {\n\treturn discoverManifests(cwd).flatMap(({ manifest }) =>\n\t\t!manifest.private && manifest.name ? [manifest.name] : []\n\t);\n}\n","import type { CliEnv } from \"../../env/index.js\";\nimport type { PublishPrint } from \"./publish.type.js\";\n\nexport function printNextSteps(\n\tprint: PublishPrint,\n\tenv: CliEnv,\n\tpackageNames: readonly string[],\n\trepoName: string\n): void {\n\tprint(\"\");\n\tprint(\" → next: configure Trusted Publisher for each package on npm:\");\n\tfor (const name of packageNames) {\n\t\tprint(` https://www.npmjs.com/package/${name}/access`);\n\t}\n\tprint(` Publisher: GitHub Actions Org: theholocron Repo: ${repoName} Workflow: delivery.publish.yml`);\n\n\tif (env.get(\"NPM_TOKEN\")) {\n\t\tprint(\"\");\n\t\tprint(\" → cleanup: $NPM_TOKEN was used. Revoke it now (no API for self-revoke; UI-only):\");\n\t\tprint(\" https://www.npmjs.com/settings/~/tokens\");\n\t}\n}\n","import { readGitRemote } from \"@theholocron/git-utils\";\n\nimport type { RunPublishInput } from \"./run-publish/index.js\";\n\nexport async function resolveRepoName(cwd: string, exec: NonNullable<RunPublishInput[\"exec\"]>): Promise<string> {\n\tconst remote = await readGitRemote(cwd, {\n\t\texec: async (args, options) => {\n\t\t\tconst result = await exec(\"git\", args, options);\n\t\t\tif (result.exitCode !== 0) throw new Error(`git ${args.join(\" \")} exited ${result.exitCode}`);\n\t\t\treturn result.stdout;\n\t\t},\n\t});\n\treturn remote?.repo ?? \"unknown\";\n}\n","import { hasPackagesDir } from \"./has-packages-dir.js\";\nimport { hasPluginsDir } from \"./has-plugins-dir.js\";\n\n/**\n * `-r --filter=./packages/* --filter=./plugins/*` — whichever workspace\n * roots exist. Empty (single-package repo, no `-r`) when neither does.\n * Shared by every `pnpm publish` invocation below so a repo with only\n * `plugins/*` (or both) is covered the same as `packages/*`-only.\n */\nexport function workspaceFilterArgs(cwd: string): string[] {\n\tconst filters: string[] = [];\n\tif (hasPackagesDir(cwd)) filters.push(\"--filter=./packages/*\");\n\tif (hasPluginsDir(cwd)) filters.push(\"--filter=./plugins/*\");\n\treturn filters.length > 0 ? [\"-r\", ...filters] : [];\n}\n","/**\n * `holocron package publish --initial` — bottles up the chicken-and-egg bootstrap\n * that every new npm-published holocron monorepo hits.\n *\n * npm requires a package to exist before Trusted Publishing can be\n * configured on it. So the first publish has to happen outside the OIDC\n * flow — a browser-auth session (`npm login --auth-type=web`) or an\n * ephemeral automation token. This command drives the login step itself\n * (when `npm whoami` shows you're not authenticated), runs the publish\n * step, and tells you exactly what to do next.\n *\n * Workflow:\n *\n * $ pnpm install --frozen-lockfile\n * $ pnpm build\n * $ pnpm exec tsx packages/cli/src/cli.ts package publish --initial\n *\n * `npm login --auth-type=web` runs automatically the first time — no\n * separate manual step. `pnpm install` + `pnpm build` stay outside the\n * command (no pnpm-inside-pnpm).\n *\n * `--initial` is required today — this command only implements the\n * bootstrap publish. A non-initial `holocron package publish` (for a manual publish\n * outside the semantic-release/OIDC steady state) isn't built yet; the flag\n * exists so the surface doesn't need another rename when it is.\n *\n * If `NPM_TOKEN` is detected in env, the command prints a final\n * \"revoke this token at <url>\" reminder — same pattern as `rando vc\n * setup` for the ephemeral GH admin PAT.\n */\n\nimport { makeEnv } from \"../../../env/index.js\";\nimport { getLogger } from \"../../../observability/logger/index.js\";\nimport { defaultExec } from \"../default-exec.js\";\nimport { defaultLogin } from \"../default-login.js\";\nimport { discoverPublicPackages } from \"../discover-public-packages.js\";\nimport { printNextSteps } from \"../print-next-steps.js\";\nimport type { PublishReport } from \"../publish.type.js\";\nimport { resolveRepoName } from \"../resolve-repo-name.js\";\nimport { workspaceFilterArgs } from \"../workspace-filter-args.js\";\nimport type { RunPublishInput } from \"./run-publish.type.js\";\n\nexport async function runPublish(input: RunPublishInput = {}): Promise<PublishReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst tag = input.tag ?? \"alpha\";\n\tconst dryRun = input.dryRun ?? false;\n\tconst otp = input.otp;\n\tconst env = makeEnv(input.env);\n\tconst exec = input.exec ?? defaultExec;\n\tconst login = input.login ?? defaultLogin;\n\n\t// Two repo layouts: a monorepo (`packages/*` and/or `plugins/*`, this\n\t// repo's own shape) and a single package at the root (most\n\t// `node-template` scaffolds — neither dir). `pnpm -r --filter=./packages/*`\n\t// silently matches zero workspaces in the latter and exits 0 — build the\n\t// right invocation for whichever layout is on disk. Shared between\n\t// dry-run preview and the real call so what we print is exactly what\n\t// we'd run.\n\tconst publishArgs = [\n\t\t...workspaceFilterArgs(cwd),\n\t\t\"publish\",\n\t\t\"--access\",\n\t\t\"public\",\n\t\t\"--no-git-checks\",\n\t\t\"--tag\",\n\t\ttag,\n\t\t...(otp ? [\"--otp\", otp] : []),\n\t];\n\n\tprint(`Holocron publish --initial${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` cwd: ${cwd}`);\n\tprint(` tag: ${tag}`);\n\tlogger.info({ tag, dryRun: dryRun || undefined }, \"publish --initial: start\");\n\tif (otp) print(` otp: <${otp.length} chars>`);\n\tprint(\"\");\n\n\t// ── 1. Verify npm auth — log in automatically if not ────────────────\n\tprint(\" → verifying npm auth (`npm whoami`)…\");\n\tlet whoami = await exec(\"npm\", [\"whoami\"], { cwd });\n\tif (whoami.exitCode !== 0) {\n\t\tprint(\" not authenticated — running `npm login --auth-type=web`…\");\n\t\tlogger.info({}, \"publish --initial: npm login\");\n\t\tconst loginResult = await login(cwd);\n\t\tif (loginResult.exitCode !== 0) {\n\t\t\tconst message = \"npm login failed. Run `npm login --auth-type=web` (or `npm login`) manually, then re-run.\";\n\t\t\tprint(` ✗ ${message}`);\n\t\t\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\t\t\tlogger.warn({ reason: \"npm login failed\" }, \"publish --initial: done\");\n\t\t\treturn { status: \"fail\", message, packageNames };\n\t\t}\n\t\twhoami = await exec(\"npm\", [\"whoami\"], { cwd });\n\t\tif (whoami.exitCode !== 0) {\n\t\t\tconst message = \"npm login completed but `npm whoami` still fails — check your npm account.\";\n\t\t\tprint(` ✗ ${message}`);\n\t\t\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\t\t\tlogger.warn({ reason: \"npm whoami still fails after login\" }, \"publish --initial: done\");\n\t\t\treturn { status: \"fail\", message, packageNames };\n\t\t}\n\t}\n\tconst whoamiName = whoami.stdout.trim() || \"<unknown>\";\n\tprint(` ✓ authed as ${whoamiName}`);\n\n\t// ── 2. Resolve dynamic values needed for next-steps ─────────────────\n\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\tconst repoName = input.repoName ?? (await resolveRepoName(cwd, exec));\n\n\t// A `pnpm --filter=./packages/*` (or a bare `pnpm publish`) that matches\n\t// nothing still exits 0 — catch the no-op before it's mistaken for\n\t// success. Applies to dry-run too: the point is to diagnose the\n\t// misconfiguration, not just the real publish.\n\tif (packageNames.length === 0) {\n\t\tconst message = \"nothing to publish (no packages/*, plugins/*, or root package.json is private or unnamed)\";\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ reason: message }, \"publish --initial: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\n\t// ── 3. Publish ──────────────────────────────────────────────────────\n\tif (dryRun) {\n\t\tprint(\"\");\n\t\tprint(\" … (dry-run) skipping actual publish\");\n\t\tprint(` would run: pnpm ${publishArgs.join(\" \")}`);\n\t\tprintNextSteps(print, env, packageNames, repoName);\n\t\tlogger.info({ tag, status: \"dry-run\", packages: packageNames.length }, \"publish --initial: done\");\n\t\treturn { status: \"dry-run\", message: \"dry-run — no publish executed\", packageNames };\n\t}\n\n\tprint(\"\");\n\tprint(\" → publishing all public @theholocron/* packages…\");\n\tconst publish = await exec(\"pnpm\", publishArgs, { cwd });\n\tif (publish.exitCode !== 0) {\n\t\tconst message = `publish failed (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || \"no output\"}`;\n\t\tprint(` ✗ ${message}`);\n\t\t// Detect EOTP and surface the --otp hint right at the failure.\n\t\tif (publish.stdout.includes(\"EOTP\") || publish.stderr.includes(\"EOTP\")) {\n\t\t\tprint(\"\");\n\t\t\tprint(\" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:\");\n\t\t\tprint(` pnpm exec tsx packages/cli/src/cli.ts package publish --initial --otp <6-digit-code>`);\n\t\t}\n\t\tlogger.warn({ tag, reason: message }, \"publish --initial: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\tprint(\" ✓ publish complete\");\n\n\t// ── 4. Next-step reminders ──────────────────────────────────────────\n\tprintNextSteps(print, env, packageNames, repoName);\n\tlogger.info({ tag, status: \"ok\", packages: packageNames.length }, \"publish --initial: done\");\n\treturn { status: \"ok\", packageNames };\n}\n","import { discoverManifests } from \"./discover-manifests.js\";\nimport type { PublicPackageEntry } from \"./public-package-entry.type.js\";\n\n/**\n * Every public package (`!private && name`) with its version and a\n * `pnpm --filter`-ready path — {@link runSteadyPublish}'s `skipAlreadyPublished`\n * mode needs both to check `npm view <pkg>@<version>` and publish one\n * workspace at a time.\n */\nexport function discoverPublicPackageEntries(cwd: string): readonly PublicPackageEntry[] {\n\treturn discoverManifests(cwd).flatMap(({ manifest, dir }) =>\n\t\t!manifest.private && manifest.name && manifest.version\n\t\t\t? [{ name: manifest.name, version: manifest.version, dir }]\n\t\t\t: []\n\t);\n}\n","import { getLogger } from \"../../../observability/logger/index.js\";\nimport { defaultExec } from \"../default-exec.js\";\nimport { discoverPublicPackageEntries } from \"../discover-public-package-entries.js\";\nimport type { PublishReport } from \"../publish.type.js\";\nimport { workspaceFilterArgs } from \"../workspace-filter-args.js\";\nimport type { RunSteadyPublishInput } from \"./run-steady-publish.type.js\";\n\n/**\n * `holocron package publish` (no `--initial`) — the steady-state publish\n * `exec.publishCmd` in `release.config.ts` should call, replacing each\n * repo's hand-typed `pnpm -r --filter=./packages/* publish ...` shell (which\n * differs, today, only in monorepo-vs-single-package, provenance on/off, and\n * whether a repo needs to skip already-published packages) with one uniform\n * invocation. Part of the config-resolution workstream, #676 — see\n * `.notes/tech-config-resolution.spec.md`.\n *\n * Deliberately does not do the `--initial` bootstrap dance (npm\n * login-if-needed, Trusted Publisher next-steps printout) — a steady-state\n * publish runs in CI, authenticated via OIDC automatically, no interactive\n * step involved. Reuses `workspaceFilterArgs()`'s monorepo-vs-single-package\n * detection rather than duplicating it.\n */\nexport async function runSteadyPublish(input: RunSteadyPublishInput = {}): Promise<PublishReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst tag = input.tag ?? \"latest\";\n\tconst dryRun = input.dryRun ?? false;\n\tconst otp = input.otp;\n\tconst exec = input.exec ?? defaultExec;\n\tconst provenance = input.provenance ?? true;\n\tconst skipAlreadyPublished = input.skipAlreadyPublished ?? false;\n\tconst entries = input.packages ?? discoverPublicPackageEntries(cwd);\n\tconst packageNames = entries.map((e) => e.name);\n\n\tprint(`Holocron publish${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` cwd: ${cwd}`);\n\tprint(` tag: ${tag}`);\n\tprint(` provenance: ${provenance}`);\n\tif (skipAlreadyPublished) print(\" skip-already-published: true\");\n\tlogger.info({ tag, provenance, skipAlreadyPublished, dryRun: dryRun || undefined }, \"publish: start\");\n\tif (otp) print(` otp: <${otp.length} chars>`);\n\tprint(\"\");\n\n\tif (entries.length === 0) {\n\t\tconst message = \"nothing to publish (no packages/*, plugins/*, or root package.json is private or unnamed)\";\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ reason: message }, \"publish: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\n\tconst baseFlags = [\"--access\", \"public\", \"--no-git-checks\", \"--tag\", tag, ...(provenance ? [\"--provenance\"] : [])];\n\tconst otpFlags = otp ? [\"--otp\", otp] : [];\n\n\tif (dryRun) {\n\t\tprint(\"\");\n\t\tif (skipAlreadyPublished) {\n\t\t\tfor (const entry of entries) {\n\t\t\t\tprint(` … would check ${entry.name}@${entry.version}, publish if not already on npm`);\n\t\t\t}\n\t\t} else {\n\t\t\tconst args = [...workspaceFilterArgs(cwd), \"publish\", ...baseFlags, ...otpFlags];\n\t\t\tprint(` … (dry-run) skipping actual publish`);\n\t\t\tprint(` would run: pnpm ${args.join(\" \")}`);\n\t\t}\n\t\tlogger.info({ tag, status: \"dry-run\", packages: entries.length }, \"publish: done\");\n\t\treturn { status: \"dry-run\", message: \"dry-run — no publish executed\", packageNames };\n\t}\n\n\tif (skipAlreadyPublished) {\n\t\tprint(\" → publishing packages not already on npm…\");\n\t\tfor (const entry of entries) {\n\t\t\tconst view = await exec(\"npm\", [\"view\", `${entry.name}@${entry.version}`, \"version\"], { cwd });\n\t\t\tif (view.exitCode === 0 && view.stdout.trim()) {\n\t\t\t\tprint(` skip ${entry.name}@${entry.version} (already published)`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst publish = await exec(\"pnpm\", [\"--filter\", entry.dir, \"publish\", ...baseFlags, ...otpFlags], { cwd });\n\t\t\tif (publish.exitCode !== 0) {\n\t\t\t\tconst message = `publish failed for ${entry.name}@${entry.version} (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || \"no output\"}`;\n\t\t\t\tprint(` ✗ ${message}`);\n\t\t\t\tlogger.warn({ tag, package: entry.name, reason: message }, \"publish: done\");\n\t\t\t\treturn { status: \"fail\", message, packageNames };\n\t\t\t}\n\t\t\tprint(` ✓ ${entry.name}@${entry.version}`);\n\t\t}\n\t\tlogger.info({ tag, status: \"ok\", packages: entries.length }, \"publish: done\");\n\t\treturn { status: \"ok\", packageNames };\n\t}\n\n\tprint(\" → publishing all public @theholocron/* packages…\");\n\tconst args = [...workspaceFilterArgs(cwd), \"publish\", ...baseFlags, ...otpFlags];\n\tconst publish = await exec(\"pnpm\", args, { cwd });\n\tif (publish.exitCode !== 0) {\n\t\tconst message = `publish failed (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || \"no output\"}`;\n\t\tprint(` ✗ ${message}`);\n\t\tif (publish.stdout.includes(\"EOTP\") || publish.stderr.includes(\"EOTP\")) {\n\t\t\tprint(\"\");\n\t\t\tprint(\" → hint: your npm account requires 2FA for writes. Re-run with `--otp <code>`:\");\n\t\t\tprint(` pnpm exec holocron package publish --otp <6-digit-code>`);\n\t\t}\n\t\tlogger.warn({ tag, reason: message }, \"publish: done\");\n\t\treturn { status: \"fail\", message, packageNames };\n\t}\n\tprint(\" ✓ publish complete\");\n\tlogger.info({ tag, status: \"ok\", packages: entries.length }, \"publish: done\");\n\treturn { status: \"ok\", packageNames };\n}\n","import type { NpmTrustError } from \"./run-sync-trust/index.js\";\n\nexport function isEotp(parsed: unknown): boolean {\n\treturn (\n\t\ttypeof parsed === \"object\" &&\n\t\tparsed !== null &&\n\t\t\"error\" in parsed &&\n\t\t(parsed as NpmTrustError).error?.code === \"EOTP\"\n\t);\n}\n","export function parseJson(raw: string): unknown {\n\ttry {\n\t\treturn JSON.parse(raw) as unknown;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n","import { getLogger } from \"../../../observability/logger/index.js\";\nimport { defaultExec } from \"../default-exec.js\";\nimport { discoverPublicPackages } from \"../discover-public-packages.js\";\nimport { isEotp } from \"../is-eotp.js\";\nimport { parseJson } from \"../parse-json.js\";\nimport type {\n\tNpmTrustEntry,\n\tNpmTrustError,\n\tRunSyncTrustInput,\n\tSyncTrustPackageResult,\n\tSyncTrustReport,\n} from \"./run-sync-trust.type.js\";\n\n/**\n * `holocron package publish --sync-trust <old-file> <new-file>` — bulk-migrates npm\n * Trusted Publisher (OIDC) config to a new workflow filename across every\n * public package. See issue #689 / `scripts/npm-trust-migrate.sh` (the\n * shell-script prototype this supersedes) for the full \"why\": npm ties\n * Trusted Publisher to a workflow FILENAME per package, so renaming the\n * release workflow breaks OIDC publish (`ENEEDAUTH`) until every package's\n * config is updated to match.\n *\n * Requires npm@11.15.0+ (`npm trust`) — always shells out through\n * `npx -y npm@latest` regardless of the locally-installed npm version.\n *\n * npm's `trust` mutations — and reads, once a short-lived OTP grant lapses —\n * require a fresh interactive browser 2FA approval (an `EOTP` error with an\n * `authUrl`). No token bypasses this (npm's own docs: Granular Access Tokens\n * with the bypass-2FA option are explicitly unsupported for trust commands).\n * This command can't drive that browser step itself, so on the first `EOTP`\n * it stops immediately, prints the `authUrl`, and returns — the operator\n * approves it and re-runs; already-migrated packages are skipped on the next\n * pass, so it's safe to resume from wherever it stopped.\n */\nexport async function runSyncTrust(input: RunSyncTrustInput): Promise<SyncTrustReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst repo = input.repo ?? \"theholocron/holocron\";\n\tconst dryRun = input.dryRun ?? false;\n\tconst exec = input.exec ?? defaultExec;\n\tconst packageNames = input.packages ?? discoverPublicPackages(cwd);\n\tconst npm = \"npx\";\n\tconst npmArgs = [\"-y\", \"npm@latest\"];\n\n\tprint(`Holocron publish --sync-trust${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` ${input.oldFile} -> ${input.newFile} (repo: ${repo})`);\n\tprint(` ${packageNames.length} public packages`);\n\tprint(\"\");\n\tlogger.info({ oldFile: input.oldFile, newFile: input.newFile, packages: packageNames.length }, \"sync-trust: start\");\n\n\tif (packageNames.length === 0) {\n\t\tconst message = \"nothing to sync (no packages/*, plugins/*, or root package.json is private or unnamed)\";\n\t\tprint(` ✗ ${message}`);\n\t\treturn { status: \"fail\", message, packages: [] };\n\t}\n\n\tif (dryRun) {\n\t\tfor (const name of packageNames) print(` … would sync ${name}`);\n\t\treturn { status: \"dry-run\", message: \"dry-run — no npm calls made\", packages: [] };\n\t}\n\n\tconst results: SyncTrustPackageResult[] = [];\n\n\tfor (const name of packageNames) {\n\t\tprint(`=== ${name} ===`);\n\t\tconst listResult = await exec(npm, [...npmArgs, \"trust\", \"list\", name, \"--json\"], { cwd });\n\t\tconst parsed = parseJson(listResult.stdout);\n\n\t\tif (isEotp(parsed)) {\n\t\t\tconst authUrl = (parsed as NpmTrustError).error?.authUrl ?? \"\";\n\t\t\tprint(` needs fresh 2FA — open and approve: ${authUrl}`);\n\t\t\tprint(\" then re-run; already-migrated packages are skipped.\");\n\t\t\tresults.push({ name, status: \"needs-auth\", message: authUrl });\n\t\t\tlogger.warn({ package: name, authUrl }, \"sync-trust: needs auth, stopping\");\n\t\t\treturn { status: \"fail\", message: \"npm 2FA grant needed — see printed authUrl\", packages: results };\n\t\t}\n\n\t\tconst entry = parsed as NpmTrustEntry;\n\t\tif (entry.file === input.newFile) {\n\t\t\tprint(` already on ${input.newFile}, skipping`);\n\t\t\tresults.push({ name, status: \"skipped\" });\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (entry.id) {\n\t\t\tprint(` revoking existing trust (file=${entry.file ?? \"?\"}, id=${entry.id})`);\n\t\t\tconst revoke = await exec(npm, [...npmArgs, \"trust\", \"revoke\", name, \"--id\", entry.id, \"-y\"], { cwd });\n\t\t\tif (revoke.exitCode !== 0 && isEotp(parseJson(revoke.stdout))) {\n\t\t\t\tconst authUrl = (parseJson(revoke.stdout) as NpmTrustError).error?.authUrl ?? \"\";\n\t\t\t\tprint(` needs fresh 2FA — open and approve: ${authUrl}`);\n\t\t\t\tresults.push({ name, status: \"needs-auth\", message: authUrl });\n\t\t\t\treturn { status: \"fail\", message: \"npm 2FA grant needed — see printed authUrl\", packages: results };\n\t\t\t}\n\t\t} else {\n\t\t\tprint(\" no existing trust config found\");\n\t\t}\n\n\t\tprint(` creating trust: ${input.newFile}`);\n\t\tconst create = await exec(\n\t\t\tnpm,\n\t\t\t[\n\t\t\t\t...npmArgs,\n\t\t\t\t\"trust\",\n\t\t\t\t\"github\",\n\t\t\t\tname,\n\t\t\t\t\"--repo\",\n\t\t\t\trepo,\n\t\t\t\t\"--file\",\n\t\t\t\tinput.newFile,\n\t\t\t\t\"--allow-publish\",\n\t\t\t\t\"--allow-stage-publish\",\n\t\t\t\t\"-y\",\n\t\t\t],\n\t\t\t{ cwd }\n\t\t);\n\t\tif (create.exitCode === 0) {\n\t\t\tprint(\" ✓ ok\");\n\t\t\tresults.push({ name, status: \"ok\" });\n\t\t} else {\n\t\t\tconst createParsed = parseJson(create.stdout);\n\t\t\tif (isEotp(createParsed)) {\n\t\t\t\tconst authUrl = (createParsed as NpmTrustError).error?.authUrl ?? \"\";\n\t\t\t\tprint(` needs fresh 2FA — open and approve: ${authUrl}`);\n\t\t\t\tresults.push({ name, status: \"needs-auth\", message: authUrl });\n\t\t\t\treturn { status: \"fail\", message: \"npm 2FA grant needed — see printed authUrl\", packages: results };\n\t\t\t}\n\t\t\tconst message = create.stderr.trim() || create.stdout.trim() || `exit ${create.exitCode}`;\n\t\t\tprint(` ✗ FAILED: ${message}`);\n\t\t\tresults.push({ name, status: \"fail\", message });\n\t\t}\n\t}\n\n\tconst failed = results.filter((r) => r.status === \"fail\");\n\tlogger.info({ ok: results.filter((r) => r.status === \"ok\").length, failed: failed.length }, \"sync-trust: done\");\n\treturn {\n\t\tstatus: failed.length > 0 ? \"fail\" : \"ok\",\n\t\t...(failed.length > 0 ? { message: `${failed.length} package(s) failed` } : {}),\n\t\tpackages: results,\n\t};\n}\n","/**\n * `holocron secrets set` — one-shot single-secret push.\n *\n * Complements `holocron secrets sync` (bulk vault → destinations) for\n * ad-hoc scenarios:\n * - Bootstrap secrets (e.g., NPM_TOKEN on theholocron/holocron itself\n * before the rest of the setup exists)\n * - One-off rotations that don't warrant a vault sync\n * - Setting secrets the vault doesn't track\n *\n * Value source resolution (in priority order):\n * 1. Positional `value` argument\n * 2. `--from-stdin` reads from stdin\n * 3. `--from-env <NAME>` reads from the named env var\n * 4. Implicit: env var matching the secret name (e.g., `NPM_TOKEN`)\n *\n * Errors clearly when no value can be sourced.\n */\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { env } from \"../../env/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { assertPluginsResolvable, PluginLoader, type Secrets, type SecretScope } from \"../../plugin/index.js\";\nimport type { RunSecretSetInput, SecretSetReport } from \"./secret-set.type.js\";\n\nexport async function runSecretSet(input: RunSecretSetInput): Promise<SecretSetReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait loader.load();\n\tassertPluginsResolvable(loader, \"secrets set\");\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst scope: SecretScope = input.scope ?? { kind: \"repo\" };\n\n\tif (!loader.has(\"secrets\")) {\n\t\tthrow new Error(\"`secrets` capability is not configured — add a `secrets` provider to holocron.config.json\");\n\t}\n\n\t// Resolve the value to push, surfacing a clear error when none can be sourced.\n\tconst value = await resolveValue(input);\n\tif (!value) {\n\t\tthrow new Error(\n\t\t\t`no value for secret \\`${input.name}\\` — pass it positionally, via --from-stdin, --from-env <NAME>, or set $${input.name} in the environment`\n\t\t);\n\t}\n\n\tprint(`Holocron secret set — ${input.name} (${describeScope(scope)})${dryRun ? \" (dry-run)\" : \"\"}`);\n\n\tif (dryRun) {\n\t\tconst message = `would: secrets.setSecret(${describeScope(scope)}, ${input.name}, <${value.length} chars>)`;\n\t\tprint(` … ${message}`);\n\t\treturn { status: \"dry-run\", name: input.name, scope, message };\n\t}\n\n\ttry {\n\t\tconst secrets = loader.get(\"secrets\") as Secrets;\n\t\tawait secrets.setSecret(scope, input.name, value);\n\t\tprint(` ✓ set ${input.name} via ${secrets.providerName}`);\n\t\t// `name` is a secret NAME, never the value.\n\t\tlogger.info(\n\t\t\t{ key: input.name, scope: describeScope(scope), provider: secrets.providerName, status: \"ok\" },\n\t\t\t`secret set: ${input.name}`\n\t\t);\n\t\treturn { status: \"ok\", name: input.name, scope };\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ key: input.name, scope: describeScope(scope), reason: message }, `secret set: ${input.name}`);\n\t\treturn { status: \"fail\", name: input.name, scope, message };\n\t}\n}\n\n// ── helpers ──────────────────────────────────────────────────────────\n\nasync function resolveValue(input: RunSecretSetInput): Promise<string | undefined> {\n\tif (input.value) return input.value;\n\tif (input.fromStdin) {\n\t\tconst reader = input.readStdin ?? defaultReadStdin;\n\t\tconst text = await reader();\n\t\treturn text.replace(/\\r?\\n$/, \"\"); // trim trailing newline\n\t}\n\tif (input.fromEnv) {\n\t\treturn env.get(input.fromEnv);\n\t}\n\t// Implicit: env var with the same name as the secret.\n\treturn env.get(input.name);\n}\n\nasync function defaultReadStdin(): Promise<string> {\n\tconst chunks: Buffer[] = [];\n\treturn new Promise<string>((resolve, reject) => {\n\t\tprocess.stdin.on(\"data\", (chunk: Buffer) => chunks.push(chunk));\n\t\tprocess.stdin.on(\"end\", () => resolve(Buffer.concat(chunks).toString(\"utf8\")));\n\t\tprocess.stdin.on(\"error\", reject);\n\t});\n}\n\nfunction describeScope(scope: SecretScope): string {\n\tif (scope.kind === \"repo\") return \"scope=repo\";\n\tif (scope.kind === \"environment\") return `scope=environment:${scope.name}`;\n\treturn `scope=organization:${scope.name}`;\n}\n","/**\n * `holocron secrets sync` — vault → destinations.\n *\n * Reads a named environment from the configured `vault` (1P\n * Environment / similar) as KEY=VALUE pairs, then fans those values\n * out to the configured destinations:\n *\n * - `secrets` capability (e.g., GH Actions secrets) — repo-scope\n * - `deployment` capability (e.g., Vercel env vars) — per-target\n * - local `.env` file (optional, planned for v5.1 — currently skipped\n * with a soft \"not yet\" note)\n *\n * Per-secret routing rules:\n *\n * - All keys go to `deployment` for each target the caller asks for\n * (defaults: production + preview)\n * - `secrets` (GH Actions) defaults to every key, repo-scoped — but a\n * caller can pass `githubSecretKeys` (an allowlist, from repeatable\n * `--github-secret KEY` CLI values) to restrict `secrets` to only\n * those keys, and `githubSecretScope` (same `{ kind }` shape `secret\n * set`'s own `--scope repo|env=NAME|org=NAME` parses to) to apply one\n * scope to all of them. A key not in the allowlist is skipped for\n * `secrets` entirely — still synced to `deployment` if configured.\n * Needed for a vault holding a mix of deploy-only secrets and one\n * CI-consumed, org-wide secret (holocron#781's Sentinel case: 4\n * Vercel-only keys + one org-scoped Axiom ingest token\n * `theholocron/.github`'s dispatched-check workflow also reads).\n *\n * The vault MUST implement `readEnvironment(envId)` (optional method).\n * If it doesn't, the command errors with a hint to populate the keys\n * individually via `holocron secrets set` (also planned for v5.1).\n */\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Deployment,\n\ttype DeploymentTarget,\n\tPluginLoader,\n\ttype Secrets,\n\ttype SecretScope,\n\ttype Vault,\n} from \"../../plugin/index.js\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport type { RunSecretsSyncInput, SyncReport, SyncRow } from \"./secrets-sync.type.js\";\n\nexport async function runSecretsSync(input: RunSecretsSyncInput): Promise<SyncReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait withSpinner(\"Loading plugins…\", () => loader.load());\n\tassertPluginsResolvable(loader, \"secrets sync\");\n\n\tlogger.info(\n\t\t{ environment: input.environmentId, dryRun: (input.context.dryRun ?? false) || undefined },\n\t\t\"secrets sync: start\"\n\t);\n\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst targets = input.targets ?? ([\"production\", \"preview\"] as DeploymentTarget[]);\n\n\tprint(style.header(`Holocron secrets sync — environment ${input.environmentId}${dryRun ? \" (dry-run)\" : \"\"}`));\n\tprint(style.dim(` vault: ${vaultProviderName(loader)}`));\n\tprint(\"\");\n\n\t// ── Read the vault ─────────────────────────────────────────────────\n\tconst vault = loader.get(\"vault\") as Vault;\n\tif (!vault.readEnvironment) {\n\t\tthrow new Error(\n\t\t\t`vault provider (${vault.providerName}) does not implement readEnvironment — sync needs bulk env reads`\n\t\t);\n\t}\n\tconst envVars = await withSpinner(`Reading vault environment ${input.environmentId}…`, () =>\n\t\tvault.readEnvironment!(input.environmentId)\n\t);\n\tconst keys = Object.keys(envVars).sort();\n\tprint(style.step(`read ${keys.length} keys from vault`));\n\tprint(\"\");\n\n\tconst rows: SyncRow[] = [];\n\n\t// ── Push to `secrets` (CI/Actions secrets) ─────────────────────────\n\tif (loader.has(\"secrets\")) {\n\t\tconst secrets = loader.get(\"secrets\") as Secrets;\n\t\tconst scope = input.githubSecretScope ?? { kind: \"repo\" };\n\t\tconst allowedKeys = input.githubSecretKeys ? new Set(input.githubSecretKeys) : undefined;\n\t\tprint(style.step(\"secrets\"));\n\t\tfor (const key of keys) {\n\t\t\t// No allowlist → every key (original default). With one → only\n\t\t\t// listed keys; an unlisted key is skipped for `secrets` entirely\n\t\t\t// (still reaches `deployment` above, if configured).\n\t\t\tif (allowedKeys && !allowedKeys.has(key)) continue;\n\n\t\t\trows.push(\n\t\t\t\tawait runRow(`secrets:${secrets.providerName}`, scopeLabel(scope), key, dryRun, async () => {\n\t\t\t\t\tawait secrets.setSecret(scope, key, envVars[key]!);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatRow(rows[rows.length - 1]!));\n\t\t}\n\t}\n\n\t// ── Push to `deployment` (Vercel env vars) ─────────────────────────\n\tif (loader.has(\"deployment\")) {\n\t\tconst deploy = loader.get(\"deployment\") as Deployment;\n\t\tif (!input.projectId) {\n\t\t\tprint(style.step(\"deployment\"));\n\t\t\tconst row: SyncRow = {\n\t\t\t\tdestination: `deployment:${deploy.providerName}`,\n\t\t\t\tscope: \"no projectId\",\n\t\t\t\tkey: \"(all)\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"projectId required for deployment env-var sync (pass --project-id)\",\n\t\t\t};\n\t\t\trows.push(row);\n\t\t\tprint(formatRow(row));\n\t\t} else {\n\t\t\tfor (const target of targets) {\n\t\t\t\tprint(style.step(`deployment (target=${target})`));\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\trows.push(\n\t\t\t\t\t\tawait runRow(`deployment:${deploy.providerName}`, `target=${target}`, key, dryRun, async () => {\n\t\t\t\t\t\t\tawait deploy.setEnvVar(input.projectId!, target, key, envVars[key]!);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatRow(rows[rows.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const r of rows) {\n\t\t// `key` is a secret NAME, never a value — safe to log. The logger also\n\t\t// redacts `secrets[*].value` shapes as defence in depth.\n\t\tlogger[r.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{\n\t\t\t\tdestination: r.destination,\n\t\t\t\tscope: r.scope,\n\t\t\t\tkey: r.key,\n\t\t\t\tstatus: r.status,\n\t\t\t\t...(r.message ? { detail: r.message } : {}),\n\t\t\t},\n\t\t\t`secrets sync: ${r.key} → ${r.destination}`\n\t\t);\n\t}\n\n\tconst summary = rows.reduce(\n\t\t(acc, r) => {\n\t\t\tif (r.status === \"ok\") acc.ok += 1;\n\t\t\telse if (r.status === \"fail\") acc.fail += 1;\n\t\t\telse if (r.status === \"skip\") acc.skip += 1;\n\t\t\telse if (r.status === \"dry-run\") acc.dryRun += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0, dryRun: 0 }\n\t);\n\n\tlogger[summary.fail > 0 ? \"warn\" : \"info\"]({ ...summary, keys: rows.length }, \"secrets sync: done\");\n\n\tprint(\"\");\n\tconst summaryLine = `${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${\n\t\tdryRun ? `, ${summary.dryRun} would-do` : \"\"\n\t}`;\n\tprint(summary.fail > 0 ? style.fail(summaryLine) : style.success(summaryLine));\n\n\treturn { rows, summary };\n}\n\n// ── helpers ──────────────────────────────────────────────────────────\n\nasync function runRow(\n\tdestination: string,\n\tscope: string,\n\tkey: string,\n\tdryRun: boolean,\n\tbody: () => Promise<void>\n): Promise<SyncRow> {\n\tif (dryRun) {\n\t\treturn { destination, scope, key, status: \"dry-run\" };\n\t}\n\ttry {\n\t\tawait body();\n\t\treturn { destination, scope, key, status: \"ok\" };\n\t} catch (err) {\n\t\treturn {\n\t\t\tdestination,\n\t\t\tscope,\n\t\t\tkey,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n\nfunction formatRow(row: SyncRow): string {\n\tconst detail = row.message ? style.dim(` (${row.message})`) : \"\";\n\tconst label = `${row.key}${detail}`;\n\tif (row.status === \"ok\") return ` ${style.success(label)}`;\n\tif (row.status === \"fail\") return ` ${style.fail(label)}`;\n\tif (row.status === \"dry-run\") return ` ${style.dim(`… ${label}`)}`;\n\treturn ` ${style.dim(`· ${label}`)}`;\n}\n\nfunction scopeLabel(scope: SecretScope): string {\n\tif (scope.kind === \"repo\") return \"scope=repo\";\n\tif (scope.kind === \"organization\") return `scope=organization,org=${scope.name}`;\n\treturn `scope=environment,env=${scope.name}`;\n}\n\nfunction vaultProviderName(loader: PluginLoader): string {\n\tif (!loader.has(\"vault\")) return \"<missing>\";\n\treturn (loader.get(\"vault\") as Vault).providerName;\n}\n","import { join } from \"node:path\";\n\nimport type { WorkspacePackage } from \"@theholocron/astromech\";\nimport { readPackageJson } from \"@theholocron/pkg-utils\";\n\nimport type { ResolvedProvidersConfig } from \"../../../config/index.js\";\nimport type { DeriveProfileInput, HolocronProfile, PackageJsonLike } from \"./derived-properties.type.js\";\n\n/**\n * Repo archetype, in priority order:\n * 1. `*-template` repo name → `template` (independent of package shape).\n * 2. Monorepo whose primary published artifact is a CLI (some workspace\n * package has `bin`) → `platform` — matches `holocron` itself: the CLI is\n * the deliverable, the plugin packages are supporting infrastructure for\n * it, not separate products.\n * 3. Monorepo with no CLI but at least one non-private workspace package →\n * `library` — matches `clients`/`configs`/`utils`/`themes`/\n * `observability`: a family of published packages, none of them a CLI.\n * Checked *before* falling into the root-package branch below, because\n * these repos' own root `package.json` is private and often carries\n * `@theholocron/astro-config` for a docs site built from the monorepo\n * root — without this check they'd wrongly resolve to `docs` off that\n * root-level signal alone, when the docs site is a secondary concern of\n * a library collection, not what the repo fundamentally is.\n * 4. Single-package repo with `package.json#bin` → `cli`.\n * 5. Docs-only site (astro/starlight present, root package private, no\n * publishable exports) → `docs`.\n * 6. Private, non-publishable, non-docs → `app`.\n * 7. Otherwise, a single publishable package → `library`.\n */\nexport function deriveProfile(input: DeriveProfileInput): HolocronProfile {\n\tif (/-template$/.test(input.repoName)) return \"template\";\n\n\tif (input.isMonorepo) {\n\t\tconst hasPublishedCli = input.workspacePackageJsons.some((pkg) => Boolean(pkg.bin));\n\t\tif (hasPublishedCli) return \"platform\";\n\n\t\tconst hasPublishedLibrary = input.workspacePackageJsons.some((pkg) => pkg.private !== true);\n\t\tif (hasPublishedLibrary) return \"library\";\n\t}\n\n\tconst pkg = input.rootPackageJson;\n\tif (pkg?.bin) return \"cli\";\n\n\tconst deps = { ...pkg?.dependencies, ...pkg?.devDependencies };\n\tconst isDocsSite = Boolean(deps[\"@theholocron/astro-config\"] || deps[\"astro\"]);\n\tif (pkg?.private && isDocsSite) return \"docs\";\n\tif (pkg?.private) return \"app\";\n\n\treturn \"library\";\n}\n\nconst KNOWN_STACK_DEPS = [\n\t\"next\",\n\t\"vite\",\n\t\"astro\",\n\t\"tsdown\",\n\t\"rollup\",\n\t\"webpack\",\n\t\"storybook\",\n\t\"vitest\",\n\t\"playwright\",\n\t\"turbo\",\n] as const;\n\n/**\n * Detected build/framework tooling — the literal \"does this repo need\n * next/vite/tsdown\" signal `holocron.config.ts` has no field for today\n * (framework choice isn't a config concept, unlike `providers`/`tasks`).\n * Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new\n * frameworks show up rather than trying to detect anything on npm.\n */\nexport function deriveStack(pkg: PackageJsonLike | null): string[] {\n\tconst deps = { ...pkg?.dependencies, ...pkg?.devDependencies };\n\treturn KNOWN_STACK_DEPS.filter((name) => name in deps);\n}\n\n/** The provider capability keys actually wired in `providers: {}` — zero heuristics. */\nexport function deriveCapabilities(providers: ResolvedProvidersConfig | undefined): string[] {\n\treturn Object.keys(providers ?? {}).sort();\n}\n\n/**\n * `source` + `ci` are the minimal baseline every repo `holocron repo setup`\n * touches wires — every `holocron.config.ts` in this org already satisfies\n * this, so `non-compliant` here means drift (a provider manually removed\n * after setup), not an unmet aspirational policy. Deliberately not a richer\n * per-profile policy yet (e.g. \"a `library` must have `deployment`\") — that's\n * a Phase B (GitHub App) refinement once it can post *why* on a check run.\n */\nconst REQUIRED_BASELINE = [\"source\", \"ci\"] as const;\n\nexport function deriveCompliance(capabilities: readonly string[]): \"compliant\" | \"non-compliant\" {\n\treturn REQUIRED_BASELINE.every((key) => capabilities.includes(key)) ? \"compliant\" : \"non-compliant\";\n}\n\n/**\n * The Phase B refinement `deriveCompliance()`'s own doc comment names —\n * *why* a repo is non-compliant, not just that it is. `[]` when compliant.\n * Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one\n * table, not two independently-maintained baselines.\n */\nexport function missingCapabilities(capabilities: readonly string[]): string[] {\n\treturn REQUIRED_BASELINE.filter((key) => !capabilities.includes(key));\n}\n\n/**\n * Reads each workspace package's actual `package.json` content (not just\n * `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s\n * `platform` detection needs `bin`, which that helper doesn't carry).\n * Missing/invalid files are skipped, matching `readWorkspacePackages()`'s\n * own soft-fail behavior.\n */\nexport async function readWorkspacePackageJsons(\n\trepoRoot: string,\n\tworkspacePackages: readonly WorkspacePackage[]\n): Promise<PackageJsonLike[]> {\n\tconst results: PackageJsonLike[] = [];\n\tfor (const { slug, dir = \"packages\" } of workspacePackages) {\n\t\t// no package.json or invalid JSON — skipped, same as readWorkspacePackages().\n\t\tconst pkg = await readPackageJson(join(repoRoot, dir, slug));\n\t\tif (pkg) results.push(pkg);\n\t}\n\treturn results;\n}\n","export const CANONICAL_LABELS = [\n\t{ name: \"bug\", color: \"d73a4a\", description: \"Something isn't working\" },\n\t{ name: \"chore\", color: \"ededed\", description: \"Maintenance, no user-facing change\" },\n\t{ name: \"ci\", color: \"0075ca\", description: \"CI/CD pipeline changes\" },\n\t{ name: \"dependencies\", color: \"0366d6\", description: \"Dependency update\" },\n\t{ name: \"documentation\", color: \"0075ca\", description: \"Documentation only\" },\n\t{ name: \"duplicate\", color: \"cfd3d7\", description: \"Already reported\" },\n\t{ name: \"enhancement\", color: \"a2eeef\", description: \"New feature or request\" },\n\t{ name: \"good first issue\", color: \"7057ff\", description: \"Good for newcomers\" },\n\t{ name: \"help wanted\", color: \"008672\", description: \"Extra attention needed\" },\n\t{ name: \"invalid\", color: \"e4e669\", description: \"Doesn't seem right\" },\n\t{ name: \"performance\", color: \"fbca04\", description: \"Performance improvement\" },\n\t{ name: \"question\", color: \"d876e3\", description: \"Further information requested\" },\n\t{ name: \"refactor\", color: \"cfd3d7\", description: \"Code restructuring\" },\n\t{ name: \"released\", color: \"ededed\", description: \"Included in a release\" },\n\t{ name: \"test\", color: \"bfd4f2\", description: \"Test-related changes\" },\n\t{ name: \"triage\", color: \"e4e669\", description: \"Needs investigation\" },\n\t{ name: \"wontfix\", color: \"ffffff\", description: \"Won't be addressed\" },\n] as const;\n\nexport const STALE_LABELS = [\n\t\"github_actions\",\n\t\"javascript\",\n\t\"autorelease: pending\",\n\t\"autorelease: tagged\",\n\t\"released on @alpha\",\n];\n","allowRemediationCommits:\n individual: true\n","/**\n * Canonical AI engineering workflow role prompts.\n *\n * Written to `.agents/prompts/<role>.md` by `holocron repo setup` when `agent` is\n * configured. Paths are gitignored and regenerated on every setup run so the\n * content always reflects the current CLI version.\n *\n * Source: docs/wiki/specifications/ai-engineering-workflow.spec.md\n */\n\nexport const AGENT_PROMPTS: Record<string, string> = {\n\t\"discovery.md\": `# Discovery Agent\n\nYou are performing engineering discovery.\n\nYour goal is to understand the problem and the existing system before\nproposing implementation changes.\n\nRead the relevant issue, repository code, documentation, specifications,\nand ADRs.\n\nInvestigate:\n- current behavior\n- relevant architecture\n- dependencies\n- constraints\n- existing patterns\n- affected packages/services\n- compatibility concerns\n- security concerns\n- operational concerns\n\nDo not implement anything.\nDo not assume the proposed solution is correct.\n\nProduce:\n1. Problem summary\n2. Current system behavior\n3. Relevant architecture\n4. Constraints\n5. Systems/packages likely affected\n6. Unknowns or open questions\n7. Risks\n8. Decisions that may require architectural discussion\n9. Recommended next step\n\nIf you discover a meaningful architectural choice, explicitly identify it\nrather than silently making the decision.\n`,\n\n\t\"design.md\": `# Design Agent\n\nYou are acting as a software architect.\n\nUsing the issue, discovery findings, existing architecture, specifications,\nand ADRs, propose a design for this change.\n\nDo not write implementation code.\n\nIdentify the important engineering decisions required.\n\nFor each meaningful decision:\n1. Explain the decision that must be made.\n2. Describe viable alternatives.\n3. Explain advantages and disadvantages.\n4. Identify operational and maintenance consequences.\n5. Recommend an approach and explain why.\n\nTreat existing accepted ADRs as architectural constraints.\nDo not contradict an accepted ADR without explicitly identifying the conflict.\n\nAt the end, produce:\n- Recommended design\n- Open questions\n- Decisions requiring ADRs\n- Decisions that are implementation details and do not require ADRs\n- Suggested specification scope\n\nDo not create ADRs merely because a choice exists. An ADR is warranted only\nwhen the decision is significant enough that a future engineer may reasonably\nask why one approach was selected over another.\n`,\n\n\t\"discussion.md\": `# Discussion / RFC Agent\n\nConvert the design analysis into a GitHub Discussion suitable for engineering\nreview.\n\nInclude:\n\n# Problem\n# Context\n# Constraints\n\n# Options\nFor each option:\n- description\n- advantages\n- disadvantages\n- operational consequences\n- implementation complexity\n\n# Recommended Direction\nState the recommendation clearly as a proposal, not a decision.\n\n# Open Questions\n# Decision Requested\n\nAvoid implementation-level details unless they materially affect the\narchitectural choice.\n`,\n\n\t\"adr.md\": `# ADR Author\n\nCreate an Architecture Decision Record from the accepted engineering decision.\n\nUse the accepted GitHub Discussion as the primary source of decision history.\n\nCapture the final architectural conclusion, not the full discussion.\n\nInclude:\n- Title\n- Status\n- Date\n- Context\n- Decision\n- Rationale\n- Alternatives considered\n- Consequences\n- Related issue, Discussion, and specifications\n\nClearly distinguish between the final decision, supporting rationale, and\nalternatives that were rejected.\n\nDo not introduce new architectural decisions.\n\nIf the Discussion does not contain enough information to state a decision\nconfidently, identify the missing information instead of inventing it.\n\n## Format\n\nUse MADR format. Start from the \\`adr\\` skill's template,\n\\`.agents/skills/adr/assets/template.md\\`, and number the record sequentially.\n\\`holocron repo setup\\` installs that skill when \\`adr\\` is listed under\n\\`skills\\` in \\`holocron.config\\` — if the file is missing, add it there and\nre-run setup.\n\n\\`\\`\\`sh\ncp .agents/skills/adr/assets/template.md docs/wiki/decisions/000N-short-title.md\n\\`\\`\\`\n\nSave to \\`docs/wiki/decisions/NNNN-<slug>.md\\`.\n`,\n\n\t\"spec.md\": `# Specification Agent\n\nYou are acting as a technical specification author.\n\nCreate a specification for the requested capability using:\n- the GitHub issue\n- accepted design decisions\n- accepted ADRs\n- existing system behavior\n- relevant repository documentation\n\nTreat accepted ADRs as architectural constraints.\n\nThe specification should describe WHAT the system must do, not how to implement it.\n\nInclude:\n- Objective\n- Background\n- Goals / Non-goals\n- Existing behavior\n- Required behavior\n- Interfaces\n- Data model\n- Validation\n- State transitions\n- Error handling\n- Authorization / security\n- Observability\n- Compatibility requirements\n- Edge cases\n- Testing requirements\n- Acceptance criteria\n- Related ADRs and issues\n\nThe specification should be detailed enough that another engineer or AI agent\ncould implement the feature without seeing the original planning conversation.\n\nIMPORTANT: Do not silently make new architectural decisions. If the specification\nrequires a decision that has not been established, mark it as an unresolved\ndesign question and surface it for discussion.\n\n## Process rule\n\nFile a GitHub issue BEFORE writing the spec. The spec's frontmatter \\`issue:\\`\nfield must reference it. Order: Issue → Spec → PR → Review → merge.\n`,\n\n\t\"implementation-plan.md\": `# Implementation Planner\n\nYou are acting as an implementation planner.\n\nTreat the accepted specification and ADRs as authoritative.\n\nInspect the repository and produce a concrete implementation plan for\nsatisfying the specification. Do not redesign the feature.\n\nIdentify:\n- packages/services affected\n- files likely affected\n- new files required\n- schema changes and migrations\n- API changes\n- configuration changes\n- tests required\n- observability changes\n- documentation changes\n- deployment or rollout requirements\n\nProduce an ordered implementation plan. Each step should include:\n1. Goal\n2. Files or modules affected\n3. Expected change\n4. Tests required\n5. Dependencies on earlier steps\n\nIdentify tasks that can safely be implemented in parallel.\n\nIf repository reality conflicts with the specification or ADRs, stop that\nportion of the plan and explicitly describe the conflict. Do not silently\nalter the design to work around it.\n`,\n\n\t\"implement.md\": `# Implementation Agent\n\nYou are implementing an accepted engineering specification.\n\nAuthority order:\n1. Accepted ADRs\n2. Accepted specification\n3. Approved implementation plan\n4. Existing repository conventions\n\nImplement the approved plan.\n\nDo not change product behavior described by the specification.\nDo not contradict accepted ADRs.\nDo not introduce new architectural patterns unless required by the specification.\nFollow existing repository conventions where they do not conflict with the spec.\n\nFor each implementation step:\n- make the required change\n- add or update tests\n- preserve backward compatibility where required\n- add appropriate observability\n- update relevant documentation\n\nIf you discover that repository reality makes the specification impossible or\nrequires a new architectural decision:\n\nSTOP that portion of implementation.\n\nDescribe:\n- what the specification requires\n- what the repository currently supports\n- why they conflict\n- what decision is required\n\nDo not silently invent a new design.\n`,\n\n\t\"review.md\": `# Review Agent\n\nYou are acting as an independent engineering reviewer.\n\nReview the implementation against:\n1. The GitHub issue\n2. Accepted ADRs\n3. The accepted specification\n4. The implementation plan\n5. Repository conventions\n\nDo not assume the implementation is correct simply because tests pass.\n\nEvaluate:\n\n## Specification Compliance\nIdentify every requirement in the specification and determine whether it is\nimplemented.\n\n## ADR Compliance\nIdentify any behavior or architecture that conflicts with accepted ADRs.\n\n## Correctness\nLook for logical errors, invalid state transitions, race conditions, missing\nvalidation, and incorrect assumptions.\n\n## Security\nReview authentication, authorization, data exposure, input handling, and\ntrust boundaries.\n\n## Failure Behavior\nReview errors, retries, partial failures, rollback behavior, and recovery.\n\n## Observability\nConfirm appropriate logs, metrics, traces, and diagnostic information.\n\n## Compatibility\nCheck backward compatibility and migration behavior.\n\n## Testing\nIdentify missing test cases — especially failure paths, boundary conditions,\nauthorization, state transitions, concurrency, and regression cases.\n\n## Scope\nIdentify unrelated changes or unnecessary complexity.\n\nProduce findings ordered by severity. For each finding include:\n- severity\n- location\n- violated requirement or principle\n- explanation\n- recommended correction\n\nFinally provide:\n- specification requirements fully satisfied\n- specification requirements partially satisfied\n- specification requirements missing\n- ADR violations\n- overall recommendation\n`,\n\n\t\"verify.md\": `# Verification Agent\n\nVerify this implementation against the accepted specification.\n\nTreat each acceptance criterion as independently testable.\n\nCreate a requirement matrix containing:\n- requirement\n- implementation location\n- test coverage\n- status (PASS | PARTIAL | FAIL | NOT TESTED)\n- notes\n\nDo not infer compliance merely because related code exists.\nVerify the actual behavior where possible.\nIdentify any specification language that is ambiguous or impossible to verify.\n`,\n};\n\nexport const DECISIONS_README = `# Decisions\n\nArchitectural Decision Records live here. Each file captures one architectural\ndecision, the options that were considered, and the rationale for the choice made.\n\n## Creating a new decision\n\nStart from the template that ships with the \\`adr\\` skill,\n\\`.agents/skills/adr/assets/template.md\\` (installed by \\`holocron repo setup\\`\nwhen \\`adr\\` is listed under \\`skills\\` in \\`holocron.config\\`), and number the\nrecord sequentially:\n\n\\`\\`\\`sh\ncp .agents/skills/adr/assets/template.md docs/wiki/decisions/000N-short-title.md\n\\`\\`\\`\n\n\\`madr\\` has no CLI — creation is manual. Frontmatter is validated in CI\nvia \\`scripts/validate-adrs.mjs\\` (runs as part of the Lint workflow).\n\n## Status values\n\n| Status | Meaning |\n| ------------ | --------------------------------------------- |\n| \\`proposed\\` | Under discussion — not yet accepted |\n| \\`accepted\\` | In effect |\n| \\`rejected\\` | Considered and declined |\n| \\`deprecated\\` | Was accepted; no longer relevant |\n| \\`superseded\\` | Replaced by a later decision (link in frontmatter) |\n\n## Index\n\n| ID | Title | Status |\n| -- | ----- | ------ |\n`;\n\nexport const STANDARDS_README = `# Standards\n\nOrg-wide engineering standards — conventions, practices, and guidelines that\napply across all repos in the org.\n\n> **Drafts** live in \\`.notes/\\` until accepted, then graduate here.\n`;\n\nexport const SPECIFICATIONS_README = `# Specifications\n\nAccepted specs for planned or in-progress features. Each spec captures what\nthe system must do — not how to implement it.\n\n> **Drafts** live in \\`.notes/*.spec.md\\` until accepted, then graduate here.\n`;\n","import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { updateGitignore } from \"@theholocron/git-utils\";\n\nimport { AGENT_PROMPTS } from \"./agent-prompts-data.js\";\n\nconst AGENTS_PROMPTS_ROOT = \".agents/prompts\";\nconst PROMPTS_GITIGNORE_START = \"# managed by holocron setup — prompts\";\nconst PROMPTS_GITIGNORE_END = \"# end managed by holocron setup — prompts\";\n\nexport async function installAgentPrompts({ repoRoot }: { repoRoot: string }): Promise<string> {\n\tconst promptsDir = join(repoRoot, AGENTS_PROMPTS_ROOT);\n\tawait mkdir(promptsDir, { recursive: true });\n\n\tfor (const [filename, content] of Object.entries(AGENT_PROMPTS)) {\n\t\tawait writeFile(join(promptsDir, filename), content, \"utf8\");\n\t}\n\n\tawait updateGitignore(join(repoRoot, \".gitignore\"), {\n\t\tstart: PROMPTS_GITIGNORE_START,\n\t\tend: PROMPTS_GITIGNORE_END,\n\t\tlines: [`/${AGENTS_PROMPTS_ROOT}/`],\n\t});\n\n\treturn `wrote ${Object.keys(AGENT_PROMPTS).length} prompt files to ${AGENTS_PROMPTS_ROOT}/`;\n}\n","import { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { ProviderApiError, type Source } from \"../../plugin/index.js\";\nimport type { SetupStepResult } from \"./run-step/index.js\";\n\nexport const RULESET_NAME = \"holocron-default-branch\";\n\nexport function buildClassicProtectionPayload(requiredChecks: string[] = []): Record<string, unknown> {\n\treturn {\n\t\trequired_status_checks: requiredChecks.length > 0 ? { strict: false, contexts: requiredChecks } : null,\n\t\tenforce_admins: false,\n\t\trequired_pull_request_reviews: {\n\t\t\trequired_approving_review_count: 0,\n\t\t\tdismiss_stale_reviews: false,\n\t\t\trequire_code_owner_reviews: false,\n\t\t},\n\t\trestrictions: null,\n\t\tallow_force_pushes: false,\n\t\tallow_deletions: false,\n\t};\n}\n\nexport function buildRulesetPayload(requiredChecks: string[] = []): Record<string, unknown> {\n\tconst rules: Record<string, unknown>[] = [\n\t\t{ type: \"deletion\" },\n\t\t{ type: \"non_fast_forward\" },\n\t\t{\n\t\t\ttype: \"pull_request\",\n\t\t\tparameters: {\n\t\t\t\trequired_approving_review_count: 0,\n\t\t\t\tdismiss_stale_reviews_on_push: false,\n\t\t\t\trequire_code_owner_review: false,\n\t\t\t\trequire_last_push_approval: false,\n\t\t\t\trequired_review_thread_resolution: true,\n\t\t\t\t// GitHub defaults this to `true`. It bumps the required approval\n\t\t\t\t// count to 1 for a PR with unverified / unattributed commits —\n\t\t\t\t// which, with `required_approving_review_count: 0` and a single\n\t\t\t\t// maintainer, is an unsatisfiable block (the author can't\n\t\t\t\t// self-approve). Admin bypass already covers the real risk.\n\t\t\t\trequire_extra_approval_for_unattributed_changes: false,\n\t\t\t},\n\t\t},\n\t];\n\tif (requiredChecks.length > 0) {\n\t\trules.push({\n\t\t\ttype: \"required_status_checks\",\n\t\t\tparameters: {\n\t\t\t\trequired_status_checks: requiredChecks.map((context) => ({ context })),\n\t\t\t\tstrict_required_status_checks_policy: false,\n\t\t\t},\n\t\t});\n\t}\n\treturn {\n\t\tname: RULESET_NAME,\n\t\ttarget: \"branch\",\n\t\tenforcement: \"active\",\n\t\t// Repository admins (role 4) can bypass — required for semantic-release\n\t\t// and other automation that pushes directly to the default branch.\n\t\tbypass_actors: [{ actor_id: 4, actor_type: \"RepositoryRole\", bypass_mode: \"always\" }],\n\t\tconditions: { ref_name: { include: [\"~DEFAULT_BRANCH\"], exclude: [] } },\n\t\trules,\n\t};\n}\n\n// Tries the modern Rulesets API first, falls back to classic branch protection\n// if rulesets return 403 (requires GitHub Team+ on private repos), and gracefully\n// skips if both APIs are unavailable (GitHub Free on private repos).\nexport async function upsertBranchProtection(\n\tsource: Source,\n\tdryRun: boolean,\n\trequiredChecks: string[]\n): Promise<SetupStepResult> {\n\tconst step = `upsert ruleset ${RULESET_NAME}`;\n\tif (dryRun) return { capability: \"source\", step, status: \"dry-run\" };\n\n\t// Attempt 1: modern rulesets\n\ttry {\n\t\tconst existing = await source.listRulesets();\n\t\tconst found = existing.find((r) => r.name === RULESET_NAME);\n\t\tif (found) {\n\t\t\tawait source.updateRuleset(found.id, buildRulesetPayload(requiredChecks));\n\t\t\treturn { capability: \"source\", step, status: \"ok\", message: \"updated\" };\n\t\t}\n\t\tawait source.createRuleset(buildRulesetPayload(requiredChecks));\n\t\treturn { capability: \"source\", step, status: \"ok\", message: \"created\" };\n\t} catch (err) {\n\t\tif (!(err instanceof ProviderApiError) || err.status !== 403) {\n\t\t\treturn {\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep,\n\t\t\t\tstatus: \"fail\",\n\t\t\t\tmessage: errorMessage(err),\n\t\t\t};\n\t\t}\n\t}\n\n\t// Attempt 2: classic branch protection (free-plan fallback)\n\ttry {\n\t\tconst repo = await source.getRepo();\n\t\tawait source.protectBranch(repo.defaultBranch, buildClassicProtectionPayload(requiredChecks));\n\t\treturn { capability: \"source\", step, status: \"ok\", message: `classic protection on ${repo.defaultBranch}` };\n\t} catch (err) {\n\t\tif (err instanceof ProviderApiError && err.status === 403) {\n\t\t\treturn {\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep,\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"branch protection unavailable on private repos without GitHub Pro/Team\",\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tcapability: \"source\",\n\t\t\tstep,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n","import { access, mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport { DECISIONS_README, SPECIFICATIONS_README, STANDARDS_README } from \"./agent-prompts-data.js\";\n\nasync function writeIfAbsent(filePath: string, content: string): Promise<boolean> {\n\ttry {\n\t\tawait access(filePath);\n\t\treturn false; // already exists — skip\n\t} catch {\n\t\tawait mkdir(dirname(filePath), { recursive: true });\n\t\tawait writeFile(filePath, content, \"utf8\");\n\t\treturn true;\n\t}\n}\n\nexport async function installEngineeringStructure({ repoRoot }: { repoRoot: string }): Promise<string> {\n\tconst results: string[] = [];\n\n\tconst writes: Array<[string, string]> = [\n\t\t[join(repoRoot, \"docs/wiki/decisions/README.md\"), DECISIONS_README],\n\t\t[join(repoRoot, \"docs/wiki/standards/README.md\"), STANDARDS_README],\n\t\t[join(repoRoot, \"docs/wiki/specifications/README.md\"), SPECIFICATIONS_README],\n\t];\n\n\tfor (const [path, content] of writes) {\n\t\tconst wrote = await writeIfAbsent(path, content);\n\t\tif (wrote) results.push(path.replace(repoRoot + \"/\", \"\"));\n\t}\n\n\treturn results.length > 0 ? `created: ${results.join(\", \")}` : \"all files already exist — nothing to write\";\n}\n","import type { RepoSettings } from \"../../plugin/index.js\";\n\nexport const BALANCED_REPO_SETTINGS: RepoSettings = {\n\tallow_squash_merge: true,\n\tallow_merge_commit: false,\n\tallow_rebase_merge: false,\n\tallow_auto_merge: true,\n\tallow_update_branch: true,\n\tdelete_branch_on_merge: true,\n\thas_issues: true,\n\thas_discussions: true,\n\thas_projects: true,\n\thas_wiki: false,\n\t// web_commit_signoff_required is intentionally omitted: GitHub rejects this\n\t// field when the organization already enforces it at org level (422). Org-level\n\t// enforcement already covers every repo — no per-repo override is needed.\n};\n","import { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../../observability/logger/index.js\";\nimport { ProviderApiError } from \"../../../plugin/index.js\";\n\nexport async function runStep(\n\tcapability: string,\n\tstep: string,\n\tdryRun: boolean,\n\tbody: () => Promise<string | void>,\n\topts: { skipCodes?: number[] } = {}\n): Promise<SetupStepResult> {\n\tconst result = await execStep(capability, step, dryRun, body, opts);\n\tconst { status, message, reason } = result;\n\tgetLogger()[status === \"fail\" ? \"warn\" : \"info\"](\n\t\t{ capability, step, status, ...(message ? { detail: message } : {}), ...(reason ? { reason } : {}) },\n\t\t`${capability}.${step}`\n\t);\n\treturn result;\n}\n\nasync function execStep(\n\tcapability: string,\n\tstep: string,\n\tdryRun: boolean,\n\tbody: () => Promise<string | void>,\n\topts: { skipCodes?: number[] } = {}\n): Promise<SetupStepResult> {\n\tif (dryRun) {\n\t\treturn { capability, step, status: \"dry-run\" };\n\t}\n\ttry {\n\t\tconst note = await body();\n\t\tconst result: SetupStepResult = { capability, step, status: \"ok\" };\n\t\tif (typeof note === \"string\") result.message = note;\n\t\treturn result;\n\t} catch (err) {\n\t\tif (err instanceof ProviderApiError) {\n\t\t\tif (err.status !== undefined && opts.skipCodes?.includes(err.status)) {\n\t\t\t\treturn { capability, step, status: \"skip\", message: err.message };\n\t\t\t}\n\t\t\tif (err.status === 403) {\n\t\t\t\tconst reason = classify403(err);\n\t\t\t\t// Plan-restriction 403s mean the feature is unavailable on the current\n\t\t\t\t// plan — not a setup failure, just a capability gap. Report as skip.\n\t\t\t\treturn { capability, step, status: reason === \"plan\" ? \"skip\" : \"fail\", message: err.message, reason };\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tcapability,\n\t\t\tstep,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n\nexport function classify403(err: ProviderApiError): FailReason {\n\tconst detailText =\n\t\ttypeof err.details === \"string\"\n\t\t\t? err.details\n\t\t\t: typeof err.details === \"object\" && err.details !== null && \"message\" in err.details\n\t\t\t\t? String((err.details as { message?: unknown }).message)\n\t\t\t\t: \"\";\n\tconst text = `${err.message} ${detailText}`.toLowerCase();\n\tif (\n\t\ttext.includes(\"advanced security\") ||\n\t\ttext.includes(\"not enabled for this repository\") ||\n\t\ttext.includes(\"upgrade\") ||\n\t\ttext.includes(\"not available on\")\n\t) {\n\t\treturn \"plan\";\n\t}\n\treturn \"permissions\";\n}\n\nimport { style } from \"../../../ui/index.js\";\nimport type { FailReason, SetupStepResult } from \"./run-step.type.js\";\n\nexport function formatStep(step: SetupStepResult): string {\n\tconst tag = step.reason === \"permissions\" ? \" [permissions]\" : step.reason === \"plan\" ? \" [plan restriction]\" : \"\";\n\tconst detail = step.message ? style.dim(` (${step.message})`) : \"\";\n\tconst label = `${step.step}${tag}${detail}`;\n\tif (step.status === \"ok\") return ` ${style.success(label)}`;\n\tif (step.status === \"fail\") return ` ${style.fail(label)}`;\n\tif (step.status === \"dry-run\") return ` ${style.dim(`… ${label}`)}`;\n\treturn ` ${style.dim(`· ${label}`)}`;\n}\n","import { spawnSync } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { copyFile, mkdir, readdir, readFile, rm, stat, symlink, unlink, writeFile } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, relative } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { updateGitignore } from \"@theholocron/git-utils\";\n\nimport type { SkillLockEntry, SkillsLock } from \"./skills.type.js\";\n\nasync function fetchExternalSkill(entry: SkillLockEntry): Promise<{ content: string; stale: boolean }> {\n\tif (entry.sourceType !== \"github\") {\n\t\t/* c8 ignore next */\n\t\tthrow new Error(`unsupported sourceType: ${entry.sourceType}`);\n\t}\n\tconst url = `https://raw.githubusercontent.com/${entry.source}/HEAD/${entry.skillPath}`;\n\tconst res = await fetch(url);\n\tif (!res.ok) throw new Error(`HTTP ${res.status} fetching ${url}`);\n\tconst content = await res.text();\n\tconst stale = !!entry.computedHash && createHash(\"sha256\").update(content).digest(\"hex\") !== entry.computedHash;\n\treturn { content, stale };\n}\n\nconst AGENTS_SKILLS_ROOT = \".agents/skills\";\n\n/** Relative path of the agent-specific symlink. undefined = unsupported agent. */\nexport const AGENT_SYMLINK_PATHS: Partial<Record<string, (name: string) => string>> = {\n\tclaude: (name) => `.claude/skills/${name}`,\n};\n\nconst GITIGNORE_BLOCK_START = \"# managed by holocron setup — skills\";\n// Safety invariant: GITIGNORE_BLOCK_START must NOT be a substring of\n// GITIGNORE_BLOCK_END. The \"# end \" prefix currently guarantees this — if\n// either string is edited, verify the invariant still holds so that\n// indexOf(GITIGNORE_BLOCK_START) cannot match inside the end marker.\nconst GITIGNORE_BLOCK_END = \"# end managed by holocron setup — skills\";\n\nexport async function installSkills({\n\tagent,\n\tskills,\n\trepoRoot,\n}: {\n\tagent: string;\n\tskills: string[];\n\trepoRoot: string;\n}): Promise<string> {\n\tconst symlinkFn = AGENT_SYMLINK_PATHS[agent];\n\tif (!symlinkFn) {\n\t\treturn `agent \"${agent}\" has no known skill install path — skipping`;\n\t}\n\n\tconst require = createRequire(pathToFileURL(join(repoRoot, \"package.json\")));\n\tlet skillsRoot: string;\n\ttry {\n\t\tskillsRoot = dirname(require.resolve(\"@theholocron/skills/package.json\"));\n\t} catch {\n\t\tconst result = spawnSync(\"pnpm\", [\"add\", \"-D\", \"@theholocron/skills\"], {\n\t\t\tcwd: repoRoot,\n\t\t\tstdio: \"inherit\",\n\t\t});\n\t\tif (result.status !== 0) {\n\t\t\tthrow new Error(\"failed to auto-install @theholocron/skills\");\n\t\t}\n\t\ttry {\n\t\t\tskillsRoot = dirname(require.resolve(\"@theholocron/skills/package.json\"));\n\t\t} catch {\n\t\t\tthrow new Error(\"failed to auto-install @theholocron/skills\");\n\t\t}\n\t}\n\n\tconst gitignorePath = join(repoRoot, \".gitignore\");\n\tconst existingContent = await readFile(gitignorePath, \"utf8\").catch(() => \"\");\n\tconst previouslyInstalled = parsePreviousSkills(existingContent, symlinkFn);\n\tconst currentSet = new Set(skills);\n\tconst stale = previouslyInstalled.filter((n) => !currentSet.has(n));\n\tfor (const name of stale) {\n\t\tawait rm(join(repoRoot, symlinkFn(name)), { force: true }).catch(() => undefined);\n\t\tawait rm(join(repoRoot, AGENTS_SKILLS_ROOT, name), { recursive: true, force: true }).catch(() => undefined);\n\t}\n\n\tconst installed: string[] = [];\n\tconst missing: string[] = [];\n\n\tfor (const name of skills) {\n\t\tconst srcDir = join(skillsRoot, \"src\", name);\n\n\t\ttry {\n\t\t\tawait stat(srcDir);\n\t\t} catch {\n\t\t\tmissing.push(name);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst agentsDir = join(repoRoot, AGENTS_SKILLS_ROOT, name);\n\t\tawait copyDirRecursive(srcDir, agentsDir);\n\n\t\tconst symlinkPath = join(repoRoot, symlinkFn(name));\n\t\tawait mkdir(dirname(symlinkPath), { recursive: true });\n\t\ttry {\n\t\t\tawait unlink(symlinkPath);\n\t\t} catch {\n\t\t\t// didn't exist — that's fine\n\t\t}\n\t\tawait symlink(relative(dirname(symlinkPath), agentsDir).replace(/\\\\/g, \"/\"), symlinkPath);\n\n\t\tinstalled.push(name);\n\t}\n\n\tconst externalFailed: string[] = [];\n\tconst externalStale: string[] = [];\n\tif (missing.length > 0) {\n\t\tlet lock: SkillsLock | null = null;\n\t\ttry {\n\t\t\tlock = JSON.parse(await readFile(join(skillsRoot, \"skills-lock.json\"), \"utf8\")) as SkillsLock;\n\t\t} catch {\n\t\t\t// No lock file or parse error — all missing remain unknown.\n\t\t}\n\t\tif (lock?.skills) {\n\t\t\tfor (const name of [...missing]) {\n\t\t\t\tconst entry = lock.skills[name];\n\t\t\t\tif (!entry) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst { content, stale: isStale } = await fetchExternalSkill(entry);\n\t\t\t\t\tconst agentsDir = join(repoRoot, AGENTS_SKILLS_ROOT, name);\n\t\t\t\t\tawait mkdir(agentsDir, { recursive: true });\n\t\t\t\t\tawait writeFile(join(agentsDir, \"SKILL.md\"), content);\n\t\t\t\t\tconst symlinkPath = join(repoRoot, symlinkFn(name));\n\t\t\t\t\tawait mkdir(dirname(symlinkPath), { recursive: true });\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait unlink(symlinkPath);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// didn't exist — that's fine\n\t\t\t\t\t}\n\t\t\t\t\tawait symlink(relative(dirname(symlinkPath), agentsDir).replace(/\\\\/g, \"/\"), symlinkPath);\n\t\t\t\t\tmissing.splice(missing.indexOf(name), 1);\n\t\t\t\t\tinstalled.push(name);\n\t\t\t\t\tif (isStale) externalStale.push(name);\n\t\t\t\t} catch {\n\t\t\t\t\tmissing.splice(missing.indexOf(name), 1);\n\t\t\t\t\texternalFailed.push(name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (installed.length > 0 || stale.length > 0 || missing.length > 0 || externalFailed.length > 0) {\n\t\tawait updateSkillsGitignore(gitignorePath, [...installed, ...missing, ...externalFailed], symlinkFn);\n\t}\n\n\tconst parts: string[] = [`installed ${installed.length}`];\n\tif (stale.length > 0) parts.push(`pruned: ${stale.join(\", \")}`);\n\tif (externalStale.length > 0)\n\t\tparts.push(`stale: ${externalStale.join(\", \")} (run \\`holocron skills update\\` to refresh)`);\n\tif (externalFailed.length > 0) parts.push(`fetch failed: ${externalFailed.join(\", \")}`);\n\tif (missing.length > 0) parts.push(`unknown: ${missing.join(\", \")}`);\n\treturn parts.join(\"; \");\n}\n\n/**\n * The skill names a previous `holocron setup` recorded in the `.gitignore`\n * managed block. A block missing its end marker (hand-edited, truncated) runs\n * only to the next blank line — the same rule `updateGitignore` uses to\n * replace it — so user-written ignore rules further down are never mistaken\n * for installed skills and pruned.\n */\nexport function parsePreviousSkills(gitignoreContent: string, symlinkFn: (n: string) => string): string[] {\n\tconst startIdx = gitignoreContent.indexOf(GITIGNORE_BLOCK_START);\n\tif (startIdx === -1) return [];\n\tconst endIdx = gitignoreContent.indexOf(GITIGNORE_BLOCK_END, startIdx);\n\tconst blankAt = /\\r?\\n[ \\t]*\\r?\\n/.exec(gitignoreContent.slice(startIdx));\n\tconst blankIdx = blankAt ? startIdx + blankAt.index : -1;\n\t// Complete only if the end marker comes before any blank line.\n\tconst complete = endIdx !== -1 && (blankIdx === -1 || endIdx < blankIdx);\n\tconst blockEnd = complete ? endIdx : blankIdx === -1 ? gitignoreContent.length : blankIdx;\n\tconst block = gitignoreContent.slice(startIdx, blockEnd);\n\tconst placeholder = \"__placeholder__\";\n\tconst symlinkPrefix = `/${symlinkFn(placeholder)}`.replace(placeholder, \"\");\n\treturn block\n\t\t.split(/\\r?\\n/)\n\t\t.filter((line) => line.startsWith(symlinkPrefix))\n\t\t.map((line) => line.slice(symlinkPrefix.length));\n}\n\nasync function copyDirRecursive(src: string, dest: string): Promise<void> {\n\tawait mkdir(dest, { recursive: true });\n\tconst entries = await readdir(src, { withFileTypes: true });\n\tfor (const entry of entries) {\n\t\tconst srcPath = join(src, entry.name);\n\t\tconst destPath = join(dest, entry.name);\n\t\tif (entry.isDirectory()) {\n\t\t\tawait copyDirRecursive(srcPath, destPath);\n\t\t} else {\n\t\t\tawait copyFile(srcPath, destPath);\n\t\t}\n\t}\n}\n\nasync function updateSkillsGitignore(\n\tgitignorePath: string,\n\tskills: string[],\n\tsymlinkFn: (name: string) => string\n): Promise<void> {\n\tawait updateGitignore(gitignorePath, {\n\t\tstart: GITIGNORE_BLOCK_START,\n\t\tend: GITIGNORE_BLOCK_END,\n\t\tlines: [`/${AGENTS_SKILLS_ROOT}/`, ...skills.map((n) => `/${symlinkFn(n)}`)],\n\t});\n}\n","/**\n * `holocron repo setup` — orchestrates per-capability setup actions across\n * every plugin loaded from `holocron.config.json`.\n *\n * Per CLAUDE.md soft-skip: each step is wrapped in a try/catch and\n * failures don't abort subsequent capabilities. The summary at the end\n * reports counts so the operator can see what worked + what didn't.\n *\n * Per the Standards: when `ctx.dryRun` is true, mutating calls are\n * replaced with \"would\" log lines. Read-only probes (e.g.,\n * `vault.list`) still run so the operator sees real state.\n *\n * The orchestrator knows about specific capability methods by name\n * (e.g., `source.enableVulnerabilityAlerts`). This deliberate coupling\n * makes the \"what does setup do\" contract explicit and concrete —\n * decoupling via a per-capability `setupSteps()` method would be more\n * extensible but pushes the same knowledge into N plugins instead of\n * one central place.\n */\n\nimport { access, readFile, writeFile } from \"node:fs/promises\";\nimport { basename, join } from \"node:path\";\n\nimport {\n\tcreateAlexignore,\n\tcreateAlexrc,\n\tcreateAstromech,\n\tcreateCommitMsg,\n\tcreateDependabot,\n\tcreateDevmoji,\n\tcreateEditorconfig,\n\tcreateEditorconfigChecker,\n\tcreateHeader,\n\tcreateLabeler,\n\tcreatePreCommit,\n\tcreatePrepareCommitMsg,\n\tcreatePrePush,\n\tcreateYamlignore,\n\tcreateYamllint,\n\textractPreviewConfig,\n\tKNOWN_WORKFLOWS,\n\treadWorkspacePackages,\n} from \"@theholocron/astromech\";\nimport type { TasksConfig } from \"@theholocron/astromech/config\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { AuthError, createFeatureResolver } from \"../../auth/index.js\";\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport {\n\tassertPluginsResolvable,\n\ttype Auth,\n\ttype Deployment,\n\ttype Dns,\n\ttype DnsRecordRequest,\n\ttype Environments,\n\ttype Errors,\n\ttype Logs,\n\ttype Monitoring,\n\tPluginLoader,\n\ttype Secrets,\n\ttype Source,\n\ttype Tooling,\n\ttype Vault,\n\ttype Wiki,\n\ttype Workers,\n} from \"../../plugin/index.js\";\nimport dcoConfig from \"../../templates/dco.yml\";\nimport { style, withSpinner } from \"../../ui/index.js\";\nimport { installAgentPrompts } from \"./agent-prompts.js\";\nimport { upsertBranchProtection } from \"./branch-protection.js\";\nimport {\n\tderiveCapabilities,\n\tderiveCompliance,\n\tderiveProfile,\n\tderiveStack,\n\treadWorkspacePackageJsons,\n} from \"./derived-properties/index.js\";\nimport { installEngineeringStructure } from \"./engineering.js\";\nimport { CANONICAL_LABELS, STALE_LABELS } from \"./labels.js\";\nimport { BALANCED_REPO_SETTINGS } from \"./repo-settings.js\";\nimport { formatStep, type RunSetupInput, runStep, type SetupReport, type SetupStepResult } from \"./run-step/index.js\";\nimport { AGENT_SYMLINK_PATHS, installSkills } from \"./skills/index.js\";\n\nconst { workflowHeader } = createHeader({\n\tsource: \"packages/cli/src/commands/setup/run-setup.ts\",\n\ttool: \"holocron repo setup\",\n});\n// Thin-caller workflow content comes from astromech.thinCallers(), not this\n// file — a separate binding so its header points contributors at the actual\n// template/generation logic (packages/astromech/src/thin-callers.ts), same as\n// the workflowHeader() calls further down that write genuinely cli-owned\n// templates (dco.yml).\nconst { workflowHeader: thinCallerHeader } = createHeader({\n\tsource: \"packages/astromech/src/thin-callers.ts\",\n\ttool: \"holocron repo setup\",\n});\n\nexport async function runSetup(input: RunSetupInput): Promise<SetupReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\tawait withSpinner(\"Loading plugins…\", () => loader.load());\n\tassertPluginsResolvable(loader, \"repo setup\");\n\n\tconst config = input.loaded.resolved;\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst steps: SetupStepResult[] = [];\n\tconst repo = config.repo;\n\tconst effectivePreset = repo?.protection;\n\n\t// Git hooks: `--hooks`/`--no-hooks` wins, then `config.hooks`, then default\n\t// on for `protection: \"strict\"`.\n\tconst hooksEnabled =\n\t\tinput.hooks ??\n\t\t(typeof config.hooks === \"boolean\"\n\t\t\t? config.hooks\n\t\t\t: typeof config.hooks === \"object\"\n\t\t\t\t? config.hooks.prePush !== false\n\t\t\t\t: effectivePreset === \"strict\");\n\n\tprint(style.header(`Holocron setup — ${config.name}${dryRun ? \" (dry-run)\" : \"\"}`));\n\tprint(style.dim(` config: ${input.loaded.filepath}`));\n\tprint(\"\");\n\n\t// ── source: security toggles + repo policy ──────────────────────────\n\tif (loader.has(\"source\")) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tprint(style.step(\"source\"));\n\t\tconst SECURITY_SKIP_CODES: Partial<Record<string, number[]>> = {\n\t\t\tenableSecretScanning: [422],\n\t\t\tenablePrivateVulnerabilityReporting: [404],\n\t\t};\n\t\tfor (const method of [\n\t\t\t\"enableVulnerabilityAlerts\",\n\t\t\t\"enableAutomatedSecurityFixes\",\n\t\t\t\"enableSecretScanning\",\n\t\t\t\"enablePrivateVulnerabilityReporting\",\n\t\t\t\"enableDependencyGraph\",\n\t\t] as const) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\n\t\t\t\t\t\"source\",\n\t\t\t\t\tmethod,\n\t\t\t\t\tdryRun,\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\tawait source[method]();\n\t\t\t\t\t},\n\t\t\t\t\t{ skipCodes: SECURITY_SKIP_CODES[method] }\n\t\t\t\t)\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst usesAdvancedCodeQL = (config.tasks ?? [])\n\t\t\t.map((e) => (typeof e === \"string\" ? e : e.name))\n\t\t\t.includes(\"security.codeScanning\");\n\t\tsteps.push(\n\t\t\tawait runStep(\n\t\t\t\t\"source\",\n\t\t\t\tusesAdvancedCodeQL ? \"disableDefaultCodeScanning\" : \"enableCodeScanning\",\n\t\t\t\tdryRun,\n\t\t\t\tasync () => {\n\t\t\t\t\tif (usesAdvancedCodeQL) {\n\t\t\t\t\t\tawait source.disableDefaultCodeScanning();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn await source.enableCodeScanning();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\tif (effectivePreset && effectivePreset !== \"none\") {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"updateRepoSettings\", dryRun, async () => {\n\t\t\t\t\tawait source.updateRepoSettings({\n\t\t\t\t\t\t...BALANCED_REPO_SETTINGS,\n\t\t\t\t\t\t...(repo?.defaultBranch ? { default_branch: repo.defaultBranch } : {}),\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\tconst tasksConfig: TasksConfig = { tasks: config.tasks as TasksConfig[\"tasks\"] };\n\t\t\tif (config.extraRequiredChecks) tasksConfig.extraRequiredChecks = config.extraRequiredChecks;\n\t\t\tconst requiredChecks =\n\t\t\t\teffectivePreset === \"strict\"\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t\"DCO\",\n\t\t\t\t\t\t\t...createAstromech({\n\t\t\t\t\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\t\t\t\t\tconfig: tasksConfig,\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t}).requiredChecks(),\n\t\t\t\t\t\t]\n\t\t\t\t\t: [];\n\t\t\tsteps.push(await upsertBranchProtection(source, dryRun, requiredChecks));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── source: workflow thin wrappers ──────────────────────────────────\n\tconst tasks = config.tasks;\n\tif (loader.has(\"source\") && tasks && tasks.length > 0) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tprint(style.step(\"workflows\"));\n\n\t\t// astromech renders every thin caller from the manifest (lint linter set,\n\t\t// deploy paths, deploy+preview) and validates it — a bad manifest throws\n\t\t// here, aborting setup, same as before. Iterate the manifest (not the map)\n\t\t// so step reporting keeps the config's order.\n\t\tconst files = createAstromech({\n\t\t\tcwd: input.context.repoRoot,\n\t\t\tconfig: { tasks: tasks as TasksConfig[\"tasks\"] },\n\t\t\torgContext: { org: config.org, domain: config.domain },\n\t\t\tlogger,\n\t\t}).thinCallers();\n\n\t\tfor (const entry of tasks) {\n\t\t\tconst name = typeof entry === \"string\" ? entry : entry.name;\n\t\t\t// knowledge.docs / knowledge.components have no static\n\t\t\t// WORKFLOW_TEMPLATES entry (their content is always\n\t\t\t// combined-generated, astromech.ts) — not in KNOWN_WORKFLOWS, but\n\t\t\t// not \"unknown\" either.\n\t\t\tconst isCombinedContentOnly = name === \"knowledge.docs\" || name === \"knowledge.components\";\n\n\t\t\tif (!KNOWN_WORKFLOWS.has(name) && !isCombinedContentOnly) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: `write workflow ${name}`,\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: `unknown workflow \"${name}\" — no template available`,\n\t\t\t\t});\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// The combined-content family (delivery.deploy, knowledge.docs,\n\t\t\t// knowledge.components) all key their generated file by task name\n\t\t\t// already — no special-casing needed, unlike the old hardcoded\n\t\t\t// \"deploy.yml\" filename.\n\t\t\tconst filename = `${name}.yml`;\n\t\t\tconst content = files.get(filename);\n\t\t\tif (content === undefined) continue; // ci: false — nothing to write\n\n\t\t\tconst withPreview = content.includes(\"workflows/preview.yml@main\");\n\t\t\tconst step = withPreview ? `write workflow ${name} (with preview)` : `write workflow ${name}`;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", step, dryRun, async () => {\n\t\t\t\t\tawait source.writeWorkflowFile(filename, `${thinCallerHeader()}${content}`);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── source: labeler config ───────────────────────────────────────────\n\tif (\n\t\tloader.has(\"source\") &&\n\t\t(config.tasks ?? []).map((e) => (typeof e === \"string\" ? e : e.name)).includes(\"bookkeeping\")\n\t) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .github/labeler.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".github/labeler.yml\", createLabeler());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── source: dependabot + dco config ─────────────────────────────────\n\tif (loader.has(\"source\") && effectivePreset !== \"none\") {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .github/dependabot.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".github/dependabot.yml\", createDependabot());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .github/dco.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".github/dco.yml\", `${workflowHeader()}${dcoConfig}`);\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── source: static config files ──────────────────────────────────────\n\tif (loader.has(\"source\")) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .alexrc.json\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".alexrc.json\", createAlexrc());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .alexignore\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".alexignore\", createAlexignore());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .yamllint.yml\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".yamllint.yml\", createYamllint());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .yamlignore\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".yamlignore\", createYamlignore());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .editorconfig\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".editorconfig\", createEditorconfig());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .editorconfig-checker.json\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".editorconfig-checker.json\", createEditorconfigChecker());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write devmoji.config.cjs\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\"devmoji.config.cjs\", createDevmoji());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .husky/prepare-commit-msg\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".husky/prepare-commit-msg\", createPrepareCommitMsg());\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tsteps.push(\n\t\t\tawait runStep(\"source\", \"write .husky/commit-msg\", dryRun, async () => {\n\t\t\t\tawait source.writeRepoFile(\".husky/commit-msg\", createCommitMsg(config.holocronScript));\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\tif (hooksEnabled) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"write .husky/pre-push\", dryRun, async () => {\n\t\t\t\t\tawait source.writeRepoFile(\".husky/pre-push\", createPrePush(config.holocronScript));\n\t\t\t\t\treturn \"runs `holocron run ci` before push — bypass with `git push --no-verify`\";\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"write .husky/pre-commit\", dryRun, async () => {\n\t\t\t\t\tawait source.writeRepoFile(\".husky/pre-commit\", createPreCommit());\n\t\t\t\t\treturn \"runs GitLeaks (staged-only) + lint-staged before commit\";\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tif (config.syncScripts !== false) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"set package.json prepare script\", dryRun, async () => {\n\t\t\t\t\t\treturn (await ensurePrepareScript(input.context.repoRoot))\n\t\t\t\t\t\t\t? \"prepare now runs husky\"\n\t\t\t\t\t\t\t: \"already runs husky\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep: \"write .husky/pre-push\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"git hooks disabled\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep: \"write .husky/pre-commit\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"git hooks disabled\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t\t{\n\t\t\tconst configuredWorkflowNames = (config.tasks ?? []).map((e) => (typeof e === \"string\" ? e : e.name));\n\t\t\tconst hasTestWorkflow = configuredWorkflowNames.includes(\"verification.unitTests\");\n\t\t\tconst existing = await readFile(join(input.context.repoRoot, \"codecov.yml\"), \"utf8\").catch(() => null);\n\t\t\tif (!hasTestWorkflow && existing == null) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: \"write codecov.yml\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no test workflow configured\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"write codecov.yml\", dryRun, async () => {\n\t\t\t\t\t\tconst content = createAstromech({ cwd: input.context.repoRoot, logger }).codecovConfig(\n\t\t\t\t\t\t\texisting\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait source.writeRepoFile(\"codecov.yml\", content);\n\t\t\t\t\t\tconst packageCount = readWorkspacePackages(input.context.repoRoot).length;\n\t\t\t\t\t\treturn packageCount > 0 ? `${packageCount} components` : \"no components\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t\t{\n\t\t\tconst astromechTurbo = createAstromech({\n\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\tconfig: { tasks: config.tasks as TasksConfig[\"tasks\"] },\n\t\t\t\tlogger,\n\t\t\t});\n\t\t\tconst content = astromechTurbo.turboConfig();\n\n\t\t\tif (content === null) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: \"write turbo.json\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no fan-out-eligible tasks configured\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"write turbo.json\", dryRun, async () => {\n\t\t\t\t\t\tawait source.writeRepoFile(\"turbo.json\", content);\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\t\t// #692: a root that's genuinely a directly-buildable package (not\n\t\t\t\t// just an orchestrator) silently vanishes from `turbo run <task>`\n\t\t\t\t// once turbo.json exists, unless it's an explicit workspace\n\t\t\t\t// member — fix pnpm-workspace.yaml in the same step that\n\t\t\t\t// introduces the risk.\n\t\t\t\tconst rootPkgRaw = await readFile(join(input.context.repoRoot, \"package.json\"), \"utf8\").catch(\n\t\t\t\t\t() => null\n\t\t\t\t);\n\t\t\t\tconst rootPkg = rootPkgRaw ? (JSON.parse(rootPkgRaw) as { scripts?: Record<string, string> }) : null;\n\t\t\t\tconst workspaceYaml = await readFile(join(input.context.repoRoot, \"pnpm-workspace.yaml\"), \"utf8\").catch(\n\t\t\t\t\t() => \"\"\n\t\t\t\t);\n\t\t\t\tconst rootScripts = rootPkg?.scripts ?? {};\n\t\t\t\tconst workspaceFix = astromechTurbo.ensureRootWorkspaceMember(workspaceYaml, rootScripts);\n\t\t\t\tif (workspaceFix.changed) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runStep(\n\t\t\t\t\t\t\t\"source\",\n\t\t\t\t\t\t\t\"fix pnpm-workspace.yaml (root workspace member, #692)\",\n\t\t\t\t\t\t\tdryRun,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tawait source.writeRepoFile(\"pnpm-workspace.yaml\", workspaceFix.content);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// turbo.json alone is inert without turbo itself installed — see\n\t\t\t\t// ensureTurboDependency()'s own docstring for how this was found.\n\t\t\t\tif (rootPkgRaw) {\n\t\t\t\t\tconst depFix = astromechTurbo.ensureTurboDependency(rootPkgRaw, workspaceFix.content);\n\t\t\t\t\tif (depFix.changed) {\n\t\t\t\t\t\tsteps.push(\n\t\t\t\t\t\t\tawait runStep(\"source\", \"add turbo devDependency\", dryRun, async () => {\n\t\t\t\t\t\t\t\tawait source.writeRepoFile(\"package.json\", depFix.content);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (source.syncLabels) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"sync labels\", dryRun, async () => {\n\t\t\t\t\treturn source.syncLabels!(CANONICAL_LABELS, STALE_LABELS);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst properties: Record<string, string | string[]> = {};\n\n\t\tif (effectivePreset && effectivePreset !== \"none\")\n\t\t\tproperties[\"holocron_branch_protection_level\"] = effectivePreset;\n\n\t\tconst isMonorepo = await access(join(input.context.repoRoot, \"pnpm-workspace.yaml\"))\n\t\t\t.then(() => true)\n\t\t\t.catch(() => false);\n\t\tproperties[\"monorepo\"] = String(isMonorepo);\n\n\t\tconst manual = repo?.properties ?? {};\n\t\tif (manual.lifecycle) properties[\"lifecycle\"] = manual.lifecycle;\n\t\tif (manual.open_source !== undefined) properties[\"open_source\"] = String(manual.open_source);\n\t\tif (manual.runtime_environment) properties[\"runtime_environment\"] = manual.runtime_environment;\n\t\tif (manual.uses_external_packages !== undefined)\n\t\t\tproperties[\"uses_external_packages\"] = String(manual.uses_external_packages);\n\n\t\t// #677 — derived fields, distinct from the manual ones above: signal\n\t\t// that isn't an explicit holocron.config.ts field today (framework\n\t\t// choice, repo archetype, capability drift).\n\t\t{\n\t\t\tconst rootPackageJson = await readFile(join(input.context.repoRoot, \"package.json\"), \"utf8\")\n\t\t\t\t.then((raw) => JSON.parse(raw) as Parameters<typeof deriveStack>[0])\n\t\t\t\t.catch(() => null);\n\t\t\tconst workspacePackages = readWorkspacePackages(input.context.repoRoot);\n\t\t\tconst workspacePackageJsons = await readWorkspacePackageJsons(input.context.repoRoot, workspacePackages);\n\t\t\tproperties[\"holocron_profile\"] = deriveProfile({\n\t\t\t\trootPackageJson,\n\t\t\t\trepoName: basename(input.context.repoRoot),\n\t\t\t\tisMonorepo,\n\t\t\t\tworkspacePackageJsons,\n\t\t\t});\n\t\t\tproperties[\"holocron_stack\"] = deriveStack(rootPackageJson);\n\t\t\tconst capabilities = deriveCapabilities(config.providers);\n\t\t\tproperties[\"holocron_capabilities\"] = capabilities;\n\t\t\tproperties[\"holocron_compliance\"] = deriveCompliance(capabilities);\n\t\t}\n\n\t\tif (source.syncProperties) {\n\t\t\tsteps.push(await runStep(\"source\", \"sync properties\", dryRun, () => source.syncProperties!(properties)));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst topics = repo?.topics ?? [];\n\t\tif (topics.length > 0 && source.syncTopics) {\n\t\t\tsteps.push(await runStep(\"source\", \"sync topics\", dryRun, () => source.syncTopics!(topics)));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (config.description && source.syncDescription) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"sync description\", dryRun, () => source.syncDescription!(config.description!))\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (config.homepage && source.syncHomepage) {\n\t\t\tsteps.push(await runStep(\"source\", \"sync homepage\", dryRun, () => source.syncHomepage!(config.homepage!)));\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tconst teams = repo?.teams ?? [];\n\t\tif (teams.length > 0) {\n\t\t\tif (source.syncTeams) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"source\", \"sync teams\", dryRun, () => source.syncTeams!(teams), { skipCodes: [422] })\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\t\tconst repoCoord = input.context.repo ?? repo?.name ?? \"\";\n\t\t\t\tconst org = repoCoord.includes(\"/\") ? repoCoord.split(\"/\")[0]! : \"\";\n\t\t\t\tconst writeableTeams = teams\n\t\t\t\t\t.map((t) => (typeof t === \"string\" ? { slug: t, permission: \"push\" as const } : t))\n\t\t\t\t\t.filter((t) => [\"push\", \"maintain\", \"admin\"].includes(t.permission));\n\t\t\t\tif (org && writeableTeams.length > 0) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runStep(\"source\", \"write .github/CODEOWNERS\", dryRun, async () => {\n\t\t\t\t\t\t\tconst content = writeableTeams.map((t) => `* @${org}/${t.slug}`).join(\"\\n\") + \"\\n\";\n\t\t\t\t\t\t\tawait source.writeRepoFile(\".github/CODEOWNERS\", content);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\tstep: \"sync teams\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"provider does not implement syncTeams\",\n\t\t\t\t});\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── environments ────────────────────────────────────────────────────\n\tif (loader.has(\"environments\")) {\n\t\tconst envs = loader.get(\"environments\") as Environments;\n\t\tprint(style.step(\"environments\"));\n\t\tfor (const envName of [\"staging\", \"production\"]) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"environments\", `upsert ${envName}`, dryRun, async () => {\n\t\t\t\t\tawait envs.upsertEnvironment({ name: envName });\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── docs: configure GitHub Pages ────────────────────────────────────\n\tif (loader.has(\"source\") && config.docs) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tconst resolveDeployToken = createFeatureResolver({\n\t\t\tenvName: \"HOLOCRON_DEPLOY_TOKEN\",\n\t\t\tkeyringKey: \"github.deploy\",\n\t\t});\n\t\tlet deployToken: string | undefined;\n\t\ttry {\n\t\t\tdeployToken = resolveDeployToken({ keyring: input.keyring });\n\t\t} catch (err) {\n\t\t\tif (!(err instanceof AuthError)) throw err;\n\t\t}\n\t\tprint(style.step(\"docs\"));\n\t\tif (!deployToken) {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"source\",\n\t\t\t\tstep: \"configure GitHub Pages\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"no deploy token found — set HOLOCRON_DEPLOY_TOKEN or run: holocron auth set github.deploy <PAT>\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t} else if (source.configurePages) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"source\", \"configure GitHub Pages\", dryRun, async () => {\n\t\t\t\t\tawait source.configurePages!(config.docs!, deployToken);\n\t\t\t\t\tconst parts: string[] = [config.docs!.build];\n\t\t\t\t\tif (config.docs!.domain) parts.push(`domain: ${config.docs!.domain}`);\n\t\t\t\t\tif (config.docs!.https) parts.push(\"https: enforced\");\n\t\t\t\t\treturn parts.join(\", \");\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── wiki: provision engineering wiki config ──────────────────────────\n\tif (loader.has(\"wiki\")) {\n\t\tconst wiki = loader.get(\"wiki\") as Wiki;\n\t\tprint(style.step(\"wiki\"));\n\t\tsteps.push(\n\t\t\tawait runStep(\"wiki\", \"provision wiki config\", dryRun, async () => {\n\t\t\t\treturn await wiki.provision({ name: config.name });\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\tconst wikiDns = wiki.dnsRecord?.();\n\t\tconst wikiProxy = wiki.proxyConfig?.();\n\t\tif (wikiDns && loader.has(\"dns\")) {\n\t\t\tconst dns = loader.get(\"dns\") as Dns;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"dns\", `upsertRecord ${wikiDns.record.name}`, dryRun, async () => {\n\t\t\t\t\tawait dns.upsertRecord(wikiDns.zone, {\n\t\t\t\t\t\t...wikiDns.record,\n\t\t\t\t\t\tttl: 1,\n\t\t\t\t\t\t...(wikiProxy ? { proxied: true } : {}),\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (wikiProxy && wikiDns && loader.has(\"workers\")) {\n\t\t\tconst workers = loader.get(\"workers\") as Workers;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"workers\", `upsertProxy ${wikiDns.record.name}`, dryRun, async () => {\n\t\t\t\t\tawait workers.upsertProxy(wikiDns.record.name, wikiProxy);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── deployment: ensure project + preview infrastructure ─────────────\n\tif (loader.has(\"deployment\")) {\n\t\tconst deploy = loader.get(\"deployment\") as Deployment;\n\t\tprint(style.step(\"deployment\"));\n\n\t\t// delivery.deploy, knowledge.docs, and knowledge.components all share the\n\t\t// same combined production+preview mechanism (astromech.ts) — any one of\n\t\t// them can carry the preview config that drives project/DNS provisioning.\n\t\tconst deployEntry = (config.tasks ?? [])\n\t\t\t.map((e) => (typeof e === \"string\" ? { name: e } : e))\n\t\t\t.find(\n\t\t\t\t(e) => e.name === \"delivery.deploy\" || e.name === \"knowledge.docs\" || e.name === \"knowledge.components\"\n\t\t\t);\n\t\tconst previewCfg = deployEntry?.with\n\t\t\t? extractPreviewConfig(deployEntry.with as Record<string, unknown>, {\n\t\t\t\t\torg: config.org,\n\t\t\t\t\tdomain: config.domain,\n\t\t\t\t})\n\t\t\t: null;\n\t\tconst ensureCustomDomain = async (projectId: string, hostname: string) => {\n\t\t\tif (!deploy.ensureCustomDomain) return;\n\t\t\tconst customDomainDns = { value: null as DnsRecordRequest | null };\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"deployment\", `ensureCustomDomain ${hostname}`, dryRun, async () => {\n\t\t\t\t\tcustomDomainDns.value = await deploy.ensureCustomDomain!(projectId, hostname);\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\tif (customDomainDns.value && loader.has(\"dns\")) {\n\t\t\t\tconst dns = loader.get(\"dns\") as Dns;\n\t\t\t\tconst dnsRecord = customDomainDns.value;\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"dns\", `upsertRecord ${dnsRecord.record.name}`, dryRun, async () => {\n\t\t\t\t\t\tawait dns.upsertRecord(dnsRecord.zone, { ...dnsRecord.record, ttl: 1 });\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t};\n\n\t\tif (!previewCfg) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"deployment\", `ensureProject ${config.name}`, dryRun, async () => {\n\t\t\t\t\tawait deploy.ensureProject({ name: config.name });\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tif (deploy.domain) {\n\t\t\t\tawait ensureCustomDomain(config.name, deploy.domain);\n\t\t\t}\n\t\t}\n\n\t\tif (previewCfg) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"deployment\", `ensureProject ${previewCfg.project}`, dryRun, async () => {\n\t\t\t\t\tawait deploy.ensureProject({ name: previewCfg.project });\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (previewCfg?.domain) {\n\t\t\tawait ensureCustomDomain(previewCfg.project, previewCfg.domain);\n\t\t}\n\n\t\t// Cloudflare Pages doesn't expose its DNS challenge, so retain its\n\t\t// provider-specific apex + wildcard records. Other providers return\n\t\t// their required record from ensureCustomDomain() above.\n\t\tif (previewCfg?.domain && deploy.providerName === \"cloudflare\" && loader.has(\"dns\")) {\n\t\t\tconst dns = loader.get(\"dns\") as Dns;\n\t\t\tconst wildcardDomain = `*.${previewCfg.domain}`;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"dns\", `upsertRecord ${previewCfg.domain}`, dryRun, async () => {\n\t\t\t\t\tawait dns.upsertRecord(previewCfg.domain!, {\n\t\t\t\t\t\ttype: \"CNAME\",\n\t\t\t\t\t\tname: previewCfg.domain!,\n\t\t\t\t\t\tcontent: `${previewCfg.project}.pages.dev`,\n\t\t\t\t\t\tttl: 1,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"dns\", `upsertRecord ${wildcardDomain}`, dryRun, async () => {\n\t\t\t\t\tawait dns.upsertRecord(previewCfg.domain!, {\n\t\t\t\t\t\ttype: \"CNAME\",\n\t\t\t\t\t\tname: wildcardDomain,\n\t\t\t\t\t\tcontent: `${previewCfg.project}.pages.dev`,\n\t\t\t\t\t\tttl: 1,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── auth: ensure webhook app (optional method) ──────────────────────\n\tif (loader.has(\"auth\")) {\n\t\tconst auth = loader.get(\"auth\") as Auth;\n\t\tprint(style.step(\"auth\"));\n\t\tif (auth.ensureWebhookApp) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"auth\", \"ensureWebhookApp\", dryRun, async () => {\n\t\t\t\t\tconst result = await auth.ensureWebhookApp!();\n\t\t\t\t\treturn `webhook ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"auth\",\n\t\t\t\tstep: \"ensureWebhookApp\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: \"provider does not implement ensureWebhookApp\",\n\t\t\t});\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── vault: bootstrap project + configs, then read-only probe ───────\n\tif (loader.has(\"vault\")) {\n\t\tconst vault = loader.get(\"vault\") as Vault;\n\t\tprint(style.step(\"vault\"));\n\n\t\tif (vault.ensureProject) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"vault\", `ensureProject ${config.name}`, dryRun, async () => {\n\t\t\t\t\tconst result = await vault.ensureProject!(config.name);\n\t\t\t\t\treturn `project ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (vault.ensureEnvironment) {\n\t\t\tfor (const envName of [\"dev\", \"stg\", \"prd\"]) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"vault\", `ensureEnvironment ${envName}`, dryRun, async () => {\n\t\t\t\t\t\tconst result = await vault.ensureEnvironment!(config.name, envName);\n\t\t\t\t\t\treturn `${envName} ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst keys = await vault.list();\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"vault\",\n\t\t\t\tstep: \"list\",\n\t\t\t\tstatus: \"ok\",\n\t\t\t\tmessage: `${keys.length} keys available`,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"vault\",\n\t\t\t\tstep: \"list\",\n\t\t\t\tstatus: \"fail\",\n\t\t\t\tmessage: errorMessage(err),\n\t\t\t});\n\t\t}\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── errors: provision the tracker project + push the DSN to secrets ─\n\tif (loader.has(\"errors\")) {\n\t\tconst errors = loader.get(\"errors\") as Errors;\n\t\tprint(style.step(\"errors\"));\n\n\t\tif (errors.ensureProject) {\n\t\t\tlet dsn: string | undefined;\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"errors\", `ensureProject ${config.name}`, dryRun, async () => {\n\t\t\t\t\tconst result = await errors.ensureProject!({ name: config.name });\n\t\t\t\t\tdsn = result.dsn;\n\t\t\t\t\treturn `project ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\n\t\t\tif (dsn && loader.has(\"secrets\")) {\n\t\t\t\tconst secrets = loader.get(\"secrets\") as Secrets;\n\t\t\t\tconst { envKeys } = await errors.describe();\n\t\t\t\tfor (const key of envKeys) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runStep(\"errors\", `secrets set ${key}`, dryRun, async () => {\n\t\t\t\t\t\t\tawait secrets.setSecret({ kind: \"repo\" }, key, dsn!);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── logs: provision the aggregation datasets ───────────────────────\n\tif (loader.has(\"logs\")) {\n\t\tconst logs = loader.get(\"logs\") as Logs;\n\t\tprint(style.step(\"logs\"));\n\n\t\tif (logs.ensureDataset) {\n\t\t\tfor (const dataset of [\"holocron-ci\", \"holocron-local\"]) {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runStep(\"logs\", `ensureDataset ${dataset}`, dryRun, async () => {\n\t\t\t\t\t\tconst result = await logs.ensureDataset!(dataset);\n\t\t\t\t\t\treturn `${dataset} ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── monitoring: ensure each configured check exists ─────────────────\n\tif (loader.has(\"monitoring\")) {\n\t\tconst monitoring = loader.get(\"monitoring\") as Monitoring;\n\t\tprint(style.step(\"monitoring\"));\n\n\t\tfor (const checkInput of monitoring.checks) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"monitoring\", `ensureCheck ${checkInput.name}`, dryRun, async () => {\n\t\t\t\t\tconst result = await monitoring.ensureCheck(checkInput);\n\t\t\t\t\treturn `${checkInput.name} ${result.alreadyExists ? \"exists\" : \"created\"}`;\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── tooling: sync each (many cardinality) ───────────────────────────\n\tif (loader.has(\"tooling\")) {\n\t\tconst tools = loader.get(\"tooling\") as Tooling[];\n\t\tprint(style.step(\"tooling\"));\n\t\tfor (const tool of tools) {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"tooling\", `${tool.providerName}.sync`, dryRun, async () => {\n\t\t\t\t\tawait tool.sync();\n\t\t\t\t})\n\t\t\t);\n\t\t\tprint(formatStep(steps[steps.length - 1]!));\n\t\t}\n\t}\n\n\t// ── skills: install agent skills from registry ──────────────────────\n\tif (config.skills && config.skills.length > 0 && config.agent) {\n\t\tprint(style.step(\"skills\"));\n\t\tif (!(config.agent in AGENT_SYMLINK_PATHS)) {\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"skills\",\n\t\t\t\tstep: \"install skills\",\n\t\t\t\tstatus: \"skip\",\n\t\t\t\tmessage: `agent \"${config.agent}\" has no known skill install path`,\n\t\t\t});\n\t\t} else {\n\t\t\tsteps.push(\n\t\t\t\tawait runStep(\"skills\", \"install skills\", dryRun, async () => {\n\t\t\t\t\treturn await installSkills({\n\t\t\t\t\t\tagent: config.agent!,\n\t\t\t\t\t\tskills: config.skills!,\n\t\t\t\t\t\trepoRoot: input.context.repoRoot,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── prompts: write agent role prompts to .agents/prompts/ ────────────\n\tif (config.agent) {\n\t\tprint(style.step(\"prompts\"));\n\t\tsteps.push(\n\t\t\tawait runStep(\"prompts\", \"install agent prompts\", dryRun, async () => {\n\t\t\t\treturn await installAgentPrompts({ repoRoot: input.context.repoRoot });\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\t// ── engineering: provision docs/decisions/ and docs/engineering/ ─────\n\tif (config.docs) {\n\t\tprint(style.step(\"engineering\"));\n\t\tsteps.push(\n\t\t\tawait runStep(\"engineering\", \"provision engineering structure\", dryRun, async () => {\n\t\t\t\treturn await installEngineeringStructure({ repoRoot: input.context.repoRoot });\n\t\t\t})\n\t\t);\n\t\tprint(formatStep(steps[steps.length - 1]!));\n\t}\n\n\tconst summary = steps.reduce(\n\t\t(acc, s) => {\n\t\t\tif (s.status === \"ok\") acc.ok += 1;\n\t\t\telse if (s.status === \"fail\") acc.fail += 1;\n\t\t\telse if (s.status === \"skip\") acc.skip += 1;\n\t\t\telse if (s.status === \"dry-run\") acc.dryRun += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0, dryRun: 0 }\n\t);\n\n\tprint(\"\");\n\tconst summaryLine = ` ${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${\n\t\tdryRun ? `, ${summary.dryRun} would-do` : \"\"\n\t}`;\n\tprint(summary.fail > 0 ? style.fail(summaryLine.trim()) : style.success(summaryLine.trim()));\n\n\tconst skippedSteps = steps.filter((s) => s.status === \"skip\");\n\tif (skippedSteps.length > 0) {\n\t\tprint(\"\");\n\t\tprint(style.hint(\" Skipped:\"));\n\t\tfor (const s of skippedSteps) {\n\t\t\t/* v8 ignore next -- all skip steps set message; empty fallback is defensive */\n\t\t\tprint(style.hint(` · ${s.step}${s.message ? ` (${s.message})` : \"\"}`));\n\t\t}\n\t}\n\n\tif (steps.some((s) => s.reason === \"permissions\")) {\n\t\tprint(\"\");\n\t\tprint(style.warn(\"Some steps failed with 403 (insufficient token permissions).\"));\n\t\tprint(style.hint(\" Repo-scoped operations (rulesets, settings, workflows) require a\"));\n\t\tprint(style.hint(\" fine-grained PAT passed via --token or HOLOCRON_ADMIN_TOKEN:\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" · Administration — read and write\"));\n\t\tprint(style.hint(\" · Code scanning alerts — read and write\"));\n\t\tprint(style.hint(\" · Contents — read and write\"));\n\t\tprint(style.hint(\" · Secret scanning alerts — read and write\"));\n\t\tprint(style.hint(\" · Workflows — read and write\"));\n\t\tprint(style.hint(\" · Metadata — read (added automatically)\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" Org-scoped operations (teams, custom properties) require\"));\n\t\tprint(style.hint(\" HOLOCRON_ORG_TOKEN — a fine-grained PAT with resource owner set to the org:\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" · Administration — read and write (repository permission)\"));\n\t\tprint(style.hint(\" · Members — read (organization permission)\"));\n\t\tprint(style.hint(\" · Organization custom properties — read and write (organization permission)\"));\n\t\tprint(style.hint(\" · Metadata — read (repository permission, auto-included)\"));\n\t\tprint(\"\");\n\t\tprint(style.hint(\" Create tokens at: https://github.com/settings/personal-access-tokens/new\"));\n\t\tprint(style.hint(\" Then re-run: holocron repo setup --token <your-admin-pat>\"));\n\t\tprint(style.hint(\" Store org token: HOLOCRON_ORG_TOKEN env var or keyring key github.org\"));\n\t}\n\n\treturn { steps, summary };\n}\n\n/**\n * Ensure `package.json#scripts.prepare` runs `husky` so git hooks register on\n * install. Merge-only: an existing `prepare` that does more than husky (e.g.\n * `turbo run build` — needed where root config files import a workspace\n * package's `dist/`, theholocron/holocron#654) is preserved and husky is\n * appended. Leaves every other script untouched. Returns `true` when it wrote\n * a change, `false` when already runs husky or there is no `package.json`.\n */\nasync function ensurePrepareScript(repoRoot: string): Promise<boolean> {\n\tconst pkgPath = join(repoRoot, \"package.json\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(pkgPath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\tconst pkg = JSON.parse(content) as { scripts?: Record<string, string> };\n\tconst scripts = pkg.scripts ?? {};\n\tconst current = scripts.prepare?.trim() ?? \"\";\n\t// Already invokes husky (bare, or as a step in a chain) → nothing to do.\n\tif (/(^|[\\s&|;])husky($|[\\s&|;])/.test(current)) return false;\n\tscripts.prepare = current ? `${current} && husky` : \"husky\";\n\tpkg.scripts = scripts;\n\tawait writeFile(pkgPath, stringifyJson(pkg, { like: content }), \"utf8\");\n\treturn true;\n}\n","/**\n * `holocron skills` — install, remove, and update agent skills from @theholocron/skills.\n *\n * Unlike `holocron repo setup`, this command is purely local (no GitHub token\n * required). It reads `agent` and `skills` from the config and installs\n * the listed skills into `.agents/skills/<name>/` with a symlink at the\n * agent-specific path (e.g. `.claude/skills/<name>` for Claude Code).\n *\n * `holocron skills remove [name]` and `holocron skills update [name]` delegate\n * to the corresponding `npx skills` subcommands from the upstream skills CLI.\n */\n\nimport { spawnSync } from \"node:child_process\";\n\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { installSkills } from \"../setup/index.js\";\nimport type {\n\tExecFn,\n\tRunSkillsInput,\n\tRunSkillsRemoveInput,\n\tRunSkillsUpdateInput,\n\tSkillsRemoveReport,\n\tSkillsUpdateReport,\n} from \"./skills.type.js\";\n\nconst defaultExec: ExecFn = (cmd, args, opts) => {\n\tconst result = spawnSync(cmd, args, { cwd: opts.cwd, stdio: \"inherit\" });\n\treturn { exitCode: result.status ?? -1 };\n};\n\nexport async function runSkillsInstall(input: RunSkillsInput): Promise<void> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst config = input.loaded.resolved;\n\n\tif (!config.agent || !config.skills?.length) {\n\t\tprint(\"Nothing to install — set `agent` and `skills` in holocron.config.ts\");\n\t\tlogger.info({ status: \"skip\", reason: \"no agent/skills configured\" }, \"skills install: done\");\n\t\treturn;\n\t}\n\n\tif (input.context.dryRun) {\n\t\tprint(`Would install ${config.skills.length} skill(s) for agent: ${config.agent}`);\n\t\tfor (const name of config.skills) {\n\t\t\tprint(` → would install: ${name}`);\n\t\t}\n\t\tlogger.info({ agent: config.agent, skills: config.skills, status: \"dry-run\" }, \"skills install: done\");\n\t\treturn;\n\t}\n\n\tprint(`Installing ${config.skills.length} skill(s) for agent: ${config.agent}`);\n\tlogger.info({ agent: config.agent, count: config.skills.length }, \"skills install: start\");\n\ttry {\n\t\tconst result = await installSkills({\n\t\t\tagent: config.agent,\n\t\t\tskills: config.skills,\n\t\t\trepoRoot: input.context.repoRoot,\n\t\t});\n\t\tprint(` → ${result}`);\n\t\tlogger.info({ agent: config.agent, skills: config.skills, status: \"ok\" }, \"skills install: done\");\n\t} catch (err) {\n\t\tconst message = errorMessage(err);\n\t\tprint(` ✗ ${message}`);\n\t\tlogger.warn({ agent: config.agent, reason: message, status: \"fail\" }, \"skills install: done\");\n\t}\n}\n\nexport function runSkillsRemove(input: RunSkillsRemoveInput): SkillsRemoveReport {\n\tconst { dryRun, repoRoot } = input.context;\n\tconst exec = input.exec ?? defaultExec;\n\tconst logger = input.logger ?? getLogger();\n\tconst args = [\"skills\", \"remove\", ...(input.names ?? [])];\n\n\tif (dryRun) {\n\t\tlogger.info({ argv: args }, `Would run: npx ${args.join(\" \")}`);\n\t\treturn { status: \"dry-run\" };\n\t}\n\n\tconst { exitCode } = exec(\"npx\", args, { cwd: repoRoot });\n\treturn { status: exitCode === 0 ? \"ok\" : \"fail\" };\n}\n\nexport function runSkillsUpdate(input: RunSkillsUpdateInput): SkillsUpdateReport {\n\tconst { dryRun, repoRoot } = input.context;\n\tconst exec = input.exec ?? defaultExec;\n\tconst logger = input.logger ?? getLogger();\n\tconst args = [\"skills\", \"update\", ...(input.name ? [input.name] : [])];\n\n\tif (dryRun) {\n\t\tlogger.info({ argv: args }, `Would run: npx ${args.join(\" \")}`);\n\t\treturn { status: \"dry-run\" };\n\t}\n\n\tconst { exitCode } = exec(\"npx\", args, { cwd: repoRoot });\n\treturn { status: exitCode === 0 ? \"ok\" : \"fail\" };\n}\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { generateReadme, type PackagesRegistry } from \"@theholocron/components-doc/markdown\";\nimport { getClients, getConfigs, getDocs, getPlugins, getSkills, getThemes, getUtils } from \"@theholocron/registry-doc\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { style } from \"../../ui/index.js\";\nimport type { PackageJson, RunSyncReadmeInput, SyncReadmeReport } from \"./sync-readme.type.js\";\n\nconst MARKER_INSTALL_START = \"<!-- holocron:installation -->\";\nconst MARKER_INSTALL_END = \"<!-- /holocron:installation -->\";\n\nconst REGISTRY_MAP: Record<string, () => PackagesRegistry> = {\n\t\"@theholocron/clients\": getClients,\n\t\"@theholocron/configs\": getConfigs,\n\t\"@theholocron/docs\": getDocs,\n\t\"@theholocron/holocron\": getPlugins,\n\t\"@theholocron/skills\": getSkills,\n\t\"@theholocron/themes\": getThemes,\n\t\"@theholocron/utils\": getUtils,\n};\n\nfunction generateInstallBlock(pkg: PackageJson, homepage = \"\"): string {\n\tconst { name = \"\", bin, peerDependencies = {} } = pkg;\n\tconst isCli = Boolean(bin);\n\tconst isReact = Boolean(peerDependencies[\"react\"]);\n\t// A private package with no bin and nothing importable (no `main`, no\n\t// `exports`) is a workspace root or template — not something to `pnpm\n\t// install` or `import` from.\n\tconst isConsumable = isCli || !pkg.private || Boolean(pkg.main) || pkg.exports !== undefined;\n\tconst lines: string[] = [];\n\n\tlines.push(\"## Installation\", \"\");\n\n\tif (!isConsumable) {\n\t\tlines.push(\n\t\t\t\"This repository is a workspace root — it is not published. See the\",\n\t\t\t\"packages under [`packages/`](./packages) for the tools it ships.\"\n\t\t);\n\t\treturn lines.join(\"\\n\");\n\t}\n\n\tif (isCli) {\n\t\tlines.push(\"```bash\", `npm install --global ${name}`, \"```\");\n\t} else {\n\t\tlines.push(\"```bash\", `pnpm install ${name}`, \"```\");\n\t}\n\n\tlines.push(\"\", \"## Usage\", \"\");\n\n\tif (isCli) {\n\t\tconst commands =\n\t\t\ttypeof bin === \"string\" ? [name.split(\"/\").at(-1)!] : Object.keys(bin as Record<string, string>);\n\t\tlines.push(\"```bash\");\n\t\tfor (const cmd of commands) {\n\t\t\tlines.push(`${cmd} --help`);\n\t\t}\n\t\tlines.push(\"```\");\n\t} else if (isReact) {\n\t\tlines.push(\"```tsx\", `import {} from \"${name}\";`, \"\", \"function App() {\", ` return <></>;`, \"}\", \"```\");\n\t} else if (homepage) {\n\t\t// Exports aren't known at sync time — link the docs rather than emit a\n\t\t// meaningless empty-brace import.\n\t\tlines.push(`See the [documentation](${homepage}) for the API.`);\n\t} else {\n\t\tlines.push(\"See the package documentation for the API.\");\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Replace content between `<!-- holocron:marker -->` / `<!-- /holocron:marker -->` tags.\n * Returns the updated README string, or the original if the marker pair is absent.\n */\nfunction replaceMarkerBlock(readme: string, marker: string, content: string): string {\n\tconst start = `<!-- holocron:${marker} -->`;\n\tconst end = `<!-- /holocron:${marker} -->`;\n\tconst lines = readme.split(\"\\n\");\n\tconst startIdx = lines.findIndex((l) => l.trim() === start);\n\tconst endIdx = lines.findIndex((l) => l.trim() === end);\n\tif (startIdx === -1 || endIdx === -1 || endIdx <= startIdx) return readme;\n\tlines.splice(startIdx + 1, endIdx - startIdx - 1, \"\", ...content.split(\"\\n\"), \"\");\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Apply all README updates in a single read-write cycle.\n * Returns true if the README was found (even if no changes were needed).\n */\nasync function updateReadme(\n\trepoRoot: string,\n\tinstallBlock: string,\n\tsections: Record<string, string>,\n\tdryRun: boolean,\n\treadFileFn: (path: string, encoding: BufferEncoding) => Promise<string>,\n\twriteFileFn: (path: string, content: string, encoding: BufferEncoding) => Promise<void>\n): Promise<boolean> {\n\tconst readmePath = join(repoRoot, \"README.md\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFileFn(readmePath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\n\tlet updated = content;\n\n\t// Replace existing marker blocks for generated sections\n\tfor (const [marker, text] of Object.entries(sections)) {\n\t\tupdated = replaceMarkerBlock(updated, marker, text);\n\t}\n\n\t// Replace or insert installation block\n\tconst lines = updated.split(\"\\n\");\n\tconst startIdx = lines.findIndex((l) => l.trim() === MARKER_INSTALL_START);\n\tconst endIdx = lines.findIndex((l) => l.trim() === MARKER_INSTALL_END);\n\tconst blockLines = installBlock.split(\"\\n\");\n\n\tif (startIdx !== -1 && endIdx !== -1 && endIdx > startIdx) {\n\t\tlines.splice(startIdx + 1, endIdx - startIdx - 1, \"\", ...blockLines, \"\");\n\t\tupdated = lines.join(\"\\n\");\n\t} else {\n\t\tconst descEnd = lines.findIndex((l) => l.trim() === \"<!-- /holocron:description -->\");\n\t\tconst insertAfter = descEnd !== -1 ? descEnd : lines.findIndex((l) => /^# /.test(l));\n\t\tif (insertAfter === -1) return false;\n\t\tlines.splice(insertAfter + 1, 0, \"\", MARKER_INSTALL_START, \"\", ...blockLines, \"\", MARKER_INSTALL_END);\n\t\tupdated = lines.join(\"\\n\");\n\t}\n\n\tif (!dryRun) {\n\t\tawait writeFileFn(readmePath, updated, \"utf8\");\n\t}\n\treturn true;\n}\n\nasync function updateIndexMdxDescription(\n\trepoRoot: string,\n\tdescription: string,\n\tdryRun: boolean,\n\treadFileFn: (path: string, encoding: BufferEncoding) => Promise<string>,\n\twriteFileFn: (path: string, content: string, encoding: BufferEncoding) => Promise<void>\n): Promise<void> {\n\tconst mdxPath = join(repoRoot, \"docs\", \"src\", \"content\", \"docs\", \"index.mdx\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFileFn(mdxPath, \"utf8\");\n\t} catch {\n\t\treturn; // file doesn't exist — skip silently\n\t}\n\tconst updated = content.replace(/^(description:\\s*).*$/m, `$1${description}`);\n\tif (updated !== content && !dryRun) {\n\t\tawait writeFileFn(mdxPath, updated, \"utf8\");\n\t}\n}\n\nexport async function runSyncReadme(input: RunSyncReadmeInput): Promise<SyncReadmeReport> {\n\tconst { loaded, context, print = console.log, readFileFn = readFile, writeFileFn = writeFile } = input;\n\tconst logger = input.logger ?? getLogger();\n\n\tconst { repoRoot, dryRun = false } = context;\n\n\tconst namespaces = loaded.resolved.env?.namespaces ?? [];\n\n\tprint(style.header(`Syncing README installation block${dryRun ? \" (dry-run)\" : \"\"}…`));\n\tif (namespaces.length > 0) {\n\t\tprint(style.hint(` namespaces: ${namespaces.join(\", \")}`));\n\t}\n\n\t// Read package.json\n\tlet pkg: PackageJson;\n\ttry {\n\t\tconst raw = await readFileFn(join(repoRoot, \"package.json\"), \"utf8\");\n\t\tpkg = JSON.parse(raw) as PackageJson;\n\t} catch {\n\t\tlogger.warn({ repoRoot, reason: \"could not read package.json\" }, \"sync readme: done\");\n\t\treturn { status: \"fail\", updated: false, message: \"Could not read package.json\" };\n\t}\n\n\t// Assemble generated sections (4.3)\n\tconst description = loaded.resolved.description ?? \"\";\n\tconst homepage = loaded.resolved.homepage ?? pkg.homepage ?? \"\";\n\tconst scripts = pkg.scripts ?? {};\n\tconst packages = pkg.name ? REGISTRY_MAP[pkg.name]?.() : undefined;\n\n\tconst sections = generateReadme({ description, homepage, scripts, packages });\n\tconst markerSections: Record<string, string> = {\n\t\t...(sections.packages !== undefined && { packages: sections.packages }),\n\t\tdevelopment: sections.development,\n\t\treleases: sections.releases,\n\t};\n\n\t// Single read-write pass for all README changes\n\tconst installBlock = generateInstallBlock(pkg, homepage);\n\tconst updated = await updateReadme(repoRoot, installBlock, markerSections, dryRun, readFileFn, writeFileFn);\n\n\tif (!updated) {\n\t\tprint(style.warn(\"README.md not found or has no writable location for installation block\"));\n\t\tlogger.warn({ repoRoot, reason: \"README.md not found / no marker block\" }, \"sync readme: done\");\n\t\treturn { status: \"fail\", updated: false, message: \"README.md update failed\" };\n\t}\n\n\t// Update docs/src/content/docs/index.mdx frontmatter description (4.4)\n\tif (description) {\n\t\tawait updateIndexMdxDescription(repoRoot, description, dryRun, readFileFn, writeFileFn);\n\t}\n\n\tprint(dryRun ? style.hint(\" would update README.md\") : style.success(\" updated README.md\"));\n\tconst status = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ repoRoot, status, updated }, \"sync readme: done\");\n\treturn { status, updated };\n}\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { firstEnv } from \"@theholocron/env-utils\";\nimport { createRestClient } from \"@theholocron/http-client\";\n\nimport { env } from \"../../env/index.js\";\nimport type { SetupStepResult } from \"../setup/index.js\";\nimport type { FileContents, OrgRepo, RunSyncWikiInput, WikiRepo } from \"./sync-wiki.type.js\";\n\n// ---------------------------------------------------------------------------\n// Token resolution\n// ---------------------------------------------------------------------------\n\nfunction resolveToken(input: RunSyncWikiInput): string | undefined {\n\treturn input.token ?? input.context.cliToken ?? firstEnv(env, [\"HOLOCRON_READ_TOKEN\", \"GH_TOKEN\", \"GITHUB_TOKEN\"]);\n}\n\n// ---------------------------------------------------------------------------\n// Config parsing helpers\n// ---------------------------------------------------------------------------\n\nfunction deriveBasepath(domain: string | undefined, repoName: string): string {\n\tif (domain) {\n\t\tconst slashIdx = domain.indexOf(\"/\");\n\t\tif (slashIdx !== -1) return domain.slice(slashIdx + 1);\n\t}\n\treturn repoName;\n}\n\nfunction toNavLabel(basepath: string): string {\n\treturn basepath\n\t\t.split(\"-\")\n\t\t.map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n\t\t.join(\" \");\n}\n\nfunction extractFromJson(raw: string, repoName: string): WikiRepo | null {\n\tlet config: Record<string, unknown>;\n\ttry {\n\t\tconfig = JSON.parse(raw) as Record<string, unknown>;\n\t} catch {\n\t\treturn null;\n\t}\n\tconst providers = config.providers as Record<string, unknown> | undefined;\n\tif (!providers?.wiki) return null;\n\n\tconst wikiEntry = providers.wiki;\n\tlet domain: string | undefined;\n\n\tif (Array.isArray(wikiEntry) && wikiEntry.length === 2) {\n\t\tconst opts = wikiEntry[1] as Record<string, unknown>;\n\t\tdomain = typeof opts.domain === \"string\" ? opts.domain : undefined;\n\t}\n\n\tconst basepath = deriveBasepath(domain, repoName);\n\treturn { displayName: toNavLabel(basepath), basepath, ...(domain ? { domain } : {}) };\n}\n\nfunction extractFromTs(raw: string, repoName: string): WikiRepo | null {\n\tconst hasWikiProvider = /providers\\s*:\\s*\\{[^}]*\\bwiki\\b/s.test(raw);\n\tconst hasWikiPreset = /\\bwikiCapability\\b|\\bwiki\\s*\\(\\s*\\)/.test(raw);\n\t/* c8 ignore next */\n\tif (!hasWikiProvider && !hasWikiPreset) return null;\n\n\tconst domainMatch = raw.match(/\\bdomain\\s*:\\s*[\"']([^\"']+)[\"']/);\n\tconst domain = domainMatch?.[1];\n\n\tconst basepath = deriveBasepath(domain, repoName);\n\treturn { displayName: toNavLabel(basepath), basepath, ...(domain ? { domain } : {}) };\n}\n\n// ---------------------------------------------------------------------------\n// Discovery\n// ---------------------------------------------------------------------------\n\nexport async function discoverWikiRepos(\n\torg: string,\n\ttoken: string,\n\tfetchFn?: typeof globalThis.fetch\n): Promise<WikiRepo[]> {\n\tconst rest = createRestClient({\n\t\tbaseUrl: \"https://api.github.com\",\n\t\ttoken,\n\t\textraHeaders: {\n\t\t\taccept: \"application/vnd.github+json\",\n\t\t\t\"x-github-api-version\": \"2022-11-28\",\n\t\t},\n\t\tvendor: \"GitHub\",\n\t\tfetch: fetchFn,\n\t});\n\n\tconst allRepos: OrgRepo[] = [];\n\tlet page = 1;\n\twhile (true) {\n\t\tconst batch = await rest.request<OrgRepo[]>(`/orgs/${org}/repos`, {\n\t\t\tquery: { per_page: \"100\", page: String(page), type: \"all\" },\n\t\t});\n\t\tallRepos.push(...batch);\n\t\tif (batch.length < 100) break;\n\t\tpage++;\n\t}\n\n\tconst repos: WikiRepo[] = [];\n\n\tfor (const repo of allRepos.filter((r) => !r.archived)) {\n\t\tlet found: WikiRepo | null = null;\n\n\t\ttry {\n\t\t\tconst contents = await rest.request<FileContents>(`/repos/${repo.full_name}/contents/holocron.config.json`);\n\t\t\tif (contents.encoding === \"base64\") {\n\t\t\t\tconst raw = Buffer.from(contents.content.replace(/\\s/g, \"\"), \"base64\").toString(\"utf8\");\n\t\t\t\tfound = extractFromJson(raw, repo.name);\n\t\t\t}\n\t\t} catch {\n\t\t\t// no JSON config — try TS\n\t\t}\n\n\t\tif (!found) {\n\t\t\ttry {\n\t\t\t\tconst contents = await rest.request<FileContents>(\n\t\t\t\t\t`/repos/${repo.full_name}/contents/holocron.config.ts`\n\t\t\t\t);\n\t\t\t\tif (contents.encoding === \"base64\") {\n\t\t\t\t\tconst raw = Buffer.from(contents.content.replace(/\\s/g, \"\"), \"base64\").toString(\"utf8\");\n\t\t\t\t\tfound = extractFromTs(raw, repo.name);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// no config found — skip\n\t\t\t}\n\t\t}\n\n\t\tif (found) repos.push(found);\n\t}\n\n\trepos.sort((a, b) => a.basepath.localeCompare(b.basepath));\n\treturn repos;\n}\n\n// ---------------------------------------------------------------------------\n// navbar-links block builder\n// ---------------------------------------------------------------------------\n\n/**\n * Builds the complete navbar-links YAML block for a given repo.\n *\n * Includes:\n * - A GitHub button linking to the repo itself (always first)\n * - A single \"Wiki\" dropdown containing minimal links to every other\n * wiki-enabled repo (excluding self), keeping the navbar uncluttered\n * regardless of how many repos are in the org.\n *\n * The block is replaced wholesale on each sync so removed/added wikis\n * stay in sync automatically.\n */\nexport function buildNavbarLinks(repos: WikiRepo[], currentBasepath: string, repoFullName: string): string {\n\tconst lines = [`navbar-links:`, ` - type: github`, ` value: https://github.com/${repoFullName}`];\n\n\tconst others = repos.filter((r) => r.basepath !== currentBasepath);\n\tif (others.length > 0) {\n\t\tlines.push(` - type: dropdown`, ` text: Other Projects`, ` icon: fa-duotone fa-book`, ` links:`);\n\t\tfor (const repo of others) {\n\t\t\tconst url = repo.domain ? `https://${repo.domain}` : `https://wiki.theholocron.dev/${repo.basepath}`;\n\t\t\tlines.push(` - href: ${url}`, ` text: ${repo.displayName}`);\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// fern/docs.yml updater\n// ---------------------------------------------------------------------------\n\n/**\n * Idempotently ensures `edit-this-page:` (inside instances) is present and\n * replaces `navbar-links:` with the provided shared block.\n *\n * Returns true when the file was modified.\n * Throws when fern/docs.yml does not exist.\n */\nexport async function mergeWikiConfig(\n\tdocsYmlPath: string,\n\tconfig: { owner: string; repoName: string; navbarBlock: string }\n): Promise<boolean> {\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(docsYmlPath, \"utf8\");\n\t} catch {\n\t\tthrow new Error(`fern/docs.yml not found at ${docsYmlPath}`);\n\t}\n\n\tlet updated = content;\n\n\t// 1. Ensure edit-this-page: is nested inside the instances block entry.\n\tif (!updated.includes(\"edit-this-page:\")) {\n\t\tconst editBlock = [\n\t\t\t` edit-this-page:`,\n\t\t\t` github:`,\n\t\t\t` owner: ${config.owner}`,\n\t\t\t` repo: ${config.repoName}`,\n\t\t\t` branch: main`,\n\t\t].join(\"\\n\");\n\n\t\tif (/^ {4}multi-source: true$/m.test(updated)) {\n\t\t\tupdated = updated.replace(/^( {4}multi-source: true)$/m, `$1\\n${editBlock}`);\n\t\t} else if (/^ {4}custom-domain: .+$/m.test(updated)) {\n\t\t\tupdated = updated.replace(/^( {4}custom-domain: .+)$/m, `$1\\n${editBlock}`);\n\t\t} else {\n\t\t\t// Fallback: insert after the \" - url:\" list item line\n\t\t\tupdated = updated.replace(/^( {2}- url: .+)$/m, `$1\\n${editBlock}`);\n\t\t}\n\t}\n\n\t// 2. Replace navbar-links: wholesale so removed/added wikis stay in sync.\n\tconst navbarRe = /^navbar-links:(?:\\n[ \\t][^\\n]*)*/m;\n\tif (navbarRe.test(updated)) {\n\t\tupdated = updated.replace(navbarRe, config.navbarBlock);\n\t} else if (/^colors:/m.test(updated)) {\n\t\tupdated = updated.replace(/^(colors:)/m, `${config.navbarBlock}\\n\\n$1`);\n\t} else {\n\t\tupdated = updated.trimEnd() + \"\\n\\n\" + config.navbarBlock + \"\\n\";\n\t}\n\n\tif (updated !== content) {\n\t\tawait writeFile(docsYmlPath, updated, \"utf8\");\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// ---------------------------------------------------------------------------\n// Validate\n// ---------------------------------------------------------------------------\n\n/**\n * Checks that fern/docs.yml has the required wiki header fields.\n * Returns a list of missing field names; empty means valid.\n */\nexport async function validateWikiConfig(docsYmlPath: string): Promise<string[]> {\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(docsYmlPath, \"utf8\");\n\t} catch {\n\t\treturn [\"fern/docs.yml not found\"];\n\t}\n\n\tconst missing: string[] = [];\n\tif (!content.includes(\"edit-this-page:\")) missing.push(\"edit-this-page\");\n\tif (!content.includes(\"navbar-links:\")) missing.push(\"navbar-links\");\n\treturn missing;\n}\n\n// ---------------------------------------------------------------------------\n// runSyncWiki\n// ---------------------------------------------------------------------------\n\nexport async function runSyncWiki(input: RunSyncWikiInput): Promise<SetupStepResult> {\n\tconst config = input.loaded.resolved;\n\tconst dryRun = input.context.dryRun ?? false;\n\n\tif (!config.providers.wiki) {\n\t\treturn { capability: \"local\", step: \"sync wiki\", status: \"skip\", message: \"no wiki provider configured\" };\n\t}\n\n\tconst rawRepo = input.context.repo ?? config.repo?.name;\n\tif (!rawRepo) {\n\t\treturn { capability: \"local\", step: \"sync wiki\", status: \"skip\", message: \"no repo configured\" };\n\t}\n\n\tconst [owner, repoName] = rawRepo.split(\"/\") as [string, string | undefined];\n\tif (!owner || !repoName) {\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"skip\",\n\t\t\tmessage: \"repo must be owner/name format\",\n\t\t};\n\t}\n\n\tconst org = config.org ?? owner;\n\n\tconst token = resolveToken(input);\n\tif (!token) {\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"skip\",\n\t\t\tmessage: \"no GitHub token available (set HOLOCRON_READ_TOKEN or GH_TOKEN)\",\n\t\t};\n\t}\n\n\tif (dryRun) {\n\t\treturn { capability: \"local\", step: \"sync wiki\", status: \"dry-run\" };\n\t}\n\n\tconst docsYmlPath = join(input.context.repoRoot, \"fern\", \"docs.yml\");\n\n\ttry {\n\t\tconst repos = await discoverWikiRepos(org, token, input.fetch);\n\n\t\t// Derive the current repo's basepath from its own wiki config so we\n\t\t// can exclude it from the nav links it renders for itself.\n\t\t// config.providers.wiki is already resolved to { tuple: { options } } form.\n\t\tconst wikiOpts = (config.providers.wiki as unknown as { tuple?: { options?: Record<string, unknown> } })?.tuple\n\t\t\t?.options;\n\t\tconst domain = typeof wikiOpts?.domain === \"string\" ? wikiOpts.domain : undefined;\n\t\tconst currentBasepath = deriveBasepath(domain, repoName);\n\n\t\tconst navbarBlock = buildNavbarLinks(repos, currentBasepath, rawRepo);\n\n\t\tconst changed = await mergeWikiConfig(docsYmlPath, { owner, repoName, navbarBlock });\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"ok\",\n\t\t\tmessage: changed ? `updated (${repos.length} wiki repos discovered)` : \"already up to date\",\n\t\t};\n\t} catch (err) {\n\t\treturn {\n\t\t\tcapability: \"local\",\n\t\t\tstep: \"sync wiki\",\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: err instanceof Error ? err.message : /* c8 ignore next */ String(err),\n\t\t};\n\t}\n}\n","import { randomUUID } from \"node:crypto\";\nimport { realpathSync } from \"node:fs\";\nimport { access, mkdir, readFile, rename, writeFile } from \"node:fs/promises\";\nimport { basename, join } from \"node:path\";\n\nimport { createAstromech, createHeader, KNOWN_WORKFLOWS, readWorkspacePackages } from \"@theholocron/astromech\";\nimport type { TasksConfig } from \"@theholocron/astromech/config\";\nimport { findRootSync } from \"@theholocron/fs-utils\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { PluginLoader, type Source } from \"../../plugin/index.js\";\nimport {\n\tCANONICAL_LABELS,\n\tderiveCapabilities,\n\tderiveCompliance,\n\tderiveProfile,\n\tderiveStack,\n\treadWorkspacePackageJsons,\n\ttype SetupReport,\n\ttype SetupStepResult,\n\tSTALE_LABELS,\n} from \"../setup/index.js\";\n\n// The only content this file ever prefixes with workflowHeader() is thin-caller\n// workflow content from astromech.thinCallers() — sync.ts just writes it. The\n// actual template/generation logic a contributor would edit lives there.\nconst { workflowHeader } = createHeader({\n\tsource: \"packages/astromech/src/thin-callers.ts\",\n\ttool: \"holocron repo sync\",\n});\nimport { runSyncReadme } from \"../sync-readme/index.js\";\nimport { runSyncWiki } from \"../sync-wiki/index.js\";\nimport type { RunSyncInput, SyncStep } from \"./sync.type.js\";\n\nexport const SYNC_STEPS = [\n\t\"labels\",\n\t\"properties\",\n\t\"teams\",\n\t\"topics\",\n\t\"keywords\",\n\t\"description\",\n\t\"homepage\",\n\t\"readme\",\n\t\"workflows\",\n\t\"scripts\",\n\t\"turbo\",\n\t\"wiki\",\n] as const;\n\n// Steps that write to the local filesystem only — no provider token needed.\nconst LOCAL_STEPS = new Set<SyncStep>([\n\t\"keywords\",\n\t\"description\",\n\t\"homepage\",\n\t\"readme\",\n\t\"workflows\",\n\t\"scripts\",\n\t\"turbo\",\n\t\"wiki\",\n]);\n\nexport async function runSync(input: RunSyncInput): Promise<SetupReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);\n\n\tconst config = input.loaded.resolved;\n\tconst dryRun = input.context.dryRun ?? false;\n\tconst requestedSteps = input.steps;\n\tconst steps: SetupStepResult[] = [];\n\t// `--cwd` picks which holocron.config.ts to load — for a monorepo\n\t// subpackage (e.g. apps/sentinel) that's NOT the git repo root.\n\t// Anything inherently repo-wide (.github/workflows, turbo.json,\n\t// pnpm-workspace.yaml, the root package.json's own devDependencies,\n\t// \"is this repo a monorepo\") must resolve against the real root or it\n\t// silently writes into a GitHub-invisible nested .github/ instead\n\t// (holocron#1014) — package-local writes (this package's own\n\t// package.json scripts/keywords/description, its own README) stay\n\t// keyed to `input.context.repoRoot` (= --cwd) unchanged below.\n\t// `fallback: \"start\"` means this always resolves to a string (the start dir when\n\t// there is no `.git` above it); the declared `string | undefined` is the no-fallback case.\n\tconst gitRoot = findRootSync(input.context.repoRoot, \".git\", { fallback: \"start\", realpath: true }) as string;\n\t// `findRootSync` (with `realpath`) resolves symlinks and relative segments internally; a\n\t// plain `===` against the raw, unresolved `input.context.repoRoot`\n\t// would mark a real root invocation as a subpackage whenever --cwd's\n\t// spelling differs at all from gitRoot's resolved form (e.g. `--cwd\n\t// ./` at the actual root) — resolved once here for that comparison.\n\t// Falls back to the raw value on a nonexistent path (tests routinely\n\t// use a synthetic `repoRoot` like `\"/tmp/test\"` that's never actually\n\t// created) — same soft-skip `fallback: \"start\"` keeps.\n\tlet resolvedRepoRoot: string;\n\ttry {\n\t\tresolvedRepoRoot = realpathSync(input.context.repoRoot);\n\t} catch {\n\t\tresolvedRepoRoot = input.context.repoRoot;\n\t}\n\n\tlogger.info({ config: config.name, steps: requestedSteps ?? \"all\", dryRun: dryRun || undefined }, \"sync: start\");\n\n\t// `load()` soft-skips any plugin it can't load (missing token, package\n\t// not installed). Remote steps then push a `skip` result when\n\t// `source` is absent; local steps (keywords, description, readme…)\n\t// write to disk regardless.\n\tawait loader.load();\n\tfor (const failure of loader.loadFailures()) {\n\t\tlogger.warn(\n\t\t\t{ capability: failure.key, provider: failure.provider, reason: failure.error.message },\n\t\t\t`sync: plugin ${failure.provider} unavailable`\n\t\t);\n\t}\n\n\tprint(`Holocron sync — ${config.name}${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` config: ${input.loaded.filepath}`);\n\tprint(\"\");\n\n\tif (loader.has(\"source\")) {\n\t\tconst source = loader.get(\"source\") as Source;\n\t\tprint(\" → source\");\n\n\t\tfor (const stepName of SYNC_STEPS) {\n\t\t\tif (requestedSteps !== undefined && !requestedSteps.includes(stepName)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Local steps are handled below, outside this block.\n\t\t\tif (LOCAL_STEPS.has(stepName)) continue;\n\n\t\t\tif (stepName === \"labels\") {\n\t\t\t\tif (source.syncLabels) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\"source\", \"sync labels\", dryRun, () =>\n\t\t\t\t\t\t\tsource.syncLabels!(CANONICAL_LABELS, STALE_LABELS)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync labels\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncLabels\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (stepName === \"properties\") {\n\t\t\t\tif (source.syncProperties) {\n\t\t\t\t\tconst repo = config.repo;\n\t\t\t\t\tconst properties: Record<string, string | string[]> = {};\n\t\t\t\t\tconst effectivePreset = repo?.protection;\n\t\t\t\t\tif (effectivePreset && effectivePreset !== \"none\")\n\t\t\t\t\t\tproperties[\"holocron_branch_protection_level\"] = effectivePreset;\n\t\t\t\t\tconst isMonorepo = await access(join(gitRoot, \"pnpm-workspace.yaml\"))\n\t\t\t\t\t\t.then(() => true)\n\t\t\t\t\t\t.catch(() => false);\n\t\t\t\t\tproperties[\"monorepo\"] = String(isMonorepo);\n\t\t\t\t\tconst manual = repo?.properties ?? {};\n\t\t\t\t\tif (manual.lifecycle) properties[\"lifecycle\"] = manual.lifecycle;\n\t\t\t\t\tif (manual.open_source !== undefined) properties[\"open_source\"] = String(manual.open_source);\n\t\t\t\t\tif (manual.runtime_environment) properties[\"runtime_environment\"] = manual.runtime_environment;\n\t\t\t\t\tif (manual.uses_external_packages !== undefined)\n\t\t\t\t\t\tproperties[\"uses_external_packages\"] = String(manual.uses_external_packages);\n\n\t\t\t\t\t// #677 — derived fields, distinct from the manual ones above: signal\n\t\t\t\t\t// that isn't an explicit holocron.config.ts field today (framework\n\t\t\t\t\t// choice, repo archetype, capability drift).\n\t\t\t\t\t{\n\t\t\t\t\t\tconst rootPackageJson = await readFile(join(gitRoot, \"package.json\"), \"utf8\")\n\t\t\t\t\t\t\t.then((raw) => JSON.parse(raw) as Parameters<typeof deriveStack>[0])\n\t\t\t\t\t\t\t.catch(() => null);\n\t\t\t\t\t\tconst workspacePackages = readWorkspacePackages(gitRoot);\n\t\t\t\t\t\tconst workspacePackageJsons = await readWorkspacePackageJsons(gitRoot, workspacePackages);\n\t\t\t\t\t\tproperties[\"holocron_profile\"] = deriveProfile({\n\t\t\t\t\t\t\trootPackageJson,\n\t\t\t\t\t\t\trepoName: basename(gitRoot),\n\t\t\t\t\t\t\tisMonorepo,\n\t\t\t\t\t\t\tworkspacePackageJsons,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tproperties[\"holocron_stack\"] = deriveStack(rootPackageJson);\n\t\t\t\t\t\tconst capabilities = deriveCapabilities(config.providers);\n\t\t\t\t\t\tproperties[\"holocron_capabilities\"] = capabilities;\n\t\t\t\t\t\tproperties[\"holocron_compliance\"] = deriveCompliance(capabilities);\n\t\t\t\t\t}\n\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\"source\", \"sync properties\", dryRun, () => source.syncProperties!(properties))\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync properties\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncProperties\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (stepName === \"teams\") {\n\t\t\t\tconst teams = config.repo?.teams ?? [];\n\t\t\t\tif (teams.length === 0) {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync teams\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"no teams configured\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else if (source.syncTeams) {\n\t\t\t\t\tsteps.push(await runSyncStep(\"source\", \"sync teams\", dryRun, () => source.syncTeams!(teams)));\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\n\t\t\t\t\tconst repoCoord = input.context.repo ?? config.repo?.name ?? \"\";\n\t\t\t\t\tconst org = repoCoord.includes(\"/\") ? repoCoord.split(\"/\")[0]! : \"\";\n\t\t\t\t\tconst writeableTeams = teams\n\t\t\t\t\t\t.map((t) => (typeof t === \"string\" ? { slug: t, permission: \"push\" as const } : t))\n\t\t\t\t\t\t.filter((t) => [\"push\", \"maintain\", \"admin\"].includes(t.permission));\n\t\t\t\t\tif (org && writeableTeams.length > 0) {\n\t\t\t\t\t\tsteps.push(\n\t\t\t\t\t\t\tawait runSyncStep(\"source\", \"write .github/CODEOWNERS\", dryRun, async () => {\n\t\t\t\t\t\t\t\tconst content = writeableTeams.map((t) => `* @${org}/${t.slug}`).join(\"\\n\") + \"\\n\";\n\t\t\t\t\t\t\t\tawait source.writeRepoFile(\".github/CODEOWNERS\", content);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync teams\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncTeams\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (stepName === \"topics\") {\n\t\t\t\tconst topics = config.repo?.topics ?? [];\n\t\t\t\tif (topics.length === 0) {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync topics\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"no topics configured\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else if (source.syncTopics) {\n\t\t\t\t\tsteps.push(await runSyncStep(\"source\", \"sync topics\", dryRun, () => source.syncTopics!(topics)));\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t} else {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: \"sync topics\",\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: \"provider does not implement syncTopics\",\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Report unknown step names\n\t\tif (requestedSteps) {\n\t\t\tfor (const name of requestedSteps) {\n\t\t\t\tif (!(SYNC_STEPS as ReadonlyArray<string>).includes(name)) {\n\t\t\t\t\tsteps.push({\n\t\t\t\t\t\tcapability: \"source\",\n\t\t\t\t\t\tstep: `sync ${name}`,\n\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\tmessage: `unknown step \"${name}\"`,\n\t\t\t\t\t});\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// ── local-only steps (no provider token required) ──────────────────\n\t// keywords, description, homepage, readme, and workflows write to local\n\t// files and optionally push to GitHub when source is loaded. They run\n\t// outside the `if (loader.has(\"source\"))` block so they work without a token.\n\n\tfor (const stepName of [\n\t\t\"keywords\",\n\t\t\"description\",\n\t\t\"homepage\",\n\t\t\"readme\",\n\t\t\"workflows\",\n\t\t\"scripts\",\n\t\t\"turbo\",\n\t\t\"wiki\",\n\t] as const) {\n\t\tif (requestedSteps !== undefined && !requestedSteps.includes(stepName)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (stepName === \"keywords\") {\n\t\t\tconst topics = config.repo?.topics ?? [];\n\t\t\tif (topics.length === 0) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync keywords\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no topics configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync keywords\", dryRun, async () => {\n\t\t\t\t\t\tconst wrote = await writePackageJsonField(input.context.repoRoot, \"keywords\", topics);\n\t\t\t\t\t\treturn wrote\n\t\t\t\t\t\t\t? `${topics.length} keywords written`\n\t\t\t\t\t\t\t: `${topics.length} topics (no package.json)`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"description\") {\n\t\t\tconst description = config.description;\n\t\t\tif (!description) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync description\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no description configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tconst source = loader.has(\"source\") ? (loader.get(\"source\") as Source) : null;\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync description\", dryRun, async () => {\n\t\t\t\t\t\tconst pkgWrote = await writePackageJsonField(\n\t\t\t\t\t\t\tinput.context.repoRoot,\n\t\t\t\t\t\t\t\"description\",\n\t\t\t\t\t\t\tdescription\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst readmeWrote = await updateReadmeDescription(input.context.repoRoot, description);\n\t\t\t\t\t\tif (source?.syncDescription) {\n\t\t\t\t\t\t\tawait source.syncDescription(description);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst parts: string[] = [];\n\t\t\t\t\t\tif (pkgWrote) parts.push(\"package.json\");\n\t\t\t\t\t\tif (readmeWrote) parts.push(\"README.md\");\n\t\t\t\t\t\tif (source?.syncDescription) parts.push(\"GitHub\");\n\t\t\t\t\t\treturn parts.length > 0 ? parts.join(\", \") + \" updated\" : \"description synced\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"homepage\") {\n\t\t\tconst homepage = config.homepage;\n\t\t\tif (!homepage) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync homepage\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no homepage configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tconst source = loader.has(\"source\") ? (loader.get(\"source\") as Source) : null;\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync homepage\", dryRun, async () => {\n\t\t\t\t\t\tconst pkgWrote = await writePackageJsonField(input.context.repoRoot, \"homepage\", homepage);\n\t\t\t\t\t\tif (source?.syncHomepage) {\n\t\t\t\t\t\t\tawait source.syncHomepage(homepage);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst parts: string[] = [];\n\t\t\t\t\t\tif (pkgWrote) parts.push(\"package.json\");\n\t\t\t\t\t\tif (source?.syncHomepage) parts.push(\"GitHub\");\n\t\t\t\t\t\treturn parts.length > 0 ? parts.join(\", \") + \" updated\" : \"homepage synced\";\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"readme\") {\n\t\t\tconst report = await runSyncReadme({ loaded: input.loaded, context: input.context, print: () => {} });\n\t\t\tsteps.push({\n\t\t\t\tcapability: \"local\",\n\t\t\t\tstep: \"sync readme\",\n\t\t\t\tstatus: report.status === \"ok\" ? \"ok\" : report.status === \"dry-run\" ? \"dry-run\" : \"skip\",\n\t\t\t\t...(report.message ? { message: report.message } : {}),\n\t\t\t});\n\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t}\n\n\t\tif (stepName === \"workflows\") {\n\t\t\tconst taskEntries = config.tasks ?? [];\n\t\t\tif (taskEntries.length === 0) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync workflows\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no tasks configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\t// astromech renders every thin caller from the manifest (lint linter\n\t\t\t\t// set, deploy paths, deploy+preview). Iterate the manifest (not the\n\t\t\t\t// map) so step reporting keeps the config's order.\n\t\t\t\tconst files = createAstromech({\n\t\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\t\tconfig: { tasks: config.tasks as TasksConfig[\"tasks\"] },\n\t\t\t\t\torgContext: { org: config.org, domain: config.domain },\n\t\t\t\t\tlogger,\n\t\t\t\t}).thinCallers();\n\n\t\t\t\tfor (const entry of taskEntries) {\n\t\t\t\t\tconst name = typeof entry === \"string\" ? entry : entry.name;\n\t\t\t\t\t// knowledge.docs / knowledge.components have no static\n\t\t\t\t\t// WORKFLOW_TEMPLATES entry (their content is always\n\t\t\t\t\t// combined-generated, astromech.ts) — not in KNOWN_WORKFLOWS,\n\t\t\t\t\t// but not \"unknown\" either.\n\t\t\t\t\tconst isCombinedContentOnly = name === \"knowledge.docs\" || name === \"knowledge.components\";\n\n\t\t\t\t\tif (!KNOWN_WORKFLOWS.has(name) && !isCombinedContentOnly) {\n\t\t\t\t\t\tsteps.push({\n\t\t\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\t\t\tstep: `sync workflow ${name}`,\n\t\t\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\t\t\tmessage: `unknown workflow \"${name}\" — no template available`,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// The combined-content family (delivery.deploy, knowledge.docs,\n\t\t\t\t\t// knowledge.components) all key their generated file by task\n\t\t\t\t\t// name already — no special-casing needed.\n\t\t\t\t\t// Keyed by task name alone, regardless of which package's\n\t\t\t\t\t// --cwd generated it — two different subpackages opting\n\t\t\t\t\t// into the same generic task name would overwrite each\n\t\t\t\t\t// other's file here, and package-relative paths baked\n\t\t\t\t\t// into a template wouldn't get rebased for a non-root\n\t\t\t\t\t// --cwd. Tracked as #1026; not yet a real collision since\n\t\t\t\t\t// Sentinel's two --cwd-scoped tasks are both task-name-\n\t\t\t\t\t// unique and carry no repo-root-relative content.\n\t\t\t\t\tconst filename = `${name}.yml`;\n\t\t\t\t\tconst content = files.get(filename);\n\t\t\t\t\tif (content === undefined) continue; // ci: false — nothing to write\n\n\t\t\t\t\tconst withPreview = content.includes(\"workflows/preview.yml@main\");\n\t\t\t\t\tconst step = `sync workflow ${name}${withPreview ? \" (with preview)\" : \"\"}`;\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\"local\", step, dryRun, async () => {\n\t\t\t\t\t\t\tawait writeWorkflowFile(gitRoot, filename, `${workflowHeader()}${content}`);\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"scripts\") {\n\t\t\tif (config.syncScripts === false) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync scripts\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"syncScripts: false\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tconst tasksConfig: TasksConfig = { tasks: config.tasks as TasksConfig[\"tasks\"] };\n\t\t\t\tif (config.holocronScript !== undefined) tasksConfig.holocronScript = config.holocronScript;\n\t\t\t\tconst astromechScripts = createAstromech({\n\t\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\t\tconfig: tasksConfig,\n\t\t\t\t\tlogger,\n\t\t\t\t});\n\t\t\t\tconst desired = astromechScripts.packageScripts();\n\t\t\t\t// #747: which of `desired`'s keys turbo.json would fan out — the\n\t\t\t\t// only ones an existing direct-tool root script is ever protected\n\t\t\t\t// for. See mergePackageJsonScripts()'s own docstring.\n\t\t\t\tconst turboContent = astromechScripts.turboConfig();\n\t\t\t\tconst turboEligible = new Set<string>(\n\t\t\t\t\tturboContent\n\t\t\t\t\t\t? Object.keys((JSON.parse(turboContent) as { tasks: Record<string, unknown> }).tasks)\n\t\t\t\t\t\t: []\n\t\t\t\t);\n\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync scripts\", dryRun, async () => {\n\t\t\t\t\t\tconst changed = await mergePackageJsonScripts(input.context.repoRoot, desired, turboEligible);\n\t\t\t\t\t\tif (changed === null) return \"no package.json\";\n\t\t\t\t\t\tif (changed.length === 0) return `${Object.keys(desired).length} scripts already current`;\n\t\t\t\t\t\treturn `${changed.join(\", \")} set`;\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"turbo\") {\n\t\t\t// turbo.json, pnpm-workspace.yaml, and the root package.json's own\n\t\t\t// devDependencies are each a single, whole-workspace file — one\n\t\t\t// subpackage's holocron.config.ts can't correctly own writing\n\t\t\t// them (which other subpackage's tasks would it be allowed to\n\t\t\t// clobber?). A monorepo subpackage sync (holocron#1014's exact\n\t\t\t// shape — --cwd resolves to a package, not the git root) skips\n\t\t\t// this entire step rather than guessing at a merge semantic; the\n\t\t\t// repo's own root-level sync run (where --cwd IS gitRoot) is the\n\t\t\t// one place these get written.\n\t\t\tif (resolvedRepoRoot !== gitRoot) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync turbo.json\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"--cwd is a monorepo subpackage, not the git root — run from the root to sync turbo.json\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst astromechTurbo = createAstromech({\n\t\t\t\tcwd: input.context.repoRoot,\n\t\t\t\tconfig: { tasks: config.tasks as TasksConfig[\"tasks\"] },\n\t\t\t\tlogger,\n\t\t\t});\n\t\t\tconst content = astromechTurbo.turboConfig();\n\n\t\t\tif (content === null) {\n\t\t\t\tsteps.push({\n\t\t\t\t\tcapability: \"local\",\n\t\t\t\t\tstep: \"sync turbo.json\",\n\t\t\t\t\tstatus: \"skip\",\n\t\t\t\t\tmessage: \"no fan-out-eligible tasks configured\",\n\t\t\t\t});\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t} else {\n\t\t\t\tsteps.push(\n\t\t\t\t\tawait runSyncStep(\"local\", \"sync turbo.json\", dryRun, async () => {\n\t\t\t\t\t\tawait writeFile(join(gitRoot, \"turbo.json\"), content, \"utf8\");\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\n\t\t\t\t// #692: fix pnpm-workspace.yaml in the same step that introduces\n\t\t\t\t// the risk — see run-setup.ts's identical wiring for the full\n\t\t\t\t// explanation.\n\t\t\t\tconst rootPkgRaw = await readFile(join(gitRoot, \"package.json\"), \"utf8\").catch(() => null);\n\t\t\t\tconst rootPkg = rootPkgRaw ? (JSON.parse(rootPkgRaw) as { scripts?: Record<string, string> }) : null;\n\t\t\t\tconst workspaceYaml = await readFile(join(gitRoot, \"pnpm-workspace.yaml\"), \"utf8\").catch(() => \"\");\n\t\t\t\tconst rootScripts = rootPkg?.scripts ?? {};\n\t\t\t\tconst workspaceFix = astromechTurbo.ensureRootWorkspaceMember(workspaceYaml, rootScripts);\n\t\t\t\tif (workspaceFix.changed) {\n\t\t\t\t\tsteps.push(\n\t\t\t\t\t\tawait runSyncStep(\n\t\t\t\t\t\t\t\"local\",\n\t\t\t\t\t\t\t\"fix pnpm-workspace.yaml (root workspace member, #692)\",\n\t\t\t\t\t\t\tdryRun,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tawait writeFile(join(gitRoot, \"pnpm-workspace.yaml\"), workspaceFix.content, \"utf8\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t}\n\n\t\t\t\t// turbo.json alone is inert without turbo itself installed —\n\t\t\t\t// see ensureTurboDependency()'s own docstring for how this was\n\t\t\t\t// found (a global-version fallback that silently broke on an\n\t\t\t\t// unrelated turbo install).\n\t\t\t\tif (rootPkgRaw) {\n\t\t\t\t\tconst depFix = astromechTurbo.ensureTurboDependency(rootPkgRaw, workspaceFix.content);\n\t\t\t\t\tif (depFix.changed) {\n\t\t\t\t\t\tsteps.push(\n\t\t\t\t\t\t\tawait runSyncStep(\"local\", \"add turbo devDependency\", dryRun, async () => {\n\t\t\t\t\t\t\t\tawait writeFile(join(gitRoot, \"package.json\"), depFix.content, \"utf8\");\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprint(formatSyncStep(steps[steps.length - 1]!));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (stepName === \"wiki\") {\n\t\t\t// fern/docs.yml is repo-wide, same category as turbo.json —\n\t\t\t// runSyncWiki resolves it via context.repoRoot, so a monorepo\n\t\t\t// subpackage sync needs gitRoot there instead, or it looks for\n\t\t\t// (and fails to find) packages/<pkg>/fern/docs.yml.\n\t\t\tconst result = await runSyncWiki({\n\t\t\t\tloaded: input.loaded,\n\t\t\t\tcontext: { ...input.context, repoRoot: gitRoot },\n\t\t\t});\n\t\t\tsteps.push(result);\n\t\t\tprint(formatSyncStep(result));\n\t\t}\n\t}\n\n\tfor (const s of steps) {\n\t\tlogger[s.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{ capability: s.capability, step: s.step, status: s.status, ...(s.message ? { detail: s.message } : {}) },\n\t\t\t`sync: ${s.step}`\n\t\t);\n\t}\n\n\tconst summary = steps.reduce(\n\t\t(acc, s) => {\n\t\t\tif (s.status === \"ok\") acc.ok += 1;\n\t\t\telse if (s.status === \"fail\") acc.fail += 1;\n\t\t\telse if (s.status === \"skip\") acc.skip += 1;\n\t\t\telse if (s.status === \"dry-run\") acc.dryRun += 1;\n\t\t\treturn acc;\n\t\t},\n\t\t{ ok: 0, fail: 0, skip: 0, dryRun: 0 }\n\t);\n\n\tlogger[summary.fail > 0 ? \"warn\" : \"info\"]({ ...summary }, \"sync: done\");\n\n\tprint(\"\");\n\tprint(\n\t\t` ${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped${\n\t\t\tdryRun ? `, ${summary.dryRun} would-do` : \"\"\n\t\t}`\n\t);\n\n\treturn { steps, summary };\n}\n\nasync function runSyncStep(\n\tcapability: string,\n\tstep: string,\n\tdryRun: boolean,\n\tbody: () => Promise<string | void>\n): Promise<SetupStepResult> {\n\tif (dryRun) {\n\t\treturn { capability, step, status: \"dry-run\" };\n\t}\n\ttry {\n\t\tconst note = await body();\n\t\tconst result: SetupStepResult = { capability, step, status: \"ok\" };\n\t\tif (typeof note === \"string\") result.message = note;\n\t\treturn result;\n\t} catch (err) {\n\t\treturn {\n\t\t\tcapability,\n\t\t\tstep,\n\t\t\tstatus: \"fail\",\n\t\t\tmessage: errorMessage(err),\n\t\t};\n\t}\n}\n\nfunction formatSyncStep(step: SetupStepResult): string {\n\tconst icon = step.status === \"ok\" ? \"✓\" : step.status === \"fail\" ? \"✗\" : step.status === \"dry-run\" ? \"…\" : \"·\";\n\tconst detail = step.message ? ` (${step.message})` : \"\";\n\treturn ` ${icon} ${step.step}${detail}`;\n}\n\nasync function writePackageJsonField(repoRoot: string, field: string, value: unknown): Promise<boolean> {\n\tconst pkgPath = join(repoRoot, \"package.json\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(pkgPath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\tconst pkg = JSON.parse(content) as Record<string, unknown>;\n\tpkg[field] = value;\n\tawait writeFile(pkgPath, stringifyJson(pkg, { like: content }), \"utf8\");\n\treturn true;\n}\n\n/**\n * Merge `desired` script entries into `package.json#scripts` — sets only the\n * listed keys, never touches the rest. Returns the sorted list of keys that\n * drifted (empty when all current), or `null` when there is no `package.json`.\n *\n * `turboEligible` (#747): task names `turbo.json` fans out — the same set\n * {@link EnsureRootWorkspaceMemberResult} above already keys off. For those\n * only, an *existing* script that isn't the generated `holocron run <task>\n * --` wrapper is left untouched: root may genuinely be a directly-buildable\n * package (not an orchestrator) with its own real command (`tsc --noEmit`,\n * `vitest run`, …) for that task. Overwriting it would silently discard the\n * real command and, once `turbo.json` exists and root is a real workspace\n * member (#692), reintroduce infinite recursion — `turbo run <task>` →\n * root's own `<task>` script → the wrapper → `holocron run <task>` sees\n * `turbo.json` still defines the task → `turbo run <task>` again, forever.\n * Every other key (non-turbo tasks, `holocron`, `prepare`, …) has no\n * legitimate direct-command alternative and stays fully generator-owned.\n */\nasync function mergePackageJsonScripts(\n\trepoRoot: string,\n\tdesired: Record<string, string>,\n\tturboEligible: ReadonlySet<string>\n): Promise<string[] | null> {\n\tconst pkgPath = join(repoRoot, \"package.json\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(pkgPath, \"utf8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tconst pkg = JSON.parse(content) as Record<string, unknown>;\n\tconst scripts = (pkg.scripts ?? {}) as Record<string, string>;\n\tconst changed: string[] = [];\n\tfor (const [name, command] of Object.entries(desired)) {\n\t\tconst existing = scripts[name];\n\t\tif (turboEligible.has(name) && existing !== undefined && !isGeneratedRunWrapper(existing, name)) continue;\n\t\tif (existing !== command) {\n\t\t\tscripts[name] = command;\n\t\t\tchanged.push(name);\n\t\t}\n\t}\n\tif (changed.length === 0) return [];\n\tpkg.scripts = scripts;\n\tawait writeFile(pkgPath, stringifyJson(pkg, { like: content }), \"utf8\");\n\treturn changed.sort();\n}\n\n/**\n * Matches the exact shape `packageScripts()` generates for `taskName` —\n * `<bin> run <taskName> --`, `<bin>` normally `holocron` but substitutable\n * (`holocronScript`, itself allowed to be multi-word, e.g. `\"node\npackages/cli/dist/cli.mjs\"` — see its own test). Checking the *suffix*\n * rather than the whole string means an old wrapper survives a\n * `holocronScript` rename intact — it's still recognized as a wrapper (safe\n * to update to the new one), not mistaken for a real command.\n */\nfunction isGeneratedRunWrapper(command: string, taskName: string): boolean {\n\treturn command.endsWith(` run ${taskName} --`);\n}\n\nconst README_DESC_START = \"<!-- holocron:description -->\";\nconst README_DESC_END = \"<!-- /holocron:description -->\";\n\nasync function updateReadmeDescription(repoRoot: string, description: string): Promise<boolean> {\n\tconst readmePath = join(repoRoot, \"README.md\");\n\tlet content: string;\n\ttry {\n\t\tcontent = await readFile(readmePath, \"utf8\");\n\t} catch {\n\t\treturn false;\n\t}\n\tconst lines = content.split(\"\\n\");\n\n\tconst startIdx = lines.findIndex((l) => l.trim() === README_DESC_START);\n\tconst endIdx = lines.findIndex((l) => l.trim() === README_DESC_END);\n\tif (startIdx !== -1) {\n\t\tif (endIdx === -1 || endIdx <= startIdx) return false;\n\t\tlines.splice(startIdx + 1, endIdx - startIdx - 1, description);\n\t\tawait writeFile(readmePath, lines.join(\"\\n\"), \"utf8\");\n\t\treturn true;\n\t}\n\n\tconst h1Index = lines.findIndex((l) => /^# /.test(l));\n\tif (h1Index === -1) return false;\n\n\tlines.splice(h1Index + 1, 0, \"\", README_DESC_START, description, README_DESC_END);\n\tawait writeFile(readmePath, lines.join(\"\\n\"), \"utf8\");\n\treturn true;\n}\n\n/**\n * Writes via a temp file + rename in the same directory, not a direct\n * `writeFile` — a monorepo subpackage sync can target the same root-level\n * file a root sync (or another subpackage's sync) also writes, and a\n * process killed mid-write would otherwise leave the live GitHub Actions\n * workflow truncated until some later sync happens to restore it. A same-\n * directory rename is atomic on POSIX filesystems, so readers only ever\n * see the old complete content or the new complete content, never a\n * partial write.\n */\nasync function writeWorkflowFile(repoRoot: string, filename: string, content: string): Promise<void> {\n\tconst dir = join(repoRoot, \".github\", \"workflows\");\n\tawait mkdir(dir, { recursive: true });\n\tconst tmpPath = join(dir, `.${filename}.${randomUUID()}.tmp`);\n\tawait writeFile(tmpPath, content, \"utf8\");\n\tawait rename(tmpPath, join(dir, filename));\n}\n","/**\n * Holocron-specific credential resolution for the telemetry sinks — the env\n * chain plus Holocron's own shipped fallbacks. This is **CLI policy**, not part\n * of the portable adapter set: `sentry-sink.ts` / `posthog-sink.ts` take a\n * resolved DSN / key and never read the environment. When the adapters move to\n * `@theholocron/observability` (#635) this module stays here.\n *\n * errors: HOLOCRON_SENTRY_DSN → SENTRY_DSN → FALLBACK_DSN\n * analytics: HOLOCRON_POSTHOG_PROJECT_TOKEN → POSTHOG_PROJECT_TOKEN → FALLBACK_POSTHOG_PROJECT_TOKEN\n * host: HOLOCRON_POSTHOG_HOST → POSTHOG_HOST → DEFAULT_POSTHOG_HOST\n *\n * The `SENTRY_DSN` / `POSTHOG_PROJECT_TOKEN` fallbacks are the vendor-native\n * names a consumer repo sets to route CLI telemetry to its own project. The\n * built-in fallbacks are ingest-only keys — publishable by design, same risk\n * model as ADR-0007 / ADR-0008.\n */\n\nimport { holocronEnv } from \"../../env/index.js\";\n\n/** Holocron's own Sentry project — the fallback when no env var points elsewhere. */\nconst FALLBACK_DSN = \"https://95cbb72ad5636c94e119a5405ee8f55f@o4508238154104832.ingest.us.sentry.io/4511810950791168\";\n\n/** Holocron's own PostHog project write key — ingest-only. */\nconst FALLBACK_POSTHOG_PROJECT_TOKEN = \"phc_AC4vFCvYzwnzmG7Vg5nEc3PZKZztoPyfKp4Lb9BbXcLK\"; // gitleaks:allow\n\nconst DEFAULT_POSTHOG_HOST = \"https://us.i.posthog.com\";\n\n/** Resolve the Sentry DSN. `\"\"` → error telemetry disabled. */\nexport function resolveDsn(): string {\n\treturn holocronEnv.get(\"SENTRY_DSN\") ?? FALLBACK_DSN;\n}\n\n/** Resolve the PostHog project key. `\"\"` → usage analytics disabled. */\nexport function resolvePostHogKey(): string {\n\treturn holocronEnv.get(\"POSTHOG_PROJECT_TOKEN\") ?? FALLBACK_POSTHOG_PROJECT_TOKEN;\n}\n\n/** Resolve the PostHog ingest host. */\nexport function resolvePostHogHost(): string {\n\treturn holocronEnv.get(\"POSTHOG_HOST\") ?? DEFAULT_POSTHOG_HOST;\n}\n","/**\n * CLI self-telemetry orchestration — errors (Sentry), usage analytics (PostHog).\n *\n * This module holds *no* vendor SDK import. Each concern sits behind an\n * interface from `@theholocron/observability` ({@link ErrorSink} /\n * {@link AnalyticsSink}); the `SentrySink` / `PostHogSink` adapters there are\n * the only `@sentry/node` / `posthog-node` call sites, and a `Noop*Sink` is\n * installed when telemetry is off. Same seam the package's `Logger` uses for\n * Pino.\n *\n * Activation is env-var + shipped-fallback, resolved here (`resolve-telemetry.ts`)\n * and passed to the sink — the adapters read no environment. The single kill\n * switch is `HOLOCRON_TELEMETRY=false` (legacy alias `NO_HOLOCRON_TELEMETRY`);\n * see ADR-0007 / ADR-0008.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { hostname, userInfo } from \"node:os\";\n\nimport { PostHogSink } from \"@theholocron/observability/analytics\";\nimport {\n\ttype AnalyticsSink,\n\ttype CommandSpan,\n\ttype ErrorSink,\n\tNoopAnalyticsSink,\n\tNoopErrorSink,\n\tredactObject,\n} from \"@theholocron/observability/core\";\nimport { SentrySink } from \"@theholocron/observability/errors\";\n\nimport type { TelemetryConfig } from \"../../config/index.js\";\nimport { env } from \"../../env/index.js\";\nimport { getRunId } from \"../logger/index.js\";\nimport { resolveDsn, resolvePostHogHost, resolvePostHogKey } from \"../resolve-telemetry/index.js\";\n\n// ── sinks ────────────────────────────────────────────────────────────────────\n\nlet errors: ErrorSink = new NoopErrorSink();\nlet analytics: AnalyticsSink = new NoopAnalyticsSink();\n\n// ── gate ─────────────────────────────────────────────────────────────────────\n\n/**\n * The shared opt-out. `HOLOCRON_TELEMETRY=false` (going-forward) or\n * `NO_HOLOCRON_TELEMETRY` (any truthy value, back-compat) disables all sinks.\n */\nfunction isEnabled(): boolean {\n\treturn env.get(\"HOLOCRON_TELEMETRY\") !== \"false\" && !env.get(\"NO_HOLOCRON_TELEMETRY\");\n}\n\n// ── identity ─────────────────────────────────────────────────────────────────\n\nlet commandStartedAt = 0;\nlet currentCommand = \"unknown\";\nlet lastErrorType: string | undefined;\nlet currentSpan: CommandSpan | undefined;\n\n/**\n * Anonymous, stable per-machine id — `sha256(hostname + username)` truncated\n * (ADR-0008). One-way: no raw hostname or username is ever transmitted.\n */\nfunction machineId(): string {\n\ttry {\n\t\treturn createHash(\"sha256\").update(`${hostname()} ${userInfo().username}`).digest(\"hex\").slice(0, 32);\n\t} catch {\n\t\treturn \"unknown\";\n\t}\n}\n\n/** Properties every analytics event carries — pivot key to the Axiom trace. */\nfunction baseProps(): Record<string, unknown> {\n\tconst runId = getRunId();\n\treturn {\n\t\tcommand: currentCommand,\n\t\tci: Boolean(env.get(\"CI\")),\n\t\t...(runId ? { runId } : {}),\n\t};\n}\n\n// ── lifecycle ────────────────────────────────────────────────────────────────\n\nexport function init(version: string): void {\n\tconst dsn = resolveDsn();\n\tif (isEnabled() && dsn !== \"\") {\n\t\terrors = new SentrySink();\n\t\terrors.init({\n\t\t\tdsn,\n\t\t\trelease: `holocron@${version}`,\n\t\t\tenvironment: env.get(\"CI\") ? \"ci\" : \"local\",\n\t\t\ttags: { os: process.platform, node: process.version, ci: String(Boolean(env.get(\"CI\"))) },\n\t\t});\n\t}\n\tconst posthogKey = resolvePostHogKey();\n\tif (isEnabled() && posthogKey !== \"\") {\n\t\tanalytics = new PostHogSink({ key: posthogKey, host: resolvePostHogHost() });\n\t\tanalytics.identify(machineId(), {\n\t\t\tci: Boolean(env.get(\"CI\")),\n\t\t\tos: process.platform,\n\t\t\tnode: process.version,\n\t\t\tcli: version,\n\t\t\t...(env.get(\"HOLOCRON_ORG\") ? { org: env.get(\"HOLOCRON_ORG\") } : {}),\n\t\t});\n\t}\n}\n\n/**\n * Apply the `telemetry` config block — the committed override layer, run once\n * per command *after* config loads (so it lands after {@link init}). Env still\n * wins: this only ever *narrows* what `init` turned on, never re-enables.\n *\n * - `enabled: false` → swap both sinks to no-ops for the rest of the run.\n * - `analytics: \"none\"` → drop usage analytics only; error reporting stays.\n *\n * A live sink is drained best-effort before it is dropped so an in-flight\n * Sentry session / PostHog queue still leaves the process cleanly.\n */\nexport function applyConfig(cfg: TelemetryConfig | undefined): void {\n\tif (!cfg) return;\n\n\t// Best-effort drain — never let a rejected close() surface as an unhandled\n\t// rejection from this sync path.\n\tconst drain = (p: Promise<unknown>): void => {\n\t\tp.catch(() => {});\n\t};\n\n\tif (cfg.enabled === false) {\n\t\tdrain(errors.flush());\n\t\tdrain(analytics.shutdown());\n\t\terrors = new NoopErrorSink();\n\t\tanalytics = new NoopAnalyticsSink();\n\t\treturn;\n\t}\n\n\tif (cfg.analytics === \"none\") {\n\t\tdrain(analytics.shutdown());\n\t\tanalytics = new NoopAnalyticsSink();\n\t}\n}\n\n/** Capture a PostHog event. Every `properties` object runs through the scrubber. */\nexport function event(name: string, properties: Record<string, unknown> = {}): void {\n\tanalytics.capture(machineId(), name, redactObject({ ...baseProps(), ...properties }));\n}\n\nexport function startCommand(name: string): (ok: boolean) => void {\n\tcurrentCommand = name;\n\tcommandStartedAt = Date.now();\n\tlastErrorType = undefined;\n\tcurrentSpan = errors.startSpan(name);\n\n\tevent(\"command_started\", { dry_run: process.argv.includes(\"--dry-run\") });\n\n\treturn (ok: boolean) => {\n\t\tcurrentSpan?.setStatus(ok);\n\t\tcurrentSpan?.end();\n\t\tevent(ok ? \"command_completed\" : \"command_failed\", {\n\t\t\tstatus: ok ? \"ok\" : \"fail\",\n\t\t\tduration_ms: Date.now() - commandStartedAt,\n\t\t\t...(ok || !lastErrorType ? {} : { error_type: lastErrorType }),\n\t\t});\n\t};\n}\n\nexport function captureException(err: unknown): void {\n\tlastErrorType = err instanceof Error ? err.constructor.name : \"Error\";\n\terrors.captureException(err);\n}\n\nexport function endSession(): void {\n\terrors.endSession();\n}\n\nexport async function flush(): Promise<void> {\n\tawait errors.flush();\n\tawait analytics.shutdown();\n\terrors = new NoopErrorSink();\n\tanalytics = new NoopAnalyticsSink();\n}\n\n// ── test hook ────────────────────────────────────────────────────────────────\n\n/** Drop the sinks + command state back to their no-op defaults. */\nexport function resetTelemetry(): void {\n\terrors = new NoopErrorSink();\n\tanalytics = new NoopAnalyticsSink();\n\tcommandStartedAt = 0;\n\tcurrentCommand = \"unknown\";\n\tlastErrorType = undefined;\n\tcurrentSpan = undefined;\n}\n","import { createHash } from \"node:crypto\";\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nimport { reusableTemplates } from \"@theholocron/astromech\";\nimport { createGitHubClient } from \"@theholocron/github-client\";\nimport { ProviderApiError } from \"@theholocron/http-client\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport { event as telemetryEvent } from \"../../observability/telemetry/index.js\";\nimport type { FileBatch, RunSyncGithubInput, SyncGithubReport } from \"./sync-github.type.js\";\n\nconst DEFAULT_REPO = \"theholocron/.github\";\n\n/**\n * The file set `sync-github` pushes to `theholocron/.github` — the reusable\n * `workflow_call` implementations, composite actions and starter-workflow\n * metadata, generated by `@theholocron/astromech`. Secondary repos get nothing:\n * their thin callers are managed by `holocron repo sync --steps workflows`, which\n * executes the resolved config (regex parsing here can't resolve preset spreads\n * like `...tasks` from `nodeDocs()` — see issue #464).\n */\nfunction buildBatch(repo: string): FileBatch {\n\tif (repo !== DEFAULT_REPO) return [];\n\treturn [...reusableTemplates()].map(([path, content]) => ({ path, content }));\n}\n\n/** Git blob SHA: sha1(\"blob {len}\\0{content}\") — used to detect unchanged files. */\nexport function gitBlobSha(content: string): string {\n\tconst buf = Buffer.from(content, \"utf8\");\n\treturn createHash(\"sha1\").update(`blob ${buf.length}\\0`).update(buf).digest(\"hex\");\n}\n\nexport async function runSyncGithub(input: RunSyncGithubInput): Promise<SyncGithubReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst repo = input.repo ?? DEFAULT_REPO;\n\tconst { token, dryRun = false, branch, createPr = false } = input;\n\tconst message = input.message ?? `chore: sync from theholocron/holocron`;\n\n\tconst client = createGitHubClient({ token, fetch: input.fetch });\n\n\tprint(`holocron sync github${dryRun ? \" (dry-run)\" : \"\"}`);\n\tprint(` repo: ${repo}`);\n\tif (branch) print(` branch: ${branch}`);\n\tprint(\"\");\n\n\tlogger.info({ repo, branch, createPr: createPr || undefined, dryRun: dryRun || undefined }, \"sync-github: start\");\n\n\t/** Single exit point — one structured line per invocation, whatever the path. */\n\tconst done = (r: SyncGithubReport): SyncGithubReport => {\n\t\tlogger[r.status === \"fail\" ? \"warn\" : \"info\"](\n\t\t\t{\n\t\t\t\trepo,\n\t\t\t\tstatus: r.status,\n\t\t\t\tcreated: r.created,\n\t\t\t\tupdated: r.updated,\n\t\t\t\tunchanged: r.unchanged,\n\t\t\t\t...(r.message ? { reason: r.message } : {}),\n\t\t\t\t...(r.prUrl ? { pr: r.prUrl } : {}),\n\t\t\t},\n\t\t\t\"sync-github: done\"\n\t\t);\n\t\ttelemetryEvent(\"sync_github_run\", {\n\t\t\trepo,\n\t\t\tstatus: r.status,\n\t\t\t...(branch ? { branch } : {}),\n\t\t\trepos_targeted: 1,\n\t\t\tfiles_changed: r.created + r.updated,\n\t\t\tpr_opened: Boolean(r.prUrl),\n\t\t});\n\t\treturn r;\n\t};\n\n\t// ── output-dir: write all files to disk without any API calls ───────────\n\tif (input.outputDir) {\n\t\tconst batch = buildBatch(repo);\n\t\tfor (const file of batch) {\n\t\t\tconst dest = join(input.outputDir, file.path);\n\t\t\tmkdirSync(dirname(dest), { recursive: true });\n\t\t\twriteFileSync(dest, file.content, \"utf8\");\n\t\t}\n\t\tprint(` ${batch.length} files written to ${input.outputDir}`);\n\t\treturn done({ status: \"ok\", created: batch.length, updated: 0, unchanged: 0 });\n\t}\n\n\t// ── 1. Resolve target branch ─────────────────────────────────────────────\n\tlet targetBranch = branch;\n\tlet defaultBranch: string | undefined;\n\tif (!targetBranch || createPr) {\n\t\ttry {\n\t\t\tconst repoData = await client.repos.getRepo(repo);\n\t\t\tdefaultBranch = repoData.default_branch;\n\t\t\tif (!targetBranch) targetBranch = defaultBranch;\n\t\t} catch {\n\t\t\tconst msg = \"failed to fetch repo metadata\";\n\t\t\tprint(` ✗ ${msg}`);\n\t\t\treturn done({ status: \"fail\", created: 0, updated: 0, unchanged: 0, message: msg });\n\t\t}\n\t}\n\n\t// ── 2. Get HEAD commit → base tree ───────────────────────────────────────\n\tconst baseBranch = createPr && defaultBranch ? defaultBranch : targetBranch!;\n\tlet headSha: string;\n\tlet baseTreeSha: string;\n\tlet existingBlobs: Map<string, string>;\n\ttry {\n\t\tconst ref = await client.git.getRef(repo, baseBranch);\n\t\theadSha = ref.object.sha;\n\t\tconst commit = await client.git.getCommit(repo, headSha);\n\t\tbaseTreeSha = commit.tree.sha;\n\t\tconst treeData = await client.git.getTree(repo, baseTreeSha, true);\n\t\texistingBlobs = new Map(treeData.tree.filter((i) => i.type === \"blob\").map((i) => [i.path, i.sha]));\n\t} catch (err) {\n\t\tconst msg = err instanceof Error ? err.message : `Branch ${baseBranch} not found`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created: 0, updated: 0, unchanged: 0, message: msg });\n\t}\n\n\t// ── 3. Build file batch ─────────────────────────────────────────────────\n\t// Secondary-repo thin callers are managed by `holocron repo sync --steps workflows`.\n\tconst batch = buildBatch(repo);\n\n\t// ── 5. Detect changes ────────────────────────────────────────────────────\n\tlet created = 0;\n\tlet updated = 0;\n\tlet unchanged = 0;\n\tconst changedFiles: Array<{ path: string; content: string }> = [];\n\n\tfor (const file of batch) {\n\t\tconst localSha = gitBlobSha(file.content);\n\t\tconst existingSha = existingBlobs.get(file.path);\n\n\t\tif (existingSha === localSha) {\n\t\t\tprint(` · unchanged ${file.path}`);\n\t\t\tunchanged++;\n\t\t} else if (existingSha) {\n\t\t\tprint(` ${dryRun ? \"~\" : \"✓\"} updated ${file.path}`);\n\t\t\tlogger.debug({ file: file.path, change: \"updated\" }, \"sync-github: file\");\n\t\t\tupdated++;\n\t\t\tif (!dryRun) changedFiles.push(file);\n\t\t} else {\n\t\t\tprint(` ${dryRun ? \"~\" : \"✓\"} created ${file.path}`);\n\t\t\tlogger.debug({ file: file.path, change: \"created\" }, \"sync-github: file\");\n\t\t\tcreated++;\n\t\t\tif (!dryRun) changedFiles.push(file);\n\t\t}\n\t}\n\n\tprint(\"\");\n\tprint(` ${created} created, ${updated} updated, ${unchanged} unchanged`);\n\n\tif (dryRun || changedFiles.length === 0) {\n\t\treturn done({ status: dryRun ? \"dry-run\" : \"ok\", created, updated, unchanged });\n\t}\n\n\t// ── 6. Create blobs for changed files ────────────────────────────────────\n\tconst treeEntries: Array<{ path: string; mode: string; type: string; sha: string }> = [];\n\tfor (const file of changedFiles) {\n\t\ttry {\n\t\t\tconst blob = await client.git.createBlob(repo, file.content);\n\t\t\ttreeEntries.push({ path: file.path, mode: \"100644\", type: \"blob\", sha: blob.sha });\n\t\t} catch (err) {\n\t\t\tconst msg = `failed to create blob for ${file.path}: ${errorMessage(err)}`;\n\t\t\tprint(` ✗ ${msg}`);\n\t\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t\t}\n\t}\n\n\t// ── 7. Create tree ───────────────────────────────────────────────────────\n\tlet newTreeSha: string;\n\ttry {\n\t\tconst newTree = await client.git.createTree(repo, treeEntries, baseTreeSha);\n\t\tnewTreeSha = newTree.sha;\n\t} catch (err) {\n\t\tconst msg = `failed to create tree: ${errorMessage(err)}`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t}\n\n\t// ── 8. Create commit ─────────────────────────────────────────────────────\n\tlet newCommitSha: string;\n\ttry {\n\t\tconst newCommit = await client.git.createCommit(repo, message, newTreeSha, [headSha]);\n\t\tnewCommitSha = newCommit.sha;\n\t} catch (err) {\n\t\tconst msg = `failed to create commit: ${errorMessage(err)}`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t}\n\n\t// ── 9. Update (or create) branch ref ────────────────────────────────────\n\ttry {\n\t\tif (createPr && branch) {\n\t\t\ttry {\n\t\t\t\tawait client.git.createRef(repo, `refs/heads/${branch}`, newCommitSha);\n\t\t\t} catch (err) {\n\t\t\t\tif (!(err instanceof ProviderApiError) || err.status !== 422) throw err;\n\t\t\t\t// Branch already exists from a previous partial run — force-update it.\n\t\t\t\tawait client.git.updateRef(repo, `heads/${branch}`, newCommitSha, true);\n\t\t\t}\n\t\t} else {\n\t\t\tawait client.git.updateRef(repo, `heads/${targetBranch!}`, newCommitSha);\n\t\t}\n\t} catch (err) {\n\t\tconst msg = `failed to update ref: ${errorMessage(err)}`;\n\t\tprint(` ✗ ${msg}`);\n\t\treturn done({ status: \"fail\", created, updated, unchanged, message: msg });\n\t}\n\n\t// ── 10. Open PR if requested ─────────────────────────────────────────────\n\tlet prUrl: string | undefined;\n\tif (branch && createPr && !dryRun) {\n\t\ttry {\n\t\t\tconst pr = await client.git.createPull(repo, {\n\t\t\t\ttitle: message.split(\"\\n\")[0]!,\n\t\t\t\thead: branch,\n\t\t\t\tbase: \"main\",\n\t\t\t\tbody: \"Auto-generated by `holocron sync github`. Review and merge to apply template updates.\",\n\t\t\t});\n\t\t\tprUrl = pr.html_url;\n\t\t\tprint(` → PR opened: ${prUrl}`);\n\t\t} catch (err) {\n\t\t\tconst alreadyExists =\n\t\t\t\terr instanceof ProviderApiError && err.status === 422 && String(err.details).includes(\"already exists\");\n\t\t\tif (alreadyExists) {\n\t\t\t\tprint(` → PR already open for ${branch} — branch updated, ready to merge`);\n\t\t\t} else {\n\t\t\t\tprint(` ⚠ PR creation failed: ${errorMessage(err)}`);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn done({ status: \"ok\", created, updated, unchanged, prUrl });\n}\n","/**\n * `holocron repo upgrade deps` — bring a repo's `@theholocron/*` dependency pins and\n * its `holocron.config.ts` up to the current major.\n *\n * Two concerns:\n *\n * 1. **Catalog pins.** Every `@theholocron/*` entry in `pnpm-workspace.yaml`\n * (`catalog:` and every named `catalogs.*`) is bumped to the latest published\n * version, preserving the range prefix (`^` / `~`). Never downgrades.\n * 2. **`holocron.config.ts` migration.** `@theholocron/holocron-config@8`\n * dropped the 7.x preset shape (`const { repo, workflows, providers } =\n * node()` + `repo.requiredChecks` + `workflows:`) for a composed-preset\n * (`const preset = node()` + `...preset` + `tasks:` + `extraRequiredChecks:`).\n * This applies the mechanical transforms and flags anything that needs a\n * human eye.\n *\n * After running, `pnpm install && holocron run ci`.\n */\n\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type {\n\tCatalogBump,\n\tConfigMigration,\n\tFetchLatest,\n\tRunUpgradeDepsInput,\n\tUpgradeDepsReport,\n\tUpgradeDepsStatus,\n} from \"./upgrade-deps.type.js\";\n\nconst FETCH_TIMEOUT_MS = 4000;\n\n/** Resolve a package's `latest` dist-tag from the npm registry. */\nexport const fetchLatestFromNpm: FetchLatest = async (pkg) => {\n\ttry {\n\t\tconst res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`, {\n\t\t\tsignal: AbortSignal.timeout(FETCH_TIMEOUT_MS),\n\t\t\theaders: { accept: \"application/vnd.npm.install-v1+json\" },\n\t\t});\n\t\tif (!res.ok) return null;\n\t\tconst data = (await res.json()) as { \"dist-tags\"?: Record<string, string> };\n\t\treturn data[\"dist-tags\"]?.[\"latest\"] ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n// ── semver (just enough) ─────────────────────────────────────────────────────\n\n/** `a > b` for `x.y.z` release versions (prerelease tags are ignored). */\nexport function gt(a: string, b: string): boolean {\n\tconst pa = a.split(\".\").map((n) => parseInt(n, 10));\n\tconst pb = b.split(\".\").map((n) => parseInt(n, 10));\n\tfor (let i = 0; i < 3; i++) {\n\t\tconst x = pa[i] ?? 0;\n\t\tconst y = pb[i] ?? 0;\n\t\tif (x !== y) return x > y;\n\t}\n\treturn false;\n}\n\n// ── 1. catalog pins ──────────────────────────────────────────────────────────\n\nconst CATALOG_LINE = /^(\\s*['\"]?)(@theholocron\\/[a-z0-9-]+)(['\"]?\\s*:\\s*['\"]?)([~^]?)(\\d+\\.\\d+\\.\\d+[\\w.-]*)(['\"]?\\s*)$/;\n\n/**\n * Rewrite every `@theholocron/*` pin in a `pnpm-workspace.yaml` to `latest`,\n * keeping the range prefix. `latest` is looked up once per package.\n */\nexport async function bumpCatalogs(\n\tcontent: string,\n\tfetchLatest: FetchLatest\n): Promise<{ content: string; bumps: CatalogBump[] }> {\n\tconst lines = content.split(\"\\n\");\n\tconst wanted = new Set<string>();\n\tfor (const line of lines) {\n\t\tconst m = CATALOG_LINE.exec(line);\n\t\tif (m) wanted.add(m[2]!);\n\t}\n\n\tconst latest = new Map<string, string | null>();\n\tawait Promise.all(\n\t\t[...wanted].map(async (pkg) => {\n\t\t\tlatest.set(pkg, await fetchLatest(pkg));\n\t\t})\n\t);\n\n\tconst bumps: CatalogBump[] = [];\n\tconst out = lines.map((line) => {\n\t\tconst m = CATALOG_LINE.exec(line);\n\t\tif (!m) return line;\n\t\tconst [, pre, pkg, mid, prefix, current, post] = m;\n\t\tconst next = latest.get(pkg!);\n\t\tif (!next || next === current || !gt(next, current!)) return line;\n\t\tbumps.push({ pkg: pkg!, from: current!, to: next });\n\t\treturn `${pre}${pkg}${mid}${prefix}${next}${post}`;\n\t});\n\n\treturn { content: out.join(\"\\n\"), bumps };\n}\n\n/** True if the file still uses the 7.x preset shape. */\nexport function isLegacyConfig(content: string): boolean {\n\t// Only the 7.x markers count: a `workflows:` key, a `...repo.requiredChecks`\n\t// spread, or a preset destructure that pulls `workflows`. A config already on\n\t// `compose()` + `tasks:` + `extraRequiredChecks:` that merely destructures\n\t// `{ repo, providers }` is valid 8.x — touching it strands `...tasks` /\n\t// `...extraRequiredChecks` on the removed binding.\n\treturn (\n\t\t/\\.\\.\\.repo\\.requiredChecks/.test(content) ||\n\t\t/^\\s*workflows\\s*:/m.test(content) ||\n\t\t/const\\s*\\{[^}]*\\bworkflows\\b[^}]*\\}\\s*=\\s*(compose\\(|[a-zA-Z]+\\()/.test(content)\n\t);\n}\n\n/**\n * Apply the mechanical 7.x → 8.x transforms to a `holocron.config.ts`. Best\n * effort — the result should always be reviewed and run through `holocron run ci`.\n */\nexport function migrateConfig(content: string): ConfigMigration {\n\tconst transforms: string[] = [];\n\tconst warnings: string[] = [];\n\tlet s = content;\n\n\tif (!isLegacyConfig(s)) {\n\t\treturn { content, changed: false, transforms, warnings };\n\t}\n\n\t// `const { repo, workflows, ... } = <preset>;` → `const preset = <preset>;`\n\tlet destructured: string[] = [];\n\ts = s.replace(\n\t\t/const\\s*\\{([^}]*)\\}\\s*=\\s*((?:compose\\([\\s\\S]*?\\)|[a-zA-Z]+\\([\\s\\S]*?\\)))\\s*;/,\n\t\t(_m, names: string, expr: string) => {\n\t\t\tdestructured = names\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((n) => n.trim().split(\":\")[0]!.trim())\n\t\t\t\t.filter(Boolean);\n\t\t\ttransforms.push(\"destructured preset → `const preset = …`\");\n\t\t\treturn `const preset = ${expr.trim()};`;\n\t\t}\n\t);\n\n\t// Any binding that was destructured and is still spread bare (`...tasks`,\n\t// `...extraRequiredChecks`, …) now has to come off `preset`.\n\tfor (const name of destructured) {\n\t\tif (name === \"repo\" || name === \"providers\" || name === \"workflows\") continue; // handled explicitly below\n\t\tconst bare = new RegExp(`\\\\.\\\\.\\\\.${name}\\\\b(?!\\\\.)`, \"g\");\n\t\tif (bare.test(s)) {\n\t\t\ts = s.replace(bare, `...preset.${name}`);\n\t\t\ttransforms.push(`\\`...${name}\\` → \\`...preset.${name}\\``);\n\t\t}\n\t}\n\n\t// Inject `...preset,` as the first key of defineConfig({ … })\n\tif (/const preset =/.test(s) && !/\\.\\.\\.preset\\b/.test(s)) {\n\t\ts = s.replace(/(defineConfig\\(\\{\\s*\\n)/, `$1\\t...preset,\\n`);\n\t\ttransforms.push(\"spread `...preset` into defineConfig()\");\n\t}\n\n\t// Drop the top-level destructure pass-throughs — `...preset` covers them.\n\ts = s.replace(/^\\torg,\\n/m, \"\");\n\ts = s.replace(/^\\tdomain,\\n/m, \"\");\n\ts = s.replace(/^\\tdocs,\\n/m, \"\");\n\n\t// Spread renames\n\tif (/\\.\\.\\.repo\\.properties/.test(s)) {\n\t\ts = s.replace(/\\.\\.\\.repo\\.properties/g, \"...preset.repo?.properties\");\n\t\ttransforms.push(\"`...repo.properties` → `...preset.repo?.properties`\");\n\t}\n\tif (/([{[,]\\s*)\\.\\.\\.repo\\b(?!\\.)/.test(s)) {\n\t\ts = s.replace(/([{[,]\\s*)\\.\\.\\.repo\\b(?!\\.)/g, \"$1...preset.repo\");\n\t\ttransforms.push(\"`...repo` → `...preset.repo`\");\n\t}\n\tif (/\\.\\.\\.providers\\b/.test(s)) {\n\t\ts = s.replace(/\\.\\.\\.providers\\b/g, \"...preset.providers\");\n\t\ttransforms.push(\"`...providers` → `...preset.providers`\");\n\t}\n\n\t// `repo.requiredChecks` is gone — the derived checks come from `tasks`.\n\t// Pull the custom entries out to a top-level `extraRequiredChecks`.\n\tconst rc = /(\\n\\s*)requiredChecks\\s*:\\s*\\[\\s*\\n?\\s*\\.\\.\\.repo\\.requiredChecks\\s*,?\\s*([\\s\\S]*?)\\n\\s*\\]\\s*,/.exec(s);\n\tif (rc) {\n\t\tconst custom = rc[2]!.trim().replace(/,\\s*$/, \"\");\n\t\ts = s.replace(rc[0], \"\");\n\t\tif (custom) {\n\t\t\tconst block = `\\textraRequiredChecks: [\\n\\t\\t${custom\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.map((l) => l.trim())\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\\t\\t\")}\\n\\t],\\n`;\n\t\t\ts = s.replace(/(defineConfig\\(\\{\\s*\\n(?:\\t\\.\\.\\.preset,\\n)?)/, `$1${block}`);\n\t\t\ttransforms.push(\"`repo.requiredChecks` custom entries → top-level `extraRequiredChecks`\");\n\t\t\twarnings.push(\"check the moved `extraRequiredChecks` — the preset already contributes lint/test/typecheck\");\n\t\t} else {\n\t\t\ts = s.replace(/,(\\s*)\\.\\.\\.repo\\.requiredChecks/g, \"$1\");\n\t\t\ttransforms.push(\"dropped `...repo.requiredChecks`\");\n\t\t}\n\t}\n\n\t// `workflows:` → `tasks:` (`...workflows` → `...preset.tasks`)\n\tif (/^\\s*workflows\\s*:/m.test(s)) {\n\t\ts = s.replace(/(\\n\\s*)workflows(\\s*:\\s*\\[)/, \"$1tasks$2\");\n\t\ts = s.replace(/\\.\\.\\.workflows\\b/g, \"...preset.tasks\");\n\t\ttransforms.push(\"`workflows:` → `tasks:` (`...workflows` → `...preset.tasks`)\");\n\t\twarnings.push(\n\t\t\t\"review the `tasks` array — a bare workflow name that should gate merges now needs `{ name, required: true }`\"\n\t\t);\n\t}\n\n\treturn { content: s, changed: s !== content, transforms, warnings };\n}\n\nexport async function runUpgradeDeps(input: RunUpgradeDepsInput = {}): Promise<UpgradeDepsReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst dryRun = input.dryRun ?? false;\n\tconst pinsOnly = input.pinsOnly ?? false;\n\tconst _readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\tconst _writeFile = input.writeFile ?? ((p: string, c: string) => writeFileSync(p, c));\n\tconst fetchLatest = input.fetchLatest ?? fetchLatestFromNpm;\n\n\tlogger.info({ dryRun: dryRun || undefined, pinsOnly: pinsOnly || undefined }, \"upgrade deps: start\");\n\tprint(`Upgrading @theholocron/* dependencies${dryRun ? \" (dry-run)\" : \"\"}…`);\n\n\t// ── 1. catalog pins ──\n\tconst wsPath = join(cwd, \"pnpm-workspace.yaml\");\n\tlet bumps: CatalogBump[] = [];\n\ttry {\n\t\tconst ws = _readFile(wsPath);\n\t\tconst result = await bumpCatalogs(ws, fetchLatest);\n\t\tbumps = result.bumps;\n\t\tif (bumps.length > 0) {\n\t\t\tif (!dryRun) _writeFile(wsPath, result.content);\n\t\t\tprint(\"\");\n\t\t\tprint(` pnpm-workspace.yaml — ${bumps.length} pin${bumps.length === 1 ? \"\" : \"s\"}`);\n\t\t\tfor (const b of bumps) print(` ${dryRun ? \"~\" : \"✓\"} ${b.pkg} ${b.from} → ${b.to}`);\n\t\t} else {\n\t\t\tprint(\" · pnpm-workspace.yaml — @theholocron/* pins already current\");\n\t\t}\n\t} catch {\n\t\tprint(\" · no pnpm-workspace.yaml — skipping catalog pins\");\n\t}\n\n\t// ── 2. holocron.config.ts migration ──\n\tlet configMigrated = false;\n\tlet configWarnings: string[] = [];\n\tif (!pinsOnly) {\n\t\tfor (const name of [\"holocron.config.ts\", \"holocron.config.js\"]) {\n\t\t\tlet cfg: string;\n\t\t\ttry {\n\t\t\t\tcfg = _readFile(join(cwd, name));\n\t\t\t} catch {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst m = migrateConfig(cfg);\n\t\t\tif (!m.changed) {\n\t\t\t\tprint(` · ${name} — already on the current preset API`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!dryRun) _writeFile(join(cwd, name), m.content);\n\t\t\tconfigMigrated = true;\n\t\t\tconfigWarnings = m.warnings;\n\t\t\tprint(\"\");\n\t\t\tprint(` ${name} — ${dryRun ? \"would migrate\" : \"migrated\"} to the 8.x preset API`);\n\t\t\tfor (const t of m.transforms) print(` ${dryRun ? \"~\" : \"✓\"} ${t}`);\n\t\t\tfor (const w of m.warnings) print(` ⚠ ${w}`);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprint(\"\");\n\tif (bumps.length === 0 && !configMigrated) {\n\t\tprint(\"Nothing to do — already up to date.\");\n\t} else {\n\t\tprint(`Next: ${dryRun ? \"run without --dry-run, then \" : \"\"}\\`pnpm install && holocron run ci\\``);\n\t\tif (configMigrated) print(\" review holocron.config.ts before committing.\");\n\t}\n\n\tconst status: UpgradeDepsStatus = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ bumps: bumps.length, configMigrated, warnings: configWarnings.length, status }, \"upgrade deps: done\");\n\treturn { status, bumps, configMigrated, configWarnings };\n}\n","import { readFileSync, writeFileSync } from \"node:fs\";\nimport { basename, join, resolve, sep } from \"node:path\";\n\nimport { walkFilesSync } from \"@theholocron/fs-utils\";\nimport { stringifyJson } from \"@theholocron/json-utils\";\nimport { errorMessage } from \"@theholocron/misc-utils\";\n\nimport { getLogger } from \"../../observability/logger/index.js\";\nimport type { Pattern, RunUpgradeNodeInput, UpgradeNodeReport } from \"./upgrade-node.type.js\";\n\n// Directories to skip when walking the repo tree\nconst SKIP_DIRS = [\"node_modules\", \".git\", \"dist\", \"coverage\", \"build\", \".turbo\", \".next\", \"out\"];\n\n// ── per-file-type patch functions ─────────────────────────────────────────────\n// Each returns the new file content, or null if nothing in that file changed.\n\nfunction patchPackageJson(content: string, from: number, to: number): string | null {\n\tlet pkg: Record<string, unknown>;\n\ttry {\n\t\tpkg = JSON.parse(content) as Record<string, unknown>;\n\t} catch {\n\t\treturn null;\n\t}\n\n\tlet changed = false;\n\n\tconst engines = pkg.engines as Record<string, string> | undefined;\n\tif (engines?.node && /^>=\\d+(?:\\.0\\.0)?$/.test(engines.node)) {\n\t\tconst major = parseInt(engines.node.match(/\\d+/)![0]!, 10);\n\t\tif (major === from) {\n\t\t\tengines.node = `>=${to}.0.0`;\n\t\t\tchanged = true;\n\t\t}\n\t}\n\n\tfor (const field of [\"devDependencies\", \"dependencies\"] as const) {\n\t\tconst deps = pkg[field] as Record<string, string> | undefined;\n\t\tif (!deps?.[\"@types/node\"]) continue;\n\t\t// Only update exact semver ranges; leave catalog: pins alone\n\t\tif (deps[\"@types/node\"] === `^${from}.0.0`) {\n\t\t\tdeps[\"@types/node\"] = `^${to}.0.0`;\n\t\t\tchanged = true;\n\t\t}\n\t}\n\n\treturn changed ? stringifyJson(pkg, { like: content }) : null;\n}\n\nfunction patchYaml(content: string, from: number, to: number): string | null {\n\t// node-version: 20 / node-version: '20' / node-version: \"20\"\n\tconst updated = content.replace(/node-version:\\s+['\"]?(\\d+)['\"]?/g, (match, ver) =>\n\t\tver === String(from) ? match.replace(String(from), String(to)) : match\n\t);\n\treturn updated !== content ? updated : null;\n}\n\nfunction patchPinFile(content: string, from: number, to: number): string | null {\n\t// .nvmrc / .node-version — \"20\" or \"20.x.y\" on the first line\n\tconst trimmed = content.trim();\n\tif (trimmed === String(from) || trimmed.startsWith(`${from}.`)) {\n\t\treturn `${to}\\n`;\n\t}\n\treturn null;\n}\n\nfunction patchDockerfile(content: string, from: number, to: number): string | null {\n\t// FROM node:20 / FROM node:20-alpine / FROM node:20.11.0\n\tconst updated = content.replace(/^(FROM\\s+node:)(\\d+)/gm, (match, prefix, ver) =>\n\t\tver === String(from) ? `${prefix}${to}` : match\n\t);\n\treturn updated !== content ? updated : null;\n}\n\nfunction patchToolVersions(content: string, from: number, to: number): string | null {\n\t// nodejs 20 / nodejs 20.11.0\n\tconst updated = content.replace(/^(nodejs\\s+)(\\d+)/gm, (match, prefix, ver) =>\n\t\tver === String(from) ? `${prefix}${to}` : match\n\t);\n\treturn updated !== content ? updated : null;\n}\n\nconst PATTERNS: Pattern[] = [\n\t{ matches: (n) => n === \"package.json\", patch: patchPackageJson },\n\t{ matches: (n) => n.endsWith(\".yml\") || n.endsWith(\".yaml\"), patch: patchYaml },\n\t{ matches: (n) => n === \".nvmrc\" || n === \".node-version\", patch: patchPinFile },\n\t{ matches: (n) => n === \"Dockerfile\" || n.startsWith(\"Dockerfile.\"), patch: patchDockerfile },\n\t{ matches: (n) => n === \".tool-versions\", patch: patchToolVersions },\n];\n\n// ── auto-detect current major from the repo ───────────────────────────────────\n\nfunction detectFrom(cwd: string, _readFile: (p: string) => string): number | null {\n\tfor (const name of [\".nvmrc\", \".node-version\"]) {\n\t\ttry {\n\t\t\tconst major = parseInt(_readFile(join(cwd, name)).trim(), 10);\n\t\t\tif (!isNaN(major)) return major;\n\t\t} catch {\n\t\t\t/* absent */\n\t\t}\n\t}\n\ttry {\n\t\tconst pkg = JSON.parse(_readFile(join(cwd, \"package.json\"))) as Record<string, unknown>;\n\t\tconst node = (pkg.engines as Record<string, string> | undefined)?.node;\n\t\tif (node) {\n\t\t\tconst m = node.match(/(\\d+)/);\n\t\t\tif (m) return parseInt(m[1]!, 10);\n\t\t}\n\t} catch {\n\t\t/* absent */\n\t}\n\treturn null;\n}\n\n// ── default file walker ───────────────────────────────────────────────────────\n\nconst defaultWalkFiles = (dir: string): string[] => walkFilesSync(dir, { skip: SKIP_DIRS });\n\nexport async function runUpgradeNode(input: RunUpgradeNodeInput): Promise<UpgradeNodeReport> {\n\tconst print = input.print ?? ((line: string) => console.log(line));\n\tconst logger = input.logger ?? getLogger();\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst { to, dryRun = false, extra = [] } = input;\n\tconst _readFile = input.readFile ?? ((p: string) => readFileSync(p, \"utf8\"));\n\tconst _writeFile = input.writeFile ?? ((p: string, c: string) => writeFileSync(p, c));\n\tconst _walkFiles = input.walkFiles ?? defaultWalkFiles;\n\n\t// Read the tree first: an unreadable directory is its own failure, not\n\t// \"couldn't detect the version\" or \"already up to date\".\n\tlet walked: string[];\n\ttry {\n\t\twalked = _walkFiles(cwd);\n\t} catch (error) {\n\t\tconst message = `could not read ${cwd}: ${errorMessage(error)}`;\n\t\tlogger.warn({ to, reason: message }, \"upgrade node: done\");\n\t\treturn { status: \"fail\", updated: [], message };\n\t}\n\n\tconst from = input.from ?? detectFrom(cwd, _readFile);\n\tif (from === null) {\n\t\tconst message = \"could not detect current Node version — pass --from <major>\";\n\t\tlogger.warn({ to, reason: message }, \"upgrade node: done\");\n\t\treturn { status: \"fail\", updated: [], message };\n\t}\n\n\tlogger.info({ from, to, dryRun: dryRun || undefined }, \"upgrade node: start\");\n\n\tif (from === to) {\n\t\tprint(`Already at Node.js ${to} — nothing to do.`);\n\t\tlogger.info({ from, to, updated: 0, status: \"ok\" }, \"upgrade node: done\");\n\t\treturn { status: \"ok\", updated: [] };\n\t}\n\n\tprint(`Upgrading Node.js ${from} → ${to}${dryRun ? \" (dry-run)\" : \"\"}…`);\n\n\tconst updated: string[] = [];\n\tconst root = resolve(cwd);\n\tconst scanned = [...walked, ...extra.map((p) => join(cwd, p))];\n\n\tfor (const abs of scanned) {\n\t\tconst name = basename(abs);\n\t\tconst pattern = PATTERNS.find((p) => p.matches(name));\n\t\tif (!pattern) continue;\n\n\t\tlet content: string;\n\t\ttry {\n\t\t\tcontent = _readFile(abs);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst patched = pattern.patch(content, from, to);\n\t\tif (patched === null) continue;\n\n\t\tconst absolute = resolve(abs);\n\t\tconst rel = absolute.startsWith(root + sep) ? absolute.slice(root.length + 1) : abs;\n\t\tif (!dryRun) _writeFile(abs, patched);\n\t\tprint(` ${dryRun ? \"~\" : \"✓\"} ${rel}`);\n\t\tlogger.debug({ file: rel, from, to }, \"upgrade node: patched\");\n\t\tupdated.push(rel);\n\t}\n\n\tif (updated.length === 0) {\n\t\tprint(` · no files contained Node.js ${from} pins`);\n\t}\n\n\tconst status = dryRun ? \"dry-run\" : \"ok\";\n\tlogger.info({ from, to, updated: updated.length, status }, \"upgrade node: done\");\n\treturn { status, updated };\n}\n","import type { CommandEntry } from \"../command-registry/index.js\";\n\n/**\n * `--token` (repeatable), `--org`, `--cwd`, `--dry-run` — the global flags a\n * menu-launched child should inherit from the parent invocation. Everything\n * else (command-specific options) was never captured by the top-level `$0`\n * handler in the first place, so there's nothing else to forward.\n *\n * `dryRunOverride`, when passed, wins over `argv.dryRun` — `launchMenu`'s\n * dry-run offer needs to force `--dry-run` on for the preview spawn and\n * force it back off for the real-run spawn that follows, regardless of\n * what was on the original invocation.\n */\nexport function forwardedFlags(argv: Record<string, unknown>, dryRunOverride?: boolean): string[] {\n\tconst out: string[] = [];\n\tconst tokens = argv.token as string[] | undefined;\n\tfor (const t of tokens ?? []) out.push(\"--token\", t);\n\tif (typeof argv.org === \"string\") out.push(\"--org\", argv.org);\n\tif (typeof argv.cwd === \"string\") out.push(\"--cwd\", argv.cwd);\n\tif (dryRunOverride ?? argv.dryRun === true) out.push(\"--dry-run\");\n\treturn out;\n}\n\n/** `entry.spawnArgs` if set, else `entry.name` split into tokens — resolved positionals appended, then forwarded flags. */\nexport function buildChildArgv(\n\tentry: CommandEntry,\n\tpositionals: string[],\n\tparentArgv: Record<string, unknown>,\n\tdryRunOverride?: boolean\n): string[] {\n\treturn [\n\t\t...(entry.spawnArgs ?? entry.name.split(\" \")),\n\t\t...positionals,\n\t\t...forwardedFlags(parentArgv, dryRunOverride),\n\t];\n}\n","import { listStoredProviders } from \"../../auth/index.js\";\nimport type { CommandEntry } from \"./command-registry.type.js\";\n\nconst numeric = (value: string): boolean | string => (/^\\d+$/.test(value) ? true : \"enter a number\");\n\n/**\n * The full command surface, hand-maintained in parallel with `cli.ts`'s\n * yargs registrations (this module does not introspect yargs at runtime).\n * `run <task>` has no entry here at all — `cli.ts`'s `$0` handler merges in\n * {@link buildRunMenuEntries}'s dynamically-built ones instead, since the\n * task namespace is this repo's own resolved manifest, not a static set\n * this module can hand-enumerate the way every other entry's positionals\n * are. `job` and `passthrough` stay un-prompted either way; picking a task\n * and running it plain covers the common case, and typing\n * `holocron run <task> <job> -- <args>` directly is one step away for\n * everything else. `run lint commit-msg <file>` stays excluded entirely:\n * it's invoked exclusively from `.husky/commit-msg \"$1\"`, never typed by a\n * human.\n */\nexport const COMMAND_REGISTRY: CommandEntry[] = [\n\t{\n\t\tname: \"clone\",\n\t\tdescription: \"Clone a single repo (org/repo) or every repo in an org (org)\",\n\t\tpositionals: [\n\t\t\t{\n\t\t\t\tkey: \"target\",\n\t\t\t\tmessage: \"org/repo to clone (or a bare org to clone every repo in it):\",\n\t\t\t\ttype: \"input\",\n\t\t\t\tvalidate: (v) => v.trim().length > 0 || \"org/repo or org is required\",\n\t\t\t},\n\t\t],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"doctor\",\n\t\tdescription: \"Load the config and run a smoke check against every provider\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo setup\",\n\t\tdescription: \"Apply infra setup actions across every configured capability\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"secrets set\",\n\t\tdescription: \"Set a single secret via the configured `secrets` capability\",\n\t\tpositionals: [{ key: \"name\", message: \"Secret name:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"secrets sync\",\n\t\tdescription: \"Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars\",\n\t\tpositionals: [{ key: \"environmentId\", message: \"Vault environment id:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"deploy\",\n\t\tdescription: \"Trigger a deployment via the configured `deployment` capability\",\n\t\tpositionals: [{ key: \"branch\", message: \"Branch to deploy:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"deploy cleanup-preview\",\n\t\tdescription: \"List and delete Cloudflare Pages preview deployments for a GitHub PR\",\n\t\tpositionals: [{ key: \"pr\", message: \"PR number:\", type: \"input\", validate: numeric }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"deploy on-release\",\n\t\tdescription: \"Deploy every workspace package whose delivery.deploy task is `on: release`\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"monitoring check\",\n\t\tdescription: \"Run every configured `monitoring` check against a given URL instead of its own configured url\",\n\t\tpositionals: [{ key: \"url\", message: \"URL to test against:\", type: \"input\" }],\n\t\tsupportsDryRun: false,\n\t},\n\t{\n\t\tname: \"package bump-versions\",\n\t\tdescription: \"Bump all non-private package versions in lockstep (semantic-release prepareCmd)\",\n\t\tpositionals: [{ key: \"newVersion\", cliArg: \"new-version\", message: \"New version:\", type: \"input\" }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"package publish\",\n\t\tdescription: \"Publish @theholocron/* packages to npm\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo sync\",\n\t\tdescription:\n\t\t\t\"Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"run ci\",\n\t\tdescription: \"Run the merge-gating checks locally, in CI order — 'will CI pass?'\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"sync github\",\n\t\tdescription: \"Sync workflow templates and composite actions to theholocron/.github\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo sync readme\",\n\t\tdescription: \"Sync the Installation + Usage block in README.md from package.json\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{ name: \"config show\", description: \"Print the resolved holocron config\", positionals: [] },\n\t{\n\t\tname: \"new repo\",\n\t\tdescription: \"Scaffold a new repo from a GitHub template (e.g. cli, react, nextjs, node, monorepo, base)\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"new plugin\",\n\t\tdescription: \"Scaffold a new @theholocron/holocron-plugin-<slug> package\",\n\t\tpositionals: [\n\t\t\t{ key: \"slug\", message: \"Package slug (kebab-case):\", type: \"input\" },\n\t\t\t{ key: \"vendor\", message: \"Vendor display name (PascalCase):\", type: \"input\" },\n\t\t],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"skills install\",\n\t\tdescription: \"Copy skills from @theholocron/skills into .agents/ with agent symlinks\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"skills remove\",\n\t\tdescription: \"Remove installed skills via npx skills remove\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"skills update\",\n\t\tdescription: \"Update installed skills to their latest upstream versions via npx skills update\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo upgrade node\",\n\t\tdescription: \"Scan the repo and update every Node.js version pin to a new major\",\n\t\tpositionals: [{ key: \"to\", message: \"Target Node.js major version:\", type: \"input\", validate: numeric }],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"repo upgrade deps\",\n\t\tdescription: \"Bump every @theholocron/* pin to latest and migrate holocron.config.ts to the current preset API\",\n\t\tpositionals: [],\n\t\tsupportsDryRun: true,\n\t},\n\t{\n\t\tname: \"auth set\",\n\t\tdescription: \"Verify + store a bootstrap token for a provider\",\n\t\tpositionals: [{ key: \"provider\", message: \"Provider name:\", type: \"input\" }],\n\t},\n\t{\n\t\tname: \"auth unset\",\n\t\tdescription: \"Remove a stored bootstrap token\",\n\t\tpositionals: [{ key: \"provider\", message: \"Provider:\", type: \"select\", choices: listStoredProviders }],\n\t},\n\t{\n\t\tname: \"auth check\",\n\t\tdescription: \"Re-verify a stored bootstrap token\",\n\t\tpositionals: [{ key: \"provider\", message: \"Provider:\", type: \"select\", choices: listStoredProviders }],\n\t},\n\t{\n\t\tname: \"auth list\",\n\t\tdescription: \"List every provider with a stored bootstrap token\",\n\t\tpositionals: [],\n\t},\n];\n\n/** Look up a {@link CommandEntry} by its full name — for Layer 3 call sites in `cli.ts`. */\nexport function getEntry(name: string): CommandEntry {\n\tconst entry = COMMAND_REGISTRY.find((e) => e.name === name);\n\tif (!entry) throw new Error(`interactive-menu: no COMMAND_REGISTRY entry named \"${name}\"`);\n\treturn entry;\n}\n","import type { MenuItem } from \"../../ui/index.js\";\nimport type { CommandEntry } from \"../command-registry/index.js\";\n\n/** Prefix of a menu item's `value` that opens a submenu rather than running a command. */\nexport const GROUP = \"group:\";\n/** The \"← back\" item's value; only offered below the first level. */\nexport const BACK = \"back\";\n\n/**\n * One level of the menu, derived from the registered command names: the next word\n * of every entry under `path` (`[]` is the top). A word is\n *\n * - a **command** when nothing is nested under it (`doctor`);\n * - a **group** when commands are nested under it (`repo` → `repo setup`, `repo sync`, …),\n * which can nest as deep as the names go (`repo upgrade` → `repo upgrade node`);\n *\n * Every row is a single word, never a \"<command> <subcommand>\" path: `config show` is\n * `config ›` then `show`, even when a group holds just one command.\n *\n * A path that is itself runnable (`repo sync`, `deploy`) gets a leading \"<word> (run it)\" item.\n * Registration order is kept.\n */\nexport function menuItems(entries: CommandEntry[], path: string[] = []): MenuItem[] {\n\tconst prefix = path.join(\" \");\n\tconst own = prefix ? entries.find((e) => e.name === prefix) : undefined;\n\tconst under = prefix ? entries.filter((e) => e.name.startsWith(`${prefix} `)) : entries;\n\tconst haystackOf = (list: CommandEntry[]): string =>\n\t\tlist.map((e) => `${e.name} ${e.description}`.toLowerCase()).join(\" \");\n\n\tconst items: MenuItem[] = [];\n\tif (own) {\n\t\titems.push({\n\t\t\tname: `${path[path.length - 1]!} (run it)`,\n\t\t\tvalue: own.name,\n\t\t\tdescription: own.description,\n\t\t\thaystack: haystackOf([own]),\n\t\t});\n\t}\n\tconst words = [...new Set(under.map((e) => e.name.split(\" \")[path.length]!))];\n\tfor (const word of words) {\n\t\tconst full = [...path, word].join(\" \");\n\t\tconst family = under.filter((e) => e.name === full || e.name.startsWith(`${full} `));\n\t\tconst self = family.find((e) => e.name === full);\n\t\tconst nested = family.filter((e) => e.name !== full);\n\t\tif (nested.length === 0 && self) {\n\t\t\titems.push({ name: word, value: full, description: self.description, haystack: haystackOf([self]) });\n\t\t} else {\n\t\t\tconst children = [...new Set(nested.map((e) => e.name.split(\" \")[path.length + 1]!))];\n\t\t\titems.push({\n\t\t\t\tname: `${word} ›`,\n\t\t\t\tvalue: `${GROUP}${full}`,\n\t\t\t\tdescription: children.join(\", \"),\n\t\t\t\thaystack: haystackOf(family),\n\t\t\t});\n\t\t}\n\t}\n\treturn items;\n}\n","import { spawn } from \"node:child_process\";\n\nimport { confirm } from \"@inquirer/prompts\";\n\nimport { NonInteractiveError, pickMenuItem, promptForPositionals } from \"../../ui/index.js\";\nimport { buildChildArgv } from \"../child-argv/index.js\";\nimport type { CommandEntry } from \"../command-registry/index.js\";\nimport { BACK, GROUP, menuItems } from \"../menu-items/index.js\";\n\n/**\n * Set on a dry-run preview child's env ({@link spawnChild}'s `extraEnv`) so\n * its handler knows this specific `--dry-run` came from `launchMenu`'s own\n * preview-then-ask flow, not a direct `holocron <cmd> --dry-run` invocation.\n * A handler that supports it uses this — never bare `argv.dryRun` — to\n * decide whether to report {@link DRY_RUN_NOOP_EXIT_CODE}: that exit code\n * only has special meaning to `launchMenu` itself, so a direct/scripted\n * `--dry-run` call must never produce it — doing so unconditionally would\n * silently change the public exit-code contract for a successful dry run.\n */\nexport const DRY_RUN_PREVIEW_ENV_VAR = \"HOLOCRON_DRY_RUN_PREVIEW\";\n\n/**\n * Reserved exit code a dry-run-capable handler may use — only when {@link\n * DRY_RUN_PREVIEW_ENV_VAR} is set — to report \"ran clean, nothing would\n * change.\" `launchMenu` treats it as success but skips the \"proceed with\n * the real run?\" question, since there's nothing for the real run to do\n * either.\n */\nexport const DRY_RUN_NOOP_EXIT_CODE = 2;\n\n/**\n * Spawn `holocron <...args>` inheriting stdio; resolve with its exit code.\n *\n * `NO_UPDATE_NOTIFIER` is forced on in the child's env — the parent's own\n * update-notifier tail still runs after this resolves (see `launchMenu`'s\n * docstring), so without this the freshly-spawned child independently runs\n * its own `checkForUpdates()` too and the notice prints twice: once from\n * the child right after its command output, once more from the parent\n * once the child exits. `extraEnv` layers on top — used only for {@link\n * DRY_RUN_PREVIEW_ENV_VAR} on the dry-run preview spawn.\n */\nfunction spawnChild(args: string[], extraEnv?: Record<string, string>): Promise<number> {\n\treturn new Promise((resolve) => {\n\t\tconst child = spawn(process.execPath, [process.argv[1]!, ...args], {\n\t\t\tstdio: \"inherit\",\n\t\t\tenv: { ...process.env, NO_UPDATE_NOTIFIER: \"1\", ...extraEnv },\n\t\t});\n\t\tchild.on(\"exit\", (code) => resolve(code ?? 0));\n\t\tchild.on(\"error\", () => resolve(1));\n\t});\n}\n\n/**\n * Whether `launchMenu` should auto-preview a picked command before running\n * it for real — only when the command's handler actually honours\n * `--dry-run` ({@link CommandEntry.supportsDryRun}) and the top-level\n * invocation didn't pass `--skip-dry-run` to opt out of the preview\n * entirely (an escape hatch for \"I already know what I want, skip\n * straight to the real run\").\n */\nexport function shouldPreviewDryRun(entry: CommandEntry, parentArgv: Record<string, unknown>): boolean {\n\treturn Boolean(entry.supportsDryRun) && parentArgv.skipDryRun !== true;\n}\n\n/**\n * Layers 1 and 2: walk the nested menu over `entries` (starting at `startPath`,\n * `[]` for the top), prompt for the picked command's required positionals, spawn\n * it as a fresh `holocron` invocation, and set `process.exitCode` from the child —\n * the caller (a `$0` handler in `cli.ts`) returns normally afterward so the\n * parent's own telemetry flush / update-notifier tail still runs. The parent's\n * own `command_completed` event fires with command name \"unknown\" (the middleware\n * ran before any command was picked) — left as-is rather than suppressed; it's a\n * real, useful signal (\"the menu got used\").\n *\n * Picking a group opens its submenu, which has a \"← back\" item; a command ends\n * the walk. See {@link menuItems} for how a level is built.\n *\n * For a command that honours `--dry-run` ({@link CommandEntry.supportsDryRun})\n * and wasn't opted out via `--skip-dry-run` ({@link shouldPreviewDryRun}),\n * this always previews first — a dry run doesn't mutate anything, so\n * there's nothing to ask permission for. A preview that exits non-zero\n * stops here; one that reports {@link DRY_RUN_NOOP_EXIT_CODE} (nothing\n * would change) stops here too, skipping the follow-up question since the\n * real run would have nothing to do either. Otherwise it asks \"proceed\n * with the real run?\" before the real spawn — the one actual decision\n * left to make, since this one does mutate something.\n */\nexport async function launchMenu(\n\tentries: CommandEntry[],\n\tparentArgv: Record<string, unknown>,\n\tpickMessage?: string,\n\tnonInteractiveMessage = \"Run `holocron --help` to see available commands.\",\n\tstartPath: string[] = []\n): Promise<void> {\n\tif (!process.stdin.isTTY) {\n\t\tthrow new NonInteractiveError(nonInteractiveMessage);\n\t}\n\tconst stack: string[][] = [startPath];\n\tlet picked: CommandEntry | undefined;\n\twhile (!picked) {\n\t\tconst path = stack[stack.length - 1]!;\n\t\tconst items = menuItems(entries, path);\n\t\tif (stack.length > 1) {\n\t\t\titems.push({ name: \"← back\", value: BACK, description: \"Return to the previous menu\", haystack: \"back\" });\n\t\t}\n\t\tconst message = stack.length === 1 ? pickMessage : `${path.join(\" \")} — choose a subcommand:`;\n\t\tconst value = await pickMenuItem(items, message);\n\t\tif (value === BACK) {\n\t\t\tstack.pop();\n\t\t} else if (value.startsWith(GROUP)) {\n\t\t\tstack.push(value.slice(GROUP.length).split(\" \"));\n\t\t} else {\n\t\t\t// `value` is drawn from `items`, which are built from `entries`, so this is always defined.\n\t\t\tpicked = entries.find((e) => e.name === value);\n\t\t}\n\t}\n\tconst positionals = await promptForPositionals(picked, {});\n\n\tif (shouldPreviewDryRun(picked, parentArgv)) {\n\t\tconst dryExit = await spawnChild(buildChildArgv(picked, positionals, parentArgv, true), {\n\t\t\t[DRY_RUN_PREVIEW_ENV_VAR]: \"1\",\n\t\t});\n\t\tif (dryExit === DRY_RUN_NOOP_EXIT_CODE) {\n\t\t\tprocess.exitCode = 0;\n\t\t\treturn;\n\t\t}\n\t\tif (dryExit !== 0) {\n\t\t\tprocess.exitCode = dryExit;\n\t\t\treturn;\n\t\t}\n\t\tconst proceed = await confirm({ message: \"Dry run complete — proceed with the real run?\", default: false });\n\t\tif (!proceed) {\n\t\t\tprocess.exitCode = 0;\n\t\t\treturn;\n\t\t}\n\t\tprocess.exitCode = await spawnChild(buildChildArgv(picked, positionals, parentArgv, false));\n\t\treturn;\n\t}\n\n\tprocess.exitCode = await spawnChild(buildChildArgv(picked, positionals, parentArgv));\n}\n","import { createAstromech } from \"@theholocron/astromech\";\nimport { loadTasksConfig } from \"@theholocron/astromech/config\";\n\nimport type { CommandEntry } from \"../command-registry/index.js\";\n\n/**\n * This repo's own resolved task manifest, filtered to what's actually\n * runnable locally — `Astromech.runnableTasks()`, reused rather than\n * reimplemented (deliberately *not* `packageScripts()`, whose\n * `syncScripts: false` short-circuit returns `{}` for repos — this one\n * included — that opt out of generated `package.json` scripts but still\n * have real runnable tasks). Empty (never throws) when there's no config to\n * resolve — feeds {@link buildRunMenuEntries}, which renders an empty list\n * as \"run ›\" simply having no children.\n */\nexport async function listRunnableTasks(argv: Record<string, unknown>): Promise<string[]> {\n\tconst cwd = typeof argv.cwd === \"string\" ? argv.cwd : process.cwd();\n\tconst config = await loadTasksConfig(cwd).catch(() => undefined);\n\treturn createAstromech({ cwd, config }).runnableTasks();\n}\n\n/**\n * Namespace display order for the `run` menu — deliberately its own thing,\n * not `@theholocron/astromech`'s `CI_ORDER`: that one is tuned for \"cheapest\n * signal first\" in an automated gate, a different goal from \"how a person\n * would naturally work through a repo\" (build it, clean up its style, check\n * it's secure, test it, validate it, document it). A namespace absent here\n * (a repo-specific one this list doesn't know about) sorts after every\n * named one, in whatever order it was first seen.\n */\nconst RUN_MENU_NAMESPACE_ORDER = [\"delivery\", \"sourceQuality\", \"security\", \"verification\", \"platform\", \"knowledge\"];\n\n/**\n * Splits `taskNames` (`\"sourceQuality.staticAnalysis\"`, …) into namespace\n * groups, ordered by {@link RUN_MENU_NAMESPACE_ORDER} — insertion order\n * within each group is `taskNames`' own order (already declaration order,\n * from {@link listRunnableTasks}). A name with no `.` at all (defensive;\n * every real registry task has a namespace) is its own bucket, keyed by the\n * full name, sorted after every namespaced group.\n */\nfunction groupByNamespace(taskNames: string[]): Map<string, string[]> {\n\tconst groups = new Map<string, string[]>();\n\tfor (const name of taskNames) {\n\t\tconst dot = name.indexOf(\".\");\n\t\tconst key = dot === -1 ? name : name.slice(0, dot);\n\t\tconst list = groups.get(key);\n\t\tif (list) list.push(name);\n\t\telse groups.set(key, [name]);\n\t}\n\tconst ordered = new Map<string, string[]>();\n\tconst byMenuOrder = (a: string, b: string) => {\n\t\tconst ia = RUN_MENU_NAMESPACE_ORDER.indexOf(a);\n\t\tconst ib = RUN_MENU_NAMESPACE_ORDER.indexOf(b);\n\t\tif (ia !== -1 || ib !== -1) return (ia === -1 ? Infinity : ia) - (ib === -1 ? Infinity : ib);\n\t\treturn 0; // neither is known — keep Map's own insertion (first-seen) order\n\t};\n\tfor (const key of [...groups.keys()].sort(byMenuOrder)) ordered.set(key, groups.get(key)!);\n\treturn ordered;\n}\n\n/**\n * Dynamically-built `run` sub-entries for every locally-runnable task\n * ({@link listRunnableTasks}), grouped by namespace and merged into\n * `COMMAND_REGISTRY` at `cli.ts`'s `$0` call site — not a registry entry\n * itself, since the task set is per-repo, not a static surface this module\n * can hand-enumerate.\n *\n * Each namespace becomes a group with a leading \"<namespace> (run it)\" item\n * (`holocron run <namespace>` — every task in it, via\n * `Astromech.runGroup()`) alongside each of its individual tasks, the exact\n * same \"a group that's also runnable\" shape `menuItems` already renders for\n * `repo sync` / `deploy` — reached here for free by using a space, not the\n * task's own `.`, between namespace and leaf in `name` (`spawnArgs` carries\n * the real dotted invocation `buildChildArgv` actually spawns).\n */\nexport function buildRunMenuEntries(taskNames: string[]): CommandEntry[] {\n\tconst entries: CommandEntry[] = [];\n\tfor (const [namespace, tasks] of groupByNamespace(taskNames)) {\n\t\tconst isRealNamespace = tasks[0] !== namespace || tasks.length > 1;\n\t\tif (isRealNamespace) {\n\t\t\tentries.push({\n\t\t\t\tname: `run ${namespace}`,\n\t\t\t\tdescription: `Run every ${namespace}.* task in sequence`,\n\t\t\t\tpositionals: [],\n\t\t\t\tsupportsDryRun: true,\n\t\t\t\tspawnArgs: [\"run\", namespace],\n\t\t\t});\n\t\t}\n\t\tfor (const task of tasks) {\n\t\t\tconst leaf = task === namespace ? namespace : task.slice(namespace.length + 1);\n\t\t\tentries.push({\n\t\t\t\tname: isRealNamespace ? `run ${namespace} ${leaf}` : `run ${leaf}`,\n\t\t\t\tdescription: `Run ${task}`,\n\t\t\t\tpositionals: [],\n\t\t\t\tsupportsDryRun: true,\n\t\t\t\tspawnArgs: [\"run\", task],\n\t\t\t});\n\t\t}\n\t}\n\treturn entries;\n}\n","import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport chalk from \"chalk\";\n\nimport { env } from \"../env/index.js\";\nimport type { CacheEntry } from \"./update-notifier.type.js\";\n\nconst PACKAGE_NAME = \"@theholocron/cli\";\nconst CACHE_TTL_MS = 24 * 60 * 60 * 1000;\nconst FETCH_TIMEOUT_MS = 3000;\n\nfunction getCacheDir(): string {\n\treturn env.get(\"HOLOCRON_CACHE_DIR\") ?? join(homedir(), \".cache\", \"holocron\");\n}\n\nfunction getCachePath(): string {\n\treturn join(getCacheDir(), \"update-check.json\");\n}\n\nfunction readCache(): CacheEntry | null {\n\ttry {\n\t\treturn JSON.parse(readFileSync(getCachePath(), \"utf8\")) as CacheEntry;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction writeCache(entry: CacheEntry): void {\n\ttry {\n\t\tmkdirSync(getCacheDir(), { recursive: true });\n\t\twriteFileSync(getCachePath(), JSON.stringify(entry));\n\t} catch {\n\t\t// silently ignore — update check is best-effort\n\t}\n}\n\nasync function fetchLatestVersion(channel: string): Promise<string | null> {\n\ttry {\n\t\tconst res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}`, {\n\t\t\tsignal: AbortSignal.timeout(FETCH_TIMEOUT_MS),\n\t\t});\n\t\tif (!res.ok) return null;\n\t\tconst data = (await res.json()) as { \"dist-tags\": Record<string, string> };\n\t\treturn data[\"dist-tags\"][channel] ?? data[\"dist-tags\"][\"latest\"] ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction getChannel(version: string): string {\n\tconst match = /^[^-]+-([a-zA-Z]+)/.exec(version);\n\treturn match?.[1] ?? \"latest\";\n}\n\nexport function isUpdateAvailable(current: string, latest: string): boolean {\n\tconst normalize = (v: string) => v.replace(/^v/, \"\");\n\tconst c = normalize(current);\n\tconst l = normalize(latest);\n\tif (c === l) return false;\n\n\tconst splitPre = (v: string): [string, string] => {\n\t\tconst idx = v.indexOf(\"-\");\n\t\treturn idx === -1 ? [v, \"\"] : [v.slice(0, idx), v.slice(idx + 1)];\n\t};\n\n\tconst [cRelease, cPre] = splitPre(c);\n\tconst [lRelease, lPre] = splitPre(l);\n\n\tconst parseRelease = (r: string) => r.split(\".\").map(Number);\n\tconst cParts = parseRelease(cRelease);\n\tconst lParts = parseRelease(lRelease);\n\n\tfor (let i = 0; i < Math.max(cParts.length, lParts.length); i++) {\n\t\tconst cv = cParts[i] ?? 0;\n\t\tconst lv = lParts[i] ?? 0;\n\t\tif (lv > cv) return true;\n\t\tif (lv < cv) return false;\n\t}\n\n\t// Release parts equal — compare prerelease\n\tif (!lPre && cPre) return true; // stable > prerelease\n\tif (lPre && !cPre) return false; // prerelease < stable\n\n\t// Both prerelease — compare segment by segment\n\tconst cPreParts = cPre.split(\".\");\n\tconst lPreParts = lPre.split(\".\");\n\tfor (let i = 0; i < Math.max(cPreParts.length, lPreParts.length); i++) {\n\t\tconst cv = cPreParts[i] ?? \"\";\n\t\tconst lv = lPreParts[i] ?? \"\";\n\t\tconst cvNum = Number(cv);\n\t\tconst lvNum = Number(lv);\n\t\tif (!isNaN(cvNum) && !isNaN(lvNum)) {\n\t\t\tif (lvNum > cvNum) return true;\n\t\t\tif (lvNum < cvNum) return false;\n\t\t} else {\n\t\t\tif (lv > cv) return true;\n\t\t\tif (lv < cv) return false;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction formatNotice(current: string, latest: string): string {\n\tconst installCmd = `npm install -g ${PACKAGE_NAME}`;\n\t// Measure raw strings before applying chalk so we avoid control-char regexes.\n\tconst raw1 = `Update available: ${current} → ${latest}`;\n\tconst raw2 = `Run ${installCmd} to update`;\n\tconst width = Math.max(raw1.length, raw2.length) + 4;\n\tconst bar = chalk.yellow(\"─\".repeat(width));\n\tconst border = chalk.yellow(\"│\");\n\tconst pad = (raw: string, styled: string) => `${border} ${styled}${\" \".repeat(width - 2 - raw.length)} ${border}`;\n\treturn [\n\t\t\"\",\n\t\tchalk.yellow(`╭${bar}╮`),\n\t\tpad(raw1, `Update available: ${chalk.dim(current)} → ${chalk.green(latest)}`),\n\t\tpad(raw2, `Run ${chalk.cyan(installCmd)} to update`),\n\t\tchalk.yellow(`╰${bar}╯`),\n\t\t\"\",\n\t].join(\"\\n\");\n}\n\nexport async function checkForUpdates(currentVersion: string): Promise<(() => void) | null> {\n\tif (env.get(\"CI\") || env.get(\"NO_UPDATE_NOTIFIER\")) return null;\n\n\tconst channel = getChannel(currentVersion);\n\tconst cache = readCache();\n\tconst now = Date.now();\n\n\tlet latestVersion: string | null = null;\n\n\tif (cache && now - cache.checkedAt < CACHE_TTL_MS) {\n\t\tlatestVersion = cache.latestVersion;\n\t} else {\n\t\tlatestVersion = await fetchLatestVersion(channel);\n\t\tif (latestVersion) writeCache({ latestVersion, checkedAt: now });\n\t}\n\n\tif (!latestVersion || !isUpdateAvailable(currentVersion, latestVersion)) return null;\n\n\treturn () => {\n\t\tprocess.stderr.write(formatNotice(currentVersion, latestVersion as string) + \"\\n\");\n\t};\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { confirm, input, select } from \"@inquirer/prompts\";\nimport { createAstromech, deployOnRelease } from \"@theholocron/astromech\";\nimport { loadTasksConfig } from \"@theholocron/astromech/config\";\nimport { lintCommitMsgFile } from \"@theholocron/astromech/lint\";\nimport { LOG_LEVELS, type LogLevel } from \"@theholocron/observability/core\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport {\n\tAuthError,\n\tcreateFeatureResolver,\n\ttype ParsedTokenArgs,\n\tparseTokenArgs,\n\tTokenParseError,\n} from \"./auth/index.js\";\nimport { runAuthCheck, runAuthList, runAuthSet, runAuthUnset } from \"./commands/auth/index.js\";\nimport { runCleanupPreview } from \"./commands/cleanup-preview/index.js\";\nimport { parseCloneTarget, runClone, type WholeOrgScope } from \"./commands/clone/index.js\";\nimport { commandsInContext } from \"./commands/contexts/index.js\";\nimport { runDeploy, runDeployFromFiles } from \"./commands/deploy/index.js\";\nimport { runDoctor } from \"./commands/doctor/index.js\";\nimport { runMonitoringCheck } from \"./commands/monitoring-check/index.js\";\nimport { NewError, parseTopics, runNew, validateRepoName } from \"./commands/new/index.js\";\nimport { runNpmBumpVersions } from \"./commands/npm-bump-versions/index.js\";\nimport { PluginCreateError, resolvePluginCreateInputs, runPluginCreate } from \"./commands/plugin-create/index.js\";\nimport { runPublish, runSteadyPublish, runSyncTrust } from \"./commands/publish/index.js\";\nimport { runSecretSet } from \"./commands/secret-set/index.js\";\nimport { runSecretsSync } from \"./commands/secrets-sync/index.js\";\nimport { runSetup } from \"./commands/setup/index.js\";\nimport { runSkillsInstall, runSkillsRemove, runSkillsUpdate } from \"./commands/skills/index.js\";\nimport { runSync } from \"./commands/sync/index.js\";\nimport { runSyncGithub } from \"./commands/sync-github/index.js\";\nimport { runSyncReadme } from \"./commands/sync-readme/index.js\";\nimport { runUpgradeDeps } from \"./commands/upgrade-deps/index.js\";\nimport { runUpgradeNode } from \"./commands/upgrade-node/index.js\";\nimport { loadConfig, type TelemetryConfig } from \"./config/index.js\";\nimport { env } from \"./env/index.js\";\nimport {\n\tbuildRunMenuEntries,\n\tCOMMAND_REGISTRY,\n\tDRY_RUN_NOOP_EXIT_CODE,\n\tDRY_RUN_PREVIEW_ENV_VAR,\n\tgetEntry,\n\tlaunchMenu,\n\tlistRunnableTasks,\n} from \"./interactive-menu/index.js\";\nimport { buildCliLogger, type BuildCliLoggerOpts, getRunId, reportError } from \"./observability/logger/index.js\";\nimport {\n\tapplyConfig,\n\tcaptureException,\n\tendSession,\n\tflush,\n\tinit,\n\tstartCommand,\n} from \"./observability/telemetry/index.js\";\nimport { CARDINALITY } from \"./plugin/index.js\";\nimport { NonInteractiveError, openPath, promptForPositionals, style, viewJson } from \"./ui/index.js\";\nimport { checkForUpdates } from \"./update-notifier/index.js\";\n\nconst resolveCloneToken = createFeatureResolver({ envName: \"HOLOCRON_READ_TOKEN\", keyringKey: \"github.read\" });\nconst resolveSyncToken = createFeatureResolver({ envName: \"HOLOCRON_SYNC_TOKEN\", keyringKey: \"github.sync\" });\n\n/**\n * Error class names whose `.message` is a complete, actionable sentence —\n * the top-level catch prints it and suppresses the stack trace.\n */\nconst USER_FACING_ERRORS = new Set([\"WorkspaceContextError\", \"ConfigFileError\", \"NonInteractiveError\"]);\n\nconst { version: CLI_VERSION } = JSON.parse(readFileSync(new URL(\"../package.json\", import.meta.url), \"utf-8\")) as {\n\tversion: string;\n};\n\n/** Whether to print the correlation id at command end (`--debug` / `--verbose`). */\nlet printRunId = false;\n\n/**\n * Resolves the active org in priority order:\n * 1. `--org` CLI flag\n * 2. `HOLOCRON_ORG` env var\n * 3. `org` from `holocron.config.ts`\n */\nfunction resolveOrg(argv: { org?: string }, config: { org?: string }): string | undefined {\n\treturn argv.org ?? env.get(\"HOLOCRON_ORG\") ?? config.org;\n}\n\n/**\n * Print the dim version line once per terminal session — keyed by the\n * parent shell's PID, since that's stable across repeated bare `holocron`\n * invocations in the same shell but changes in a new tab/window. A marker\n * file in the OS tmpdir tracks whether this shell has already seen it, so\n * re-running `holocron` doesn't repeat the line every time.\n */\nfunction printVersionHeaderOnce(): void {\n\tconst marker = join(tmpdir(), `.holocron-version-shown-${process.ppid}`);\n\tif (existsSync(marker)) return;\n\tconsole.log(style.dim(`v${CLI_VERSION}`));\n\twriteFileSync(marker, \"\");\n}\n\n/**\n * `buildCliLogger` options derived from a loaded `holocron.config` — the\n * level, the Axiom dataset, and the resolved org for a keyring-backed\n * Axiom token. Used by every handler that has already called `loadConfig`.\n */\nfunction cliLoggerOpts(\n\targv: { org?: string; verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\tresolved: { org?: string; log?: { level?: LogLevel; axiom?: { dataset?: string } } }\n): BuildCliLoggerOpts {\n\treturn {\n\t\tconfigLevel: resolved.log?.level,\n\t\tconfigAxiomDataset: resolved.log?.axiom?.dataset,\n\t\torg: resolveOrg(argv, resolved),\n\t};\n}\n\n/**\n * Fold a loaded `holocron.config` into the running process: reconfigure the\n * logger from `log:`, then apply the `telemetry:` override layer. Every handler\n * that has called `loadConfig` runs this, so a repo's `telemetry.enabled: false`\n * (or `analytics: \"none\"`) is honoured for that command. Env still wins —\n * `applyConfig` only narrows what `init` already turned on.\n */\nfunction applyResolvedConfig(\n\targv: { org?: string; verbose?: boolean; quiet?: boolean; log?: LogLevel },\n\tresolved: {\n\t\torg?: string;\n\t\tlog?: { level?: LogLevel; axiom?: { dataset?: string } };\n\t\ttelemetry?: TelemetryConfig;\n\t}\n): void {\n\tbuildCliLogger(argv, cliLoggerOpts(argv, resolved));\n\tapplyConfig(resolved.telemetry);\n}\n\n/** Parses --token values and returns the context spread, or null on parse error (exits with code 1). */\nfunction tokenContext(rawTokens: string[] | undefined): ParsedTokenArgs | null {\n\tif (!rawTokens?.length) return {};\n\ttry {\n\t\treturn parseTokenArgs(rawTokens);\n\t} catch (err) {\n\t\tif (err instanceof TokenParseError) {\n\t\t\treportError(`--token: ${err.message}`);\n\t\t\tprocess.exitCode = 1;\n\t\t\treturn null;\n\t\t}\n\t\tthrow err;\n\t}\n}\n\n/** Layer 2: a bare group command (`holocron repo`, `holocron repo upgrade`, …) opens the menu at that level. */\nasync function launchGroupMenu(parent: string, argv: Record<string, unknown>): Promise<void> {\n\tawait launchMenu(\n\t\tCOMMAND_REGISTRY,\n\t\targv,\n\t\t`${parent} — choose a subcommand:`,\n\t\t`Run \\`holocron ${parent} --help\\` to see available ${parent} subcommands.`,\n\t\tparent.split(\" \")\n\t);\n}\n\ninit(CLI_VERSION);\nconst updateCheckPromise = checkForUpdates(CLI_VERSION);\n\nlet finishCommand: (ok: boolean) => void = () => {};\n/** Set by `.fail()` once it has printed an error, so the outer catch doesn't repeat it. */\nlet errorReported = false;\n\ntry {\n\tawait yargs(hideBin(process.argv))\n\t\t.scriptName(\"\")\n\t\t.usage(\"holocron <command> [options]\")\n\t\t.version(CLI_VERSION)\n\t\t.alias(\"version\", \"v\")\n\t\t// Keep everything after `--` in `argv['--']` instead of folding it into\n\t\t// `argv._`. `holocron run <task> [job] -- <args>` forwards `<args>` to the\n\t\t// underlying tool (`lhci autorun --config=…`, `turbo run build -- …`); the\n\t\t// telemetry command name reads `argv._` and must not pick these up.\n\t\t.parserConfiguration({ \"populate--\": true })\n\t\t// ── global options (apply to every subcommand) ──────────────────────\n\t\t.option(\"dry-run\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe:\n\t\t\t\t\"Print what would be mutated without calling capability mutators. \" +\n\t\t\t\t\"Commands branch on this; read-only commands ignore it.\",\n\t\t})\n\t\t.option(\"skip-dry-run\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe:\n\t\t\t\t\"Interactive mode only: skip the automatic dry-run preview for a \" +\n\t\t\t\t\"dry-run-capable command and run for real immediately.\",\n\t\t})\n\t\t.option(\"token\", {\n\t\t\ttype: \"string\",\n\t\t\tarray: true,\n\t\t\tdescribe:\n\t\t\t\t\"Vendor token override for plugins. \" +\n\t\t\t\t\"Bare form: --token <value> (fallback for all plugins, single-plugin commands). \" +\n\t\t\t\t\"Keyed form: --token vendor=value (targets a specific provider; repeat for each). \" +\n\t\t\t\t\"Example: --token github=ghp_xxx --token vercel=v_yyy\",\n\t\t})\n\t\t.option(\"org\", {\n\t\t\ttype: \"string\",\n\t\t\tdescribe:\n\t\t\t\t\"Active org name for namespaced keyring lookup. \" +\n\t\t\t\t\"Overrides HOLOCRON_ORG env var and the `org` field in holocron.config.ts. \" +\n\t\t\t\t\"Example: --org theholocron\",\n\t\t})\n\t\t.option(\"cwd\", {\n\t\t\ttype: \"string\",\n\t\t\tdefault: process.cwd(),\n\t\t\tdescribe: \"Directory to search for holocron.config.json\",\n\t\t})\n\t\t.option(\"verbose\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe: \"Set the log level to debug — full structured operational output.\",\n\t\t})\n\t\t.option(\"debug\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe: \"Print the run ID at command end for Axiom lookup. Does not change the log level.\",\n\t\t})\n\t\t.option(\"quiet\", {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t\tdescribe: \"Set the log level to error — suppress info and warn.\",\n\t\t})\n\t\t.option(\"log\", {\n\t\t\ttype: \"string\",\n\t\t\tchoices: LOG_LEVELS,\n\t\t\tdescribe:\n\t\t\t\t\"Show structured logger output at this level. Local/interactive runs are \" +\n\t\t\t\t\"quiet by default (no console output regardless of level) — this opts back in.\",\n\t\t})\n\t\t.middleware((argv) => {\n\t\t\tconst name = (argv._ as string[]).slice(0, 3).join(\" \") || \"unknown\";\n\t\t\tprintRunId = Boolean(argv.debug || argv.verbose);\n\t\t\t// Establish the root logger first (command name + flags + env) so its\n\t\t\t// `runId` is available to tag telemetry events. Handlers that load a\n\t\t\t// config call `buildCliLogger(argv, { configLevel })` again to fold in\n\t\t\t// the lowest-priority level + Axiom-dataset sources.\n\t\t\tbuildCliLogger(argv, { command: name, org: argv.org });\n\t\t\tfinishCommand = startCommand(name);\n\t\t})\n\t\t// ── commands ────────────────────────────────────────────────────────\n\t\t.command(\n\t\t\t\"clone [target]\",\n\t\t\t\"Clone a single repo (org/repo) or every repo in an org (org)\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.positional(\"target\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"org/repo to clone, or a bare org to clone every repo in it (confirms first).\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"dir\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"Parent directory to clone into (default: ~/Code/<org>)\",\n\t\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\tif (!tokens) return;\n\t\t\t\tlet token: string;\n\t\t\t\ttry {\n\t\t\t\t\ttoken = resolveCloneToken({ cliToken: tokens.cliTokens?.[\"github\"] ?? tokens.cliToken });\n\t\t\t\t} catch (err) {\n\t\t\t\t\treportError(`clone: ${err instanceof AuthError ? err.message : String(err)}`);\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst [targetInput] = await promptForPositionals(getEntry(\"clone\"), argv as Record<string, unknown>);\n\t\t\t\tconst { org, repo } = parseCloneTarget(targetInput);\n\t\t\t\tconst report = await runClone({\n\t\t\t\t\torg,\n\t\t\t\t\t...(repo ? { repo } : {}),\n\t\t\t\t\ttoken,\n\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t...(argv.dir ? { dir: argv.dir } : {}),\n\t\t\t\t\t...(!repo\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tconfirmWholeOrg: async ({ total, alreadyCloned, toClone }: WholeOrgScope) => {\n\t\t\t\t\t\t\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\t\t\t\t\t\t\tthrow new NonInteractiveError(\n\t\t\t\t\t\t\t\t\t\t\t`clone: cloning every repo in \"${org}\" needs interactive confirmation — ` +\n\t\t\t\t\t\t\t\t\t\t\t\t`run this from a terminal, or pass a specific org/repo instead`\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (toClone === 0) return true;\n\t\t\t\t\t\t\t\t\treturn confirm({\n\t\t\t\t\t\t\t\t\t\tmessage: `${org} has ${total} repos — ${alreadyCloned} already cloned locally, ${toClone} new. Clone them all?`,\n\t\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tconfirmOpen: async (openTarget: string, moreToCome: boolean) => {\n\t\t\t\t\t\tif (!process.stdin.isTTY) return;\n\t\t\t\t\t\t// A menu-launched preview with something it would actually clone\n\t\t\t\t\t\t// is about to ask \"proceed with the real run?\" — defer to there\n\t\t\t\t\t\t// instead of asking twice for the same directory. A direct\n\t\t\t\t\t\t// --dry-run invocation (no menu involved) has no such follow-up,\n\t\t\t\t\t\t// so it still asks now.\n\t\t\t\t\t\tif (moreToCome && env.get(DRY_RUN_PREVIEW_ENV_VAR) === \"1\") return;\n\t\t\t\t\t\tif (await confirm({ message: `Open ${openTarget}?`, default: false })) openPath(openTarget);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\tif (report.message) reportError(`clone: ${report.message}`);\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t} else if (\n\t\t\t\t\treport.status === \"dry-run\" &&\n\t\t\t\t\treport.cloned === 0 &&\n\t\t\t\t\tenv.get(DRY_RUN_PREVIEW_ENV_VAR) === \"1\"\n\t\t\t\t) {\n\t\t\t\t\tprocess.exitCode = DRY_RUN_NOOP_EXIT_CODE;\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"doctor\",\n\t\t\t\"Load the config and run a smoke check against every provider\",\n\t\t\t(y) =>\n\t\t\t\ty.option(\"repo\", {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdescribe: 'Repo coords (\"owner/name\"). Defaults to plugin-specific resolution.',\n\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\tif (!tokens) return;\n\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\tconst report = await runDoctor({\n\t\t\t\t\tloaded,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo } : {}),\n\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"skills\",\n\t\t\t\"Manage agent skills from the @theholocron/skills registry\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"install\",\n\t\t\t\t\t\t\"Copy skills from @theholocron/skills into .agents/ with agent symlinks\",\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tawait runSkillsInstall({ loaded, context: { repoRoot: argv.cwd, dryRun: argv.dryRun } });\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"remove [names..]\",\n\t\t\t\t\t\t\"Remove installed skills via npx skills remove\",\n\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\tyy.positional(\"names\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tarray: true,\n\t\t\t\t\t\t\t\tdescribe: \"Skill name(s) to remove (omit to remove all installed skills)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t(argv) => {\n\t\t\t\t\t\t\tconst report = runSkillsRemove({\n\t\t\t\t\t\t\t\tcontext: { repoRoot: argv.cwd, dryRun: argv.dryRun },\n\t\t\t\t\t\t\t\t...(argv.names?.length ? { names: argv.names as string[] } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"update [name]\",\n\t\t\t\t\t\t\"Update installed skills to their latest upstream versions via npx skills update\",\n\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\tyy.positional(\"name\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tdescribe: \"Skill name to update (omit to update all installed skills)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t(argv) => {\n\t\t\t\t\t\t\tconst report = runSkillsUpdate({\n\t\t\t\t\t\t\t\tcontext: { repoRoot: argv.cwd, dryRun: argv.dryRun },\n\t\t\t\t\t\t\t\t...(argv.name ? { name: argv.name as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"skills\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"run <task> [job] [passthrough..]\",\n\t\t\t\"Run a task locally (test, typecheck, lint, build, audit) — figures out turbo / the tool / the package manager. `run ci` runs every merge-gating check; `run lint commit-msg <file>` lints a commit message.\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.positional(\"task\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Task name (test, typecheck, lint, build, audit, or `ci` for the merge-gating suite). See `holocron run --help`.\",\n\t\t\t\t\t})\n\t\t\t\t\t.positional(\"job\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Sub-job within the task (e.g. `holocron run audit performance`, `holocron run lint commit-msg <file>`). Omit to run every job.\",\n\t\t\t\t\t})\n\t\t\t\t\t.positional(\"passthrough\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tarray: true,\n\t\t\t\t\t\tdescribe: \"Args forwarded to the tool — put them after `--`.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"required\", {\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescribe: \"Fail (exit 1) if this repo has no such task, instead of skipping.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"all\", {\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescribe: \"With `run ci`: run every `ci: true` task, not just the required ones.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"filter\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"turbo --filter=<pkg> passthrough (monorepo).\",\n\t\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\t// The specific command key (not just `run`) so `contexts.ts` can scope the\n\t\t\t\t// commit-msg hook to the global dataset and `run ci` to the repo's (ADR-0012).\n\t\t\t\tconst commandKey =\n\t\t\t\t\targv.task === \"ci\"\n\t\t\t\t\t\t? \"run ci\"\n\t\t\t\t\t\t: argv.task === \"lint\" && argv.job === \"commit-msg\"\n\t\t\t\t\t\t\t? \"run lint commit-msg\"\n\t\t\t\t\t\t\t: \"run\";\n\t\t\t\tconst { logger } = buildCliLogger(argv, { command: commandKey });\n\t\t\t\tconst passthrough = [\n\t\t\t\t\t...((argv.passthrough as string[] | undefined) ?? []),\n\t\t\t\t\t...((argv[\"--\"] as string[] | undefined) ?? []),\n\t\t\t\t];\n\t\t\t\t// `run lint commit-msg <file>` is the `.husky/commit-msg` hook: a real\n\t\t\t\t// commit-message linter, not astromech's filesystem-driven `lint` task.\n\t\t\t\tif (argv.task === \"lint\" && argv.job === \"commit-msg\") {\n\t\t\t\t\tconst file = passthrough[0];\n\t\t\t\t\tif (!file) {\n\t\t\t\t\t\treportError(\"run lint commit-msg: missing <file> (the commit message file git passes as $1).\");\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await lintCommitMsgFile(file, argv.cwd as string);\n\t\t\t\t\tif (!result.valid) {\n\t\t\t\t\t\tfor (const violation of result.violations) {\n\t\t\t\t\t\t\tconsole.error(`✖ ${violation.rule}: ${violation.message}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// `ci` isn't a manifest task: it's the merge-gating suite, in CI order.\n\t\t\t\tif (argv.task === \"ci\") {\n\t\t\t\t\tconst ciConfig = await loadTasksConfig(argv.cwd as string).catch(() => undefined);\n\t\t\t\t\tconst report = createAstromech({ cwd: argv.cwd, logger, config: ciConfig }).ci({\n\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\tscope: argv.all ? \"all\" : \"required\",\n\t\t\t\t\t\t...(argv.filter ? { filter: argv.filter as string } : {}),\n\t\t\t\t\t});\n\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// The task manifest drives `lint`'s linter set; other tasks are\n\t\t\t\t// filesystem-driven and ignore it. Missing / unparseable config → undefined.\n\t\t\t\tconst config = await loadTasksConfig(argv.cwd as string).catch(() => undefined);\n\t\t\t\tconst astromech = createAstromech({ cwd: argv.cwd, logger, config });\n\t\t\t\tconst report = astromech.run(argv.task as string, {\n\t\t\t\t\t...(argv.job !== undefined ? { job: argv.job as string } : {}),\n\t\t\t\t\tpassthrough,\n\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\trequired: argv.required,\n\t\t\t\t\t...(argv.filter ? { filter: argv.filter as string } : {}),\n\t\t\t\t});\n\t\t\t\tif (report.status === \"fail\" || report.status === \"unknown\") process.exitCode = 1;\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"config show\",\n\t\t\t\"Print the resolved holocron config\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.option(\"depth\", {\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdescribe: \"Collapse objects/arrays nested deeper than N levels (TTY output only)\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"interactive\", {\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Browse the config in a foldable tree (default on a TTY; --no-interactive for static output)\",\n\t\t\t\t\t}),\n\t\t\tasync (argv) => {\n\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\tawait viewJson(loaded.resolved, { depth: argv.depth, interactive: argv.interactive });\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"auth <subcommand>\",\n\t\t\t\"Manage bootstrap credentials in the OS keyring\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"set [provider] [value]\",\n\t\t\t\t\t\t\"Verify + store a bootstrap token for a provider\",\n\t\t\t\t\t\t(yy) => yy.positional(\"provider\", { type: \"string\" }).positional(\"value\", { type: \"string\" }),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [provider] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"auth set\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst result = await runAuthSet({\n\t\t\t\t\t\t\t\tprovider: provider!,\n\t\t\t\t\t\t\t\t...(argv.value ? { positional: argv.value as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.org ? { org: argv.org as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (result.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"unset [provider]\",\n\t\t\t\t\t\t\"Remove a stored bootstrap token\",\n\t\t\t\t\t\t(yy) => yy.positional(\"provider\", { type: \"string\" }),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [provider] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"auth unset\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\trunAuthUnset({ provider: provider! });\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"check [provider]\",\n\t\t\t\t\t\t\"Re-verify a stored bootstrap token\",\n\t\t\t\t\t\t(yy) => yy.positional(\"provider\", { type: \"string\" }),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [provider] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"auth check\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst result = await runAuthCheck({\n\t\t\t\t\t\t\t\tprovider: provider!,\n\t\t\t\t\t\t\t\t...(argv.org ? { org: argv.org as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (result.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"list\",\n\t\t\t\t\t\t\"List every provider with a stored bootstrap token\",\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\tawait runAuthList();\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"auth\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"$0\",\n\t\t\tfalse,\n\t\t\t() => {},\n\t\t\tasync (argv) => {\n\t\t\t\tprintVersionHeaderOnce();\n\t\t\t\tconst runEntries = buildRunMenuEntries(await listRunnableTasks(argv));\n\t\t\t\tawait launchMenu([...COMMAND_REGISTRY, ...runEntries], argv);\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"repo\",\n\t\t\t\"Set up, sync and upgrade the current repo\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"setup\",\n\t\t\t\t\t\t\"Apply infra setup actions across every configured capability\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: 'Repo coords (\"owner/name\"). Defaults to plugin-specific resolution.',\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"hooks\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Install git hooks (.husky/pre-push → holocron run ci). Default: on for protection:'strict'. --no-hooks to skip.\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSetup({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo } : {}),\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t...(argv.hooks !== undefined ? { hooks: argv.hooks as boolean } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"sync [steps..]\",\n\t\t\t\t\t\t\"Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"readme\",\n\t\t\t\t\t\t\t\t\t\"Sync the Installation + Usage block in README.md from package.json\",\n\t\t\t\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\t\t\t\ty.option(\"dry-run\", {\n\t\t\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\t\t\tdescribe: \"Print what would change without writing\",\n\t\t\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\t\t\t\tconst report = await runSyncReadme({\n\t\t\t\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\t\t\t\tcontext: { repoRoot: argv.cwd, dryRun: argv.dryRun },\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\t\t\tif (report.message) reportError(`repo sync readme: ${report.message}`);\n\t\t\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.positional(\"steps\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tarray: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Steps to run: labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki (default: all)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: 'Repo coords (\"owner/name\"). Defaults to plugin-specific resolution.',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSync({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo } : {}),\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t...(argv.steps && argv.steps.length > 0 ? { steps: argv.steps as string[] } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"upgrade\",\n\t\t\t\t\t\t\"Upgrade toolchain version pins across the repo\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"node [to]\",\n\t\t\t\t\t\t\t\t\t\"Scan the repo and update every Node.js version pin to a new major\",\n\t\t\t\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\t\t\t\tyy\n\t\t\t\t\t\t\t\t\t\t\t.positional(\"to\", {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\t\t\t\tdescribe: \"Target Node.js major version (e.g., 22)\",\n\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t.option(\"from\", {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"Current major version to replace. Auto-detected from .nvmrc / engines.node when omitted.\",\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tconst [to] = await promptForPositionals(\n\t\t\t\t\t\t\t\t\t\t\tgetEntry(\"repo upgrade node\"),\n\t\t\t\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t// Read upgrade.node.extra from holocron.config.json if present.\n\t\t\t\t\t\t\t\t\t\t// We read the raw file directly rather than through loadConfig because\n\t\t\t\t\t\t\t\t\t\t// the upgrade config is not part of the plugin schema.\n\t\t\t\t\t\t\t\t\t\tlet extra: string[] = [];\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tconst raw = readFileSync(join(argv.cwd, \"holocron.config.json\"), \"utf8\");\n\t\t\t\t\t\t\t\t\t\t\tconst cfg = JSON.parse(raw) as { upgrade?: { node?: { extra?: unknown } } };\n\t\t\t\t\t\t\t\t\t\t\tconst extraRaw = cfg.upgrade?.node?.extra;\n\t\t\t\t\t\t\t\t\t\t\tif (Array.isArray(extraRaw)) {\n\t\t\t\t\t\t\t\t\t\t\t\textra = extraRaw as string[];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t\t\t/* no config or no upgrade section — fine */\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst report = await runUpgradeNode({\n\t\t\t\t\t\t\t\t\t\t\tto: Number(to),\n\t\t\t\t\t\t\t\t\t\t\t...(argv.from != null ? { from: argv.from as number } : {}),\n\t\t\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t\t\textra,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\t\t\tif (report.message) reportError(`upgrade node: ${report.message}`);\n\t\t\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"deps\",\n\t\t\t\t\t\t\t\t\t\"Bump every @theholocron/* pin to latest and migrate holocron.config.ts to the current preset API\",\n\t\t\t\t\t\t\t\t\t(yy) =>\n\t\t\t\t\t\t\t\t\t\tyy.option(\"pins-only\", {\n\t\t\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\t\t\"Only bump the catalog pins — skip the holocron.config.ts migration\",\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tconst report = await runUpgradeDeps({\n\t\t\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t\t\tpinsOnly: argv.pinsOnly as boolean,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\t\t\tif (report.message) reportError(`upgrade deps: ${report.message}`);\n\t\t\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.command(\n\t\t\t\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t() => {},\n\t\t\t\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\t\t\t\tawait launchGroupMenu(\"repo upgrade\", argv);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t() => {}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"repo\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"new\",\n\t\t\t\"Scaffold a new repo or plugin\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"repo [type] [name]\",\n\t\t\t\t\t\t\"Scaffold a new repo from a GitHub template (e.g. cli, react, nextjs, node, monorepo, base)\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"type\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Template type — maps to theholocron/<type>-template \" +\n\t\t\t\t\t\t\t\t\t\t\"(e.g. cli, react, nextjs, node, monorepo, base)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.positional(\"name\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"New repo name (kebab-case, e.g. my-tool)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"description\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Short description — replaces <description> placeholders in the template\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"homepage\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Homepage URL — replaces <homepage> placeholders and appears in holocron.config.ts\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"vault\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vault provider: none, doppler, 1password, infisical\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"deployment\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Deployment provider: none, vercel\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"agent\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"AI agent: claude, none\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"runtime-environment\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Runtime environment: node, browser, universal, none\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"topics\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Comma-separated repo topics (e.g. typescript,nodejs)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"protection\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Branch protection level: strict, balanced, minimal\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"open-source\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Whether the repo is open source (default: true)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"uses-external-packages\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Whether the repo calls external APIs or services (default: true)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"skills\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Comma-separated agent skill names (e.g. git-safety,pr-workflow)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"is-template\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Mark the new repo as a GitHub template repository\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"org\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"theholocron\",\n\t\t\t\t\t\t\t\t\tdescribe: \"GitHub org that owns the template and will own the new repo\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"verify\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Run pnpm install + holocron repo setup after bootstrapping (--no-verify skips)\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\t\tconst adminToken = tokens.cliTokens?.[\"github\"] ?? tokens.cliToken;\n\n\t\t\t\t\t\t\t\tlet type = argv.type as string | undefined;\n\t\t\t\t\t\t\t\tlet name = argv.name as string | undefined;\n\t\t\t\t\t\t\t\tlet description = argv.description as string | undefined;\n\t\t\t\t\t\t\t\tlet homepage = argv.homepage as string | undefined;\n\t\t\t\t\t\t\t\tlet vaultProvider = argv.vault as string | undefined;\n\t\t\t\t\t\t\t\tlet vaultProject: string | undefined;\n\t\t\t\t\t\t\t\tlet vaultConfig: string | undefined;\n\t\t\t\t\t\t\t\tlet deploymentProvider = argv.deployment as string | undefined;\n\t\t\t\t\t\t\t\tlet agent = argv.agent as string | undefined;\n\t\t\t\t\t\t\t\tlet runtimeEnvironment = argv.runtimeEnvironment as string | undefined;\n\t\t\t\t\t\t\t\tlet topics: string[] = parseTopics(argv.topics as string | undefined);\n\t\t\t\t\t\t\t\tlet protection = argv.protection as string | undefined;\n\t\t\t\t\t\t\t\tlet openSource = argv.openSource as boolean | undefined;\n\t\t\t\t\t\t\t\tlet usesExternalPackages = argv.usesExternalPackages as boolean | undefined;\n\t\t\t\t\t\t\t\tlet skills: string[] = parseTopics(argv.skills as string | undefined);\n\t\t\t\t\t\t\t\tconst isTemplate = argv.isTemplate as boolean | undefined;\n\n\t\t\t\t\t\t\t\t// Interactive wizard — skip any field already supplied as a CLI arg\n\t\t\t\t\t\t\t\tif (!type) {\n\t\t\t\t\t\t\t\t\ttype = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Template type:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"node — Node.js library or tool\", value: \"node\" },\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: \"cli — CLI application (inquirer, chalk, yargs)\",\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: \"cli\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"monorepo — Turbo monorepo\", value: \"monorepo\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"react — React component library\", value: \"react\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"nextjs — Next.js application\", value: \"nextjs\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"base — Minimal repo (no package.json)\", value: \"base\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!name) {\n\t\t\t\t\t\t\t\t\tname = await input({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Repo name (kebab-case):\",\n\t\t\t\t\t\t\t\t\t\tvalidate: validateRepoName,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tname = name.trim();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (description === undefined) {\n\t\t\t\t\t\t\t\t\tdescription = await input({ message: \"Short description:\" });\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (homepage === undefined) {\n\t\t\t\t\t\t\t\t\tconst raw = await input({ message: \"Homepage URL (optional, Enter to skip):\" });\n\t\t\t\t\t\t\t\t\thomepage = raw.trim() || undefined;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!runtimeEnvironment) {\n\t\t\t\t\t\t\t\t\truntimeEnvironment = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Runtime environment:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"node — Node.js process\", value: \"node\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"browser — Browser only\", value: \"browser\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"universal — Node.js + browser\", value: \"universal\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"none — No runtime (docs, config, etc.)\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\tdefault: type === \"base\" ? \"none\" : \"node\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!vaultProvider) {\n\t\t\t\t\t\t\t\t\tvaultProvider = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Vault provider:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"None\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Doppler\", value: \"doppler\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"1Password\", value: \"1password\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Infisical\", value: \"infisical\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (vaultProvider === \"doppler\") {\n\t\t\t\t\t\t\t\t\tvaultProject = await input({ message: \"Doppler project name:\", default: name });\n\t\t\t\t\t\t\t\t\tvaultConfig = await input({ message: \"Doppler config:\", default: \"dev\" });\n\t\t\t\t\t\t\t\t} else if (vaultProvider === \"1password\" || vaultProvider === \"infisical\") {\n\t\t\t\t\t\t\t\t\tvaultProject = await input({\n\t\t\t\t\t\t\t\t\t\tmessage: `${vaultProvider === \"1password\" ? \"1Password vault\" : \"Infisical project\"} name:`,\n\t\t\t\t\t\t\t\t\t\tdefault: name,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!deploymentProvider) {\n\t\t\t\t\t\t\t\t\tdeploymentProvider = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Deployment provider:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"None\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Vercel\", value: \"vercel\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!agent) {\n\t\t\t\t\t\t\t\t\tagent = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"AI agent:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Claude\", value: \"claude\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"None\", value: \"none\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (topics.length === 0) {\n\t\t\t\t\t\t\t\t\tconst raw = await input({ message: \"Topics (comma-separated, optional):\" });\n\t\t\t\t\t\t\t\t\ttopics = parseTopics(raw);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!protection) {\n\t\t\t\t\t\t\t\t\tprotection = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Branch protection:\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"strict — required reviews + passing checks\", value: \"strict\" },\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: \"balanced — required reviews, flexible checks\",\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: \"balanced\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"minimal — branch protection only\", value: \"minimal\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (openSource === undefined) {\n\t\t\t\t\t\t\t\t\tconst ans = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Open source?\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Yes\", value: \"yes\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"No\", value: \"no\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\topenSource = ans === \"yes\";\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (usesExternalPackages === undefined) {\n\t\t\t\t\t\t\t\t\tconst ans = await select({\n\t\t\t\t\t\t\t\t\t\tmessage: \"Uses external APIs or services?\",\n\t\t\t\t\t\t\t\t\t\tchoices: [\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"Yes\", value: \"yes\" },\n\t\t\t\t\t\t\t\t\t\t\t{ name: \"No\", value: \"no\" },\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tusesExternalPackages = ans === \"yes\";\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (skills.length === 0) {\n\t\t\t\t\t\t\t\t\tconst raw = await input({ message: \"Agent skills (comma-separated, optional):\" });\n\t\t\t\t\t\t\t\t\tskills = parseTopics(raw);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!type) {\n\t\t\t\t\t\t\t\t\treportError(\"new: template type is required\");\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!name) {\n\t\t\t\t\t\t\t\t\treportError(\"new: repo name is required\");\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst report = await runNew({\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tdescription: description || undefined,\n\t\t\t\t\t\t\t\t\thomepage,\n\t\t\t\t\t\t\t\t\tvaultProvider:\n\t\t\t\t\t\t\t\t\t\t(vaultProvider as \"doppler\" | \"1password\" | \"infisical\" | \"none\") ?? \"none\",\n\t\t\t\t\t\t\t\t\tvaultProject,\n\t\t\t\t\t\t\t\t\tvaultConfig,\n\t\t\t\t\t\t\t\t\tdeploymentProvider: (deploymentProvider as \"vercel\" | \"none\") ?? \"none\",\n\t\t\t\t\t\t\t\t\tagent: (agent as \"claude\" | \"none\") ?? \"claude\",\n\t\t\t\t\t\t\t\t\truntimeEnvironment:\n\t\t\t\t\t\t\t\t\t\t(runtimeEnvironment as \"node\" | \"browser\" | \"universal\" | \"none\") ?? \"node\",\n\t\t\t\t\t\t\t\t\tprotection: protection ?? \"strict\",\n\t\t\t\t\t\t\t\t\topenSource: openSource ?? true,\n\t\t\t\t\t\t\t\t\tusesExternalPackages: usesExternalPackages ?? true,\n\t\t\t\t\t\t\t\t\ttopics,\n\t\t\t\t\t\t\t\t\tskills,\n\t\t\t\t\t\t\t\t\tisTemplate,\n\t\t\t\t\t\t\t\t\torg: argv.org,\n\t\t\t\t\t\t\t\t\ttoken: adminToken,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\tnoVerify: !argv.verify,\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tif (err instanceof NewError) {\n\t\t\t\t\t\t\t\t\treportError(`new: ${err.message}`);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"plugin [slug] [vendor]\",\n\t\t\t\t\t\t\"Scaffold a new @theholocron/holocron-plugin-<slug> package\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"slug\", { type: \"string\", describe: \"Package slug (kebab-case)\" })\n\t\t\t\t\t\t\t\t.positional(\"vendor\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vendor display name (PascalCase)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"capability\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Capability key: source|ci|secrets|environments|issues|deployment|storage|auth|vault|dns|tooling|notifications|analytics|errors|logs|wiki|workers\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"token-env\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Holocron env var name (defaults to HOLOCRON_<VENDOR>_TOKEN)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"vendor-env\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vendor-native env var name\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"base-url\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"REST base URL\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"verify\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Run post-scaffold pnpm install + typecheck + lint + test (default true; --no-verify skips)\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst [slug, vendor] = await promptForPositionals(\n\t\t\t\t\t\t\t\t\tgetEntry(\"new plugin\"),\n\t\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst { capability, vendorEnv, baseUrl } = await resolvePluginCreateInputs(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcapability: argv.capability as string | undefined,\n\t\t\t\t\t\t\t\t\t\tvendorEnv: argv.vendorEnv as string | undefined,\n\t\t\t\t\t\t\t\t\t\tbaseUrl: argv.baseUrl as string | undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tselectCapability: () =>\n\t\t\t\t\t\t\t\t\t\t\tselect({\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"Capability:\",\n\t\t\t\t\t\t\t\t\t\t\t\tchoices: Object.keys(CARDINALITY).map((k) => ({ name: k, value: k })),\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tinputVendorEnv: () =>\n\t\t\t\t\t\t\t\t\t\t\tinput({\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: `Vendor-native env var for the ${vendor} token (e.g. MYVENDOR_API_KEY):`,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tinputBaseUrl: () =>\n\t\t\t\t\t\t\t\t\t\t\tinput({\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: `REST base URL for the ${vendor} API (e.g. https://api.myvendor.com):`,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst report = runPluginCreate({\n\t\t\t\t\t\t\t\t\tslug: slug!,\n\t\t\t\t\t\t\t\t\tvendorName: vendor!,\n\t\t\t\t\t\t\t\t\tcapability,\n\t\t\t\t\t\t\t\t\tvendorEnv,\n\t\t\t\t\t\t\t\t\tbaseUrl,\n\t\t\t\t\t\t\t\t\t...(argv.tokenEnv ? { tokenEnv: argv.tokenEnv as string } : {}),\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t// Yargs: `--no-verify` flips `argv.verify` to false. We pass\n\t\t\t\t\t\t\t\t\t// the inverse to preserve the internal `noVerify` naming.\n\t\t\t\t\t\t\t\t\tnoVerify: !argv.verify,\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tif (err instanceof PluginCreateError) {\n\t\t\t\t\t\t\t\t\treportError(`plugin create: ${err.message}`);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"new\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"secrets\",\n\t\t\t\"Set secrets and sync vault environments\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"set [name] [value]\",\n\t\t\t\t\t\t\"Set a single secret via the configured `secrets` capability\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"name\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Secret name (e.g., NPM_TOKEN)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.positional(\"value\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Secret value (positional). If omitted, sources from --from-stdin, --from-env, or env var matching <name>.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"from-stdin\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe: \"Read the secret value from stdin\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"from-env\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Read the secret value from the named env var (otherwise: env var matching <name>)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"scope\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"repo\",\n\t\t\t\t\t\t\t\t\tdescribe: 'Scope: \"repo\" (default), \"env=<name>\", or \"org=<name>\"',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst [name] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"secrets set\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst scopeArg = argv.scope as string;\n\t\t\t\t\t\t\tconst scope = parseScope(scopeArg);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSecretSet({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tname: name!,\n\t\t\t\t\t\t\t\t...(argv.value ? { value: argv.value as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.fromStdin ? { fromStdin: true } : {}),\n\t\t\t\t\t\t\t\t...(argv.fromEnv ? { fromEnv: argv.fromEnv as string } : {}),\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"sync [environmentId]\",\n\t\t\t\t\t\t\"Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"environmentId\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Vault environment id to read (1P Environment id, etc.)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"project-id\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Deployment project id (e.g., Vercel prj_*). Required when deployment is loaded.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"target\", {\n\t\t\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\t\t\tdefault: [\"production\", \"preview\"] as Array<\n\t\t\t\t\t\t\t\t\t\t\"development\" | \"preview\" | \"production\"\n\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\tdescribe: \"Deployment targets to sync to. Defaults to production + preview.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"github-secret\", {\n\t\t\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Vault key(s) to push to GH Actions secrets (repeatable). Omit to push every key.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"github-secret-scope\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"repo\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t'Scope applied to every --github-secret key: \"repo\" (default), \"env=<name>\", or \"org=<name>\".',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst githubSecretScope = parseScope(argv.githubSecretScope as string);\n\t\t\t\t\t\t\tconst [environmentId] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"secrets sync\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runSecretsSync({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tenvironmentId: environmentId!,\n\t\t\t\t\t\t\t\t...(argv.projectId ? { projectId: argv.projectId } : {}),\n\t\t\t\t\t\t\t\t...(argv.githubSecret?.length\n\t\t\t\t\t\t\t\t\t? { githubSecretKeys: argv.githubSecret as string[] }\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\tgithubSecretScope,\n\t\t\t\t\t\t\t\ttargets: argv.target as Array<\"development\" | \"preview\" | \"production\">,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.summary.fail > 0) {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"secrets\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"sync\",\n\t\t\t\"Sync generated files to other repos\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"github\",\n\t\t\t\t\t\t\"Sync workflow templates and composite actions to theholocron/.github\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"theholocron/.github\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Target org/repo (default: theholocron/.github)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"branch\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Push to this branch instead of the default branch (enables PR-based workflow for protected repos)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"pr\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe: \"Open a PR after pushing to --branch (no-op without --branch)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"message\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"Commit message (default: chore: sync from theholocron/holocron)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"output-dir\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Write generated files to this local directory instead of pushing (for validation)\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst outputDir = argv[\"output-dir\"] as string | undefined;\n\t\t\t\t\t\t\tconst parsed = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!parsed) return;\n\t\t\t\t\t\t\tlet token: string;\n\t\t\t\t\t\t\tif (outputDir) {\n\t\t\t\t\t\t\t\ttoken = \"no-token-needed\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\ttoken = resolveSyncToken({\n\t\t\t\t\t\t\t\t\t\tcliToken: parsed.cliTokens?.[\"github\"] ?? parsed.cliToken,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t\treportError(`sync-github: ${err instanceof AuthError ? err.message : String(err)}`);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst report = await runSyncGithub({\n\t\t\t\t\t\t\t\ttoken,\n\t\t\t\t\t\t\t\trepo: argv.repo,\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t...(argv.branch ? { branch: argv.branch } : {}),\n\t\t\t\t\t\t\t\t...(argv.pr ? { createPr: true } : {}),\n\t\t\t\t\t\t\t\t...(argv.message ? { message: argv.message } : {}),\n\t\t\t\t\t\t\t\t...(outputDir ? { outputDir } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"sync\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"package\",\n\t\t\t\"Version and publish workspace packages\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"bump-versions [new-version]\",\n\t\t\t\t\t\t\"Bump all non-private package versions in lockstep (semantic-release prepareCmd)\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty.positional(\"new-version\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tdescribe: \"Version to set (e.g., 4.2.0 or 2.0.0-alpha.1)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst [newVersion] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"package bump-versions\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst report = await runNpmBumpVersions({\n\t\t\t\t\t\t\t\tversion: newVersion!,\n\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"publish\",\n\t\t\t\t\t\t\"Publish @theholocron/* packages to npm\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"initial\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"One-shot bootstrap publish for trusted-publishing-eligible packages (npm needs the \" +\n\t\t\t\t\t\t\t\t\t\t\"package to exist before Trusted Publishing can be configured for it). Skips the \" +\n\t\t\t\t\t\t\t\t\t\t\"steady-state OIDC path below — use only for a package's very first publish.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"tag\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"npm distribution tag. Defaults to alpha for --initial, latest for a steady-state publish.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"otp\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"One-time password from your authenticator (required if npm needs 2FA for writes)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"sync-trust\", {\n\t\t\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Migrate npm Trusted Publisher config to a new workflow filename across every public \" +\n\t\t\t\t\t\t\t\t\t\t\"package: --sync-trust <old-file> <new-file>. See issue #689 — npm requires fresh \" +\n\t\t\t\t\t\t\t\t\t\t\"interactive 2FA per package; re-run after approving the printed authUrl if it stops early.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"owner/repo for Trusted Publisher config (--sync-trust). Defaults to theholocron/holocron.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"provenance\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Publish with --provenance (steady-state only). Default on — free under CI/OIDC.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"skip-already-published\", {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"Steady-state only: check `npm view <pkg>@<version>` before publishing each package and \" +\n\t\t\t\t\t\t\t\t\t\t\"skip it if that exact version already exists, instead of one bulk publish. For repos \" +\n\t\t\t\t\t\t\t\t\t\t\"that ship many independently-versioned packages where a release doesn't bump every one.\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tif (argv.syncTrust) {\n\t\t\t\t\t\t\t\tconst [oldFile, newFile] = argv.syncTrust as [string?, string?];\n\t\t\t\t\t\t\t\tif (!oldFile || !newFile) {\n\t\t\t\t\t\t\t\t\treportError(\n\t\t\t\t\t\t\t\t\t\t\"publish --sync-trust requires exactly two values: <old-file> <new-file>\"\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst report = await runSyncTrust({\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\toldFile,\n\t\t\t\t\t\t\t\t\tnewFile,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo as string } : {}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (argv.initial) {\n\t\t\t\t\t\t\t\tconst report = await runPublish({\n\t\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...(argv.tag ? { tag: argv.tag as string } : {}),\n\t\t\t\t\t\t\t\t\t...(argv.otp ? { otp: argv.otp as string } : {}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst report = await runSteadyPublish({\n\t\t\t\t\t\t\t\tcwd: argv.cwd,\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\tprovenance: argv.provenance as boolean,\n\t\t\t\t\t\t\t\tskipAlreadyPublished: argv.skipAlreadyPublished as boolean,\n\t\t\t\t\t\t\t\t...(argv.tag ? { tag: argv.tag as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.otp ? { otp: argv.otp as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"package\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.command(\n\t\t\t\"deploy [branch]\",\n\t\t\t\"Trigger a deployment via the configured `deployment` capability\",\n\t\t\t(y) =>\n\t\t\t\ty\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"cleanup-preview [pr]\",\n\t\t\t\t\t\t\"List and delete Cloudflare Pages preview deployments for a GitHub PR\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.positional(\"pr\", {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tdescribe: \"PR number to clean up\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"project\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t\t\t\t\tdescribe: \"Cloudflare Pages project name (e.g. theholocron-preview)\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"repo\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"GitHub repo as owner/name — defaults to the repo in holocron.config\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst [pr] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"deploy cleanup-preview\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runCleanupPreview({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprNumber: Number(pr),\n\t\t\t\t\t\t\t\tproject: argv.project as string,\n\t\t\t\t\t\t\t\t...(argv.repo ? { repo: argv.repo as string } : {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"on-release\",\n\t\t\t\t\t\t\"Deploy every workspace package whose delivery.deploy task is `on: release` — run by the delivery.publish workflow's deploy job\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t.option(\"channel\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdefault: \"\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"The release's channel: its prerelease identifier (`alpha`); empty or `main` for a stable release.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"from\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\t\t\t\"The previous release's commit, to diff against. Omit when there is none.\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.option(\"to\", {\n\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\tdescribe: \"The release commit. Default HEAD.\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst report = await deployOnRelease({\n\t\t\t\t\t\t\t\tcwd: argv.cwd as string,\n\t\t\t\t\t\t\t\tchannel: argv.channel as string,\n\t\t\t\t\t\t\t\t// An empty value (an unset workflow output) means \"not given\".\n\t\t\t\t\t\t\t\t...(argv.from ? { from: argv.from as string } : {}),\n\t\t\t\t\t\t\t\t...(argv.to ? { to: argv.to as string } : {}),\n\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\tprint: (line) => console.log(line),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") process.exitCode = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.positional(\"branch\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"Git branch to deploy (omit when using --files)\",\n\t\t\t\t\t})\n\t\t\t\t\t// Not `demandOption`: yargs would make every nested subcommand\n\t\t\t\t\t// (`deploy on-release`, `deploy cleanup-preview`) inherit it. The\n\t\t\t\t\t// handler below enforces it for the trigger itself.\n\t\t\t\t\t.option(\"project-id\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe: \"Deployment project id (required to trigger a deployment, e.g. Vercel prj_*)\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"target\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tchoices: [\"production\", \"staging\"] as const,\n\t\t\t\t\t\tdescribe: \"Named environment to deploy into. Omit for a branch preview.\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"files\", {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Deploy from a local directory of source files instead of a Git branch — calls deployFunction(), no linked repo required. Conflicts with `branch`.\",\n\t\t\t\t\t})\n\t\t\t\t\t.conflicts(\"files\", \"branch\"),\n\t\t\tasync (argv) => {\n\t\t\t\tif (!argv.projectId) {\n\t\t\t\t\treportError(\"deploy: missing required argument --project-id\");\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\tif (!tokens) return;\n\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\tconst context = {\n\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t...tokens,\n\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t};\n\n\t\t\t\tif (argv.files) {\n\t\t\t\t\tconst report = await runDeployFromFiles({\n\t\t\t\t\t\tloaded,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tprojectId: argv.projectId as string,\n\t\t\t\t\t\tdir: argv.files as string,\n\t\t\t\t\t\t...(argv.target ? { target: argv.target as \"production\" | \"staging\" } : {}),\n\t\t\t\t\t});\n\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [branch] = await promptForPositionals(getEntry(\"deploy\"), argv as Record<string, unknown>);\n\t\t\t\tconst report = await runDeploy({\n\t\t\t\t\tloaded,\n\t\t\t\t\tcontext,\n\t\t\t\t\tprojectId: argv.projectId as string,\n\t\t\t\t\tbranch: branch!,\n\t\t\t\t\t...(argv.target ? { target: argv.target as \"production\" | \"staging\" } : {}),\n\t\t\t\t});\n\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t\t.command(\n\t\t\t\"monitoring\",\n\t\t\t\"Run monitoring checks ad hoc, outside the configured provider\",\n\t\t\t(g) =>\n\t\t\t\tg\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"check <url>\",\n\t\t\t\t\t\t\"Run every configured `monitoring` check against a given URL instead of its own configured url\",\n\t\t\t\t\t\t(y) =>\n\t\t\t\t\t\t\ty.positional(\"url\", {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\tdescribe: \"URL to test every configured check against (e.g. a PR's preview deployment)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tconst tokens = tokenContext(argv.token);\n\t\t\t\t\t\t\tif (!tokens) return;\n\t\t\t\t\t\t\tconst [url] = await promptForPositionals(\n\t\t\t\t\t\t\t\tgetEntry(\"monitoring check\"),\n\t\t\t\t\t\t\t\targv as Record<string, unknown>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst loaded = await loadConfig(argv.cwd);\n\t\t\t\t\t\t\tapplyResolvedConfig(argv, loaded.resolved);\n\t\t\t\t\t\t\tconst report = await runMonitoringCheck({\n\t\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t\t\trepoRoot: argv.cwd,\n\t\t\t\t\t\t\t\t\tdryRun: argv.dryRun,\n\t\t\t\t\t\t\t\t\t...tokens,\n\t\t\t\t\t\t\t\t\torg: resolveOrg(argv, loaded.resolved),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\turl: url!,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (report.status === \"fail\") {\n\t\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t\t.command(\n\t\t\t\t\t\t\"$0\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t() => {},\n\t\t\t\t\t\tasync (argv) => {\n\t\t\t\t\t\t\tawait launchGroupMenu(\"monitoring\", argv);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t() => {}\n\t\t)\n\t\t.strict()\n\t\t.help()\n\t\t.epilogue(\n\t\t\t\"Execution contexts:\\n\" +\n\t\t\t\t` global works from a bare 'npm i -g': ${commandsInContext(\"global\").join(\", \")}\\n` +\n\t\t\t\t` repo-aware needs ./holocron.config in cwd: ${commandsInContext(\"repo-aware\").join(\", \")}\\n` +\n\t\t\t\t` workspace also needs the plugin packages: ${commandsInContext(\"workspace\").join(\", \")}\\n` +\n\t\t\t\t\" https://theholocron.github.io/holocron/execution-contexts\"\n\t\t)\n\t\t.fail((msg, err) => {\n\t\t\t// A user-facing error (a `workspace` command with no resolvable\n\t\t\t// plugins, a missing `holocron.config`) — its message is the whole\n\t\t\t// story. Print that: no usage dump, no stack trace.\n\t\t\tif (err instanceof Error && USER_FACING_ERRORS.has(err.name)) {\n\t\t\t\tcaptureException(err);\n\t\t\t\treportError(err.message);\n\t\t\t\terrorReported = true;\n\t\t\t\tprocess.exitCode = 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Anything else a handler threw: hand back to the outer catch so\n\t\t\t// telemetry + the generic path own it.\n\t\t\tif (err) throw err;\n\t\t\t// A yargs validation failure (unknown command, missing positional):\n\t\t\t// keep yargs' own message.\n\t\t\treportError(msg);\n\t\t\terrorReported = true;\n\t\t\tprocess.exitCode = 1;\n\t\t})\n\t\t.parse();\n} catch (err) {\n\tcaptureException(err);\n\t// User-facing errors carry a self-contained message — print it instead of\n\t// letting a raw stack trace escape (unless `.fail()` already did).\n\tif (!errorReported && err instanceof Error && USER_FACING_ERRORS.has(err.name)) {\n\t\treportError(err.message);\n\t}\n\tif (!process.exitCode) process.exitCode = 1;\n}\n\nfinishCommand(!process.exitCode);\nendSession();\n// `--debug` / `--verbose`: surface the correlation id for Axiom lookup. This is\n// user-facing reference output (print semantics); cli.ts has no `print` injection.\nconst rid = getRunId();\nif (printRunId && rid) console.log(`Run ID: ${rid}`);\nconst notify = await updateCheckPromise;\nnotify?.();\nawait flush();\n\n/**\n * Parse `--scope` strings: `repo` | `env=NAME` | `org=NAME`.\n */\nfunction parseScope(\n\ts: string\n): { kind: \"repo\" } | { kind: \"environment\"; name: string } | { kind: \"organization\"; name: string } {\n\tif (s === \"repo\") return { kind: \"repo\" };\n\tif (s.startsWith(\"env=\")) return { kind: \"environment\", name: s.slice(\"env=\".length) };\n\tif (s.startsWith(\"org=\")) return { kind: \"organization\", name: s.slice(\"org=\".length) };\n\tthrow new Error(`invalid --scope \"${s}\" — expected \"repo\", \"env=<name>\", or \"org=<name>\"`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAa,MAAM,gBAAgB;;;;;;;AAQnC,MAAa,cAAc,cAAc,KAAK,UAAU;;;;;AAMxD,SAAgB,QAAQ,QAA6C;CACpE,OAAO,gBAAgB,MAAM;AAC9B;;;;;;;;;;;;;;;;;;;;;ACAA,MAAM,UAAU;;;;;AAMhB,SAAgB,SAAS,UAAkB,OAAwB;CAClE,IAAI;EACH,IAAI,MAAM,SAAS,QAAQ,CAA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