@rigkit/cli 0.2.6 → 0.2.7
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/package.json +4 -4
- package/src/completion.test.ts +8 -6
- package/src/completion.ts +10 -11
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rigkit/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"log-symbols": "^7.0.1",
|
|
26
26
|
"log-update": "^8.0.0",
|
|
27
27
|
"ora": "^9.4.0",
|
|
28
|
-
"@rigkit/provider-cmux": "0.2.
|
|
29
|
-
"@rigkit/
|
|
30
|
-
"@rigkit/
|
|
28
|
+
"@rigkit/provider-cmux": "0.2.7",
|
|
29
|
+
"@rigkit/runtime-client": "0.2.7",
|
|
30
|
+
"@rigkit/engine": "0.2.7"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/bun": "latest",
|
package/src/completion.test.ts
CHANGED
|
@@ -16,7 +16,7 @@ describe("CLI completion", () => {
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
expect(items.map((item) => item.value)).toEqual(["api", "web"]);
|
|
19
|
-
expect(items[0]?.description).toBe("
|
|
19
|
+
expect(items[0]?.description).toBe("created 2h ago");
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -56,7 +56,7 @@ describe("CLI completion", () => {
|
|
|
56
56
|
currentIndex: 2,
|
|
57
57
|
});
|
|
58
58
|
expect(roots.map((item) => item.value)).toEqual(["api", "web"]);
|
|
59
|
-
expect(roots[0]).toMatchObject({ description: "
|
|
59
|
+
expect(roots[0]).toMatchObject({ description: "created 2h ago" });
|
|
60
60
|
|
|
61
61
|
const exactWorkspace = await completeRig({
|
|
62
62
|
cwd: projectDir,
|
|
@@ -102,17 +102,19 @@ describe("CLI completion", () => {
|
|
|
102
102
|
expect(formatCompletionItems([{ value: "api", description: "workspace smoke", noSpace: true }], "zsh"))
|
|
103
103
|
.toBe("api\tworkspace smoke\tnospace");
|
|
104
104
|
expect(renderCompletionScript("zsh")).toContain("rig __complete");
|
|
105
|
-
expect(renderCompletionScript("zsh")).toContain("compadd -
|
|
105
|
+
expect(renderCompletionScript("zsh")).toContain("compadd -ld displays -a values");
|
|
106
|
+
expect(renderCompletionScript("zsh")).toContain("compadd -S '' -ld nospace_displays -a nospace_values");
|
|
106
107
|
expect(renderCompletionScript("zsh")).toContain('display="${value} -- ${description}"');
|
|
108
|
+
expect(renderCompletionScript("zsh")).not.toContain("_describe");
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
test("formats workspace ages", () => {
|
|
110
112
|
const now = Date.parse("2026-05-14T12:00:00.000Z");
|
|
111
113
|
|
|
112
114
|
expect(formatWorkspaceAge("2026-05-14T11:59:45.000Z", now)).toBe("just now");
|
|
113
|
-
expect(formatWorkspaceAge("2026-05-14T11:30:00.000Z", now)).toBe("30m
|
|
114
|
-
expect(formatWorkspaceAge("2026-05-14T09:00:00.000Z", now)).toBe("3h
|
|
115
|
-
expect(formatWorkspaceAge("2026-05-11T12:00:00.000Z", now)).toBe("3d
|
|
115
|
+
expect(formatWorkspaceAge("2026-05-14T11:30:00.000Z", now)).toBe("30m ago");
|
|
116
|
+
expect(formatWorkspaceAge("2026-05-14T09:00:00.000Z", now)).toBe("3h ago");
|
|
117
|
+
expect(formatWorkspaceAge("2026-05-11T12:00:00.000Z", now)).toBe("3d ago");
|
|
116
118
|
expect(formatWorkspaceAge("not-a-date", now)).toBeUndefined();
|
|
117
119
|
});
|
|
118
120
|
|
package/src/completion.ts
CHANGED
|
@@ -256,8 +256,8 @@ _rig() {
|
|
|
256
256
|
displays+=("\${display}")
|
|
257
257
|
fi
|
|
258
258
|
done
|
|
259
|
-
(( \${#nospace_values} )) && compadd -S '' -
|
|
260
|
-
(( \${#values} )) && compadd -
|
|
259
|
+
(( \${#nospace_values} )) && compadd -S '' -ld nospace_displays -a nospace_values
|
|
260
|
+
(( \${#values} )) && compadd -ld displays -a values
|
|
261
261
|
}
|
|
262
262
|
compdef _rig rig
|
|
263
263
|
`;
|
|
@@ -361,7 +361,7 @@ async function workspaceTargets(
|
|
|
361
361
|
const workspaces = await readWorkspaces(paths);
|
|
362
362
|
const items = workspaces.map((workspace) => ({
|
|
363
363
|
value: workspace.name,
|
|
364
|
-
description: workspaceDescription(workspace
|
|
364
|
+
description: workspaceDescription(workspace),
|
|
365
365
|
}));
|
|
366
366
|
|
|
367
367
|
return dedupeItems(items);
|
|
@@ -461,10 +461,9 @@ function dedupeItems(items: CompletionItem[]): CompletionItem[] {
|
|
|
461
461
|
return deduped;
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
function workspaceDescription(workspace: RuntimeWorkspaceCompletion
|
|
465
|
-
const label = options.prefix ? `workspace ${workspace.workflow}` : workspace.workflow;
|
|
464
|
+
function workspaceDescription(workspace: RuntimeWorkspaceCompletion): string {
|
|
466
465
|
const age = formatWorkspaceAge(workspace.createdAt);
|
|
467
|
-
return age ?
|
|
466
|
+
return age ? `created ${age}` : "created date unknown";
|
|
468
467
|
}
|
|
469
468
|
|
|
470
469
|
export function formatWorkspaceAge(createdAt: string, nowMs = Date.now()): string | undefined {
|
|
@@ -475,16 +474,16 @@ export function formatWorkspaceAge(createdAt: string, nowMs = Date.now()): strin
|
|
|
475
474
|
if (elapsedSeconds < 60) return "just now";
|
|
476
475
|
|
|
477
476
|
const elapsedMinutes = Math.floor(elapsedSeconds / 60);
|
|
478
|
-
if (elapsedMinutes < 60) return `${elapsedMinutes}m
|
|
477
|
+
if (elapsedMinutes < 60) return `${elapsedMinutes}m ago`;
|
|
479
478
|
|
|
480
479
|
const elapsedHours = Math.floor(elapsedMinutes / 60);
|
|
481
|
-
if (elapsedHours < 48) return `${elapsedHours}h
|
|
480
|
+
if (elapsedHours < 48) return `${elapsedHours}h ago`;
|
|
482
481
|
|
|
483
482
|
const elapsedDays = Math.floor(elapsedHours / 24);
|
|
484
|
-
if (elapsedDays < 30) return `${elapsedDays}d
|
|
483
|
+
if (elapsedDays < 30) return `${elapsedDays}d ago`;
|
|
485
484
|
|
|
486
485
|
const elapsedMonths = Math.floor(elapsedDays / 30);
|
|
487
|
-
if (elapsedMonths < 24) return `${elapsedMonths}mo
|
|
486
|
+
if (elapsedMonths < 24) return `${elapsedMonths}mo ago`;
|
|
488
487
|
|
|
489
|
-
return `${Math.floor(elapsedMonths / 12)}y
|
|
488
|
+
return `${Math.floor(elapsedMonths / 12)}y ago`;
|
|
490
489
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const RIGKIT_CLI_VERSION = "0.2.
|
|
1
|
+
export const RIGKIT_CLI_VERSION = "0.2.7";
|