monoforge 1.1.0 → 1.2.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 CHANGED
@@ -1,4 +1,4 @@
1
- # monoforge 1.1.0
1
+ # monoforge 1.2.0
2
2
 
3
3
  The struct-family factory: stamp a fleet repo from proven template blocks, doctor it for truth, lock it verifiably.
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoforge",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "The struct-family factory: stamps a new fleet repo from proven template blocks, doctors it for truth, and locks it. Generated green is never shipped: the doctor refuses placeholder text and unverified gates.\n",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,9 +33,9 @@
33
33
  "lint:prestruct-pins": "node scripts/check-prestruct-pins.cjs"
34
34
  },
35
35
  "devDependencies": {
36
- "eyestruct": "1.0.0",
37
- "packstruct": "1.0.0",
38
- "crashtest": "1.1.0"
36
+ "eyestruct": "1.1.0",
37
+ "packstruct": "1.1.0",
38
+ "crashtest": "1.3.0"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=20"
@@ -19,6 +19,7 @@
19
19
  "E_LOCK_REFUSED": "lock refused because the doctor reported at least one failure",
20
20
  "E_NPM_TEST": "npm test failed over the tree",
21
21
  "E_PACKAGE_JSON": "package.json is not valid JSON",
22
+ "E_PACKS_UNDELIVERED": "a committed packs/public/<name>/ pack is not delivered by package.json `files` (npm would drop it from the tarball, poststruct#79)",
22
23
  "E_PROFILE_UNKNOWN": "factory.json profile is not a known profile",
23
24
  "E_PUBLISH_GATE": "publish.yml does not refuse 0.x refs (the OIDC ladder gate)",
24
25
  "E_PUBLISH_TOKEN": "publish.yml references a publish token (the law is OIDC only)",
package/src/doctor.mjs CHANGED
@@ -21,6 +21,7 @@ export const CODE_BY_ID = {
21
21
  'bin-path': 'E_BIN_PATH',
22
22
  'exports-path': 'E_EXPORTS_PATH',
23
23
  'files-path': 'E_FILES_PATH',
24
+ 'packs-undelivered': 'E_PACKS_UNDELIVERED',
24
25
  'publish-gate': 'E_PUBLISH_GATE',
25
26
  'publish-token': 'E_PUBLISH_TOKEN',
26
27
  'npm-test': 'E_NPM_TEST',
@@ -134,6 +135,22 @@ export default async function doctor(dir, opts = {}) {
134
135
  const p3 = join(dir, f)
135
136
  if (!existsSync(p3) && !f.includes('*')) fail('files-path', `files entry ${f} does not exist in the tree`, f)
136
137
  }
138
+ // The inverse of files-path (poststruct#79): a COMMITTED pack must be
139
+ // DELIVERED. npm honours `files`, so a pack tree excluded there is
140
+ // invisible to `npm i <pkg>` even though it is committed and green. A
141
+ // tree with no packs/public/ stays silent - this is canon-free, it only
142
+ // bites a repo that already chose to carry packs.
143
+ const packsRoot = join(dir, 'packs', 'public')
144
+ if (existsSync(packsRoot)) {
145
+ let packDirs = []
146
+ try { packDirs = readdirSync(packsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name) } catch { packDirs = [] }
147
+ const whitelist = pkg.files || []
148
+ const barePacks = whitelist.some((f) => f === 'packs' || f === 'packs/')
149
+ for (const name of packDirs) {
150
+ const covered = barePacks || whitelist.some((f) => f === `packs/public/${name}` || f === `packs/public/${name}/`)
151
+ if (!covered) fail('packs-undelivered', `committed pack packs/public/${name}/ is not delivered by package.json \`files\` - npm would drop it from the tarball (add "packs/" or "packs/public/${name}")`, `packs/public/${name}`)
152
+ }
153
+ }
137
154
  if (!pkg.description || pkg.description.length < 10) warn('description', 'package.json description missing or too thin')
138
155
  if ((pkg.engines?.node || '') < '>=20') warn('engines', 'engines.node floor not >=20 (house runtime floor)')
139
156
  // 4. publish.yml refuses 0.x AND carries no publish token
@@ -1,14 +1,14 @@
1
- /* __NAME__ docs theme — the fleet stone look, dark. */
2
- :root { --bg: #0c0f0a; --fg: #e6e8dd; --accent: #a8c000; --muted: #9aa38f; --card: #14180f; }
1
+ /* __NAME__ docs theme — the fleet stone look, light. */
2
+ :root { --bg: #f4f5ee; --fg: #1c2012; --accent: #5a6a00; --muted: #5d6550; --card: #ffffff; }
3
3
  body { background: var(--bg); color: var(--fg); max-width: 42rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; font: 16px/1.65 system-ui, sans-serif }
4
4
  nav a, a { color: var(--accent) }
5
5
  table { width: 100%; border-collapse: collapse }
6
- th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #22281b }
6
+ th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #d6dac8 }
7
7
  th { color: var(--muted); text-transform: uppercase; font-size: .75rem; letter-spacing: .08em }
8
8
  code, pre { background: var(--card); border-radius: 6px; font: .9em ui-monospace, monospace }
9
9
  pre { padding: .75rem 1rem; overflow-x: auto }
10
10
  footer { margin-top: 3rem; color: var(--muted); font-size: .85rem }
11
11
  header nav { margin-bottom: 2.5rem; font-size: .9rem }
12
12
  h1, h2 { letter-spacing: -0.02em }
13
- .crosslinks { border-top: 1px solid #22281b; margin-top: 2.5rem; padding-top: 1.25rem; color: var(--muted); font-size: .92rem }
14
- footer { border-top: 1px solid #22281b; padding-top: 1.25rem }
13
+ .crosslinks { border-top: 1px solid #d6dac8; margin-top: 2.5rem; padding-top: 1.25rem; color: var(--muted); font-size: .92rem }
14
+ footer { border-top: 1px solid #d6dac8; padding-top: 1.25rem }
@@ -5,3 +5,4 @@ site:
5
5
  url: https://docs.creadev.org
6
6
  description: The shared /packs SPEC — manifest contract, entry profiles, lifecycle, and the lint CLI.
7
7
  basePath: /__NAME__
8
+ breadcrumb: true
@@ -7,6 +7,6 @@
7
7
  set -e
8
8
  cd "$(dirname "$0")/.."
9
9
  ( cd docs && bundle exec jekyll build )
10
- npx --yes freestruct@1.1.0 --strict # discovers docs/freestruct.config.yml + docs/_site
10
+ npx --yes freestruct@1.3.0 --strict # discovers docs/freestruct.config.yml + docs/_site
11
11
  npx --yes pagefind --site docs/_site # local-dev only, see note
12
12
  echo "docs build complete: docs/_site"
@@ -4,7 +4,7 @@
4
4
  # post-build layer, the optional crashtest dogfood campaign, the Pages upload,
5
5
  # the main-gated deploy) lives ONCE in the lane. This file keeps only what is
6
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
7
+ # defaults (ruby 3.4, node 22, freestruct 1.3.0 EXACT, --strict) fit a repo
8
8
  # that brings its own docs tree; pass `with:` inputs to override them.
9
9
  #
10
10
  # The docs truth gates (npm run lint:docs) run in test.yml, not here: a
@@ -32,4 +32,4 @@ jobs:
32
32
  docs:
33
33
  # Pinned to the lane's SHA (pins, never floats): a moving @main would let
34
34
  # the runbook change under us between runs.
35
- uses: dhaupin/freestruct/.github/workflows/docs-lane.yml@22bb7e9b2634d6cdd966963d9e25c7f892577276 # main
35
+ uses: dhaupin/freestruct/.github/workflows/docs-lane.yml@7dfb1722d16b2ee173e8d4cbbd6106eecec11a1a # main
@@ -1,22 +1,36 @@
1
- # staging-ff-sync - after a promotion to main, fast-forward the permanent
2
- # staging integration branch to main (monoforge#20, the family staging flow).
1
+ # staging-ff-sync - keep the permanent staging integration branch a fast-forward
2
+ # mirror of main (monoforge#20, the family staging flow), and self-heal it if it
3
+ # is ever deleted.
3
4
  #
4
- # A merge-commit promotion puts a commit on main that staging lacks, so the
5
- # two drift by one on every promotion even when the flow is followed exactly.
6
- # This job is the required sync step: staging is a mirror of the integration
7
- # state, never a second line of history, so a fast-forward is the only move -
8
- # never a merge, never a force-push.
5
+ # A merge-commit promotion puts a commit on main that staging lacks, so the two
6
+ # drift by one on every promotion even when the flow is followed exactly. The
7
+ # sync step is required: staging is a mirror of the integration state, never a
8
+ # second line of history, so a fast-forward is the only move - never a merge,
9
+ # never a force-push.
9
10
  #
10
- # Non-destructive by construction: `git push origin origin/main:staging` with
11
- # a fast-forward-only refspec. If staging has moved ahead of main the push is
12
- # refused and this job fails loudly, which is the signal that a commit landed
13
- # on staging that main does not have.
11
+ # Non-destructive by construction: `git push origin origin/main:staging` with a
12
+ # fast-forward-only refspec. If staging has moved ahead of main the push is
13
+ # refused and the job fails loudly, which is the signal that a commit landed on
14
+ # staging that main does not have.
15
+ #
16
+ # Self-healing (the delete trap): `gh pr merge --delete-branch` deletes the
17
+ # PR's HEAD branch, and a promote PR's head IS staging - so the one command
18
+ # that reads as tidy housekeeping deletes the permanent branch. Two triggers
19
+ # cover it: the `delete` event restores staging the moment it is removed, and
20
+ # the `push: main` pass restores it too if a run ever lands first. The restore
21
+ # target is main, the same commit the fast-forward would set, so both
22
+ # invariants (staging == main, staging never a second line of history) hold.
23
+ #
24
+ # This job cannot PREVENT a delete - only the owner can, by restricting
25
+ # deletion of `staging` (a ruleset or branch protection), which is a repo-admin
26
+ # action, not a repo-file one. This is the belt for that missing suspender.
14
27
 
15
28
  name: Sync staging to main
16
29
 
17
30
  on:
18
31
  push:
19
32
  branches: [main]
33
+ delete:
20
34
  workflow_dispatch:
21
35
 
22
36
  permissions:
@@ -30,15 +44,31 @@ jobs:
30
44
  ff-sync:
31
45
  runs-on: ubuntu-latest
32
46
  steps:
33
- - name: Fast-forward staging to main
47
+ - name: Fast-forward (or restore) staging to main
34
48
  env:
35
49
  TOKEN: ${{ secrets.GITHUB_TOKEN }}
50
+ EVENT: ${{ github.event_name }}
51
+ DELETED_REF: ${{ github.event.ref }}
52
+ DELETED_TYPE: ${{ github.event.ref_type }}
36
53
  run: |
37
54
  set -euo pipefail
55
+
56
+ # A delete event for anything but the staging BRANCH is not ours.
57
+ if [ "$EVENT" = "delete" ] && { [ "$DELETED_TYPE" != "branch" ] || [ "$DELETED_REF" != "staging" ]; }; then
58
+ echo "delete event for '$DELETED_REF' ($DELETED_TYPE) - not the staging branch, nothing to do."
59
+ exit 0
60
+ fi
61
+
38
62
  git init -q .
39
63
  git remote add origin "https://x-access-token:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
40
- git fetch -q origin main staging
41
- # Fast-forward only: the refspec requires staging to be an ancestor
42
- # of main. `git push` refuses a non-fast-forward update, so a
43
- # divergence fails the job instead of rewriting history.
44
- git push origin origin/main:refs/heads/staging
64
+ git fetch -q origin main
65
+
66
+ if git fetch -q origin staging 2>/dev/null; then
67
+ # Fast-forward only: the refspec requires staging to be an ancestor
68
+ # of main. `git push` refuses a non-fast-forward update, so a
69
+ # divergence fails the job instead of rewriting history.
70
+ git push origin origin/main:refs/heads/staging
71
+ else
72
+ echo "staging is missing - recreating it at main (the fast-forward target)."
73
+ git push origin origin/main:refs/heads/staging
74
+ fi