@rucher/cli 0.3.0-beta.0 → 0.3.0-beta.2
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/cli.mjs +63 -13
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -242,7 +242,10 @@ const completionConfig = { subCommands: {
|
|
|
242
242
|
into: workspaces
|
|
243
243
|
} },
|
|
244
244
|
drop: { args: { name: workspaces } },
|
|
245
|
-
show: {
|
|
245
|
+
show: {
|
|
246
|
+
args: { name: workspaces },
|
|
247
|
+
options: workspace
|
|
248
|
+
},
|
|
246
249
|
add: {
|
|
247
250
|
args: { path: directories },
|
|
248
251
|
options: workspace
|
|
@@ -251,9 +254,18 @@ const completionConfig = { subCommands: {
|
|
|
251
254
|
args: { path: repos },
|
|
252
255
|
options: workspace
|
|
253
256
|
},
|
|
254
|
-
sync: {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
sync: {
|
|
258
|
+
args: { name: workspaces },
|
|
259
|
+
options: workspace
|
|
260
|
+
},
|
|
261
|
+
edit: {
|
|
262
|
+
args: { name: workspaces },
|
|
263
|
+
options: workspace
|
|
264
|
+
},
|
|
265
|
+
path: {
|
|
266
|
+
args: { name: workspaces },
|
|
267
|
+
options: workspace
|
|
268
|
+
}
|
|
257
269
|
}
|
|
258
270
|
}
|
|
259
271
|
} };
|
|
@@ -277,7 +289,7 @@ async function setupCompletion(main) {
|
|
|
277
289
|
};
|
|
278
290
|
}
|
|
279
291
|
// package.json
|
|
280
|
-
var version = "0.3.0-beta.
|
|
292
|
+
var version = "0.3.0-beta.2";
|
|
281
293
|
// src/plugin.ts
|
|
282
294
|
const CLI_VERSION = version;
|
|
283
295
|
function readJson(path) {
|
|
@@ -1565,6 +1577,15 @@ const workspaceArgument = { ws: {
|
|
|
1565
1577
|
type: "string",
|
|
1566
1578
|
description: "Workspace name (default: from RUCHER_WS or the run directory, else asked)"
|
|
1567
1579
|
} };
|
|
1580
|
+
const workspaceNameArgument = { name: {
|
|
1581
|
+
type: "positional",
|
|
1582
|
+
required: false,
|
|
1583
|
+
description: "Workspace name, or --ws"
|
|
1584
|
+
} };
|
|
1585
|
+
function namedWorkspace(args) {
|
|
1586
|
+
if (args.name && args.ws && args.name !== args.ws) throw new CliError(`Two workspaces given: ${args.name} and --ws ${args.ws}`, "pass the name or --ws, not both");
|
|
1587
|
+
return args.name || args.ws;
|
|
1588
|
+
}
|
|
1568
1589
|
function forwardWorkspace({ args }) {
|
|
1569
1590
|
if (args.ws) process.env.RUCHER_WS = args.ws;
|
|
1570
1591
|
}
|
|
@@ -1809,6 +1830,7 @@ function workspaceRename(from, to, io, options = {}) {
|
|
|
1809
1830
|
const lines = [
|
|
1810
1831
|
`would rename ${from} to ${to}:`,
|
|
1811
1832
|
...moveLines(result),
|
|
1833
|
+
...treeList(result.trees),
|
|
1812
1834
|
" Claude Code project folder and trust entry, when they exist",
|
|
1813
1835
|
rowLine(result),
|
|
1814
1836
|
...result.running.length ? [`the real run would stop: ${plural(result.running.length, "session")} running (${result.running.map((row) => row.name ?? row.id.slice(0, 8)).join(", ")})`] : []
|
|
@@ -1820,6 +1842,7 @@ function workspaceRename(from, to, io, options = {}) {
|
|
|
1820
1842
|
const lines = [
|
|
1821
1843
|
`renamed ${from} to ${to}`,
|
|
1822
1844
|
...moveLines(done),
|
|
1845
|
+
...treeList(done.trees),
|
|
1823
1846
|
rowLine(done),
|
|
1824
1847
|
` paths rewritten: ${done.paths}`,
|
|
1825
1848
|
` trust entry ${done.trustMoved ? "moved" : "not found, unchanged"}`,
|
|
@@ -1837,6 +1860,19 @@ function moveList(title, moves) {
|
|
|
1837
1860
|
if (!moves.length) return [];
|
|
1838
1861
|
return [` ${title}:`, ...moves.map((move) => ` ${move.from} → ${move.to}`)];
|
|
1839
1862
|
}
|
|
1863
|
+
const TREE_KIND = {
|
|
1864
|
+
worktree: "worktree",
|
|
1865
|
+
orphan: "orphan worktree, no repo registers it, moved as is",
|
|
1866
|
+
clone: "clone"
|
|
1867
|
+
};
|
|
1868
|
+
function treeList(trees) {
|
|
1869
|
+
if (!trees.length) return [];
|
|
1870
|
+
return [" git trees, moved whole:", ...trees.map((tree) => {
|
|
1871
|
+
const what = tree.kind === "worktree" ? `worktree of ${tree.repo}, repaired` : TREE_KIND[tree.kind];
|
|
1872
|
+
const held = tree.holders.length ? `, held by ${tree.holders.map((holder) => holder.name).join(", ")}` : "";
|
|
1873
|
+
return ` ${tree.path} → ${tree.to} (${what}${held})`;
|
|
1874
|
+
})];
|
|
1875
|
+
}
|
|
1840
1876
|
function mergePlanLines(plan) {
|
|
1841
1877
|
const { sessions, notes, activeDays } = plan.rows;
|
|
1842
1878
|
return [
|
|
@@ -1848,6 +1884,7 @@ function mergePlanLines(plan) {
|
|
|
1848
1884
|
` Claude Code project folder of ${plan.from} merged into ${plan.into}'s (conversations, memory), trust entry dropped`,
|
|
1849
1885
|
...moveList("reports", plan.reports),
|
|
1850
1886
|
...moveList("sandboxes", plan.sandboxes),
|
|
1887
|
+
...treeList(plan.trees),
|
|
1851
1888
|
...moveList("other files", plan.files),
|
|
1852
1889
|
` then ${plan.from}'s definition and run directory go to the backup folder`
|
|
1853
1890
|
];
|
|
@@ -1985,6 +2022,15 @@ async function askWorkspace({ args }) {
|
|
|
1985
2022
|
fail(io, error);
|
|
1986
2023
|
}
|
|
1987
2024
|
}
|
|
2025
|
+
async function askNamedWorkspace({ args }) {
|
|
2026
|
+
let workspace;
|
|
2027
|
+
try {
|
|
2028
|
+
workspace = namedWorkspace(args);
|
|
2029
|
+
} catch (error) {
|
|
2030
|
+
fail(processIo(), error);
|
|
2031
|
+
}
|
|
2032
|
+
await askWorkspace({ args: { ws: workspace } });
|
|
2033
|
+
}
|
|
1988
2034
|
const kindArgument = { kind: {
|
|
1989
2035
|
type: "string",
|
|
1990
2036
|
description: AGENT_KINDS.join(", ")
|
|
@@ -2823,12 +2869,13 @@ const wsCommand = defineCommand({
|
|
|
2823
2869
|
description: "Name, definition, run directory and repos of the workspace"
|
|
2824
2870
|
},
|
|
2825
2871
|
args: {
|
|
2872
|
+
...workspaceNameArgument,
|
|
2826
2873
|
...workspaceArgument,
|
|
2827
2874
|
...colorArgument
|
|
2828
2875
|
},
|
|
2829
|
-
setup:
|
|
2876
|
+
setup: askNamedWorkspace,
|
|
2830
2877
|
run({ args }) {
|
|
2831
|
-
process.exitCode = workspaceShow(processIo({ color: args.color }), { workspace: args
|
|
2878
|
+
process.exitCode = workspaceShow(processIo({ color: args.color }), { workspace: namedWorkspace(args) });
|
|
2832
2879
|
}
|
|
2833
2880
|
}),
|
|
2834
2881
|
add: defineCommand({
|
|
@@ -2875,12 +2922,13 @@ const wsCommand = defineCommand({
|
|
|
2875
2922
|
description: "Render the workspace's run directory (instruction copies, generated settings)"
|
|
2876
2923
|
},
|
|
2877
2924
|
args: {
|
|
2925
|
+
...workspaceNameArgument,
|
|
2878
2926
|
...workspaceArgument,
|
|
2879
2927
|
...colorArgument
|
|
2880
2928
|
},
|
|
2881
|
-
setup:
|
|
2929
|
+
setup: askNamedWorkspace,
|
|
2882
2930
|
run({ args }) {
|
|
2883
|
-
process.exitCode = workspaceSync(processIo({ color: args.color }), { workspace: args
|
|
2931
|
+
process.exitCode = workspaceSync(processIo({ color: args.color }), { workspace: namedWorkspace(args) });
|
|
2884
2932
|
}
|
|
2885
2933
|
}),
|
|
2886
2934
|
edit: defineCommand({
|
|
@@ -2889,6 +2937,7 @@ const wsCommand = defineCommand({
|
|
|
2889
2937
|
description: "Open the instructions (or workspace.json with --json) in $EDITOR, then sync"
|
|
2890
2938
|
},
|
|
2891
2939
|
args: {
|
|
2940
|
+
...workspaceNameArgument,
|
|
2892
2941
|
json: {
|
|
2893
2942
|
type: "boolean",
|
|
2894
2943
|
default: false,
|
|
@@ -2896,10 +2945,10 @@ const wsCommand = defineCommand({
|
|
|
2896
2945
|
},
|
|
2897
2946
|
...workspaceArgument
|
|
2898
2947
|
},
|
|
2899
|
-
setup:
|
|
2948
|
+
setup: askNamedWorkspace,
|
|
2900
2949
|
async run({ args }) {
|
|
2901
2950
|
process.exitCode = await workspaceEdit(processIo(), {
|
|
2902
|
-
workspace: args
|
|
2951
|
+
workspace: namedWorkspace(args),
|
|
2903
2952
|
json: args.json,
|
|
2904
2953
|
confirm: askYes
|
|
2905
2954
|
});
|
|
@@ -2916,6 +2965,7 @@ const wsCommand = defineCommand({
|
|
|
2916
2965
|
default: false,
|
|
2917
2966
|
description: "The definition folder instead"
|
|
2918
2967
|
},
|
|
2968
|
+
...workspaceNameArgument,
|
|
2919
2969
|
run: {
|
|
2920
2970
|
type: "boolean",
|
|
2921
2971
|
default: false,
|
|
@@ -2923,10 +2973,10 @@ const wsCommand = defineCommand({
|
|
|
2923
2973
|
},
|
|
2924
2974
|
...workspaceArgument
|
|
2925
2975
|
},
|
|
2926
|
-
setup:
|
|
2976
|
+
setup: askNamedWorkspace,
|
|
2927
2977
|
run({ args }) {
|
|
2928
2978
|
process.exitCode = workspacePath(processIo(), {
|
|
2929
|
-
workspace: args
|
|
2979
|
+
workspace: namedWorkspace(args),
|
|
2930
2980
|
definition: args.def
|
|
2931
2981
|
});
|
|
2932
2982
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rucher/cli",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.2",
|
|
4
4
|
"description": "rucher: status, journal and sessions of your Claude Code sub-agents, from the terminal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@bomb.sh/tab": "0.0.22",
|
|
38
|
-
"@rucher/carnet": "0.3.0-beta.
|
|
38
|
+
"@rucher/carnet": "0.3.0-beta.2",
|
|
39
39
|
"citty": "^0.2.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|