@hatchway/cli 0.50.71 → 0.50.73
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/bin/hatchway.js +2 -4
- package/package.json +2 -9
- package/dist/chunks/Banner-B4nm86qK.js +0 -27
- package/dist/chunks/Banner-B4nm86qK.js.map +0 -1
- package/dist/chunks/index-DCC6HGdr.js +0 -119
- package/dist/chunks/index-DCC6HGdr.js.map +0 -1
- package/dist/chunks/init-CBODHYDw.js +0 -473
- package/dist/chunks/init-CBODHYDw.js.map +0 -1
- package/dist/chunks/init-tui-CcxzfgmC.js +0 -1168
- package/dist/chunks/init-tui-CcxzfgmC.js.map +0 -1
- package/dist/chunks/main-tui-qySRaa-s.js +0 -652
- package/dist/chunks/main-tui-qySRaa-s.js.map +0 -1
- package/dist/chunks/manager-DjVI7erc.js +0 -1161
- package/dist/chunks/manager-DjVI7erc.js.map +0 -1
- package/dist/chunks/port-allocator-BENntRMG.js +0 -864
- package/dist/chunks/port-allocator-BENntRMG.js.map +0 -1
- package/dist/chunks/run-BbxtXsLx.js +0 -698
- package/dist/chunks/run-BbxtXsLx.js.map +0 -1
- package/dist/chunks/start-Dkuro1jp.js +0 -1713
- package/dist/chunks/start-Dkuro1jp.js.map +0 -1
- package/dist/chunks/theme-NAQBkisB.js +0 -40222
- package/dist/chunks/theme-NAQBkisB.js.map +0 -1
- package/dist/chunks/use-app-Ct3w2jLI.js +0 -10
- package/dist/chunks/use-app-Ct3w2jLI.js.map +0 -1
- package/dist/chunks/useBuildState-Dy7pRR8Z.js +0 -330
- package/dist/chunks/useBuildState-Dy7pRR8Z.js.map +0 -1
- package/dist/chunks/version-info-CDtU8Ta2.js +0 -92
- package/dist/chunks/version-info-CDtU8Ta2.js.map +0 -1
- package/dist/instrument.js +0 -48
- package/dist/instrument.js.map +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Hatchway CLI - Built with Rollup
|
|
2
|
-
import { r as reactExports, A as AppContext } from './theme-NAQBkisB.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
`useApp` is a React hook that exposes a method to manually exit the app (unmount).
|
|
6
|
-
*/
|
|
7
|
-
const useApp = () => reactExports.useContext(AppContext);
|
|
8
|
-
|
|
9
|
-
export { useApp as u };
|
|
10
|
-
//# sourceMappingURL=use-app-Ct3w2jLI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-app-Ct3w2jLI.js","sources":["../../../../node_modules/.pnpm/ink@6.5.1_@types+react@19.2.7_react@19.1.0/node_modules/ink/build/hooks/use-app.js"],"sourcesContent":["import { useContext } from 'react';\nimport AppContext from '../components/AppContext.js';\n/**\n`useApp` is a React hook that exposes a method to manually exit the app (unmount).\n*/\nconst useApp = () => useContext(AppContext);\nexport default useApp;\n//# sourceMappingURL=use-app.js.map"],"names":["useContext"],"mappings":";;;AAEA;AACA;AACA;AACK,MAAC,MAAM,GAAG,MAAMA,uBAAU,CAAC,UAAU;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
// Hatchway CLI - Built with Rollup
|
|
2
|
-
import { r as reactExports, j as jsxRuntimeExports, B as Box, c as colors, T as Text, s as symbols } from './theme-NAQBkisB.js';
|
|
3
|
-
import 'node:stream';
|
|
4
|
-
import 'node:process';
|
|
5
|
-
import 'chalk';
|
|
6
|
-
import 'node:events';
|
|
7
|
-
import { b as getLogger, g as getLogBuffer } from './runner-logger-instance-Dj_JMznn.js';
|
|
8
|
-
|
|
9
|
-
function BuildPanel({ build, width, height }) {
|
|
10
|
-
const [elapsedTime, setElapsedTime] = reactExports.useState(0);
|
|
11
|
-
// Update elapsed time every second
|
|
12
|
-
reactExports.useEffect(() => {
|
|
13
|
-
if (!build || build.status !== 'running') {
|
|
14
|
-
setElapsedTime(0);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const startTime = build.startTime;
|
|
18
|
-
const updateElapsed = () => {
|
|
19
|
-
const now = Date.now();
|
|
20
|
-
setElapsedTime(Math.floor((now - startTime) / 1000));
|
|
21
|
-
};
|
|
22
|
-
updateElapsed();
|
|
23
|
-
const interval = setInterval(updateElapsed, 1000);
|
|
24
|
-
return () => clearInterval(interval);
|
|
25
|
-
}, [build?.id, build?.status, build?.startTime]);
|
|
26
|
-
// Don't render if no build
|
|
27
|
-
if (!build) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const truncate = (str, maxLen) => {
|
|
31
|
-
if (str.length <= maxLen)
|
|
32
|
-
return str;
|
|
33
|
-
return str.substring(0, maxLen - 3) + '...';
|
|
34
|
-
};
|
|
35
|
-
const formatDuration = (seconds) => {
|
|
36
|
-
if (seconds < 60)
|
|
37
|
-
return `${seconds}s`;
|
|
38
|
-
const mins = Math.floor(seconds / 60);
|
|
39
|
-
const secs = seconds % 60;
|
|
40
|
-
return `${mins}m ${secs}s`;
|
|
41
|
-
};
|
|
42
|
-
// Determine elapsed time to show
|
|
43
|
-
const displayElapsed = build.status === 'running'
|
|
44
|
-
? elapsedTime
|
|
45
|
-
: build.endTime
|
|
46
|
-
? Math.floor((build.endTime - build.startTime) / 1000)
|
|
47
|
-
: 0;
|
|
48
|
-
return (jsxRuntimeExports.jsxs(Box, { flexDirection: "column", width: width, height: height, borderStyle: "single", borderColor: colors.darkGray, paddingX: 1, children: [jsxRuntimeExports.jsx(Box, { marginBottom: 1, children: jsxRuntimeExports.jsx(Text, { color: colors.cyan, bold: true, children: "BUILD" }) }), jsxRuntimeExports.jsx(Box, { children: jsxRuntimeExports.jsx(Text, { color: colors.white, children: truncate(build.projectSlug, width - 4) }) }), build.template && (jsxRuntimeExports.jsx(Box, { children: jsxRuntimeExports.jsx(Text, { color: colors.gray, children: truncate(build.template, width - 4) }) })), jsxRuntimeExports.jsx(Box, { children: jsxRuntimeExports.jsx(Text, { color: colors.gray, children: build.agent === 'claude-code' ? build.model : build.agent }) }), jsxRuntimeExports.jsxs(Box, { marginTop: 1, children: [build.status === 'running' && (jsxRuntimeExports.jsxs(Text, { color: colors.cyan, children: [symbols.spinnerFrames[Math.floor(Date.now() / 120) % symbols.spinnerFrames.length], " ", formatDuration(displayElapsed)] })), build.status === 'completed' && (jsxRuntimeExports.jsxs(Text, { color: colors.success, children: [symbols.check, " ", formatDuration(displayElapsed)] })), build.status === 'failed' && (jsxRuntimeExports.jsxs(Text, { color: colors.error, children: [symbols.cross, " ", formatDuration(displayElapsed)] })), build.status === 'pending' && (jsxRuntimeExports.jsx(Text, { color: colors.gray, children: "Pending..." }))] }), build.todos.length > 0 && (jsxRuntimeExports.jsxs(Box, { flexDirection: "column", marginTop: 1, children: [jsxRuntimeExports.jsx(Text, { color: colors.dimGray, bold: true, children: "TASKS" }), jsxRuntimeExports.jsx(TodoList, { todos: build.todos, maxWidth: width - 6, maxVisible: 10 })] })), build.status === 'failed' && build.error && (jsxRuntimeExports.jsx(Box, { marginTop: 1, children: jsxRuntimeExports.jsx(Text, { color: colors.error, wrap: "truncate", children: truncate(build.error, width - 4) }) }))] }));
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* TodoList - Smart display of todo items
|
|
52
|
-
* - Shows up to maxVisible items (default 10)
|
|
53
|
-
* - Prioritizes in_progress and pending tasks
|
|
54
|
-
* - Hides completed tasks when space is needed
|
|
55
|
-
* - Shows count of hidden completed tasks
|
|
56
|
-
*/
|
|
57
|
-
function TodoList({ todos, maxWidth, maxVisible = 10 }) {
|
|
58
|
-
// Separate todos by status
|
|
59
|
-
const inProgress = todos.filter(t => t.status === 'in_progress');
|
|
60
|
-
const pending = todos.filter(t => t.status === 'pending');
|
|
61
|
-
const completed = todos.filter(t => t.status === 'completed');
|
|
62
|
-
const cancelled = todos.filter(t => t.status === 'cancelled');
|
|
63
|
-
// Calculate how many slots we have for each category
|
|
64
|
-
// Priority: in_progress > pending > completed > cancelled
|
|
65
|
-
inProgress.length + pending.length;
|
|
66
|
-
let visibleTodos = [];
|
|
67
|
-
let hiddenCompletedCount = 0;
|
|
68
|
-
if (todos.length <= maxVisible) {
|
|
69
|
-
// All todos fit - show them in order
|
|
70
|
-
visibleTodos = todos;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
// Need to prioritize - always show in_progress and pending first
|
|
74
|
-
visibleTodos = [...inProgress, ...pending];
|
|
75
|
-
// Calculate remaining slots for completed tasks
|
|
76
|
-
const remainingSlots = maxVisible - visibleTodos.length;
|
|
77
|
-
if (remainingSlots > 0) {
|
|
78
|
-
// Show as many completed as we can fit
|
|
79
|
-
visibleTodos = [...visibleTodos, ...completed.slice(0, remainingSlots)];
|
|
80
|
-
hiddenCompletedCount = Math.max(0, completed.length - remainingSlots);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
hiddenCompletedCount = completed.length;
|
|
84
|
-
}
|
|
85
|
-
// Add cancelled if there's still room
|
|
86
|
-
const slotsAfterCompleted = maxVisible - visibleTodos.length;
|
|
87
|
-
if (slotsAfterCompleted > 0) {
|
|
88
|
-
visibleTodos = [...visibleTodos, ...cancelled.slice(0, slotsAfterCompleted)];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// Sort visible todos to maintain logical order (by original index)
|
|
92
|
-
visibleTodos.sort((a, b) => {
|
|
93
|
-
const aIndex = todos.findIndex(t => t.id === a.id);
|
|
94
|
-
const bIndex = todos.findIndex(t => t.id === b.id);
|
|
95
|
-
return aIndex - bIndex;
|
|
96
|
-
});
|
|
97
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [visibleTodos.map((todo) => (jsxRuntimeExports.jsx(TodoRow, { todo: todo, maxWidth: maxWidth }, todo.id))), hiddenCompletedCount > 0 && (jsxRuntimeExports.jsxs(Text, { color: colors.dimGray, children: ["\u2713 ", hiddenCompletedCount, " completed"] }))] }));
|
|
98
|
-
}
|
|
99
|
-
// Todo row component
|
|
100
|
-
function TodoRow({ todo, maxWidth }) {
|
|
101
|
-
const statusIcon = {
|
|
102
|
-
pending: jsxRuntimeExports.jsx(Text, { color: colors.dimGray, children: symbols.hollowDot }),
|
|
103
|
-
in_progress: jsxRuntimeExports.jsx(Text, { color: colors.cyan, children: symbols.spinnerFrames[Math.floor(Date.now() / 120) % symbols.spinnerFrames.length] }),
|
|
104
|
-
completed: jsxRuntimeExports.jsx(Text, { color: colors.success, children: symbols.check }),
|
|
105
|
-
cancelled: jsxRuntimeExports.jsx(Text, { color: colors.dimGray, children: "\u2298" }),
|
|
106
|
-
}[todo.status];
|
|
107
|
-
const textColor = {
|
|
108
|
-
pending: colors.dimGray,
|
|
109
|
-
in_progress: colors.white,
|
|
110
|
-
completed: colors.gray,
|
|
111
|
-
cancelled: colors.dimGray,
|
|
112
|
-
}[todo.status];
|
|
113
|
-
const truncatedContent = todo.content.length > maxWidth - 3
|
|
114
|
-
? todo.content.substring(0, maxWidth - 6) + '...'
|
|
115
|
-
: todo.content;
|
|
116
|
-
return (jsxRuntimeExports.jsxs(Box, { children: [statusIcon, jsxRuntimeExports.jsxs(Text, { color: textColor, children: [" ", truncatedContent] })] }));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* useBuildState - Hook to track build state and todos
|
|
121
|
-
*
|
|
122
|
-
* Manages:
|
|
123
|
-
* - Active builds list
|
|
124
|
-
* - Current build selection (for multi-build navigation)
|
|
125
|
-
* - Todo list updates
|
|
126
|
-
* - Build lifecycle events
|
|
127
|
-
*
|
|
128
|
-
* Subscribes to RunnerLogger events to automatically update state.
|
|
129
|
-
*
|
|
130
|
-
* IMPORTANT: Uses refs for event handlers to prevent race conditions
|
|
131
|
-
* where events could be missed during re-subscriptions caused by
|
|
132
|
-
* callback dependency changes.
|
|
133
|
-
*/
|
|
134
|
-
function useBuildState() {
|
|
135
|
-
const [builds, setBuilds] = reactExports.useState([]);
|
|
136
|
-
const [currentBuildIndex, setCurrentBuildIndex] = reactExports.useState(0);
|
|
137
|
-
const [isConnected, setIsConnected] = reactExports.useState(false);
|
|
138
|
-
const [isVerbose, setIsVerbose] = reactExports.useState(false);
|
|
139
|
-
// Derive current build from index
|
|
140
|
-
const currentBuild = builds.length > 0 ? builds[currentBuildIndex] ?? null : null;
|
|
141
|
-
// Navigation between builds
|
|
142
|
-
const nextBuild = reactExports.useCallback(() => {
|
|
143
|
-
setCurrentBuildIndex(prev => {
|
|
144
|
-
if (builds.length === 0)
|
|
145
|
-
return 0;
|
|
146
|
-
return (prev + 1) % builds.length;
|
|
147
|
-
});
|
|
148
|
-
}, [builds.length]);
|
|
149
|
-
const prevBuild = reactExports.useCallback(() => {
|
|
150
|
-
setCurrentBuildIndex(prev => {
|
|
151
|
-
if (builds.length === 0)
|
|
152
|
-
return 0;
|
|
153
|
-
return prev === 0 ? builds.length - 1 : prev - 1;
|
|
154
|
-
});
|
|
155
|
-
}, [builds.length]);
|
|
156
|
-
// Verbose toggle - updates both UI state and logger
|
|
157
|
-
const toggleVerbose = reactExports.useCallback(() => {
|
|
158
|
-
setIsVerbose(prev => {
|
|
159
|
-
const newValue = !prev;
|
|
160
|
-
// Also update the logger's verbose flag
|
|
161
|
-
try {
|
|
162
|
-
const logger = getLogger();
|
|
163
|
-
logger.setVerbose(newValue);
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
// Logger not initialized yet
|
|
167
|
-
}
|
|
168
|
-
return newValue;
|
|
169
|
-
});
|
|
170
|
-
}, []);
|
|
171
|
-
// Track when a new build is added to auto-select it
|
|
172
|
-
const [pendingNewBuildId, setPendingNewBuildId] = reactExports.useState(null);
|
|
173
|
-
// Add a new build
|
|
174
|
-
const addBuild = reactExports.useCallback((build) => {
|
|
175
|
-
setBuilds(prev => {
|
|
176
|
-
// Check if build already exists
|
|
177
|
-
const exists = prev.some(b => b.id === build.id);
|
|
178
|
-
if (exists) {
|
|
179
|
-
// Update existing build
|
|
180
|
-
return prev.map(b => b.id === build.id ? { ...b, ...build } : b);
|
|
181
|
-
}
|
|
182
|
-
// Mark this as a new build to auto-select
|
|
183
|
-
setPendingNewBuildId(build.id);
|
|
184
|
-
// Add new build
|
|
185
|
-
return [...prev, build];
|
|
186
|
-
});
|
|
187
|
-
}, []);
|
|
188
|
-
// Auto-select newly added builds
|
|
189
|
-
reactExports.useEffect(() => {
|
|
190
|
-
if (pendingNewBuildId) {
|
|
191
|
-
const index = builds.findIndex(b => b.id === pendingNewBuildId);
|
|
192
|
-
if (index !== -1) {
|
|
193
|
-
setCurrentBuildIndex(index);
|
|
194
|
-
}
|
|
195
|
-
setPendingNewBuildId(null);
|
|
196
|
-
}
|
|
197
|
-
}, [builds, pendingNewBuildId]);
|
|
198
|
-
// Update an existing build
|
|
199
|
-
const updateBuild = reactExports.useCallback((buildId, updates) => {
|
|
200
|
-
setBuilds(prev => prev.map(build => build.id === buildId ? { ...build, ...updates } : build));
|
|
201
|
-
}, []);
|
|
202
|
-
// Update todos for a build
|
|
203
|
-
const updateTodos = reactExports.useCallback((buildId, todos) => {
|
|
204
|
-
setBuilds(prev => prev.map(build => build.id === buildId ? { ...build, todos } : build));
|
|
205
|
-
}, []);
|
|
206
|
-
// Connection status
|
|
207
|
-
const setConnected = reactExports.useCallback((connected) => {
|
|
208
|
-
setIsConnected(connected);
|
|
209
|
-
}, []);
|
|
210
|
-
// Use refs to store the latest callbacks so event handlers always call current versions
|
|
211
|
-
// This prevents race conditions where events could be missed during re-subscriptions
|
|
212
|
-
const addBuildRef = reactExports.useRef(addBuild);
|
|
213
|
-
const updateBuildRef = reactExports.useRef(updateBuild);
|
|
214
|
-
const updateTodosRef = reactExports.useRef(updateTodos);
|
|
215
|
-
// Keep refs up to date
|
|
216
|
-
reactExports.useEffect(() => {
|
|
217
|
-
addBuildRef.current = addBuild;
|
|
218
|
-
}, [addBuild]);
|
|
219
|
-
reactExports.useEffect(() => {
|
|
220
|
-
updateBuildRef.current = updateBuild;
|
|
221
|
-
}, [updateBuild]);
|
|
222
|
-
reactExports.useEffect(() => {
|
|
223
|
-
updateTodosRef.current = updateTodos;
|
|
224
|
-
}, [updateTodos]);
|
|
225
|
-
// Subscribe to RunnerLogger events - only runs ONCE on mount
|
|
226
|
-
// Uses refs for callbacks to avoid re-subscription race conditions
|
|
227
|
-
reactExports.useEffect(() => {
|
|
228
|
-
const logger = getLogger();
|
|
229
|
-
// Sync initial state from logger (in case events already fired)
|
|
230
|
-
setIsConnected(logger.isConnected());
|
|
231
|
-
setIsVerbose(logger.isVerbose());
|
|
232
|
-
// Load any existing builds
|
|
233
|
-
const existingBuilds = logger.getAllBuilds();
|
|
234
|
-
if (existingBuilds.length > 0) {
|
|
235
|
-
for (const build of existingBuilds) {
|
|
236
|
-
addBuildRef.current(build);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
// Handle build start events - use ref to get latest callback
|
|
240
|
-
const handleBuildStart = (build) => {
|
|
241
|
-
addBuildRef.current(build);
|
|
242
|
-
};
|
|
243
|
-
// Handle build update events
|
|
244
|
-
const handleBuildUpdate = (build) => {
|
|
245
|
-
updateBuildRef.current(build.id, build);
|
|
246
|
-
};
|
|
247
|
-
// Handle build complete events
|
|
248
|
-
const handleBuildComplete = (build) => {
|
|
249
|
-
updateBuildRef.current(build.id, { ...build, status: build.status });
|
|
250
|
-
};
|
|
251
|
-
// Handle todo updates
|
|
252
|
-
const handleTodoUpdate = (buildId, todos) => {
|
|
253
|
-
updateTodosRef.current(buildId, todos);
|
|
254
|
-
};
|
|
255
|
-
// Handle connection events
|
|
256
|
-
const handleConnected = () => {
|
|
257
|
-
setIsConnected(true);
|
|
258
|
-
};
|
|
259
|
-
const handleDisconnected = () => {
|
|
260
|
-
setIsConnected(false);
|
|
261
|
-
};
|
|
262
|
-
// Handle verbose change
|
|
263
|
-
const handleVerboseChange = (verbose) => {
|
|
264
|
-
setIsVerbose(verbose);
|
|
265
|
-
};
|
|
266
|
-
// Subscribe to events
|
|
267
|
-
logger.on('buildStart', handleBuildStart);
|
|
268
|
-
logger.on('buildUpdate', handleBuildUpdate);
|
|
269
|
-
logger.on('buildComplete', handleBuildComplete);
|
|
270
|
-
logger.on('todoUpdate', handleTodoUpdate);
|
|
271
|
-
logger.on('connected', handleConnected);
|
|
272
|
-
logger.on('disconnected', handleDisconnected);
|
|
273
|
-
logger.on('verboseChange', handleVerboseChange);
|
|
274
|
-
// Cleanup - only runs on unmount
|
|
275
|
-
return () => {
|
|
276
|
-
logger.off('buildStart', handleBuildStart);
|
|
277
|
-
logger.off('buildUpdate', handleBuildUpdate);
|
|
278
|
-
logger.off('buildComplete', handleBuildComplete);
|
|
279
|
-
logger.off('todoUpdate', handleTodoUpdate);
|
|
280
|
-
logger.off('connected', handleConnected);
|
|
281
|
-
logger.off('disconnected', handleDisconnected);
|
|
282
|
-
logger.off('verboseChange', handleVerboseChange);
|
|
283
|
-
};
|
|
284
|
-
}, []); // Empty deps - only subscribe once on mount
|
|
285
|
-
const state = {
|
|
286
|
-
builds,
|
|
287
|
-
currentBuildIndex,
|
|
288
|
-
currentBuild,
|
|
289
|
-
isConnected,
|
|
290
|
-
isVerbose,
|
|
291
|
-
};
|
|
292
|
-
const actions = {
|
|
293
|
-
nextBuild,
|
|
294
|
-
prevBuild,
|
|
295
|
-
setVerbose: setIsVerbose,
|
|
296
|
-
toggleVerbose,
|
|
297
|
-
addBuild,
|
|
298
|
-
updateBuild,
|
|
299
|
-
updateTodos,
|
|
300
|
-
setConnected,
|
|
301
|
-
};
|
|
302
|
-
return [state, actions];
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Hook to subscribe to log entries from the buffer
|
|
306
|
-
*/
|
|
307
|
-
function useLogEntries(maxEntries = 100) {
|
|
308
|
-
const [entries, setEntries] = reactExports.useState([]);
|
|
309
|
-
reactExports.useEffect(() => {
|
|
310
|
-
const buffer = getLogBuffer();
|
|
311
|
-
// Initialize with current entries
|
|
312
|
-
setEntries(buffer.getRecent(maxEntries));
|
|
313
|
-
// Subscribe to new entries
|
|
314
|
-
const unsubscribe = buffer.onLog((entry) => {
|
|
315
|
-
setEntries(prev => {
|
|
316
|
-
const newEntries = [...prev, entry];
|
|
317
|
-
// Keep only the most recent entries
|
|
318
|
-
if (newEntries.length > maxEntries) {
|
|
319
|
-
return newEntries.slice(-maxEntries);
|
|
320
|
-
}
|
|
321
|
-
return newEntries;
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
return unsubscribe;
|
|
325
|
-
}, [maxEntries]);
|
|
326
|
-
return entries;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export { BuildPanel as B, useLogEntries as a, useBuildState as u };
|
|
330
|
-
//# sourceMappingURL=useBuildState-Dy7pRR8Z.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBuildState-Dy7pRR8Z.js","sources":["../../src/cli/tui/components/BuildPanel.tsx","../../src/cli/tui/hooks/useBuildState.ts"],"sourcesContent":["/**\n * BuildPanel - Left panel showing current build info and todo list\n * Takes up 20% of width, shows:\n * - Project name\n * - Template name\n * - Agent/model\n * - Elapsed time\n * - Todo list with status indicators\n */\n\nimport React, { useState, useEffect } from 'react';\nimport { Box, Text } from 'ink';\nimport { colors, symbols } from '../theme.js';\nimport type { BuildInfo, TodoItem } from '../../../lib/logging/types.js';\n\ninterface BuildPanelProps {\n build: BuildInfo | null;\n width: number;\n height?: number;\n}\n\nexport function BuildPanel({ build, width, height }: BuildPanelProps) {\n const [elapsedTime, setElapsedTime] = useState(0);\n\n // Update elapsed time every second\n useEffect(() => {\n if (!build || build.status !== 'running') {\n setElapsedTime(0);\n return;\n }\n\n const startTime = build.startTime;\n const updateElapsed = () => {\n const now = Date.now();\n setElapsedTime(Math.floor((now - startTime) / 1000));\n };\n\n updateElapsed();\n const interval = setInterval(updateElapsed, 1000);\n return () => clearInterval(interval);\n }, [build?.id, build?.status, build?.startTime]);\n\n // Don't render if no build\n if (!build) {\n return null;\n }\n\n const truncate = (str: string, maxLen: number) => {\n if (str.length <= maxLen) return str;\n return str.substring(0, maxLen - 3) + '...';\n };\n\n const formatDuration = (seconds: number): string => {\n if (seconds < 60) return `${seconds}s`;\n const mins = Math.floor(seconds / 60);\n const secs = seconds % 60;\n return `${mins}m ${secs}s`;\n };\n\n // Determine elapsed time to show\n const displayElapsed = build.status === 'running' \n ? elapsedTime \n : build.endTime \n ? Math.floor((build.endTime - build.startTime) / 1000)\n : 0;\n\n return (\n <Box\n flexDirection=\"column\"\n width={width}\n height={height}\n borderStyle=\"single\"\n borderColor={colors.darkGray}\n paddingX={1}\n >\n {/* Header */}\n <Box marginBottom={1}>\n <Text color={colors.cyan} bold>BUILD</Text>\n </Box>\n\n {/* Project name */}\n <Box>\n <Text color={colors.white}>{truncate(build.projectSlug, width - 4)}</Text>\n </Box>\n\n {/* Template */}\n {build.template && (\n <Box>\n <Text color={colors.gray}>{truncate(build.template, width - 4)}</Text>\n </Box>\n )}\n\n {/* Agent/model */}\n <Box>\n <Text color={colors.gray}>\n {build.agent === 'claude-code' ? build.model : build.agent}\n </Text>\n </Box>\n\n {/* Elapsed time with status */}\n <Box marginTop={1}>\n {build.status === 'running' && (\n <Text color={colors.cyan}>\n {symbols.spinnerFrames[Math.floor(Date.now() / 120) % symbols.spinnerFrames.length]} {formatDuration(displayElapsed)}\n </Text>\n )}\n {build.status === 'completed' && (\n <Text color={colors.success}>\n {symbols.check} {formatDuration(displayElapsed)}\n </Text>\n )}\n {build.status === 'failed' && (\n <Text color={colors.error}>\n {symbols.cross} {formatDuration(displayElapsed)}\n </Text>\n )}\n {build.status === 'pending' && (\n <Text color={colors.gray}>Pending...</Text>\n )}\n </Box>\n\n {/* Todo list */}\n {build.todos.length > 0 && (\n <Box flexDirection=\"column\" marginTop={1}>\n <Text color={colors.dimGray} bold>TASKS</Text>\n <TodoList todos={build.todos} maxWidth={width - 6} maxVisible={10} />\n </Box>\n )}\n\n {/* Error message if failed */}\n {build.status === 'failed' && build.error && (\n <Box marginTop={1}>\n <Text color={colors.error} wrap=\"truncate\">\n {truncate(build.error, width - 4)}\n </Text>\n </Box>\n )}\n </Box>\n );\n}\n\n/**\n * TodoList - Smart display of todo items\n * - Shows up to maxVisible items (default 10)\n * - Prioritizes in_progress and pending tasks\n * - Hides completed tasks when space is needed\n * - Shows count of hidden completed tasks\n */\nfunction TodoList({ todos, maxWidth, maxVisible = 10 }: { \n todos: TodoItem[]; \n maxWidth: number;\n maxVisible?: number;\n}) {\n // Separate todos by status\n const inProgress = todos.filter(t => t.status === 'in_progress');\n const pending = todos.filter(t => t.status === 'pending');\n const completed = todos.filter(t => t.status === 'completed');\n const cancelled = todos.filter(t => t.status === 'cancelled');\n \n // Calculate how many slots we have for each category\n // Priority: in_progress > pending > completed > cancelled\n const activeCount = inProgress.length + pending.length;\n \n let visibleTodos: TodoItem[] = [];\n let hiddenCompletedCount = 0;\n \n if (todos.length <= maxVisible) {\n // All todos fit - show them in order\n visibleTodos = todos;\n } else {\n // Need to prioritize - always show in_progress and pending first\n visibleTodos = [...inProgress, ...pending];\n \n // Calculate remaining slots for completed tasks\n const remainingSlots = maxVisible - visibleTodos.length;\n \n if (remainingSlots > 0) {\n // Show as many completed as we can fit\n visibleTodos = [...visibleTodos, ...completed.slice(0, remainingSlots)];\n hiddenCompletedCount = Math.max(0, completed.length - remainingSlots);\n } else {\n hiddenCompletedCount = completed.length;\n }\n \n // Add cancelled if there's still room\n const slotsAfterCompleted = maxVisible - visibleTodos.length;\n if (slotsAfterCompleted > 0) {\n visibleTodos = [...visibleTodos, ...cancelled.slice(0, slotsAfterCompleted)];\n }\n }\n \n // Sort visible todos to maintain logical order (by original index)\n visibleTodos.sort((a, b) => {\n const aIndex = todos.findIndex(t => t.id === a.id);\n const bIndex = todos.findIndex(t => t.id === b.id);\n return aIndex - bIndex;\n });\n \n return (\n <>\n {visibleTodos.map((todo) => (\n <TodoRow key={todo.id} todo={todo} maxWidth={maxWidth} />\n ))}\n {hiddenCompletedCount > 0 && (\n <Text color={colors.dimGray}>✓ {hiddenCompletedCount} completed</Text>\n )}\n </>\n );\n}\n\n// Todo row component\nfunction TodoRow({ todo, maxWidth }: { todo: TodoItem; maxWidth: number }) {\n const statusIcon = {\n pending: <Text color={colors.dimGray}>{symbols.hollowDot}</Text>,\n in_progress: <Text color={colors.cyan}>{symbols.spinnerFrames[Math.floor(Date.now() / 120) % symbols.spinnerFrames.length]}</Text>,\n completed: <Text color={colors.success}>{symbols.check}</Text>,\n cancelled: <Text color={colors.dimGray}>⊘</Text>,\n }[todo.status];\n\n const textColor = {\n pending: colors.dimGray,\n in_progress: colors.white,\n completed: colors.gray,\n cancelled: colors.dimGray,\n }[todo.status];\n\n const truncatedContent = todo.content.length > maxWidth - 3\n ? todo.content.substring(0, maxWidth - 6) + '...'\n : todo.content;\n\n return (\n <Box>\n {statusIcon}\n <Text color={textColor}> {truncatedContent}</Text>\n </Box>\n );\n}\n","/**\n * useBuildState - Hook to track build state and todos\n * \n * Manages:\n * - Active builds list\n * - Current build selection (for multi-build navigation)\n * - Todo list updates\n * - Build lifecycle events\n * \n * Subscribes to RunnerLogger events to automatically update state.\n * \n * IMPORTANT: Uses refs for event handlers to prevent race conditions\n * where events could be missed during re-subscriptions caused by\n * callback dependency changes.\n */\n\nimport { useState, useEffect, useCallback, useRef } from 'react';\nimport type { BuildInfo, TodoItem, LogEntry } from '../../../lib/logging/types.js';\nimport { getLogBuffer } from '../../../lib/logging/log-buffer.js';\nimport { getLogger } from '../../../lib/logging/index.js';\n\nexport interface BuildState {\n builds: BuildInfo[];\n currentBuildIndex: number;\n currentBuild: BuildInfo | null;\n isConnected: boolean;\n isVerbose: boolean;\n}\n\nexport interface BuildStateActions {\n nextBuild: () => void;\n prevBuild: () => void;\n setVerbose: (verbose: boolean) => void;\n toggleVerbose: () => void;\n addBuild: (build: BuildInfo) => void;\n updateBuild: (buildId: string, updates: Partial<BuildInfo>) => void;\n updateTodos: (buildId: string, todos: TodoItem[]) => void;\n setConnected: (connected: boolean) => void;\n}\n\nexport function useBuildState(): [BuildState, BuildStateActions] {\n const [builds, setBuilds] = useState<BuildInfo[]>([]);\n const [currentBuildIndex, setCurrentBuildIndex] = useState(0);\n const [isConnected, setIsConnected] = useState(false);\n const [isVerbose, setIsVerbose] = useState(false);\n\n // Derive current build from index\n const currentBuild = builds.length > 0 ? builds[currentBuildIndex] ?? null : null;\n\n // Navigation between builds\n const nextBuild = useCallback(() => {\n setCurrentBuildIndex(prev => {\n if (builds.length === 0) return 0;\n return (prev + 1) % builds.length;\n });\n }, [builds.length]);\n\n const prevBuild = useCallback(() => {\n setCurrentBuildIndex(prev => {\n if (builds.length === 0) return 0;\n return prev === 0 ? builds.length - 1 : prev - 1;\n });\n }, [builds.length]);\n\n // Verbose toggle - updates both UI state and logger\n const toggleVerbose = useCallback(() => {\n setIsVerbose(prev => {\n const newValue = !prev;\n // Also update the logger's verbose flag\n try {\n const logger = getLogger();\n logger.setVerbose(newValue);\n } catch {\n // Logger not initialized yet\n }\n return newValue;\n });\n }, []);\n\n // Track when a new build is added to auto-select it\n const [pendingNewBuildId, setPendingNewBuildId] = useState<string | null>(null);\n\n // Add a new build\n const addBuild = useCallback((build: BuildInfo) => {\n setBuilds(prev => {\n // Check if build already exists\n const exists = prev.some(b => b.id === build.id);\n if (exists) {\n // Update existing build\n return prev.map(b => b.id === build.id ? { ...b, ...build } : b);\n }\n // Mark this as a new build to auto-select\n setPendingNewBuildId(build.id);\n // Add new build\n return [...prev, build];\n });\n }, []);\n\n // Auto-select newly added builds\n useEffect(() => {\n if (pendingNewBuildId) {\n const index = builds.findIndex(b => b.id === pendingNewBuildId);\n if (index !== -1) {\n setCurrentBuildIndex(index);\n }\n setPendingNewBuildId(null);\n }\n }, [builds, pendingNewBuildId]);\n\n // Update an existing build\n const updateBuild = useCallback((buildId: string, updates: Partial<BuildInfo>) => {\n setBuilds(prev => prev.map(build => \n build.id === buildId ? { ...build, ...updates } : build\n ));\n }, []);\n\n // Update todos for a build\n const updateTodos = useCallback((buildId: string, todos: TodoItem[]) => {\n setBuilds(prev => prev.map(build =>\n build.id === buildId ? { ...build, todos } : build\n ));\n }, []);\n\n // Connection status\n const setConnected = useCallback((connected: boolean) => {\n setIsConnected(connected);\n }, []);\n\n // Use refs to store the latest callbacks so event handlers always call current versions\n // This prevents race conditions where events could be missed during re-subscriptions\n const addBuildRef = useRef(addBuild);\n const updateBuildRef = useRef(updateBuild);\n const updateTodosRef = useRef(updateTodos);\n \n // Keep refs up to date\n useEffect(() => {\n addBuildRef.current = addBuild;\n }, [addBuild]);\n \n useEffect(() => {\n updateBuildRef.current = updateBuild;\n }, [updateBuild]);\n \n useEffect(() => {\n updateTodosRef.current = updateTodos;\n }, [updateTodos]);\n\n // Subscribe to RunnerLogger events - only runs ONCE on mount\n // Uses refs for callbacks to avoid re-subscription race conditions\n useEffect(() => {\n const logger = getLogger();\n \n // Sync initial state from logger (in case events already fired)\n setIsConnected(logger.isConnected());\n setIsVerbose(logger.isVerbose());\n \n // Load any existing builds\n const existingBuilds = logger.getAllBuilds();\n if (existingBuilds.length > 0) {\n for (const build of existingBuilds) {\n addBuildRef.current(build);\n }\n }\n \n // Handle build start events - use ref to get latest callback\n const handleBuildStart = (build: BuildInfo) => {\n addBuildRef.current(build);\n };\n \n // Handle build update events\n const handleBuildUpdate = (build: BuildInfo) => {\n updateBuildRef.current(build.id, build);\n };\n \n // Handle build complete events\n const handleBuildComplete = (build: BuildInfo) => {\n updateBuildRef.current(build.id, { ...build, status: build.status });\n };\n \n // Handle todo updates\n const handleTodoUpdate = (buildId: string, todos: TodoItem[]) => {\n updateTodosRef.current(buildId, todos);\n };\n \n // Handle connection events\n const handleConnected = () => {\n setIsConnected(true);\n };\n \n const handleDisconnected = () => {\n setIsConnected(false);\n };\n \n // Handle verbose change\n const handleVerboseChange = (verbose: boolean) => {\n setIsVerbose(verbose);\n };\n \n // Subscribe to events\n logger.on('buildStart', handleBuildStart);\n logger.on('buildUpdate', handleBuildUpdate);\n logger.on('buildComplete', handleBuildComplete);\n logger.on('todoUpdate', handleTodoUpdate);\n logger.on('connected', handleConnected);\n logger.on('disconnected', handleDisconnected);\n logger.on('verboseChange', handleVerboseChange);\n \n // Cleanup - only runs on unmount\n return () => {\n logger.off('buildStart', handleBuildStart);\n logger.off('buildUpdate', handleBuildUpdate);\n logger.off('buildComplete', handleBuildComplete);\n logger.off('todoUpdate', handleTodoUpdate);\n logger.off('connected', handleConnected);\n logger.off('disconnected', handleDisconnected);\n logger.off('verboseChange', handleVerboseChange);\n };\n }, []); // Empty deps - only subscribe once on mount\n\n const state: BuildState = {\n builds,\n currentBuildIndex,\n currentBuild,\n isConnected,\n isVerbose,\n };\n\n const actions: BuildStateActions = {\n nextBuild,\n prevBuild,\n setVerbose: setIsVerbose,\n toggleVerbose,\n addBuild,\n updateBuild,\n updateTodos,\n setConnected,\n };\n\n return [state, actions];\n}\n\n/**\n * Hook to subscribe to log entries from the buffer\n */\nexport function useLogEntries(maxEntries: number = 100): LogEntry[] {\n const [entries, setEntries] = useState<LogEntry[]>([]);\n\n useEffect(() => {\n const buffer = getLogBuffer();\n \n // Initialize with current entries\n setEntries(buffer.getRecent(maxEntries));\n\n // Subscribe to new entries\n const unsubscribe = buffer.onLog((entry) => {\n setEntries(prev => {\n const newEntries = [...prev, entry];\n // Keep only the most recent entries\n if (newEntries.length > maxEntries) {\n return newEntries.slice(-maxEntries);\n }\n return newEntries;\n });\n });\n\n return unsubscribe;\n }, [maxEntries]);\n\n return entries;\n}\n"],"names":["useState","useEffect","_jsxs","_jsx","useCallback","useRef"],"mappings":";;;;;;;;AAqBM,SAAU,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAmB,EAAA;IAClE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGA,qBAAQ,CAAC,CAAC,CAAC;;IAGjDC,sBAAS,CAAC,MAAK;QACb,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;YACxC,cAAc,CAAC,CAAC,CAAC;YACjB;QACF;AAEA,QAAA,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS;QACjC,M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b,QAAQ;QACR,WAAW;QACX,WAAW;QACX,YAAY;KACb;AAED,IAAA,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AACzB;AAEA;;AAEG;AACG,SAAU,aAAa,CAAC,UAAA,GAAqB,GAAG,EAAA;IACpD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGD,qBAAQ,CAAa,EAAE,CAAC;IAEtDC,sBAAS,CAAC,MAAK;AACb,QAAA,MAAM,MAAM,GAAG,YAAY,EAAE;;QAG7B,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;;QAGxC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;YACzC,UAAU,CAAC,IAAI,IAAG;gBAChB,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC;;AAEnC,gBAAA,IAAI,UAAU,CAAC,MAAM,GAAG,UAAU,EAAE;AAClC,oBAAA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;gBACtC;AACA,gBAAA,OAAO,UAAU;AACnB,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,WAAW;AACpB,IAAA,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AAEhB,IAAA,OAAO,OAAO;AAChB;;;;"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// Hatchway CLI - Built with Rollup
|
|
2
|
-
import { execSync } from 'node:child_process';
|
|
3
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
-
import { dirname, join } from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Version and git commit info utilities
|
|
9
|
-
*/
|
|
10
|
-
const __filename$1 = fileURLToPath(import.meta.url);
|
|
11
|
-
const __dirname$1 = dirname(__filename$1);
|
|
12
|
-
/**
|
|
13
|
-
* Find the package root directory (apps/runner).
|
|
14
|
-
* Works in both development (src/cli/utils/) and production (dist/cli/utils/) modes.
|
|
15
|
-
*/
|
|
16
|
-
function findPackageRoot() {
|
|
17
|
-
// Try multiple possible locations
|
|
18
|
-
const possiblePaths = [
|
|
19
|
-
// Development: src/cli/utils/ -> apps/runner (3 levels up)
|
|
20
|
-
join(__dirname$1, '..', '..', '..'),
|
|
21
|
-
// Production from dist/cli/utils/: -> apps/runner (3 levels up, same structure)
|
|
22
|
-
join(__dirname$1, '..', '..', '..'),
|
|
23
|
-
];
|
|
24
|
-
for (const path of possiblePaths) {
|
|
25
|
-
const packageJsonPath = join(path, 'package.json');
|
|
26
|
-
if (existsSync(packageJsonPath)) {
|
|
27
|
-
try {
|
|
28
|
-
const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
29
|
-
// Verify this is the runner package
|
|
30
|
-
if (pkg.name === '@hatchway/cli') {
|
|
31
|
-
return path;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
// Continue to next path
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// Fallback to the standard path
|
|
40
|
-
return join(__dirname$1, '..', '..', '..');
|
|
41
|
-
}
|
|
42
|
-
// Cache the package root
|
|
43
|
-
const packageRoot = findPackageRoot();
|
|
44
|
-
/**
|
|
45
|
-
* Get the package version from package.json
|
|
46
|
-
*/
|
|
47
|
-
function getPackageVersion() {
|
|
48
|
-
try {
|
|
49
|
-
const packageJsonPath = join(packageRoot, 'package.json');
|
|
50
|
-
if (existsSync(packageJsonPath)) {
|
|
51
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
52
|
-
return packageJson.version || '0.0.0';
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
// Ignore errors
|
|
57
|
-
}
|
|
58
|
-
return '0.0.0';
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Get the short git commit hash
|
|
62
|
-
*/
|
|
63
|
-
function getGitCommit() {
|
|
64
|
-
try {
|
|
65
|
-
// Try to get commit from git command
|
|
66
|
-
const commit = execSync('git rev-parse --short HEAD', {
|
|
67
|
-
cwd: packageRoot,
|
|
68
|
-
encoding: 'utf-8',
|
|
69
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
70
|
-
}).trim();
|
|
71
|
-
return commit || null;
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// Git not available or not a git repo
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get all version info
|
|
80
|
-
*/
|
|
81
|
-
function getVersionInfo() {
|
|
82
|
-
const version = getPackageVersion();
|
|
83
|
-
const commit = getGitCommit();
|
|
84
|
-
return {
|
|
85
|
-
version,
|
|
86
|
-
commit,
|
|
87
|
-
display: commit ? `v${version} (${commit})` : `v${version}`,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export { getPackageVersion as a, getVersionInfo as g };
|
|
92
|
-
//# sourceMappingURL=version-info-CDtU8Ta2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version-info-CDtU8Ta2.js","sources":["../../src/cli/utils/version-info.ts"],"sourcesContent":["/**\n * Version and git commit info utilities\n */\n\nimport { execSync } from 'node:child_process';\nimport { readFileSync, existsSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Find the package root directory (apps/runner).\n * Works in both development (src/cli/utils/) and production (dist/cli/utils/) modes.\n */\nfunction findPackageRoot(): string {\n // Try multiple possible locations\n const possiblePaths = [\n // Development: src/cli/utils/ -> apps/runner (3 levels up)\n join(__dirname, '..', '..', '..'),\n // Production from dist/cli/utils/: -> apps/runner (3 levels up, same structure)\n join(__dirname, '..', '..', '..'),\n ];\n \n for (const path of possiblePaths) {\n const packageJsonPath = join(path, 'package.json');\n if (existsSync(packageJsonPath)) {\n try {\n const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n // Verify this is the runner package\n if (pkg.name === '@hatchway/cli') {\n return path;\n }\n } catch {\n // Continue to next path\n }\n }\n }\n \n // Fallback to the standard path\n return join(__dirname, '..', '..', '..');\n}\n\n// Cache the package root\nconst packageRoot = findPackageRoot();\n\n/**\n * Get the package version from package.json\n */\nexport function getPackageVersion(): string {\n try {\n const packageJsonPath = join(packageRoot, 'package.json');\n if (existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n return packageJson.version || '0.0.0';\n }\n } catch {\n // Ignore errors\n }\n return '0.0.0';\n}\n\n/**\n * Get the short git commit hash\n */\nexport function getGitCommit(): string | null {\n try {\n // Try to get commit from git command\n const commit = execSync('git rev-parse --short HEAD', {\n cwd: packageRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n return commit || null;\n } catch {\n // Git not available or not a git repo\n return null;\n }\n}\n\n/**\n * Get combined version string with commit\n * Returns \"v0.19.1 (abc1234)\" or just \"v0.19.1\" if no commit\n */\nexport function getVersionString(): string {\n const version = getPackageVersion();\n const commit = getGitCommit();\n \n if (commit) {\n return `v${version} (${commit})`;\n }\n return `v${version}`;\n}\n\n/**\n * Version info object\n */\nexport interface VersionInfo {\n version: string;\n commit: string | null;\n display: string;\n}\n\n/**\n * Get all version info\n */\nexport function getVersionInfo(): VersionInfo {\n const version = getPackageVersion();\n const commit = getGitCommit();\n \n return {\n version,\n commit,\n display: commit ? `v${version} (${commit})` : `v${version}`,\n };\n}\n"],"names":["__filename","__dirname"],"mappings":";;;;;;AAAA;;AAEG;AAOH,MAAMA,YAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AACjD,MAAMC,WAAS,GAAG,OAAO,CAACD,YAAU,CAAC;AAErC;;;AAGG;AAC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A,QAAQ,EAAE,OAAO;AACjB,YAAA,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE;QACT,OAAO,MAAM,IAAI,IAAI;IACvB;AAAE,IAAA,MAAM;;AAEN,QAAA,OAAO,IAAI;IACb;AACF;AAyBA;;AAEG;SACa,cAAc,GAAA;AAC5B,IAAA,MAAM,OAAO,GAAG,iBAAiB,EAAE;AACnC,IAAA,MAAM,MAAM,GAAG,YAAY,EAAE;IAE7B,OAAO;QACL,OAAO;QACP,MAAM;AACN,QAAA,OAAO,EAAE,MAAM,GAAG,CAAA,CAAA,EAAI,OAAO,CAAA,EAAA,EAAK,MAAM,GAAG,GAAG,CAAA,CAAA,EAAI,OAAO,CAAA,CAAE;KAC5D;AACH;;;;"}
|
package/dist/instrument.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Hatchway CLI - Built with Rollup
|
|
2
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
|
|
5
|
-
import * as Sentry from '@sentry/node';
|
|
6
|
-
|
|
7
|
-
// Debug logging for instrumentation (enabled via DEBUG_SENTRY=1)
|
|
8
|
-
const debugSentry = process.env.DEBUG_SENTRY === '1';
|
|
9
|
-
const log = (msg) => debugSentry && console.log(`[sentry-instrument] ${msg}`);
|
|
10
|
-
// Build integrations array
|
|
11
|
-
const integrations = [];
|
|
12
|
-
// Add http integration for request tracing
|
|
13
|
-
if (typeof Sentry.httpIntegration === "function") {
|
|
14
|
-
integrations.push(Sentry.httpIntegration());
|
|
15
|
-
log('Added httpIntegration');
|
|
16
|
-
}
|
|
17
|
-
log(`Total integrations configured: ${integrations.length}`);
|
|
18
|
-
// Default DSN for Hatchway error tracking — users can override via SENTRY_DSN env var
|
|
19
|
-
const DEFAULT_SENTRY_DSN = "https://94f02492541e36eaa9ebfa56c4c042d2@o4508130833793024.ingest.us.sentry.io/4510156711919616";
|
|
20
|
-
Sentry.init({
|
|
21
|
-
dsn: process.env.SENTRY_DSN || DEFAULT_SENTRY_DSN,
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
integrations: integrations,
|
|
24
|
-
tracesSampleRate: 1.0,
|
|
25
|
-
enableLogs: true,
|
|
26
|
-
debug: false,
|
|
27
|
-
sendDefaultPii: false,
|
|
28
|
-
// Configure trace propagation (Runner → Broker communication)
|
|
29
|
-
tracePropagationTargets: [
|
|
30
|
-
// Local development
|
|
31
|
-
"localhost",
|
|
32
|
-
"localhost:3000",
|
|
33
|
-
"localhost:4000",
|
|
34
|
-
/^https?:\/\/localhost:\d+$/,
|
|
35
|
-
// Production domains
|
|
36
|
-
"hatchway.sh",
|
|
37
|
-
"hatchway.app",
|
|
38
|
-
"hatchway.up.railway.app",
|
|
39
|
-
"broker.hatchway.sh",
|
|
40
|
-
"broker.hatchway.app",
|
|
41
|
-
"broker.up.railway.app",
|
|
42
|
-
// Wildcard patterns for Railway
|
|
43
|
-
/^https?:\/\/.*\.railway\.app/, // Railway deployments
|
|
44
|
-
/^https?:\/\/.*\.up\.railway\.app/, // Railway preview deployments
|
|
45
|
-
/^https?:\/\/.*\.hatchway\.app/, // Custom domain subdomains
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=instrument.js.map
|
package/dist/instrument.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sources":["../src/instrument.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\n\n// Debug logging for instrumentation (enabled via DEBUG_SENTRY=1)\nconst debugSentry = process.env.DEBUG_SENTRY === '1';\nconst log = (msg: string) => debugSentry && console.log(`[sentry-instrument] ${msg}`);\n\n// Build integrations array\nconst integrations: unknown[] = [];\n\n// Add http integration for request tracing\nif (typeof Sentry.httpIntegration === \"function\") {\n integrations.push(Sentry.httpIntegration());\n log('Added httpIntegration');\n}\n\nlog(`Total integrations configured: ${integrations.length}`);\n\n// Default DSN for Hatchway error tracking — users can override via SENTRY_DSN env var\nconst DEFAULT_SENTRY_DSN = \"https://94f02492541e36eaa9ebfa56c4c042d2@o4508130833793024.ingest.us.sentry.io/4510156711919616\";\n\nSentry.init({\n dsn: process.env.SENTRY_DSN || DEFAULT_SENTRY_DSN,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n integrations: integrations as any[],\n tracesSampleRate: 1.0,\n enableLogs: true,\n debug: false,\n sendDefaultPii: false,\n // Configure trace propagation (Runner → Broker communication)\n tracePropagationTargets: [\n // Local development\n \"localhost\",\n \"localhost:3000\",\n \"localhost:4000\",\n /^https?:\\/\\/localhost:\\d+$/,\n\n // Production domains\n \"hatchway.sh\",\n \"hatchway.app\",\n \"hatchway.up.railway.app\",\n \"broker.hatchway.sh\",\n \"broker.hatchway.app\",\n \"broker.up.railway.app\",\n\n // Wildcard patterns for Railway\n /^https?:\\/\\/.*\\.railway\\.app/, // Railway deployments\n /^https?:\\/\\/.*\\.up\\.railway\\.app/, // Railway preview deployments\n /^https?:\\/\\/.*\\.hatchway\\.app/, // Custom domain subdomains\n ],\n});\n"],"names":[],"mappings":";;;;;;AAEA;AACA,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,GAAG;AACpD,MAAM,GAAG,GAAG,CAAC,GAAW,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,CAAA,CAAE,CAAC;AAErF;AACA,MAAM,YAAY,GAAc,EAAE;AAElC;AACA,IAAI,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU,EAAE;IAChD,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;IAC3C,GAAG,CAAC,uBAAuB,CAAC;AAC9B;AAEA,GAAG,CAAC,CAAA,+BAAA,EAAkC,YAAY,CAAC,MAAM,CAAA,CAAE,CAAC;AAE5D;AACA,MAAM,kBAAkB,GAAG,iGAAiG;AAE5H,MAAM,CAAC,IAAI,CAAC;AACV,IAAA,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,kBAAkB;;AAEjD,IAAA,YAAY,EAAE,YAAqB;AACnC,IAAA,gBAAgB,EAAE,GAAG;AACrB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,cAAc,EAAE,KAAK;;AAErB,IAAA,uBAAuB,EAAE;;QAEvB,WAAW;QACX,gBAAgB;QAChB,gBAAgB;QAChB,4BAA4B;;QAG5B,aAAa;QACb,cAAc;QACd,yBAAyB;QACzB,oBAAoB;QACpB,qBAAqB;QACrB,uBAAuB;;AAGvB,QAAA,8BAA8B;AAC9B,QAAA,kCAAkC;AAClC,QAAA,+BAA+B;AAChC,KAAA;AACF,CAAA,CAAC"}
|