@agentlensai/cli 0.10.0 → 0.13.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/LICENSE +21 -0
- package/dist/__tests__/migrate.test.d.ts +8 -0
- package/dist/__tests__/migrate.test.d.ts.map +1 -0
- package/dist/__tests__/migrate.test.js +153 -0
- package/dist/__tests__/migrate.test.js.map +1 -0
- package/dist/commands/audit.d.ts +2 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +119 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/diagnose.d.ts +2 -0
- package/dist/commands/diagnose.d.ts.map +1 -0
- package/dist/commands/diagnose.js +148 -0
- package/dist/commands/diagnose.js.map +1 -0
- package/dist/commands/lessons.d.ts +7 -1
- package/dist/commands/lessons.d.ts.map +1 -1
- package/dist/commands/lessons.js +13 -367
- package/dist/commands/lessons.js.map +1 -1
- package/dist/commands/migrate.d.ts +30 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +342 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentlens migrate — Self-Hosted ↔ Cloud Migration (S-8.4)
|
|
3
|
+
*
|
|
4
|
+
* Reads from local SQLite, transforms to cloud NDJSON format,
|
|
5
|
+
* and uploads via cloud API. Supports resume on failure and
|
|
6
|
+
* reverse migration (cloud → self-hosted export → SQLite import).
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync, writeFileSync, existsSync, unlinkSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { createHash } from 'node:crypto';
|
|
12
|
+
import { loadConfig } from '../lib/config.js';
|
|
13
|
+
const STATE_DIR = join(homedir(), '.agentlens');
|
|
14
|
+
const DEFAULT_STATE_FILE = join(STATE_DIR, 'migrate-state.json');
|
|
15
|
+
const DEFAULT_SQLITE_PATH = join(process.cwd(), 'agentlens.db');
|
|
16
|
+
// ─── Main Command ────────────────────────────────────────────
|
|
17
|
+
export async function runMigrateCommand(args) {
|
|
18
|
+
const subcommand = args[0];
|
|
19
|
+
switch (subcommand) {
|
|
20
|
+
case 'up':
|
|
21
|
+
await migrateUp(args.slice(1));
|
|
22
|
+
break;
|
|
23
|
+
case 'down':
|
|
24
|
+
await migrateDown(args.slice(1));
|
|
25
|
+
break;
|
|
26
|
+
case 'status':
|
|
27
|
+
showMigrateStatus();
|
|
28
|
+
break;
|
|
29
|
+
case 'clean':
|
|
30
|
+
cleanMigrateState();
|
|
31
|
+
break;
|
|
32
|
+
case '--help':
|
|
33
|
+
case '-h':
|
|
34
|
+
case undefined:
|
|
35
|
+
showHelp();
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
console.error(`Unknown migrate subcommand: ${subcommand}`);
|
|
39
|
+
showHelp();
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function showHelp() {
|
|
44
|
+
console.log(`agentlens migrate — Self-Hosted ↔ Cloud Migration
|
|
45
|
+
|
|
46
|
+
Usage:
|
|
47
|
+
agentlens migrate up [options] Migrate self-hosted SQLite → Cloud
|
|
48
|
+
agentlens migrate down [options] Export Cloud → local NDJSON file
|
|
49
|
+
agentlens migrate status Show current migration state
|
|
50
|
+
agentlens migrate clean Remove migration state file
|
|
51
|
+
|
|
52
|
+
Options (up):
|
|
53
|
+
--db <path> SQLite database path (default: ./agentlens.db)
|
|
54
|
+
--batch-size <n> Records per upload batch (default: 500)
|
|
55
|
+
--resume Resume a previously interrupted migration
|
|
56
|
+
|
|
57
|
+
Options (down):
|
|
58
|
+
--output <path> Output NDJSON file (default: ./agentlens-export.ndjson)
|
|
59
|
+
|
|
60
|
+
Common:
|
|
61
|
+
--url <url> Cloud API URL (overrides config)
|
|
62
|
+
--api-key <key> Cloud API key (overrides config)
|
|
63
|
+
`);
|
|
64
|
+
}
|
|
65
|
+
// ─── Migrate Up (Self-Hosted → Cloud) ────────────────────────
|
|
66
|
+
async function migrateUp(args) {
|
|
67
|
+
const options = parseArgs(args);
|
|
68
|
+
const sqlitePath = options['db'] ?? DEFAULT_SQLITE_PATH;
|
|
69
|
+
const batchSize = parseInt(options['batch-size'] ?? '500', 10);
|
|
70
|
+
const resume = args.includes('--resume');
|
|
71
|
+
const config = loadConfig();
|
|
72
|
+
const cloudUrl = options['url'] ?? config.url;
|
|
73
|
+
const apiKey = options['api-key'] ?? config.apiKey;
|
|
74
|
+
if (!apiKey) {
|
|
75
|
+
console.error('Error: API key required. Set via `agentlens config set api-key <key>` or --api-key');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
// Check for resume state
|
|
79
|
+
let state = null;
|
|
80
|
+
if (resume && existsSync(DEFAULT_STATE_FILE)) {
|
|
81
|
+
state = JSON.parse(readFileSync(DEFAULT_STATE_FILE, 'utf-8'));
|
|
82
|
+
console.log(`Resuming migration from line ${state.lastUploadedLine}/${state.totalLines}`);
|
|
83
|
+
}
|
|
84
|
+
// Phase 1: Export from SQLite
|
|
85
|
+
let ndjsonLines;
|
|
86
|
+
if (state?.exportFile && existsSync(state.exportFile)) {
|
|
87
|
+
console.log('Using cached export file...');
|
|
88
|
+
ndjsonLines = readFileSync(state.exportFile, 'utf-8').split('\n').filter(Boolean);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.log(`Exporting from SQLite: ${sqlitePath}`);
|
|
92
|
+
ndjsonLines = await exportFromSqlite(sqlitePath);
|
|
93
|
+
// Cache export
|
|
94
|
+
const exportFile = join(STATE_DIR, 'migrate-export.ndjson');
|
|
95
|
+
writeFileSync(exportFile, ndjsonLines.join('\n') + '\n', 'utf-8');
|
|
96
|
+
state = {
|
|
97
|
+
direction: 'up',
|
|
98
|
+
phase: 'upload',
|
|
99
|
+
exportFile,
|
|
100
|
+
lastUploadedLine: 0,
|
|
101
|
+
totalLines: ndjsonLines.length,
|
|
102
|
+
counts: {},
|
|
103
|
+
};
|
|
104
|
+
saveState(state);
|
|
105
|
+
console.log(`Exported ${ndjsonLines.length} records`);
|
|
106
|
+
}
|
|
107
|
+
// Phase 2: Upload to cloud in batches
|
|
108
|
+
const startLine = state?.lastUploadedLine ?? 0;
|
|
109
|
+
const total = ndjsonLines.length;
|
|
110
|
+
let uploaded = startLine;
|
|
111
|
+
for (let i = startLine; i < total; i += batchSize) {
|
|
112
|
+
const batch = ndjsonLines.slice(i, Math.min(i + batchSize, total));
|
|
113
|
+
const progress = Math.min(100, Math.round(((i + batch.length) / total) * 100));
|
|
114
|
+
process.stdout.write(`\rUploading... ${progressBar(progress)} ${progress}% (${i + batch.length}/${total})`);
|
|
115
|
+
await uploadBatch(cloudUrl, apiKey, batch);
|
|
116
|
+
uploaded = i + batch.length;
|
|
117
|
+
// Save progress for resume
|
|
118
|
+
state.lastUploadedLine = uploaded;
|
|
119
|
+
saveState(state);
|
|
120
|
+
}
|
|
121
|
+
console.log('\n');
|
|
122
|
+
// Phase 3: Verify
|
|
123
|
+
state.phase = 'verify';
|
|
124
|
+
saveState(state);
|
|
125
|
+
console.log('Verifying migration...');
|
|
126
|
+
const verified = await verifyMigration(cloudUrl, apiKey, ndjsonLines);
|
|
127
|
+
if (verified) {
|
|
128
|
+
console.log('✅ Migration verified successfully!');
|
|
129
|
+
state.phase = 'done';
|
|
130
|
+
saveState(state);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
console.log('⚠️ Verification found count mismatches. Run `agentlens migrate status` for details.');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// ─── Migrate Down (Cloud → Self-Hosted) ─────────────────────
|
|
137
|
+
async function migrateDown(args) {
|
|
138
|
+
const options = parseArgs(args);
|
|
139
|
+
const outputPath = options['output'] ?? join(process.cwd(), 'agentlens-export.ndjson');
|
|
140
|
+
const config = loadConfig();
|
|
141
|
+
const cloudUrl = options['url'] ?? config.url;
|
|
142
|
+
const apiKey = options['api-key'] ?? config.apiKey;
|
|
143
|
+
if (!apiKey) {
|
|
144
|
+
console.error('Error: API key required.');
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
console.log('Exporting from cloud...');
|
|
148
|
+
const response = await fetch(`${cloudUrl}/api/export`, {
|
|
149
|
+
headers: {
|
|
150
|
+
Authorization: `Bearer ${apiKey}`,
|
|
151
|
+
Accept: 'application/x-ndjson',
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
if (!response.ok) {
|
|
155
|
+
console.error(`Export failed: ${response.status} ${response.statusText}`);
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
const body = await response.text();
|
|
159
|
+
writeFileSync(outputPath, body, 'utf-8');
|
|
160
|
+
const lineCount = body.split('\n').filter(Boolean).length;
|
|
161
|
+
console.log(`✅ Exported ${lineCount} records to ${outputPath}`);
|
|
162
|
+
}
|
|
163
|
+
// ─── Status & Clean ──────────────────────────────────────────
|
|
164
|
+
function showMigrateStatus() {
|
|
165
|
+
if (!existsSync(DEFAULT_STATE_FILE)) {
|
|
166
|
+
console.log('No migration in progress.');
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const state = JSON.parse(readFileSync(DEFAULT_STATE_FILE, 'utf-8'));
|
|
170
|
+
console.log(`Migration status:
|
|
171
|
+
Direction: ${state.direction}
|
|
172
|
+
Phase: ${state.phase}
|
|
173
|
+
Progress: ${state.lastUploadedLine}/${state.totalLines} records
|
|
174
|
+
${state.phase === 'done' ? '✅ Complete' : '⏳ In progress'}`);
|
|
175
|
+
}
|
|
176
|
+
function cleanMigrateState() {
|
|
177
|
+
if (existsSync(DEFAULT_STATE_FILE)) {
|
|
178
|
+
unlinkSync(DEFAULT_STATE_FILE);
|
|
179
|
+
console.log('Migration state cleaned.');
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
console.log('No migration state to clean.');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// ─── SQLite Export ───────────────────────────────────────────
|
|
186
|
+
/**
|
|
187
|
+
* Read from local SQLite and produce NDJSON lines.
|
|
188
|
+
* Uses dynamic import for better-sqlite3 so it's optional.
|
|
189
|
+
*/
|
|
190
|
+
export async function exportFromSqlite(dbPath) {
|
|
191
|
+
if (!existsSync(dbPath)) {
|
|
192
|
+
throw new Error(`SQLite database not found: ${dbPath}`);
|
|
193
|
+
}
|
|
194
|
+
// Dynamic import — better-sqlite3 is optional dep
|
|
195
|
+
let Database;
|
|
196
|
+
try {
|
|
197
|
+
const modName = 'better-sqlite3';
|
|
198
|
+
const mod = await import(modName);
|
|
199
|
+
Database = mod.default ?? mod;
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
throw new Error('better-sqlite3 is required for SQLite migration. Install it: npm install better-sqlite3');
|
|
203
|
+
}
|
|
204
|
+
const db = new Database(dbPath, { readonly: true });
|
|
205
|
+
const lines = [];
|
|
206
|
+
try {
|
|
207
|
+
// Agents
|
|
208
|
+
const agents = safeAll(db, 'SELECT * FROM agents ORDER BY id');
|
|
209
|
+
for (const row of agents) {
|
|
210
|
+
lines.push(JSON.stringify({ _type: 'agent', _version: 1, ...row }));
|
|
211
|
+
}
|
|
212
|
+
// Sessions
|
|
213
|
+
const sessions = safeAll(db, 'SELECT * FROM sessions ORDER BY created_at');
|
|
214
|
+
for (const row of sessions) {
|
|
215
|
+
lines.push(JSON.stringify({ _type: 'session', _version: 1, ...parseJsonFields(row, ['metadata']) }));
|
|
216
|
+
}
|
|
217
|
+
// Events
|
|
218
|
+
const events = safeAll(db, 'SELECT * FROM events ORDER BY timestamp');
|
|
219
|
+
for (const row of events) {
|
|
220
|
+
lines.push(JSON.stringify({ _type: 'event', _version: 1, ...parseJsonFields(row, ['data']) }));
|
|
221
|
+
}
|
|
222
|
+
// Health scores
|
|
223
|
+
const healthScores = safeAll(db, 'SELECT * FROM health_scores ORDER BY timestamp');
|
|
224
|
+
for (const row of healthScores) {
|
|
225
|
+
lines.push(JSON.stringify({ _type: 'health_score', _version: 1, ...parseJsonFields(row, ['dimensions', 'metadata']) }));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
db.close();
|
|
230
|
+
}
|
|
231
|
+
// Add checksum
|
|
232
|
+
const hash = createHash('sha256');
|
|
233
|
+
for (const line of lines) {
|
|
234
|
+
hash.update(line + '\n');
|
|
235
|
+
}
|
|
236
|
+
const counts = {};
|
|
237
|
+
for (const line of lines) {
|
|
238
|
+
const type = JSON.parse(line)._type;
|
|
239
|
+
counts[type] = (counts[type] ?? 0) + 1;
|
|
240
|
+
}
|
|
241
|
+
lines.push(JSON.stringify({
|
|
242
|
+
_type: 'checksum',
|
|
243
|
+
sha256: hash.digest('hex'),
|
|
244
|
+
counts,
|
|
245
|
+
exported_at: new Date().toISOString(),
|
|
246
|
+
}));
|
|
247
|
+
return lines;
|
|
248
|
+
}
|
|
249
|
+
// ─── Upload Helpers ──────────────────────────────────────────
|
|
250
|
+
async function uploadBatch(cloudUrl, apiKey, lines) {
|
|
251
|
+
const body = lines.join('\n') + '\n';
|
|
252
|
+
const response = await fetch(`${cloudUrl}/api/import`, {
|
|
253
|
+
method: 'POST',
|
|
254
|
+
headers: {
|
|
255
|
+
Authorization: `Bearer ${apiKey}`,
|
|
256
|
+
'Content-Type': 'application/x-ndjson',
|
|
257
|
+
},
|
|
258
|
+
body,
|
|
259
|
+
});
|
|
260
|
+
if (!response.ok) {
|
|
261
|
+
const text = await response.text().catch(() => '');
|
|
262
|
+
throw new Error(`Upload failed: ${response.status} ${response.statusText} ${text}`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async function verifyMigration(cloudUrl, apiKey, ndjsonLines) {
|
|
266
|
+
// Count local records by type
|
|
267
|
+
const localCounts = {};
|
|
268
|
+
for (const line of ndjsonLines) {
|
|
269
|
+
try {
|
|
270
|
+
const parsed = JSON.parse(line);
|
|
271
|
+
if (parsed._type && parsed._type !== 'checksum') {
|
|
272
|
+
localCounts[parsed._type] = (localCounts[parsed._type] ?? 0) + 1;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch { /* skip */ }
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
const response = await fetch(`${cloudUrl}/api/export/counts`, {
|
|
279
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
280
|
+
});
|
|
281
|
+
if (!response.ok)
|
|
282
|
+
return false;
|
|
283
|
+
const remoteCounts = (await response.json());
|
|
284
|
+
let allMatch = true;
|
|
285
|
+
for (const [type, count] of Object.entries(localCounts)) {
|
|
286
|
+
const remote = remoteCounts[type] ?? 0;
|
|
287
|
+
if (remote < count) {
|
|
288
|
+
console.log(` ⚠️ ${type}: local=${count}, cloud=${remote}`);
|
|
289
|
+
allMatch = false;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
console.log(` ✓ ${type}: ${remote} records`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return allMatch;
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
console.log(' Could not verify (API error). Check manually.');
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// ─── Utility ─────────────────────────────────────────────────
|
|
303
|
+
function progressBar(pct) {
|
|
304
|
+
const filled = Math.round(pct / 5);
|
|
305
|
+
return '[' + '█'.repeat(filled) + '░'.repeat(20 - filled) + ']';
|
|
306
|
+
}
|
|
307
|
+
function saveState(state) {
|
|
308
|
+
const { mkdirSync } = require('node:fs');
|
|
309
|
+
mkdirSync(STATE_DIR, { recursive: true });
|
|
310
|
+
writeFileSync(DEFAULT_STATE_FILE, JSON.stringify(state, null, 2), 'utf-8');
|
|
311
|
+
}
|
|
312
|
+
function parseArgs(args) {
|
|
313
|
+
const result = {};
|
|
314
|
+
for (let i = 0; i < args.length; i++) {
|
|
315
|
+
if (args[i].startsWith('--') && i + 1 < args.length && !args[i + 1].startsWith('--')) {
|
|
316
|
+
result[args[i].slice(2)] = args[i + 1];
|
|
317
|
+
i++;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return result;
|
|
321
|
+
}
|
|
322
|
+
function safeAll(db, sql) {
|
|
323
|
+
try {
|
|
324
|
+
return db.prepare(sql).all();
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
return [];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function parseJsonFields(row, fields) {
|
|
331
|
+
const result = { ...row };
|
|
332
|
+
for (const field of fields) {
|
|
333
|
+
if (typeof result[field] === 'string') {
|
|
334
|
+
try {
|
|
335
|
+
result[field] = JSON.parse(result[field]);
|
|
336
|
+
}
|
|
337
|
+
catch { /* keep as string */ }
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return result;
|
|
341
|
+
}
|
|
342
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA0B9C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AAChD,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AACjE,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;AAEh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;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,EAAO,EAAE,GAAW;IACnC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,GAAc,EAAE,MAAgB;IACvD,MAAM,MAAM,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;IAC1B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;YACtC,IAAI,CAAC;gBACH,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAW,CAAC,CAAC;YACtD,CAAC;YAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,30 +4,36 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Uses node:util parseArgs for lightweight argument parsing.
|
|
6
6
|
*/
|
|
7
|
+
import { runAuditCommand } from './commands/audit.js';
|
|
7
8
|
import { runConfigCommand } from './commands/config.js';
|
|
9
|
+
import { runDiagnoseCommand } from './commands/diagnose.js';
|
|
8
10
|
import { runContextCommand } from './commands/context.js';
|
|
9
11
|
import { runEventsCommand } from './commands/events.js';
|
|
10
12
|
import { runGuardrailsCommand } from './commands/guardrails.js';
|
|
11
13
|
import { runHealthCommand } from './commands/health.js';
|
|
12
|
-
import {
|
|
14
|
+
import { lessonsCommand } from './commands/lessons.js';
|
|
13
15
|
import { runLlmCommand } from './commands/llm.js';
|
|
14
16
|
import { runOptimizeCommand } from './commands/optimize.js';
|
|
15
17
|
import { runRecallCommand } from './commands/recall.js';
|
|
16
18
|
import { runReflectCommand } from './commands/reflect.js';
|
|
17
19
|
import { runSessionsCommand } from './commands/sessions.js';
|
|
18
20
|
import { runTailCommand } from './commands/tail.js';
|
|
21
|
+
import { runMigrateCommand } from './commands/migrate.js';
|
|
19
22
|
const HELP = `AgentLens CLI — Observability for AI agents
|
|
20
23
|
|
|
21
24
|
Usage: agentlens <command> [options]
|
|
22
25
|
|
|
23
26
|
Commands:
|
|
27
|
+
audit Verify audit trail integrity
|
|
24
28
|
config Get or set configuration (url, api-key)
|
|
29
|
+
diagnose AI-powered diagnostics & root cause analysis
|
|
25
30
|
context Retrieve cross-session context for a topic
|
|
26
31
|
events Query events
|
|
27
32
|
guardrails Manage guardrail rules (list, get, create, enable, disable, history, delete)
|
|
28
33
|
health Agent health scores and trends
|
|
29
34
|
lessons Manage agent lessons (list, create, get, update, delete, search)
|
|
30
35
|
llm LLM call tracking (stats, models, recent)
|
|
36
|
+
migrate Migrate data between self-hosted and cloud
|
|
31
37
|
optimize Cost optimization recommendations
|
|
32
38
|
recall Semantic search over agent memory
|
|
33
39
|
reflect Pattern analysis across agent sessions
|
|
@@ -46,12 +52,18 @@ async function main() {
|
|
|
46
52
|
const command = args[0];
|
|
47
53
|
const rest = args.slice(1);
|
|
48
54
|
switch (command) {
|
|
55
|
+
case 'audit':
|
|
56
|
+
await runAuditCommand(rest);
|
|
57
|
+
break;
|
|
49
58
|
case 'config':
|
|
50
59
|
runConfigCommand(rest);
|
|
51
60
|
break;
|
|
52
61
|
case 'context':
|
|
53
62
|
await runContextCommand(rest);
|
|
54
63
|
break;
|
|
64
|
+
case 'diagnose':
|
|
65
|
+
await runDiagnoseCommand(rest);
|
|
66
|
+
break;
|
|
55
67
|
case 'events':
|
|
56
68
|
await runEventsCommand(rest);
|
|
57
69
|
break;
|
|
@@ -62,11 +74,14 @@ async function main() {
|
|
|
62
74
|
await runHealthCommand(rest);
|
|
63
75
|
break;
|
|
64
76
|
case 'lessons':
|
|
65
|
-
await
|
|
77
|
+
await lessonsCommand(rest);
|
|
66
78
|
break;
|
|
67
79
|
case 'llm':
|
|
68
80
|
await runLlmCommand(rest);
|
|
69
81
|
break;
|
|
82
|
+
case 'migrate':
|
|
83
|
+
await runMigrateCommand(rest);
|
|
84
|
+
break;
|
|
70
85
|
case 'optimize':
|
|
71
86
|
await runOptimizeCommand(rest);
|
|
72
87
|
break;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAk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,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,oFAAoF,CAAC,CAAC;QACtG,CAAC;aAAM,IAAI,CAAC,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;QAC/E,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentlensai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Command-line interface for AgentLens — query events, sessions, and manage your observability server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Amit Paz",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/agentkitai/agentlens.git",
|
|
11
11
|
"directory": "packages/cli"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/
|
|
13
|
+
"homepage": "https://github.com/agentkitai/agentlens/tree/main/packages/cli",
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/agentkitai/agentlens/issues"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"agentlens",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"files": [
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@agentlensai/sdk": "0.13.0"
|
|
41
|
+
},
|
|
39
42
|
"scripts": {
|
|
40
43
|
"build": "tsc -b",
|
|
41
44
|
"dev": "tsc -b --watch",
|
|
42
45
|
"typecheck": "tsc --noEmit",
|
|
43
46
|
"test": "vitest run",
|
|
44
47
|
"test:watch": "vitest"
|
|
45
|
-
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"@agentlensai/sdk": "^0.8.0"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|