@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/event-filter.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* User-facing event types — shown by default (mirrors web UI defaults).
|
|
5
|
-
*/
|
|
6
|
-
export const USER_EVENT_TYPES = [
|
|
7
|
-
'user_message',
|
|
8
|
-
'agent_notification_message',
|
|
9
|
-
'agent_notification_progress',
|
|
10
|
-
'agent_notification_error',
|
|
11
|
-
'credentials_request',
|
|
12
|
-
'agent_install_request',
|
|
13
|
-
'trigger_message',
|
|
14
|
-
'system_error',
|
|
15
|
-
];
|
|
16
|
-
/**
|
|
17
|
-
* System / debug event types — hidden by default (mirrors web UI defaults).
|
|
18
|
-
*/
|
|
19
|
-
export const SYSTEM_EVENT_TYPES = [
|
|
20
|
-
'agent_console',
|
|
21
|
-
'runtime_start',
|
|
22
|
-
'runtime_running',
|
|
23
|
-
'runtime_waiting',
|
|
24
|
-
'runtime_error',
|
|
25
|
-
'runtime_done',
|
|
26
|
-
'llm_start',
|
|
27
|
-
'llm_done',
|
|
28
|
-
];
|
|
29
|
-
/**
|
|
30
|
-
* Default active filter: all user-facing types, no system types.
|
|
31
|
-
*/
|
|
32
|
-
export const DEFAULT_EVENT_TYPES = new Set(USER_EVENT_TYPES);
|
|
33
|
-
/**
|
|
34
|
-
* Parse the value of the `--events` flag into a Set of event type names.
|
|
35
|
-
*
|
|
36
|
-
* Whatever you pass replaces the defaults entirely:
|
|
37
|
-
* - `none` → empty set (no event types shown)
|
|
38
|
-
* - `user` → all USER_EVENT_TYPES (same as default)
|
|
39
|
-
* - `system` → only SYSTEM_EVENT_TYPES
|
|
40
|
-
* - `all` → both USER_EVENT_TYPES + SYSTEM_EVENT_TYPES
|
|
41
|
-
*
|
|
42
|
-
* Comma-separated for fine-grained control:
|
|
43
|
-
* - `agent_console,llm_start` → only those two types
|
|
44
|
-
* - `user,system` → same as `all`
|
|
45
|
-
*/
|
|
46
|
-
export function parseEventFilter(raw) {
|
|
47
|
-
const tokens = raw
|
|
48
|
-
.split(',')
|
|
49
|
-
.map((t) => t.trim())
|
|
50
|
-
.filter(Boolean);
|
|
51
|
-
// `none` returns an empty set — no event types shown
|
|
52
|
-
if (tokens.length === 1 && tokens[0] === 'none') {
|
|
53
|
-
return new Set();
|
|
54
|
-
}
|
|
55
|
-
const result = new Set();
|
|
56
|
-
for (const token of tokens) {
|
|
57
|
-
switch (token) {
|
|
58
|
-
case 'all':
|
|
59
|
-
for (const t of USER_EVENT_TYPES)
|
|
60
|
-
result.add(t);
|
|
61
|
-
for (const t of SYSTEM_EVENT_TYPES)
|
|
62
|
-
result.add(t);
|
|
63
|
-
break;
|
|
64
|
-
case 'user':
|
|
65
|
-
for (const t of USER_EVENT_TYPES)
|
|
66
|
-
result.add(t);
|
|
67
|
-
break;
|
|
68
|
-
case 'system':
|
|
69
|
-
for (const t of SYSTEM_EVENT_TYPES)
|
|
70
|
-
result.add(t);
|
|
71
|
-
break;
|
|
72
|
-
default:
|
|
73
|
-
result.add(token);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Check whether an event should be shown given the active filter.
|
|
80
|
-
*
|
|
81
|
-
* Returns `true` when the event type is in the filter set.
|
|
82
|
-
*
|
|
83
|
-
* Note: certain event types (e.g. `agent_notification_progress`,
|
|
84
|
-
* `agent_notification_message`) drive core UI state (spinner, chat history)
|
|
85
|
-
* and are always processed regardless of the filter; only their *display* is
|
|
86
|
-
* gated here for new/optional event types.
|
|
87
|
-
*/
|
|
88
|
-
export function shouldShowEvent(type, filter) {
|
|
89
|
-
return filter.has(type);
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=event-filter.js.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// =============================================================================
|
|
2
|
-
// AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
|
|
3
|
-
// =============================================================================
|
|
4
|
-
//
|
|
5
|
-
// This file is generated by: cli/scripts/sync-types-from-python.py
|
|
6
|
-
// Run that script after modifying Python enum definitions.
|
|
7
|
-
//
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// Source: python/guildcore/ent_schemas/third_party_service.py -> ThirdPartyService
|
|
10
|
-
export const WEBHOOK_SERVICES = [
|
|
11
|
-
'AZURE_DEVOPS',
|
|
12
|
-
'BITBUCKET',
|
|
13
|
-
'CURL',
|
|
14
|
-
'CYPRESS',
|
|
15
|
-
'GITHUB',
|
|
16
|
-
'GOOGLE_DOCS',
|
|
17
|
-
'GOOGLE_COMPUTE',
|
|
18
|
-
'GOOGLE_LOGGING',
|
|
19
|
-
'JIRA',
|
|
20
|
-
'LINEAR',
|
|
21
|
-
'NEWRELIC',
|
|
22
|
-
'NOTION',
|
|
23
|
-
'SLACK',
|
|
24
|
-
'TESTRAIL',
|
|
25
|
-
'ZENDESK',
|
|
26
|
-
];
|
|
27
|
-
// Source: python/guildcore/ent_schemas/ent_workspace_trigger_time_schema.py -> TimeTriggerFrequency
|
|
28
|
-
export const TIME_TRIGGER_FREQUENCIES = [
|
|
29
|
-
'HOURLY',
|
|
30
|
-
'DAILY',
|
|
31
|
-
'WEEKLY',
|
|
32
|
-
'MONTHLY',
|
|
33
|
-
'CRON',
|
|
34
|
-
];
|
|
35
|
-
// Source: python/guildcore/routes/serializers.py -> EventType
|
|
36
|
-
export const EVENT_TYPES = [
|
|
37
|
-
'user_message',
|
|
38
|
-
'agent_console',
|
|
39
|
-
'runtime_start',
|
|
40
|
-
'runtime_running',
|
|
41
|
-
'runtime_waiting',
|
|
42
|
-
'runtime_error',
|
|
43
|
-
'runtime_done',
|
|
44
|
-
'credentials_request',
|
|
45
|
-
'agent_install_request',
|
|
46
|
-
'agent_notification_message',
|
|
47
|
-
'agent_notification_progress',
|
|
48
|
-
'agent_notification_error',
|
|
49
|
-
'system_error',
|
|
50
|
-
'system_message',
|
|
51
|
-
'trigger_message',
|
|
52
|
-
'interrupted',
|
|
53
|
-
'llm_start',
|
|
54
|
-
'llm_done',
|
|
55
|
-
];
|
|
56
|
-
//# sourceMappingURL=generated-types.js.map
|
package/dist/lib/git.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* Git command utilities for Guild CLI
|
|
5
|
-
*
|
|
6
|
-
* These helpers ensure git commands work reliably in non-interactive environments
|
|
7
|
-
* by preventing interactive prompts and providing clear error messages.
|
|
8
|
-
*/
|
|
9
|
-
import { execa } from 'execa';
|
|
10
|
-
import * as fs from 'fs/promises';
|
|
11
|
-
import * as path from 'path';
|
|
12
|
-
import { debug } from './errors.js';
|
|
13
|
-
/**
|
|
14
|
-
* Error thrown when a git command fails
|
|
15
|
-
*/
|
|
16
|
-
export class GitError extends Error {
|
|
17
|
-
command;
|
|
18
|
-
args;
|
|
19
|
-
stderr;
|
|
20
|
-
stdout;
|
|
21
|
-
exitCode;
|
|
22
|
-
timedOut;
|
|
23
|
-
constructor(command, args, stderr, stdout, exitCode, timedOut) {
|
|
24
|
-
// Use stderr as the primary message, fall back to stdout
|
|
25
|
-
const output = stderr.trim() || stdout.trim();
|
|
26
|
-
const baseMessage = timedOut
|
|
27
|
-
? `Git command timed out: git ${args.join(' ')}`
|
|
28
|
-
: `Git command failed: git ${args.join(' ')}`;
|
|
29
|
-
super(output ? `${baseMessage}\n${output}` : baseMessage);
|
|
30
|
-
this.command = command;
|
|
31
|
-
this.args = args;
|
|
32
|
-
this.stderr = stderr;
|
|
33
|
-
this.stdout = stdout;
|
|
34
|
-
this.exitCode = exitCode;
|
|
35
|
-
this.timedOut = timedOut;
|
|
36
|
-
this.name = 'GitError';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Default timeout for git commands (30 seconds)
|
|
41
|
-
*
|
|
42
|
-
* This is long enough for most operations but short enough to fail fast
|
|
43
|
-
* if something is waiting for interactive input.
|
|
44
|
-
*/
|
|
45
|
-
const DEFAULT_TIMEOUT = 30000;
|
|
46
|
-
/**
|
|
47
|
-
* Longer timeout for network operations (2 minutes)
|
|
48
|
-
*
|
|
49
|
-
* Clone, push, pull, and fetch can take longer over slow connections.
|
|
50
|
-
*/
|
|
51
|
-
const NETWORK_TIMEOUT = 120000;
|
|
52
|
-
/**
|
|
53
|
-
* Git commands that involve network operations
|
|
54
|
-
*/
|
|
55
|
-
const NETWORK_COMMANDS = ['clone', 'push', 'pull', 'fetch'];
|
|
56
|
-
/**
|
|
57
|
-
* Run a git command with non-interactive settings
|
|
58
|
-
*
|
|
59
|
-
* This function:
|
|
60
|
-
* - Sets GIT_TERMINAL_PROMPT=0 to prevent credential prompts from hanging
|
|
61
|
-
* - Applies a timeout to prevent indefinite hangs
|
|
62
|
-
* - Bubbles up errors with the actual git output
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* const { stdout } = await runGit(['status', '--porcelain'], { cwd: '/path/to/repo' });
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* try {
|
|
69
|
-
* await runGit(['commit', '-m', 'message'], { cwd });
|
|
70
|
-
* } catch (error) {
|
|
71
|
-
* if (error instanceof GitError) {
|
|
72
|
-
* console.error('Git failed:', error.message);
|
|
73
|
-
* }
|
|
74
|
-
* }
|
|
75
|
-
*/
|
|
76
|
-
export async function runGit(args, options = {}) {
|
|
77
|
-
const { cwd, timeout: customTimeout, env: extraEnv } = options;
|
|
78
|
-
// Determine timeout based on command type
|
|
79
|
-
const isNetworkCommand = args.length > 0 && NETWORK_COMMANDS.includes(args[0]);
|
|
80
|
-
const timeout = customTimeout ?? (isNetworkCommand ? NETWORK_TIMEOUT : DEFAULT_TIMEOUT);
|
|
81
|
-
debug(`Running git command: git ${args.join(' ')} (timeout: ${timeout}ms)`);
|
|
82
|
-
let result;
|
|
83
|
-
try {
|
|
84
|
-
result = await execa('git', args, {
|
|
85
|
-
cwd,
|
|
86
|
-
timeout,
|
|
87
|
-
reject: false,
|
|
88
|
-
env: {
|
|
89
|
-
...process.env,
|
|
90
|
-
// Prevent git from prompting for credentials - fail fast instead
|
|
91
|
-
GIT_TERMINAL_PROMPT: '0',
|
|
92
|
-
// Prevent SSH from prompting for passwords/passphrases
|
|
93
|
-
GIT_SSH_COMMAND: 'ssh -o BatchMode=yes',
|
|
94
|
-
...extraEnv,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
// Handle timeout errors from execa
|
|
100
|
-
const execaError = error;
|
|
101
|
-
if (execaError.timedOut) {
|
|
102
|
-
throw new GitError('git', args, String(execaError.stderr || ''), String(execaError.stdout || ''), null, true);
|
|
103
|
-
}
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
const stdout = String(result.stdout ?? '');
|
|
107
|
-
const stderr = String(result.stderr ?? '');
|
|
108
|
-
const exitCode = result.exitCode ?? 0;
|
|
109
|
-
// Check for timeout (execa sets timedOut property)
|
|
110
|
-
if (result.timedOut) {
|
|
111
|
-
throw new GitError('git', args, stderr, stdout, null, true);
|
|
112
|
-
}
|
|
113
|
-
// Check for non-zero exit code
|
|
114
|
-
if (exitCode !== 0) {
|
|
115
|
-
throw new GitError('git', args, stderr, stdout, exitCode, false);
|
|
116
|
-
}
|
|
117
|
-
return { stdout, stderr, exitCode };
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Format a GitError for display to the user
|
|
121
|
-
*
|
|
122
|
-
* Returns a user-friendly error message with the git output.
|
|
123
|
-
*/
|
|
124
|
-
export function formatGitError(error) {
|
|
125
|
-
const lines = [];
|
|
126
|
-
if (error.timedOut) {
|
|
127
|
-
lines.push('Git command timed out');
|
|
128
|
-
lines.push('');
|
|
129
|
-
lines.push('This usually means git is waiting for input that cannot be provided.');
|
|
130
|
-
lines.push('Common causes:');
|
|
131
|
-
lines.push(' • GPG signing requires a passphrase - run `gpg --sign` to cache it');
|
|
132
|
-
lines.push(' • SSH key requires a passphrase - run `ssh-add` to cache it');
|
|
133
|
-
lines.push(' • Git credentials are needed - configure a credential helper');
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
lines.push('Git operation failed');
|
|
137
|
-
}
|
|
138
|
-
lines.push('');
|
|
139
|
-
lines.push(`Command: git ${error.args.join(' ')}`);
|
|
140
|
-
if (error.stderr) {
|
|
141
|
-
lines.push('');
|
|
142
|
-
lines.push('Output:');
|
|
143
|
-
lines.push(error.stderr.trim());
|
|
144
|
-
}
|
|
145
|
-
else if (error.stdout) {
|
|
146
|
-
lines.push('');
|
|
147
|
-
lines.push('Output:');
|
|
148
|
-
lines.push(error.stdout.trim());
|
|
149
|
-
}
|
|
150
|
-
if (error.exitCode !== null) {
|
|
151
|
-
lines.push('');
|
|
152
|
-
lines.push(`Exit code: ${error.exitCode}`);
|
|
153
|
-
}
|
|
154
|
-
return lines.join('\n');
|
|
155
|
-
}
|
|
156
|
-
const PRE_PUSH_HOOK = `#!/bin/sh
|
|
157
|
-
if [ "$GUILD_AGENT_SAVE" != "1" ]; then
|
|
158
|
-
echo "Please use \\\`guild agent save\\\` to push."
|
|
159
|
-
exit 1
|
|
160
|
-
fi
|
|
161
|
-
exit 0
|
|
162
|
-
`;
|
|
163
|
-
/**
|
|
164
|
-
* Install a pre-push hook that blocks direct git push.
|
|
165
|
-
*
|
|
166
|
-
* The hook allows pushes only when the GUILD_AGENT_SAVE env var is set,
|
|
167
|
-
* which guild agent save sets automatically.
|
|
168
|
-
*/
|
|
169
|
-
export async function installPrePushHook(targetDir) {
|
|
170
|
-
const hooksDir = path.join(targetDir, '.git', 'hooks');
|
|
171
|
-
await fs.mkdir(hooksDir, { recursive: true });
|
|
172
|
-
await fs.writeFile(path.join(hooksDir, 'pre-push'), PRE_PUSH_HOOK, {
|
|
173
|
-
mode: 0o755,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
//# sourceMappingURL=git.js.map
|
package/dist/lib/gk.js
DELETED
|
@@ -1,91 +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 axios from 'axios';
|
|
6
|
-
import { getGlobalConfigDir } from './guild-config.js';
|
|
7
|
-
import { getGuildcoreUrl } from './config.js';
|
|
8
|
-
import { getAuthToken } from './auth.js';
|
|
9
|
-
import { getIapHeaders } from './iap.js';
|
|
10
|
-
import { debug } from './errors.js';
|
|
11
|
-
const GK_CACHE_FILE = 'gk-cache.json';
|
|
12
|
-
const GK_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
13
|
-
function getCachePath() {
|
|
14
|
-
return path.join(getGlobalConfigDir(), GK_CACHE_FILE);
|
|
15
|
-
}
|
|
16
|
-
async function readCache(host) {
|
|
17
|
-
try {
|
|
18
|
-
const content = await fs.readFile(getCachePath(), 'utf-8');
|
|
19
|
-
const entry = JSON.parse(content);
|
|
20
|
-
if (entry.host === host && Date.now() - entry.ts < GK_CACHE_TTL_MS) {
|
|
21
|
-
debug('GK cache hit for %s', host);
|
|
22
|
-
return entry.gks;
|
|
23
|
-
}
|
|
24
|
-
debug('GK cache stale or host mismatch');
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
debug('GK cache not found or unreadable');
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
async function writeCache(host, gks) {
|
|
32
|
-
const configDir = getGlobalConfigDir();
|
|
33
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
34
|
-
await fs.writeFile(getCachePath(), JSON.stringify({ gks, ts: Date.now(), host }));
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Fetch the set of GK names enabled for the current user.
|
|
38
|
-
*
|
|
39
|
-
* Returns null when the enabled set cannot be determined (not authenticated,
|
|
40
|
-
* network error, etc.). Callers should treat null as "show everything" (fail-open).
|
|
41
|
-
*/
|
|
42
|
-
export async function getEnabledGKs() {
|
|
43
|
-
const token = await getAuthToken();
|
|
44
|
-
if (!token) {
|
|
45
|
-
debug('Not authenticated, skipping GK fetch');
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
const baseUrl = getGuildcoreUrl();
|
|
49
|
-
let host;
|
|
50
|
-
try {
|
|
51
|
-
host = new URL(baseUrl).host;
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
const cached = await readCache(host);
|
|
57
|
-
if (cached) {
|
|
58
|
-
return new Set(cached);
|
|
59
|
-
}
|
|
60
|
-
try {
|
|
61
|
-
const iapHeaders = await getIapHeaders(baseUrl);
|
|
62
|
-
const response = await axios.get(`${baseUrl}/gks/enabled`, {
|
|
63
|
-
headers: {
|
|
64
|
-
...iapHeaders,
|
|
65
|
-
Authorization: `Bearer ${token}`,
|
|
66
|
-
Accept: 'application/json',
|
|
67
|
-
},
|
|
68
|
-
timeout: 5000,
|
|
69
|
-
});
|
|
70
|
-
const gkNames = response.data.gks.map((g) => g.name);
|
|
71
|
-
await writeCache(host, gkNames);
|
|
72
|
-
debug('Fetched %d enabled GKs', gkNames.length);
|
|
73
|
-
return new Set(gkNames);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
debug('Failed to fetch GKs: %s', error);
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Check whether a specific GK is enabled for the current user.
|
|
82
|
-
*
|
|
83
|
-
* When enabledGKs is null (could not be determined), returns true (fail-open)
|
|
84
|
-
* so that commands are not hidden due to transient errors.
|
|
85
|
-
*/
|
|
86
|
-
export function isGKEnabled(gk, enabledGKs) {
|
|
87
|
-
if (!enabledGKs)
|
|
88
|
-
return true;
|
|
89
|
-
return enabledGKs.has(gk);
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=gk.js.map
|
package/dist/lib/guild-config.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Guild.ai
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* Guild Configuration
|
|
5
|
-
*
|
|
6
|
-
* Unified config loading for local (guild.json) and global (~/.guild/config.json) configs.
|
|
7
|
-
*
|
|
8
|
-
* Priority for workspace resolution:
|
|
9
|
-
* 1. Explicit --workspace flag (not handled here, handled by commands)
|
|
10
|
-
* 2. GUILD_WORKSPACE_ID environment variable
|
|
11
|
-
* 3. Local guild.json workspace_id (agent-specific workspace)
|
|
12
|
-
* 4. Global ~/.guild/config.json default_workspace
|
|
13
|
-
* 5. First workspace from API (fallback)
|
|
14
|
-
*/
|
|
15
|
-
import * as fs from 'fs/promises';
|
|
16
|
-
import * as path from 'path';
|
|
17
|
-
import * as os from 'os';
|
|
18
|
-
import { debug } from './errors.js';
|
|
19
|
-
const GLOBAL_CONFIG_DIR = '.guild';
|
|
20
|
-
const GLOBAL_CONFIG_FILE = 'config.json';
|
|
21
|
-
const LOCAL_CONFIG_FILE = 'guild.json';
|
|
22
|
-
/**
|
|
23
|
-
* Get path to global config directory
|
|
24
|
-
*/
|
|
25
|
-
export function getGlobalConfigDir() {
|
|
26
|
-
return path.join(os.homedir(), GLOBAL_CONFIG_DIR);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get path to global config file
|
|
30
|
-
*/
|
|
31
|
-
export function getGlobalConfigPath() {
|
|
32
|
-
return path.join(getGlobalConfigDir(), GLOBAL_CONFIG_FILE);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get path to local config file in specified directory
|
|
36
|
-
*/
|
|
37
|
-
export function getLocalConfigPath(cwd = process.cwd()) {
|
|
38
|
-
return path.join(cwd, LOCAL_CONFIG_FILE);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if a file exists
|
|
42
|
-
*/
|
|
43
|
-
async function fileExists(filePath) {
|
|
44
|
-
return fs
|
|
45
|
-
.access(filePath)
|
|
46
|
-
.then(() => true)
|
|
47
|
-
.catch(() => false);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Load global config from ~/.guild/config.json
|
|
51
|
-
*
|
|
52
|
-
* @returns GlobalConfig or undefined if not found
|
|
53
|
-
*/
|
|
54
|
-
export async function loadGlobalConfig() {
|
|
55
|
-
const configPath = getGlobalConfigPath();
|
|
56
|
-
if (!(await fileExists(configPath))) {
|
|
57
|
-
debug('Global config not found at %s', configPath);
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
try {
|
|
61
|
-
const content = await fs.readFile(configPath, 'utf-8');
|
|
62
|
-
const config = JSON.parse(content);
|
|
63
|
-
debug('Loaded global config: %O', config);
|
|
64
|
-
return config;
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
debug('Failed to parse global config: %s', error);
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Load local config from guild.json in specified directory
|
|
73
|
-
*
|
|
74
|
-
* @param cwd Directory to look in (defaults to process.cwd())
|
|
75
|
-
* @returns LocalConfig or undefined if not found
|
|
76
|
-
*/
|
|
77
|
-
export async function loadLocalConfig(cwd = process.cwd()) {
|
|
78
|
-
const configPath = getLocalConfigPath(cwd);
|
|
79
|
-
if (!(await fileExists(configPath))) {
|
|
80
|
-
debug('Local config not found at %s', configPath);
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
try {
|
|
84
|
-
const content = await fs.readFile(configPath, 'utf-8');
|
|
85
|
-
const config = JSON.parse(content);
|
|
86
|
-
debug('Loaded local config: %O', config);
|
|
87
|
-
return config;
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
debug('Failed to parse local config: %s', error);
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Load both local and global configs
|
|
96
|
-
*
|
|
97
|
-
* @param cwd Directory to look for local config (defaults to process.cwd())
|
|
98
|
-
* @returns ResolvedConfig with local and global configs (either may be undefined)
|
|
99
|
-
*/
|
|
100
|
-
export async function loadConfig(cwd = process.cwd()) {
|
|
101
|
-
const [local, global] = await Promise.all([loadLocalConfig(cwd), loadGlobalConfig()]);
|
|
102
|
-
return { local, global };
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Save global config to ~/.guild/config.json
|
|
106
|
-
*
|
|
107
|
-
* @param config Config to save (merged with existing config)
|
|
108
|
-
*/
|
|
109
|
-
export async function saveGlobalConfig(config) {
|
|
110
|
-
const configDir = getGlobalConfigDir();
|
|
111
|
-
const configPath = getGlobalConfigPath();
|
|
112
|
-
// Ensure directory exists
|
|
113
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
114
|
-
// Load existing config and merge
|
|
115
|
-
const existing = (await loadGlobalConfig()) || {};
|
|
116
|
-
const merged = { ...existing, ...config };
|
|
117
|
-
// Write config
|
|
118
|
-
await fs.writeFile(configPath, JSON.stringify(merged, null, 2) + '\n');
|
|
119
|
-
debug('Saved global config: %O', merged);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Get the workspace ID to use, with proper priority.
|
|
123
|
-
*
|
|
124
|
-
* Priority (--workspace flag is handled by commands before calling this):
|
|
125
|
-
* 1. GUILD_WORKSPACE_ID environment variable
|
|
126
|
-
* 2. Local guild.json workspace_id (if in agent directory with workspace set)
|
|
127
|
-
* 3. Global ~/.guild/config.json default_workspace
|
|
128
|
-
* 4. undefined (caller should handle fallback)
|
|
129
|
-
*
|
|
130
|
-
* @param cwd Directory to look for local config
|
|
131
|
-
* @returns Workspace ID and source, or undefined
|
|
132
|
-
*/
|
|
133
|
-
export async function getWorkspaceId(cwd = process.cwd()) {
|
|
134
|
-
// Priority 1: Environment variable override
|
|
135
|
-
if (process.env.GUILD_WORKSPACE_ID) {
|
|
136
|
-
debug('Using workspace from GUILD_WORKSPACE_ID env var: %s', process.env.GUILD_WORKSPACE_ID);
|
|
137
|
-
return { workspaceId: process.env.GUILD_WORKSPACE_ID, source: 'env' };
|
|
138
|
-
}
|
|
139
|
-
const config = await loadConfig(cwd);
|
|
140
|
-
// Priority 2: Local workspace_id
|
|
141
|
-
if (config.local?.workspace_id) {
|
|
142
|
-
debug('Using workspace from local config: %s', config.local.workspace_id);
|
|
143
|
-
return { workspaceId: config.local.workspace_id, source: 'local' };
|
|
144
|
-
}
|
|
145
|
-
// Priority 3: Global default_workspace
|
|
146
|
-
if (config.global?.default_workspace) {
|
|
147
|
-
debug('Using workspace from global config: %s', config.global.default_workspace);
|
|
148
|
-
return { workspaceId: config.global.default_workspace, source: 'global' };
|
|
149
|
-
}
|
|
150
|
-
debug('No workspace configured in local or global config');
|
|
151
|
-
return undefined;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Check if we're in an agent directory (has guild.json)
|
|
155
|
-
*/
|
|
156
|
-
export async function isAgentDirectory(cwd = process.cwd()) {
|
|
157
|
-
return fileExists(getLocalConfigPath(cwd));
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Get a human-readable label for the workspace source.
|
|
161
|
-
* Returns undefined for 'env' (treated as explicit, like --workspace flag; no label needed).
|
|
162
|
-
*
|
|
163
|
-
* @param source - The source of workspace resolution
|
|
164
|
-
* @returns Human-readable label, or undefined for env source
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* getWorkspaceSourceLabel('local') // → 'guild.json'
|
|
168
|
-
* getWorkspaceSourceLabel('global') // → 'global config'
|
|
169
|
-
* getWorkspaceSourceLabel('env') // → undefined
|
|
170
|
-
*/
|
|
171
|
-
export function getWorkspaceSourceLabel(source) {
|
|
172
|
-
if (source === 'local')
|
|
173
|
-
return 'guild.json';
|
|
174
|
-
if (source === 'global')
|
|
175
|
-
return 'global config';
|
|
176
|
-
return undefined; // 'env' is explicit (GUILD_WORKSPACE_ID), no magic label needed
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=guild-config.js.map
|