monoforge 1.1.1 → 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monoforge",
|
|
3
|
-
"version": "1.
|
|
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": {
|
package/spec/refusals.json
CHANGED
|
@@ -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,22 +1,36 @@
|
|
|
1
|
-
# staging-ff-sync -
|
|
2
|
-
#
|
|
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
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
# never a
|
|
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
|
-
#
|
|
12
|
-
# refused and
|
|
13
|
-
#
|
|
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
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|