@prajwolkc/stk 0.4.0 → 0.4.1
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/mcp/server.js +155 -0
- package/package.json +2 -2
package/dist/mcp/server.js
CHANGED
|
@@ -1204,6 +1204,161 @@ server.tool("stk_brain_stats", "Check what the brain knows — total knowledge e
|
|
|
1204
1204
|
}],
|
|
1205
1205
|
};
|
|
1206
1206
|
});
|
|
1207
|
+
// ──────────────────────────────────────────
|
|
1208
|
+
// Tool: stk_brain_claudemd
|
|
1209
|
+
// ──────────────────────────────────────────
|
|
1210
|
+
server.tool("stk_brain_claudemd", "Auto-generate a CLAUDE.md file for the current project. Analyzes the tech stack, project structure, services, and brain knowledge to create comprehensive project instructions for Claude Code.", {
|
|
1211
|
+
projectName: z.string().optional().describe("Project name (auto-detected from stk.config.json if omitted)"),
|
|
1212
|
+
write: z.boolean().optional().default(false).describe("Actually write the CLAUDE.md file to disk. If false, just returns the content for review."),
|
|
1213
|
+
}, async ({ projectName, write }) => {
|
|
1214
|
+
const config = loadConfig();
|
|
1215
|
+
const name = projectName ?? config.name ?? "my-project";
|
|
1216
|
+
const enabled = enabledServices(config);
|
|
1217
|
+
// Detect project info
|
|
1218
|
+
let gitBranch = "";
|
|
1219
|
+
let gitRemote = "";
|
|
1220
|
+
let packageJson = {};
|
|
1221
|
+
try {
|
|
1222
|
+
gitBranch = execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
1223
|
+
}
|
|
1224
|
+
catch { }
|
|
1225
|
+
try {
|
|
1226
|
+
gitRemote = execSync("git remote get-url origin", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
1227
|
+
}
|
|
1228
|
+
catch { }
|
|
1229
|
+
try {
|
|
1230
|
+
const { readFileSync } = await import("fs");
|
|
1231
|
+
packageJson = JSON.parse(readFileSync("package.json", "utf-8"));
|
|
1232
|
+
}
|
|
1233
|
+
catch { }
|
|
1234
|
+
// Detect tech stack
|
|
1235
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
1236
|
+
const stack = [];
|
|
1237
|
+
if (deps?.["next"])
|
|
1238
|
+
stack.push("Next.js");
|
|
1239
|
+
if (deps?.["react"])
|
|
1240
|
+
stack.push("React");
|
|
1241
|
+
if (deps?.["vue"])
|
|
1242
|
+
stack.push("Vue");
|
|
1243
|
+
if (deps?.["express"])
|
|
1244
|
+
stack.push("Express.js");
|
|
1245
|
+
if (deps?.["fastify"])
|
|
1246
|
+
stack.push("Fastify");
|
|
1247
|
+
if (deps?.["@supabase/supabase-js"])
|
|
1248
|
+
stack.push("Supabase");
|
|
1249
|
+
if (deps?.["stripe"])
|
|
1250
|
+
stack.push("Stripe");
|
|
1251
|
+
if (deps?.["prisma"] || deps?.["@prisma/client"])
|
|
1252
|
+
stack.push("Prisma");
|
|
1253
|
+
if (deps?.["mongoose"])
|
|
1254
|
+
stack.push("Mongoose/MongoDB");
|
|
1255
|
+
if (deps?.["redis"] || deps?.["ioredis"])
|
|
1256
|
+
stack.push("Redis");
|
|
1257
|
+
if (deps?.["tailwindcss"])
|
|
1258
|
+
stack.push("Tailwind CSS");
|
|
1259
|
+
if (deps?.["typescript"])
|
|
1260
|
+
stack.push("TypeScript");
|
|
1261
|
+
if (deps?.["zod"])
|
|
1262
|
+
stack.push("Zod");
|
|
1263
|
+
if (stack.length === 0 && Object.keys(deps ?? {}).length > 0) {
|
|
1264
|
+
stack.push("Node.js");
|
|
1265
|
+
}
|
|
1266
|
+
// Detect file structure
|
|
1267
|
+
let fileStructure = "";
|
|
1268
|
+
try {
|
|
1269
|
+
fileStructure = execSync("find . -maxdepth 3 -type f -name '*.ts' -o -name '*.js' -o -name '*.tsx' -o -name '*.jsx' -o -name '*.json' -o -name '*.css' -o -name '*.html' | grep -v node_modules | grep -v dist | grep -v .git | sort | head -40", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
1270
|
+
}
|
|
1271
|
+
catch { }
|
|
1272
|
+
// Build CLAUDE.md
|
|
1273
|
+
const lines = [];
|
|
1274
|
+
lines.push(`# ${name}\n`);
|
|
1275
|
+
// Project overview
|
|
1276
|
+
lines.push(`## Overview\n`);
|
|
1277
|
+
if (packageJson.description)
|
|
1278
|
+
lines.push(`${packageJson.description}\n`);
|
|
1279
|
+
if (stack.length > 0)
|
|
1280
|
+
lines.push(`**Tech Stack:** ${stack.join(", ")}\n`);
|
|
1281
|
+
if (gitRemote)
|
|
1282
|
+
lines.push(`**Repo:** ${gitRemote}`);
|
|
1283
|
+
if (gitBranch)
|
|
1284
|
+
lines.push(`**Main Branch:** ${gitBranch}`);
|
|
1285
|
+
lines.push("");
|
|
1286
|
+
// Services
|
|
1287
|
+
if (enabled.length > 0) {
|
|
1288
|
+
lines.push(`## Services\n`);
|
|
1289
|
+
for (const svc of enabled) {
|
|
1290
|
+
const svcName = svc.charAt(0).toUpperCase() + svc.slice(1);
|
|
1291
|
+
lines.push(`- **${svcName}** — configured and monitored via stk`);
|
|
1292
|
+
}
|
|
1293
|
+
lines.push("");
|
|
1294
|
+
}
|
|
1295
|
+
// Project structure
|
|
1296
|
+
if (fileStructure) {
|
|
1297
|
+
lines.push(`## Project Structure\n`);
|
|
1298
|
+
lines.push("```");
|
|
1299
|
+
lines.push(fileStructure);
|
|
1300
|
+
lines.push("```\n");
|
|
1301
|
+
}
|
|
1302
|
+
// Development commands
|
|
1303
|
+
lines.push(`## Development\n`);
|
|
1304
|
+
if (packageJson.scripts) {
|
|
1305
|
+
lines.push("```bash");
|
|
1306
|
+
if (packageJson.scripts.dev)
|
|
1307
|
+
lines.push(`npm run dev # Start dev server`);
|
|
1308
|
+
if (packageJson.scripts.build)
|
|
1309
|
+
lines.push(`npm run build # Build for production`);
|
|
1310
|
+
if (packageJson.scripts.test)
|
|
1311
|
+
lines.push(`npm test # Run tests`);
|
|
1312
|
+
if (packageJson.scripts.start)
|
|
1313
|
+
lines.push(`npm start # Start production server`);
|
|
1314
|
+
lines.push("```\n");
|
|
1315
|
+
}
|
|
1316
|
+
// stk tools available
|
|
1317
|
+
lines.push(`## stk Tools Available\n`);
|
|
1318
|
+
lines.push(`This project uses stk for infrastructure monitoring. Available commands:\n`);
|
|
1319
|
+
lines.push(`- \`stk_health\` — Check service health`);
|
|
1320
|
+
lines.push(`- \`stk_status\` — Full project overview`);
|
|
1321
|
+
lines.push(`- \`stk_logs\` — Production logs`);
|
|
1322
|
+
lines.push(`- \`stk_db\` — Query database`);
|
|
1323
|
+
lines.push(`- \`stk_alerts\` — Check for problems`);
|
|
1324
|
+
lines.push(`- \`stk_deploy\` — Deploy to production`);
|
|
1325
|
+
lines.push(`- \`stk_brain_search\` — Search knowledge base`);
|
|
1326
|
+
lines.push(`- \`stk_brain_learn\` — Save patterns for future use`);
|
|
1327
|
+
lines.push("");
|
|
1328
|
+
// Conventions
|
|
1329
|
+
lines.push(`## Conventions\n`);
|
|
1330
|
+
if (deps?.["typescript"]) {
|
|
1331
|
+
lines.push(`- TypeScript strict mode enabled`);
|
|
1332
|
+
}
|
|
1333
|
+
lines.push(`- Use existing patterns in the codebase before introducing new ones`);
|
|
1334
|
+
lines.push(`- Check stk_health before debugging production issues`);
|
|
1335
|
+
lines.push(`- Use stk_brain_search to find how other projects solve similar problems`);
|
|
1336
|
+
lines.push(`- Save useful patterns with stk_brain_learn for future reference`);
|
|
1337
|
+
lines.push("");
|
|
1338
|
+
// Environment
|
|
1339
|
+
lines.push(`## Environment Variables\n`);
|
|
1340
|
+
lines.push(`Environment variables are managed via \`.env\` files. See \`.env.example\` for required variables.`);
|
|
1341
|
+
if (enabled.includes("vercel"))
|
|
1342
|
+
lines.push(`Use \`stk_env_sync\` to compare local vs remote env vars.`);
|
|
1343
|
+
lines.push("");
|
|
1344
|
+
const content = lines.join("\n");
|
|
1345
|
+
if (write) {
|
|
1346
|
+
const { writeFileSync } = await import("fs");
|
|
1347
|
+
writeFileSync("CLAUDE.md", content);
|
|
1348
|
+
return {
|
|
1349
|
+
content: [{
|
|
1350
|
+
type: "text",
|
|
1351
|
+
text: JSON.stringify({ written: true, path: "CLAUDE.md", lines: content.split("\n").length }, null, 2),
|
|
1352
|
+
}],
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
return {
|
|
1356
|
+
content: [{
|
|
1357
|
+
type: "text",
|
|
1358
|
+
text: JSON.stringify({ preview: true, content, note: "Call again with write: true to save to disk" }, null, 2),
|
|
1359
|
+
}],
|
|
1360
|
+
};
|
|
1361
|
+
});
|
|
1207
1362
|
// Helper
|
|
1208
1363
|
function detectGitHubRepo() {
|
|
1209
1364
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prajwolkc/stk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "One CLI to deploy, monitor, debug, and learn about your entire stack. Infrastructure monitoring, knowledge base brain, deploy watching, and GitHub issues — all from one command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"LICENSE"
|
|
36
36
|
],
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
38
|
+
"node": ">=20"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc",
|