politty 0.2.0 → 0.2.2
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/{command-DCpFEZFM.js → command-D-P2Pc3J.js} +1 -1
- package/dist/{command-DCpFEZFM.js.map → command-D-P2Pc3J.js.map} +1 -1
- package/dist/completion/index.cjs +1 -0
- package/dist/completion/index.cjs.map +1 -1
- package/dist/completion/index.js +2 -2
- package/dist/docs/index.cjs +47 -21
- package/dist/docs/index.cjs.map +1 -1
- package/dist/docs/index.d.cts +6 -6
- package/dist/docs/index.d.cts.map +1 -1
- package/dist/docs/index.d.ts +6 -6
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +33 -22
- package/dist/docs/index.js.map +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +30 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{runner-ttyvfYGi.cjs → runner-B38UBqhv.cjs} +336 -8
- package/dist/runner-B38UBqhv.cjs.map +1 -0
- package/dist/{runner-CyxuNkT1.js → runner-CUN50BqK.js} +338 -11
- package/dist/runner-CUN50BqK.js.map +1 -0
- package/dist/{schema-extractor-D0q5Fj2R.js → schema-extractor-1YXqFSDT.js} +1 -1
- package/dist/{schema-extractor-D0q5Fj2R.js.map → schema-extractor-1YXqFSDT.js.map} +1 -1
- package/dist/{subcommand-router-D9QSLX56.js → subcommand-router-DtCeT_O9.js} +1 -1
- package/dist/{subcommand-router-D9QSLX56.js.map → subcommand-router-DtCeT_O9.js.map} +1 -1
- package/package.json +22 -25
- package/dist/runner-BkhekqT9.cjs +0 -4
- package/dist/runner-CyxuNkT1.js.map +0 -1
- package/dist/runner-DzzbIwEy.js +0 -4
- package/dist/runner-ttyvfYGi.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -278,6 +278,35 @@ declare const logger: {
|
|
|
278
278
|
debug(message: string): void;
|
|
279
279
|
};
|
|
280
280
|
//#endregion
|
|
281
|
+
//#region src/output/markdown-renderer.d.ts
|
|
282
|
+
/**
|
|
283
|
+
* Lightweight Markdown-to-terminal renderer.
|
|
284
|
+
*
|
|
285
|
+
* Supports a subset of Markdown tailored for CLI help notes:
|
|
286
|
+
* - Inline: bold, italic, inline code, links
|
|
287
|
+
* - Block: paragraphs, unordered/ordered lists, blockquotes, headings,
|
|
288
|
+
* horizontal rules, fenced code blocks
|
|
289
|
+
*/
|
|
290
|
+
/**
|
|
291
|
+
* Apply inline Markdown formatting to a string.
|
|
292
|
+
*
|
|
293
|
+
* Processing order matters to avoid conflicts:
|
|
294
|
+
* 1. Inline code (backticks) — content inside is literal, no further processing
|
|
295
|
+
* 2. Bold (**text**)
|
|
296
|
+
* 3. Italic (*text* or _text_)
|
|
297
|
+
* 4. Links [text](url)
|
|
298
|
+
*/
|
|
299
|
+
declare function renderInline(text: string): string;
|
|
300
|
+
/**
|
|
301
|
+
* Render a Markdown string to styled terminal output.
|
|
302
|
+
*
|
|
303
|
+
* Block-level processing:
|
|
304
|
+
* - Splits input into blocks separated by blank lines
|
|
305
|
+
* - Detects headings, horizontal rules, blockquotes, lists, code blocks, and paragraphs
|
|
306
|
+
* - Applies inline formatting within each block
|
|
307
|
+
*/
|
|
308
|
+
declare function renderMarkdown(markdown: string): string;
|
|
309
|
+
//#endregion
|
|
281
310
|
//#region src/parser/argv-parser.d.ts
|
|
282
311
|
/**
|
|
283
312
|
* Parsed arguments result
|
|
@@ -474,5 +503,5 @@ type ValidationResult<T> = {
|
|
|
474
503
|
*/
|
|
475
504
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
476
505
|
//#endregion
|
|
477
|
-
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, DuplicateAliasError, DuplicateFieldError, type Example, type ExtractedFields, type HelpOptions, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, arg, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateHelp, getUnknownKeysMode, isColorEnabled, logger, parseArgv, runCommand, runMain, setColorEnabled, styles, symbols, toKebabCase, validateCommand, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases };
|
|
506
|
+
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, DuplicateAliasError, DuplicateFieldError, type Example, type ExtractedFields, type HelpOptions, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, arg, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateHelp, getUnknownKeysMode, isColorEnabled, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toKebabCase, validateCommand, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases };
|
|
478
507
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator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OAAA,CAAQ,SAAA,CAAU,OAAA;;;;;;;;;;;;;;;;;;;;;;;;iBAgCC,OAAA,CAAQ,OAAA,EAAS,UAAA,EAAY,OAAA,GAAS,WAAA,GAAmB,OAAA;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;KAaK,SAAA,gBAAyB,WAAA,SAAoB,CAAA,CAAE,OAAA,GAChD,CAAA,CAAE,KAAA,CAAM,WAAA,IACR,MAAA;;;;;;UAOM,mBAAA,qBAAwC,UAAA;EAChD,IAAA;EACA,WAAA;EACA,IAAA,GAAO,WAAA;EACP,WAAA,GAAc,iBAAA;EACd,KAAA,IAAS,OAAA;IAAW,IAAA,EAAM,SAAA,CAAU,WAAA;EAAA,aAA0B,OAAA;EAC9D,GAAA,IAAO,IAAA,EAAM,SAAA,CAAU,WAAA,MAAiB,OAAA;EACxC,OAAA,IAAW,OAAA;IACT,IAAA,EAAM,SAAA,CAAU,WAAA;IAChB,KAAA,GAAQ,KAAA;EAAA,aACG,OAAA;EACb,KAAA;EACA,QAAA,GAAW,OAAA;AAAA;;;;UAMH,cAAA,qBACY,UAAA,+BAEZ,mBAAA,CAAoB,WAAA,EAAa,OAAA;EACzC,GAAA,GAAM,IAAA,EAAM,SAAA,CAAU,WAAA,MAAiB,OAAA;AAAA;;;;UAM/B,iBAAA,qBAAsC,UAAA,sBAAgC,IAAA,CAC9E,mBAAA,CAAoB,WAAA;EAGpB,GAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AApBkB;;;;;;;;;;;;;;iBA4EJ,aAAA,qBACM,UAAA,yCAAA,CAGpB,MAAA,EAAQ,cAAA,CAAe,WAAA,EAAa,OAAA,IACnC,eAAA,CAAg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AAA,EAAQ,eAAA;AAAA;;;;iBA4Cd,sBAAA,CAAuB,MAAA,EAAQ,eAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -278,6 +278,35 @@ declare const logger: {
|
|
|
278
278
|
debug(message: string): void;
|
|
279
279
|
};
|
|
280
280
|
//#endregion
|
|
281
|
+
//#region src/output/markdown-renderer.d.ts
|
|
282
|
+
/**
|
|
283
|
+
* Lightweight Markdown-to-terminal renderer.
|
|
284
|
+
*
|
|
285
|
+
* Supports a subset of Markdown tailored for CLI help notes:
|
|
286
|
+
* - Inline: bold, italic, inline code, links
|
|
287
|
+
* - Block: paragraphs, unordered/ordered lists, blockquotes, headings,
|
|
288
|
+
* horizontal rules, fenced code blocks
|
|
289
|
+
*/
|
|
290
|
+
/**
|
|
291
|
+
* Apply inline Markdown formatting to a string.
|
|
292
|
+
*
|
|
293
|
+
* Processing order matters to avoid conflicts:
|
|
294
|
+
* 1. Inline code (backticks) — content inside is literal, no further processing
|
|
295
|
+
* 2. Bold (**text**)
|
|
296
|
+
* 3. Italic (*text* or _text_)
|
|
297
|
+
* 4. Links [text](url)
|
|
298
|
+
*/
|
|
299
|
+
declare function renderInline(text: string): string;
|
|
300
|
+
/**
|
|
301
|
+
* Render a Markdown string to styled terminal output.
|
|
302
|
+
*
|
|
303
|
+
* Block-level processing:
|
|
304
|
+
* - Splits input into blocks separated by blank lines
|
|
305
|
+
* - Detects headings, horizontal rules, blockquotes, lists, code blocks, and paragraphs
|
|
306
|
+
* - Applies inline formatting within each block
|
|
307
|
+
*/
|
|
308
|
+
declare function renderMarkdown(markdown: string): string;
|
|
309
|
+
//#endregion
|
|
281
310
|
//#region src/parser/argv-parser.d.ts
|
|
282
311
|
/**
|
|
283
312
|
* Parsed arguments result
|
|
@@ -474,5 +503,5 @@ type ValidationResult<T> = {
|
|
|
474
503
|
*/
|
|
475
504
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
476
505
|
//#endregion
|
|
477
|
-
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, DuplicateAliasError, DuplicateFieldError, type Example, type ExtractedFields, type HelpOptions, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, arg, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateHelp, getUnknownKeysMode, isColorEnabled, logger, parseArgv, runCommand, runMain, setColorEnabled, styles, symbols, toKebabCase, validateCommand, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases };
|
|
506
|
+
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, DuplicateAliasError, DuplicateFieldError, type Example, type ExtractedFields, type HelpOptions, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, arg, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateHelp, getUnknownKeysMode, isColorEnabled, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toKebabCase, validateCommand, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases };
|
|
478
507
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;KAaK,SAAA,gBAAyB,WAAA,SAAoB,CAAA,CAAE,OAAA,GAChD,CAAA,CAAE,KAAA,CAAM,WAAA,IACR,MAAA;;;;;;UAOM,mBAAA,qBAAwC,UAAA;EAChD,IAAA;EACA,WAAA;EACA,IAAA,GAAO,WAAA;EACP,WAAA,GAAc,iBAAA;EACd,KAAA,IAAS,OAAA;IAAW,IAAA,EAAM,SAAA,CAAU,WAAA;EAAA,aAA0B,OAAA;EAC9D,GAAA,IAAO,IAAA,EAAM,SAAA,CAAU,WAAA,MAAiB,OAAA;EACxC,OAAA,IAAW,OAAA;IACT,IAAA,EAAM,SAAA,CAAU,WAAA;IAChB,KAAA,GAAQ,KAAA;EAAA,aACG,OAAA;EACb,KAAA;EACA,QAAA,GAAW,OAAA;AAAA;;;;UAMH,cAAA,qBACY,UAAA,+BAEZ,mBAAA,CAAoB,WAAA,EAAa,OAAA;EACzC,GAAA,GAAM,IAAA,EAAM,SAAA,CAAU,WAAA,MAAiB,OAAA;AAAA;;;;UAM/B,iBAAA,qBAAsC,UAAA,sBAAgC,IAAA,CAC9E,mBAAA,CAAoB,WAAA;EAGpB,GAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AApBkB;;;;;;;;;;;;;;iBA4EJ,aAAA,qBACM,UAAA,yCAAA,CAGpB,MAAA,EAAQ,cAAA,CAAe,WAAA,EAAa,OAAA,IACnC,eAAA,CAAgB,WAAA,EAAa,SAAA,CAAU,WAAA,GAAc,OAAA;AAAA,iBAGxC,aAAA,qBAAkC,UAAA,yBAAA,CAChD,MAAA,EAAQ,iBAAA,CAAkB,WAAA,IACzB,kBAAA,CAAmB,WAAA,EAAa,SAAA,CAAU,WAAA;;;;;;;AAhHxB;;;;;;;;;;;;;;;;;;;;AAOX;;iBCoDY,UAAA,mBAAA,CACpB,OAAA,EAAS,UAAA,EACT,IAAA,YACA,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,SAAA,CAAU,OAAA;;;;;;;;;;;;;;;;;;;;;;;;iBAgCC,OAAA,CAAQ,OAAA,EAAS,UAAA,EAAY,OAAA,GAAS,WAAA,GAAmB,OAAA;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;KAaK,SAAA,gBAAyB,WAAA,SAAoB,CAAA,CAAE,OAAA,GAChD,CAAA,CAAE,KAAA,CAAM,WAAA,IACR,MAAA;;;;;;UAOM,mBAAA,qBAAwC,UAAA;EAChD,IAAA;EACA,WAAA;EACA,IAAA,GAAO,WAAA;EACP,WAAA,GAAc,iBAAA;EACd,KAAA,IAAS,OAAA;IAAW,IAAA,EAAM,SAAA,CAAU,WAAA;EAAA,aAA0B,OAAA;EAC9D,GAAA,IAAO,IAAA,EAAM,SAAA,CAAU,WAAA,MAAiB,OAAA;EACxC,OAAA,IAAW,OAAA;IACT,IAAA,EAAM,SAAA,CAAU,WAAA;IAChB,KAAA,GAAQ,KAAA;EAAA,aACG,OAAA;EACb,KAAA;EACA,QAAA,GAAW,OAAA;AAAA;;;;UAMH,cAAA,qBACY,UAAA,+BAEZ,mBAAA,CAAoB,WAAA,EAAa,OAAA;EACzC,GAAA,GAAM,IAAA,EAAM,SAAA,CAAU,WAAA,MAAiB,OAAA;AAAA;;;;UAM/B,iBAAA,qBAAsC,UAAA,sBAAgC,IAAA,CAC9E,mBAAA,CAAoB,WAAA;EAGpB,GAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;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AAA;ERIU;EQFV,IAAA;ERGE;EQDF,QAAA;ERCQ;EQCR,QAAA;AAAA;;;;KAMU,gBAAA;EACN,OAAA;EAAe,IAAA,EAAM,CAAA;AAAA;EACrB,OAAA;EAAgB,MAAA,EAAQ,eAAA;AAAA;;;;iBA4Cd,sBAAA,CAAuB,MAAA,EAAQ,eAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
1
|
+
import { C as symbols, S as styles, _ as renderInline, a as parseArgv, b as logger, c as validateDuplicateAliases, d as validateReservedAliases, f as DuplicateAliasError, g as generateHelp, h as ReservedAliasError, i as formatValidationErrors, l as validateDuplicateFields, m as PositionalConfigError, n as runMain, o as formatCommandValidationErrors, p as DuplicateFieldError, s as validateCommand, t as runCommand, u as validatePositionalConfig, v as renderMarkdown, x as setColorEnabled, y as isColorEnabled } from "./runner-CUN50BqK.js";
|
|
2
|
+
import { a as arg, i as toKebabCase, r as getUnknownKeysMode, t as extractFields } from "./schema-extractor-1YXqFSDT.js";
|
|
3
|
+
import { t as defineCommand } from "./command-D-P2Pc3J.js";
|
|
4
4
|
|
|
5
|
-
export { DuplicateAliasError, DuplicateFieldError, PositionalConfigError, ReservedAliasError, arg, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateHelp, getUnknownKeysMode, isColorEnabled, logger, parseArgv, runCommand, runMain, setColorEnabled, styles, symbols, toKebabCase, validateCommand, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases };
|
|
5
|
+
export { DuplicateAliasError, DuplicateFieldError, PositionalConfigError, ReservedAliasError, arg, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateHelp, getUnknownKeysMode, isColorEnabled, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toKebabCase, validateCommand, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases };
|
|
@@ -141,7 +141,7 @@ const styles = {
|
|
|
141
141
|
white: createStyleFn("white"),
|
|
142
142
|
gray: createStyleFn("gray"),
|
|
143
143
|
command: createStyleFn("bold"),
|
|
144
|
-
commandName: createStyleFn("bold", "cyan"),
|
|
144
|
+
commandName: createStyleFn("bold", "underline", "cyan"),
|
|
145
145
|
option: createStyleFn("cyan"),
|
|
146
146
|
optionName: createStyleFn("bold"),
|
|
147
147
|
placeholder: createStyleFn("dim"),
|
|
@@ -189,6 +189,311 @@ const logger = {
|
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/output/markdown-renderer.ts
|
|
194
|
+
/**
|
|
195
|
+
* Lightweight Markdown-to-terminal renderer.
|
|
196
|
+
*
|
|
197
|
+
* Supports a subset of Markdown tailored for CLI help notes:
|
|
198
|
+
* - Inline: bold, italic, inline code, links
|
|
199
|
+
* - Block: paragraphs, unordered/ordered lists, blockquotes, headings,
|
|
200
|
+
* horizontal rules, fenced code blocks
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Apply inline Markdown formatting to a string.
|
|
204
|
+
*
|
|
205
|
+
* Processing order matters to avoid conflicts:
|
|
206
|
+
* 1. Inline code (backticks) — content inside is literal, no further processing
|
|
207
|
+
* 2. Bold (**text**)
|
|
208
|
+
* 3. Italic (*text* or _text_)
|
|
209
|
+
* 4. Links [text](url)
|
|
210
|
+
*/
|
|
211
|
+
function renderInline(text) {
|
|
212
|
+
const codeSpans = [];
|
|
213
|
+
let result = text.replace(/`([^`]+)`/g, (_match, code) => {
|
|
214
|
+
const index = codeSpans.length;
|
|
215
|
+
codeSpans.push(styles.cyan(code));
|
|
216
|
+
return `\x00CODE${index}\x00`;
|
|
217
|
+
});
|
|
218
|
+
result = result.replace(/\*\*(.+?)\*\*/g, (_match, content) => styles.bold(content));
|
|
219
|
+
result = result.replace(/__(.+?)__/g, (_match, content) => styles.bold(content));
|
|
220
|
+
result = result.replace(/\*(.+?)\*/g, (_match, content) => styles.italic(content));
|
|
221
|
+
result = result.replace(/(?<!\w)_(.+?)_(?!\w)/g, (_match, content) => styles.italic(content));
|
|
222
|
+
result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, linkText, url) => `${styles.underline(linkText)} ${styles.dim(`(${url})`)}`);
|
|
223
|
+
result = result.replace(/\x00CODE(\d+)\x00/g, (_match, index) => codeSpans[Number(index)]);
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Render a Markdown string to styled terminal output.
|
|
228
|
+
*
|
|
229
|
+
* Block-level processing:
|
|
230
|
+
* - Splits input into blocks separated by blank lines
|
|
231
|
+
* - Detects headings, horizontal rules, blockquotes, lists, code blocks, and paragraphs
|
|
232
|
+
* - Applies inline formatting within each block
|
|
233
|
+
*/
|
|
234
|
+
function renderMarkdown(markdown) {
|
|
235
|
+
return splitIntoBlocks(markdown.split("\n")).map(renderBlock).join("\n\n");
|
|
236
|
+
}
|
|
237
|
+
const HEADING_RE = /^(#{1,6})\s+(.+)$/;
|
|
238
|
+
const HR_RE = /^(?:---+|\*\*\*+|___+)\s*$/;
|
|
239
|
+
const BLOCKQUOTE_RE = /^>\s?(.*)$/;
|
|
240
|
+
const UL_RE = /^-\s+(.+)$/;
|
|
241
|
+
const OL_RE = /^(\d+)[.)]\s+(.+)$/;
|
|
242
|
+
const FENCE_OPEN_RE = /^(`{3,}|~{3,})(\S*)\s*$/;
|
|
243
|
+
const ALERT_RE = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/;
|
|
244
|
+
const TABLE_ROW_RE = /^\|(.+)\|$/;
|
|
245
|
+
const TABLE_SEP_RE = /^\|(\s*:?-+:?\s*\|)+$/;
|
|
246
|
+
/**
|
|
247
|
+
* Split lines into logical blocks separated by blank lines.
|
|
248
|
+
* Consecutive lines of the same block type are grouped together.
|
|
249
|
+
*/
|
|
250
|
+
function splitIntoBlocks(lines) {
|
|
251
|
+
const blocks = [];
|
|
252
|
+
let i = 0;
|
|
253
|
+
while (i < lines.length) {
|
|
254
|
+
const line = lines[i];
|
|
255
|
+
if (line.trim() === "") {
|
|
256
|
+
i++;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
const fenceMatch = line.match(FENCE_OPEN_RE);
|
|
260
|
+
if (fenceMatch) {
|
|
261
|
+
const fence = fenceMatch[1];
|
|
262
|
+
const lang = fenceMatch[2] ?? "";
|
|
263
|
+
const codeLines = [];
|
|
264
|
+
i++;
|
|
265
|
+
while (i < lines.length) {
|
|
266
|
+
if (lines[i].startsWith(fence.charAt(0).repeat(fence.length)) && lines[i].trim() === fence.charAt(0).repeat(Math.max(fence.length, lines[i].trim().length))) {
|
|
267
|
+
i++;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
codeLines.push(lines[i]);
|
|
271
|
+
i++;
|
|
272
|
+
}
|
|
273
|
+
blocks.push({
|
|
274
|
+
type: "code",
|
|
275
|
+
lang,
|
|
276
|
+
lines: codeLines
|
|
277
|
+
});
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
const headingMatch = line.match(HEADING_RE);
|
|
281
|
+
if (headingMatch) {
|
|
282
|
+
blocks.push({
|
|
283
|
+
type: "heading",
|
|
284
|
+
level: headingMatch[1].length,
|
|
285
|
+
content: headingMatch[2]
|
|
286
|
+
});
|
|
287
|
+
i++;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (HR_RE.test(line)) {
|
|
291
|
+
blocks.push({ type: "hr" });
|
|
292
|
+
i++;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (BLOCKQUOTE_RE.test(line)) {
|
|
296
|
+
const bqLines = [];
|
|
297
|
+
while (i < lines.length) {
|
|
298
|
+
const bqMatch = lines[i].match(BLOCKQUOTE_RE);
|
|
299
|
+
if (bqMatch) {
|
|
300
|
+
bqLines.push(bqMatch[1]);
|
|
301
|
+
i++;
|
|
302
|
+
} else break;
|
|
303
|
+
}
|
|
304
|
+
if (bqLines.length > 0) {
|
|
305
|
+
const alertMatch = bqLines[0].match(ALERT_RE);
|
|
306
|
+
if (alertMatch) {
|
|
307
|
+
const contentLines = bqLines.slice(1).filter((l) => l !== "");
|
|
308
|
+
blocks.push({
|
|
309
|
+
type: "alert",
|
|
310
|
+
alertType: alertMatch[1],
|
|
311
|
+
lines: contentLines
|
|
312
|
+
});
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
blocks.push({
|
|
317
|
+
type: "blockquote",
|
|
318
|
+
lines: bqLines
|
|
319
|
+
});
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
if (UL_RE.test(line)) {
|
|
323
|
+
const items = [];
|
|
324
|
+
while (i < lines.length) {
|
|
325
|
+
const ulMatch = lines[i].match(UL_RE);
|
|
326
|
+
if (ulMatch) {
|
|
327
|
+
items.push(ulMatch[1]);
|
|
328
|
+
i++;
|
|
329
|
+
} else break;
|
|
330
|
+
}
|
|
331
|
+
blocks.push({
|
|
332
|
+
type: "ul",
|
|
333
|
+
items
|
|
334
|
+
});
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
const olMatch = line.match(OL_RE);
|
|
338
|
+
if (olMatch) {
|
|
339
|
+
const start = Number(olMatch[1]);
|
|
340
|
+
const items = [];
|
|
341
|
+
while (i < lines.length) {
|
|
342
|
+
const match = lines[i].match(OL_RE);
|
|
343
|
+
if (match) {
|
|
344
|
+
items.push(match[2]);
|
|
345
|
+
i++;
|
|
346
|
+
} else break;
|
|
347
|
+
}
|
|
348
|
+
blocks.push({
|
|
349
|
+
type: "ol",
|
|
350
|
+
items,
|
|
351
|
+
start
|
|
352
|
+
});
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (TABLE_ROW_RE.test(line) && i + 1 < lines.length && TABLE_SEP_RE.test(lines[i + 1])) {
|
|
356
|
+
const headers = parseCells(line);
|
|
357
|
+
const alignments = parseAlignments(lines[i + 1]);
|
|
358
|
+
i += 2;
|
|
359
|
+
const rows = [];
|
|
360
|
+
while (i < lines.length && TABLE_ROW_RE.test(lines[i])) {
|
|
361
|
+
rows.push(parseCells(lines[i]));
|
|
362
|
+
i++;
|
|
363
|
+
}
|
|
364
|
+
blocks.push({
|
|
365
|
+
type: "table",
|
|
366
|
+
headers,
|
|
367
|
+
alignments,
|
|
368
|
+
rows
|
|
369
|
+
});
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
const paraLines = [];
|
|
373
|
+
while (i < lines.length) {
|
|
374
|
+
const l = lines[i];
|
|
375
|
+
if (l.trim() === "" || HEADING_RE.test(l) || HR_RE.test(l) || BLOCKQUOTE_RE.test(l) || UL_RE.test(l) || OL_RE.test(l) || FENCE_OPEN_RE.test(l) || TABLE_ROW_RE.test(l) && i + 1 < lines.length && TABLE_SEP_RE.test(lines[i + 1])) break;
|
|
376
|
+
paraLines.push(l);
|
|
377
|
+
i++;
|
|
378
|
+
}
|
|
379
|
+
if (paraLines.length > 0) blocks.push({
|
|
380
|
+
type: "paragraph",
|
|
381
|
+
lines: paraLines
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
return blocks;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Parse cells from a table row: `| a | b | c |` → `["a", "b", "c"]`
|
|
388
|
+
*/
|
|
389
|
+
function parseCells(row) {
|
|
390
|
+
return row.slice(1, -1).split("|").map((cell) => cell.trim());
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Parse alignment from separator row: `|:---|:---:|---:|` → `["left", "center", "right"]`
|
|
394
|
+
*/
|
|
395
|
+
function parseAlignments(sepRow) {
|
|
396
|
+
return sepRow.slice(1, -1).split("|").map((cell) => {
|
|
397
|
+
const trimmed = cell.trim();
|
|
398
|
+
if (trimmed.startsWith(":") && trimmed.endsWith(":")) return "center";
|
|
399
|
+
if (trimmed.endsWith(":")) return "right";
|
|
400
|
+
return "left";
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Pad a string to a given width with the specified alignment.
|
|
405
|
+
*/
|
|
406
|
+
function alignText(text, width, alignment) {
|
|
407
|
+
if (alignment === "right") return text.padStart(width);
|
|
408
|
+
if (alignment === "center") {
|
|
409
|
+
const total = width - text.length;
|
|
410
|
+
const left = Math.floor(total / 2);
|
|
411
|
+
return " ".repeat(left) + text + " ".repeat(total - left);
|
|
412
|
+
}
|
|
413
|
+
return text.padEnd(width);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Style configuration for GitHub-style alert blocks.
|
|
417
|
+
*/
|
|
418
|
+
const alertStyles = {
|
|
419
|
+
NOTE: {
|
|
420
|
+
icon: "ℹ",
|
|
421
|
+
label: "Note",
|
|
422
|
+
styleFn: styles.cyan
|
|
423
|
+
},
|
|
424
|
+
TIP: {
|
|
425
|
+
icon: "💡",
|
|
426
|
+
label: "Tip",
|
|
427
|
+
styleFn: styles.green
|
|
428
|
+
},
|
|
429
|
+
IMPORTANT: {
|
|
430
|
+
icon: "❗",
|
|
431
|
+
label: "Important",
|
|
432
|
+
styleFn: styles.magenta
|
|
433
|
+
},
|
|
434
|
+
WARNING: {
|
|
435
|
+
icon: "⚠",
|
|
436
|
+
label: "Warning",
|
|
437
|
+
styleFn: styles.yellow
|
|
438
|
+
},
|
|
439
|
+
CAUTION: {
|
|
440
|
+
icon: "🔴",
|
|
441
|
+
label: "Caution",
|
|
442
|
+
styleFn: styles.red
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Render a single block to styled terminal output.
|
|
447
|
+
*/
|
|
448
|
+
function renderBlock(block) {
|
|
449
|
+
switch (block.type) {
|
|
450
|
+
case "heading": return styles.green(styles.bold(renderInline(block.content)));
|
|
451
|
+
case "hr": return styles.dim("─".repeat(40));
|
|
452
|
+
case "blockquote": {
|
|
453
|
+
const prefix = styles.dim("│ ");
|
|
454
|
+
return block.lines.map((line) => `${prefix}${renderInline(line)}`).join("\n");
|
|
455
|
+
}
|
|
456
|
+
case "alert": {
|
|
457
|
+
const { icon, label, styleFn } = alertStyles[block.alertType];
|
|
458
|
+
const prefix = styleFn(styles.bold("│")) + " ";
|
|
459
|
+
const header = `${prefix}${styleFn(icon)} ${styleFn(label)}`;
|
|
460
|
+
if (block.lines.length === 0) return header;
|
|
461
|
+
return `${header}\n${block.lines.map((line) => `${prefix}${renderInline(line)}`).join("\n")}`;
|
|
462
|
+
}
|
|
463
|
+
case "ul": return block.items.map((item) => `${styles.dim("•")} ${renderInline(item)}`).join("\n");
|
|
464
|
+
case "ol": {
|
|
465
|
+
const maxNum = block.start + block.items.length - 1;
|
|
466
|
+
const width = String(maxNum).length;
|
|
467
|
+
return block.items.map((item, i) => {
|
|
468
|
+
const num = String(block.start + i).padStart(width, " ");
|
|
469
|
+
return `${styles.dim(`${num}.`)} ${renderInline(item)}`;
|
|
470
|
+
}).join("\n");
|
|
471
|
+
}
|
|
472
|
+
case "table": {
|
|
473
|
+
const colCount = block.headers.length;
|
|
474
|
+
const colWidths = block.headers.map((h, i) => {
|
|
475
|
+
const cellLengths = block.rows.map((row) => (row[i] ?? "").length);
|
|
476
|
+
return Math.max(h.length, ...cellLengths);
|
|
477
|
+
});
|
|
478
|
+
const pipe = styles.dim("│");
|
|
479
|
+
const topBorder = styles.dim(`┌─${colWidths.map((w) => "─".repeat(w)).join("─┬─")}─┐`);
|
|
480
|
+
const midBorder = styles.dim(`├─${colWidths.map((w) => "─".repeat(w)).join("─┼─")}─┤`);
|
|
481
|
+
const botBorder = styles.dim(`└─${colWidths.map((w) => "─".repeat(w)).join("─┴─")}─┘`);
|
|
482
|
+
return [
|
|
483
|
+
topBorder,
|
|
484
|
+
`${pipe} ${block.headers.map((h, i) => styles.bold(alignText(h, colWidths[i], block.alignments[i] ?? "left"))).join(` ${pipe} `)} ${pipe}`,
|
|
485
|
+
midBorder,
|
|
486
|
+
...block.rows.map((row) => {
|
|
487
|
+
return `${pipe} ${Array.from({ length: colCount }, (_, i) => renderInline(alignText(row[i] ?? "", colWidths[i], block.alignments[i] ?? "left"))).join(` ${pipe} `)} ${pipe}`;
|
|
488
|
+
}),
|
|
489
|
+
botBorder
|
|
490
|
+
].join("\n");
|
|
491
|
+
}
|
|
492
|
+
case "code": return block.lines.map((line) => ` ${styles.yellow(line)}`).join("\n");
|
|
493
|
+
case "paragraph": return renderInline(block.lines.join(" "));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
192
497
|
//#endregion
|
|
193
498
|
//#region src/output/help-generator.ts
|
|
194
499
|
/**
|
|
@@ -454,17 +759,15 @@ function renderSubcommandsWithOptions(subCommands, parentPath, baseIndent) {
|
|
|
454
759
|
function generateHelp(command, options) {
|
|
455
760
|
const sections = [];
|
|
456
761
|
const context = options.context;
|
|
457
|
-
const headerLines = [];
|
|
458
762
|
const displayName = buildFullCommandName(command, context);
|
|
459
763
|
if (displayName) {
|
|
460
764
|
let header = styles.commandName(displayName);
|
|
461
765
|
if (context?.rootName && context.commandPath && context.commandPath.length > 0) if (context.rootVersion) header += ` ${styles.version(`(${context.rootName} v${context.rootVersion})`)}`;
|
|
462
766
|
else header += ` ${styles.version(`(${context.rootName})`)}`;
|
|
463
767
|
else if (context?.rootVersion) header += ` ${styles.version(`v${context.rootVersion}`)}`;
|
|
464
|
-
|
|
768
|
+
sections.push(header);
|
|
465
769
|
}
|
|
466
|
-
if (command.description)
|
|
467
|
-
if (headerLines.length > 0) sections.push(headerLines.join("\n"));
|
|
770
|
+
if (command.description) sections.push(command.description);
|
|
468
771
|
sections.push(`${styles.sectionHeader("Usage:")} ${renderUsageLine(command, context)}`);
|
|
469
772
|
const optionsText = renderOptions(command, options.descriptions, context);
|
|
470
773
|
if (optionsText) sections.push(`${styles.sectionHeader("Options:")}\n${optionsText}`);
|
|
@@ -487,8 +790,11 @@ function generateHelp(command, options) {
|
|
|
487
790
|
const exampleLines = renderExamplesForHelp(command.examples, context);
|
|
488
791
|
sections.push(`${styles.sectionHeader("Examples:")}\n${exampleLines}`);
|
|
489
792
|
}
|
|
490
|
-
if (command.notes)
|
|
491
|
-
|
|
793
|
+
if (command.notes) {
|
|
794
|
+
const indented = renderMarkdown(command.notes).split("\n").map((line) => line === "" ? "" : ` ${line}`).join("\n");
|
|
795
|
+
sections.push(`${styles.sectionHeader("Notes:")}\n${indented}`);
|
|
796
|
+
}
|
|
797
|
+
return `\n${sections.join("\n\n")}\n`;
|
|
492
798
|
}
|
|
493
799
|
/**
|
|
494
800
|
* Render examples for CLI help output
|
|
@@ -1149,6 +1455,10 @@ function formatValidationErrors(errors) {
|
|
|
1149
1455
|
|
|
1150
1456
|
//#endregion
|
|
1151
1457
|
//#region src/core/runner.ts
|
|
1458
|
+
var runner_exports = /* @__PURE__ */ require_docs_index.__exportAll({
|
|
1459
|
+
runCommand: () => runCommand,
|
|
1460
|
+
runMain: () => runMain
|
|
1461
|
+
});
|
|
1152
1462
|
/**
|
|
1153
1463
|
* Default logger using console
|
|
1154
1464
|
*/
|
|
@@ -1429,6 +1739,18 @@ Object.defineProperty(exports, 'parseArgv', {
|
|
|
1429
1739
|
return parseArgv;
|
|
1430
1740
|
}
|
|
1431
1741
|
});
|
|
1742
|
+
Object.defineProperty(exports, 'renderInline', {
|
|
1743
|
+
enumerable: true,
|
|
1744
|
+
get: function () {
|
|
1745
|
+
return renderInline;
|
|
1746
|
+
}
|
|
1747
|
+
});
|
|
1748
|
+
Object.defineProperty(exports, 'renderMarkdown', {
|
|
1749
|
+
enumerable: true,
|
|
1750
|
+
get: function () {
|
|
1751
|
+
return renderMarkdown;
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1432
1754
|
Object.defineProperty(exports, 'runCommand', {
|
|
1433
1755
|
enumerable: true,
|
|
1434
1756
|
get: function () {
|
|
@@ -1441,6 +1763,12 @@ Object.defineProperty(exports, 'runMain', {
|
|
|
1441
1763
|
return runMain;
|
|
1442
1764
|
}
|
|
1443
1765
|
});
|
|
1766
|
+
Object.defineProperty(exports, 'runner_exports', {
|
|
1767
|
+
enumerable: true,
|
|
1768
|
+
get: function () {
|
|
1769
|
+
return runner_exports;
|
|
1770
|
+
}
|
|
1771
|
+
});
|
|
1444
1772
|
Object.defineProperty(exports, 'setColorEnabled', {
|
|
1445
1773
|
enumerable: true,
|
|
1446
1774
|
get: function () {
|
|
@@ -1489,4 +1817,4 @@ Object.defineProperty(exports, 'validateReservedAliases', {
|
|
|
1489
1817
|
return validateReservedAliases;
|
|
1490
1818
|
}
|
|
1491
1819
|
});
|
|
1492
|
-
//# sourceMappingURL=runner-
|
|
1820
|
+
//# sourceMappingURL=runner-B38UBqhv.cjs.map
|