agentic-retro 0.1.1 → 0.1.2
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/cli/lib/commands.js +10 -2
- package/cli/lib/outcomes.js +1 -1
- package/cli/lib/queue.js +11 -7
- package/package.json +1 -1
- package/skills/run/SKILL.md +12 -7
package/cli/lib/commands.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Builds the command that starts the batch agent in each harness.
|
|
2
|
-
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { readFileSync, existsSync, statSync } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { join, dirname } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -37,7 +37,15 @@ function sessionsOf(batchDir) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function workDirs(config, sessions) {
|
|
40
|
-
const
|
|
40
|
+
const editable = (config.editable ?? []).map((path) => {
|
|
41
|
+
path = expandHome(path);
|
|
42
|
+
try {
|
|
43
|
+
return statSync(path).isFile() ? dirname(path) : path;
|
|
44
|
+
} catch {
|
|
45
|
+
return path;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const paths = [...sessions.flatMap((s) => [s.repo, s.cwd]), ...editable];
|
|
41
49
|
return [...new Set(paths.filter(Boolean))];
|
|
42
50
|
}
|
|
43
51
|
|
package/cli/lib/outcomes.js
CHANGED
|
@@ -39,7 +39,7 @@ export function syncOutcomes() {
|
|
|
39
39
|
if (status !== 'open') setStatus(p, status);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
for (const p of open()) {
|
|
42
|
+
for (const p of open().filter((p) => !p.pr)) {
|
|
43
43
|
if (ledger.batchCount - p.batch >= expireAfterBatches) setStatus(p, 'expired');
|
|
44
44
|
}
|
|
45
45
|
saveLedger(ledger);
|
package/cli/lib/queue.js
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
import { execFileSync } from 'node:child_process';
|
|
3
3
|
import { readdirSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
|
-
import { join, basename } from 'node:path';
|
|
5
|
+
import { join, basename, resolve } from 'node:path';
|
|
6
6
|
import { readJson, writeJson } from './paths.js';
|
|
7
7
|
import { loadConfig } from './config.js';
|
|
8
8
|
import { startBatch } from './runner.js';
|
|
9
9
|
|
|
10
|
-
function repoOf(cwd) {
|
|
10
|
+
function repoOf(cwd, fallback = cwd) {
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const options = { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] };
|
|
13
|
+
const commonDir = execFileSync('git', ['-C', cwd, 'rev-parse', '--git-common-dir'], options).replace(/\n$/, '');
|
|
14
|
+
// Git lists the shared identity first: the main checkout or its separate metadata directory.
|
|
15
|
+
const worktrees = execFileSync('git', ['--git-dir', resolve(cwd, commonDir), 'worktree', 'list', '--porcelain', '-z'], options);
|
|
16
|
+
const main = worktrees.split('\0').find((field) => field.startsWith('worktree '));
|
|
17
|
+
return main ? main.slice('worktree '.length) : fallback;
|
|
14
18
|
} catch {
|
|
15
|
-
return
|
|
19
|
+
return fallback;
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
22
|
|
|
@@ -43,8 +47,8 @@ export async function enqueue({ harness, sessionId, transcript, cwd }) {
|
|
|
43
47
|
harness ||= harnessOf(transcript);
|
|
44
48
|
if (!harness || !sessionId || !cwd) throw new Error('enqueue needs a harness, session, and cwd');
|
|
45
49
|
|
|
46
|
-
const queue = readJson('queue.json', []);
|
|
47
|
-
if (queue.some((s) => s.sessionId === sessionId)) return;
|
|
50
|
+
const queue = readJson('queue.json', []).map((s) => ({ ...s, repo: repoOf(s.cwd, s.repo) }));
|
|
51
|
+
if (queue.some((s) => s.sessionId === sessionId)) return writeJson('queue.json', queue);
|
|
48
52
|
const entry = { harness, sessionId, transcript, cwd, repo: repoOf(cwd), endedAt: new Date().toISOString() };
|
|
49
53
|
queue.push(entry);
|
|
50
54
|
|
package/package.json
CHANGED
package/skills/run/SKILL.md
CHANGED
|
@@ -109,20 +109,25 @@ agentic-retro propose --repo <target repo path> --category <category> [--risk lo
|
|
|
109
109
|
|
|
110
110
|
Do this once per target repo. Skip a target with no git remote, and put its proposals in a report file instead (5b).
|
|
111
111
|
|
|
112
|
+
Before you branch, read the repo's PR rules in its `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md` and CI workflows, such as a `dev` base branch or a version bump.
|
|
113
|
+
|
|
112
114
|
```bash
|
|
113
115
|
git -C "$repo" fetch origin
|
|
114
|
-
base=$(git -C "$repo" symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@')
|
|
116
|
+
base=$(git -C "$repo" symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@') # override with the rules' base
|
|
115
117
|
wt=$(mktemp -d)/wt
|
|
116
118
|
git -C "$repo" worktree add -b "agentic-retro/batch-<n>" "$wt" "origin/$base"
|
|
117
119
|
```
|
|
118
120
|
|
|
119
121
|
1. Apply each proposal in `$wt`, then commit it on its own: `git -C "$wt" add -A && git -C "$wt" commit -m "P12: <title>"`
|
|
120
|
-
2.
|
|
121
|
-
3.
|
|
122
|
-
4.
|
|
123
|
-
5.
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
2. Do the steps the rules require in one last commit without a proposal ID, so dropping a proposal keeps them. When a step needs a command you cannot run, say so at the top of the PR body
|
|
123
|
+
3. Push the branch: `git -C "$wt" push -u origin "agentic-retro/batch-<n>"`
|
|
124
|
+
4. Make sure the `agentic-retro` label exists from `$wt`: `(cd "$wt" && gh label create agentic-retro --force)`
|
|
125
|
+
5. Write the body per `writing-proposals.md`, then open the PR from `$wt`: `(cd "$wt" && gh pr create --base "$base" --title "<title>" --body-file <file> --label agentic-retro)`
|
|
126
|
+
6. Wait for CI with `gh pr checks <url> --watch`, then fix each failure in a new commit and push
|
|
127
|
+
7. Record the PR and commit on each proposal: `agentic-retro link P12 --pr <url> --commit <sha>`
|
|
128
|
+
8. Remove the worktree: `git -C "$repo" worktree remove "$wt"`
|
|
129
|
+
|
|
130
|
+
When `autoMergeLowRisk` is `true`, low-risk agent-setup proposals go on a second branch, `agentic-retro/batch-<n>-low-risk`, with their own PR. Merge that PR with `gh pr merge --merge` once its checks pass. Everything else waits for the user.
|
|
126
131
|
|
|
127
132
|
## 5b. Report mode: one report file
|
|
128
133
|
|