@mdless/cli 1.2.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 +50 -10
- package/package.json +1 -1
- package/src/agents/prompts/reviewer.md +2 -2
- package/src/commands/agent.ts +7 -5
- package/src/commands/start.ts +1 -12
- package/src/playStartupSound.ts +19 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Mind less, ship more.**
|
|
6
6
|
|
|
7
|
-
Run custom Claude Code agent loops from markdown prompts in your repo.
|
|
7
|
+
Run custom Claude Code agent loops from plain markdown prompts in your repo.
|
|
8
8
|
|
|
9
9
|
## ๐ฆ Installation
|
|
10
10
|
|
|
@@ -20,23 +20,33 @@ npx @mdless/cli
|
|
|
20
20
|
npm install -g @mdless/cli
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## ๐ง The idea
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
An **agent is just a markdown file**. Drop your prompts into `.mdless/agents/` and
|
|
26
|
+
each file becomes a looping Claude Code agent.
|
|
26
27
|
|
|
27
|
-
```
|
|
28
|
-
mdless
|
|
28
|
+
```
|
|
29
|
+
.mdless/
|
|
30
|
+
โโโ agents/
|
|
31
|
+
โโโ curator.md โ agent "curator"
|
|
32
|
+
โโโ developer.md โ agent "developer"
|
|
33
|
+
โโโ reviewer.md โ agent "reviewer"
|
|
29
34
|
```
|
|
30
35
|
|
|
31
|
-
|
|
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.
|
|
32
39
|
|
|
33
|
-
|
|
40
|
+
Get started with the bundled defaults:
|
|
34
41
|
|
|
35
42
|
```bash
|
|
36
|
-
mdless
|
|
43
|
+
mdless init
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
|
|
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
|
|
40
50
|
|
|
41
51
|
#### Run a single agent
|
|
42
52
|
|
|
@@ -44,7 +54,37 @@ Launches every prompt in `.mdless/agents/` as a looping agent in a tmux session.
|
|
|
44
54
|
mdless agent <name>
|
|
45
55
|
```
|
|
46
56
|
|
|
47
|
-
Runs
|
|
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`.
|
|
62
|
+
|
|
63
|
+
#### Run every agent at once (tmux)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
mdless work
|
|
67
|
+
```
|
|
68
|
+
|
|
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.
|
|
71
|
+
|
|
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>`
|
|
75
|
+
|
|
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.
|
|
79
|
+
|
|
80
|
+
## ๐ Command reference
|
|
81
|
+
|
|
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 |
|
|
48
88
|
|
|
49
89
|
## ๐ License
|
|
50
90
|
|
package/package.json
CHANGED
|
@@ -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,6 +1,7 @@
|
|
|
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
6
|
const SLEEP_SECONDS = 60;
|
|
6
7
|
|
|
@@ -139,7 +140,7 @@ function formatStreamEvent(line: string): string | null {
|
|
|
139
140
|
} else if (block.type === "tool_use") {
|
|
140
141
|
const summary = summarizeToolInput(block.name, block.input);
|
|
141
142
|
const color = toolColor(block.name);
|
|
142
|
-
out.push(` ${color}โธ${RESET} ${color}${block.name.padEnd(9)}${RESET}${summary}`);
|
|
143
|
+
out.push(` ${color}โธ${RESET} ${color}${block.name.padEnd(9)}${RESET} ${summary}`);
|
|
143
144
|
} else if (block.type === "thinking" && block.thinking?.trim()) {
|
|
144
145
|
out.push(` ${DIM}${ITALIC}~ ${truncate(block.thinking, 200)}${RESET}`);
|
|
145
146
|
}
|
|
@@ -226,8 +227,9 @@ function sleep(seconds: number): Promise<void> {
|
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
export async function agentCommand(name: string): Promise<void> {
|
|
230
|
+
playStartupSound();
|
|
231
|
+
|
|
229
232
|
const prompt = loadPrompt(name);
|
|
230
|
-
const sleepSeconds = Number(process.env.MDLESS_SLEEP) || SLEEP_SECONDS;
|
|
231
233
|
|
|
232
234
|
const logDir = join(process.cwd(), ".mdless", "logs");
|
|
233
235
|
mkdirSync(logDir, { recursive: true });
|
|
@@ -237,7 +239,7 @@ export async function agentCommand(name: string): Promise<void> {
|
|
|
237
239
|
const banner =
|
|
238
240
|
`\n${titleColor}${BOLD} โฆ mdless ยท ${name}${RESET}\n` +
|
|
239
241
|
`${DIM} ${"โ".repeat(40)}${RESET}\n` +
|
|
240
|
-
`${DIM} loop every ${
|
|
242
|
+
`${DIM} loop every ${SLEEP_SECONDS}s ยท logs in .mdless/logs/${name}.log${RESET}\n`;
|
|
241
243
|
process.stdout.write(banner);
|
|
242
244
|
logStream.write(banner);
|
|
243
245
|
|
|
@@ -253,10 +255,10 @@ export async function agentCommand(name: string): Promise<void> {
|
|
|
253
255
|
|
|
254
256
|
await runClaude(prompt, logStream);
|
|
255
257
|
|
|
256
|
-
const footer = `${DIM} sleeping ${
|
|
258
|
+
const footer = `${DIM} sleeping ${SLEEP_SECONDS}sโฆ${RESET}\n`;
|
|
257
259
|
process.stdout.write(footer);
|
|
258
260
|
logStream.write(footer);
|
|
259
261
|
|
|
260
|
-
await sleep(
|
|
262
|
+
await sleep(SLEEP_SECONDS);
|
|
261
263
|
}
|
|
262
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,
|
|
@@ -183,16 +183,6 @@ function startTmux(agents: string[]): void {
|
|
|
183
183
|
spawnSync("tmux", ["attach", "-t", session], { stdio: "inherit" });
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
function playStartupSound(): void {
|
|
187
|
-
const audioPath = join(import.meta.dirname!, "..", "..", "assets", "ready-to-work.mp3");
|
|
188
|
-
if (!existsSync(audioPath)) return;
|
|
189
|
-
|
|
190
|
-
const player = platform() === "darwin" ? "afplay" : platform() === "linux" ? "mpg123" : null;
|
|
191
|
-
if (!player || !which(player)) return;
|
|
192
|
-
|
|
193
|
-
spawn(player, [audioPath], { stdio: "ignore", detached: true }).unref();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
186
|
export async function startCommand(): Promise<void> {
|
|
197
187
|
if (!existsSync(join(process.cwd(), ".git"))) {
|
|
198
188
|
console.error("โ mdless work must be run inside a git repository.");
|
|
@@ -228,6 +218,5 @@ export async function startCommand(): Promise<void> {
|
|
|
228
218
|
mkdirSync(join(process.cwd(), ".mdless", "logs"), { recursive: true });
|
|
229
219
|
mkdirSync(join(process.cwd(), ".mdless", "worktrees"), { recursive: true });
|
|
230
220
|
|
|
231
|
-
playStartupSound();
|
|
232
221
|
startTmux(agents);
|
|
233
222
|
}
|
|
@@ -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
|
+
}
|