@shardflux/cli 0.14.3 → 0.14.4

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.4
4
+
5
+ - `shard <path> --codex` and `--claude` choose the agent like `shard <path> codex` and `claude`. An unknown option or app on `shard <path>` names the right form, e.g. `shard ./ codex`.
6
+
3
7
  ## 0.14.3
4
8
 
5
9
  - Poll device requests and deliver approvals independently of transcript mirroring, so a slow or failed copy cannot delay file-push approvals. Isolate mirror failures by conversation, retry with exponential backoff, and log each failure once per conversation revision with the affected entry name.
package/README.md CHANGED
@@ -1163,7 +1163,7 @@ as ordinary files. Browser logins and Claude/Codex config belong to the machine.
1163
1163
  your agent uses the same save/rollback commands there. Every agent starts from both. Save or roll back with `shard machine save|rollback` and
1164
1164
  `shard template save|rollback`; changed files reach running agents live, software at the next start.
1165
1165
  `shard machine save --wait` and `shard template save --wait` return once the new version is ready (0.13.3+).
1166
- `shard ./ codex` (or `claude`) starts that agent directly; `shard agents targets <project>/<agent>` lists each
1166
+ `shard ./ codex` (or `claude`; `--codex` and `--claude` also work, 0.14.4+) starts that agent directly; `shard agents targets <project>/<agent>` lists each
1167
1167
  connection it configured and the file it is in (0.13.3+).
1168
1168
 
1169
1169
  `shard agents fork` or `f` in the command center copies the whole running state into an independent workspace and
package/dist/args.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const CLI_VERSION = "0.14.3";
1
+ export declare const CLI_VERSION = "0.14.4";
2
2
  export interface OptionSpec {
3
3
  type: 'string' | 'boolean';
4
4
  short?: string;
package/dist/args.js CHANGED
@@ -12,7 +12,7 @@
12
12
  import { parseArgs } from 'node:util';
13
13
  import { ACCOUNT_COMMANDS } from "./account-args.js";
14
14
  import { UsageError } from "./errors.js";
15
- export const CLI_VERSION = '0.14.3';
15
+ export const CLI_VERSION = '0.14.4';
16
16
  export const GLOBAL_OPTIONS = {
17
17
  'api-url': { type: 'string', value: '<url>', description: 'API base URL (default $SHARDFLUX_API_URL, else https://api.shardflux.dev).' },
18
18
  json: { type: 'boolean', description: 'Print machine-readable JSON on stdout (errors as JSON on stderr).' },
@@ -1173,8 +1173,19 @@ const AGENT_OPTIONS = {
1173
1173
  export const PROJECT_COMMAND = {
1174
1174
  path: ['<path>'], summary: 'Start a conversation in its own cloud VM',
1175
1175
  description: 'Opens Claude Code or Codex directly. --resume continues a project conversation. With --json it starts detached and prints the session. Detach with Ctrl-] then d.',
1176
- positionals: [{ name: 'path', required: true }, { name: 'claude|codex' }], options: { ...AGENT_OPTIONS, new: { type: 'boolean', description: 'Start a new conversation.' }, resume: { type: 'boolean', description: 'Continue a conversation from this project.' } },
1176
+ positionals: [{ name: 'path', required: true }, { name: 'claude|codex' }], options: {
1177
+ ...AGENT_OPTIONS,
1178
+ new: { type: 'boolean', description: 'Start a new conversation.' },
1179
+ resume: { type: 'boolean', description: 'Continue a conversation from this project.' },
1180
+ claude: { type: 'boolean', description: 'Same as the claude argument (0.14.4+).' },
1181
+ codex: { type: 'boolean', description: 'Same as the codex argument (0.14.4+).' },
1182
+ },
1177
1183
  };
1184
+ /** `shard ./ codex`, quoting the path the way it was given when a shell would need it. */
1185
+ function projectExample(rest, app) {
1186
+ const path = rest.find((r, i) => !r.startsWith('-') && !GLOBAL_VALUE_FLAGS.has(rest[i - 1] ?? '')) ?? './';
1187
+ return `shard ${/^[\w./~@:+,=-]+$/.test(path) ? path : `'${path.replaceAll("'", `'\\''`)}'`} ${app}`;
1188
+ }
1178
1189
  export const CENTER_COMMAND = { path: ['<center>'], summary: 'Open the cloud agent command center', positionals: [], options: {} };
1179
1190
  const AGENT_COMMANDS = [
1180
1191
  { path: ['conversations', 'try'], summary: 'Try a conversation in a synced local worktree', positionals: [{ name: 'conversation', required: true }], options: { path: { type: 'string', value: '<path>', description: 'Local project checkout.' }, stop: { type: 'boolean', description: 'Stop the device helper’s local sync and ports.' } } },
@@ -1479,6 +1490,9 @@ export function parseCommandLine(argv, options = {}) {
1479
1490
  });
1480
1491
  }
1481
1492
  catch (err) {
1493
+ const unknown = command === PROJECT_COMMAND && err.code === 'ERR_PARSE_ARGS_UNKNOWN_OPTION' ? /'([^']+)'/.exec(String(err.message))?.[1] : undefined;
1494
+ if (unknown !== undefined)
1495
+ throw new UsageError(`unknown option "${unknown}" for "shard <path>"; choose the agent with "${projectExample(rest, 'codex')}" or "${projectExample(rest, 'claude')}"`);
1482
1496
  throw new UsageError(err instanceof Error ? err.message : String(err));
1483
1497
  }
1484
1498
  const values = parsed.values;
@@ -1487,8 +1501,20 @@ export function parseCommandLine(argv, options = {}) {
1487
1501
  if (values.version === true)
1488
1502
  return { kind: 'version' };
1489
1503
  const positionals = parsed.positionals;
1490
- if (command === PROJECT_COMMAND && positionals[1] !== undefined && !['claude', 'codex'].includes(positionals[1]))
1491
- throw new UsageError('agent app must be claude or codex');
1504
+ if (command === PROJECT_COMMAND) {
1505
+ // --claude and --codex are spellings of the app argument; the handler only sees the argument.
1506
+ const flagged = ['claude', 'codex'].filter((app) => values[app] === true);
1507
+ delete values.claude;
1508
+ delete values.codex;
1509
+ if (positionals[1] !== undefined && !['claude', 'codex'].includes(positionals[1])) {
1510
+ throw new UsageError(`agent app must be claude or codex, as in "${projectExample(rest, 'codex')}"`);
1511
+ }
1512
+ const chosen = new Set([...flagged, ...(positionals[1] === undefined ? [] : [positionals[1]])]);
1513
+ if (chosen.size > 1)
1514
+ throw new UsageError(`choose one agent app: "${projectExample(rest, 'codex')}" or "${projectExample(rest, 'claude')}"`);
1515
+ if (positionals[1] === undefined && flagged[0] !== undefined && positionals.length === 1)
1516
+ positionals.push(flagged[0]);
1517
+ }
1492
1518
  const specs = command.positionals;
1493
1519
  const variadic = specs.at(-1)?.variadic === true;
1494
1520
  const required = specs.filter((s) => s.required && !s.variadic).length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shardflux/cli",
3
- "version": "0.14.3",
3
+ "version": "0.14.4",
4
4
  "type": "module",
5
5
  "description": "shard: the Shardflux command line. Create an account, sign in, set up keys and billing, then open, run commands in, move files to, suspend, resume and fork serverless agent workspaces.",
6
6
  "license": "Apache-2.0",