@arjunkhera/atlas 0.2.0 → 0.2.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/.claude-plugin/plugin.json +4 -2
- package/door/lib/pull-request.mjs +17 -11
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atlas",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Atlas: the delivery lifecycle, its crews and the Atlas tools, for any repository.",
|
|
5
|
-
"author": {
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Arjun Khera"
|
|
7
|
+
},
|
|
6
8
|
"repository": "https://github.com/Arjunkhera/atlas",
|
|
7
9
|
"license": "UNLICENSED",
|
|
8
10
|
"userConfig": {
|
|
@@ -15,7 +15,9 @@ import { checkChanges, HELPER_LABEL, PROVENANCE_SOURCES } from './helpers.mjs';
|
|
|
15
15
|
|
|
16
16
|
export { HELPER_LABEL, PROVENANCE_SOURCES };
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// A backtick breaks a table cell the same way a pipe does, and a provenance
|
|
19
|
+
// line often carries one. Both are escaped (acceptance review of slice B2).
|
|
20
|
+
const escapeCell = (text) => String(text ?? '').replaceAll('|', '\\|').replaceAll('`', '\\`').replaceAll('\n', ' ').trim();
|
|
19
21
|
|
|
20
22
|
// One request may reach two helpers. "We now deploy prod on Fly" reaches Facts
|
|
21
23
|
// and Procedures. It is still ONE pull request: design page D2's rule, carried
|
|
@@ -62,7 +64,7 @@ export function provenanceBody({ helper, helpers, why, changes, groups, repo = n
|
|
|
62
64
|
'2. An agent made every change. No person edited these files by hand.',
|
|
63
65
|
`3. "Source" is one of: ${PROVENANCE_SOURCES.join(', ')}.`,
|
|
64
66
|
'',
|
|
65
|
-
`Label: \`${HELPER_LABEL}\`. Authority: Arjunkhera/atlas,
|
|
67
|
+
`Label: \`${HELPER_LABEL}\`. Authority: Arjunkhera/atlas, amendment A1.6, section 5, slice L2 stage one.`,
|
|
66
68
|
'',
|
|
67
69
|
);
|
|
68
70
|
return lines.join('\n');
|
|
@@ -88,7 +90,7 @@ const run = (command, args, cwd) => execFileSync(command, args, { cwd, encoding:
|
|
|
88
90
|
//
|
|
89
91
|
// It never merges. A person merges every file a helper writes, because every
|
|
90
92
|
// one of them steers agents.
|
|
91
|
-
export function open({ root, helperId, changes, groups, why, branch, title, base = null, label = HELPER_LABEL, dryRun = false }) {
|
|
93
|
+
export function open({ root, helperId, changes, groups, why, branch, title, base = null, label = HELPER_LABEL, dryRun = false, exec = run }) {
|
|
92
94
|
const wanted = groups ?? [{ helperId, changes }];
|
|
93
95
|
const checked = checkAll(wanted);
|
|
94
96
|
const all = checked.flatMap((group) => group.changes);
|
|
@@ -96,20 +98,24 @@ export function open({ root, helperId, changes, groups, why, branch, title, base
|
|
|
96
98
|
// printed "Nothing was pushed", which was true and misleading (acceptance
|
|
97
99
|
// review of batch 16, finding S3-5).
|
|
98
100
|
if (!dryRun) for (const group of checked) applyChanges(root, group.helper.id, group.changes);
|
|
99
|
-
const repo = (() => { try { return
|
|
101
|
+
const repo = (() => { try { return exec('gh', ['repo', 'view', '--json', 'nameWithOwner', '--jq', '.nameWithOwner'], root); } catch { return null; } })();
|
|
100
102
|
const body = provenanceBody({ groups: checked, why, repo });
|
|
101
|
-
const onto = base ??
|
|
103
|
+
const onto = base ?? exec('git', ['symbolic-ref', '--short', 'HEAD'], root);
|
|
102
104
|
const helper = checked[0].helper;
|
|
103
105
|
if (dryRun) return { helper, helpers: checked.map((group) => group.helper), repo, branch, title, body, base: onto, written: all.map((change) => change.path), opened: false };
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
exec('git', ['checkout', '-b', branch], root);
|
|
108
|
+
exec('git', ['add', '--', ...all.map((change) => change.path)], root);
|
|
109
|
+
exec('git', ['commit', '-m', title, '-m', body], root);
|
|
110
|
+
exec('git', ['push', '-u', 'origin', branch], root);
|
|
109
111
|
// A label that does not exist yet makes `gh pr create` fail, so it is made
|
|
110
112
|
// first. A label that already exists makes that call fail instead, and that
|
|
111
113
|
// failure is the expected one.
|
|
112
|
-
try {
|
|
113
|
-
|
|
114
|
+
try { exec('gh', ['label', 'create', label, '--description', 'Written by an Atlas helper. A person merges it.', '--color', 'C5A882'], root); } catch { /* it already exists */ }
|
|
115
|
+
// --head names the branch. `git push -u` does not always record the upstream
|
|
116
|
+
// in a shallow clone, and then `gh pr create` refuses with "you must first
|
|
117
|
+
// push the current branch" although the branch is already on GitHub
|
|
118
|
+
// (measured on an Engram clone, 2026-09-20).
|
|
119
|
+
const url = exec('gh', ['pr', 'create', '--title', title, '--body', body, '--label', label, '--base', onto, '--head', branch], root);
|
|
114
120
|
return { helper, helpers: checked.map((group) => group.helper), repo, branch, title, body, base: onto, written: all.map((change) => change.path), opened: true, url };
|
|
115
121
|
}
|
package/package.json
CHANGED