monoforge 0.0.0-stage → 0.9.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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -2
  3. package/bin/forge.mjs +65 -0
  4. package/package.json +49 -4
  5. package/src/cut.mjs +244 -0
  6. package/src/doctor.mjs +230 -0
  7. package/src/index.mjs +4 -0
  8. package/src/lint-packs.mjs +77 -0
  9. package/src/lock.mjs +37 -0
  10. package/src/stamp.mjs +201 -0
  11. package/src/templates.mjs +133 -0
  12. package/templates/monoforge/AGENTS.md +30 -0
  13. package/templates/monoforge/CHANGELOG.md +19 -0
  14. package/templates/monoforge/DEPLOY.md +53 -0
  15. package/templates/monoforge/LICENSE +21 -0
  16. package/templates/monoforge/README.md +16 -0
  17. package/templates/monoforge/TEMPLATE.md +19 -0
  18. package/templates/monoforge/docs/Gemfile +5 -0
  19. package/templates/monoforge/docs/_config.yml +36 -0
  20. package/templates/monoforge/docs/_layouts/default.html +29 -0
  21. package/templates/monoforge/docs/assets/css/style.css +14 -0
  22. package/templates/monoforge/docs/freestruct.config.yml +7 -0
  23. package/templates/monoforge/docs/index.md +27 -0
  24. package/templates/monoforge/docs/search.md +28 -0
  25. package/templates/monoforge/functions/api/health.js +10 -0
  26. package/templates/monoforge/gitignore.tmpl +9 -0
  27. package/templates/monoforge/horcrux/HORCRUX.md +7 -0
  28. package/templates/monoforge/labs/.eyes/ledger.json +1 -0
  29. package/templates/monoforge/labs/.eyes/manifest.yml +5 -0
  30. package/templates/monoforge/labs/TASKS.md +11 -0
  31. package/templates/monoforge/scripts/build-docs.sh +12 -0
  32. package/templates/monoforge/scripts/check-docs-frontmatter.cjs +112 -0
  33. package/templates/monoforge/scripts/check-docs-links.cjs +81 -0
  34. package/templates/monoforge/scripts/check-docs-style.cjs +79 -0
  35. package/templates/monoforge/scripts/check-fiction-signatures.cjs +69 -0
  36. package/templates/monoforge/scripts/check-jekyll-filters.cjs +62 -0
  37. package/templates/monoforge/scripts/check-language.cjs +171 -0
  38. package/templates/monoforge/site/robots.txt +4 -0
  39. package/templates/monoforge/wrangler.toml +11 -0
  40. package/templates/monoforge-headless/.github/workflows/docs.yml +102 -0
  41. package/templates/monoforge-headless/.github/workflows/publish.yml +141 -0
  42. package/templates/monoforge-headless/.github/workflows/staging-ff-sync.yml +44 -0
  43. package/templates/monoforge-headless/.github/workflows/test.yml +21 -0
  44. package/templates/monoforge-headless/TEMPLATE.md +17 -0
@@ -0,0 +1,141 @@
1
+ name: publish
2
+ # The release ladder (the family shape, receipt dhaupin/eyestruct@4e2b552).
3
+ # Three jobs drive a tag end to end: publish, cut the GH release, then verify
4
+ # the cut against what the registry and GitHub actually serve. The gap the
5
+ # shape closes: a publish step can go green while the registry result is
6
+ # wrong, because nothing asserted the tarball in between.
7
+ #
8
+ # Publish rides npm Trusted Publishing (OIDC): NO publish token exists
9
+ # anywhere. The `secrets.NPM_TOKEN` line this file used to carry was the
10
+ # family-law violation ("no publish tokens anywhere") this adoption removes.
11
+ # One-time setup per account: link the package to this repo under
12
+ # npmjs.com -> package Settings -> Publishing access (the OIDC flow needs
13
+ # that mapping to mint credentials). No secret is ever created.
14
+ #
15
+ # Scaffold: the adopter supplies package.json (the version truth) and its
16
+ # test script. `npm publish` runs prepublishOnly automatically, so a red
17
+ # battery cannot mint a tarball. The gate refuses 0.x (the family ladder:
18
+ # 0.x is the manual ship lane) and, on a tag push, a tag that disagrees with
19
+ # the packaged version. Every github context value reaches the script
20
+ # through env, never inline interpolation.
21
+ on:
22
+ push:
23
+ tags: ['v*']
24
+ workflow_dispatch:
25
+ inputs:
26
+ mode:
27
+ description: 'publish = registry cut | verify-only = re-run the trust ladder against what is already served'
28
+ required: false
29
+ default: 'publish'
30
+ type: choice
31
+ options: ['publish', 'verify-only']
32
+
33
+ permissions:
34
+ contents: write
35
+ id-token: write
36
+
37
+ jobs:
38
+ publish:
39
+ if: github.event_name == 'push' || inputs.mode != 'verify-only'
40
+ runs-on: ubuntu-latest
41
+ outputs:
42
+ version: ${{ steps.gate.outputs.version }}
43
+ tag: ${{ steps.gate.outputs.tag }}
44
+ steps:
45
+ # fetch-depth: 0 - the verify ladder's git archive needs the release
46
+ # commit reachable.
47
+ - uses: actions/checkout@v4
48
+ with: { fetch-depth: 0 }
49
+ - uses: actions/setup-node@v4
50
+ with:
51
+ node-version: 20
52
+ registry-url: https://registry.npmjs.org
53
+ - name: npm floor for trusted publishing (11.5.1+)
54
+ run: npm install -g npm@^11
55
+ - id: gate
56
+ name: the gate - 0.x refused, tag == packaged version
57
+ env:
58
+ TAG_REF: ${{ github.ref_name }}
59
+ EVENT_NAME: ${{ github.event_name }}
60
+ run: |
61
+ set -e
62
+ V="$(node -p "require('./package.json').version")"
63
+ case "$V" in
64
+ 0.*) echo "publish gate: refusing $V - the OIDC lane serves 1.0.0+ only (0.x is the manual ship lane)"; exit 1 ;;
65
+ esac
66
+ if [ "$EVENT_NAME" = "push" ] && [ "$TAG_REF" != "v$V" ]; then
67
+ echo "publish gate: refusing - tag $TAG_REF does not equal the packaged version v$V (a tag that lies about its version never cuts)"; exit 1
68
+ fi
69
+ echo "publish gate: v$V passes the 0.x refusal and the tag==version gate"
70
+ echo "version=$V" >> "$GITHUB_OUTPUT"
71
+ echo "tag=v$V" >> "$GITHUB_OUTPUT"
72
+ - name: Install
73
+ run: npm install --no-fund --no-audit
74
+ - name: npm publish (OIDC - no token secret involved)
75
+ # prepublishOnly rides this automatically: the adopter's test battery.
76
+ run: npm publish --provenance --access public
77
+
78
+ release:
79
+ needs: publish
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v4
83
+ # Notes are EXTRACTED from the CHANGELOG's own [version] section - a
84
+ # release body that disagrees with the changelog is drift, and an empty
85
+ # extraction refuses the cut. notes.md lives in RUNNER_TEMP: never a
86
+ # silent overwrite of a repo file that happens to carry the name.
87
+ - name: extract the release notes from the changelog (refuses empty)
88
+ env:
89
+ BLOCK_VERSION: ${{ needs.publish.outputs.version }}
90
+ run: |
91
+ set -e
92
+ NOTES="$(awk -v v="$BLOCK_VERSION" '
93
+ index($0, "## [" v "]") == 1 { grab=1; next }
94
+ grab && index($0, "## [") == 1 { exit }
95
+ grab { print }
96
+ ' CHANGELOG.md)"
97
+ if [ -z "$(printf '%s' "$NOTES" | tr -d '[:space:]')" ]; then
98
+ echo "release: no non-empty [${BLOCK_VERSION}] section in CHANGELOG.md - the tag and the changelog disagree"; exit 1
99
+ fi
100
+ printf '%s\n' "$NOTES" > "$RUNNER_TEMP/notes.md"
101
+ - name: cut the GH release from the tag (idempotent)
102
+ env:
103
+ GH_TOKEN: ${{ github.token }}
104
+ BLOCK_VERSION: ${{ needs.publish.outputs.version }}
105
+ BLOCK_TAG: ${{ needs.publish.outputs.tag }}
106
+ run: |
107
+ if gh release view "$BLOCK_TAG" > /dev/null 2>&1; then
108
+ echo "release $BLOCK_TAG already exists - not re-minting; the verify job judges its truth"
109
+ else
110
+ gh release create "$BLOCK_TAG" --title "__NAME__ $BLOCK_VERSION" --notes-file "$RUNNER_TEMP/notes.md"
111
+ fi
112
+
113
+ # The verify leg runs after a real cut, but ALSO stands alone in
114
+ # verify-only mode (publish skipped, release skipped, the ladder judged
115
+ # against what is already served and released).
116
+ verify:
117
+ needs: publish
118
+ if: >-
119
+ always() &&
120
+ (needs.publish.result == 'success' ||
121
+ (needs.publish.result == 'skipped' && inputs.mode == 'verify-only'))
122
+ runs-on: ubuntu-latest
123
+ permissions:
124
+ contents: read
125
+ steps:
126
+ - uses: actions/checkout@v4
127
+ - uses: actions/setup-node@v4
128
+ with: { node-version: 20 }
129
+ - name: the post-publish trust ladder
130
+ env:
131
+ GH_TOKEN: ${{ github.token }}
132
+ run: |
133
+ set -e
134
+ V="$(node -p "require('./package.json').version")"
135
+ SERVED="$(npm view __NAME__@"$V" version)"
136
+ if [ "$SERVED" != "$V" ]; then
137
+ echo "verify: the registry serves __NAME__@$SERVED but this tree is $V"; exit 1
138
+ fi
139
+ echo "PASS registry serves __NAME__@$V"
140
+ gh release view "v$V" > /dev/null
141
+ echo "PASS GH release v$V exists"
@@ -0,0 +1,44 @@
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).
3
+ #
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.
9
+ #
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.
14
+
15
+ name: Sync staging to main
16
+
17
+ on:
18
+ push:
19
+ branches: [main]
20
+ workflow_dispatch:
21
+
22
+ permissions:
23
+ contents: write
24
+
25
+ concurrency:
26
+ group: staging-ff-sync
27
+ cancel-in-progress: false
28
+
29
+ jobs:
30
+ ff-sync:
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - name: Fast-forward staging to main
34
+ env:
35
+ TOKEN: ${{ secrets.GITHUB_TOKEN }}
36
+ run: |
37
+ set -euo pipefail
38
+ git init -q .
39
+ 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
@@ -0,0 +1,21 @@
1
+ name: test
2
+ on:
3
+ push: { branches: [main, staging] }
4
+ pull_request: { branches: [main, staging] }
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - uses: actions/setup-node@v4
11
+ with: { node-version: 20 }
12
+ - run: npm install --no-fund --no-audit
13
+ - run: npm test
14
+ - name: lint the repo's own conformance fixtures + shipped packs through the CLI
15
+ run: |
16
+ node bin/cli.mjs lint test/fixtures/good/packs
17
+ if node bin/cli.mjs lint test/fixtures/bad/packs >/dev/null 2>&1; then
18
+ echo "lint should have failed on broken fixtures"; exit 1
19
+ fi
20
+ # dogfood: the repo's own packs tree (the crashtest scenario pack) is itself SPEC-v1 shaped
21
+ node bin/cli.mjs lint packs
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: monoforge-headless
3
+ description: >
4
+ CI only - the .github/ battery (test, docs, publish), no scaffold.
5
+ chain: []
6
+ ---
7
+
8
+ # monoforge-headless
9
+
10
+ CI only - the .github/ battery (test, docs, publish), no scaffold.
11
+
12
+ GENERATED metadata for the template layer - `stamp` resolves this profile by reading this file's `chain:`.
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"`).