deweyou-cli 0.2.1 → 0.3.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/CHANGELOG.md +10 -0
- package/README.md +19 -8
- package/dist/{cache-CBEKVQeD.mjs → cache-rbXm6Wyh.mjs} +32 -4
- package/dist/{context-BYyhbv5D.mjs → context-B-zj0-Yr.mjs} +1 -1
- package/dist/deweyou.mjs +4 -4
- package/dist/{doctor-Do7WDnrg.mjs → doctor-C8GORlzg.mjs} +1 -1
- package/dist/{init-ClloZBVB.mjs → init-g2D-URoL.mjs} +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -19,14 +19,17 @@ From npm:
|
|
|
19
19
|
npm install -g deweyou-cli
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
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 `
|
|
64
|
+
Refreshes the local Dewey asset cache from the default `deweyou/agents` source
|
|
65
|
+
checkout.
|
|
62
66
|
|
|
63
67
|
```bash
|
|
64
|
-
|
|
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.
|
|
@@ -90,7 +101,7 @@ Scripted examples:
|
|
|
90
101
|
|
|
91
102
|
```bash
|
|
92
103
|
deweyou-cli agent init --all --mode link --yes
|
|
93
|
-
deweyou-cli agent init --skills
|
|
104
|
+
deweyou-cli agent init --skills repo-memory,spec-driven-coding,git-delivery --rules code-style
|
|
94
105
|
deweyou-cli agent init --dry-run
|
|
95
106
|
```
|
|
96
107
|
|
|
@@ -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
|
-
-
|
|
182
|
-
|
|
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
|
|
135
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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, n as writeJson, t as readJson } from "./cache-
|
|
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";
|