docs: document plugin program cli helpers

This commit is contained in:
Peter Steinberger
2026-06-04 11:03:24 -04:00
parent 169a4159de
commit f7e54acec1
10 changed files with 17 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
// Builds the root Commander program, context, help, hooks, and command registry.
import process from "node:process";
import { Command } from "commander";
import { registerProgramCommands } from "./command-registry.js";

View File

@@ -1,3 +1,4 @@
// Core command registry that lazily imports command groups based on parsed argv.
import type { Command } from "commander";
import { resolveCliArgvInvocation } from "../argv-invocation.js";
import { shouldRegisterPrimaryCommandOnly } from "../command-registration-policy.js";
@@ -142,6 +143,7 @@ const coreEntrySpecs: readonly CommandGroupDescriptorSpec<
];
function resolveCoreCommandGroups(ctx: ProgramContext, argv: string[]): CommandGroupEntry[] {
// Descriptor metadata and import specs stay separate so help can stay cheap.
return buildCommandGroupEntries(
getCoreCliCommandDescriptors(),
coreEntrySpecs,

View File

@@ -1,3 +1,4 @@
// CLI config readiness guard, legacy-state migration routing, and invalid-config allowances.
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
@@ -97,6 +98,7 @@ function hasBundledChannelLegacyStateMigrationInputs(stateDir: string, oauthDir:
}
function hasLegacyStateMigrationInputs(): boolean {
// Only run migration prompts when old state actually exists in known legacy locations.
const stateDir = resolveStateDir(process.env, os.homedir);
const oauthDir = resolveOAuthDir(process.env, stateDir);
if (