@mdless/cli 1.0.3 → 1.0.5

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 ADDED
@@ -0,0 +1,57 @@
1
+ # @mdless/cli
2
+
3
+ **Mind less, ship more.**
4
+
5
+ You know that feeling when you craft the perfect Claude Code skill, and then you need it in another project? Or when your teammate asks "how did you make Claude do that?"
6
+
7
+ Yeah, we're tired of that too.
8
+
9
+ ## What's this?
10
+
11
+ mdless lets you share Claude Code skills across projects. Skills live in your repo, not on your machine—so your whole team gets the superpowers, not just you.
12
+
13
+ No more "it works on my Claude." No more copy-pasting skills between repos. No more explaining to Eddy how to set up his `.claude` folder for the fifth time.
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ npm install -g @mdless/cli
19
+ mdless skills
20
+ ```
21
+
22
+ Or just run it when you need it:
23
+
24
+ ```bash
25
+ npx @mdless/cli skills
26
+ ```
27
+
28
+ That's it. Pick the skills you want, hit enter, go back to shipping.
29
+
30
+ The CLI will:
31
+
32
+ 1. Create `.claude/skills/` if it doesn't exist (you're welcome, Eddy)
33
+ 2. Show you a list of available skills
34
+ 3. Install the ones you pick (remove the ones you don't)
35
+
36
+ Commit the skills to your repo. Now everyone on your team has them. Revolutionary, we know.
37
+
38
+ ## Available Skills
39
+
40
+ | Skill | What it does |
41
+ | --------------- | ------------------------------------------------- |
42
+ | **commit** | Writes commit messages so you don't have to think |
43
+ | **pr** | Creates PRs with actual descriptions |
44
+ | **pr-comments** | Responds to PR comments (politely) |
45
+ | **ci-errors** | Reads CI logs and fixes the errors |
46
+
47
+ ## Why "mdless"?
48
+
49
+ Two reasons:
50
+
51
+ 1. **md-less** — Write less markdown. Skills are maintained by the community, so you don't have to craft every SKILL.md from scratch.
52
+
53
+ 2. **mindless** — Stop overthinking. Mind less and just ship that shit out.
54
+
55
+ ## License
56
+
57
+ MIT — go wild.
package/bin.mjs CHANGED
@@ -2,14 +2,18 @@
2
2
  import { spawnSync } from "node:child_process";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { dirname, join } from "node:path";
5
+ import { createRequire } from "node:module";
5
6
 
6
7
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const require = createRequire(import.meta.url);
9
+ const tsxPath = require.resolve("tsx");
10
+
7
11
  const result = spawnSync(
8
12
  "node",
9
13
  [
10
14
  "--import",
11
- "tsx",
12
- join(__dirname, "main.ts"),
15
+ tsxPath,
16
+ join(__dirname, "src", "index.ts"),
13
17
  ...process.argv.slice(2),
14
18
  ],
15
19
  { stdio: "inherit" }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@mdless/cli",
3
- "version": "1.0.3",
4
- "description": "Interactive skill selector CLI",
3
+ "version": "1.0.5",
4
+ "description": "Mind less, ship more. Share Claude Code skills across projects and teams.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "mdless": "bin.mjs"
8
8
  },
9
9
  "files": [
10
10
  "bin.mjs",
11
- "main.ts",
11
+ "src/",
12
12
  "skills/"
13
13
  ],
14
14
  "keywords": [
@@ -0,0 +1,73 @@
1
+ import { checkbox, confirm } from "@inquirer/prompts";
2
+ import { cpSync, existsSync, mkdirSync, rmSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { exit, getDirectories, withExitHandler } from "../utils.js";
5
+
6
+ export async function skillsCommand(): Promise<void> {
7
+ const cwd = process.cwd();
8
+ const claudeDir = join(cwd, ".claude");
9
+
10
+ if (!existsSync(claudeDir)) {
11
+ const shouldCreate = await withExitHandler(
12
+ confirm({ message: "No .claude folder found. Create one?" })
13
+ );
14
+
15
+ if (!shouldCreate) {
16
+ exit();
17
+ }
18
+
19
+ mkdirSync(claudeDir);
20
+ console.log("✓ Created .claude folder.");
21
+ }
22
+
23
+ const skillsDir = join(import.meta.dirname!, "..", "..", "skills");
24
+ const skills = getDirectories(skillsDir);
25
+ const destSkillsDir = join(claudeDir, "skills");
26
+
27
+ function isInstalled(skill: string): boolean {
28
+ return existsSync(join(destSkillsDir, skill));
29
+ }
30
+
31
+ const selected = await withExitHandler(
32
+ checkbox({
33
+ message: "Select skills to install:",
34
+ choices: skills.map((skill) => ({
35
+ name: skill,
36
+ value: skill,
37
+ checked: isInstalled(skill),
38
+ })),
39
+ })
40
+ );
41
+
42
+ const installed: string[] = [];
43
+ const removed: string[] = [];
44
+
45
+ for (const skill of skills) {
46
+ const src = join(skillsDir, skill);
47
+ const dest = join(destSkillsDir, skill);
48
+ const wasInstalled = isInstalled(skill);
49
+ const shouldBeInstalled = selected.includes(skill);
50
+
51
+ if (shouldBeInstalled && !wasInstalled) {
52
+ cpSync(src, dest, { recursive: true });
53
+ installed.push(skill);
54
+ } else if (!shouldBeInstalled && wasInstalled) {
55
+ rmSync(dest, { recursive: true });
56
+ removed.push(skill);
57
+ }
58
+ }
59
+
60
+ if (installed.length > 0 || removed.length > 0) {
61
+ console.log("✓ Changes applied.");
62
+ }
63
+
64
+ const finalSkills = existsSync(destSkillsDir)
65
+ ? getDirectories(destSkillsDir)
66
+ : [];
67
+
68
+ if (finalSkills.length > 0) {
69
+ console.log(`\nProject skills: ${finalSkills.join(", ")}`);
70
+ } else {
71
+ console.log("\nNo skills in this project.");
72
+ }
73
+ }
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env tsx
2
+ import { Command } from "commander";
3
+ import packageJson from "../package.json" with { type: "json" };
4
+ import { skillsCommand } from "./commands/skills.js";
5
+
6
+ const program = new Command()
7
+ .name("mdless")
8
+ .description("CLI tools for Claude Code hard-working devs")
9
+ .version(packageJson.version);
10
+
11
+ program
12
+ .command("skills")
13
+ .description("Share Claude Code skills across projects and teams")
14
+ .action(skillsCommand);
15
+
16
+ program.parse();
package/src/utils.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { readdirSync, statSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ export function exit(): never {
5
+ console.log("\nAborted.");
6
+ process.exit(0);
7
+ }
8
+
9
+ export function getDirectories(path: string): string[] {
10
+ return readdirSync(path).filter((name) =>
11
+ statSync(join(path, name)).isDirectory()
12
+ );
13
+ }
14
+
15
+ export function withExitHandler<T>(promise: Promise<T>): Promise<T> {
16
+ return promise.catch((e: Error) => {
17
+ if (e.name === "ExitPromptError") exit();
18
+ throw e;
19
+ });
20
+ }
package/main.ts DELETED
@@ -1,108 +0,0 @@
1
- #!/usr/bin/env tsx
2
- import { checkbox, confirm } from "@inquirer/prompts";
3
- import { Command } from "commander";
4
- import {
5
- cpSync,
6
- existsSync,
7
- mkdirSync,
8
- readdirSync,
9
- rmSync,
10
- statSync,
11
- } from "node:fs";
12
- import { join } from "node:path";
13
- import packageJson from "./package.json" with { type: "json" };
14
-
15
- function exit(): never {
16
- console.log("\nAborted.");
17
- process.exit(0);
18
- }
19
-
20
- async function skillsCommand(): Promise<void> {
21
- const cwd = process.cwd();
22
- const claudeDir = join(cwd, ".claude");
23
-
24
- if (!existsSync(claudeDir)) {
25
- const shouldCreate = await confirm({
26
- message: "No .claude folder found. Create one?",
27
- }).catch((e: Error) => {
28
- if (e.name === "ExitPromptError") exit();
29
- throw e;
30
- });
31
-
32
- if (!shouldCreate) {
33
- exit();
34
- }
35
-
36
- mkdirSync(claudeDir);
37
- console.log("✓ Created .claude folder.");
38
- }
39
-
40
- const skillsDir = join(import.meta.dirname!, "skills");
41
- const skills = readdirSync(skillsDir).filter((name) =>
42
- statSync(join(skillsDir, name)).isDirectory(),
43
- );
44
-
45
- const destSkillsDir = join(claudeDir, "skills");
46
-
47
- function isInstalled(skill: string): boolean {
48
- return existsSync(join(destSkillsDir, skill));
49
- }
50
-
51
- const selected = await checkbox({
52
- message: "Select skills to install:",
53
- choices: skills.map((skill) => ({
54
- name: skill,
55
- value: skill,
56
- checked: isInstalled(skill),
57
- })),
58
- }).catch((e: Error) => {
59
- if (e.name === "ExitPromptError") exit();
60
- throw e;
61
- });
62
-
63
- const installed: string[] = [];
64
- const removed: string[] = [];
65
-
66
- for (const skill of skills) {
67
- const src = join(skillsDir, skill);
68
- const dest = join(destSkillsDir, skill);
69
- const wasInstalled = isInstalled(skill);
70
- const shouldBeInstalled = selected.includes(skill);
71
-
72
- if (shouldBeInstalled && !wasInstalled) {
73
- cpSync(src, dest, { recursive: true });
74
- installed.push(skill);
75
- } else if (!shouldBeInstalled && wasInstalled) {
76
- rmSync(dest, { recursive: true });
77
- removed.push(skill);
78
- }
79
- }
80
-
81
- if (installed.length > 0 || removed.length > 0) {
82
- console.log("✓ Changes applied.");
83
- }
84
-
85
- const finalSkills = existsSync(destSkillsDir)
86
- ? readdirSync(destSkillsDir).filter((name) =>
87
- statSync(join(destSkillsDir, name)).isDirectory(),
88
- )
89
- : [];
90
-
91
- if (finalSkills.length > 0) {
92
- console.log(`\nProject skills: ${finalSkills.join(", ")}`);
93
- } else {
94
- console.log("\nNo skills in this project.");
95
- }
96
- }
97
-
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();