@arjunkhera/atlas 0.2.1 → 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 +1 -1
- package/door/lib/pull-request.mjs +12 -10
- package/package.json +1 -1
|
@@ -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
|
|
@@ -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,24 +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 {
|
|
114
|
+
try { exec('gh', ['label', 'create', label, '--description', 'Written by an Atlas helper. A person merges it.', '--color', 'C5A882'], root); } catch { /* it already exists */ }
|
|
113
115
|
// --head names the branch. `git push -u` does not always record the upstream
|
|
114
116
|
// in a shallow clone, and then `gh pr create` refuses with "you must first
|
|
115
117
|
// push the current branch" although the branch is already on GitHub
|
|
116
118
|
// (measured on an Engram clone, 2026-09-20).
|
|
117
|
-
const url =
|
|
119
|
+
const url = exec('gh', ['pr', 'create', '--title', title, '--body', body, '--label', label, '--base', onto, '--head', branch], root);
|
|
118
120
|
return { helper, helpers: checked.map((group) => group.helper), repo, branch, title, body, base: onto, written: all.map((change) => change.path), opened: true, url };
|
|
119
121
|
}
|
package/package.json
CHANGED