@ekzs/cli 0.3.0 → 0.3.4

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 (49) hide show
  1. package/README.md +31 -5
  2. package/dist/commands/ask.d.ts.map +1 -1
  3. package/dist/commands/ask.js +16 -3
  4. package/dist/commands/local-agent.d.ts.map +1 -1
  5. package/dist/commands/local-agent.js +146 -60
  6. package/dist/commands/setup.d.ts +5 -0
  7. package/dist/commands/setup.d.ts.map +1 -0
  8. package/dist/commands/setup.js +4 -0
  9. package/dist/index.js +18 -1
  10. package/dist/lib/commands-i18n.d.ts +2 -2
  11. package/dist/lib/commands-i18n.d.ts.map +1 -1
  12. package/dist/lib/commands-i18n.js +21 -12
  13. package/dist/lib/global-config.d.ts +19 -0
  14. package/dist/lib/global-config.d.ts.map +1 -0
  15. package/dist/lib/global-config.js +52 -0
  16. package/dist/lib/help.d.ts.map +1 -1
  17. package/dist/lib/help.js +3 -0
  18. package/dist/lib/locale.d.ts.map +1 -1
  19. package/dist/lib/locale.js +2 -1
  20. package/dist/lib/onboarding.d.ts +20 -0
  21. package/dist/lib/onboarding.d.ts.map +1 -0
  22. package/dist/lib/onboarding.js +129 -0
  23. package/dist/lib/providers/catalog.d.ts +5 -0
  24. package/dist/lib/providers/catalog.d.ts.map +1 -1
  25. package/dist/lib/providers/catalog.js +34 -1
  26. package/dist/lib/providers/credentials.d.ts +2 -0
  27. package/dist/lib/providers/credentials.d.ts.map +1 -1
  28. package/dist/lib/providers/credentials.js +19 -3
  29. package/dist/lib/providers/cursor-runner.d.ts +2 -2
  30. package/dist/lib/providers/cursor-runner.d.ts.map +1 -1
  31. package/dist/lib/providers/cursor-runner.js +7 -5
  32. package/dist/lib/providers/cursor-sdk.d.ts +8 -0
  33. package/dist/lib/providers/cursor-sdk.d.ts.map +1 -0
  34. package/dist/lib/providers/cursor-sdk.js +25 -0
  35. package/dist/lib/providers/store.d.ts +1 -1
  36. package/dist/lib/providers/store.d.ts.map +1 -1
  37. package/dist/lib/providers/store.js +13 -7
  38. package/dist/lib/providers/ui.d.ts +2 -0
  39. package/dist/lib/providers/ui.d.ts.map +1 -1
  40. package/dist/lib/providers/ui.js +60 -24
  41. package/dist/lib/setup-messages.d.ts +4 -0
  42. package/dist/lib/setup-messages.d.ts.map +1 -0
  43. package/dist/lib/setup-messages.js +13 -0
  44. package/dist/lib/ui/splash.d.ts.map +1 -1
  45. package/dist/lib/ui/splash.js +4 -0
  46. package/dist/lib/version.d.ts +2 -0
  47. package/dist/lib/version.d.ts.map +1 -0
  48. package/dist/lib/version.js +13 -0
  49. package/package.json +10 -2
@@ -0,0 +1,25 @@
1
+ import { providersCommandLabels } from "../commands-i18n.js";
2
+ export class CursorSdkMissingError extends Error {
3
+ constructor(locale = "en") {
4
+ const p = providersCommandLabels(locale);
5
+ const msg = locale === "pt"
6
+ ? `Provider Cursor requer @cursor/sdk. Instala: npm install -g @cursor/sdk\nOu usa outro provider em ${p.repl}.`
7
+ : locale === "zh"
8
+ ? `Cursor provider 需要 @cursor/sdk。安装: npm install -g @cursor/sdk\n或在 ${p.repl} 选择其他 provider。`
9
+ : `Cursor provider requires @cursor/sdk. Run: npm install -g @cursor/sdk\nOr pick another provider via ${p.repl}.`;
10
+ super(msg);
11
+ this.name = "CursorSdkMissingError";
12
+ }
13
+ }
14
+ let cached = null;
15
+ export async function loadCursorSdk(locale = "en") {
16
+ if (cached)
17
+ return cached;
18
+ try {
19
+ cached = await import("@cursor/sdk");
20
+ return cached;
21
+ }
22
+ catch {
23
+ throw new CursorSdkMissingError(locale);
24
+ }
25
+ }
@@ -17,5 +17,5 @@ export declare function setStoredProvider(id: ProviderId, entry: StoredProvider)
17
17
  export declare function removeStoredProvider(id: ProviderId): void;
18
18
  export declare function setActiveProvider(id: ProviderId): void;
19
19
  export declare function resolveModel(id: ProviderId, stored?: StoredProvider): string;
20
- export declare function resolveBaseUrl(id: ProviderId, stored?: StoredProvider): string | undefined;
20
+ export declare function resolveBaseUrl(id: ProviderId, _stored?: StoredProvider): string | undefined;
21
21
  //# sourceMappingURL=store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,cAAc,CAAC;AAEtE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;CACxD,CAAC;AAWF,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,aAAa,CAcjD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,QAQpD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAE5E;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,QAKtE;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,UAAU,QAOlD;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,QAO/C;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,MAAM,CAG5E;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAG1F"}
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,cAAc,CAAC;AAGtE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;CACxD,CAAC;AAWF,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,aAAa,CAcjD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,QAQpD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAE5E;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,QAQtE;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,UAAU,QAOlD;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,QAO/C;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,MAAM,CAM5E;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAE3F"}
@@ -2,6 +2,7 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "f
2
2
  import { homedir } from "os";
3
3
  import { join } from "path";
4
4
  import { getProviderDefinition } from "./catalog.js";
5
+ import { clearGlobalOffline, markSetupComplete } from "../global-config.js";
5
6
  const EKZ_HOME = join(homedir(), ".ekz");
6
7
  const PROVIDERS_PATH = join(EKZ_HOME, "providers.json");
7
8
  function ensureEkzHome() {
@@ -49,10 +50,12 @@ export function getStoredProvider(id) {
49
50
  }
50
51
  export function setStoredProvider(id, entry) {
51
52
  const file = loadProvidersFile();
52
- file.providers[id] = entry;
53
- if (!file.active)
54
- file.active = id;
53
+ const { baseUrl: _ignored, ...rest } = entry;
54
+ file.providers[id] = rest;
55
+ file.active = id;
55
56
  saveProvidersFile(file);
57
+ clearGlobalOffline();
58
+ markSetupComplete();
56
59
  }
57
60
  export function removeStoredProvider(id) {
58
61
  const file = loadProvidersFile();
@@ -72,10 +75,13 @@ export function setActiveProvider(id) {
72
75
  }
73
76
  export function resolveModel(id, stored) {
74
77
  const def = getProviderDefinition(id);
75
- return stored?.model?.trim() || def?.defaultModel || "gpt-4o";
78
+ if (!def)
79
+ return stored?.model?.trim() || "gpt-4o";
80
+ const trimmed = stored?.model?.trim();
81
+ if (trimmed)
82
+ return trimmed;
83
+ return def.defaultModel;
76
84
  }
77
- export function resolveBaseUrl(id, stored) {
78
- if (stored?.baseUrl?.trim())
79
- return stored.baseUrl.trim();
85
+ export function resolveBaseUrl(id, _stored) {
80
86
  return getProviderDefinition(id)?.defaultBaseUrl;
81
87
  }
@@ -1,4 +1,6 @@
1
1
  import { type EkzLocale } from "../locale.js";
2
+ /** One-shot provider pick + configure — used by `ekz setup`. */
3
+ export declare function runSetupProviderWizard(locale?: EkzLocale): Promise<boolean>;
2
4
  export declare function runProvidersInteractive(locale?: EkzLocale): Promise<void>;
3
5
  export declare function formatActiveProviderLabel(locale: EkzLocale): string;
4
6
  //# sourceMappingURL=ui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/ui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AA+L9C,wBAAsB,uBAAuB,CAAC,MAAM,GAAE,SAAgB,iBAuDrE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAMnE"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/ui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAqN9C,gEAAgE;AAChE,wBAAsB,sBAAsB,CAAC,MAAM,GAAE,SAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBvF;AAED,wBAAsB,uBAAuB,CAAC,MAAM,GAAE,SAAgB,iBAuDrE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAMnE"}
@@ -88,10 +88,46 @@ function printProviderList(rows, locale) {
88
88
  console.log(` ${muted(t(locale, "[número] configurar · u usar · r remover · q sair", "[number] configure · u use · r remove · q quit", "[数字] 配置 · u 使用 · r 删除 · q 退出"))}`);
89
89
  console.log("");
90
90
  }
91
+ function printCatalogPicker(locale) {
92
+ console.log("");
93
+ console.log(` ${c.bold}${t(locale, "Escolhe o provedor", "Choose provider", "选择 provider")}${c.reset}`);
94
+ console.log("");
95
+ PROVIDER_CATALOG.forEach((def, index) => {
96
+ console.log(` ${c.bold}${String(index + 1).padStart(2)}.${c.reset} ${def.name.padEnd(16)} ${muted(def.description)}`);
97
+ });
98
+ console.log("");
99
+ }
100
+ async function pickModel(id, locale) {
101
+ const def = getProviderDefinition(id);
102
+ if (!def)
103
+ return null;
104
+ const defaultIndex = Math.max(0, def.models.findIndex((m) => m === def.defaultModel));
105
+ const defaultNum = defaultIndex + 1;
106
+ console.log("");
107
+ console.log(` ${c.bold}${t(locale, "Modelo", "Model", "模型")}${c.reset}`);
108
+ def.models.forEach((model, index) => {
109
+ const n = index + 1;
110
+ const tag = model === def.defaultModel
111
+ ? muted(t(locale, " · predefinição", " · default", " · 默认"))
112
+ : "";
113
+ console.log(` ${c.bold}${String(n).padStart(2)}.${c.reset} ${model}${tag}`);
114
+ });
115
+ console.log("");
116
+ const prompt = t(locale, ` Escolha [${defaultNum}]: `, ` Choice [${defaultNum}]: `, ` 选择 [${defaultNum}]: `);
117
+ const choice = await askLine(prompt);
118
+ if (!choice)
119
+ return def.defaultModel;
120
+ const num = Number(choice);
121
+ if (Number.isInteger(num) && num >= 1 && num <= def.models.length) {
122
+ return def.models[num - 1];
123
+ }
124
+ warn(t(locale, "Opção inválida — a usar predefinição.", "Invalid choice — using default.", "无效选项 — 使用默认。"));
125
+ return def.defaultModel;
126
+ }
91
127
  async function configureProvider(id, locale) {
92
128
  const def = getProviderDefinition(id);
93
129
  if (!def)
94
- return;
130
+ return false;
95
131
  console.log("");
96
132
  console.log(` ${c.bold}${def.name}${c.reset} — ${muted(def.description)}`);
97
133
  console.log(` ${muted(def.docsUrl)}`);
@@ -100,29 +136,14 @@ async function configureProvider(id, locale) {
100
136
  const apiKey = await askLine(keyPrompt, true);
101
137
  if (!apiKey) {
102
138
  warn(t(locale, "Chave vazia — cancelado.", "Empty key — cancelled.", "密钥为空,已取消。"));
103
- return;
104
- }
105
- const modelDefault = def.defaultModel;
106
- const modelPrompt = t(locale, `Modelo [${modelDefault}]: `, `Model [${modelDefault}]: `, `模型 [${modelDefault}]: `);
107
- const modelInput = await askLine(modelPrompt);
108
- const model = modelInput || modelDefault;
109
- let baseUrl;
110
- if (def.kind === "openai-compatible" || def.defaultBaseUrl) {
111
- const urlPrompt = t(locale, `Base URL [${def.defaultBaseUrl ?? "(default)"}]: `, `Base URL [${def.defaultBaseUrl ?? "(default)"}]: `, `Base URL [${def.defaultBaseUrl ?? "(default)"}]: `);
112
- const urlInput = await askLine(urlPrompt);
113
- if (urlInput)
114
- baseUrl = urlInput;
115
- }
116
- setStoredProvider(id, { apiKey, model, baseUrl });
117
- ok(t(locale, `Guardado ${def.name} (${maskApiKey(apiKey)})`, `Saved ${def.name} (${maskApiKey(apiKey)})`, `已保存 ${def.name} (${maskApiKey(apiKey)})`));
118
- const active = resolveActiveCredentials();
119
- if (!active || active.id !== id) {
120
- const useNow = await askLine(t(locale, "Usar como provider activo? [Y/n]: ", "Use as active provider? [Y/n]: ", "设为当前 provider? [Y/n]: "), false);
121
- if (!useNow || useNow.toLowerCase() === "y" || useNow.toLowerCase() === "s" || useNow === "") {
122
- setActiveProvider(id);
123
- ok(t(locale, `${def.name} activo.`, `${def.name} is now active.`, `${def.name} 已激活。`));
124
- }
139
+ return false;
125
140
  }
141
+ const model = await pickModel(id, locale);
142
+ if (!model)
143
+ return false;
144
+ setStoredProvider(id, { apiKey, model });
145
+ ok(t(locale, `Guardado ${def.name} · ${model} (${maskApiKey(apiKey)})`, `Saved ${def.name} · ${model} (${maskApiKey(apiKey)})`, `已保存 ${def.name} · ${model} (${maskApiKey(apiKey)})`));
146
+ return true;
126
147
  }
127
148
  function resolveRowTarget(rows, target) {
128
149
  const trimmed = target.trim().toLowerCase();
@@ -132,6 +153,21 @@ function resolveRowTarget(rows, target) {
132
153
  }
133
154
  return rows.find((r) => r.definition.id === trimmed);
134
155
  }
156
+ /** One-shot provider pick + configure — used by `ekz setup`. */
157
+ export async function runSetupProviderWizard(locale = "pt") {
158
+ printCatalogPicker(locale);
159
+ const prompt = t(locale, " Número do provedor (Enter cancelar): ", " Provider number (Enter to cancel): ", " Provider 编号 (Enter 取消): ");
160
+ const choice = (await askLine(prompt)).trim();
161
+ if (!choice)
162
+ return false;
163
+ const num = Number(choice);
164
+ if (!Number.isInteger(num) || num < 1 || num > PROVIDER_CATALOG.length) {
165
+ warn(t(locale, "Opção inválida.", "Invalid option.", "无效选项。"));
166
+ return false;
167
+ }
168
+ const def = PROVIDER_CATALOG[num - 1];
169
+ return configureProvider(def.id, locale);
170
+ }
135
171
  export async function runProvidersInteractive(locale = "pt") {
136
172
  while (true) {
137
173
  const rows = listProviderRows();
@@ -184,5 +220,5 @@ export function formatActiveProviderLabel(locale) {
184
220
  if (!creds) {
185
221
  return t(locale, "sem provider", "no provider", "未配置");
186
222
  }
187
- return `${creds.definition.name} · ${creds.maskedKey}`;
223
+ return `${creds.definition.name} · ${creds.model} · ${creds.maskedKey}`;
188
224
  }
@@ -0,0 +1,4 @@
1
+ /** Shown when agent needs provider but setup was not run (all locales). */
2
+ export declare function formatSetupRequiredMessage(): string;
3
+ export declare function providersSetupHint(_locale?: string): string;
4
+ //# sourceMappingURL=setup-messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-messages.d.ts","sourceRoot":"","sources":["../../src/lib/setup-messages.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wBAAgB,0BAA0B,IAAI,MAAM,CAQnD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D"}
@@ -0,0 +1,13 @@
1
+ /** Shown when agent needs provider but setup was not run (all locales). */
2
+ export function formatSetupRequiredMessage() {
3
+ return [
4
+ "Setup required · Configuração necessária · 需要设置",
5
+ "",
6
+ " pt: Corre `ekz setup` ou `ekz --offline`",
7
+ " en: Run `ekz setup` or `ekz --offline`",
8
+ " zh: 运行 `ekz setup` 或 `ekz --offline`",
9
+ ].join("\n");
10
+ }
11
+ export function providersSetupHint(_locale) {
12
+ return formatSetupRequiredMessage();
13
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"splash.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/splash.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,cAAc,CAAC;AACzD,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAMvD,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AA2GF,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAQtD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAG1D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,SAAI,GAAG,MAAM,CAIrE"}
1
+ {"version":3,"file":"splash.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/splash.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,cAAc,CAAC;AACzD,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAMvD,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AA6GF,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAQtD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAG1D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,SAAI,GAAG,MAAM,CAIrE"}
@@ -4,6 +4,7 @@ import { readFileSync } from "fs";
4
4
  import { dirname, join } from "path";
5
5
  import { fileURLToPath } from "url";
6
6
  import { formatSplashTool, splashHelpHint, splashSectionTitle, SPLASH_TOOLS, splashSessionLines, welcomeMessage, } from "../commands-i18n.js";
7
+ import { getGlobalUserName } from "../global-config.js";
7
8
  import { uiStrings } from "../locale.js";
8
9
  import { MODE_LABELS } from "../mode.js";
9
10
  import { detectShellEnvironment, shellLabel } from "../shell.js";
@@ -24,6 +25,9 @@ function packageVersion() {
24
25
  }
25
26
  }
26
27
  function displayName() {
28
+ const fromConfig = getGlobalUserName();
29
+ if (fromConfig)
30
+ return fromConfig.split(/\s+/)[0] ?? fromConfig;
27
31
  const fromEnv = process.env.EKZ_USER_NAME?.trim();
28
32
  if (fromEnv)
29
33
  return fromEnv.split(/\s+/)[0] ?? fromEnv;
@@ -0,0 +1,2 @@
1
+ export declare function packageVersion(): string;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/lib/version.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,IAAI,MAAM,CASvC"}
@@ -0,0 +1,13 @@
1
+ import { readFileSync } from "fs";
2
+ import { dirname, join } from "path";
3
+ import { fileURLToPath } from "url";
4
+ const here = dirname(fileURLToPath(import.meta.url));
5
+ export function packageVersion() {
6
+ try {
7
+ const pkg = JSON.parse(readFileSync(join(here, "../../package.json"), "utf8"));
8
+ return pkg.version ?? "0.0.0";
9
+ }
10
+ catch {
11
+ return "0.0.0";
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekzs/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.4",
4
4
  "description": "CLI agent for e-Kwanza v2.4 — health checks, code scan, webhook tests, AI assistance",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,12 +17,20 @@
17
17
  "prepublishOnly": "npm run build"
18
18
  },
19
19
  "dependencies": {
20
- "@cursor/sdk": "^1.0.13",
21
20
  "@ekzs/connect": "^0.1.0",
22
21
  "commander": "^12.1.0",
23
22
  "dotenv": "^16.4.7"
24
23
  },
24
+ "peerDependencies": {
25
+ "@cursor/sdk": "^1.0.13"
26
+ },
27
+ "peerDependenciesMeta": {
28
+ "@cursor/sdk": {
29
+ "optional": true
30
+ }
31
+ },
25
32
  "devDependencies": {
33
+ "@cursor/sdk": "^1.0.13",
26
34
  "@types/node": "^20",
27
35
  "typescript": "^5"
28
36
  },