@open-tomato/rafa 0.45.0 → 0.46.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 (140) hide show
  1. package/README.md +255 -23
  2. package/dist/PROMPT.md +18 -1
  3. package/dist/adapters/logger/settings.d.ts +132 -0
  4. package/dist/bugs/closest.d.ts +19 -0
  5. package/dist/bugs/fenced.d.ts +8 -0
  6. package/dist/bugs/places.d.ts +20 -0
  7. package/dist/bugs/record.d.ts +145 -0
  8. package/dist/bugs/title.d.ts +83 -0
  9. package/dist/bundled/agents/doc-updater.md +17 -3
  10. package/dist/bundled/agents/loop-implementer.md +14 -2
  11. package/dist/bundled/operators/skills/rafa-stretch-pit-stop/SKILL.md +10 -3
  12. package/dist/bundled/operators/skills/rafa-stretch-sweep/SKILL.md +5 -0
  13. package/dist/bundled/skills/dev-planner/SKILL.md +101 -18
  14. package/dist/cli.js +74726 -62960
  15. package/dist/config/entry.d.ts +119 -0
  16. package/dist/config/index.d.ts +36 -0
  17. package/dist/config/index.js +51 -0
  18. package/dist/config/shape.d.ts +232 -0
  19. package/dist/config-registry.d.ts +127 -0
  20. package/dist/config-schema-board-project.d.ts +157 -0
  21. package/dist/config-schema-bugs.d.ts +71 -0
  22. package/dist/config-schema-errors.d.ts +54 -0
  23. package/dist/config-schema-features.d.ts +64 -0
  24. package/dist/config-schema-hub.d.ts +150 -0
  25. package/dist/config-schema-issues.d.ts +95 -0
  26. package/dist/config-schema-logger.d.ts +91 -0
  27. package/dist/config-schema-loop-continue.d.ts +122 -0
  28. package/dist/config-schema-loop-retries.d.ts +94 -0
  29. package/dist/config-schema-release.d.ts +307 -0
  30. package/dist/config-schema-tests.d.ts +170 -0
  31. package/dist/config-schema-triage.d.ts +142 -0
  32. package/dist/config-schema-wrap-up.d.ts +96 -0
  33. package/dist/core/command/command.d.ts +228 -0
  34. package/dist/core/command/confirm.d.ts +67 -0
  35. package/dist/core/command/index.d.ts +112 -0
  36. package/dist/core/command/lazy.d.ts +54 -0
  37. package/dist/core/command/registry-types.d.ts +96 -0
  38. package/dist/core/command/running.d.ts +96 -0
  39. package/dist/core/command/spends.d.ts +39 -0
  40. package/dist/core/command/types.d.ts +92 -0
  41. package/dist/core/command/version.d.ts +4 -0
  42. package/dist/core/config/branch-template.d.ts +20 -0
  43. package/dist/core/config/config-items.d.ts +86 -0
  44. package/dist/core/config/config-load.d.ts +47 -0
  45. package/dist/core/config/config-origins.d.ts +57 -0
  46. package/dist/core/config/config-readers.d.ts +167 -0
  47. package/dist/core/config/config-schema.d.ts +207 -0
  48. package/dist/core/config/config-sections.d.ts +493 -0
  49. package/dist/core/config/config.d.ts +320 -0
  50. package/dist/core/config/core-section.d.ts +39 -0
  51. package/dist/core/config/dangerous.d.ts +58 -0
  52. package/dist/core/config/default-routing.d.ts +16 -0
  53. package/dist/core/config/index.d.ts +141 -0
  54. package/dist/core/config/scope.d.ts +42 -0
  55. package/dist/core/config/section.d.ts +206 -0
  56. package/dist/core/config/sections.d.ts +45 -0
  57. package/dist/core/config/standard-schema.d.ts +27 -0
  58. package/dist/core/git/commit.d.ts +232 -0
  59. package/dist/core/git/gh-runner.d.ts +24 -0
  60. package/dist/core/git/git.d.ts +22 -0
  61. package/dist/core/git/index.d.ts +85 -0
  62. package/dist/core/loop/claude.d.ts +388 -0
  63. package/dist/core/loop/hop-record.d.ts +52 -0
  64. package/dist/core/loop/index.d.ts +179 -0
  65. package/dist/core/loop/session-env.d.ts +20 -0
  66. package/dist/core/loop/session-record-parse.d.ts +63 -0
  67. package/dist/core/loop/sessions.d.ts +408 -0
  68. package/dist/core/loop/suite-failure.d.ts +25 -0
  69. package/dist/core/output/active.d.ts +100 -0
  70. package/dist/core/output/stream.d.ts +20 -0
  71. package/dist/core/output/text.d.ts +55 -0
  72. package/dist/core/plan/block-reader.d.ts +46 -0
  73. package/dist/core/plan/blocks.d.ts +139 -0
  74. package/dist/core/plan/declaration.d.ts +366 -0
  75. package/dist/core/plan/plan-stamp.d.ts +75 -0
  76. package/dist/core/runtime/identity.d.ts +21 -0
  77. package/dist/core/runtime/index.d.ts +46 -0
  78. package/dist/effort/store/bring-forward.d.ts +131 -0
  79. package/dist/effort/store/check-rows.d.ts +31 -0
  80. package/dist/effort/store/commit-stats.d.ts +42 -0
  81. package/dist/effort/store/copy.d.ts +35 -0
  82. package/dist/effort/store/development-build.d.ts +105 -0
  83. package/dist/effort/store/effort-levels.d.ts +13 -0
  84. package/dist/effort/store/findings.d.ts +214 -0
  85. package/dist/effort/store/fix-schema.d.ts +184 -0
  86. package/dist/effort/store/index.js +10 -7
  87. package/dist/effort/store/location.d.ts +44 -0
  88. package/dist/effort/store/merge-commit-gaps.d.ts +68 -0
  89. package/dist/effort/store/merge-conflicts.d.ts +91 -0
  90. package/dist/effort/store/merge-rules.d.ts +82 -0
  91. package/dist/effort/store/merge-store.d.ts +211 -0
  92. package/dist/effort/store/merge-union.d.ts +92 -0
  93. package/dist/effort/store/migrate.d.ts +146 -0
  94. package/dist/effort/store/migrations.d.ts +92 -0
  95. package/dist/effort/store/ndjson-files.d.ts +114 -0
  96. package/dist/effort/store/origins.d.ts +116 -0
  97. package/dist/effort/store/plan-stubs.d.ts +79 -0
  98. package/dist/effort/store/rebuild-aside.d.ts +172 -0
  99. package/dist/effort/store/schema-plan.d.ts +102 -0
  100. package/dist/effort/store/session-row-types.d.ts +64 -0
  101. package/dist/effort/store/settings.d.ts +13 -0
  102. package/dist/effort/store/sqlite.d.ts +340 -0
  103. package/dist/effort/store/store-generation.d.ts +17 -0
  104. package/dist/effort/store/store-identity.d.ts +220 -0
  105. package/dist/effort/store/store-meta.d.ts +305 -0
  106. package/dist/effort/store/store-replaced.d.ts +72 -0
  107. package/dist/effort/store/types.d.ts +223 -0
  108. package/dist/errors/codes.d.ts +56 -0
  109. package/dist/errors/rafa-codes.d.ts +36 -0
  110. package/dist/index-2a7nb3an.js +125 -0
  111. package/dist/{index-r28fzsvc.js → index-39kbcw68.js} +350 -165
  112. package/dist/{index-nv34ptht.js → index-77ajfffn.js} +14 -9
  113. package/dist/index-cy98y87p.js +2597 -0
  114. package/dist/index-gqz4jn6j.js +13447 -0
  115. package/dist/index-gvek4r8m.js +710 -0
  116. package/dist/index-j4k2vdz3.js +1125 -0
  117. package/dist/index-jh1r4kcn.js +1067 -0
  118. package/dist/{index-mgh2s9bj.js → index-ykggr043.js} +58 -455
  119. package/dist/index-z1w83f81.js +4 -0
  120. package/dist/index.js +14715 -21516
  121. package/dist/learning/index.js +5 -6
  122. package/dist/plan/index.js +12 -11
  123. package/dist/plan-prompt.md +3 -1
  124. package/dist/ports/index.d.ts +732 -0
  125. package/dist/ports/learning.d.ts +101 -0
  126. package/dist/ports/log-level.d.ts +13 -0
  127. package/dist/ports/spec-review.d.ts +66 -0
  128. package/dist/pr/checks.d.ts +133 -0
  129. package/dist/pr/types.d.ts +422 -0
  130. package/dist/ready-4f8edezt.js +2016 -0
  131. package/dist/release-templates/release-bot-fragment.yml +153 -0
  132. package/dist/release-templates/release-publish.yml +110 -0
  133. package/dist/release-templates/release-settle.yml +122 -0
  134. package/dist/release-templates/release-tag.yml +102 -0
  135. package/dist/report/parse.d.ts +415 -0
  136. package/dist/schema/project-id.d.ts +79 -0
  137. package/dist/schema/tiers.d.ts +107 -0
  138. package/package.json +41 -3
  139. package/dist/index-hf2k497d.js +0 -16
  140. package/dist/index-nsr78ct2.js +0 -8219
@@ -0,0 +1,36 @@
1
+ /**
2
+ * rafa's own cause codes (#949): the list every project starts from,
3
+ * and the tagged view `rafa bug codes` prints.
4
+ *
5
+ * The list has three parts. The first two give a code in the new form to
6
+ * every value of the four per-module unions that existed before it:
7
+ * `ROUTE_REFUSALS` and `DISPATCH_ERROR_CODES` (`src/cli/`), and
8
+ * `SKILL_ISSUE_CODES` with `FailureStringCode` (`src/schema/`). Those
9
+ * unions keep their own spellings, since `--output=json` readers see
10
+ * them in `error.code`; each entry here carries the old spelling in
11
+ * `legacy`. Nothing derives the unions from this list. The test beside
12
+ * this file holds the two together instead: a union value with no entry,
13
+ * or a `legacy` naming no union value, turns it red.
14
+ *
15
+ * The third part seeds the causes behind the largest duplicate clusters
16
+ * the bug audit found, and one common case per shared family. The list
17
+ * grows from fixes: a bug filed as `<family>:new-context` gets its code
18
+ * added here by the change that fixes it.
19
+ *
20
+ * A project's own codes come from `errors.codes`
21
+ * (`src/config-schema-errors.ts`), and {@link listedCodes} puts the two
22
+ * side by side.
23
+ */
24
+ import type { ErrorCodeEntry } from './codes.js';
25
+ /** Where a listed code comes from. */
26
+ export type CodeSource = 'rafa' | 'project';
27
+ /** A code as `rafa bug codes` lists it. */
28
+ export interface ListedCode extends ErrorCodeEntry {
29
+ readonly source: CodeSource;
30
+ }
31
+ /** One line per family rafa's list uses. */
32
+ export declare const FAMILY_DESCRIPTIONS: Readonly<Record<string, string>>;
33
+ /** rafa's own codes; see the module note. */
34
+ export declare const RAFA_CODES: readonly ErrorCodeEntry[];
35
+ /** rafa's codes, then `projectCodes`, each tagged with where it comes from. */
36
+ export declare function listedCodes(projectCodes: readonly ErrorCodeEntry[]): readonly ListedCode[];
@@ -0,0 +1,125 @@
1
+ // @bun
2
+ // packages/rafa/src/core/output/text.ts
3
+ var DEBUG_VERBOSITY = 2;
4
+ function formatPayload(payload) {
5
+ return typeof payload === "string" ? payload : JSON.stringify(payload);
6
+ }
7
+ function resultLine(event) {
8
+ if (event.ok) {
9
+ return event.data === undefined ? "result: ok" : `result: ok ${formatPayload(event.data)}`;
10
+ }
11
+ const code = event.error?.code ?? "unknown";
12
+ const message = event.error?.message ?? "";
13
+ return message === "" ? `result: error ${code}` : `result: error ${code}: ${message}`;
14
+ }
15
+ function createTextOutput({ verbosity, stream }) {
16
+ const writeLine = (line) => {
17
+ stream.write(`${line}
18
+ `);
19
+ };
20
+ const debug = (message) => {
21
+ if (verbosity >= DEBUG_VERBOSITY)
22
+ writeLine(`debug: ${message}`);
23
+ };
24
+ const info = (message) => {
25
+ writeLine(message);
26
+ };
27
+ const warn = (message) => {
28
+ writeLine(`warn: ${message}`);
29
+ };
30
+ const error = (message) => {
31
+ writeLine(`error: ${message}`);
32
+ };
33
+ const result = (payload) => {
34
+ writeLine(`result: ${formatPayload(payload)}`);
35
+ };
36
+ const writeLog = (event) => {
37
+ switch (event.level) {
38
+ case "debug": {
39
+ debug(event.message);
40
+ return;
41
+ }
42
+ case "info": {
43
+ info(event.message);
44
+ return;
45
+ }
46
+ case "warn": {
47
+ warn(event.message);
48
+ return;
49
+ }
50
+ case "error": {
51
+ error(event.message);
52
+ return;
53
+ }
54
+ }
55
+ };
56
+ const emit = (event) => {
57
+ switch (event.type) {
58
+ case "start": {
59
+ writeLine(`start: ${event.command}`);
60
+ return;
61
+ }
62
+ case "step": {
63
+ writeLine(`step: ${event.name}`);
64
+ return;
65
+ }
66
+ case "log": {
67
+ writeLog(event);
68
+ return;
69
+ }
70
+ case "result": {
71
+ writeLine(resultLine(event));
72
+ return;
73
+ }
74
+ case "event": {
75
+ return;
76
+ }
77
+ }
78
+ };
79
+ return Object.freeze({ info, warn, error, debug, emit, result });
80
+ }
81
+
82
+ // packages/rafa/src/core/output/active.ts
83
+ import { AsyncLocalStorage } from "async_hooks";
84
+ var scopes = new AsyncLocalStorage;
85
+ var DEFAULT_OUTPUT = createTextOutput({ verbosity: 0, stream: process.stdout });
86
+ var active = DEFAULT_OUTPUT;
87
+ var activeMode = "text";
88
+ function activeOutput() {
89
+ return scopes.getStore()?.output ?? active;
90
+ }
91
+ function activeOutputMode() {
92
+ return scopes.getStore()?.mode ?? activeMode;
93
+ }
94
+
95
+ // packages/rafa/src/core/plan/plan-stamp.ts
96
+ var STUB_PATTERN = "[A-Za-z0-9._-]+";
97
+ var STAMP_PATTERN = new RegExp(`<!--\\s*ralph:plan=(${STUB_PATTERN})\\s*-->`);
98
+ function isStampableStub(stub) {
99
+ return new RegExp(`^${STUB_PATTERN}$`).test(stub);
100
+ }
101
+ function planStampLine(stub) {
102
+ if (!isStampableStub(stub)) {
103
+ throw new Error(`rafa plan stamp: unusable stub ${JSON.stringify(stub)}`);
104
+ }
105
+ return `<!-- ralph:plan=${stub} -->`;
106
+ }
107
+ function planStubFromPrompt(content) {
108
+ if (typeof content !== "string" || content.length === 0)
109
+ return null;
110
+ const match = STAMP_PATTERN.exec(content);
111
+ const stub = match?.[1];
112
+ return stub !== undefined && isStampableStub(stub) ? stub : null;
113
+ }
114
+ function stampPrompt(stub, prompt) {
115
+ return `${prompt}
116
+ ${planStampLine(stub)}`;
117
+ }
118
+ function planStubFromPath(planPath) {
119
+ const base = planPath.split("/").pop() ?? planPath;
120
+ const match = /^PLAN(?:_TRACKER)?-(.+)\.md$/.exec(base);
121
+ const stub = match?.[1];
122
+ return stub !== undefined && isStampableStub(stub) ? stub : null;
123
+ }
124
+
125
+ export { createTextOutput, activeOutput, activeOutputMode, isStampableStub, planStubFromPrompt, stampPrompt, planStubFromPath };