@mstar-harness/dsh 2.1.1

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 (146) hide show
  1. package/README.i18n.yaml +7 -0
  2. package/README.md +448 -0
  3. package/README.zh.md +221 -0
  4. package/bundle/README.md +312 -0
  5. package/bundle/cordis.patch.yml +17 -0
  6. package/dist/client/index.d.ts +14 -0
  7. package/dist/client/panel/PanelView.d.ts +67 -0
  8. package/dist/client/panel/TabNav.d.ts +28 -0
  9. package/dist/client/panel/graph/event-log.d.ts +76 -0
  10. package/dist/client/panel/graph/project-graph.d.ts +499 -0
  11. package/dist/client/panel/graph/schema.d.ts +224 -0
  12. package/dist/client/panel/guards.d.ts +12 -0
  13. package/dist/client/panel/locale.d.ts +134 -0
  14. package/dist/client/panel/pages/AgentCanvasPage.d.ts +363 -0
  15. package/dist/client/panel/pages/EventLogPage.d.ts +48 -0
  16. package/dist/client/panel/pages/IterationInfoSection.d.ts +80 -0
  17. package/dist/client/panel/pages/IterationTaskPage.d.ts +37 -0
  18. package/dist/client/panel/panel-meta.d.ts +18 -0
  19. package/dist/client/panel/plan-sort.d.ts +54 -0
  20. package/dist/client/panel/sidebar.d.ts +17 -0
  21. package/dist/client/panel/state-section.d.ts +23 -0
  22. package/dist/client/panel/use-mstar-engine-status.d.ts +42 -0
  23. package/dist/client/panel/zones/Legend.d.ts +18 -0
  24. package/dist/client/panel/zones/TaskBoard.d.ts +40 -0
  25. package/dist/client.d.ts +1 -0
  26. package/dist/client.js +4486 -0
  27. package/dist/gates/_shared.d.ts +198 -0
  28. package/dist/gates/adapter.d.ts +131 -0
  29. package/dist/gates/agent-flow.d.ts +320 -0
  30. package/dist/gates/catalog.d.ts +118 -0
  31. package/dist/gates/dispatch.d.ts +152 -0
  32. package/dist/gates/seams.d.ts +152 -0
  33. package/dist/gates/skill-lint.d.ts +87 -0
  34. package/dist/gates/status.d.ts +81 -0
  35. package/dist/gates/tools.d.ts +37 -0
  36. package/dist/index.d.ts +107 -0
  37. package/dist/index.js +5748 -0
  38. package/dist/invariant.d.ts +15 -0
  39. package/dist/invariant.js +29 -0
  40. package/dist/service.d.ts +96 -0
  41. package/dist/types.d.ts +241 -0
  42. package/harness-commands/codebase-audit.md +40 -0
  43. package/harness-commands/iteration-drive.md +129 -0
  44. package/harness-commands/iteration-loop.md +139 -0
  45. package/harness-commands/iteration-start.md +179 -0
  46. package/harness-skills/grill-me/SKILL.md +10 -0
  47. package/harness-skills/mstar-audit/SKILL.md +183 -0
  48. package/harness-skills/mstar-audit/references/audit-playbook.md +130 -0
  49. package/harness-skills/mstar-audit/references/finding-format.md +65 -0
  50. package/harness-skills/mstar-branch-worktree/SKILL.md +219 -0
  51. package/harness-skills/mstar-branch-worktree/references/parallel-writable-pre-dispatch.md +68 -0
  52. package/harness-skills/mstar-coding-behavior/SKILL.md +147 -0
  53. package/harness-skills/mstar-compound/SKILL.md +105 -0
  54. package/harness-skills/mstar-compound/assets/resolution-template.md +94 -0
  55. package/harness-skills/mstar-compound/references/category-mapping.md +37 -0
  56. package/harness-skills/mstar-compound/references/compound-workflow.md +155 -0
  57. package/harness-skills/mstar-compound/references/concepts-vocabulary.md +44 -0
  58. package/harness-skills/mstar-compound/references/schema.yaml +122 -0
  59. package/harness-skills/mstar-compound-refresh/SKILL.md +140 -0
  60. package/harness-skills/mstar-compound-refresh/references/project-knowledge-bootstrap.md +164 -0
  61. package/harness-skills/mstar-design-md/SKILL.md +142 -0
  62. package/harness-skills/mstar-design-md/references/completeness-checklist.md +181 -0
  63. package/harness-skills/mstar-design-md/references/design-md-spec.md +508 -0
  64. package/harness-skills/mstar-design-md/references/vercel-example.md +200 -0
  65. package/harness-skills/mstar-design-md/templates/DESIGN.dark.md.template +354 -0
  66. package/harness-skills/mstar-design-md/templates/DESIGN.md.template +474 -0
  67. package/harness-skills/mstar-dispatch-gates/SKILL.md +128 -0
  68. package/harness-skills/mstar-dispatch-gates/references/leaf-executor-checklist.md +23 -0
  69. package/harness-skills/mstar-harness-core/SKILL.md +180 -0
  70. package/harness-skills/mstar-host/SKILL.md +78 -0
  71. package/harness-skills/mstar-host/references/_shared/host-role-binding-core.md +51 -0
  72. package/harness-skills/mstar-host/references/_shared/plan-mode-bridge-core.md +91 -0
  73. package/harness-skills/mstar-host/references/codex.md +61 -0
  74. package/harness-skills/mstar-host/references/cursor-plan-mode-bridge.md +159 -0
  75. package/harness-skills/mstar-host/references/cursor.md +183 -0
  76. package/harness-skills/mstar-host/references/dsh.md +502 -0
  77. package/harness-skills/mstar-host/references/kimi-plan-mode-bridge.md +36 -0
  78. package/harness-skills/mstar-host/references/kimi.md +136 -0
  79. package/harness-skills/mstar-host/references/omp-plan-mode-bridge.md +32 -0
  80. package/harness-skills/mstar-host/references/omp.md +244 -0
  81. package/harness-skills/mstar-host/references/opencode.md +76 -0
  82. package/harness-skills/mstar-host/references/parallel-dispatch.md +68 -0
  83. package/harness-skills/mstar-host/references/zcode-plan-mode-bridge.md +36 -0
  84. package/harness-skills/mstar-host/references/zcode.md +129 -0
  85. package/harness-skills/mstar-iteration/SKILL.md +393 -0
  86. package/harness-skills/mstar-iteration/references/autonomous-direction-lock.md +90 -0
  87. package/harness-skills/mstar-iteration/references/iteration-artifact-boundaries.md +103 -0
  88. package/harness-skills/mstar-iteration/references/iteration-compass-template.md +142 -0
  89. package/harness-skills/mstar-iteration/references/iteration-corpus-hygiene.md +45 -0
  90. package/harness-skills/mstar-iteration/references/iteration-workspace-readme-template.md +27 -0
  91. package/harness-skills/mstar-iteration/references/phase-2-worktree-lease.md +193 -0
  92. package/harness-skills/mstar-iteration/references/phase-3-iteration-close.md +95 -0
  93. package/harness-skills/mstar-iteration/references/phase-4-5-pr-delivery.md +84 -0
  94. package/harness-skills/mstar-iteration/references/phase5-helper-discovery.md +24 -0
  95. package/harness-skills/mstar-phase-gates/SKILL.md +112 -0
  96. package/harness-skills/mstar-plan-artifacts/SKILL.md +46 -0
  97. package/harness-skills/mstar-plan-artifacts/references/done-compaction.md +88 -0
  98. package/harness-skills/mstar-plan-artifacts/references/knowledge-and-designs.md +100 -0
  99. package/harness-skills/mstar-plan-artifacts/references/plan-files-and-reports.md +99 -0
  100. package/harness-skills/mstar-plan-artifacts/references/plan-quality-bar.md +99 -0
  101. package/harness-skills/mstar-plan-artifacts/references/status-and-residuals.md +570 -0
  102. package/harness-skills/mstar-plan-artifacts/templates/README.md +9 -0
  103. package/harness-skills/mstar-plan-artifacts/templates/notes.empty.json +5 -0
  104. package/harness-skills/mstar-plan-artifacts/templates/plan.main.md +54 -0
  105. package/harness-skills/mstar-plan-artifacts/templates/plans-done.empty.json +3 -0
  106. package/harness-skills/mstar-plan-artifacts/templates/status.empty.json +7 -0
  107. package/harness-skills/mstar-plan-conventions/SKILL.md +165 -0
  108. package/harness-skills/mstar-plan-conventions/references/artifact-storage-paths.md +50 -0
  109. package/harness-skills/mstar-plan-conventions/references/effort-estimation.md +38 -0
  110. package/harness-skills/mstar-plan-conventions/references/harness-bootstrap-and-agents-layering.md +93 -0
  111. package/harness-skills/mstar-review-qc/SKILL.md +60 -0
  112. package/harness-skills/mstar-review-qc/references/review-responsibility-boundaries.md +54 -0
  113. package/harness-skills/mstar-roles/SKILL.md +86 -0
  114. package/harness-skills/mstar-roles/references/_shared/leaf-executor-core.md +46 -0
  115. package/harness-skills/mstar-roles/references/architect.md +114 -0
  116. package/harness-skills/mstar-roles/references/code-reviewer.md +109 -0
  117. package/harness-skills/mstar-roles/references/frontend-dev.md +70 -0
  118. package/harness-skills/mstar-roles/references/fullstack-dev-shared.md +89 -0
  119. package/harness-skills/mstar-roles/references/ops-engineer.md +78 -0
  120. package/harness-skills/mstar-roles/references/product-manager.md +107 -0
  121. package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +198 -0
  122. package/harness-skills/mstar-roles/references/project-manager/plan-management.md +61 -0
  123. package/harness-skills/mstar-roles/references/project-manager/qa-trigger-matrix.md +56 -0
  124. package/harness-skills/mstar-roles/references/project-manager/qc-and-residuals.md +98 -0
  125. package/harness-skills/mstar-roles/references/project-manager/routing-and-dev-allocation.md +99 -0
  126. package/harness-skills/mstar-roles/references/project-manager.md +310 -0
  127. package/harness-skills/mstar-roles/references/prompt-engineer.md +71 -0
  128. package/harness-skills/mstar-roles/references/qa-engineer/acceptance-gate.md +62 -0
  129. package/harness-skills/mstar-roles/references/qa-engineer.md +79 -0
  130. package/harness-skills/mstar-roles/references/qc-specialist/deep-review-lenses.md +95 -0
  131. package/harness-skills/mstar-roles/references/qc-specialist/report-template.md +72 -0
  132. package/harness-skills/mstar-roles/references/qc-specialist/reviewer-checklist.md +44 -0
  133. package/harness-skills/mstar-roles/references/qc-specialist/reviewer-workflow.md +57 -0
  134. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +128 -0
  135. package/harness-skills/mstar-roles/references/writing-specialist.md +59 -0
  136. package/harness-skills/mstar-sdd/SKILL.md +133 -0
  137. package/harness-skills/mstar-sdd/references/file-handoffs.md +83 -0
  138. package/harness-skills/mstar-sdd/references/implementer-continuation-prompt.md +44 -0
  139. package/harness-skills/mstar-sdd/references/implementer-prompt.md +56 -0
  140. package/harness-skills/mstar-sdd/references/sticky-implementer-session.md +103 -0
  141. package/harness-skills/mstar-sdd/references/task-reviewer-prompt.md +53 -0
  142. package/harness-skills/mstar-skill-authoring/SKILL.md +162 -0
  143. package/harness-skills/mstar-skill-authoring/references/skillsbench-authoring.md +117 -0
  144. package/harness-skills/mstar-strategy/SKILL.md +130 -0
  145. package/harness-skills/pm/SKILL.md +40 -0
  146. package/package.json +92 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Package-owned invariant companion for `@mstar-harness/dsh`.
3
+ * @module @mstar-harness/dsh/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "dsh-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
@@ -0,0 +1,29 @@
1
+ var __create = Object.create;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __toESM = (mod, isNodeMode, target) => {
7
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
8
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
+ for (let key of __getOwnPropNames(mod))
10
+ if (!__hasOwnProp.call(to, key))
11
+ __defProp(to, key, {
12
+ get: () => mod[key],
13
+ enumerable: true
14
+ });
15
+ return to;
16
+ };
17
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18
+
19
+ // src/invariant.ts
20
+ var PACKAGE_NAME = "@mstar-harness/dsh";
21
+ var name = "dsh-invariant";
22
+ var inject = ["invariants"];
23
+ var install = () => {};
24
+ var apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
25
+ export {
26
+ name,
27
+ inject,
28
+ apply
29
+ };
@@ -0,0 +1,96 @@
1
+ /**
2
+ * `ctx.dshMstar` service — the in-process Morning Star engine surface for
3
+ * dsh gate plugins. Backed by `@mstar-harness/engine` (bundled into the
4
+ * plugin dist at build time per the single-version convention; resolved
5
+ * through the workspace devDependency at dev/test time).
6
+ *
7
+ * @module @mstar-harness/dsh
8
+ */
9
+ import { Context, Service } from '@deepseek-ai/cordis';
10
+ import type { EnforcementFlag, FindingsCleanupMode, GateResult, ResolveHarnessDirOptions, ResidualEntry, StatusDoc } from '@mstar-harness/engine';
11
+ declare module '@deepseek-ai/cordis' {
12
+ interface Context {
13
+ /** Morning Star engine service provided by `@mstar-harness/dsh`. */
14
+ dshMstar: DshMstar;
15
+ }
16
+ }
17
+ /** Options for constructing the service (resolved plugin config). */
18
+ export interface DshMstarOptions {
19
+ /**
20
+ * The boot-resolved `{HARNESS_DIR}`: the explicit `harnessDir` config root
21
+ * (null when unset). The plugin never probes from the process cwd —
22
+ * without the explicit config the harness dir resolves per session
23
+ * workspace at event time (the gates / pre-step catalog / tools), so the
24
+ * boot value is only the config-known part.
25
+ */
26
+ readonly harnessDir: string | null;
27
+ }
28
+ /**
29
+ * Morning Star engine access for dsh gate plugins.
30
+ *
31
+ * Layering: this service is the composition/test façade for
32
+ * FUTURE inject consumers (host adapters, catalogs, P2/P3 seams) — the
33
+ * P1 gates in `index.ts` are co-located engine wrappers that import
34
+ * `@mstar-harness/engine` directly (same plugin, engine bundled at build
35
+ * time), so the engine stays the single grammar for both paths. The service
36
+ * is constructed (and thereby self-registered) by the `dsh` function
37
+ * plugin's `apply`.
38
+ */
39
+ export declare class DshMstar extends Service {
40
+ /**
41
+ * The boot-resolved `{HARNESS_DIR}` (the explicit config root, null when
42
+ * unset — per-workspace resolution happens at event time, never from the
43
+ * process cwd).
44
+ */
45
+ readonly harnessDir: string | null;
46
+ constructor(ctx: Context, options: DshMstarOptions);
47
+ /**
48
+ * Validate a status.json document or file path.
49
+ * @param docOrPath - parsed status document or path to a status.json file.
50
+ */
51
+ validateStatus(docOrPath: StatusDoc | string): GateResult;
52
+ /**
53
+ * Validate one residual entry (status-and-residuals.md § Basic structure).
54
+ * @param entry - the residual entry as parsed from status.json.
55
+ */
56
+ validateResidual(entry: ResidualEntry | unknown): GateResult;
57
+ /**
58
+ * Findings cleanup gate for one plan (status-and-residuals.md § Findings
59
+ * cleanup modes). Mode resolution: explicit `opts.mode` → `plans[].metadata.
60
+ * findings_cleanup` → `allow-residual`.
61
+ * @param doc - the parsed status document.
62
+ * @param planId - the plan whose open residuals are checked.
63
+ * @param opts - explicit cleanup-mode override.
64
+ */
65
+ findingsCleanupGate(doc: StatusDoc, planId: string, opts?: {
66
+ mode?: FindingsCleanupMode;
67
+ }): GateResult;
68
+ /**
69
+ * Resolve the repo-level hard-enforcement flag from the iteration compass
70
+ * (`{ITERATION_DIR}/<id>/delivery-compass.md` frontmatter `enforcement: hard`
71
+ * on active/locked compasses). Hard gates are never the default.
72
+ * @param harnessDir - the resolved `{HARNESS_DIR}`.
73
+ */
74
+ resolveCompassEnforcement(harnessDir: string): EnforcementFlag;
75
+ /**
76
+ * Resolve `{HARNESS_DIR}` per plan-conventions resolution order. This is
77
+ * the generic engine mirror — callers pass the workspace root they probe
78
+ * from explicitly; the plugin itself never probes from the process cwd.
79
+ * @param startDir - directory to probe from (defaults to the process cwd).
80
+ * @param opts - explicit harness-dir override or environment fallback.
81
+ */
82
+ resolveHarnessDir(startDir?: string, opts?: ResolveHarnessDirOptions): string | null;
83
+ /**
84
+ * Read the harness version (single-version invariant — 2.1.1).
85
+ * @returns the version string of the bundled/workspace engine manifest.
86
+ */
87
+ readHarnessVersion(): string;
88
+ /**
89
+ * Apply the `Enforcement: hard` flag to a gate result.
90
+ * @param gate - gate result to escalate.
91
+ * @param opts - whether hard enforcement is on.
92
+ */
93
+ applyEnforcement(gate: GateResult, opts: {
94
+ hard: boolean;
95
+ }): GateResult;
96
+ }
@@ -0,0 +1,241 @@
1
+ /**
2
+ * `mstar-engine-status` catalog source: a durable `catalog`-form
3
+ * MessageSource the plugin appends to
4
+ * every composed step at `agent/pre-step`, so the model-visible engine-status
5
+ * row is reconstructable from the session log without re-parsing its prose
6
+ * (model-visible ⟺ logged — dsh packages/AGENTS.md). Merge-extensible
7
+ * `MessageSourceMap` augmentation mirroring the `@deepseek-ai/dsh-tool-skill`
8
+ * precedent (declare module '@deepseek-ai/dsh-llm' + catalog-form source).
9
+ *
10
+ * `mstar-iteration-gate` is the sibling catalog row: the boot-cached
11
+ * `evaluatePhaseGate` verdict (tool result shape) appended after the
12
+ * engine-status row on the same
13
+ * pre-step listener.
14
+ *
15
+ * @module @mstar-harness/dsh
16
+ */
17
+ import type { EnforcementFlag } from '@mstar-harness/engine';
18
+ /**
19
+ * Durable provenance for the ONE unified engine-status catalog row. The
20
+ * catalog is a `catalog`-form context, so it records the facts it published
21
+ * beside the model-facing prose: a consumer presenting the row must not
22
+ * re-parse the `<mstar_engine_status>` block, whose framing exists for the
23
+ * model.
24
+ */
25
+ export interface MstarEngineStatusSource {
26
+ readonly kind: 'mstar-engine-status';
27
+ readonly form: 'catalog';
28
+ /**
29
+ * The unified mstar version: the `@mstar-harness/dsh` plugin package
30
+ * version (own manifest). The single-version invariant pins the bundled
31
+ * `@mstar-harness/engine` to the same version, so one field covers both.
32
+ */
33
+ readonly version: string;
34
+ /** Resolved `{HARNESS_DIR}` (null when probing found none). */
35
+ readonly harnessDir: string | null;
36
+ /** Repo-level hard-enforcement flag from the iteration compass. */
37
+ readonly enforcement: EnforcementFlag;
38
+ /**
39
+ * Iteration phase-gate section: present when a steering compass +
40
+ * `status.json` resolve (the `mstar iteration gate` tool result shape).
41
+ */
42
+ readonly iteration?: MstarIterationGateView;
43
+ /**
44
+ * Workspace-state digest section: the plan registry, open residual
45
+ * counts, branch/policy anchors, active leases, knowledge index digest
46
+ * and the steering compass direction one-liner. Null when the workspace
47
+ * has no harness dir or no `status.json` (the state lines are absent).
48
+ */
49
+ readonly state: MstarHarnessState | null;
50
+ }
51
+ /** JSON projection of one engine `ValidationResult` (lossless — `fix` omitted when absent). */
52
+ export interface IterationGateViolationView {
53
+ severity: 'critical' | 'high' | 'medium' | 'low' | 'nit';
54
+ code: string;
55
+ message: string;
56
+ fix?: string;
57
+ }
58
+ /** JSON projection of one engine gate (`GateResult`). */
59
+ export interface IterationGateListView {
60
+ ok: boolean;
61
+ violations: IterationGateViolationView[];
62
+ }
63
+ /**
64
+ * JSON projection of the engine `PhaseGateResult` (snake_case to match the
65
+ * model-facing tool vocabulary of the CLI's `mstar iteration gate` — the
66
+ * tool result shape reused verbatim by the pre-step catalog row).
67
+ */
68
+ export interface IterationGateView {
69
+ transition: 'phase-2-execute' | 'phase-3-close' | 'phase-4-pr-delivery';
70
+ all_plans_done: boolean;
71
+ ok: boolean;
72
+ entry: IterationGateListView;
73
+ exit: IterationGateListView;
74
+ violations: IterationGateViolationView[];
75
+ }
76
+ /** The iteration phase-gate section of the unified engine-status row. */
77
+ export interface MstarIterationGateView {
78
+ /** Iteration id whose steering compass was evaluated. */
79
+ readonly iterationId: string;
80
+ /** Control-path `{HARNESS_DIR}/status.json` evaluated. */
81
+ readonly statusPath: string;
82
+ /** The steering `{ITERATION_DIR}/<id>/delivery-compass.md` evaluated. */
83
+ readonly compassPath: string;
84
+ /** Cached `evaluatePhaseGate` result (tool result shape). */
85
+ readonly gate: IterationGateView;
86
+ /**
87
+ * The steering compass frontmatter `status` (`'active' | 'locked'`), the
88
+ * authoritative signal for whether Phase 1 is still in flight vs. complete
89
+ * (spec panel-f4 §2.3 R9 / §5 D5). Optional and OMITTED when absent or
90
+ * not one of the two steering values (lossless omit-when-absent — the
91
+ * `iteration` key's discipline: `Session.append` rejects undefined-valued
92
+ * properties) — old catalog rows / typed fixtures without the field keep
93
+ * compiling and the projection degrades to the existing transition-driven
94
+ * behavior.
95
+ */
96
+ readonly compassStatus?: 'active' | 'locked';
97
+ }
98
+ /** One registered plan row of the harness-state digest (id + status + completion date). */
99
+ export interface HarnessPlanView {
100
+ readonly id: string;
101
+ readonly status: string;
102
+ /**
103
+ * The `status.json` plan row `done_at` (trimmed string). ALWAYS-present
104
+ * nullable scalar: a missing/empty `done_at` projects to `null` (lossless
105
+ * JSON — never an `undefined` property; the omit pattern is reserved for
106
+ * optional fields like `verdict?`).
107
+ */
108
+ readonly doneAt: string | null;
109
+ /**
110
+ * The `status.json` plan row `metadata.iteration_refs` (array of iteration
111
+ * ids the plan is registered under). ALWAYS-present array (plan
112
+ * `20260813-panel-quick-fixes` Task 2): a missing/non-array value projects
113
+ * to `[]` — the empty default, never an omitted field (lossless JSON).
114
+ */
115
+ readonly iterationRefs: string[];
116
+ }
117
+ /** One open residual finding of the harness-state digest (`planId` = the owning `residual_findings` root key). */
118
+ export interface ResidualFindingView {
119
+ readonly planId: string;
120
+ /** The finding's `id` (e.g. `R1`); '' when the source entry carries none. */
121
+ readonly id: string;
122
+ /** The finding's `severity` (one of the residual severity enum when known). */
123
+ readonly severity: string;
124
+ /** The finding's `title`; '' when the source entry carries none. */
125
+ readonly title: string;
126
+ }
127
+ /** Open residual finding counts by severity (non-zero severities only). */
128
+ export interface HarnessResidualView {
129
+ readonly severity: 'critical' | 'high' | 'medium' | 'low' | 'nit';
130
+ readonly count: number;
131
+ }
132
+ /** One active plan execution lease of the harness-state digest. */
133
+ export interface HarnessLeaseView {
134
+ readonly planId: string;
135
+ readonly holder: string;
136
+ readonly worktreePath: string | null;
137
+ }
138
+ /**
139
+ * The workspace-state digest section of the unified engine-status row: the
140
+ * plan registry, open residual counts, branch/policy anchors, active
141
+ * leases, knowledge index digest and the steering compass direction
142
+ * one-liner. All fields come from the same per-workspace cached build as
143
+ * the rest of the row (one status.json / compass / knowledge-index read
144
+ * per cache refresh — the TTL-bounded staleness tradeoff documented on
145
+ * `buildCatalogSources`).
146
+ */
147
+ export interface MstarHarnessState {
148
+ /** Registered plan rows (`plan_id`/`id` + `status`), status.json order. */
149
+ readonly plans: readonly HarnessPlanView[];
150
+ /** Open `residual_findings` counts by severity (non-zero only). */
151
+ readonly residuals: readonly HarnessResidualView[];
152
+ /**
153
+ * Open residual findings detail (planId + R# + severity + title), severity
154
+ * ordered (critical→nit) and capped at 10. Null when the
155
+ * `residual_findings` root key is missing/unreadable (advisory — same null
156
+ * pattern as `knowledge`); `[]` when the key exists but has no open
157
+ * entries. Independent of the `residuals` rollup (which stays
158
+ * backward-compatible).
159
+ */
160
+ readonly residualFindings: readonly ResidualFindingView[] | null;
161
+ /** `metadata.iteration_base_branch` (compass frontmatter fallback), null when absent. */
162
+ readonly iterationBaseBranch: string | null;
163
+ /** `metadata.target_branch` (compass frontmatter fallback), null when absent. */
164
+ readonly targetBranch: string | null;
165
+ /** `metadata.spec_integration_branch`, null when absent. */
166
+ readonly specIntegrationBranch: string | null;
167
+ /** `metadata.push_policy`, null when absent. */
168
+ readonly pushPolicy: string | null;
169
+ /** `metadata.worktree_mode`, null when absent. */
170
+ readonly worktreeMode: string | null;
171
+ /** `metadata.control_worktree_path`, null when absent. */
172
+ readonly controlWorktreePath: string | null;
173
+ /** Active plan execution leases (holder + worktree). */
174
+ readonly leases: readonly HarnessLeaseView[];
175
+ /** Knowledge index digest (docs count + categories), null when no index. */
176
+ readonly knowledge: {
177
+ readonly docCount: number;
178
+ readonly categories: readonly string[];
179
+ } | null;
180
+ /** Steering compass direction one-liner (problem statement digest), null when unavailable. */
181
+ readonly direction: string | null;
182
+ /**
183
+ * Actual subagent flow evidence (the agent-flow ledger read — spec
184
+ * §2.1.3/§2.2): the latest dispatch/settle events (≤50) plus a role ×
185
+ * outcome summary over the same window. Null when the ledger file is
186
+ * missing or unreadable (advisory degrade — the agent-flow line is absent
187
+ * from the model text). Rendered text stays ~1 compact line (only when
188
+ * `events.length > 0`); the event detail lives in this structured source
189
+ * only. Same TTL as the rest of the state section (the catalog cache
190
+ * refreshes the ledger read at most once per `catalogTtlMs`).
191
+ */
192
+ readonly agentFlow: AgentFlowView | null;
193
+ }
194
+ /**
195
+ * One agent-flow ledger event in the catalog view. Optional dispatch/settle
196
+ * fields are OMITTED (never `undefined`-valued properties — `Session.append`
197
+ * rejects non-lossless JSON) using the `iterationViolationView` omit pattern.
198
+ */
199
+ export interface AgentFlowEventView {
200
+ readonly ts: number;
201
+ readonly kind: 'dispatch' | 'settle';
202
+ /** The session's stable id; null when the event carried none. */
203
+ readonly agent: string | null;
204
+ /** Assignment `Execute as` ('' for settle rows without a paired identity). */
205
+ readonly role: string;
206
+ readonly planId: string | null;
207
+ readonly taskId: string | null;
208
+ readonly taskCategory: string | null;
209
+ /** Dispatch gate verdict (dispatch events only). */
210
+ readonly verdict?: 'ok' | 'advisory' | 'denied';
211
+ /** resolveDispatchHard result (dispatch events only). */
212
+ readonly hard?: boolean;
213
+ /** Settle outcome (settle events only). */
214
+ readonly outcome?: 'ok' | 'error' | 'denied';
215
+ /** Settle duration in ms (settle events only, when recorded). */
216
+ readonly durationMs?: number | null;
217
+ /**
218
+ * Settle rows only (plan `20260811-panel-f4-timeliness` Task 1): true when
219
+ * the settle carries the PAIRED dispatch's identity (`role`/`planId`/
220
+ * `taskId` — same fields + semantics as the dispatch event) — the client
221
+ * pairs exactly on that identity. ABSENT on unpaired (legacy) settles →
222
+ * they stay unpaired (honest, no owner+time guessing).
223
+ */
224
+ readonly paired?: boolean;
225
+ }
226
+ /** One role × outcome count of the agent-flow summary (count desc). */
227
+ export interface AgentFlowSummaryRow {
228
+ readonly role: string;
229
+ readonly outcome: string;
230
+ readonly count: number;
231
+ }
232
+ /** The catalog's agent-flow evidence: latest events first (≤ limit) + summary. */
233
+ export interface AgentFlowView {
234
+ readonly events: readonly AgentFlowEventView[];
235
+ readonly summary: readonly AgentFlowSummaryRow[];
236
+ }
237
+ declare module '@deepseek-ai/dsh-llm' {
238
+ interface MessageSourceMap {
239
+ 'mstar-engine-status': MstarEngineStatusSource;
240
+ }
241
+ }
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: codebase-audit
3
+ description: Survey a codebase as a senior advisor and produce prioritized, self-contained improvement plans. Read-only on source code. Use standalone before iteration-start to discover what's worth doing, or independently to build a prioritized backlog.
4
+ agent: project-manager
5
+ input: "[no args]"
6
+ ---
7
+
8
+ # Audit Codebase
9
+
10
+ Run a read-only codebase audit that discovers what is worth doing and writes self-contained plans for the normal Prepare → Execute flow.
11
+
12
+ **Read-only.** No source edits, no state machine, no commits. Output: prioritized plans in `{PLAN_DIR}/audit-<date>/`.
13
+
14
+ ## Boot
15
+
16
+ 1. `mstar-harness-core`
17
+ 2. `mstar-audit` → SKILL.md(workflow、hard rules、scope variants、handoff 全量在此)
18
+ 3. `mstar-roles` → `references/code-reviewer.md`(执行角色:audit 执行体)
19
+ 4. `mstar-plan-conventions` (path symbols — `{PLAN_DIR}`, `{HARNESS_DIR}`)
20
+ 5. `mstar-host` → active host reference (invoke capability for parallel subagents)
21
+
22
+ ## Routing(谁执行 audit)
23
+
24
+ | Context | Who runs the audit |
25
+ |---------|-------------------|
26
+ | **Small repo** (single scan pass feasible) | PM dispatches `@code-reviewer` — single scan pass, then vet and write plans |
27
+ | **Large repo** (parallel categories needed) | `@code-reviewer` fans out read-only `scout` / `explore` subagents per category via Assignment `Delegation: allowed (scout/explore only, read-only)`, then vets and writes plans |
28
+ | **Specialist depth needed** | PM orchestrates an `@architect` consult for architecture/tech-debt depth (separate dispatch, or folded into the audit delegation brief) |
29
+
30
+ This command is the PM entry point; the audit execution body is `code-reviewer`(PM dispatch).
31
+
32
+ The audit is **advisory** — it does not enter the per-plan state machine (`Todo → InProgress → InReview → Done`). Its output is plan *candidates*.
33
+
34
+ ## Execute
35
+
36
+ Execute **`mstar-audit`** end to end(SKILL.md:Recon → Audit → Vet & prioritize → Write plans;effort `quick` / `standard` / `deep`;scope variants `security` / `perf` / `tests` / `branch` / `next` / `roadmap`)。Plans → `{PLAN_DIR}/audit-<YYYY-MM-DD>/NNN-<slug>.md` + `README.md` index,per **`mstar-plan-artifacts/references/plan-quality-bar.md`**。
37
+
38
+ Executor: PM dispatches `@code-reviewer`;大型仓库 scout 扇出经 Assignment `Delegation: allowed (scout/explore only, read-only)`(Routing 表)。
39
+
40
+ Pursued plans feed the normal Prepare → Execute flow(fast-track Prepare — intent gate + clarify still apply)or `/iteration-start` as direction candidates。
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: iteration-drive
3
+ description: Drive the active iteration to completion — Phase 2 Autonomous Execute, Phase 3 iteration-close, Phase 4 Create PR, Phase 5 PR merge-ready loop (prefer babysit/*-babysit; optional greploop when repo has it; else CI fallback) until mergeable. Not Done until Phase 5 exit checklist passes.
4
+ agent: project-manager
5
+ input: "[no args]"
6
+ ---
7
+
8
+ # Drive Iteration
9
+
10
+ Drive the active Morning Star iteration forward. **Boot loads skills; this command sequences Phase 2 → 3 → 4 → 5.** Phase gate SSOT → **`mstar-iteration`** §2–§5;本 command 仅补充 **可选第三方 helper skill 发现**(Phase 5),不反向写入 `mstar-*`。
11
+
12
+ ## Phase flow(禁止跳步)
13
+
14
+ `Phase 2: Autonomous Execute → Phase 3: iteration-close → Phase 4: Create PR → Phase 5: PR merge-ready`。Transition gates(HARD)→ **`mstar-iteration`** **Phase transition gates** table。
15
+
16
+ **Done 定义**:**仅** Phase 5 §5.5 exit checklist 全 `[x]`。**Phase 3 close ≠ Done;Phase 4 开 PR ≠ Done。**
17
+
18
+ ## Continuous execution(HARD — Phase 2–5)
19
+
20
+ Execute **`mstar-iteration` §2.6**(Continuous execution SSOT:自 Phase 2 进入至 Phase 5 §5.5 exit 前 PM **连续编排**,进度汇报后下一条必须是 dispatch 或下一 phase 步骤,不向用户例行 yes/no check-in)。
21
+
22
+ **合法 STOP(仅此升级用户)**:
23
+
24
+ - §2.0 / Phase 4 branch metadata 缺失(`iteration_base_branch` / `target_branch`)
25
+ - **`Blocked`**:真冲突、secrets、不可逆范围缺口、Phase 5 多轮仍无法 merge-ready
26
+ - 用户本轮显式打断
27
+
28
+ **Turn 收束纪律**:若 host 即将结束本轮,最后一条 assistant 内容必须是 **in-flight 动作**(invoke 已发出、或写明下一 dispatch 的 Assignment 字段),**不得**以对用户的确认问句结尾。
29
+
30
+ ## PM invariants(Phase 2–5 全程有效)
31
+
32
+ | 禁止(PM 线程) | 必须 |
33
+ |-----------------|------|
34
+ | Write/Edit/Shell 产品代码、写测试、跑 QC 审查(Phase 2) | 每条 implement/QC/QA Assignment ⇒ **1 次 `Task`** |
35
+ | **多 task plan 用 inline 大包派发**(整份 plan / T1–Tn 贴进一个 dev Assignment) | **SDD**:`mstar-sdd` per-task 循环 — `mstar sdd task-brief` → implementer → `mstar sdd review-package` → task reviewer → `progress.md` |
36
+ | 只写 Assignment 就进入下一 gate | 同轮 dispatch:`Subagent invokes issued: N`(N = Assignment 条数) |
37
+ | 最后一个 plan `Done` 后直接开 PR / 汇报结束 | **Phase 3 → 4 → 5** 顺序执行 |
38
+ | Phase 4 开 PR 后停止 | Phase 5 loop 至 merge-ready;**禁止**未过 §5.5 就结束会话 |
39
+ | Phase 5 自己改产品代码 | 需改产品代码时 **dispatch** `fullstack-dev` / `ops-engineer` |
40
+
41
+ 派发细则 → **`mstar-dispatch-gates`** + **`mstar-host`**。Phase 3 细则 → **`mstar-iteration` §3** + **`mstar-compound`**。
42
+
43
+ **Session todos**:
44
+
45
+ | Todo id | 何时追加 | 何时可勾掉 |
46
+ |---------|----------|------------|
47
+ | plan-wave todos | 进入 Phase 2 | 各 plan `Done` |
48
+ | `phase-3-iteration-close` | 仅剩 1 个非 `Done` plan | Phase 3 §3.5 exit 全 `[x]` |
49
+ | `phase-4-create-pr` | Phase 3 完成后 | PR 已创建并记录 URL/number |
50
+ | `phase-5-pr-merge-ready` | Phase 4 完成后 | Phase 5 §5.5 exit 全 `[x]` |
51
+
52
+ ## Boot
53
+
54
+ 1. `mstar-harness-core`
55
+ 2. `mstar-roles` → `references/project-manager.md`
56
+ 3. `mstar-iteration` → **§ Phase 2–5**(§3 close gate;§4 PR delivery;§5 merge-ready loop)
57
+ 4. `mstar-compound` — Phase 3 §3.2 前加载(含 Phase 6 索引登记)
58
+ 5. `mstar-dispatch-gates` + host reference
59
+ 6. **`mstar-sdd`** — **before first implement dispatch** in Phase 2(per-task loop SSOT;多 task plan 默认 `Execution mode: sdd`)
60
+ 7. `mstar-review-qc` — before first QC dispatch in Phase 2
61
+ 8. `mstar-plan-artifacts`, `mstar-plan-conventions`, `mstar-branch-worktree`
62
+ 9. **`mstar-iteration/references/phase-2-worktree-lease.md`** — Phase 2 control worktree、`execution_lease`、serial `integration_merge_lease`(§2.0 #5 未 waive)
63
+
64
+ ## Phase 2: Autonomous Execute
65
+
66
+ **Continuous execution applies**(上节)。Execute **`mstar-iteration` § Phase 2** exactly:§2.0 前置五道闸(含 branch metadata #4 + control-worktree/lease #5)→ §2.1 session todos → §2.2 read backlog(`status.json` + branch metadata)→ §2.3 integration branch + control worktree(record `metadata.control_worktree_path`;status/SDD via control path)→ §2.4 per-plan loop(**lease-gated parallel** across plan IDs unless `Plan parallelism: serial`;claim/resume `execution_lease`;feature worktree;**SDD** per-task 串行;QC full tri-review **N=3** + QA;serial merge via `integration_merge_lease`;cross-plan sync → compass)→ §2.5 dispatch-first → §2.6 push 纪律。全部 plan `Done` → **STOP**(Phase flow)→ 打印 `## Phase 3: iteration-close`;**不得**进入 Phase 4。
67
+
68
+ **Assignment preflight**(`mstar-harness` bin 未安装时静默跳过): 在每次 implement/QC/QA 派发前(**SDD** 下为最新 `{SDD_DIR}/task-N-brief.md` 或临时写盘的 Assignment),若本机装有 CLI,校验最新 Assignment。模式由迭代 compass frontmatter 的 `enforcement` 键决定(Slice 5):
69
+
70
+ - **默认(compass 无 `enforcement: hard`)— 可选 warn-only**:exit 1 仅提示,不阻断派发(Slice 3 行为不变):
71
+
72
+ ```bash
73
+ command -v mstar-harness >/dev/null 2>&1 && mstar-harness dispatch validate "<latest-assignment-file>"
74
+ ```
75
+
76
+ - **`enforcement: hard`(迭代 compass frontmatter 声明)— fail-fast**:校验失败即 `exit 1` 阻断派发(bin 缺失仍静默跳过):
77
+
78
+ ```bash
79
+ if command -v mstar-harness >/dev/null 2>&1; then mstar-harness dispatch validate "<latest-assignment-file>" || exit 1; fi
80
+ ```
81
+
82
+ > 路径必须加引号且替换为具体文件(如最新 `{SDD_DIR}/task-N-brief.md`,勿留尖括号)——agent 代入的路径不得进入 shell 无引号展开。
83
+
84
+ ## Phase 3: iteration-close
85
+
86
+ 当 **every** plan 为 `Done`:
87
+
88
+ 1. **STOP** per-plan loop — 不得开 PR、不得进入 Phase 4/5、不得输出「迭代完成」摘要。
89
+ 2. 打印标题 **`## Phase 3: iteration-close`**(用户可见的 phase 边界)。
90
+ 3. Execute **`mstar-iteration` § Phase 3**(→ **`references/phase-3-iteration-close.md`** §3.0→§3.5):§3.0.5 compass 规范化 → §3.1 close entry checklist(**HARD GATE**,必须打印)→ §3.2 compound + **`<iteration-id>/` package promotion**(`mstar-compound` Phase 6 索引登记)→ §3.3 roadmap → §3.4 frontmatter `status: completed` + `end_date` → §3.5 close exit checklist + commit → push。
91
+ 4. §3.5 exit 全 `[x]` 且 compass `status: completed` 后 → 打印 **`## Phase 4: Create PR`**。
92
+
93
+ **Phase 3 exit(非 iteration-drive Done)**: §3.5 checklist `[x]` + compass frontmatter `completed`。
94
+
95
+ ## Phase 4: Create PR
96
+
97
+ Execute **`mstar-iteration` § Phase 4**(→ **`references/phase-4-5-pr-delivery.md`**):打印 `## Phase 4: Create PR` → resolve `metadata.target_branch`(compass fallback;缺失 → **STOP**,never default `main`/`master`)→ 创建 PR `spec_integration_branch` → `target_branch` → 记录 PR URL + number(Phase 5 SSOT)→ 勾掉 host todo `phase-4-create-pr` → **Immediately** 打印 **`## Phase 5: PR merge-ready`**(**禁止**在此停止或汇报 Done)。
98
+
99
+ **Phase 4 exit(非 iteration-drive Done)**: PR 已创建且 head = `spec_integration_branch`。
100
+
101
+ ## Phase 5: PR merge-ready(babysit loop)
102
+
103
+ Execute **`mstar-iteration` § Phase 5**(→ **`references/phase-4-5-pr-delivery.md`** §5.0–§5.2;**§5.1a push cadence HARD**)。**§5.5 exit 全 `[x]` = iteration-drive Done.**
104
+
105
+ 本 command **叠加**可选 helper skill 发现(**non-`mstar-*`**;不写入 `mstar-*` load order):
106
+
107
+ ### 5.0 Discover optional helper skills
108
+
109
+ Helper 搜索路径 → **`mstar-iteration/references/phase5-helper-discovery.md`**(babysit / `*-babysit` / greploop 路径清单;first readable `SKILL.md` wins per name)。
110
+
111
+ | Priority | Condition | Read before loop | Primary done signal |
112
+ |----------|-----------|------------------|---------------------|
113
+ | 1 | `babysit` **or** any `*-babysit` found | that skill’s `SKILL.md`(prefer exact `babysit`, else first matching `*-babysit`) | Required CI **all green** + **all** review threads **resolved** |
114
+ | 2 | `greploop` found **and** repo has Greptile/greploop | `greploop` SKILL.md | Greptile score **5/5** on this PR(**additive** — does not replace priority-1 gates) |
115
+ | 3 | else neither babysit/`*-babysit` | —(fallback = babysit 同级 CI + reviews 门禁) | Required CI **all green** + **all** review threads **resolved** |
116
+
117
+ **Both babysit/`*-babysit` and greploop apply**: run **babysit/`*-babysit` first**(CI + reviews),then optional greploop until Greptile **5/5**(串行;§5.5 仍须满足全部 exit 项)。Do **not** prefer greploop over babysit。**No greploop / repo without Greptile**: skip greploop entirely。**All modes** share §5.5 exit checklist(Greptile 5/5 only when greploop mode ran or repo shows a Greptile score)。
118
+
119
+ ### 5.1 Loop + review fix hygiene(all modes)
120
+
121
+ Execute **`mstar-iteration` §5.1 loop**(`references/phase-4-5-pr-delivery.md` §5.1):status(`gh pr view <number> --json mergeable,mergeStateStatus,statusCheckRollup,reviewDecision` 或宿主等价 API)→ merge conflicts → unresolved reviews → CI → **§5.1a idle push**(一批修复一次 push)→ mode-specific pass(babysit SKILL / greploop / fallback)→ §5.1 review fix hygiene(**comment on same thread + resolve**)→ repeat until §5.5。Fixes **push 到 `spec_integration_branch`**(PR head);禁止另开分支替代。**Checkout(HARD,§5.0)**:直接在 control / 集成分支 checkout 上修;**禁止**另开 Phase 5 fix worktree,**禁止**套用 Phase 2 control 产品编辑禁令。产品代码修复 → **dispatch** dev/ops(Assignment cwd = control);PM 线程不代写。**禁止**为「让 CI 变绿」而改 workflow,除非用户明确授权。多轮仍 blocked → 升级用户。
122
+
123
+ ### 5.2 Phase 5 exit checklist(iteration-drive Done)
124
+
125
+ Print **`## Phase 5 exit checklist`** per **`mstar-iteration` §5.2**(`references/phase-4-5-pr-delivery.md` §5.2:PR mergeable、required CI green、review threads resolved(或用户书面 waive)、§5.1 comment + resolve、todo `phase-5-pr-merge-ready`;Greptile 5/5 仅当 greploop mode / repo 可见分数)→ 全 `[x]` 后结束本 command。
126
+
127
+ **Then** report: iteration id, plans completed, compound summary, PR link, merge-ready evidence(CI snapshot + review resolution + Greptile if applicable)。
128
+
129
+ PR merge itself may still be manual or a separate host action unless user authorized auto-merge.