@ekzs/cli 0.3.4 → 0.3.5
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
CHANGED
|
@@ -1,43 +1,59 @@
|
|
|
1
1
|
# @ekzs/cli
|
|
2
2
|
|
|
3
|
+
**Version:** 0.3.5
|
|
4
|
+
|
|
3
5
|
**Ekz** is a local coding agent for e-Kwanza Pagamento Integrado v2.4 — like Claude Code, but specialized for `@ekzs/connect`, GPO, EMIS ref, and Ticket integrations.
|
|
4
6
|
|
|
5
|
-
Runs **in your repo**
|
|
7
|
+
Runs **in your repo**. Edits files directly in **agent** or **plan** mode. You bring your own LLM key (BYOK) — Cursor, OpenAI, Anthropic, DeepSeek, and more.
|
|
6
8
|
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
12
|
npm install -g @ekzs/cli
|
|
13
|
+
ekz setup
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
Clean install (~15 packages)
|
|
14
|
-
|
|
15
|
-
**Cursor provider only** (optional — pulls native deps + npm deprecation noise from `@cursor/sdk`):
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install -g @cursor/sdk
|
|
19
|
-
```
|
|
16
|
+
Clean install (~15 packages). Keys are configured locally via `ekz setup` or `ekz providers` — never committed to git.
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
**Cursor:** if you pick Cursor during `ekz setup`, Ekz checks for `@cursor/sdk` **before** asking for your API key and offers to run `npm install -g @cursor/sdk` for you. You can also install it yourself beforehand:
|
|
22
19
|
|
|
23
20
|
```bash
|
|
24
21
|
npm install -g @ekzs/cli @cursor/sdk
|
|
25
22
|
```
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
Other providers (OpenAI, Anthropic, etc.) need no extra packages.
|
|
28
25
|
|
|
29
|
-
First run
|
|
26
|
+
## First run — `ekz setup`
|
|
30
27
|
|
|
31
28
|
```bash
|
|
32
29
|
ekz setup
|
|
33
30
|
# aliases: ekz configurar · ekz 设置
|
|
34
31
|
```
|
|
35
32
|
|
|
36
|
-
Wizard steps:
|
|
33
|
+
Wizard steps:
|
|
34
|
+
|
|
35
|
+
1. **Language** — Português · English · 中文
|
|
36
|
+
2. **Your name** — shown on the splash screen
|
|
37
|
+
3. **Provider or offline** — configure one LLM key, or skip to doctor/scan-only mode
|
|
38
|
+
|
|
39
|
+
When you configure a provider:
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
- Pick from the **numbered provider list**
|
|
42
|
+
- **Cursor only:** Ekz checks for `@cursor/sdk` and offers to install it **before** the API key step
|
|
43
|
+
- Paste your **API key**
|
|
44
|
+
- Pick a **model from a predefined list** (Enter = default)
|
|
45
|
+
- Setup **finishes and exits** — then run `ekz` to start the agent
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
No base URL prompts — endpoints are predefined per provider.
|
|
48
|
+
|
|
49
|
+
Stored in:
|
|
50
|
+
|
|
51
|
+
| File | Contents |
|
|
52
|
+
|------|----------|
|
|
53
|
+
| `~/.ekz/config.json` | locale, name, offline flag, setup complete |
|
|
54
|
+
| `~/.ekz/providers.json` | active provider, API keys, models (mode `600`) |
|
|
55
|
+
|
|
56
|
+
Without setup or a provider, `ekz` shows:
|
|
41
57
|
|
|
42
58
|
```
|
|
43
59
|
Setup required · Configuração necessária · 需要设置
|
|
@@ -47,78 +63,78 @@ Setup required · Configuração necessária · 需要设置
|
|
|
47
63
|
zh: 运行 `ekz setup` 或 `ekz --offline`
|
|
48
64
|
```
|
|
49
65
|
|
|
50
|
-
Supported providers
|
|
51
|
-
|
|
52
|
-
| Mode | BYOK behavior |
|
|
53
|
-
|------|----------------|
|
|
54
|
-
| `agent` | Cursor → local SDK; others → tool loop (read/write/run) |
|
|
55
|
-
| `plan` | Same, plan-first instructions |
|
|
56
|
-
| `ask` | Chat only (Cursor uses lightweight Cursor agent) |
|
|
57
|
-
|
|
58
|
-
**Localized commands:** `ekz provedores` / `/provedores` (PT) · `ekz 供应商` / `/供应商` (ZH)
|
|
66
|
+
### Supported providers
|
|
59
67
|
|
|
60
|
-
|
|
68
|
+
| Provider | Example models |
|
|
69
|
+
|----------|----------------|
|
|
70
|
+
| **Cursor** | Requires `@cursor/sdk` (offered during setup) · `composer-2.5-fast`, `gpt-5.3-codex`, … |
|
|
71
|
+
| **OpenAI** | `gpt-4o`, `gpt-4o-mini`, `o1`, `o3-mini`, … |
|
|
72
|
+
| **Anthropic** | `claude-sonnet-4-20250514`, `claude-opus-4-20250514`, … |
|
|
73
|
+
| **DeepSeek** | `deepseek-chat`, `deepseek-reasoner` |
|
|
74
|
+
| **Kimi (Moonshot)** | `moonshot-v1-8k`, `moonshot-v1-32k`, … |
|
|
75
|
+
| **Groq** | `llama-3.3-70b-versatile`, … |
|
|
76
|
+
| **Mistral** | `mistral-large-latest`, `codestral-latest`, … |
|
|
77
|
+
| **Google Gemini** | `gemini-2.0-flash`, `gemini-1.5-pro`, … |
|
|
78
|
+
| **Ollama** | `llama3.2`, `qwen2.5`, … (local) |
|
|
61
79
|
|
|
62
|
-
|
|
80
|
+
Manage keys anytime:
|
|
63
81
|
|
|
64
82
|
```bash
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
#
|
|
68
|
-
./ekz # Git Bash / macOS / Linux
|
|
69
|
-
.\ekz # PowerShell / cmd (resolves to ekz.cmd)
|
|
70
|
-
npx ekz # any shell, from repo root
|
|
71
|
-
|
|
72
|
-
# Option B — npm script
|
|
73
|
-
npm run ekz # interactive REPL
|
|
74
|
-
npm run ekz -- agent "fix webhook"
|
|
75
|
-
|
|
76
|
-
# Option C — global command (once)
|
|
77
|
-
npm run setup:cli # build + npm link
|
|
78
|
-
ekz # works everywhere
|
|
83
|
+
ekz providers # full menu — configure, switch, remove
|
|
84
|
+
ekz provedores # PT
|
|
85
|
+
ekz 供应商 # ZH
|
|
79
86
|
```
|
|
80
87
|
|
|
81
|
-
|
|
88
|
+
In the REPL: `/providers`, `/provedores`, `/供应商`
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
### Modes
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
| Mode | Aliases | Behavior |
|
|
93
|
+
|------|---------|----------|
|
|
94
|
+
| **agent** | default, `agente`, `代理` | Edits files and runs commands |
|
|
95
|
+
| **plan** | `plano`, `计划` | Plans before editing |
|
|
96
|
+
| **ask** | `perguntar`, `问答`, `chat` | Q&A only — no file edits |
|
|
90
97
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
| Mode | BYOK routing |
|
|
99
|
+
|------|----------------|
|
|
100
|
+
| **agent / plan** | Cursor → `@cursor/sdk`; others → tool loop (`read_file`, `write_file`, `run_command`) |
|
|
101
|
+
| **ask** | Chat API (Cursor uses lightweight Cursor agent) |
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
Optional one-off override: `--api-key crsr_...` in agent/plan mode.
|
|
96
104
|
|
|
97
105
|
## Commands
|
|
98
106
|
|
|
99
107
|
| Command | Description |
|
|
100
108
|
|---------|-------------|
|
|
101
|
-
| `ekz`
|
|
109
|
+
| `ekz setup` | First-run wizard — language, name, provider or offline |
|
|
110
|
+
| `ekz` / `ekz agent` | Interactive REPL (default: agent mode) |
|
|
102
111
|
| `ekz --mode plan` | Plan before editing files |
|
|
103
112
|
| `ekz --mode ask` | BYOK Q&A, no file edits |
|
|
113
|
+
| `ekz --offline` | Doctor/scan answers only — no LLM |
|
|
104
114
|
| `ekz agent "fix webhook"` | One-shot task with file edits |
|
|
105
115
|
| `ekz fix` | Full integration audit + auto-fix pass |
|
|
106
116
|
| `ekz ask "…"` | BYOK Q&A only |
|
|
107
117
|
| `ekz ask -i` | Interactive ask REPL |
|
|
108
|
-
| `ekz providers` |
|
|
118
|
+
| `ekz providers` | Manage LLM API keys (BYOK) |
|
|
109
119
|
| `ekz agent --resume` | Continue last session (`.ekz/session.json`) |
|
|
110
|
-
| `ekz doctor` | Env +
|
|
111
|
-
| `ekz health` | OAuth + rail health (free) |
|
|
112
|
-
| `ekz scan` | Lint common mistakes (free) |
|
|
113
|
-
| `ekz webhook <url>` | POST sample webhook (free) |
|
|
120
|
+
| `ekz doctor` | Env + credential checks (**free**) |
|
|
121
|
+
| `ekz health` | OAuth + rail health (**free**) |
|
|
122
|
+
| `ekz scan` | Lint common integration mistakes (**free**) |
|
|
123
|
+
| `ekz webhook <url>` | POST sample webhook (**free**) |
|
|
114
124
|
|
|
115
125
|
### REPL shortcuts
|
|
116
126
|
|
|
117
|
-
Type `/help` in the REPL for the full list
|
|
127
|
+
Type `/help` in the REPL for the full list. Also:
|
|
128
|
+
|
|
129
|
+
`/providers` · `/mode agent|plan|ask` · `/doctor` · `/scan` · `/lang pt|en|zh` · `/save` · `/resume`
|
|
118
130
|
|
|
119
131
|
## Examples
|
|
120
132
|
|
|
121
133
|
```bash
|
|
134
|
+
# First time
|
|
135
|
+
ekz setup
|
|
136
|
+
ekz
|
|
137
|
+
|
|
122
138
|
# Interactive — stay in your project and iterate
|
|
123
139
|
ekz agent
|
|
124
140
|
|
|
@@ -130,19 +146,55 @@ ekz fix "Ticket webhook returns 401 on x-signature"
|
|
|
130
146
|
|
|
131
147
|
# Plan before editing
|
|
132
148
|
ekz --mode plan "Add emis_ref rail to checkout"
|
|
133
|
-
# or shorthand:
|
|
134
|
-
ekz agent --plan "Add emis_ref rail to checkout"
|
|
135
149
|
|
|
136
150
|
# Ask mode (no local edits)
|
|
137
151
|
ekz --mode ask "What env vars am I missing for Ticket?"
|
|
138
152
|
|
|
153
|
+
# Free checks before touching the agent
|
|
154
|
+
ekz doctor
|
|
155
|
+
ekz scan
|
|
156
|
+
ekz webhook http://localhost:3000/api/webhooks/ekwanza
|
|
157
|
+
|
|
139
158
|
# Resume yesterday's session
|
|
140
159
|
ekz agent --resume
|
|
141
160
|
```
|
|
142
161
|
|
|
143
162
|
## Billing
|
|
144
163
|
|
|
145
|
-
|
|
164
|
+
**BYOK only** — usage bills through your provider account (Cursor, OpenAI, Anthropic, etc.). Ekz does not resell LLM credits.
|
|
165
|
+
|
|
166
|
+
Free commands (no API key): `doctor`, `health`, `scan`, `webhook`.
|
|
167
|
+
|
|
168
|
+
## Run from this repo
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
npm run build:cli
|
|
172
|
+
|
|
173
|
+
# Option A — wrapper (no global install)
|
|
174
|
+
./ekz # Git Bash / macOS / Linux
|
|
175
|
+
.\ekz # PowerShell / cmd
|
|
176
|
+
npx ekz # any shell, from repo root
|
|
177
|
+
|
|
178
|
+
# Option B — npm script
|
|
179
|
+
npm run ekz
|
|
180
|
+
npm run ekz -- agent "fix webhook"
|
|
181
|
+
|
|
182
|
+
# Option C — global command
|
|
183
|
+
npm run setup:cli # build + npm link
|
|
184
|
+
ekz
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Windows / PowerShell
|
|
188
|
+
|
|
189
|
+
```powershell
|
|
190
|
+
.\ekz # resolves to ekz.cmd
|
|
191
|
+
npx ekz
|
|
192
|
+
npm run setup:cli # then `ekz` works globally
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Shell type is detected at launch and injected into agent turns. Override with `EKZ_AGENT_SHELL=powershell|bash|cmd`.
|
|
196
|
+
|
|
197
|
+
In PowerShell, use `curl.exe` for manual HTTP tests — bare `curl` is an alias for `Invoke-WebRequest`. Prefer `ekz doctor`, `ekz health`, `ekz webhook <url>`.
|
|
146
198
|
|
|
147
199
|
## Session file
|
|
148
200
|
|
|
@@ -150,35 +202,42 @@ You bring your own keys (BYOK). Usage bills through **your** provider account (C
|
|
|
150
202
|
|
|
151
203
|
## Agent skills
|
|
152
204
|
|
|
153
|
-
|
|
205
|
+
15 skills under `packages/cli/skills/`. On build, they sync to `.cursor/skills/` for local Cursor use.
|
|
154
206
|
|
|
155
207
|
| Skill | Use when |
|
|
156
208
|
|-------|----------|
|
|
157
|
-
| `ekz-connect` | Orchestrator —
|
|
158
|
-
| `ekz-payment-core-architecture` |
|
|
159
|
-
| `ekz-ekwanza-provider-adapter` |
|
|
160
|
-
| `ekz-webhook-normalization` |
|
|
161
|
-
| `ekz-one-time-product-payments` | Products,
|
|
162
|
-
| `ekz-ticket-invite-selling` | Reservations, invite/ticket issuance
|
|
163
|
-
| `ekz-subscription-billing` | Recurring
|
|
164
|
-
| `ekz-overage-billing` | Metered usage, overage charges
|
|
165
|
-
| `ekz-integration-playbook` | Adapting
|
|
209
|
+
| `ekz-connect` | Orchestrator — SDK entry points |
|
|
210
|
+
| `ekz-payment-core-architecture` | Primitives, state machines, idempotency |
|
|
211
|
+
| `ekz-ekwanza-provider-adapter` | Auth, config, GPO, EMIS ref, Ticket API |
|
|
212
|
+
| `ekz-webhook-normalization` | Callbacks, x-signature, dedupe, routing |
|
|
213
|
+
| `ekz-one-time-product-payments` | Products, checkout links, fulfillment |
|
|
214
|
+
| `ekz-ticket-invite-selling` | Reservations, invite/ticket issuance |
|
|
215
|
+
| `ekz-subscription-billing` | Recurring payments, grace, entitlements |
|
|
216
|
+
| `ekz-overage-billing` | Metered usage, overage charges |
|
|
217
|
+
| `ekz-integration-playbook` | Adapting patterns into existing codebases |
|
|
166
218
|
| `ekz-sdk-cli` | `@ekzs/connect`, `ekz doctor`, CLI |
|
|
219
|
+
| `ekz-data-layer-design` | Store abstraction choices |
|
|
220
|
+
| `ekz-data-postgres` | Supabase / Postgres |
|
|
221
|
+
| `ekz-data-mysql` | MySQL |
|
|
222
|
+
| `ekz-data-sqlite` | SQLite |
|
|
223
|
+
| `ekz-data-mongo` | MongoDB |
|
|
167
224
|
|
|
168
225
|
```bash
|
|
169
|
-
npm run sync:skills --prefix packages/cli
|
|
226
|
+
npm run sync:skills --prefix packages/cli
|
|
170
227
|
```
|
|
171
228
|
|
|
172
|
-
|
|
229
|
+
## Language
|
|
173
230
|
|
|
174
|
-
|
|
231
|
+
Default replies: **Portuguese (Angola)**. Switch in the REPL with `/lang pt`, `/lang en`, `/lang zh`, or start with `ekz --lang en`.
|
|
175
232
|
|
|
176
|
-
|
|
233
|
+
## Publish (maintainers)
|
|
177
234
|
|
|
235
|
+
```bash
|
|
236
|
+
npm run build:cli
|
|
237
|
+
npm run publish:cli
|
|
178
238
|
```
|
|
179
|
-
/lang pt
|
|
180
|
-
/lang en
|
|
181
|
-
/ajuda
|
|
182
|
-
```
|
|
183
239
|
|
|
184
|
-
|
|
240
|
+
## Related
|
|
241
|
+
|
|
242
|
+
- [`@ekzs/connect`](../sdk/README.md) — TypeScript SDK for v2.4
|
|
243
|
+
- [Full report](../../docs/EKZ-CONNECT-FULL-REPORT.md) — product + agent reference
|
|
@@ -3,6 +3,13 @@ export declare class CursorSdkMissingError extends Error {
|
|
|
3
3
|
constructor(locale?: EkzLocale);
|
|
4
4
|
}
|
|
5
5
|
type CursorSdkModule = typeof import("@cursor/sdk");
|
|
6
|
+
export declare function clearCursorSdkCache(): void;
|
|
7
|
+
export declare function probeCursorSdk(): Promise<boolean>;
|
|
6
8
|
export declare function loadCursorSdk(locale?: EkzLocale): Promise<CursorSdkModule>;
|
|
9
|
+
/**
|
|
10
|
+
* Before Cursor API key entry: ensure @cursor/sdk is installed.
|
|
11
|
+
* Offers to run `npm install -g @cursor/sdk` when missing.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ensureCursorSdkReady(locale: EkzLocale): Promise<boolean>;
|
|
7
14
|
export type { SDKAgent } from "@cursor/sdk";
|
|
8
15
|
//# sourceMappingURL=cursor-sdk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-sdk.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/cursor-sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cursor-sdk.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/cursor-sdk.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,MAAM,GAAE,SAAgB;CAWrC;AAED,KAAK,eAAe,GAAG,cAAc,aAAa,CAAC,CAAC;AAoBpD,wBAAgB,mBAAmB,SAElC;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAOvD;AAED,wBAAsB,aAAa,CAAC,MAAM,GAAE,SAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAQtF;AAcD;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAwE9E;AAED,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import readline from "readline";
|
|
1
3
|
import { providersCommandLabels } from "../commands-i18n.js";
|
|
4
|
+
import { info, ok, warn } from "../output.js";
|
|
5
|
+
import { muted } from "../theme.js";
|
|
2
6
|
export class CursorSdkMissingError extends Error {
|
|
3
7
|
constructor(locale = "en") {
|
|
4
8
|
const p = providersCommandLabels(locale);
|
|
@@ -12,6 +16,34 @@ export class CursorSdkMissingError extends Error {
|
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
let cached = null;
|
|
19
|
+
function t(locale, pt, en, zh) {
|
|
20
|
+
if (locale === "pt")
|
|
21
|
+
return pt;
|
|
22
|
+
if (locale === "zh")
|
|
23
|
+
return zh;
|
|
24
|
+
return en;
|
|
25
|
+
}
|
|
26
|
+
async function askLine(prompt) {
|
|
27
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
rl.question(prompt, (answer) => {
|
|
30
|
+
rl.close();
|
|
31
|
+
resolve(answer.trim());
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function clearCursorSdkCache() {
|
|
36
|
+
cached = null;
|
|
37
|
+
}
|
|
38
|
+
export async function probeCursorSdk() {
|
|
39
|
+
try {
|
|
40
|
+
await import("@cursor/sdk");
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
15
47
|
export async function loadCursorSdk(locale = "en") {
|
|
16
48
|
if (cached)
|
|
17
49
|
return cached;
|
|
@@ -23,3 +55,42 @@ export async function loadCursorSdk(locale = "en") {
|
|
|
23
55
|
throw new CursorSdkMissingError(locale);
|
|
24
56
|
}
|
|
25
57
|
}
|
|
58
|
+
async function runNpmInstallGlobal(packageName) {
|
|
59
|
+
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
const child = spawn(npm, ["install", "-g", packageName], {
|
|
62
|
+
stdio: "inherit",
|
|
63
|
+
shell: process.platform === "win32",
|
|
64
|
+
});
|
|
65
|
+
child.on("error", () => resolve(false));
|
|
66
|
+
child.on("close", (code) => resolve(code === 0));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Before Cursor API key entry: ensure @cursor/sdk is installed.
|
|
71
|
+
* Offers to run `npm install -g @cursor/sdk` when missing.
|
|
72
|
+
*/
|
|
73
|
+
export async function ensureCursorSdkReady(locale) {
|
|
74
|
+
clearCursorSdkCache();
|
|
75
|
+
if (await probeCursorSdk()) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
console.log("");
|
|
79
|
+
info(t(locale, "Cursor usa o pacote @cursor/sdk para correr o agente local.", "Cursor uses @cursor/sdk to run the local agent.", "Cursor 使用 @cursor/sdk 运行本地 agent。"));
|
|
80
|
+
console.log(` ${muted("npm install -g @cursor/sdk")}`);
|
|
81
|
+
console.log("");
|
|
82
|
+
const answer = await askLine(t(locale, " Instalar agora? [Y/n]: ", " Install now? [Y/n]: ", " 现在安装? [Y/n]: "));
|
|
83
|
+
if (answer && !["y", "yes", "s", "sim", "是", ""].includes(answer.toLowerCase())) {
|
|
84
|
+
warn(t(locale, "Instalação cancelada — escolhe outro provider ou corre npm install -g @cursor/sdk.", "Install skipped — pick another provider or run npm install -g @cursor/sdk.", "已跳过安装 — 请选择其他 provider 或运行 npm install -g @cursor/sdk。"));
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
info(t(locale, "A instalar @cursor/sdk…", "Installing @cursor/sdk…", "正在安装 @cursor/sdk…"));
|
|
88
|
+
const installed = await runNpmInstallGlobal("@cursor/sdk");
|
|
89
|
+
clearCursorSdkCache();
|
|
90
|
+
if (!installed || !(await probeCursorSdk())) {
|
|
91
|
+
warn(t(locale, "Instalação falhou. Tenta manualmente: npm install -g @cursor/sdk", "Install failed. Try manually: npm install -g @cursor/sdk", "安装失败。请手动运行: npm install -g @cursor/sdk"));
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
ok(t(locale, "@cursor/sdk instalado.", "@cursor/sdk installed.", "@cursor/sdk 已安装。"));
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
@@ -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;
|
|
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;AA2N9C,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"}
|
package/dist/lib/providers/ui.js
CHANGED
|
@@ -5,6 +5,7 @@ import { askWithPlaceholder, formatInputPrompt } from "../ui/prompt.js";
|
|
|
5
5
|
import { PROVIDER_CATALOG, getProviderDefinition } from "./catalog.js";
|
|
6
6
|
import { listProviderRows, resolveActiveCredentials, } from "./credentials.js";
|
|
7
7
|
import { maskApiKey, providersFilePath, removeStoredProvider, setActiveProvider, setStoredProvider, } from "./store.js";
|
|
8
|
+
import { ensureCursorSdkReady } from "./cursor-sdk.js";
|
|
8
9
|
function providersTitle(locale) {
|
|
9
10
|
if (locale === "pt")
|
|
10
11
|
return "Provedores (BYOK)";
|
|
@@ -132,6 +133,11 @@ async function configureProvider(id, locale) {
|
|
|
132
133
|
console.log(` ${c.bold}${def.name}${c.reset} — ${muted(def.description)}`);
|
|
133
134
|
console.log(` ${muted(def.docsUrl)}`);
|
|
134
135
|
console.log("");
|
|
136
|
+
if (id === "cursor") {
|
|
137
|
+
const sdkReady = await ensureCursorSdkReady(locale);
|
|
138
|
+
if (!sdkReady)
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
135
141
|
const keyPrompt = t(locale, `Cola a API key (${def.keyHint}): `, `Paste API key (${def.keyHint}): `, `粘贴 API key (${def.keyHint}): `);
|
|
136
142
|
const apiKey = await askLine(keyPrompt, true);
|
|
137
143
|
if (!apiKey) {
|