@kroos-dev/code-advisor 0.2.0 → 0.2.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/bundle.mjs +3 -3
- package/mcp.mjs +8 -5
- package/package.json +25 -4
package/bundle.mjs
CHANGED
|
@@ -14,11 +14,11 @@ export const LIMITS = { files: 3000, perFile: 200_000, total: 12_000_000 };
|
|
|
14
14
|
export const BATCH_BYTES = 56_000;
|
|
15
15
|
|
|
16
16
|
const SKIP_DIRS = new Set(["node_modules", ".git", "dist", "build", "out", ".next", ".nuxt", ".svelte-kit", "vendor", ".venv", "venv", "env", "__pycache__", "target", ".gradle", "Pods", "coverage", ".turbo", ".cache", ".terraform", ".idea", ".vscode", "bin", "obj", "DerivedData", ".dart_tool"]);
|
|
17
|
-
const TEXT_EXT = new Set([".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx", ".py", ".go", ".rb", ".php", ".java", ".kt", ".kts", ".swift", ".dart", ".cs", ".rs", ".c", ".h", ".cpp", ".hpp", ".m", ".scala", ".ex", ".exs", ".erl", ".clj", ".lua", ".r", ".sql", ".prisma", ".graphql", ".gql", ".vue", ".svelte", ".astro", ".html", ".css", ".scss", ".sass", ".less", ".json", ".yml", ".yaml", ".toml", ".xml", ".gradle", ".tf", ".hcl", ".sh", ".bash", ".zsh", ".ps1", ".md", ".mdx", ".txt", ".ini", ".cfg", ".conf", ".proto", ".sol"]);
|
|
17
|
+
const TEXT_EXT = new Set([".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx", ".py", ".go", ".rb", ".php", ".java", ".kt", ".kts", ".swift", ".dart", ".cs", ".rs", ".c", ".h", ".cpp", ".hpp", ".m", ".scala", ".ex", ".exs", ".erl", ".clj", ".lua", ".r", ".sql", ".prisma", ".graphql", ".gql", ".vue", ".svelte", ".astro", ".html", ".css", ".scss", ".sass", ".less", ".json", ".yml", ".yaml", ".toml", ".xml", ".gradle", ".tf", ".hcl", ".sh", ".bash", ".zsh", ".ps1", ".md", ".mdx", ".txt", ".ini", ".cfg", ".conf", ".proto", ".sol", ".plist", ".entitlements", ".xcconfig", ".properties", ".mm"]);
|
|
18
18
|
const TEXT_NAMES = new Set(["Dockerfile", "Makefile", "Procfile", "Gemfile", "Rakefile", "Podfile", "Jenkinsfile", "Caddyfile", ".env.example", ".env.sample"]);
|
|
19
19
|
const LOCKFILES = new Set(["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "Cargo.lock", "poetry.lock", "Gemfile.lock", "composer.lock", "Pipfile.lock", "go.sum", "pubspec.lock", "Podfile.lock", "packages.lock.json", "uv.lock"]);
|
|
20
20
|
const MANIFESTS = new Set(["package.json", "requirements.txt", "pyproject.toml", "go.mod", "composer.json", "pubspec.yaml", "Gemfile", "pom.xml", "build.gradle", "build.gradle.kts", "Cargo.toml", "Package.swift", "Dockerfile"]);
|
|
21
|
-
const SENSITIVE = /(^|\/)(\.env(\.(?!example$|sample$)[\w.-]+)?|.*\.(pem|key|p12|pfx|jks|keystore|crt|cer|der)|id_(rsa|dsa|ecdsa|ed25519)(\.pub)?|\.npmrc|\.pypirc|\.netrc|credentials(\.json)?|service[-_]?account.*\.json|.*\.tfstate(\.backup)?|.*\.tfvars)$/i;
|
|
21
|
+
const SENSITIVE = /(^|\/)(\.env(\.(?!example$|sample$)[\w.-]+)?|.*\.(pem|key|p12|pfx|jks|keystore|crt|cer|der)|id_(rsa|dsa|ecdsa|ed25519)(\.pub)?|\.npmrc|\.pypirc|\.netrc|credentials(\.json)?|service[-_]?account.*\.json|.*\.tfstate(\.backup)?|.*\.tfvars|local\.properties|keystore\.properties|signing\.properties|.*\.mobileprovision|.*\.p8|GoogleService-Info\.plist|google-services\.json|Local\.xcconfig|Secrets?\.xcconfig)$/i;
|
|
22
22
|
|
|
23
23
|
// Secrets are replaced before sending (Kroos hides them again on arrival).
|
|
24
24
|
const SECRET_PATTERNS = [
|
|
@@ -64,7 +64,7 @@ function listFiles(root) {
|
|
|
64
64
|
|
|
65
65
|
const depth = (p) => p.split("/").length;
|
|
66
66
|
const CODE_EXT = new Set([".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx", ".py", ".go", ".rb", ".php", ".java", ".kt", ".kts", ".swift", ".dart", ".cs", ".rs", ".c", ".h", ".cpp", ".hpp", ".m", ".scala", ".ex", ".exs", ".erl", ".clj", ".lua", ".r", ".sql", ".prisma", ".graphql", ".gql", ".vue", ".svelte", ".astro", ".sol", ".proto"]);
|
|
67
|
-
const CONFIG_EXT = new Set([".json", ".yml", ".yaml", ".toml", ".xml", ".gradle", ".tf", ".hcl", ".sh", ".bash", ".zsh", ".ps1", ".ini", ".cfg", ".conf", ".html", ".css", ".scss", ".sass", ".less"]);
|
|
67
|
+
const CONFIG_EXT = new Set([".plist", ".entitlements", ".xcconfig", ".properties", ".json", ".yml", ".yaml", ".toml", ".xml", ".gradle", ".tf", ".hcl", ".sh", ".bash", ".zsh", ".ps1", ".ini", ".cfg", ".conf", ".html", ".css", ".scss", ".sass", ".less"]);
|
|
68
68
|
const TEST_PATH = /(^|\/)(tests?|__tests__|spec|specs|e2e|cypress|playwright|__mocks__|fixtures?|testdata)(\/|$)|\.(test|spec|stories)\.[\w]+$|_test\.(go|py)$|(^|\/)test_[\w]+\.py$/i;
|
|
69
69
|
const DOC_PATH = /\.(md|mdx|txt|rst|adoc)$/i;
|
|
70
70
|
const SCRATCH = /(^|\/)(\.[\w-]+|examples?|samples?|demo|scratch|tmp|temp|archive|old|legacy|generated|__generated__|migrations?\/\d)(\/|$)/i;
|
package/mcp.mjs
CHANGED
|
@@ -54,7 +54,7 @@ const TOOLS = [
|
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
name: "review_files",
|
|
57
|
-
description: "Ask Kroos about specific files: they're re-read from disk now (so Kroos sees the current version), secrets hidden, and sent with the question (up to 20 files, 50,000 characters). Use for follow-ups after share_project, passing its conversationId. Only call with the user's OK to send these files.",
|
|
57
|
+
description: "Ask Kroos about specific files: they're re-read from disk now (so Kroos sees the current version), secrets hidden, and sent with the question (up to 20 files, 50,000 characters). Use for follow-ups after share_project, passing its conversationId: Kroos keeps its review of the project, not the code, so send the files a question is about. Only call with the user's OK to send these files.",
|
|
58
58
|
inputSchema: { type: "object", properties: { path: { type: "string", description: "Absolute path to the project root" }, files: { type: "array", items: { type: "string" }, description: "File paths relative to the root" }, question: { type: "string" }, conversationId: { type: "string" }, confirmed: { type: "boolean", description: "true only if the user approved sending these files" } }, required: ["path", "files", "question", "confirmed"], additionalProperties: false },
|
|
59
59
|
},
|
|
60
60
|
];
|
|
@@ -86,10 +86,12 @@ async function callTool(name, args) {
|
|
|
86
86
|
return text(j.markdown ?? JSON.stringify(j), j);
|
|
87
87
|
}
|
|
88
88
|
if (name === "bundle_project") {
|
|
89
|
-
|
|
89
|
+
// The person's plan decides how big a project can be (Kroos tells us at the access check).
|
|
90
|
+
const access = await checkAccess({ url: CODE_URL, token: PROJECT_TOKEN });
|
|
91
|
+
const plan = access.ok && access.limits?.project ? { files: access.limits.project.files, total: access.limits.project.total } : undefined;
|
|
92
|
+
const b = bundle(args.path, { include: Array.isArray(args.include) ? args.include : [], project: typeof args.project === "string" && args.project.trim() ? args.project.trim() : undefined, ...(plan ? { limits: plan } : {}) });
|
|
90
93
|
bundles.set(b.id, b);
|
|
91
94
|
if (bundles.size > 10) bundles.delete(bundles.keys().next().value);
|
|
92
|
-
const access = await checkAccess({ url: CODE_URL, token: PROJECT_TOKEN });
|
|
93
95
|
if (!access.ok) return text(`${summaryMarkdown(b.summary)}\n\nNothing has been sent. Before these files can be shared, the advisor needs access:\n\n${access.message}\n\nShow the user these steps; once they've done them, run bundle_project again.`, { ...b.summary, access: access.reason });
|
|
94
96
|
return text(`${summaryMarkdown(b.summary)}\n\nNothing has been sent. Ask the user whether to share these files with Kroos; only call share_project (bundleId ${b.id}) with confirmed=true after they say yes.`, b.summary);
|
|
95
97
|
}
|
|
@@ -101,7 +103,8 @@ async function callTool(name, args) {
|
|
|
101
103
|
const j = await share(b, { url: CODE_URL, token: PROJECT_TOKEN, question: args.question, conversationId: args.conversationId });
|
|
102
104
|
bundles.delete(b.id);
|
|
103
105
|
const report = (j.documents ?? []).find((d) => /code reading report/i.test(d.title ?? ""));
|
|
104
|
-
|
|
106
|
+
const reply = (j.reply ?? "").trim() || (report ? "Kroos read the project; its report is below." : "Kroos received the project but didn't return a review this time. Ask for it with ask_kroos in the same conversation (pass this conversationId); it answers from its review of the code.");
|
|
107
|
+
return text(`${reply.replace(" The full report is in the card.", report ? " The full report is below." : "")}${report ? `\n\n---\n${report.markdown}` : ""}\n\n(Shared ${j.files} files in ${j.batches} part${j.batches > 1 ? "s" : ""}. conversationId: ${j.conversationId}; open Kroos → Projects to continue anywhere.)`, { conversationId: j.conversationId, project: j.project, files: j.files, sources: j.sources, allowance: j.allowance });
|
|
105
108
|
} catch (e) { return { ...text(e.message), isError: true }; }
|
|
106
109
|
}
|
|
107
110
|
if (name === "review_files") {
|
|
@@ -109,7 +112,7 @@ async function callTool(name, args) {
|
|
|
109
112
|
try {
|
|
110
113
|
const j = await review(args.path, args.files, { url: CODE_URL, token: PROJECT_TOKEN, question: args.question, conversationId: args.conversationId });
|
|
111
114
|
const report = (j.documents ?? []).find((d) => /code reading report/i.test(d.title ?? ""));
|
|
112
|
-
return text(`${j.reply.replace(" The full report is in the card.", report ? " The full report is below." : "")}${report ? `\n\n---\n${report.markdown}` : ""}\n\n(conversationId: ${j.conversationId})`, { conversationId: j.conversationId, sources: j.sources, allowance: j.allowance });
|
|
115
|
+
return text(`${((j.reply ?? "").trim() || "Kroos didn't return an answer this time; try again in a moment.").replace(" The full report is in the card.", report ? " The full report is below." : "")}${report ? `\n\n---\n${report.markdown}` : ""}\n\n(conversationId: ${j.conversationId})`, { conversationId: j.conversationId, sources: j.sources, allowance: j.allowance });
|
|
113
116
|
} catch (e) { return { ...text(e.message), isError: true }; }
|
|
114
117
|
}
|
|
115
118
|
throw Object.assign(new Error(`Unknown tool ${name}`), { code: -32602 });
|
package/package.json
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kroos-dev/code-advisor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Kroos Code Advisor for Claude Code and IDEs: business advice from a project summary, and full Kroos code reviews that share code only after you approve it, with secrets hidden on your machine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/kroosAI/kroos.git",
|
|
10
|
+
"directory": "tools/kroos-fingerprint"
|
|
11
|
+
},
|
|
7
12
|
"homepage": "https://dev.kroos.ai/mcp",
|
|
8
|
-
"engines": {
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
9
16
|
"bin": {
|
|
10
17
|
"code-advisor": "mcp.mjs",
|
|
11
18
|
"kroos-fingerprint": "cli.mjs"
|
|
12
19
|
},
|
|
13
|
-
"files": [
|
|
14
|
-
|
|
20
|
+
"files": [
|
|
21
|
+
"mcp.mjs",
|
|
22
|
+
"cli.mjs",
|
|
23
|
+
"bundle.mjs",
|
|
24
|
+
"fingerprint.mjs",
|
|
25
|
+
"productModel.mjs",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"kroos",
|
|
31
|
+
"mcp",
|
|
32
|
+
"claude-code",
|
|
33
|
+
"code-review",
|
|
34
|
+
"model-context-protocol"
|
|
35
|
+
]
|
|
15
36
|
}
|