@devness/useai-cli 0.6.23 → 0.6.25

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.
Files changed (2) hide show
  1. package/dist/index.js +132 -35
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -30,15 +30,36 @@ 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.23";
33
+ var VERSION = "0.6.25";
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
+ milestones: true,
47
+ prompts: false,
48
+ private_titles: false,
49
+ projects: false,
50
+ model: true,
51
+ languages: true
52
+ };
53
+ var DEFAULT_SYNC_CONFIG = {
54
+ enabled: false,
55
+ interval_hours: 24,
56
+ include: { ...DEFAULT_SYNC_INCLUDE_CONFIG }
57
+ };
36
58
  var DEFAULT_CONFIG = {
37
- milestone_tracking: true,
38
- auto_sync: true,
59
+ capture: { ...DEFAULT_CAPTURE_CONFIG },
60
+ sync: { ...DEFAULT_SYNC_CONFIG },
39
61
  evaluation_framework: "space"
40
62
  };
41
- var DEFAULT_SYNC_INTERVAL_HOURS = 24;
42
63
 
43
64
  // ../shared/dist/constants/tools.js
44
65
  var TOOL_COLORS = {
@@ -184,6 +205,56 @@ function formatDuration(seconds) {
184
205
  // ../shared/dist/utils/id.js
185
206
  import { randomUUID } from "crypto";
186
207
 
208
+ // ../shared/dist/utils/config-migrate.js
209
+ function migrateConfig(raw) {
210
+ const config = { ...raw };
211
+ if (!config.capture || typeof config.capture !== "object") {
212
+ config.capture = { ...DEFAULT_CAPTURE_CONFIG };
213
+ if (typeof raw["milestone_tracking"] === "boolean") {
214
+ config.capture.milestones = raw["milestone_tracking"];
215
+ }
216
+ } else {
217
+ const c = config.capture;
218
+ config.capture = {
219
+ prompt: c.prompt ?? DEFAULT_CAPTURE_CONFIG.prompt,
220
+ prompt_images: c.prompt_images ?? DEFAULT_CAPTURE_CONFIG.prompt_images,
221
+ evaluation: c.evaluation ?? DEFAULT_CAPTURE_CONFIG.evaluation,
222
+ evaluation_reasons: c.evaluation_reasons ?? DEFAULT_CAPTURE_CONFIG.evaluation_reasons,
223
+ milestones: c.milestones ?? DEFAULT_CAPTURE_CONFIG.milestones
224
+ };
225
+ }
226
+ if (!config.sync || typeof config.sync !== "object") {
227
+ config.sync = { ...DEFAULT_SYNC_CONFIG, include: { ...DEFAULT_SYNC_INCLUDE_CONFIG } };
228
+ if (typeof raw["auto_sync"] === "boolean") {
229
+ config.sync.enabled = raw["auto_sync"];
230
+ }
231
+ if (typeof raw["sync_interval_hours"] === "number") {
232
+ config.sync.interval_hours = raw["sync_interval_hours"];
233
+ }
234
+ } else {
235
+ const s = config.sync;
236
+ const include = s.include ?? {};
237
+ config.sync = {
238
+ enabled: s.enabled ?? DEFAULT_SYNC_CONFIG.enabled,
239
+ interval_hours: s.interval_hours ?? DEFAULT_SYNC_CONFIG.interval_hours,
240
+ include: {
241
+ sessions: include.sessions ?? DEFAULT_SYNC_INCLUDE_CONFIG.sessions,
242
+ evaluations: include.evaluations ?? DEFAULT_SYNC_INCLUDE_CONFIG.evaluations,
243
+ milestones: include.milestones ?? DEFAULT_SYNC_INCLUDE_CONFIG.milestones,
244
+ prompts: include.prompts ?? DEFAULT_SYNC_INCLUDE_CONFIG.prompts,
245
+ private_titles: include.private_titles ?? DEFAULT_SYNC_INCLUDE_CONFIG.private_titles,
246
+ projects: include.projects ?? DEFAULT_SYNC_INCLUDE_CONFIG.projects,
247
+ model: include.model ?? DEFAULT_SYNC_INCLUDE_CONFIG.model,
248
+ languages: include.languages ?? DEFAULT_SYNC_INCLUDE_CONFIG.languages
249
+ }
250
+ };
251
+ }
252
+ if (!config.evaluation_framework) {
253
+ config.evaluation_framework = "space";
254
+ }
255
+ return config;
256
+ }
257
+
187
258
  // src/services/stats.service.ts
188
259
  function getStats() {
189
260
  const sessions = readJson(SESSIONS_FILE, []);
@@ -300,12 +371,9 @@ import { existsSync as existsSync2, statSync, readdirSync } from "fs";
300
371
  import chalk3 from "chalk";
301
372
 
302
373
  // src/services/config.service.ts
303
- var DEFAULT_USEAI_CONFIG = {
304
- ...DEFAULT_CONFIG,
305
- sync_interval_hours: DEFAULT_SYNC_INTERVAL_HOURS
306
- };
307
374
  function getConfig() {
308
- return readJson(CONFIG_FILE, DEFAULT_USEAI_CONFIG);
375
+ const raw = readJson(CONFIG_FILE, {});
376
+ return migrateConfig(raw);
309
377
  }
310
378
  function saveConfig(config) {
311
379
  writeJson(CONFIG_FILE, config);
@@ -362,19 +430,21 @@ var statusCommand = new Command2("status").description("Full transparency dashbo
362
430
  console.log(header("Settings"));
363
431
  console.log(
364
432
  table([
365
- ["Milestone tracking", config.milestone_tracking ? chalk3.green("on") : chalk3.red("off")],
366
- ["Auto sync", config.auto_sync ? chalk3.green("on") : chalk3.red("off")],
367
- ["Sync interval", `${config.sync_interval_hours}h`],
433
+ ["Milestone tracking", config.capture.milestones ? chalk3.green("on") : chalk3.red("off")],
434
+ ["Prompt capture", config.capture.prompt ? chalk3.green("on") : chalk3.red("off")],
435
+ ["Eval reasons", config.capture.evaluation_reasons],
436
+ ["Cloud sync", config.sync.enabled ? chalk3.green("on") : chalk3.red("off")],
437
+ ["Sync interval", `${config.sync.interval_hours}h`],
368
438
  ["Last sync", config.last_sync_at ?? chalk3.dim("never")],
369
439
  ["Logged in", config.auth ? chalk3.green(config.auth.user.email) : chalk3.dim("no")]
370
440
  ])
371
441
  );
372
442
  console.log(header("Privacy"));
373
443
  console.log(
374
- info("useai NEVER captures code, file contents, prompts, or responses.")
444
+ info("Prompts are stored locally only. Cloud sync strips private data by default.")
375
445
  );
376
446
  console.log(
377
- info("Only durations, tool names, languages, and task types are recorded.")
447
+ info("Configure sync.include to control what leaves your machine.")
378
448
  );
379
449
  console.log("");
380
450
  });
@@ -5361,13 +5431,20 @@ var rawFramework = {
5361
5431
  const { prompt_quality, context_provided, independence_level, scope_quality } = evaluation;
5362
5432
  return (prompt_quality + context_provided + independence_level + scope_quality) / 20 * 100;
5363
5433
  },
5364
- getInstructionText() {
5365
- return [
5434
+ getInstructionText(opts) {
5435
+ const reasonsLevel = opts?.evaluationReasons ?? "all";
5436
+ const lines = [
5366
5437
  "- 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
5438
  ' - **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
5439
  " - **milestone category values**: feature, bugfix, refactor, test, docs, setup, deployment, fix, analysis, research, investigation, performance, cleanup, chore, security, migration, design, devops, config, other",
5369
5440
  " - **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
- ].join("\n");
5441
+ ];
5442
+ if (reasonsLevel === "all") {
5443
+ 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.");
5444
+ } else if (reasonsLevel === "below_perfect") {
5445
+ 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".');
5446
+ }
5447
+ return lines.join("\n");
5371
5448
  }
5372
5449
  };
5373
5450
 
@@ -5436,8 +5513,9 @@ var spaceFramework = {
5436
5513
  const { prompt_quality, context_provided, independence_level, scope_quality } = evaluation;
5437
5514
  return (prompt_quality / 5 * 0.3 + context_provided / 5 * 0.25 + independence_level / 5 * 0.25 + scope_quality / 5 * 0.2) * 100;
5438
5515
  },
5439
- getInstructionText() {
5440
- return [
5516
+ getInstructionText(opts) {
5517
+ const reasonsLevel = opts?.evaluationReasons ?? "all";
5518
+ const lines = [
5441
5519
  "- At the END of every response, call `useai_end` with languages used, files_touched_count, milestones, and an `evaluation` object.",
5442
5520
  ' - **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
5521
  " - **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 +5525,14 @@ var spaceFramework = {
5447
5525
  " - **context_provided** (Communication, weight 0.25): 1=no context, 3=some files/errors but incomplete, 5=comprehensive with constraints",
5448
5526
  " - **independence_level** (Efficiency, weight 0.25): 1=constant guidance needed, 3=some back-and-forth, 5=clear spec with autonomous execution",
5449
5527
  " - **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
- "- 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."
5452
- ].join("\n");
5528
+ "- Also include: task_outcome (completed/partial/abandoned/blocked), iteration_count, tools_leveraged count."
5529
+ ];
5530
+ if (reasonsLevel === "all") {
5531
+ 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.");
5532
+ } else if (reasonsLevel === "below_perfect") {
5533
+ 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".');
5534
+ }
5535
+ return lines.join("\n");
5453
5536
  }
5454
5537
  };
5455
5538
 
@@ -5467,15 +5550,19 @@ function getFramework(id) {
5467
5550
  function getFrameworkIds() {
5468
5551
  return Object.keys(frameworks);
5469
5552
  }
5470
- function buildInstructionsText(frameworkId) {
5553
+ function buildInstructionsText(frameworkId, opts) {
5471
5554
  const framework = getFramework(frameworkId);
5555
+ const frameworkOpts = {
5556
+ evaluationReasons: opts?.evaluationReasons
5557
+ };
5558
+ const promptInstruction = opts?.capturePrompt !== false ? ", `prompt` (the user's full verbatim prompt text)" : "";
5472
5559
  return [
5473
5560
  "## UseAI Session Tracking",
5474
- "- At the START of every response to a **user message**, call `useai_start` with the appropriate task_type. Also generate a short session `title` (generic, no project names) and `private_title` (detailed, can include specifics) from the user's prompt.",
5561
+ `- 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
5562
  " - **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
5563
  "- 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
5564
  "- For LONG sessions (15+ min), call `useai_heartbeat` periodically.",
5478
- framework.getInstructionText()
5565
+ framework.getInstructionText(frameworkOpts)
5479
5566
  ].join("\n");
5480
5567
  }
5481
5568
 
@@ -6124,20 +6211,28 @@ function reinjectInstructions(frameworkId) {
6124
6211
  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
6212
  let changed = false;
6126
6213
  if (process.argv.includes("--no-sync")) {
6127
- updateConfig({ auto_sync: false });
6128
- console.log(success("Auto-sync disabled."));
6214
+ const cfg = getConfig();
6215
+ cfg.sync.enabled = false;
6216
+ updateConfig(cfg);
6217
+ console.log(success("Cloud sync disabled."));
6129
6218
  changed = true;
6130
6219
  } else if (process.argv.includes("--sync")) {
6131
- updateConfig({ auto_sync: true });
6132
- console.log(success("Auto-sync enabled."));
6220
+ const cfg = getConfig();
6221
+ cfg.sync.enabled = true;
6222
+ updateConfig(cfg);
6223
+ console.log(success("Cloud sync enabled."));
6133
6224
  changed = true;
6134
6225
  }
6135
6226
  if (process.argv.includes("--no-milestones")) {
6136
- updateConfig({ milestone_tracking: false });
6227
+ const cfg = getConfig();
6228
+ cfg.capture.milestones = false;
6229
+ updateConfig(cfg);
6137
6230
  console.log(success("Milestone tracking disabled."));
6138
6231
  changed = true;
6139
6232
  } else if (process.argv.includes("--milestones")) {
6140
- updateConfig({ milestone_tracking: true });
6233
+ const cfg = getConfig();
6234
+ cfg.capture.milestones = true;
6235
+ updateConfig(cfg);
6141
6236
  console.log(success("Milestone tracking enabled."));
6142
6237
  changed = true;
6143
6238
  }
@@ -6162,10 +6257,12 @@ var configCommand = new Command4("config").description("View or update settings"
6162
6257
  console.log(header("Current Settings"));
6163
6258
  console.log(
6164
6259
  table([
6165
- ["Milestone tracking", config.milestone_tracking ? chalk5.green("on") : chalk5.red("off")],
6166
- ["Auto sync", config.auto_sync ? chalk5.green("on") : chalk5.red("off")],
6167
- ["Eval framework", chalk5.cyan(config.evaluation_framework ?? "raw")],
6168
- ["Sync interval", `${config.sync_interval_hours}h`],
6260
+ ["Milestone tracking", config.capture.milestones ? chalk5.green("on") : chalk5.red("off")],
6261
+ ["Prompt capture", config.capture.prompt ? chalk5.green("on") : chalk5.red("off")],
6262
+ ["Eval reasons", config.capture.evaluation_reasons],
6263
+ ["Cloud sync", config.sync.enabled ? chalk5.green("on") : chalk5.red("off")],
6264
+ ["Eval framework", chalk5.cyan(config.evaluation_framework ?? "space")],
6265
+ ["Sync interval", `${config.sync.interval_hours}h`],
6169
6266
  ["Last sync", config.last_sync_at ?? chalk5.dim("never")],
6170
6267
  ["Logged in", config.auth ? chalk5.green(config.auth.user.email) : chalk5.dim("no")]
6171
6268
  ])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devness/useai-cli",
3
- "version": "0.6.23",
3
+ "version": "0.6.25",
4
4
  "description": "CLI tool for useai.dev — stats, sync, publish your AI development workflow",
5
5
  "author": "nabeelkausari",
6
6
  "license": "AGPL-3.0-only",