@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.
@@ -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.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
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
+ }