jouzu 0.0.1 → 0.1.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.
Files changed (66) hide show
  1. package/README.md +50 -0
  2. package/dist/args.d.ts +45 -0
  3. package/dist/args.d.ts.map +1 -0
  4. package/dist/args.js +221 -0
  5. package/dist/args.js.map +1 -0
  6. package/dist/cli.js +250 -29
  7. package/dist/cli.js.map +1 -1
  8. package/dist/doctor.d.ts +36 -0
  9. package/dist/doctor.d.ts.map +1 -0
  10. package/dist/doctor.js +224 -0
  11. package/dist/doctor.js.map +1 -0
  12. package/dist/keybindings.d.ts +68 -0
  13. package/dist/keybindings.d.ts.map +1 -0
  14. package/dist/keybindings.js +559 -0
  15. package/dist/keybindings.js.map +1 -0
  16. package/dist/metadata.d.ts +21 -0
  17. package/dist/metadata.d.ts.map +1 -0
  18. package/dist/metadata.js +22 -0
  19. package/dist/metadata.js.map +1 -0
  20. package/dist/paths.d.ts +17 -0
  21. package/dist/paths.d.ts.map +1 -0
  22. package/dist/paths.js +65 -0
  23. package/dist/paths.js.map +1 -0
  24. package/dist/pi.lock.json +15 -0
  25. package/dist/presentation.d.ts +45 -0
  26. package/dist/presentation.d.ts.map +1 -0
  27. package/dist/presentation.js +202 -0
  28. package/dist/presentation.js.map +1 -0
  29. package/dist/private-fs.d.ts +12 -0
  30. package/dist/private-fs.d.ts.map +1 -0
  31. package/dist/private-fs.js +64 -0
  32. package/dist/private-fs.js.map +1 -0
  33. package/dist/profile-choice.d.ts +14 -0
  34. package/dist/profile-choice.d.ts.map +1 -0
  35. package/dist/profile-choice.js +83 -0
  36. package/dist/profile-choice.js.map +1 -0
  37. package/dist/profile-manager.d.ts +50 -0
  38. package/dist/profile-manager.d.ts.map +1 -0
  39. package/dist/profile-manager.js +364 -0
  40. package/dist/profile-manager.js.map +1 -0
  41. package/dist/profiles/core/assets/jouzu-core-skill.md +12 -0
  42. package/dist/profiles/core/assets/jouzu-review.md +1 -0
  43. package/dist/profiles/core/manifest.json +17 -0
  44. package/dist/profiles/ja/assets/APPEND_SYSTEM.md +8 -0
  45. package/dist/profiles/ja/manifest.json +13 -0
  46. package/dist/profiles.d.ts +18 -0
  47. package/dist/profiles.d.ts.map +1 -0
  48. package/dist/profiles.js +153 -0
  49. package/dist/profiles.js.map +1 -0
  50. package/dist/resume.d.ts +7 -0
  51. package/dist/resume.d.ts.map +1 -0
  52. package/dist/resume.js +23 -0
  53. package/dist/resume.js.map +1 -0
  54. package/dist/runtime.d.ts +18 -0
  55. package/dist/runtime.d.ts.map +1 -0
  56. package/dist/runtime.js +59 -0
  57. package/dist/runtime.js.map +1 -0
  58. package/dist/state-lock.d.ts +39 -0
  59. package/dist/state-lock.d.ts.map +1 -0
  60. package/dist/state-lock.js +143 -0
  61. package/dist/state-lock.js.map +1 -0
  62. package/dist/updater.d.ts +113 -0
  63. package/dist/updater.d.ts.map +1 -0
  64. package/dist/updater.js +698 -0
  65. package/dist/updater.js.map +1 -0
  66. package/package.json +7 -4
package/README.md CHANGED
@@ -1 +1,51 @@
1
1
  # Jouzu
2
+
3
+ Jouzu is an agentic AI environment built on the Pi coding agent, with CJK-safe text and path handling. `jouzu` and `jz` run exact Pi `0.84.2` with isolated Jouzu state, a language-neutral Core fallback, an optional JA preview, and non-mutating diagnostics. Japanese support is optional and first-class.
4
+
5
+ ## Install and start
6
+
7
+ Requires Node.js 22.19+, npm, Git, and Bash. Windows requires Git Bash.
8
+
9
+ ```bash
10
+ npm install --global jouzu@0.1.1
11
+
12
+ jz --version
13
+ jz doctor
14
+ jz
15
+ ```
16
+
17
+ The first interactive launch asks whether to enable Japanese support. An affirmative answer selects `ja`; declining or pressing Enter selects the provider-neutral `core` profile. Non-interactive first runs safely use Core without recording consent. Preview either profile with:
18
+
19
+ ```bash
20
+ jz profile plan --profile core
21
+ jz profile plan --profile ja
22
+ ```
23
+
24
+ Locale, terminal settings, repository text, and branding never select JA automatically.
25
+
26
+ Profile planning does not write. Application detects user-file conflicts, retains backups for managed updates/deletions, and never prunes unknown files. Existing unsupported CP932/Shift-JIS profile targets are left unchanged.
27
+
28
+ Use `/login` to authenticate within Jouzu's agent root. Pi's `/model` or `Ctrl+L` picker remains available. `/status` reports provider-neutral session, model, context, profile, and runtime facts.
29
+
30
+ Jouzu does not import stock Pi state. Override all roots with `--jouzu-home <path>` or `JOUZU_HOME`. Trusted project `.pi` resources and Pi's cross-harness `~/.agents/skills` read surface still follow Pi behavior. On exit, resume the isolated session with the printed `jz --session SESSION_ID` command; Jouzu resolves its own session root.
31
+
32
+ Use `jz pi ...` or `jz -- ...` for Pi command collisions. Pi runtime self-update is blocked; package/model updates inside Jouzu state remain available.
33
+
34
+ When the isolated Jouzu agent root has no `keybindings.json`, the first interactive launch seeds `Ctrl+Enter` for Pi's `app.message.followUp` action and `Ctrl+Up` for `app.message.dequeue`; `Tab` retains Pi autocomplete. On upgrade from v0.1.0, Jouzu backs up and replaces only an exact Jouzu-owned `Tab` follow-up entry. User-owned or modified bindings remain unchanged. Use `jz keybindings status|plan|apply|reset`; explicit apply merges only missing defaults with conflict checks/backups, while reset removes only Jouzu-recorded entries and disables reseeding. `JOUZU_NO_KEYBINDING_DEFAULTS=1` is a one-run opt-out. Modified-key reporting is terminal-dependent; tmux should use `extended-keys-format csi-u`.
35
+
36
+ Real global npm installs default to a pre-TUI automatic Jouzu update check/restart on the first eligible launch. Successful checks are cached for 24 hours; failed checks retry no sooner than one hour later. Candidate tarball SHA-512 integrity and the installed Jouzu/Pi tuple are verified; failure restores the locally packed previous version. Source, project-local, and ephemeral `npx` invocations are not rewritten.
37
+
38
+ ```bash
39
+ jz self-update status
40
+ jz self-update check
41
+ jz self-update apply
42
+ jz self-update policy auto-restart # or notify/off
43
+ ```
44
+
45
+ Set `JOUZU_NO_UPDATE=1` for a one-run opt-out. Checks use npm's configured registry, proxy, and CA behavior and send no Jouzu telemetry. Updating requires write access to the active global npm prefix; permission or network failures leave the current version running.
46
+
47
+ Interactive launches show an adaptive Jouzu header and clear the viewport. Set `JOUZU_NO_CLEAR=1` to retain it; set `NO_COLOR=1` to disable color.
48
+
49
+ npm is the only v0.1 channel. PyPI `jouzu==0.0.1` remains a non-functional reservation. Jouzu v0.1 does not bundle prerequisites, native installers, hosted models, routing, or provider privacy/retention guarantees.
50
+
51
+ See the [full documentation](https://github.com/shisa-ai/jouzu#readme) and [Windows prerequisites](https://github.com/shisa-ai/jouzu/blob/main/docs/windows.md).
package/dist/args.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ export declare const PROFILE_IDS: readonly ["core", "ja"];
2
+ export type ProfileId = (typeof PROFILE_IDS)[number];
3
+ export declare class UsageError extends Error {
4
+ readonly exitCode = 2;
5
+ constructor(message: string);
6
+ }
7
+ export interface JouzuOptions {
8
+ home?: string;
9
+ profile?: ProfileId;
10
+ }
11
+ export type ParsedCommand = {
12
+ kind: "pi";
13
+ options: JouzuOptions;
14
+ args: string[];
15
+ } | {
16
+ kind: "doctor";
17
+ options: JouzuOptions;
18
+ } | {
19
+ kind: "version";
20
+ options: JouzuOptions;
21
+ } | {
22
+ kind: "help";
23
+ options: JouzuOptions;
24
+ } | {
25
+ kind: "self-update";
26
+ options: JouzuOptions;
27
+ operation: "status" | "check" | "apply" | "policy";
28
+ json: boolean;
29
+ policy?: "auto-restart" | "notify" | "off";
30
+ } | {
31
+ kind: "keybindings";
32
+ options: JouzuOptions;
33
+ operation: "status" | "plan" | "apply" | "reset";
34
+ json: boolean;
35
+ } | {
36
+ kind: "profile";
37
+ options: JouzuOptions;
38
+ operation: "plan" | "apply";
39
+ profile?: ProfileId;
40
+ json: boolean;
41
+ };
42
+ export declare function parseJouzuArgs(args: string[]): ParsedCommand;
43
+ export declare function isBlockedPiSelfUpdate(args: string[]): boolean;
44
+ export declare function formatHelp(): string;
45
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,eAA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AAC;AAsFL,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CA8C5D;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAgC7D;AAED,wBAAgB,UAAU,IAAI,MAAM,CAmCnC"}
package/dist/args.js ADDED
@@ -0,0 +1,221 @@
1
+ export const PROFILE_IDS = ["core", "ja"];
2
+ export class UsageError extends Error {
3
+ exitCode = 2;
4
+ constructor(message) {
5
+ super(message);
6
+ this.name = "UsageError";
7
+ }
8
+ }
9
+ function readOptionValue(args, index, option) {
10
+ const token = args[index];
11
+ const equalsPrefix = `${option}=`;
12
+ if (token.startsWith(equalsPrefix)) {
13
+ const value = token.slice(equalsPrefix.length);
14
+ if (!value)
15
+ throw new UsageError(`${option} requires a value`);
16
+ return { value, next: index + 1 };
17
+ }
18
+ if (token !== option)
19
+ throw new UsageError(`internal parser error for ${option}`);
20
+ const value = args[index + 1];
21
+ if (value === undefined || value.length === 0)
22
+ throw new UsageError(`${option} requires a value`);
23
+ return { value, next: index + 2 };
24
+ }
25
+ function parseSelfUpdateCommand(options, args) {
26
+ const [operation = "status", ...remaining] = args;
27
+ if (operation !== "status" && operation !== "check" && operation !== "apply" && operation !== "policy") {
28
+ throw new UsageError('self-update requires "status", "check", "apply", or "policy"');
29
+ }
30
+ if (operation === "policy") {
31
+ const [policy, ...extra] = remaining;
32
+ if (policy !== "auto-restart" && policy !== "notify" && policy !== "off") {
33
+ throw new UsageError("self-update policy must be one of: auto-restart, notify, off");
34
+ }
35
+ if (extra.length > 0)
36
+ throw new UsageError("self-update policy accepts exactly one value");
37
+ return { kind: "self-update", options, operation, json: false, policy };
38
+ }
39
+ let json = false;
40
+ for (const token of remaining) {
41
+ if (token !== "--json" || json || operation === "apply") {
42
+ throw new UsageError(`unknown self-update ${operation} option: ${token}`);
43
+ }
44
+ json = true;
45
+ }
46
+ return { kind: "self-update", options, operation, json };
47
+ }
48
+ function parseKeybindingsCommand(options, args) {
49
+ const [operation = "status", ...remaining] = args;
50
+ if (operation !== "status" && operation !== "plan" && operation !== "apply" && operation !== "reset") {
51
+ throw new UsageError('keybindings requires "status", "plan", "apply", or "reset"');
52
+ }
53
+ let json = false;
54
+ for (const token of remaining) {
55
+ if (token !== "--json" || json || operation === "apply" || operation === "reset") {
56
+ throw new UsageError(`unknown keybindings ${operation} option: ${token}`);
57
+ }
58
+ json = true;
59
+ }
60
+ return { kind: "keybindings", options, operation, json };
61
+ }
62
+ function parseProfileCommand(options, args) {
63
+ if (options.profile !== undefined) {
64
+ throw new UsageError("use profile --profile <core|ja>; do not mix it with --jouzu-profile");
65
+ }
66
+ const [operation, ...remaining] = args;
67
+ if (operation !== "plan" && operation !== "apply") {
68
+ throw new UsageError('profile requires "plan" or "apply"');
69
+ }
70
+ let profile;
71
+ let json = false;
72
+ for (let index = 0; index < remaining.length; index += 1) {
73
+ const token = remaining[index];
74
+ if (token === "--profile" || token.startsWith("--profile=")) {
75
+ if (profile !== undefined)
76
+ throw new UsageError("--profile may be specified only once");
77
+ const parsed = readOptionValue(remaining, index, "--profile");
78
+ if (!PROFILE_IDS.includes(parsed.value)) {
79
+ throw new UsageError(`--profile must be one of: ${PROFILE_IDS.join(", ")}`);
80
+ }
81
+ profile = parsed.value;
82
+ index = parsed.next - 1;
83
+ continue;
84
+ }
85
+ if (token === "--json" && operation === "plan") {
86
+ if (json)
87
+ throw new UsageError("--json may be specified only once");
88
+ json = true;
89
+ continue;
90
+ }
91
+ throw new UsageError(`unknown profile ${operation} option: ${token}`);
92
+ }
93
+ return { kind: "profile", options, operation, ...(profile ? { profile } : {}), json };
94
+ }
95
+ export function parseJouzuArgs(args) {
96
+ const options = {};
97
+ let index = 0;
98
+ while (index < args.length) {
99
+ const token = args[index];
100
+ if (token === "--jouzu-home" || token.startsWith("--jouzu-home=")) {
101
+ if (options.home !== undefined)
102
+ throw new UsageError("--jouzu-home may be specified only once");
103
+ const parsed = readOptionValue(args, index, "--jouzu-home");
104
+ options.home = parsed.value;
105
+ index = parsed.next;
106
+ continue;
107
+ }
108
+ if (token === "--jouzu-profile" || token.startsWith("--jouzu-profile=")) {
109
+ if (options.profile !== undefined)
110
+ throw new UsageError("--jouzu-profile may be specified only once");
111
+ const parsed = readOptionValue(args, index, "--jouzu-profile");
112
+ if (!PROFILE_IDS.includes(parsed.value)) {
113
+ throw new UsageError(`--jouzu-profile must be one of: ${PROFILE_IDS.join(", ")}`);
114
+ }
115
+ options.profile = parsed.value;
116
+ index = parsed.next;
117
+ continue;
118
+ }
119
+ if (token.startsWith("--jouzu-"))
120
+ throw new UsageError(`unknown Jouzu option: ${token}`);
121
+ break;
122
+ }
123
+ const remaining = args.slice(index);
124
+ const [command, ...rest] = remaining;
125
+ if (command === "pi" || command === "--")
126
+ return { kind: "pi", options, args: rest };
127
+ if (command === "doctor") {
128
+ if (rest.length > 0)
129
+ throw new UsageError("doctor does not accept arguments");
130
+ return { kind: "doctor", options };
131
+ }
132
+ if (command === "profile")
133
+ return parseProfileCommand(options, rest);
134
+ if (command === "keybindings")
135
+ return parseKeybindingsCommand(options, rest);
136
+ if (command === "self-update")
137
+ return parseSelfUpdateCommand(options, rest);
138
+ if (command === "--version" || command === "-v") {
139
+ if (rest.length > 0)
140
+ throw new UsageError(`${command} does not accept arguments; use "jouzu pi ${command}" for Pi`);
141
+ return { kind: "version", options };
142
+ }
143
+ if (command === "--help" || command === "-h") {
144
+ if (rest.length > 0)
145
+ throw new UsageError(`${command} does not accept arguments; use "jouzu pi ${command}" for Pi`);
146
+ return { kind: "help", options };
147
+ }
148
+ return { kind: "pi", options, args: remaining };
149
+ }
150
+ export function isBlockedPiSelfUpdate(args) {
151
+ if (args[0] !== "update")
152
+ return false;
153
+ const updateArgs = args.slice(1);
154
+ if (updateArgs.length === 0)
155
+ return true;
156
+ if (updateArgs.some((arg) => arg === "--all" || arg === "--self"))
157
+ return true;
158
+ let hasExtensionOrModelTarget = false;
159
+ let positionalTarget;
160
+ for (let index = 0; index < updateArgs.length; index += 1) {
161
+ const arg = updateArgs[index];
162
+ if (arg === "--extensions" || arg === "--models") {
163
+ hasExtensionOrModelTarget = true;
164
+ continue;
165
+ }
166
+ if (arg === "--extension") {
167
+ if (updateArgs[index + 1] !== undefined) {
168
+ hasExtensionOrModelTarget = true;
169
+ index += 1;
170
+ }
171
+ continue;
172
+ }
173
+ if (arg.startsWith("--extension=")) {
174
+ hasExtensionOrModelTarget = arg.length > "--extension=".length;
175
+ continue;
176
+ }
177
+ if (!arg.startsWith("-")) {
178
+ positionalTarget ??= arg;
179
+ }
180
+ }
181
+ if (positionalTarget === "self" || positionalTarget === "pi")
182
+ return true;
183
+ return !hasExtensionOrModelTarget && positionalTarget === undefined;
184
+ }
185
+ export function formatHelp() {
186
+ return `Jouzu agentic AI environment
187
+
188
+ Usage:
189
+ jouzu [--jouzu-home <path>] [--jouzu-profile <core|ja>] [Pi arguments...]
190
+ jouzu --session <id> [Pi arguments...]
191
+ jouzu [Jouzu options] pi [Pi arguments...]
192
+ jouzu [Jouzu options] -- [Pi arguments...]
193
+ jouzu [Jouzu options] doctor
194
+ jouzu profile plan [--profile <core|ja>] [--json]
195
+ jouzu profile apply [--profile <core|ja>]
196
+ jouzu keybindings status [--json]
197
+ jouzu keybindings plan [--json]
198
+ jouzu keybindings apply
199
+ jouzu keybindings reset
200
+ jouzu self-update status [--json]
201
+ jouzu self-update check [--json]
202
+ jouzu self-update apply
203
+ jouzu self-update policy <auto-restart|notify|off>
204
+ jouzu [Jouzu options] --version
205
+
206
+ Commands:
207
+ doctor Show non-mutating runtime and isolation diagnostics
208
+ profile plan Preview safe Core/JA profile changes without writing
209
+ profile apply Apply the selected profile with conflicts and backups
210
+ keybindings Inspect, apply, or reset Jouzu's Pi-compatible key defaults
211
+ self-update Inspect, check, apply, or configure Jouzu npm updates
212
+ pi, -- Explicitly pass all remaining arguments to pinned Pi
213
+
214
+ The jz command is an exact alias. Resume with the jz --session command printed
215
+ on exit; Jouzu resolves its isolated session root. First interactive launch asks before enabling
216
+ the optional JA profile; Core is the safe fallback. Interactive launches clear
217
+ the viewport and show the Jouzu header;
218
+ set JOUZU_NO_CLEAR=1 to preserve the existing screen. Pi's model picker remains
219
+ available through /model or Ctrl+L. Use "jouzu pi --help" for Pi CLI help.`;
220
+ }
221
+ //# sourceMappingURL=args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,IAAI,CAAU,CAAC;AAGnD,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC3B,QAAQ,GAAG,CAAC,CAAC;IAEtB,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC1B,CAAC;CACD;AAiCD,SAAS,eAAe,CAAC,IAAc,EAAE,KAAa,EAAE,MAAc;IACrE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,YAAY,GAAG,GAAG,MAAM,GAAG,CAAC;IAClC,IAAI,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,UAAU,CAAC,GAAG,MAAM,mBAAmB,CAAC,CAAC;QAC/D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;IACnC,CAAC;IACD,IAAI,KAAK,KAAK,MAAM;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,MAAM,EAAE,CAAC,CAAC;IAClF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAA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IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,gBAAgB,KAAK,GAAG,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,IAAI,gBAAgB,KAAK,MAAM,IAAI,gBAAgB,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC1E,OAAO,CAAC,yBAAyB,IAAI,gBAAgB,KAAK,SAAS,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,UAAU;IACzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAiCmE,CAAC;AAC5E,CAAC"}
package/dist/cli.js CHANGED
@@ -1,33 +1,254 @@
1
1
  #!/usr/bin/env node
2
- const VERSION = "0.0.1";
3
- const PREVIEW_MESSAGE = "Jouzu is reserved for an upcoming Japanese-first Pi distribution. This preview package is not functional yet.";
4
- function printDoctor() {
5
- console.log(JSON.stringify({
6
- name: "jouzu",
7
- version: VERSION,
8
- status: "package-name-reservation",
9
- node: process.version,
10
- platform: process.platform,
11
- architecture: process.arch,
12
- }, null, 2));
2
+ import { join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { formatHelp, isBlockedPiSelfUpdate, parseJouzuArgs, UsageError } from "./args.js";
5
+ import { createDoctorReport } from "./doctor.js";
6
+ import { applyKeybindings, ensureDefaultKeybindings, formatKeybindingPlan, KeybindingConfigError, KeybindingConflictError, planKeybindings, resetKeybindings, } from "./keybindings.js";
7
+ import { loadMetadata } from "./metadata.js";
8
+ import { resolveJouzuPaths } from "./paths.js";
9
+ import { clearInteractiveStartup, createJouzuPresentationExtension, isInteractivePiStartup } from "./presentation.js";
10
+ import { promptForJapaneseSupport, writeProfileChoice } from "./profile-choice.js";
11
+ import { applyProfile, formatProfilePlan, ProfileConflictError, ProfileStateError, planProfile, } from "./profile-manager.js";
12
+ import { loadBundledProfile } from "./profiles.js";
13
+ import { withJouzuResumeHint } from "./resume.js";
14
+ import { configurePiProcess, resolveProfileSelection } from "./runtime.js";
15
+ import { formatUpdateStatus, JouzuUpdater, relaunchUpdatedJouzu, UpdateError } from "./updater.js";
16
+ async function loadPiRuntime() {
17
+ return import("@earendil-works/pi-coding-agent");
13
18
  }
14
- const [command] = process.argv.slice(2);
15
- switch (command) {
16
- case "--version":
17
- case "-v":
18
- case "version":
19
- console.log(VERSION);
20
- break;
21
- case "doctor":
22
- printDoctor();
23
- break;
24
- case "--help":
25
- case "-h":
26
- console.log("Usage: jouzu [--version|doctor]");
27
- console.log(PREVIEW_MESSAGE);
28
- break;
29
- default:
30
- console.log(PREVIEW_MESSAGE);
19
+ async function runCli(args) {
20
+ const parsed = parseJouzuArgs(args);
21
+ if (parsed.kind === "help") {
22
+ console.log(formatHelp());
23
+ return;
24
+ }
25
+ if (parsed.kind === "pi" && isBlockedPiSelfUpdate(parsed.args)) {
26
+ throw new UsageError("Jouzu pins its Pi runtime and cannot run Pi self-update. Upgrade Jouzu instead; package-only updates such as `jz update --extensions` remain available.");
27
+ }
28
+ const paths = resolveJouzuPaths({ homeOverride: parsed.options.home });
29
+ const metadata = loadMetadata();
30
+ const interactiveStartup = parsed.kind === "pi" && isInteractivePiStartup(parsed.args);
31
+ const executable = process.argv[1] ?? fileURLToPath(import.meta.url);
32
+ const updater = new JouzuUpdater({
33
+ paths,
34
+ currentVersion: metadata.jouzuVersion,
35
+ executable,
36
+ report: (message) => console.log(message),
37
+ });
38
+ if (parsed.kind === "keybindings") {
39
+ if (parsed.operation === "status" || parsed.operation === "plan") {
40
+ const plan = planKeybindings(paths);
41
+ console.log(parsed.json ? JSON.stringify(plan, null, 2) : formatKeybindingPlan(plan));
42
+ if (plan.actions.some((action) => action.type === "conflict"))
43
+ process.exitCode = 5;
44
+ return;
45
+ }
46
+ const result = parsed.operation === "apply" ? applyKeybindings(paths) : resetKeybindings(paths);
47
+ console.log(formatKeybindingPlan(result.plan));
48
+ console.log(result.changed
49
+ ? `${parsed.operation === "apply" ? "Applied" : "Reset"} keybinding transaction: ${result.transactionId}`
50
+ : `Keybinding defaults already ${parsed.operation === "apply" ? "converged" : "disabled"}.`);
51
+ if (result.backupDir)
52
+ console.log(`Backup: ${result.backupDir}`);
53
+ return;
54
+ }
55
+ if (parsed.kind === "self-update") {
56
+ if (parsed.operation === "policy") {
57
+ if (!parsed.policy)
58
+ throw new UsageError("self-update policy requires a value");
59
+ const state = updater.setPolicy(parsed.policy);
60
+ console.log(`Jouzu self-update policy: ${state.policy}`);
61
+ return;
62
+ }
63
+ if (parsed.operation === "check") {
64
+ const result = updater.check();
65
+ if (parsed.json)
66
+ console.log(JSON.stringify(result, null, 2));
67
+ else if (result.status === "available") {
68
+ console.log(`Jouzu ${result.version} is available (installed ${result.installedVersion})`);
69
+ }
70
+ else {
71
+ console.log(`Jouzu ${result.installedVersion} is current (latest ${result.version})`);
72
+ }
73
+ return;
74
+ }
75
+ if (parsed.operation === "apply") {
76
+ const result = updater.apply();
77
+ console.log(result.changed
78
+ ? `Updated Jouzu to ${result.version}. Restart Jouzu to use the new version.`
79
+ : `Jouzu ${result.version} is already current.`);
80
+ return;
81
+ }
82
+ const status = updater.status();
83
+ console.log(parsed.json ? JSON.stringify(status, null, 2) : formatUpdateStatus(status));
84
+ return;
85
+ }
86
+ if (interactiveStartup) {
87
+ const startupUpdate = updater.startup();
88
+ delete process.env.JOUZU_INTERNAL_UPDATE_RESTARTED;
89
+ if (startupUpdate.message)
90
+ console.error(startupUpdate.message);
91
+ if (startupUpdate.action === "restart") {
92
+ console.log(`Updated Jouzu ${metadata.jouzuVersion} → ${startupUpdate.version}; restarting…`);
93
+ process.exitCode = relaunchUpdatedJouzu({ executable, args, env: process.env });
94
+ return;
95
+ }
96
+ }
97
+ const inheritedPiAgentDir = process.env.PI_CODING_AGENT_DIR;
98
+ const inheritedPiSessionDir = process.env.PI_CODING_AGENT_SESSION_DIR;
99
+ const profileChoicePath = join(paths.stateDir, "profile-choice.json");
100
+ let profile = resolveProfileSelection(paths, {
101
+ explicitProfile: parsed.options.profile,
102
+ allowSavedChoice: parsed.kind !== "version",
103
+ interactiveStartup,
104
+ });
105
+ let firstRunChoice = false;
106
+ if (profile.needsFirstRunInput) {
107
+ profile = {
108
+ id: await promptForJapaneseSupport(),
109
+ source: "first-run choice",
110
+ needsFirstRunInput: false,
111
+ };
112
+ firstRunChoice = true;
113
+ }
114
+ if (parsed.kind === "profile") {
115
+ const selected = parsed.profile ?? profile.id;
116
+ const bundled = loadBundledProfile(selected);
117
+ if (parsed.operation === "plan") {
118
+ const plan = planProfile(bundled, paths, metadata.jouzuVersion);
119
+ console.log(parsed.json ? JSON.stringify(plan, null, 2) : formatProfilePlan(plan));
120
+ if (plan.actions.some((action) => action.type === "conflict"))
121
+ process.exitCode = 3;
122
+ return;
123
+ }
124
+ const result = applyProfile(bundled, paths, metadata.jouzuVersion);
125
+ writeProfileChoice(profileChoicePath, selected);
126
+ console.log(formatProfilePlan(result.plan));
127
+ console.log(result.changed ? `Applied transaction: ${result.transactionId}` : "Profile already converged");
128
+ if (result.backupDir)
129
+ console.log(`Backups: ${result.backupDir}`);
130
+ return;
131
+ }
132
+ if (interactiveStartup) {
133
+ const bootstrap = ensureDefaultKeybindings(paths);
134
+ if (bootstrap.message)
135
+ console.error(bootstrap.message);
136
+ }
137
+ configurePiProcess(paths);
138
+ let pi;
139
+ let piRuntimeVersion;
140
+ let piImportDiagnostic;
141
+ try {
142
+ pi = await loadPiRuntime();
143
+ piRuntimeVersion = pi.VERSION;
144
+ }
145
+ catch (error) {
146
+ piImportDiagnostic = error instanceof Error ? error.message : String(error);
147
+ }
148
+ if (parsed.kind === "version") {
149
+ if (piImportDiagnostic || !piRuntimeVersion) {
150
+ throw new Error(`Jouzu could not load its pinned Pi runtime: ${piImportDiagnostic ?? "unavailable"}`);
151
+ }
152
+ if (piRuntimeVersion !== metadata.piVersion) {
153
+ throw new Error(`loaded Pi ${piRuntimeVersion} does not match Jouzu's exact pin ${metadata.piVersion}`);
154
+ }
155
+ console.log(`jouzu ${metadata.jouzuVersion}`);
156
+ console.log(`pi ${piRuntimeVersion}`);
157
+ console.log(`profile schema ${metadata.profileSchemaVersion}`);
158
+ return;
159
+ }
160
+ if (parsed.kind === "doctor") {
161
+ const desiredProfile = loadBundledProfile(profile.id);
162
+ let updateStatus;
163
+ let updateDiagnostic;
164
+ let keybindingPlan;
165
+ let keybindingDiagnostic;
166
+ try {
167
+ updateStatus = updater.status();
168
+ }
169
+ catch (error) {
170
+ updateDiagnostic = error instanceof Error ? error.message : String(error);
171
+ }
172
+ try {
173
+ keybindingPlan = planKeybindings(paths);
174
+ }
175
+ catch (error) {
176
+ keybindingDiagnostic = error instanceof Error ? error.message : String(error);
177
+ }
178
+ const result = createDoctorReport({
179
+ metadata,
180
+ paths,
181
+ profile,
182
+ piRuntimeVersion: piRuntimeVersion ?? "unavailable",
183
+ piRuntimeDiagnostic: piImportDiagnostic,
184
+ executable,
185
+ inheritedPiAgentDir,
186
+ inheritedPiSessionDir,
187
+ desiredProfileManifestSha256: desiredProfile.manifestSha256,
188
+ ...(updateStatus ? { updateStatus } : {}),
189
+ ...(updateDiagnostic ? { updateDiagnostic } : {}),
190
+ ...(keybindingPlan ? { keybindingPlan } : {}),
191
+ ...(keybindingDiagnostic ? { keybindingDiagnostic } : {}),
192
+ });
193
+ console.log(result.text);
194
+ if (!result.healthy)
195
+ process.exitCode = 1;
196
+ return;
197
+ }
198
+ const bundled = loadBundledProfile(profile.id);
199
+ applyProfile(bundled, paths, metadata.jouzuVersion);
200
+ if (firstRunChoice) {
201
+ writeProfileChoice(profileChoicePath, profile.id);
202
+ console.log(profile.id === "ja" ? "Japanese support enabled." : "Continuing with the Core profile.");
203
+ }
204
+ clearInteractiveStartup(parsed.args);
205
+ if (piImportDiagnostic || !pi || !piRuntimeVersion) {
206
+ throw new Error(`Jouzu could not load its pinned Pi runtime: ${piImportDiagnostic ?? "unavailable"}`);
207
+ }
208
+ if (piRuntimeVersion !== metadata.piVersion) {
209
+ throw new Error(`loaded Pi ${piRuntimeVersion} does not match Jouzu's exact pin ${metadata.piVersion}`);
210
+ }
211
+ await withJouzuResumeHint(() => pi.main(parsed.args, {
212
+ extensionFactories: [createJouzuPresentationExtension(metadata, profile)],
213
+ }));
31
214
  }
32
- export {};
215
+ runCli(process.argv.slice(2)).catch((error) => {
216
+ if (error instanceof KeybindingConflictError) {
217
+ console.error(formatKeybindingPlan(error.plan));
218
+ console.error('Resolve the conflicts above, then run "jouzu keybindings apply" again.');
219
+ process.exitCode = error.exitCode;
220
+ return;
221
+ }
222
+ if (error instanceof KeybindingConfigError) {
223
+ console.error(`Jouzu keybindings failed: ${error.message}`);
224
+ process.exitCode = error.exitCode;
225
+ return;
226
+ }
227
+ if (error instanceof UpdateError) {
228
+ console.error(`Jouzu update failed: ${error.message}`);
229
+ process.exitCode = error.exitCode;
230
+ return;
231
+ }
232
+ if (error instanceof ProfileStateError) {
233
+ console.error(`Jouzu profile state is unreadable: ${error.message}`);
234
+ console.error('Recovery: repair or remove the profile state file, then run "jouzu profile plan" and "jouzu profile apply" again.');
235
+ process.exitCode = 1;
236
+ return;
237
+ }
238
+ if (error instanceof ProfileConflictError) {
239
+ console.error(formatProfilePlan(error.plan));
240
+ console.error('Resolve the conflicts above, then run "jouzu profile apply" again.');
241
+ process.exitCode = error.exitCode;
242
+ return;
243
+ }
244
+ if (error instanceof UsageError) {
245
+ console.error(`Error: ${error.message}`);
246
+ console.error('Run "jouzu --help" for Jouzu usage or "jouzu pi --help" for Pi usage.');
247
+ process.exitCode = error.exitCode;
248
+ return;
249
+ }
250
+ const message = error instanceof Error ? error.message : String(error);
251
+ console.error(`Jouzu failed: ${message}`);
252
+ process.exitCode = 1;
253
+ });
33
254
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,MAAM,eAAe,GACpB,+GAA+G,CAAC;AAEjH,SA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