@rigkit/cli 0.0.0-canary-20260518T014918-c5bc0c2
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/README.md +34 -0
- package/package.json +42 -0
- package/src/cli.test.ts +419 -0
- package/src/cli.ts +2496 -0
- package/src/completion.test.ts +413 -0
- package/src/completion.ts +844 -0
- package/src/init.test.ts +90 -0
- package/src/init.ts +269 -0
- package/src/interaction.test.ts +28 -0
- package/src/interaction.ts +33 -0
- package/src/project.test.ts +81 -0
- package/src/project.ts +184 -0
- package/src/run-logger.test.ts +92 -0
- package/src/run-logger.ts +203 -0
- package/src/run-presenter.ts +250 -0
- package/src/ui.ts +159 -0
- package/src/version.ts +1 -0
- package/src/workspace-name.test.ts +17 -0
- package/src/workspace-name.ts +59 -0
package/src/version.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RIGKIT_CLI_VERSION = "0.0.0-canary-20260518T014918-c5bc0c2";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { generateWorkspaceName } from "./workspace-name.ts";
|
|
3
|
+
|
|
4
|
+
describe("workspace name defaults", () => {
|
|
5
|
+
test("generates shell-safe adjective noun names", () => {
|
|
6
|
+
expect(generateWorkspaceName([], () => 0)).toBe("snowy-ridge");
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test("skips generated names that already exist", () => {
|
|
10
|
+
const randomValues = [0, 0, 0.5, 0.5];
|
|
11
|
+
let index = 0;
|
|
12
|
+
const name = generateWorkspaceName(["snowy-ridge"], () => randomValues[index++] ?? 0.5);
|
|
13
|
+
|
|
14
|
+
expect(name).not.toBe("snowy-ridge");
|
|
15
|
+
expect(name).toMatch(/^(?!-)[A-Za-z0-9._-]+$/);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const adjectives = [
|
|
2
|
+
"snowy",
|
|
3
|
+
"bright",
|
|
4
|
+
"quiet",
|
|
5
|
+
"rapid",
|
|
6
|
+
"silver",
|
|
7
|
+
"clear",
|
|
8
|
+
"steady",
|
|
9
|
+
"bold",
|
|
10
|
+
"lucky",
|
|
11
|
+
"fresh",
|
|
12
|
+
"golden",
|
|
13
|
+
"nimble",
|
|
14
|
+
"calm",
|
|
15
|
+
"brisk",
|
|
16
|
+
"sharp",
|
|
17
|
+
"sunny",
|
|
18
|
+
] as const;
|
|
19
|
+
|
|
20
|
+
const nouns = [
|
|
21
|
+
"ridge",
|
|
22
|
+
"harbor",
|
|
23
|
+
"signal",
|
|
24
|
+
"orbit",
|
|
25
|
+
"bridge",
|
|
26
|
+
"summit",
|
|
27
|
+
"field",
|
|
28
|
+
"grove",
|
|
29
|
+
"spark",
|
|
30
|
+
"stone",
|
|
31
|
+
"valley",
|
|
32
|
+
"meadow",
|
|
33
|
+
"trail",
|
|
34
|
+
"cove",
|
|
35
|
+
"anchor",
|
|
36
|
+
"beacon",
|
|
37
|
+
] as const;
|
|
38
|
+
|
|
39
|
+
export function generateWorkspaceName(
|
|
40
|
+
existingNames: Iterable<string> = [],
|
|
41
|
+
random: () => number = Math.random,
|
|
42
|
+
): string {
|
|
43
|
+
const existing = new Set(existingNames);
|
|
44
|
+
|
|
45
|
+
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
46
|
+
const name = `${pick(adjectives, random)}-${pick(nouns, random)}`;
|
|
47
|
+
if (!existing.has(name)) return name;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return `workspace-${Date.now().toString(36)}-${Math.floor(random() * 10000).toString(36)}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function pick<const Values extends readonly string[]>(
|
|
54
|
+
values: Values,
|
|
55
|
+
random: () => number,
|
|
56
|
+
): Values[number] {
|
|
57
|
+
const index = Math.min(values.length - 1, Math.floor(random() * values.length));
|
|
58
|
+
return values[index]!;
|
|
59
|
+
}
|