ccjk 2.0.0 → 2.0.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.
- package/README.md +183 -181
- package/README.zh-CN.md +335 -0
- package/dist/chunks/claude-code-config-manager.mjs +7 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +1 -1
- package/dist/chunks/codex-config-switch.mjs +3 -3
- package/dist/chunks/codex-provider-manager.mjs +1 -1
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/commands.mjs +1 -1
- package/dist/chunks/features.mjs +10 -10
- package/dist/chunks/simple-config.mjs +21 -364
- package/dist/cli.mjs +387 -8
- package/dist/i18n/locales/en/configuration.json +12 -1
- package/dist/i18n/locales/en/menu.json +29 -1
- package/dist/i18n/locales/zh-CN/configuration.json +12 -1
- package/dist/i18n/locales/zh-CN/menu.json +29 -1
- package/dist/index.mjs +366 -7
- package/package.json +51 -48
package/README.zh-CN.md
CHANGED
|
@@ -233,6 +233,341 @@ permissions:
|
|
|
233
233
|
| 📚 **文档专家** | API文档、README | "为这个代码库写文档" |
|
|
234
234
|
| 🔄 **重构专家** | 整洁代码、SOLID | "应用设计模式重构" |
|
|
235
235
|
|
|
236
|
+
#### 📘 如何使用 AI 代理
|
|
237
|
+
|
|
238
|
+
**方法一:直接 @ 调用代理**
|
|
239
|
+
|
|
240
|
+
在 Claude Code 对话中,使用 `@代理名` 直接调用:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# 调用规划师代理进行任务分解
|
|
244
|
+
> @planner 我需要为应用添加用户认证功能
|
|
245
|
+
|
|
246
|
+
# 调用代码审查代理
|
|
247
|
+
> @ccjk-code-reviewer 请帮我审查 src/auth.ts 这个文件
|
|
248
|
+
|
|
249
|
+
# 调用安全专家
|
|
250
|
+
> @ccjk-security-expert 检查这个项目的安全漏洞
|
|
251
|
+
|
|
252
|
+
# 调用性能专家
|
|
253
|
+
> @ccjk-performance-expert 分析这个函数的性能问题
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**方法二:通过斜杠命令自动触发**
|
|
257
|
+
|
|
258
|
+
某些命令会自动调用相关代理:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# /feat 命令自动调用 planner 代理进行任务规划
|
|
262
|
+
> /feat 添加购物车功能
|
|
263
|
+
|
|
264
|
+
# /init-project 命令调用 init-architect 代理
|
|
265
|
+
> /init-project
|
|
266
|
+
|
|
267
|
+
# /workflow 命令启动六步开发流程
|
|
268
|
+
> /workflow
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**方法三:代理协作(自动委派)**
|
|
272
|
+
|
|
273
|
+
代理之间可以自动协作,例如代码审查员发现安全问题时会自动委派给安全专家:
|
|
274
|
+
|
|
275
|
+
```yaml
|
|
276
|
+
# 代理定义中的委派规则
|
|
277
|
+
## DELEGATIONS
|
|
278
|
+
- Security issues → ccjk-security-expert
|
|
279
|
+
- Performance issues → ccjk-performance-expert
|
|
280
|
+
- Missing tests → ccjk-testing-specialist
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
#### 🎯 完整代理列表
|
|
284
|
+
|
|
285
|
+
| 代理名称 | 调用方式 | 专业领域 |
|
|
286
|
+
|----------|----------|----------|
|
|
287
|
+
| `planner` | `@planner` | 📋 任务规划和分解 |
|
|
288
|
+
| `ui-ux-designer` | `@ui-ux-designer` | 🎨 UI/UX 设计 |
|
|
289
|
+
| `init-architect` | `@init-architect` | 🏗️ 项目初始化架构 |
|
|
290
|
+
| `ccjk-code-reviewer` | `@ccjk-code-reviewer` | 🔍 代码审查 |
|
|
291
|
+
| `ccjk-security-expert` | `@ccjk-security-expert` | 🔒 安全审计 |
|
|
292
|
+
| `ccjk-performance-expert` | `@ccjk-performance-expert` | ⚡ 性能优化 |
|
|
293
|
+
| `ccjk-frontend-architect` | `@ccjk-frontend-architect` | 🖥️ 前端架构 |
|
|
294
|
+
| `ccjk-backend-architect` | `@ccjk-backend-architect` | ⚙️ 后端架构 |
|
|
295
|
+
| `ccjk-database-expert` | `@ccjk-database-expert` | 🗄️ 数据库设计 |
|
|
296
|
+
| `ccjk-devops-expert` | `@ccjk-devops-expert` | 🚀 DevOps/CI/CD |
|
|
297
|
+
| `ccjk-testing-specialist` | `@ccjk-testing-specialist` | 🧪 测试专家 |
|
|
298
|
+
| `ccjk-refactoring-expert` | `@ccjk-refactoring-expert` | ♻️ 代码重构 |
|
|
299
|
+
| `ccjk-documentation-expert` | `@ccjk-documentation-expert` | 📚 文档生成 |
|
|
300
|
+
| `ccjk-api-architect` | `@ccjk-api-architect` | 🔌 API 设计 |
|
|
301
|
+
| `ccjk-i18n-specialist` | `@ccjk-i18n-specialist` | 🌍 国际化 |
|
|
302
|
+
|
|
303
|
+
#### 💡 代理使用示例
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
# 示例 1:复杂功能规划
|
|
307
|
+
> @planner 我需要为电商应用添加以下功能:
|
|
308
|
+
1. 用户购物车
|
|
309
|
+
2. 订单管理
|
|
310
|
+
3. 支付集成
|
|
311
|
+
请帮我分解任务并制定实施计划
|
|
312
|
+
|
|
313
|
+
# 示例 2:代码审查
|
|
314
|
+
> @ccjk-code-reviewer 请审查 src/services/ 目录下的所有服务代码,
|
|
315
|
+
重点关注错误处理和代码复用
|
|
316
|
+
|
|
317
|
+
# 示例 3:安全审计
|
|
318
|
+
> @ccjk-security-expert 对这个 Node.js 后端项目进行全面安全审计,
|
|
319
|
+
特别关注 SQL 注入和 XSS 漏洞
|
|
320
|
+
|
|
321
|
+
# 示例 4:性能优化
|
|
322
|
+
> @ccjk-performance-expert 分析 src/utils/data-processor.ts 的性能,
|
|
323
|
+
这个函数处理大数据集时很慢
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### 🪝 Hooks 钩子系统
|
|
327
|
+
|
|
328
|
+
Hooks 是 CCJK 的扩展机制,允许你在特定事件发生时自动执行自定义逻辑。
|
|
329
|
+
|
|
330
|
+
#### 🎯 Hook 类型
|
|
331
|
+
|
|
332
|
+
| 类型 | 触发时机 | 典型用途 |
|
|
333
|
+
|------|----------|----------|
|
|
334
|
+
| `pre-tool-use` | 工具执行**前** | 输入验证、限流、添加默认值 |
|
|
335
|
+
| `post-tool-use` | 工具执行**后** | 日志记录、缓存结果、资源清理 |
|
|
336
|
+
| `skill-activated` | 技能激活时 | 权限检查、环境初始化 |
|
|
337
|
+
| `skill-completed` | 技能完成时 | 清理资源、发送通知 |
|
|
338
|
+
| `workflow-started` | 工作流开始 | 环境设置、参数验证 |
|
|
339
|
+
| `workflow-completed` | 工作流结束 | 生成报告、清理临时文件 |
|
|
340
|
+
| `on-error` | 发生错误时 | 错误追踪、自动恢复 |
|
|
341
|
+
| `config-changed` | 配置变更时 | 重新加载、验证配置 |
|
|
342
|
+
|
|
343
|
+
#### 📝 创建自定义 Hook
|
|
344
|
+
|
|
345
|
+
在项目的 `.claude/hooks/` 目录下创建 TypeScript 文件:
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
// .claude/hooks/my-hooks.ts
|
|
349
|
+
import { registry } from 'ccjk/hooks'
|
|
350
|
+
|
|
351
|
+
// 示例 1:文件修改前自动备份
|
|
352
|
+
registry.register({
|
|
353
|
+
id: 'auto-backup',
|
|
354
|
+
name: '自动备份',
|
|
355
|
+
type: 'pre-tool-use',
|
|
356
|
+
priority: 9, // 优先级 1-10,数字越大越先执行
|
|
357
|
+
condition: {
|
|
358
|
+
tools: ['Edit', 'Write'] // 只在编辑/写入文件时触发
|
|
359
|
+
},
|
|
360
|
+
action: {
|
|
361
|
+
execute: async (context) => {
|
|
362
|
+
console.log(`📦 备份文件: ${context.path}`)
|
|
363
|
+
await backupFile(context.path)
|
|
364
|
+
return {
|
|
365
|
+
success: true,
|
|
366
|
+
status: 'success',
|
|
367
|
+
durationMs: 0,
|
|
368
|
+
continueChain: true // 继续执行后续 hooks
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
timeout: 5000 // 5秒超时
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
// 示例 2:操作完成后记录日志
|
|
376
|
+
registry.register({
|
|
377
|
+
id: 'audit-log',
|
|
378
|
+
name: '审计日志',
|
|
379
|
+
type: 'post-tool-use',
|
|
380
|
+
priority: 1,
|
|
381
|
+
action: {
|
|
382
|
+
execute: async (context) => {
|
|
383
|
+
await logToFile({
|
|
384
|
+
timestamp: new Date().toISOString(),
|
|
385
|
+
tool: context.tool,
|
|
386
|
+
path: context.path,
|
|
387
|
+
success: !context.error
|
|
388
|
+
})
|
|
389
|
+
return {
|
|
390
|
+
success: true,
|
|
391
|
+
status: 'success',
|
|
392
|
+
durationMs: 0,
|
|
393
|
+
continueChain: true
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
// 示例 3:性能监控
|
|
400
|
+
registry.register({
|
|
401
|
+
id: 'perf-monitor',
|
|
402
|
+
name: '性能监控',
|
|
403
|
+
type: 'post-tool-use',
|
|
404
|
+
action: {
|
|
405
|
+
execute: async (context) => {
|
|
406
|
+
const duration = context.result?.durationMs || 0
|
|
407
|
+
if (duration > 5000) {
|
|
408
|
+
console.warn(`⚠️ 操作耗时过长: ${context.tool} - ${duration}ms`)
|
|
409
|
+
}
|
|
410
|
+
return {
|
|
411
|
+
success: true,
|
|
412
|
+
status: 'success',
|
|
413
|
+
durationMs: 0,
|
|
414
|
+
continueChain: true
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
})
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
#### 🔧 实用 Hook 模板
|
|
422
|
+
|
|
423
|
+
**限流 Hook(防止 API 过载)**
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
const requests = new Map<string, number[]>()
|
|
427
|
+
const MAX_PER_MINUTE = 60
|
|
428
|
+
|
|
429
|
+
registry.register({
|
|
430
|
+
id: 'rate-limit',
|
|
431
|
+
name: '请求限流',
|
|
432
|
+
type: 'pre-tool-use',
|
|
433
|
+
priority: 10, // 最高优先级
|
|
434
|
+
action: {
|
|
435
|
+
execute: async (context) => {
|
|
436
|
+
const tool = context.tool || 'unknown'
|
|
437
|
+
const now = Date.now()
|
|
438
|
+
let reqs = requests.get(tool) || []
|
|
439
|
+
reqs = reqs.filter(t => t > now - 60000) // 保留最近1分钟
|
|
440
|
+
|
|
441
|
+
if (reqs.length >= MAX_PER_MINUTE) {
|
|
442
|
+
return {
|
|
443
|
+
success: false,
|
|
444
|
+
status: 'failed',
|
|
445
|
+
error: `限流:${tool} 每分钟最多 ${MAX_PER_MINUTE} 次`,
|
|
446
|
+
continueChain: false // 阻止执行
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
reqs.push(now)
|
|
451
|
+
requests.set(tool, reqs)
|
|
452
|
+
return { success: true, status: 'success', durationMs: 0, continueChain: true }
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
})
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
**缓存 Hook(避免重复计算)**
|
|
459
|
+
|
|
460
|
+
```typescript
|
|
461
|
+
const cache = new Map<string, any>()
|
|
462
|
+
|
|
463
|
+
// 执行前检查缓存
|
|
464
|
+
registry.register({
|
|
465
|
+
id: 'cache-check',
|
|
466
|
+
name: '缓存检查',
|
|
467
|
+
type: 'pre-tool-use',
|
|
468
|
+
priority: 8,
|
|
469
|
+
action: {
|
|
470
|
+
execute: async (context) => {
|
|
471
|
+
const key = `${context.tool}:${JSON.stringify(context.args)}`
|
|
472
|
+
const cached = cache.get(key)
|
|
473
|
+
if (cached) {
|
|
474
|
+
return {
|
|
475
|
+
success: true,
|
|
476
|
+
status: 'success',
|
|
477
|
+
output: cached,
|
|
478
|
+
continueChain: false // 跳过实际执行,直接返回缓存
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return { success: true, status: 'success', durationMs: 0, continueChain: true }
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
})
|
|
485
|
+
|
|
486
|
+
// 执行后存入缓存
|
|
487
|
+
registry.register({
|
|
488
|
+
id: 'cache-store',
|
|
489
|
+
name: '缓存存储',
|
|
490
|
+
type: 'post-tool-use',
|
|
491
|
+
action: {
|
|
492
|
+
execute: async (context) => {
|
|
493
|
+
if (context.result && !context.error) {
|
|
494
|
+
const key = `${context.tool}:${JSON.stringify(context.args)}`
|
|
495
|
+
cache.set(key, context.result)
|
|
496
|
+
}
|
|
497
|
+
return { success: true, status: 'success', durationMs: 0, continueChain: true }
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
})
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**错误通知 Hook**
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
registry.register({
|
|
507
|
+
id: 'error-notify',
|
|
508
|
+
name: '错误通知',
|
|
509
|
+
type: 'on-error',
|
|
510
|
+
action: {
|
|
511
|
+
execute: async (context) => {
|
|
512
|
+
// 发送错误通知(如 Slack、邮件等)
|
|
513
|
+
await sendNotification({
|
|
514
|
+
title: '⚠️ CCJK 错误',
|
|
515
|
+
message: context.error?.message,
|
|
516
|
+
stack: context.error?.stack
|
|
517
|
+
})
|
|
518
|
+
return { success: true, status: 'success', durationMs: 0, continueChain: true }
|
|
519
|
+
},
|
|
520
|
+
continueOnError: true // 即使通知失败也不影响主流程
|
|
521
|
+
}
|
|
522
|
+
})
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### 🎚️ 优先级指南
|
|
526
|
+
|
|
527
|
+
| 优先级 | 用途 | 示例 |
|
|
528
|
+
|--------|------|------|
|
|
529
|
+
| 10 | 关键验证 | 安全检查、权限验证 |
|
|
530
|
+
| 9 | 限流控制 | 请求频率限制 |
|
|
531
|
+
| 8 | 缓存操作 | 缓存检查/存储 |
|
|
532
|
+
| 7 | 业务验证 | 输入格式验证 |
|
|
533
|
+
| 6 | 数据转换 | 格式转换、标准化 |
|
|
534
|
+
| 5 | 默认值 | 添加默认参数 |
|
|
535
|
+
| 4 | 监控 | 性能追踪 |
|
|
536
|
+
| 3 | 缓存管理 | 缓存清理 |
|
|
537
|
+
| 2 | 日志 | 调试输出 |
|
|
538
|
+
| 1 | 清理 | 资源释放 |
|
|
539
|
+
|
|
540
|
+
#### 📊 Hook 管理 API
|
|
541
|
+
|
|
542
|
+
```typescript
|
|
543
|
+
import { initializeHooksSystem } from 'ccjk/hooks'
|
|
544
|
+
|
|
545
|
+
const { registry, executor } = initializeHooksSystem()
|
|
546
|
+
|
|
547
|
+
// 注册 Hook
|
|
548
|
+
registry.register(myHook)
|
|
549
|
+
|
|
550
|
+
// 注销 Hook
|
|
551
|
+
registry.unregister('hook-id')
|
|
552
|
+
|
|
553
|
+
// 启用/禁用 Hook
|
|
554
|
+
registry.setEnabled('hook-id', false)
|
|
555
|
+
|
|
556
|
+
// 获取所有 Hooks
|
|
557
|
+
const hooks = registry.getAllHooks()
|
|
558
|
+
|
|
559
|
+
// 按类型获取
|
|
560
|
+
const preHooks = registry.getHooksForType('pre-tool-use')
|
|
561
|
+
|
|
562
|
+
// 获取统计信息
|
|
563
|
+
const stats = registry.getStatistics()
|
|
564
|
+
// { totalHooks: 10, enabledHooks: 8, successRate: 96.67, ... }
|
|
565
|
+
|
|
566
|
+
// 手动执行 Hooks
|
|
567
|
+
await executor.executePreToolUse('grep', '/path', { pattern: 'TODO' })
|
|
568
|
+
await executor.executePostToolUse('grep', '/path', result, error)
|
|
569
|
+
```
|
|
570
|
+
|
|
236
571
|
### 🔍 审查引擎 - AI代码审计器
|
|
237
572
|
|
|
238
573
|
全自动AI代码审计器,无需预定义规则:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import { join } from 'pathe';
|
|
3
|
-
import {
|
|
3
|
+
import { U as ZCF_CONFIG_FILE, Z as ZCF_CONFIG_DIR, cU as ensureDir, cV as readDefaultTomlConfig, cW as createDefaultTomlConfig, cX as exists, cB as readJsonConfig, cY as writeTomlConfig, z as SETTINGS_FILE, cZ as clearModelEnv, c_ as copyFile } from './simple-config.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'ansis';
|
|
@@ -185,15 +185,15 @@ class ClaudeCodeConfigManager {
|
|
|
185
185
|
* Apply profile settings to Claude Code runtime
|
|
186
186
|
*/
|
|
187
187
|
static async applyProfileSettings(profile) {
|
|
188
|
-
const { ensureI18nInitialized, i18n } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
188
|
+
const { ensureI18nInitialized, i18n } = await import('./simple-config.mjs').then(function (n) { return n.d6; });
|
|
189
189
|
ensureI18nInitialized();
|
|
190
190
|
try {
|
|
191
191
|
if (!profile) {
|
|
192
|
-
const { switchToOfficialLogin } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
192
|
+
const { switchToOfficialLogin } = await import('./simple-config.mjs').then(function (n) { return n.da; });
|
|
193
193
|
switchToOfficialLogin();
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
|
-
const { readJsonConfig: readJsonConfig2, writeJsonConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
196
|
+
const { readJsonConfig: readJsonConfig2, writeJsonConfig } = await import('./simple-config.mjs').then(function (n) { return n.d8; });
|
|
197
197
|
const settings = readJsonConfig2(SETTINGS_FILE) || {};
|
|
198
198
|
if (!settings.env)
|
|
199
199
|
settings.env = {};
|
|
@@ -206,7 +206,7 @@ class ClaudeCodeConfigManager {
|
|
|
206
206
|
settings.env.ANTHROPIC_AUTH_TOKEN = profile.apiKey;
|
|
207
207
|
delete settings.env.ANTHROPIC_API_KEY;
|
|
208
208
|
} else if (profile.authType === "ccr_proxy") {
|
|
209
|
-
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
209
|
+
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.db; });
|
|
210
210
|
const ccrConfig = readCcrConfig();
|
|
211
211
|
if (!ccrConfig) {
|
|
212
212
|
throw new Error(i18n.t("ccr:ccrNotConfigured") || "CCR proxy configuration not found");
|
|
@@ -241,7 +241,7 @@ class ClaudeCodeConfigManager {
|
|
|
241
241
|
clearModelEnv(settings.env);
|
|
242
242
|
}
|
|
243
243
|
writeJsonConfig(SETTINGS_FILE, settings);
|
|
244
|
-
const { setPrimaryApiKey, addCompletedOnboarding } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
244
|
+
const { setPrimaryApiKey, addCompletedOnboarding } = await import('./simple-config.mjs').then(function (n) { return n.d9; });
|
|
245
245
|
setPrimaryApiKey();
|
|
246
246
|
addCompletedOnboarding();
|
|
247
247
|
if (shouldRestartCcr) {
|
|
@@ -602,7 +602,7 @@ class ClaudeCodeConfigManager {
|
|
|
602
602
|
*/
|
|
603
603
|
static async syncCcrProfile() {
|
|
604
604
|
try {
|
|
605
|
-
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
605
|
+
const { readCcrConfig } = await import('./simple-config.mjs').then(function (n) { return n.db; });
|
|
606
606
|
const ccrConfig = readCcrConfig();
|
|
607
607
|
if (!ccrConfig) {
|
|
608
608
|
await this.ensureCcrProfileExists(ccrConfig);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { cm as ensureI18nInitialized, ch as i18n, cx as addNumbersToChoices, cT as validateApiKey, cr as promptBoolean } from './simple-config.mjs';
|
|
4
4
|
import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:process';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { cm as ensureI18nInitialized, b2 as detectConfigManagementMode, ch as i18n, cx as addNumbersToChoices, cr as promptBoolean, cB as readJsonConfig, H as CODEX_AUTH_FILE } from './simple-config.mjs';
|
|
4
4
|
import { deleteProviders, addProviderToExisting, editExistingProvider } from './codex-provider-manager.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:process';
|
|
@@ -168,7 +168,7 @@ async function handleAddProvider() {
|
|
|
168
168
|
defaultValue: true
|
|
169
169
|
});
|
|
170
170
|
if (setAsDefault) {
|
|
171
|
-
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
171
|
+
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.dd; });
|
|
172
172
|
const switched = await switchToProvider(provider.id);
|
|
173
173
|
if (switched) {
|
|
174
174
|
console.log(ansis.green(i18n.t("multi-config:profileSetAsDefault", { name: provider.name })));
|
|
@@ -363,7 +363,7 @@ ${i18n.t("codex:copyingProvider", { name: provider.name })}`));
|
|
|
363
363
|
defaultValue: false
|
|
364
364
|
});
|
|
365
365
|
if (setAsDefault) {
|
|
366
|
-
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
366
|
+
const { switchToProvider } = await import('./simple-config.mjs').then(function (n) { return n.dd; });
|
|
367
367
|
const switched = await switchToProvider(copiedProvider.id);
|
|
368
368
|
if (switched) {
|
|
369
369
|
console.log(ansis.green(i18n.t("multi-config:profileSetAsDefault", { name: copiedProvider.name })));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cm as ensureI18nInitialized, aR as readCodexConfig, ch as i18n, ay as backupCodexComplete, b1 as writeCodexConfig, b0 as writeAuthFile } from './simple-config.mjs';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:process';
|
|
4
4
|
import 'ansis';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pathExists } from 'fs-extra';
|
|
2
2
|
import { join } from 'pathe';
|
|
3
|
-
import {
|
|
3
|
+
import { F as CODEX_DIR, G as CODEX_CONFIG_FILE, cD as moveToTrash, ch as i18n, H as CODEX_AUTH_FILE, I as CODEX_AGENTS_FILE, J as CODEX_PROMPTS_DIR } from './simple-config.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'ansis';
|
|
@@ -154,7 +154,7 @@ class CodexUninstaller {
|
|
|
154
154
|
warnings: []
|
|
155
155
|
};
|
|
156
156
|
try {
|
|
157
|
-
const { uninstallCodeTool } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
157
|
+
const { uninstallCodeTool } = await import('./simple-config.mjs').then(function (n) { return n.de; });
|
|
158
158
|
const success = await uninstallCodeTool("codex");
|
|
159
159
|
if (success) {
|
|
160
160
|
result.removed.push("@openai/codex");
|
package/dist/chunks/commands.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { exec } from 'node:child_process';
|
|
2
2
|
import { promisify } from 'node:util';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import {
|
|
4
|
+
import { cm as ensureI18nInitialized, ch as i18n } from './simple-config.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:process';
|
|
7
7
|
import 'inquirer';
|
package/dist/chunks/features.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { ch as i18n, cm as ensureI18nInitialized, a3 as SUPPORTED_LANGS, cx as addNumbersToChoices, a4 as LANG_LABELS, cE as updateZcfConfig, cS as changeLanguage, cA as readZcfConfig, cr as promptBoolean, x as openSettingsJson, w as importRecommendedPermissions, u as importRecommendedEnv, bu as applyAiLanguageDirective, c$ as configureOutputStyle, bs as getExistingModelConfig, bp as updateCustomModel, bq as updateDefaultModel, d0 as isWindows, am as readMcpConfig, ar as fixWindowsMcpConfig, an as writeMcpConfig, d1 as selectMcpServices, ao as backupMcpConfig, d2 as getMcpServices, aq as buildMcpServerConfig, ap as mergeMcpServers, co as isCcrInstalled, cp as installCcr, d3 as setupCcrConfiguration, bt as getExistingApiConfig, bw as promptApiConfigurationAction, d4 as modifyApiConfigPartially, cT as validateApiKey, bn as configureApi, d5 as formatApiKeyDisplay, bv as switchToOfficialLogin } from './simple-config.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'pathe';
|
|
@@ -353,7 +353,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
356
|
+
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.dc; });
|
|
357
357
|
const aiOutputLang = await selectAiOutputLanguage();
|
|
358
358
|
applyAiLanguageDirective(aiOutputLang);
|
|
359
359
|
updateZcfConfig({ aiOutputLang });
|
|
@@ -386,7 +386,7 @@ async function changeScriptLanguageFeature(currentLang) {
|
|
|
386
386
|
}
|
|
387
387
|
async function configureCodexDefaultModelFeature() {
|
|
388
388
|
ensureI18nInitialized();
|
|
389
|
-
const { readCodexConfig } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
389
|
+
const { readCodexConfig } = await import('./simple-config.mjs').then(function (n) { return n.dd; });
|
|
390
390
|
const existingConfig = readCodexConfig();
|
|
391
391
|
const currentModel = existingConfig?.model;
|
|
392
392
|
if (currentModel) {
|
|
@@ -487,7 +487,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
487
487
|
return;
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
490
|
+
const { selectAiOutputLanguage } = await import('./simple-config.mjs').then(function (n) { return n.dc; });
|
|
491
491
|
const aiOutputLang = await selectAiOutputLanguage();
|
|
492
492
|
await updateCodexLanguageDirective(aiOutputLang);
|
|
493
493
|
updateZcfConfig({ aiOutputLang });
|
|
@@ -495,14 +495,14 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
495
495
|
} else if (option === "systemPrompt") {
|
|
496
496
|
const zcfConfig = readZcfConfig();
|
|
497
497
|
const currentLang = zcfConfig?.aiOutputLang || "English";
|
|
498
|
-
const { runCodexSystemPromptSelection } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
498
|
+
const { runCodexSystemPromptSelection } = await import('./simple-config.mjs').then(function (n) { return n.dd; });
|
|
499
499
|
await runCodexSystemPromptSelection();
|
|
500
500
|
await ensureLanguageDirectiveInAgents(currentLang);
|
|
501
501
|
console.log(ansis.green(`\u2714 ${i18n.t("configuration:systemPromptConfigured")}`));
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
async function updateCodexModelProvider(modelProvider) {
|
|
505
|
-
const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
505
|
+
const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.dd; });
|
|
506
506
|
const backupPath = backupCodexConfig();
|
|
507
507
|
if (backupPath) {
|
|
508
508
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
@@ -523,7 +523,7 @@ async function updateCodexModelProvider(modelProvider) {
|
|
|
523
523
|
writeCodexConfig(updatedConfig);
|
|
524
524
|
}
|
|
525
525
|
async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
526
|
-
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
526
|
+
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.d7; });
|
|
527
527
|
const { homedir } = await import('node:os');
|
|
528
528
|
const { join } = await import('pathe');
|
|
529
529
|
const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
|
|
@@ -541,7 +541,7 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
|
541
541
|
const langLabel = languageLabels[aiOutputLang] || aiOutputLang;
|
|
542
542
|
const hasLanguageDirective = /\*\*Most Important:\s*Always respond in [^*]+\*\*/i.test(content);
|
|
543
543
|
if (!hasLanguageDirective) {
|
|
544
|
-
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
544
|
+
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.dd; });
|
|
545
545
|
const backupPath = backupCodexAgents();
|
|
546
546
|
if (backupPath) {
|
|
547
547
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
@@ -558,8 +558,8 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
async function updateCodexLanguageDirective(aiOutputLang) {
|
|
561
|
-
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
562
|
-
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.
|
|
561
|
+
const { readFile, writeFile, exists } = await import('./simple-config.mjs').then(function (n) { return n.d7; });
|
|
562
|
+
const { backupCodexAgents, getBackupMessage } = await import('./simple-config.mjs').then(function (n) { return n.dd; });
|
|
563
563
|
const { homedir } = await import('node:os');
|
|
564
564
|
const { join } = await import('pathe');
|
|
565
565
|
const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
|