@open-tomato/rafa 0.45.0 → 0.47.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/README.md +285 -23
- package/dist/PROMPT.md +18 -1
- package/dist/adapters/logger/settings.d.ts +132 -0
- package/dist/bugs/closest.d.ts +19 -0
- package/dist/bugs/fenced.d.ts +8 -0
- package/dist/bugs/places.d.ts +20 -0
- package/dist/bugs/record.d.ts +145 -0
- package/dist/bugs/title.d.ts +83 -0
- package/dist/bundled/agents/doc-updater.md +17 -3
- package/dist/bundled/agents/loop-implementer.md +14 -2
- package/dist/bundled/operators/skills/rafa-stretch-pit-stop/SKILL.md +10 -3
- package/dist/bundled/operators/skills/rafa-stretch-sweep/SKILL.md +5 -0
- package/dist/bundled/skills/dev-planner/SKILL.md +101 -18
- package/dist/cli.js +76536 -64285
- package/dist/config/entry.d.ts +119 -0
- package/dist/config/index.d.ts +41 -0
- package/dist/config/index.js +54 -0
- package/dist/config/shape.d.ts +235 -0
- package/dist/config/templates.d.ts +64 -0
- package/dist/config-registry.d.ts +136 -0
- package/dist/config-schema-board-project.d.ts +157 -0
- package/dist/config-schema-bugs.d.ts +71 -0
- package/dist/config-schema-checks.d.ts +114 -0
- package/dist/config-schema-errors.d.ts +54 -0
- package/dist/config-schema-features.d.ts +64 -0
- package/dist/config-schema-hub.d.ts +152 -0
- package/dist/config-schema-issues.d.ts +95 -0
- package/dist/config-schema-logger.d.ts +91 -0
- package/dist/config-schema-loop-continue.d.ts +122 -0
- package/dist/config-schema-loop-retries.d.ts +94 -0
- package/dist/config-schema-release.d.ts +306 -0
- package/dist/config-schema-tests.d.ts +178 -0
- package/dist/config-schema-triage.d.ts +142 -0
- package/dist/config-schema-wrap-up.d.ts +96 -0
- package/dist/core/command/command.d.ts +228 -0
- package/dist/core/command/confirm.d.ts +73 -0
- package/dist/core/command/index.d.ts +130 -0
- package/dist/core/command/lazy.d.ts +54 -0
- package/dist/core/command/registry-types.d.ts +96 -0
- package/dist/core/command/running.d.ts +96 -0
- package/dist/core/command/shared-flags.d.ts +40 -0
- package/dist/core/command/spends.d.ts +39 -0
- package/dist/core/command/types.d.ts +92 -0
- package/dist/core/command/version.d.ts +4 -0
- package/dist/core/config/branch-template.d.ts +20 -0
- package/dist/core/config/config-items.d.ts +86 -0
- package/dist/core/config/config-load-module.d.ts +43 -0
- package/dist/core/config/config-load.d.ts +78 -0
- package/dist/core/config/config-origins.d.ts +58 -0
- package/dist/core/config/config-readers.d.ts +167 -0
- package/dist/core/config/config-schema.d.ts +212 -0
- package/dist/core/config/config-sections.d.ts +493 -0
- package/dist/core/config/config.d.ts +385 -0
- package/dist/core/config/core-section.d.ts +39 -0
- package/dist/core/config/dangerous.d.ts +58 -0
- package/dist/core/config/default-routing.d.ts +16 -0
- package/dist/core/config/index.d.ts +145 -0
- package/dist/core/config/merge-method.d.ts +40 -0
- package/dist/core/config/scope.d.ts +42 -0
- package/dist/core/config/section.d.ts +286 -0
- package/dist/core/config/sections.d.ts +53 -0
- package/dist/core/config/standard-schema.d.ts +27 -0
- package/dist/core/git/commit.d.ts +232 -0
- package/dist/core/git/gh-runner.d.ts +24 -0
- package/dist/core/git/git.d.ts +22 -0
- package/dist/core/git/index.d.ts +85 -0
- package/dist/core/loop/claude.d.ts +388 -0
- package/dist/core/loop/hop-record.d.ts +52 -0
- package/dist/core/loop/index.d.ts +179 -0
- package/dist/core/loop/session-env.d.ts +20 -0
- package/dist/core/loop/session-record-parse.d.ts +70 -0
- package/dist/core/loop/sessions.d.ts +420 -0
- package/dist/core/loop/suite-failure.d.ts +25 -0
- package/dist/core/output/active.d.ts +100 -0
- package/dist/core/output/stream.d.ts +20 -0
- package/dist/core/output/text.d.ts +55 -0
- package/dist/core/plan/block-reader.d.ts +46 -0
- package/dist/core/plan/blocks.d.ts +139 -0
- package/dist/core/plan/declaration.d.ts +366 -0
- package/dist/core/plan/plan-stamp.d.ts +75 -0
- package/dist/core/runtime/identity.d.ts +21 -0
- package/dist/core/runtime/index.d.ts +46 -0
- package/dist/effort/store/bring-forward.d.ts +131 -0
- package/dist/effort/store/check-rows.d.ts +31 -0
- package/dist/effort/store/commit-stats.d.ts +42 -0
- package/dist/effort/store/copy.d.ts +35 -0
- package/dist/effort/store/development-build.d.ts +105 -0
- package/dist/effort/store/effort-levels.d.ts +13 -0
- package/dist/effort/store/findings.d.ts +214 -0
- package/dist/effort/store/fix-schema.d.ts +184 -0
- package/dist/effort/store/index.js +10 -7
- package/dist/effort/store/location.d.ts +44 -0
- package/dist/effort/store/merge-commit-gaps.d.ts +68 -0
- package/dist/effort/store/merge-conflicts.d.ts +91 -0
- package/dist/effort/store/merge-rules.d.ts +82 -0
- package/dist/effort/store/merge-store.d.ts +211 -0
- package/dist/effort/store/merge-union.d.ts +92 -0
- package/dist/effort/store/migrate.d.ts +146 -0
- package/dist/effort/store/migrations.d.ts +92 -0
- package/dist/effort/store/ndjson-files.d.ts +114 -0
- package/dist/effort/store/origins.d.ts +116 -0
- package/dist/effort/store/plan-stubs.d.ts +79 -0
- package/dist/effort/store/rebuild-aside.d.ts +172 -0
- package/dist/effort/store/schema-plan.d.ts +102 -0
- package/dist/effort/store/session-row-types.d.ts +64 -0
- package/dist/effort/store/settings.d.ts +13 -0
- package/dist/effort/store/sqlite.d.ts +340 -0
- package/dist/effort/store/store-generation.d.ts +17 -0
- package/dist/effort/store/store-identity.d.ts +220 -0
- package/dist/effort/store/store-meta.d.ts +305 -0
- package/dist/effort/store/store-replaced.d.ts +72 -0
- package/dist/effort/store/types.d.ts +223 -0
- package/dist/errors/codes.d.ts +56 -0
- package/dist/errors/rafa-codes.d.ts +36 -0
- package/dist/{index-nv34ptht.js → index-38ktnyvz.js} +14 -9
- package/dist/index-3mwsr6wg.js +1070 -0
- package/dist/index-7dgc5g1t.js +13480 -0
- package/dist/index-cbqvgda6.js +766 -0
- package/dist/index-eay1bd2w.js +2632 -0
- package/dist/index-f1y86zbb.js +125 -0
- package/dist/index-n3e31fmw.js +1041 -0
- package/dist/{index-r28fzsvc.js → index-nwzx41g1.js} +351 -166
- package/dist/index-pzpb1rf7.js +153 -0
- package/dist/{index-mgh2s9bj.js → index-r5q2pdky.js} +65 -457
- package/dist/index-z1w83f81.js +4 -0
- package/dist/index.js +17592 -24119
- package/dist/learning/index.js +5 -6
- package/dist/plan/index.js +12 -11
- package/dist/plan-prompt.md +3 -1
- package/dist/ports/index.d.ts +732 -0
- package/dist/ports/learning.d.ts +101 -0
- package/dist/ports/log-level.d.ts +13 -0
- package/dist/ports/spec-review.d.ts +66 -0
- package/dist/ready-6p40c3gw.js +2007 -0
- package/dist/release-templates/release-bot-fragment.yml +153 -0
- package/dist/release-templates/release-publish.yml +110 -0
- package/dist/release-templates/release-settle.yml +122 -0
- package/dist/release-templates/release-tag.yml +102 -0
- package/dist/report/parse.d.ts +415 -0
- package/dist/schema/project-id.d.ts +79 -0
- package/dist/schema/tiers.d.ts +107 -0
- package/package.json +62 -3
- package/dist/index-hf2k497d.js +0 -16
- package/dist/index-nsr78ct2.js +0 -8219
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conventional type of a derived subject.
|
|
3
|
+
*
|
|
4
|
+
* Exactly the six {@link COMMIT_TYPE_RULES} can select, one of which
|
|
5
|
+
* is also {@link DEFAULT_COMMIT_TYPE}. `ci` and `perf` are legal in
|
|
6
|
+
* this repo's history and are absent here on purpose: no rule selects
|
|
7
|
+
* them, and a member the inference can never answer would be a column
|
|
8
|
+
* that always reads empty.
|
|
9
|
+
*/
|
|
10
|
+
export type CommitType = 'chore' | 'docs' | 'feat' | 'fix' | 'refactor' | 'test';
|
|
11
|
+
/** What a task text is labelled when no rule matches it. */
|
|
12
|
+
export declare const DEFAULT_COMMIT_TYPE: CommitType;
|
|
13
|
+
/** One inference rule. The first whose pattern matches wins. */
|
|
14
|
+
export interface CommitTypeRule {
|
|
15
|
+
/** Type this rule selects. */
|
|
16
|
+
type: CommitType;
|
|
17
|
+
/** Matched against the normalised, still-capitalised task text. */
|
|
18
|
+
pattern: RegExp;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The inference table, in priority order.
|
|
22
|
+
*
|
|
23
|
+
* It is a LABEL and not a classification: a wrong type costs a
|
|
24
|
+
* slightly-off word at the front of a subject whose body carries the
|
|
25
|
+
* whole task text, so the rules are kept few and readable rather
|
|
26
|
+
* than exhaustive. Two orderings in it are load-bearing.
|
|
27
|
+
*
|
|
28
|
+
* `test` runs first because a test task is the one shape whose verb
|
|
29
|
+
* is indistinguishable from a feature's — both begin `Add` — and only
|
|
30
|
+
* the noun separates them.
|
|
31
|
+
*
|
|
32
|
+
* `docs` runs before every verb rule because a documentation task's
|
|
33
|
+
* verb is whatever the edit happens to be (`Remove the four commit
|
|
34
|
+
* instructions from PROMPT.md`, `Rewrite the root AGENTS.md`,
|
|
35
|
+
* `Split packages/service/AGENTS.md`), while the thing it names is
|
|
36
|
+
* reliably a markdown file. The known cost of that order is a real
|
|
37
|
+
* code task that merely mentions a `.md` path, which is labelled
|
|
38
|
+
* `docs`; the body still says what it did.
|
|
39
|
+
*/
|
|
40
|
+
export declare const COMMIT_TYPE_RULES: readonly CommitTypeRule[];
|
|
41
|
+
/**
|
|
42
|
+
* Longest subject this module will produce, including the type
|
|
43
|
+
* prefix. Git's own convention, and the ceiling GitHub renders
|
|
44
|
+
* without eliding.
|
|
45
|
+
*/
|
|
46
|
+
export declare const MAX_SUBJECT_LENGTH = 72;
|
|
47
|
+
/** Description used when the task text carries no words at all. */
|
|
48
|
+
export declare const FALLBACK_DESCRIPTION = "complete the scoped task";
|
|
49
|
+
/**
|
|
50
|
+
* Characters of a failed git invocation kept on the result.
|
|
51
|
+
*
|
|
52
|
+
* A rejected hook can print a finding per staged file, and the loop
|
|
53
|
+
* echoes this to a console a human is scrolling. Truncation is
|
|
54
|
+
* marked, so a caller can tell a short message from a cut one.
|
|
55
|
+
*/
|
|
56
|
+
export declare const MAX_MESSAGE_CHARS = 4000;
|
|
57
|
+
/** Collapses every whitespace run, newlines included, to one space. */
|
|
58
|
+
export declare function normaliseTaskText(taskText: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Picks the conventional type for a task text.
|
|
61
|
+
*
|
|
62
|
+
* Falls back to {@link DEFAULT_COMMIT_TYPE}, which is what an
|
|
63
|
+
* unrecognised verb gets rather than an exception: the loop must
|
|
64
|
+
* still be able to commit a task whose wording nobody anticipated.
|
|
65
|
+
*/
|
|
66
|
+
export declare function inferCommitType(taskText: string): CommitType;
|
|
67
|
+
/**
|
|
68
|
+
* The task text up to its first comma, colon or parenthesis outside a
|
|
69
|
+
* code span, trailing whitespace dropped. The whole text when nothing
|
|
70
|
+
* ends it, and the empty string when the text opens on an ending.
|
|
71
|
+
*
|
|
72
|
+
* A subject quotes the first clause rather than the first 72
|
|
73
|
+
* characters because a width cut stops wherever the width falls: the
|
|
74
|
+
* 2026-09-14 cutover run committed a subject ending `(under 60 lines)
|
|
75
|
+
* stating that the loop`, mid-sentence, where the clause before the
|
|
76
|
+
* parenthesis was the whole of what it needed to say.
|
|
77
|
+
*
|
|
78
|
+
* The code-span exception is what makes the rule usable on a plan,
|
|
79
|
+
* which names identifiers in backticks: the comma in `run(a, b)` is
|
|
80
|
+
* part of a name, never the end of a clause. A backtick run that
|
|
81
|
+
* nothing closes opens no span, as CommonMark reads it, so it is
|
|
82
|
+
* literal text and the endings after it still count.
|
|
83
|
+
*/
|
|
84
|
+
export declare function firstClause(text: string): string;
|
|
85
|
+
/** How a subject is built. */
|
|
86
|
+
export interface SubjectOptions {
|
|
87
|
+
/** Conventional scope, rendered as `type(scope):`. Optional. */
|
|
88
|
+
scope?: string;
|
|
89
|
+
/** Cap including the prefix. Defaults to {@link MAX_SUBJECT_LENGTH}. */
|
|
90
|
+
maxLength?: number;
|
|
91
|
+
}
|
|
92
|
+
/** A derived subject and what deriving it decided. */
|
|
93
|
+
export interface DerivedSubject {
|
|
94
|
+
/** The whole subject line, prefix included. */
|
|
95
|
+
subject: string;
|
|
96
|
+
/** Type the rules selected. */
|
|
97
|
+
type: CommitType;
|
|
98
|
+
/**
|
|
99
|
+
* True when the description was cut to fit the cap. Ending at the
|
|
100
|
+
* first clause is not a cut: a clause that fits answers false
|
|
101
|
+
* however much task text follows it.
|
|
102
|
+
*/
|
|
103
|
+
truncated: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Derives a conventional-commit subject from a task's text.
|
|
107
|
+
*
|
|
108
|
+
* The description is the text's {@link firstClause}, cut at a word
|
|
109
|
+
* boundary when that clause alone is longer than the cap leaves room
|
|
110
|
+
* for. The TYPE is still inferred from the whole text, since a clause
|
|
111
|
+
* can end before the path or the noun the rules read. Whatever the
|
|
112
|
+
* subject leaves out, the body {@link buildCommitMessage} writes
|
|
113
|
+
* carries.
|
|
114
|
+
*
|
|
115
|
+
* Deterministic over its input: the same task text answers the same
|
|
116
|
+
* subject on every machine and every run, which is what lets the
|
|
117
|
+
* loop's commits be predicted by a test instead of inspected by a
|
|
118
|
+
* human.
|
|
119
|
+
*/
|
|
120
|
+
export declare function deriveCommitSubject(taskText: string, options?: SubjectOptions): DerivedSubject;
|
|
121
|
+
/** A subject with the body that carries the whole task line. */
|
|
122
|
+
export interface CommitMessage extends DerivedSubject {
|
|
123
|
+
/**
|
|
124
|
+
* The whole normalised task text, written whatever the subject kept
|
|
125
|
+
* of it. The empty string only for a task text with no words, which
|
|
126
|
+
* has no line to carry.
|
|
127
|
+
*/
|
|
128
|
+
body: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Builds the message a task's commit is made with.
|
|
132
|
+
*
|
|
133
|
+
* The body is the whole task line on every commit. The subject holds
|
|
134
|
+
* one clause at most, so it seldom carries the sentence, and a body
|
|
135
|
+
* written only when the subject lost words would leave a reader of
|
|
136
|
+
* `git log` checking, commit by commit, which of the two holds it. The
|
|
137
|
+
* sentence is the only record of what the commit was asked to do, so
|
|
138
|
+
* it sits in the same place every time, even where that repeats a
|
|
139
|
+
* subject that already says all of it.
|
|
140
|
+
*/
|
|
141
|
+
export declare function buildCommitMessage(taskText: string, options?: SubjectOptions): CommitMessage;
|
|
142
|
+
/** Argv that stages the whole worktree. */
|
|
143
|
+
export declare function stageAllArgs(): string[];
|
|
144
|
+
/**
|
|
145
|
+
* Argv that answers whether anything is staged: exit 0 for nothing,
|
|
146
|
+
* exit 1 for something. Exported so a caller reading the exit code
|
|
147
|
+
* can see which command produced it.
|
|
148
|
+
*/
|
|
149
|
+
export declare function stagedChangesArgs(): string[];
|
|
150
|
+
/**
|
|
151
|
+
* Argv that makes the commit.
|
|
152
|
+
*
|
|
153
|
+
* `--cleanup=whitespace` is spelled out because strip DELETES every
|
|
154
|
+
* line beginning with `#`, and a task text is free to open on a shell
|
|
155
|
+
* comment or a markdown heading. It is NOT defending against git's
|
|
156
|
+
* default: for a `-m` message the default already behaves as
|
|
157
|
+
* whitespace, strip being the default only when the message is to be
|
|
158
|
+
* edited. What it defends against is a `commit.cleanup=strip`
|
|
159
|
+
* CONFIGURATION, which a machine's global git config is free to set
|
|
160
|
+
* (measured, git 2.50.1). Since {@link buildCommitMessage} collapses
|
|
161
|
+
* the task text to one line, the whole reachable difference is a task
|
|
162
|
+
* text that OPENS on a hash.
|
|
163
|
+
*
|
|
164
|
+
* Two `-m` arguments rather than one joined string: git inserts the
|
|
165
|
+
* blank line between subject and body itself, so the separator
|
|
166
|
+
* cannot drift.
|
|
167
|
+
*/
|
|
168
|
+
export declare function commitArgs(subject: string, body?: string): string[];
|
|
169
|
+
/** Argv that reads the sha the commit just produced. */
|
|
170
|
+
export declare function headShaArgs(): string[];
|
|
171
|
+
/** One git invocation's result, as the runner reports it. */
|
|
172
|
+
export interface GitRunResult {
|
|
173
|
+
/** Exit code, or null when the process was killed or never ran. */
|
|
174
|
+
status: number | null;
|
|
175
|
+
stdout: string;
|
|
176
|
+
stderr: string;
|
|
177
|
+
}
|
|
178
|
+
/** Runs git with the given argv. The seam every test drives. */
|
|
179
|
+
export type GitRunner = (args: string[]) => GitRunResult;
|
|
180
|
+
/** Which invocation a failure came from. */
|
|
181
|
+
export type CommitStep = 'stage' | 'inspect' | 'commit';
|
|
182
|
+
/** What one attempt did. */
|
|
183
|
+
export type CommitOutcome = 'committed' | 'nothing-to-commit' | 'failed';
|
|
184
|
+
/** The whole result of one attempt. */
|
|
185
|
+
export interface CommitAttempt {
|
|
186
|
+
outcome: CommitOutcome;
|
|
187
|
+
/** Subject the commit was made with, derived either way. */
|
|
188
|
+
subject: string;
|
|
189
|
+
/** Sha of the new commit, or null when none was made. */
|
|
190
|
+
sha: string | null;
|
|
191
|
+
/** Invocation that failed, or null when none did. */
|
|
192
|
+
failedStep: CommitStep | null;
|
|
193
|
+
/** That invocation's exit code, or null. */
|
|
194
|
+
exitCode: number | null;
|
|
195
|
+
/** Its stderr and stdout, capped. Empty when nothing failed. */
|
|
196
|
+
message: string;
|
|
197
|
+
}
|
|
198
|
+
/** How an attempt is made. */
|
|
199
|
+
export interface CommitOptions {
|
|
200
|
+
/** The task's text, which the subject is derived from. */
|
|
201
|
+
taskText: string;
|
|
202
|
+
/** Directory git runs in. Defaults to the current one. */
|
|
203
|
+
cwd?: string;
|
|
204
|
+
/** Conventional scope for the subject. Optional. */
|
|
205
|
+
scope?: string;
|
|
206
|
+
/** Cap for the subject. Defaults to {@link MAX_SUBJECT_LENGTH}. */
|
|
207
|
+
maxLength?: number;
|
|
208
|
+
/** Runner override. Defaults to a real `git` spawn in `cwd`. */
|
|
209
|
+
runGit?: GitRunner;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The default runner: a real `git` in `cwd`.
|
|
213
|
+
*
|
|
214
|
+
* `spawnSync` and not `execFileSync`, because two of the three
|
|
215
|
+
* invocations use their exit code as an ANSWER rather than as an
|
|
216
|
+
* error — `git diff --cached --quiet` exits 1 to say a commit is
|
|
217
|
+
* warranted, and a thrown exception there would turn the ordinary
|
|
218
|
+
* case into the failure path.
|
|
219
|
+
*/
|
|
220
|
+
export declare function spawnGit(cwd: string): GitRunner;
|
|
221
|
+
/**
|
|
222
|
+
* Stages the worktree and commits it under a subject derived from
|
|
223
|
+
* the task's text.
|
|
224
|
+
*
|
|
225
|
+
* The three invocations run in a fixed order and each one's failure
|
|
226
|
+
* stops the attempt, so a caller never sees a `committed` result
|
|
227
|
+
* whose commit did not happen. The fourth read — the sha — is the
|
|
228
|
+
* exception: it runs AFTER the commit succeeded, so a failure there
|
|
229
|
+
* leaves the outcome `committed` with a null sha rather than
|
|
230
|
+
* retracting a commit that is already in the history.
|
|
231
|
+
*/
|
|
232
|
+
export declare function commitTaskWork(options: CommitOptions): CommitAttempt;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seam every `gh` command goes through: the runner's type and what
|
|
3
|
+
* one command answers.
|
|
4
|
+
*
|
|
5
|
+
* Declared here, below the `github` tracker that spawns `gh`, so the
|
|
6
|
+
* adapter registry types its `gh` option without importing the tracker.
|
|
7
|
+
* `src/adapters/tracker/github.ts` imports both names from this file
|
|
8
|
+
* and re-exports them under the same names, so none of its importers
|
|
9
|
+
* changes.
|
|
10
|
+
*/
|
|
11
|
+
/** What one `gh` command answered. */
|
|
12
|
+
export interface GhResult {
|
|
13
|
+
/** True when `gh` exited 0. */
|
|
14
|
+
readonly ok: boolean;
|
|
15
|
+
readonly stdout: string;
|
|
16
|
+
readonly stderr: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Runs `gh` with the arguments after its name. A command that fails,
|
|
20
|
+
* or could not be run, answers `ok` false rather than rejecting.
|
|
21
|
+
* `stdin`, when given, is the whole of what `gh` reads on its standard
|
|
22
|
+
* input; left out, `gh` reads a closed one.
|
|
23
|
+
*/
|
|
24
|
+
export type GhRunner = (args: readonly string[], stdin?: string) => Promise<GhResult>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** What one git command answered. Never a throw; see the module note. */
|
|
2
|
+
export interface GitResult {
|
|
3
|
+
/** True when git exited 0. */
|
|
4
|
+
readonly ok: boolean;
|
|
5
|
+
/** Its standard output, empty when it wrote none. */
|
|
6
|
+
readonly stdout: string;
|
|
7
|
+
/** Its standard error, empty when it wrote none. */
|
|
8
|
+
readonly stderr: string;
|
|
9
|
+
}
|
|
10
|
+
/** Runs git with the arguments after its name, in the directory it was made for. */
|
|
11
|
+
export type GitRunner = (args: readonly string[]) => GitResult;
|
|
12
|
+
/**
|
|
13
|
+
* Makes the runner that spawns `git` in `cwd`, under `LC_ALL=C`, with
|
|
14
|
+
* its output read as UTF-8. It never throws; see the module note.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createGitRunner(cwd: string): GitRunner;
|
|
17
|
+
/**
|
|
18
|
+
* What git said, its standard error first, since that is where it
|
|
19
|
+
* writes its refusals and its progress. Empty when it said nothing at
|
|
20
|
+
* all, which a successful `git switch` does.
|
|
21
|
+
*/
|
|
22
|
+
export declare function gitSaid(result: GitResult): string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The barrel over git: every name `git.ts`, `commit.ts` and
|
|
3
|
+
* `gh-runner.ts` export but one, and nothing else.
|
|
4
|
+
*
|
|
5
|
+
* A file outside `packages/rafa/src/core/` imports this file and never the two behind
|
|
6
|
+
* it (`scripts/survey/core-barrels.ts` measures that, and
|
|
7
|
+
* `src/tests/core-barrels.sweep.test.ts` holds it against the tree). A
|
|
8
|
+
* file inside `packages/rafa/src/core/` imports the two directly and never this file.
|
|
9
|
+
* None does today.
|
|
10
|
+
*
|
|
11
|
+
* ## What sits behind it
|
|
12
|
+
*
|
|
13
|
+
* - `git.ts`: the runner that spawns `git` in a directory and answers
|
|
14
|
+
* what git said instead of throwing, with the reader of that answer;
|
|
15
|
+
* - `commit.ts`: staging and committing one task's work on the loop's
|
|
16
|
+
* behalf, the subject derived from the task text, and the argv of
|
|
17
|
+
* each step;
|
|
18
|
+
* - `gh-runner.ts`: the type of the runner every `gh` command goes
|
|
19
|
+
* through and what one command answers, types alone, imported by
|
|
20
|
+
* nothing.
|
|
21
|
+
*
|
|
22
|
+
* ## The one name the two files share
|
|
23
|
+
*
|
|
24
|
+
* Both files export a type named `GitRunner`, and they are two types.
|
|
25
|
+
* `git.ts` declares `(args: readonly string[]) => GitResult`, the seam
|
|
26
|
+
* the callers of this barrel stub. `commit.ts` declares
|
|
27
|
+
* `(args: string[]) => GitRunResult`, the runner `CommitOptions.runGit`
|
|
28
|
+
* takes, which carries an exit status where the first carries `ok`.
|
|
29
|
+
*
|
|
30
|
+
* One barrel exports one binding under a name, so `GitRunner` here is
|
|
31
|
+
* the one `git.ts` declares, and the one of `commit.ts` is not exported
|
|
32
|
+
* from this file. The move changed paths and no logic, so neither type
|
|
33
|
+
* was renamed, and the barrel coins no second name for the one it
|
|
34
|
+
* leaves out.
|
|
35
|
+
*
|
|
36
|
+
* Measured when the two moved: 138 files under `src/` imported
|
|
37
|
+
* `git.ts`, and 107 of them took its `GitRunner`. Eleven imported
|
|
38
|
+
* `commit.ts`, and one of those took its `GitRunner`:
|
|
39
|
+
* `commit.test.ts`, which moved with it and imports it directly. A
|
|
40
|
+
* caller outside `packages/rafa/src/core/` that stubs the commit runner types it
|
|
41
|
+
* through `CommitOptions['runGit']`, and `GitRunResult` is exported for
|
|
42
|
+
* what it answers.
|
|
43
|
+
*
|
|
44
|
+
* ## Why one barrel can hold both
|
|
45
|
+
*
|
|
46
|
+
* A barrel that groups a file with a file outside `packages/rafa/src/core/` that
|
|
47
|
+
* imports the barrel back by value is a runtime cycle. `commit.ts`
|
|
48
|
+
* imports `node:child_process` and no file. `git.ts` imports one file by
|
|
49
|
+
* value: `packages/rafa/src/core/config/config-sections.ts`, for `messageOf`. That
|
|
50
|
+
* file imports one file outside `packages/rafa/src/core/` by value,
|
|
51
|
+
* `packages/rafa/src/schema/tiers.ts`, and it does not reach this barrel.
|
|
52
|
+
*
|
|
53
|
+
* `src/pr/index.ts`, the `pr` subject's barrel, re-exports the four
|
|
54
|
+
* names of `git.ts` from this file, as it re-exported them from
|
|
55
|
+
* `git.ts` before the move. `config-sections.ts` imports
|
|
56
|
+
* `src/pr/types.ts` directly and not that barrel, which is why the edge
|
|
57
|
+
* closes nothing.
|
|
58
|
+
*
|
|
59
|
+
* Measured when the two moved: the value imports of the non-test files
|
|
60
|
+
* under `src/` and `packages/` held six cycles before the move and the
|
|
61
|
+
* same six after it, none through a file of this folder. The control,
|
|
62
|
+
* the same tree with `src/pr/types.ts` taking one value (`gitSaid`) from
|
|
63
|
+
* this barrel, held a seventh: that file, `config-sections.ts`, `git.ts`
|
|
64
|
+
* and this one. No load order of the control was run.
|
|
65
|
+
*
|
|
66
|
+
* `docs/survey/cluster-map.json` places `git.ts` and `commit.ts` in two
|
|
67
|
+
* clusters, and this file, which it does not name, lands by its folder
|
|
68
|
+
* in the cluster of `git.ts`. `src/tests/import-cycle.sweep.test.ts`
|
|
69
|
+
* reads cycles and this file is in none.
|
|
70
|
+
*
|
|
71
|
+
* ## What it exports
|
|
72
|
+
*
|
|
73
|
+
* Each name is spelled, types apart from values, as the other core
|
|
74
|
+
* barrels spell theirs. No name here is part of the published surface:
|
|
75
|
+
* `src/index.ts` re-exports nothing from this file.
|
|
76
|
+
*
|
|
77
|
+
* `index.test.ts` holds the list to the two files: every name either
|
|
78
|
+
* exports is here once, as the same binding, `GitRunner` as the type
|
|
79
|
+
* `git.ts` declares, and no other name is here.
|
|
80
|
+
*/
|
|
81
|
+
export type { GhResult, GhRunner } from './gh-runner.js';
|
|
82
|
+
export type { GitResult, GitRunner } from './git.js';
|
|
83
|
+
export type { CommitAttempt, CommitMessage, CommitOptions, CommitOutcome, CommitStep, CommitType, CommitTypeRule, DerivedSubject, GitRunResult, SubjectOptions, } from './commit.js';
|
|
84
|
+
export { createGitRunner, gitSaid } from './git.js';
|
|
85
|
+
export { buildCommitMessage, COMMIT_TYPE_RULES, commitArgs, commitTaskWork, DEFAULT_COMMIT_TYPE, deriveCommitSubject, FALLBACK_DESCRIPTION, firstClause, headShaArgs, inferCommitType, MAX_MESSAGE_CHARS, MAX_SUBJECT_LENGTH, normaliseTaskText, spawnGit, stageAllArgs, stagedChangesArgs, } from './commit.js';
|