@spader/dotllm 1.1.0 → 1.2.1
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 +1 -1
- package/src/cli/commands/add.js +3 -2
- package/src/cli/commands/link.js +3 -14
- package/src/cli/commands/sync.js +2 -11
- package/src/cli/index.js +19 -16
- package/src/cli/prompt.js +23 -0
- package/src/cli/yargs.js +6 -0
package/package.json
CHANGED
package/src/cli/commands/add.js
CHANGED
|
@@ -4,8 +4,9 @@ import fs from "fs";
|
|
|
4
4
|
import path from "path";
|
|
5
5
|
import * as prompts from "@clack/prompts";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { add, Config } from "@spader/dotllm/core";
|
|
7
|
+
import { add, Config, sync } from "@spader/dotllm/core";
|
|
8
8
|
import { defaultTheme as t } from "@spader/dotllm/cli/theme";
|
|
9
|
+
import { Prompt } from "@spader/dotllm/cli/prompt";
|
|
9
10
|
var RepoShape = z.object({
|
|
10
11
|
description: z.string().nullable().optional()
|
|
11
12
|
});
|
|
@@ -126,7 +127,7 @@ function autoLink(name) {
|
|
|
126
127
|
if (!repo)
|
|
127
128
|
return;
|
|
128
129
|
Config.Local.write(Config.Local.add(local, repo));
|
|
129
|
-
|
|
130
|
+
Prompt.sync(sync());
|
|
130
131
|
}
|
|
131
132
|
async function run(uri, name, description) {
|
|
132
133
|
const spinner2 = prompts.spinner();
|
package/src/cli/commands/link.js
CHANGED
|
@@ -3,18 +3,7 @@
|
|
|
3
3
|
import * as prompts from "@clack/prompts";
|
|
4
4
|
import { Config, link, unlink, sync } from "@spader/dotllm/core";
|
|
5
5
|
import { defaultTheme as t } from "@spader/dotllm/cli/theme";
|
|
6
|
-
|
|
7
|
-
const parts = [];
|
|
8
|
-
if (result.linked.length > 0)
|
|
9
|
-
parts.push(`${result.linked.length} added`);
|
|
10
|
-
if (result.removed.length > 0)
|
|
11
|
-
parts.push(`${result.removed.length} removed`);
|
|
12
|
-
if (result.unchanged.length > 0)
|
|
13
|
-
parts.push(`${result.unchanged.length} unchanged`);
|
|
14
|
-
if (parts.length === 0)
|
|
15
|
-
return;
|
|
16
|
-
prompts.log.step(parts.join(", "));
|
|
17
|
-
}
|
|
6
|
+
import { Prompt } from "@spader/dotllm/cli/prompt";
|
|
18
7
|
var command = {
|
|
19
8
|
description: "Interactively pick repos to link into .llm/reference/, or add/remove one by name",
|
|
20
9
|
summary: "Link references",
|
|
@@ -55,7 +44,7 @@ var command = {
|
|
|
55
44
|
}
|
|
56
45
|
const local2 = Config.Local.read();
|
|
57
46
|
Config.Local.write(Config.Local.add(local2, repo));
|
|
58
|
-
|
|
47
|
+
Prompt.sync(sync());
|
|
59
48
|
return;
|
|
60
49
|
}
|
|
61
50
|
const global = Config.Global.read();
|
|
@@ -81,7 +70,7 @@ var command = {
|
|
|
81
70
|
return;
|
|
82
71
|
}
|
|
83
72
|
const names = Array.isArray(selected) ? selected.filter((value) => typeof value === "string") : [];
|
|
84
|
-
|
|
73
|
+
Prompt.sync(link(names));
|
|
85
74
|
}
|
|
86
75
|
};
|
|
87
76
|
export {
|
package/src/cli/commands/sync.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as prompts from "@clack/prompts";
|
|
4
4
|
import { pull, sync } from "@spader/dotllm/core";
|
|
5
5
|
import { defaultTheme as t } from "@spader/dotllm/cli/theme";
|
|
6
|
+
import { Prompt } from "@spader/dotllm/cli/prompt";
|
|
6
7
|
var command = {
|
|
7
8
|
description: "Re-create symlinks from .llm/dotllm.json",
|
|
8
9
|
summary: "Sync symlinks from local config",
|
|
@@ -14,17 +15,7 @@ var command = {
|
|
|
14
15
|
console.log(t.dim("use `dotllm link` to select repos"));
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
if (result.linked.length > 0)
|
|
19
|
-
parts.push(`${result.linked.length} added`);
|
|
20
|
-
if (result.removed.length > 0)
|
|
21
|
-
parts.push(`${result.removed.length} removed`);
|
|
22
|
-
if (result.unchanged.length > 0)
|
|
23
|
-
parts.push(`${result.unchanged.length} unchanged`);
|
|
24
|
-
if (result.missing.length > 0)
|
|
25
|
-
parts.push(`${result.missing.length} missing`);
|
|
26
|
-
if (parts.length > 0)
|
|
27
|
-
prompts.log.step(parts.join(", "));
|
|
18
|
+
Prompt.sync(result);
|
|
28
19
|
const refs = [...new Set([...result.unchanged, ...result.linked])];
|
|
29
20
|
if (refs.length === 0) {
|
|
30
21
|
return;
|
package/src/cli/index.js
CHANGED
|
@@ -6,25 +6,28 @@ import { build } from "@spader/dotllm/cli/yargs";
|
|
|
6
6
|
import { add, remove, list, link, sync, which, cd } from "@spader/dotllm/cli/commands/index";
|
|
7
7
|
var DotLlmCli;
|
|
8
8
|
((DotLlmCli) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
async function run() {
|
|
10
|
+
const raw = await Bun.file(new URL("../../package.json", import.meta.url)).json();
|
|
11
|
+
const version = typeof raw.version === "string" ? raw.version : undefined;
|
|
12
|
+
const def = {
|
|
13
|
+
name: "dotllm",
|
|
14
|
+
description: "Manage git repo references symlinked into .llm/reference/",
|
|
15
|
+
version,
|
|
16
|
+
commands: {
|
|
17
|
+
add,
|
|
18
|
+
remove,
|
|
19
|
+
list,
|
|
20
|
+
link,
|
|
21
|
+
sync,
|
|
22
|
+
which,
|
|
23
|
+
cd
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
build(def).parse();
|
|
24
27
|
}
|
|
25
28
|
DotLlmCli.run = run;
|
|
26
29
|
})(DotLlmCli ||= {});
|
|
27
|
-
DotLlmCli.run();
|
|
30
|
+
await DotLlmCli.run();
|
|
28
31
|
export {
|
|
29
32
|
DotLlmCli
|
|
30
33
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/cli/prompt.ts
|
|
3
|
+
import * as prompts from "@clack/prompts";
|
|
4
|
+
var Prompt;
|
|
5
|
+
((Prompt) => {
|
|
6
|
+
function sync(result) {
|
|
7
|
+
const parts = [];
|
|
8
|
+
if (result.linked.length > 0)
|
|
9
|
+
parts.push(`${result.linked.length} added`);
|
|
10
|
+
if (result.removed.length > 0)
|
|
11
|
+
parts.push(`${result.removed.length} removed`);
|
|
12
|
+
if (result.unchanged.length > 0)
|
|
13
|
+
parts.push(`${result.unchanged.length} unchanged`);
|
|
14
|
+
if (result.missing.length > 0)
|
|
15
|
+
parts.push(`${result.missing.length} missing`);
|
|
16
|
+
if (parts.length > 0)
|
|
17
|
+
prompts.log.step(parts.join(", "));
|
|
18
|
+
}
|
|
19
|
+
Prompt.sync = sync;
|
|
20
|
+
})(Prompt ||= {});
|
|
21
|
+
export {
|
|
22
|
+
Prompt
|
|
23
|
+
};
|
package/src/cli/yargs.js
CHANGED
|
@@ -58,6 +58,9 @@ function help(def, name, path = [], t = defaultTheme) {
|
|
|
58
58
|
...def.options ?? {},
|
|
59
59
|
help: { alias: "h", type: "boolean", description: "Show help" }
|
|
60
60
|
};
|
|
61
|
+
if ("version" in def && def.version) {
|
|
62
|
+
opts.version = { alias: "v", type: "boolean", description: "Show version" };
|
|
63
|
+
}
|
|
61
64
|
if (Object.keys(opts).length > 0) {
|
|
62
65
|
if (prev)
|
|
63
66
|
console.log("");
|
|
@@ -145,6 +148,9 @@ function configure(y, def, root, path) {
|
|
|
145
148
|
y.demandCommand(1, "You must specify a command");
|
|
146
149
|
}
|
|
147
150
|
y.help(false).option("help", { alias: "h", type: "boolean", describe: "Show help" }).check(check(def, root, path)).fail(fail(def, root, path));
|
|
151
|
+
if (path.length === 0 && "version" in def && def.version) {
|
|
152
|
+
y.version(def.version).alias("version", "v");
|
|
153
|
+
}
|
|
148
154
|
}
|
|
149
155
|
function command(y, name, def, root, path) {
|
|
150
156
|
let cmd = name;
|