@mdless/cli 1.0.3 β 1.0.6
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 +62 -0
- package/bin.mjs +6 -2
- package/package.json +3 -3
- package/src/commands/skills.ts +73 -0
- package/src/index.ts +69 -0
- package/src/utils.ts +20 -0
- package/main.ts +0 -108
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
## π€ Why "mdless"?
|
|
10
|
+
|
|
11
|
+
Two reasons:
|
|
12
|
+
|
|
13
|
+
1. Write less markdown. Skills are maintained by the community, so you don't have to craft every SKILL.md from scratch.
|
|
14
|
+
|
|
15
|
+
2. Mind less - stop overthinking - and just ship that shit out.
|
|
16
|
+
|
|
17
|
+
Mdless lets you share your superpowers across projects and teams. Skills live in your repo, not on your machineβso your whole team gets to be a superhero.
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
## π¦ Installation
|
|
22
|
+
|
|
23
|
+
#### Run instantly with npx
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx @mdless/cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Install globally with npm
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g @mdless/cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## π Key Features
|
|
36
|
+
|
|
37
|
+
#### Share skills across projects
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
mdless skills
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
| Skill | What it does |
|
|
44
|
+
| ---------------------------------------------- | ------------------------------------------------- |
|
|
45
|
+
| [**commit**](skills/commit/SKILL.md) | Writes commit messages so you don't have to think |
|
|
46
|
+
| [**pr**](skills/pr/SKILL.md) | Creates PRs with actual descriptions |
|
|
47
|
+
| [**pr-comments**](skills/pr-comments/SKILL.md) | Responds to PR comments (politely) |
|
|
48
|
+
| [**ci-errors**](skills/ci-errors/SKILL.md) | Reads CI logs and fixes the errors |
|
|
49
|
+
|
|
50
|
+
That's it. Pick the skills you want, hit enter, go back to shipping.
|
|
51
|
+
|
|
52
|
+
The CLI will:
|
|
53
|
+
|
|
54
|
+
1. Create `.claude/skills/` if it doesn't exist (you're welcome, Eddy)
|
|
55
|
+
2. Show you a list of available skills
|
|
56
|
+
3. Install the ones you pick (remove the ones you don't)
|
|
57
|
+
|
|
58
|
+
Commit the skills to your repo. Now everyone on your team has them. Revolutionary, we know.
|
|
59
|
+
|
|
60
|
+
## π License
|
|
61
|
+
|
|
62
|
+
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
|
-
|
|
12
|
-
join(__dirname, "
|
|
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.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.6",
|
|
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
|
-
"
|
|
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,69 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { select } from "@inquirer/prompts";
|
|
4
|
+
import packageJson from "../package.json" with { type: "json" };
|
|
5
|
+
import { skillsCommand } from "./commands/skills.js";
|
|
6
|
+
import { withExitHandler } from "./utils.js";
|
|
7
|
+
|
|
8
|
+
const banner = `
|
|
9
|
+
\x1b[38;5;135mβββ\x1b[0m \x1b[38;5;141mββββ ββββ\x1b[38;5;147mβββββββ \x1b[38;5;153mβββ \x1b[38;5;159mββββββββ\x1b[38;5;195mββββββββ\x1b[38;5;231mββββββββ
|
|
10
|
+
\x1b[38;5;135mββββ\x1b[0m \x1b[38;5;141mβββββ βββββ\x1b[38;5;147mββββββββ\x1b[38;5;153mβββ \x1b[38;5;159mββββββββ\x1b[38;5;195mββββββββ\x1b[38;5;231mββββββββ
|
|
11
|
+
\x1b[38;5;135m ββββ\x1b[0m \x1b[38;5;141mβββββββββββ\x1b[38;5;147mβββ βββ\x1b[38;5;153mβββ \x1b[38;5;159mββββββ \x1b[38;5;195mββββββββ\x1b[38;5;231mββββββββ
|
|
12
|
+
\x1b[38;5;135m ββββ\x1b[0m \x1b[38;5;141mβββββββββββ\x1b[38;5;147mβββ βββ\x1b[38;5;153mβββ \x1b[38;5;159mββββββ \x1b[38;5;195mββββββββ\x1b[38;5;231mββββββββ
|
|
13
|
+
\x1b[38;5;135mββββ\x1b[0m \x1b[38;5;141mβββ βββ βββ\x1b[38;5;147mββββββββ\x1b[38;5;153mββββββββ\x1b[38;5;159mββββββββ\x1b[38;5;195mββββββββ\x1b[38;5;231mββββββββ
|
|
14
|
+
\x1b[38;5;135mβββ\x1b[0m \x1b[38;5;141mβββ βββ\x1b[38;5;147mβββββββ \x1b[38;5;153mββββββββ\x1b[38;5;159mββββββββ\x1b[38;5;195mββββββββ\x1b[38;5;231mββββββββ\x1b[0m
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const commands = [
|
|
18
|
+
{
|
|
19
|
+
name: "skills",
|
|
20
|
+
description: "Share Claude Code skills across projects and teams",
|
|
21
|
+
action: skillsCommand,
|
|
22
|
+
},
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
async function interactiveMode(): Promise<void> {
|
|
26
|
+
console.log(banner);
|
|
27
|
+
console.log(
|
|
28
|
+
`\x1b[2m Mind less, ship more. v${packageJson.version}\x1b[0m\n`,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const choice = await withExitHandler(
|
|
32
|
+
select({
|
|
33
|
+
message: "What would you like to do?",
|
|
34
|
+
choices: [
|
|
35
|
+
...commands.map((cmd) => ({
|
|
36
|
+
name: cmd.name,
|
|
37
|
+
value: cmd.name,
|
|
38
|
+
description: cmd.description,
|
|
39
|
+
})),
|
|
40
|
+
{ name: "exit", value: "exit", description: "Exit the CLI" },
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
if (choice === "exit") {
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const command = commands.find((cmd) => cmd.name === choice);
|
|
50
|
+
if (command) {
|
|
51
|
+
await command.action();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const program = new Command()
|
|
56
|
+
.name("mdless")
|
|
57
|
+
.description("CLI tools for Claude Code hard-working devs")
|
|
58
|
+
.version(packageJson.version);
|
|
59
|
+
|
|
60
|
+
for (const cmd of commands) {
|
|
61
|
+
program.command(cmd.name).description(cmd.description).action(cmd.action);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// If no arguments provided, show interactive mode
|
|
65
|
+
if (process.argv.length <= 2) {
|
|
66
|
+
interactiveMode();
|
|
67
|
+
} else {
|
|
68
|
+
program.parse();
|
|
69
|
+
}
|
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();
|