@open-tomato/rafa 0.47.0 → 0.48.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.
Files changed (73) hide show
  1. package/README.md +5 -2
  2. package/dist/bugs/places.d.ts +1 -1
  3. package/dist/bundled/skills/dev-planner/SKILL.md +1 -1
  4. package/dist/cli.js +58833 -58857
  5. package/dist/config/index.js +4 -5
  6. package/dist/config/shape.d.ts +13 -11
  7. package/dist/config-schema-board-project.d.ts +3 -3
  8. package/dist/config-schema-checks.d.ts +3 -3
  9. package/dist/config-schema-hub.d.ts +3 -3
  10. package/dist/config-schema-issues.d.ts +4 -4
  11. package/dist/config-schema-loop-continue.d.ts +3 -3
  12. package/dist/config-schema-loop-retries.d.ts +4 -4
  13. package/dist/config-schema-release.d.ts +13 -13
  14. package/dist/config-schema-tests.d.ts +3 -3
  15. package/dist/config-schema-triage.d.ts +3 -3
  16. package/dist/config-schema-wrap-up.d.ts +4 -4
  17. package/dist/core/command/global-flags.d.ts +25 -0
  18. package/dist/core/command/index.d.ts +31 -25
  19. package/dist/core/command/registry-types.d.ts +4 -4
  20. package/dist/core/command/shared-flags.d.ts +6 -6
  21. package/dist/core/command/types.d.ts +3 -2
  22. package/dist/core/config/branch-template.d.ts +2 -0
  23. package/dist/core/config/config-items.d.ts +1 -1
  24. package/dist/core/config/config-schema.d.ts +6 -0
  25. package/dist/core/config/config-sections.d.ts +15 -14
  26. package/dist/core/config/config.d.ts +1 -1
  27. package/dist/core/config/core-section.d.ts +1 -1
  28. package/dist/core/config/default-routing.d.ts +1 -1
  29. package/dist/core/config/index.d.ts +4 -4
  30. package/dist/core/config/merge-method.d.ts +4 -4
  31. package/dist/core/config/sections.d.ts +6 -3
  32. package/dist/core/git/gh-runner.d.ts +1 -1
  33. package/dist/core/git/git.d.ts +34 -0
  34. package/dist/core/git/index.d.ts +13 -8
  35. package/dist/core/loop/claude.d.ts +11 -5
  36. package/dist/core/loop/index.d.ts +3 -2
  37. package/dist/core/loop/sessions.d.ts +1 -1
  38. package/dist/core/loop/suite-failure.d.ts +8 -6
  39. package/dist/core/output/active.d.ts +1 -1
  40. package/dist/core/runtime/identity.d.ts +13 -0
  41. package/dist/core/runtime/index.d.ts +12 -6
  42. package/dist/effort/store/check-rows.d.ts +1 -1
  43. package/dist/effort/store/commit-stats.d.ts +1 -1
  44. package/dist/effort/store/index.js +8 -9
  45. package/dist/effort/store/merge-commit-gaps.d.ts +1 -1
  46. package/dist/effort/store/plan-stubs.d.ts +1 -1
  47. package/dist/effort/store/session-row-types.d.ts +2 -2
  48. package/dist/{index-f1y86zbb.js → index-2a7nb3an.js} +31 -31
  49. package/dist/index-2xzkzwm6.js +670 -0
  50. package/dist/index-ajv88fkm.js +448 -0
  51. package/dist/{index-r5q2pdky.js → index-fpgmdmww.js} +4 -1
  52. package/dist/{index-pzpb1rf7.js → index-g91ys6kw.js} +97 -1
  53. package/dist/{index-eay1bd2w.js → index-jx3x70xh.js} +1090 -652
  54. package/dist/{index-cbqvgda6.js → index-m672ptpg.js} +3 -1
  55. package/dist/{index-nwzx41g1.js → index-w5qbpdtp.js} +416 -843
  56. package/dist/{index-7dgc5g1t.js → index-z4r20zwr.js} +8696 -11193
  57. package/dist/{index-n3e31fmw.js → index-zsak0jy6.js} +172 -254
  58. package/dist/index.js +24857 -18957
  59. package/dist/learning/index.js +221 -12
  60. package/dist/plan/index.js +11 -10
  61. package/dist/ports/index.d.ts +6 -6
  62. package/dist/ports/learning.d.ts +5 -4
  63. package/dist/ports/spec-review.d.ts +1 -1
  64. package/dist/ready-gax3hhtt.js +241 -0
  65. package/dist/release-templates/release-bot-fragment.yml +6 -6
  66. package/dist/release-templates/release-publish.yml +8 -8
  67. package/dist/release-templates/release-settle.yml +8 -7
  68. package/dist/release-templates/release-tag.yml +8 -7
  69. package/package.json +32 -2
  70. package/dist/index-38ktnyvz.js +0 -223
  71. package/dist/index-3mwsr6wg.js +0 -1070
  72. package/dist/index-z1w83f81.js +0 -4
  73. package/dist/ready-6p40c3gw.js +0 -2007
@@ -1,12 +1,13 @@
1
1
  # The rafa release settle workflow: level 4 of the release ladder.
2
2
  #
3
3
  # Written into a project's `.github/workflows/` by `writeReleaseWorkflow`
4
- # (`src/release/templates.ts`) for `release.settle: push` with
5
- # `release.tag: settle` and `release.publish: ci`. Every push to the base
6
- # branch checks it out with full history, sets a git identity for the
7
- # release commit, and runs `rafa release settle`, which folds the waiting
8
- # fragments into a release commit, pushes it to the base and tags it.
9
- # A push with no fragment waiting settles nothing and exits 0.
4
+ # (`packages/rafa-release/src/release/templates.ts`) for
5
+ # `release.settle: push` with `release.tag: settle` and
6
+ # `release.publish: ci`. Every push to the base branch checks it out with
7
+ # full history, sets a git identity for the release commit, and runs
8
+ # `rafa release settle`, which folds the waiting fragments into a release
9
+ # commit, pushes it to the base and tags it. A push with no fragment
10
+ # waiting settles nothing and exits 0.
10
11
  #
11
12
  # The settle job runs on a push to the repository's default branch. When
12
13
  # `pr.base` names another branch, write that branch's name in place of
@@ -58,7 +59,7 @@ jobs:
58
59
  release: ${{ steps.settle.outputs.release }}
59
60
  steps:
60
61
  - name: Checkout
61
- uses: actions/checkout@v4
62
+ uses: actions/checkout@v7
62
63
  with:
63
64
  ref: ${{ github.ref_name }}
64
65
  fetch-depth: 0
@@ -1,12 +1,13 @@
1
1
  # The rafa release tag workflow: level 3 of the release ladder.
2
2
  #
3
3
  # Written into a project's `.github/workflows/` by `writeReleaseWorkflow`
4
- # (`src/release/templates.ts`) for `release.settle: pr` with
5
- # `release.tag: settle` and `release.publish: ci`. Settle never tags a
6
- # `pr` delivery: it pushes the release commit to `rafa/release` and opens
7
- # one release pull request. When that pull request merges, by any merge
8
- # button, this workflow checks the base branch out at the merge commit,
9
- # runs `rafa release tag --push`, and then publishes.
4
+ # (`packages/rafa-release/src/release/templates.ts`) for
5
+ # `release.settle: pr` with `release.tag: settle` and
6
+ # `release.publish: ci`. Settle never tags a `pr` delivery: it pushes the
7
+ # release commit to `rafa/release` and opens one release pull request.
8
+ # When that pull request merges, by any merge button, this workflow
9
+ # checks the base branch out at the merge commit, runs
10
+ # `rafa release tag --push`, and then publishes.
10
11
  #
11
12
  # It runs only on the release pull request's merge: a closed pull
12
13
  # request that did not merge, or one from another head or from a fork,
@@ -54,7 +55,7 @@ jobs:
54
55
  timeout-minutes: 15
55
56
  steps:
56
57
  - name: Checkout
57
- uses: actions/checkout@v4
58
+ uses: actions/checkout@v7
58
59
  with:
59
60
  ref: ${{ github.event.pull_request.base.ref }}
60
61
  fetch-depth: 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tomato/rafa",
3
- "version": "0.47.0",
3
+ "version": "0.48.0",
4
4
  "description": "Alpha. Runs a plan through the ralph loop: one Claude Code session per task, one commit per task, then a pull request and a CI wait.",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -87,6 +87,36 @@
87
87
  },
88
88
  "./config-schema-logger": {
89
89
  "types": "./dist/config-schema-logger.d.ts"
90
+ },
91
+ "./config-schema-board-project": {
92
+ "types": "./dist/config-schema-board-project.d.ts"
93
+ },
94
+ "./config-schema-checks": {
95
+ "types": "./dist/config-schema-checks.d.ts"
96
+ },
97
+ "./config-schema-hub": {
98
+ "types": "./dist/config-schema-hub.d.ts"
99
+ },
100
+ "./config-schema-issues": {
101
+ "types": "./dist/config-schema-issues.d.ts"
102
+ },
103
+ "./config-schema-loop-continue": {
104
+ "types": "./dist/config-schema-loop-continue.d.ts"
105
+ },
106
+ "./config-schema-loop-retries": {
107
+ "types": "./dist/config-schema-loop-retries.d.ts"
108
+ },
109
+ "./config-schema-release": {
110
+ "types": "./dist/config-schema-release.d.ts"
111
+ },
112
+ "./config-schema-tests": {
113
+ "types": "./dist/config-schema-tests.d.ts"
114
+ },
115
+ "./config-schema-triage": {
116
+ "types": "./dist/config-schema-triage.d.ts"
117
+ },
118
+ "./config-schema-wrap-up": {
119
+ "types": "./dist/config-schema-wrap-up.d.ts"
90
120
  }
91
121
  },
92
122
  "files": [
@@ -97,7 +127,7 @@
97
127
  "bun": ">=1.3.14"
98
128
  },
99
129
  "scripts": {
100
- "build": "rm -rf dist && bun scripts/build/bundle.ts && tsc -p packages/rafa/tsconfig.types.json && tsc -p tsconfig.config-types.json && cp src/PROMPT.md src/plan-prompt.md src/epic-verify-prompt.md src/continue-decision-prompt.md src/continue-criteria.md dist/ && cp -R src/bundled dist/bundled && bun build src/tools/ts-symbols/cli.ts --target=bun --outfile=dist/bundled/bin/ts-symbols && for tree in pr/plans:plans board/templates:templates release/templates:release-templates; do src=src/${tree%:*}; out=dist/${tree#*:}; [ -d \"$src\" ] || continue; mkdir -p \"$out\" || exit 1; copied=0; for asset in \"$src\"/*.md \"$src\"/*.yml; do [ -e \"$asset\" ] || continue; cp \"$asset\" \"$out\"/ || exit 1; copied=1; done; [ $copied = 1 ] || exit 1; done",
130
+ "build": "rm -rf dist && bun scripts/build/bundle.ts && tsc -p packages/rafa/tsconfig.types.json && tsc -p tsconfig.config-types.json && cp src/PROMPT.md src/plan-prompt.md packages/rafa-board/src/epic-verify-prompt.md src/continue-decision-prompt.md src/continue-criteria.md dist/ && cp -R src/bundled dist/bundled && bun build src/tools/ts-symbols/cli.ts --target=bun --outfile=dist/bundled/bin/ts-symbols && for tree in packages/rafa-pr/src/pr/plans:plans packages/rafa-board/src/board/templates:templates packages/rafa-release/src/release/templates:release-templates; do src=${tree%:*}; out=dist/${tree#*:}; [ -d \"$src\" ] || continue; mkdir -p \"$out\" || exit 1; copied=0; for asset in \"$src\"/*.md \"$src\"/*.yml; do [ -e \"$asset\" ] || continue; cp \"$asset\" \"$out\"/ || exit 1; copied=1; done; [ $copied = 1 ] || exit 1; done",
101
131
  "prepack": "bun run build",
102
132
  "test": "bun test",
103
133
  "lint": "eslint .",
@@ -1,223 +0,0 @@
1
- // @bun
2
- // src/learning/bless.ts
3
- import { createHash } from "crypto";
4
- var HUNDREDTHS = 100;
5
- function hundredths(confidence) {
6
- return Math.round(confidence * HUNDREDTHS);
7
- }
8
- function compareText(left, right) {
9
- if (left < right) {
10
- return -1;
11
- }
12
- if (left > right) {
13
- return 1;
14
- }
15
- return 0;
16
- }
17
- function byTrust(left, right) {
18
- return hundredths(right.confidence) - hundredths(left.confidence) || right.usage_count - left.usage_count || compareText(left.id, right.id);
19
- }
20
- function blessedRecords(held, minConfidence) {
21
- const floor = hundredths(minConfidence);
22
- return held.filter((each) => each.status === "active" && each.promoted_to === undefined && hundredths(each.confidence) >= floor).sort(byTrust);
23
- }
24
- function versionOf(instincts) {
25
- return createHash("sha256").update(JSON.stringify(instincts)).digest("hex");
26
- }
27
- function bless(held, options) {
28
- const instincts = blessedRecords(held, options.minConfidence);
29
- return { version: versionOf(instincts), instincts };
30
- }
31
- function promotable(held, options) {
32
- return blessedRecords(held, options.minConfidence).filter((each) => each.usage_count >= options.after);
33
- }
34
- // src/learning/identity.ts
35
- import { createHash as createHash2 } from "crypto";
36
- var GAP = 0.1;
37
- var SOURCE_STEP = 0.05;
38
- var CONFIDENCE_MIN = 0.3;
39
- var CONFIDENCE_MAX = 0.9;
40
- var WHITESPACE_RUN = /\s+/g;
41
- function actionHash(action) {
42
- return createHash2("sha256").update(action.trim().toLowerCase()).digest("hex");
43
- }
44
- function triggerKey(trigger) {
45
- return trigger.trim().toLowerCase().replace(WHITESPACE_RUN, " ");
46
- }
47
- // src/learning/merge.ts
48
- var HUNDREDTHS2 = 100;
49
- var GAP_H = Math.round(GAP * HUNDREDTHS2);
50
- var STEP_H = Math.round(SOURCE_STEP * HUNDREDTHS2);
51
- var MIN_H = Math.round(CONFIDENCE_MIN * HUNDREDTHS2);
52
- var MAX_H = Math.round(CONFIDENCE_MAX * HUNDREDTHS2);
53
- function hundredths2(confidence) {
54
- return Math.round(confidence * HUNDREDTHS2);
55
- }
56
- function compareText2(left, right) {
57
- if (left < right) {
58
- return -1;
59
- }
60
- if (left > right) {
61
- return 1;
62
- }
63
- return 0;
64
- }
65
- function byAge(left, right) {
66
- return compareText2(left.created_at, right.created_at) || compareText2(left.id, right.id);
67
- }
68
- function byConfidence(left, right) {
69
- return hundredths2(right.confidence) - hundredths2(left.confidence) || compareText2(left.id, right.id);
70
- }
71
- function sourcesOf(record) {
72
- return record.sources !== undefined && record.sources.length > 0 ? [...new Set(record.sources)] : [record.id];
73
- }
74
- function withSource(record, sourceId) {
75
- const sources = [...new Set([...record.sources ?? [], sourceId])].sort();
76
- return { ...record, sources, usage_count: sources.length };
77
- }
78
- function firstOptional(ordered, key) {
79
- const found = ordered.find((record) => record[key] !== undefined);
80
- return found === undefined ? {} : { [key]: found[key] };
81
- }
82
- function collapse(group) {
83
- const ordered = [...[...group.held].sort(byAge), ...[...group.incoming].sort(byAge)];
84
- if (ordered.length === 1) {
85
- return ordered[0];
86
- }
87
- const seen = new Set;
88
- let weighted = 0;
89
- for (const member of ordered) {
90
- const own = sourcesOf(member);
91
- const fresh = own.filter((source) => !seen.has(source));
92
- const base = hundredths2(member.confidence) - STEP_H * (own.length - 1);
93
- weighted += base * fresh.length;
94
- for (const source of fresh) {
95
- seen.add(source);
96
- }
97
- }
98
- const sources = [...seen].sort();
99
- const stepped = Math.round(weighted / sources.length + STEP_H * (sources.length - 1));
100
- const confidence = Math.min(MAX_H, Math.max(MIN_H, stepped)) / HUNDREDTHS2;
101
- const byAgeAll = [...ordered].sort(byAge);
102
- const lead = byAgeAll[0];
103
- const rest = {};
104
- for (const [key, value] of Object.entries(lead)) {
105
- if (key !== "artifact" && key !== "promoted_to") {
106
- Object.assign(rest, { [key]: value });
107
- }
108
- }
109
- return {
110
- ...rest,
111
- ...firstOptional(byAgeAll, "artifact"),
112
- ...firstOptional(byAgeAll, "promoted_to"),
113
- confidence,
114
- usage_count: sources.length,
115
- sources
116
- };
117
- }
118
- function sameButStamp(left, right) {
119
- const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
120
- keys.delete("updated_at");
121
- return [...keys].every((key) => {
122
- const field = key;
123
- return JSON.stringify(left[field]) === JSON.stringify(right[field]);
124
- });
125
- }
126
- function stamp(record, held, now) {
127
- const before = held.find((candidate) => candidate.id === record.id);
128
- if (before !== undefined && sameButStamp(before, record)) {
129
- return before;
130
- }
131
- return { ...record, updated_at: now };
132
- }
133
- function withStatus(record, status) {
134
- return record.status === status ? record : { ...record, status };
135
- }
136
- function groupByAction(held, incoming) {
137
- const groups = new Map;
138
- const groupOf = (hash) => {
139
- const found = groups.get(hash);
140
- if (found !== undefined) {
141
- return found;
142
- }
143
- const made = { held: [], incoming: [] };
144
- groups.set(hash, made);
145
- return made;
146
- };
147
- for (const record of held) {
148
- groupOf(record.action_hash).held.push(record);
149
- }
150
- for (const record of incoming) {
151
- groupOf(record.action_hash).incoming.push(record);
152
- }
153
- return groups;
154
- }
155
- function settleOne(hash, group, held, now) {
156
- if (group.held.length === 0 && group.incoming.length === 1) {
157
- return {
158
- produced: [group.incoming[0]],
159
- discarded: [],
160
- rules: new Map([[hash, "new-trigger"]])
161
- };
162
- }
163
- const record = stamp(withStatus(collapse(group), "active"), held, now);
164
- return { produced: [record], discarded: [], rules: new Map([[hash, "same-action"]]) };
165
- }
166
- function settleMany(collapsed, held, now) {
167
- const leaderH = Math.max(...[...collapsed.values()].map((record) => hundredths2(record.confidence)));
168
- const kept = new Map;
169
- const discarded = [];
170
- for (const [hash, record] of collapsed) {
171
- if (leaderH - hundredths2(record.confidence) > GAP_H) {
172
- discarded.push(record);
173
- } else {
174
- kept.set(hash, record);
175
- }
176
- }
177
- const status = kept.size > 1 ? "flagged" : "active";
178
- const rule = kept.size > 1 ? "flagged" : "higher-confidence";
179
- const rules = new Map;
180
- for (const hash of collapsed.keys()) {
181
- rules.set(hash, kept.has(hash) ? rule : "higher-confidence");
182
- }
183
- const produced = [...kept.values()].map((record) => stamp(withStatus(record, status), held, now));
184
- return {
185
- produced: produced.sort(byConfidence),
186
- discarded: discarded.sort(byConfidence),
187
- rules
188
- };
189
- }
190
- function settleTrigger(held, incoming, now) {
191
- const groups = groupByAction(held, incoming);
192
- if (groups.size === 1) {
193
- const [hash, group] = [...groups.entries()][0];
194
- return settleOne(hash, group, held, now);
195
- }
196
- const collapsed = new Map;
197
- for (const [hash, group] of groups) {
198
- collapsed.set(hash, collapse(group));
199
- }
200
- return settleMany(collapsed, held, now);
201
- }
202
- function merge(held, payload, now) {
203
- const incoming = payload.instincts.map((record) => withSource(record, payload.source_id));
204
- const keys = [...new Set(incoming.map((record) => triggerKey(record.trigger)))];
205
- const outcomes = new Map;
206
- for (const key of keys) {
207
- const onKey = (record) => triggerKey(record.trigger) === key;
208
- outcomes.set(key, settleTrigger(held.filter(onKey), incoming.filter(onKey), now));
209
- }
210
- const decisions = payload.instincts.map((record) => {
211
- const outcome = outcomes.get(triggerKey(record.trigger));
212
- return {
213
- incoming: record,
214
- rule: outcome.rules.get(record.action_hash),
215
- produced: [...outcome.produced]
216
- };
217
- });
218
- return {
219
- decisions,
220
- discarded: keys.flatMap((key) => outcomes.get(key).discarded)
221
- };
222
- }
223
- export { GAP, SOURCE_STEP, CONFIDENCE_MIN, CONFIDENCE_MAX, actionHash, triggerKey, bless, promotable, merge };