@jmanuelcorral/bond-app 0.1.5 → 0.1.6
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/README.md +211 -17
- package/app/brand/TOKENS.md +5 -5
- package/app/layouts/bond.json +10 -14
- package/app/mods/bond-agents/api.js +35 -0
- package/app/mods/bond-agents/branch.svg +1 -0
- package/app/mods/bond-agents/brand.js +53 -2
- package/app/mods/bond-agents/config.js +4 -0
- package/app/mods/bond-agents/eye-off.svg +1 -0
- package/app/mods/bond-agents/eye.svg +1 -0
- package/app/mods/bond-agents/main.js +308 -327
- package/app/mods/bond-agents/model.js +354 -5
- package/app/mods/bond-board/api.js +35 -0
- package/app/mods/bond-board/branch.svg +1 -0
- package/app/mods/bond-board/brand.js +53 -2
- package/app/mods/bond-board/config.js +4 -0
- package/app/mods/bond-board/main.js +686 -444
- package/app/mods/bond-board/model.js +99 -25
- package/app/mods/bond-pane/close.svg +1 -0
- package/app/mods/bond-pane/hide.svg +1 -0
- package/app/mods/bond-pane/main.js +103 -0
- package/app/mods/bond-pane/mod.json +1 -0
- package/app/mods/bond-pane/model.js +18 -0
- package/app/mods/bond-pane/split-down.svg +1 -0
- package/app/mods/bond-pane/split-right.svg +1 -0
- package/app/mods/bond-pane/unzoom.svg +1 -0
- package/app/mods/bond-pane/zoom.svg +1 -0
- package/app/mods/bond-settings/api.js +35 -0
- package/app/mods/bond-settings/brand.js +53 -2
- package/app/mods/bond-settings/config.js +4 -0
- package/app/mods/bond-settings/main.js +1159 -278
- package/app/mods/bond-settings/mod.json +1 -1
- package/app/mods/bond-status/api.js +35 -0
- package/app/mods/bond-status/brand.js +53 -2
- package/app/mods/bond-status/config.js +4 -0
- package/app/mods/bond-status/main.js +37 -15
- package/app/mods/bond-status/model.js +19 -1
- package/app/mods/bond-tabs/brand.js +53 -2
- package/app/mods/bond-tabs/main.js +45 -3
- package/app/mods/bond-titlebar/brand.js +53 -2
- package/app/mods/bond-titlebar/main.js +85 -29
- package/app/mods/bond-titlebar/version.js +3 -0
- package/app/themes/bond-dark.json +5 -5
- package/app/themes/bond-light.json +5 -5
- package/package.json +1 -1
- package/runner/Dockerfile +16 -2
- package/runner/SPIKE-BOND.md +6 -2
- package/runner/entrypoint.sh +16 -0
- package/runner/setup.sh +439 -8
- package/runner/versions.env +32 -1
- package/scripts/app-install.ts +60 -1
- package/src/cli.ts +53 -3
- package/src/core/agy-login.ts +682 -0
- package/src/core/delivery.ts +3 -1
- package/src/core/orchestrator.ts +736 -78
- package/src/core/repo-host.ts +60 -0
- package/src/core/setup.ts +62 -1
- package/src/core/watchdog.ts +6 -6
- package/src/db/database.ts +41 -1
- package/src/db/settings-repo.ts +332 -7
- package/src/db/ticket-repo.ts +46 -20
- package/src/index.ts +4 -4
- package/src/runner/azure-devops-client.ts +163 -0
- package/src/runner/docker-client.ts +59 -9
- package/src/runner/github-client.ts +30 -3
- package/src/runner/hc-client.ts +33 -5
- package/src/runner/image-builder.ts +123 -5
- package/src/runner/jira-client.ts +368 -0
- package/src/runner/tool-catalog.ts +84 -0
- package/src/server/app.ts +377 -5
- package/src/types.ts +129 -2
package/src/cli.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { spawn, execFileSync } from 'node:child_process';
|
|
|
15
15
|
import { fileURLToPath } from 'node:url';
|
|
16
16
|
|
|
17
17
|
import { bootstrap } from './index.ts';
|
|
18
|
+
import type { ServerHooks } from './server/app.ts';
|
|
18
19
|
import { MIN_HC_VERSION, MIN_HERDR_APP_VERSION } from './runner/hc-client.ts';
|
|
19
20
|
import { install, parseInstallArgs, removeLauncher } from '../scripts/app-install.ts';
|
|
20
21
|
|
|
@@ -209,9 +210,34 @@ export async function queryStatus(opts: StatusOptions): Promise<StatusResult> {
|
|
|
209
210
|
};
|
|
210
211
|
}
|
|
211
212
|
|
|
213
|
+
/**
|
|
214
|
+
* «Reiniciar orquestador»: start this same command again, detached, with the same argv,
|
|
215
|
+
* execArgv and environment (so RUNNER_IMAGE, --port and --data-dir survive). Its output
|
|
216
|
+
* goes to <data dir>/orchestrator.log: the terminal that started us may be gone.
|
|
217
|
+
*/
|
|
218
|
+
export function relaunchSelf(dataDir: string, spawnFn: typeof spawn = spawn): number | undefined {
|
|
219
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
220
|
+
const logPath = path.join(dataDir, 'orchestrator.log');
|
|
221
|
+
const fd = fs.openSync(logPath, 'a', 0o600);
|
|
222
|
+
try {
|
|
223
|
+
const child = spawnFn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
224
|
+
detached: true,
|
|
225
|
+
stdio: ['ignore', fd, fd],
|
|
226
|
+
env: process.env,
|
|
227
|
+
cwd: process.cwd(),
|
|
228
|
+
});
|
|
229
|
+
child.unref();
|
|
230
|
+
console.log(`[bond-app] Restarting in the background (pid ${child.pid}); log: ${logPath}`);
|
|
231
|
+
return child.pid;
|
|
232
|
+
} finally {
|
|
233
|
+
fs.closeSync(fd);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
212
237
|
export async function handleStart(
|
|
213
238
|
args: string[],
|
|
214
|
-
bootstrapFn: (overrides?: any) => Promise<{ server: any; orchestrator: any; port: number }> = bootstrap
|
|
239
|
+
bootstrapFn: (overrides?: any, hooks?: ServerHooks) => Promise<{ server: any; orchestrator: any; port: number }> = bootstrap,
|
|
240
|
+
relaunchFn: (dataDir: string) => unknown = relaunchSelf
|
|
215
241
|
): Promise<number> {
|
|
216
242
|
const overrides: Record<string, any> = {};
|
|
217
243
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -238,6 +264,7 @@ export async function handleStart(
|
|
|
238
264
|
|
|
239
265
|
return new Promise<number>((resolve, reject) => {
|
|
240
266
|
let shuttingDown = false;
|
|
267
|
+
let restartRequested = false;
|
|
241
268
|
let serverInstance: any = null;
|
|
242
269
|
let orchestratorInstance: any = null;
|
|
243
270
|
let bootstrapPromise: Promise<{ server: any; orchestrator: any }> | null = null;
|
|
@@ -263,7 +290,11 @@ export async function handleStart(
|
|
|
263
290
|
}
|
|
264
291
|
try {
|
|
265
292
|
if (serverInstance) {
|
|
266
|
-
await new Promise<void>((r) =>
|
|
293
|
+
await new Promise<void>((r) => {
|
|
294
|
+
serverInstance.close(() => r());
|
|
295
|
+
// Keep-alive connections (the mods poll) would hold close() open.
|
|
296
|
+
serverInstance.closeAllConnections?.();
|
|
297
|
+
});
|
|
267
298
|
}
|
|
268
299
|
} catch (err: any) {
|
|
269
300
|
console.warn(`[bond-app] Error closing HTTP server: ${err?.message || err}`);
|
|
@@ -276,6 +307,19 @@ export async function handleStart(
|
|
|
276
307
|
console.warn(`[bond-app] Error stopping orchestrator: ${err?.message || err}`);
|
|
277
308
|
}
|
|
278
309
|
console.log('[bond-app] Orchestrator stopped cleanly.');
|
|
310
|
+
if (restartRequested) {
|
|
311
|
+
const dataDir = orchestratorInstance?.config?.dataDir
|
|
312
|
+
|| overrides.dataDir
|
|
313
|
+
|| process.env.BOND_APP_DATA_DIR
|
|
314
|
+
|| path.join(os.homedir(), '.bond-app');
|
|
315
|
+
try {
|
|
316
|
+
relaunchFn(dataDir);
|
|
317
|
+
} catch (err: any) {
|
|
318
|
+
console.error(`[bond-app] Could not restart: ${err?.message || err}`);
|
|
319
|
+
resolve(1);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
279
323
|
resolve(0);
|
|
280
324
|
};
|
|
281
325
|
|
|
@@ -285,7 +329,13 @@ export async function handleStart(
|
|
|
285
329
|
process.once('SIGINT', sigintHandler);
|
|
286
330
|
process.once('SIGTERM', sigtermHandler);
|
|
287
331
|
|
|
288
|
-
|
|
332
|
+
const hooks: ServerHooks = {
|
|
333
|
+
onRestart: () => {
|
|
334
|
+
restartRequested = true;
|
|
335
|
+
void shutdown('restart request');
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
bootstrapPromise = bootstrapFn(overrides, hooks);
|
|
289
339
|
bootstrapPromise
|
|
290
340
|
.then(({ server, orchestrator }) => {
|
|
291
341
|
serverInstance = server;
|