forge-orkes 0.80.2 → 0.80.4
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/package.json +1 -1
- package/template/.claude/hooks/forge-context-migrate.sh +22 -0
- package/template/.claude/hooks/tests/forge-context-migrate.test.sh +50 -0
- package/template/.claude/settings.json +1 -1
- package/template/.forge/gitignore +11 -5
- package/template/.forge/migrations/0.80.0-context-md-sharding.md +12 -8
package/package.json
CHANGED
|
@@ -168,6 +168,7 @@ BEGIN {
|
|
|
168
168
|
cur_noid_key = ""
|
|
169
169
|
n_ids = 0
|
|
170
170
|
n_noid = 0
|
|
171
|
+
n_other_headings = 0
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
/^## / {
|
|
@@ -179,6 +180,10 @@ BEGIN {
|
|
|
179
180
|
if ($0 ~ /^## Needs Resolution/) { section = "NEEDS_RESOLUTION"; next }
|
|
180
181
|
if ($0 ~ /^## Amendment Log/) { section = "AMENDMENT"; next }
|
|
181
182
|
section = "OTHER"
|
|
183
|
+
n_other_headings++
|
|
184
|
+
w = $0
|
|
185
|
+
sub(/^## /, "", w)
|
|
186
|
+
other_heading_order[n_other_headings] = w
|
|
182
187
|
other_buf = other_buf $0 "\n"
|
|
183
188
|
next
|
|
184
189
|
}
|
|
@@ -313,6 +318,23 @@ END {
|
|
|
313
318
|
exit 1
|
|
314
319
|
}
|
|
315
320
|
|
|
321
|
+
# Unrecognized top-level `## ` sections (issue #45) are preserved verbatim
|
|
322
|
+
# in context-log.md's "Other Sections" by design — never guessed onto a
|
|
323
|
+
# milestone — but a large or multi-heading OTHER bucket usually means the
|
|
324
|
+
# source context.md uses a section vocabulary this tool doesn't know about
|
|
325
|
+
# (e.g. a project-specific "## Active Streams"), and that content silently
|
|
326
|
+
# missing its own per-milestone home is easy to overlook. Loud, not fatal:
|
|
327
|
+
# nothing is lost (it's right there in context-log.md), so this warns
|
|
328
|
+
# without changing the exit code.
|
|
329
|
+
if (n_other_headings > 0 && length(other_buf) > 500) {
|
|
330
|
+
headings_list = other_heading_order[1]
|
|
331
|
+
for (i = 2; i <= n_other_headings; i++) headings_list = headings_list ", " other_heading_order[i]
|
|
332
|
+
print "forge-context-migrate: WARNING — " length(other_buf) " byte(s) across " \
|
|
333
|
+
n_other_headings " unrecognized heading(s) (" headings_list ") landed in" \
|
|
334
|
+
" context-log.md's \"Other Sections\" instead of a per-milestone file — review" \
|
|
335
|
+
" it; if that content is milestone-scoped, re-file it into context/{id}.md by hand" > "/dev/stderr"
|
|
336
|
+
}
|
|
337
|
+
|
|
316
338
|
print "forge-context-migrate: " n_ids " milestone id(s) processed"
|
|
317
339
|
}
|
|
318
340
|
AWKEOF
|
|
@@ -251,6 +251,56 @@ BADRC=$?
|
|
|
251
251
|
[ "$BADRC" -ne 0 ] && pass "unresolvable id scheme exits non-zero instead of silently producing 0 shards" || fail "unresolvable id scheme should exit non-zero (exit $BADRC)"
|
|
252
252
|
check_has "unresolvable id scheme prints an ERROR line" "$BADOUT" "ERROR"
|
|
253
253
|
|
|
254
|
+
# --- large unrecognized-section warning (issue #45) -------------------------
|
|
255
|
+
# A project-specific top-level heading (e.g. "## Active Streams") this tool
|
|
256
|
+
# doesn't know about is preserved verbatim in context-log.md's "Other
|
|
257
|
+
# Sections" by design — but silently doing that with a large amount of
|
|
258
|
+
# content is easy to overlook. Must warn (not fail — nothing is lost) when
|
|
259
|
+
# the OTHER bucket is substantial, and stay silent when it's small/absent.
|
|
260
|
+
# Deliberately alongside a resolving Locked Decisions id, so this warning
|
|
261
|
+
# fires independent of (and isn't masked by) the zero-shards guard above.
|
|
262
|
+
|
|
263
|
+
WARNROOT="$(mktemp -d)"
|
|
264
|
+
trap 'rm -rf "$ROOT" "$LBLROOT" "$BADROOT" "$WARNROOT"' EXIT INT TERM
|
|
265
|
+
WARNSRC="$WARNROOT/context.md"
|
|
266
|
+
WARNDEST="$WARNROOT/.forge"
|
|
267
|
+
mkdir -p "$WARNDEST"
|
|
268
|
+
|
|
269
|
+
{
|
|
270
|
+
printf '## Locked Decisions\n\n### m-53 — numeric decision\n\n- **Decision**: fine.\n\n'
|
|
271
|
+
printf '## Active Streams\n\n### m-HC01 — some stream\n\n'
|
|
272
|
+
# 600 bytes — over the 500-byte warn floor
|
|
273
|
+
printf 'x%.0s' $(seq 1 600)
|
|
274
|
+
printf '\n\n## Needs Resolution\n\n(none)\n\n## Amendment Log\n\n(none)\n'
|
|
275
|
+
} > "$WARNSRC"
|
|
276
|
+
|
|
277
|
+
WARNOUT="$("$MIGRATE" --source "$WARNSRC" --dest "$WARNDEST" --dry-run 2>&1)"
|
|
278
|
+
WARNRC=$?
|
|
279
|
+
[ "$WARNRC" -eq 0 ] && pass "large unrecognized-section run still exits 0 (warning, not a failure)" || fail "large unrecognized-section run should exit 0 (exit $WARNRC)"
|
|
280
|
+
check_has "large unrecognized-section run prints a WARNING line" "$WARNOUT" "WARNING"
|
|
281
|
+
check_has "warning names the unrecognized heading" "$WARNOUT" "Active Streams"
|
|
282
|
+
|
|
283
|
+
SMALLROOT="$(mktemp -d)"
|
|
284
|
+
trap 'rm -rf "$ROOT" "$LBLROOT" "$BADROOT" "$WARNROOT" "$SMALLROOT"' EXIT INT TERM
|
|
285
|
+
SMALLSRC="$SMALLROOT/context.md"
|
|
286
|
+
SMALLDEST="$SMALLROOT/.forge"
|
|
287
|
+
mkdir -p "$SMALLDEST"
|
|
288
|
+
|
|
289
|
+
cat > "$SMALLSRC" <<'FIXTURE'
|
|
290
|
+
## Locked Decisions
|
|
291
|
+
|
|
292
|
+
### m-53 — numeric decision
|
|
293
|
+
|
|
294
|
+
- **Decision**: fine.
|
|
295
|
+
|
|
296
|
+
## Some Small Aside
|
|
297
|
+
|
|
298
|
+
A short unrecognized note, well under the warn floor.
|
|
299
|
+
FIXTURE
|
|
300
|
+
|
|
301
|
+
SMALLOUT="$("$MIGRATE" --source "$SMALLSRC" --dest "$SMALLDEST" --dry-run 2>&1)"
|
|
302
|
+
check_absent "a small unrecognized section stays silent (no WARNING)" "$SMALLOUT" "WARNING"
|
|
303
|
+
|
|
254
304
|
# --- summary -----------------------------------------------------------------
|
|
255
305
|
|
|
256
306
|
printf '\n%s passed, %s failed\n' "$PASSED" "$FAILED"
|
|
@@ -34,13 +34,19 @@ dev-source
|
|
|
34
34
|
# Orchestration locks
|
|
35
35
|
*.lock
|
|
36
36
|
|
|
37
|
-
# Render-on-read derived registries (0.53.0
|
|
38
|
-
# from their sources (state/index.yml ←
|
|
39
|
-
# ← streams/*.yml + active milestones
|
|
40
|
-
#
|
|
41
|
-
#
|
|
37
|
+
# Render-on-read derived registries (0.53.0; context.md joined in 0.80.0/ADR-033).
|
|
38
|
+
# Regenerated at every `forge` boot from their sources (state/index.yml ←
|
|
39
|
+
# state/milestone-*.yml; streams/active.yml ← streams/*.yml + active milestones;
|
|
40
|
+
# context.md ← context/*.md joined against state/index.yml). Local cache only —
|
|
41
|
+
# never committed, so a committed projection can never drift stale from its
|
|
42
|
+
# source. Without these entries a fresh install would re-commit them, and an
|
|
43
|
+
# upgrade would silently re-track context.md after a project migrated off the
|
|
44
|
+
# monolithic file (issue #46 — this line must ship canonically, not as a
|
|
45
|
+
# per-project manual edit, since this file is overwritten wholesale on every
|
|
46
|
+
# upgrade).
|
|
42
47
|
state/index.yml
|
|
43
48
|
streams/active.yml
|
|
49
|
+
context.md
|
|
44
50
|
|
|
45
51
|
# Notion board id-binding cache (ADR-020 derived class) — forge-id → page-id, rebuilt
|
|
46
52
|
# by query-self-heal; never committed (a committed copy would leak private Notion page IDs).
|
|
@@ -123,19 +123,23 @@ What is **not** repeatable is the untrack step below — do that once.
|
|
|
123
123
|
git rm --cached .forge/context.md
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
`
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
If your project uses the shipped `.forge/.gitignore` default (no custom
|
|
127
|
+
gitignore layout), a `create-forge` install/upgrade at 0.80.4+ already lists
|
|
128
|
+
`context.md` next to `state/index.yml` and `streams/active.yml` in that file —
|
|
129
|
+
nothing to add by hand, and it's safe against a future upgrade overwriting it
|
|
130
|
+
(issue #46: before 0.80.4, `.forge/.gitignore` was wholesale re-synced from
|
|
131
|
+
the canonical shipped file on every upgrade, silently reverting a manual
|
|
132
|
+
addition here — the fix moved the line into the canonical source itself).
|
|
133
|
+
|
|
134
|
+
If your project customized gitignore layout (e.g. this repo's own root
|
|
135
|
+
`.gitignore`, not `.forge/.gitignore`), add `.forge/context.md` there by
|
|
136
|
+
hand, next to the other two derived-registry entries, matching their
|
|
137
|
+
existing comment block rather than starting a new one:
|
|
131
138
|
|
|
132
139
|
```bash
|
|
133
140
|
grep -rn "index.yml" .gitignore .forge/.gitignore 2>/dev/null
|
|
134
141
|
```
|
|
135
142
|
|
|
136
|
-
Add the line next to the other two derived-registry entries, matching their
|
|
137
|
-
existing comment block rather than starting a new one.
|
|
138
|
-
|
|
139
143
|
### 3. Commit the migration output
|
|
140
144
|
|
|
141
145
|
```bash
|