deweyou-cli 0.2.1 → 0.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 - 2026-05-17
4
+
5
+ ### Added
6
+
7
+ - default agent update to cached source
3
8
  ## 0.2.1 - 2026-05-17
4
9
 
5
10
  ### Fixed
package/README.md CHANGED
@@ -19,14 +19,17 @@ From npm:
19
19
  npm install -g deweyou-cli
20
20
  ```
21
21
 
22
- During v0, point the CLI at your local `deweyou/agents` checkout before updating
23
- the cache:
22
+ Then refresh the local asset cache:
24
23
 
25
24
  ```bash
26
- export DEWEYOU_AGENTS_SOURCE=/path/to/deweyou/agents
27
25
  deweyou-cli agent update
28
26
  ```
29
27
 
28
+ By default, `agent update` clones or pulls `https://github.com/deweyou/agents.git`
29
+ into `~/.deweyou/agents/source`. For local development, set
30
+ `DEWEYOU_AGENTS_SOURCE=/path/to/deweyou/agents` to use a specific checkout
31
+ instead.
32
+
30
33
  ## Quick Start
31
34
 
32
35
  ```bash
@@ -58,10 +61,11 @@ skills and rules; a writing or design repo can select different ones.
58
61
 
59
62
  ### `deweyou-cli agent update`
60
63
 
61
- Refreshes the local Dewey asset cache from `DEWEYOU_AGENTS_SOURCE`.
64
+ Refreshes the local Dewey asset cache from the default `deweyou/agents` source
65
+ checkout.
62
66
 
63
67
  ```bash
64
- DEWEYOU_AGENTS_SOURCE=/path/to/deweyou/agents deweyou-cli agent update
68
+ deweyou-cli agent update
65
69
  ```
66
70
 
67
71
  This command writes the global cache at:
@@ -72,6 +76,13 @@ This command writes the global cache at:
72
76
 
73
77
  Run this after changing or pulling updates in the asset hub.
74
78
 
79
+ Source selection:
80
+
81
+ - Default: clone or pull `https://github.com/deweyou/agents.git` under
82
+ `~/.deweyou/agents/source`.
83
+ - Override: set `DEWEYOU_AGENTS_SOURCE=/path/to/deweyou/agents` to scan a local
84
+ checkout.
85
+
75
86
  ### `deweyou-cli agent init`
76
87
 
77
88
  Initializes the current repository with selected skills and rules.
@@ -178,8 +189,8 @@ workflow context. Existing content outside that managed section is preserved.
178
189
  - `--force` only replaces destinations that are already Dewey-managed. It
179
190
  refuses to overwrite unrelated user-created files or directories.
180
191
  - `--dry-run` is the safest way to preview what `init` would write.
181
- - In v0, the asset source is local. Set `DEWEYOU_AGENTS_SOURCE` to the
182
- `deweyou/agents` checkout you want to use.
192
+ - Set `DEWEYOU_AGENTS_SOURCE` only when you want to override the default source
193
+ checkout, usually while developing this asset hub locally.
183
194
 
184
195
  ## Development
185
196
 
@@ -131,10 +131,38 @@ async function writeJson(path, value) {
131
131
  }
132
132
  //#endregion
133
133
  //#region src/cli/source.ts
134
- const DEFAULT_SOURCE = "deweyou/agents";
135
- function resolveSourceRoot({ env = process.env } = {}) {
134
+ const DEFAULT_SOURCE_REPOSITORY = "https://github.com/deweyou/agents.git";
135
+ const execFileAsync$1 = promisify(execFile);
136
+ async function resolveSourceRoot({ env = process.env, homeDir = homedir(), execFile = execFileAsync$1 } = {}) {
136
137
  if (env.DEWEYOU_AGENTS_SOURCE) return env.DEWEYOU_AGENTS_SOURCE;
137
- throw new Error(`No local asset source configured. Set DEWEYOU_AGENTS_SOURCE to a checkout of ${DEFAULT_SOURCE}.`);
138
+ const sourceRoot = join(homeDir, ".deweyou", "agents", "source");
139
+ if (await isGitCheckout(sourceRoot)) await execFile("git", [
140
+ "-C",
141
+ sourceRoot,
142
+ "pull",
143
+ "--ff-only"
144
+ ]);
145
+ else {
146
+ await mkdir(join(sourceRoot, ".."), { recursive: true });
147
+ await execFile("git", [
148
+ "clone",
149
+ "--depth",
150
+ "1",
151
+ DEFAULT_SOURCE_REPOSITORY,
152
+ sourceRoot
153
+ ]);
154
+ }
155
+ return sourceRoot;
156
+ }
157
+ async function isGitCheckout(sourceRoot) {
158
+ try {
159
+ await stat(join(sourceRoot, ".git"));
160
+ return true;
161
+ } catch (error) {
162
+ if (!(error instanceof Error) || !("code" in error)) throw error;
163
+ if (error.code === "ENOENT") return false;
164
+ throw error;
165
+ }
138
166
  }
139
167
  //#endregion
140
168
  //#region src/cli/cache.ts
@@ -185,7 +213,7 @@ async function updateCache({ homeDir = homedir(), sourceRoot, cliVersion = CLI_V
185
213
  }
186
214
  }
187
215
  async function runUpdate(flags = {}) {
188
- const sourceRoot = flags.sourceRoot ?? resolveSourceRoot();
216
+ const sourceRoot = flags.sourceRoot ?? await resolveSourceRoot({ homeDir: flags.homeDir });
189
217
  const manifest = await updateCache({
190
218
  homeDir: flags.homeDir,
191
219
  sourceRoot,
@@ -1,5 +1,5 @@
1
1
  import { t as usageError } from "./deweyou.mjs";
2
- import { cachePaths, t as readJson } from "./cache-CBEKVQeD.mjs";
2
+ import { cachePaths, t as readJson } from "./cache-rbXm6Wyh.mjs";
3
3
  import { readFile, stat } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
5
5
  import { join } from "node:path";
package/dist/deweyou.mjs CHANGED
@@ -81,22 +81,22 @@ async function main(argv) {
81
81
  const parsed = parseArgs(argv);
82
82
  if (parsed.topic !== "agent") printUsageAndThrow();
83
83
  if (parsed.command === "init") {
84
- const { runInit } = await import("./init-ClloZBVB.mjs");
84
+ const { runInit } = await import("./init-g2D-URoL.mjs");
85
85
  await runInit(parsed.flags);
86
86
  return;
87
87
  }
88
88
  if (parsed.command === "update") {
89
- const { runUpdate } = await import("./cache-CBEKVQeD.mjs");
89
+ const { runUpdate } = await import("./cache-rbXm6Wyh.mjs");
90
90
  await runUpdate(parsed.flags);
91
91
  return;
92
92
  }
93
93
  if (parsed.command === "context") {
94
- const { runContext } = await import("./context-BYyhbv5D.mjs");
94
+ const { runContext } = await import("./context-B-zj0-Yr.mjs");
95
95
  await runContext(parsed.flags);
96
96
  return;
97
97
  }
98
98
  if (parsed.command === "doctor") {
99
- const { runDoctor } = await import("./doctor-Do7WDnrg.mjs");
99
+ const { runDoctor } = await import("./doctor-C8GORlzg.mjs");
100
100
  await runDoctor(parsed.flags);
101
101
  return;
102
102
  }
@@ -1,4 +1,4 @@
1
- import { cachePaths, t as readJson } from "./cache-CBEKVQeD.mjs";
1
+ import { cachePaths, t as readJson } from "./cache-rbXm6Wyh.mjs";
2
2
  import { lstat, stat } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
@@ -1,4 +1,4 @@
1
- import { cachePaths, n as writeJson, t as readJson } from "./cache-CBEKVQeD.mjs";
1
+ import { cachePaths, n as writeJson, t as readJson } from "./cache-rbXm6Wyh.mjs";
2
2
  import { cp, lstat, mkdir, readFile, realpath, rename, rm, symlink, writeFile } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
4
  import { basename, dirname, isAbsolute, join, relative } from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deweyou-cli",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Dewey's personal agent workflow bootstrapper",
6
6
  "files": [