@devness/useai 0.3.6 → 0.3.8
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/index.js +42 -18
- package/package.json +11 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 useai.dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -264,7 +264,8 @@ function createTool(def) {
|
|
|
264
264
|
remove: () => {
|
|
265
265
|
handler.remove(def.configPath);
|
|
266
266
|
if (def.instructions) removeInstructions(def.instructions);
|
|
267
|
-
}
|
|
267
|
+
},
|
|
268
|
+
getManualHint: () => def.instructions ? null : def.manualHint ?? null
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
function matchesTool(tool, query) {
|
|
@@ -288,10 +289,16 @@ function resolveTools(names) {
|
|
|
288
289
|
}
|
|
289
290
|
return { matched, unmatched };
|
|
290
291
|
}
|
|
291
|
-
var MCP_ENTRY, home, INSTRUCTIONS_START, INSTRUCTIONS_END, USEAI_INSTRUCTIONS, USEAI_INSTRUCTIONS_BLOCK, formatHandlers, appSupport, AI_TOOLS;
|
|
292
|
+
var USEAI_INSTRUCTIONS_TEXT, MCP_ENTRY, home, INSTRUCTIONS_START, INSTRUCTIONS_END, USEAI_INSTRUCTIONS, USEAI_INSTRUCTIONS_BLOCK, formatHandlers, appSupport, AI_TOOLS;
|
|
292
293
|
var init_tools = __esm({
|
|
293
294
|
"src/tools.ts"() {
|
|
294
295
|
"use strict";
|
|
296
|
+
USEAI_INSTRUCTIONS_TEXT = [
|
|
297
|
+
"## UseAI Session Tracking",
|
|
298
|
+
"- At the START of every conversation, call `useai_session_start` with the appropriate task_type.",
|
|
299
|
+
"- For LONG sessions (15+ min), call `useai_heartbeat` periodically.",
|
|
300
|
+
"- At the END of every conversation, call `useai_session_end` with languages used, files_touched_count, and milestones (generic descriptions only \u2014 no project names, file paths, or company names)."
|
|
301
|
+
].join("\n");
|
|
295
302
|
MCP_ENTRY = {
|
|
296
303
|
command: "npx",
|
|
297
304
|
args: ["-y", "@devness/useai"]
|
|
@@ -330,7 +337,8 @@ ${INSTRUCTIONS_END}`;
|
|
|
330
337
|
name: "Cursor",
|
|
331
338
|
configFormat: "standard",
|
|
332
339
|
configPath: join3(home, ".cursor", "mcp.json"),
|
|
333
|
-
detect: () => existsSync3(join3(home, ".cursor"))
|
|
340
|
+
detect: () => existsSync3(join3(home, ".cursor")),
|
|
341
|
+
manualHint: "Open Cursor Settings \u2192 Rules \u2192 User Rules and paste the instructions below."
|
|
334
342
|
}),
|
|
335
343
|
createTool({
|
|
336
344
|
id: "windsurf",
|
|
@@ -369,7 +377,8 @@ ${INSTRUCTIONS_END}`;
|
|
|
369
377
|
name: "Zed",
|
|
370
378
|
configFormat: "zed",
|
|
371
379
|
configPath: join3(appSupport, "Zed", "settings.json"),
|
|
372
|
-
detect: () => existsSync3(join3(appSupport, "Zed"))
|
|
380
|
+
detect: () => existsSync3(join3(appSupport, "Zed")),
|
|
381
|
+
manualHint: "Open Rules Library (\u2318\u2325L) \u2192 click + \u2192 paste the instructions below."
|
|
373
382
|
}),
|
|
374
383
|
createTool({
|
|
375
384
|
id: "cline",
|
|
@@ -412,14 +421,16 @@ ${INSTRUCTIONS_END}`;
|
|
|
412
421
|
name: "Amazon Q CLI",
|
|
413
422
|
configFormat: "standard",
|
|
414
423
|
configPath: join3(home, ".aws", "amazonq", "mcp.json"),
|
|
415
|
-
detect: () => hasBinary("q") || existsSync3(join3(home, ".aws", "amazonq"))
|
|
424
|
+
detect: () => hasBinary("q") || existsSync3(join3(home, ".aws", "amazonq")),
|
|
425
|
+
manualHint: "Create .amazonq/rules/useai.md in your project root with the instructions below."
|
|
416
426
|
}),
|
|
417
427
|
createTool({
|
|
418
428
|
id: "amazon-q-ide",
|
|
419
429
|
name: "Amazon Q IDE",
|
|
420
430
|
configFormat: "standard",
|
|
421
431
|
configPath: join3(home, ".aws", "amazonq", "default.json"),
|
|
422
|
-
detect: () => existsSync3(join3(home, ".amazonq")) || existsSync3(join3(home, ".aws", "amazonq"))
|
|
432
|
+
detect: () => existsSync3(join3(home, ".amazonq")) || existsSync3(join3(home, ".aws", "amazonq")),
|
|
433
|
+
manualHint: "Create .amazonq/rules/useai.md in your project root with the instructions below."
|
|
423
434
|
}),
|
|
424
435
|
createTool({
|
|
425
436
|
id: "codex",
|
|
@@ -450,7 +461,8 @@ ${INSTRUCTIONS_END}`;
|
|
|
450
461
|
name: "Junie",
|
|
451
462
|
configFormat: "standard",
|
|
452
463
|
configPath: join3(home, ".junie", "mcp", "mcp.json"),
|
|
453
|
-
detect: () => existsSync3(join3(home, ".junie"))
|
|
464
|
+
detect: () => existsSync3(join3(home, ".junie")),
|
|
465
|
+
manualHint: "Add the instructions below to .junie/guidelines.md in your project root."
|
|
454
466
|
})
|
|
455
467
|
];
|
|
456
468
|
}
|
|
@@ -481,6 +493,21 @@ function err(text) {
|
|
|
481
493
|
function dim(text) {
|
|
482
494
|
return chalk.dim(` ${text}`);
|
|
483
495
|
}
|
|
496
|
+
function showManualHints(installedTools) {
|
|
497
|
+
const hints = installedTools.map((t) => ({ name: t.name, hint: t.getManualHint() })).filter((h) => h.hint !== null);
|
|
498
|
+
if (hints.length === 0) return;
|
|
499
|
+
console.log(chalk.yellow(`
|
|
500
|
+
\u26A0 Manual setup needed for ${hints.length} tool${hints.length === 1 ? "" : "s"}:
|
|
501
|
+
`));
|
|
502
|
+
for (const { name, hint } of hints) {
|
|
503
|
+
console.log(` ${chalk.bold(name)}: ${hint}`);
|
|
504
|
+
}
|
|
505
|
+
console.log(chalk.dim("\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
506
|
+
for (const line of USEAI_INSTRUCTIONS_TEXT.split("\n")) {
|
|
507
|
+
console.log(chalk.dim(" \u2502 ") + line);
|
|
508
|
+
}
|
|
509
|
+
console.log(chalk.dim(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"));
|
|
510
|
+
}
|
|
484
511
|
function showStatus(tools) {
|
|
485
512
|
console.log(header("AI Tool MCP Status"));
|
|
486
513
|
const rows = [];
|
|
@@ -520,6 +547,7 @@ async function installFlow(tools, autoYes, explicit) {
|
|
|
520
547
|
console.log(err(`\u2717 ${tool.name.padEnd(18)} \u2014 ${e.message}`));
|
|
521
548
|
}
|
|
522
549
|
}
|
|
550
|
+
showManualHints(tools);
|
|
523
551
|
console.log();
|
|
524
552
|
return;
|
|
525
553
|
}
|
|
@@ -585,6 +613,7 @@ async function installFlow(tools, autoYes, explicit) {
|
|
|
585
613
|
} catch {
|
|
586
614
|
}
|
|
587
615
|
}
|
|
616
|
+
showManualHints([...toInstall, ...alreadyConfigured]);
|
|
588
617
|
console.log(`
|
|
589
618
|
Done! UseAI MCP server configured in ${chalk.bold(String(toInstall.length))} tool${toInstall.length === 1 ? "" : "s"}.
|
|
590
619
|
`);
|
|
@@ -1049,7 +1078,7 @@ var server = new McpServer({
|
|
|
1049
1078
|
});
|
|
1050
1079
|
server.tool(
|
|
1051
1080
|
"useai_session_start",
|
|
1052
|
-
"Start tracking an AI coding session. Call this at the beginning of a conversation.
|
|
1081
|
+
"Start tracking an AI coding session. Call this at the beginning of a conversation.",
|
|
1053
1082
|
{
|
|
1054
1083
|
task_type: z2.enum(["coding", "debugging", "testing", "planning", "reviewing", "documenting", "learning", "other"]).optional().describe("What kind of task is the developer working on?")
|
|
1055
1084
|
},
|
|
@@ -1067,8 +1096,7 @@ server.tool(
|
|
|
1067
1096
|
{
|
|
1068
1097
|
type: "text",
|
|
1069
1098
|
text: `useai session started \u2014 tracking ${sessionTaskType} session on ${clientName}.
|
|
1070
|
-
Session: ${sessionId.slice(0, 8)} \xB7 Chain: ${record.hash.slice(0, 12)} (${signingAvailable ? "signed" : "unsigned"})
|
|
1071
|
-
All data stored locally at ${USEAI_DIR}. No network calls made.`
|
|
1099
|
+
Session: ${sessionId.slice(0, 8)} \xB7 Chain: ${record.hash.slice(0, 12)} (${signingAvailable ? "signed" : "unsigned"})`
|
|
1072
1100
|
}
|
|
1073
1101
|
]
|
|
1074
1102
|
};
|
|
@@ -1076,7 +1104,7 @@ All data stored locally at ${USEAI_DIR}. No network calls made.`
|
|
|
1076
1104
|
);
|
|
1077
1105
|
server.tool(
|
|
1078
1106
|
"useai_heartbeat",
|
|
1079
|
-
"Record a heartbeat for the current AI coding session. Call this periodically during long conversations (every 10-15 minutes).
|
|
1107
|
+
"Record a heartbeat for the current AI coding session. Call this periodically during long conversations (every 10-15 minutes).",
|
|
1080
1108
|
{},
|
|
1081
1109
|
async () => {
|
|
1082
1110
|
incrementHeartbeat();
|
|
@@ -1088,7 +1116,7 @@ server.tool(
|
|
|
1088
1116
|
content: [
|
|
1089
1117
|
{
|
|
1090
1118
|
type: "text",
|
|
1091
|
-
text: `Heartbeat recorded
|
|
1119
|
+
text: `Heartbeat recorded. Session active for ${formatDuration(getSessionDuration())}.`
|
|
1092
1120
|
}
|
|
1093
1121
|
]
|
|
1094
1122
|
};
|
|
@@ -1096,7 +1124,7 @@ server.tool(
|
|
|
1096
1124
|
);
|
|
1097
1125
|
server.tool(
|
|
1098
1126
|
"useai_session_end",
|
|
1099
|
-
"End the current AI coding session
|
|
1127
|
+
"End the current AI coding session and record milestones. IMPORTANT: Milestone descriptions must be GENERIC \u2014 no project names, file names, file paths, or company names. Use general terms like 'authentication system', 'data validation layer', 'responsive dashboard'.",
|
|
1100
1128
|
{
|
|
1101
1129
|
task_type: z2.enum(["coding", "debugging", "testing", "planning", "reviewing", "documenting", "learning", "other"]).optional().describe("What kind of task was the developer working on?"),
|
|
1102
1130
|
languages: z2.array(z2.string()).optional().describe("Programming languages used (e.g. ['typescript', 'python'])"),
|
|
@@ -1207,11 +1235,7 @@ server.tool(
|
|
|
1207
1235
|
content: [
|
|
1208
1236
|
{
|
|
1209
1237
|
type: "text",
|
|
1210
|
-
text: `Session
|
|
1211
|
-
${sessionRecordCount} chain records \xB7 ${signingAvailable ? "Ed25519 signed" : "unsigned"}${milestoneStr}
|
|
1212
|
-
Stored at: ${sealedPath}
|
|
1213
|
-
|
|
1214
|
-
To publish: run \`useai sync\` from your terminal.`
|
|
1238
|
+
text: `Session ended: ${durationStr} ${finalTaskType}${langStr}${milestoneStr}`
|
|
1215
1239
|
}
|
|
1216
1240
|
]
|
|
1217
1241
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devness/useai",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "Track your AI-assisted development workflow. MCP server that records usage metrics across all your AI tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -28,14 +28,6 @@
|
|
|
28
28
|
"README.md",
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsc -p tsconfig.build.json",
|
|
33
|
-
"dev": "tsc --watch",
|
|
34
|
-
"bundle": "tsup src/index.ts --format esm --target node18 --no-splitting",
|
|
35
|
-
"prepublishOnly": "pnpm run bundle",
|
|
36
|
-
"typecheck": "tsc --noEmit",
|
|
37
|
-
"clean": "rm -rf dist"
|
|
38
|
-
},
|
|
39
31
|
"dependencies": {
|
|
40
32
|
"@inquirer/prompts": "^8.2.1",
|
|
41
33
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
@@ -46,9 +38,9 @@
|
|
|
46
38
|
},
|
|
47
39
|
"devDependencies": {
|
|
48
40
|
"@types/node": "^22.13.4",
|
|
49
|
-
"@useai/shared": "workspace:*",
|
|
50
41
|
"tsup": "^8.0.0",
|
|
51
|
-
"typescript": "^5.7.3"
|
|
42
|
+
"typescript": "^5.7.3",
|
|
43
|
+
"@useai/shared": "0.2.0"
|
|
52
44
|
},
|
|
53
45
|
"repository": {
|
|
54
46
|
"type": "git",
|
|
@@ -57,5 +49,12 @@
|
|
|
57
49
|
"homepage": "https://useai.dev",
|
|
58
50
|
"engines": {
|
|
59
51
|
"node": ">=18"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc -p tsconfig.build.json",
|
|
55
|
+
"dev": "tsc --watch",
|
|
56
|
+
"bundle": "tsup src/index.ts --format esm --target node18 --no-splitting",
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"clean": "rm -rf dist"
|
|
60
59
|
}
|
|
61
|
-
}
|
|
60
|
+
}
|