ai-first-os 2.3.0 → 2.4.1
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/core/CLAUDE.md +8 -3
- package/core/VERSION +1 -1
- package/core/lib/bootstrap.sh +30 -1
- package/core/lib/mount-repo.sh +15 -1
- package/core/lib/recall.sh +6 -4
- package/core/manual/COMO-FUNCIONA.md +4 -1
- package/core/manual/HOW-IT-WORKS.md +3 -2
- package/core/skills/mount-repo.md +2 -1
- package/core/skills/new-spec.md +8 -0
- package/core/templates/repo-scaffold/CLAUDE.md +2 -0
- package/core/templates/repo-scaffold/capabilities/README.md +153 -0
- package/core/templates/repo-scaffold/scripts/apply-capability-changes.sh +4 -0
- package/core/templates/repo-scaffold/scripts/capability_tools.py +677 -0
- package/core/templates/repo-scaffold/scripts/check-capability-diagrams.sh +4 -0
- package/core/templates/repo-scaffold/scripts/check-capability-evals.sh +4 -0
- package/core/templates/repo-scaffold/scripts/merge-if-green.sh +288 -0
- package/core/templates/repo-scaffold/scripts/render-mermaid.sh +103 -0
- package/core/templates/strings.md +14 -4
- package/package.json +1 -1
package/core/CLAUDE.md
CHANGED
|
@@ -103,9 +103,14 @@ last commit. A clean tree and a recent commit say nothing about whether the work
|
|
|
103
103
|
answer given by the session that wrote it dies with that session.
|
|
104
104
|
|
|
105
105
|
**Gate 2 runs `scripts/merge-if-green.sh <branch>` of the mounted repo, never a bare `git merge`.**
|
|
106
|
-
It refuses a branch that does not declare itself finished, merges,
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
It refuses a branch that does not declare itself finished, merges, applies the spec's `## Capability changes`
|
|
107
|
+
section onto `capabilities/` (the rules are in the `capabilities/README.md` of the mounted repo), runs the whole
|
|
108
|
+
eval suite of that repo over the result, and rolls the merge back if anything turns red. The person decides the
|
|
109
|
+
branch is ready; the suite decides it is correct.
|
|
110
|
+
|
|
111
|
+
A repo born from the product's scaffold carries the script.
|
|
112
|
+
A mounted repo that does not have it has no mechanical Gate 2: the session says so before the merge, the person
|
|
113
|
+
makes the merge, and the session never reports a script that did not run.
|
|
109
114
|
|
|
110
115
|
**Whoever merges removes the worktree and deletes the branch: cleanup is the last step of Gate 2,
|
|
111
116
|
never of the agent's own close.** The agent leaves its worktree standing because that is what the
|
package/core/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.4.1
|
package/core/lib/bootstrap.sh
CHANGED
|
@@ -112,7 +112,23 @@ respaldo_local() {
|
|
|
112
112
|
;;
|
|
113
113
|
none) git -C "$brain" init -q ;;
|
|
114
114
|
esac
|
|
115
|
+
# `.os/` holds symlinks with absolute paths of this machine (spec 051). Whether git ignores them is
|
|
116
|
+
# asked to git, never read off the file: a negation (`!.os`), a `.gitignore` that is a folder or one
|
|
117
|
+
# that cannot be read all leave a line `.os` in the file and `.os/` in the commit. What git does not
|
|
118
|
+
# ignore is declared and kept out of the first commit.
|
|
119
|
+
local ruta rutas=".os/core" d os_ignorado=1
|
|
120
|
+
for d in "$brain"/.os/packs/*; do
|
|
121
|
+
[ -e "$d" ] || [ -L "$d" ] || continue
|
|
122
|
+
rutas="$rutas .os/packs/${d##*/}"
|
|
123
|
+
done
|
|
124
|
+
for ruta in $rutas; do
|
|
125
|
+
git -C "$brain" check-ignore -q "$ruta" > /dev/null 2>&1 || os_ignorado=0
|
|
126
|
+
done
|
|
115
127
|
git -C "$brain" add -A
|
|
128
|
+
if [ "$os_ignorado" = "0" ]; then
|
|
129
|
+
git -C "$brain" rm -r -q --cached --ignore-unmatch .os > /dev/null 2>&1 || true
|
|
130
|
+
printf 'sin .gitignore: git no ignora .os (el .gitignore de %s no se pudo escribir, o una regla lo vuelve a incluir) — el primer commit deja .os/ afuera, y hay que ignorarlo a mano antes del próximo git add\n' "$brain"
|
|
131
|
+
fi
|
|
116
132
|
if git -C "$brain" commit -q -m "$S_FIRST_COMMIT" > /dev/null 2>&1; then
|
|
117
133
|
printf 'respaldo local: git init + primer commit\n'
|
|
118
134
|
return 0
|
|
@@ -228,7 +244,20 @@ os_render "$templates/tree.md" "MANUAL=$OS_MANUAL_LINK" > "$brain/$OS_TREE_FILE"
|
|
|
228
244
|
|
|
229
245
|
os_check_identity_cap "$brain/$OS_OPERATOR_FILE"
|
|
230
246
|
|
|
231
|
-
|
|
247
|
+
# `.os` is the product's own folder (`.os/core` and `.os/packs/*` are symlinks with absolute paths of
|
|
248
|
+
# the machine that made them, broken on any other): the brain declares it in its `.gitignore` before
|
|
249
|
+
# the first commit below (spec 051). The entry is `.os`, the exact text `recall.sh` already writes;
|
|
250
|
+
# `os_gitignore_ensure` compares text, so another spelling would leave two lines. A `.gitignore` that
|
|
251
|
+
# was already there keeps its rules and is not one of the pieces that stop a second run.
|
|
252
|
+
# The output names `.gitignore` only when this run wrote it. `os_gitignore_ensure` answers 1 for
|
|
253
|
+
# "already there" and 0 even when its write failed, so the file is read back for the name; whether
|
|
254
|
+
# `.os/` ends up ignored is asked to git in `respaldo_local`, which declares it when it is not.
|
|
255
|
+
escrito="$OS_OPERATOR_FILE · $OS_VOICE_FILE · $OS_ROOT_RESOLVER_FILE · $OS_TREE_FILE"
|
|
256
|
+
if os_gitignore_ensure "$brain" ".os" > /dev/null 2>&1 \
|
|
257
|
+
&& grep -qx '[[:space:]]*\.os[[:space:]]*' "$brain/.gitignore" 2>/dev/null; then
|
|
258
|
+
escrito="$escrito · .gitignore"
|
|
259
|
+
fi
|
|
260
|
+
printf '%s\n' "$escrito"
|
|
232
261
|
|
|
233
262
|
# El manual se engancha por symlink al del producto: nace con el brain y se actualiza con el
|
|
234
263
|
# producto, sin volver a correr nada.
|
package/core/lib/mount-repo.sh
CHANGED
|
@@ -333,7 +333,8 @@ repo_birth() {
|
|
|
333
333
|
local dest="$1" name="$2" tpl="$here/../templates/repo-scaffold" d
|
|
334
334
|
birth_error=""
|
|
335
335
|
mkdir -p "$dest/.claude" "$dest/specs/done" "$dest/intents" "$dest/docs/postmortems" "$dest/docs/research" \
|
|
336
|
-
"$dest/learnings" "$dest/evals"
|
|
336
|
+
"$dest/learnings" "$dest/evals" "$dest/capabilities" "$dest/scripts" \
|
|
337
|
+
|| { birth_error="mkdir $dest"; return 1; }
|
|
337
338
|
os_render_lang "$tpl/CLAUDE.md" "$language" "NAME=$name" > "$dest/CLAUDE.md" \
|
|
338
339
|
|| { birth_error="CLAUDE.md"; return 1; }
|
|
339
340
|
os_render_lang "$tpl/ARCHITECTURE.md" "$language" "NAME=$name" > "$dest/ARCHITECTURE.md" \
|
|
@@ -347,6 +348,19 @@ repo_birth() {
|
|
|
347
348
|
# merge— and the ignore list that keeps a secret out of the first commit.
|
|
348
349
|
cp "$tpl/settings.json" "$dest/.claude/settings.json" || { birth_error=".claude/settings.json"; return 1; }
|
|
349
350
|
cp "$tpl/gitignore" "$dest/.gitignore" || { birth_error=".gitignore"; return 1; }
|
|
351
|
+
# The living capabilities travel with the repo: the format that explains them, and the merge script
|
|
352
|
+
# with the tools it calls. They are copied as they are —never rendered— so the born repo and the
|
|
353
|
+
# product hold the same bytes; the execute permission is set here, not trusted from the source,
|
|
354
|
+
# which an installation can lose.
|
|
355
|
+
cp "$tpl/capabilities/README.md" "$dest/capabilities/README.md" \
|
|
356
|
+
|| { birth_error="capabilities/README.md"; return 1; }
|
|
357
|
+
for d in merge-if-green.sh capability_tools.py apply-capability-changes.sh check-capability-diagrams.sh \
|
|
358
|
+
check-capability-evals.sh render-mermaid.sh; do
|
|
359
|
+
cp "$tpl/scripts/$d" "$dest/scripts/$d" || { birth_error="scripts/$d"; return 1; }
|
|
360
|
+
case "$d" in
|
|
361
|
+
*.sh) chmod +x "$dest/scripts/$d" || { birth_error="chmod scripts/$d"; return 1; } ;;
|
|
362
|
+
esac
|
|
363
|
+
done
|
|
350
364
|
# git does not track empty folders: without a keep file the taxonomy does not survive the first
|
|
351
365
|
# clone, and the next agent finds a tree that is not the one that was born.
|
|
352
366
|
for d in specs/done intents docs/postmortems docs/research learnings; do
|
package/core/lib/recall.sh
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
# with the same value, or only one, work the same; the two with different values stop with an error.
|
|
10
10
|
#
|
|
11
11
|
# WHAT THIS COMMAND INDEXES. The index is `.os/living-memory.sqlite`, inside the brain: never
|
|
12
|
-
# committed (`.os
|
|
12
|
+
# committed (`bootstrap.sh` writes `.os` into the `.gitignore` of a new brain since spec 051; this
|
|
13
|
+
# command still calls `os_gitignore_ensure` for the brains born before it), and it is
|
|
13
14
|
# derived and discardable — deleting it just costs the next call a full reindex. It is written with
|
|
14
15
|
# Python 3 (found by `os_python_find`: python3, python or py -3) and the `sqlite3` module of the
|
|
15
16
|
# standard library, using an FTS5 table: no dependency the product does not already carry (Python 3
|
|
@@ -169,9 +170,10 @@ head_file=$(os_head_file "$brain") || true
|
|
|
169
170
|
|
|
170
171
|
mkdir -p "$brain/.os" 2>/dev/null
|
|
171
172
|
# The index never gets committed. `.os/` is meant to be gitignored everywhere it is used
|
|
172
|
-
# (`.os/core` is the product's own symlink)
|
|
173
|
-
#
|
|
174
|
-
#
|
|
173
|
+
# (`.os/core` is the product's own symlink). A brain born since spec 051 already has the entry,
|
|
174
|
+
# written by `bootstrap.sh`, and this call is a no-op there; a brain born before it does not, and
|
|
175
|
+
# this is the first thing under `.os/` it accumulates on disk instead of just holding a symlink, so
|
|
176
|
+
# the first call that would leave one is the one that makes sure the entry is there.
|
|
175
177
|
os_gitignore_ensure "$brain" ".os" > /dev/null 2>&1 || true
|
|
176
178
|
db="$brain/.os/living-memory.sqlite"
|
|
177
179
|
|
|
@@ -374,7 +374,10 @@ Cuando eso pasa, se despiertan tres capacidades:
|
|
|
374
374
|
- **`mount-repo`** — le da cuerpo a una iniciativa: apunta la cabeza al repositorio de código, deja
|
|
375
375
|
el checkout afuera de tu carpeta y registra dónde quedó en esta máquina. Si el repositorio todavía
|
|
376
376
|
no existe, el mismo comando lo hace nacer —con su constitución, sus carpetas y su primer commit— y
|
|
377
|
-
te deja el comando para crear el remoto.
|
|
377
|
+
te deja el comando para crear el remoto. El repo nace con una carpeta `capabilities/`, una
|
|
378
|
+
descripción viva por capacidad que el merge mantiene al día, y con el script
|
|
379
|
+
`scripts/merge-if-green.sh` con que se hace el Gate 2. A partir de ahí, esa iniciativa tiene dónde
|
|
380
|
+
construirse.
|
|
378
381
|
- **`new-intent`** — antes de la spec, escribe una intención de una página —el problema, el
|
|
379
382
|
resultado, a quién afecta, las restricciones, las preguntas abiertas— que una persona acepta o
|
|
380
383
|
rechaza. Una idea rechazada cuesta una página. La regla vive en `core/skills/new-intent.md`.
|
|
@@ -363,8 +363,9 @@ When that happens, three capabilities wake up:
|
|
|
363
363
|
- **`mount-repo`** — gives an initiative a body: it points the head at the code repository, leaves
|
|
364
364
|
the checkout outside your folder, and records where it landed on this machine. If the repository
|
|
365
365
|
does not exist yet, the same command gives birth to it —with its constitution, its folders and its
|
|
366
|
-
first commit— and hands you the command to create the remote.
|
|
367
|
-
|
|
366
|
+
first commit— and hands you the command to create the remote. The repo is born with a `capabilities/`
|
|
367
|
+
folder, one living description per capability that the merge keeps up to date, and with the script
|
|
368
|
+
`scripts/merge-if-green.sh` that does Gate 2. From there, that initiative has somewhere to build.
|
|
368
369
|
- **`new-intent`** — before the spec, writes a one-page intent —the problem, the outcome, who it
|
|
369
370
|
affects, the constraints, the open questions— that a person accepts or rejects. A rejected idea
|
|
370
371
|
costs one page. The rule lives in `core/skills/new-intent.md`.
|
|
@@ -43,7 +43,8 @@ the head's `repo:` is what activates the building mechanics, and this command wr
|
|
|
43
43
|
**`--new` is for a repo that does not exist yet**: instead of cloning, it writes the scaffold
|
|
44
44
|
—`CLAUDE.md` with the two gates and the Definition of Done, `.claude/settings.json` denying the
|
|
45
45
|
agents `git push` and `gh pr merge`, `ARCHITECTURE.md`, `decisions.md`, `learnings/`,
|
|
46
|
-
`docs/postmortems/`, `docs/research/`, `specs/done/`, `intents/`, `evals/run.sh
|
|
46
|
+
`docs/postmortems/`, `docs/research/`, `specs/done/`, `intents/`, `evals/run.sh`, `capabilities/README.md` and
|
|
47
|
+
`scripts/` with the merge script `scripts/merge-if-green.sh` and the capability tools—, commits it and points
|
|
47
48
|
`origin` at the remote. The prose comes out in the brain's language.
|
|
48
49
|
|
|
49
50
|
**`--new` reads "the remote does not answer" as "it does not exist yet".** A private repo that does
|
package/core/skills/new-spec.md
CHANGED
|
@@ -25,6 +25,8 @@ If it was not stated, ask for it. Before writing:
|
|
|
25
25
|
implemented, the terrain it describes may be gone. Git catches a code conflict at merge time and
|
|
26
26
|
nothing catches a stale prior state, so the agent that implements it runs
|
|
27
27
|
`git log <commit>..main --stat` first and sees in seconds whether its terrain moved.
|
|
28
|
+
- `ls capabilities/` of the repo, if the folder exists → which capabilities already have a file, so the spec
|
|
29
|
+
says what it changes in each one and which ones it adds.
|
|
28
30
|
- If the repo has no `specs/` yet, that repo has not adopted this format. Say so and offer to write
|
|
29
31
|
the first spec anyway, creating the folder.
|
|
30
32
|
|
|
@@ -39,6 +41,12 @@ When there is no intent with `status: accepted`, this skill offers to write the
|
|
|
39
41
|
steps of `new-intent`, asks the person to accept or reject it, and goes on only on acceptance. `verification` and
|
|
40
42
|
`residuals` specs have no intent and do not ask for one.
|
|
41
43
|
|
|
44
|
+
**Capability changes, for `feature` specs.** When the target repo has a `capabilities/` folder, a `feature` spec carries a
|
|
45
|
+
`## Capability changes` section after its acceptance criteria: what it adds, modifies or removes in each capability. A
|
|
46
|
+
capability with no file yet enters with `ADDED`. The format is in the `capabilities/README.md` of that repo; this skill does
|
|
47
|
+
not repeat it. `verification` and `residuals` specs carry no `## Capability changes` section.
|
|
48
|
+
A repo with no `capabilities/` folder is not asked for it.
|
|
49
|
+
|
|
42
50
|
**Frontmatter.** A `feature` spec carries three fields; `verification` and `residuals` keep exactly `status` and
|
|
43
51
|
`depends_on`:
|
|
44
52
|
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# capabilities/
|
|
2
|
+
|
|
3
|
+
One file per capability: how it works today, with the evals that prove each rule. A spec that changes
|
|
4
|
+
a capability's behavior says so in its own `## Capability changes` section, and the merge applies it.
|
|
5
|
+
This is the only place the format and the rules are written; everything else points here.
|
|
6
|
+
|
|
7
|
+
A capability gets its file the first time a spec changes it, with `ADDED`; nothing is back-filled. A
|
|
8
|
+
repo with no capability file needs no general diagram (see "The first capability").
|
|
9
|
+
|
|
10
|
+
## A capability file
|
|
11
|
+
|
|
12
|
+
`capabilities/<capability>.md`. The title, then the Mermaid diagram of the flow, then the purpose and
|
|
13
|
+
the requirements.
|
|
14
|
+
|
|
15
|
+
The text is written in the language of the repo's documents. The fixed words stay in English: the
|
|
16
|
+
headings `## Purpose`, `## Requirements`, `### Requirement:` and `#### Scenario:`, the words `SHALL`,
|
|
17
|
+
`WHEN`, `THEN` and `AND`, the line `Evals:` and the kinds of a spec's section (below).
|
|
18
|
+
|
|
19
|
+
````markdown
|
|
20
|
+
# Invoice export
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
flowchart TD
|
|
24
|
+
A[export command] --> B{any invoice?}
|
|
25
|
+
B -- yes --> Z[write the file, exit 0]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Purpose
|
|
29
|
+
One or two sentences.
|
|
30
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
|
|
33
|
+
### Requirement: Exports every invoice of the month
|
|
34
|
+
`export` SHALL write one row per invoice of the month and exit 0.
|
|
35
|
+
Evals: S001-C1
|
|
36
|
+
|
|
37
|
+
#### Scenario: A month with invoices
|
|
38
|
+
- WHEN `export 2026-01` runs on a month with two invoices
|
|
39
|
+
- THEN the file has two rows and the exit code is 0
|
|
40
|
+
````
|
|
41
|
+
|
|
42
|
+
- The file has exactly one `mermaid` block and it is the first thing after the `#` title. It opens with
|
|
43
|
+
`flowchart`, `graph`, `stateDiagram-v2` or `sequenceDiagram`, closes its fence, and has balanced
|
|
44
|
+
brackets, braces, parentheses and quotes on every line.
|
|
45
|
+
- A requirement is identified by its title, compared exactly after trimming spaces. It states one
|
|
46
|
+
behavior with SHALL, in the code as it is today, and nothing that no eval proves.
|
|
47
|
+
- `Evals:` is a line of eval ids in each requirement, at least one. An id has the form `S<NNN>-C<n>`
|
|
48
|
+
(spec number and criterion number: `S001-C1, S014-C3`). Each id has to be printed by `evals/run.sh` as
|
|
49
|
+
a line that starts with `PASS <id>` for the merge to go through.
|
|
50
|
+
- Each requirement has at least one `#### Scenario:` with `WHEN` / `THEN` / `AND` lines.
|
|
51
|
+
- The general diagram of how the parts connect is the one at the top of `ARCHITECTURE.md`: a `mermaid`
|
|
52
|
+
block before its first `##` title. It must have a node whose text is each capability's file name
|
|
53
|
+
(without `.md`).
|
|
54
|
+
|
|
55
|
+
## The first capability
|
|
56
|
+
|
|
57
|
+
A repo that was just born has no capability file and its `ARCHITECTURE.md` has no diagram: the check
|
|
58
|
+
needs no general diagram until there is a capability to name. The first spec that adds a capability
|
|
59
|
+
brings, in the same branch, the general diagram at the top of `ARCHITECTURE.md` with a node for it.
|
|
60
|
+
From the first capability file on, `scripts/check-capability-diagrams.sh` requires the general diagram.
|
|
61
|
+
|
|
62
|
+
## The `## Capability changes` section of a spec
|
|
63
|
+
|
|
64
|
+
After the acceptance criteria. Headings are one level lower than in the file, so several capabilities
|
|
65
|
+
fit in one document; to copy a block into the file, remove one `#` from each heading.
|
|
66
|
+
|
|
67
|
+
````markdown
|
|
68
|
+
## Capability changes
|
|
69
|
+
|
|
70
|
+
### invoice-export · DIAGRAM
|
|
71
|
+
|
|
72
|
+
```mermaid
|
|
73
|
+
flowchart TD
|
|
74
|
+
...the whole new diagram...
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### invoice-export · MODIFIED
|
|
78
|
+
|
|
79
|
+
#### Requirement: Exports every invoice of the month
|
|
80
|
+
...the whole new requirement...
|
|
81
|
+
Evals: S001-C1, S014-C3
|
|
82
|
+
|
|
83
|
+
##### Scenario: ...
|
|
84
|
+
|
|
85
|
+
### tax-report · ADDED
|
|
86
|
+
Purpose: only when the capability's file does not exist yet.
|
|
87
|
+
|
|
88
|
+
#### Requirement: ...
|
|
89
|
+
````
|
|
90
|
+
|
|
91
|
+
Each block is `### <capability> · <KIND>`, with KIND one of `DIAGRAM`, `RENAMED`, `REMOVED`,
|
|
92
|
+
`MODIFIED`, `ADDED`.
|
|
93
|
+
|
|
94
|
+
- `DIAGRAM`: the whole new diagram in a `mermaid` block, or the single line `Diagram: unchanged`.
|
|
95
|
+
- `ADDED`, `MODIFIED`: whole requirement blocks (`#### Requirement:` with its `Evals:` and its
|
|
96
|
+
`##### Scenario:` blocks).
|
|
97
|
+
- `REMOVED`: one `#### Requirement: <title>` line per requirement.
|
|
98
|
+
- `RENAMED`: `FROM: <old>` and `TO: <new>` lines.
|
|
99
|
+
|
|
100
|
+
## The applier and its rules
|
|
101
|
+
|
|
102
|
+
`scripts/apply-capability-changes.sh <spec>` applies the section onto `capabilities/`. Exit 0 applied or
|
|
103
|
+
nothing to apply, 1 stopped (prints capability, requirement and rule), 2 misused.
|
|
104
|
+
|
|
105
|
+
1. It checks everything first and then writes. If anything fails, no file is touched.
|
|
106
|
+
2. Per capability the order is RENAMED, REMOVED, MODIFIED, ADDED.
|
|
107
|
+
3. MODIFIED: the requirement has to exist; the new block replaces the old one whole. If the new block
|
|
108
|
+
lacks a scenario the old one had, it stops, unless the block names it in a line
|
|
109
|
+
`Drops scenario: <name>`.
|
|
110
|
+
4. ADDED: an existing requirement with the same title and the same text is skipped (so applying twice
|
|
111
|
+
equals applying once); with other text it stops.
|
|
112
|
+
5. REMOVED: the requirement has to exist, or it stops.
|
|
113
|
+
6. RENAMED: `FROM` has to exist and `TO` must not.
|
|
114
|
+
7. A capability with no file accepts only ADDED, and its block carries `Purpose:`.
|
|
115
|
+
8. Each added or modified requirement has an `Evals:` line with an id and at least one scenario.
|
|
116
|
+
9. The same requirement in two sections of the same capability stops. The one exception is the target of
|
|
117
|
+
a rename modified under its new name in the same capability (`RENAMED` `FROM: A` `TO: B` plus
|
|
118
|
+
`MODIFIED` of `B`): it is not a conflict, and rule 2 applies the rename first.
|
|
119
|
+
10. A spec without the section does nothing and exits 0.
|
|
120
|
+
11. Every capability the section touches has its `DIAGRAM` block. A `mermaid` block replaces the one
|
|
121
|
+
that opens the file; `Diagram: unchanged` leaves it; a new capability always brings a `mermaid`
|
|
122
|
+
block.
|
|
123
|
+
|
|
124
|
+
## What the merge does
|
|
125
|
+
|
|
126
|
+
Gate 2 is `scripts/merge-if-green.sh <branch>`, run by a person on `main`, never a bare `git merge`.
|
|
127
|
+
Usage: `scripts/merge-if-green.sh <branch> [-m "message"] [--require-render] [-- <arguments for evals/run.sh>]`.
|
|
128
|
+
|
|
129
|
+
The branch has to declare itself finished in a file: `status: implementada` in the spec it archived under
|
|
130
|
+
`specs/done/`, or the trailer `Listo-para-merge: si` in its last commit. Without either, nothing is merged.
|
|
131
|
+
|
|
132
|
+
After merging and before the suite:
|
|
133
|
+
|
|
134
|
+
1. If the declared spec has the section, the script runs the applier and adds the changes to the merge
|
|
135
|
+
commit (`--amend`). If the applier stops, the merge is undone.
|
|
136
|
+
2. In every merge, with or without the section: `scripts/check-capability-diagrams.sh` (the form rules
|
|
137
|
+
above, and a node for each capability in the general diagram) and `scripts/render-mermaid.sh` (every
|
|
138
|
+
diagram drawn for real by `@mermaid-js/mermaid-cli@11.16.0`). If either stops, the merge is undone.
|
|
139
|
+
3. The suite, `evals/run.sh`, over the result of the merge. The merge is green with exit 0, no line
|
|
140
|
+
that starts with `FAIL` and a last line that ends in `· 0 fail` or `· 0 fallan`. Otherwise it is undone.
|
|
141
|
+
4. With the suite green, `scripts/check-capability-evals.sh <suite output>`: every requirement has an
|
|
142
|
+
`Evals:` line and every id has its `PASS` line. If not, it is red and the merge is undone.
|
|
143
|
+
|
|
144
|
+
With no flags, the drawing never uses the network: if `npx`, the pinned package in the npm cache or
|
|
145
|
+
Chromium is missing, `scripts/render-mermaid.sh` prints one line that starts with `render-mermaid: SKIPPED`
|
|
146
|
+
(what is missing, how many diagrams were not drawn and the command that brings it) and exits 0, and the
|
|
147
|
+
merge goes on. With `--require-render` the drawing is a condition: when the npm cache is cold the script
|
|
148
|
+
fetches the pinned package once, with the same version, and tries again; if it cannot fetch it, or `npx` or
|
|
149
|
+
Chromium is missing, the merge stops and is undone. A diagram that does not draw, when the drawing tool is
|
|
150
|
+
there, always stops it.
|
|
151
|
+
|
|
152
|
+
What comes after `--` goes to `evals/run.sh` as it is. `--spec` after `--` exits 2: the merge runs the
|
|
153
|
+
whole suite, never a part of it.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Usage: scripts/apply-capability-changes.sh <spec> [--root DIR] — applies the spec's '## Capability changes' onto capabilities/.
|
|
3
|
+
# Exit: 0 ok · 1 stopped (says capability, requirement and rule) · 2 misused. Format: capabilities/README.md.
|
|
4
|
+
exec python3 "$(dirname "$0")/capability_tools.py" apply "$@"
|