@mayurdluffy/ccwf 0.4.0 → 0.6.0
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 +20 -14
- package/lib/chrome-mcp.js +73 -66
- package/lib/index.js +173 -66
- package/lib/installer.js +115 -30
- package/lib/machine.js +63 -18
- package/lib/merge.js +56 -12
- package/lib/modules.js +38 -6
- package/lib/published.js +51 -0
- package/lib/stats.js +110 -0
- package/package.json +2 -2
- package/templates/blocks/browser.md +2 -2
- package/templates/blocks/guardrails.md +7 -0
- package/templates/docs/ROADMAP.md +1 -1
- package/templates/docs/agents/issue-tracker.md +5 -5
- package/templates/docs/agents/setup.md +5 -5
- package/templates/docs/agents/workflow.md +3 -3
- package/templates/guardrails/check.sh +100 -0
- package/templates/machine.json +53 -43
- package/templates/skills/commit/SKILL.md +1 -1
- package/templates/skills/orchestrate-workers/SKILL.md +46 -16
- package/templates/skills/orchestrate-workers/approve.sh +5 -1
- package/templates/skills/orchestrate-workers/assign.sh +2 -0
- package/templates/skills/orchestrate-workers/checks.sh +17 -0
- package/templates/skills/orchestrate-workers/claude-worker-settings.json +6 -2
- package/templates/skills/orchestrate-workers/end.sh +5 -2
- package/templates/skills/orchestrate-workers/grid.sh +2 -0
- package/templates/skills/orchestrate-workers/pane.sh +19 -4
- package/templates/skills/orchestrate-workers/review.sh +68 -0
- package/templates/skills/orchestrate-workers/runlog.sh +23 -0
- package/templates/skills/orchestrate-workers/tickets.sh +94 -0
- package/templates/skills/orchestrate-workers/watch.sh +64 -13
- package/templates/skills/orchestrate-workers/workers.conf +4 -0
- package/templates/skills/orchestrate-workers/worktree.sh +160 -0
- package/templates/skills/verify-ui/PLAYBOOK.md +1 -1
- package/templates/skills/verify-ui/SKILL.md +5 -4
- package/templates/skills/verify-ui/ab.sh +9 -0
- package/templates/skills/verify-ui/lib.sh +59 -0
- package/templates/skills/verify-ui/probe.sh +6 -3
- package/templates/skills/verify-ui/run.sh +21 -7
package/README.md
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@mayurdluffy/ccwf)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
One command that sets up the same agent system on any computer and in any repo, for **Claude Code, Codex and Cursor** (only those three; macOS and Linux).
|
|
6
|
+
One command that sets up the same agent system on any computer and in any repo, for **Claude Code, Codex and Cursor** (only those three; macOS and Linux). Needs Node 22 or newer.
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
cd your-repo
|
|
10
10
|
npx @mayurdluffy/cbm-cli install --agents claude,codex,cursor # code-graph MCP first (see docs/agents/setup.md after init)
|
|
11
|
-
npx @mayurdluffy/ccwf init # tools + user-level skills + project files
|
|
11
|
+
npx @mayurdluffy/ccwf@latest init # tools + user-level skills + project files
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
`init` shows what is missing on your machine, installs it after one confirmation, then writes the project files. `--yes` skips the question: it runs vendor install scripts from the network and installs skills from
|
|
14
|
+
`init` shows what is missing on your machine, installs it after one confirmation, then writes the project files. `--yes` skips the question: it runs vendor install scripts from the network and installs third-party skills from fixed commits. Re-running is safe: your own text and config keys are kept. `--force` overwrites only files ccwf owns, never seeded docs. A config ccwf cannot merge (a comment in `.mcp.json`, for example) stops it before it writes anything.
|
|
15
15
|
|
|
16
16
|
## What you get
|
|
17
17
|
|
|
18
|
-
**On the machine (once):** the
|
|
18
|
+
**On the machine (once):** the 15 user-level skills this workflow uses (`mattpocock/skills`, at a commit fixed in ccwf; `--extra-skills` adds 24 more), `agent-browser`, `herdr` + `hc`, `gh`, `ffmpeg`, the Claude / Codex / Cursor CLIs you pick, and Codex trust for the repo. Chrome and logins are checked and explained, not installed.
|
|
19
19
|
|
|
20
20
|
**In the repo (committed):**
|
|
21
21
|
|
|
@@ -25,7 +25,8 @@ npx @mayurdluffy/ccwf init # tools + user-level skills + project files
|
|
|
25
25
|
| `memory` | `.agent-memory/MEMORY.md` + rules |
|
|
26
26
|
| `tracking` | `docs/ROADMAP.md` (session entry point: product, order of work, efforts with their `progress.md`), empty `docs/GLOSSARY.md`, `DECISIONS.md`, `FEATURES.md`, `BACKLOG.md`, `adr/`, `learnings/` + `save-learning` skill + rules; `docs/agents/{domain,issue-tracker,triage-labels}.md` |
|
|
27
27
|
| `browser` | `agent-browser` + `verify-ui` skills, `chrome-devtools` MCP, `.cursor/cli.json`, Claude MCP approval and allowed sites |
|
|
28
|
-
| `
|
|
28
|
+
| `guardrails` (only when asked for: `ccwf add guardrails`) | `.agents/guardrails/check.sh` runs your project's checks from `checks.conf` and looks for new secrets. The same script serves workers (a finished one is sent back once if it fails), git commits (`--install-hook`) and CI (`--all`) |
|
|
29
|
+
| `workers` | `orchestrate-workers` skill (a `workers` tab of four panes in the orchestrator's own herdr space, `hc` reference, `workers.conf`). A `reviewer` row in `workers.conf` turns on an independent review of every ticket. `isolation worktree` gives each worker a folder of its own, which is deleted once its work is merged |
|
|
29
30
|
|
|
30
31
|
Skills live in `.agents/skills/` (Codex, Cursor); Claude Code gets symlinks in `.claude/skills/`. Files are written only for the agents you select.
|
|
31
32
|
|
|
@@ -39,13 +40,14 @@ A skill that needs project settings asks you the first time it runs and saves th
|
|
|
39
40
|
|
|
40
41
|
| Command | What it does |
|
|
41
42
|
|---|---|
|
|
42
|
-
| `ccwf init` | machine setup + repo setup (`--agents`, `--modules`, `--project-only`, `--machine-only`, `--yes`, `--dry-run`, `--force`, `--dir`) |
|
|
43
|
+
| `ccwf init` | machine setup + repo setup; a repo that has ccwf keeps its modules (add one with `--modules` or `ccwf add`) (`--agents`, `--modules`, `--project-only`, `--machine-only`, `--yes`, `--dry-run`, `--force`, `--dir`) |
|
|
43
44
|
| `ccwf add <module>` | add a module |
|
|
44
45
|
| `ccwf update` | the only command that re-renders templates from this ccwf version; files you edited are merged, not overwritten (see below) |
|
|
45
46
|
| `ccwf sync` | push skill settings into agent configs and add navigation rules; does not re-render templates |
|
|
46
|
-
| `ccwf doctor` | check tools, skills and files; offer to
|
|
47
|
+
| `ccwf doctor` | check tools, skills and files; offer to install what is missing and to run `update` (`--yes` does both). `--check` changes nothing and exits 1 on problems |
|
|
48
|
+
| `ccwf stats` | worker runs in this repo per model and folder mode: done, first try, time, fix rounds, failed checks (`--json`). Recorded in `.git/ccwf/runs.jsonl` on your computer only, without prompts or code |
|
|
47
49
|
| `ccwf eject <skill>` | stop managing a skill you changed |
|
|
48
|
-
| `ccwf status` | installed modules,
|
|
50
|
+
| `ccwf status` | installed modules; files, managed blocks, settings and links that differ. `--check` exits 1 when something is missing or broken; your edits do not count |
|
|
49
51
|
|
|
50
52
|
State is in `.ccwf.json` (choices and a hash of every file, managed block and seeded doc ccwf wrote). Commit it.
|
|
51
53
|
|
|
@@ -58,26 +60,27 @@ npx @mayurdluffy/ccwf@latest update
|
|
|
58
60
|
`update` brings in new skills, scripts, rules and docs and keeps everything you wrote:
|
|
59
61
|
|
|
60
62
|
- **Your own text in `AGENTS.md`** (domain notes, anything outside the `<!-- ccwf:begin/end -->` markers) is never touched. If you edited inside a managed block, your edit is merged with the new block.
|
|
61
|
-
- **Files ccwf owns** (skills, scripts, guides): untouched ones are replaced; ones you edited are merged 3-way against the version ccwf last wrote (kept in `.git/ccwf/base/`, or found in git history after a fresh clone).
|
|
63
|
+
- **Files ccwf owns** (skills, scripts, guides): untouched ones are replaced; ones you edited are merged 3-way against the version ccwf last wrote (kept in `.git/ccwf/base/`, or found in git history or the published package after a fresh clone). Files a new version no longer has are removed if you never edited them.
|
|
62
64
|
- **Seeded docs** (`docs/GLOSSARY.md`, `DECISIONS.md`, ...): new template lines are merged in; your entries stay. `workers.conf` (your roster) is never re-rendered.
|
|
63
65
|
- Where your edit and the new version change the same lines, the file gets git-style markers (`<<<<<<< current` / `=======` / `>>>>>>> incoming (ccwf X)`) and a warning; `ccwf status` lists files that still have them, and `update` skips them until you resolve them.
|
|
64
66
|
- `--dry-run` shows what would change (`*` merged, `x` conflict); `--force` replaces files ccwf owns instead of merging; `ccwf eject <skill>` stops managing a skill.
|
|
67
|
+
- An older ccwf refuses to write to a repo set up by a newer one (`--force` overrides).
|
|
65
68
|
|
|
66
69
|
## What a first run looks like
|
|
67
70
|
|
|
68
71
|
```text
|
|
69
|
-
$ npx @mayurdluffy/ccwf init
|
|
72
|
+
$ npx @mayurdluffy/ccwf@latest init
|
|
70
73
|
+ AGENTS.md
|
|
71
74
|
+ .agents/skills/commit/SKILL.md
|
|
72
75
|
...
|
|
73
76
|
repo: 40 created, 0 updated, 0 unchanged, 0 skipped
|
|
74
77
|
machine:
|
|
75
|
-
✗ mattpocock/skills skills (0/
|
|
78
|
+
✗ mattpocock/skills skills (0/15 installed)
|
|
76
79
|
✓ gh (GitHub CLI)
|
|
77
80
|
✗ Codex trusts this repo
|
|
78
81
|
|
|
79
82
|
Will run:
|
|
80
|
-
- install
|
|
83
|
+
- install 15 skills from mattpocock/skills with `npx skills add` (full command: ccwf init --machine-only --dry-run)
|
|
81
84
|
- add [projects."/path/to/repo"] trust_level = "trusted" to ~/.codex/config.toml
|
|
82
85
|
Install all? [Y/n]:
|
|
83
86
|
```
|
|
@@ -91,6 +94,7 @@ Then follow `docs/agents/workflow.md` in your repo. Commit `.ccwf.json` and the
|
|
|
91
94
|
| `skipped: not a terminal; re-run with --yes` | run `ccwf init --yes` from a terminal script, or install by hand from `docs/agents/setup.md` |
|
|
92
95
|
| `warning: <file>: your edits and the new version overlap` | resolve the `<<<<<<< current` / `>>>>>>> incoming` markers in that file, then commit |
|
|
93
96
|
| `warning: <file>: merged without the previous ccwf version` | no record of what ccwf wrote last time: your lines and the new lines were combined; read the file once |
|
|
97
|
+
| `this repo was set up by ccwf X and this is Y` | `npx` ran an older copy: use `npx @mayurdluffy/ccwf@latest` |
|
|
94
98
|
| `... already defined by hand, skipped` | you wrote that config table yourself; ccwf leaves it alone |
|
|
95
99
|
| `next: codebase-memory is not set up here` | run `npx @mayurdluffy/cbm-cli install --agents claude,codex,cursor`, then `ccwf sync` |
|
|
96
100
|
| anything else | `ccwf doctor` checks tools, skills and files and offers to fix them |
|
|
@@ -104,6 +108,8 @@ Then follow `docs/agents/workflow.md` in your repo. Commit `.ccwf.json` and the
|
|
|
104
108
|
|
|
105
109
|
`node scripts/harvest.js <repo> --terms yourproduct` diffs a working repo's skills against `templates/skills/`, flags project-specific lines, and with `--apply` copies the clean ones. Not published to npm.
|
|
106
110
|
|
|
111
|
+
Before and after changing a skill, run its tasks in [evals/](evals/README.md). They use paid agent sessions and never run in CI.
|
|
112
|
+
|
|
107
113
|
## Releasing
|
|
108
114
|
|
|
109
115
|
Push a tag `vX.Y.Z`; `.github/workflows/publish.yml` publishes with npm trusted publishing (OIDC), so no npm token is stored in the repo.
|
|
@@ -112,9 +118,9 @@ Push a tag `vX.Y.Z`; `.github/workflows/publish.yml` publishes with npm trusted
|
|
|
112
118
|
|
|
113
119
|
Issues and PRs are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
114
120
|
|
|
115
|
-
##
|
|
121
|
+
## Agent browser
|
|
116
122
|
|
|
117
|
-
Chrome DevTools MCP
|
|
123
|
+
Chrome DevTools MCP opens the system's Chrome when an agent first needs it: a visible window with a profile of its own per project under `~/.cache/ccwf/chrome/`, so logins persist and your everyday Chrome profile is never touched. The first agent to start on a project holds that profile until it exits; other agents on the same project, and all workers, get a temporary isolated one. URL patterns from verify-ui.conf apply in both cases. Run `ccwf chrome-mcp --print` to inspect the launch command. The pinned MCP requires Node 20.19+, 22.12+, or newer supported releases and Chrome 149+ for URL restrictions.
|
|
118
124
|
|
|
119
125
|
## License
|
|
120
126
|
|
package/lib/chrome-mcp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const {
|
|
2
|
+
const { spawn } = require("node:child_process");
|
|
3
|
+
const { createHash } = require("node:crypto");
|
|
4
|
+
const { existsSync, readlinkSync, unlinkSync } = require("node:fs");
|
|
3
5
|
const fs = require("node:fs/promises");
|
|
4
|
-
const { promisify } = require("node:util");
|
|
5
|
-
const { setTimeout: delay } = require("node:timers/promises");
|
|
6
6
|
const { isIP } = require("node:net");
|
|
7
7
|
const os = require("node:os");
|
|
8
8
|
const path = require("node:path");
|
|
@@ -10,26 +10,18 @@ const { CONF, parseConf, validSiteList } = require("./modules");
|
|
|
10
10
|
|
|
11
11
|
const CHROME_MCP = "chrome-devtools-mcp@1.14.0";
|
|
12
12
|
|
|
13
|
+
// Means the same as the list does for agent-browser: a host is that host only, and *.example.com is
|
|
14
|
+
// example.com with its subdomains.
|
|
13
15
|
function urlPatterns(sites) {
|
|
14
16
|
if (!validSiteList(sites)) throw new Error("verify-ui.conf: invalid ALLOWED_DOMAINS site list");
|
|
15
|
-
return [...new Set(sites.toLowerCase().split(","))].flatMap((
|
|
17
|
+
return [...new Set(sites.toLowerCase().split(","))].flatMap((entry) => {
|
|
18
|
+
const site = entry.replace(/^\*\./, "");
|
|
16
19
|
if (site === "localhost" || isIP(site)) return [`http://${site}:*/*`, `https://${site}:*/*`];
|
|
17
|
-
const hosts = [site, `*.${site}`];
|
|
20
|
+
const hosts = entry === site ? [site] : [site, `*.${site}`];
|
|
18
21
|
const protocols = site.endsWith(".local") || site.endsWith(".localhost") || !site.includes(".")
|
|
19
22
|
? ["https", "http"] : ["https"];
|
|
20
23
|
return protocols.flatMap((protocol) => hosts.map((host) => `${protocol}://${host}/*`));
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function allowedPage(value, patterns) {
|
|
25
|
-
let url;
|
|
26
|
-
try { url = new URL(value); } catch { return false; }
|
|
27
|
-
if (url.username || url.password) return false;
|
|
28
|
-
return patterns.some((pattern) => {
|
|
29
|
-
const [, protocol, host, anyPort] = pattern.match(/^(https?):\/\/(.*?)(:\*)?\/\*$/);
|
|
30
|
-
const matchesHost = host.startsWith("*.") ? url.hostname.endsWith(host.slice(1)) : url.hostname === host;
|
|
31
|
-
return url.protocol === protocol + ":" && matchesHost && (anyPort || !url.port);
|
|
32
|
-
});
|
|
24
|
+
}).filter((pattern, i, all) => all.indexOf(pattern) === i);
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
async function projectConfig(root) {
|
|
@@ -39,65 +31,80 @@ async function projectConfig(root) {
|
|
|
39
31
|
return parseConf(config);
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
// An agent may start the server from a subfolder: the project is the nearest folder above with
|
|
35
|
+
// .ccwf.json, looked for up to the repo's top. Without one, the start folder itself.
|
|
36
|
+
function projectRoot(start) {
|
|
37
|
+
for (let dir = path.resolve(start); ; dir = path.dirname(dir)) {
|
|
38
|
+
if (existsSync(path.join(dir, ".ccwf.json"))) return dir;
|
|
39
|
+
if (existsSync(path.join(dir, ".git")) || dir === path.dirname(dir)) return path.resolve(start);
|
|
40
|
+
}
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
43
|
+
function alive(pid) {
|
|
44
|
+
if (!Number.isInteger(pid) || pid < 1) return false;
|
|
45
|
+
try { process.kill(pid, 0); return true; }
|
|
46
|
+
catch (err) { return err.code === "EPERM"; }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Chrome holds a profile with a SingletonLock symlink to "<host>-<pid>".
|
|
50
|
+
async function profileInUse(dir) {
|
|
51
|
+
let target;
|
|
52
|
+
try { target = await fs.readlink(path.join(dir, "SingletonLock")); }
|
|
53
|
+
catch (err) { if (err.code === "ENOENT") return false; throw err; }
|
|
54
|
+
return alive(Number(target.slice(target.lastIndexOf("-") + 1)));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// One wrapper per project holds the profile from its start, because Chrome itself only locks it on
|
|
58
|
+
// the first browser call. The lease is a symlink to the holder's pid (created in one step, like
|
|
59
|
+
// Chrome's own lock); a dead holder's lease is moved aside, never deleted in place, so two agents
|
|
60
|
+
// that both find it stale cannot both win.
|
|
61
|
+
async function takeLease(file) {
|
|
62
|
+
const mine = String(process.pid);
|
|
63
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
64
|
+
try {
|
|
65
|
+
await fs.symlink(mine, file);
|
|
66
|
+
process.once("exit", () => {
|
|
67
|
+
try { if (readlinkSync(file) === mine) unlinkSync(file); } catch {}
|
|
68
|
+
});
|
|
69
|
+
return true;
|
|
70
|
+
} catch (err) { if (err.code !== "EEXIST") throw err; }
|
|
71
|
+
let holder;
|
|
72
|
+
try { holder = await fs.readlink(file); }
|
|
73
|
+
catch (err) { if (err.code === "ENOENT") continue; throw err; }
|
|
74
|
+
if (alive(Number(holder))) return false;
|
|
75
|
+
const aside = `${file}.${mine}`;
|
|
76
|
+
try { await fs.rename(file, aside); }
|
|
77
|
+
catch (err) { if (err.code === "ENOENT") continue; throw err; }
|
|
78
|
+
const moved = await fs.readlink(aside);
|
|
79
|
+
await fs.unlink(aside);
|
|
80
|
+
if (moved !== holder) { // another agent took over in between: give its lease back
|
|
81
|
+
await fs.symlink(moved, file).catch(() => {});
|
|
82
|
+
return false;
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
|
-
return
|
|
85
|
+
return false;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
// Like Antigravity's agent browser: the system Chrome, visible, launched on the first browser
|
|
89
|
+
// tool call, with a profile of its own per project so logins persist between sessions. A worker
|
|
90
|
+
// (CCWF_BROWSER=isolated) and a second agent on the same project get a throwaway one instead.
|
|
91
|
+
// `lease` keeps the profile for this process; without it the command is only worked out.
|
|
92
|
+
async function command(root, { lease = false, cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache") } = {}) {
|
|
89
93
|
const conf = await projectConfig(root);
|
|
90
94
|
const patterns = urlPatterns(conf.ALLOWED_DOMAINS || "localhost");
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
const id = createHash("sha256").update(path.resolve(root)).digest("hex").slice(0, 12);
|
|
96
|
+
const profile = path.join(cacheHome, "ccwf", "chrome", `${path.basename(path.resolve(root))}-${id}`);
|
|
97
|
+
await fs.mkdir(profile, { recursive: true, mode: 0o700 });
|
|
98
|
+
await fs.chmod(profile, 0o700);
|
|
99
|
+
const own = process.env.CCWF_BROWSER !== "isolated" && !(await profileInUse(profile)) && (!lease || await takeLease(`${profile}.lease`));
|
|
100
|
+
const browser = own ? ["--userDataDir", profile] : ["--isolated"];
|
|
101
|
+
return ["npx", "-y", CHROME_MCP, ...browser,
|
|
95
102
|
"--allowedUrlPattern", ...patterns, "--no-usage-statistics", "--no-performance-crux"];
|
|
96
103
|
}
|
|
97
104
|
|
|
98
|
-
async function run(
|
|
99
|
-
const
|
|
100
|
-
|
|
105
|
+
async function run(start, print) {
|
|
106
|
+
const root = projectRoot(start);
|
|
107
|
+
const [program, ...args] = await command(root, { lease: !print });
|
|
101
108
|
if (print) {
|
|
102
109
|
console.log([program, ...args].map((arg) => /^[\w./@:-]+$/.test(arg) ? arg : `'${arg}'`).join(" "));
|
|
103
110
|
return;
|
|
@@ -124,4 +131,4 @@ async function run(root, print, open) {
|
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
|
|
127
|
-
module.exports = { command, run, urlPatterns
|
|
134
|
+
module.exports = { command, run, urlPatterns };
|