kaizen-agent 0.1.0 → 0.2.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/README.md +5 -1
- package/cli/install.ts +26 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,9 +29,13 @@ cd ~/kaizen && bun run cli/install.ts
|
|
|
29
29
|
|
|
30
30
|
Flags, either way:
|
|
31
31
|
|
|
32
|
+
Run interactively with no flags and it asks where to install; piped or scripted
|
|
33
|
+
runs take the global install without asking.
|
|
34
|
+
|
|
32
35
|
| Flag | Effect |
|
|
33
36
|
|---|---|
|
|
34
|
-
| *(none)* |
|
|
37
|
+
| *(none)* | Ask, defaulting to every project (`~/.claude/`) |
|
|
38
|
+
| `--global` | Every project, no question asked |
|
|
35
39
|
| `--project` | Install into `.claude/` in the current directory only |
|
|
36
40
|
| `--check` | Report what is linked and exit non-zero if anything is missing |
|
|
37
41
|
| `--force` | Replace a real file sitting where a link belongs |
|
package/cli/install.ts
CHANGED
|
@@ -17,8 +17,16 @@ async function resolveRepo() {
|
|
|
17
17
|
|
|
18
18
|
const dest = process.env.KAIZEN_HOME ?? join(home, "kaizen");
|
|
19
19
|
if (existsSync(join(dest, ".git"))) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// A pull can refuse for reasons that have nothing to do with linking — local
|
|
21
|
+
// edits, a detached head, no network. Linking the checkout that is already
|
|
22
|
+
// there still works, so say what happened and carry on rather than failing
|
|
23
|
+
// the install over it.
|
|
24
|
+
try {
|
|
25
|
+
await Bun.$`git -C ${dest} pull --ff-only`.quiet();
|
|
26
|
+
console.log(`update ${dest}`);
|
|
27
|
+
} catch {
|
|
28
|
+
console.log(`skip ${dest} — could not pull, linking what is there`);
|
|
29
|
+
}
|
|
22
30
|
return dest;
|
|
23
31
|
}
|
|
24
32
|
console.log(`clone ${REPO_URL} -> ${dest}`);
|
|
@@ -52,8 +60,21 @@ function linkState(src: string, dest: string) {
|
|
|
52
60
|
const args = new Set(Bun.argv.slice(2));
|
|
53
61
|
const check = args.has("--check");
|
|
54
62
|
const force = args.has("--force");
|
|
55
|
-
const
|
|
56
|
-
|
|
63
|
+
const base = join(await chooseRoot(), ".claude");
|
|
64
|
+
|
|
65
|
+
async function chooseRoot() {
|
|
66
|
+
if (args.has("--project")) return process.cwd();
|
|
67
|
+
if (args.has("--global") || check) return home;
|
|
68
|
+
|
|
69
|
+
// Only ask when there is someone to answer. Piped, scripted, or CI runs take the
|
|
70
|
+
// global install silently rather than hanging on a prompt nobody sees.
|
|
71
|
+
if (!process.stdin.isTTY) return home;
|
|
72
|
+
|
|
73
|
+
console.log(`\n 1 every project ${join(home, ".claude")}`);
|
|
74
|
+
console.log(` 2 this one only ${join(process.cwd(), ".claude")}\n`);
|
|
75
|
+
const answer = prompt("Install where? [1]") ?? "";
|
|
76
|
+
return answer.trim() === "2" ? process.cwd() : home;
|
|
77
|
+
}
|
|
57
78
|
|
|
58
79
|
let bad = 0;
|
|
59
80
|
for (const [src, sub] of links) {
|
|
@@ -83,4 +104,5 @@ if (check) {
|
|
|
83
104
|
process.exit(bad ? 1 : 0);
|
|
84
105
|
}
|
|
85
106
|
console.log(`\nInstalled into ${base}. Restart Claude Code: skills load live, slash commands only on session start.`);
|
|
107
|
+
console.log(`Then, in a repository you want to use it on: /kaizen-init`);
|
|
86
108
|
if (bad) process.exit(1);
|