monoforge 0.9.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -8
- package/bin/forge.mjs +34 -1
- package/package.json +15 -6
- package/packs/README.md +50 -0
- package/packs/public/forge-shapes/index.mjs +161 -0
- package/packs/public/forge-shapes/pack.json +13 -0
- package/packs/public/forge-shapes/test/fixtures/bad-publish/.github/workflows/publish.yml +11 -0
- package/packs/public/forge-shapes/test/fixtures/bad-publish/.monoforge-stamp.json +12 -0
- package/packs/public/forge-shapes/test/fixtures/bad-publish/README.md +3 -0
- package/packs/public/forge-shapes/test/fixtures/bad-publish/bin/probe.mjs +2 -0
- package/packs/public/forge-shapes/test/fixtures/bad-publish/package.json +14 -0
- package/packs/public/forge-shapes/test/fixtures/clean/.github/workflows/publish.yml +12 -0
- package/packs/public/forge-shapes/test/fixtures/clean/.monoforge-stamp.json +12 -0
- package/packs/public/forge-shapes/test/fixtures/clean/README.md +3 -0
- package/packs/public/forge-shapes/test/fixtures/clean/bin/probe.mjs +2 -0
- package/packs/public/forge-shapes/test/fixtures/clean/package.json +14 -0
- package/packs/public/forge-shapes/test/fixtures/missing-file/.github/workflows/publish.yml +12 -0
- package/packs/public/forge-shapes/test/fixtures/missing-file/.monoforge-stamp.json +13 -0
- package/packs/public/forge-shapes/test/fixtures/missing-file/README.md +3 -0
- package/packs/public/forge-shapes/test/fixtures/missing-file/bin/probe.mjs +2 -0
- package/packs/public/forge-shapes/test/fixtures/missing-file/package.json +14 -0
- package/packs/public/forge-shapes/test/fixtures/token/.github/workflows/publish.yml +12 -0
- package/packs/public/forge-shapes/test/fixtures/token/.monoforge-stamp.json +12 -0
- package/packs/public/forge-shapes/test/fixtures/token/README.md +3 -0
- package/packs/public/forge-shapes/test/fixtures/token/bin/probe.mjs +2 -0
- package/packs/public/forge-shapes/test/fixtures/token/package.json +14 -0
- package/packs/public/forge-shapes/test/fixtures/unfilled/.github/workflows/publish.yml +12 -0
- package/packs/public/forge-shapes/test/fixtures/unfilled/.monoforge-stamp.json +12 -0
- package/packs/public/forge-shapes/test/fixtures/unfilled/README.md +3 -0
- package/packs/public/forge-shapes/test/fixtures/unfilled/bin/probe.mjs +2 -0
- package/packs/public/forge-shapes/test/fixtures/unfilled/package.json +14 -0
- package/packs/public/forge-shapes/test/run.mjs +67 -0
- package/spec/refusals.json +35 -0
- package/src/doctor.mjs +46 -23
- package/src/fs-adapter.mjs +143 -0
- package/src/fs-node.mjs +15 -0
- package/src/harness.mjs +118 -0
- package/src/index.mjs +16 -1
- package/src/lock.mjs +1 -1
- package/src/packs.mjs +200 -0
- package/src/paths.mjs +48 -0
- package/src/refusals.mjs +45 -0
- package/src/sha256.mjs +61 -0
- package/src/stamp.mjs +70 -51
- package/src/templates.mjs +28 -14
- package/src/workers.mjs +16 -0
- package/templates/monoforge/AGENTS.md +6 -15
- package/templates/monoforge/CHANGELOG.md +2 -5
- package/templates/monoforge/DEPLOY.md +13 -30
- package/templates/monoforge/README.md +1 -2
- package/templates/monoforge/TEMPLATE.md +1 -4
- package/templates/monoforge/docs/index.md +1 -2
- package/templates/monoforge/horcrux/HORCRUX.md +1 -5
- package/templates/monoforge/labs/TASKS.md +2 -6
- package/templates/monoforge/scripts/check-docs-frontmatter.cjs +1 -1
- package/templates/monoforge/scripts/check-fiction-signatures.cjs +1 -1
- package/templates/monoforge/scripts/unwrap-prose.cjs +178 -0
- package/templates/monoforge-headless/.github/workflows/docs.yml +15 -82
- package/templates/monoforge-headless/.github/workflows/publish.yml +11 -9
- package/templates/monoforge-headless/.github/workflows/test.yml +2 -2
- package/templates/monoforge-headless/TEMPLATE.md +1 -4
package/src/templates.mjs
CHANGED
|
@@ -18,11 +18,21 @@
|
|
|
18
18
|
// The registry is the source of truth for `stamp` (which copies a resolved
|
|
19
19
|
// profile into a new repo) and for the tests. It is the only place a profile
|
|
20
20
|
// is declared; adding one is one entry here.
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
21
|
+
import { join } from './paths.mjs'
|
|
22
|
+
import { getDefaultFs } from './fs-adapter.mjs'
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
// The template root is computed lazily from `import.meta.url` with a pure-JS
|
|
25
|
+
// file-URL reader, so the engine core imports NO `node:*` and stays bundleable
|
|
26
|
+
// for workerd. A worker consumer always passes an explicit `root` (it has no
|
|
27
|
+
// repo tree on disk), so this default is only ever evaluated under Node.
|
|
28
|
+
let ROOT_CACHE
|
|
29
|
+
const fileUrlToPath = (u) => decodeURIComponent(String(u).replace(/^file:\/\//, '').replace(/^\/([A-Za-z]:)/, '$1'))
|
|
30
|
+
const defaultRoot = () => (ROOT_CACHE ??= join(fileUrlToPath(new URL('..', import.meta.url))))
|
|
31
|
+
const defaultFs = () => {
|
|
32
|
+
const fs = getDefaultFs()
|
|
33
|
+
if (!fs) throw new Error('no storage adapter is set - pass { fs: memoryFs() } (see src/fs-adapter.mjs)')
|
|
34
|
+
return fs
|
|
35
|
+
}
|
|
26
36
|
|
|
27
37
|
// The profiles. `from` names the template dirs/files the stamp copies;
|
|
28
38
|
// `chain` names child profiles composed underneath this one. A leaf profile
|
|
@@ -83,13 +93,15 @@ export function resolveChain(name, seen = []) {
|
|
|
83
93
|
}
|
|
84
94
|
|
|
85
95
|
// Load a profile's file map (rel -> source path) by walking templates/<name>/.
|
|
86
|
-
// TEMPLATE.md is forge metadata, not payload, so it is skipped.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
// TEMPLATE.md is forge metadata, not payload, so it is skipped. The walk runs
|
|
97
|
+
// through the storage adapter, so a workers consumer seeding the template tree
|
|
98
|
+
// into memoryFs resolves the SAME chain as Node does on disk.
|
|
99
|
+
export function loadProfile(name, { fs = defaultFs(), root = defaultRoot() } = {}) {
|
|
100
|
+
const dir = join(root, 'templates', name)
|
|
101
|
+
if (!fs.existsSync(dir)) throw new Error(`template "${name}" is not present - the scaffold is missing templates/${name}/`)
|
|
90
102
|
const files = new Map()
|
|
91
103
|
const walk = (d, rel) => {
|
|
92
|
-
for (const e of readdirSync(d, { withFileTypes: true })) {
|
|
104
|
+
for (const e of fs.readdirSync(d, { withFileTypes: true })) {
|
|
93
105
|
const r = rel ? `${rel}/${e.name}` : e.name
|
|
94
106
|
if (e.isDirectory()) { walk(join(d, e.name), r); continue }
|
|
95
107
|
if (r === 'TEMPLATE.md') continue
|
|
@@ -102,16 +114,18 @@ export function loadProfile(name) {
|
|
|
102
114
|
|
|
103
115
|
// Resolve a profile into the file map `stamp` copies: children first, then the
|
|
104
116
|
// parent, parent wins on collision (vant's override rule).
|
|
105
|
-
export function resolveTemplate(name) {
|
|
117
|
+
export function resolveTemplate(name, opts = {}) {
|
|
106
118
|
const merged = new Map()
|
|
107
119
|
for (const profile of resolveChain(name)) {
|
|
108
|
-
for (const [rel, src] of loadProfile(profile)) merged.set(rel, src)
|
|
120
|
+
for (const [rel, src] of loadProfile(profile, opts)) merged.set(rel, src)
|
|
109
121
|
}
|
|
110
122
|
return merged
|
|
111
123
|
}
|
|
112
124
|
|
|
113
|
-
// CLI: --list / --resolve NAME, for eyeballing and for the tests.
|
|
114
|
-
|
|
125
|
+
// CLI: --list / --resolve NAME, for eyeballing and for the tests. Guarded so a
|
|
126
|
+
// worker bundle (no `process.argv`) evaluates nothing here.
|
|
127
|
+
const isNodeCli = typeof process !== 'undefined' && Array.isArray(process.argv) && process.argv[1]
|
|
128
|
+
if (isNodeCli && fileUrlToPath(import.meta.url) === fileUrlToPath(process.argv[1])) {
|
|
115
129
|
const argv = process.argv.slice(2)
|
|
116
130
|
if (argv.includes('--list')) {
|
|
117
131
|
for (const [name, cfg] of Object.entries(TEMPLATES)) {
|
|
@@ -123,7 +137,7 @@ if (import.meta.url === pathToFileURL(process.argv[1] || '').href) {
|
|
|
123
137
|
const i = argv.indexOf('--resolve')
|
|
124
138
|
if (i !== -1) {
|
|
125
139
|
const name = argv[i + 1]
|
|
126
|
-
const files = resolveTemplate(name)
|
|
140
|
+
const files = resolveTemplate(name, { root: defaultRoot() })
|
|
127
141
|
for (const rel of [...files.keys()].sort()) console.log(rel)
|
|
128
142
|
console.log(`# ${files.size} file(s) from ${resolveChain(name).join(' + ')}`)
|
|
129
143
|
process.exit(0)
|
package/src/workers.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/workers.mjs - the workers-native surface (monoforge#27).
|
|
2
|
+
//
|
|
3
|
+
// The coreforge rig vendored a fork of the stamp engine because workerd has no
|
|
4
|
+
// `node:fs`. This module is the surface that retires the fork: the stamp engine
|
|
5
|
+
// plus the storage adapters, with NO import that reaches `node:fs` statically.
|
|
6
|
+
// A Cloudflare Worker imports this, seeds its templates into `memoryFs()`, and
|
|
7
|
+
// calls `stamp(dir, { fs, root })` - the same truth machinery as Node, only the
|
|
8
|
+
// storage differs.
|
|
9
|
+
//
|
|
10
|
+
// Unlike `src/index.mjs`, this surface deliberately omits `doctor` and `lock`
|
|
11
|
+
// (they shell out to git and use `node:fs`); a worker that wants the battery
|
|
12
|
+
// runs it in Node. The engine (`stamp`) and the adapters are what the runtime
|
|
13
|
+
// boundary needs.
|
|
14
|
+
export { default as stamp, readFactoryConfig, tokenReplacements, stampToolName, sha256, RECEIPT } from './stamp.mjs'
|
|
15
|
+
export { memoryFs, FS_ADAPTER_METHODS, setDefaultFs, getDefaultFs } from './fs-adapter.mjs'
|
|
16
|
+
export { resolveTemplate, resolveChain, TEMPLATES } from './templates.mjs'
|
|
@@ -6,24 +6,15 @@
|
|
|
6
6
|
- **Core law:** FORGE-TODO:truth (the one-line law this tool enforces; the doctor reads this section down, so fill it, never stub it)
|
|
7
7
|
|
|
8
8
|
## Mechanical conventions (this repo)
|
|
9
|
-
- Source lives in `src/`, CLI in `bin/`. Keep `package.json` exports/bin
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
and run `npm test` FIRST to see whether the change is planned or a
|
|
14
|
-
regression you just caught by accident.
|
|
15
|
-
- All prose submits to the voice law: zero dashes of any kind, no
|
|
16
|
-
AI-cliche constructions, plain declarative sentences only. The doctor
|
|
17
|
-
enforces the dash part mechanically.
|
|
9
|
+
- Source lives in `src/`, CLI in `bin/`. Keep `package.json` exports/bin pointing at both.
|
|
10
|
+
- Fixtures are law: the negative test in `test/` asserts exact expected ids. Update fixtures and assertions in the same commit as a check change, and run `npm test` FIRST to see whether the change is planned or a regression you just caught by accident.
|
|
11
|
+
- All prose submits to the voice law: zero dashes of any kind, no AI-cliche constructions, plain declarative sentences only. The doctor enforces the dash part mechanically.
|
|
12
|
+
- Prose flows: never hard-wrap at a fixed column at commit time (the 72-column habit is dead). Paragraphs keep their natural length, and `scripts/unwrap-prose.cjs` joins hard-wrapped prose without touching frontmatter, fences, indented code, tables, headings, or thematic breaks. Run it over any markdown that regains the wrap.
|
|
18
13
|
- The walk-exit rule (the promotion rule, family law 2026-10-28, eyestruct@70dfbea): a manual walk is not done until nothing it found is uncommissioned. A probe that only ever lived in prose is a one-mortem; the walk's exit criterion is that every finding became permanent in the same session (a battery leg, a pack verdict row, or a named docket row) so future walks only see fresh ground. Walks DISCOVER classes; the battery REMEMBERS them. Worked example (eyestruct@70dfbea): a walk found a real product bug (served octet-stream for brand jpgs) and two prose-only probe claims; all three were commissioned same-session - the jpg refusal became a served-contract leg, the serve-dist HTTP-shape probes became a battery file, and the lint-packs exit-fidelity claim became its adapter-api leg.
|
|
19
14
|
|
|
20
15
|
## Release
|
|
21
|
-
- 0.9.0 = current manual npm. Bump to 1.0.0, tag v1.0.0, publish.yml runs
|
|
22
|
-
|
|
23
|
-
versions at the gate).
|
|
24
|
-
- CHANGELOG.md is Keep-a-Changelog. The `[Unreleased]` section is staged
|
|
25
|
-
content: it flips to the dated version header in the same commit that
|
|
26
|
-
carries the tag. Never mint a patch version for a docs-only change.
|
|
16
|
+
- 0.9.0 = current manual npm. Bump to 1.0.0, tag v1.0.0, publish.yml runs (see DEPLOY.md; OIDC trusted publishing; the workflow refuses 0.x versions at the gate).
|
|
17
|
+
- CHANGELOG.md is Keep-a-Changelog. The `[Unreleased]` section is staged content: it flips to the dated version header in the same commit that carries the tag. Never mint a patch version for a docs-only change.
|
|
27
18
|
|
|
28
19
|
## Landing & docs
|
|
29
20
|
- Landing: __SITE_URL__ (Cloudflare Pages; functions under `functions/`)
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to __NAME__ will be documented in this file.
|
|
4
4
|
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
6
|
|
|
8
7
|
## [Unreleased]
|
|
9
8
|
|
|
10
9
|
### Added
|
|
11
|
-
- Scaffold stamped by __STAMP_TOOL__ from the proven template blocks (docs
|
|
12
|
-
system, workflows, release ladder, gate scripts). FORGE-TODO:truth
|
|
13
|
-
here: list what the tool actually ships.
|
|
10
|
+
- Scaffold stamped by __STAMP_TOOL__ from the proven template blocks (docs system, workflows, release ladder, gate scripts). FORGE-TODO:truth here: list what the tool actually ships.
|
|
14
11
|
|
|
15
12
|
## [__VERSION__] - __STAMP_DATE__
|
|
16
13
|
|
|
@@ -1,53 +1,36 @@
|
|
|
1
1
|
# DEPLOY.md - __NAME__ release runbook
|
|
2
2
|
|
|
3
|
-
__NAME__ is an npm tool. Deploy = publish. The ladder follows the proven
|
|
4
|
-
fleet convention:
|
|
3
|
+
__NAME__ is an npm tool. Deploy = publish. The ladder follows the proven fleet convention:
|
|
5
4
|
|
|
6
|
-
1. **0.9.x is manual.** While the major is 0.x, publish by hand
|
|
7
|
-
(`npm publish`). The workflow refuses 0.x versions.
|
|
5
|
+
1. **0.9.x is manual.** While the major is 0.x, publish by hand (`npm publish`). The workflow refuses 0.x versions.
|
|
8
6
|
|
|
9
7
|
## The trifecta audit (run before every tag)
|
|
10
8
|
|
|
11
|
-
One walk over four artifacts, receipts over vibes (monoforge#10). Each member is
|
|
12
|
-
checked against what the tree ACTUALLY does, not what a prior cut said:
|
|
9
|
+
One walk over four artifacts, receipts over vibes (monoforge#10). Each member is checked against what the tree ACTUALLY does, not what a prior cut said:
|
|
13
10
|
|
|
14
|
-
1. **README** - usage lines match the real bin dispatch (no phantom flags), the
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
3. **Deploy lanes** - the `.github/workflows/*.yml` set: deploy env still matches
|
|
19
|
-
what README/DEPLOY claim, each lane discoverable from AGENTS.md.
|
|
20
|
-
4. **CHANGELOG** - keep-a-changelog discipline: one type heading per section,
|
|
21
|
-
`[Unreleased]` carries only REAL futures.
|
|
11
|
+
1. **README** - usage lines match the real bin dispatch (no phantom flags), the status line describes what is live, surfaces link docs/npm/workshop.
|
|
12
|
+
2. **AGENTS.md** - the agent's first read: where things live, the battery/lane workflow file names, the receipt inventory an agent may cite.
|
|
13
|
+
3. **Deploy lanes** - the `.github/workflows/*.yml` set: deploy env still matches what README/DEPLOY claim, each lane discoverable from AGENTS.md.
|
|
14
|
+
4. **CHANGELOG** - keep-a-changelog discipline: one type heading per section, `[Unreleased]` carries only REAL futures.
|
|
22
15
|
|
|
23
|
-
The walk is not done until every catch is commissioned in the same session (a
|
|
24
|
-
battery leg, a doc fix, or a named docket row) - the walk-exit rule in AGENTS.md.
|
|
16
|
+
The walk is not done until every catch is commissioned in the same session (a battery leg, a doc fix, or a named docket row) - the walk-exit rule in AGENTS.md.
|
|
25
17
|
|
|
26
18
|
## Release atomicity (ruled 2026-10-24 on crashtest#20)
|
|
27
19
|
|
|
28
|
-
- CHANGELOG `[Unreleased]` flips to the dated version header in the same
|
|
29
|
-
|
|
30
|
-
- Never mint a patch version for a docs-only change. Prefer retagging
|
|
31
|
-
that same commit.
|
|
20
|
+
- CHANGELOG `[Unreleased]` flips to the dated version header in the same commit that carries the tag.
|
|
21
|
+
- Never mint a patch version for a docs-only change. Prefer retagging that same commit.
|
|
32
22
|
|
|
33
23
|
## Ladder to automated publishes
|
|
34
24
|
|
|
35
25
|
1. Bump `package.json` + `CHANGELOG.md` to 1.0.0 (Unreleased, then dated).
|
|
36
26
|
2. `npm test` + `npm pack --dry-run` locally. Tag `v1.0.0`, push.
|
|
37
|
-
3. publish.yml: tags `v*` + `workflow_dispatch`, idempotent
|
|
38
|
-
already-published check (`npm view __NAME__@<version>`), `npm test`,
|
|
39
|
-
provenance publish (`id-token: write`). Refuses 0.x refs.
|
|
27
|
+
3. publish.yml: tags `v*` + `workflow_dispatch`, idempotent already-published check (`npm view __NAME__@<version>`), `npm test`, provenance publish (`id-token: write`). Refuses 0.x refs.
|
|
40
28
|
|
|
41
29
|
## Landing site (Cloudflare Pages, __SITE_URL__)
|
|
42
30
|
|
|
43
|
-
- `wrangler.toml` pins `pages_build_output_dir = "FORGE-TODO:dist-or-site"`:
|
|
44
|
-
whatever builds the site must emit there. (The author wires the real
|
|
45
|
-
build; Forge doctor flags this slot until it is filled.)
|
|
31
|
+
- `wrangler.toml` pins `pages_build_output_dir = "FORGE-TODO:dist-or-site"`: whatever builds the site must emit there. (The author wires the real build; Forge doctor flags this slot until it is filled.)
|
|
46
32
|
- `functions/api/health.js`: `GET /api/health` canary ships ready.
|
|
47
33
|
|
|
48
34
|
## Docs site (GitHub Pages via Actions, __DOCS_URL__)
|
|
49
35
|
|
|
50
|
-
- `.github/workflows/docs.yml`: docs-truth gates first (the six ported
|
|
51
|
-
checkers), Jekyll, `freestruct --strict` (basePath-aware), `pagefind`
|
|
52
|
-
from the proven musl tarball, official artifact deploy. First run needs
|
|
53
|
-
the Pages source set to "GitHub Actions" in repo settings.
|
|
36
|
+
- `.github/workflows/docs.yml`: docs-truth gates first (the six ported checkers), Jekyll, `freestruct --strict` (basePath-aware), `pagefind` from the proven musl tarball, official artifact deploy. First run needs the Pages source set to "GitHub Actions" in repo settings.
|
|
@@ -4,8 +4,7 @@ __PITCH__.
|
|
|
4
4
|
|
|
5
5
|
## What this shipping skeleton provides
|
|
6
6
|
|
|
7
|
-
(forge leaves this section to the author; it must describe what the tool
|
|
8
|
-
actually does. Replace this slot before the first push. FORGE-TODO:truth)
|
|
7
|
+
(forge leaves this section to the author; it must describe what the tool actually does. Replace this slot before the first push. FORGE-TODO:truth)
|
|
9
8
|
|
|
10
9
|
## Status
|
|
11
10
|
|
|
@@ -13,7 +13,4 @@ The full fleet scaffold - docs, gates, root docs, labs/horcrux, canary - chainin
|
|
|
13
13
|
|
|
14
14
|
GENERATED metadata for the template layer - `stamp` resolves this profile by reading this file's `chain:`.
|
|
15
15
|
|
|
16
|
-
This profile CHAINS monoforge-headless: `monoforge new` composes the child
|
|
17
|
-
profile(s) first, then overlays this profile's own files (parent wins on a path
|
|
18
|
-
collision). The `.github/` battery therefore lives once, in the headless
|
|
19
|
-
profile, and both shapes inherit it - one copy, no drift.
|
|
16
|
+
This profile CHAINS monoforge-headless: `monoforge new` composes the child profile(s) first, then overlays this profile's own files (parent wins on a path collision). The `.github/` battery therefore lives once, in the headless profile, and both shapes inherit it - one copy, no drift.
|
|
@@ -18,8 +18,7 @@ __PITCH__.
|
|
|
18
18
|
# documented usage here (keep this line honest: usage in docs must match the CLI)
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
The release ladder: 0.9.x is manual npm; 1.0.0 flips OIDC trusted publishing
|
|
22
|
-
(publish.yml refuses 0.x versions). See DEPLOY.md in the repo.
|
|
21
|
+
The release ladder: 0.9.x is manual npm; 1.0.0 flips OIDC trusted publishing (publish.yml refuses 0.x versions). See DEPLOY.md in the repo.
|
|
23
22
|
|
|
24
23
|
<div class="crosslinks">
|
|
25
24
|
<p><strong>More in these docs:</strong>
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
# horcrux - __NAME__
|
|
2
2
|
|
|
3
|
-
Continuance stones live in dhaupin/creadev `horcrux/` (the fleet's private
|
|
4
|
-
workspace) until this repo earns its public copy. Boot convention:
|
|
5
|
-
`<agent>-p_<password>.svg`, the text after p_ IS the key. The mind itself
|
|
6
|
-
lives in the vant workspace at models/public/__NAME__/ (identity, goals,
|
|
7
|
-
lessons).
|
|
3
|
+
Continuance stones live in dhaupin/creadev `horcrux/` (the fleet's private workspace) until this repo earns its public copy. Boot convention: `<agent>-p_<password>.svg`, the text after p_ IS the key. The mind itself lives in the vant workspace at models/public/__NAME__/ (identity, goals, lessons).
|
|
@@ -3,9 +3,5 @@
|
|
|
3
3
|
Last updated: __STAMP_DATE__ (stamped by __STAMP_TOOL__; queue is empty by design)
|
|
4
4
|
|
|
5
5
|
## Landing queue
|
|
6
|
-
- [ ] Fill every FORGE-TODO:truth slot before the first push (README,
|
|
7
|
-
|
|
8
|
-
Added list, DEPLOY pages output dir, docs PITCH). The doctor
|
|
9
|
-
flags unfilled slots; statuses must be true.
|
|
10
|
-
- [ ] Push pending: repo connection (the Freebuff app reconnect gates
|
|
11
|
-
both the push and the CI).
|
|
6
|
+
- [ ] Fill every FORGE-TODO:truth slot before the first push (README, AGENTS core law, CHANGELOG Added list, DEPLOY pages output dir, docs PITCH). The doctor flags unfilled slots; statuses must be true.
|
|
7
|
+
- [ ] Push pending: repo connection (the Freebuff app reconnect gates both the push and the CI).
|
|
@@ -33,7 +33,7 @@ const fs = require('fs');
|
|
|
33
33
|
const path = require('path');
|
|
34
34
|
|
|
35
35
|
// --root <dir> checks a tree other than this one (tests + adopters),
|
|
36
|
-
// the family gate convention (
|
|
36
|
+
// the family gate convention (coreforge lib/root.cjs).
|
|
37
37
|
const rootArg = process.argv.indexOf('--root');
|
|
38
38
|
const ROOT = rootArg !== -1 ? path.resolve(process.argv[rootArg + 1]) : path.resolve(__dirname, '..');
|
|
39
39
|
const DOCS = path.join(ROOT, 'docs');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Fiction-signature gate - the
|
|
3
|
+
* Fiction-signature gate - the coreforge shell edition (same scanner logic
|
|
4
4
|
* the struct-family repos run; the seed signatures below are GENERIC, and
|
|
5
5
|
* the shell house law is:
|
|
6
6
|
*
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict'
|
|
3
|
+
|
|
4
|
+
// Unwrap prose in markdown: join lines that belong to one paragraph or one
|
|
5
|
+
// list item into a single line. Never touches frontmatter (a `--- ... ---`
|
|
6
|
+
// block at the very top of the file), fenced code (``` blocks), INDENTED code
|
|
7
|
+
// (4+ leading spaces), table rows (| lines), headings, thematic breaks
|
|
8
|
+
// (--- / *** / ___), or blank-line boundaries. The point: the 72-column
|
|
9
|
+
// commit-time habit is dead - prose flows, and future agents must not re-wrap
|
|
10
|
+
// it.
|
|
11
|
+
//
|
|
12
|
+
// Frontmatter is only the block at line 1, and only when line 1 looks like a
|
|
13
|
+
// `key: value` pair. A bare `---` horizontal rule later in the file (labs/
|
|
14
|
+
// TASKS.md has one at line 7) must NOT be read as an opening fence, or the
|
|
15
|
+
// whole document after it stops unwrapping.
|
|
16
|
+
//
|
|
17
|
+
// Indented code is structural: a line indented 4+ spaces (and not a list
|
|
18
|
+
// marker, table row, or heading) is verbatim, so a Markdown example block
|
|
19
|
+
// (` packs/public/... -> ...`) survives. Joining those collapsed two code
|
|
20
|
+
// lines onto one and corrupted the example.
|
|
21
|
+
//
|
|
22
|
+
// A thematic break (--- / *** / ___) flushes the buffer instead of joining
|
|
23
|
+
// into it. Without that, TASKS.md's pass separators and CHANGELOG's rules
|
|
24
|
+
// collapse into prose. Hardened from the prestruct / eyestruct@3adda1d
|
|
25
|
+
// originals, merged with the indented-code and HTML-block fixes below.
|
|
26
|
+
//
|
|
27
|
+
// Usage: node scripts/unwrap-prose.cjs <file.md> [file2.md ...]
|
|
28
|
+
|
|
29
|
+
const fs = require('fs')
|
|
30
|
+
|
|
31
|
+
function unwrap(textOrLines) {
|
|
32
|
+
const lines = Array.isArray(textOrLines) ? textOrLines : textOrLines.split('\n')
|
|
33
|
+
const out = []
|
|
34
|
+
let fenced = false
|
|
35
|
+
let inHtml = false
|
|
36
|
+
|
|
37
|
+
const isCodeLines = (ln) => /^\s*```/.test(ln)
|
|
38
|
+
const isTableRow = (ln) => /^\s*\|/.test(ln)
|
|
39
|
+
const isHeading = (ln) => /^#{1,6} /.test(ln)
|
|
40
|
+
const isBlank = (ln) => ln.trim() === ''
|
|
41
|
+
// A thematic break (horizontal rule): ---, ***, ___ (3+, optional spaces).
|
|
42
|
+
// Distinct from a frontmatter fence, which only opens/closes at file start.
|
|
43
|
+
const isRule = (ln) => /^ {0,3}([-*_])( *\1){2,} *$/.test(ln)
|
|
44
|
+
// Indented code: 4+ leading spaces that are not a nested list marker or a
|
|
45
|
+
// table row. Structural (verbatim), so an example block is never joined.
|
|
46
|
+
const isIndentedCode = (ln) => /^ {4,}\S/.test(ln) && !/^ {4,}([-*+] |\d+\. )/.test(ln) && !isTableRow(ln)
|
|
47
|
+
// An HTML block starts at a line whose first non-space char is `<` and runs
|
|
48
|
+
// to the next blank line (the Markdown rule). Verbatim, so a multi-line
|
|
49
|
+
// `<div>`/`<p>` footer is never collapsed onto one line.
|
|
50
|
+
const isHtmlStart = (ln) => /^\s*</.test(ln)
|
|
51
|
+
|
|
52
|
+
// Frontmatter exists only when line 0 is a `---` fence, line 1 looks like a
|
|
53
|
+
// `key: value` pair, and a closing `---` follows. A bare top-of-file rule is
|
|
54
|
+
// not frontmatter.
|
|
55
|
+
const hasFrontmatter =
|
|
56
|
+
lines[0] !== undefined && lines[0].trim() === '---' &&
|
|
57
|
+
/^[A-Za-z0-9_.-]+\s*:/.test(lines[1] || '')
|
|
58
|
+
let fmClose = -1
|
|
59
|
+
if (hasFrontmatter) {
|
|
60
|
+
for (let j = 1; j < lines.length; j++) {
|
|
61
|
+
if (lines[j].trim() === '---') { fmClose = j; break }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let buf = null
|
|
66
|
+
|
|
67
|
+
for (let i = 0; i < lines.length; i++) {
|
|
68
|
+
const ln = lines[i]
|
|
69
|
+
|
|
70
|
+
// Frontmatter block: emitted verbatim, never joined.
|
|
71
|
+
if (fmClose >= 0 && i <= fmClose) {
|
|
72
|
+
if (buf != null) { out.push(buf); buf = null }
|
|
73
|
+
out.push(ln)
|
|
74
|
+
continue
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (isCodeLines(ln)) {
|
|
78
|
+
fenced = !fenced
|
|
79
|
+
if (buf != null) { out.push(buf); buf = null }
|
|
80
|
+
out.push(ln)
|
|
81
|
+
continue
|
|
82
|
+
}
|
|
83
|
+
if (fenced) { out.push(ln); continue }
|
|
84
|
+
|
|
85
|
+
// An HTML block runs verbatim to the next blank line (the Markdown rule).
|
|
86
|
+
if (inHtml) {
|
|
87
|
+
if (isBlank(ln)) {
|
|
88
|
+
inHtml = false
|
|
89
|
+
out.push(ln)
|
|
90
|
+
} else {
|
|
91
|
+
out.push(ln)
|
|
92
|
+
}
|
|
93
|
+
continue
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (isBlank(ln)) {
|
|
97
|
+
if (buf != null) { out.push(buf); buf = null }
|
|
98
|
+
out.push(ln)
|
|
99
|
+
continue
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// A list item may be indented (nested bullets); its marker, not its
|
|
103
|
+
// column, is what makes it structural. A wrapped continuation line never
|
|
104
|
+
// starts with a marker, so this keeps nested lists intact instead of
|
|
105
|
+
// flattening them into the parent paragraph.
|
|
106
|
+
const listStart = /^\s*([-*+] |\d+\. )/.test(ln)
|
|
107
|
+
const quoteStart = /^>/.test(ln)
|
|
108
|
+
const tableRow = isTableRow(ln)
|
|
109
|
+
const heading = isHeading(ln)
|
|
110
|
+
|
|
111
|
+
// HTML blocks only START at a block boundary (buf null): mid-paragraph a
|
|
112
|
+
// `<em>` continuation belongs to the paragraph, not a new block.
|
|
113
|
+
if (isHtmlStart(ln) && buf === null) {
|
|
114
|
+
inHtml = true
|
|
115
|
+
out.push(ln.replace(/\s+$/, ''))
|
|
116
|
+
continue
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (tableRow || heading || isRule(ln)) {
|
|
120
|
+
if (buf != null) { out.push(buf); buf = null }
|
|
121
|
+
out.push(ln)
|
|
122
|
+
continue
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (listStart) {
|
|
126
|
+
if (buf != null) { out.push(buf); buf = null }
|
|
127
|
+
buf = ln.replace(/\s+$/, '')
|
|
128
|
+
continue
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (quoteStart) {
|
|
132
|
+
if (buf != null) { out.push(buf); buf = null }
|
|
133
|
+
buf = ln.replace(/\s+$/, '')
|
|
134
|
+
continue
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Indented code only STARTS a block: at the head of a block (buf null) a
|
|
138
|
+
// 4+ space line is verbatim. Mid-block it is a wrapped continuation of the
|
|
139
|
+
// current paragraph or list item, so the join below still applies (a
|
|
140
|
+
// nested bullet's wrapped second line is indented, not code).
|
|
141
|
+
if (isIndentedCode(ln) && buf === null) {
|
|
142
|
+
out.push(ln.replace(/\s+$/, ''))
|
|
143
|
+
continue
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Continuation line: join into the current buffer.
|
|
147
|
+
if (buf != null) {
|
|
148
|
+
buf = buf.replace(/\s+$/, '') + ' ' + ln.trim()
|
|
149
|
+
} else {
|
|
150
|
+
buf = ln.replace(/\s+$/, '')
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (buf != null) out.push(buf)
|
|
154
|
+
// Collapse runs of >2 consecutive blank lines down to one.
|
|
155
|
+
const collapsed = []
|
|
156
|
+
let blanks = 0
|
|
157
|
+
for (const ln of out) {
|
|
158
|
+
if (ln.trim() === '') {
|
|
159
|
+
blanks++
|
|
160
|
+
if (blanks > 1) continue
|
|
161
|
+
} else blanks = 0
|
|
162
|
+
collapsed.push(ln)
|
|
163
|
+
}
|
|
164
|
+
return collapsed.join('\n')
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (require.main === module) {
|
|
168
|
+
for (const file of process.argv.slice(2)) {
|
|
169
|
+
const src = fs.readFileSync(file, 'utf8')
|
|
170
|
+
const unwrapped = unwrap(src)
|
|
171
|
+
fs.writeFileSync(file, unwrapped)
|
|
172
|
+
const before = src.split('\n').filter((l) => l.trim() !== '').length
|
|
173
|
+
const after = unwrapped.split('\n').filter((l) => l.trim() !== '').length
|
|
174
|
+
console.log(`${file}: ${before} non-blank -> ${after} non-blank lines`)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = { unwrap }
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# docs - a THIN caller of THE one docs lane (dhaupin/freestruct).
|
|
2
|
+
#
|
|
3
|
+
# The runbook (Jekyll, the hardened pagefind scrape, the pinned freestruct
|
|
4
|
+
# post-build layer, the optional crashtest dogfood campaign, the Pages upload,
|
|
5
|
+
# the main-gated deploy) lives ONCE in the lane. This file keeps only what is
|
|
6
|
+
# per-repo: the trigger, the permissions, and the concurrency group. The lane
|
|
7
|
+
# defaults (ruby 3.4, node 22, freestruct 1.2.0 EXACT, --strict) fit a repo
|
|
8
|
+
# that brings its own docs tree; pass `with:` inputs to override them.
|
|
9
|
+
#
|
|
10
|
+
# The docs truth gates (npm run lint:docs) run in test.yml, not here: a
|
|
11
|
+
# workflow_call caller cannot carry extra steps, so they stay in the battery.
|
|
1
12
|
name: docs
|
|
2
13
|
|
|
3
14
|
on:
|
|
@@ -18,85 +29,7 @@ concurrency:
|
|
|
18
29
|
cancel-in-progress: false
|
|
19
30
|
|
|
20
31
|
jobs:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- uses: actions/setup-node@v4
|
|
27
|
-
with: { node-version: 20 }
|
|
28
|
-
|
|
29
|
-
# Docs truth gates (ported house checkers): frontmatter 5-field law,
|
|
30
|
-
# resolvable links, style law (no dashes in prose, language-tagged
|
|
31
|
-
# fences, no trailing ws), fiction-signature seeds, the two-argument
|
|
32
|
-
# Liquid filter trap, English-only prose.
|
|
33
|
-
- name: Docs gates
|
|
34
|
-
run: |
|
|
35
|
-
node scripts/check-docs-frontmatter.cjs
|
|
36
|
-
node scripts/check-docs-links.cjs
|
|
37
|
-
node scripts/check-docs-style.cjs
|
|
38
|
-
node scripts/check-fiction-signatures.cjs
|
|
39
|
-
node scripts/check-jekyll-filters.cjs
|
|
40
|
-
node scripts/check-language.cjs
|
|
41
|
-
|
|
42
|
-
- name: Setup Ruby
|
|
43
|
-
uses: ruby/setup-ruby@v1
|
|
44
|
-
with:
|
|
45
|
-
ruby-version: '3.3'
|
|
46
|
-
bundler-cache: true
|
|
47
|
-
cache-version: 1
|
|
48
|
-
|
|
49
|
-
- name: Setup Pages
|
|
50
|
-
id: pages
|
|
51
|
-
uses: actions/configure-pages@v4
|
|
52
|
-
|
|
53
|
-
- name: Install deps
|
|
54
|
-
working-directory: docs
|
|
55
|
-
run: bundle install
|
|
56
|
-
|
|
57
|
-
# House-measured: the pagefind npm package resolves a platform binary at
|
|
58
|
-
# install and an npx fallback DIED in CI ("Failed to install either of
|
|
59
|
-
# [pagefind_extended, pagefind]" - dhaupin/freestruct docs.yml note).
|
|
60
|
-
# The standalone musl tarball is the proven path (prestruct docs.yml).
|
|
61
|
-
- name: Download Pagefind
|
|
62
|
-
working-directory: docs
|
|
63
|
-
run: |
|
|
64
|
-
VERSION=$(curl -sL "https://api.github.com/repos/Pagefind/pagefind/releases/latest" | grep '"tag_name"' | sed 's/.*"v\([^\"]*\)".*/\1/')
|
|
65
|
-
curl -sL "https://github.com/Pagefind/pagefind/releases/download/v${VERSION}/pagefind-v${VERSION}-x86_64-unknown-linux-musl.tar.gz" -o pagefind.tar.gz
|
|
66
|
-
tar -xzf pagefind.tar.gz
|
|
67
|
-
rm pagefind.tar.gz
|
|
68
|
-
|
|
69
|
-
- name: Jekyll build
|
|
70
|
-
working-directory: docs
|
|
71
|
-
run: bundle exec jekyll build
|
|
72
|
-
|
|
73
|
-
# freestruct AFTER jekyll (post-render SEO layer; discovers
|
|
74
|
-
# docs/freestruct.config.yml + docs/_site by the engine's own rule) --
|
|
75
|
-
# --strict: broken links fail the build.
|
|
76
|
-
- name: Freestruct (strict)
|
|
77
|
-
run: npx --yes freestruct@1.1.0 --strict
|
|
78
|
-
|
|
79
|
-
# Pagefind LAST - index over the FINAL html (freestruct-injected)
|
|
80
|
-
- name: Index search with Pagefind
|
|
81
|
-
working-directory: docs
|
|
82
|
-
run: ./pagefind --site _site
|
|
83
|
-
|
|
84
|
-
- name: Upload artifact
|
|
85
|
-
id: upload-artifact
|
|
86
|
-
uses: actions/upload-pages-artifact@v3
|
|
87
|
-
with:
|
|
88
|
-
path: 'docs/_site'
|
|
89
|
-
|
|
90
|
-
deploy:
|
|
91
|
-
needs: build
|
|
92
|
-
# The integration branch is in the trigger list, so the trigger no longer
|
|
93
|
-
# keeps staging's docs out of production - this guard does (flowforge#30,
|
|
94
|
-
# point 3: the trap). Only a promotion to main deploys.
|
|
95
|
-
if: github.ref == 'refs/heads/main'
|
|
96
|
-
runs-on: ubuntu-latest
|
|
97
|
-
environment:
|
|
98
|
-
name: github-pages
|
|
99
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
100
|
-
steps:
|
|
101
|
-
- id: deployment
|
|
102
|
-
uses: actions/deploy-pages@v4
|
|
32
|
+
docs:
|
|
33
|
+
# Pinned to the lane's SHA (pins, never floats): a moving @main would let
|
|
34
|
+
# the runbook change under us between runs.
|
|
35
|
+
uses: dhaupin/freestruct/.github/workflows/docs-lane.yml@22bb7e9b2634d6cdd966963d9e25c7f892577276 # main
|
|
@@ -44,9 +44,9 @@ jobs:
|
|
|
44
44
|
steps:
|
|
45
45
|
# fetch-depth: 0 - the verify ladder's git archive needs the release
|
|
46
46
|
# commit reachable.
|
|
47
|
-
- uses: actions/checkout@v4
|
|
47
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
48
48
|
with: { fetch-depth: 0 }
|
|
49
|
-
- uses: actions/setup-node@v4
|
|
49
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
50
50
|
with:
|
|
51
51
|
node-version: 20
|
|
52
52
|
registry-url: https://registry.npmjs.org
|
|
@@ -79,7 +79,7 @@ jobs:
|
|
|
79
79
|
needs: publish
|
|
80
80
|
runs-on: ubuntu-latest
|
|
81
81
|
steps:
|
|
82
|
-
- uses: actions/checkout@v4
|
|
82
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
83
83
|
# Notes are EXTRACTED from the CHANGELOG's own [version] section - a
|
|
84
84
|
# release body that disagrees with the changelog is drift, and an empty
|
|
85
85
|
# extraction refuses the cut. notes.md lives in RUNNER_TEMP: never a
|
|
@@ -110,11 +110,13 @@ jobs:
|
|
|
110
110
|
gh release create "$BLOCK_TAG" --title "__NAME__ $BLOCK_VERSION" --notes-file "$RUNNER_TEMP/notes.md"
|
|
111
111
|
fi
|
|
112
112
|
|
|
113
|
-
# The verify leg
|
|
114
|
-
#
|
|
115
|
-
#
|
|
113
|
+
# The verify leg judges what the registry and GitHub actually serve, so it
|
|
114
|
+
# waits for release to cut the object and attach the tarball (a bare
|
|
115
|
+
# `needs: publish` let verify race release and red-flag a cut that landed).
|
|
116
|
+
# It ALSO stands alone in verify-only mode (publish skipped, release
|
|
117
|
+
# skipped, the ladder judged against what is already served and released).
|
|
116
118
|
verify:
|
|
117
|
-
needs: publish
|
|
119
|
+
needs: [publish, release]
|
|
118
120
|
if: >-
|
|
119
121
|
always() &&
|
|
120
122
|
(needs.publish.result == 'success' ||
|
|
@@ -123,8 +125,8 @@ jobs:
|
|
|
123
125
|
permissions:
|
|
124
126
|
contents: read
|
|
125
127
|
steps:
|
|
126
|
-
- uses: actions/checkout@v4
|
|
127
|
-
- uses: actions/setup-node@v4
|
|
128
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
129
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
128
130
|
with: { node-version: 20 }
|
|
129
131
|
- name: the post-publish trust ladder
|
|
130
132
|
env:
|
|
@@ -6,8 +6,8 @@ jobs:
|
|
|
6
6
|
test:
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
steps:
|
|
9
|
-
- uses: actions/checkout@v4
|
|
10
|
-
- uses: actions/setup-node@v4
|
|
9
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
10
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
11
11
|
with: { node-version: 20 }
|
|
12
12
|
- run: npm install --no-fund --no-audit
|
|
13
13
|
- run: npm test
|
|
@@ -11,7 +11,4 @@ CI only - the .github/ battery (test, docs, publish), no scaffold.
|
|
|
11
11
|
|
|
12
12
|
GENERATED metadata for the template layer - `stamp` resolves this profile by reading this file's `chain:`.
|
|
13
13
|
|
|
14
|
-
This profile is a leaf: it carries its files and chains nothing. A repo that
|
|
15
|
-
brings its own docs tree still inherits the gates, the docs lane, and the
|
|
16
|
-
release ladder by stamping this profile alone (`factory.json.profile =
|
|
17
|
-
"monoforge-headless"`).
|
|
14
|
+
This profile is a leaf: it carries its files and chains nothing. A repo that brings its own docs tree still inherits the gates, the docs lane, and the release ladder by stamping this profile alone (`factory.json.profile = "monoforge-headless"`).
|