politty 0.4.11 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -8
- package/dist/{arg-registry-BDybpyo5.d.cts → arg-registry-6E4C5MTC.d.ts} +188 -2
- package/dist/arg-registry-6E4C5MTC.d.ts.map +1 -0
- package/dist/{arg-registry-CHmAzJOM.d.ts → arg-registry-CeIRoLaB.d.cts} +188 -2
- package/dist/arg-registry-CeIRoLaB.d.cts.map +1 -0
- package/dist/augment.d.cts +1 -1
- package/dist/augment.d.ts +1 -1
- package/dist/completion/index.cjs +1 -2
- package/dist/completion/index.d.cts +1 -1
- package/dist/completion/index.d.ts +1 -1
- package/dist/completion/index.js +1 -2
- package/dist/{completion-BADAzqT9.cjs → completion-D3LUac1o.cjs} +3 -3
- package/dist/completion-D3LUac1o.cjs.map +1 -0
- package/dist/{completion-Dj7ytbLu.js → completion-DzaT2YCN.js} +2 -2
- package/dist/completion-DzaT2YCN.js.map +1 -0
- package/dist/docs/index.cjs +89 -14
- package/dist/docs/index.cjs.map +1 -1
- package/dist/docs/index.d.cts +8 -3
- package/dist/docs/index.d.cts.map +1 -1
- package/dist/docs/index.d.ts +8 -3
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +89 -15
- package/dist/docs/index.js.map +1 -1
- package/dist/{index-DcwMaTvt.d.ts → index-BW02tH1-.d.cts} +2 -3
- package/dist/index-BW02tH1-.d.cts.map +1 -0
- package/dist/{index-DjU9BErU.d.cts → index-C3UtsvgY.d.ts} +2 -3
- package/dist/index-C3UtsvgY.d.ts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{lazy-B_E2X0KR.cjs → lazy-qPy4cMnv.cjs} +8 -3
- package/dist/lazy-qPy4cMnv.cjs.map +1 -0
- package/dist/{lazy-D6nL_iKJ.js → lazy-xrzxwnru.js} +7 -2
- package/dist/lazy-xrzxwnru.js.map +1 -0
- package/dist/prompt/clack/index.cjs +34 -0
- package/dist/prompt/clack/index.cjs.map +1 -0
- package/dist/prompt/clack/index.d.cts +18 -0
- package/dist/prompt/clack/index.d.cts.map +1 -0
- package/dist/prompt/clack/index.d.ts +18 -0
- package/dist/prompt/clack/index.d.ts.map +1 -0
- package/dist/prompt/clack/index.js +32 -0
- package/dist/prompt/clack/index.js.map +1 -0
- package/dist/prompt/index.cjs +7 -0
- package/dist/prompt/index.d.cts +108 -0
- package/dist/prompt/index.d.cts.map +1 -0
- package/dist/prompt/index.d.ts +108 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +3 -0
- package/dist/prompt/inquirer/index.cjs +49 -0
- package/dist/prompt/inquirer/index.cjs.map +1 -0
- package/dist/prompt/inquirer/index.d.cts +18 -0
- package/dist/prompt/inquirer/index.d.cts.map +1 -0
- package/dist/prompt/inquirer/index.d.ts +18 -0
- package/dist/prompt/inquirer/index.d.ts.map +1 -0
- package/dist/prompt/inquirer/index.js +47 -0
- package/dist/prompt/inquirer/index.js.map +1 -0
- package/dist/prompt-BKHqGrFw.js +172 -0
- package/dist/prompt-BKHqGrFw.js.map +1 -0
- package/dist/prompt-aXfSf27y.cjs +196 -0
- package/dist/prompt-aXfSf27y.cjs.map +1 -0
- package/dist/{runner-JZRo4pYu.js → runner-CnG-Ncz0.js} +33 -70
- package/dist/runner-CnG-Ncz0.js.map +1 -0
- package/dist/{runner-BgW1XWJw.cjs → runner-DA48D-3K.cjs} +33 -70
- package/dist/runner-DA48D-3K.cjs.map +1 -0
- package/dist/{subcommand-router-Bu3YTw_f.js → subcommand-router-BhYVuS83.js} +2 -2
- package/dist/{subcommand-router-Bu3YTw_f.js.map → subcommand-router-BhYVuS83.js.map} +1 -1
- package/dist/{subcommand-router-BTOzDQnY.cjs → subcommand-router-BnHpqyRk.cjs} +2 -2
- package/dist/{subcommand-router-BTOzDQnY.cjs.map → subcommand-router-BnHpqyRk.cjs.map} +1 -1
- package/package.json +51 -9
- package/dist/arg-registry-BDybpyo5.d.cts.map +0 -1
- package/dist/arg-registry-CHmAzJOM.d.ts.map +0 -1
- package/dist/completion-BADAzqT9.cjs.map +0 -1
- package/dist/completion-Dj7ytbLu.js.map +0 -1
- package/dist/index-DcwMaTvt.d.ts.map +0 -1
- package/dist/index-DjU9BErU.d.cts.map +0 -1
- package/dist/lazy-B_E2X0KR.cjs.map +0 -1
- package/dist/lazy-D6nL_iKJ.js.map +0 -1
- package/dist/runner-BgW1XWJw.cjs.map +0 -1
- package/dist/runner-JZRo4pYu.js.map +0 -1
- package/dist/schema-extractor-D1sJW-sc.d.ts +0 -117
- package/dist/schema-extractor-D1sJW-sc.d.ts.map +0 -1
- package/dist/schema-extractor-RainqdRn.d.cts +0 -117
- package/dist/schema-extractor-RainqdRn.d.cts.map +0 -1
package/dist/docs/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as ResolvedFieldMeta, t as ExtractedFields } from "../schema-extractor-RainqdRn.cjs";
|
|
1
|
+
import { N as SubCommandValue, R as ExtractedFields, h as Example, l as AnyCommand, u as ArgsSchema, z as ResolvedFieldMeta } from "../arg-registry-CeIRoLaB.cjs";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
import * as fs from "node:fs";
|
|
5
4
|
|
|
@@ -431,6 +430,12 @@ type FormatterFunction = (content: string) => string | Promise<string>;
|
|
|
431
430
|
* Environment variable name for update mode
|
|
432
431
|
*/
|
|
433
432
|
declare const UPDATE_GOLDEN_ENV = "POLITTY_DOCS_UPDATE";
|
|
433
|
+
/**
|
|
434
|
+
* Environment variable name for doctor mode.
|
|
435
|
+
* When enabled alone, detects and reports missing section markers (read-only).
|
|
436
|
+
* When combined with POLITTY_DOCS_UPDATE=true, auto-inserts missing markers.
|
|
437
|
+
*/
|
|
438
|
+
declare const DOCTOR_ENV = "POLITTY_DOCS_DOCTOR";
|
|
434
439
|
/**
|
|
435
440
|
* All section types in rendering order
|
|
436
441
|
*/
|
|
@@ -697,5 +702,5 @@ type CommandCategory = {
|
|
|
697
702
|
*/
|
|
698
703
|
declare function renderCommandIndex(command: AnyCommand, categories: CommandCategory[], options?: CommandIndexOptions): Promise<string>;
|
|
699
704
|
//#endregion
|
|
700
|
-
export { type ArgsShape, type ArgsTableOptions, type ArgumentsRenderContext, type ArgumentsRenderFunction, type CommandCategory, type CommandIndexOptions, type CommandInfo, type DefaultRendererOptions, type DeleteFileFs, type ExampleCommandConfig, type ExampleConfig, type ExampleExecutionResult, type ExamplesRenderContext, type ExamplesRenderFunction, type ExamplesRenderOptions, type FileConfig, type FileMapping, type FormatterFunction, GLOBAL_OPTIONS_MARKER_PREFIX, type GenerateDocConfig, type GenerateDocResult, type HeadingLevel, INDEX_MARKER_PREFIX, type OptionsRenderContext, type OptionsRenderFunction, type PathConfig, ROOT_FOOTER_MARKER_PREFIX, ROOT_HEADER_MARKER_PREFIX, type RenderContentOptions, type RenderFunction, type RootCommandInfo, type RootDocConfig, SECTION_MARKER_PREFIX, SECTION_TYPES, type SectionRenderFunction, type SectionType, type SimpleRenderContext, type SimpleRenderFunction, type SubCommandInfo, type SubcommandsRenderContext, type SubcommandsRenderFunction, type SubcommandsRenderOptions, UPDATE_GOLDEN_ENV, assertDocMatch, buildCommandInfo, collectAllCommands, compareWithExisting, createCommandRenderer, defaultRenderers, executeExamples, formatDiff, generateDoc, globalOptionsEndMarker, globalOptionsStartMarker, indexEndMarker, indexStartMarker, initDocFile, renderArgsTable, renderArgumentsList, renderArgumentsListFromArray, renderArgumentsTable, renderArgumentsTableFromArray, renderCommandIndex, renderExamplesDefault, renderOptionsList, renderOptionsListFromArray, renderOptionsTable, renderOptionsTableFromArray, renderSubcommandsTable, renderSubcommandsTableFromArray, renderUsage, resolveLazyCommand, rootFooterEndMarker, rootFooterStartMarker, rootHeaderEndMarker, rootHeaderStartMarker, sectionEndMarker, sectionStartMarker, writeFile };
|
|
705
|
+
export { type ArgsShape, type ArgsTableOptions, type ArgumentsRenderContext, type ArgumentsRenderFunction, type CommandCategory, type CommandIndexOptions, type CommandInfo, DOCTOR_ENV, type DefaultRendererOptions, type DeleteFileFs, type ExampleCommandConfig, type ExampleConfig, type ExampleExecutionResult, type ExamplesRenderContext, type ExamplesRenderFunction, type ExamplesRenderOptions, type FileConfig, type FileMapping, type FormatterFunction, GLOBAL_OPTIONS_MARKER_PREFIX, type GenerateDocConfig, type GenerateDocResult, type HeadingLevel, INDEX_MARKER_PREFIX, type OptionsRenderContext, type OptionsRenderFunction, type PathConfig, ROOT_FOOTER_MARKER_PREFIX, ROOT_HEADER_MARKER_PREFIX, type RenderContentOptions, type RenderFunction, type RootCommandInfo, type RootDocConfig, SECTION_MARKER_PREFIX, SECTION_TYPES, type SectionRenderFunction, type SectionType, type SimpleRenderContext, type SimpleRenderFunction, type SubCommandInfo, type SubcommandsRenderContext, type SubcommandsRenderFunction, type SubcommandsRenderOptions, UPDATE_GOLDEN_ENV, assertDocMatch, buildCommandInfo, collectAllCommands, compareWithExisting, createCommandRenderer, defaultRenderers, executeExamples, formatDiff, generateDoc, globalOptionsEndMarker, globalOptionsStartMarker, indexEndMarker, indexStartMarker, initDocFile, renderArgsTable, renderArgumentsList, renderArgumentsListFromArray, renderArgumentsTable, renderArgumentsTableFromArray, renderCommandIndex, renderExamplesDefault, renderOptionsList, renderOptionsListFromArray, renderOptionsTable, renderOptionsTableFromArray, renderSubcommandsTable, renderSubcommandsTableFromArray, renderUsage, resolveLazyCommand, rootFooterEndMarker, rootFooterStartMarker, rootHeaderEndMarker, rootHeaderStartMarker, sectionEndMarker, sectionStartMarker, writeFile };
|
|
701
706
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/executor/subcommand-router.ts","../../src/docs/render-args.ts","../../src/docs/types.ts","../../src/docs/default-renderers.ts","../../src/docs/doc-comparator.ts","../../src/docs/doc-generator.ts","../../src/docs/example-executor.ts","../../src/docs/golden-test.ts","../../src/docs/render-index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/executor/subcommand-router.ts","../../src/docs/render-args.ts","../../src/docs/types.ts","../../src/docs/default-renderers.ts","../../src/docs/doc-comparator.ts","../../src/docs/doc-generator.ts","../../src/docs/example-executor.ts","../../src/docs/golden-test.ts","../../src/docs/render-index.ts"],"mappings":";;;;;;;;;AASA;;iBAAsB,kBAAA,CAAmB,GAAA,EAAK,eAAA,GAAkB,OAAA,CAAQ,UAAA;;;;;;;KCD5D,SAAA,GAAY,MAAA,SAAe,CAAA,CAAE,OAAA;;;;KAK7B,gBAAA;EDJoD,6DCM9D,OAAA;AAAA;;;;;;;;;;AAPF;;;;;;;;;AAKA;;;;;iBAyCgB,eAAA,CAAgB,IAAA,EAAM,SAAA,EAAW,OAAA,GAAU,gBAAA;;;;KCjD/C,YAAA;AFIZ;;;AAAA,KECY,mBAAA;EFD4D,4DEGtE,YAAA,GAAe,YAAA,EFHsD;EEKrE,QAAA;AAAA;;;;UAMe,WAAA;EFXiE;EEahF,IAAA;;EAEA,WAAA;EDhBU;ECkBV,eAAA;;EAEA,WAAA;EDpBsB;ECsBtB,KAAA;EDtBuC;ECwBvC,cAAA,EAAgB,iBAAA;EDxB8B;EC0B9C,OAAA,EAAS,iBAAA;EDrBiB;ECuB1B,WAAA,EAAa,cAAA;EDrBb;ECuBA,SAAA,EAAW,eAAA;EDgBG;ECdd,OAAA,EAAS,UAAA;;EAET,KAAA;EDYoC;ECVpC,QAAA;EDUyD;ECRzD,OAAA,GAAU,MAAA;EDQ+D;ECNzE,QAAA,GAAW,OAAA;;EAEX,cAAA,GAAiB,sBAAA;;EAEjB,WAAA;EA/CsB;EAiDtB,gBAAA;AAAA;;AA5CF;;UAkDiB,cAAA;EAhDY;EAkD3B,IAAA;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
|
1
|
+
import { N as SubCommandValue, R as ExtractedFields, h as Example, l as AnyCommand, u as ArgsSchema, z as ResolvedFieldMeta } from "../arg-registry-6E4C5MTC.js";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
import * as fs from "node:fs";
|
|
5
4
|
|
|
@@ -431,6 +430,12 @@ type FormatterFunction = (content: string) => string | Promise<string>;
|
|
|
431
430
|
* Environment variable name for update mode
|
|
432
431
|
*/
|
|
433
432
|
declare const UPDATE_GOLDEN_ENV = "POLITTY_DOCS_UPDATE";
|
|
433
|
+
/**
|
|
434
|
+
* Environment variable name for doctor mode.
|
|
435
|
+
* When enabled alone, detects and reports missing section markers (read-only).
|
|
436
|
+
* When combined with POLITTY_DOCS_UPDATE=true, auto-inserts missing markers.
|
|
437
|
+
*/
|
|
438
|
+
declare const DOCTOR_ENV = "POLITTY_DOCS_DOCTOR";
|
|
434
439
|
/**
|
|
435
440
|
* All section types in rendering order
|
|
436
441
|
*/
|
|
@@ -697,5 +702,5 @@ type CommandCategory = {
|
|
|
697
702
|
*/
|
|
698
703
|
declare function renderCommandIndex(command: AnyCommand, categories: CommandCategory[], options?: CommandIndexOptions): Promise<string>;
|
|
699
704
|
//#endregion
|
|
700
|
-
export { type ArgsShape, type ArgsTableOptions, type ArgumentsRenderContext, type ArgumentsRenderFunction, type CommandCategory, type CommandIndexOptions, type CommandInfo, type DefaultRendererOptions, type DeleteFileFs, type ExampleCommandConfig, type ExampleConfig, type ExampleExecutionResult, type ExamplesRenderContext, type ExamplesRenderFunction, type ExamplesRenderOptions, type FileConfig, type FileMapping, type FormatterFunction, GLOBAL_OPTIONS_MARKER_PREFIX, type GenerateDocConfig, type GenerateDocResult, type HeadingLevel, INDEX_MARKER_PREFIX, type OptionsRenderContext, type OptionsRenderFunction, type PathConfig, ROOT_FOOTER_MARKER_PREFIX, ROOT_HEADER_MARKER_PREFIX, type RenderContentOptions, type RenderFunction, type RootCommandInfo, type RootDocConfig, SECTION_MARKER_PREFIX, SECTION_TYPES, type SectionRenderFunction, type SectionType, type SimpleRenderContext, type SimpleRenderFunction, type SubCommandInfo, type SubcommandsRenderContext, type SubcommandsRenderFunction, type SubcommandsRenderOptions, UPDATE_GOLDEN_ENV, assertDocMatch, buildCommandInfo, collectAllCommands, compareWithExisting, createCommandRenderer, defaultRenderers, executeExamples, formatDiff, generateDoc, globalOptionsEndMarker, globalOptionsStartMarker, indexEndMarker, indexStartMarker, initDocFile, renderArgsTable, renderArgumentsList, renderArgumentsListFromArray, renderArgumentsTable, renderArgumentsTableFromArray, renderCommandIndex, renderExamplesDefault, renderOptionsList, renderOptionsListFromArray, renderOptionsTable, renderOptionsTableFromArray, renderSubcommandsTable, renderSubcommandsTableFromArray, renderUsage, resolveLazyCommand, rootFooterEndMarker, rootFooterStartMarker, rootHeaderEndMarker, rootHeaderStartMarker, sectionEndMarker, sectionStartMarker, writeFile };
|
|
705
|
+
export { type ArgsShape, type ArgsTableOptions, type ArgumentsRenderContext, type ArgumentsRenderFunction, type CommandCategory, type CommandIndexOptions, type CommandInfo, DOCTOR_ENV, type DefaultRendererOptions, type DeleteFileFs, type ExampleCommandConfig, type ExampleConfig, type ExampleExecutionResult, type ExamplesRenderContext, type ExamplesRenderFunction, type ExamplesRenderOptions, type FileConfig, type FileMapping, type FormatterFunction, GLOBAL_OPTIONS_MARKER_PREFIX, type GenerateDocConfig, type GenerateDocResult, type HeadingLevel, INDEX_MARKER_PREFIX, type OptionsRenderContext, type OptionsRenderFunction, type PathConfig, ROOT_FOOTER_MARKER_PREFIX, ROOT_HEADER_MARKER_PREFIX, type RenderContentOptions, type RenderFunction, type RootCommandInfo, type RootDocConfig, SECTION_MARKER_PREFIX, SECTION_TYPES, type SectionRenderFunction, type SectionType, type SimpleRenderContext, type SimpleRenderFunction, type SubCommandInfo, type SubcommandsRenderContext, type SubcommandsRenderFunction, type SubcommandsRenderOptions, UPDATE_GOLDEN_ENV, assertDocMatch, buildCommandInfo, collectAllCommands, compareWithExisting, createCommandRenderer, defaultRenderers, executeExamples, formatDiff, generateDoc, globalOptionsEndMarker, globalOptionsStartMarker, indexEndMarker, indexStartMarker, initDocFile, renderArgsTable, renderArgumentsList, renderArgumentsListFromArray, renderArgumentsTable, renderArgumentsTableFromArray, renderCommandIndex, renderExamplesDefault, renderOptionsList, renderOptionsListFromArray, renderOptionsTable, renderOptionsTableFromArray, renderSubcommandsTable, renderSubcommandsTableFromArray, renderUsage, resolveLazyCommand, rootFooterEndMarker, rootFooterStartMarker, rootHeaderEndMarker, rootHeaderStartMarker, sectionEndMarker, sectionStartMarker, writeFile };
|
|
701
706
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/docs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/executor/subcommand-router.ts","../../src/docs/render-args.ts","../../src/docs/types.ts","../../src/docs/default-renderers.ts","../../src/docs/doc-comparator.ts","../../src/docs/doc-generator.ts","../../src/docs/example-executor.ts","../../src/docs/golden-test.ts","../../src/docs/render-index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/executor/subcommand-router.ts","../../src/docs/render-args.ts","../../src/docs/types.ts","../../src/docs/default-renderers.ts","../../src/docs/doc-comparator.ts","../../src/docs/doc-generator.ts","../../src/docs/example-executor.ts","../../src/docs/golden-test.ts","../../src/docs/render-index.ts"],"mappings":";;;;;;;;;AASA;;iBAAsB,kBAAA,CAAmB,GAAA,EAAK,eAAA,GAAkB,OAAA,CAAQ,UAAA;;;;;;;KCD5D,SAAA,GAAY,MAAA,SAAe,CAAA,CAAE,OAAA;;;;KAK7B,gBAAA;EDJoD,6DCM9D,OAAA;AAAA;;;;;;;;;;AAPF;;;;;;;;;AAKA;;;;;iBAyCgB,eAAA,CAAgB,IAAA,EAAM,SAAA,EAAW,OAAA,GAAU,gBAAA;;;;KCjD/C,YAAA;AFIZ;;;AAAA,KECY,mBAAA;EFD4D,4DEGtE,YAAA,GA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AAe,MAAA,EAAQ,iBAAA,GAAoB,OAAA;;;;;;;;iBA6BjD,WAAA,CACd,MAAA,EAAQ,IAAA,CAAK,iBAAA,qBACb,UAAA,GAAa,YAAA;;;;;;KC3/DH,eAAA;ERZ4B,oDQctC,KAAA,URd4C;EQgB5C,WAAA,URhB8D;EQkB9D,QAAA,YRlBqE;EQoBrE,OAAA;AAAA;;;;;;;APrBF;;;;;;;;;AAKA;;;;;AAyCA;;;;;;;;;;iBOuGsB,kBAAA,CACpB,OAAA,EAAS,UAAA,EACT,UAAA,EAAY,eAAA,IACZ,OAAA,GAAU,mBAAA,GACT,OAAA"}
|
package/dist/docs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as getExtractedFields, i as extractFields } from "../lazy-
|
|
2
|
-
import { i as createLogCollector, n as resolveLazyCommand } from "../subcommand-router-
|
|
1
|
+
import { a as getExtractedFields, i as extractFields } from "../lazy-xrzxwnru.js";
|
|
2
|
+
import { i as createLogCollector, n as resolveLazyCommand } from "../subcommand-router-BhYVuS83.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { isDeepStrictEqual } from "node:util";
|
|
5
5
|
import * as fs from "node:fs";
|
|
@@ -11,6 +11,12 @@ import * as path from "node:path";
|
|
|
11
11
|
*/
|
|
12
12
|
const UPDATE_GOLDEN_ENV = "POLITTY_DOCS_UPDATE";
|
|
13
13
|
/**
|
|
14
|
+
* Environment variable name for doctor mode.
|
|
15
|
+
* When enabled alone, detects and reports missing section markers (read-only).
|
|
16
|
+
* When combined with POLITTY_DOCS_UPDATE=true, auto-inserts missing markers.
|
|
17
|
+
*/
|
|
18
|
+
const DOCTOR_ENV = "POLITTY_DOCS_DOCTOR";
|
|
19
|
+
/**
|
|
14
20
|
* All section types in rendering order
|
|
15
21
|
*/
|
|
16
22
|
const SECTION_TYPES = [
|
|
@@ -819,7 +825,7 @@ async function executeSingleExample(example, rootCommand, commandPath) {
|
|
|
819
825
|
collector.start();
|
|
820
826
|
let success = true;
|
|
821
827
|
try {
|
|
822
|
-
const { runCommand } = await import("../runner-
|
|
828
|
+
const { runCommand } = await import("../runner-CnG-Ncz0.js").then((n) => n.r);
|
|
823
829
|
const result = await runCommand(rootCommand, argv);
|
|
824
830
|
success = result.success;
|
|
825
831
|
if (!result.success && result.error) console.error(result.error.message);
|
|
@@ -1112,11 +1118,8 @@ async function applyFormatter(content, formatter) {
|
|
|
1112
1118
|
if (!content.endsWith("\n") && formatted.endsWith("\n")) return formatted.slice(0, -1);
|
|
1113
1119
|
return formatted;
|
|
1114
1120
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
*/
|
|
1118
|
-
function isUpdateMode() {
|
|
1119
|
-
const value = process.env[UPDATE_GOLDEN_ENV];
|
|
1121
|
+
function isTruthyEnv(envKey) {
|
|
1122
|
+
const value = process.env[envKey];
|
|
1120
1123
|
return value === "true" || value === "1";
|
|
1121
1124
|
}
|
|
1122
1125
|
/**
|
|
@@ -1352,6 +1355,54 @@ function replaceSectionMarker(content, type, scope, newContent) {
|
|
|
1352
1355
|
return replaceMarkerSection(content, sectionStartMarker(type, scope), sectionEndMarker(type, scope), newContent);
|
|
1353
1356
|
}
|
|
1354
1357
|
/**
|
|
1358
|
+
* Insert a new section marker into existing content at the correct position
|
|
1359
|
+
* relative to other section markers for the same command, based on SECTION_TYPES order.
|
|
1360
|
+
* Preserves any existing content between adjacent markers by wrapping it with the new markers
|
|
1361
|
+
* instead of replacing it with generated content.
|
|
1362
|
+
* @throws If no adjacent marker is found (unreachable when at least one marker exists for the command)
|
|
1363
|
+
*/
|
|
1364
|
+
function insertSectionMarkerAtOrder(content, type, scope, generatedSection) {
|
|
1365
|
+
const typeIndex = SECTION_TYPES.indexOf(type);
|
|
1366
|
+
const startMarker = sectionStartMarker(type, scope);
|
|
1367
|
+
const endMarker = sectionEndMarker(type, scope);
|
|
1368
|
+
let prevBoundary = null;
|
|
1369
|
+
for (let i = typeIndex - 1; i >= 0; i--) {
|
|
1370
|
+
const prevType = SECTION_TYPES[i];
|
|
1371
|
+
const prevEnd = sectionEndMarker(prevType, scope);
|
|
1372
|
+
const prevEndIdx = content.indexOf(prevEnd);
|
|
1373
|
+
if (prevEndIdx !== -1) {
|
|
1374
|
+
prevBoundary = prevEndIdx + prevEnd.length;
|
|
1375
|
+
break;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
let nextBoundary = null;
|
|
1379
|
+
for (let i = typeIndex + 1; i < SECTION_TYPES.length; i++) {
|
|
1380
|
+
const nextType = SECTION_TYPES[i];
|
|
1381
|
+
const nextStart = sectionStartMarker(nextType, scope);
|
|
1382
|
+
const nextStartIdx = content.indexOf(nextStart);
|
|
1383
|
+
if (nextStartIdx !== -1) {
|
|
1384
|
+
nextBoundary = nextStartIdx;
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
if (prevBoundary != null && nextBoundary != null) {
|
|
1389
|
+
const wrapped = startMarker + content.slice(prevBoundary, nextBoundary).replace(/^\n+/, "\n").replace(/\n+$/, "\n") + endMarker;
|
|
1390
|
+
return content.slice(0, prevBoundary) + "\n\n" + wrapped + "\n\n" + content.slice(nextBoundary);
|
|
1391
|
+
}
|
|
1392
|
+
if (prevBoundary != null) {
|
|
1393
|
+
let afterPos = prevBoundary;
|
|
1394
|
+
while (afterPos < content.length && content[afterPos] === "\n") afterPos++;
|
|
1395
|
+
return content.slice(0, prevBoundary) + "\n\n" + generatedSection + (afterPos < content.length ? "\n\n" : "\n") + content.slice(afterPos);
|
|
1396
|
+
}
|
|
1397
|
+
if (nextBoundary != null) {
|
|
1398
|
+
let beforePos = nextBoundary;
|
|
1399
|
+
while (beforePos > 0 && content[beforePos - 1] === "\n") beforePos--;
|
|
1400
|
+
const prefix = beforePos === 0 ? "" : "\n\n";
|
|
1401
|
+
return content.slice(0, beforePos) + prefix + generatedSection + "\n\n" + content.slice(nextBoundary);
|
|
1402
|
+
}
|
|
1403
|
+
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.`);
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1355
1406
|
* Collect all section types that have markers for a given command path.
|
|
1356
1407
|
*/
|
|
1357
1408
|
function collectSectionMarkers(content, commandPath) {
|
|
@@ -1507,9 +1558,10 @@ function deriveIndexFromFiles(files, rootDocPath, allCommands, ignores) {
|
|
|
1507
1558
|
const docPath = "./" + path.relative(path.dirname(rootDocPath), filePath).replace(/\\/g, "/");
|
|
1508
1559
|
const firstCmdPath = commandPaths[0];
|
|
1509
1560
|
const cmdInfo = firstCmdPath !== void 0 ? allCommands.get(firstCmdPath) : void 0;
|
|
1561
|
+
const fileConfig = Array.isArray(fileConfigRaw) ? void 0 : fileConfigRaw;
|
|
1510
1562
|
categories.push({
|
|
1511
|
-
title: cmdInfo?.name ?? path.basename(filePath, path.extname(filePath)),
|
|
1512
|
-
description: cmdInfo?.description ?? "",
|
|
1563
|
+
title: fileConfig?.title ?? cmdInfo?.name ?? path.basename(filePath, path.extname(filePath)),
|
|
1564
|
+
description: fileConfig?.description ?? cmdInfo?.description ?? "",
|
|
1513
1565
|
commands: topLevelCommands,
|
|
1514
1566
|
docPath
|
|
1515
1567
|
});
|
|
@@ -1897,7 +1949,9 @@ async function generateDoc(config) {
|
|
|
1897
1949
|
};
|
|
1898
1950
|
}
|
|
1899
1951
|
}
|
|
1900
|
-
const updateMode =
|
|
1952
|
+
const updateMode = isTruthyEnv(UPDATE_GOLDEN_ENV);
|
|
1953
|
+
const doctorMode = isTruthyEnv(DOCTOR_ENV);
|
|
1954
|
+
let hasDoctorIssues = false;
|
|
1901
1955
|
if (rootDoc && !usingPathConfig) {
|
|
1902
1956
|
const normalizedRootDocPath = normalizeDocPathForComparison(rootDoc.path);
|
|
1903
1957
|
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 +2057,25 @@ async function generateDoc(config) {
|
|
|
2003
2057
|
diffs.push(formatDiff(existingSection, generatedSectionPart));
|
|
2004
2058
|
}
|
|
2005
2059
|
}
|
|
2060
|
+
if (doctorMode) {
|
|
2061
|
+
const generatedMarkers = collectSectionMarkers(generatedSection, targetCommand);
|
|
2062
|
+
const existingMarkerSet = new Set(existingMarkers);
|
|
2063
|
+
for (const sectionType of generatedMarkers) {
|
|
2064
|
+
if (existingMarkerSet.has(sectionType)) continue;
|
|
2065
|
+
const generatedSectionPart = extractSectionMarker(generatedSection, sectionType, targetCommand);
|
|
2066
|
+
if (!generatedSectionPart) continue;
|
|
2067
|
+
if (updateMode) {
|
|
2068
|
+
existingContent = insertSectionMarkerAtOrder(existingContent, sectionType, targetCommand, generatedSectionPart);
|
|
2069
|
+
writeFile(filePath, existingContent);
|
|
2070
|
+
if (fileStatus !== "created") fileStatus = "updated";
|
|
2071
|
+
} else {
|
|
2072
|
+
hasError = true;
|
|
2073
|
+
hasDoctorIssues = true;
|
|
2074
|
+
fileStatus = "diff";
|
|
2075
|
+
diffs.push(`[doctor] Missing section marker "${sectionType}" for command "${formatCommandPath(targetCommand)}". Run with ${DOCTOR_ENV}=true ${UPDATE_GOLDEN_ENV}=true to insert.\n${generatedSectionPart}`);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2006
2079
|
}
|
|
2007
2080
|
if (existingContent) {
|
|
2008
2081
|
const existingMarkerPaths = collectSectionMarkerPaths(existingContent);
|
|
@@ -2115,10 +2188,11 @@ async function generateDoc(config) {
|
|
|
2115
2188
|
diff: rootDocDiffs.length > 0 ? rootDocDiffs.join("\n\n") : void 0
|
|
2116
2189
|
});
|
|
2117
2190
|
}
|
|
2191
|
+
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
2192
|
return {
|
|
2119
2193
|
success: !hasError,
|
|
2120
2194
|
files: results,
|
|
2121
|
-
error: hasError ? `Documentation is out of date.
|
|
2195
|
+
error: hasError ? `Documentation is out of date. ${errorHint}` : void 0
|
|
2122
2196
|
};
|
|
2123
2197
|
}
|
|
2124
2198
|
/**
|
|
@@ -2133,7 +2207,7 @@ async function assertDocMatch(config) {
|
|
|
2133
2207
|
if (f.diff) msg += f.diff;
|
|
2134
2208
|
return msg;
|
|
2135
2209
|
}).join("\n\n");
|
|
2136
|
-
throw new Error(`Documentation does not match golden files.\n\n${diffMessages}\n\
|
|
2210
|
+
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
2211
|
}
|
|
2138
2212
|
}
|
|
2139
2213
|
/**
|
|
@@ -2144,11 +2218,11 @@ async function assertDocMatch(config) {
|
|
|
2144
2218
|
* @param fileSystem - Optional fs implementation (useful when fs is mocked)
|
|
2145
2219
|
*/
|
|
2146
2220
|
function initDocFile(config, fileSystem) {
|
|
2147
|
-
if (!
|
|
2221
|
+
if (!isTruthyEnv("POLITTY_DOCS_UPDATE")) return;
|
|
2148
2222
|
if (typeof config === "string") deleteFile(config, fileSystem);
|
|
2149
2223
|
else if (config.files) for (const filePath of Object.keys(config.files)) deleteFile(filePath, fileSystem);
|
|
2150
2224
|
}
|
|
2151
2225
|
|
|
2152
2226
|
//#endregion
|
|
2153
|
-
export { GLOBAL_OPTIONS_MARKER_PREFIX, INDEX_MARKER_PREFIX, ROOT_FOOTER_MARKER_PREFIX, ROOT_HEADER_MARKER_PREFIX, SECTION_MARKER_PREFIX, SECTION_TYPES, UPDATE_GOLDEN_ENV, assertDocMatch, buildCommandInfo, collectAllCommands, compareWithExisting, createCommandRenderer, defaultRenderers, executeExamples, formatDiff, generateDoc, globalOptionsEndMarker, globalOptionsStartMarker, indexEndMarker, indexStartMarker, initDocFile, renderArgsTable, renderArgumentsList, renderArgumentsListFromArray, renderArgumentsTable, renderArgumentsTableFromArray, renderCommandIndex, renderExamplesDefault, renderOptionsList, renderOptionsListFromArray, renderOptionsTable, renderOptionsTableFromArray, renderSubcommandsTable, renderSubcommandsTableFromArray, renderUsage, resolveLazyCommand, rootFooterEndMarker, rootFooterStartMarker, rootHeaderEndMarker, rootHeaderStartMarker, sectionEndMarker, sectionStartMarker, writeFile };
|
|
2227
|
+
export { DOCTOR_ENV, GLOBAL_OPTIONS_MARKER_PREFIX, INDEX_MARKER_PREFIX, ROOT_FOOTER_MARKER_PREFIX, ROOT_HEADER_MARKER_PREFIX, SECTION_MARKER_PREFIX, SECTION_TYPES, UPDATE_GOLDEN_ENV, assertDocMatch, buildCommandInfo, collectAllCommands, compareWithExisting, createCommandRenderer, defaultRenderers, executeExamples, formatDiff, generateDoc, globalOptionsEndMarker, globalOptionsStartMarker, indexEndMarker, indexStartMarker, initDocFile, renderArgsTable, renderArgumentsList, renderArgumentsListFromArray, renderArgumentsTable, renderArgumentsTableFromArray, renderCommandIndex, renderExamplesDefault, renderOptionsList, renderOptionsListFromArray, renderOptionsTable, renderOptionsTableFromArray, renderSubcommandsTable, renderSubcommandsTableFromArray, renderUsage, resolveLazyCommand, rootFooterEndMarker, rootFooterStartMarker, rootHeaderEndMarker, rootHeaderStartMarker, sectionEndMarker, sectionStartMarker, writeFile };
|
|
2154
2228
|
//# sourceMappingURL=index.js.map
|