@shardflux/cli 0.19.1 → 0.22.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/CHANGELOG.md +278 -1
- package/README.md +225 -73
- package/dist/account-args.js +7 -2
- package/dist/account-commands.js +56 -106
- package/dist/account-pool.d.ts +20 -15
- package/dist/account-pool.js +51 -97
- package/dist/account-scope.d.ts +65 -0
- package/dist/account-scope.js +246 -0
- package/dist/acp-login.d.ts +4 -3
- package/dist/acp-login.js +7 -5
- package/dist/acp-models.js +20 -15
- package/dist/acp.js +66 -13
- package/dist/agent-commands.d.ts +4 -1
- package/dist/agent-commands.js +86 -32
- package/dist/agent-config-files.d.ts +19 -0
- package/dist/agent-config-files.js +70 -1
- package/dist/agent-config-return.d.ts +194 -0
- package/dist/agent-config-return.js +724 -0
- package/dist/agent-config-sync.d.ts +10 -2
- package/dist/agent-config-sync.js +45 -51
- package/dist/agent-credentials.js +7 -3
- package/dist/agent-repository.d.ts +16 -3
- package/dist/agent-repository.js +149 -74
- package/dist/agent-setup.d.ts +14 -3
- package/dist/agent-setup.js +78 -36
- package/dist/agent-target-commands.js +24 -13
- package/dist/args.d.ts +1 -1
- package/dist/args.js +104 -55
- package/dist/bin.js +5 -1
- package/dist/browser.d.ts +13 -2
- package/dist/browser.js +30 -14
- package/dist/claude-cloud-login.d.ts +24 -2
- package/dist/claude-cloud-login.js +151 -11
- package/dist/cli-proxy-forward.d.ts +2 -0
- package/dist/cli-proxy-forward.js +9 -2
- package/dist/cli-proxy-hub.d.ts +69 -25
- package/dist/cli-proxy-hub.js +231 -54
- package/dist/cli-proxy.d.ts +70 -1
- package/dist/cli-proxy.js +298 -32
- package/dist/client-settings.d.ts +39 -0
- package/dist/client-settings.js +91 -0
- package/dist/codex-cloud.d.ts +5 -0
- package/dist/codex-cloud.js +88 -17
- package/dist/command-center-actions.js +5 -1
- package/dist/commands.js +171 -22
- package/dist/conversation-commands.d.ts +5 -0
- package/dist/conversation-commands.js +8 -5
- package/dist/conversation-terminal.d.ts +10 -2
- package/dist/conversation-terminal.js +81 -15
- package/dist/conversations.d.ts +77 -1
- package/dist/conversations.js +257 -23
- package/dist/device-bridge.d.ts +1 -1
- package/dist/device-bridge.js +6 -4
- package/dist/device-helper.js +52 -4
- package/dist/errors.d.ts +34 -1
- package/dist/errors.js +56 -5
- package/dist/filesystem-commands.d.ts +22 -3
- package/dist/filesystem-commands.js +132 -16
- package/dist/format.d.ts +2 -1
- package/dist/format.js +10 -1
- package/dist/handlers.js +4 -1
- package/dist/initial-prompt.d.ts +8 -0
- package/dist/initial-prompt.js +43 -1
- package/dist/large-media.d.ts +14 -0
- package/dist/large-media.js +100 -0
- package/dist/linux-terminal.d.ts +5 -3
- package/dist/linux-terminal.js +6 -20
- package/dist/local-sessions.d.ts +26 -2
- package/dist/local-sessions.js +113 -24
- package/dist/machine-setup.d.ts +190 -0
- package/dist/machine-setup.js +849 -0
- package/dist/machine-status.d.ts +67 -0
- package/dist/machine-status.js +140 -0
- package/dist/main.js +23 -13
- package/dist/move-worktrees-restore.py +144 -0
- package/dist/move-worktrees.d.ts +63 -0
- package/dist/move-worktrees.js +201 -0
- package/dist/move.d.ts +10 -1
- package/dist/move.js +116 -16
- package/dist/onboarding.d.ts +11 -7
- package/dist/onboarding.js +59 -27
- package/dist/prepared-repository.d.ts +202 -0
- package/dist/prepared-repository.js +860 -0
- package/dist/prepared-repository.py +1306 -0
- package/dist/project-preparation.d.ts +48 -0
- package/dist/project-preparation.js +304 -0
- package/dist/project-sync-manifest.d.ts +4 -0
- package/dist/project-sync-manifest.js +5 -1
- package/dist/project-sync-transfer.js +1 -1
- package/dist/project-sync.d.ts +19 -4
- package/dist/project-sync.js +31 -8
- package/dist/project-template-setup.d.ts +33 -1
- package/dist/project-template-setup.js +59 -2
- package/dist/secret-ask.d.ts +72 -0
- package/dist/secret-ask.js +351 -0
- package/dist/seed-phases.d.ts +13 -3
- package/dist/seed-phases.js +21 -3
- package/dist/setup-cache.d.ts +7 -0
- package/dist/setup-cache.js +32 -0
- package/dist/t3-launch.js +1 -4
- package/dist/t3-mode.d.ts +8 -2
- package/dist/t3-mode.js +19 -4
- package/dist/t3-phone.d.ts +4 -2
- package/dist/t3-phone.js +12 -4
- package/dist/terminal-apps.d.ts +157 -0
- package/dist/terminal-apps.js +561 -0
- package/dist/terminal-onboarding.d.ts +2 -0
- package/dist/terminal-onboarding.js +11 -1
- package/dist/this-computer.d.ts +11 -0
- package/dist/this-computer.js +36 -0
- package/dist/thread-on-computer.js +4 -1
- package/dist/update.js +11 -3
- package/dist/worktree-twin.d.ts +10 -2
- package/dist/worktree-twin.js +27 -9
- package/package.json +5 -5
package/dist/t3-mode.js
CHANGED
|
@@ -35,8 +35,11 @@ import { T3_THREAD_SCRIPT } from "./t3-thread-script.js";
|
|
|
35
35
|
import { t3InstallScript } from "./t3-runtime.js";
|
|
36
36
|
import { uploadInitialImages } from "./initial-prompt.js";
|
|
37
37
|
export const T3_BUNDLE_ID = 'com.t3tools.t3code';
|
|
38
|
-
/**
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Where each app's new conversations can open: Claude in a terminal app, Claude Desktop, claude.ai or T3; Codex in the
|
|
40
|
+
* Codex app, a terminal app (0.21.1+ on macOS) or T3. `agents targets --json` reports them as `open_in_targets`.
|
|
41
|
+
*/
|
|
42
|
+
export const OPEN_IN_TARGETS = { claude: ['terminal', 'claude-desktop', 'web', 't3'], codex: ['codex-app', 'terminal', 't3'] };
|
|
40
43
|
export const openInTargets = (app, platform = process.platform) => platform === 'linux' && app === 'codex' ? ['terminal', 't3'] : OPEN_IN_TARGETS[app];
|
|
41
44
|
/** T3 0.0.45's built-in defaults (DEFAULT_MODEL_BY_PROVIDER), used only when T3 in the VM has not described its models yet. */
|
|
42
45
|
const T3_DEFAULT_MODEL = { claude: 'claude-fable-5-1', codex: 'gpt-6-astra' };
|
|
@@ -173,10 +176,22 @@ export function openInChoices(ctx, project, known = {}) {
|
|
|
173
176
|
return { claude: choices.claude.target, codex: choices.codex.target };
|
|
174
177
|
}
|
|
175
178
|
const available = (target, status, clients) => target === 't3' ? status.installed : target === 'claude-desktop' ? clients.includes('claude-desktop') : true;
|
|
176
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* `--open-in claude=t3,codex=t3`: validated against what is installed, then saved in agents.json. A bare target
|
|
181
|
+
* (`--open-in terminal`, 0.20.1+) is the choice of every app that opens there (terminal: Claude and Codex).
|
|
182
|
+
*/
|
|
177
183
|
export function saveOpenIn(ctx, spec, status, clients) {
|
|
178
184
|
const choices = {};
|
|
179
|
-
|
|
185
|
+
const apps = ['claude', 'codex'];
|
|
186
|
+
const parts = spec.split(',').map(s => s.trim()).filter(Boolean).flatMap(part => {
|
|
187
|
+
if (part.includes('='))
|
|
188
|
+
return [part];
|
|
189
|
+
const fits = apps.filter(app => openInTargets(app).includes(part));
|
|
190
|
+
if (!fits.length)
|
|
191
|
+
throw new UsageError(`--open-in: a target is one of ${[...new Set(apps.flatMap(app => openInTargets(app)))].join(', ')}, or app=target pairs such as claude=t3,codex=t3.`);
|
|
192
|
+
return fits.map(app => `${app}=${part}`);
|
|
193
|
+
});
|
|
194
|
+
for (const part of parts) {
|
|
180
195
|
const [app, target, extra] = part.split('=').map(s => s.trim());
|
|
181
196
|
if (app !== 'claude' && app !== 'codex' || !target || extra !== undefined)
|
|
182
197
|
throw new UsageError('--open-in takes app=target pairs, e.g. claude=t3,codex=t3.');
|
package/dist/t3-phone.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface T3PhoneLink {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Links a workspace for the T3 app on the phone (0.17.0+). An API key links with its creator's sign-in; starting that
|
|
15
|
-
* sign-in takes the person's own session, so the sign-in comes from `shard`'s session when the key has none yet.
|
|
15
|
+
* sign-in takes the person's own session, so the sign-in comes from `shard`'s session when the key has none yet. That
|
|
16
|
+
* sign-in is for the workspace's organization: `projectId` (the workspace's project) scopes it, which a person in more
|
|
17
|
+
* than one organization needs (0.20.2+; without it the API answers 422 project_id is required).
|
|
16
18
|
*/
|
|
17
|
-
export declare function t3PhoneLink(ctx: Ctx, workspaceId: string): Promise<T3PhoneLink>;
|
|
19
|
+
export declare function t3PhoneLink(ctx: Ctx, workspaceId: string, projectId?: string): Promise<T3PhoneLink>;
|
package/dist/t3-phone.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { t3NeedsProject } from "./account-scope.js";
|
|
1
2
|
/**
|
|
2
3
|
* Links a workspace for the T3 app on the phone (0.17.0+). An API key links with its creator's sign-in; starting that
|
|
3
|
-
* sign-in takes the person's own session, so the sign-in comes from `shard`'s session when the key has none yet.
|
|
4
|
+
* sign-in takes the person's own session, so the sign-in comes from `shard`'s session when the key has none yet. That
|
|
5
|
+
* sign-in is for the workspace's organization: `projectId` (the workspace's project) scopes it, which a person in more
|
|
6
|
+
* than one organization needs (0.20.2+; without it the API answers 422 project_id is required).
|
|
4
7
|
*/
|
|
5
|
-
export async function t3PhoneLink(ctx, workspaceId) {
|
|
8
|
+
export async function t3PhoneLink(ctx, workspaceId, projectId) {
|
|
6
9
|
const link = await ctx.cloud().t3.link(workspaceId);
|
|
7
10
|
if (link.status !== 'needs_sign_in')
|
|
8
11
|
return { link };
|
|
@@ -10,6 +13,11 @@ export async function t3PhoneLink(ctx, workspaceId) {
|
|
|
10
13
|
return { link, signIn: link.sign_in };
|
|
11
14
|
if (ctx.store.profile(ctx.apiUrl).session?.state !== 'active')
|
|
12
15
|
return { link, needsLogin: true };
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
try {
|
|
17
|
+
const flow = await ctx.account().t3.signIn(projectId ? { projectId } : {});
|
|
18
|
+
return { link, signIn: flow };
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
throw t3NeedsProject(error) ?? error;
|
|
22
|
+
}
|
|
15
23
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { Ctx, Io } from './commands.js';
|
|
2
|
+
export declare const TERMINAL_IDS: readonly ["ghostty", "iterm", "terminal", "wezterm", "kitty", "alacritty", "warp"];
|
|
3
|
+
export type TerminalId = typeof TERMINAL_IDS[number];
|
|
4
|
+
export type TerminalMode = 'tab' | 'window';
|
|
5
|
+
export interface TerminalChoice {
|
|
6
|
+
id: TerminalId;
|
|
7
|
+
mode: TerminalMode;
|
|
8
|
+
}
|
|
9
|
+
type Env = Record<string, string | undefined>;
|
|
10
|
+
export declare const terminalName: (id: TerminalId) => string;
|
|
11
|
+
/** The terminals this platform can open conversations in (iTerm2 is macOS only). */
|
|
12
|
+
export declare const platformTerminals: (platform?: NodeJS.Platform) => TerminalId[];
|
|
13
|
+
export declare const tabSupported: (id: TerminalId, platform?: NodeJS.Platform) => boolean;
|
|
14
|
+
/** One terminal on this computer: its app bundle (macOS) or program (Linux), whether it runs now and opens tabs. */
|
|
15
|
+
export interface TerminalInfo {
|
|
16
|
+
id: TerminalId;
|
|
17
|
+
name: string;
|
|
18
|
+
installed: boolean;
|
|
19
|
+
running: boolean;
|
|
20
|
+
tab_supported: boolean;
|
|
21
|
+
path: string | null;
|
|
22
|
+
}
|
|
23
|
+
/** Native lookups and launches; tests replace them (no osascript, no terminal ever starts in a test). */
|
|
24
|
+
export declare const terminalNative: {
|
|
25
|
+
/** A short program's result; `code` is null when it did not start or ran out of time. */
|
|
26
|
+
run(command: string, args: string[], opts: {
|
|
27
|
+
env: Env;
|
|
28
|
+
input?: string;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
cwd?: string;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
code: number | null;
|
|
33
|
+
stdout: string;
|
|
34
|
+
stderr: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Starts a program that outlives shard (a new terminal window): true once it started. */
|
|
37
|
+
start(command: string, args: string[], opts: {
|
|
38
|
+
env: Env;
|
|
39
|
+
cwd?: string;
|
|
40
|
+
}): Promise<boolean>;
|
|
41
|
+
/** Running processes: executable paths on macOS, program names on Linux (one `ps`). */
|
|
42
|
+
processes(env: Env): string[];
|
|
43
|
+
/** App bundles with these bundle ids anywhere Spotlight knows (macOS), one query. */
|
|
44
|
+
spotlight(bundles: readonly string[], env: Env): string[];
|
|
45
|
+
/** CFBundleShortVersionString of an app bundle. */
|
|
46
|
+
appVersion(path: string): string | null;
|
|
47
|
+
writeFile(file: string, text: string): void;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The terminals this platform can use, installed or not. macOS: app bundles in the app folders (applicationDirs, and
|
|
51
|
+
* the system's Utilities folder) and, with `spotlight`, anywhere Spotlight finds their bundle ids; Terminal.app is part
|
|
52
|
+
* of macOS. SHARDFLUX_APPLICATIONS_DIRS (tests) replaces every folder and turns Spotlight off. Linux: programs on PATH;
|
|
53
|
+
* `terminal` is the default terminal ($TERMINAL, x-terminal-emulator, gnome-terminal).
|
|
54
|
+
*/
|
|
55
|
+
export declare function detectTerminals(env: Env, platform?: NodeJS.Platform, opts?: {
|
|
56
|
+
spotlight?: boolean;
|
|
57
|
+
}): TerminalInfo[];
|
|
58
|
+
/** The terminal a command runs in: TERM_PROGRAM, the terminals' own variables, then the app that started it. */
|
|
59
|
+
export declare function currentTerminal(env: Env): TerminalId | null;
|
|
60
|
+
/** The choice saved with `agents targets --terminal`, or null (auto). */
|
|
61
|
+
export declare function storedTerminal(dir: string): TerminalChoice | null;
|
|
62
|
+
/**
|
|
63
|
+
* `--terminal <app>[:tab|:window]` checked against this computer: null for `auto` (clears the choice). A terminal that
|
|
64
|
+
* opens only windows takes `<app>` or `<app>:window`; without a mode, a tab where the app opens tabs.
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseTerminalChoice(spec: string, terminals: readonly TerminalInfo[], platform?: NodeJS.Platform): TerminalChoice | null;
|
|
67
|
+
export declare function saveTerminalChoice(dir: string, choice: TerminalChoice | null): void;
|
|
68
|
+
/** Where a terminal conversation opens now: the saved choice while installed, else the terminal this runs in, else a
|
|
69
|
+
* running terminal, else Terminal.app (macOS) or the default terminal (Linux). null when the computer has none. */
|
|
70
|
+
export declare function effectiveTerminal(stored: TerminalChoice | null, terminals: readonly TerminalInfo[], env: Env): (TerminalChoice & {
|
|
71
|
+
saved: boolean;
|
|
72
|
+
}) | null;
|
|
73
|
+
/** The terminal part of `agents targets --json` (0.20.1+). */
|
|
74
|
+
export declare function terminalReport(dir: string, env: Env, terminals: readonly TerminalInfo[]): {
|
|
75
|
+
terminal_app: TerminalChoice | null;
|
|
76
|
+
terminal: {
|
|
77
|
+
name: string;
|
|
78
|
+
id: TerminalId;
|
|
79
|
+
mode: TerminalMode;
|
|
80
|
+
saved: boolean;
|
|
81
|
+
} | null;
|
|
82
|
+
current_terminal: "terminal" | "ghostty" | "iterm" | "wezterm" | "kitty" | "alacritty" | "warp" | null;
|
|
83
|
+
terminals: {
|
|
84
|
+
id: "terminal" | "ghostty" | "iterm" | "wezterm" | "kitty" | "alacritty" | "warp";
|
|
85
|
+
name: string;
|
|
86
|
+
installed: boolean;
|
|
87
|
+
running: boolean;
|
|
88
|
+
tab_supported: boolean;
|
|
89
|
+
path: string | null;
|
|
90
|
+
}[];
|
|
91
|
+
};
|
|
92
|
+
/** A shell word, quoted only when it needs it (the line shows in the person's terminal). */
|
|
93
|
+
export declare const shellWord: (s: string) => string;
|
|
94
|
+
/** The command as typed: with this computer's config folder when it is not the default (an app's own, a test's). */
|
|
95
|
+
export declare function commandLine(argv: readonly string[], env: Env): string;
|
|
96
|
+
/** What a shell in a new tab types: into the project folder, then the command. */
|
|
97
|
+
export declare const typedLine: (argv: readonly string[], cwd: string, env: Env) => string;
|
|
98
|
+
/** A new window's own command (Linux, Alacritty): it keeps the window open on an error so the person can read it. */
|
|
99
|
+
export declare function windowCommand(argv: readonly string[], cwd: string, env: Env): string[];
|
|
100
|
+
/** An AppleScript string literal. */
|
|
101
|
+
export declare const appleString: (s: string) => string;
|
|
102
|
+
/**
|
|
103
|
+
* The AppleScript that opens `command` in `cwd` in a new shell of Ghostty, iTerm2 or Terminal.app. A tab goes in the
|
|
104
|
+
* front window; with no window, or `window`, a new window. An app this script starts uses the window it opens with.
|
|
105
|
+
*/
|
|
106
|
+
export declare function appleScript(id: 'ghostty' | 'iterm' | 'terminal', mode: TerminalMode, command: string, cwd: string): string;
|
|
107
|
+
/** Warp's tab config for one conversation (`warp://tab_config/shardflux`). */
|
|
108
|
+
export declare function warpTabConfig(argv: readonly string[], cwd: string, env: Env): string;
|
|
109
|
+
export declare function warpTabConfigFile(env: Env, platform?: NodeJS.Platform): string;
|
|
110
|
+
/** kitty's remote-control socket: KITTY_LISTEN_ON, else `listen_on` in kitty.conf (kitty adds -<pid> to a unix path). */
|
|
111
|
+
export declare function kittySocket(env: Env, platform?: NodeJS.Platform): string | null;
|
|
112
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
113
|
+
/** `opened`: where it opened (`fallback_from` and `reason` when not in the chosen app); else why nothing opened. */
|
|
114
|
+
export interface TerminalOpen {
|
|
115
|
+
opened: boolean;
|
|
116
|
+
app: TerminalId | null;
|
|
117
|
+
mode: TerminalMode | null;
|
|
118
|
+
command: string[];
|
|
119
|
+
fallback_from?: TerminalId;
|
|
120
|
+
reason?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Opens `argv` in the person's terminal app, in `cwd`: the chosen app (effectiveTerminal) as a tab, or a window with
|
|
124
|
+
* `window`; when it fails, the other running terminals, then Terminal.app or the Linux default terminal.
|
|
125
|
+
*/
|
|
126
|
+
export declare function openInTerminal(dir: string, env: Env, argv: readonly string[], opts: {
|
|
127
|
+
cwd: string;
|
|
128
|
+
window?: boolean;
|
|
129
|
+
platform?: NodeJS.Platform;
|
|
130
|
+
}): Promise<TerminalOpen>;
|
|
131
|
+
/** "Opened in Ghostty (new tab)." and, when it fell back, the reason on its own line. */
|
|
132
|
+
export declare function openedText(result: TerminalOpen): {
|
|
133
|
+
line: string;
|
|
134
|
+
note?: string;
|
|
135
|
+
};
|
|
136
|
+
/** The runnable command that opens a conversation: this shard (an app's own Node.js and script) when it is not the
|
|
137
|
+
* `shard` on PATH, with its API. */
|
|
138
|
+
export declare function shardArgv(runtime: {
|
|
139
|
+
node: string;
|
|
140
|
+
script: string;
|
|
141
|
+
} | null, apiUrl: string, words: readonly string[], env: Env): string[];
|
|
142
|
+
/** A terminal a person types into: not a pipe, and not a coding agent's shell (a PTY nobody types into, 0.17.1+). */
|
|
143
|
+
export declare const attachable: (io: Pick<Io, "stdin" | "stdout" | "env">) => boolean;
|
|
144
|
+
/**
|
|
145
|
+
* The local folder a conversation or agent belongs to, where its terminal tab starts: the conversation's record, the
|
|
146
|
+
* Git agent's repository, else the current folder (the home folder for an app, whose folder is /).
|
|
147
|
+
*/
|
|
148
|
+
export declare function referenceFolder(dir: string, apiUrl: string, ref: string, env: Env): string;
|
|
149
|
+
/** `--json`: `{target: 'terminal', opened, app, mode, command, fallback_from?, reason?}`; text: where it opened, the
|
|
150
|
+
* reason it fell back on stderr, and with nothing opened the runnable command. */
|
|
151
|
+
export declare function reportTerminalOpen(ctx: Pick<Ctx, 'io' | 'json'>, result: TerminalOpen, extra?: Record<string, unknown>): void;
|
|
152
|
+
/** Opens `shard <words>` (a conversation's attach) in the person's terminal app, in `cwd`. */
|
|
153
|
+
export declare function openShardInTerminal(ctx: Pick<Ctx, 'runtime' | 'apiUrl' | 'io' | 'store'>, words: readonly string[], opts: {
|
|
154
|
+
cwd: string;
|
|
155
|
+
window?: boolean;
|
|
156
|
+
}): Promise<TerminalOpen>;
|
|
157
|
+
export {};
|