@mstar-harness/engine 3.1.2 → 3.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/dist/audit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { GateResult } from "./core.js";
2
- /** Priority values (mstar-audit SKILL § Plan files Status block). */
2
+ /** Priority values (mstar-audit SKILL.md § Plan output (all variants) Status block). */
3
3
  export declare const AUDIT_PRIORITIES: readonly ["P1", "P2", "P3"];
4
4
  export type AuditPriority = (typeof AUDIT_PRIORITIES)[number];
5
5
  /** Effort values (Morning Star agent-oriented effort scale). */
@@ -8,12 +8,12 @@ export type AuditEffort = (typeof AUDIT_EFFORTS)[number];
8
8
  /** Risk values. */
9
9
  export declare const AUDIT_RISKS: readonly ["LOW", "MED", "HIGH"];
10
10
  export type AuditRisk = (typeof AUDIT_RISKS)[number];
11
- /** Category codes (finding-format.md § Category codes + SKILL Status block). */
11
+ /** Category codes (finding-format.md § Category codes + mstar-audit SKILL.md § Plan output (all variants) Status block). */
12
12
  export declare const AUDIT_CATEGORIES: readonly ["bug", "security", "perf", "tests", "tech-debt", "migration", "dx", "docs", "direction"];
13
13
  export type AuditCategory = (typeof AUDIT_CATEGORIES)[number];
14
14
  /**
15
15
  * Validate the audit Status block(s) of a plan file against the field
16
- * contract (mstar-audit SKILL § Plan files):
16
+ * contract (mstar-audit SKILL.md § Plan output (all variants) Status block):
17
17
  * - `Priority`: P1 | P2 | P3
18
18
  * - `Effort`: XS | S | M | L | XL
19
19
  * - `Risk`: LOW | MED | HIGH
@@ -89,7 +89,7 @@ export type ScaffoldAuditPlanResult = {
89
89
  };
90
90
  /**
91
91
  * Scaffold an audit plan directory (`{PLAN_DIR}/audit-<date>/` layout,
92
- * mstar-audit SKILL § Phase 4): numbered `NNN-<slug>.md` plan files from
92
+ * mstar-audit SKILL.md § Plan output (all variants)): numbered `NNN-<slug>.md` plan files from
93
93
  * findings plus a README.md index. Numbering is monotonic — when the
94
94
  * directory already contains `NNN-*.md` files (same-date re-run), the new
95
95
  * batch continues after the highest existing number instead of restarting
@@ -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 SKILL.md § Plan output (all variants) — 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
+ }>;