@mdless/cli 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/bin.mjs +17 -0
  2. package/main.ts +15 -25
  3. package/package.json +4 -2
package/bin.mjs ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ const result = spawnSync(
8
+ "node",
9
+ [
10
+ "--import",
11
+ "tsx",
12
+ join(__dirname, "main.ts"),
13
+ ...process.argv.slice(2),
14
+ ],
15
+ { stdio: "inherit" }
16
+ );
17
+ process.exit(result.status ?? 1);
package/main.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env tsx
2
2
  import { checkbox, confirm } from "@inquirer/prompts";
3
+ import { Command } from "commander";
3
4
  import {
4
5
  cpSync,
5
6
  existsSync,
@@ -9,19 +10,13 @@ import {
9
10
  statSync,
10
11
  } from "node:fs";
11
12
  import { join } from "node:path";
13
+ import packageJson from "./package.json" with { type: "json" };
12
14
 
13
15
  function exit(): never {
14
16
  console.log("\nAborted.");
15
17
  process.exit(0);
16
18
  }
17
19
 
18
- function showHelp(): void {
19
- console.log(`Usage: mdless <command>
20
-
21
- Commands:
22
- skills Install or remove Claude Code skills`);
23
- }
24
-
25
20
  async function skillsCommand(): Promise<void> {
26
21
  const cwd = process.cwd();
27
22
  const claudeDir = join(cwd, ".claude");
@@ -94,25 +89,20 @@ async function skillsCommand(): Promise<void> {
94
89
  : [];
95
90
 
96
91
  if (finalSkills.length > 0) {
97
- console.log(`\nInstalled skills: ${finalSkills.join(", ")}`);
92
+ console.log(`\nProject skills: ${finalSkills.join(", ")}`);
98
93
  } else {
99
- console.log("\nNo skills installed.");
94
+ console.log("\nNo skills in this project.");
100
95
  }
101
96
  }
102
97
 
103
- const [command] = process.argv.slice(2);
104
-
105
- switch (command) {
106
- case "skills":
107
- await skillsCommand();
108
- break;
109
- case undefined:
110
- case "-h":
111
- case "--help":
112
- showHelp();
113
- break;
114
- default:
115
- console.error(`Unknown command: ${command}`);
116
- showHelp();
117
- process.exit(1);
118
- }
98
+ const program = new Command()
99
+ .name("mdless")
100
+ .description("CLI tools for Claude Code projects")
101
+ .version(packageJson.version);
102
+
103
+ program
104
+ .command("skills")
105
+ .description("Install or remove Claude Code skills")
106
+ .action(skillsCommand);
107
+
108
+ program.parse();
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@mdless/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Interactive skill selector CLI",
5
5
  "type": "module",
6
6
  "bin": {
7
- "mdless": "./main.ts"
7
+ "mdless": "bin.mjs"
8
8
  },
9
9
  "files": [
10
+ "bin.mjs",
10
11
  "main.ts",
11
12
  "skills/"
12
13
  ],
@@ -18,6 +19,7 @@
18
19
  "license": "MIT",
19
20
  "dependencies": {
20
21
  "@inquirer/prompts": "^8.2.0",
22
+ "commander": "^14.0.3",
21
23
  "tsx": "^4.7.0"
22
24
  },
23
25
  "devDependencies": {