@telora/daemon 0.15.13 → 0.15.17

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 (97) hide show
  1. package/build-info.json +2 -2
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +0 -50
  4. package/dist/config.js.map +1 -1
  5. package/dist/delivery-lifecycle.d.ts +22 -0
  6. package/dist/delivery-lifecycle.d.ts.map +1 -1
  7. package/dist/delivery-lifecycle.js +51 -0
  8. package/dist/delivery-lifecycle.js.map +1 -1
  9. package/dist/directive-executor.d.ts +92 -0
  10. package/dist/directive-executor.d.ts.map +1 -1
  11. package/dist/directive-executor.js +172 -11
  12. package/dist/directive-executor.js.map +1 -1
  13. package/dist/focus-completion.d.ts.map +1 -1
  14. package/dist/focus-completion.js +12 -1
  15. package/dist/focus-completion.js.map +1 -1
  16. package/dist/focus-engine.d.ts.map +1 -1
  17. package/dist/focus-engine.js +0 -43
  18. package/dist/focus-engine.js.map +1 -1
  19. package/dist/focus-executor.d.ts.map +1 -1
  20. package/dist/focus-executor.js +8 -2
  21. package/dist/focus-executor.js.map +1 -1
  22. package/dist/focus-lifecycle.d.ts +3 -4
  23. package/dist/focus-lifecycle.d.ts.map +1 -1
  24. package/dist/focus-lifecycle.js +6 -79
  25. package/dist/focus-lifecycle.js.map +1 -1
  26. package/dist/focus-phase.d.ts +26 -0
  27. package/dist/focus-phase.d.ts.map +1 -1
  28. package/dist/focus-phase.js +43 -0
  29. package/dist/focus-phase.js.map +1 -1
  30. package/dist/focus-provisioning.d.ts.map +1 -1
  31. package/dist/focus-provisioning.js +1 -7
  32. package/dist/focus-provisioning.js.map +1 -1
  33. package/dist/focus-worktree-state.d.ts.map +1 -1
  34. package/dist/focus-worktree-state.js +0 -1
  35. package/dist/focus-worktree-state.js.map +1 -1
  36. package/dist/listener-auto-advance.d.ts.map +1 -1
  37. package/dist/listener-auto-advance.js +16 -1
  38. package/dist/listener-auto-advance.js.map +1 -1
  39. package/dist/listener.d.ts.map +1 -1
  40. package/dist/listener.js +0 -6
  41. package/dist/listener.js.map +1 -1
  42. package/dist/queries/shared.d.ts.map +1 -1
  43. package/dist/queries/shared.js +0 -3
  44. package/dist/queries/shared.js.map +1 -1
  45. package/dist/supabase.d.ts +0 -4
  46. package/dist/supabase.d.ts.map +1 -1
  47. package/dist/supabase.js +0 -8
  48. package/dist/supabase.js.map +1 -1
  49. package/dist/team-spawner.d.ts.map +1 -1
  50. package/dist/team-spawner.js +8 -2
  51. package/dist/team-spawner.js.map +1 -1
  52. package/dist/templates/claude-md.d.ts.map +1 -1
  53. package/dist/templates/claude-md.js +0 -2
  54. package/dist/templates/claude-md.js.map +1 -1
  55. package/dist/templates/claude-settings.d.ts.map +1 -1
  56. package/dist/templates/claude-settings.js +0 -5
  57. package/dist/templates/claude-settings.js.map +1 -1
  58. package/dist/types/config.d.ts +0 -10
  59. package/dist/types/config.d.ts.map +1 -1
  60. package/dist/types/focus.d.ts +11 -2
  61. package/dist/types/focus.d.ts.map +1 -1
  62. package/dist/unified-shell-config.d.ts.map +1 -1
  63. package/dist/unified-shell-config.js +0 -39
  64. package/dist/unified-shell-config.js.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/qa-crash-recovery.d.ts +0 -77
  67. package/dist/qa-crash-recovery.d.ts.map +0 -1
  68. package/dist/qa-crash-recovery.js +0 -243
  69. package/dist/qa-crash-recovery.js.map +0 -1
  70. package/dist/qa-dev-server.d.ts +0 -73
  71. package/dist/qa-dev-server.d.ts.map +0 -1
  72. package/dist/qa-dev-server.js +0 -279
  73. package/dist/qa-dev-server.js.map +0 -1
  74. package/dist/qa-orchestrator.d.ts +0 -107
  75. package/dist/qa-orchestrator.d.ts.map +0 -1
  76. package/dist/qa-orchestrator.js +0 -518
  77. package/dist/qa-orchestrator.js.map +0 -1
  78. package/dist/qa-port-allocator.d.ts +0 -34
  79. package/dist/qa-port-allocator.d.ts.map +0 -1
  80. package/dist/qa-port-allocator.js +0 -75
  81. package/dist/qa-port-allocator.js.map +0 -1
  82. package/dist/qa-provisioner.d.ts +0 -33
  83. package/dist/qa-provisioner.d.ts.map +0 -1
  84. package/dist/qa-provisioner.js +0 -139
  85. package/dist/qa-provisioner.js.map +0 -1
  86. package/dist/qa-state.d.ts +0 -118
  87. package/dist/qa-state.d.ts.map +0 -1
  88. package/dist/qa-state.js +0 -88
  89. package/dist/qa-state.js.map +0 -1
  90. package/dist/queries/qa.d.ts +0 -120
  91. package/dist/queries/qa.d.ts.map +0 -1
  92. package/dist/queries/qa.js +0 -118
  93. package/dist/queries/qa.js.map +0 -1
  94. package/dist/save-point-restore.d.ts +0 -35
  95. package/dist/save-point-restore.d.ts.map +0 -1
  96. package/dist/save-point-restore.js +0 -146
  97. package/dist/save-point-restore.js.map +0 -1
@@ -1,77 +0,0 @@
1
- /**
2
- * QA environment crash recovery.
3
- *
4
- * When the daemon crashes, QA dev server processes may be left in inconsistent
5
- * states. This module runs on daemon startup AFTER normal crash recovery to
6
- * reconcile QA-specific state.
7
- *
8
- * Under the persistent worktree model, QA does not own its own worktrees.
9
- * Recovery is purely DB-driven: query focuses with QA state and reset
10
- * dead dev servers to 'requested' for re-provisioning by the poll loop.
11
- *
12
- * Runs after recoverFromCrash() and before startListeners().
13
- */
14
- import type { DaemonConfig } from './types.js';
15
- export interface QaRecoveryDeps {
16
- getQaFocuses: () => Promise<Array<{
17
- focusId: string;
18
- focusName: string;
19
- qaStatus: string | null;
20
- qaWorktreePath: string | null;
21
- qaPort: number | null;
22
- focusStatus: string;
23
- }>>;
24
- updateQaStatus: (focusId: string, fields: Record<string, unknown>) => Promise<void>;
25
- }
26
- export interface QaRecoveryResult {
27
- focusesWithQa: number;
28
- resetToRequested: number;
29
- deactivatedTeardowns: number;
30
- errors: string[];
31
- }
32
- /**
33
- * Reconcile QA environments after a daemon crash.
34
- *
35
- * DB-driven recovery: queries focuses with active QA states and handles:
36
- *
37
- * 1. 'ready': Dev server died in crash. Reset to 'requested' for re-provision.
38
- * 2. 'provisioning': Crashed mid-provision. Reset to 'requested'.
39
- * 3. 'requested': Normal (daemon was down). Leave for poll loop.
40
- * 4. 'stop_requested': Leave for poll loop to handle.
41
- * 5. Deactivated focus: Clear QA state. Worktree cleanup handled by
42
- * focus lifecycle (teardownFocus).
43
- *
44
- * Safe to call multiple times -- idempotent by design.
45
- */
46
- export declare function reconcileQaEnvironments(config: DaemonConfig, deps: QaRecoveryDeps): Promise<QaRecoveryResult>;
47
- export interface ProductQaRecoveryDeps {
48
- getProductQaStatus: (productId: string) => Promise<{
49
- productId: string;
50
- productName: string;
51
- qaStatus: string | null;
52
- qaPort: number | null;
53
- qaWorktreePath: string | null;
54
- productStatus: string;
55
- }>;
56
- updateProductQaStatus: (productId: string, fields: Record<string, unknown>) => Promise<void>;
57
- removeQaWorktree: (repoPath: string, worktreePath: string) => void;
58
- }
59
- export interface ProductQaRecoveryResult {
60
- hadQaState: boolean;
61
- resetToRequested: boolean;
62
- cleared: boolean;
63
- errors: string[];
64
- }
65
- /**
66
- * Reconcile product-level QA environment after a daemon crash.
67
- *
68
- * Handles:
69
- * 1. 'ready': Dev server died in crash. Reset to 'requested' for re-provision.
70
- * 2. 'provisioning': Crashed mid-provision. Clean up worktree, reset to 'requested'.
71
- * 3. 'requested': Normal. Leave for poll loop.
72
- * 4. 'stop_requested': Clean up worktree, clear to null.
73
- *
74
- * Safe to call multiple times -- idempotent by design.
75
- */
76
- export declare function reconcileProductQaEnvironment(config: DaemonConfig, deps: ProductQaRecoveryDeps): Promise<ProductQaRecoveryResult>;
77
- //# sourceMappingURL=qa-crash-recovery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"qa-crash-recovery.d.ts","sourceRoot":"","sources":["../src/qa-crash-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,OA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AAM,KAAK,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CA+GlC"}
@@ -1,243 +0,0 @@
1
- /**
2
- * QA environment crash recovery.
3
- *
4
- * When the daemon crashes, QA dev server processes may be left in inconsistent
5
- * states. This module runs on daemon startup AFTER normal crash recovery to
6
- * reconcile QA-specific state.
7
- *
8
- * Under the persistent worktree model, QA does not own its own worktrees.
9
- * Recovery is purely DB-driven: query focuses with QA state and reset
10
- * dead dev servers to 'requested' for re-provisioning by the poll loop.
11
- *
12
- * Runs after recoverFromCrash() and before startListeners().
13
- */
14
- // -- Main entry point -------------------------------------------------------
15
- /**
16
- * Reconcile QA environments after a daemon crash.
17
- *
18
- * DB-driven recovery: queries focuses with active QA states and handles:
19
- *
20
- * 1. 'ready': Dev server died in crash. Reset to 'requested' for re-provision.
21
- * 2. 'provisioning': Crashed mid-provision. Reset to 'requested'.
22
- * 3. 'requested': Normal (daemon was down). Leave for poll loop.
23
- * 4. 'stop_requested': Leave for poll loop to handle.
24
- * 5. Deactivated focus: Clear QA state. Worktree cleanup handled by
25
- * focus lifecycle (teardownFocus).
26
- *
27
- * Safe to call multiple times -- idempotent by design.
28
- */
29
- export async function reconcileQaEnvironments(config, deps) {
30
- console.log('[qa-recovery] Starting QA environment recovery scan...');
31
- const result = {
32
- focusesWithQa: 0,
33
- resetToRequested: 0,
34
- deactivatedTeardowns: 0,
35
- errors: [],
36
- };
37
- // Query DB for focuses with active QA states
38
- let focuses;
39
- try {
40
- focuses = await deps.getQaFocuses();
41
- result.focusesWithQa = focuses.length;
42
- console.log(`[qa-recovery] Found ${focuses.length} focus/focuses with QA state in DB`);
43
- }
44
- catch (err) {
45
- const msg = `Failed to query QA focuses from DB: ${err instanceof Error ? err.message : String(err)}`;
46
- console.error(`[qa-recovery] ${msg}`);
47
- result.errors.push(msg);
48
- return result;
49
- }
50
- // Process each focus with QA state
51
- for (const focus of focuses) {
52
- try {
53
- await handleFocusRecovery(focus, config, deps, result);
54
- }
55
- catch (err) {
56
- const msg = `Error recovering QA for focus ${focus.focusId} (${focus.focusName}): ${err instanceof Error ? err.message : String(err)}`;
57
- console.error(`[qa-recovery] ${msg}`);
58
- result.errors.push(msg);
59
- }
60
- }
61
- // Summary
62
- console.log(`[qa-recovery] Recovery complete: ` +
63
- `${result.focusesWithQa} focus/focuses with QA state, ` +
64
- `${result.resetToRequested} reset to requested, ` +
65
- `${result.deactivatedTeardowns} deactivated teardown(s)`);
66
- if (result.errors.length > 0) {
67
- console.warn(`[qa-recovery] ${result.errors.length} error(s) during recovery (non-fatal)`);
68
- }
69
- return result;
70
- }
71
- // -- Internal helpers -------------------------------------------------------
72
- /**
73
- * Handle recovery for a single focus based on its QA status.
74
- */
75
- async function handleFocusRecovery(focus, _config, deps, result) {
76
- const { focusId, focusName, qaStatus, focusStatus } = focus;
77
- const label = `${focusId.slice(0, 8)} (${focusName})`;
78
- // Deactivated focus -- clear QA DB state.
79
- // Worktree removal is handled by focus lifecycle (teardownFocus / rebuildFocusWorktreeState).
80
- if (focusStatus !== 'active') {
81
- console.log(`[qa-recovery] Focus ${label}: status is '${focusStatus}' (not active) with qa_status '${qaStatus}'. ` +
82
- `Clearing QA state.`);
83
- await deps.updateQaStatus(focusId, {
84
- qaStatus: null,
85
- qaUrl: null,
86
- qaPort: null,
87
- qaWorktreePath: null,
88
- qaRequestedAt: null,
89
- qaReadyAt: null,
90
- qaError: null,
91
- });
92
- result.deactivatedTeardowns++;
93
- return;
94
- }
95
- switch (qaStatus) {
96
- case 'ready': {
97
- // Dev server died in crash. Reset to 'requested' so poll loop re-provisions.
98
- console.log(`[qa-recovery] Focus ${label}: dev server dead (daemon crashed). Resetting to 'requested'.`);
99
- await deps.updateQaStatus(focusId, { qaStatus: 'requested' });
100
- result.resetToRequested++;
101
- break;
102
- }
103
- case 'provisioning': {
104
- // Crashed mid-provision. Reset to 'requested'.
105
- console.log(`[qa-recovery] Focus ${label}: crashed mid-provision. Resetting to 'requested'.`);
106
- await deps.updateQaStatus(focusId, {
107
- qaStatus: 'requested',
108
- qaWorktreePath: null,
109
- qaPort: null,
110
- });
111
- result.resetToRequested++;
112
- break;
113
- }
114
- case 'requested': {
115
- // Normal -- daemon was down when request came in. Leave for poll loop.
116
- console.log(`[qa-recovery] Focus ${label}: 'requested' -- leaving for poll loop.`);
117
- break;
118
- }
119
- case 'stop_requested': {
120
- // Leave for poll loop to handle.
121
- console.log(`[qa-recovery] Focus ${label}: 'stop_requested' -- leaving for poll loop.`);
122
- break;
123
- }
124
- default: {
125
- if (qaStatus != null) {
126
- console.log(`[qa-recovery] Focus ${label}: unexpected qa_status '${qaStatus}' -- no action taken.`);
127
- }
128
- break;
129
- }
130
- }
131
- }
132
- /**
133
- * Reconcile product-level QA environment after a daemon crash.
134
- *
135
- * Handles:
136
- * 1. 'ready': Dev server died in crash. Reset to 'requested' for re-provision.
137
- * 2. 'provisioning': Crashed mid-provision. Clean up worktree, reset to 'requested'.
138
- * 3. 'requested': Normal. Leave for poll loop.
139
- * 4. 'stop_requested': Clean up worktree, clear to null.
140
- *
141
- * Safe to call multiple times -- idempotent by design.
142
- */
143
- export async function reconcileProductQaEnvironment(config, deps) {
144
- console.log('[product-qa-recovery] Starting product QA environment recovery scan...');
145
- const result = {
146
- hadQaState: false,
147
- resetToRequested: false,
148
- cleared: false,
149
- errors: [],
150
- };
151
- let product;
152
- try {
153
- product = await deps.getProductQaStatus(config.productId);
154
- }
155
- catch (err) {
156
- const msg = `Failed to query product QA status: ${err instanceof Error ? err.message : String(err)}`;
157
- console.error(`[product-qa-recovery] ${msg}`);
158
- result.errors.push(msg);
159
- return result;
160
- }
161
- if (!product.qaStatus) {
162
- console.log('[product-qa-recovery] No product QA state in DB -- nothing to recover.');
163
- return result;
164
- }
165
- result.hadQaState = true;
166
- const label = `${product.productId.slice(0, 8)} (${product.productName})`;
167
- switch (product.qaStatus) {
168
- case 'ready':
169
- case 'provisioning': {
170
- // Dev server died in crash. Clean up stale worktree and reset to 'requested'.
171
- const reason = product.qaStatus === 'ready' ? 'dev server dead (daemon crashed)' : 'crashed mid-provision';
172
- console.log(`[product-qa-recovery] Product ${label}: ${reason}. Resetting to 'requested'.`);
173
- // Remove stale worktree so re-provision creates a fresh one
174
- if (product.qaWorktreePath) {
175
- try {
176
- deps.removeQaWorktree(config.repoPath, product.qaWorktreePath);
177
- }
178
- catch (err) {
179
- console.warn(`[product-qa-recovery] Failed to remove stale worktree: ${err instanceof Error ? err.message : String(err)}`);
180
- }
181
- }
182
- try {
183
- await deps.updateProductQaStatus(config.productId, {
184
- qaStatus: 'requested',
185
- qaPort: null,
186
- qaWorktreePath: null,
187
- });
188
- result.resetToRequested = true;
189
- }
190
- catch (err) {
191
- const msg = `Failed to reset product QA: ${err instanceof Error ? err.message : String(err)}`;
192
- console.error(`[product-qa-recovery] ${msg}`);
193
- result.errors.push(msg);
194
- }
195
- break;
196
- }
197
- case 'requested': {
198
- // Normal -- daemon was down when request came in. Leave for poll loop.
199
- console.log(`[product-qa-recovery] Product ${label}: 'requested' -- leaving for poll loop.`);
200
- break;
201
- }
202
- case 'stop_requested': {
203
- // Daemon was down when user requested stop. Clean up worktree and clear state.
204
- console.log(`[product-qa-recovery] Product ${label}: 'stop_requested' -- clearing QA state.`);
205
- if (product.qaWorktreePath) {
206
- try {
207
- deps.removeQaWorktree(config.repoPath, product.qaWorktreePath);
208
- }
209
- catch (err) {
210
- console.warn(`[product-qa-recovery] Failed to remove worktree: ${err instanceof Error ? err.message : String(err)}`);
211
- }
212
- }
213
- try {
214
- await deps.updateProductQaStatus(config.productId, {
215
- qaStatus: null,
216
- qaUrl: null,
217
- qaPort: null,
218
- qaWorktreePath: null,
219
- qaReadyAt: null,
220
- qaError: null,
221
- });
222
- result.cleared = true;
223
- }
224
- catch (err) {
225
- const msg = `Failed to clear product QA: ${err instanceof Error ? err.message : String(err)}`;
226
- console.error(`[product-qa-recovery] ${msg}`);
227
- result.errors.push(msg);
228
- }
229
- break;
230
- }
231
- default: {
232
- console.log(`[product-qa-recovery] Product ${label}: unexpected qa_status '${product.qaStatus}' -- no action taken.`);
233
- break;
234
- }
235
- }
236
- console.log(`[product-qa-recovery] Recovery complete: ` +
237
- `hadQaState=${result.hadQaState}, resetToRequested=${result.resetToRequested}, cleared=${result.cleared}`);
238
- if (result.errors.length > 0) {
239
- console.warn(`[product-qa-recovery] ${result.errors.length} error(s) during recovery (non-fatal)`);
240
- }
241
- return result;
242
- }
243
- //# sourceMappingURL=qa-crash-recovery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"qa-crash-recovery.js","sourceRoot":"","sources":["../src/qa-crash-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAyBH,8EAA8E;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAoB,EACpB,IAAoB;IAEpB,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;IAEtE,MAAM,MAAM,GAAqB;QAC/B,aAAa,EAAE,CAAC;QAChB,gBAAgB,EAAE,CAAC;QACnB,oBAAoB,EAAE,CAAC;QACvB,MAAM,EAAE,EAAE;KACX,CAAC;IAEF,6CAA6C;IAC7C,IAAI,OAA4D,CAAC;IACjE,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QACpC,MAAM,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,uBAAuB,OAAO,CAAC,MAAM,oCAAoC,CAAC,CAAC;IACzF,C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AI;oBACd,KAAK,EAAE,IAAI;oBACX,MAAM,EAAE,IAAI;oBACZ,cAAc,EAAE,IAAI;oBACpB,SAAS,EAAE,IAAI;oBACf,OAAO,EAAE,IAAI;iBACd,CAAC,CAAC;gBACH,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;YACxB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,GAAG,GAAG,+BAA+B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC9F,OAAO,CAAC,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;gBAC9C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;YACD,MAAM;QACR,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,CAAC,GAAG,CAAC,iCAAiC,KAAK,2BAA2B,OAAO,CAAC,QAAQ,uBAAuB,CAAC,CAAC;YACtH,MAAM;QACR,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CACT,2CAA2C;QAC3C,cAAc,MAAM,CAAC,UAAU,sBAAsB,MAAM,CAAC,gBAAgB,aAAa,MAAM,CAAC,OAAO,EAAE,CAC1G,CAAC;IAEF,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,CAAC,MAAM,CAAC,MAAM,uCAAuC,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,73 +0,0 @@
1
- /**
2
- * QA dev server spawn and health monitoring.
3
- *
4
- * Manages the lifecycle of Vite dev servers in QA worktrees:
5
- * runs npm install, spawns `npm run dev` on an allocated port,
6
- * streams stdout/stderr to log files, and provides stop/health helpers.
7
- */
8
- import type { DaemonConfig } from './types.js';
9
- /** Options for starting a QA dev server. */
10
- export interface StartQaDevServerOptions {
11
- /** Daemon configuration (for logDir). */
12
- config: DaemonConfig;
13
- /** Focus UUID (used for log directory naming). */
14
- focusId: string;
15
- /** Absolute path to the QA worktree. */
16
- worktreePath: string;
17
- /** Port to bind the dev server to. */
18
- port: number;
19
- /** Callback invoked if the dev server exits unexpectedly. */
20
- onUnexpectedExit: (error: string) => void;
21
- }
22
- /** Result from a successful dev server start. */
23
- export interface StartQaDevServerResult {
24
- /** PID of the spawned dev server process. */
25
- pid: number;
26
- /** Absolute path to the stdout log file. */
27
- stdoutPath: string;
28
- /** Absolute path to the stderr log file. */
29
- stderrPath: string;
30
- }
31
- /**
32
- * Install dependencies and spawn a dev server in a QA worktree.
33
- *
34
- * 1. Runs `npm install` synchronously in the worktree.
35
- * 2. Spawns `npm run dev` with `PORT` env var set to the allocated port.
36
- * 3. Pipes stdout/stderr to log files under `{logDir}/qa-{focusId-prefix}/`.
37
- * 4. Registers an on-exit handler that calls `onUnexpectedExit` if the
38
- * process exits without an intentional stop.
39
- *
40
- * @returns The child process PID and log file paths.
41
- * @throws If npm install fails or the dev server process cannot be spawned.
42
- */
43
- export declare function startQaDevServer(options: StartQaDevServerOptions): StartQaDevServerResult;
44
- /**
45
- * Gracefully stop a running QA dev server.
46
- *
47
- * Sends SIGTERM first, then escalates to SIGKILL if the process
48
- * does not exit within the grace period.
49
- */
50
- export declare function stopQaDevServer(pid: number): Promise<void>;
51
- /**
52
- * Check if a QA dev server process is still alive.
53
- *
54
- * Uses the `process.kill(pid, 0)` pattern which sends no signal
55
- * but throws if the process does not exist.
56
- */
57
- export declare function isQaDevServerRunning(pid: number): boolean;
58
- /**
59
- * Build the browser-accessible Supabase URL for a QA environment.
60
- *
61
- * The local Supabase typically listens on 127.0.0.1:54321, but the QA
62
- * browser is remote (e.g. on a different machine). Replace the host
63
- * portion with the daemon's LAN IP (qaHost) so the browser can reach it.
64
- */
65
- export declare function buildQaSupabaseUrl(localSupabaseUrl: string, qaHost: string): string;
66
- type DevFramework = 'vite' | 'nextjs' | 'unknown';
67
- /**
68
- * Detect the dev framework from the project's package.json.
69
- * Checks devDependencies and dependencies for known frameworks.
70
- */
71
- export declare function detectFramework(worktreePath: string): DevFramework;
72
- export {};
73
- //# sourceMappingURL=qa-dev-server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"qa-dev-server.d.ts","sourceRoot":"","sources":["../src/qa-dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,MAAM,EAAE,YAAY,CAAC;IACrB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,iDAAiD;AACjD,MAAM,WAAW,sBAAsB;IACrC,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;CACpB;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAmHzF;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuChE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOzD;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASnF;AAED,KAAK,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,YAAY,CAclE"}