@spader/dotllm 1.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spader/dotllm",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A simple CLI to clone, manage, and link repositories for LLM reference",
5
5
  "type": "module",
6
6
  "repository": {
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
- DotLlmCli.def = {
10
- name: "dotllm",
11
- description: "Manage git repo references symlinked into .llm/reference/",
12
- commands: {
13
- add,
14
- remove,
15
- list,
16
- link,
17
- sync,
18
- which,
19
- cd
20
- }
21
- };
22
- function run() {
23
- build(DotLlmCli.def).parse();
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
  };
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;