@guildai/cli 0.11.0 → 0.12.0
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/auth-CRMO5O3N.js +29 -0
- package/dist/auth-CRMO5O3N.js.map +7 -0
- package/dist/chat-5VX2WJH2.js +303 -0
- package/dist/chat-5VX2WJH2.js.map +7 -0
- package/dist/chat-SIKDYZQK.js +31 -0
- package/dist/chat-SIKDYZQK.js.map +7 -0
- package/dist/chunk-56YCMGL3.js +522 -0
- package/dist/chunk-56YCMGL3.js.map +7 -0
- package/dist/chunk-6EX6E7WP.js +7042 -0
- package/dist/chunk-6EX6E7WP.js.map +7 -0
- package/dist/chunk-B7VAF5UG.js +532 -0
- package/dist/chunk-B7VAF5UG.js.map +7 -0
- package/dist/chunk-DOIYVBNY.js +3057 -0
- package/dist/chunk-DOIYVBNY.js.map +7 -0
- package/dist/chunk-ENKEEJ45.js +17 -0
- package/dist/chunk-ENKEEJ45.js.map +7 -0
- package/dist/chunk-IBRKVGMZ.js +97041 -0
- package/dist/chunk-IBRKVGMZ.js.map +7 -0
- package/dist/chunk-LFMQJOKC.js +19778 -0
- package/dist/chunk-LFMQJOKC.js.map +7 -0
- package/dist/chunk-M347HP6M.js +22896 -0
- package/dist/chunk-M347HP6M.js.map +7 -0
- package/dist/chunk-OYQ476FQ.js +44 -0
- package/dist/chunk-OYQ476FQ.js.map +7 -0
- package/dist/chunk-PNCUR4OB.js +257 -0
- package/dist/chunk-PNCUR4OB.js.map +7 -0
- package/dist/chunk-RIG2HZWM.js +317 -0
- package/dist/chunk-RIG2HZWM.js.map +7 -0
- package/dist/chunk-SPZPZXUN.js +826 -0
- package/dist/chunk-SPZPZXUN.js.map +7 -0
- package/dist/chunk-VVSOU6ON.js +53 -0
- package/dist/chunk-VVSOU6ON.js.map +7 -0
- package/dist/chunk-X3ADGWOF.js +3643 -0
- package/dist/chunk-X3ADGWOF.js.map +7 -0
- package/dist/commands/skill/create.d.ts +3 -0
- package/dist/commands/skill/get.d.ts +3 -0
- package/dist/commands/skill/list.d.ts +3 -0
- package/dist/commands/skill/update.d.ts +3 -0
- package/dist/commands/skill/version/create.d.ts +3 -0
- package/dist/commands/skill/version/get.d.ts +3 -0
- package/dist/commands/skill/version/list.d.ts +3 -0
- package/dist/devtools-AO7YSDOD.js +67 -0
- package/dist/devtools-AO7YSDOD.js.map +7 -0
- package/dist/dist-4CBK6X5H.js +1566 -0
- package/dist/dist-4CBK6X5H.js.map +7 -0
- package/dist/esm-FRAVZP4J.js +13 -0
- package/dist/esm-FRAVZP4J.js.map +7 -0
- package/dist/execa-XQMWSABC.js +35 -0
- package/dist/execa-XQMWSABC.js.map +7 -0
- package/dist/index.js +8230 -263
- package/dist/index.js.map +7 -0
- package/dist/lib/api-types.d.ts +44 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/errors.d.ts +1 -1
- package/dist/lib/output.d.ts +11 -1
- package/dist/lib/session-events.d.ts +1 -1
- package/dist/lib/session-polling.d.ts +24 -1
- package/dist/lib/websocket-client.d.ts +46 -0
- package/dist/open-RF4X5MOP.js +13 -0
- package/dist/open-RF4X5MOP.js.map +7 -0
- package/dist/server-JYVH64FD.js +27659 -0
- package/dist/server-JYVH64FD.js.map +7 -0
- package/dist/test-SNIYRJ32.js +692 -0
- package/dist/test-SNIYRJ32.js.map +7 -0
- package/docs/skills/codex-agent-dev.md +2 -2
- package/package.json +8 -12
- package/dist/commands/agent/chat.js +0 -281
- package/dist/commands/agent/clone.js +0 -118
- package/dist/commands/agent/code.js +0 -87
- package/dist/commands/agent/fork.js +0 -220
- package/dist/commands/agent/get.js +0 -37
- package/dist/commands/agent/grep.js +0 -107
- package/dist/commands/agent/init.js +0 -403
- package/dist/commands/agent/list.js +0 -110
- package/dist/commands/agent/logs.js +0 -62
- package/dist/commands/agent/owners.js +0 -74
- package/dist/commands/agent/publish.js +0 -91
- package/dist/commands/agent/pull.js +0 -194
- package/dist/commands/agent/revalidate.js +0 -56
- package/dist/commands/agent/save.js +0 -345
- package/dist/commands/agent/search.js +0 -61
- package/dist/commands/agent/tags/add.js +0 -73
- package/dist/commands/agent/tags/list.js +0 -43
- package/dist/commands/agent/tags/remove.js +0 -84
- package/dist/commands/agent/tags/set.js +0 -71
- package/dist/commands/agent/test.js +0 -489
- package/dist/commands/agent/unpublish.js +0 -64
- package/dist/commands/agent/update.js +0 -118
- package/dist/commands/agent/versions.js +0 -55
- package/dist/commands/agent/workspaces.js +0 -54
- package/dist/commands/auth/login.js +0 -31
- package/dist/commands/auth/logout.js +0 -24
- package/dist/commands/auth/status.js +0 -38
- package/dist/commands/auth/token.js +0 -19
- package/dist/commands/chat.js +0 -1416
- package/dist/commands/config/get.js +0 -64
- package/dist/commands/config/list.js +0 -46
- package/dist/commands/config/path.js +0 -37
- package/dist/commands/config/set.js +0 -132
- package/dist/commands/credentials/endpoint-list.js +0 -88
- package/dist/commands/credentials/list.js +0 -50
- package/dist/commands/credentials/policy-create.js +0 -66
- package/dist/commands/credentials/policy-delete.js +0 -33
- package/dist/commands/credentials/policy-list.js +0 -45
- package/dist/commands/credentials/policy-update.js +0 -66
- package/dist/commands/doctor.js +0 -233
- package/dist/commands/integration/connect.js +0 -76
- package/dist/commands/integration/create.js +0 -298
- package/dist/commands/integration/get.js +0 -95
- package/dist/commands/integration/list.js +0 -62
- package/dist/commands/integration/operation/create.js +0 -164
- package/dist/commands/integration/operation/list.js +0 -92
- package/dist/commands/integration/update.js +0 -139
- package/dist/commands/integration/version/build.js +0 -86
- package/dist/commands/integration/version/create.js +0 -45
- package/dist/commands/integration/version/get.js +0 -72
- package/dist/commands/integration/version/list.js +0 -45
- package/dist/commands/integration/version/publish.js +0 -79
- package/dist/commands/integration/version/test.js +0 -104
- package/dist/commands/job/get-step.js +0 -40
- package/dist/commands/job/get.js +0 -44
- package/dist/commands/mcp.js +0 -34
- package/dist/commands/session/create.js +0 -59
- package/dist/commands/session/events.js +0 -56
- package/dist/commands/session/get.js +0 -33
- package/dist/commands/session/interrupt.js +0 -33
- package/dist/commands/session/list.js +0 -59
- package/dist/commands/session/send.js +0 -54
- package/dist/commands/session/tasks.js +0 -45
- package/dist/commands/setup.js +0 -260
- package/dist/commands/trigger/activate.js +0 -41
- package/dist/commands/trigger/create.js +0 -197
- package/dist/commands/trigger/deactivate.js +0 -41
- package/dist/commands/trigger/get.js +0 -33
- package/dist/commands/trigger/list.js +0 -57
- package/dist/commands/trigger/sessions.js +0 -48
- package/dist/commands/trigger/update.js +0 -128
- package/dist/commands/version.js +0 -24
- package/dist/commands/workspace/agent/add.js +0 -114
- package/dist/commands/workspace/agent/list.js +0 -78
- package/dist/commands/workspace/agent/remove.js +0 -78
- package/dist/commands/workspace/clear.js +0 -45
- package/dist/commands/workspace/context/edit.js +0 -107
- package/dist/commands/workspace/context/get.js +0 -47
- package/dist/commands/workspace/context/list.js +0 -51
- package/dist/commands/workspace/context/publish.js +0 -42
- package/dist/commands/workspace/create.js +0 -51
- package/dist/commands/workspace/current.js +0 -63
- package/dist/commands/workspace/get.js +0 -39
- package/dist/commands/workspace/list.js +0 -70
- package/dist/commands/workspace/select.js +0 -184
- package/dist/components/AgentInstallPrompt.js +0 -97
- package/dist/components/SplashAnimation.js +0 -321
- package/dist/components/TaskView.js +0 -268
- package/dist/lib/agent-helpers.js +0 -306
- package/dist/lib/alternate-screen.js +0 -59
- package/dist/lib/api-client.js +0 -154
- package/dist/lib/api-types.js +0 -10
- package/dist/lib/auth.js +0 -284
- package/dist/lib/braille-canvas.js +0 -321
- package/dist/lib/colors.js +0 -46
- package/dist/lib/config-cache.js +0 -45
- package/dist/lib/config.js +0 -153
- package/dist/lib/did-you-mean.js +0 -144
- package/dist/lib/errors.js +0 -375
- package/dist/lib/event-filter.js +0 -91
- package/dist/lib/generated-types.js +0 -56
- package/dist/lib/git.js +0 -176
- package/dist/lib/gk.js +0 -91
- package/dist/lib/guild-config.js +0 -178
- package/dist/lib/iap.js +0 -117
- package/dist/lib/integration-helpers.js +0 -38
- package/dist/lib/loading-messages.js +0 -72
- package/dist/lib/logo.js +0 -141
- package/dist/lib/lottie-serverside.js +0 -181
- package/dist/lib/markdown.js +0 -38
- package/dist/lib/npmrc.js +0 -59
- package/dist/lib/output-mode.js +0 -54
- package/dist/lib/output.js +0 -622
- package/dist/lib/owner-helpers.js +0 -112
- package/dist/lib/polling.js +0 -76
- package/dist/lib/progress.js +0 -324
- package/dist/lib/session-events-fetch.js +0 -25
- package/dist/lib/session-events.js +0 -126
- package/dist/lib/session-polling.js +0 -166
- package/dist/lib/session-resume.js +0 -229
- package/dist/lib/spinners.js +0 -770
- package/dist/lib/splash.js +0 -42
- package/dist/lib/stdin.js +0 -91
- package/dist/lib/svg-to-braille.js +0 -76
- package/dist/lib/table.js +0 -59
- package/dist/lib/update-check.js +0 -65
- package/dist/lib/validate-input-schema.js +0 -208
- package/dist/lib/version-helpers.js +0 -137
- package/dist/lib/workspace-helpers.js +0 -49
- package/dist/mcp/resources.js +0 -67
- package/dist/mcp/server.js +0 -64
- package/dist/mcp/tools.js +0 -753
package/dist/lib/splash.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import LOGO from './logo.js';
|
|
5
|
-
import { brand } from './colors.js';
|
|
6
|
-
import { isMachineReadable } from './output-mode.js';
|
|
7
|
-
/**
|
|
8
|
-
* Show splash screen with logo
|
|
9
|
-
*/
|
|
10
|
-
export function showSplashScreen(options) {
|
|
11
|
-
console.log('');
|
|
12
|
-
LOGO.forEach((line) => console.log(brand(line)));
|
|
13
|
-
console.log('');
|
|
14
|
-
console.log('Guild.ai CLI');
|
|
15
|
-
console.log(chalk.dim(`v${options.version}`));
|
|
16
|
-
console.log('');
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Determine if splash screen should be shown
|
|
20
|
-
*
|
|
21
|
-
* Show for: help, version, interactive chat
|
|
22
|
-
* Never for: --json, data commands, action commands
|
|
23
|
-
*/
|
|
24
|
-
export function shouldShowSplash() {
|
|
25
|
-
// Never in machine-readable mode (--mode json, --mode jsonl, --json)
|
|
26
|
-
if (isMachineReadable()) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
const args = process.argv.slice(2);
|
|
30
|
-
// Show for top-level help/version only
|
|
31
|
-
// Don't show for subcommand help (e.g., 'guild chat --help')
|
|
32
|
-
// Note: chat command renders its own header, so we skip splash for it
|
|
33
|
-
if (args.length === 0 || args[0] === 'version') {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
// Only show splash for top-level --help (no other commands before it)
|
|
37
|
-
if ((args[0] === '--help' || args[0] === '-h') && args.length === 1) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=splash.js.map
|
package/dist/lib/stdin.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* Check if the CLI is running in interactive mode.
|
|
5
|
-
*
|
|
6
|
-
* Returns false when:
|
|
7
|
-
* - stdin is not a TTY (piped input, CI, cron)
|
|
8
|
-
* - the global --non-interactive flag is set
|
|
9
|
-
*/
|
|
10
|
-
export function isInteractive() {
|
|
11
|
-
if (process.argv.includes('--non-interactive')) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return process.stdin.isTTY === true;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Exit with a helpful error when stdin is piped but no --mode flag was given.
|
|
18
|
-
* Call this before rendering an interactive UI (Ink render()) so users who
|
|
19
|
-
* accidentally pipe input without --mode get clear guidance instead of a hang.
|
|
20
|
-
*/
|
|
21
|
-
export function ensureInteractiveStdin(command) {
|
|
22
|
-
if (!process.stdin.isTTY) {
|
|
23
|
-
console.error('Error: stdin is piped but --mode was not specified');
|
|
24
|
-
console.error('');
|
|
25
|
-
console.error('When piping input, use --mode to set the input format:');
|
|
26
|
-
console.error(` echo '{"prompt":"hello"}' | ${command} --mode json`);
|
|
27
|
-
console.error(` cat inputs.jsonl | ${command} --mode jsonl`);
|
|
28
|
-
console.error('');
|
|
29
|
-
console.error('Or run interactively (no pipe):');
|
|
30
|
-
console.error(` ${command}`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Read raw text from stdin with a timeout.
|
|
36
|
-
*/
|
|
37
|
-
export function readStdinAsText() {
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
let input = '';
|
|
40
|
-
const timeout = setTimeout(() => {
|
|
41
|
-
reject(new Error('Timeout waiting for stdin'));
|
|
42
|
-
}, 5000);
|
|
43
|
-
process.stdin.setEncoding('utf8');
|
|
44
|
-
process.stdin.on('data', (chunk) => {
|
|
45
|
-
input += chunk;
|
|
46
|
-
});
|
|
47
|
-
process.stdin.on('end', () => {
|
|
48
|
-
clearTimeout(timeout);
|
|
49
|
-
resolve(input);
|
|
50
|
-
});
|
|
51
|
-
process.stdin.on('error', (error) => {
|
|
52
|
-
clearTimeout(timeout);
|
|
53
|
-
reject(error);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Read JSON from stdin with a timeout.
|
|
59
|
-
*/
|
|
60
|
-
export function readStdinAsJSON() {
|
|
61
|
-
return new Promise((resolve, reject) => {
|
|
62
|
-
let input = '';
|
|
63
|
-
const timeout = setTimeout(() => {
|
|
64
|
-
reject(new Error('Timeout waiting for stdin'));
|
|
65
|
-
}, 5000);
|
|
66
|
-
process.stdin.setEncoding('utf8');
|
|
67
|
-
process.stdin.on('data', (chunk) => {
|
|
68
|
-
input += chunk;
|
|
69
|
-
});
|
|
70
|
-
process.stdin.on('end', () => {
|
|
71
|
-
clearTimeout(timeout);
|
|
72
|
-
if (!input.trim()) {
|
|
73
|
-
reject(new Error('No JSON input provided'));
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
const parsed = JSON.parse(input);
|
|
78
|
-
resolve(parsed);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
const err = error;
|
|
82
|
-
reject(new Error(`Invalid JSON: ${err.message}`));
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
process.stdin.on('error', (error) => {
|
|
86
|
-
clearTimeout(timeout);
|
|
87
|
-
reject(error);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=stdin.js.map
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* Simple SVG to Braille converter using proper SVG rendering
|
|
5
|
-
* Uses sharp to render SVG to bitmap, then samples pixels for braille
|
|
6
|
-
*/
|
|
7
|
-
import sharp from 'sharp';
|
|
8
|
-
// Braille Unicode range: U+2800 to U+28FF
|
|
9
|
-
// Each braille character represents an 8-pixel grid (2x4)
|
|
10
|
-
// Bit positions (0-indexed):
|
|
11
|
-
// 0 3
|
|
12
|
-
// 1 4
|
|
13
|
-
// 2 5
|
|
14
|
-
// 6 7
|
|
15
|
-
/**
|
|
16
|
-
* Convert SVG string to braille text representation
|
|
17
|
-
*/
|
|
18
|
-
export async function svgToBraille(svgString, widthChars, heightChars) {
|
|
19
|
-
// Each braille char is 2 pixels wide, 4 pixels tall
|
|
20
|
-
const pixelWidth = widthChars * 2;
|
|
21
|
-
const pixelHeight = heightChars * 4;
|
|
22
|
-
// Single-pass pipeline: render SVG to bitmap and get raw pixel data
|
|
23
|
-
const { data, info } = await sharp(Buffer.from(svgString))
|
|
24
|
-
.resize(pixelWidth, pixelHeight, {
|
|
25
|
-
fit: 'contain',
|
|
26
|
-
background: { r: 255, g: 255, b: 255, alpha: 1 },
|
|
27
|
-
})
|
|
28
|
-
.flatten({ background: { r: 255, g: 255, b: 255 } })
|
|
29
|
-
.greyscale()
|
|
30
|
-
.raw()
|
|
31
|
-
.toBuffer({ resolveWithObject: true });
|
|
32
|
-
// Convert pixels to braille
|
|
33
|
-
const lines = [];
|
|
34
|
-
for (let row = 0; row < heightChars; row++) {
|
|
35
|
-
let line = '';
|
|
36
|
-
for (let col = 0; col < widthChars; col++) {
|
|
37
|
-
// Sample 2x4 pixel grid for this braille character
|
|
38
|
-
let brailleBits = 0;
|
|
39
|
-
for (let dy = 0; dy < 4; dy++) {
|
|
40
|
-
for (let dx = 0; dx < 2; dx++) {
|
|
41
|
-
const pixelX = col * 2 + dx;
|
|
42
|
-
const pixelY = row * 4 + dy;
|
|
43
|
-
// Get pixel value (grayscale: black = 0, white = 255)
|
|
44
|
-
const pixelIndex = (pixelY * info.width + pixelX) * info.channels;
|
|
45
|
-
const pixelValue = data[pixelIndex]; // R channel (they're all the same for grayscale)
|
|
46
|
-
// If pixel is dark (< 128), set the corresponding braille bit
|
|
47
|
-
if (pixelValue < 128) {
|
|
48
|
-
// Map pixel position to braille bit position
|
|
49
|
-
// dx=0,dy=0 -> bit 0
|
|
50
|
-
// dx=0,dy=1 -> bit 1
|
|
51
|
-
// dx=0,dy=2 -> bit 2
|
|
52
|
-
// dx=0,dy=3 -> bit 6
|
|
53
|
-
// dx=1,dy=0 -> bit 3
|
|
54
|
-
// dx=1,dy=1 -> bit 4
|
|
55
|
-
// dx=1,dy=2 -> bit 5
|
|
56
|
-
// dx=1,dy=3 -> bit 7
|
|
57
|
-
let bitPos;
|
|
58
|
-
if (dx === 0) {
|
|
59
|
-
bitPos = dy < 3 ? dy : 6;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
bitPos = dy < 3 ? dy + 3 : 7;
|
|
63
|
-
}
|
|
64
|
-
brailleBits |= 1 << bitPos;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Convert bit pattern to braille Unicode character
|
|
69
|
-
const brailleChar = String.fromCharCode(0x2800 + brailleBits);
|
|
70
|
-
line += brailleChar;
|
|
71
|
-
}
|
|
72
|
-
lines.push(line);
|
|
73
|
-
}
|
|
74
|
-
return lines;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=svg-to-braille.js.map
|
package/dist/lib/table.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import stringWidth from 'string-width';
|
|
5
|
-
/**
|
|
6
|
-
* Minimal table renderer using string-width@7 for ANSI-aware column sizing.
|
|
7
|
-
*/
|
|
8
|
-
export class Table {
|
|
9
|
-
columns;
|
|
10
|
-
rows = [];
|
|
11
|
-
constructor(config) {
|
|
12
|
-
this.columns = config.columns;
|
|
13
|
-
}
|
|
14
|
-
addRow(row) {
|
|
15
|
-
const sanitized = {};
|
|
16
|
-
for (const [k, v] of Object.entries(row)) {
|
|
17
|
-
sanitized[k] = v.replace(/[\r\n]+/g, ' ').trim();
|
|
18
|
-
}
|
|
19
|
-
this.rows.push(sanitized);
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
const widths = this.columns.map((col) => {
|
|
23
|
-
const headerWidth = stringWidth(col.title);
|
|
24
|
-
const maxData = this.rows.reduce((max, row) => Math.max(max, stringWidth(row[col.name] ?? '')), 0);
|
|
25
|
-
return Math.max(headerWidth, maxData);
|
|
26
|
-
});
|
|
27
|
-
const pad = (text, width) => {
|
|
28
|
-
const visible = stringWidth(text);
|
|
29
|
-
return visible >= width ? text : text + ' '.repeat(width - visible);
|
|
30
|
-
};
|
|
31
|
-
const top = '┌' + widths.map((w) => '─'.repeat(w + 2)).join('┬') + '┐';
|
|
32
|
-
const mid = '├' + widths.map((w) => '─'.repeat(w + 2)).join('┼') + '┤';
|
|
33
|
-
const bot = '└' + widths.map((w) => '─'.repeat(w + 2)).join('┴') + '┘';
|
|
34
|
-
const header = '│' +
|
|
35
|
-
this.columns
|
|
36
|
-
.map((col, i) => ' ' + chalk.bold(pad(col.title, widths[i])) + ' ')
|
|
37
|
-
.join('│') +
|
|
38
|
-
'│';
|
|
39
|
-
const dataRows = this.rows.map((row) => '│' +
|
|
40
|
-
this.columns
|
|
41
|
-
.map((col, i) => {
|
|
42
|
-
const val = row[col.name] ?? '';
|
|
43
|
-
const padded = pad(val, widths[i]);
|
|
44
|
-
if (col.color && col.color in chalk) {
|
|
45
|
-
return (' ' +
|
|
46
|
-
chalk[col.color](padded) +
|
|
47
|
-
' ');
|
|
48
|
-
}
|
|
49
|
-
return ' ' + padded + ' ';
|
|
50
|
-
})
|
|
51
|
-
.join('│') +
|
|
52
|
-
'│');
|
|
53
|
-
return [top, header, mid, ...dataRows, bot].join('\n');
|
|
54
|
-
}
|
|
55
|
-
printTable() {
|
|
56
|
-
console.log(this.render());
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=table.js.map
|
package/dist/lib/update-check.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import https from 'https';
|
|
4
|
-
import { getOutputMode, isQuietMode } from './output-mode.js';
|
|
5
|
-
/**
|
|
6
|
-
* Fire-and-forget check for a newer version on npm.
|
|
7
|
-
* Prints a one-liner to stderr if an update is available.
|
|
8
|
-
* Network failures are silently ignored.
|
|
9
|
-
*/
|
|
10
|
-
export function checkForUpdate(currentVersion) {
|
|
11
|
-
// Suppress in JSON mode, quiet mode, or non-TTY stderr
|
|
12
|
-
if (getOutputMode() === 'json' || isQuietMode() || !process.stderr.isTTY) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const req = https.get('https://registry.npmjs.org/@guildai/cli/latest', { timeout: 3000 }, (res) => {
|
|
16
|
-
let data = '';
|
|
17
|
-
res.on('data', (chunk) => {
|
|
18
|
-
data += chunk.toString();
|
|
19
|
-
});
|
|
20
|
-
res.on('end', () => {
|
|
21
|
-
try {
|
|
22
|
-
const pkg = JSON.parse(data);
|
|
23
|
-
if (pkg.version && isNewer(pkg.version, currentVersion)) {
|
|
24
|
-
process.stderr.write(`\nUpdate available: ${currentVersion} → ${pkg.version} Run: npm install -g @guildai/cli\n`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
// malformed JSON — ignore
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
req.on('error', () => {
|
|
33
|
-
// network failure — ignore
|
|
34
|
-
});
|
|
35
|
-
req.on('timeout', () => {
|
|
36
|
-
req.destroy();
|
|
37
|
-
});
|
|
38
|
-
// Don't let this request keep the process alive
|
|
39
|
-
if (req.socket) {
|
|
40
|
-
req.socket.unref();
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
req.on('socket', (socket) => {
|
|
44
|
-
socket.unref();
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Simple numeric version comparison (major.minor.patch).
|
|
50
|
-
* Returns true if `latest` is strictly newer than `current`.
|
|
51
|
-
*/
|
|
52
|
-
export function isNewer(latest, current) {
|
|
53
|
-
const l = latest.split('.').map(Number);
|
|
54
|
-
const c = current.split('.').map(Number);
|
|
55
|
-
for (let i = 0; i < Math.max(l.length, c.length); i++) {
|
|
56
|
-
const lv = l[i] ?? 0;
|
|
57
|
-
const cv = c[i] ?? 0;
|
|
58
|
-
if (lv > cv)
|
|
59
|
-
return true;
|
|
60
|
-
if (lv < cv)
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=update-check.js.map
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import * as fs from 'fs/promises';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import * as os from 'os';
|
|
6
|
-
import { execFile } from 'child_process';
|
|
7
|
-
import { promisify } from 'util';
|
|
8
|
-
import { debug } from './errors.js';
|
|
9
|
-
const execFileAsync = promisify(execFile);
|
|
10
|
-
function resolveSourceEntryPoint(agentDir, packageJson) {
|
|
11
|
-
const exports = packageJson.exports;
|
|
12
|
-
if (exports?.['.']) {
|
|
13
|
-
const distPath = exports['.'];
|
|
14
|
-
const sourcePath = distPath
|
|
15
|
-
.replace(/^\.\/dist\//, '')
|
|
16
|
-
.replace(/\.compiled\.js$/, '.ts')
|
|
17
|
-
.replace(/\.js$/, '.ts');
|
|
18
|
-
return path.join(agentDir, sourcePath);
|
|
19
|
-
}
|
|
20
|
-
return path.join(agentDir, 'agent.ts');
|
|
21
|
-
}
|
|
22
|
-
async function fileExists(filePath) {
|
|
23
|
-
return fs
|
|
24
|
-
.access(filePath)
|
|
25
|
-
.then(() => true)
|
|
26
|
-
.catch(() => false);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Extract a single `const <name> = z.<call>(...)` declaration from source,
|
|
30
|
-
* starting at the given regex match. Uses balanced parenthesis matching
|
|
31
|
-
* with string literal awareness.
|
|
32
|
-
*/
|
|
33
|
-
function extractZodDeclaration(source, match) {
|
|
34
|
-
const startIndex = match.index;
|
|
35
|
-
const afterEquals = match.index + match[0].length;
|
|
36
|
-
let depth = 0;
|
|
37
|
-
let foundOpen = false;
|
|
38
|
-
let endIndex = afterEquals;
|
|
39
|
-
let inString = null;
|
|
40
|
-
for (let charIndex = afterEquals; charIndex < source.length; charIndex++) {
|
|
41
|
-
const char = source[charIndex];
|
|
42
|
-
if (inString) {
|
|
43
|
-
if (char === '\\') {
|
|
44
|
-
charIndex++;
|
|
45
|
-
}
|
|
46
|
-
else if (char === inString) {
|
|
47
|
-
inString = null;
|
|
48
|
-
}
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (char === '"' || char === "'" || char === '`') {
|
|
52
|
-
inString = char;
|
|
53
|
-
}
|
|
54
|
-
else if (char === '(') {
|
|
55
|
-
depth++;
|
|
56
|
-
foundOpen = true;
|
|
57
|
-
}
|
|
58
|
-
else if (char === ')') {
|
|
59
|
-
depth--;
|
|
60
|
-
if (foundOpen && depth === 0) {
|
|
61
|
-
endIndex = charIndex + 1;
|
|
62
|
-
if (source[endIndex] === ';')
|
|
63
|
-
endIndex++;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (!foundOpen)
|
|
69
|
-
return null;
|
|
70
|
-
return source.substring(startIndex, endIndex);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Extract inputSchema and any Zod schema dependencies from agent source.
|
|
74
|
-
* Finds all `const <name> = z.<call>(...)` declarations that appear before
|
|
75
|
-
* inputSchema (which may be referenced inside it), plus inputSchema itself.
|
|
76
|
-
* Returns them in source order so dependencies are defined before use.
|
|
77
|
-
*/
|
|
78
|
-
function extractInputSchema(source) {
|
|
79
|
-
const inputPattern = /const\s+inputSchema\s*=\s*/;
|
|
80
|
-
const inputMatch = inputPattern.exec(source);
|
|
81
|
-
if (!inputMatch)
|
|
82
|
-
return null;
|
|
83
|
-
const inputBlock = extractZodDeclaration(source, inputMatch);
|
|
84
|
-
if (!inputBlock)
|
|
85
|
-
return null;
|
|
86
|
-
const blocks = [];
|
|
87
|
-
const zodDeclPattern = /const\s+\w+\s*=\s*z\s*\.\s*/g;
|
|
88
|
-
let declMatch;
|
|
89
|
-
while ((declMatch = zodDeclPattern.exec(source)) !== null) {
|
|
90
|
-
if (declMatch.index >= inputMatch.index)
|
|
91
|
-
break;
|
|
92
|
-
const block = extractZodDeclaration(source, declMatch);
|
|
93
|
-
if (block)
|
|
94
|
-
blocks.push(block);
|
|
95
|
-
}
|
|
96
|
-
blocks.push(inputBlock);
|
|
97
|
-
return blocks.join('\n');
|
|
98
|
-
}
|
|
99
|
-
export async function validateInputSchema(agentDir, inputs) {
|
|
100
|
-
const nodeModulesPath = path.join(agentDir, 'node_modules');
|
|
101
|
-
if (!(await fileExists(nodeModulesPath))) {
|
|
102
|
-
return {
|
|
103
|
-
valid: true,
|
|
104
|
-
skipped: true,
|
|
105
|
-
reason: 'run npm install for pre-build input validation',
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
const pkgJsonPath = path.join(agentDir, 'package.json');
|
|
109
|
-
if (!(await fileExists(pkgJsonPath))) {
|
|
110
|
-
return {
|
|
111
|
-
valid: true,
|
|
112
|
-
skipped: true,
|
|
113
|
-
reason: 'no package.json found',
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
const pkgJson = JSON.parse(await fs.readFile(pkgJsonPath, 'utf-8'));
|
|
117
|
-
let entryPoint = resolveSourceEntryPoint(agentDir, pkgJson);
|
|
118
|
-
if (!(await fileExists(entryPoint))) {
|
|
119
|
-
const fallback = path.join(agentDir, 'agent.ts');
|
|
120
|
-
if (await fileExists(fallback)) {
|
|
121
|
-
entryPoint = fallback;
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
return {
|
|
125
|
-
valid: true,
|
|
126
|
-
skipped: true,
|
|
127
|
-
reason: `could not find agent source file (tried ${path.basename(entryPoint)})`,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const agentSource = await fs.readFile(entryPoint, 'utf-8');
|
|
132
|
-
const schemaBlock = extractInputSchema(agentSource);
|
|
133
|
-
if (!schemaBlock) {
|
|
134
|
-
return {
|
|
135
|
-
valid: true,
|
|
136
|
-
skipped: true,
|
|
137
|
-
reason: 'could not find inputSchema definition in agent source',
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'guild-validate-'));
|
|
141
|
-
try {
|
|
142
|
-
const extractorSource = [
|
|
143
|
-
`import { z } from "zod";`,
|
|
144
|
-
schemaBlock,
|
|
145
|
-
`const inputs = JSON.parse(process.argv[2]);`,
|
|
146
|
-
`const errors = [];`,
|
|
147
|
-
`for (let i = 0; i < inputs.length; i++) {`,
|
|
148
|
-
` try {`,
|
|
149
|
-
` inputSchema.parse(inputs[i]);`,
|
|
150
|
-
` } catch (e) {`,
|
|
151
|
-
` const issues = e.issues || [{ message: e.message }];`,
|
|
152
|
-
` errors.push({ index: i, issues: issues.map(iss => ({ message: iss.message, path: iss.path })) });`,
|
|
153
|
-
` }`,
|
|
154
|
-
`}`,
|
|
155
|
-
`if (errors.length > 0) {`,
|
|
156
|
-
` console.log(JSON.stringify({ valid: false, errors }));`,
|
|
157
|
-
`} else {`,
|
|
158
|
-
` console.log(JSON.stringify({ valid: true }));`,
|
|
159
|
-
`}`,
|
|
160
|
-
].join('\n');
|
|
161
|
-
const extractorPath = path.join(tmpDir, 'validate.mjs');
|
|
162
|
-
await fs.writeFile(extractorPath, extractorSource);
|
|
163
|
-
const { build } = await import('esbuild');
|
|
164
|
-
const bundlePath = path.join(tmpDir, 'validate-bundle.mjs');
|
|
165
|
-
await build({
|
|
166
|
-
entryPoints: [extractorPath],
|
|
167
|
-
bundle: true,
|
|
168
|
-
format: 'esm',
|
|
169
|
-
target: 'esnext',
|
|
170
|
-
platform: 'node',
|
|
171
|
-
outfile: bundlePath,
|
|
172
|
-
logLevel: 'silent',
|
|
173
|
-
nodePaths: [path.join(agentDir, 'node_modules')],
|
|
174
|
-
});
|
|
175
|
-
const inputArg = JSON.stringify(inputs);
|
|
176
|
-
const { stdout } = await execFileAsync('node', [bundlePath, inputArg], {
|
|
177
|
-
cwd: agentDir,
|
|
178
|
-
timeout: 10000,
|
|
179
|
-
});
|
|
180
|
-
const result = JSON.parse(stdout.trim());
|
|
181
|
-
if (result.valid) {
|
|
182
|
-
return { valid: true };
|
|
183
|
-
}
|
|
184
|
-
const flatErrors = [];
|
|
185
|
-
for (const entry of result.errors) {
|
|
186
|
-
for (const issue of entry.issues) {
|
|
187
|
-
const prefix = inputs.length > 1 ? `Line ${entry.index + 1}: ` : '';
|
|
188
|
-
flatErrors.push({
|
|
189
|
-
message: `${prefix}${issue.message}`,
|
|
190
|
-
path: issue.path,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return { valid: false, errors: flatErrors };
|
|
195
|
-
}
|
|
196
|
-
catch (error) {
|
|
197
|
-
debug('Local input validation failed: %s', error);
|
|
198
|
-
return {
|
|
199
|
-
valid: true,
|
|
200
|
-
skipped: true,
|
|
201
|
-
reason: 'local validation encountered an error (server-side validation will still run)',
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
finally {
|
|
205
|
-
await fs.rm(tmpDir, { recursive: true, force: true }).catch(() => { });
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
//# sourceMappingURL=validate-input-schema.js.map
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { GuildAPIClient } from './api-client.js';
|
|
4
|
-
import { pollUntilComplete } from './polling.js';
|
|
5
|
-
/**
|
|
6
|
-
* Format a list of validation steps into a compact single-line status string
|
|
7
|
-
* suitable for spinner text, e.g. `✓ build ⟳ test ○ deploy`.
|
|
8
|
-
* Returns null when the steps array is empty so callers can fall back to the
|
|
9
|
-
* default attempt-counter text.
|
|
10
|
-
*/
|
|
11
|
-
function formatStepProgress(steps) {
|
|
12
|
-
if (steps.length === 0)
|
|
13
|
-
return null;
|
|
14
|
-
const tokens = steps.map((step) => {
|
|
15
|
-
let prefix;
|
|
16
|
-
switch (step.status) {
|
|
17
|
-
case 'SUCCEEDED':
|
|
18
|
-
prefix = '✓';
|
|
19
|
-
break;
|
|
20
|
-
case 'RUNNING':
|
|
21
|
-
prefix = '⟳';
|
|
22
|
-
break;
|
|
23
|
-
case 'FAILED':
|
|
24
|
-
prefix = '✗';
|
|
25
|
-
break;
|
|
26
|
-
default:
|
|
27
|
-
prefix = '○';
|
|
28
|
-
}
|
|
29
|
-
return `${prefix} ${step.name}`;
|
|
30
|
-
});
|
|
31
|
-
return tokens.join(' ');
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Poll until a version's validation completes, then check the result.
|
|
35
|
-
* Exits the process on timeout or validation failure.
|
|
36
|
-
* Returns the updated version on success.
|
|
37
|
-
*/
|
|
38
|
-
export async function waitForValidation(versionId, output) {
|
|
39
|
-
const client = new GuildAPIClient();
|
|
40
|
-
const pollResult = await pollUntilComplete({
|
|
41
|
-
resourceId: versionId,
|
|
42
|
-
endpoint: `/versions/${versionId}`,
|
|
43
|
-
isComplete: (response) => response.validation_status !== 'PENDING' &&
|
|
44
|
-
response.validation_status !== 'RUNNING',
|
|
45
|
-
message: 'Waiting for validation to complete...',
|
|
46
|
-
successMessage: 'Validation complete',
|
|
47
|
-
timeoutMessage: 'Validation timed out',
|
|
48
|
-
maxAttempts: 120,
|
|
49
|
-
delayMs: 1000,
|
|
50
|
-
onPoll: async () => {
|
|
51
|
-
const r = await client.get(`/versions/${versionId}/validation/steps`);
|
|
52
|
-
return formatStepProgress(r.steps);
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
if (!pollResult.success || !pollResult.response) {
|
|
56
|
-
output.error('Validation did not complete in time', 'Check status manually:\n guild agent versions');
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
const version = pollResult.response;
|
|
60
|
-
if (version.validation_status === 'FAILED') {
|
|
61
|
-
const details = await fetchValidationFailureDetails(version.id);
|
|
62
|
-
output.error('Validation failed', details);
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
return version;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Fetch validation step details for a failed version.
|
|
69
|
-
* Shows content from all steps (not just failed) so the full build output is visible.
|
|
70
|
-
*/
|
|
71
|
-
async function fetchValidationFailureDetails(versionId) {
|
|
72
|
-
const client = new GuildAPIClient();
|
|
73
|
-
let failureDetails = '';
|
|
74
|
-
try {
|
|
75
|
-
const stepsResponse = await client.get(`/versions/${versionId}/validation/steps`);
|
|
76
|
-
if (stepsResponse.steps.length > 0) {
|
|
77
|
-
failureDetails = stepsResponse.steps
|
|
78
|
-
.map((step) => {
|
|
79
|
-
let icon;
|
|
80
|
-
switch (step.status) {
|
|
81
|
-
case 'SUCCEEDED':
|
|
82
|
-
icon = '✓';
|
|
83
|
-
break;
|
|
84
|
-
case 'FAILED':
|
|
85
|
-
case 'ERRORED':
|
|
86
|
-
icon = '✗';
|
|
87
|
-
break;
|
|
88
|
-
case 'RUNNING':
|
|
89
|
-
icon = '⟳';
|
|
90
|
-
break;
|
|
91
|
-
default:
|
|
92
|
-
icon = '○';
|
|
93
|
-
}
|
|
94
|
-
const header = `${icon} ${step.name} [${step.status}]`;
|
|
95
|
-
return step.content ? `${header}\n${step.content}` : header;
|
|
96
|
-
})
|
|
97
|
-
.join('\n\n');
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
failureDetails = 'No steps found. Check validation logs for details.';
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
104
|
-
failureDetails = 'Could not fetch validation details.';
|
|
105
|
-
}
|
|
106
|
-
failureDetails +=
|
|
107
|
-
'\n\nFix the issues, then save a new version:\n guild agent save --message "Fix validation errors"';
|
|
108
|
-
return failureDetails;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Poll until a version's publish completes (PUBLISHING → PUBLISHED).
|
|
112
|
-
* Exits the process on timeout or failure.
|
|
113
|
-
* Returns the updated version on success.
|
|
114
|
-
*/
|
|
115
|
-
export async function waitForPublish(versionId, output) {
|
|
116
|
-
const client = new GuildAPIClient();
|
|
117
|
-
const pollResult = await pollUntilComplete({
|
|
118
|
-
resourceId: versionId,
|
|
119
|
-
endpoint: `/versions/${versionId}`,
|
|
120
|
-
isComplete: (response) => response.status === 'PUBLISHED' || response.status === 'FAILED',
|
|
121
|
-
message: 'Waiting for publish to complete...',
|
|
122
|
-
successMessage: 'Published',
|
|
123
|
-
timeoutMessage: 'Publish timed out',
|
|
124
|
-
maxAttempts: 60,
|
|
125
|
-
delayMs: 1000,
|
|
126
|
-
onPoll: async () => {
|
|
127
|
-
const r = await client.get(`/versions/${versionId}/publish/steps`);
|
|
128
|
-
return formatStepProgress(r.steps);
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
if (!pollResult.success || pollResult.response?.status !== 'PUBLISHED') {
|
|
132
|
-
output.error('Publish did not complete in time', 'Check status manually:\n guild agent versions');
|
|
133
|
-
process.exit(1);
|
|
134
|
-
}
|
|
135
|
-
return pollResult.response;
|
|
136
|
-
}
|
|
137
|
-
//# sourceMappingURL=version-helpers.js.map
|