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.
- package/.claude/commands/maestro-analyze.md +46 -3
- package/.claude/commands/maestro-execute.md +14 -0
- package/.claude/commands/maestro-plan.md +16 -0
- package/.claude/commands/manage-harvest.md +1 -1
- package/.claude/commands/manage-issue-discover.md +2 -2
- package/.claude/commands/manage-issue.md +3 -3
- package/.codex/skills/maestro/SKILL.md +463 -0
- package/.codex/skills/maestro-analyze/SKILL.md +28 -7
- package/.codex/skills/maestro-chain/SKILL.md +248 -0
- package/.codex/skills/maestro-coordinate/SKILL.md +279 -224
- package/.codex/skills/maestro-execute/SKILL.md +8 -0
- package/.codex/skills/maestro-plan/SKILL.md +9 -1
- package/README.md +7 -7
- package/README.zh-CN.md +7 -7
- package/chains/issue-lifecycle.json +13 -13
- package/chains/singles/issue-analyze.json +3 -3
- package/chains/singles/issue-execute.json +3 -3
- package/chains/singles/issue-plan.json +3 -3
- package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
- package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
- package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
- package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
- package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
- package/dashboard/dist-server/src/hooks/constants.d.ts +90 -12
- package/dashboard/dist-server/src/hooks/constants.js +149 -16
- package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
- package/dashboard/dist-server/src/types/index.d.ts +5 -0
- package/dist/src/commands/collab.d.ts +1 -34
- package/dist/src/commands/collab.d.ts.map +1 -1
- package/dist/src/commands/collab.js +4 -72
- package/dist/src/commands/collab.js.map +1 -1
- package/dist/src/commands/hooks.d.ts +5 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +50 -10
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
- package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
- package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.js +5 -1
- package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallFlow.js +7 -3
- package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
- package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
- package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
- package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
- package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
- package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
- package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
- package/dist/src/hooks/constants.d.ts +90 -12
- package/dist/src/hooks/constants.d.ts.map +1 -1
- package/dist/src/hooks/constants.js +149 -16
- package/dist/src/hooks/constants.js.map +1 -1
- package/dist/src/hooks/guards/index.d.ts +1 -0
- package/dist/src/hooks/guards/index.d.ts.map +1 -1
- package/dist/src/hooks/guards/index.js +1 -0
- package/dist/src/hooks/guards/index.js.map +1 -1
- package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
- package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
- package/dist/src/hooks/guards/preflight-guard.js +95 -0
- package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +1 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/preflight-core.d.ts +37 -0
- package/dist/src/hooks/preflight-core.d.ts.map +1 -0
- package/dist/src/hooks/preflight-core.js +86 -0
- package/dist/src/hooks/preflight-core.js.map +1 -0
- package/dist/src/hooks/statusline.d.ts +8 -17
- package/dist/src/hooks/statusline.d.ts.map +1 -1
- package/dist/src/hooks/statusline.js +269 -112
- package/dist/src/hooks/statusline.js.map +1 -1
- package/dist/src/i18n/locales/en.d.ts.map +1 -1
- package/dist/src/i18n/locales/en.js +5 -0
- package/dist/src/i18n/locales/en.js.map +1 -1
- package/dist/src/i18n/locales/zh.d.ts.map +1 -1
- package/dist/src/i18n/locales/zh.js +5 -0
- package/dist/src/i18n/locales/zh.js.map +1 -1
- package/dist/src/i18n/types.d.ts +5 -0
- package/dist/src/i18n/types.d.ts.map +1 -1
- package/dist/src/tools/collab-adapter.d.ts +17 -0
- package/dist/src/tools/collab-adapter.d.ts.map +1 -1
- package/dist/src/tools/collab-adapter.js +138 -0
- package/dist/src/tools/collab-adapter.js.map +1 -1
- package/dist/src/tools/merge-validator.d.ts +24 -0
- package/dist/src/tools/merge-validator.d.ts.map +1 -0
- package/dist/src/tools/merge-validator.js +220 -0
- package/dist/src/tools/merge-validator.js.map +1 -0
- package/dist/src/types/index.d.ts +5 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
- package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
- package/templates/search-tools.md +1 -1
- package/workflows/cli-tools-usage.md +44 -27
- package/workflows/delegate-usage.md +3 -3
- package/workflows/issue-analyze.md +6 -2
- package/workflows/issue-discover.md +4 -4
- package/workflows/issue-execute.md +6 -3
- package/workflows/issue-plan.md +5 -2
- package/workflows/maestro-coordinate.codex.md +281 -470
- package/workflows/maestro-coordinate.md +14 -14
- package/workflows/maestro-link-coordinate.md +2 -2
- package/workflows/maestro.codex.md +710 -0
- package/workflows/maestro.md +10 -11
- package/workflows/retrospective.md +1 -1
- package/.claude/commands/manage-issue-analyze.md +0 -62
- package/.claude/commands/manage-issue-execute.md +0 -73
- package/.claude/commands/manage-issue-plan.md +0 -62
- package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
- package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
- package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
|
@@ -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
|
-
*
|
|
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',
|
|
47
|
-
neutral: '\x1b[33m',
|
|
48
|
-
alert: '\x1b[38;5;208m',
|
|
49
|
-
critical: '\x1b[5;31m',
|
|
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,kBAAkB,GAAG,EAAE,CAAC;AAErC,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC,kDAAkD;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC,yDAAyD;AACzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;AAE5C,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE/C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAEpD,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/hooks/constants.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAA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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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface PreflightGuardResult {
|
|
2
|
+
/** True if the guard wants to block (only when mode = 'block'). */
|
|
3
|
+
blocked: boolean;
|
|
4
|
+
/** Warning lines (always populated when conflicts exist). */
|
|
5
|
+
warnings: string[];
|
|
6
|
+
/** Number of conflicting teammates. */
|
|
7
|
+
conflictCount: number;
|
|
8
|
+
}
|
|
9
|
+
export interface PreflightGuardConfig {
|
|
10
|
+
/** 'warn' = emit warnings, 'block' = reject the operation. Default: 'warn' */
|
|
11
|
+
mode: 'warn' | 'block';
|
|
12
|
+
/** Activity look-back window in minutes. Default: 30 */
|
|
13
|
+
windowMin: number;
|
|
14
|
+
/** Whether to run automatically. Default: true */
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Load preflight guard config from `.workflow/config.json` → `collab` section.
|
|
19
|
+
* Returns defaults on any error.
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadPreflightConfig(projectRoot: string): PreflightGuardConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Evaluate whether the current phase has active teammates.
|
|
24
|
+
*
|
|
25
|
+
* Pure function — takes explicit dependencies for testability.
|
|
26
|
+
* Never throws.
|
|
27
|
+
*/
|
|
28
|
+
export declare function evaluatePreflightGuard(projectRoot: string, config?: Partial<PreflightGuardConfig>): PreflightGuardResult;
|
|
29
|
+
//# sourceMappingURL=preflight-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight-guard.d.ts","sourceRoot":"","sources":["../../../../src/hooks/guards/preflight-guard.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uCAAuC;IACvC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB;AAYD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,oBAAoB,CAiB7E;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACrC,oBAAoB,CA6BtB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// PreflightGuard — Warns when teammates are active on the same phase
|
|
3
|
+
//
|
|
4
|
+
// Runs as a PreToolUse hook on write operations (Bash|Write|Edit|Agent).
|
|
5
|
+
// Advisory by default (emits warning context), configurable to block.
|
|
6
|
+
//
|
|
7
|
+
// Namespace: reads `.workflow/collab/activity.jsonl` (never writes).
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { resolveSelf } from '../../tools/team-members.js';
|
|
12
|
+
import { runPreflight } from '../preflight-core.js';
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Config loading
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
const DEFAULT_CONFIG = {
|
|
17
|
+
mode: 'warn',
|
|
18
|
+
windowMin: 30,
|
|
19
|
+
enabled: true,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Load preflight guard config from `.workflow/config.json` → `collab` section.
|
|
23
|
+
* Returns defaults on any error.
|
|
24
|
+
*/
|
|
25
|
+
export function loadPreflightConfig(projectRoot) {
|
|
26
|
+
try {
|
|
27
|
+
const configPath = join(projectRoot, '.workflow', 'config.json');
|
|
28
|
+
if (!existsSync(configPath))
|
|
29
|
+
return DEFAULT_CONFIG;
|
|
30
|
+
const raw = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
31
|
+
const collab = raw?.collab;
|
|
32
|
+
if (!collab)
|
|
33
|
+
return DEFAULT_CONFIG;
|
|
34
|
+
return {
|
|
35
|
+
mode: collab.preflight_mode === 'block' ? 'block' : 'warn',
|
|
36
|
+
windowMin: typeof collab.preflight_window_min === 'number'
|
|
37
|
+
? collab.preflight_window_min
|
|
38
|
+
: DEFAULT_CONFIG.windowMin,
|
|
39
|
+
enabled: collab.auto_preflight !== false,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return DEFAULT_CONFIG;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Core evaluation
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
/**
|
|
50
|
+
* Evaluate whether the current phase has active teammates.
|
|
51
|
+
*
|
|
52
|
+
* Pure function — takes explicit dependencies for testability.
|
|
53
|
+
* Never throws.
|
|
54
|
+
*/
|
|
55
|
+
export function evaluatePreflightGuard(projectRoot, config) {
|
|
56
|
+
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
57
|
+
if (!cfg.enabled) {
|
|
58
|
+
return { blocked: false, warnings: [], conflictCount: 0 };
|
|
59
|
+
}
|
|
60
|
+
const self = resolveSelf();
|
|
61
|
+
if (!self) {
|
|
62
|
+
return { blocked: false, warnings: [], conflictCount: 0 };
|
|
63
|
+
}
|
|
64
|
+
// Read current phase from state.json
|
|
65
|
+
const phase = readCurrentPhase(projectRoot);
|
|
66
|
+
if (phase === null) {
|
|
67
|
+
return { blocked: false, warnings: [], conflictCount: 0 };
|
|
68
|
+
}
|
|
69
|
+
const result = runPreflight(phase, { force: cfg.mode !== 'block' });
|
|
70
|
+
if (result.conflicts.length === 0) {
|
|
71
|
+
return { blocked: false, warnings: [], conflictCount: 0 };
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
blocked: cfg.mode === 'block' && result.exitCode !== 0,
|
|
75
|
+
warnings: result.warnings,
|
|
76
|
+
conflictCount: result.conflicts.length,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// Helpers
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
function readCurrentPhase(projectRoot) {
|
|
83
|
+
try {
|
|
84
|
+
const statePath = join(projectRoot, '.workflow', 'state.json');
|
|
85
|
+
if (!existsSync(statePath))
|
|
86
|
+
return null;
|
|
87
|
+
const state = JSON.parse(readFileSync(statePath, 'utf-8'));
|
|
88
|
+
const phase = state?.current_phase;
|
|
89
|
+
return typeof phase === 'number' ? phase : null;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=preflight-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight-guard.js","sourceRoot":"","sources":["../../../../src/hooks/guards/preflight-guard.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,qEAAqE;AACrE,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,EAAE;AACF,qEAAqE;AACr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E;AAE9E,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,KAAK,EAAE,aAAa,CAAC;QACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -4,5 +4,6 @@ export { FACES, getFaceLevel, WARNING_THRESHOLD, CRITICAL_THRESHOLD } from './co
|
|
|
4
4
|
export { SyncHook, AsyncSeriesHook, AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from './hook-engine.js';
|
|
5
5
|
export { WorkflowHookRegistry } from './workflow-hooks.js';
|
|
6
6
|
export { HookManager } from './hook-manager.js';
|
|
7
|
+
export { runPreflight, type PreflightResult, type PreflightDeps } from './preflight-core.js';
|
|
7
8
|
export type { RunContext, NodeContext, CommandContext, CommandResultContext, ErrorContext, DecisionContext, } from './workflow-hooks.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7F,YAAY,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
|
package/dist/src/hooks/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { FACES, getFaceLevel, WARNING_THRESHOLD, CRITICAL_THRESHOLD } from './co
|
|
|
4
4
|
export { SyncHook, AsyncSeriesHook, AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from './hook-engine.js';
|
|
5
5
|
export { WorkflowHookRegistry } from './workflow-hooks.js';
|
|
6
6
|
export { HookManager } from './hook-manager.js';
|
|
7
|
+
export { runPreflight } from './preflight-core.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAA4C,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type MemberRecord } from '../tools/team-members.js';
|
|
2
|
+
import { type ActivityEvent } from '../tools/team-activity.js';
|
|
3
|
+
export interface PreflightResult {
|
|
4
|
+
exitCode: 0 | 1 | 2;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
conflicts: Array<{
|
|
7
|
+
user: string;
|
|
8
|
+
host: string;
|
|
9
|
+
action: string;
|
|
10
|
+
ts: string;
|
|
11
|
+
relative: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface PreflightDeps {
|
|
15
|
+
getSelf?: () => MemberRecord | null;
|
|
16
|
+
getActivity?: (mins: number) => ActivityEvent[];
|
|
17
|
+
now?: () => number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Pure preflight logic — detects whether other team members are active on
|
|
21
|
+
* the given phase within a look-back window.
|
|
22
|
+
*
|
|
23
|
+
* Algorithm:
|
|
24
|
+
* 1. If no self → exit 0 (team mode off is a safe no-op).
|
|
25
|
+
* 2. Fetch recent activity (30 min window, clock tolerance handled by
|
|
26
|
+
* team-activity module).
|
|
27
|
+
* 3. Filter: same phase, different user.
|
|
28
|
+
* 4. Deduplicate by `user@host` keeping the most recent event.
|
|
29
|
+
* 5. Emit one warning line per unique teammate.
|
|
30
|
+
*
|
|
31
|
+
* `force` affects ONLY the exit code — warnings are still returned so
|
|
32
|
+
* callers can display them.
|
|
33
|
+
*/
|
|
34
|
+
export declare function runPreflight(phase: number, opts: {
|
|
35
|
+
force?: boolean;
|
|
36
|
+
}, deps?: PreflightDeps): PreflightResult;
|
|
37
|
+
//# sourceMappingURL=preflight-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight-core.d.ts","sourceRoot":"","sources":["../../../src/hooks/preflight-core.ts"],"names":[],"mappings":"AAOA,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAMnF,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,YAAY,GAAG,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;IAChD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EACzB,IAAI,CAAC,EAAE,aAAa,GACnB,eAAe,CAyDjB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Preflight Core — Pure conflict detection logic shared between CLI and hooks.
|
|
3
|
+
//
|
|
4
|
+
// Extracted from `src/commands/collab.ts` so that both the `maestro collab
|
|
5
|
+
// preflight` command and the PreToolUse guard can reuse the same algorithm.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
import { resolveSelf } from '../tools/team-members.js';
|
|
8
|
+
import { readRecentActivity } from '../tools/team-activity.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Core algorithm
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Pure preflight logic — detects whether other team members are active on
|
|
14
|
+
* the given phase within a look-back window.
|
|
15
|
+
*
|
|
16
|
+
* Algorithm:
|
|
17
|
+
* 1. If no self → exit 0 (team mode off is a safe no-op).
|
|
18
|
+
* 2. Fetch recent activity (30 min window, clock tolerance handled by
|
|
19
|
+
* team-activity module).
|
|
20
|
+
* 3. Filter: same phase, different user.
|
|
21
|
+
* 4. Deduplicate by `user@host` keeping the most recent event.
|
|
22
|
+
* 5. Emit one warning line per unique teammate.
|
|
23
|
+
*
|
|
24
|
+
* `force` affects ONLY the exit code — warnings are still returned so
|
|
25
|
+
* callers can display them.
|
|
26
|
+
*/
|
|
27
|
+
export function runPreflight(phase, opts, deps) {
|
|
28
|
+
const getSelf = deps?.getSelf ?? resolveSelf;
|
|
29
|
+
const getActivity = deps?.getActivity ?? readRecentActivity;
|
|
30
|
+
const now = deps?.now ?? Date.now;
|
|
31
|
+
const self = getSelf();
|
|
32
|
+
if (!self) {
|
|
33
|
+
return { exitCode: 0, warnings: [], conflicts: [] };
|
|
34
|
+
}
|
|
35
|
+
const events = getActivity(30);
|
|
36
|
+
const filtered = events.filter((e) => e.phase_id === phase && e.user !== self.uid);
|
|
37
|
+
// Dedupe by user@host, keep the most recent.
|
|
38
|
+
const latest = new Map();
|
|
39
|
+
for (const e of filtered) {
|
|
40
|
+
const key = `${e.user}@${e.host}`;
|
|
41
|
+
const prev = latest.get(key);
|
|
42
|
+
if (!prev || Date.parse(e.ts) > Date.parse(prev.ts)) {
|
|
43
|
+
latest.set(key, e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (latest.size === 0) {
|
|
47
|
+
return { exitCode: 0, warnings: [], conflicts: [] };
|
|
48
|
+
}
|
|
49
|
+
const nowMs = now();
|
|
50
|
+
const warnings = [];
|
|
51
|
+
const conflicts = [];
|
|
52
|
+
// Stable order: most recent first.
|
|
53
|
+
const rows = Array.from(latest.values()).sort((a, b) => Date.parse(b.ts) - Date.parse(a.ts));
|
|
54
|
+
for (const e of rows) {
|
|
55
|
+
const rel = relTime(e.ts, nowMs);
|
|
56
|
+
warnings.push(`\u26a0 ${e.user}@${e.host} is active on phase ${phase} ` +
|
|
57
|
+
`(last: ${e.action}, ${rel} ago)`);
|
|
58
|
+
conflicts.push({
|
|
59
|
+
user: e.user,
|
|
60
|
+
host: e.host,
|
|
61
|
+
action: e.action,
|
|
62
|
+
ts: e.ts,
|
|
63
|
+
relative: rel,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
exitCode: opts.force ? 0 : 1,
|
|
68
|
+
warnings,
|
|
69
|
+
conflicts,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// Helpers
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
function relTime(ts, now) {
|
|
76
|
+
const ms = now - new Date(ts).getTime();
|
|
77
|
+
const min = Math.floor(ms / 60000);
|
|
78
|
+
if (min < 1)
|
|
79
|
+
return 'just now';
|
|
80
|
+
if (min === 1)
|
|
81
|
+
return '1 min';
|
|
82
|
+
if (min < 60)
|
|
83
|
+
return `${min} min`;
|
|
84
|
+
return `${Math.floor(min / 60)}h ${min % 60}m`;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=preflight-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight-core.js","sourceRoot":"","sources":["../../../src/hooks/preflight-core.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAE9E,OAAO,EAAE,WAAW,EAAqB,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAsB,MAAM,2BAA2B,CAAC;AAwBnF,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,IAAyB,EACzB,IAAoB;IAEpB,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI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AAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;IACnC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,UAAU,CAAC;IAC/B,IAAI,GAAG,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAC9B,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,GAAG,GAAG,MAAM,CAAC;IAClC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,CAAC;AACjD,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Maestro Statusline Hook
|
|
2
|
+
* Maestro Statusline Hook — Powerline × Notion style
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Renders a Nerd-Font Powerline statusline with muted Notion-inspired colors.
|
|
5
|
+
* Segments are conditionally shown — empty segments are omitted for a clean line.
|
|
6
|
+
*
|
|
7
|
+
* Segments (left → right):
|
|
8
|
+
* Model | Phase | Coordinator | Task | Team | Directory+Git | Context bar
|
|
6
9
|
*
|
|
7
10
|
* Input (stdin JSON from Claude Code):
|
|
8
11
|
* { model, workspace, session_id, context_window }
|
|
9
12
|
*
|
|
10
|
-
* Output (stdout): formatted
|
|
13
|
+
* Output (stdout): formatted Powerline string
|
|
11
14
|
*/
|
|
12
15
|
interface StatuslineInput {
|
|
13
16
|
model?: {
|
|
@@ -21,21 +24,9 @@ interface StatuslineInput {
|
|
|
21
24
|
remaining_percentage?: number;
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Build the teammate activity segment. Returns empty string if:
|
|
26
|
-
* - Team mode not enabled (no self record)
|
|
27
|
-
* - No recent teammate activity in the last 30 minutes (excluding self)
|
|
28
|
-
* - Any error (never throws)
|
|
29
|
-
*
|
|
30
|
-
* Result is cached per-session for 10 seconds via a JSON file in os.tmpdir().
|
|
31
|
-
*/
|
|
32
27
|
export declare function buildTeamSegment(session: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Build coordinator progress segment from bridge file.
|
|
35
|
-
* Returns e.g. "[3/6]verify" or "[P]review" (paused) or empty string.
|
|
36
|
-
*/
|
|
37
28
|
export declare function buildCoordinatorSegment(session: string): string;
|
|
38
|
-
/** Main statusline handler — processes input and returns
|
|
29
|
+
/** Main statusline handler — processes input and returns Powerline string */
|
|
39
30
|
export declare function formatStatusline(data: StatuslineInput): string;
|
|
40
31
|
/** Entry point — reads stdin JSON, writes formatted statusline to stdout */
|
|
41
32
|
export declare function runStatusline(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusline.d.ts","sourceRoot":"","sources":["../../../src/hooks/statusline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"statusline.d.ts","sourceRoot":"","sources":["../../../src/hooks/statusline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+BH,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,SAAS,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD;AA4SD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA2DxD;AAMD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAqB/D;AAMD,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAoH9D;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,IAAI,IAAI,CAepC"}
|