@mstar-harness/engine 3.1.1 → 3.1.3

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/dist/audit.d.ts CHANGED
@@ -97,3 +97,45 @@ export type ScaffoldAuditPlanResult = {
97
97
  * findings render in the "considered and rejected" section.
98
98
  */
99
99
  export declare function scaffoldAuditPlan(outDir: string, findings: readonly AuditFinding[], options?: ScaffoldAuditPlanOptions): ScaffoldAuditPlanResult;
100
+ /** Options for `promoteAuditPlans`. `harnessDir` is required — the snapshot
101
+ * and `status.json` live under the harness, never beside the audit dir. */
102
+ export type PromoteAuditPlansOptions = {
103
+ /** Absolute harness dir that contains `status.json` + `workflows/`. Required. */
104
+ harnessDir: string;
105
+ /** Default: basename of `outDir` (e.g. `audit-2026-08-22`). */
106
+ workflowId?: string;
107
+ };
108
+ /**
109
+ * Promote selected audit plans into the v2 workflow lifecycle as a
110
+ * `type: "plan"` workflow (mstar-audit Handoff): write the workflow
111
+ * snapshot FIRST (with one Todo PlanRow per selected file), then register
112
+ * the workflow entry — `validateStatusV2` validates the full status doc
113
+ * including the per-snapshot existence check, so the snapshot must exist
114
+ * before the registration. Plan rows are built from the README index
115
+ * `## Execution order & status` columns (Plan/Title), falling back to the
116
+ * private `readPlanFileSummary` only when the index lacks the row.
117
+ *
118
+ * Run-once semantics: a workflow id whose snapshot already exists refuses
119
+ * the promote (re-promote would drop its registered plan rows); remove
120
+ * that workflow first.
121
+ *
122
+ * The re-promote guard, the snapshot write, and the root upsert run in ONE
123
+ * atomic section under the root `withStatusWriteLock(statusPath)` — the
124
+ * same root lock `registerWorkflow` uses — so the guard is check-then-act
125
+ * safe: two concurrent same-id promotes cannot both pass it (one writes
126
+ * and registers; the other re-checks under the lock and refuses). The
127
+ * snapshot is written directly with `writeJson` under the root lock (never
128
+ * a nested `writeWorkflowSnapshot` — its own snapshot-dir lock would be a
129
+ * second serialization point; the root lock must be THE serialization
130
+ * point). The root upsert replicates `registerWorkflow` semantics inline
131
+ * via the shared `registerWorkflowEntryLocked` helper (calling
132
+ * `registerWorkflow` itself would re-enter the non-reentrant root lock).
133
+ *
134
+ * On any failure inside the lock, the partial snapshot + now-empty
135
+ * workflow dir are rolled back so a retry converges after the root
136
+ * conflict is resolved.
137
+ */
138
+ export declare function promoteAuditPlans(outDir: string, selected: readonly string[], options: PromoteAuditPlansOptions): Promise<{
139
+ workflowId: string;
140
+ snapshotPath: string;
141
+ }>;