devworkspace 0.4.3 → 0.4.4
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/CHANGELOG.md +27 -0
- package/README.md +100 -22
- package/dist/cli/args.d.ts +3 -0
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/help.js +8 -4
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/render.js +53 -4
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/run.js +41 -33
- package/dist/cli/run.js.map +1 -1
- package/dist/core/artifacts.d.ts +32 -0
- package/dist/core/artifacts.js +46 -0
- package/dist/core/artifacts.js.map +1 -0
- package/dist/core/version.js +3 -0
- package/dist/core/version.js.map +1 -1
- package/dist/core/workspace.js +1 -0
- package/dist/core/workspace.js.map +1 -1
- package/dist/integrations/adapters/graphify.js +2 -1
- package/dist/integrations/adapters/graphify.js.map +1 -1
- package/dist/mcp/setup.d.ts +77 -5
- package/dist/mcp/setup.js +247 -82
- package/dist/mcp/setup.js.map +1 -1
- package/dist/mcp/tools.d.ts +6 -0
- package/dist/mcp/tools.js +67 -13
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/verify.d.ts +41 -0
- package/dist/mcp/verify.js +229 -0
- package/dist/mcp/verify.js.map +1 -0
- package/dist/services/doctor.js +64 -1
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/graph.d.ts +71 -4
- package/dist/services/graph.js +331 -189
- package/dist/services/graph.js.map +1 -1
- package/dist/services/setup.js +3 -0
- package/dist/services/setup.js.map +1 -1
- package/dist/services/taskContext.d.ts +20 -2
- package/dist/services/taskContext.js +29 -15
- package/dist/services/taskContext.js.map +1 -1
- package/docs/agents.md +2 -2
- package/docs/claude.md +13 -0
- package/docs/getting-started.md +40 -1
- package/docs/integrations.md +16 -1
- package/docs/mcp.md +42 -11
- package/docs/troubleshooting.md +5 -0
- package/package.json +1 -1
package/dist/mcp/tools.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { requireWorkspace, loadProject } from '../core/workspace.js';
|
|
4
|
+
import { readVersioned } from '../core/versioned.js';
|
|
5
|
+
import { SCHEMA_VERSION, validateCommands } from '../config/schemas.js';
|
|
6
|
+
import { packageDirs } from '../verification/scope.js';
|
|
4
7
|
import { loadFacts, evaluateStaleness, authorityRank } from '../knowledge/facts.js';
|
|
5
8
|
import { getStatus } from '../services/status.js';
|
|
6
9
|
import { getTaskContext, isContextRole, words, expandQueryTerms, matchesQuery, STOP, WEAK_TERMS, PATH_STRUCTURAL_TERMS, } from '../services/taskContext.js';
|
|
@@ -15,6 +18,34 @@ import { isSensitiveFile, safeReadText } from '../security/files.js';
|
|
|
15
18
|
import { redact } from '../security/redact.js';
|
|
16
19
|
import { assertNoSymlinkEscape, isInside, looksAbsolute, resolveInside, toPosix, validateRelativePath, } from '../utils/paths.js';
|
|
17
20
|
import { pathExists, readJsonFile, readTextBounded } from '../utils/fs.js';
|
|
21
|
+
/**
|
|
22
|
+
* When a root-level file (e.g. package.json) is missing in a multi-package repo, list the same-named files that
|
|
23
|
+
* actually exist inside the known package directories. Every suggestion is confirmed on disk first.
|
|
24
|
+
*/
|
|
25
|
+
export async function suggestPackageManifests(ws, posixRel) {
|
|
26
|
+
if (posixRel.includes('/'))
|
|
27
|
+
return [];
|
|
28
|
+
let dirs;
|
|
29
|
+
try {
|
|
30
|
+
dirs = packageDirs((await readVersioned(ws.commands, 'commands', SCHEMA_VERSION, validateCommands)).data.checks);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const found = [];
|
|
36
|
+
for (const d of [...new Set(dirs)].sort()) {
|
|
37
|
+
const cand = `${d.replace(/\\/g, '/')}/${posixRel}`;
|
|
38
|
+
try {
|
|
39
|
+
const full = resolveInside(ws.root, cand);
|
|
40
|
+
if ((await pathExists(full)) && (await fs.lstat(full)).isFile())
|
|
41
|
+
found.push(cand);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
/* unsafe or unreadable candidate: never suggest it */
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return found;
|
|
48
|
+
}
|
|
18
49
|
export const TOOL_PROJECT_OVERVIEW = {
|
|
19
50
|
name: 'get_project_overview',
|
|
20
51
|
description: 'Retrieve the architectural summary, detected stack, health status, context freshness, and context capabilities of the current DevWorkspace project.',
|
|
@@ -342,7 +373,7 @@ function formatTaskContextText(r, task, maxChars, extraFeatures, knownFiles, gra
|
|
|
342
373
|
if (r.roleFindings?.graphNodes) {
|
|
343
374
|
for (const node of r.roleFindings.graphNodes) {
|
|
344
375
|
if (node.path) {
|
|
345
|
-
addCandidate(node.path, `graph symbol node "${node.symbol ?? node.id}" (${node.status})`, 45);
|
|
376
|
+
addCandidate(node.path, `graph symbol node "${node.symbol ?? node.id}" (${node.status}${node.weak ? ', weak match' : ''})`, 45);
|
|
346
377
|
}
|
|
347
378
|
}
|
|
348
379
|
}
|
|
@@ -380,7 +411,17 @@ function formatTaskContextText(r, task, maxChars, extraFeatures, knownFiles, gra
|
|
|
380
411
|
if (rf.graphNodes && rf.graphNodes.length > 0) {
|
|
381
412
|
parts.push('\n### Graph Nodes');
|
|
382
413
|
for (const node of rf.graphNodes.slice(0, 10)) {
|
|
383
|
-
|
|
414
|
+
const loc = node.path ? `: \`${node.path}${node.line ? `:${node.line}` : ''}\`` : '';
|
|
415
|
+
const weak = node.weak ? ' - weak match, confirm relevance' : '';
|
|
416
|
+
parts.push(`- ${node.id} [${node.nodeType}] (${node.status} in source${weak})${loc}`);
|
|
417
|
+
}
|
|
418
|
+
const rels = rf.graphRelationships ?? [];
|
|
419
|
+
if (rels.length > 0) {
|
|
420
|
+
parts.push('\n### Graph Relationships');
|
|
421
|
+
for (const e of rels.slice(0, 8)) {
|
|
422
|
+
const tag = e.confidence === 'EXTRACTED' ? 'EXTRACTED (AST)' : e.confidence === 'INFERRED' ? 'INFERRED (graph inference, not source-confirmed)' : 'confidence unavailable';
|
|
423
|
+
parts.push(`- \`${e.source}\` --[${e.relation}]--> \`${e.target}\` [${tag}]`);
|
|
424
|
+
}
|
|
384
425
|
}
|
|
385
426
|
}
|
|
386
427
|
else if (rf.graphNotice) {
|
|
@@ -771,6 +812,16 @@ export async function handleFileContext(workspaceRoot, rawArgs) {
|
|
|
771
812
|
};
|
|
772
813
|
}
|
|
773
814
|
if (!(await pathExists(fullPath))) {
|
|
815
|
+
const alts = await suggestPackageManifests(ws, posixRel);
|
|
816
|
+
if (alts.length > 0) {
|
|
817
|
+
return {
|
|
818
|
+
content: [{
|
|
819
|
+
type: 'text',
|
|
820
|
+
text: `File not found: "${rawPath}" does not exist at the workspace root. This looks like a multi-package workspace; confirmed existing alternatives: ${alts.map((a) => `"${a}"`).join(', ')}.`,
|
|
821
|
+
}],
|
|
822
|
+
isError: true,
|
|
823
|
+
};
|
|
824
|
+
}
|
|
774
825
|
return {
|
|
775
826
|
content: [{ type: 'text', text: `File not found: "${rawPath}" does not exist in the workspace.` }],
|
|
776
827
|
isError: true,
|
|
@@ -1437,29 +1488,32 @@ export async function handleTraceSymbolDependencies(workspaceRoot, rawArgs) {
|
|
|
1437
1488
|
lines.push(`- **${m.name}** (${m.type})`);
|
|
1438
1489
|
lines.push(` • Path: \`${m.path ?? 'none'}\``);
|
|
1439
1490
|
lines.push(` • Status: [${m.status.toUpperCase()}]${m.reason ? ` (${m.reason})` : ''}`);
|
|
1440
|
-
lines.push(` •
|
|
1491
|
+
lines.push(` • Source location: ${m.line ? `line ${m.line}` : (m.sourceLocation ?? 'unavailable')}`);
|
|
1492
|
+
lines.push(` • Traversal Depth: ${depth} (inspected ${trace.totalNodes} of max ${trace.maxNodes} node(s): ${trace.verifiedNodes} verified, ${trace.hypothesisNodes} hypothesis)`);
|
|
1493
|
+
for (const w of trace.warnings)
|
|
1494
|
+
lines.push(` • Note: ${w}`);
|
|
1441
1495
|
if (trace.nodes.length > 1) {
|
|
1442
1496
|
lines.push('\n### Connected Dependency Nodes');
|
|
1443
|
-
const otherNodes = trace.nodes
|
|
1444
|
-
.filter((n) => n.id !== m.id)
|
|
1445
|
-
.sort((a, b) => a.depth - b.depth || a.name.localeCompare(b.name));
|
|
1497
|
+
const otherNodes = trace.nodes.filter((n) => n.id !== m.id); // already ordered by depth, then path
|
|
1446
1498
|
for (const n of otherNodes.slice(0, 45)) {
|
|
1447
|
-
const pathStr = n.path ? ` in \`${n.path}\`` : '';
|
|
1499
|
+
const pathStr = n.path ? ` in \`${n.path}${n.line ? `:${n.line}` : ''}\`` : '';
|
|
1448
1500
|
const unverified = n.status === 'hypothesis' ? ` ⚠️ [HYPOTHESIS: ${n.reason ?? 'unverified'}]` : ' [VERIFIED]';
|
|
1449
1501
|
lines.push(`- [depth ${n.depth}] **${n.name}** (${n.type})${pathStr}${unverified}`);
|
|
1450
1502
|
}
|
|
1451
1503
|
if (otherNodes.length > 45) {
|
|
1452
|
-
lines.push(`- ...
|
|
1504
|
+
lines.push(`- ... ${otherNodes.length - 45} more node(s) not shown (showing 45 of ${otherNodes.length} returned)`);
|
|
1453
1505
|
}
|
|
1454
1506
|
}
|
|
1455
1507
|
if (trace.edges.length > 0) {
|
|
1456
1508
|
lines.push('\n### Dependency Relationships');
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1509
|
+
lines.push('Evidence: EXTRACTED = AST-derived by Graphify; INFERRED = Graphify inference (not source-confirmed); UNKNOWN = older graph without confidence.');
|
|
1510
|
+
// Already ordered: shallower depth, stronger evidence, then deterministic id order.
|
|
1511
|
+
for (const e of trace.edges.slice(0, 40)) {
|
|
1512
|
+
const ev = e.provenance === 'extracted' ? 'EXTRACTED' : e.provenance === 'inferred' ? 'INFERRED' : 'UNKNOWN';
|
|
1513
|
+
lines.push(`- \`${e.source}\` --[${e.relation}]--> \`${e.target}\` [${ev}, ${e.status}]`);
|
|
1460
1514
|
}
|
|
1461
|
-
if (
|
|
1462
|
-
lines.push(`- ...
|
|
1515
|
+
if (trace.edges.length > 40) {
|
|
1516
|
+
lines.push(`- ... ${trace.edges.length - 40} more relationship(s) not shown (showing 40 of ${trace.edges.length})`);
|
|
1463
1517
|
}
|
|
1464
1518
|
}
|
|
1465
1519
|
lines.push(UNTRUSTED_FOOTER);
|