@writechoice/mint-cli 0.0.9 → 0.0.10

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 CHANGED
@@ -31,10 +31,24 @@ writechoice check links docs.example.com http://localhost:3000
31
31
 
32
32
  # Fix broken anchor links
33
33
  writechoice fix links
34
+
35
+ # Generate config.json template
36
+ writechoice config
34
37
  ```
35
38
 
36
39
  ## Commands
37
40
 
41
+ ### `config`
42
+
43
+ Generates a config.json template file with all available options.
44
+
45
+ ```bash
46
+ writechoice config # Create config.json
47
+ writechoice config --force # Overwrite existing config.json
48
+ ```
49
+
50
+ **Output:** Creates `config.json` in the current directory with placeholder values.
51
+
38
52
  ### `check parse`
39
53
 
40
54
  Validates MDX files for parsing errors.
@@ -173,6 +187,7 @@ writechoice check links docs.example.com
173
187
  Detailed documentation is available in the [docs/](docs/) folder:
174
188
 
175
189
  - **Commands**
190
+ - [config](docs/commands/config.md) - Generate config.json template
176
191
  - [check links](docs/commands/check-links.md) - Link validation
177
192
  - [check parse](docs/commands/check-parse.md) - MDX parsing validation
178
193
  - [fix links](docs/commands/fix-links.md) - Auto-fix broken links
package/bin/cli.js CHANGED
@@ -95,6 +95,17 @@ fix
95
95
  await fixLinks(options);
96
96
  });
97
97
 
98
+ // Config command
99
+ program
100
+ .command("config")
101
+ .description("Generate a config.json template file")
102
+ .option("--force", "Overwrite existing config.json file")
103
+ .option("--quiet", "Suppress terminal output")
104
+ .action(async (options) => {
105
+ const { generateConfig } = await import("../src/commands/config.js");
106
+ await generateConfig(options);
107
+ });
108
+
98
109
  // Update command
99
110
  program
100
111
  .command("update")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@writechoice/mint-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "CLI tool for Mintlify documentation validation and utilities",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Config File Generator
3
+ *
4
+ * Generates a config.json template file with all available options.
5
+ */
6
+
7
+ import { writeFileSync, existsSync } from "fs";
8
+ import { join } from "path";
9
+ import chalk from "chalk";
10
+
11
+ /**
12
+ * Generates a config.json template file
13
+ * @param {Object} options - CLI options
14
+ */
15
+ export async function generateConfig(options) {
16
+ const configPath = join(process.cwd(), "config.json");
17
+
18
+ // Check if config.json already exists
19
+ if (existsSync(configPath) && !options.force) {
20
+ console.error(chalk.red("\n✗ Error: config.json already exists in the current directory."));
21
+ console.log(chalk.yellow("\nUse --force to overwrite the existing file:"));
22
+ console.log(chalk.gray(" writechoice config --force"));
23
+ process.exit(1);
24
+ }
25
+
26
+ // Create the config template
27
+ const configTemplate = {
28
+ "$schema": "https://json-schema.org/draft-07/schema#",
29
+ "description": "Configuration file for WriteChoice Mint CLI",
30
+
31
+ "source": "https://docs.example.com",
32
+ "target": "http://localhost:3000",
33
+
34
+ "links": {
35
+ "file": null,
36
+ "dir": null,
37
+ "output": "links_report",
38
+ "dry-run": false,
39
+ "quiet": false,
40
+ "concurrency": 25,
41
+ "headless": true
42
+ },
43
+
44
+ "parse": {
45
+ "file": null,
46
+ "dir": null,
47
+ "quiet": false
48
+ }
49
+ };
50
+
51
+ try {
52
+ writeFileSync(configPath, JSON.stringify(configTemplate, null, 2), "utf-8");
53
+
54
+ if (!options.quiet) {
55
+ console.log(chalk.green("\n✓ Successfully created config.json\n"));
56
+ console.log(chalk.bold("Next steps:\n"));
57
+ console.log("1. Edit config.json and update the placeholder values:");
58
+ console.log(chalk.cyan(" - source:") + " Your production documentation URL");
59
+ console.log(chalk.cyan(" - target:") + " Your validation environment URL (e.g., localhost:3000)");
60
+ console.log("\n2. Run validation commands without arguments:");
61
+ console.log(chalk.gray(" writechoice check links"));
62
+ console.log(chalk.gray(" writechoice check parse"));
63
+ console.log("\n3. For more details, see:");
64
+ console.log(chalk.gray(" docs/config-file.md"));
65
+ }
66
+ } catch (error) {
67
+ console.error(chalk.red(`\n✗ Error creating config.json: ${error.message}`));
68
+ process.exit(1);
69
+ }
70
+ }