ccjk 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/agent-teams.mjs +1 -1
- package/dist/chunks/agent.mjs +1 -1
- package/dist/chunks/agents.mjs +1 -1
- package/dist/chunks/api-providers.mjs +1 -1
- package/dist/chunks/api.mjs +3 -3
- package/dist/chunks/auto-bootstrap.mjs +1 -1
- package/dist/chunks/auto-updater.mjs +1 -1
- package/dist/{shared/ccjk.Br91zBIG.mjs → chunks/banner.mjs} +52 -3
- package/dist/chunks/boost.mjs +2 -2
- package/dist/chunks/ccjk-agents.mjs +1 -1
- package/dist/chunks/ccjk-all.mjs +1 -1
- package/dist/chunks/ccjk-config.mjs +1 -1
- package/dist/chunks/ccjk-hooks.mjs +1 -1
- package/dist/chunks/ccjk-mcp.mjs +2 -2
- package/dist/chunks/ccjk-setup.mjs +1 -1
- package/dist/chunks/ccjk-skills.mjs +1 -1
- package/dist/chunks/ccr.mjs +10 -10
- package/dist/chunks/ccu.mjs +1 -1
- package/dist/chunks/check-updates.mjs +3 -3
- package/dist/chunks/claude-code-config-manager.mjs +7 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
- package/dist/chunks/claude-config.mjs +3 -3
- package/dist/chunks/claude-wrapper.mjs +2 -2
- package/dist/chunks/codex-config-switch.mjs +2 -2
- package/dist/chunks/codex-provider-manager.mjs +2 -2
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/codex.mjs +5 -5
- package/dist/chunks/commands.mjs +88 -391
- package/dist/chunks/commands2.mjs +391 -88
- package/dist/chunks/completion.mjs +1 -1
- package/dist/chunks/config-consolidator.mjs +2 -2
- package/dist/chunks/config-switch.mjs +3 -3
- package/dist/chunks/config.mjs +5 -5
- package/dist/chunks/config2.mjs +410 -400
- package/dist/chunks/config3.mjs +400 -410
- package/dist/chunks/constants.mjs +1 -1
- package/dist/chunks/context.mjs +283 -1
- package/dist/chunks/dashboard.mjs +365 -0
- package/dist/chunks/doctor.mjs +4 -4
- package/dist/chunks/features.mjs +11 -11
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/health-alerts.mjs +304 -0
- package/dist/chunks/health-check.mjs +532 -0
- package/dist/chunks/index.mjs +10 -177
- package/dist/chunks/index2.mjs +168 -1162
- package/dist/chunks/index3.mjs +1076 -910
- package/dist/chunks/index4.mjs +947 -137
- package/dist/chunks/index5.mjs +167 -635
- package/dist/chunks/index6.mjs +663 -0
- package/dist/chunks/init.mjs +19 -19
- package/dist/chunks/installer.mjs +649 -147
- package/dist/chunks/installer2.mjs +147 -649
- package/dist/chunks/interview.mjs +2 -2
- package/dist/chunks/marketplace.mjs +1 -1
- package/dist/chunks/mcp.mjs +4 -4
- package/dist/chunks/menu.mjs +16 -9
- package/dist/chunks/metrics-display.mjs +152 -0
- package/dist/chunks/migrator.mjs +1 -1
- package/dist/chunks/monitor.mjs +2 -2
- package/dist/chunks/notification.mjs +1 -1
- package/dist/chunks/onboarding.mjs +2 -2
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/permission-manager.mjs +2 -2
- package/dist/chunks/permissions.mjs +1 -1
- package/dist/chunks/persistence-manager.mjs +781 -0
- package/dist/chunks/persistence.mjs +667 -0
- package/dist/chunks/platform.mjs +1 -1
- package/dist/chunks/plugin.mjs +1 -1
- package/dist/chunks/prompts.mjs +1 -1
- package/dist/chunks/providers.mjs +1 -1
- package/dist/chunks/quick-actions.mjs +321 -0
- package/dist/chunks/quick-setup.mjs +8 -8
- package/dist/chunks/sessions.mjs +1 -1
- package/dist/chunks/silent-updater.mjs +1 -1
- package/dist/chunks/simple-config.mjs +2 -2
- package/dist/chunks/skill.mjs +1 -1
- package/dist/chunks/skills-sync.mjs +1 -1
- package/dist/chunks/skills.mjs +1 -1
- package/dist/chunks/slash-commands.mjs +208 -0
- package/dist/chunks/smart-defaults.mjs +1 -1
- package/dist/chunks/startup.mjs +1 -1
- package/dist/chunks/stats.mjs +1 -1
- package/dist/chunks/status.mjs +31 -2
- package/dist/chunks/team.mjs +1 -1
- package/dist/chunks/thinking.mjs +2 -2
- package/dist/chunks/uninstall.mjs +5 -5
- package/dist/chunks/update.mjs +7 -7
- package/dist/chunks/upgrade-manager.mjs +2 -2
- package/dist/chunks/version-checker.mjs +3 -3
- package/dist/chunks/vim.mjs +1 -1
- package/dist/cli.mjs +191 -21
- package/dist/i18n/locales/en/cli.json +14 -1
- package/dist/i18n/locales/en/common.json +27 -0
- package/dist/i18n/locales/en/context.json +54 -1
- package/dist/i18n/locales/en/dashboard.json +78 -0
- package/dist/i18n/locales/en/persistence.json +127 -0
- package/dist/i18n/locales/en/quick-actions.json +78 -0
- package/dist/i18n/locales/zh-CN/cli.json +14 -1
- package/dist/i18n/locales/zh-CN/common.json +27 -0
- package/dist/i18n/locales/zh-CN/context.json +54 -1
- package/dist/i18n/locales/zh-CN/dashboard.json +78 -0
- package/dist/i18n/locales/zh-CN/persistence.json +127 -0
- package/dist/i18n/locales/zh-CN/quick-actions.json +78 -0
- package/dist/index.mjs +2 -2
- package/dist/shared/{ccjk.DE91nClQ.mjs → ccjk.BKoi8-Hy.mjs} +1 -1
- package/dist/shared/{ccjk.Dpw86UX0.mjs → ccjk.CxtuJxaS.mjs} +1 -1
- package/dist/shared/{ccjk.ClzTOz9n.mjs → ccjk.DB2UYcq0.mjs} +5 -5
- package/dist/shared/{ccjk.Bndhan7G.mjs → ccjk.DfwJOEok.mjs} +1 -1
- package/dist/shared/{ccjk.DvIrK0wz.mjs → ccjk.DrMygfCF.mjs} +1 -1
- package/dist/shared/ccjk.DtMBiwVG.mjs +599 -0
- package/dist/shared/{ccjk.CmsW23FN.mjs → ccjk.IbImMVWM.mjs} +3 -3
- package/package.json +19 -19
- package/dist/shared/ccjk.OYWY25_l.mjs +0 -239
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
2
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { join, dirname } from 'pathe';
|
|
4
|
-
|
|
5
|
-
class TaskPersistence {
|
|
6
|
-
db;
|
|
7
|
-
dbPath;
|
|
8
|
-
constructor(dbPath) {
|
|
9
|
-
this.dbPath = dbPath || join(
|
|
10
|
-
process.env.HOME || process.env.USERPROFILE || ".",
|
|
11
|
-
".ccjk",
|
|
12
|
-
"brain.db"
|
|
13
|
-
);
|
|
14
|
-
const dir = dirname(this.dbPath);
|
|
15
|
-
if (!existsSync(dir)) {
|
|
16
|
-
mkdirSync(dir, { recursive: true });
|
|
17
|
-
}
|
|
18
|
-
this.db = new Database(this.dbPath);
|
|
19
|
-
this.initSchema();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Initialize database schema
|
|
23
|
-
*/
|
|
24
|
-
initSchema() {
|
|
25
|
-
this.db.exec(`
|
|
26
|
-
CREATE TABLE IF NOT EXISTS tasks (
|
|
27
|
-
id TEXT PRIMARY KEY,
|
|
28
|
-
session_id TEXT NOT NULL,
|
|
29
|
-
name TEXT NOT NULL,
|
|
30
|
-
description TEXT,
|
|
31
|
-
status TEXT NOT NULL,
|
|
32
|
-
priority INTEGER NOT NULL DEFAULT 0,
|
|
33
|
-
dependencies TEXT NOT NULL DEFAULT '[]',
|
|
34
|
-
input TEXT NOT NULL,
|
|
35
|
-
output TEXT,
|
|
36
|
-
error TEXT,
|
|
37
|
-
created_at INTEGER NOT NULL,
|
|
38
|
-
started_at INTEGER,
|
|
39
|
-
completed_at INTEGER,
|
|
40
|
-
metadata TEXT NOT NULL DEFAULT '{}'
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_session ON tasks(session_id);
|
|
44
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_status ON tasks(status);
|
|
45
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_created ON tasks(created_at);
|
|
46
|
-
|
|
47
|
-
CREATE TABLE IF NOT EXISTS sessions (
|
|
48
|
-
id TEXT PRIMARY KEY,
|
|
49
|
-
created_at INTEGER NOT NULL,
|
|
50
|
-
updated_at INTEGER NOT NULL,
|
|
51
|
-
metadata TEXT NOT NULL DEFAULT '{}'
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
CREATE INDEX IF NOT EXISTS idx_sessions_created ON sessions(created_at);
|
|
55
|
-
`);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Save a task
|
|
59
|
-
*/
|
|
60
|
-
saveTask(task, sessionId) {
|
|
61
|
-
const stmt = this.db.prepare(`
|
|
62
|
-
INSERT OR REPLACE INTO tasks (
|
|
63
|
-
id, session_id, name, description, status, priority,
|
|
64
|
-
dependencies, input, output, error,
|
|
65
|
-
created_at, started_at, completed_at, metadata
|
|
66
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
67
|
-
`);
|
|
68
|
-
stmt.run(
|
|
69
|
-
task.id,
|
|
70
|
-
sessionId,
|
|
71
|
-
task.name,
|
|
72
|
-
task.description || null,
|
|
73
|
-
task.status || "pending",
|
|
74
|
-
task.priority || 0,
|
|
75
|
-
JSON.stringify(task.dependencies || []),
|
|
76
|
-
JSON.stringify(task.input || {}),
|
|
77
|
-
task.output ? JSON.stringify(task.output) : null,
|
|
78
|
-
task.error ? JSON.stringify(task.error) : null,
|
|
79
|
-
Date.now(),
|
|
80
|
-
null,
|
|
81
|
-
null,
|
|
82
|
-
JSON.stringify(task.metadata || {})
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Update task status
|
|
87
|
-
*/
|
|
88
|
-
updateTaskStatus(taskId, status, output, error) {
|
|
89
|
-
const now = Date.now();
|
|
90
|
-
const updates = ["status = ?"];
|
|
91
|
-
const params = [status];
|
|
92
|
-
if (status === "running") {
|
|
93
|
-
updates.push("started_at = ?");
|
|
94
|
-
params.push(now);
|
|
95
|
-
}
|
|
96
|
-
if (status === "completed" || status === "failed") {
|
|
97
|
-
updates.push("completed_at = ?");
|
|
98
|
-
params.push(now);
|
|
99
|
-
}
|
|
100
|
-
if (output) {
|
|
101
|
-
updates.push("output = ?");
|
|
102
|
-
params.push(JSON.stringify(output));
|
|
103
|
-
}
|
|
104
|
-
if (error) {
|
|
105
|
-
updates.push("error = ?");
|
|
106
|
-
params.push(JSON.stringify({ message: error.message, stack: error.stack }));
|
|
107
|
-
}
|
|
108
|
-
params.push(taskId);
|
|
109
|
-
const stmt = this.db.prepare(`
|
|
110
|
-
UPDATE tasks SET ${updates.join(", ")} WHERE id = ?
|
|
111
|
-
`);
|
|
112
|
-
stmt.run(...params);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Get task by ID
|
|
116
|
-
*/
|
|
117
|
-
getTask(taskId) {
|
|
118
|
-
const stmt = this.db.prepare(`
|
|
119
|
-
SELECT * FROM tasks WHERE id = ?
|
|
120
|
-
`);
|
|
121
|
-
const row = stmt.get(taskId);
|
|
122
|
-
if (!row) return void 0;
|
|
123
|
-
return this.rowToTask(row);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Get all tasks for a session
|
|
127
|
-
*/
|
|
128
|
-
getSessionTasks(sessionId) {
|
|
129
|
-
const stmt = this.db.prepare(`
|
|
130
|
-
SELECT * FROM tasks WHERE session_id = ? ORDER BY created_at ASC
|
|
131
|
-
`);
|
|
132
|
-
const rows = stmt.all(sessionId);
|
|
133
|
-
return rows.map((row) => this.rowToTask(row));
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Get task dependencies
|
|
137
|
-
*/
|
|
138
|
-
getDependencies(taskId) {
|
|
139
|
-
const task = this.getTask(taskId);
|
|
140
|
-
if (!task || task.dependencies.length === 0) {
|
|
141
|
-
return [];
|
|
142
|
-
}
|
|
143
|
-
const placeholders = task.dependencies.map(() => "?").join(",");
|
|
144
|
-
const stmt = this.db.prepare(`
|
|
145
|
-
SELECT * FROM tasks WHERE id IN (${placeholders})
|
|
146
|
-
`);
|
|
147
|
-
const rows = stmt.all(...task.dependencies);
|
|
148
|
-
return rows.map((row) => this.rowToTask(row));
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Restore context for a session
|
|
152
|
-
*/
|
|
153
|
-
restoreContext(sessionId) {
|
|
154
|
-
const tasks = this.getSessionTasks(sessionId);
|
|
155
|
-
if (tasks.length === 0) {
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
const sessionStmt = this.db.prepare(`
|
|
159
|
-
SELECT * FROM sessions WHERE id = ?
|
|
160
|
-
`);
|
|
161
|
-
const sessionRow = sessionStmt.get(sessionId);
|
|
162
|
-
const metadata = sessionRow ? JSON.parse(sessionRow.metadata) : {};
|
|
163
|
-
return {
|
|
164
|
-
sessionId,
|
|
165
|
-
tasks,
|
|
166
|
-
metadata
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Create or update session
|
|
171
|
-
*/
|
|
172
|
-
saveSession(sessionId, metadata = {}) {
|
|
173
|
-
const stmt = this.db.prepare(`
|
|
174
|
-
INSERT OR REPLACE INTO sessions (id, created_at, updated_at, metadata)
|
|
175
|
-
VALUES (?, ?, ?, ?)
|
|
176
|
-
`);
|
|
177
|
-
const now = Date.now();
|
|
178
|
-
stmt.run(sessionId, now, now, JSON.stringify(metadata));
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* List recent sessions
|
|
182
|
-
*/
|
|
183
|
-
listSessions(limit = 10) {
|
|
184
|
-
const stmt = this.db.prepare(`
|
|
185
|
-
SELECT * FROM sessions ORDER BY created_at DESC LIMIT ?
|
|
186
|
-
`);
|
|
187
|
-
const rows = stmt.all(limit);
|
|
188
|
-
return rows.map((row) => ({
|
|
189
|
-
id: row.id,
|
|
190
|
-
createdAt: row.created_at,
|
|
191
|
-
metadata: JSON.parse(row.metadata)
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Clean up old sessions
|
|
196
|
-
*/
|
|
197
|
-
cleanup(keepDays = 7) {
|
|
198
|
-
const cutoff = Date.now() - keepDays * 24 * 60 * 60 * 1e3;
|
|
199
|
-
const deleteTasksStmt = this.db.prepare(`
|
|
200
|
-
DELETE FROM tasks WHERE created_at < ?
|
|
201
|
-
`);
|
|
202
|
-
const tasksResult = deleteTasksStmt.run(cutoff);
|
|
203
|
-
const deleteSessionsStmt = this.db.prepare(`
|
|
204
|
-
DELETE FROM sessions WHERE created_at < ?
|
|
205
|
-
`);
|
|
206
|
-
const sessionsResult = deleteSessionsStmt.run(cutoff);
|
|
207
|
-
return tasksResult.changes + sessionsResult.changes;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Close database
|
|
211
|
-
*/
|
|
212
|
-
close() {
|
|
213
|
-
this.db.close();
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Convert database row to PersistedTask
|
|
217
|
-
*/
|
|
218
|
-
rowToTask(row) {
|
|
219
|
-
return {
|
|
220
|
-
id: row.id,
|
|
221
|
-
sessionId: row.session_id,
|
|
222
|
-
name: row.name,
|
|
223
|
-
description: row.description,
|
|
224
|
-
status: row.status,
|
|
225
|
-
priority: row.priority,
|
|
226
|
-
dependencies: JSON.parse(row.dependencies),
|
|
227
|
-
input: row.input,
|
|
228
|
-
output: row.output,
|
|
229
|
-
error: row.error,
|
|
230
|
-
createdAt: row.created_at,
|
|
231
|
-
startedAt: row.started_at,
|
|
232
|
-
completedAt: row.completed_at,
|
|
233
|
-
metadata: row.metadata
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
const taskPersistence = new TaskPersistence();
|
|
238
|
-
|
|
239
|
-
export { taskPersistence as t };
|