politty 0.4.10 → 0.4.12

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.
Files changed (39) hide show
  1. package/dist/{arg-registry-CHmAzJOM.d.ts → arg-registry-BlXeCM4p.d.cts} +3 -1
  2. package/dist/arg-registry-BlXeCM4p.d.cts.map +1 -0
  3. package/dist/{arg-registry-BDybpyo5.d.cts → arg-registry-D0MimRYf.d.ts} +3 -1
  4. package/dist/arg-registry-D0MimRYf.d.ts.map +1 -0
  5. package/dist/augment.d.cts +1 -1
  6. package/dist/augment.d.ts +1 -1
  7. package/dist/completion/index.d.cts +1 -1
  8. package/dist/completion/index.d.ts +1 -1
  9. package/dist/docs/index.cjs +71 -11
  10. package/dist/docs/index.cjs.map +1 -1
  11. package/dist/docs/index.d.cts +9 -3
  12. package/dist/docs/index.d.cts.map +1 -1
  13. package/dist/docs/index.d.ts +9 -3
  14. package/dist/docs/index.d.ts.map +1 -1
  15. package/dist/docs/index.js +71 -12
  16. package/dist/docs/index.js.map +1 -1
  17. package/dist/{index-DcwMaTvt.d.ts → index-CBGSQVm9.d.ts} +3 -3
  18. package/dist/{index-DcwMaTvt.d.ts.map → index-CBGSQVm9.d.ts.map} +1 -1
  19. package/dist/{index-DjU9BErU.d.cts → index-f2-VIfCo.d.cts} +3 -3
  20. package/dist/{index-DjU9BErU.d.cts.map → index-f2-VIfCo.d.cts.map} +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.cts +3 -3
  23. package/dist/index.d.cts.map +1 -1
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/{runner-BnBUkTvG.js → runner-Bx2S6_Id.js} +22 -67
  28. package/dist/runner-Bx2S6_Id.js.map +1 -0
  29. package/dist/{runner-DXmgHXNR.cjs → runner-U86FIDHT.cjs} +22 -67
  30. package/dist/runner-U86FIDHT.cjs.map +1 -0
  31. package/dist/{schema-extractor-D1sJW-sc.d.ts → schema-extractor-CAZi3kK1.d.ts} +2 -2
  32. package/dist/{schema-extractor-D1sJW-sc.d.ts.map → schema-extractor-CAZi3kK1.d.ts.map} +1 -1
  33. package/dist/{schema-extractor-RainqdRn.d.cts → schema-extractor-D-eGlm4W.d.cts} +2 -2
  34. package/dist/{schema-extractor-RainqdRn.d.cts.map → schema-extractor-D-eGlm4W.d.cts.map} +1 -1
  35. package/package.json +9 -9
  36. package/dist/arg-registry-BDybpyo5.d.cts.map +0 -1
  37. package/dist/arg-registry-CHmAzJOM.d.ts.map +0 -1
  38. package/dist/runner-BnBUkTvG.js.map +0 -1
  39. package/dist/runner-DXmgHXNR.cjs.map +0 -1
@@ -204,6 +204,8 @@ interface MainOptions {
204
204
  setup?: ((context: GlobalSetupContext) => void | Promise<void>) | undefined;
205
205
  /** Global cleanup hook (runs after command execution, always executes even on error) */
206
206
  cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
207
+ /** Whether to display errors to stderr before process.exit (default: true) */
208
+ displayErrors?: boolean;
207
209
  }
208
210
  /**
209
211
  * Options for runCommand (programmatic/test usage)
@@ -456,4 +458,4 @@ declare function arg<T extends z.ZodType>(schema: T): T;
456
458
  declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M>): T;
457
459
  //#endregion
458
460
  export { SubCommandValue as A, NonRunnableCommand as C, RunResultSuccess as D, RunResultFailure as E, LazyCommand as M, isLazyCommand as N, RunnableCommand as O, lazy as P, MainOptions as S, RunResult as T, IsEmpty as _, EffectContext as a, LogStream as b, ArgsSchema as c, Command as d, CommandBase as f, GlobalSetupContext as g, GlobalCleanupContext as h, CustomCompletion as i, SubCommandsRecord as j, SetupContext as k, CleanupContext as l, GlobalArgs as m, CompletionMeta as n, arg as o, Example as p, CompletionType as r, AnyCommand as s, ArgMeta as t, CollectedLogs as u, LogEntry as v, RunCommandOptions as w, Logger as x, LogLevel as y };
459
- //# sourceMappingURL=arg-registry-CHmAzJOM.d.ts.map
461
+ //# sourceMappingURL=arg-registry-BlXeCM4p.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arg-registry-BlXeCM4p.d.cts","names":[],"sources":["../src/lazy.ts","../src/types.ts","../src/core/arg-registry.ts"],"mappings":";;;;;;;;UAgBiB,WAAA,WAAsB,UAAA,GAAa,UAAA;EAAA,SACzC,gBAAA;EAAA,SACA,IAAA,EAAM,CAAA;EAAA,SACN,IAAA,QAAY,OAAA,CAAQ,UAAA;AAAA;;;;iBAMf,aAAA,CAAc,KAAA,YAAiB,KAAA,IAAS,WAAA;;;;;;;AAAxD;;;;;;;;;AAkCA;;;;;;;;;;;;;iBAAgB,IAAA,WAAe,UAAA,CAAA,CAC7B,IAAA,EAAM,CAAA,EACN,IAAA,QAAY,OAAA,CAAQ,UAAA,IACnB,WAAA,CAAY,CAAA;;;;AA9Cf;;;;;;;;;UCDiB,UAAA;;;;KAKL,OAAA,YAAmB,CAAA;;;;UAKd,OAAA;EDNwB;ECQvC,GAAA;EDFc;ECId,IAAA;;EAEA,MAAA;AAAA;;;;;UAOe,MAAA;EDqBG;ECnBlB,GAAA,CAAI,OAAA;EDmByB;ECjB7B,KAAA,CAAM,OAAA;AAAA;;;;KAOI,UAAA,GAAa,CAAA,CAAE,OAAA,CAAQ,MAAA;;;;UAKlB,YAAA;EDMf;ECJA,IAAA,EAAM,KAAA;AAAA;;;;UAMS,cAAA;EDAD;ECEd,IAAA,EAAM,KAAA;;EAEN,KAAA,GAAQ,KAAA;AAAA;;;;UAOO,kBAAA;;;;UAKA,oBAAA;EArDA;EAuDf,KAAA,GAAQ,KAAA;AAAA;;;;;;UAQO,WAAA,qBACK,UAAA;EAnDL;EAuDf,IAAA;;EAEA,WAAA;EAvDA;EAyDA,IAAA,EAAM,WAAA;EAvDN;EAyDA,WAAA,GAAc,iBAAA;EAzDO;EA2DrB,KAAA,KAAU,OAAA,EAAS,YAAA,CAAa,KAAA,aAAkB,OAAA;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ED9CqB;ECgDrB,UAAA;EDhDqB;ECkDrB,WAAA;EDhDI;;;;;AASN;;;;;;;;;ECsDE,GAAA;EDjD2B;ECmD3B,UAAA,GAAa,cAAA;EDjDF;;;;;;AAMb;;;;;;;;;EC2DE,MAAA,IAAU,KAAA,EAAO,MAAA,EAAQ,OAAA,EAAS,aAAA,YAAyB,WAAA;AAAA;ADhD7D;;;AAAA,UCsDiB,cAAA,2BAAyC,WAAA,CAAY,MAAA;EDtDnC;ECwDjC,KAAA;AAAA;;;;UAMe,sBAAA,2BAAiD,WAAA,CAAY,MAAA;ED/ClD;ECiD1B,KAAA;EDhDoB;ECkDpB,oBAAA;AAAA;;;;KAMU,OAAA,qBAA4B,cAAA,CAAe,MAAA,IAAU,sBAAA,CAAuB,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;AD7BxF;;;KCgEK,eAAA,MAAqB,CAAA;EAAY,KAAA;AAAA,IAClC,CAAA;EAAY,oBAAA;AAAA,IACV,CAAA,iBAEc,CAAA,GAAI,CAAA,CAAE,CAAA;EAElB,WAAA;AAAA,IAEJ,CAAA;AAAA,iBAEY,GAAA,WAAc,CAAA,CAAE,OAAA,CAAA,CAAS,MAAA,EAAQ,CAAA,GAAI,CAAA;AAAA,iBACrC,GAAA,WAAc,CAAA,CAAE,OAAA,YAAmB,OAAA,CAAQ,CAAA,CAAE,MAAA,CAAO,CAAA,GAAA,CAClE,MAAA,EAAQ,CAAA,EACR,IAAA,EAAM,eAAA,CAAgB,CAAA,IACrB,CAAA"}
@@ -204,6 +204,8 @@ interface MainOptions {
204
204
  setup?: ((context: GlobalSetupContext) => void | Promise<void>) | undefined;
205
205
  /** Global cleanup hook (runs after command execution, always executes even on error) */
206
206
  cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
207
+ /** Whether to display errors to stderr before process.exit (default: true) */
208
+ displayErrors?: boolean;
207
209
  }
208
210
  /**
209
211
  * Options for runCommand (programmatic/test usage)
@@ -456,4 +458,4 @@ declare function arg<T extends z.ZodType>(schema: T): T;
456
458
  declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M>): T;
457
459
  //#endregion
458
460
  export { SubCommandValue as A, NonRunnableCommand as C, RunResultSuccess as D, RunResultFailure as E, LazyCommand as M, isLazyCommand as N, RunnableCommand as O, lazy as P, MainOptions as S, RunResult as T, IsEmpty as _, EffectContext as a, LogStream as b, ArgsSchema as c, Command as d, CommandBase as f, GlobalSetupContext as g, GlobalCleanupContext as h, CustomCompletion as i, SubCommandsRecord as j, SetupContext as k, CleanupContext as l, GlobalArgs as m, CompletionMeta as n, arg as o, Example as p, CompletionType as r, AnyCommand as s, ArgMeta as t, CollectedLogs as u, LogEntry as v, RunCommandOptions as w, Logger as x, LogLevel as y };
459
- //# sourceMappingURL=arg-registry-BDybpyo5.d.cts.map
461
+ //# sourceMappingURL=arg-registry-D0MimRYf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arg-registry-D0MimRYf.d.ts","names":[],"sources":["../src/lazy.ts","../src/types.ts","../src/core/arg-registry.ts"],"mappings":";;;;;;;;UAgBiB,WAAA,WAAsB,UAAA,GAAa,UAAA;EAAA,SACzC,gBAAA;EAAA,SACA,IAAA,EAAM,CAAA;EAAA,SACN,IAAA,QAAY,OAAA,CAAQ,UAAA;AAAA;;;;iBAMf,aAAA,CAAc,KAAA,YAAiB,KAAA,IAAS,WAAA;;;;;;;AAAxD;;;;;;;;;AAkCA;;;;;;;;;;;;;iBAAgB,IAAA,WAAe,UAAA,CAAA,CAC7B,IAAA,EAAM,CAAA,EACN,IAAA,QAAY,OAAA,CAAQ,UAAA,IACnB,WAAA,CAAY,CAAA;;;;AA9Cf;;;;;;;;;UCDiB,UAAA;;;;KAKL,OAAA,YAAmB,CAAA;;;;UAKd,OAAA;EDNwB;ECQvC,GAAA;EDFc;ECId,IAAA;;EAEA,MAAA;AAAA;;;;;UAOe,MAAA;EDqBG;ECnBlB,GAAA,CAAI,O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S,MAAA,EAAQ,CAAA,GAAI,CAAA;AAAA,iBACrC,GAAA,WAAc,CAAA,CAAE,OAAA,YAAmB,OAAA,CAAQ,CAAA,CAAE,MAAA,CAAO,CAAA,GAAA,CAClE,MAAA,EAAQ,CAAA,EACR,IAAA,EAAM,eAAA,CAAgB,CAAA,IACrB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { t as ArgMeta } from "./arg-registry-BDybpyo5.cjs";
1
+ import { t as ArgMeta } from "./arg-registry-BlXeCM4p.cjs";
2
2
 
3
3
  //#region src/augment.d.ts
4
4
  declare module "zod" {
package/dist/augment.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as ArgMeta } from "./arg-registry-CHmAzJOM.js";
1
+ import { t as ArgMeta } from "./arg-registry-D0MimRYf.js";
2
2
 
3
3
  //#region src/augment.d.ts
4
4
  declare module "zod" {
@@ -1,2 +1,2 @@
1
- import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-DjU9BErU.cjs";
1
+ import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-f2-VIfCo.cjs";
2
2
  export { CandidateResult, CompletableOption, CompletableSubcommand, CompletionCandidate, CompletionContext, CompletionData, CompletionDirective, CompletionGenerator, CompletionOptions, CompletionResult, CompletionType, ShellFormatOptions, ShellType, ValueCompletionField, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
@@ -1,2 +1,2 @@
1
- import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-DcwMaTvt.js";
1
+ import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-CBGSQVm9.js";
2
2
  export { CandidateResult, CompletableOption, CompletableSubcommand, CompletionCandidate, CompletionContext, CompletionData, CompletionDirective, CompletionGenerator, CompletionOptions, CompletionResult, CompletionType, ShellFormatOptions, ShellType, ValueCompletionField, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
@@ -14,6 +14,12 @@ node_path = require_subcommand_router.__toESM(node_path);
14
14
  */
15
15
  const UPDATE_GOLDEN_ENV = "POLITTY_DOCS_UPDATE";
16
16
  /**
17
+ * Environment variable name for doctor mode.
18
+ * When enabled alone, detects and reports missing section markers (read-only).
19
+ * When combined with POLITTY_DOCS_UPDATE=true, auto-inserts missing markers.
20
+ */
21
+ const DOCTOR_ENV = "POLITTY_DOCS_DOCTOR";
22
+ /**
17
23
  * All section types in rendering order
18
24
  */
19
25
  const SECTION_TYPES = [
@@ -339,8 +345,11 @@ function renderUnionOptionsMarkdown(extracted, style = "table") {
339
345
  const option = unionOptions[i];
340
346
  if (!option) continue;
341
347
  const uniqueFields = option.fields.filter((f) => !commonFieldNames.has(f.name) && !f.positional);
342
- if (uniqueFields.length === 0) continue;
343
348
  const label = option.description ?? `Variant ${i + 1}`;
349
+ if (uniqueFields.length === 0) {
350
+ sections.push(`**${label}:**\n\n_no options_`);
351
+ continue;
352
+ }
344
353
  const rendered = style === "table" ? renderOptionsTableFromArray(uniqueFields) : renderOptionsListFromArray(uniqueFields);
345
354
  sections.push(`**${label}:**\n\n${rendered}`);
346
355
  }
@@ -819,7 +828,7 @@ async function executeSingleExample(example, rootCommand, commandPath) {
819
828
  collector.start();
820
829
  let success = true;
821
830
  try {
822
- const { runCommand } = await Promise.resolve().then(() => require("../runner-DXmgHXNR.cjs")).then((n) => n.runner_exports);
831
+ const { runCommand } = await Promise.resolve().then(() => require("../runner-U86FIDHT.cjs")).then((n) => n.runner_exports);
823
832
  const result = await runCommand(rootCommand, argv);
824
833
  success = result.success;
825
834
  if (!result.success && result.error) console.error(result.error.message);
@@ -1112,11 +1121,8 @@ async function applyFormatter(content, formatter) {
1112
1121
  if (!content.endsWith("\n") && formatted.endsWith("\n")) return formatted.slice(0, -1);
1113
1122
  return formatted;
1114
1123
  }
1115
- /**
1116
- * Check if update mode is enabled via environment variable
1117
- */
1118
- function isUpdateMode() {
1119
- const value = process.env[UPDATE_GOLDEN_ENV];
1124
+ function isTruthyEnv(envKey) {
1125
+ const value = process.env[envKey];
1120
1126
  return value === "true" || value === "1";
1121
1127
  }
1122
1128
  /**
@@ -1352,6 +1358,37 @@ function replaceSectionMarker(content, type, scope, newContent) {
1352
1358
  return replaceMarkerSection(content, sectionStartMarker(type, scope), sectionEndMarker(type, scope), newContent);
1353
1359
  }
1354
1360
  /**
1361
+ * Insert a new section marker into existing content at the correct position
1362
+ * relative to other section markers for the same command, based on SECTION_TYPES order.
1363
+ * @throws If no adjacent marker is found (unreachable when at least one marker exists for the command)
1364
+ */
1365
+ function insertSectionMarkerAtOrder(content, type, scope, newSection) {
1366
+ const typeIndex = SECTION_TYPES.indexOf(type);
1367
+ for (let i = typeIndex - 1; i >= 0; i--) {
1368
+ const prevType = SECTION_TYPES[i];
1369
+ const prevEnd = sectionEndMarker(prevType, scope);
1370
+ const prevEndIdx = content.indexOf(prevEnd);
1371
+ if (prevEndIdx !== -1) {
1372
+ const insertPos = prevEndIdx + prevEnd.length;
1373
+ let afterPos = insertPos;
1374
+ while (afterPos < content.length && content[afterPos] === "\n") afterPos++;
1375
+ return content.slice(0, insertPos) + "\n\n" + newSection + "\n\n" + content.slice(afterPos);
1376
+ }
1377
+ }
1378
+ for (let i = typeIndex + 1; i < SECTION_TYPES.length; i++) {
1379
+ const nextType = SECTION_TYPES[i];
1380
+ const nextStart = sectionStartMarker(nextType, scope);
1381
+ const nextStartIdx = content.indexOf(nextStart);
1382
+ if (nextStartIdx !== -1) {
1383
+ let beforePos = nextStartIdx;
1384
+ while (beforePos > 0 && content[beforePos - 1] === "\n") beforePos--;
1385
+ const prefix = beforePos === 0 ? "" : "\n\n";
1386
+ return content.slice(0, beforePos) + prefix + newSection + "\n\n" + content.slice(nextStartIdx);
1387
+ }
1388
+ }
1389
+ throw new Error(`No insertion point found for section "${type}" (scope="${scope}"). This should be unreachable when at least one marker exists for the command.`);
1390
+ }
1391
+ /**
1355
1392
  * Collect all section types that have markers for a given command path.
1356
1393
  */
1357
1394
  function collectSectionMarkers(content, commandPath) {
@@ -1897,7 +1934,9 @@ async function generateDoc(config) {
1897
1934
  };
1898
1935
  }
1899
1936
  }
1900
- const updateMode = isUpdateMode();
1937
+ const updateMode = isTruthyEnv(UPDATE_GOLDEN_ENV);
1938
+ const doctorMode = isTruthyEnv(DOCTOR_ENV);
1939
+ let hasDoctorIssues = false;
1901
1940
  if (rootDoc && !usingPathConfig) {
1902
1941
  const normalizedRootDocPath = normalizeDocPathForComparison(rootDoc.path);
1903
1942
  if (Object.keys(files).some((filePath) => normalizeDocPathForComparison(filePath) === normalizedRootDocPath)) throw new Error(`rootDoc.path "${rootDoc.path}" must not also appear as a key in files.`);
@@ -2003,6 +2042,25 @@ async function generateDoc(config) {
2003
2042
  diffs.push(formatDiff(existingSection, generatedSectionPart));
2004
2043
  }
2005
2044
  }
2045
+ if (doctorMode) {
2046
+ const generatedMarkers = collectSectionMarkers(generatedSection, targetCommand);
2047
+ const existingMarkerSet = new Set(existingMarkers);
2048
+ for (const sectionType of generatedMarkers) {
2049
+ if (existingMarkerSet.has(sectionType)) continue;
2050
+ const generatedSectionPart = extractSectionMarker(generatedSection, sectionType, targetCommand);
2051
+ if (!generatedSectionPart) continue;
2052
+ if (updateMode) {
2053
+ existingContent = insertSectionMarkerAtOrder(existingContent, sectionType, targetCommand, generatedSectionPart);
2054
+ writeFile(filePath, existingContent);
2055
+ if (fileStatus !== "created") fileStatus = "updated";
2056
+ } else {
2057
+ hasError = true;
2058
+ hasDoctorIssues = true;
2059
+ fileStatus = "diff";
2060
+ diffs.push(`[doctor] Missing section marker "${sectionType}" for command "${formatCommandPath(targetCommand)}". Run with ${DOCTOR_ENV}=true ${UPDATE_GOLDEN_ENV}=true to insert.\n${generatedSectionPart}`);
2061
+ }
2062
+ }
2063
+ }
2006
2064
  }
2007
2065
  if (existingContent) {
2008
2066
  const existingMarkerPaths = collectSectionMarkerPaths(existingContent);
@@ -2115,10 +2173,11 @@ async function generateDoc(config) {
2115
2173
  diff: rootDocDiffs.length > 0 ? rootDocDiffs.join("\n\n") : void 0
2116
2174
  });
2117
2175
  }
2176
+ const errorHint = hasDoctorIssues ? `Run with ${DOCTOR_ENV}=true ${UPDATE_GOLDEN_ENV}=true to fix missing markers.` : `Run with ${UPDATE_GOLDEN_ENV}=true to update.`;
2118
2177
  return {
2119
2178
  success: !hasError,
2120
2179
  files: results,
2121
- error: hasError ? `Documentation is out of date. Run with ${UPDATE_GOLDEN_ENV}=true to update.` : void 0
2180
+ error: hasError ? `Documentation is out of date. ${errorHint}` : void 0
2122
2181
  };
2123
2182
  }
2124
2183
  /**
@@ -2133,7 +2192,7 @@ async function assertDocMatch(config) {
2133
2192
  if (f.diff) msg += f.diff;
2134
2193
  return msg;
2135
2194
  }).join("\n\n");
2136
- throw new Error(`Documentation does not match golden files.\n\n${diffMessages}\n\nRun with ${UPDATE_GOLDEN_ENV}=true to update the documentation.`);
2195
+ throw new Error(`Documentation does not match golden files.\n\n${diffMessages}\n\n` + (result.error ?? `Run with ${"POLITTY_DOCS_UPDATE"}=true to update the documentation.`));
2137
2196
  }
2138
2197
  }
2139
2198
  /**
@@ -2144,12 +2203,13 @@ async function assertDocMatch(config) {
2144
2203
  * @param fileSystem - Optional fs implementation (useful when fs is mocked)
2145
2204
  */
2146
2205
  function initDocFile(config, fileSystem) {
2147
- if (!isUpdateMode()) return;
2206
+ if (!isTruthyEnv("POLITTY_DOCS_UPDATE")) return;
2148
2207
  if (typeof config === "string") deleteFile(config, fileSystem);
2149
2208
  else if (config.files) for (const filePath of Object.keys(config.files)) deleteFile(filePath, fileSystem);
2150
2209
  }
2151
2210
 
2152
2211
  //#endregion
2212
+ exports.DOCTOR_ENV = DOCTOR_ENV;
2153
2213
  exports.GLOBAL_OPTIONS_MARKER_PREFIX = GLOBAL_OPTIONS_MARKER_PREFIX;
2154
2214
  exports.INDEX_MARKER_PREFIX = INDEX_MARKER_PREFIX;
2155
2215
  exports.ROOT_FOOTER_MARKER_PREFIX = ROOT_FOOTER_MARKER_PREFIX;