@devness/useai-cli 0.6.23 → 0.6.24
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/index.js +134 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,15 +30,37 @@ var SYSTEMD_SERVICE_PATH = join(homedir(), ".config", "systemd", "user", "useai-
|
|
|
30
30
|
var WINDOWS_STARTUP_SCRIPT_PATH = join(process.env["APPDATA"] ?? join(homedir(), "AppData", "Roaming"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "useai-daemon.vbs");
|
|
31
31
|
|
|
32
32
|
// ../shared/dist/constants/version.js
|
|
33
|
-
var VERSION = "0.6.
|
|
33
|
+
var VERSION = "0.6.24";
|
|
34
34
|
|
|
35
35
|
// ../shared/dist/constants/defaults.js
|
|
36
|
+
var DEFAULT_CAPTURE_CONFIG = {
|
|
37
|
+
prompt: true,
|
|
38
|
+
prompt_images: true,
|
|
39
|
+
evaluation: true,
|
|
40
|
+
evaluation_reasons: "all",
|
|
41
|
+
milestones: true
|
|
42
|
+
};
|
|
43
|
+
var DEFAULT_SYNC_INCLUDE_CONFIG = {
|
|
44
|
+
sessions: true,
|
|
45
|
+
evaluations: true,
|
|
46
|
+
evaluation_reasons: "all",
|
|
47
|
+
milestones: true,
|
|
48
|
+
prompts: false,
|
|
49
|
+
private_titles: false,
|
|
50
|
+
projects: false,
|
|
51
|
+
model: true,
|
|
52
|
+
languages: true
|
|
53
|
+
};
|
|
54
|
+
var DEFAULT_SYNC_CONFIG = {
|
|
55
|
+
enabled: false,
|
|
56
|
+
interval_hours: 24,
|
|
57
|
+
include: { ...DEFAULT_SYNC_INCLUDE_CONFIG }
|
|
58
|
+
};
|
|
36
59
|
var DEFAULT_CONFIG = {
|
|
37
|
-
|
|
38
|
-
|
|
60
|
+
capture: { ...DEFAULT_CAPTURE_CONFIG },
|
|
61
|
+
sync: { ...DEFAULT_SYNC_CONFIG },
|
|
39
62
|
evaluation_framework: "space"
|
|
40
63
|
};
|
|
41
|
-
var DEFAULT_SYNC_INTERVAL_HOURS = 24;
|
|
42
64
|
|
|
43
65
|
// ../shared/dist/constants/tools.js
|
|
44
66
|
var TOOL_COLORS = {
|
|
@@ -184,6 +206,57 @@ function formatDuration(seconds) {
|
|
|
184
206
|
// ../shared/dist/utils/id.js
|
|
185
207
|
import { randomUUID } from "crypto";
|
|
186
208
|
|
|
209
|
+
// ../shared/dist/utils/config-migrate.js
|
|
210
|
+
function migrateConfig(raw) {
|
|
211
|
+
const config = { ...raw };
|
|
212
|
+
if (!config.capture || typeof config.capture !== "object") {
|
|
213
|
+
config.capture = { ...DEFAULT_CAPTURE_CONFIG };
|
|
214
|
+
if (typeof raw["milestone_tracking"] === "boolean") {
|
|
215
|
+
config.capture.milestones = raw["milestone_tracking"];
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
const c = config.capture;
|
|
219
|
+
config.capture = {
|
|
220
|
+
prompt: c.prompt ?? DEFAULT_CAPTURE_CONFIG.prompt,
|
|
221
|
+
prompt_images: c.prompt_images ?? DEFAULT_CAPTURE_CONFIG.prompt_images,
|
|
222
|
+
evaluation: c.evaluation ?? DEFAULT_CAPTURE_CONFIG.evaluation,
|
|
223
|
+
evaluation_reasons: c.evaluation_reasons ?? DEFAULT_CAPTURE_CONFIG.evaluation_reasons,
|
|
224
|
+
milestones: c.milestones ?? DEFAULT_CAPTURE_CONFIG.milestones
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (!config.sync || typeof config.sync !== "object") {
|
|
228
|
+
config.sync = { ...DEFAULT_SYNC_CONFIG, include: { ...DEFAULT_SYNC_INCLUDE_CONFIG } };
|
|
229
|
+
if (typeof raw["auto_sync"] === "boolean") {
|
|
230
|
+
config.sync.enabled = raw["auto_sync"];
|
|
231
|
+
}
|
|
232
|
+
if (typeof raw["sync_interval_hours"] === "number") {
|
|
233
|
+
config.sync.interval_hours = raw["sync_interval_hours"];
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
const s = config.sync;
|
|
237
|
+
const include = s.include ?? {};
|
|
238
|
+
config.sync = {
|
|
239
|
+
enabled: s.enabled ?? DEFAULT_SYNC_CONFIG.enabled,
|
|
240
|
+
interval_hours: s.interval_hours ?? DEFAULT_SYNC_CONFIG.interval_hours,
|
|
241
|
+
include: {
|
|
242
|
+
sessions: include.sessions ?? DEFAULT_SYNC_INCLUDE_CONFIG.sessions,
|
|
243
|
+
evaluations: include.evaluations ?? DEFAULT_SYNC_INCLUDE_CONFIG.evaluations,
|
|
244
|
+
evaluation_reasons: include.evaluation_reasons ?? DEFAULT_SYNC_INCLUDE_CONFIG.evaluation_reasons,
|
|
245
|
+
milestones: include.milestones ?? DEFAULT_SYNC_INCLUDE_CONFIG.milestones,
|
|
246
|
+
prompts: include.prompts ?? DEFAULT_SYNC_INCLUDE_CONFIG.prompts,
|
|
247
|
+
private_titles: include.private_titles ?? DEFAULT_SYNC_INCLUDE_CONFIG.private_titles,
|
|
248
|
+
projects: include.projects ?? DEFAULT_SYNC_INCLUDE_CONFIG.projects,
|
|
249
|
+
model: include.model ?? DEFAULT_SYNC_INCLUDE_CONFIG.model,
|
|
250
|
+
languages: include.languages ?? DEFAULT_SYNC_INCLUDE_CONFIG.languages
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
if (!config.evaluation_framework) {
|
|
255
|
+
config.evaluation_framework = "space";
|
|
256
|
+
}
|
|
257
|
+
return config;
|
|
258
|
+
}
|
|
259
|
+
|
|
187
260
|
// src/services/stats.service.ts
|
|
188
261
|
function getStats() {
|
|
189
262
|
const sessions = readJson(SESSIONS_FILE, []);
|
|
@@ -300,12 +373,9 @@ import { existsSync as existsSync2, statSync, readdirSync } from "fs";
|
|
|
300
373
|
import chalk3 from "chalk";
|
|
301
374
|
|
|
302
375
|
// src/services/config.service.ts
|
|
303
|
-
var DEFAULT_USEAI_CONFIG = {
|
|
304
|
-
...DEFAULT_CONFIG,
|
|
305
|
-
sync_interval_hours: DEFAULT_SYNC_INTERVAL_HOURS
|
|
306
|
-
};
|
|
307
376
|
function getConfig() {
|
|
308
|
-
|
|
377
|
+
const raw = readJson(CONFIG_FILE, {});
|
|
378
|
+
return migrateConfig(raw);
|
|
309
379
|
}
|
|
310
380
|
function saveConfig(config) {
|
|
311
381
|
writeJson(CONFIG_FILE, config);
|
|
@@ -362,19 +432,21 @@ var statusCommand = new Command2("status").description("Full transparency dashbo
|
|
|
362
432
|
console.log(header("Settings"));
|
|
363
433
|
console.log(
|
|
364
434
|
table([
|
|
365
|
-
["Milestone tracking", config.
|
|
366
|
-
["
|
|
367
|
-
["
|
|
435
|
+
["Milestone tracking", config.capture.milestones ? chalk3.green("on") : chalk3.red("off")],
|
|
436
|
+
["Prompt capture", config.capture.prompt ? chalk3.green("on") : chalk3.red("off")],
|
|
437
|
+
["Eval reasons", config.capture.evaluation_reasons],
|
|
438
|
+
["Cloud sync", config.sync.enabled ? chalk3.green("on") : chalk3.red("off")],
|
|
439
|
+
["Sync interval", `${config.sync.interval_hours}h`],
|
|
368
440
|
["Last sync", config.last_sync_at ?? chalk3.dim("never")],
|
|
369
441
|
["Logged in", config.auth ? chalk3.green(config.auth.user.email) : chalk3.dim("no")]
|
|
370
442
|
])
|
|
371
443
|
);
|
|
372
444
|
console.log(header("Privacy"));
|
|
373
445
|
console.log(
|
|
374
|
-
info("
|
|
446
|
+
info("Prompts are stored locally only. Cloud sync strips private data by default.")
|
|
375
447
|
);
|
|
376
448
|
console.log(
|
|
377
|
-
info("
|
|
449
|
+
info("Configure sync.include to control what leaves your machine.")
|
|
378
450
|
);
|
|
379
451
|
console.log("");
|
|
380
452
|
});
|
|
@@ -5361,13 +5433,20 @@ var rawFramework = {
|
|
|
5361
5433
|
const { prompt_quality, context_provided, independence_level, scope_quality } = evaluation;
|
|
5362
5434
|
return (prompt_quality + context_provided + independence_level + scope_quality) / 20 * 100;
|
|
5363
5435
|
},
|
|
5364
|
-
getInstructionText() {
|
|
5365
|
-
|
|
5436
|
+
getInstructionText(opts) {
|
|
5437
|
+
const reasonsLevel = opts?.evaluationReasons ?? "all";
|
|
5438
|
+
const lines = [
|
|
5366
5439
|
"- At the END of every response, call `useai_end` with languages used, files_touched_count, milestones, and an `evaluation` object honestly assessing: prompt_quality (1-5), context_provided (1-5), task_outcome, iteration_count, independence_level (1-5), scope_quality (1-5), tools_leveraged count.",
|
|
5367
5440
|
' - **milestones**: Array of objects, each with required `title` (string, generic \u2014 no project/file names), `category` (string), and optional `private_title` (string, detailed \u2014 can include project names and specifics). Example: `[{"title": "Implemented auth flow", "private_title": "Added OAuth2 to UserService in acme-api", "category": "feature"}]`',
|
|
5368
5441
|
" - **milestone category values**: feature, bugfix, refactor, test, docs, setup, deployment, fix, analysis, research, investigation, performance, cleanup, chore, security, migration, design, devops, config, other",
|
|
5369
5442
|
" - **task_type values**: coding, debugging, testing, planning, reviewing, documenting, learning, deployment, devops, research, migration, design, data, security, configuration, code_review, investigation, infrastructure, analysis, ops, setup, refactoring, other"
|
|
5370
|
-
]
|
|
5443
|
+
];
|
|
5444
|
+
if (reasonsLevel === "all") {
|
|
5445
|
+
lines.push("- For EVERY scored metric, you MUST provide a *_reason field explaining the score. For < 5: what was lacking + tip to improve. For 5: what the user did well. Always provide task_outcome_reason.");
|
|
5446
|
+
} else if (reasonsLevel === "below_perfect") {
|
|
5447
|
+
lines.push('- For any scored metric < 5, you MUST provide a *_reason field explaining what was lacking and a tip to improve. Only skip *_reason for a perfect 5. Always provide task_outcome_reason if outcome is not "completed".');
|
|
5448
|
+
}
|
|
5449
|
+
return lines.join("\n");
|
|
5371
5450
|
}
|
|
5372
5451
|
};
|
|
5373
5452
|
|
|
@@ -5436,8 +5515,9 @@ var spaceFramework = {
|
|
|
5436
5515
|
const { prompt_quality, context_provided, independence_level, scope_quality } = evaluation;
|
|
5437
5516
|
return (prompt_quality / 5 * 0.3 + context_provided / 5 * 0.25 + independence_level / 5 * 0.25 + scope_quality / 5 * 0.2) * 100;
|
|
5438
5517
|
},
|
|
5439
|
-
getInstructionText() {
|
|
5440
|
-
|
|
5518
|
+
getInstructionText(opts) {
|
|
5519
|
+
const reasonsLevel = opts?.evaluationReasons ?? "all";
|
|
5520
|
+
const lines = [
|
|
5441
5521
|
"- At the END of every response, call `useai_end` with languages used, files_touched_count, milestones, and an `evaluation` object.",
|
|
5442
5522
|
' - **milestones**: Array of objects, each with required `title` (string, generic \u2014 no project/file names), `category` (string), and optional `private_title` (string, detailed \u2014 can include project names and specifics). Example: `[{"title": "Implemented auth flow", "private_title": "Added OAuth2 to UserService in acme-api", "category": "feature"}]`',
|
|
5443
5523
|
" - **milestone category values**: feature, bugfix, refactor, test, docs, setup, deployment, fix, analysis, research, investigation, performance, cleanup, chore, security, migration, design, devops, config, other",
|
|
@@ -5447,9 +5527,14 @@ var spaceFramework = {
|
|
|
5447
5527
|
" - **context_provided** (Communication, weight 0.25): 1=no context, 3=some files/errors but incomplete, 5=comprehensive with constraints",
|
|
5448
5528
|
" - **independence_level** (Efficiency, weight 0.25): 1=constant guidance needed, 3=some back-and-forth, 5=clear spec with autonomous execution",
|
|
5449
5529
|
" - **scope_quality** (Performance, weight 0.20): 1=vague/impossibly broad, 3=reasonable with ambiguity, 5=precise and well-decomposed",
|
|
5450
|
-
"- Also include: task_outcome (completed/partial/abandoned/blocked), iteration_count, tools_leveraged count."
|
|
5451
|
-
|
|
5452
|
-
|
|
5530
|
+
"- Also include: task_outcome (completed/partial/abandoned/blocked), iteration_count, tools_leveraged count."
|
|
5531
|
+
];
|
|
5532
|
+
if (reasonsLevel === "all") {
|
|
5533
|
+
lines.push("- For EVERY scored metric, you MUST provide a *_reason field explaining the score. For < 5: what was lacking + tip to improve. For 5: what the user did well. Always provide task_outcome_reason.");
|
|
5534
|
+
} else if (reasonsLevel === "below_perfect") {
|
|
5535
|
+
lines.push('- For any scored metric < 5, you MUST provide a *_reason field explaining what was lacking and a tip to improve. Only skip *_reason for a perfect 5. Always provide task_outcome_reason if outcome is not "completed".');
|
|
5536
|
+
}
|
|
5537
|
+
return lines.join("\n");
|
|
5453
5538
|
}
|
|
5454
5539
|
};
|
|
5455
5540
|
|
|
@@ -5467,15 +5552,19 @@ function getFramework(id) {
|
|
|
5467
5552
|
function getFrameworkIds() {
|
|
5468
5553
|
return Object.keys(frameworks);
|
|
5469
5554
|
}
|
|
5470
|
-
function buildInstructionsText(frameworkId) {
|
|
5555
|
+
function buildInstructionsText(frameworkId, opts) {
|
|
5471
5556
|
const framework = getFramework(frameworkId);
|
|
5557
|
+
const frameworkOpts = {
|
|
5558
|
+
evaluationReasons: opts?.evaluationReasons
|
|
5559
|
+
};
|
|
5560
|
+
const promptInstruction = opts?.capturePrompt !== false ? ", `prompt` (the user's full verbatim prompt text)" : "";
|
|
5472
5561
|
return [
|
|
5473
5562
|
"## UseAI Session Tracking",
|
|
5474
|
-
|
|
5563
|
+
`- At the START of every response to a **user message**, call \`useai_start\` with the appropriate task_type${promptInstruction}. Also generate a short session \`title\` (generic, no project names) and \`private_title\` (detailed, can include specifics) from the user's prompt.`,
|
|
5475
5564
|
" - **task_type values**: coding, debugging, testing, planning, reviewing, documenting, learning, deployment, devops, research, migration, design, data, security, configuration, code_review, investigation, infrastructure, analysis, ops, setup, refactoring, other",
|
|
5476
5565
|
"- To group multiple prompts in the same conversation, pass the `conversation_id` from the previous `useai_start` response (returned as `conversation_id=<value>`). Omit it for the first message or a new conversation.",
|
|
5477
5566
|
"- For LONG sessions (15+ min), call `useai_heartbeat` periodically.",
|
|
5478
|
-
framework.getInstructionText()
|
|
5567
|
+
framework.getInstructionText(frameworkOpts)
|
|
5479
5568
|
].join("\n");
|
|
5480
5569
|
}
|
|
5481
5570
|
|
|
@@ -6124,20 +6213,28 @@ function reinjectInstructions(frameworkId) {
|
|
|
6124
6213
|
var configCommand = new Command4("config").description("View or update settings").option("--sync", "Enable auto-sync").option("--no-sync", "Disable auto-sync").option("--milestones", "Enable milestone tracking").option("--no-milestones", "Disable milestone tracking").option("--framework <name>", "Set evaluation framework: space (recommended), raw (basic)").action((opts) => {
|
|
6125
6214
|
let changed = false;
|
|
6126
6215
|
if (process.argv.includes("--no-sync")) {
|
|
6127
|
-
|
|
6128
|
-
|
|
6216
|
+
const cfg = getConfig();
|
|
6217
|
+
cfg.sync.enabled = false;
|
|
6218
|
+
updateConfig(cfg);
|
|
6219
|
+
console.log(success("Cloud sync disabled."));
|
|
6129
6220
|
changed = true;
|
|
6130
6221
|
} else if (process.argv.includes("--sync")) {
|
|
6131
|
-
|
|
6132
|
-
|
|
6222
|
+
const cfg = getConfig();
|
|
6223
|
+
cfg.sync.enabled = true;
|
|
6224
|
+
updateConfig(cfg);
|
|
6225
|
+
console.log(success("Cloud sync enabled."));
|
|
6133
6226
|
changed = true;
|
|
6134
6227
|
}
|
|
6135
6228
|
if (process.argv.includes("--no-milestones")) {
|
|
6136
|
-
|
|
6229
|
+
const cfg = getConfig();
|
|
6230
|
+
cfg.capture.milestones = false;
|
|
6231
|
+
updateConfig(cfg);
|
|
6137
6232
|
console.log(success("Milestone tracking disabled."));
|
|
6138
6233
|
changed = true;
|
|
6139
6234
|
} else if (process.argv.includes("--milestones")) {
|
|
6140
|
-
|
|
6235
|
+
const cfg = getConfig();
|
|
6236
|
+
cfg.capture.milestones = true;
|
|
6237
|
+
updateConfig(cfg);
|
|
6141
6238
|
console.log(success("Milestone tracking enabled."));
|
|
6142
6239
|
changed = true;
|
|
6143
6240
|
}
|
|
@@ -6162,10 +6259,12 @@ var configCommand = new Command4("config").description("View or update settings"
|
|
|
6162
6259
|
console.log(header("Current Settings"));
|
|
6163
6260
|
console.log(
|
|
6164
6261
|
table([
|
|
6165
|
-
["Milestone tracking", config.
|
|
6166
|
-
["
|
|
6167
|
-
["Eval
|
|
6168
|
-
["
|
|
6262
|
+
["Milestone tracking", config.capture.milestones ? chalk5.green("on") : chalk5.red("off")],
|
|
6263
|
+
["Prompt capture", config.capture.prompt ? chalk5.green("on") : chalk5.red("off")],
|
|
6264
|
+
["Eval reasons", config.capture.evaluation_reasons],
|
|
6265
|
+
["Cloud sync", config.sync.enabled ? chalk5.green("on") : chalk5.red("off")],
|
|
6266
|
+
["Eval framework", chalk5.cyan(config.evaluation_framework ?? "space")],
|
|
6267
|
+
["Sync interval", `${config.sync.interval_hours}h`],
|
|
6169
6268
|
["Last sync", config.last_sync_at ?? chalk5.dim("never")],
|
|
6170
6269
|
["Logged in", config.auth ? chalk5.green(config.auth.user.email) : chalk5.dim("no")]
|
|
6171
6270
|
])
|