iterate-ui-daemon 0.1.0 → 0.1.2
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/dist/index.js +27 -14
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -601,7 +601,7 @@ var WebSocketHub = class {
|
|
|
601
601
|
};
|
|
602
602
|
|
|
603
603
|
// src/worktree/copy-files.ts
|
|
604
|
-
import { copyFileSync, mkdirSync, existsSync, unlinkSync, globSync, statSync } from "fs";
|
|
604
|
+
import { copyFileSync, cpSync, mkdirSync, existsSync, unlinkSync, globSync, statSync } from "fs";
|
|
605
605
|
import { join as join2, dirname } from "path";
|
|
606
606
|
import { execSync } from "child_process";
|
|
607
607
|
function copyFilesToWorktree(cwd, worktreePath, patterns) {
|
|
@@ -639,10 +639,14 @@ function copyUncommittedFiles(cwd, worktreePath) {
|
|
|
639
639
|
continue;
|
|
640
640
|
}
|
|
641
641
|
const src = join2(cwd, filePath);
|
|
642
|
-
if (!existsSync(src)
|
|
642
|
+
if (!existsSync(src)) continue;
|
|
643
643
|
const dest = join2(worktreePath, filePath);
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
if (statSync(src).isDirectory()) {
|
|
645
|
+
cpSync(src, dest, { recursive: true });
|
|
646
|
+
} else {
|
|
647
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
648
|
+
copyFileSync(src, dest);
|
|
649
|
+
}
|
|
646
650
|
}
|
|
647
651
|
}
|
|
648
652
|
|
|
@@ -805,7 +809,7 @@ async function startDaemon(opts = {}) {
|
|
|
805
809
|
const { worktreePath, branch } = await worktreeManager.create(name, baseBranch);
|
|
806
810
|
info.worktreePath = worktreePath;
|
|
807
811
|
info.branch = branch;
|
|
808
|
-
copyFilesToWorktree(cwd, worktreePath, config.copyFiles ?? [".env*"]);
|
|
812
|
+
copyFilesToWorktree(cwd, worktreePath, config.copyFiles ?? [".env*", ".npmrc"]);
|
|
809
813
|
copyUncommittedFiles(cwd, worktreePath);
|
|
810
814
|
info.status = "installing";
|
|
811
815
|
store.setIteration(name, info);
|
|
@@ -832,14 +836,16 @@ async function startDaemon(opts = {}) {
|
|
|
832
836
|
wsHub.broadcast({ type: "iteration:created", payload: info });
|
|
833
837
|
return info;
|
|
834
838
|
} catch (err) {
|
|
839
|
+
const errorMessage = err.message;
|
|
835
840
|
const info = store.getIteration(name);
|
|
836
841
|
if (info) {
|
|
837
842
|
info.status = "error";
|
|
843
|
+
info.error = errorMessage;
|
|
838
844
|
store.setIteration(name, info);
|
|
839
|
-
wsHub.broadcast({ type: "iteration:status", payload: { name, status: "error" } });
|
|
845
|
+
wsHub.broadcast({ type: "iteration:status", payload: { name, status: "error", error: errorMessage } });
|
|
840
846
|
}
|
|
841
847
|
return reply.status(500).send({
|
|
842
|
-
message: `Failed to create iteration: ${
|
|
848
|
+
message: `Failed to create iteration: ${errorMessage}`
|
|
843
849
|
});
|
|
844
850
|
}
|
|
845
851
|
});
|
|
@@ -996,7 +1002,7 @@ async function startDaemon(opts = {}) {
|
|
|
996
1002
|
const { worktreePath, branch } = await worktreeManager.create(name);
|
|
997
1003
|
info.worktreePath = worktreePath;
|
|
998
1004
|
info.branch = branch;
|
|
999
|
-
copyFilesToWorktree(cwd, worktreePath, config.copyFiles ?? [".env*"]);
|
|
1005
|
+
copyFilesToWorktree(cwd, worktreePath, config.copyFiles ?? [".env*", ".npmrc"]);
|
|
1000
1006
|
copyUncommittedFiles(cwd, worktreePath);
|
|
1001
1007
|
info.status = "installing";
|
|
1002
1008
|
store.setIteration(name, info);
|
|
@@ -1022,10 +1028,12 @@ async function startDaemon(opts = {}) {
|
|
|
1022
1028
|
store.setIteration(name, info);
|
|
1023
1029
|
wsHub.broadcast({ type: "iteration:created", payload: info });
|
|
1024
1030
|
} catch (err) {
|
|
1025
|
-
|
|
1031
|
+
const errorMessage = err.message;
|
|
1032
|
+
console.error(`[iterate] Failed to create iteration "${name}":`, errorMessage);
|
|
1026
1033
|
info.status = "error";
|
|
1034
|
+
info.error = errorMessage;
|
|
1027
1035
|
store.setIteration(name, info);
|
|
1028
|
-
wsHub.broadcast({ type: "iteration:status", payload: { name, status: "error" } });
|
|
1036
|
+
wsHub.broadcast({ type: "iteration:status", payload: { name, status: "error", error: errorMessage } });
|
|
1029
1037
|
}
|
|
1030
1038
|
})();
|
|
1031
1039
|
} catch (err) {
|
|
@@ -1177,10 +1185,12 @@ async function discoverAndRegisterWorktrees(worktreeManager, processManager, sto
|
|
|
1177
1185
|
store.setIteration(name, info);
|
|
1178
1186
|
wsHub.broadcast({ type: "iteration:created", payload: info });
|
|
1179
1187
|
} catch (err) {
|
|
1180
|
-
|
|
1188
|
+
const errorMessage = err.message;
|
|
1189
|
+
console.error(`[iterate] Failed to start external worktree "${name}":`, errorMessage);
|
|
1181
1190
|
info.status = "error";
|
|
1191
|
+
info.error = errorMessage;
|
|
1182
1192
|
store.setIteration(name, info);
|
|
1183
|
-
wsHub.broadcast({ type: "iteration:status", payload: { name, status: "error" } });
|
|
1193
|
+
wsHub.broadcast({ type: "iteration:status", payload: { name, status: "error", error: errorMessage } });
|
|
1184
1194
|
} finally {
|
|
1185
1195
|
pendingPaths.delete(wt.path);
|
|
1186
1196
|
}
|
|
@@ -1298,7 +1308,7 @@ function getShellHTML() {
|
|
|
1298
1308
|
switch (msg.type) {
|
|
1299
1309
|
case 'state:sync': state = msg.payload; render(); break;
|
|
1300
1310
|
case 'iteration:created': state.iterations[msg.payload.name] = msg.payload; render(); break;
|
|
1301
|
-
case 'iteration:status': if (state.iterations[msg.payload.name]) state.iterations[msg.payload.name].status = msg.payload.status; render(); break;
|
|
1311
|
+
case 'iteration:status': if (state.iterations[msg.payload.name]) { state.iterations[msg.payload.name].status = msg.payload.status; if (msg.payload.error) state.iterations[msg.payload.name].error = msg.payload.error; } render(); break;
|
|
1302
1312
|
case 'iteration:removed': delete state.iterations[msg.payload.name]; if (activeIteration === msg.payload.name) activeIteration = null; render(); break;
|
|
1303
1313
|
case 'change:created': state.changes.push(msg.payload); break;
|
|
1304
1314
|
case 'change:deleted': state.changes = state.changes.filter(a => a.id !== msg.payload.id); break;
|
|
@@ -1340,7 +1350,10 @@ function getShellHTML() {
|
|
|
1340
1350
|
if (!iframe) { iframe = document.createElement('iframe'); iframe.src = '/' + encodeURIComponent(activeIteration) + '/'; iframe.dataset.iteration = activeIteration; viewport.appendChild(iframe); iframeCache[activeIteration] = iframe; }
|
|
1341
1351
|
iframe.style.display = '';
|
|
1342
1352
|
} else {
|
|
1343
|
-
const empty = document.createElement('div'); empty.className = 'empty-state';
|
|
1353
|
+
const empty = document.createElement('div'); empty.className = 'empty-state';
|
|
1354
|
+
const statusText = document.createElement('p'); statusText.textContent = 'Iteration "' + activeIteration + '" is ' + (info.status || 'unknown') + '...'; empty.appendChild(statusText);
|
|
1355
|
+
if (info.status === 'error' && info.error) { const errEl = document.createElement('code'); errEl.style.cssText = 'color:#ef4444;font-size:12px;max-width:600px;overflow-x:auto;white-space:pre-wrap;word-break:break-all;padding:8px 12px;background:#1a1a1a;border-radius:6px;margin-top:8px;display:block;'; errEl.textContent = info.error; empty.appendChild(errEl); }
|
|
1356
|
+
viewport.appendChild(empty);
|
|
1344
1357
|
}
|
|
1345
1358
|
}
|
|
1346
1359
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iterate-ui-daemon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "iterate daemon — control server, worktree manager, proxy",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@fastify/reply-from": "^12.0.0",
|
|
38
38
|
"simple-git": "^3.27.0",
|
|
39
39
|
"execa": "^9.5.0",
|
|
40
|
-
"iterate-ui-
|
|
41
|
-
"iterate-ui-
|
|
40
|
+
"iterate-ui-overlay": "0.1.2",
|
|
41
|
+
"iterate-ui-core": "0.1.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^22.0.0",
|