legal-markdown-js 2.7.0 → 2.8.0
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 +32 -0
- package/dist/cli/interactive/index.d.ts +24 -0
- package/dist/cli/interactive/index.d.ts.map +1 -0
- package/dist/cli/interactive/index.js +107 -0
- package/dist/cli/interactive/index.js.map +1 -0
- package/dist/cli/interactive/prompts/confirmation.d.ts +9 -0
- package/dist/cli/interactive/prompts/confirmation.d.ts.map +1 -0
- package/dist/cli/interactive/prompts/confirmation.js +20 -0
- package/dist/cli/interactive/prompts/confirmation.js.map +1 -0
- package/dist/cli/interactive/prompts/css-selector.d.ts +9 -0
- package/dist/cli/interactive/prompts/css-selector.d.ts.map +1 -0
- package/dist/cli/interactive/prompts/css-selector.js +39 -0
- package/dist/cli/interactive/prompts/css-selector.js.map +1 -0
- package/dist/cli/interactive/prompts/file-selector.d.ts +19 -0
- package/dist/cli/interactive/prompts/file-selector.d.ts.map +1 -0
- package/dist/cli/interactive/prompts/file-selector.js +178 -0
- package/dist/cli/interactive/prompts/file-selector.js.map +1 -0
- package/dist/cli/interactive/prompts/filename.d.ts +8 -0
- package/dist/cli/interactive/prompts/filename.d.ts.map +1 -0
- package/dist/cli/interactive/prompts/filename.js +72 -0
- package/dist/cli/interactive/prompts/filename.js.map +1 -0
- package/dist/cli/interactive/prompts/output-format.d.ts +9 -0
- package/dist/cli/interactive/prompts/output-format.d.ts.map +1 -0
- package/dist/cli/interactive/prompts/output-format.js +29 -0
- package/dist/cli/interactive/prompts/output-format.js.map +1 -0
- package/dist/cli/interactive/prompts/processing-options.d.ts +9 -0
- package/dist/cli/interactive/prompts/processing-options.d.ts.map +1 -0
- package/dist/cli/interactive/prompts/processing-options.js +34 -0
- package/dist/cli/interactive/prompts/processing-options.js.map +1 -0
- package/dist/cli/interactive/service.d.ts +55 -0
- package/dist/cli/interactive/service.d.ts.map +1 -0
- package/dist/cli/interactive/service.js +160 -0
- package/dist/cli/interactive/service.js.map +1 -0
- package/dist/cli/interactive/types.d.ts +69 -0
- package/dist/cli/interactive/types.d.ts.map +1 -0
- package/dist/cli/interactive/types.js +9 -0
- package/dist/cli/interactive/types.js.map +1 -0
- package/dist/cli/interactive/utils/file-scanner.d.ts +41 -0
- package/dist/cli/interactive/utils/file-scanner.d.ts.map +1 -0
- package/dist/cli/interactive/utils/file-scanner.js +141 -0
- package/dist/cli/interactive/utils/file-scanner.js.map +1 -0
- package/dist/cli/interactive/utils/format-helpers.d.ts +44 -0
- package/dist/cli/interactive/utils/format-helpers.d.ts.map +1 -0
- package/dist/cli/interactive/utils/format-helpers.js +102 -0
- package/dist/cli/interactive/utils/format-helpers.js.map +1 -0
- package/dist/constants/paths.d.ts +1 -1
- package/dist/constants/paths.js +2 -2
- package/dist/constants/paths.js.map +1 -1
- package/dist/extensions/generators/pdf-generator.d.ts +1 -1
- package/dist/extensions/generators/pdf-generator.js +2 -2
- package/dist/extensions/generators/pdf-generator.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -37,6 +37,12 @@ imports `@import`, and generate professional PDFs ready to be shared.
|
|
|
37
37
|
npm install legal-markdown-js
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
After installation, you'll have access to these commands:
|
|
41
|
+
|
|
42
|
+
- **`legal-md`** - Standard command-line interface with options and flags
|
|
43
|
+
- **`legal-md-ui`** - Interactive CLI with guided prompts and smart defaults
|
|
44
|
+
- **`legal2md`** - Alias for `legal-md` (for compatibility)
|
|
45
|
+
|
|
40
46
|
## 🚀 Try it Online
|
|
41
47
|
|
|
42
48
|
**[Live Playground](https://petalo.github.io/legal-markdown-js/)** - Try Legal
|
|
@@ -47,6 +53,8 @@ processing.
|
|
|
47
53
|
|
|
48
54
|
### Command Line Usage
|
|
49
55
|
|
|
56
|
+
#### Standard CLI
|
|
57
|
+
|
|
50
58
|
```bash
|
|
51
59
|
# Basic document processing
|
|
52
60
|
legal-md input.md output.md
|
|
@@ -58,6 +66,28 @@ legal-md document.md --pdf --highlight
|
|
|
58
66
|
legal-md document.md --html --css styles.css
|
|
59
67
|
```
|
|
60
68
|
|
|
69
|
+
#### Interactive CLI
|
|
70
|
+
|
|
71
|
+
For a guided, user-friendly experience, use the interactive CLI:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Launch interactive mode
|
|
75
|
+
legal-md-ui
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The interactive CLI provides:
|
|
79
|
+
|
|
80
|
+
- **📁 Smart file discovery**: Automatically scans your input directory for
|
|
81
|
+
supported files (`.md`, `.markdown`, `.rst`, `.tex`, `.latex`, `.txt`)
|
|
82
|
+
- **🎯 Multiple output formats**: Select any combination of PDF, HTML, Markdown,
|
|
83
|
+
and metadata export
|
|
84
|
+
- **⚙️ Conditional options**: Processing options adapt based on your selected
|
|
85
|
+
formats
|
|
86
|
+
- **🎨 CSS selection**: Choose from available stylesheets or proceed without
|
|
87
|
+
custom styling
|
|
88
|
+
- **📋 Configuration summary**: Review all settings before processing
|
|
89
|
+
- **✅ Clear results**: See exactly which files were generated
|
|
90
|
+
|
|
61
91
|
### Programmatic Usage
|
|
62
92
|
|
|
63
93
|
```typescript
|
|
@@ -106,6 +136,8 @@ All original Legal Markdown features are fully implemented:
|
|
|
106
136
|
|
|
107
137
|
Additional features available only in the Node.js version:
|
|
108
138
|
|
|
139
|
+
- **Interactive CLI**: User-friendly guided interface with smart file discovery
|
|
140
|
+
and configuration management
|
|
109
141
|
- **Mixins System**: Template substitution and helpers with `{{variable}}`
|
|
110
142
|
syntax
|
|
111
143
|
- **AST-Based Processing**: Modern AST-based mixin processing to prevent text
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Interactive CLI for Legal Markdown Processing
|
|
4
|
+
*
|
|
5
|
+
* This module provides an interactive command-line interface for Legal Markdown
|
|
6
|
+
* processing, guiding users through file selection, format options, and processing
|
|
7
|
+
* configuration with intuitive prompts.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Interactive file selection with recursive directory scanning
|
|
11
|
+
* - Multiple output format selection (HTML, PDF, Markdown, Metadata)
|
|
12
|
+
* - Conditional processing options based on selected formats
|
|
13
|
+
* - CSS file selection for HTML/PDF styling
|
|
14
|
+
* - Configuration confirmation and summary display
|
|
15
|
+
* - Integration with existing CliService for processing
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```bash
|
|
19
|
+
* # Launch interactive mode
|
|
20
|
+
* legal-md-ui
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/interactive/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Interactive CLI for Legal Markdown Processing
|
|
5
|
+
*
|
|
6
|
+
* This module provides an interactive command-line interface for Legal Markdown
|
|
7
|
+
* processing, guiding users through file selection, format options, and processing
|
|
8
|
+
* configuration with intuitive prompts.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Interactive file selection with recursive directory scanning
|
|
12
|
+
* - Multiple output format selection (HTML, PDF, Markdown, Metadata)
|
|
13
|
+
* - Conditional processing options based on selected formats
|
|
14
|
+
* - CSS file selection for HTML/PDF styling
|
|
15
|
+
* - Configuration confirmation and summary display
|
|
16
|
+
* - Integration with existing CliService for processing
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```bash
|
|
20
|
+
* # Launch interactive mode
|
|
21
|
+
* legal-md-ui
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
const commander_1 = require("commander");
|
|
29
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
30
|
+
const file_selector_1 = require("./prompts/file-selector");
|
|
31
|
+
const output_format_1 = require("./prompts/output-format");
|
|
32
|
+
const processing_options_1 = require("./prompts/processing-options");
|
|
33
|
+
const css_selector_1 = require("./prompts/css-selector");
|
|
34
|
+
const filename_1 = require("./prompts/filename");
|
|
35
|
+
const confirmation_1 = require("./prompts/confirmation");
|
|
36
|
+
const service_1 = require("./service");
|
|
37
|
+
const format_helpers_1 = require("./utils/format-helpers");
|
|
38
|
+
/**
|
|
39
|
+
* Main interactive flow that guides users through the complete Legal Markdown processing workflow
|
|
40
|
+
*
|
|
41
|
+
* This function orchestrates the entire interactive experience by:
|
|
42
|
+
* 1. Displaying welcome message and scanning for input files
|
|
43
|
+
* 2. Prompting for file selection from available documents
|
|
44
|
+
* 3. Collecting output format preferences (PDF, HTML, Markdown, Metadata)
|
|
45
|
+
* 4. Gathering processing options based on selected formats
|
|
46
|
+
* 5. Optional CSS file selection for styling
|
|
47
|
+
* 6. Output filename specification
|
|
48
|
+
* 7. Configuration confirmation and processing execution
|
|
49
|
+
*
|
|
50
|
+
* @returns Promise that resolves when the interactive flow completes
|
|
51
|
+
* @throws Error when processing fails or user cancels operation
|
|
52
|
+
*/
|
|
53
|
+
async function runInteractiveMode() {
|
|
54
|
+
try {
|
|
55
|
+
console.log(chalk_1.default.bold.blue('\n🎯 Legal Markdown Interactive CLI\n'));
|
|
56
|
+
console.log(chalk_1.default.gray('Follow the prompts to configure your document processing.\n'));
|
|
57
|
+
// Step 1: Select input file
|
|
58
|
+
const inputFile = await (0, file_selector_1.selectInputFile)();
|
|
59
|
+
// Step 2: Select output formats
|
|
60
|
+
const outputFormats = await (0, output_format_1.selectOutputFormats)();
|
|
61
|
+
// Step 3: Configure processing options
|
|
62
|
+
const processingOptions = await (0, processing_options_1.promptProcessingOptions)(outputFormats);
|
|
63
|
+
// Step 4: Select CSS file (if needed)
|
|
64
|
+
const cssFile = await (0, css_selector_1.selectCssFile)(outputFormats);
|
|
65
|
+
// Step 5: Enter output filename
|
|
66
|
+
const outputFilename = await (0, filename_1.promptOutputFilename)(inputFile);
|
|
67
|
+
// Build configuration
|
|
68
|
+
const config = {
|
|
69
|
+
inputFile,
|
|
70
|
+
outputFilename,
|
|
71
|
+
outputFormats,
|
|
72
|
+
processingOptions,
|
|
73
|
+
cssFile,
|
|
74
|
+
};
|
|
75
|
+
// Step 6: Confirm configuration
|
|
76
|
+
const confirmed = await (0, confirmation_1.confirmConfiguration)(config);
|
|
77
|
+
if (!confirmed) {
|
|
78
|
+
console.log(chalk_1.default.yellow('\n❌ Operation cancelled.\n'));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// Step 7: Process files
|
|
82
|
+
console.log(chalk_1.default.cyan('\n⏳ Processing files...\n'));
|
|
83
|
+
const service = new service_1.InteractiveService(config);
|
|
84
|
+
const outputFiles = await service.processFile(inputFile);
|
|
85
|
+
// Step 8: Show results
|
|
86
|
+
console.log((0, format_helpers_1.formatSuccessMessage)(outputFiles));
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (error instanceof Error && error.message.includes('User force closed')) {
|
|
90
|
+
console.log(chalk_1.default.yellow('\n👋 Goodbye!\n'));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
console.log((0, format_helpers_1.formatErrorMessage)(error instanceof Error ? error.message : String(error)));
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Create program
|
|
98
|
+
const program = new commander_1.Command();
|
|
99
|
+
// Setup CLI information
|
|
100
|
+
program
|
|
101
|
+
.name('legal-md-ui')
|
|
102
|
+
.description('Interactive CLI for Legal Markdown document processing')
|
|
103
|
+
.version('0.1.0')
|
|
104
|
+
.action(runInteractiveMode);
|
|
105
|
+
// Parse command line arguments
|
|
106
|
+
program.parse();
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/interactive/index.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;AAEH,yCAAoC;AACpC,kDAA0B;AAC1B,2DAA0D;AAC1D,2DAA8D;AAC9D,qEAAuE;AACvE,yDAAuD;AACvD,iDAA0D;AAC1D,yDAA8D;AAC9D,uCAA+C;AAE/C,2DAAkF;AAElF;;;;;;;;;;;;;;GAcG;AACH,KAAK,UAAU,kBAAkB;IAC/B,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC,CAAC;QAEvF,4BAA4B;QAC5B,MAAM,SAAS,GAAG,MAAM,IAAA,+BAAe,GAAE,CAAC;QAE1C,gCAAgC;QAChC,MAAM,aAAa,GAAG,MAAM,IAAA,mCAAmB,GAAE,CAAC;QAElD,uCAAuC;QACvC,MAAM,iBAAiB,GAAG,MAAM,IAAA,4CAAuB,EAAC,aAAa,CAAC,CAAC;QAEvE,sCAAsC;QACtC,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAa,EAAC,aAAa,CAAC,CAAC;QAEnD,gCAAgC;QAChC,MAAM,cAAc,GAAG,MAAM,IAAA,+BAAoB,EAAC,SAAS,CAAC,CAAC;QAE7D,sBAAsB;QACtB,MAAM,MAAM,GAAsB;YAChC,SAAS;YACT,cAAc;YACd,aAAa;YACb,iBAAiB;YACjB,OAAO;SACR,CAAC;QAEF,gCAAgC;QAChC,MAAM,SAAS,GAAG,MAAM,IAAA,mCAAoB,E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AAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Confirmation prompt for Interactive CLI
|
|
3
|
+
*/
|
|
4
|
+
import { InteractiveConfig } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Show configuration summary and prompt for confirmation
|
|
7
|
+
*/
|
|
8
|
+
export declare function confirmConfiguration(config: InteractiveConfig): Promise<boolean>;
|
|
9
|
+
//# sourceMappingURL=confirmation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/confirmation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAStF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Confirmation prompt for Interactive CLI
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.confirmConfiguration = confirmConfiguration;
|
|
7
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
8
|
+
const format_helpers_1 = require("../utils/format-helpers");
|
|
9
|
+
/**
|
|
10
|
+
* Show configuration summary and prompt for confirmation
|
|
11
|
+
*/
|
|
12
|
+
async function confirmConfiguration(config) {
|
|
13
|
+
console.log((0, format_helpers_1.formatConfigSummary)(config));
|
|
14
|
+
const confirmed = await (0, prompts_1.confirm)({
|
|
15
|
+
message: 'Proceed with this configuration?',
|
|
16
|
+
default: true,
|
|
17
|
+
});
|
|
18
|
+
return confirmed;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=confirmation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.js","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/confirmation.ts"],"names":[],"mappings":";AAAA;;GAEG;;AASH,oDASC;AAhBD,+CAA4C;AAE5C,4DAA8D;AAE9D;;GAEG;AACI,KAAK,UAAU,oBAAoB,CAAC,MAAyB;IAClE,OAAO,CAAC,GAAG,CAAC,IAAA,oCAAmB,EAAC,MAAM,CAAC,CAAC,CAAC;IAEzC,MAAM,SAAS,GAAG,MAAM,IAAA,iBAAO,EAAC;QAC9B,OAAO,EAAE,kCAAkC;QAC3C,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CSS file selection prompt for Interactive CLI
|
|
3
|
+
*/
|
|
4
|
+
import { OutputFormat } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Prompt user to select a CSS file if HTML or PDF formats are selected
|
|
7
|
+
*/
|
|
8
|
+
export declare function selectCssFile(outputFormats: OutputFormat): Promise<string | undefined>;
|
|
9
|
+
//# sourceMappingURL=css-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-selector.d.ts","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/css-selector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC;;GAEG;AACH,wBAAsB,aAAa,CAAC,aAAa,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA6B5F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview CSS file selection prompt for Interactive CLI
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.selectCssFile = selectCssFile;
|
|
7
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
8
|
+
const _constants_1 = require("../../../constants/index.js");
|
|
9
|
+
const file_scanner_1 = require("../utils/file-scanner");
|
|
10
|
+
const format_helpers_1 = require("../utils/format-helpers");
|
|
11
|
+
const NO_CSS_OPTION = 'No custom CSS';
|
|
12
|
+
/**
|
|
13
|
+
* Prompt user to select a CSS file if HTML or PDF formats are selected
|
|
14
|
+
*/
|
|
15
|
+
async function selectCssFile(outputFormats) {
|
|
16
|
+
// Only show CSS selection if HTML or PDF is selected
|
|
17
|
+
if (!outputFormats.html && !outputFormats.pdf) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
console.log('\n🎨 CSS Selection:\n');
|
|
21
|
+
const cssFiles = (0, file_scanner_1.scanCssFiles)(_constants_1.RESOLVED_PATHS.STYLES_DIR);
|
|
22
|
+
if (cssFiles.length === 0) {
|
|
23
|
+
console.log((0, format_helpers_1.formatWarningMessage)(`No CSS files found in ${_constants_1.RESOLVED_PATHS.STYLES_DIR}`));
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const choices = [
|
|
27
|
+
{ name: NO_CSS_OPTION, value: undefined },
|
|
28
|
+
...cssFiles.map(file => ({
|
|
29
|
+
name: file,
|
|
30
|
+
value: file,
|
|
31
|
+
})),
|
|
32
|
+
];
|
|
33
|
+
const selectedCss = await (0, prompts_1.select)({
|
|
34
|
+
message: 'Select a CSS file for styling:',
|
|
35
|
+
choices,
|
|
36
|
+
});
|
|
37
|
+
return selectedCss;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=css-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-selector.js","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/css-selector.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAaH,sCA6BC;AAxCD,+CAA2C;AAC3C,2CAA4C;AAC5C,wDAAqD;AACrD,4DAA+D;AAG/D,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,aAA2B;IAC7D,qDAAqD;IACrD,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAErC,MAAM,QAAQ,GAAG,IAAA,2BAAY,EAAC,2BAAc,CAAC,UAAU,CAAC,CAAC;IAEzD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,IAAA,qCAAoB,EAAC,yBAAyB,2BAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACxF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG;QACd,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE;QACzC,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACvB,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,IAAA,gBAAM,EAAC;QAC/B,OAAO,EAAE,gCAAgC;QACzC,OAAO;KACR,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File selection prompt for Interactive CLI
|
|
3
|
+
*
|
|
4
|
+
* This module handles the file selection process, providing users with
|
|
5
|
+
* options to select from discovered files, browse directories, or
|
|
6
|
+
* manually enter file paths.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Prompt user to select an input file
|
|
10
|
+
*
|
|
11
|
+
* Initiates the file selection process by scanning the default input directory
|
|
12
|
+
* and presenting available files to the user. If no files are found, falls back
|
|
13
|
+
* to manual input options.
|
|
14
|
+
*
|
|
15
|
+
* @returns Promise resolving to the absolute path of the selected input file
|
|
16
|
+
* @throws Error when user cancels or no valid file is selected
|
|
17
|
+
*/
|
|
18
|
+
export declare function selectInputFile(): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=file-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-selector.d.ts","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/file-selector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH;;;;;;;;;GASG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAqCvD"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* File selection prompt for Interactive CLI
|
|
4
|
+
*
|
|
5
|
+
* This module handles the file selection process, providing users with
|
|
6
|
+
* options to select from discovered files, browse directories, or
|
|
7
|
+
* manually enter file paths.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.selectInputFile = selectInputFile;
|
|
47
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
50
|
+
const _constants_1 = require("../../../constants/index.js");
|
|
51
|
+
const file_scanner_1 = require("../utils/file-scanner");
|
|
52
|
+
const format_helpers_1 = require("../utils/format-helpers");
|
|
53
|
+
/** Option for browsing alternative directories */
|
|
54
|
+
const BROWSE_OPTION = '📁 Browse other folder...';
|
|
55
|
+
/** Option for manual path entry */
|
|
56
|
+
const MANUAL_OPTION = '📝 Enter path manually...';
|
|
57
|
+
/** Option for exiting the application */
|
|
58
|
+
const EXIT_OPTION = '❌ Exit';
|
|
59
|
+
/**
|
|
60
|
+
* Prompt user to select an input file
|
|
61
|
+
*
|
|
62
|
+
* Initiates the file selection process by scanning the default input directory
|
|
63
|
+
* and presenting available files to the user. If no files are found, falls back
|
|
64
|
+
* to manual input options.
|
|
65
|
+
*
|
|
66
|
+
* @returns Promise resolving to the absolute path of the selected input file
|
|
67
|
+
* @throws Error when user cancels or no valid file is selected
|
|
68
|
+
*/
|
|
69
|
+
async function selectInputFile() {
|
|
70
|
+
console.log(chalk_1.default.cyan(`🔍 Searching for files in: ${_constants_1.RESOLVED_PATHS.DEFAULT_INPUT_DIR}\n`));
|
|
71
|
+
const files = (0, file_scanner_1.scanDirectory)(_constants_1.RESOLVED_PATHS.DEFAULT_INPUT_DIR);
|
|
72
|
+
if (files.length === 0) {
|
|
73
|
+
console.log((0, format_helpers_1.formatWarningMessage)('No supported files found in the default directory.'));
|
|
74
|
+
return await handleManualInput();
|
|
75
|
+
}
|
|
76
|
+
const choices = [
|
|
77
|
+
...files.map(file => ({
|
|
78
|
+
name: file.name,
|
|
79
|
+
value: file.path,
|
|
80
|
+
})),
|
|
81
|
+
{ name: BROWSE_OPTION, value: BROWSE_OPTION },
|
|
82
|
+
{ name: MANUAL_OPTION, value: MANUAL_OPTION },
|
|
83
|
+
{ name: EXIT_OPTION, value: EXIT_OPTION },
|
|
84
|
+
];
|
|
85
|
+
const selectedFile = await (0, prompts_1.select)({
|
|
86
|
+
message: 'Select an input file:',
|
|
87
|
+
choices,
|
|
88
|
+
});
|
|
89
|
+
switch (selectedFile) {
|
|
90
|
+
case BROWSE_OPTION:
|
|
91
|
+
return await handleBrowseFolder();
|
|
92
|
+
case MANUAL_OPTION:
|
|
93
|
+
return await handleManualInput();
|
|
94
|
+
case EXIT_OPTION:
|
|
95
|
+
console.log(chalk_1.default.yellow('👋 Goodbye!'));
|
|
96
|
+
process.exit(0);
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
return selectedFile;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handle browsing to a different folder
|
|
104
|
+
*/
|
|
105
|
+
async function handleBrowseFolder() {
|
|
106
|
+
const folderPath = await (0, prompts_1.input)({
|
|
107
|
+
message: 'Enter folder path to browse:',
|
|
108
|
+
default: _constants_1.RESOLVED_PATHS.DEFAULT_INPUT_DIR,
|
|
109
|
+
validate: (value) => {
|
|
110
|
+
const resolvedPath = path.resolve(value);
|
|
111
|
+
try {
|
|
112
|
+
const fs = require('fs');
|
|
113
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
114
|
+
return 'Folder does not exist';
|
|
115
|
+
}
|
|
116
|
+
if (!fs.statSync(resolvedPath).isDirectory()) {
|
|
117
|
+
return 'Path is not a directory';
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return 'Invalid folder path';
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
const resolvedPath = path.resolve(folderPath);
|
|
127
|
+
console.log(chalk_1.default.cyan(`🔍 Searching for files in: ${resolvedPath}\n`));
|
|
128
|
+
const files = (0, file_scanner_1.scanDirectory)(resolvedPath);
|
|
129
|
+
if (files.length === 0) {
|
|
130
|
+
console.log((0, format_helpers_1.formatWarningMessage)('No supported files found in this directory.'));
|
|
131
|
+
return await handleManualInput();
|
|
132
|
+
}
|
|
133
|
+
const choices = [
|
|
134
|
+
...files.map(file => ({
|
|
135
|
+
name: file.name,
|
|
136
|
+
value: file.path,
|
|
137
|
+
})),
|
|
138
|
+
{ name: MANUAL_OPTION, value: MANUAL_OPTION },
|
|
139
|
+
{ name: EXIT_OPTION, value: EXIT_OPTION },
|
|
140
|
+
];
|
|
141
|
+
const selectedFile = await (0, prompts_1.select)({
|
|
142
|
+
message: 'Select an input file:',
|
|
143
|
+
choices,
|
|
144
|
+
});
|
|
145
|
+
if (selectedFile === MANUAL_OPTION) {
|
|
146
|
+
return await handleManualInput();
|
|
147
|
+
}
|
|
148
|
+
if (selectedFile === EXIT_OPTION) {
|
|
149
|
+
console.log(chalk_1.default.yellow('👋 Goodbye!'));
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
return selectedFile;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Handle manual file path input
|
|
156
|
+
*/
|
|
157
|
+
async function handleManualInput() {
|
|
158
|
+
const filePath = await (0, prompts_1.input)({
|
|
159
|
+
message: 'Enter file path:',
|
|
160
|
+
validate: (value) => {
|
|
161
|
+
if (!value.trim()) {
|
|
162
|
+
return 'File path is required';
|
|
163
|
+
}
|
|
164
|
+
const resolvedPath = path.resolve(value.trim());
|
|
165
|
+
if (!(0, file_scanner_1.isValidFile)(resolvedPath)) {
|
|
166
|
+
return 'File does not exist or is not readable';
|
|
167
|
+
}
|
|
168
|
+
const ext = path.extname(resolvedPath).toLowerCase();
|
|
169
|
+
const supportedExts = ['.md', '.markdown', '.rst', '.tex', '.latex', '.txt'];
|
|
170
|
+
if (!supportedExts.includes(ext)) {
|
|
171
|
+
return `Unsupported file type. Supported: ${supportedExts.join(', ')}`;
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
return path.resolve(filePath.trim());
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=file-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-selector.js","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/file-selector.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BH,0CAqCC;AA7DD,+CAAkD;AAClD,2CAA6B;AAC7B,kDAA0B;AAC1B,2CAA4C;AAC5C,wDAAmE;AACnE,4DAA+D;AAE/D,kDAAkD;AAClD,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAClD,mCAAmC;AACnC,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAClD,yCAAyC;AACzC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAE7B;;;;;;;;;GASG;AACI,KAAK,UAAU,eAAe;IACnC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,8BAA8B,2BAAc,CAAC,iBAAiB,IAAI,CAAC,CAAC,CAAC;IAE5F,MAAM,KAAK,GAAG,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AC;KACF,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Output filename input prompt for Interactive CLI
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Prompt user for output filename (without extension)
|
|
6
|
+
*/
|
|
7
|
+
export declare function promptOutputFilename(inputFile: string): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=filename.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filename.d.ts","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/filename.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC7E"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Output filename input prompt for Interactive CLI
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.promptOutputFilename = promptOutputFilename;
|
|
40
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
/**
|
|
43
|
+
* Prompt user for output filename (without extension)
|
|
44
|
+
*/
|
|
45
|
+
async function promptOutputFilename(inputFile) {
|
|
46
|
+
const inputBasename = path.basename(inputFile, path.extname(inputFile));
|
|
47
|
+
const filename = await (0, prompts_1.input)({
|
|
48
|
+
message: 'Enter output filename (without extension):',
|
|
49
|
+
default: inputBasename,
|
|
50
|
+
validate: (value) => {
|
|
51
|
+
const trimmed = value.trim();
|
|
52
|
+
if (!trimmed) {
|
|
53
|
+
return 'Filename is required';
|
|
54
|
+
}
|
|
55
|
+
// Check for invalid characters (basic validation)
|
|
56
|
+
const invalidChars = /[<>:"/\\|?*]/;
|
|
57
|
+
if (invalidChars.test(trimmed)) {
|
|
58
|
+
return 'Filename contains invalid characters';
|
|
59
|
+
}
|
|
60
|
+
// Check if it starts/ends with spaces or dots
|
|
61
|
+
if (trimmed !== value) {
|
|
62
|
+
return 'Filename cannot start or end with spaces';
|
|
63
|
+
}
|
|
64
|
+
if (trimmed.startsWith('.') || trimmed.endsWith('.')) {
|
|
65
|
+
return 'Filename cannot start or end with dots';
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return filename.trim();
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=filename.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filename.js","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/filename.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQH,oDAiCC;AAvCD,+CAA0C;AAC1C,2CAA6B;AAE7B;;GAEG;AACI,KAAK,UAAU,oBAAoB,CAAC,SAAiB;IAC1D,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAExE,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;QAC3B,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE,aAAa;QACtB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;YAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YAE7B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,sBAAsB,CAAC;YAChC,CAAC;YAED,kDAAkD;YAClD,MAAM,YAAY,GAAG,cAAc,CAAC;YACpC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/B,OAAO,sCAAsC,CAAC;YAChD,CAAC;YAED,8CAA8C;YAC9C,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;gBACtB,OAAO,0CAA0C,CAAC;YACpD,CAAC;YAED,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrD,OAAO,wCAAwC,CAAC;YAClD,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Output format selection prompt for Interactive CLI
|
|
3
|
+
*/
|
|
4
|
+
import { OutputFormat } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Prompt user to select output formats
|
|
7
|
+
*/
|
|
8
|
+
export declare function selectOutputFormats(): Promise<OutputFormat>;
|
|
9
|
+
//# sourceMappingURL=output-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-format.d.ts","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/output-format.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,YAAY,CAAC,CAkBjE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Output format selection prompt for Interactive CLI
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.selectOutputFormats = selectOutputFormats;
|
|
7
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
8
|
+
/**
|
|
9
|
+
* Prompt user to select output formats
|
|
10
|
+
*/
|
|
11
|
+
async function selectOutputFormats() {
|
|
12
|
+
const selectedFormats = await (0, prompts_1.checkbox)({
|
|
13
|
+
message: 'Select output formats:',
|
|
14
|
+
choices: [
|
|
15
|
+
{ name: '🌐 HTML', value: 'html' },
|
|
16
|
+
{ name: '📄 PDF', value: 'pdf', checked: true }, // Default selected
|
|
17
|
+
{ name: '📝 Markdown', value: 'markdown' },
|
|
18
|
+
{ name: '📊 Export metadata (YAML/JSON)', value: 'metadata' },
|
|
19
|
+
],
|
|
20
|
+
required: true, // This ensures at least one option is selected
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
html: selectedFormats.includes('html'),
|
|
24
|
+
pdf: selectedFormats.includes('pdf'),
|
|
25
|
+
markdown: selectedFormats.includes('markdown'),
|
|
26
|
+
metadata: selectedFormats.includes('metadata'),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=output-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-format.js","sourceRoot":"","sources":["../../../../src/cli/interactive/prompts/output-format.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,kDAkBC;AAxBD,+CAA6C;AAG7C;;GAEG;AACI,KAAK,UAAU,mBAAmB;IACvC,MAAM,eAAe,GAAG,MAAM,IAAA,kBAAQ,EAAC;QACrC,OAAO,EAAE,wBAAwB;QACjC,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;YAClC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,mBAAmB;YACpE,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE;YAC1C,EAAE,IAAI,EAAE,gCAAgC,EAAE,KAAK,EAAE,UAAU,EAAE;SAC9D;QACD,QAAQ,EAAE,IAAI,EAAE,+CAA+C;KAChE,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC;QACtC,GAAG,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;QACpC,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC9C,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC;KAC/C,CAAC;AACJ,CAAC"}
|