@yourtechtribe-labs/koncept-mcp-server 0.2.0-alpha.4 → 0.2.0-alpha.6
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/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/koncept-lint-naming.d.ts +4 -0
- package/dist/tools/koncept-lint-naming.d.ts.map +1 -0
- package/dist/tools/koncept-lint-naming.js +89 -0
- package/dist/tools/koncept-lint-naming.js.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAQxE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAOvE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -3,11 +3,13 @@ import { registerKonceptSearch } from './koncept-search.js';
|
|
|
3
3
|
import { registerKonceptForFile } from './koncept-for-file.js';
|
|
4
4
|
import { registerKonceptInvariantsAtScope } from './koncept-invariants-at-scope.js';
|
|
5
5
|
import { registerKonceptAffected } from './koncept-affected.js';
|
|
6
|
+
import { registerKonceptLintNaming } from './koncept-lint-naming.js';
|
|
6
7
|
export function registerAllTools(mcp, ctx) {
|
|
7
8
|
registerKonceptGet(mcp, ctx);
|
|
8
9
|
registerKonceptSearch(mcp, ctx);
|
|
9
10
|
registerKonceptForFile(mcp, ctx);
|
|
10
11
|
registerKonceptInvariantsAtScope(mcp, ctx);
|
|
11
12
|
registerKonceptAffected(mcp, ctx);
|
|
13
|
+
registerKonceptLintNaming(mcp, ctx);
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAA;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAA;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAMpE,MAAM,UAAU,gBAAgB,CAAC,GAAc,EAAE,GAAgB;IAC/D,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC5B,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,sBAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAChC,gCAAgC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1C,uBAAuB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACjC,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"koncept-lint-naming.d.ts","sourceRoot":"","sources":["../../src/tools/koncept-lint-naming.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAMxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAgD7C,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAoDhF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { collectNamingCandidates, loadConcepts, } from '@yourtechtribe-labs/koncept-core';
|
|
5
|
+
/**
|
|
6
|
+
* koncept_lint_naming (K4, MCP surface — DESIGN §4-E).
|
|
7
|
+
*
|
|
8
|
+
* Read-only (D-002): runs ONLY the deterministic pre-filter — regex of each
|
|
9
|
+
* concept's `naming.forbidden` aliases over the working-tree content of the
|
|
10
|
+
* given files. It does NOT call any LLM and does NOT touch the network. The
|
|
11
|
+
* host AI agent is the judge: it reads these candidates (with the diff it
|
|
12
|
+
* already has) and decides which are real violations vs incidental matches.
|
|
13
|
+
* The Anthropic-API judge lives only in the CLI (`koncepto lint-naming`).
|
|
14
|
+
*/
|
|
15
|
+
const inputSchema = {
|
|
16
|
+
files: z
|
|
17
|
+
.array(z.string().min(1))
|
|
18
|
+
.min(1)
|
|
19
|
+
.describe('Changed file paths (forward-slash, repo-relative) to scan for prohibited naming aliases.'),
|
|
20
|
+
};
|
|
21
|
+
const outputSchema = {
|
|
22
|
+
candidates: z.array(z.object({
|
|
23
|
+
concept_id: z.string(),
|
|
24
|
+
concept_name: z.string(),
|
|
25
|
+
term: z.string().nullable(),
|
|
26
|
+
canonical: z.string(),
|
|
27
|
+
alias: z.string(),
|
|
28
|
+
file: z.string(),
|
|
29
|
+
line: z.number(),
|
|
30
|
+
text: z.string(),
|
|
31
|
+
rubric: z.string(),
|
|
32
|
+
})),
|
|
33
|
+
rules_applied: z.number(),
|
|
34
|
+
unreadable_files: z.array(z.string()),
|
|
35
|
+
note: z.string(),
|
|
36
|
+
};
|
|
37
|
+
const AGENT_NOTE = 'Deterministic pre-filter only. YOU are the judge: for each candidate, decide ' +
|
|
38
|
+
'whether the line is a real NEW use of the prohibited alias as a domain symbol ' +
|
|
39
|
+
'(→ violation, use the canonical) or an incidental match (comment, string, ' +
|
|
40
|
+
"unrelated identifier, external library field, different domain). Use the diff you " +
|
|
41
|
+
'already have to tell new from pre-existing.';
|
|
42
|
+
export function registerKonceptLintNaming(mcp, ctx) {
|
|
43
|
+
mcp.registerTool('koncept_lint_naming', {
|
|
44
|
+
title: 'Naming-alias candidates (DR-1 pre-filter)',
|
|
45
|
+
description: 'Given changed file paths, return lines that use a concept\'s prohibited naming alias ' +
|
|
46
|
+
'(deterministic regex pre-filter over the working tree). No LLM, no network: the calling ' +
|
|
47
|
+
'agent judges which candidates are real violations. Use when reviewing a diff for ' +
|
|
48
|
+
'domain-vocabulary drift.',
|
|
49
|
+
inputSchema,
|
|
50
|
+
outputSchema,
|
|
51
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
52
|
+
}, async ({ files }) => {
|
|
53
|
+
const loaded = await loadConcepts(ctx.rootDir);
|
|
54
|
+
const scanned = [];
|
|
55
|
+
const unreadable = [];
|
|
56
|
+
for (const file of files) {
|
|
57
|
+
try {
|
|
58
|
+
const content = readFileSync(join(ctx.rootDir, file), 'utf-8');
|
|
59
|
+
const lines = content.split('\n').map((text, i) => ({ n: i + 1, text }));
|
|
60
|
+
scanned.push({ file, lines });
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
unreadable.push(file);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const { candidates, rulesApplied } = collectNamingCandidates(loaded.concepts, scanned);
|
|
67
|
+
const payload = {
|
|
68
|
+
candidates: candidates.map((c) => ({
|
|
69
|
+
concept_id: c.conceptId,
|
|
70
|
+
concept_name: c.conceptName,
|
|
71
|
+
term: c.term,
|
|
72
|
+
canonical: c.canonical,
|
|
73
|
+
alias: c.alias,
|
|
74
|
+
file: c.file,
|
|
75
|
+
line: c.line,
|
|
76
|
+
text: c.text,
|
|
77
|
+
rubric: c.rubric,
|
|
78
|
+
})),
|
|
79
|
+
rules_applied: rulesApplied,
|
|
80
|
+
unreadable_files: unreadable,
|
|
81
|
+
note: AGENT_NOTE,
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
|
|
85
|
+
structuredContent: payload,
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=koncept-lint-naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"koncept-lint-naming.js","sourceRoot":"","sources":["../../src/tools/koncept-lint-naming.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EACL,uBAAuB,EACvB,YAAY,GAEb,MAAM,kCAAkC,CAAA;AAGzC;;;;;;;;;GASG;AAEH,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,0FAA0F,CAC3F;CACJ,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,CAAC,CAAC,KAAK,CACjB,CAAC,CAAC,MAAM,CAAC;QACP,UAAU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,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;YAC5E,iBAAiB,EAAE,OAAO;SAC3B,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yourtechtribe-labs/koncept-mcp-server",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.6",
|
|
4
4
|
"mcpName": "io.github.yourtechtribe-labs/koncept-mcp-server",
|
|
5
5
|
"description": "MCP server exposing semantic concept graph tools (koncept_search, koncept_get, koncept_for_file, koncept_invariants_at_scope).",
|
|
6
6
|
"keywords": [
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"zod": "4.4.3",
|
|
38
|
+
"@yourtechtribe-labs/koncept-core": "^0.2.0-alpha.6"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public",
|