@papyruslabsai/seshat-mcp 0.4.1 → 0.6.0
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/graph.d.ts +5 -3
- package/dist/graph.js +6 -4
- package/dist/index.d.ts +10 -22
- package/dist/index.js +143 -42
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +3 -3
- package/dist/tools/diff.d.ts +23 -0
- package/dist/tools/diff.js +491 -0
- package/dist/tools/functors.d.ts +15 -5
- package/dist/tools/functors.js +144 -18
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +11 -15
- package/dist/types.d.ts +16 -13
- package/dist/types.js +3 -4
- package/package.json +9 -3
package/dist/graph.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Call Graph Construction & Blast Radius Computation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Implements Theorem 9.4 (Incrementality):
|
|
4
|
+
* Computes the set of entities affected by a change:
|
|
6
5
|
* affected(e) = ancestors(e) ∪ descendants(e) ∪ {e}
|
|
6
|
+
*
|
|
7
|
+
* Ancestors = all transitive callers (upstream).
|
|
8
|
+
* Descendants = all transitive callees (downstream).
|
|
7
9
|
*/
|
|
8
10
|
import type { JstfEntity } from './types.js';
|
|
9
11
|
export interface CallGraph {
|
|
@@ -18,7 +20,7 @@ export interface BlastRadiusResult {
|
|
|
18
20
|
descendants: string[];
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
|
-
* Build a bidirectional call graph from entities'
|
|
23
|
+
* Build a bidirectional call graph from entities' dependency data.
|
|
22
24
|
*/
|
|
23
25
|
export declare function buildCallGraph(entities: JstfEntity[]): CallGraph;
|
|
24
26
|
/**
|
package/dist/graph.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Call Graph Construction & Blast Radius Computation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Implements Theorem 9.4 (Incrementality):
|
|
4
|
+
* Computes the set of entities affected by a change:
|
|
6
5
|
* affected(e) = ancestors(e) ∪ descendants(e) ∪ {e}
|
|
6
|
+
*
|
|
7
|
+
* Ancestors = all transitive callers (upstream).
|
|
8
|
+
* Descendants = all transitive callees (downstream).
|
|
7
9
|
*/
|
|
8
10
|
/**
|
|
9
|
-
* Build a bidirectional call graph from entities'
|
|
11
|
+
* Build a bidirectional call graph from entities' dependency data.
|
|
10
12
|
*/
|
|
11
13
|
export function buildCallGraph(entities) {
|
|
12
14
|
const callers = new Map();
|
|
@@ -27,7 +29,7 @@ export function buildCallGraph(entities) {
|
|
|
27
29
|
entityByModule.get(mod).push(entity);
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
// Build call edges from
|
|
32
|
+
// Build call edges from dependency data
|
|
31
33
|
for (const caller of entities) {
|
|
32
34
|
if (!caller.id || !caller.edges?.calls)
|
|
33
35
|
continue;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @papyruslabs/seshat-mcp — Semantic MCP Server
|
|
3
|
+
* @papyruslabs/seshat-mcp — Semantic Code Analysis MCP Server
|
|
4
4
|
*
|
|
5
|
-
* Exposes a codebase's
|
|
6
|
-
* Reads .seshat/_bundle.json
|
|
5
|
+
* Exposes a codebase's structure, dependencies, and constraints as queryable
|
|
6
|
+
* MCP tools. Reads pre-extracted analysis data from .seshat/_bundle.json.
|
|
7
7
|
*
|
|
8
8
|
* Multi-project mode:
|
|
9
9
|
* Set SESHAT_PROJECTS env var to comma-separated paths or a glob pattern.
|
|
@@ -13,25 +13,13 @@
|
|
|
13
13
|
* Single-project mode (default):
|
|
14
14
|
* When SESHAT_PROJECTS is not set, loads from CWD. No `project` param needed.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* list_projects
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* get_blast_radius — Theorem 9.4: affected set for given entity IDs
|
|
24
|
-
* list_modules — Group entities by layer, module, file, or language
|
|
25
|
-
* get_topology — API topology (routes, plugins, auth, tables)
|
|
26
|
-
* find_dead_code — Unreachable entities via ε-graph BFS
|
|
27
|
-
* find_layer_violations — ε edges violating architectural layer ordering
|
|
28
|
-
* get_coupling_metrics — Module coupling/cohesion/instability from ε-graph
|
|
29
|
-
* get_auth_matrix — Auth coverage across API-facing entities from κ
|
|
30
|
-
* find_error_gaps — Fallible callees whose callers lack try/catch
|
|
31
|
-
* get_test_coverage — Entities exercised by tests vs uncovered
|
|
32
|
-
* get_optimal_context — Greedy knapsack: max relevance per token for LLM context
|
|
33
|
-
* estimate_task_cost — Pre-work token burn projection from blast radius + source tokens
|
|
34
|
-
* report_actual_burn — Close calibration loop: actual tokens vs prediction, drift stats
|
|
16
|
+
* 20 tools across 4 categories:
|
|
17
|
+
* Discovery: list_projects, query_entities, get_entity, list_modules, get_topology
|
|
18
|
+
* Graph: get_dependencies, get_data_flow, find_by_constraint, get_blast_radius
|
|
19
|
+
* Analysis: find_dead_code, find_layer_violations, get_coupling_metrics,
|
|
20
|
+
* get_auth_matrix, find_error_gaps, get_test_coverage,
|
|
21
|
+
* get_optimal_context, estimate_task_cost, report_actual_burn
|
|
22
|
+
* Diff: diff_bundle, conflict_matrix
|
|
35
23
|
*
|
|
36
24
|
* Usage:
|
|
37
25
|
* npx @papyruslabs/seshat-mcp # single project (CWD)
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @papyruslabs/seshat-mcp — Semantic MCP Server
|
|
3
|
+
* @papyruslabs/seshat-mcp — Semantic Code Analysis MCP Server
|
|
4
4
|
*
|
|
5
|
-
* Exposes a codebase's
|
|
6
|
-
* Reads .seshat/_bundle.json
|
|
5
|
+
* Exposes a codebase's structure, dependencies, and constraints as queryable
|
|
6
|
+
* MCP tools. Reads pre-extracted analysis data from .seshat/_bundle.json.
|
|
7
7
|
*
|
|
8
8
|
* Multi-project mode:
|
|
9
9
|
* Set SESHAT_PROJECTS env var to comma-separated paths or a glob pattern.
|
|
@@ -13,25 +13,13 @@
|
|
|
13
13
|
* Single-project mode (default):
|
|
14
14
|
* When SESHAT_PROJECTS is not set, loads from CWD. No `project` param needed.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* list_projects
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* get_blast_radius — Theorem 9.4: affected set for given entity IDs
|
|
24
|
-
* list_modules — Group entities by layer, module, file, or language
|
|
25
|
-
* get_topology — API topology (routes, plugins, auth, tables)
|
|
26
|
-
* find_dead_code — Unreachable entities via ε-graph BFS
|
|
27
|
-
* find_layer_violations — ε edges violating architectural layer ordering
|
|
28
|
-
* get_coupling_metrics — Module coupling/cohesion/instability from ε-graph
|
|
29
|
-
* get_auth_matrix — Auth coverage across API-facing entities from κ
|
|
30
|
-
* find_error_gaps — Fallible callees whose callers lack try/catch
|
|
31
|
-
* get_test_coverage — Entities exercised by tests vs uncovered
|
|
32
|
-
* get_optimal_context — Greedy knapsack: max relevance per token for LLM context
|
|
33
|
-
* estimate_task_cost — Pre-work token burn projection from blast radius + source tokens
|
|
34
|
-
* report_actual_burn — Close calibration loop: actual tokens vs prediction, drift stats
|
|
16
|
+
* 20 tools across 4 categories:
|
|
17
|
+
* Discovery: list_projects, query_entities, get_entity, list_modules, get_topology
|
|
18
|
+
* Graph: get_dependencies, get_data_flow, find_by_constraint, get_blast_radius
|
|
19
|
+
* Analysis: find_dead_code, find_layer_violations, get_coupling_metrics,
|
|
20
|
+
* get_auth_matrix, find_error_gaps, get_test_coverage,
|
|
21
|
+
* get_optimal_context, estimate_task_cost, report_actual_burn
|
|
22
|
+
* Diff: diff_bundle, conflict_matrix
|
|
35
23
|
*
|
|
36
24
|
* Usage:
|
|
37
25
|
* npx @papyruslabs/seshat-mcp # single project (CWD)
|
|
@@ -46,7 +34,8 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextpro
|
|
|
46
34
|
import { MultiLoader } from './loader.js';
|
|
47
35
|
import { bootstrap } from './bootstrap.js';
|
|
48
36
|
import { initTools, queryEntities, getEntity, getDependencies, getDataFlow, findByConstraint, getBlastRadius, listModules, getTopology, } from './tools/index.js';
|
|
49
|
-
import { findDeadCode, findLayerViolations, getCouplingMetrics, getAuthMatrix, findErrorGaps, getTestCoverage, getOptimalContext, estimateTaskCost, reportActualBurn, } from './tools/functors.js';
|
|
37
|
+
import { findDeadCode, findLayerViolations, getCouplingMetrics, getAuthMatrix, findErrorGaps, getTestCoverage, getOptimalContext, estimateTaskCost, reportActualBurn, find_runtime_violations, find_ownership_violations, query_traits, } from './tools/functors.js';
|
|
38
|
+
import { diffBundle, conflictMatrix, } from './tools/diff.js';
|
|
50
39
|
// ─── Project Discovery ───────────────────────────────────────────
|
|
51
40
|
/**
|
|
52
41
|
* Discover project directories from SESHAT_PROJECTS env var.
|
|
@@ -104,7 +93,7 @@ const TOOLS = [
|
|
|
104
93
|
},
|
|
105
94
|
{
|
|
106
95
|
name: 'query_entities',
|
|
107
|
-
description: 'Search entities
|
|
96
|
+
description: 'Search code entities by name, architectural layer (route/service/repository/component), module, or source language. Returns entity summaries with constraint tags.',
|
|
108
97
|
inputSchema: {
|
|
109
98
|
type: 'object',
|
|
110
99
|
properties: {
|
|
@@ -115,11 +104,11 @@ const TOOLS = [
|
|
|
115
104
|
},
|
|
116
105
|
layer: {
|
|
117
106
|
type: 'string',
|
|
118
|
-
description: 'Filter by
|
|
107
|
+
description: 'Filter by architectural layer: route, controller, service, repository, utility, hook, component, schema',
|
|
119
108
|
},
|
|
120
109
|
module: {
|
|
121
110
|
type: 'string',
|
|
122
|
-
description: 'Filter by
|
|
111
|
+
description: 'Filter by module (partial match)',
|
|
123
112
|
},
|
|
124
113
|
language: {
|
|
125
114
|
type: 'string',
|
|
@@ -134,7 +123,7 @@ const TOOLS = [
|
|
|
134
123
|
},
|
|
135
124
|
{
|
|
136
125
|
name: 'get_entity',
|
|
137
|
-
description: 'Get
|
|
126
|
+
description: 'Get complete details for a specific code entity. Returns structure, call graph, data flow, constraints, context, ownership, type info, runtime, and logic.',
|
|
138
127
|
inputSchema: {
|
|
139
128
|
type: 'object',
|
|
140
129
|
properties: {
|
|
@@ -149,7 +138,7 @@ const TOOLS = [
|
|
|
149
138
|
},
|
|
150
139
|
{
|
|
151
140
|
name: 'get_dependencies',
|
|
152
|
-
description: 'Traverse the
|
|
141
|
+
description: 'Traverse the call graph for an entity. Shows callers (who calls this), callees (what this calls), and imports. Supports depth-limited traversal for exploring transitive dependencies.',
|
|
153
142
|
inputSchema: {
|
|
154
143
|
type: 'object',
|
|
155
144
|
properties: {
|
|
@@ -173,7 +162,7 @@ const TOOLS = [
|
|
|
173
162
|
},
|
|
174
163
|
{
|
|
175
164
|
name: 'get_data_flow',
|
|
176
|
-
description: 'Get
|
|
165
|
+
description: 'Get data flow for an entity: what data flows in (inputs/sources), what flows out (outputs/returns), and what gets mutated (database writes, state changes).',
|
|
177
166
|
inputSchema: {
|
|
178
167
|
type: 'object',
|
|
179
168
|
properties: {
|
|
@@ -188,7 +177,7 @@ const TOOLS = [
|
|
|
188
177
|
},
|
|
189
178
|
{
|
|
190
179
|
name: 'find_by_constraint',
|
|
191
|
-
description: 'Search
|
|
180
|
+
description: 'Search entities by behavioral properties. Find functions by security properties (AUTH, VALIDATED), behavioral properties (PURE, THROWS, DB_ACCESS, NETWORK_IO), or performance characteristics.',
|
|
192
181
|
inputSchema: {
|
|
193
182
|
type: 'object',
|
|
194
183
|
properties: {
|
|
@@ -203,7 +192,7 @@ const TOOLS = [
|
|
|
203
192
|
},
|
|
204
193
|
{
|
|
205
194
|
name: 'get_blast_radius',
|
|
206
|
-
description: 'Compute the blast radius for a set of entities
|
|
195
|
+
description: 'Compute the blast radius for a set of entities. Returns all transitively affected entities — both upstream (callers) and downstream (callees) — with depth annotations showing distance from the change.',
|
|
207
196
|
inputSchema: {
|
|
208
197
|
type: 'object',
|
|
209
198
|
properties: {
|
|
@@ -219,7 +208,7 @@ const TOOLS = [
|
|
|
219
208
|
},
|
|
220
209
|
{
|
|
221
210
|
name: 'list_modules',
|
|
222
|
-
description: 'List and count entities grouped by a
|
|
211
|
+
description: 'List and count entities grouped by a property. See the architectural structure (by layer), module organization (by module), file distribution (by file), or language breakdown (by language).',
|
|
223
212
|
inputSchema: {
|
|
224
213
|
type: 'object',
|
|
225
214
|
properties: {
|
|
@@ -234,7 +223,7 @@ const TOOLS = [
|
|
|
234
223
|
},
|
|
235
224
|
{
|
|
236
225
|
name: 'get_topology',
|
|
237
|
-
description: 'Get the API topology: routes, plugins, auth patterns, and database tables. Built from
|
|
226
|
+
description: 'Get the API topology: routes, plugins, auth patterns, and database tables. Built from architectural context and dependency analysis across all entities.',
|
|
238
227
|
inputSchema: {
|
|
239
228
|
type: 'object',
|
|
240
229
|
properties: {
|
|
@@ -242,10 +231,10 @@ const TOOLS = [
|
|
|
242
231
|
},
|
|
243
232
|
},
|
|
244
233
|
},
|
|
245
|
-
// ───
|
|
234
|
+
// ─── Analysis Tools ─────────────────────────────────────────────
|
|
246
235
|
{
|
|
247
236
|
name: 'find_dead_code',
|
|
248
|
-
description: 'Find unreachable entities (dead code candidates). BFS from entry points (routes, exported functions, tests, plugins) through the
|
|
237
|
+
description: 'Find unreachable entities (dead code candidates). BFS from entry points (routes, exported functions, tests, plugins) through the call graph. Entities not reachable from any entry point are flagged.',
|
|
249
238
|
inputSchema: {
|
|
250
239
|
type: 'object',
|
|
251
240
|
properties: {
|
|
@@ -259,7 +248,7 @@ const TOOLS = [
|
|
|
259
248
|
},
|
|
260
249
|
{
|
|
261
250
|
name: 'find_layer_violations',
|
|
262
|
-
description: 'Detect architectural layer violations in the
|
|
251
|
+
description: 'Detect architectural layer violations in the call graph. Finds backward calls (lower layer calling higher layer, e.g. repository → route) and skip-layer calls (jumping over multiple layers). Uses architectural layer classification.',
|
|
263
252
|
inputSchema: {
|
|
264
253
|
type: 'object',
|
|
265
254
|
properties: {
|
|
@@ -269,7 +258,7 @@ const TOOLS = [
|
|
|
269
258
|
},
|
|
270
259
|
{
|
|
271
260
|
name: 'get_coupling_metrics',
|
|
272
|
-
description: 'Compute coupling, cohesion, and instability metrics for modules or layers. Analyzes
|
|
261
|
+
description: 'Compute coupling, cohesion, and instability metrics for modules or layers. Analyzes dependency edges between and within groups. High coupling + low cohesion = candidates for refactoring.',
|
|
273
262
|
inputSchema: {
|
|
274
263
|
type: 'object',
|
|
275
264
|
properties: {
|
|
@@ -284,7 +273,7 @@ const TOOLS = [
|
|
|
284
273
|
},
|
|
285
274
|
{
|
|
286
275
|
name: 'get_auth_matrix',
|
|
287
|
-
description: 'Analyze authentication coverage across all API-facing entities. Shows which routes/controllers have auth requirements
|
|
276
|
+
description: 'Analyze authentication coverage across all API-facing entities. Shows which routes/controllers have auth requirements and which don\'t. Detects inconsistencies like DB access without auth.',
|
|
288
277
|
inputSchema: {
|
|
289
278
|
type: 'object',
|
|
290
279
|
properties: {
|
|
@@ -294,7 +283,7 @@ const TOOLS = [
|
|
|
294
283
|
},
|
|
295
284
|
{
|
|
296
285
|
name: 'find_error_gaps',
|
|
297
|
-
description: 'Find error handling gaps:
|
|
286
|
+
description: 'Find error handling gaps: entities that throw or have network/db side effects whose callers lack try/catch. These are crash risk points where exceptions can propagate unhandled.',
|
|
298
287
|
inputSchema: {
|
|
299
288
|
type: 'object',
|
|
300
289
|
properties: {
|
|
@@ -304,7 +293,7 @@ const TOOLS = [
|
|
|
304
293
|
},
|
|
305
294
|
{
|
|
306
295
|
name: 'get_test_coverage',
|
|
307
|
-
description: 'Compute semantic test coverage: which production entities are exercised by test entities via the
|
|
296
|
+
description: 'Compute semantic test coverage: which production entities are exercised by test entities via the call graph. Optionally weight uncovered entities by blast radius to prioritize what to test first.',
|
|
308
297
|
inputSchema: {
|
|
309
298
|
type: 'object',
|
|
310
299
|
properties: {
|
|
@@ -399,6 +388,101 @@ const TOOLS = [
|
|
|
399
388
|
},
|
|
400
389
|
},
|
|
401
390
|
},
|
|
391
|
+
// ─── Semantic (9D) JSTF-T Tools ─────────────────────────────────
|
|
392
|
+
{
|
|
393
|
+
name: 'find_runtime_violations',
|
|
394
|
+
description: 'Analyze the call graph across the ρ (Runtime) dimension. Finds architectural leaks where framework-agnostic code improperly imports framework-specific code (e.g. pure logic calling React hooks) or where incompatible frameworks mix directly.',
|
|
395
|
+
inputSchema: {
|
|
396
|
+
type: 'object',
|
|
397
|
+
properties: {
|
|
398
|
+
project: projectParam,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: 'find_ownership_violations',
|
|
404
|
+
description: 'Analyze the codebase across the λ (Ownership/Lifetimes) dimension. Flags entities with complex memory management constraints, unsafe blocks, escaping boundaries, or illegal mutability patterns on borrowed references.',
|
|
405
|
+
inputSchema: {
|
|
406
|
+
type: 'object',
|
|
407
|
+
properties: {
|
|
408
|
+
project: projectParam,
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
name: 'query_traits',
|
|
414
|
+
description: 'Search the codebase across the τ (Traits/Capabilities) dimension. Allows you to find entities by their abstract capabilities (e.g., "fallible", "asyncContext", "generator") regardless of their structural syntax.',
|
|
415
|
+
inputSchema: {
|
|
416
|
+
type: 'object',
|
|
417
|
+
properties: {
|
|
418
|
+
project: projectParam,
|
|
419
|
+
trait: {
|
|
420
|
+
type: 'string',
|
|
421
|
+
description: 'The trait or capability to search for (e.g., "fallible", "asyncContext")',
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
required: ['trait'],
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
// ─── Diff Tools ─────────────────────────────────────────────────
|
|
428
|
+
{
|
|
429
|
+
name: 'diff_bundle',
|
|
430
|
+
description: 'Compare entities between a worktree and the loaded project. Shows which entities were added, removed, or modified at the symbol level — not a line diff, but a structural diff showing changed signatures, call graphs, constraints, and logic. Extracts the worktree automatically if no bundle exists.',
|
|
431
|
+
inputSchema: {
|
|
432
|
+
type: 'object',
|
|
433
|
+
properties: {
|
|
434
|
+
project: projectParam,
|
|
435
|
+
worktree_path: {
|
|
436
|
+
type: 'string',
|
|
437
|
+
description: 'Absolute path to the worktree or branch checkout to compare against the loaded project',
|
|
438
|
+
},
|
|
439
|
+
include_unchanged: {
|
|
440
|
+
type: 'boolean',
|
|
441
|
+
description: 'Include unchanged entities in the output (default: false)',
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
required: ['worktree_path'],
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
name: 'conflict_matrix',
|
|
449
|
+
description: 'Given multiple tasks, classify every task pair into conflict tiers bridging JSTF-T theory and Git reality. Tier 1 (different files, safe), Tier 2 (same file, different entities, safe), Tier 3 (same entity, orthogonal Spatial Zones like imports vs logic, risky but parallelizable), Tier 4 (same entity, same Spatial Zone, MUST sequence). Passing "dimensions" per task enables Tier 3 downgrades.',
|
|
450
|
+
inputSchema: {
|
|
451
|
+
type: 'object',
|
|
452
|
+
properties: {
|
|
453
|
+
project: projectParam,
|
|
454
|
+
tasks: {
|
|
455
|
+
type: 'array',
|
|
456
|
+
items: {
|
|
457
|
+
type: 'object',
|
|
458
|
+
properties: {
|
|
459
|
+
id: {
|
|
460
|
+
type: 'string',
|
|
461
|
+
description: 'Unique task identifier (e.g. "add-dark-mode")',
|
|
462
|
+
},
|
|
463
|
+
entity_ids: {
|
|
464
|
+
type: 'array',
|
|
465
|
+
items: { type: 'string' },
|
|
466
|
+
description: 'Entity IDs or names that this task will modify',
|
|
467
|
+
},
|
|
468
|
+
dimensions: {
|
|
469
|
+
type: 'array',
|
|
470
|
+
items: { type: 'string' },
|
|
471
|
+
description: 'Optional: JSTF-T dimensions this task will modify (e.g., "edges", "struct", "semantics", "constraints"). Used to downgrade conflicts via Spatial Zones.',
|
|
472
|
+
},
|
|
473
|
+
expand_blast_radius: {
|
|
474
|
+
type: 'boolean',
|
|
475
|
+
description: 'Include transitively affected entities in the conflict check (default: false)',
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
required: ['id', 'entity_ids'],
|
|
479
|
+
},
|
|
480
|
+
description: 'Array of tasks to check for conflicts. Each task specifies which entities it will modify.',
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
required: ['tasks'],
|
|
484
|
+
},
|
|
485
|
+
},
|
|
402
486
|
];
|
|
403
487
|
// ─── Server Setup ─────────────────────────────────────────────────
|
|
404
488
|
async function main() {
|
|
@@ -454,7 +538,7 @@ async function main() {
|
|
|
454
538
|
}
|
|
455
539
|
const server = new Server({
|
|
456
540
|
name: serverLabel,
|
|
457
|
-
version: '0.
|
|
541
|
+
version: '0.5.0',
|
|
458
542
|
}, {
|
|
459
543
|
capabilities: {
|
|
460
544
|
tools: {},
|
|
@@ -516,7 +600,7 @@ async function main() {
|
|
|
516
600
|
case 'get_topology':
|
|
517
601
|
result = getTopology(args);
|
|
518
602
|
break;
|
|
519
|
-
//
|
|
603
|
+
// Analysis Tools
|
|
520
604
|
case 'find_dead_code':
|
|
521
605
|
result = findDeadCode(args);
|
|
522
606
|
break;
|
|
@@ -544,6 +628,23 @@ async function main() {
|
|
|
544
628
|
case 'report_actual_burn':
|
|
545
629
|
result = await reportActualBurn(args);
|
|
546
630
|
break;
|
|
631
|
+
// Semantic (9D) JSTF-T Tools
|
|
632
|
+
case 'find_runtime_violations':
|
|
633
|
+
result = find_runtime_violations(args);
|
|
634
|
+
break;
|
|
635
|
+
case 'find_ownership_violations':
|
|
636
|
+
result = find_ownership_violations(args);
|
|
637
|
+
break;
|
|
638
|
+
case 'query_traits':
|
|
639
|
+
result = query_traits(args);
|
|
640
|
+
break;
|
|
641
|
+
// Diff Tools
|
|
642
|
+
case 'diff_bundle':
|
|
643
|
+
result = await diffBundle(args);
|
|
644
|
+
break;
|
|
645
|
+
case 'conflict_matrix':
|
|
646
|
+
result = conflictMatrix(args);
|
|
647
|
+
break;
|
|
547
648
|
default:
|
|
548
649
|
result = { error: `Unknown tool: ${name}` };
|
|
549
650
|
}
|
package/dist/loader.d.ts
CHANGED
package/dist/loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Bundle Loader
|
|
3
3
|
*
|
|
4
4
|
* Discovers and loads .seshat/_bundle.json from the current working directory.
|
|
5
5
|
* Falls back to checking common alternative locations.
|
|
@@ -28,8 +28,8 @@ export class BundleLoader {
|
|
|
28
28
|
const bundle = JSON.parse(raw);
|
|
29
29
|
this.entities = bundle.entities || [];
|
|
30
30
|
// Remap bundle field names to internal _ prefixed names.
|
|
31
|
-
// The extraction pipeline outputs `sourceFile`, `sourceLanguage
|
|
32
|
-
// but
|
|
31
|
+
// The extraction pipeline outputs `sourceFile`, `sourceLanguage`
|
|
32
|
+
// but the entity type expects `_sourceFile`, `_sourceLanguage`.
|
|
33
33
|
for (const e of this.entities) {
|
|
34
34
|
const raw = e;
|
|
35
35
|
if (raw.sourceFile && !e._sourceFile) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Bundle Analysis Tools: diff_bundle + conflict_matrix
|
|
3
|
+
*
|
|
4
|
+
* diff_bundle: Compare entities between a worktree and the loaded project.
|
|
5
|
+
* conflict_matrix: Classify conflict tiers for parallel task scheduling.
|
|
6
|
+
*
|
|
7
|
+
* These tools compare TWO entity sets (base vs branch, or task vs task),
|
|
8
|
+
* unlike the single-bundle queries in index.ts and functors.ts.
|
|
9
|
+
*/
|
|
10
|
+
export declare function diffBundle(args: {
|
|
11
|
+
worktree_path: string;
|
|
12
|
+
project?: string;
|
|
13
|
+
include_unchanged?: boolean;
|
|
14
|
+
}): Promise<unknown>;
|
|
15
|
+
export declare function conflictMatrix(args: {
|
|
16
|
+
tasks: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
entity_ids: string[];
|
|
19
|
+
dimensions?: string[];
|
|
20
|
+
expand_blast_radius?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
project?: string;
|
|
23
|
+
}): unknown;
|