@mdless/cli 1.1.0 → 1.2.1
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 +55 -28
- package/package.json +2 -3
- package/src/agents/prompts/{watcher.md → curator.md} +6 -14
- package/src/agents/prompts/{executor.md → developer.md} +1 -1
- package/src/agents/prompts/reviewer.md +3 -3
- package/src/commands/agent.ts +10 -24
- package/src/commands/start.ts +21 -23
- package/src/index.ts +1 -13
- package/src/playStartupSound.ts +19 -0
- package/src/utils.ts +0 -28
- package/skills/ci-errors/SKILL.md +0 -29
- package/skills/commit/SKILL.md +0 -27
- package/skills/pr/SKILL.md +0 -22
- package/skills/pr-comments/SKILL.md +0 -26
- package/skills/sentry/SKILL.md +0 -39
- package/src/commands/scan.ts +0 -90
- package/src/commands/skills.ts +0 -73
- package/src/config.ts +0 -42
package/README.md
CHANGED
|
@@ -4,60 +4,87 @@
|
|
|
4
4
|
|
|
5
5
|
**Mind less, ship more.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run custom Claude Code agent loops from plain markdown prompts in your repo.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 📦 Installation
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
#### Run instantly with npx
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
```bash
|
|
14
|
+
npx @mdless/cli
|
|
15
|
+
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
#### Install globally with npm
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @mdless/cli
|
|
21
|
+
```
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
## 🧠 The idea
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
An **agent is just a markdown file**. Drop your prompts into `.mdless/agents/` and
|
|
26
|
+
each file becomes a looping Claude Code agent.
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
```
|
|
29
|
+
.mdless/
|
|
30
|
+
└── agents/
|
|
31
|
+
├── curator.md → agent "curator"
|
|
32
|
+
├── developer.md → agent "developer"
|
|
33
|
+
└── reviewer.md → agent "reviewer"
|
|
34
|
+
```
|
|
24
35
|
|
|
25
|
-
|
|
36
|
+
- One markdown file = one agent.
|
|
37
|
+
- The **file name is the agent name** (`reviewer.md` → `reviewer`).
|
|
38
|
+
- The file contents are the agent's prompt — write whatever instructions you want.
|
|
39
|
+
|
|
40
|
+
Get started with the bundled defaults:
|
|
26
41
|
|
|
27
42
|
```bash
|
|
28
|
-
|
|
43
|
+
mdless init
|
|
29
44
|
```
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
This copies a few example prompts into `.mdless/agents/`. Edit them, rename them,
|
|
47
|
+
add your own — anything in that folder counts as an agent.
|
|
48
|
+
|
|
49
|
+
## 🚀 Running agents
|
|
50
|
+
|
|
51
|
+
#### Run a single agent
|
|
32
52
|
|
|
33
53
|
```bash
|
|
34
|
-
|
|
54
|
+
mdless agent <name>
|
|
35
55
|
```
|
|
36
56
|
|
|
37
|
-
|
|
57
|
+
Runs the agent in `.mdless/agents/<name>.md` on a loop: it executes Claude Code,
|
|
58
|
+
waits, then runs again. For example, `mdless agent reviewer` loops
|
|
59
|
+
`.mdless/agents/reviewer.md`.
|
|
60
|
+
|
|
61
|
+
Logs are written to `.mdless/logs/<name>.log`. Stop with `Ctrl-C`.
|
|
38
62
|
|
|
39
|
-
####
|
|
63
|
+
#### Run every agent at once (tmux)
|
|
40
64
|
|
|
41
65
|
```bash
|
|
42
|
-
mdless
|
|
66
|
+
mdless work
|
|
43
67
|
```
|
|
44
68
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
| [**commit**](skills/commit/SKILL.md) | Writes commit messages so you don't have to think |
|
|
48
|
-
| [**pr**](skills/pr/SKILL.md) | Creates PRs with actual descriptions |
|
|
49
|
-
| [**pr-comments**](skills/pr-comments/SKILL.md) | Responds to PR comments (politely) |
|
|
50
|
-
| [**ci-errors**](skills/ci-errors/SKILL.md) | Reads CI logs and fixes the errors |
|
|
69
|
+
Discovers every prompt in `.mdless/agents/` and launches each one as its own
|
|
70
|
+
looping agent inside a single tmux session, split side by side.
|
|
51
71
|
|
|
52
|
-
|
|
72
|
+
- Detach from the session: `Ctrl-b d`
|
|
73
|
+
- Re-attach later: just run `mdless work` again
|
|
74
|
+
- Kill everything: `tmux kill-session -t mdless-<repo>`
|
|
53
75
|
|
|
54
|
-
|
|
76
|
+
`mdless work` must be run inside a git repository and needs `tmux`, `gh`
|
|
77
|
+
(authenticated), and `claude` available on your `PATH`. Missing tools are
|
|
78
|
+
installed automatically where possible.
|
|
55
79
|
|
|
56
|
-
|
|
57
|
-
2. Show you a list of available skills
|
|
58
|
-
3. Install the ones you pick (remove the ones you don't)
|
|
80
|
+
## 📋 Command reference
|
|
59
81
|
|
|
60
|
-
|
|
82
|
+
| Command | What it does |
|
|
83
|
+
| --------------------- | ------------------------------------------------------- |
|
|
84
|
+
| `mdless` | Interactive menu |
|
|
85
|
+
| `mdless init` | Copy the default agent prompts into `.mdless/agents/` |
|
|
86
|
+
| `mdless agent <name>` | Loop a single agent from `.mdless/agents/<name>.md` |
|
|
87
|
+
| `mdless work` | Loop every agent in `.mdless/agents/` in a tmux session |
|
|
61
88
|
|
|
62
89
|
## 📄 License
|
|
63
90
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdless/cli",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "Mind less, ship more.
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "Mind less, ship more. Agent loops for Claude Code projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mdless": "bin.mjs"
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"bin.mjs",
|
|
11
11
|
"src/",
|
|
12
|
-
"skills/",
|
|
13
12
|
"assets/"
|
|
14
13
|
],
|
|
15
14
|
"keywords": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Curator Agent
|
|
2
2
|
|
|
3
3
|
You scan this project for problems and file GitHub issues so other agents can pick them up.
|
|
4
4
|
|
|
@@ -10,13 +10,7 @@ You never edit code or create PRs. Only issues.
|
|
|
10
10
|
|
|
11
11
|
Scan these in order. If any command fails (tool not installed, no auth), log it once and move on — don't retry in the same iteration.
|
|
12
12
|
|
|
13
|
-
### 1.
|
|
14
|
-
|
|
15
|
-
```sh
|
|
16
|
-
sentry-cli issues list --status unresolved
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### 2. TODO / FIXME comments
|
|
13
|
+
### 1. TODO / FIXME comments
|
|
20
14
|
|
|
21
15
|
```sh
|
|
22
16
|
git grep -nE "TODO|FIXME" -- ':!*.md' ':!.mdless'
|
|
@@ -24,7 +18,7 @@ git grep -nE "TODO|FIXME" -- ':!*.md' ':!.mdless'
|
|
|
24
18
|
|
|
25
19
|
Only flag things that look actionable. Skip example/doc style comments.
|
|
26
20
|
|
|
27
|
-
###
|
|
21
|
+
### 2. Dependency vulnerabilities
|
|
28
22
|
|
|
29
23
|
Pick the audit command matching the project's lockfile:
|
|
30
24
|
|
|
@@ -52,7 +46,6 @@ Each source has a unique id format embedded in the issue body:
|
|
|
52
46
|
|
|
53
47
|
| Source | Source-ID line |
|
|
54
48
|
| ------ | --------------------------------------- |
|
|
55
|
-
| Sentry | `Sentry-ID: <id>` |
|
|
56
49
|
| TODO | `Source-Ref: <file>:<line>` |
|
|
57
50
|
| CVE | `CVE: <cve-id>` or `Advisory: <ghsa-id>` |
|
|
58
51
|
|
|
@@ -67,12 +60,11 @@ gh issue create --label mdless/work --title "..." --body "..."
|
|
|
67
60
|
Title: concise and action-oriented.
|
|
68
61
|
Good: `Fix null deref in PaymentProcessor.charge`
|
|
69
62
|
Good: `Upgrade lodash to patch CVE-2024-XXXXX`
|
|
70
|
-
Bad: `Sentry issue ABC-456`
|
|
71
63
|
|
|
72
64
|
Body: start with metadata, then a separator, then details.
|
|
73
65
|
|
|
74
66
|
```
|
|
75
|
-
Source:
|
|
67
|
+
Source: todo | cve
|
|
76
68
|
<Source-ID line>
|
|
77
69
|
---
|
|
78
70
|
<problem description, affected files/area, repro details>
|
|
@@ -80,8 +72,8 @@ Source: sentry | todo | cve
|
|
|
80
72
|
|
|
81
73
|
### Step 3 — Log one line
|
|
82
74
|
|
|
83
|
-
- `created #123
|
|
84
|
-
- `skip todo src/
|
|
75
|
+
- `created #123 todo src/foo.ts:42`
|
|
76
|
+
- `skip todo src/bar.ts:10 (already #98)`
|
|
85
77
|
|
|
86
78
|
---
|
|
87
79
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Reviewer Agent
|
|
2
2
|
|
|
3
|
-
You review pull requests created by the
|
|
3
|
+
You review pull requests created by the developer agent. You either approve them (via a label) or leave actionable inline comments.
|
|
4
4
|
|
|
5
5
|
Do one PR per invocation, then exit. The wrapper sleeps and re-invokes you.
|
|
6
6
|
|
|
@@ -42,9 +42,9 @@ gh issue view <N>
|
|
|
42
42
|
| Scope | Any changes unrelated to the issue? |
|
|
43
43
|
| Bugs | Obvious off-by-one, null derefs, missed error paths, broken types? |
|
|
44
44
|
| Tests | If similar code has tests, are there new/updated tests here? |
|
|
45
|
-
| Guidelines | Read `
|
|
45
|
+
| Guidelines | Read `AGENTS.md` (and any nested ones). Flag clear violations of its rules. |
|
|
46
46
|
|
|
47
|
-
Do not review subjective style. Only flag what's explicitly documented in `
|
|
47
|
+
Do not review subjective style. Only flag what's explicitly documented in `AGENTS.md` or what's an actual bug.
|
|
48
48
|
|
|
49
49
|
### Step 4 — Decide
|
|
50
50
|
|
package/src/commands/agent.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, createWriteStream } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { playStartupSound } from "../playStartupSound.js";
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
watcher: 300,
|
|
7
|
-
executor: 60,
|
|
8
|
-
reviewer: 120,
|
|
9
|
-
};
|
|
10
|
-
const FALLBACK_SLEEP_SECONDS = 60;
|
|
6
|
+
const SLEEP_SECONDS = 60;
|
|
11
7
|
|
|
12
8
|
function timestamp(): string {
|
|
13
9
|
const d = new Date();
|
|
@@ -52,20 +48,12 @@ const TOOL_COLORS: Record<string, string> = {
|
|
|
52
48
|
Task: MAGENTA_PURPLE,
|
|
53
49
|
};
|
|
54
50
|
|
|
55
|
-
const
|
|
56
|
-
watcher: LAVENDER,
|
|
57
|
-
executor: VIOLET,
|
|
58
|
-
reviewer: MAGENTA_PURPLE,
|
|
59
|
-
};
|
|
51
|
+
const AGENT_COLOR = VIOLET;
|
|
60
52
|
|
|
61
53
|
function toolColor(name: string): string {
|
|
62
54
|
return TOOL_COLORS[name] ?? VIOLET;
|
|
63
55
|
}
|
|
64
56
|
|
|
65
|
-
function agentColor(name: string): string {
|
|
66
|
-
return AGENT_COLORS[name] ?? VIOLET;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
57
|
function truncate(s: string, n: number): string {
|
|
70
58
|
const clean = s.replace(/\s+/g, " ").trim();
|
|
71
59
|
return clean.length > n ? clean.slice(0, n - 1) + "…" : clean;
|
|
@@ -152,7 +140,7 @@ function formatStreamEvent(line: string): string | null {
|
|
|
152
140
|
} else if (block.type === "tool_use") {
|
|
153
141
|
const summary = summarizeToolInput(block.name, block.input);
|
|
154
142
|
const color = toolColor(block.name);
|
|
155
|
-
out.push(` ${color}▸${RESET} ${color}${block.name.padEnd(9)}${RESET}${summary}`);
|
|
143
|
+
out.push(` ${color}▸${RESET} ${color}${block.name.padEnd(9)}${RESET} ${summary}`);
|
|
156
144
|
} else if (block.type === "thinking" && block.thinking?.trim()) {
|
|
157
145
|
out.push(` ${DIM}${ITALIC}~ ${truncate(block.thinking, 200)}${RESET}`);
|
|
158
146
|
}
|
|
@@ -239,21 +227,19 @@ function sleep(seconds: number): Promise<void> {
|
|
|
239
227
|
}
|
|
240
228
|
|
|
241
229
|
export async function agentCommand(name: string): Promise<void> {
|
|
230
|
+
playStartupSound();
|
|
231
|
+
|
|
242
232
|
const prompt = loadPrompt(name);
|
|
243
|
-
const sleepSeconds =
|
|
244
|
-
Number(process.env.MDLESS_SLEEP) ||
|
|
245
|
-
DEFAULT_SLEEP_SECONDS[name] ||
|
|
246
|
-
FALLBACK_SLEEP_SECONDS;
|
|
247
233
|
|
|
248
234
|
const logDir = join(process.cwd(), ".mdless", "logs");
|
|
249
235
|
mkdirSync(logDir, { recursive: true });
|
|
250
236
|
const logStream = createWriteStream(join(logDir, `${name}.log`), { flags: "a" });
|
|
251
237
|
|
|
252
|
-
const titleColor =
|
|
238
|
+
const titleColor = AGENT_COLOR;
|
|
253
239
|
const banner =
|
|
254
240
|
`\n${titleColor}${BOLD} ✦ mdless · ${name}${RESET}\n` +
|
|
255
241
|
`${DIM} ${"─".repeat(40)}${RESET}\n` +
|
|
256
|
-
`${DIM} loop every ${
|
|
242
|
+
`${DIM} loop every ${SLEEP_SECONDS}s · logs in .mdless/logs/${name}.log${RESET}\n`;
|
|
257
243
|
process.stdout.write(banner);
|
|
258
244
|
logStream.write(banner);
|
|
259
245
|
|
|
@@ -269,10 +255,10 @@ export async function agentCommand(name: string): Promise<void> {
|
|
|
269
255
|
|
|
270
256
|
await runClaude(prompt, logStream);
|
|
271
257
|
|
|
272
|
-
const footer = `${DIM} sleeping ${
|
|
258
|
+
const footer = `${DIM} sleeping ${SLEEP_SECONDS}s…${RESET}\n`;
|
|
273
259
|
process.stdout.write(footer);
|
|
274
260
|
logStream.write(footer);
|
|
275
261
|
|
|
276
|
-
await sleep(
|
|
262
|
+
await sleep(SLEEP_SECONDS);
|
|
277
263
|
}
|
|
278
264
|
}
|
package/src/commands/start.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
2
|
import {
|
|
3
3
|
existsSync,
|
|
4
4
|
mkdirSync,
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
} from "node:fs";
|
|
9
9
|
import { basename, join } from "node:path";
|
|
10
10
|
import { platform } from "node:os";
|
|
11
|
+
import { confirm } from "@inquirer/prompts";
|
|
12
|
+
import { initCommand } from "./init.js";
|
|
13
|
+
import { withExitHandler } from "../utils.js";
|
|
11
14
|
|
|
12
15
|
const SESSION_PREFIX = "mdless";
|
|
13
16
|
const LABELS: Array<{ name: string; color: string; description: string }> = [
|
|
@@ -19,7 +22,7 @@ const LABELS: Array<{ name: string; color: string; description: string }> = [
|
|
|
19
22
|
{
|
|
20
23
|
name: "mdless/approved",
|
|
21
24
|
color: "5319E7",
|
|
22
|
-
description: "Approved
|
|
25
|
+
description: "Approved via mdless",
|
|
23
26
|
},
|
|
24
27
|
];
|
|
25
28
|
|
|
@@ -61,7 +64,6 @@ function autoInstall(cmd: string): boolean {
|
|
|
61
64
|
function checkPrereqs(): boolean {
|
|
62
65
|
const autoInstallable = ["tmux"];
|
|
63
66
|
const required = ["gh", "claude"];
|
|
64
|
-
const optional = ["sentry-cli"];
|
|
65
67
|
let ok = true;
|
|
66
68
|
|
|
67
69
|
for (const cmd of autoInstallable) {
|
|
@@ -74,11 +76,6 @@ function checkPrereqs(): boolean {
|
|
|
74
76
|
ok = false;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
|
-
for (const cmd of optional) {
|
|
78
|
-
if (!which(cmd)) {
|
|
79
|
-
console.log(`! Optional command not found: ${cmd} (watcher will skip this source)`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
79
|
|
|
83
80
|
if (!ok) return false;
|
|
84
81
|
|
|
@@ -186,28 +183,30 @@ function startTmux(agents: string[]): void {
|
|
|
186
183
|
spawnSync("tmux", ["attach", "-t", session], { stdio: "inherit" });
|
|
187
184
|
}
|
|
188
185
|
|
|
189
|
-
function playStartupSound(): void {
|
|
190
|
-
const audioPath = join(import.meta.dirname!, "..", "..", "assets", "ready-to-work.mp3");
|
|
191
|
-
if (!existsSync(audioPath)) return;
|
|
192
|
-
|
|
193
|
-
const player = platform() === "darwin" ? "afplay" : platform() === "linux" ? "mpg123" : null;
|
|
194
|
-
if (!player || !which(player)) return;
|
|
195
|
-
|
|
196
|
-
spawn(player, [audioPath], { stdio: "ignore", detached: true }).unref();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
186
|
export async function startCommand(): Promise<void> {
|
|
200
187
|
if (!existsSync(join(process.cwd(), ".git"))) {
|
|
201
188
|
console.error("✗ mdless work must be run inside a git repository.");
|
|
202
189
|
process.exit(1);
|
|
203
190
|
}
|
|
204
191
|
|
|
205
|
-
|
|
192
|
+
let agents = discoverAgents();
|
|
206
193
|
if (agents.length === 0) {
|
|
207
|
-
console.
|
|
208
|
-
|
|
194
|
+
console.log("! no agent prompts found in .mdless/agents/");
|
|
195
|
+
const shouldInit = await withExitHandler(
|
|
196
|
+
confirm({
|
|
197
|
+
message: "Run `mdless init` to copy the default prompts?",
|
|
198
|
+
default: true,
|
|
199
|
+
}),
|
|
209
200
|
);
|
|
210
|
-
|
|
201
|
+
if (!shouldInit) {
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
await initCommand();
|
|
205
|
+
agents = discoverAgents();
|
|
206
|
+
if (agents.length === 0) {
|
|
207
|
+
console.error("✗ init ran but no prompts were found. Aborting.");
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
211
210
|
}
|
|
212
211
|
|
|
213
212
|
if (!checkPrereqs()) {
|
|
@@ -219,6 +218,5 @@ export async function startCommand(): Promise<void> {
|
|
|
219
218
|
mkdirSync(join(process.cwd(), ".mdless", "logs"), { recursive: true });
|
|
220
219
|
mkdirSync(join(process.cwd(), ".mdless", "worktrees"), { recursive: true });
|
|
221
220
|
|
|
222
|
-
playStartupSound();
|
|
223
221
|
startTmux(agents);
|
|
224
222
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,8 +4,6 @@ import { select } from "@inquirer/prompts";
|
|
|
4
4
|
import packageJson from "../package.json" with { type: "json" };
|
|
5
5
|
import { agentCommand } from "./commands/agent.js";
|
|
6
6
|
import { initCommand } from "./commands/init.js";
|
|
7
|
-
import { scanCommand } from "./commands/scan.js";
|
|
8
|
-
import { skillsCommand } from "./commands/skills.js";
|
|
9
7
|
import { startCommand } from "./commands/start.js";
|
|
10
8
|
import { withExitHandler } from "./utils.js";
|
|
11
9
|
|
|
@@ -19,16 +17,6 @@ const banner = `
|
|
|
19
17
|
`;
|
|
20
18
|
|
|
21
19
|
const commands = [
|
|
22
|
-
{
|
|
23
|
-
name: "skills",
|
|
24
|
-
description: "Share Claude Code skills across projects and teams",
|
|
25
|
-
action: skillsCommand,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "scan",
|
|
29
|
-
description: "Find Claude workspaces on your computer",
|
|
30
|
-
action: scanCommand,
|
|
31
|
-
},
|
|
32
20
|
{
|
|
33
21
|
name: "init",
|
|
34
22
|
description: "Copy the default agent prompts into .mdless/agents/",
|
|
@@ -82,7 +70,7 @@ for (const cmd of commands) {
|
|
|
82
70
|
|
|
83
71
|
program
|
|
84
72
|
.command("agent <name>")
|
|
85
|
-
.description("Run a single agent
|
|
73
|
+
.description("Run a single agent on repeat — reads the prompt from .mdless/agents/<name>.md")
|
|
86
74
|
.action(agentCommand);
|
|
87
75
|
|
|
88
76
|
// If no arguments provided, show interactive mode
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { platform } from "node:os";
|
|
5
|
+
|
|
6
|
+
function which(cmd: string): boolean {
|
|
7
|
+
const result = spawnSync("which", [cmd], { stdio: "ignore" });
|
|
8
|
+
return result.status === 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function playStartupSound(): void {
|
|
12
|
+
const audioPath = join(import.meta.dirname!, "..", "assets", "ready-to-work.mp3");
|
|
13
|
+
if (!existsSync(audioPath)) return;
|
|
14
|
+
|
|
15
|
+
const player = platform() === "darwin" ? "afplay" : platform() === "linux" ? "mpg123" : null;
|
|
16
|
+
if (!player || !which(player)) return;
|
|
17
|
+
|
|
18
|
+
spawn(player, [audioPath], { stdio: "ignore", detached: true }).unref();
|
|
19
|
+
}
|
package/src/utils.ts
CHANGED
|
@@ -1,39 +1,11 @@
|
|
|
1
|
-
import { readdirSync, statSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
|
|
5
1
|
export function exit(): never {
|
|
6
2
|
console.log("\nAborted.");
|
|
7
3
|
process.exit(0);
|
|
8
4
|
}
|
|
9
5
|
|
|
10
|
-
export function getDirectories(path: string): string[] {
|
|
11
|
-
return readdirSync(path).filter((name) =>
|
|
12
|
-
statSync(join(path, name)).isDirectory()
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
6
|
export function withExitHandler<T>(promise: Promise<T>): Promise<T> {
|
|
17
7
|
return promise.catch((e: Error) => {
|
|
18
8
|
if (e.name === "ExitPromptError") exit();
|
|
19
9
|
throw e;
|
|
20
10
|
});
|
|
21
11
|
}
|
|
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
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ci-errors
|
|
3
|
-
description: Fetch failing CI logs for the current PR, analyze errors, and fix them
|
|
4
|
-
allowed-tools: Bash(gh:*), Bash(git:*), Read, Grep, Glob, Edit
|
|
5
|
-
argument-hint: [optional: specific check name to focus on]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# CI Errors
|
|
9
|
-
|
|
10
|
-
Fetch failing CI logs for the current PR, analyze the errors, and fix them.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Run `gh pr view --json number,title,headRefName` to confirm there is an open PR. If not, stop.
|
|
15
|
-
|
|
16
|
-
2. Get failing checks:
|
|
17
|
-
```bash
|
|
18
|
-
gh pr checks --json name,bucket,link,state --jq '[.[] | select(.bucket == "fail")]'
|
|
19
|
-
```
|
|
20
|
-
If no checks are failing, tell the user and stop. Filter by $ARGUMENTS if provided.
|
|
21
|
-
|
|
22
|
-
3. Extract `run_id` and `job_id` from each failing check link (format: `.../actions/runs/<run_id>/job/<job_id>`).
|
|
23
|
-
Fetch logs with `gh run view <run_id> --log-failed`. Fall back to annotations if unavailable.
|
|
24
|
-
|
|
25
|
-
4. Categorize each failure (test, lint/type, build, or other) and identify the root cause.
|
|
26
|
-
|
|
27
|
-
5. Fix each error: read the source, apply the fix, explain what changed.
|
|
28
|
-
|
|
29
|
-
6. Summarize what was fixed and suggest the user re-run CI.
|
package/skills/commit/SKILL.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: commit
|
|
3
|
-
description: Stage and commit changes with a conventional commit message
|
|
4
|
-
allowed-tools: Bash(git:*)
|
|
5
|
-
argument-hint: [optional: what to commit]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Commit
|
|
9
|
-
|
|
10
|
-
Stage and commit changes using conventional commit messages.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Check `git status --short` to see what changes exist
|
|
15
|
-
2. Stage relevant files for commit
|
|
16
|
-
3. Verify nothing is staged that shouldn't be
|
|
17
|
-
4. Create a commit using conventional format: `<type>: <description>`
|
|
18
|
-
|
|
19
|
-
Only push the commit if specifically instructed to do so.
|
|
20
|
-
|
|
21
|
-
## Conventional Commit Types
|
|
22
|
-
|
|
23
|
-
`feat` | `fix` | `docs` | `style` | `refactor` | `perf` | `test` | `chore` | `ci`
|
|
24
|
-
|
|
25
|
-
Description: short summary (50 chars or less), lowercase, no period.
|
|
26
|
-
|
|
27
|
-
Use $ARGUMENTS as guidance for what to commit. If not provided, commit all unstaged changes.
|
package/skills/pr/SKILL.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pr
|
|
3
|
-
description: Commit changes, push, and create/update a pull request
|
|
4
|
-
allowed-tools: Bash(git:*), Bash(gh:*), Read, Edit
|
|
5
|
-
argument-hint: [optional: branch/commit message guidance]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Create PR
|
|
9
|
-
|
|
10
|
-
Commit changes, push, and create/update a pull request.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Check `git status` and current branch
|
|
15
|
-
2. If on main/master, create a feature branch. Otherwise stay on current branch.
|
|
16
|
-
3. Stage and commit changes using conventional commit format
|
|
17
|
-
4. Push to origin (use `-u` if branch is new)
|
|
18
|
-
5. Check if PR exists with `gh pr view`
|
|
19
|
-
6. If no PR, create one with `gh pr create` (include a summary of the changes)
|
|
20
|
-
7. Open in browser with `gh pr view --web`
|
|
21
|
-
|
|
22
|
-
Use $ARGUMENTS as guidance for branch name and commit message.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pr-comments
|
|
3
|
-
description: Review and respond to PR comments
|
|
4
|
-
allowed-tools: Bash(gh:*), Bash(git:*), Read, Edit
|
|
5
|
-
argument-hint: [optional: e.g. "reply to antoine saying we should add tests"]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# PR Comments
|
|
9
|
-
|
|
10
|
-
Review and respond to comments on a pull request.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Get the PR number: `gh pr view --json number -q .number`
|
|
15
|
-
|
|
16
|
-
2. Fetch review comments using `gh api` for the current PR
|
|
17
|
-
|
|
18
|
-
3. For each comment, show: file, line, author, body. Then suggest either:
|
|
19
|
-
- A code fix (if requesting a change)
|
|
20
|
-
- A reply (if it's a question/discussion)
|
|
21
|
-
|
|
22
|
-
4. Ask the user what to do: apply fix, reply, skip, or custom action
|
|
23
|
-
|
|
24
|
-
5. Execute: for fixes, edit/commit/push. For replies, post via `gh api`.
|
|
25
|
-
|
|
26
|
-
Use $ARGUMENTS to guide actions (e.g., "fix all issues" or "reply to antoine").
|
package/skills/sentry/SKILL.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sentry
|
|
3
|
-
description: Investigate Sentry issues and errors using the sentry-cli
|
|
4
|
-
allowed-tools: Bash(sentry-cli:*), Read, Grep, Glob, Edit
|
|
5
|
-
argument-hint: [optional: issue ID]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Sentry
|
|
9
|
-
|
|
10
|
-
Investigate Sentry issues and errors using `sentry-cli`.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Based on $ARGUMENTS, run `sentry-cli issues list` directly:
|
|
15
|
-
- **No arguments**: `sentry-cli issues list -s unresolved --max-rows 10`
|
|
16
|
-
- **Issue ID provided**: `sentry-cli issues list -i <ID>`
|
|
17
|
-
|
|
18
|
-
2. If the command fails due to missing authentication or configuration, help the user create a `.sentryclirc` in the project root:
|
|
19
|
-
|
|
20
|
-
```ini
|
|
21
|
-
[auth]
|
|
22
|
-
token=<ask user for their token>
|
|
23
|
-
|
|
24
|
-
[defaults]
|
|
25
|
-
org=<ask user for org slug>
|
|
26
|
-
project=<ask user for project slug>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Make sure `.sentryclirc` is listed in `.gitignore` since it contains the auth token. Then retry the command.
|
|
30
|
-
|
|
31
|
-
3. Analyze the issues found. For each relevant issue, identify the likely root cause by reading the referenced source files.
|
|
32
|
-
|
|
33
|
-
4. If the user wants a fix, apply it directly. Otherwise, summarize findings and suggest next steps.
|
|
34
|
-
|
|
35
|
-
## Tips
|
|
36
|
-
|
|
37
|
-
- Use `sentry-cli issues list --query "is:unresolved level:error"` for unresolved errors only
|
|
38
|
-
- Use `--max-rows` and `--pages` to limit output
|
|
39
|
-
- Always prefer `sentry-cli` over the Sentry MCP or API
|
package/src/commands/scan.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
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
|
-
"dist",
|
|
10
|
-
"build",
|
|
11
|
-
"Library",
|
|
12
|
-
"Applications",
|
|
13
|
-
"__pycache__",
|
|
14
|
-
"venv",
|
|
15
|
-
"worktrees",
|
|
16
|
-
"workspaces",
|
|
17
|
-
"tmp",
|
|
18
|
-
]);
|
|
19
|
-
|
|
20
|
-
function* walkDirectories(dir: string): Generator<string> {
|
|
21
|
-
let entries: string[];
|
|
22
|
-
try {
|
|
23
|
-
entries = readdirSync(dir);
|
|
24
|
-
} catch {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
for (const entry of entries) {
|
|
29
|
-
if (entry.startsWith(".") || EXCLUSIONS.has(entry)) continue;
|
|
30
|
-
|
|
31
|
-
const fullPath = join(dir, entry);
|
|
32
|
-
let stat;
|
|
33
|
-
try {
|
|
34
|
-
stat = statSync(fullPath);
|
|
35
|
-
} catch {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (stat.isDirectory()) {
|
|
40
|
-
yield fullPath;
|
|
41
|
-
yield* walkDirectories(fullPath);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function isClaudeWorkspace(dir: string): boolean {
|
|
47
|
-
return existsSync(join(dir, ".claude")) && existsSync(join(dir, ".git"));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export async function scanCommand(): Promise<void> {
|
|
51
|
-
const startTime = Date.now();
|
|
52
|
-
const home = homedir();
|
|
53
|
-
|
|
54
|
-
console.log(`Scanning from ${home}...`);
|
|
55
|
-
|
|
56
|
-
const found: string[] = [];
|
|
57
|
-
let scanned = 0;
|
|
58
|
-
|
|
59
|
-
for (const dir of walkDirectories(home)) {
|
|
60
|
-
scanned++;
|
|
61
|
-
if (isClaudeWorkspace(dir)) {
|
|
62
|
-
found.push(dir);
|
|
63
|
-
}
|
|
64
|
-
if (scanned % 100 === 0) {
|
|
65
|
-
clearLine();
|
|
66
|
-
process.stdout.write(
|
|
67
|
-
` ${scanned.toLocaleString()} checked, ${found.length} found | ${truncatePath(dir)}`,
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
clearLine();
|
|
73
|
-
|
|
74
|
-
const config = loadConfig();
|
|
75
|
-
config.workingDirectories = found.map((path) => ({
|
|
76
|
-
path,
|
|
77
|
-
name: basename(path),
|
|
78
|
-
sync: true,
|
|
79
|
-
}));
|
|
80
|
-
saveConfig(config);
|
|
81
|
-
|
|
82
|
-
const duration = formatDuration(Date.now() - startTime);
|
|
83
|
-
console.log(`\n✓ Found ${found.length} workspaces in ${duration}`);
|
|
84
|
-
|
|
85
|
-
for (const dir of found) {
|
|
86
|
-
console.log(` • ${basename(dir)}`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.log(`\nSaved to ~/.mdless/config.json`);
|
|
90
|
-
}
|
package/src/commands/skills.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
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/config.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
}
|