@rt-tools/agent-kit 0.27.0 → 0.28.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/assets/checks/board-epic-plan.github.mjs +86 -0
- package/assets/checks/board-epics.github.mjs +12 -67
- package/assets/checks/board-pull-state.github.mjs +6 -11
- package/assets/checks/check-glossary.mjs +10 -2
- package/assets/checks/check-lib-layers.mjs +24 -1
- package/assets/checks/check-reuse.mjs +26 -2
- package/assets/checks/check-specs.mjs +8 -1
- package/assets/checks/lib-boundaries.mjs +2 -2
- package/assets/checks/lib-common.mjs +46 -0
- package/assets/checks/lib-manifests.mjs +18 -13
- package/assets/checks/rt-kit-checks.config.mjs +6 -0
- package/assets/checks/signals.mjs +39 -5
- package/assets/checks/spec-anchors.mjs +48 -4
- package/assets/checks/spec-common.mjs +40 -6
- package/assets/checks/spec-contract.mjs +33 -7
- package/assets/checks/spec-scenarios.mjs +24 -1
- package/assets/checks/task-new.github.mjs +9 -3
- package/assets/defaults/gate-map.sh +20 -5
- package/assets/defaults/project.sh +6 -0
- package/assets/hooks/dev-server-guard.sh +61 -32
- package/assets/hooks/exam-guard.sh +10 -10
- package/assets/hooks/git-guard-delivery-conflict.sh +53 -1
- package/assets/hooks/git-guard-delivery-draft.sh +7 -6
- package/assets/hooks/git-guard-delivery-tree.sh +50 -0
- package/assets/hooks/git-guard-delivery.sh +43 -23
- package/assets/hooks/git-guard-discard.sh +144 -0
- package/assets/hooks/git-guard-push-tests.sh +36 -16
- package/assets/hooks/reuse-first-guard.sh +29 -4
- package/assets/hooks/rule-source-guard.sh +17 -2
- package/assets/hooks/skill-gate.sh +7 -0
- package/assets/hooks/sql-guard-write.sh +18 -2
- package/assets/hooks/turn-exit-guard.sh +50 -66
- package/assets/hooks/turn-exit-patterns.sh +18 -1
- package/assets/hooks/turn-exit-verdict.sh +84 -0
- package/assets/laws/delivery.md +14 -6
- package/assets/laws/verifiability.md +22 -4
- package/assets/patterns/git-workflow-pr.github.md +39 -18
- package/assets/patterns/git-workflow-stack.md +21 -2
- package/assets/patterns/task-flow-close.md +65 -78
- package/assets/patterns/ts-procedure.md +6 -0
- package/assets/pitfalls/git-workflow.github.md +38 -0
- package/assets/pitfalls/task-flow.md +25 -23
- package/assets/rules/browser-verification.md +8 -0
- package/assets/rules/deploy-flow.github.md +6 -0
- package/assets/rules/doc-style.md +6 -0
- package/assets/rules/git-workflow.azure.md +10 -0
- package/assets/rules/git-workflow.github.md +119 -119
- package/assets/rules/git-workflow.gitlab.md +10 -0
- package/assets/rules/lib-layers.md +11 -0
- package/assets/rules/spec-driven.md +10 -1
- package/assets/rules/task-flow.md +59 -56
- package/assets/rules/testing.md +7 -0
- package/assets/rules/turn-conduct.md +23 -3
- package/assets/samples/tasks/_template/plan.md +4 -1
- package/assets/skills/agent-kit.md +17 -4
- package/bin/agent-kit.js +1 -1
- package/bin/agent-kit.js.map +1 -1
- package/lib/commands.d.ts +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +59 -2
- package/lib/commands.js.map +1 -1
- package/lib/hooks-map.d.ts +5 -0
- package/lib/hooks-map.d.ts.map +1 -1
- package/lib/hooks-map.js +9 -3
- package/lib/hooks-map.js.map +1 -1
- package/lib/plan.d.ts +2 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +8 -0
- package/lib/plan.js.map +1 -1
- package/lib/proposals.d.ts +25 -0
- package/lib/proposals.d.ts.map +1 -1
- package/lib/proposals.js +43 -1
- package/lib/proposals.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +8 -11
- package/lib/shipment.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.28.0.tgz +0 -0
- package/rt-tools-agent-kit-0.27.0.tgz +0 -0
|
@@ -59,8 +59,8 @@ The state is declared in the "Where we stand" section of the progress by the mac
|
|
|
59
59
|
| `этап-идёт` | a stage is begun | finish the stage and mark it in the progress | `task-flow-resume` |
|
|
60
60
|
| `этапы-кончились` | all stages are marked | merge the agreement, bring texts up to date, run the suite | `task-flow-close` |
|
|
61
61
|
| `разбор-кончился` | the suite is green, texts are up to date | take the folder apart by the last commit | `task-flow-archive` |
|
|
62
|
-
| `папка-разобрана` | no folder in the branch, a record in the archive | open the PR
|
|
63
|
-
| `работа-отдана` | the PR is open
|
|
62
|
+
| `папка-разобрана` | no folder in the branch, a record in the archive | open the PR: a draft where a run is waited for, ready where the pipeline does not wake | `task-flow-close` |
|
|
63
|
+
| `работа-отдана` | the PR is open into the epic branch, with a reviewer | take the next task of the epic | `task-flow-resume` |
|
|
64
64
|
| `влито` | the PR merged by a person | rules review of the work and the work queue audit | `task-flow-archive` |
|
|
65
65
|
| `задачи-эпика-кончились` | every task of the epic is merged and its folder taken apart | open the PR of the epic into the main branch | `task-flow-close` |
|
|
66
66
|
|
|
@@ -107,13 +107,13 @@ flowchart TD
|
|
|
107
107
|
I -->|Stages are over| T[The agreement merges into the domain spec, texts are brought up to what was done, then the suite runs]
|
|
108
108
|
T --> N[The task folder is taken apart by the last commit: the grill — to the archive, findings — to the epic plan, the plan — away]
|
|
109
109
|
N --> S[Work queue audit]
|
|
110
|
-
S --> K[The PR opens
|
|
110
|
+
S --> K[The PR opens; the executor names the number, what it waits for and what comes next]
|
|
111
111
|
K --> W[The rules review of the closed work goes to the background, findings land on disk]
|
|
112
112
|
W --> L[While the PR waits for review, the next task is taken]
|
|
113
113
|
L --> M{Review and run are over}
|
|
114
114
|
M -->|Red run or remarks| V[Fixed in the same branch: the plan is gone from disk, the guard takes the sign of work from the branch history]
|
|
115
115
|
V --> M
|
|
116
|
-
M -->|Green and no remarks| O[The draft is lifted
|
|
116
|
+
M -->|Green and no remarks| O[The draft, if there was one, is lifted; a person presses merge into the epic branch]
|
|
117
117
|
O --> P{Tasks of the epic are left}
|
|
118
118
|
P -->|Yes| G
|
|
119
119
|
P -->|No| Q[The PR of the epic into the main branch opens: every folder is taken apart]
|
|
@@ -122,23 +122,22 @@ flowchart TD
|
|
|
122
122
|
## How the law applies here
|
|
123
123
|
- **Editing application code is refused until the work has reached a state in which code is
|
|
124
124
|
edited.** The guard demands three things: a task folder by branch name, a plan in it and a
|
|
125
|
-
declared state. The
|
|
125
|
+
declared state. The agreement has a guard of its own on the same events.
|
|
126
126
|
- **The guard judges the declared transition, not the presence of files.** An empty plan lies the
|
|
127
127
|
same as a written one, so the refusal is lifted by the declared state — `этап-идёт`,
|
|
128
128
|
`этапы-кончились`, `разбор-кончился`. The fourth road is the branch history: a folder taken apart
|
|
129
|
-
|
|
130
|
-
- **A state line moved forward is the same declaration of intent, only machine-readable.**
|
|
131
|
-
|
|
132
|
-
- **A refusal by state names the mandatory action of
|
|
133
|
-
|
|
129
|
+
means handed-in work.
|
|
130
|
+
- **A state line moved forward is the same declaration of intent, only machine-readable.** It is
|
|
131
|
+
declared by the turn in which its mandatory action is begun by deed.
|
|
132
|
+
- **A refusal by state names the mandatory action of that state.** Hearing only "wrong state", the
|
|
133
|
+
executor rewrites the state line instead of the step.
|
|
134
134
|
- **Only a word from the list counts as a state name.** A word of one's own says nothing about the
|
|
135
135
|
entry, the exit or the action.
|
|
136
|
-
- **Two requirements — two guards, and one can be lifted without losing the other.**
|
|
137
|
-
|
|
138
|
-
code-editing state.
|
|
136
|
+
- **Two requirements — two guards, and one can be lifted without losing the other.** A line about
|
|
137
|
+
unchanged behaviour lifts the agreement, not the requirement to reach the code-editing state.
|
|
139
138
|
- **A merged agreement does not lock the branch.** After the merge the "proposed" directory is gone
|
|
140
|
-
from disk
|
|
141
|
-
|
|
139
|
+
from disk while the plan refers to it to the end: the guard tells merged from never-created by the
|
|
140
|
+
branch history.
|
|
142
141
|
- **The agreement is required by the edit paths, not by an appraisal of the task.** `apps/**` and
|
|
143
142
|
`libs/**` are the sign; rules, texts, tooling and dependencies fall outside it. The bypass is the
|
|
144
143
|
line `**Behaviour:** unchanged — <the reason of the owner>` in the plan; an empty reason is not
|
|
@@ -158,31 +157,33 @@ flowchart TD
|
|
|
158
157
|
- **An instruction to work by the progress covers all its steps, including those that change
|
|
159
158
|
history.** Questions are asked about what the progress lacks.
|
|
160
159
|
- **A question written by a past session does not become a question to the owner.** It is addressed
|
|
161
|
-
to the handover's author, and some
|
|
160
|
+
to the handover's author, and some are closed by a work step.
|
|
162
161
|
- **The owner's instruction holds until they cancel it, and a new fact against it is a line in the
|
|
163
162
|
reply about the cost, not a new question.** Re-asked is what the instruction does not cover. A
|
|
164
163
|
menu where two options of three offer to cancel the owner's decision is that very cancellation.
|
|
165
164
|
- **An answer in the owner's message counts the same as an answer in a document.** A question
|
|
166
|
-
already answered in the conversation is not asked
|
|
165
|
+
already answered in the conversation is not asked again.
|
|
167
166
|
- **The owner's word about the design is a task setting, not a decision.** What they named is
|
|
168
167
|
usually already in the tree under that word — a name on a screen, a spec section, a model field —
|
|
169
168
|
and is checked against them before the edit. Diverged — the owner is asked.
|
|
170
169
|
- **A task folder is created for any work, no exceptions.** An exception with even one lawful form
|
|
171
|
-
is executed as permission. It
|
|
170
|
+
is executed as permission. It goes in before the first edit.
|
|
172
171
|
- **The task folder goes into the branch by a commit, not lives in one working tree.** Uncommitted,
|
|
173
172
|
it passes edits without refusal, and the refusal comes at the end, when the plan is already gone.
|
|
174
173
|
Outside history one draft without a number is lawful.
|
|
175
174
|
- **The task folder is taken apart by the last commit before the PR opens, not after approval.** A
|
|
176
175
|
person merges as soon as they see green, and no room is left for a closing commit.
|
|
177
176
|
- **After opening the PR, the executor tells the owner the number, what it waits for and what comes
|
|
178
|
-
next.**
|
|
179
|
-
nothing about the locked merge button.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
next.** A draft waits for the run, and next it is lifted: a green run says nothing is broken and
|
|
178
|
+
nothing about the locked merge button. A PR opened ready waits for the owner's hand, and that is
|
|
179
|
+
said in the same words.
|
|
180
|
+
- **A request to merge never comes before the work is checked.** Where the pipeline wakes for this
|
|
181
|
+
base: folder taken apart and pushed → PR as a draft → run green → draft lifted → the request to
|
|
182
|
+
merge, naming the number. Where it does not wake, the green push gate is the check, and opening
|
|
183
|
+
the PR and asking to merge are one turn.
|
|
184
|
+
- **A PR that waits for a run opens as a draft, and one that waits for nothing opens ready.** Before
|
|
185
|
+
it opens the owner sees no edits, and an open PR reads as an invitation to merge. Which of the two
|
|
186
|
+
applies is decided by the bases the pipeline wakes for, and that is read from its file.
|
|
186
187
|
- **The plan guard is the lower bound of the requirement, not its limit.** It demands a folder only
|
|
187
188
|
for an edit of application code; the article above — for any work.
|
|
188
189
|
- **An instruction to work by a rule is an instruction to do its steps, including those that change
|
|
@@ -190,13 +191,22 @@ flowchart TD
|
|
|
190
191
|
- **A taken task does not end a turn.** Creating the task, the branch, the column and the folder is
|
|
191
192
|
preparation: the work moves to the written-plan state, where the action is different. The
|
|
192
193
|
turn-exit guard names the first stage in its refusal.
|
|
194
|
+
- **The stages of a plan cover its done-sign whole.** A sign written wider than the sum of the
|
|
195
|
+
stages means a part of the order is given to no step at all: every stage closes, the run is
|
|
196
|
+
green, and half the order is not done. Either the stages are written up to the sign, or the sign
|
|
197
|
+
is narrowed to what the stages give.
|
|
198
|
+
- **A stage's readiness sign is taken from the output of a command run while the plan is written.**
|
|
199
|
+
Written by a guess, it is checked at the stage itself — latest of everything that depended on it.
|
|
200
|
+
Some lines come not from the work but from an unconfigured tree, and no stage puts them out.
|
|
201
|
+
- **A plan for work that ports a technique from outside is written by a measurement of one's own
|
|
202
|
+
code.** Reading the sample says how the sample is built; what of it is needed here is said by a
|
|
203
|
+
count over one's own files.
|
|
193
204
|
- **Waiting for one part of a stage is never a stop of the stage.** The parts independent of what is
|
|
194
205
|
awaited are done in the same turn; the owner is told what is done and what is left for their step.
|
|
195
206
|
A refused command reads the same: everything else is done first.
|
|
196
207
|
- **A finding made mid-stage is checked against the plan's exit conditions before the first edit.**
|
|
197
|
-
Nearness of subject proves no belonging
|
|
198
|
-
|
|
199
|
-
does not do, and is filed as a task.
|
|
208
|
+
Nearness of subject proves no belonging. A finding named by no exit condition goes to the section
|
|
209
|
+
on what the work does not do, and is filed as a task.
|
|
200
210
|
- **Done work is marked only in the progress.** "Where we stand" is rewritten by every session, not
|
|
201
211
|
appended: it is the first thing the next session reads.
|
|
202
212
|
- **A word for a new notion is looked up in the tree's glossary.** The package carries the common
|
|
@@ -209,29 +219,25 @@ flowchart TD
|
|
|
209
219
|
- **Work ordered in words becomes a task in the queue in the same turn.** Even if it will not be
|
|
210
220
|
done now. A draft folder is not the queue: it has no number, and one session knows of it.
|
|
211
221
|
Postponed work names a date; postponed silently, it reads as done.
|
|
212
|
-
- **Work begins with the epic, and a task outside one is not taken.**
|
|
213
|
-
|
|
214
|
-
|
|
222
|
+
- **Work begins with the epic, and a task outside one is not taken.** The epic names what the whole
|
|
223
|
+
is, and the main branch takes that whole or does not take it. Work outside an epic exists only by
|
|
224
|
+
the owner's word about that work, said about that work.
|
|
215
225
|
- **The epic branch is taken before the first task of the epic, not with it.** Taken later, it
|
|
216
226
|
leaves the first task standing on the main branch, and the epic starts as half of itself already
|
|
217
227
|
merged.
|
|
218
|
-
- **The next task is taken from the epic plan, and the
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
checked only together with a command and its output.
|
|
228
|
+
- **The next task is taken from the epic plan, and the queue list is asked only where there is no
|
|
229
|
+
epic.** By a list of numbers someone else's epic cannot be told from one's own.
|
|
230
|
+
- **An epic is not closed by a sign confirmed by reading alone.** What is checkable by eye is
|
|
231
|
+
called checked only with a command and its output.
|
|
223
232
|
- **The tasks of an epic are created all at once, by the same turn as the epic itself.** Creating
|
|
224
|
-
them one at a time hides the volume.
|
|
233
|
+
them one at a time hides the volume.
|
|
225
234
|
- **A task of an epic is linked to the epic card as a sub-issue, not only named in the plan.** The
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
hand from the list of open cards. Closed tasks are linked too — the share counts them.
|
|
235
|
+
board reads no text: without the link a task of an epic looks exactly like a task outside one.
|
|
236
|
+
Closed tasks are linked too — the share of what is done counts them.
|
|
229
237
|
|
|
230
238
|
- **The epic plan names how the branches of its tasks stand, on a par with their order.** Two
|
|
231
|
-
arrangements
|
|
232
|
-
|
|
233
|
-
listed in the cold part; the arrangement written in the plan is the epic's decision, not that of
|
|
234
|
-
whoever creates the branch.
|
|
239
|
+
arrangements: each branch from the epic branch, or a stack — each from the previous. The
|
|
240
|
+
arrangement written in the plan is the epic's decision, not that of whoever creates the branch.
|
|
235
241
|
- **The PR of the epic opens when its last folder is taken apart, and not a task earlier.** A folder
|
|
236
242
|
left in the epic branch reaches the main branch with it: what one branch needed becomes the tree's
|
|
237
243
|
for good. Until then the epic branch is not offered to a person at all — the merge button on it
|
|
@@ -240,22 +246,19 @@ flowchart TD
|
|
|
240
246
|
not hold the task order, and the task folder would hold it only until the first merge; the
|
|
241
247
|
directory — in the rule's companion. What the owner names along the way is appended there by the
|
|
242
248
|
turn that accepted it.
|
|
243
|
-
- **Building by a sample begins with reading the sample itself
|
|
244
|
-
|
|
245
|
-
the directories.
|
|
249
|
+
- **Building by a sample begins with reading the sample itself.** The repeated part is opened whole,
|
|
250
|
+
by walking the directories.
|
|
246
251
|
- **What acts on the tree, not on the edit, lies outside the index.** The path to the sample and the
|
|
247
252
|
permission to work outside the epic do not belong to the branch and live next to the handover. A
|
|
248
253
|
number in the permitted list repeats the owner's word, not replaces it.
|
|
249
|
-
- **Closed work is reviewed by the rules
|
|
250
|
-
|
|
251
|
-
with an edit of the rules layer or a proposal outward.
|
|
254
|
+
- **Closed work is reviewed by the rules as a closing step, not as a separate request.** What was
|
|
255
|
+
loaded and what was missing is seen only by the session that led the work.
|
|
252
256
|
- **The review of closed work goes to the background, and the executor takes the next task.** The
|
|
253
257
|
role works in a turn of its own; the digest is gathered before the launch, the findings are
|
|
254
258
|
accepted in one turn.
|
|
255
259
|
- **The review's findings wait for the owner, and only the digest of observations leaves for the
|
|
256
|
-
package.** A proposal
|
|
257
|
-
|
|
258
|
-
never an opinion.
|
|
260
|
+
package.** A proposal sent unreviewed becomes the work of someone who did not order it. The digest
|
|
261
|
+
is always sent: it says what was used and is never an opinion.
|
|
259
262
|
- **The cheap closing step goes before the costly one, and the run — after the merge.** Merging the
|
|
260
263
|
agreement and bringing the texts up to date cost minutes, the run costs the session window; a run
|
|
261
264
|
before the merge checks what will not reach main.
|
|
@@ -267,8 +270,8 @@ flowchart TD
|
|
|
267
270
|
- **Opening the PR and lifting the draft are refused while the branch carries its task folder.** A
|
|
268
271
|
person presses merge on the host, where there are no guards: a lifted draft reads to them as an
|
|
269
272
|
invitation. The branch content is judged, not the working tree.
|
|
270
|
-
- **A branch that removed the folder
|
|
271
|
-
|
|
273
|
+
- **A branch that removed the folder adds a record to the archive.** Removing is cheaper than taking
|
|
274
|
+
apart, and the grill leaves first — the only record of the owner's words.
|
|
272
275
|
- **The bypass is the line `Task-folder-skip: <reason>` in the PR or in the command itself.** An
|
|
273
276
|
empty reason is no bypass, and the bypass lifts the refusal but does not silence the work queue
|
|
274
277
|
audit line.
|
package/assets/rules/testing.md
CHANGED
|
@@ -181,6 +181,13 @@ flowchart TD
|
|
|
181
181
|
apart by the run's colour. So a negative assertion goes paired with a positive one: first it is
|
|
182
182
|
checked that the place sought is found at all, and only then that it lacks what must not be
|
|
183
183
|
there.
|
|
184
|
+
- **A count taken over a run's output says nothing until the run is known to have reached the step
|
|
185
|
+
counted.** A build, an install and a suite refuse at preparation steps of their own —
|
|
186
|
+
configuration parsing, dependency resolution, path resolution — and such a refusal carries the
|
|
187
|
+
same exit code as a failure of the work itself. A pattern search for the failure's own marks comes
|
|
188
|
+
back empty there, and the emptiness reads as success of everything behind it. So the count goes
|
|
189
|
+
paired with a positive check, the same way a negative assertion does: first the output is read for
|
|
190
|
+
the sign that the counted step ran at all, and only then the marks in it are counted.
|
|
184
191
|
- **A test title promises more than the body checks, and the audit does not see it.** The
|
|
185
192
|
scenario number stands in the title — the scenario counts as covered, and nobody asks what
|
|
186
193
|
exactly is asserted. The body is read together with the title: the promise in the title and the
|
|
@@ -27,9 +27,17 @@ demand, not with the rule.
|
|
|
27
27
|
|
|
28
28
|
## Turn exits
|
|
29
29
|
|
|
30
|
-
A turn ends in four ways and no others: a question to the owner the rules do not answer
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
A turn ends in four ways and no others: a question to the owner the rules do not answer **and no
|
|
31
|
+
task in the work queue that can be taken without waiting for the answer**; a guard's refusal; a
|
|
32
|
+
filled window where there is no compaction; work handed in, with the next begun. What confirms
|
|
33
|
+
each, the turn map lists where the tree laid it out.
|
|
34
|
+
|
|
35
|
+
The queue is asked by a command in the same turn, and its output stands in the turn itself: "there
|
|
36
|
+
are no tasks" is a statement about the tree, and the executor's memory does not confirm it. A turn
|
|
37
|
+
where the owner's answer holds one piece of work while an independent one lies next to it ends
|
|
38
|
+
with the work taken, and the question goes in a line beside it. The price is measured not in turns
|
|
39
|
+
but in days: a session stood a night and a morning naming the owner one and the same step while
|
|
40
|
+
three independent tasks lay untaken.
|
|
33
41
|
|
|
34
42
|
Everything else is the turn going on, not its end. A milestone does not end a turn: not a commit,
|
|
35
43
|
not a read agreement, not the boundary "read — now editing", not a green check.
|
|
@@ -75,6 +83,18 @@ flowchart TD
|
|
|
75
83
|
|
|
76
84
|
## How the law applies here
|
|
77
85
|
|
|
86
|
+
- **A promise to do the work in the next turn is an announcement of intent.** It differs from a
|
|
87
|
+
command named and not run only in that it sounds politer and is therefore recognised as
|
|
88
|
+
a stop less often. An offer to the owner to object to the announced intent is part of the
|
|
89
|
+
promise, not a question: a turn ends with a question when the work does not go without the
|
|
90
|
+
answer, and here it went.
|
|
91
|
+
- **An order named by a number or by the word "all" is counted aloud before the turn ends.** The reply carries the count — how many out of how many. A turn where the count did
|
|
92
|
+
not add up does not end: it goes on with the next item of the order. How many items the order
|
|
93
|
+
holds is written nowhere in the tree — only whoever read the order knows it.
|
|
94
|
+
- **The owner's word to work without stops holds until they cancel it themselves.** A turn ending
|
|
95
|
+
with waiting for that same word invents the cancellation. A new fact against the instruction is a
|
|
96
|
+
line about the price in the reply, not waiting; a decision the tree does not hold is asked as a
|
|
97
|
+
question by the tool.
|
|
78
98
|
- **A summary of someone else's step.** A run, the owner's review and a merge go on without the
|
|
79
99
|
executor and are not sped up by watching. Such a summary the owner reads as work: full, with
|
|
80
100
|
numbers and states, the emptiness behind it unseen. Someone else's step is named with one's own
|
|
@@ -40,7 +40,10 @@ what is named here is read twice — before the work and after it.>
|
|
|
40
40
|
|
|
41
41
|
The command is written in backticks: the turn exit guard reads it and does not let out a turn in
|
|
42
42
|
which the stage is declared closed and the command was not run. An acceptance written in prose
|
|
43
|
-
cannot be confirmed by anything.
|
|
43
|
+
cannot be confirmed by anything. The command is run right here, while the plan is written, not at
|
|
44
|
+
the end of the stage: its output is what names the readiness sign. A sign written by a guess is
|
|
45
|
+
sometimes impossible to meet — the line the stage must put out comes from an unconfigured tree
|
|
46
|
+
rather than from the work — and that is found out latest of everything that depended on it.
|
|
44
47
|
|
|
45
48
|
## What this work does not do
|
|
46
49
|
|
|
@@ -49,6 +49,10 @@ layout is worse than a whole one. Either the override here or the resource itsel
|
|
|
49
49
|
and that is the work of the tree where the package lives as sources; nothing is said about it
|
|
50
50
|
here.
|
|
51
51
|
|
|
52
|
+
**A file whose body matches the package is never a refusal.** The header alone diverged from the
|
|
53
|
+
body — the layout puts it again and says the header went stale. The word "edited by hand" stays
|
|
54
|
+
for a file whose body differs, and it sends the reader looking for an edit that is there.
|
|
55
|
+
|
|
52
56
|
**A layout is an edit of the tree, not a service call:** it rewrites hundreds of tracked files at
|
|
53
57
|
once, so the work is set up before `sync`, by the same rules as any other.
|
|
54
58
|
|
|
@@ -58,9 +62,14 @@ push gate: an edition bumped without a layout turns the main branch red and lock
|
|
|
58
62
|
**The layout puts the hook declaration together with the hook itself.** A hook is called by an
|
|
59
63
|
entry in the agent settings, and one laid out without it is indistinguishable from the outside
|
|
60
64
|
from a working one. The layout appends an entry for every event missing from the settings and
|
|
61
|
-
reports it. The edit only adds: entries are neither rewritten nor removed,
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
reports it. The edit only adds: entries are neither rewritten nor removed, and settings that
|
|
66
|
+
cannot be parsed as JSON the package does not touch — it prints a ready-made piece to enter by
|
|
67
|
+
hand.
|
|
68
|
+
|
|
69
|
+
**An entry is written only for the dispatcher that lies on disk.** A tree that did not take it
|
|
70
|
+
used to get settings calling a file that is not there — and such settings look working from the
|
|
71
|
+
outside. The layout holds no list of what the tree removed, so a hand-removed entry comes back on
|
|
72
|
+
the next layout: it is removed together with the dispatcher, not on its own.
|
|
64
73
|
|
|
65
74
|
**This is held by the edit-location guard, not by memory.** It refuses an edit of a file with the
|
|
66
75
|
layout header at the minute of the edit and names the address: the source, if the tree holds
|
|
@@ -77,6 +86,7 @@ the size of what would be wiped. Appending at the end and editing in place pass.
|
|
|
77
86
|
|
|
78
87
|
```bash
|
|
79
88
|
npx agent-kit doctor # what is laid out, what lags, what lies from a dropped resource
|
|
89
|
+
npx agent-kit doctor --since <path> # the same, plus what a new edition added into a replaced section
|
|
80
90
|
npx agent-kit sync # lay out
|
|
81
91
|
npx agent-kit sync --check # write nothing, refuse on a divergence
|
|
82
92
|
npx agent-kit stats # what was used, what never, what people stumbled on
|
|
@@ -122,7 +132,10 @@ So the bump takes three steps, and the first goes before the installation.
|
|
|
122
132
|
"resource · heading". Each is read in the snapshot and in the new edition: what the package
|
|
123
133
|
added is added to the override by hand.
|
|
124
134
|
|
|
125
|
-
|
|
135
|
+
The snapshot is given to the state review as an argument — `agent-kit doctor --since <path to the
|
|
136
|
+
snapshot>` — and it names the articles the new edition added inside a replaced section: the
|
|
137
|
+
resource, the heading and the opening of the article. Without the argument the review is as
|
|
138
|
+
before.
|
|
126
139
|
|
|
127
140
|
For every named section the articles are compared, not the headings: the heading is exactly
|
|
128
141
|
what matched, that is what replaced the section. A ready-made pair of commands is in the cold
|
package/bin/agent-kit.js
CHANGED
|
@@ -317,7 +317,7 @@ const COMMANDS = {
|
|
|
317
317
|
propose: runPropose,
|
|
318
318
|
fate: runFate,
|
|
319
319
|
enroll: runEnroll,
|
|
320
|
-
doctor: (env) => doctor(env),
|
|
320
|
+
doctor: (env, argv) => doctor(env, optionOf(argv, '--since', '')),
|
|
321
321
|
adopt: (env, argv) => adopt(env, argv.slice(1).filter((value) => !value.startsWith('--') && value !== optionOf(argv, '--root', ''))),
|
|
322
322
|
};
|
|
323
323
|
export async function main(argv) {
|
package/bin/agent-kit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-kit.js","sourceRoot":"","sources":["../../../projects/agent-kit/src/bin/agent-kit.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAmB,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAgB,IAAI,EAAqB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAW,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,EAAS,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,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4B,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEtG,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,wBAAwB,OAAO,GAAG,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAClH,CAAC;IAED,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,OAAO,GAAsB,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/B,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Точка входа. Разбирает аргументы, добывает выбор проекта, зовёт команду и печатает то, что\n * она вернула. Своей работы у неё нет: всё, что решает, живёт в `commands.ts` и проверяется\n * спеками — кроме одного, чего команде знать не по чину: откуда взялся выбор законов. У строки\n * запуска это флаг, у терминала — вопрос, у прогона без терминала нет ни того ни другого.\n */\nimport { execFileSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport process from 'node:process';\n\nimport { unknownFlagsIn } from '../lib/argv.js';\nimport { IEntryOfCatalog, readCatalog, resolveSelection } from '../lib/catalog.js';\nimport { adopt, doctor, IEnvironment, init, IOutcomeOfCommand, list, stats, sync } from '../lib/commands.js';\nimport { CONFIG_PATH, IConfig, readConfig } from '../lib/config.js';\nimport { costLines, costOf, CostUnavailableError, ICost } from '../lib/cost.js';\nimport { enroll, httpEnroll } from '../lib/enroll.js';\nimport { httpReadOwn, httpShip } from '../lib/ship.js';\nimport { fate } from '../lib/fate.js';\nimport { propose, treeSlugOf } from '../lib/shipment.js';\nimport { DEFAULT_DAYS } from '../lib/observations.js';\nimport { staleBuild } from '../lib/freshness.js';\nimport { packageRootFrom } from '../lib/package-root.js';\nimport { IChoice } from '../lib/picker.js';\nimport { IAxis, IOptionOfAxis, readAxes } from '../lib/variants.js';\nimport { ask, askOne, canAsk } from './prompt.js';\n\nconst USAGE: readonly string[] = [\n 'agent-kit <команда>',\n '',\n ' init завести .claude/rt-kit.json и каталог надстроек',\n ' list что везёт пакет и что из этого взято здесь',\n ' sync разложить ресурсы пакета в дерево проекта',\n ' sync --check ничего не писать, отказать при расхождении — для гейта пуша',\n ' doctor рассказать о состоянии раскладки, ничего не меняя',\n ' cost посчитать цену контекста: вход в работу, одно правило, весь слой',\n ' cost --rule <имя> какое правило взвесить; без довода берётся самое тяжёлое',\n ' cost --json то же машиночитаемо — этим числа кладут в замысел',\n ' stats свести наблюдения: чем пользовались, чем ни разу, обо что спотыкались',\n ' stats --days N за сколько дней; без довода — за три',\n ' stats --json то же машиночитаемо — этим сводку прикладывают к предложению',\n ' propose отправить груз в приём: сводку со снимком надстроек, предложения и разборы',\n ' fate судьба своих записей в приёме и надстройки, которые пора снять',\n ' propose --dry-run показать, что уехало бы, и ничего не отправлять',\n ' adopt [файлы] отдать пакету файлы, лежащие на его путях не от него',\n ' enroll --code <код> завести дерево по приглашению владельца: обмен кода на токен',\n ' enroll --token <токен> завести дерево токеном, выданным в админке приёма; в сеть не идёт',\n ' enroll --force перезаписать уже лежащий токен намеренно',\n '',\n ' --root <путь> корень проекта; по умолчанию текущий каталог',\n '',\n 'Выбор законов при `init`:',\n '',\n ' --all взять все законы, ни о чём не спрашивая',\n ' --laws a,b,c взять только названные; имена — из `agent-kit list`',\n ' без обоих спросить галочками; без терминала — отказ',\n '',\n 'Вид ресурсов при `init` — там, где один закон исполняется разными командами:',\n '',\n ' --<ось> <вид> например `--host gitlab`; оси и виды — из `agent-kit list`',\n ' без флага спросить; без терминала — отказ, кроме `--all`',\n];\n\n/**\n * Доводы отправки. Довод со значением помечен `<>`: за ним идёт отдельным словом путь, и без\n * пометки этот путь читался бы как ещё один незнакомый довод.\n */\nconst PROPOSE_FLAGS: readonly string[] = ['--dry-run', '--root <>'];\n\n/** Что печатает отказ на незнакомом доводе: режимы команды, а не весь свод. */\nconst PROPOSE_USAGE: readonly string[] = [\n ' propose отправить груз в приём',\n ' propose --dry-run показать, что уехало бы, и ничего не отправлять',\n ' --root <путь> корень проекта; по умолчанию текущий каталог',\n];\n\n/**\n * Единственное место, где пакет узнаёт собственное расположение. `import.meta` живёт только\n * здесь: библиотечные модули получают каталог ресурсов входным значением, и трансформ тестов,\n * разбирающий модули как CommonJS, на них уже не спотыкается.\n */\nfunction environmentOf(root: string): IEnvironment {\n const pkg: string = packageRootFrom(dirname(fileURLToPath(import.meta.url)));\n const manifest: { name: string; version: string } = JSON.parse(readFileSync(join(pkg, 'package.json'), 'utf8')) as {\n name: string;\n version: string;\n };\n\n return {\n root,\n version: manifest.version,\n // Имя из манифеста, а не записанное здесь: по нему пакет ищет себя в зависимостях дерева,\n // и своя копия имени разошлась бы с манифестом молча — у всякого, кто пакет переименовал.\n name: manifest.name,\n assetsDir: join(pkg, 'assets'),\n // Сверка со своими исходниками возможна только отсюда: здесь пакет знает, где лежит сам.\n // У потребителя исходников рядом нет, и сверка молчит.\n stale: staleBuild(pkg, manifest.name),\n };\n}\n\n/** Вывод git в этом дереве. Отказ и пустота здесь одно и то же: адреса нет — и это не отказ. */\nfunction gitSays(root: string, args: readonly string[]): string {\n try {\n // eslint-disable-next-line sonarjs/no-os-command-from-path -- путь к git у каждой машины свой, и прибитый здесь сделал бы пакет непереносимым\n return execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();\n } catch {\n return '';\n }\n}\n\n/** Имена удалённых репозиториев этого дерева, по одному в строке. */\nfunction remoteNames(root: string): readonly string[] {\n return gitSays(root, ['remote'])\n .split('\\n')\n .map((name: string): string => name.trim())\n .filter(Boolean);\n}\n\n/**\n * Чем это дерево себя выдаёт снаружи. Нет удалённого репозитория — нечем, и это не отказ.\n *\n * Имя `origin` — соглашение, а не устройство: рабочая копия, назвавшая свои remotes по хостам,\n * на которые смотрит, оставалась без адреса вовсе, и отправка отказывала словами «удалённого\n * репозитория нет» — при том что репозиторий у неё есть, и не один. Порядок поэтому такой:\n * `origin`, если он есть; ровно один remote — он; несколько без `origin` — адреса нет, и выбор\n * за человеком. Угадать здесь нельзя: угаданное неверно сливает в сводке приёма два дерева в\n * одно, а увидеть это нечем.\n */\nfunction remoteOf(root: string): string {\n const names: readonly string[] = remoteNames(root);\n\n if (names.includes('origin')) {\n return gitSays(root, ['remote', 'get-url', 'origin']);\n }\n\n return names.length === 1 ? gitSays(root, ['remote', 'get-url', names[0]]) : '';\n}\n\nfunction optionOf(argv: readonly string[], name: string, fallback: string): string {\n const index: number = argv.indexOf(name);\n\n return index >= 0 && argv[index + 1] ? argv[index + 1] : fallback;\n}\n\nconst isOutcome: (value: unknown) => value is IOutcomeOfCommand = (value: unknown): value is IOutcomeOfCommand =>\n typeof value === 'object' && value !== null && 'code' in value;\n\n/**\n * Выбор законов для `init`: список идентификаторов, `null` на брошенном выборе или готовый\n * отказ. Пустой список означает «взять всё», поэтому брошенный выбор отличается от него не\n * значением, а `null`: подставить «всё» вместо неотвеченного вопроса значило бы разложить\n * пятнадцать законов тому, кто как раз просил спросить.\n */\nasync function selectionFor(argv: readonly string[], assetsDir: string): Promise<readonly string[] | null | IOutcomeOfCommand> {\n if (argv.includes('--all')) {\n return [];\n }\n\n const catalog: readonly IEntryOfCatalog[] = readCatalog(assetsDir);\n const spoken: string = optionOf(argv, '--laws', '');\n\n if (spoken) {\n const named: string[] = spoken\n .split(',')\n .map((name: string): string => name.trim())\n .filter(Boolean);\n const { ids, unknown } = resolveSelection(named, 'laws', catalog);\n\n return unknown.length\n ? { code: 1, lines: [`таких законов пакет не везёт: ${unknown.join(', ')}`, 'что везёт — `agent-kit list`'] }\n : ids;\n }\n\n if (!canAsk()) {\n return {\n code: 1,\n lines: [\n 'спросить некого: запуск без терминала',\n 'назови законы флагом `--laws a,b,c` или возьми все флагом `--all`',\n 'что везёт пакет — `agent-kit list`',\n ],\n };\n }\n\n const choices: readonly IChoice[] = catalog\n .filter((entry: IEntryOfCatalog): boolean => entry.kind === 'laws')\n .map((entry: IEntryOfCatalog): IChoice => ({ id: entry.id, name: entry.name, title: entry.title }));\n\n return ask(choices, 'Какие законы разложить в этом проекте?');\n}\n\n/**\n * Виды для `init` по осям, объявленным пакетом: что взято из флага, что спрошено.\n *\n * `--all` берёт первый объявленный вид оси и **говорит об этом**: в CI спрашивать некого, а\n * отказ там означал бы, что пакет нельзя разложить без человека. Первый вид — умолчание, а не\n * догадка: порядок в объявлении оси и есть порядок предпочтения.\n */\nasync function variantOfAxis(axis: IAxis, argv: readonly string[]): Promise<string | null | IOutcomeOfCommand> {\n const spoken: string = optionOf(argv, `--${axis.name}`, '');\n const values: readonly string[] = axis.options.map((option: IOptionOfAxis): string => option.value);\n\n if (spoken) {\n return values.includes(spoken)\n ? spoken\n : {\n code: 1,\n lines: [`такого вида по оси «${axis.name}» пакет не везёт: ${spoken}`, `есть: ${values.join(', ')}`],\n };\n }\n\n if (argv.includes('--all')) {\n return axis.options[0]?.value ?? '';\n }\n\n if (!canAsk()) {\n return {\n code: 1,\n lines: ['спросить некого: запуск без терминала', `назови вид флагом \\`--${axis.name} <вид>\\`: ${values.join(', ')}`],\n };\n }\n\n return askOne(\n axis.options.map((option: IOptionOfAxis): IChoice => ({ id: option.value, name: option.value, title: option.title })),\n axis.question\n );\n}\n\nasync function variantsFor(argv: readonly string[], assetsDir: string): Promise<Record<string, string> | null | IOutcomeOfCommand> {\n const axes: readonly IAxis[] = readAxes(assetsDir);\n const chosen: Record<string, string> = {};\n\n for (const axis of axes) {\n const answer: string | null | IOutcomeOfCommand = await variantOfAxis(axis, argv);\n\n if (isOutcome(answer)) {\n return answer;\n }\n\n if (answer === null) {\n return null;\n }\n\n chosen[axis.name] = answer;\n }\n\n return chosen;\n}\n\n/** Заведение настройки: выбор ресурсов и видов, брошенный выбор ничего не пишет. */\nasync function runInit(env: IEnvironment, argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const selection: readonly string[] | null | IOutcomeOfCommand = await selectionFor(argv, env.assetsDir);\n if (isOutcome(selection)) {\n return selection;\n }\n if (selection === null) {\n return { code: 1, lines: ['выбор брошен — ничего не заведено'] };\n }\n\n const variants: Record<string, string> | null | IOutcomeOfCommand = await variantsFor(argv, env.assetsDir);\n if (isOutcome(variants)) {\n return variants;\n }\n\n return variants === null\n ? { code: 1, lines: ['выбор брошен — ничего не заведено'] }\n : init(env.root, selection, variants, env.assetsDir);\n}\n\n/**\n * Цена контекста: три веса и то, чем они сняты.\n *\n * Отказ печатается тем же выводом, а не броском: команду зовут глазами, и трассировка стека\n * говорит ей читателю меньше, чем строка о том, чего в дереве нет.\n */\nfunction runCost(env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand {\n const named: string = optionOf(argv, '--rule', '');\n let cost: ICost;\n try {\n cost = costOf(env.root, named === '' ? null : named);\n } catch (failure: unknown) {\n if (failure instanceof CostUnavailableError) {\n return { code: 1, lines: [failure.message] };\n }\n throw failure;\n }\n\n return { code: 0, lines: [...costLines(cost, argv.includes('--json'))] };\n}\n\n/** Сводка наблюдений: отрезок из флага, сегодняшний день — с края. */\nfunction runStats(env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand {\n const spoken: number = Number(optionOf(argv, '--days', ''));\n\n return stats(env, {\n days: Number.isFinite(spoken) && spoken > 0 ? Math.floor(spoken) : DEFAULT_DAYS,\n // Сегодняшний день берётся здесь: у команды своих часов нет, иначе сводку за\n // отрезок не проверить спекой — вчерашняя фикстура завтра станет позавчерашней.\n today: new Date().toISOString().slice(0, 10),\n json: argv.includes('--json'),\n });\n}\n\n/**\n * Отправка накопленного.\n *\n * Единственное действие этой команды необратимо и уходит наружу, поэтому незнакомый довод её\n * кончает, а не пропускается молча: вызов ради списка режимов отправил в приём всё накопленное, и\n * по выводу это не отличалось от «команда ничего не сделала». Прочие команды такого разбора не\n * знают — их действие обратимо.\n */\nasync function runPropose(env: IEnvironment, argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const unknown: readonly string[] = unknownFlagsIn(argv.slice(1), PROPOSE_FLAGS);\n if (unknown.length) {\n return {\n code: 1,\n lines: [`таких доводов у \\`propose\\` нет: ${unknown.join(', ')}`, '', ...PROPOSE_USAGE],\n };\n }\n\n return propose(env, {\n dryRun: argv.includes('--dry-run'),\n ship: httpShip,\n remote: remoteOf(env.root),\n // Имена доезжают до отказа: выбор за человеком, и отказ, не назвавший, из чего выбирать,\n // отправляет его смотреть то же самое своими руками.\n remotes: remoteNames(env.root),\n // Отрезок тот же, что у сводки по умолчанию: отправку зовут по свежей задаче.\n days: DEFAULT_DAYS,\n today: new Date().toISOString().slice(0, 10),\n });\n}\n\n/** Судьба своих записей: чтение приёма по токену дерева и надстройки под ними. */\nfunction runFate(env: IEnvironment): Promise<IOutcomeOfCommand> {\n return fate(env, { read: httpReadOwn });\n}\n\n/** Приписка дерева к приёмнику по коду приглашения. */\nasync function runEnroll(env: IEnvironment, argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const config: IConfig | null = readConfig(env.root);\n\n if (!config) {\n return { code: 1, lines: [`настройки дерева нет: ${CONFIG_PATH}. Заведите её командой \\`init\\``] };\n }\n\n return enroll({\n root: env.root,\n intake: config.intake,\n code: optionOf(argv, '--code', ''),\n issued: optionOf(argv, '--token', ''),\n tree: treeSlugOf(remoteOf(env.root), config.tree),\n token: config.token,\n force: argv.includes('--force'),\n call: httpEnroll,\n });\n}\n\n/** Ветка команды: окружение и доводы строки запуска на входе, вывод и код возврата на выходе. */\ntype TCommandRun = (env: IEnvironment, argv: readonly string[]) => IOutcomeOfCommand | Promise<IOutcomeOfCommand>;\n\n/** Что делает каждая команда строки запуска. Ключ — слово, которым её зовут. */\nconst COMMANDS: Readonly<Record<string, TCommandRun>> = {\n init: runInit,\n list: (env: IEnvironment): IOutcomeOfCommand => list(env),\n sync: (env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand => sync(env, argv.includes('--check')),\n cost: runCost,\n stats: runStats,\n propose: runPropose,\n fate: runFate,\n enroll: runEnroll,\n doctor: (env: IEnvironment): IOutcomeOfCommand => doctor(env),\n adopt: (env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand =>\n adopt(\n env,\n argv.slice(1).filter((value: string): boolean => !value.startsWith('--') && value !== optionOf(argv, '--root', ''))\n ),\n};\n\nexport async function main(argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const command: string = argv[0] ?? '';\n const env: IEnvironment = environmentOf(resolve(optionOf(argv, '--root', process.cwd())));\n const run: TCommandRun | undefined = Object.hasOwn(COMMANDS, command) ? COMMANDS[command] : undefined;\n\n if (!run) {\n return { code: command ? 1 : 0, lines: command ? [`неизвестная команда «${command}»`, '', ...USAGE] : USAGE };\n }\n\n return run(env, argv);\n}\n\nconst outcome: IOutcomeOfCommand = await main(process.argv.slice(2));\nfor (const line of outcome.lines) {\n // eslint-disable-next-line no-console\n console.log(line);\n}\nprocess.exit(outcome.code);\n"]}
|
|
1
|
+
{"version":3,"file":"agent-kit.js","sourceRoot":"","sources":["../../../projects/agent-kit/src/bin/agent-kit.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAA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CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/B,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Точка входа. Разбирает аргументы, добывает выбор проекта, зовёт команду и печатает то, что\n * она вернула. Своей работы у неё нет: всё, что решает, живёт в `commands.ts` и проверяется\n * спеками — кроме одного, чего команде знать не по чину: откуда взялся выбор законов. У строки\n * запуска это флаг, у терминала — вопрос, у прогона без терминала нет ни того ни другого.\n */\nimport { execFileSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport process from 'node:process';\n\nimport { unknownFlagsIn } from '../lib/argv.js';\nimport { IEntryOfCatalog, readCatalog, resolveSelection } from '../lib/catalog.js';\nimport { adopt, doctor, IEnvironment, init, IOutcomeOfCommand, list, stats, sync } from '../lib/commands.js';\nimport { CONFIG_PATH, IConfig, readConfig } from '../lib/config.js';\nimport { costLines, costOf, CostUnavailableError, ICost } from '../lib/cost.js';\nimport { enroll, httpEnroll } from '../lib/enroll.js';\nimport { httpReadOwn, httpShip } from '../lib/ship.js';\nimport { fate } from '../lib/fate.js';\nimport { propose, treeSlugOf } from '../lib/shipment.js';\nimport { DEFAULT_DAYS } from '../lib/observations.js';\nimport { staleBuild } from '../lib/freshness.js';\nimport { packageRootFrom } from '../lib/package-root.js';\nimport { IChoice } from '../lib/picker.js';\nimport { IAxis, IOptionOfAxis, readAxes } from '../lib/variants.js';\nimport { ask, askOne, canAsk } from './prompt.js';\n\nconst USAGE: readonly string[] = [\n 'agent-kit <команда>',\n '',\n ' init завести .claude/rt-kit.json и каталог надстроек',\n ' list что везёт пакет и что из этого взято здесь',\n ' sync разложить ресурсы пакета в дерево проекта',\n ' sync --check ничего не писать, отказать при расхождении — для гейта пуша',\n ' doctor рассказать о состоянии раскладки, ничего не меняя',\n ' cost посчитать цену контекста: вход в работу, одно правило, весь слой',\n ' cost --rule <имя> какое правило взвесить; без довода берётся самое тяжёлое',\n ' cost --json то же машиночитаемо — этим числа кладут в замысел',\n ' stats свести наблюдения: чем пользовались, чем ни разу, обо что спотыкались',\n ' stats --days N за сколько дней; без довода — за три',\n ' stats --json то же машиночитаемо — этим сводку прикладывают к предложению',\n ' propose отправить груз в приём: сводку со снимком надстроек, предложения и разборы',\n ' fate судьба своих записей в приёме и надстройки, которые пора снять',\n ' propose --dry-run показать, что уехало бы, и ничего не отправлять',\n ' adopt [файлы] отдать пакету файлы, лежащие на его путях не от него',\n ' enroll --code <код> завести дерево по приглашению владельца: обмен кода на токен',\n ' enroll --token <токен> завести дерево токеном, выданным в админке приёма; в сеть не идёт',\n ' enroll --force перезаписать уже лежащий токен намеренно',\n '',\n ' --root <путь> корень проекта; по умолчанию текущий каталог',\n '',\n 'Выбор законов при `init`:',\n '',\n ' --all взять все законы, ни о чём не спрашивая',\n ' --laws a,b,c взять только названные; имена — из `agent-kit list`',\n ' без обоих спросить галочками; без терминала — отказ',\n '',\n 'Вид ресурсов при `init` — там, где один закон исполняется разными командами:',\n '',\n ' --<ось> <вид> например `--host gitlab`; оси и виды — из `agent-kit list`',\n ' без флага спросить; без терминала — отказ, кроме `--all`',\n];\n\n/**\n * Доводы отправки. Довод со значением помечен `<>`: за ним идёт отдельным словом путь, и без\n * пометки этот путь читался бы как ещё один незнакомый довод.\n */\nconst PROPOSE_FLAGS: readonly string[] = ['--dry-run', '--root <>'];\n\n/** Что печатает отказ на незнакомом доводе: режимы команды, а не весь свод. */\nconst PROPOSE_USAGE: readonly string[] = [\n ' propose отправить груз в приём',\n ' propose --dry-run показать, что уехало бы, и ничего не отправлять',\n ' --root <путь> корень проекта; по умолчанию текущий каталог',\n];\n\n/**\n * Единственное место, где пакет узнаёт собственное расположение. `import.meta` живёт только\n * здесь: библиотечные модули получают каталог ресурсов входным значением, и трансформ тестов,\n * разбирающий модули как CommonJS, на них уже не спотыкается.\n */\nfunction environmentOf(root: string): IEnvironment {\n const pkg: string = packageRootFrom(dirname(fileURLToPath(import.meta.url)));\n const manifest: { name: string; version: string } = JSON.parse(readFileSync(join(pkg, 'package.json'), 'utf8')) as {\n name: string;\n version: string;\n };\n\n return {\n root,\n version: manifest.version,\n // Имя из манифеста, а не записанное здесь: по нему пакет ищет себя в зависимостях дерева,\n // и своя копия имени разошлась бы с манифестом молча — у всякого, кто пакет переименовал.\n name: manifest.name,\n assetsDir: join(pkg, 'assets'),\n // Сверка со своими исходниками возможна только отсюда: здесь пакет знает, где лежит сам.\n // У потребителя исходников рядом нет, и сверка молчит.\n stale: staleBuild(pkg, manifest.name),\n };\n}\n\n/** Вывод git в этом дереве. Отказ и пустота здесь одно и то же: адреса нет — и это не отказ. */\nfunction gitSays(root: string, args: readonly string[]): string {\n try {\n // eslint-disable-next-line sonarjs/no-os-command-from-path -- путь к git у каждой машины свой, и прибитый здесь сделал бы пакет непереносимым\n return execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();\n } catch {\n return '';\n }\n}\n\n/** Имена удалённых репозиториев этого дерева, по одному в строке. */\nfunction remoteNames(root: string): readonly string[] {\n return gitSays(root, ['remote'])\n .split('\\n')\n .map((name: string): string => name.trim())\n .filter(Boolean);\n}\n\n/**\n * Чем это дерево себя выдаёт снаружи. Нет удалённого репозитория — нечем, и это не отказ.\n *\n * Имя `origin` — соглашение, а не устройство: рабочая копия, назвавшая свои remotes по хостам,\n * на которые смотрит, оставалась без адреса вовсе, и отправка отказывала словами «удалённого\n * репозитория нет» — при том что репозиторий у неё есть, и не один. Порядок поэтому такой:\n * `origin`, если он есть; ровно один remote — он; несколько без `origin` — адреса нет, и выбор\n * за человеком. Угадать здесь нельзя: угаданное неверно сливает в сводке приёма два дерева в\n * одно, а увидеть это нечем.\n */\nfunction remoteOf(root: string): string {\n const names: readonly string[] = remoteNames(root);\n\n if (names.includes('origin')) {\n return gitSays(root, ['remote', 'get-url', 'origin']);\n }\n\n return names.length === 1 ? gitSays(root, ['remote', 'get-url', names[0]]) : '';\n}\n\nfunction optionOf(argv: readonly string[], name: string, fallback: string): string {\n const index: number = argv.indexOf(name);\n\n return index >= 0 && argv[index + 1] ? argv[index + 1] : fallback;\n}\n\nconst isOutcome: (value: unknown) => value is IOutcomeOfCommand = (value: unknown): value is IOutcomeOfCommand =>\n typeof value === 'object' && value !== null && 'code' in value;\n\n/**\n * Выбор законов для `init`: список идентификаторов, `null` на брошенном выборе или готовый\n * отказ. Пустой список означает «взять всё», поэтому брошенный выбор отличается от него не\n * значением, а `null`: подставить «всё» вместо неотвеченного вопроса значило бы разложить\n * пятнадцать законов тому, кто как раз просил спросить.\n */\nasync function selectionFor(argv: readonly string[], assetsDir: string): Promise<readonly string[] | null | IOutcomeOfCommand> {\n if (argv.includes('--all')) {\n return [];\n }\n\n const catalog: readonly IEntryOfCatalog[] = readCatalog(assetsDir);\n const spoken: string = optionOf(argv, '--laws', '');\n\n if (spoken) {\n const named: string[] = spoken\n .split(',')\n .map((name: string): string => name.trim())\n .filter(Boolean);\n const { ids, unknown } = resolveSelection(named, 'laws', catalog);\n\n return unknown.length\n ? { code: 1, lines: [`таких законов пакет не везёт: ${unknown.join(', ')}`, 'что везёт — `agent-kit list`'] }\n : ids;\n }\n\n if (!canAsk()) {\n return {\n code: 1,\n lines: [\n 'спросить некого: запуск без терминала',\n 'назови законы флагом `--laws a,b,c` или возьми все флагом `--all`',\n 'что везёт пакет — `agent-kit list`',\n ],\n };\n }\n\n const choices: readonly IChoice[] = catalog\n .filter((entry: IEntryOfCatalog): boolean => entry.kind === 'laws')\n .map((entry: IEntryOfCatalog): IChoice => ({ id: entry.id, name: entry.name, title: entry.title }));\n\n return ask(choices, 'Какие законы разложить в этом проекте?');\n}\n\n/**\n * Виды для `init` по осям, объявленным пакетом: что взято из флага, что спрошено.\n *\n * `--all` берёт первый объявленный вид оси и **говорит об этом**: в CI спрашивать некого, а\n * отказ там означал бы, что пакет нельзя разложить без человека. Первый вид — умолчание, а не\n * догадка: порядок в объявлении оси и есть порядок предпочтения.\n */\nasync function variantOfAxis(axis: IAxis, argv: readonly string[]): Promise<string | null | IOutcomeOfCommand> {\n const spoken: string = optionOf(argv, `--${axis.name}`, '');\n const values: readonly string[] = axis.options.map((option: IOptionOfAxis): string => option.value);\n\n if (spoken) {\n return values.includes(spoken)\n ? spoken\n : {\n code: 1,\n lines: [`такого вида по оси «${axis.name}» пакет не везёт: ${spoken}`, `есть: ${values.join(', ')}`],\n };\n }\n\n if (argv.includes('--all')) {\n return axis.options[0]?.value ?? '';\n }\n\n if (!canAsk()) {\n return {\n code: 1,\n lines: ['спросить некого: запуск без терминала', `назови вид флагом \\`--${axis.name} <вид>\\`: ${values.join(', ')}`],\n };\n }\n\n return askOne(\n axis.options.map((option: IOptionOfAxis): IChoice => ({ id: option.value, name: option.value, title: option.title })),\n axis.question\n );\n}\n\nasync function variantsFor(argv: readonly string[], assetsDir: string): Promise<Record<string, string> | null | IOutcomeOfCommand> {\n const axes: readonly IAxis[] = readAxes(assetsDir);\n const chosen: Record<string, string> = {};\n\n for (const axis of axes) {\n const answer: string | null | IOutcomeOfCommand = await variantOfAxis(axis, argv);\n\n if (isOutcome(answer)) {\n return answer;\n }\n\n if (answer === null) {\n return null;\n }\n\n chosen[axis.name] = answer;\n }\n\n return chosen;\n}\n\n/** Заведение настройки: выбор ресурсов и видов, брошенный выбор ничего не пишет. */\nasync function runInit(env: IEnvironment, argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const selection: readonly string[] | null | IOutcomeOfCommand = await selectionFor(argv, env.assetsDir);\n if (isOutcome(selection)) {\n return selection;\n }\n if (selection === null) {\n return { code: 1, lines: ['выбор брошен — ничего не заведено'] };\n }\n\n const variants: Record<string, string> | null | IOutcomeOfCommand = await variantsFor(argv, env.assetsDir);\n if (isOutcome(variants)) {\n return variants;\n }\n\n return variants === null\n ? { code: 1, lines: ['выбор брошен — ничего не заведено'] }\n : init(env.root, selection, variants, env.assetsDir);\n}\n\n/**\n * Цена контекста: три веса и то, чем они сняты.\n *\n * Отказ печатается тем же выводом, а не броском: команду зовут глазами, и трассировка стека\n * говорит ей читателю меньше, чем строка о том, чего в дереве нет.\n */\nfunction runCost(env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand {\n const named: string = optionOf(argv, '--rule', '');\n let cost: ICost;\n try {\n cost = costOf(env.root, named === '' ? null : named);\n } catch (failure: unknown) {\n if (failure instanceof CostUnavailableError) {\n return { code: 1, lines: [failure.message] };\n }\n throw failure;\n }\n\n return { code: 0, lines: [...costLines(cost, argv.includes('--json'))] };\n}\n\n/** Сводка наблюдений: отрезок из флага, сегодняшний день — с края. */\nfunction runStats(env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand {\n const spoken: number = Number(optionOf(argv, '--days', ''));\n\n return stats(env, {\n days: Number.isFinite(spoken) && spoken > 0 ? Math.floor(spoken) : DEFAULT_DAYS,\n // Сегодняшний день берётся здесь: у команды своих часов нет, иначе сводку за\n // отрезок не проверить спекой — вчерашняя фикстура завтра станет позавчерашней.\n today: new Date().toISOString().slice(0, 10),\n json: argv.includes('--json'),\n });\n}\n\n/**\n * Отправка накопленного.\n *\n * Единственное действие этой команды необратимо и уходит наружу, поэтому незнакомый довод её\n * кончает, а не пропускается молча: вызов ради списка режимов отправил в приём всё накопленное, и\n * по выводу это не отличалось от «команда ничего не сделала». Прочие команды такого разбора не\n * знают — их действие обратимо.\n */\nasync function runPropose(env: IEnvironment, argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const unknown: readonly string[] = unknownFlagsIn(argv.slice(1), PROPOSE_FLAGS);\n if (unknown.length) {\n return {\n code: 1,\n lines: [`таких доводов у \\`propose\\` нет: ${unknown.join(', ')}`, '', ...PROPOSE_USAGE],\n };\n }\n\n return propose(env, {\n dryRun: argv.includes('--dry-run'),\n ship: httpShip,\n remote: remoteOf(env.root),\n // Имена доезжают до отказа: выбор за человеком, и отказ, не назвавший, из чего выбирать,\n // отправляет его смотреть то же самое своими руками.\n remotes: remoteNames(env.root),\n // Отрезок тот же, что у сводки по умолчанию: отправку зовут по свежей задаче.\n days: DEFAULT_DAYS,\n today: new Date().toISOString().slice(0, 10),\n });\n}\n\n/** Судьба своих записей: чтение приёма по токену дерева и надстройки под ними. */\nfunction runFate(env: IEnvironment): Promise<IOutcomeOfCommand> {\n return fate(env, { read: httpReadOwn });\n}\n\n/** Приписка дерева к приёмнику по коду приглашения. */\nasync function runEnroll(env: IEnvironment, argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const config: IConfig | null = readConfig(env.root);\n\n if (!config) {\n return { code: 1, lines: [`настройки дерева нет: ${CONFIG_PATH}. Заведите её командой \\`init\\``] };\n }\n\n return enroll({\n root: env.root,\n intake: config.intake,\n code: optionOf(argv, '--code', ''),\n issued: optionOf(argv, '--token', ''),\n tree: treeSlugOf(remoteOf(env.root), config.tree),\n token: config.token,\n force: argv.includes('--force'),\n call: httpEnroll,\n });\n}\n\n/** Ветка команды: окружение и доводы строки запуска на входе, вывод и код возврата на выходе. */\ntype TCommandRun = (env: IEnvironment, argv: readonly string[]) => IOutcomeOfCommand | Promise<IOutcomeOfCommand>;\n\n/** Что делает каждая команда строки запуска. Ключ — слово, которым её зовут. */\nconst COMMANDS: Readonly<Record<string, TCommandRun>> = {\n init: runInit,\n list: (env: IEnvironment): IOutcomeOfCommand => list(env),\n sync: (env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand => sync(env, argv.includes('--check')),\n cost: runCost,\n stats: runStats,\n propose: runPropose,\n fate: runFate,\n enroll: runEnroll,\n doctor: (env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand => doctor(env, optionOf(argv, '--since', '')),\n adopt: (env: IEnvironment, argv: readonly string[]): IOutcomeOfCommand =>\n adopt(\n env,\n argv.slice(1).filter((value: string): boolean => !value.startsWith('--') && value !== optionOf(argv, '--root', ''))\n ),\n};\n\nexport async function main(argv: readonly string[]): Promise<IOutcomeOfCommand> {\n const command: string = argv[0] ?? '';\n const env: IEnvironment = environmentOf(resolve(optionOf(argv, '--root', process.cwd())));\n const run: TCommandRun | undefined = Object.hasOwn(COMMANDS, command) ? COMMANDS[command] : undefined;\n\n if (!run) {\n return { code: command ? 1 : 0, lines: command ? [`неизвестная команда «${command}»`, '', ...USAGE] : USAGE };\n }\n\n return run(env, argv);\n}\n\nconst outcome: IOutcomeOfCommand = await main(process.argv.slice(2));\nfor (const line of outcome.lines) {\n // eslint-disable-next-line no-console\n console.log(line);\n}\nprocess.exit(outcome.code);\n"]}
|
package/lib/commands.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export interface IStatsOptions {
|
|
|
56
56
|
* правил так же ценно, как дополнять.
|
|
57
57
|
*/
|
|
58
58
|
export declare function stats(env: IEnvironment, options: IStatsOptions): IOutcomeOfCommand;
|
|
59
|
-
export declare function doctor(env: IEnvironment): IOutcomeOfCommand;
|
|
59
|
+
export declare function doctor(env: IEnvironment, since?: string): IOutcomeOfCommand;
|
|
60
60
|
/**
|
|
61
61
|
* Что пакет везёт и что из этого взято здесь.
|
|
62
62
|
*
|
package/lib/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../projects/agent-kit/src/lib/commands.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../projects/agent-kit/src/lib/commands.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAyB7C,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAA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