@mdless/cli 1.0.5 β†’ 1.0.7

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
@@ -6,25 +6,47 @@ You know that feeling when you craft the perfect Claude Code skill, and then you
6
6
 
7
7
  Yeah, we're tired of that too.
8
8
 
9
- ## What's this?
9
+ ## πŸ€” Why "mdless"?
10
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.
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.
12
18
 
13
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.
14
20
 
15
- ## Usage
21
+ ## πŸ“¦ Installation
22
+
23
+ #### Run instantly with npx
24
+
25
+ ```bash
26
+ npx @mdless/cli
27
+ ```
28
+
29
+ #### Install globally with npm
16
30
 
17
31
  ```bash
18
32
  npm install -g @mdless/cli
19
- mdless skills
20
33
  ```
21
34
 
22
- Or just run it when you need it:
35
+ ## πŸ“‹ Key Features
36
+
37
+ #### Share skills across projects
23
38
 
24
39
  ```bash
25
- npx @mdless/cli skills
40
+ mdless skills
26
41
  ```
27
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
+
28
50
  That's it. Pick the skills you want, hit enter, go back to shipping.
29
51
 
30
52
  The CLI will:
@@ -35,23 +57,6 @@ The CLI will:
35
57
 
36
58
  Commit the skills to your repo. Now everyone on your team has them. Revolutionary, we know.
37
59
 
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
60
+ ## πŸ“„ License
56
61
 
57
62
  MIT β€” go wild.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdless/cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Mind less, ship more. Share Claude Code skills across projects and teams.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,95 @@
1
+ import { readdirSync, statSync, existsSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join, basename } from "node:path";
4
+ import { loadConfig, saveConfig } from "../config.js";
5
+ import { clearLine, formatDuration, truncatePath } from "../utils.js";
6
+
7
+ const EXCLUSIONS = new Set([
8
+ "node_modules",
9
+ ".git",
10
+ "dist",
11
+ "build",
12
+ ".Trash",
13
+ "Library",
14
+ "Applications",
15
+ ".npm",
16
+ ".cache",
17
+ ".local",
18
+ "__pycache__",
19
+ "venv",
20
+ ".venv",
21
+ "worktrees",
22
+ "workspaces",
23
+ ]);
24
+
25
+ function* walkDirectories(dir: string): Generator<string> {
26
+ let entries: string[];
27
+ try {
28
+ entries = readdirSync(dir);
29
+ } catch {
30
+ return;
31
+ }
32
+
33
+ for (const entry of entries) {
34
+ if (EXCLUSIONS.has(entry)) continue;
35
+
36
+ const fullPath = join(dir, entry);
37
+ let stat;
38
+ try {
39
+ stat = statSync(fullPath);
40
+ } catch {
41
+ continue;
42
+ }
43
+
44
+ if (stat.isDirectory()) {
45
+ yield fullPath;
46
+ yield* walkDirectories(fullPath);
47
+ }
48
+ }
49
+ }
50
+
51
+ function isClaudeWorkspace(dir: string): boolean {
52
+ return existsSync(join(dir, ".claude")) && existsSync(join(dir, ".git"));
53
+ }
54
+
55
+ export async function scanCommand(): Promise<void> {
56
+ const startTime = Date.now();
57
+ const home = homedir();
58
+
59
+ console.log(`Scanning from ${home}...`);
60
+
61
+ const found: string[] = [];
62
+ let scanned = 0;
63
+
64
+ for (const dir of walkDirectories(home)) {
65
+ scanned++;
66
+ if (isClaudeWorkspace(dir)) {
67
+ found.push(dir);
68
+ }
69
+ if (scanned % 100 === 0) {
70
+ clearLine();
71
+ process.stdout.write(
72
+ ` ${scanned.toLocaleString()} checked, ${found.length} found | ${truncatePath(dir)}`
73
+ );
74
+ }
75
+ }
76
+
77
+ clearLine();
78
+
79
+ const config = loadConfig();
80
+ config.workingDirectories = found.map((path) => ({
81
+ path,
82
+ name: basename(path),
83
+ sync: true,
84
+ }));
85
+ saveConfig(config);
86
+
87
+ const duration = formatDuration(Date.now() - startTime);
88
+ console.log(`\nβœ“ Found ${found.length} workspaces in ${duration}`);
89
+
90
+ for (const dir of found) {
91
+ console.log(` β€’ ${basename(dir)}`);
92
+ }
93
+
94
+ console.log(`\nSaved to ~/.mdless/config.json`);
95
+ }
package/src/config.ts ADDED
@@ -0,0 +1,42 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+
5
+ export const MDLESS_DIR = join(homedir(), ".mdless");
6
+ export const CONFIG_PATH = join(MDLESS_DIR, "config.json");
7
+
8
+ export interface WorkingDirectory {
9
+ path: string;
10
+ name: string;
11
+ sync: boolean;
12
+ }
13
+
14
+ export interface MdlessConfig {
15
+ version: 1;
16
+ workingDirectories: WorkingDirectory[];
17
+ }
18
+
19
+ export function ensureConfigDir(): void {
20
+ if (!existsSync(MDLESS_DIR)) {
21
+ mkdirSync(MDLESS_DIR, { recursive: true });
22
+ }
23
+ }
24
+
25
+ export function loadConfig(): MdlessConfig {
26
+ ensureConfigDir();
27
+
28
+ if (!existsSync(CONFIG_PATH)) {
29
+ return {
30
+ version: 1,
31
+ workingDirectories: [],
32
+ };
33
+ }
34
+
35
+ const content = readFileSync(CONFIG_PATH, "utf-8");
36
+ return JSON.parse(content) as MdlessConfig;
37
+ }
38
+
39
+ export function saveConfig(config: MdlessConfig): void {
40
+ ensureConfigDir();
41
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
42
+ }
package/src/index.ts CHANGED
@@ -1,16 +1,75 @@
1
1
  #!/usr/bin/env tsx
2
2
  import { Command } from "commander";
3
+ import { select } from "@inquirer/prompts";
3
4
  import packageJson from "../package.json" with { type: "json" };
5
+ import { scanCommand } from "./commands/scan.js";
4
6
  import { skillsCommand } from "./commands/skills.js";
7
+ import { withExitHandler } from "./utils.js";
8
+
9
+ const banner = `
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β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
15
+ \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
16
+ `;
17
+
18
+ const commands = [
19
+ {
20
+ name: "skills",
21
+ description: "Share Claude Code skills across projects and teams",
22
+ action: skillsCommand,
23
+ },
24
+ {
25
+ name: "scan",
26
+ description: "Find Claude workspaces on your computer",
27
+ action: scanCommand,
28
+ },
29
+ ] as const;
30
+
31
+ async function interactiveMode(): Promise<void> {
32
+ console.log(banner);
33
+ console.log(
34
+ `\x1b[2m Mind less, ship more. v${packageJson.version}\x1b[0m\n`,
35
+ );
36
+
37
+ const choice = await withExitHandler(
38
+ select({
39
+ message: "What would you like to do?",
40
+ choices: [
41
+ ...commands.map((cmd) => ({
42
+ name: cmd.name,
43
+ value: cmd.name,
44
+ description: cmd.description,
45
+ })),
46
+ { name: "exit", value: "exit", description: "Exit the CLI" },
47
+ ],
48
+ }),
49
+ );
50
+
51
+ if (choice === "exit") {
52
+ process.exit(0);
53
+ }
54
+
55
+ const command = commands.find((cmd) => cmd.name === choice);
56
+ if (command) {
57
+ await command.action();
58
+ }
59
+ }
5
60
 
6
61
  const program = new Command()
7
62
  .name("mdless")
8
63
  .description("CLI tools for Claude Code hard-working devs")
9
64
  .version(packageJson.version);
10
65
 
11
- program
12
- .command("skills")
13
- .description("Share Claude Code skills across projects and teams")
14
- .action(skillsCommand);
66
+ for (const cmd of commands) {
67
+ program.command(cmd.name).description(cmd.description).action(cmd.action);
68
+ }
15
69
 
16
- program.parse();
70
+ // If no arguments provided, show interactive mode
71
+ if (process.argv.length <= 2) {
72
+ interactiveMode();
73
+ } else {
74
+ program.parse();
75
+ }
package/src/utils.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { readdirSync, statSync } from "node:fs";
2
+ import { homedir } from "node:os";
2
3
  import { join } from "node:path";
3
4
 
4
5
  export function exit(): never {
@@ -18,3 +19,21 @@ export function withExitHandler<T>(promise: Promise<T>): Promise<T> {
18
19
  throw e;
19
20
  });
20
21
  }
22
+
23
+ export function truncatePath(path: string, maxLength = 50): string {
24
+ const home = homedir();
25
+ let display = path.startsWith(home) ? path.replace(home, "~") : path;
26
+ if (display.length > maxLength) {
27
+ display = "..." + display.slice(-maxLength + 3);
28
+ }
29
+ return display;
30
+ }
31
+
32
+ export function clearLine(): void {
33
+ process.stdout.write("\r\x1b[K");
34
+ }
35
+
36
+ export function formatDuration(ms: number): string {
37
+ if (ms < 1000) return `${ms}ms`;
38
+ return `${(ms / 1000).toFixed(1)}s`;
39
+ }