maestro-flow 0.3.9 → 0.3.10

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 (125) hide show
  1. package/.claude/commands/maestro-analyze.md +46 -3
  2. package/.claude/commands/maestro-execute.md +14 -0
  3. package/.claude/commands/maestro-plan.md +16 -0
  4. package/.claude/commands/manage-harvest.md +1 -1
  5. package/.claude/commands/manage-issue-discover.md +2 -2
  6. package/.claude/commands/manage-issue.md +3 -3
  7. package/.codex/skills/maestro/SKILL.md +463 -0
  8. package/.codex/skills/maestro-analyze/SKILL.md +28 -7
  9. package/.codex/skills/maestro-chain/SKILL.md +248 -0
  10. package/.codex/skills/maestro-coordinate/SKILL.md +279 -224
  11. package/.codex/skills/maestro-execute/SKILL.md +8 -0
  12. package/.codex/skills/maestro-plan/SKILL.md +9 -1
  13. package/README.md +7 -7
  14. package/README.zh-CN.md +7 -7
  15. package/chains/issue-lifecycle.json +13 -13
  16. package/chains/singles/issue-analyze.json +3 -3
  17. package/chains/singles/issue-execute.json +3 -3
  18. package/chains/singles/issue-plan.json +3 -3
  19. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
  20. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  21. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  22. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  23. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
  24. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  25. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
  26. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  27. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
  28. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  29. package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
  30. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
  31. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
  32. package/dashboard/dist-server/src/hooks/constants.d.ts +90 -12
  33. package/dashboard/dist-server/src/hooks/constants.js +149 -16
  34. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  35. package/dashboard/dist-server/src/types/index.d.ts +5 -0
  36. package/dist/src/commands/collab.d.ts +1 -34
  37. package/dist/src/commands/collab.d.ts.map +1 -1
  38. package/dist/src/commands/collab.js +4 -72
  39. package/dist/src/commands/collab.js.map +1 -1
  40. package/dist/src/commands/hooks.d.ts +5 -1
  41. package/dist/src/commands/hooks.d.ts.map +1 -1
  42. package/dist/src/commands/hooks.js +50 -10
  43. package/dist/src/commands/hooks.js.map +1 -1
  44. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
  45. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  46. package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
  47. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  48. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  49. package/dist/src/commands/install-ui/InstallExecution.js +5 -1
  50. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  51. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  52. package/dist/src/commands/install-ui/InstallFlow.js +7 -3
  53. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  54. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
  55. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  56. package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
  57. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  58. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
  59. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
  60. package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
  61. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
  62. package/dist/src/hooks/constants.d.ts +90 -12
  63. package/dist/src/hooks/constants.d.ts.map +1 -1
  64. package/dist/src/hooks/constants.js +149 -16
  65. package/dist/src/hooks/constants.js.map +1 -1
  66. package/dist/src/hooks/guards/index.d.ts +1 -0
  67. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  68. package/dist/src/hooks/guards/index.js +1 -0
  69. package/dist/src/hooks/guards/index.js.map +1 -1
  70. package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
  71. package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
  72. package/dist/src/hooks/guards/preflight-guard.js +95 -0
  73. package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
  74. package/dist/src/hooks/index.d.ts +1 -0
  75. package/dist/src/hooks/index.d.ts.map +1 -1
  76. package/dist/src/hooks/index.js +1 -0
  77. package/dist/src/hooks/index.js.map +1 -1
  78. package/dist/src/hooks/preflight-core.d.ts +37 -0
  79. package/dist/src/hooks/preflight-core.d.ts.map +1 -0
  80. package/dist/src/hooks/preflight-core.js +86 -0
  81. package/dist/src/hooks/preflight-core.js.map +1 -0
  82. package/dist/src/hooks/statusline.d.ts +8 -17
  83. package/dist/src/hooks/statusline.d.ts.map +1 -1
  84. package/dist/src/hooks/statusline.js +269 -112
  85. package/dist/src/hooks/statusline.js.map +1 -1
  86. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  87. package/dist/src/i18n/locales/en.js +5 -0
  88. package/dist/src/i18n/locales/en.js.map +1 -1
  89. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  90. package/dist/src/i18n/locales/zh.js +5 -0
  91. package/dist/src/i18n/locales/zh.js.map +1 -1
  92. package/dist/src/i18n/types.d.ts +5 -0
  93. package/dist/src/i18n/types.d.ts.map +1 -1
  94. package/dist/src/tools/collab-adapter.d.ts +17 -0
  95. package/dist/src/tools/collab-adapter.d.ts.map +1 -1
  96. package/dist/src/tools/collab-adapter.js +138 -0
  97. package/dist/src/tools/collab-adapter.js.map +1 -1
  98. package/dist/src/tools/merge-validator.d.ts +24 -0
  99. package/dist/src/tools/merge-validator.d.ts.map +1 -0
  100. package/dist/src/tools/merge-validator.js +220 -0
  101. package/dist/src/tools/merge-validator.js.map +1 -0
  102. package/dist/src/types/index.d.ts +5 -0
  103. package/dist/src/types/index.d.ts.map +1 -1
  104. package/package.json +1 -1
  105. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
  106. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
  107. package/templates/search-tools.md +1 -1
  108. package/workflows/cli-tools-usage.md +44 -27
  109. package/workflows/delegate-usage.md +3 -3
  110. package/workflows/issue-analyze.md +6 -2
  111. package/workflows/issue-discover.md +4 -4
  112. package/workflows/issue-execute.md +6 -3
  113. package/workflows/issue-plan.md +5 -2
  114. package/workflows/maestro-coordinate.codex.md +281 -470
  115. package/workflows/maestro-coordinate.md +14 -14
  116. package/workflows/maestro-link-coordinate.md +2 -2
  117. package/workflows/maestro.codex.md +710 -0
  118. package/workflows/maestro.md +10 -11
  119. package/workflows/retrospective.md +1 -1
  120. package/.claude/commands/manage-issue-analyze.md +0 -62
  121. package/.claude/commands/manage-issue-execute.md +0 -73
  122. package/.claude/commands/manage-issue-plan.md +0 -62
  123. package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
  124. package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
  125. package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
@@ -16,14 +16,98 @@ export declare const NOTIFY_PREFIX = "maestro-notify-";
16
16
  export declare const COORD_BRIDGE_PREFIX = "maestro-coord-";
17
17
  /** Max ms to wait for stdin before exiting (Windows pipe safety) */
18
18
  export declare const STDIN_TIMEOUT_MS = 3000;
19
+ /** Powerline right-arrow separator (E0B0 needs Powerline font, fallback to triangle) */
20
+ export declare const PL_SEP: string;
21
+ /** Select icon set based on config */
22
+ export declare const ICONS: {
23
+ readonly model: "󰮩";
24
+ readonly milestone: "󰽎";
25
+ readonly phase: "";
26
+ readonly coord: "󰑌";
27
+ readonly task: "";
28
+ readonly team: "󰡉";
29
+ readonly dir: "";
30
+ readonly git: "";
31
+ readonly ctx: "󰐥";
32
+ } | {
33
+ readonly model: "✎";
34
+ readonly milestone: "⚑";
35
+ readonly phase: "◆";
36
+ readonly coord: "⚙";
37
+ readonly task: "▸";
38
+ readonly team: "👥";
39
+ readonly dir: "■";
40
+ readonly git: "◆";
41
+ readonly ctx: "◔";
42
+ };
43
+ /** Git status icons */
44
+ export declare const GIT_ICONS: {
45
+ readonly clean: "✓";
46
+ readonly dirty: "●";
47
+ readonly conflict: "⚠";
48
+ readonly ahead: "↑";
49
+ readonly behind: "↓";
50
+ };
19
51
  /**
20
- * ASCII faces by severity level.
21
- *
22
- * ^_^ — plenty of context (used < 50%)
23
- * -_- — getting used (used 50–65%)
24
- * O_O — running low (used 65–80%)
25
- * X_X — critical (used >= 80%)
52
+ * RGB background colors muted Notion-inspired palette.
53
+ * Each entry: [R, G, B]
26
54
  */
55
+ export declare const SEGMENT_BG: {
56
+ readonly model: readonly [63, 75, 91];
57
+ readonly milestone: readonly [160, 82, 45];
58
+ readonly phase: readonly [180, 142, 46];
59
+ readonly coord: readonly [58, 126, 200];
60
+ readonly task: readonly [55, 55, 60];
61
+ readonly team: readonly [123, 94, 167];
62
+ readonly dir: readonly [45, 134, 89];
63
+ readonly ctxOk: readonly [45, 134, 89];
64
+ readonly ctxWarn: readonly [180, 142, 46];
65
+ readonly ctxAlert: readonly [200, 122, 42];
66
+ readonly ctxCrit: readonly [196, 64, 64];
67
+ };
68
+ export declare const SEGMENT_FG: {
69
+ readonly model: readonly [255, 255, 255];
70
+ readonly milestone: readonly [255, 255, 255];
71
+ readonly phase: readonly [30, 30, 30];
72
+ readonly coord: readonly [255, 255, 255];
73
+ readonly task: readonly [224, 224, 224];
74
+ readonly team: readonly [255, 255, 255];
75
+ readonly dir: readonly [255, 255, 255];
76
+ readonly ctxOk: readonly [255, 255, 255];
77
+ readonly ctxWarn: readonly [30, 30, 30];
78
+ readonly ctxAlert: readonly [255, 255, 255];
79
+ readonly ctxCrit: readonly [255, 255, 255];
80
+ };
81
+ export type CtxLevel = 'ok' | 'warn' | 'alert' | 'crit';
82
+ export declare function getCtxLevel(usedPct: number): CtxLevel;
83
+ export declare function ansiBg(rgb: readonly [number, number, number]): string;
84
+ export declare function ansiFg(rgb: readonly [number, number, number]): string;
85
+ export declare const ANSI_RESET = "\u001B[0m";
86
+ export declare const ANSI_DIM = "\u001B[2m";
87
+ export declare const ANSI_BOLD = "\u001B[1m";
88
+ export declare const ANSI_CYAN = "\u001B[36m";
89
+ export declare const ANSI_BLINK = "\u001B[5m";
90
+ export type StatuslineStyle = 'powerline' | 'text';
91
+ export declare function getStatuslineStyle(): StatuslineStyle;
92
+ /**
93
+ * Text-mode segment colors — used as foreground on transparent background.
94
+ * Each color is the "accent" for that segment type.
95
+ */
96
+ export declare const TEXT_COLORS: {
97
+ readonly model: readonly [86, 182, 194];
98
+ readonly milestone: readonly [224, 175, 104];
99
+ readonly phase: readonly [166, 209, 137];
100
+ readonly coord: readonly [137, 180, 250];
101
+ readonly task: readonly [205, 214, 244];
102
+ readonly team: readonly [203, 166, 247];
103
+ readonly dir: readonly [249, 226, 175];
104
+ readonly git: readonly [166, 227, 161];
105
+ readonly ctxOk: readonly [166, 227, 161];
106
+ readonly ctxWarn: readonly [249, 226, 175];
107
+ readonly ctxAlert: readonly [250, 179, 135];
108
+ readonly ctxCrit: readonly [243, 139, 168];
109
+ readonly separator: readonly [88, 91, 112];
110
+ };
27
111
  export declare const FACES: {
28
112
  readonly happy: "^_^";
29
113
  readonly neutral: "-_-";
@@ -31,11 +115,5 @@ export declare const FACES: {
31
115
  readonly critical: "X_X";
32
116
  };
33
117
  export type FaceLevel = keyof typeof FACES;
34
- /** Map used% to face level */
35
118
  export declare function getFaceLevel(usedPct: number): FaceLevel;
36
- /** ANSI color codes by face level */
37
119
  export declare const FACE_COLORS: Record<FaceLevel, string>;
38
- export declare const ANSI_RESET = "\u001B[0m";
39
- export declare const ANSI_DIM = "\u001B[2m";
40
- export declare const ANSI_BOLD = "\u001B[1m";
41
- export declare const ANSI_CYAN = "\u001B[36m";
@@ -1,4 +1,33 @@
1
1
  // Shared constants for maestro hooks
2
+ import { readFileSync, existsSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { homedir } from 'node:os';
5
+ /**
6
+ * Read statusline config from maestro config file.
7
+ * Falls back to env vars, then defaults.
8
+ */
9
+ function readStatuslineConfig() {
10
+ // 1. Try maestro config file
11
+ try {
12
+ const configPath = join(process.env.MAESTRO_HOME || join(homedir(), '.maestro'), 'config.json');
13
+ if (existsSync(configPath)) {
14
+ const cfg = JSON.parse(readFileSync(configPath, 'utf8'));
15
+ if (cfg.statusline) {
16
+ return {
17
+ style: cfg.statusline.style === 'powerline' ? 'powerline' : 'text',
18
+ nerdFont: cfg.statusline.nerdFont === true,
19
+ };
20
+ }
21
+ }
22
+ }
23
+ catch { /* ignore */ }
24
+ // 2. Fall back to env vars
25
+ const envStyle = process.env.MAESTRO_STATUSLINE_STYLE?.toLowerCase();
26
+ const style = (envStyle === 'powerline' || envStyle === 'pl') ? 'powerline' : 'text';
27
+ const nerdFont = process.env.MAESTRO_NERD_FONT === '1';
28
+ return { style, nerdFont };
29
+ }
30
+ const _slConfig = readStatuslineConfig();
2
31
  /** Remaining context % at which WARNING is emitted */
3
32
  export const WARNING_THRESHOLD = 35;
4
33
  /** Remaining context % at which CRITICAL is emitted */
@@ -17,21 +46,130 @@ export const NOTIFY_PREFIX = 'maestro-notify-';
17
46
  export const COORD_BRIDGE_PREFIX = 'maestro-coord-';
18
47
  /** Max ms to wait for stdin before exiting (Windows pipe safety) */
19
48
  export const STDIN_TIMEOUT_MS = 3000;
49
+ // ---------------------------------------------------------------------------
50
+ // Powerline statusline — Notion-inspired muted palette
51
+ // ---------------------------------------------------------------------------
52
+ /** Powerline right-arrow separator (E0B0 needs Powerline font, fallback to triangle) */
53
+ export const PL_SEP = _slConfig.nerdFont ? '\uE0B0' : '\u25B6';
54
+ /** Icon sets — Nerd Font (rich) vs Unicode (safe fallback) */
55
+ const ICONS_NERD = {
56
+ model: '\u{F0BA9}', // 󰮩 nf-md-robot
57
+ milestone: '\u{F0F4E}', // 󰽎 nf-md-flag_checkered
58
+ phase: '\uF0E3', // nf-oct-milestone
59
+ coord: '\u{F044C}', // 󰑌 nf-md-check_circle_outline
60
+ task: '\uEACB', // nf-cod-terminal_cmd
61
+ team: '\u{F0849}', // 󰡉 nf-md-account_group
62
+ dir: '\uEA83', // nf-cod-folder
63
+ git: '\uE725', // nf-dev-git_branch
64
+ ctx: '\u{F0425}', // 󰐥 nf-md-gauge
65
+ };
66
+ const ICONS_UNICODE = {
67
+ model: '\u270E', // ✎ pencil
68
+ milestone: '\u2691', // ⚑ flag
69
+ phase: '\u25C6', // ◆ diamond
70
+ coord: '\u2699', // ⚙ gear
71
+ task: '\u25B8', // ▸ triangle
72
+ team: '\u{1F465}', // 👥 people
73
+ dir: '\u25A0', // ■ square
74
+ git: '\u25C6', // ◆ diamond (git branch)
75
+ ctx: '\u25D4', // ◔ circle with quarter
76
+ };
77
+ /** Select icon set based on config */
78
+ export const ICONS = _slConfig.nerdFont ? ICONS_NERD : ICONS_UNICODE;
79
+ /** Git status icons */
80
+ export const GIT_ICONS = {
81
+ clean: '✓',
82
+ dirty: '●',
83
+ conflict: '⚠',
84
+ ahead: '↑',
85
+ behind: '↓',
86
+ };
20
87
  /**
21
- * ASCII faces by severity level.
22
- *
23
- * ^_^ — plenty of context (used < 50%)
24
- * -_- — getting used (used 50–65%)
25
- * O_O — running low (used 65–80%)
26
- * X_X — critical (used >= 80%)
88
+ * RGB background colors muted Notion-inspired palette.
89
+ * Each entry: [R, G, B]
27
90
  */
91
+ export const SEGMENT_BG = {
92
+ model: [63, 75, 91], // slate
93
+ milestone: [160, 82, 45], // warm brown
94
+ phase: [180, 142, 46], // gold (muted)
95
+ coord: [58, 126, 200], // blue
96
+ task: [55, 55, 60], // charcoal
97
+ team: [123, 94, 167], // purple
98
+ dir: [45, 134, 89], // green
99
+ ctxOk: [45, 134, 89], // green (0–49%)
100
+ ctxWarn: [180, 142, 46], // gold (50–64%)
101
+ ctxAlert: [200, 122, 42], // orange (65–79%)
102
+ ctxCrit: [196, 64, 64], // red (80%+)
103
+ };
104
+ /** Foreground color per segment: white or dark */
105
+ const WHITE = [255, 255, 255];
106
+ const DARK = [30, 30, 30];
107
+ const LIGHT = [224, 224, 224];
108
+ export const SEGMENT_FG = {
109
+ model: WHITE,
110
+ milestone: WHITE,
111
+ phase: DARK,
112
+ coord: WHITE,
113
+ task: LIGHT,
114
+ team: WHITE,
115
+ dir: WHITE,
116
+ ctxOk: WHITE,
117
+ ctxWarn: DARK,
118
+ ctxAlert: WHITE,
119
+ ctxCrit: WHITE,
120
+ };
121
+ export function getCtxLevel(usedPct) {
122
+ if (usedPct < 50)
123
+ return 'ok';
124
+ if (usedPct < 65)
125
+ return 'warn';
126
+ if (usedPct < 80)
127
+ return 'alert';
128
+ return 'crit';
129
+ }
130
+ // ---------------------------------------------------------------------------
131
+ // ANSI helpers (true-color / 24-bit)
132
+ // ---------------------------------------------------------------------------
133
+ export function ansiBg(rgb) {
134
+ return `\x1b[48;2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
135
+ }
136
+ export function ansiFg(rgb) {
137
+ return `\x1b[38;2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
138
+ }
139
+ export const ANSI_RESET = '\x1b[0m';
140
+ export const ANSI_DIM = '\x1b[2m';
141
+ export const ANSI_BOLD = '\x1b[1m';
142
+ export const ANSI_CYAN = '\x1b[36m';
143
+ export const ANSI_BLINK = '\x1b[5m';
144
+ export function getStatuslineStyle() {
145
+ return _slConfig.style;
146
+ }
147
+ /**
148
+ * Text-mode segment colors — used as foreground on transparent background.
149
+ * Each color is the "accent" for that segment type.
150
+ */
151
+ export const TEXT_COLORS = {
152
+ model: [86, 182, 194], // cyan
153
+ milestone: [224, 175, 104], // warm gold
154
+ phase: [166, 209, 137], // soft green
155
+ coord: [137, 180, 250], // light blue
156
+ task: [205, 214, 244], // white-ish
157
+ team: [203, 166, 247], // lavender
158
+ dir: [249, 226, 175], // yellow
159
+ git: [166, 227, 161], // green
160
+ ctxOk: [166, 227, 161], // green
161
+ ctxWarn: [249, 226, 175], // yellow
162
+ ctxAlert: [250, 179, 135], // peach
163
+ ctxCrit: [243, 139, 168], // red/pink
164
+ separator: [88, 91, 112], // dim gray for |
165
+ };
166
+ // Legacy face exports (kept for context-monitor compatibility)
28
167
  export const FACES = {
29
168
  happy: '^_^',
30
169
  neutral: '-_-',
31
170
  alert: 'O_O',
32
171
  critical: 'X_X',
33
172
  };
34
- /** Map used% to face level */
35
173
  export function getFaceLevel(usedPct) {
36
174
  if (usedPct < 50)
37
175
  return 'happy';
@@ -41,15 +179,10 @@ export function getFaceLevel(usedPct) {
41
179
  return 'alert';
42
180
  return 'critical';
43
181
  }
44
- /** ANSI color codes by face level */
45
182
  export const FACE_COLORS = {
46
- happy: '\x1b[32m', // green
47
- neutral: '\x1b[33m', // yellow
48
- alert: '\x1b[38;5;208m', // orange
49
- critical: '\x1b[5;31m', // blinking red
183
+ happy: '\x1b[32m',
184
+ neutral: '\x1b[33m',
185
+ alert: '\x1b[38;5;208m',
186
+ critical: '\x1b[5;31m',
50
187
  };
51
- export const ANSI_RESET = '\x1b[0m';
52
- export const ANSI_DIM = '\x1b[2m';
53
- export const ANSI_BOLD = '\x1b[1m';
54
- export const ANSI_CYAN = '\x1b[36m';
55
188
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/hooks/constants.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,sDAAsD;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,uDAAuD;AACvD,MAAM,CAAC,MAAM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D,GAAG,EAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,EAAI,QAAQ;IAC/C,KAAK,EAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,EAAI,QAAQ;IAC/C,OAAO,EAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,EAAI,SAAS;IAChD,QAAQ,EAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,EAAI,QAAQ;IAC/C,OAAO,EAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,EAAI,WAAW;IAClD,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAY,EAAI,iBAAiB;CAChD,CAAC;AAEX,+DAA+D;AAC/D,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAK,KAAK;IACf,OAAO,EAAG,KAAK;IACf,KAAK,EAAK,KAAK;IACf,QAAQ,EAAE,KAAK;CACP,CAAC;AAIX,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,OAAO,CAAC;IACjC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,SAAS,CAAC;IACnC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,OAAO,CAAC;IACjC,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAA8B;IACpD,KAAK,EAAK,UAAU;IACpB,OAAO,EAAG,UAAU;IACpB,KAAK,EAAK,gBAAgB;IAC1B,QAAQ,EAAE,YAAY;CACvB,CAAC"}
@@ -10,6 +10,10 @@ export interface SpecInjectionConfig {
10
10
  /** Max chars before truncation kicks in */
11
11
  maxContentLength?: number;
12
12
  }
13
+ export interface StatuslineConfig {
14
+ style: 'powerline' | 'text';
15
+ nerdFont?: boolean;
16
+ }
13
17
  export interface MaestroConfig {
14
18
  version: string;
15
19
  extensions: ExtensionConfig[];
@@ -17,6 +21,7 @@ export interface MaestroConfig {
17
21
  workflows: WorkflowConfig;
18
22
  hooks?: HooksConfig;
19
23
  specInjection?: SpecInjectionConfig;
24
+ statusline?: StatuslineConfig;
20
25
  }
21
26
  export interface ExtensionConfig {
22
27
  name: string;
@@ -1,6 +1,4 @@
1
1
  import type { Command } from 'commander';
2
- import { type MemberRecord } from '../tools/team-members.js';
3
- import { type ActivityEvent } from '../tools/team-activity.js';
4
2
  /**
5
3
  * Scan `.workflow/collab/overlays/` for bundle files from other team members,
6
4
  * import bundles that are newer than previously imported, and update manifest.
@@ -11,37 +9,6 @@ export declare function syncOverlays(projectRoot: string, selfUid: string): {
11
9
  imported: number;
12
10
  skipped: number;
13
11
  };
14
- export interface PreflightResult {
15
- exitCode: 0 | 1 | 2;
16
- warnings: string[];
17
- conflicts: Array<{
18
- user: string;
19
- host: string;
20
- action: string;
21
- ts: string;
22
- relative: string;
23
- }>;
24
- }
25
- /**
26
- * Pure preflight logic, exported for tests.
27
- *
28
- * Algorithm:
29
- * 1. If no self → exit 0 (team mode off is a safe no-op).
30
- * 2. Fetch recent activity (30 min window, clock tolerance handled by the
31
- * team-activity module).
32
- * 3. Filter: same phase, different user.
33
- * 4. Deduplicate by `user@host` keeping the most recent event.
34
- * 5. Emit one warning line per unique teammate.
35
- *
36
- * `force` affects ONLY the exit code — warnings are still returned verbatim
37
- * so callers can print them to stderr before continuing.
38
- */
39
- export declare function runPreflight(phase: number, opts: {
40
- force?: boolean;
41
- }, deps?: {
42
- getSelf?: () => MemberRecord | null;
43
- getActivity?: (mins: number) => ActivityEvent[];
44
- now?: () => number;
45
- }): PreflightResult;
12
+ export { runPreflight, type PreflightResult } from '../hooks/preflight-core.js';
46
13
  export declare function registerCollabCommand(program: Command): void;
47
14
  //# sourceMappingURL=collab.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collab.d.ts","sourceRoot":"","sources":["../../../src/commands/collab.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAA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OAAO,EAAE,MAAM,GACd;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgFvC;AAiXD,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA+ChF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqJ5D"}
@@ -23,6 +23,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from
23
23
  import { join } from 'node:path';
24
24
  import { joinTeam, resolveSelf, requireTeamMode, getMemberByUid, addProjectRole, removeProjectRole, listProjectRoles, } from '../tools/team-members.js';
25
25
  import { reportActivity, readRecentActivity, rotateIfNeeded, } from '../tools/team-activity.js';
26
+ import { runPreflight, } from '../hooks/preflight-core.js';
26
27
  import { importBundle, } from '../core/overlay/applier.js';
27
28
  import { createTask, listTasks, getTask, updateTaskStatus, assignTask, addCheckEntry, } from '../tools/team-tasks.js';
28
29
  import { paths } from '../config/paths.js';
@@ -599,78 +600,9 @@ function runSync(opts) {
599
600
  // ---------------------------------------------------------------------------
600
601
  // preflight
601
602
  // ---------------------------------------------------------------------------
602
- /**
603
- * Format a short relative time: "just now" / "N min" / "Nh Mm".
604
- * Inline to avoid adding a dependency.
605
- */
606
- function relTime(ts, now) {
607
- const ms = now - new Date(ts).getTime();
608
- const min = Math.floor(ms / 60000);
609
- if (min < 1)
610
- return 'just now';
611
- if (min < 60)
612
- return `${min} min`;
613
- return `${Math.floor(min / 60)}h ${min % 60}m`;
614
- }
615
- /**
616
- * Pure preflight logic, exported for tests.
617
- *
618
- * Algorithm:
619
- * 1. If no self → exit 0 (team mode off is a safe no-op).
620
- * 2. Fetch recent activity (30 min window, clock tolerance handled by the
621
- * team-activity module).
622
- * 3. Filter: same phase, different user.
623
- * 4. Deduplicate by `user@host` keeping the most recent event.
624
- * 5. Emit one warning line per unique teammate.
625
- *
626
- * `force` affects ONLY the exit code — warnings are still returned verbatim
627
- * so callers can print them to stderr before continuing.
628
- */
629
- export function runPreflight(phase, opts, deps) {
630
- const getSelf = deps?.getSelf ?? resolveSelf;
631
- const getActivity = deps?.getActivity ?? readRecentActivity;
632
- const now = deps?.now ?? Date.now;
633
- const self = getSelf();
634
- if (!self) {
635
- return { exitCode: 0, warnings: [], conflicts: [] };
636
- }
637
- const events = getActivity(30);
638
- const filtered = events.filter((e) => e.phase_id === phase && e.user !== self.uid);
639
- // Dedupe by user@host, keep the most recent.
640
- const latest = new Map();
641
- for (const e of filtered) {
642
- const key = `${e.user}@${e.host}`;
643
- const prev = latest.get(key);
644
- if (!prev || Date.parse(e.ts) > Date.parse(prev.ts)) {
645
- latest.set(key, e);
646
- }
647
- }
648
- if (latest.size === 0) {
649
- return { exitCode: 0, warnings: [], conflicts: [] };
650
- }
651
- const nowMs = now();
652
- const warnings = [];
653
- const conflicts = [];
654
- // Stable order: most recent first.
655
- const rows = Array.from(latest.values()).sort((a, b) => Date.parse(b.ts) - Date.parse(a.ts));
656
- for (const e of rows) {
657
- const rel = relTime(e.ts, nowMs);
658
- warnings.push(`\u26a0 ${e.user}@${e.host} is active on phase ${phase} ` +
659
- `(last: ${e.action}, ${rel} ago)`);
660
- conflicts.push({
661
- user: e.user,
662
- host: e.host,
663
- action: e.action,
664
- ts: e.ts,
665
- relative: rel,
666
- });
667
- }
668
- return {
669
- exitCode: opts.force ? 0 : 1,
670
- warnings,
671
- conflicts,
672
- };
673
- }
603
+ // runPreflight and PreflightResult are imported from '../hooks/preflight-core.js'
604
+ // and re-exported for backward compatibility.
605
+ export { runPreflight } from '../hooks/preflight-core.js';
674
606
  function runPreflightCli(opts) {
675
607
  // Team mode off is a silent no-op. Resolve self BEFORE checking phase arg
676
608
  // so that CI/hooks invoking preflight on machines without team config