@patronage/software-factory 1.0.0-alpha.1 → 1.0.0-alpha.2

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
@@ -4,7 +4,7 @@
4
4
 
5
5
  The factory admits a pull request from evidence bound to its candidate. It validates policy and proof; it does not schedule workers, choose models, or run reviews. Those are jobs for the harness or operator.
6
6
 
7
- Admission is fail closed. A clean-session review and required verification produce typed proof, then readiness decides whether the candidate may proceed. Evidence stays current when the candidate patch is unchanged; the push-triggered Verify workflow covers integration risk on every factory merge target and freezes further merges into a target when that target goes red. Epic policy, including review minimums and auto-merge authority, lives in the boundary manifest. HQ observes this work; it never blocks a gate.
7
+ Admission is fail closed. A clean-session review and required verification produce typed proof, then readiness decides whether the candidate may proceed. Evidence stays current when the candidate patch is unchanged; the push-triggered Verify workflow covers integration risk on every factory merge target — `main` and the `epic/**` integration branches. When a target goes red, the factory refuses new readiness decisions and authorized arming against that target; candidates armed before the target went red can still land. Epic policy, including review minimums and auto-merge authority, lives in the boundary manifest. HQ observes this work; it never blocks a gate.
8
8
 
9
9
  ## Develop the package
10
10
 
@@ -30,18 +30,24 @@ This is the release checklist. It lives here and nowhere else; the repository ru
30
30
 
31
31
  Releases are attended and hand-cut. Nothing in the factory publishes, tags, or releases on its own, and no step below may be automated as a drive-by.
32
32
 
33
+ The factory family has one version posture (ADR 0026, `docs/adr/0026-factory-family-version-lines-move-in-lockstep.md` in the source repository): `@patronage/factory-ci` moves in lockstep majors with this CLI. From factory-ci's first release in the CLI's current series onward, majors and prerelease series move together while patch and prerelease increments stay independent per package. A consumer pins a factory-ci from the same major/prerelease series as its CLI; there is no compatibility matrix. Until that first lockstep release, factory-ci's published 0.x line is the named pre-adoption state and pairs with any CLI version. `@patronage/alchemy-d1-state` keeps independent SemVer. Lockstep is a rule the maintainer follows when cutting releases, never automation.
34
+
35
+ A stacked release train has one terminal release-owning slice. Interior slices do not bump `package.json` or cut a checkpoint unless the boundary explicitly intends a separately published release at that slice: a lower-slice bump consumes the release window before the terminal slice lands, and the train must then advance the version and re-earn its terminal evidence.
36
+
37
+ A stable cut has two phases. Phase 1 is the verified package candidate: steps 1 through 4 below, ending in the attended npm publish, tag, and GitHub release. Phase 2 is post-publication stable-doc convergence: steps 5 and 6, a normal admitted docs PR followed by the read-only convergence assertion from a clean `main`. Stable docs must never claim an unpublished version, so they cannot land in the phase-1 change. Prerelease behavior is unchanged: prerelease notes may land before publish while stable docs keep naming the prior stable version.
38
+
33
39
  1. Bump `package.json` to valid SemVer. The assertion derives its expected stable or prerelease channel from the version; it accepts no channel flag.
34
40
  2. Publish to npm per the [repository operations runbook](../docs/repository-operations.md#publishing) (attended, hand-cut, `pnpm publish` only). A stable version uses `pnpm --filter @patronage/software-factory publish`, which assigns npm `latest`. A prerelease must use `pnpm --filter @patronage/software-factory publish --tag next`; bare `pnpm publish` defaults to `latest` and would move it before the post-hoc assertion can reject the release.
35
41
  3. Cut the `software-factory-vX.Y.Z` tag and push it.
36
42
  4. Cut the GitHub release for that tag, with notes covering features, deletions, breaking changes, and closed issues. Mark it as a prerelease exactly when its SemVer version has a prerelease component. When the release changes the profile `schemaVersion`, state it in the notes — the profile schema version is a separate axis from the package version.
37
- 5. Update affected `software-factory-docs/` pages. Stable docs must state the current stable version. Prerelease docs may record the candidate and its migration notes, but must not represent it as the current stable release.
38
- 6. Confirm the five facts converge:
43
+ 5. Converge the stable docs after publication. Update affected `software-factory-docs/` pages through a normal admitted docs PR. Stable docs must state the current stable version. Prerelease docs may record the candidate and its migration notes, but must not represent it as the current stable release.
44
+ 6. After the docs PR merges, confirm the six facts converge from a clean checkout of `main`:
39
45
 
40
46
  ```bash
41
47
  pnpm --filter @patronage/software-factory exec tsx scripts/assert-publish-manifest.ts --release .
42
48
  ```
43
49
 
44
- It reads what you just did and derives the channel from the manifest version. A stable release must converge exactly among manifest, npm `latest`, non-prerelease GitHub release, tag, and stable docs. A prerelease must exist on npm, own npm `next`, leave npm `latest` at the stable docs version, and have its prerelease GitHub release and tag. It publishes nothing. Step 6 is the only step a machine performs, and it performs it after you.
50
+ It reads what you just did and derives the channel from the manifest version. A stable release must converge exactly among manifest, npm `latest`, non-prerelease GitHub release, tag, and stable docs. A prerelease must exist on npm, own npm `next`, leave npm `latest` at the stable docs version, and have its prerelease GitHub release and tag. The sixth fact is the factory-ci pairing above: the assertion passes while every observed published `@patronage/factory-ci` version is pre-adoption 0.x and names that state, fails once a lockstep factory-ci release exists whose newest published version is outside the CLI's major/prerelease series, and fails when the registry read yields no readable factory-ci versions or contains an entry that does not parse — missing or unreadable data is an unsatisfied fact, not pre-adoption. It publishes nothing. Step 6 is the only step a machine performs, and it performs it after you.
45
51
 
46
52
  ## Use it in a project
47
53
 
package/dist/index.d.ts CHANGED
@@ -61,8 +61,8 @@ declare const boundaryReviewProofBaseSchema: z.ZodObject<{
61
61
  }>;
62
62
  producer: z.ZodString;
63
63
  rung: z.ZodEnum<{
64
- "independent-model": "independent-model";
65
64
  oracle: "oracle";
65
+ "independent-model": "independent-model";
66
66
  human: "human";
67
67
  }>;
68
68
  schemaVersion: z.ZodLiteral<1>;
@@ -105,8 +105,8 @@ declare const boundaryReviewProofSchema: z.ZodObject<{
105
105
  }>;
106
106
  producer: z.ZodString;
107
107
  rung: z.ZodEnum<{
108
- "independent-model": "independent-model";
109
108
  oracle: "oracle";
109
+ "independent-model": "independent-model";
110
110
  human: "human";
111
111
  }>;
112
112
  schemaVersion: z.ZodLiteral<1>;
@@ -554,8 +554,8 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
554
554
  name: z.ZodString;
555
555
  scope: z.ZodOptional<z.ZodObject<{
556
556
  classifications: z.ZodArray<z.ZodEnum<{
557
- "docs/process-only": "docs/process-only";
558
557
  trivial: "trivial";
558
+ "docs/process-only": "docs/process-only";
559
559
  "non-trivial": "non-trivial";
560
560
  }>>;
561
561
  }, z.core.$strict>>;
@@ -753,8 +753,8 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
753
753
  generationId: z.ZodNumber;
754
754
  headSha: z.ZodString;
755
755
  outcome: z.ZodEnum<{
756
- active: "active";
757
756
  stale: "stale";
757
+ active: "active";
758
758
  }>;
759
759
  reason: z.ZodString;
760
760
  recordedAt: z.ZodISODateTime;
@@ -1134,8 +1134,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1134
1134
  baseSha: z.ZodString;
1135
1135
  blockingReasons: z.ZodArray<z.ZodString>;
1136
1136
  classification: z.ZodEnum<{
1137
- "docs/process-only": "docs/process-only";
1138
1137
  trivial: "trivial";
1138
+ "docs/process-only": "docs/process-only";
1139
1139
  "non-trivial": "non-trivial";
1140
1140
  }>;
1141
1141
  externalChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1148,8 +1148,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1148
1148
  reason: z.ZodOptional<z.ZodString>;
1149
1149
  scope: z.ZodOptional<z.ZodObject<{
1150
1150
  classifications: z.ZodArray<z.ZodEnum<{
1151
- "docs/process-only": "docs/process-only";
1152
1151
  trivial: "trivial";
1152
+ "docs/process-only": "docs/process-only";
1153
1153
  "non-trivial": "non-trivial";
1154
1154
  }>>;
1155
1155
  }, z.core.$strict>>;
@@ -1199,15 +1199,15 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1199
1199
  unknown: "unknown";
1200
1200
  critical: "critical";
1201
1201
  high: "high";
1202
- medium: "medium";
1203
1202
  low: "low";
1203
+ medium: "medium";
1204
1204
  }>>;
1205
1205
  highestOpenSeverity: z.ZodOptional<z.ZodEnum<{
1206
1206
  unknown: "unknown";
1207
1207
  critical: "critical";
1208
1208
  high: "high";
1209
- medium: "medium";
1210
1209
  low: "low";
1210
+ medium: "medium";
1211
1211
  }>>;
1212
1212
  maxReviewCycles: z.ZodOptional<z.ZodNumber>;
1213
1213
  nonBlockingFindings: z.ZodNumber;
@@ -1234,9 +1234,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1234
1234
  "run-interior-cycle": "run-interior-cycle";
1235
1235
  }>;
1236
1236
  stage: z.ZodEnum<{
1237
+ interior: "interior";
1237
1238
  gate: "gate";
1238
1239
  "interior-complete": "interior-complete";
1239
- interior: "interior";
1240
1240
  }>;
1241
1241
  }, z.core.$strip>>;
1242
1242
  reviewRuns: z.ZodOptional<z.ZodArray<z.ZodType<PrReviewResult, unknown, z.core.$ZodTypeInternals<PrReviewResult, unknown>>>>;
@@ -1251,10 +1251,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1251
1251
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1252
1252
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1253
1253
  status: z.ZodEnum<{
1254
- blocked: "blocked";
1255
1254
  "not-required": "not-required";
1256
- stale: "stale";
1255
+ blocked: "blocked";
1257
1256
  current: "current";
1257
+ stale: "stale";
1258
1258
  missing: "missing";
1259
1259
  }>;
1260
1260
  }, z.core.$strip>;
@@ -1263,10 +1263,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1263
1263
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1264
1264
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1265
1265
  status: z.ZodEnum<{
1266
- blocked: "blocked";
1267
1266
  "not-required": "not-required";
1268
- stale: "stale";
1267
+ blocked: "blocked";
1269
1268
  current: "current";
1269
+ stale: "stale";
1270
1270
  missing: "missing";
1271
1271
  }>;
1272
1272
  }, z.core.$strip>>;
@@ -1277,8 +1277,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1277
1277
  docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
1278
1278
  docsOnlyVerifiedHeadSha: z.ZodOptional<z.ZodString>;
1279
1279
  prVerify: z.ZodEnum<{
1280
- stale: "stale";
1281
1280
  passed: "passed";
1281
+ stale: "stale";
1282
1282
  missing: "missing";
1283
1283
  }>;
1284
1284
  trivialDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
@@ -1589,8 +1589,8 @@ declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
1589
1589
  type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
1590
1590
  declare const requiredCheckScopeSchema: z.ZodObject<{
1591
1591
  classifications: z.ZodArray<z.ZodEnum<{
1592
- "docs/process-only": "docs/process-only";
1593
1592
  trivial: "trivial";
1593
+ "docs/process-only": "docs/process-only";
1594
1594
  "non-trivial": "non-trivial";
1595
1595
  }>>;
1596
1596
  }, z.core.$strict>;
@@ -1647,8 +1647,8 @@ declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
1647
1647
  producer: z.ZodString;
1648
1648
  requestId: z.ZodOptional<z.ZodString>;
1649
1649
  rung: z.ZodOptional<z.ZodEnum<{
1650
- "independent-model": "independent-model";
1651
1650
  oracle: "oracle";
1651
+ "independent-model": "independent-model";
1652
1652
  human: "human";
1653
1653
  }>>;
1654
1654
  schemaVersion: z.ZodLiteral<1>;
@@ -1674,8 +1674,8 @@ declare const evidenceEnvelopeSchema: z.ZodObject<{
1674
1674
  producer: z.ZodString;
1675
1675
  requestId: z.ZodOptional<z.ZodString>;
1676
1676
  rung: z.ZodOptional<z.ZodEnum<{
1677
- "independent-model": "independent-model";
1678
1677
  oracle: "oracle";
1678
+ "independent-model": "independent-model";
1679
1679
  human: "human";
1680
1680
  }>>;
1681
1681
  schemaVersion: z.ZodLiteral<1>;
@@ -1778,10 +1778,10 @@ declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
1778
1778
  //#region src/review-proof-applicability.d.ts
1779
1779
  declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
1780
1780
  declare const reviewStatusSchema: z.ZodEnum<{
1781
- blocked: "blocked";
1782
1781
  "not-required": "not-required";
1783
- stale: "stale";
1782
+ blocked: "blocked";
1784
1783
  current: "current";
1784
+ stale: "stale";
1785
1785
  missing: "missing";
1786
1786
  }>;
1787
1787
  type ReviewStatus = z.infer<typeof reviewStatusSchema>;
@@ -2187,9 +2187,9 @@ declare const retroEnvelopeV1Schema: z.ZodObject<{
2187
2187
  kind: z.ZodLiteral<"retro-envelope">;
2188
2188
  outcome: z.ZodOptional<z.ZodObject<{
2189
2189
  status: z.ZodEnum<{
2190
- blocked: "blocked";
2191
2190
  success: "success";
2192
2191
  fail: "fail";
2192
+ blocked: "blocked";
2193
2193
  "ship-with-followups": "ship-with-followups";
2194
2194
  }>;
2195
2195
  verdict: z.ZodOptional<z.ZodString>;
@@ -2295,8 +2295,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2295
2295
  wave: z.ZodString;
2296
2296
  }, z.core.$strip>>;
2297
2297
  demandedRung: z.ZodOptional<z.ZodEnum<{
2298
- "independent-model": "independent-model";
2299
2298
  oracle: "oracle";
2299
+ "independent-model": "independent-model";
2300
2300
  human: "human";
2301
2301
  }>>;
2302
2302
  epicIssue: z.ZodNumber;
@@ -2311,8 +2311,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2311
2311
  commentUrl: z.ZodOptional<z.ZodString>;
2312
2312
  producer: z.ZodString;
2313
2313
  rung: z.ZodEnum<{
2314
- "independent-model": "independent-model";
2315
2314
  oracle: "oracle";
2315
+ "independent-model": "independent-model";
2316
2316
  human: "human";
2317
2317
  }>;
2318
2318
  sessionId: z.ZodOptional<z.ZodString>;
@@ -2949,8 +2949,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
2949
2949
  sessionId: z.ZodOptional<z.ZodString>;
2950
2950
  }, z.core.$strict>>;
2951
2951
  stage: z.ZodEnum<{
2952
- gate: "gate";
2953
2952
  interior: "interior";
2953
+ gate: "gate";
2954
2954
  }>;
2955
2955
  usage: z.ZodOptional<z.ZodObject<{
2956
2956
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3002,8 +3002,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3002
3002
  sessionId: z.ZodOptional<z.ZodString>;
3003
3003
  }, z.core.$strict>>;
3004
3004
  stage: z.ZodEnum<{
3005
- gate: "gate";
3006
3005
  interior: "interior";
3006
+ gate: "gate";
3007
3007
  }>;
3008
3008
  usage: z.ZodOptional<z.ZodObject<{
3009
3009
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3046,8 +3046,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3046
3046
  sessionId: z.ZodOptional<z.ZodString>;
3047
3047
  }, z.core.$strict>>;
3048
3048
  stage: z.ZodEnum<{
3049
- gate: "gate";
3050
3049
  interior: "interior";
3050
+ gate: "gate";
3051
3051
  }>;
3052
3052
  usage: z.ZodOptional<z.ZodObject<{
3053
3053
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3077,7 +3077,7 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3077
3077
  staleRepeats: number;
3078
3078
  };
3079
3079
  observedAt: string;
3080
- stage: "gate" | "interior";
3080
+ stage: "interior" | "gate";
3081
3081
  issue?: number | undefined;
3082
3082
  pr?: number | undefined;
3083
3083
  threadId?: string | undefined;
@@ -3339,8 +3339,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3339
3339
  slotResolution: z.ZodObject<{
3340
3340
  effort: z.ZodEnum<{
3341
3341
  high: "high";
3342
- medium: "medium";
3343
3342
  low: "low";
3343
+ medium: "medium";
3344
3344
  xhigh: "xhigh";
3345
3345
  }>;
3346
3346
  engine: z.ZodString;
@@ -3352,18 +3352,18 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3352
3352
  }>;
3353
3353
  model: z.ZodString;
3354
3354
  tier: z.ZodEnum<{
3355
- oracle: "oracle";
3356
3355
  review: "review";
3357
3356
  delegate: "delegate";
3357
+ oracle: "oracle";
3358
3358
  workhorse: "workhorse";
3359
3359
  scout: "scout";
3360
3360
  }>;
3361
3361
  }, z.core.$strict>;
3362
3362
  startedAt: z.ZodString;
3363
3363
  tier: z.ZodEnum<{
3364
- oracle: "oracle";
3365
3364
  review: "review";
3366
3365
  delegate: "delegate";
3366
+ oracle: "oracle";
3367
3367
  workhorse: "workhorse";
3368
3368
  scout: "scout";
3369
3369
  }>;
@@ -3418,8 +3418,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3418
3418
  slotResolution: z.ZodObject<{
3419
3419
  effort: z.ZodEnum<{
3420
3420
  high: "high";
3421
- medium: "medium";
3422
3421
  low: "low";
3422
+ medium: "medium";
3423
3423
  xhigh: "xhigh";
3424
3424
  }>;
3425
3425
  engine: z.ZodString;
@@ -3431,18 +3431,18 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3431
3431
  }>;
3432
3432
  model: z.ZodString;
3433
3433
  tier: z.ZodEnum<{
3434
- oracle: "oracle";
3435
3434
  review: "review";
3436
3435
  delegate: "delegate";
3436
+ oracle: "oracle";
3437
3437
  workhorse: "workhorse";
3438
3438
  scout: "scout";
3439
3439
  }>;
3440
3440
  }, z.core.$strict>;
3441
3441
  startedAt: z.ZodString;
3442
3442
  tier: z.ZodEnum<{
3443
- oracle: "oracle";
3444
3443
  review: "review";
3445
3444
  delegate: "delegate";
3445
+ oracle: "oracle";
3446
3446
  workhorse: "workhorse";
3447
3447
  scout: "scout";
3448
3448
  }>;
@@ -3488,8 +3488,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3488
3488
  slotResolution: z.ZodObject<{
3489
3489
  effort: z.ZodEnum<{
3490
3490
  high: "high";
3491
- medium: "medium";
3492
3491
  low: "low";
3492
+ medium: "medium";
3493
3493
  xhigh: "xhigh";
3494
3494
  }>;
3495
3495
  engine: z.ZodString;
@@ -3501,18 +3501,18 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3501
3501
  }>;
3502
3502
  model: z.ZodString;
3503
3503
  tier: z.ZodEnum<{
3504
- oracle: "oracle";
3505
3504
  review: "review";
3506
3505
  delegate: "delegate";
3506
+ oracle: "oracle";
3507
3507
  workhorse: "workhorse";
3508
3508
  scout: "scout";
3509
3509
  }>;
3510
3510
  }, z.core.$strict>;
3511
3511
  startedAt: z.ZodString;
3512
3512
  tier: z.ZodEnum<{
3513
- oracle: "oracle";
3514
3513
  review: "review";
3515
3514
  delegate: "delegate";
3515
+ oracle: "oracle";
3516
3516
  workhorse: "workhorse";
3517
3517
  scout: "scout";
3518
3518
  }>;
@@ -3557,15 +3557,15 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3557
3557
  observedAt: string;
3558
3558
  purpose: "review" | "code";
3559
3559
  slotResolution: {
3560
- effort: "high" | "medium" | "low" | "xhigh";
3560
+ effort: "high" | "low" | "medium" | "xhigh";
3561
3561
  engine: string;
3562
3562
  layerSource: "committedDefault" | "operatorSession" | "userConfig";
3563
3563
  model: string;
3564
- tier: "oracle" | "review" | "delegate" | "workhorse" | "scout";
3564
+ tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3565
3565
  fallbackTier?: "delegate" | undefined;
3566
3566
  };
3567
3567
  startedAt: string;
3568
- tier: "oracle" | "review" | "delegate" | "workhorse" | "scout";
3568
+ tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3569
3569
  tokenUsage: {
3570
3570
  source: "cursor-csv" | "codex-json" | "cursor-json" | "claude-json";
3571
3571
  status: "available";
@@ -3924,8 +3924,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
3924
3924
  boundary: z.ZodString;
3925
3925
  closeout: z.ZodOptional<z.ZodObject<{
3926
3926
  review: z.ZodEnum<{
3927
- "independent-model": "independent-model";
3928
3927
  oracle: "oracle";
3928
+ "independent-model": "independent-model";
3929
3929
  human: "human";
3930
3930
  }>;
3931
3931
  }, z.core.$loose>>;
@@ -3933,8 +3933,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
3933
3933
  prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3934
3934
  schemaVersion: z.ZodLiteral<1>;
3935
3935
  topology: z.ZodEnum<{
3936
- "each-to-main": "each-to-main";
3937
3936
  flagged: "flagged";
3937
+ "each-to-main": "each-to-main";
3938
3938
  stacked: "stacked";
3939
3939
  }>;
3940
3940
  waves: z.ZodArray<z.ZodObject<{
@@ -3942,8 +3942,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
3942
3942
  issues: z.ZodArray<z.ZodNumber>;
3943
3943
  name: z.ZodString;
3944
3944
  review: z.ZodEnum<{
3945
- "independent-model": "independent-model";
3946
3945
  oracle: "oracle";
3946
+ "independent-model": "independent-model";
3947
3947
  human: "human";
3948
3948
  }>;
3949
3949
  }, z.core.$loose>>;
@@ -3952,8 +3952,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
3952
3952
  boundary: z.ZodString;
3953
3953
  closeout: z.ZodOptional<z.ZodObject<{
3954
3954
  review: z.ZodEnum<{
3955
- "independent-model": "independent-model";
3956
3955
  oracle: "oracle";
3956
+ "independent-model": "independent-model";
3957
3957
  human: "human";
3958
3958
  }>;
3959
3959
  }, z.core.$loose>>;
@@ -3961,8 +3961,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
3961
3961
  prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3962
3962
  schemaVersion: z.ZodLiteral<1>;
3963
3963
  topology: z.ZodEnum<{
3964
- "each-to-main": "each-to-main";
3965
3964
  flagged: "flagged";
3965
+ "each-to-main": "each-to-main";
3966
3966
  stacked: "stacked";
3967
3967
  }>;
3968
3968
  waves: z.ZodArray<z.ZodObject<{
@@ -3970,8 +3970,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
3970
3970
  issues: z.ZodArray<z.ZodNumber>;
3971
3971
  name: z.ZodString;
3972
3972
  review: z.ZodEnum<{
3973
- "independent-model": "independent-model";
3974
3973
  oracle: "oracle";
3974
+ "independent-model": "independent-model";
3975
3975
  human: "human";
3976
3976
  }>;
3977
3977
  }, z.core.$loose>>;
@@ -4056,7 +4056,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4056
4056
  ledger: {
4057
4057
  baseSha: string;
4058
4058
  blockingReasons: string[];
4059
- classification: "docs/process-only" | "trivial" | "non-trivial";
4059
+ classification: "trivial" | "docs/process-only" | "non-trivial";
4060
4060
  github: {
4061
4061
  draft: boolean;
4062
4062
  mergeStateStatus: string;
@@ -4076,13 +4076,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4076
4076
  reviews: {
4077
4077
  correctness: {
4078
4078
  required: boolean;
4079
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4079
+ status: "not-required" | "blocked" | "current" | "stale" | "missing";
4080
4080
  reviewedHeadSha?: string | undefined;
4081
4081
  reviewedPatchId?: string | undefined;
4082
4082
  };
4083
4083
  security?: {
4084
4084
  required: boolean;
4085
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4085
+ status: "not-required" | "blocked" | "current" | "stale" | "missing";
4086
4086
  reviewedHeadSha?: string | undefined;
4087
4087
  reviewedPatchId?: string | undefined;
4088
4088
  } | undefined;
@@ -4090,7 +4090,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4090
4090
  schemaVersion: 1;
4091
4091
  verification: {
4092
4092
  command: "patronage-factory pr:verify";
4093
- prVerify: "stale" | "passed" | "missing";
4093
+ prVerify: "passed" | "stale" | "missing";
4094
4094
  docsOnlyDeltaAccepted?: boolean | undefined;
4095
4095
  docsOnlyVerifiedHeadSha?: string | undefined;
4096
4096
  trivialDeltaAccepted?: boolean | undefined;
@@ -4105,7 +4105,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4105
4105
  status: "satisfied" | "unmet" | "out-of-scope";
4106
4106
  reason?: string | undefined;
4107
4107
  scope?: {
4108
- classifications: ("docs/process-only" | "trivial" | "non-trivial")[];
4108
+ classifications: ("trivial" | "docs/process-only" | "non-trivial")[];
4109
4109
  } | undefined;
4110
4110
  }[] | undefined;
4111
4111
  mergeBaseSha?: string | undefined;
@@ -4121,8 +4121,8 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4121
4121
  nonBlockingFindings: number;
4122
4122
  openFindings: number;
4123
4123
  windowExhausted: boolean;
4124
- highestBlockingSeverity?: "unknown" | "critical" | "high" | "medium" | "low" | undefined;
4125
- highestOpenSeverity?: "unknown" | "critical" | "high" | "medium" | "low" | undefined;
4124
+ highestBlockingSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
4125
+ highestOpenSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
4126
4126
  maxReviewCycles?: number | undefined;
4127
4127
  reviewCycle?: number | undefined;
4128
4128
  staleRepeatFindings?: number | undefined;
@@ -4133,7 +4133,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4133
4133
  interior: number;
4134
4134
  };
4135
4135
  nextAction: "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human" | "advance-to-gate" | "run-interior-cycle";
4136
- stage: "gate" | "interior-complete" | "interior";
4136
+ stage: "interior" | "gate" | "interior-complete";
4137
4137
  forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4138
4138
  } | undefined;
4139
4139
  reviewRuns?: PrReviewResult[] | undefined;
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import picomatch from "picomatch";
17
17
  import { parse } from "yaml";
18
18
  import { promisify } from "node:util";
19
19
  //#region package.json
20
- var version = "1.0.0-alpha.1";
20
+ var version = "1.0.0-alpha.2";
21
21
  //#endregion
22
22
  //#region src/review-rungs.ts
23
23
  const EVIDENCE_REVIEW_RUNGS$1 = [
@@ -8905,7 +8905,7 @@ const renderReport = (record) => {
8905
8905
  return `${lines.join("\n")}\n`;
8906
8906
  };
8907
8907
  function createBoundaryCheckCommand(output, action) {
8908
- return new Command("boundary:check").description("Boundary readiness gate (T8): require a membership-fresh boundary-review proof at the declared closeout rung. Blocks closeout/enablement, never merge.").requiredOption("--epic <number>", "epic issue number carrying the factory-boundary manifest", positiveInteger("--epic")).option("--repo <owner/name>", "GitHub repository (default: resolved from --cwd)").option("--cwd <path>", "repository working directory", ".").option("--output <path>", "write an additional proof copy to this path").option("--json", "print the full proof record as JSON").action(withGateTiming({
8908
+ return new Command("boundary:check").description("Boundary readiness gate (T8): require a membership-fresh boundary-review proof at the declared closeout rung. Blocks closeout/enablement, never merge.").requiredOption("--epic <number>", "epic issue number carrying the factory-boundary manifest", positiveInteger("--epic")).option("--repo <owner/name>", "GitHub repository (default: resolved from --cwd)").option("--cwd <path>", "repository working directory", ".").option("--output <path>", "write an additional proof copy to this path").option("--profile <path>", "path to the project profile JSON file").option("--json", "print the full proof record as JSON").action(withGateTiming({
8909
8909
  gate: "boundary:check",
8910
8910
  resolveLedgerRoot: (options) => resolveCwdOption(options.cwd),
8911
8911
  stderr: output.stderr
@@ -8921,7 +8921,10 @@ function createBoundaryCheckCommand(output, action) {
8921
8921
  if (!action) {
8922
8922
  const [owner, name] = record.repo.split("/");
8923
8923
  if (owner && name) {
8924
- const hqLaneBaseUrl = hqLaneRefBaseUrlFromProfile(tryLoadProjectProfile({ cwd: args.cwd })?.profile);
8924
+ const hqLaneBaseUrl = hqLaneRefBaseUrlFromProfile(tryLoadProjectProfile({
8925
+ cwd: args.cwd,
8926
+ profilePath: options.profile
8927
+ })?.profile);
8925
8928
  try {
8926
8929
  publishFactoryCheckSafely(createFactoryCheckPublisher(output), {
8927
8930
  conclusion: record.status === "ready" ? "success" : "failure",
@@ -9608,6 +9611,8 @@ const buildRetroEnvelope = (input) => {
9608
9611
  const RETRO_ENVELOPE_LEDGER_DIR = ".factory-memory/retro-envelope";
9609
9612
  const safeEnvelopeName = (agentRunId) => agentRunId.replaceAll(/[^\w.-]/gu, "-").slice(0, 120);
9610
9613
  const retroEnvelopePath = (root, agentRunId) => path.join(root, RETRO_ENVELOPE_LEDGER_DIR, `${safeEnvelopeName(agentRunId)}.json`);
9614
+ const CLAUDE_CODE_SESSION_ID_ENV = "CLAUDE_CODE_SESSION_ID";
9615
+ const resolveNativeSessionId = (env) => normalizeSessionId(env[CLAUDE_CODE_SESSION_ID_ENV]);
9611
9616
  const splitRepo = (repo) => {
9612
9617
  const [owner, name] = repo.split("/");
9613
9618
  return {
@@ -9633,11 +9638,11 @@ const otherLedgersExist = (repoRoot) => {
9633
9638
  const buildAndPersistRetroEnvelope = (input) => {
9634
9639
  const env = input.env ?? process.env;
9635
9640
  const now = input.now ?? (() => /* @__PURE__ */ new Date());
9636
- const laneIdentity = resolveGateTimingAgentRunId(env);
9641
+ const laneIdentity = resolveGateTimingAgentRunId(env) ?? resolveNativeSessionId(env);
9637
9642
  const agentRunId = laneIdentity ?? `closeout-${safeEnvelopeName(input.epic)}`;
9638
9643
  const ledgerPath = gateTimingLedgerPath(input.repoRoot, agentRunId);
9639
9644
  const ledger = laneIdentity === void 0 ? [] : readGateTimingLedger(ledgerPath);
9640
- const claudeSessionId = discoverFactorySessionId(env);
9645
+ const claudeSessionId = discoverFactorySessionId(env) ?? resolveNativeSessionId(env);
9641
9646
  const dataGaps = [];
9642
9647
  if (laneIdentity === void 0) dataGaps.push("agentRunId is synthetic (no lane run identity exported): keyed to the epic, ledger not folded.");
9643
9648
  else if (!existsSync(ledgerPath) && otherLedgersExist(input.repoRoot)) dataGaps.push(`gates[] empty: no gate-timing ledger for agentRunId "${agentRunId}" although other lane ledgers exist under ${GATE_TIMING_LEDGER_DIR} — possible identity drift between ledger writes and closeout.`);
@@ -9916,6 +9921,7 @@ function createCloseoutCommand(output, dependencies = {}) {
9916
9921
  });
9917
9922
  const retro = buildRetroGate({
9918
9923
  codexThreadIds: codexThreadIdsForCloseout(dependencies.env),
9924
+ ...dependencies.env === void 0 ? {} : { env: dependencies.env },
9919
9925
  epic: options.epic,
9920
9926
  ...options.issue === void 0 ? {} : { issue: options.issue },
9921
9927
  ...options.pr === void 0 ? {} : { pr: options.pr },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patronage/software-factory",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.2",
4
4
  "description": "Shared Patronage software factory CLI and project-profile validation tools",
5
5
  "license": "MIT",
6
6
  "repository": {