@mindlace/chreode 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +153 -2
- package/dist/cli.d.ts +27 -0
- package/dist/cli.js +102 -0
- package/dist/config/load.d.ts +5 -0
- package/dist/config/load.js +13 -0
- package/dist/config/types.d.ts +71 -0
- package/dist/config/types.js +7 -0
- package/dist/config/validate.d.ts +9 -0
- package/dist/config/validate.js +204 -0
- package/dist/git/change-set.d.ts +18 -0
- package/dist/git/change-set.js +42 -0
- package/dist/git/merge.d.ts +21 -0
- package/dist/git/merge.js +33 -0
- package/dist/github/protect.d.ts +20 -0
- package/dist/github/protect.js +90 -0
- package/dist/github/status.d.ts +24 -0
- package/dist/github/status.js +54 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/lock/machine-lock.d.ts +40 -0
- package/dist/lock/machine-lock.js +76 -0
- package/dist/run/exec.d.ts +8 -0
- package/dist/run/exec.js +15 -0
- package/dist/run/stderr.d.ts +21 -0
- package/dist/run/stderr.js +27 -0
- package/dist/run/step.d.ts +55 -0
- package/dist/run/step.js +182 -0
- package/dist/signoff/plan.d.ts +49 -0
- package/dist/signoff/plan.js +110 -0
- package/dist/signoff/preconditions.d.ts +10 -0
- package/dist/signoff/preconditions.js +49 -0
- package/dist/signoff/run.d.ts +36 -0
- package/dist/signoff/run.js +194 -0
- package/dist/signoff/tail.d.ts +32 -0
- package/dist/signoff/tail.js +55 -0
- package/package.json +70 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { writeNote } from '../git/change-set.js';
|
|
2
|
+
import { postStatus, prUrl, statusDescription } from '../github/status.js';
|
|
3
|
+
import { defaultExec, defaultRun } from '../run/exec.js';
|
|
4
|
+
/** Why this run must not become an incremental base: the note means "everything the
|
|
5
|
+
* changes since the last note needed passed", and a partial run cannot vouch for that. */
|
|
6
|
+
export function noteWithheldReasons(work) {
|
|
7
|
+
return [
|
|
8
|
+
...(work.skippedByFlag.length > 0 ? [`--skip ${work.skippedByFlag.join(', ')}`] : []),
|
|
9
|
+
...(work.allowedStderr.length > 0
|
|
10
|
+
? [`--allow-stderr waived ${work.allowedStderr.join(', ')}`]
|
|
11
|
+
: []),
|
|
12
|
+
...(work.baseFlag !== null ? [`--base ${work.baseFlag}`] : [])
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* After every step passed: push, post the status, then write the note. The note is the
|
|
17
|
+
* incremental cache ("this commit is signed off"), so it goes last: a failed post must not
|
|
18
|
+
* leave a note that makes the next run a no-op with no status on GitHub. A partial run
|
|
19
|
+
* (--skip, --base, or stderr waived by --allow-stderr) posts a status that says so but
|
|
20
|
+
* writes no note, so the next signoff diffs from the last full one.
|
|
21
|
+
*/
|
|
22
|
+
export function runTail(work, effects, log = (m) => console.log(m)) {
|
|
23
|
+
if (work.noPush) {
|
|
24
|
+
log('[chreode] --no-push: not pushing (the commit must already be on origin)');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
log('\n[chreode] git push -u origin HEAD');
|
|
28
|
+
effects.push();
|
|
29
|
+
}
|
|
30
|
+
effects.postStatus(work.sha, statusDescription(work.signer, {
|
|
31
|
+
skipped: work.skippedByFlag,
|
|
32
|
+
allowedStderr: work.allowedStderr,
|
|
33
|
+
base: work.baseFlag
|
|
34
|
+
}));
|
|
35
|
+
log(`[chreode] ${work.context} = success posted on ${work.sha}`);
|
|
36
|
+
const withheld = noteWithheldReasons(work);
|
|
37
|
+
if (withheld.length === 0) {
|
|
38
|
+
effects.writeNote(work.sha, work.ranLabels);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
log(`[chreode] not writing the signoff note (partial run: ${withheld.join('; ')}); ` +
|
|
42
|
+
`the next signoff diffs from the last full one`);
|
|
43
|
+
}
|
|
44
|
+
const url = effects.prUrl();
|
|
45
|
+
if (url)
|
|
46
|
+
log(`[chreode] PR: ${url}`);
|
|
47
|
+
}
|
|
48
|
+
export function defaultTailEffects(repo, context, exec = defaultExec, run = defaultRun) {
|
|
49
|
+
return {
|
|
50
|
+
push: () => run('git push -u origin HEAD'),
|
|
51
|
+
postStatus: (sha, description) => postStatus(repo(), sha, context, description, exec),
|
|
52
|
+
writeNote: (sha, labels) => writeNote(sha, labels, exec),
|
|
53
|
+
prUrl: () => prUrl(exec)
|
|
54
|
+
};
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindlace/chreode",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A deterministic, selective, unavoidable local-CI gate for agent-written code",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ci",
|
|
7
|
+
"signoff",
|
|
8
|
+
"git",
|
|
9
|
+
"github",
|
|
10
|
+
"agents",
|
|
11
|
+
"gate"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Ethan Fremen",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/mindlace/chreode.git"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/mindlace/chreode#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/mindlace/chreode/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22.12"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"bin": {
|
|
34
|
+
"chreode": "./dist/cli.js"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"prepack": "npm run build",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
46
|
+
"lint": "prettier --check . && eslint .",
|
|
47
|
+
"format": "prettier --write .",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"signoff": "npm run build && node dist/cli.js signoff",
|
|
50
|
+
"protect": "npm run build && node dist/cli.js protect"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"commander": "^15.0.0",
|
|
54
|
+
"jiti": "^2.7.0",
|
|
55
|
+
"picomatch": "^4.0.7",
|
|
56
|
+
"proper-lockfile": "^4.1.2"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@eslint/js": "^10.0.1",
|
|
60
|
+
"@types/node": "^24.0.0",
|
|
61
|
+
"@types/picomatch": "^4.0.3",
|
|
62
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
63
|
+
"eslint": "^10.8.0",
|
|
64
|
+
"eslint-config-prettier": "^10.1.8",
|
|
65
|
+
"globals": "^17.7.0",
|
|
66
|
+
"prettier": "^3.9.6",
|
|
67
|
+
"tsx": "^4.23.1",
|
|
68
|
+
"typescript": "~6.0.3",
|
|
69
|
+
"typescript-eslint": "^8.65.0",
|
|
70
|
+
"vitest": "^4.1.10"
|
|
71
|
+
}
|
|
72
|
+
}
|