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
|
@@ -1 +1 @@
|
|
|
1
|
-
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,IAAI,CAAC,CAAC;QAC7E,GAAG,CACD,cAAc,EACd,MAAM,EACN,+CAA+C,OAAO,EAAE,EACxD,8HAA8H,CAC/H,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvE,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,0CAA0C,SAAS,GAAG,CAAC,CAAC;IACtF,CAAC;AACH,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { SCHEMA_VERSION, validateAnalysisState, validateCommands } from '../config/schemas.js';\nimport { findWorkspaceRoot, LOCAL_GITIGNORE, loadProject, wsPaths, type Ws } from '../core/workspace.js';\nimport { readVersioned } from '../core/versioned.js';\nimport { getGitState, gitAvailable, gitTrackedFiles } from '../git/git.js';\nimport { inspectAll, summarize, type IntegrationReport } from '../integrations/index.js';\nimport { evaluateStaleness, loadFacts } from '../knowledge/facts.js';\nimport { ONBOARDING_REQUIREMENTS, validatePrompt } from '../prompts/requirements.js';\nimport { isSensitiveFile } from '../security/files.js';\nimport { findSecrets } from '../security/redact.js';\nimport { listDecisions } from '../decisions/decision.js';\nimport { listTasks } from '../tasks/task.js';\nimport { ensureDir, listFilesRecursive, pathExists, readJsonFile, readTextBounded, atomicWriteFile } from '../utils/fs.js';\nimport { ALWAYS_SKIP_DIRS } from '../discovery/scan.js';\nimport { isAuxPath } from '../discovery/detect.js';\nimport { detectContractDrift } from '../discovery/commands.js';\nimport { loadFeatures } from './features.js';\nimport { validateFeatureMap } from '../features/validate.js';\nimport { findAbsolutePaths } from '../utils/paths.js';\nimport { detectInstalledAgents, instructionsInstalled, knowledgeWritten } from './status.js';\nimport { managerEnv, type ServiceOptions } from './common.js';\nimport { withLock } from '../utils/lock.js';\nimport type { AgentAdapter } from '../agents/types.js';\nimport { which } from '../utils/proc.js';\n\nexport type CheckStatus = 'pass' | 'warn' | 'fail' | 'info';\n\nexport interface DoctorCheck {\n id: string;\n status: CheckStatus;\n message: string;\n remediation?: string;\n}\n\nexport interface DoctorResult {\n root: string | null;\n checks: DoctorCheck[];\n counts: { pass: number; warn: number; fail: number; info: number };\n /** Core workspace has no failing checks. */\n healthy: boolean;\n /** Core workspace is onboarded: instructions installed and architecture knowledge written. */\n ready: boolean;\n fixed: string[];\n /** Observed integration state, kept separate from core readiness. */\n integrations: IntegrationReport[];\n integrationSummary: { complete: boolean; required: number; verified: number };\n}\n\nexport interface DoctorOptions extends ServiceOptions {\n fix?: boolean;\n minNodeMajor?: number;\n}\n\nexport const MIN_NODE_MAJOR = 20;\n\nexport async function runDoctor(o: DoctorOptions): Promise<DoctorResult> {\n const checks: DoctorCheck[] = [];\n const fixed: string[] = [];\n const add = (id: string, status: CheckStatus, message: string, remediation?: string): void => {\n checks.push({ id, status, message, ...(remediation ? { remediation } : {}) });\n };\n\n const major = Number(process.versions.node.split('.')[0]);\n const minNode = o.minNodeMajor ?? MIN_NODE_MAJOR;\n if (major >= minNode) add('node', 'pass', `Node.js ${process.versions.node}`);\n else add('node', 'fail', `Node.js ${process.versions.node} is older than the required ${minNode}`, `Install Node.js ${minNode} or newer (https://nodejs.org).`);\n\n const hasGit = await gitAvailable();\n if (hasGit) add('git', 'pass', 'Git is available');\n else add('git', 'warn', 'Git was not found on PATH', 'Install Git; DevWorkspace works without it but cannot protect uncommitted changes.');\n\n const root = await findWorkspaceRoot(o.cwd);\n if (!root) {\n if (await pathExists(path.join(o.cwd, '.devworkspace'))) {\n add('workspace', 'fail', 'Partial initialization: .devworkspace/ exists but project.json is missing', 'Restore project.json from Git, or run \"devworkspace init\" to complete the setup (existing files are kept).');\n } else {\n add('workspace', 'fail', 'No DevWorkspace found in this directory or any parent', 'Run: devworkspace init');\n }\n return finish(null, checks, fixed, undefined, o);\n }\n const ws = wsPaths(root);\n add('workspace', 'pass', 'Workspace found');\n\n // Project config and schema compatibility.\n let projectOk = false;\n let acknowledgedNoVerification = false;\n try {\n const p = await loadProject(ws);\n projectOk = true;\n acknowledgedNoVerification = p.settings.acknowledgeNoVerification === true;\n add('project', 'pass', `project.json valid (schema v${p.schemaVersion}, id ${p.projectId.slice(0, 8)})`);\n } catch (e) {\n const code = (e as { code?: string }).code;\n add('project', 'fail', (e as Error).message.split('\\n')[0]!, code === 'SCHEMA_TOO_NEW' ? 'Upgrade DevWorkspace: npm install -g devworkspace@latest' : 'Restore .devworkspace/project.json from Git, or re-run \"devworkspace init\" after moving the broken file away.');\n }\n\n // Layout.\n const dirs = [ws.contextDir, ws.decisionsDir, ws.tasksActive, ws.tasksCompleted, ws.sessionsDir, ws.analysisDir, ws.stateDir];\n const missingDirs: string[] = [];\n for (const d of dirs) if (!(await pathExists(d))) missingDirs.push(d);\n if (missingDirs.length === 0) add('layout', 'pass', 'Workspace folders present');\n else if (o.fix && projectOk) {\n await withLock(ws.dir, async () => {\n for (const d of missingDirs) await ensureDir(d);\n });\n fixed.push(`created ${missingDirs.length} missing folder(s)`);\n add('layout', 'pass', `Recreated ${missingDirs.length} missing folder(s)`);\n } else {\n add('layout', 'warn', `Missing folders: ${missingDirs.map((d) => path.basename(d)).join(', ')}`, 'Run: devworkspace doctor --fix');\n }\n\n // Ignore rules.\n const giOk = await fs.readFile(ws.gitignore, 'utf8').then(\n (gi) => gi.split(/\\r?\\n/).some((l) => l.trim() === 'local/'),\n () => false,\n );\n if (giOk) add('ignore-local', 'pass', 'Machine-local state is git-ignored');\n else if (o.fix && projectOk) {\n await atomicWriteFile(ws.gitignore, LOCAL_GITIGNORE);\n fixed.push('wrote .devworkspace/.gitignore');\n add('ignore-local', 'pass', 'Wrote .devworkspace/.gitignore');\n } else add('ignore-local', 'fail', '.devworkspace/.gitignore does not ignore local/', 'Run: devworkspace doctor --fix');\n\n try {\n const rootGi = await fs.readFile(path.join(root, '.gitignore'), 'utf8');\n if (rootGi.split(/\\r?\\n/).some((l) => /^\\/?\\.devworkspace\\/?\\*?$/.test(l.trim()))) {\n add('ignore-root', 'warn', 'The root .gitignore ignores all of .devworkspace/, so project knowledge will not be shared', 'Remove that rule; .devworkspace/.gitignore already excludes machine-local files.');\n }\n } catch {\n /* no root .gitignore */\n }\n\n // Knowledge and contract.\n try {\n const facts = await loadFacts(ws);\n const view = await evaluateStaleness(ws.root, facts, new Date().toISOString());\n const stale = [...view.recorded, ...view.detected];\n add('facts', 'pass', `${facts.facts.length} fact(s) stored`);\n if (stale.length > 0) add('staleness', 'warn', `${stale.length} stale fact(s): ${stale.slice(0, 5).map((f) => `${f.key} (${f.reason})`).join('; ')}`, 'Run: devworkspace refresh, then re-check the listed facts against the repository.');\n else if (facts.facts.length > 0) add('staleness', 'pass', 'No stale facts recorded');\n } catch (e) {\n add('facts', 'fail', (e as Error).message.split('\\n')[0]!, 'Restore .devworkspace/context/facts.json from Git or a backup under .devworkspace/local/backups.');\n }\n\n if (await pathExists(ws.commands)) {\n try {\n const c = (await readVersioned(ws.commands, 'commands', SCHEMA_VERSION, validateCommands)).data;\n add('contract', 'pass', 'Testing contract present');\n if (!c.checks.some((x) => x.id === 'unit' && x.available)) add('tests-available', 'warn', 'No unit-test command detected', 'Add a test script or edit .devworkspace/context/commands.json; tasks will not be able to demand tests.');\n if (!c.checks.some((x) => x.id === 'build' && x.available)) add('build-available', 'info', 'No build command detected');\n const configured = c.checks.filter((x) => x.available);\n if (configured.length > 0) {\n const ids = [...new Set(configured.map((x) => x.id))];\n const dirs = [...new Set(configured.map((x) => x.cwd).filter((d): d is string => !!d))];\n add('verification-commands', 'pass', `${ids.length} verification check(s) configured: ${ids.join(', ')}${dirs.length ? ` (in ${dirs.join(', ')})` : ''}`);\n\n const drift = await detectContractDrift(ws.root, c.checks);\n if (drift.hasDrift) {\n const summary = drift.issues.slice(0, 3).map((i) => `${i.id}${i.cwd ? ` [${i.cwd}]` : ''}: ${i.message}`).join('; ');\n const more = drift.issues.length > 3 ? ` (+${drift.issues.length - 3} more)` : '';\n add(\n 'contract-drift',\n 'warn',\n `Verification contract has drifted from actual repository scripts (${drift.issues.length} issue(s): ${summary}${more})`,\n 'Run \"devworkspace refresh\" to resynchronize with package manifests, or edit .devworkspace/context/commands.json.',\n );\n } else {\n add('contract-drift', 'pass', 'Verification commands match repository manifests and directories');\n }\n } else if (acknowledgedNoVerification) {\n add('verification-commands', 'info', 'No verification commands; acknowledged in project.json (settings.acknowledgeNoVerification)');\n } else {\n add(\n 'verification-commands',\n 'warn',\n 'No verification commands (tests, lint, typecheck, build) are configured, so tasks cannot require any verification',\n 'Run: devworkspace analyze. If the project intentionally has none, set \"acknowledgeNoVerification\": true under settings in .devworkspace/project.json.',\n );\n }\n } catch (e) {\n add('contract', 'fail', (e as Error).message.split('\\n')[0]!, 'Fix commands.json or re-run: devworkspace analyze');\n }\n } else add('contract', 'warn', 'Testing contract not generated yet', 'Run: devworkspace analyze');\n\n if (await pathExists(ws.features)) {\n try {\n const f = await loadFeatures(ws);\n const rep = await validateFeatureMap(ws.root, f.features);\n if (rep.total === 0) {\n add('features', 'info', 'Feature map present but contains no features (.devworkspace/context/features.json)');\n } else if (rep.unknown > 0 || rep.features.some((x) => !x.valid)) {\n const broken = rep.features.filter((x) => !x.valid).map((x) => `${x.featureId}: ${x.issues[0]}`).slice(0, 3).join('; ');\n add(\n 'features',\n 'warn',\n `${rep.total} feature(s) mapped, but some contain missing files or broken symbols (${broken})`,\n 'Run \"devworkspace feature validate\" or update .devworkspace/context/features.json.',\n );\n } else {\n add('features', 'pass', `${rep.total} feature(s) mapped: ${rep.verified} verified, ${rep.inferred} inferred`);\n }\n } catch (e) {\n add('features', 'fail', (e as Error).message.split('\\n')[0]!, 'Fix .devworkspace/context/features.json');\n }\n } else {\n add('features', 'info', 'No feature map defined (.devworkspace/context/features.json is optional)');\n }\n\n await checkDiscovery(ws, add);\n\n if (await pathExists(ws.analysisState)) {\n try {\n const a = (await readVersioned(ws.analysisState, 'analysis', SCHEMA_VERSION, validateAnalysisState)).data;\n add('analysis', 'pass', `Last analysis ${a.analyzedAt}${a.truncated ? ' (partial: size limits hit)' : ''}`);\n } catch (e) {\n add('analysis', 'fail', (e as Error).message.split('\\n')[0]!, 'Re-run: devworkspace analyze');\n }\n } else add('analysis', 'warn', 'Repository has not been analyzed', 'Run: devworkspace analyze');\n\n // Prompt quality (when present).\n if (await pathExists(ws.onboardingPrompt)) {\n const text = (await readTextBounded(ws.onboardingPrompt, 1024 * 1024)) ?? '';\n const missing = validatePrompt(text, ONBOARDING_REQUIREMENTS);\n if (missing.length === 0) add('onboarding-prompt', 'pass', 'Onboarding prompt satisfies all behavioural requirements');\n else add('onboarding-prompt', 'fail', `Onboarding prompt is missing: ${missing.join(', ')}`, 'Re-run: devworkspace analyze');\n }\n\n // Agent wiring.\n const installedAgents = await detectInstalledAgents(ws);\n if (installedAgents.length > 0) {\n const names = installedAgents.map((a) => a.displayName).join(', ');\n const msg = installedAgents.length === 1 && installedAgents[0]!.id === 'claude'\n ? 'Claude instructions and skill installed'\n : `${names} instructions installed`;\n add('agent-instructions', 'pass', msg);\n\n // Read-only: plan() only computes what an install would write; nothing is touched here.\n const projectName = (await loadProject(ws).catch(() => null))?.name ?? path.basename(root);\n const outdatedByAgent: { agent: AgentAdapter; paths: string[] }[] = [];\n for (const adapter of installedAgents) {\n const planned = await adapter.plan({ root, projectName });\n const outdated = planned.filter((c) => c.kind === 'update').map((c) => c.path);\n if (outdated.length > 0) {\n outdatedByAgent.push({ agent: adapter, paths: outdated });\n }\n }\n if (outdatedByAgent.length > 0) {\n const allPaths = outdatedByAgent.flatMap((x) => x.paths);\n const namesStale = outdatedByAgent.map((x) => x.agent.displayName).join(', ');\n add(\n 'agent-freshness',\n 'warn',\n `Installed ${namesStale} instructions are older than this DevWorkspace version (${allPaths.join(', ')})`,\n 'Run: devworkspace agent install (add --dry-run to preview; only the managed block and the devworkspace skill change).',\n );\n } else {\n add(\n 'agent-freshness',\n 'pass',\n installedAgents.length === 1 && installedAgents[0]!.id === 'claude'\n ? 'Installed Claude instructions and skill match this DevWorkspace version'\n : `Installed ${names} instructions match this DevWorkspace version`,\n );\n }\n } else {\n add(\n 'agent-instructions',\n 'warn',\n 'Agent instructions are not installed (or the managed section is missing)',\n 'Run: devworkspace agent install',\n );\n }\n if (await knowledgeWritten(ws)) add('onboarding', 'pass', 'Architecture knowledge written');\n else add('onboarding', 'warn', 'Onboarding is not complete: .devworkspace/context/architecture.md is missing or empty', 'Paste .devworkspace/analysis/onboarding-prompt.md into your coding agent (Claude Code, Cursor, Copilot, Codex, etc.).');\n\n // MCP launcher configuration verification\n await checkMcpLauncher(root, add);\n\n // Security and portability.\n const wsFiles = (await listFilesRecursive(ws.dir, 3000)).filter((f) => !f.startsWith(ws.localDir) && !/\\.tmp$/.test(f));\n const secretHits: string[] = [];\n const absHits: string[] = [];\n for (const f of wsFiles) {\n if (!/\\.(json|md)$/.test(f)) continue;\n const rel = path.relative(ws.dir, f).replace(/\\\\/g, '/');\n const text = await readTextBounded(f, 1024 * 1024);\n if (!text) continue;\n if (findSecrets(text).length > 0) secretHits.push(rel);\n if (rel !== 'analysis/onboarding-prompt.md' && rel !== 'analysis/refresh-prompt.md' && findAbsolutePaths(text).length > 0) absHits.push(rel);\n }\n if (secretHits.length === 0) add('secrets', 'pass', 'No secret-like values in .devworkspace');\n else add('secrets', 'fail', `Secret-like values found in: ${secretHits.join(', ')}`, 'Remove the values, rotate the credential if it was real, and re-run doctor.');\n if (absHits.length === 0) add('portability', 'pass', 'No machine-specific absolute paths in portable knowledge');\n else add('portability', 'warn', `Absolute paths found in: ${absHits.join(', ')}`, 'Replace them with project-relative paths so the workspace works after the project moves.');\n\n const git = await getGitState(root);\n if (git.isRepo) {\n const tracked = await gitTrackedFiles(root);\n const bad = (tracked ?? []).filter((f) => isSensitiveFile(f));\n if (bad.length > 0) add('tracked-secrets', 'warn', `Credential-like files are tracked by Git: ${bad.slice(0, 5).join(', ')}`, 'Remove them from Git history if they hold real secrets (git rm --cached, then rotate).');\n else add('tracked-secrets', 'pass', 'No credential-like files tracked by Git');\n }\n\n const leftovers = wsFiles.filter((f) => f.endsWith('.tmp'));\n const allTmp = (await listFilesRecursive(ws.dir, 3000)).filter((f) => f.endsWith('.tmp'));\n if (allTmp.length > 0 || leftovers.length > 0) add('tmp-files', 'warn', `${allTmp.length} leftover temporary file(s) from an interrupted write`, 'They are safe to delete: ' + allTmp.slice(0, 3).map((f) => path.relative(root, f).replace(/\\\\/g, '/')).join(', '));\n\n // Tasks and decisions.\n const { tasks, corrupt } = await listTasks(ws, { includeCompleted: true });\n if (corrupt.length > 0) add('tasks', 'fail', `${corrupt.length} unreadable task file(s): ${corrupt.map((c) => c.file).join(', ')}`, 'Restore them from Git or delete the broken file.');\n else add('tasks', 'pass', `${tasks.length} task(s) readable`);\n const dec = await listDecisions(ws);\n if (dec.unreadable.length > 0) add('decisions', 'warn', `Unreadable decision file(s): ${dec.unreadable.join(', ')}`, 'Check their front matter.');\n\n return finish(root, checks, fixed, ws, o);\n}\n\nasync function finish(root: string | null, checks: DoctorCheck[], fixed: string[], ws: Ws | undefined, o: DoctorOptions): Promise<DoctorResult> {\n const counts = { pass: 0, warn: 0, fail: 0, info: 0 };\n for (const c of checks) counts[c.status]++;\n let ready = false;\n const discoveryOk = !checks.some((c) => DISCOVERY_CHECKS.has(c.id) && c.status === 'warn');\n if (ws) ready = counts.fail === 0 && discoveryOk && (await instructionsInstalled(ws)) && (await knowledgeWritten(ws));\n // Integrations are observed (tools are run), and reported separately: a missing optional tool never makes the core workspace unhealthy.\n const integrations = root && ws ? await inspectAll(ws, managerEnv(o, root), { deep: true }) : [];\n const s = summarize(integrations);\n return { root, checks, counts, healthy: counts.fail === 0, ready, fixed, integrations, integrationSummary: { complete: integrations.length > 0 && s.complete, required: s.required, verified: s.verified } };\n}\n\n/** Doctor checks that say whether the repository was actually understood, as opposed to the folder merely existing. */\nconst DISCOVERY_CHECKS = new Set(['discovery-incomplete', 'discovery-ecosystem', 'verification-commands']);\n\n/** package.json files near the top of the tree (two levels), found without a full scan. */\nasync function findNearbyManifests(root: string): Promise<string[]> {\n const found: string[] = [];\n const skip = (name: string, rel: string): boolean => name.startsWith('.') || ALWAYS_SKIP_DIRS.has(name) || isAuxPath(`${rel}/x`);\n async function dirs(rel: string): Promise<string[]> {\n try {\n return (await fs.readdir(path.join(root, rel), { withFileTypes: true })).filter((e) => e.isDirectory() && !skip(e.name, rel ? `${rel}/${e.name}` : e.name)).map((e) => (rel ? `${rel}/${e.name}` : e.name));\n } catch {\n return [];\n }\n }\n for (const d1 of await dirs('')) {\n if (await pathExists(path.join(root, d1, 'package.json'))) found.push(`${d1}/package.json`);\n for (const d2 of (await dirs(d1)).slice(0, 100)) if (await pathExists(path.join(root, d2, 'package.json'))) found.push(`${d2}/package.json`);\n }\n return found.sort();\n}\n\nasync function checkDiscovery(ws: Ws, add: (id: string, status: CheckStatus, message: string, remediation?: string) => void): Promise<void> {\n if (!(await pathExists(ws.discovery))) return; // \"not analyzed yet\" is reported by the analysis check\n let d: { ecosystems?: string[]; languages?: { name: string; files: number }[]; manifests?: string[]; monorepo?: { packages?: { path: string }[] }; scan?: { fileCount?: number } };\n try {\n d = (await readJsonFile(ws.discovery)) as typeof d;\n } catch (e) {\n add('discovery-ecosystem', 'fail', (e as Error).message.split('\\n')[0]!, 'Re-run: devworkspace analyze');\n return;\n }\n const eco = d.ecosystems ?? [];\n const languages = (d.languages ?? []).map((l) => l.name);\n // Manifests the analysis recorded. Older reports lack the list, so reconstruct it from the packages they did record.\n const known = new Set<string>(d.manifests ?? []);\n for (const p of d.monorepo?.packages ?? []) known.add(`${p.path}/package.json`);\n if (eco.includes('node')) known.add('package.json');\n const missed = (await findNearbyManifests(ws.root)).filter((m) => !known.has(m));\n if (missed.length > 0) {\n add(\n 'discovery-incomplete',\n 'warn',\n `The repository has package manifest(s) the last analysis did not record: ${missed.slice(0, 4).join(', ')}${missed.length > 4 ? ', ...' : ''}`,\n 'Run: devworkspace analyze (current versions detect nested packages). Commands you confirmed earlier are kept.',\n );\n } else if (eco.length === 0 && languages.length > 0) {\n add(\n 'discovery-ecosystem',\n 'warn',\n `No ecosystem was detected although ${d.scan?.fileCount ?? 'several'} files were scanned (${languages.slice(0, 3).join(', ')}), so build and test tooling is unknown`,\n 'Run: devworkspace analyze. If the project has no package manifest, record its commands by hand in .devworkspace/context/commands.json.',\n );\n } else if (eco.length > 0) {\n const n = d.monorepo?.packages?.length ?? 0;\n add('discovery-ecosystem', 'pass', `Detected ${eco.join(', ')}${n > 0 ? ` (${n} package${n === 1 ? '' : 's'})` : ''}`);\n } else {\n add('discovery-ecosystem', 'info', 'No source files or manifests detected');\n }\n}\n\nasync function checkMcpLauncher(\n root: string,\n add: (id: string, status: CheckStatus, message: string, remediation?: string) => void,\n): Promise<void> {\n const configs = [\n { file: '.mcp.json' },\n { file: 'mcp.json' },\n { file: path.join('.antigravity', 'mcp.json') },\n ];\n\n const found: { file: string; command: string; args: string[] }[] = [];\n for (const cfg of configs) {\n const full = path.join(root, cfg.file);\n if (await pathExists(full)) {\n try {\n const raw = await readJsonFile(full);\n const obj = typeof raw === 'object' && raw !== null ? (raw as Record<string, unknown>) : null;\n const servers = obj?.mcpServers && typeof obj.mcpServers === 'object' ? (obj.mcpServers as Record<string, unknown>) : null;\n const devServer = servers?.devworkspace && typeof servers.devworkspace === 'object' ? (servers.devworkspace as Record<string, unknown>) : null;\n if (devServer && typeof devServer.command === 'string') {\n found.push({\n file: cfg.file,\n command: devServer.command,\n args: Array.isArray(devServer.args) ? devServer.args.map(String) : [],\n });\n }\n } catch {\n // syntax error\n }\n }\n }\n\n if (found.length === 0) return;\n\n const badLaunchers: { file: string; command: string; reason: string }[] = [];\n for (const item of found) {\n if (item.command === 'devworkspace') {\n const onPath = await which('devworkspace');\n if (!onPath) {\n badLaunchers.push({\n file: item.file,\n command: item.command,\n reason: '\"devworkspace\" binary was not found on PATH',\n });\n }\n } else if (item.command === 'npx') {\n const onPath = await which('npx');\n if (!onPath) {\n badLaunchers.push({\n file: item.file,\n command: item.command,\n reason: '\"npx\" binary was not found on PATH',\n });\n }\n } else {\n const onPath = await which(item.command);\n const isLocal = await pathExists(path.resolve(root, item.command));\n if (!onPath && !isLocal) {\n badLaunchers.push({\n file: item.file,\n command: item.command,\n reason: `command \"${item.command}\" was not found on PATH or workspace root`,\n });\n }\n }\n }\n\n if (badLaunchers.length > 0) {\n const details = badLaunchers.map((b) => `${b.file}: ${b.reason}`).join('; ');\n add(\n 'mcp-launcher',\n 'warn',\n `Configured MCP launcher cannot be resolved: ${details}`,\n 'Install DevWorkspace globally (npm install -g devworkspace) or re-run: devworkspace setup --agent claude-code --launcher npx',\n );\n } else {\n const launchers = [...new Set(found.map((f) => f.command))].join(', ');\n add('mcp-launcher', 'pass', `Configured MCP launcher is resolvable (${launchers})`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/services/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAW,MAAM,sBAAsB,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,SAAS,EAA0B,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAA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AAO,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACnE,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;gBACxB,YAAY,CAAC,IAAI,CAAC;oBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,MAAM,EAAE,YAAY,IAAI,CAAC,OAAO,2CAA2C;iBAC5E,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7E,GAAG,CACD,cAAc,EACd,MAAM,EACN,+CAA+C,OAAO,EAAE,EACxD,8HAA8H,CAC/H,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9F,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,0CAA0C,SAAS,GAAG,CAAC,CAAC;IACtF,CAAC;AACH,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { SCHEMA_VERSION, validateAnalysisState, validateCommands } from '../config/schemas.js';\nimport { findWorkspaceRoot, LOCAL_GITIGNORE, loadProject, wsPaths, type Ws } from '../core/workspace.js';\nimport { readVersioned } from '../core/versioned.js';\nimport { resolveGraphifyGraph } from '../core/artifacts.js';\nimport { getGitState, gitAvailable, gitTrackedFiles } from '../git/git.js';\nimport { inspectAll, summarize, type IntegrationReport } from '../integrations/index.js';\nimport { evaluateStaleness, loadFacts } from '../knowledge/facts.js';\nimport { ONBOARDING_REQUIREMENTS, validatePrompt } from '../prompts/requirements.js';\nimport { isSensitiveFile } from '../security/files.js';\nimport { findSecrets } from '../security/redact.js';\nimport { listDecisions } from '../decisions/decision.js';\nimport { listTasks } from '../tasks/task.js';\nimport { ensureDir, listFilesRecursive, pathExists, readJsonFile, readTextBounded, atomicWriteFile } from '../utils/fs.js';\nimport { ALWAYS_SKIP_DIRS } from '../discovery/scan.js';\nimport { isAuxPath } from '../discovery/detect.js';\nimport { detectContractDrift } from '../discovery/commands.js';\nimport { loadFeatures } from './features.js';\nimport { validateFeatureMap } from '../features/validate.js';\nimport { findAbsolutePaths } from '../utils/paths.js';\nimport { detectInstalledAgents, instructionsInstalled, knowledgeWritten } from './status.js';\nimport { managerEnv, type ServiceOptions } from './common.js';\nimport { withLock } from '../utils/lock.js';\nimport type { AgentAdapter } from '../agents/types.js';\nimport { which } from '../utils/proc.js';\n\nexport type CheckStatus = 'pass' | 'warn' | 'fail' | 'info';\n\nexport interface DoctorCheck {\n id: string;\n status: CheckStatus;\n message: string;\n remediation?: string;\n}\n\nexport interface DoctorResult {\n root: string | null;\n checks: DoctorCheck[];\n counts: { pass: number; warn: number; fail: number; info: number };\n /** Core workspace has no failing checks. */\n healthy: boolean;\n /** Core workspace is onboarded: instructions installed and architecture knowledge written. */\n ready: boolean;\n fixed: string[];\n /** Observed integration state, kept separate from core readiness. */\n integrations: IntegrationReport[];\n integrationSummary: { complete: boolean; required: number; verified: number };\n}\n\nexport interface DoctorOptions extends ServiceOptions {\n fix?: boolean;\n minNodeMajor?: number;\n}\n\nexport const MIN_NODE_MAJOR = 20;\n\nexport async function runDoctor(o: DoctorOptions): Promise<DoctorResult> {\n const checks: DoctorCheck[] = [];\n const fixed: string[] = [];\n const add = (id: string, status: CheckStatus, message: string, remediation?: string): void => {\n checks.push({ id, status, message, ...(remediation ? { remediation } : {}) });\n };\n\n const major = Number(process.versions.node.split('.')[0]);\n const minNode = o.minNodeMajor ?? MIN_NODE_MAJOR;\n if (major >= minNode) add('node', 'pass', `Node.js ${process.versions.node}`);\n else add('node', 'fail', `Node.js ${process.versions.node} is older than the required ${minNode}`, `Install Node.js ${minNode} or newer (https://nodejs.org).`);\n\n const hasGit = await gitAvailable();\n if (hasGit) add('git', 'pass', 'Git is available');\n else add('git', 'warn', 'Git was not found on PATH', 'Install Git; DevWorkspace works without it but cannot protect uncommitted changes.');\n\n const root = await findWorkspaceRoot(o.cwd);\n if (!root) {\n if (await pathExists(path.join(o.cwd, '.devworkspace'))) {\n add('workspace', 'fail', 'Partial initialization: .devworkspace/ exists but project.json is missing', 'Restore project.json from Git, or run \"devworkspace init\" to complete the setup (existing files are kept).');\n } else {\n add('workspace', 'fail', 'No DevWorkspace found in this directory or any parent', 'Run: devworkspace init');\n }\n return finish(null, checks, fixed, undefined, o);\n }\n const ws = wsPaths(root);\n add('workspace', 'pass', 'Workspace found');\n\n // Project config and schema compatibility.\n let projectOk = false;\n let acknowledgedNoVerification = false;\n try {\n const p = await loadProject(ws);\n projectOk = true;\n acknowledgedNoVerification = p.settings.acknowledgeNoVerification === true;\n add('project', 'pass', `project.json valid (schema v${p.schemaVersion}, id ${p.projectId.slice(0, 8)})`);\n } catch (e) {\n const code = (e as { code?: string }).code;\n add('project', 'fail', (e as Error).message.split('\\n')[0]!, code === 'SCHEMA_TOO_NEW' ? 'Upgrade DevWorkspace: npm install -g devworkspace@latest' : 'Restore .devworkspace/project.json from Git, or re-run \"devworkspace init\" after moving the broken file away.');\n }\n\n // Layout.\n const dirs = [ws.contextDir, ws.decisionsDir, ws.tasksActive, ws.tasksCompleted, ws.sessionsDir, ws.analysisDir, ws.stateDir];\n const missingDirs: string[] = [];\n for (const d of dirs) if (!(await pathExists(d))) missingDirs.push(d);\n if (missingDirs.length === 0) add('layout', 'pass', 'Workspace folders present');\n else if (o.fix && projectOk) {\n await withLock(ws.dir, async () => {\n for (const d of missingDirs) await ensureDir(d);\n });\n fixed.push(`created ${missingDirs.length} missing folder(s)`);\n add('layout', 'pass', `Recreated ${missingDirs.length} missing folder(s)`);\n } else {\n add('layout', 'warn', `Missing folders: ${missingDirs.map((d) => path.basename(d)).join(', ')}`, 'Run: devworkspace doctor --fix');\n }\n\n // Ignore rules.\n const giOk = await fs.readFile(ws.gitignore, 'utf8').then(\n (gi) => gi.split(/\\r?\\n/).some((l) => l.trim() === 'local/'),\n () => false,\n );\n if (giOk) add('ignore-local', 'pass', 'Machine-local state is git-ignored');\n else if (o.fix && projectOk) {\n await atomicWriteFile(ws.gitignore, LOCAL_GITIGNORE);\n fixed.push('wrote .devworkspace/.gitignore');\n add('ignore-local', 'pass', 'Wrote .devworkspace/.gitignore');\n } else add('ignore-local', 'fail', '.devworkspace/.gitignore does not ignore local/', 'Run: devworkspace doctor --fix');\n\n try {\n const rootGi = await fs.readFile(path.join(root, '.gitignore'), 'utf8');\n if (rootGi.split(/\\r?\\n/).some((l) => /^\\/?\\.devworkspace\\/?\\*?$/.test(l.trim()))) {\n add('ignore-root', 'warn', 'The root .gitignore ignores all of .devworkspace/, so project knowledge will not be shared', 'Remove that rule; .devworkspace/.gitignore already excludes machine-local files.');\n }\n } catch {\n /* no root .gitignore */\n }\n\n // Knowledge and contract.\n try {\n const facts = await loadFacts(ws);\n const view = await evaluateStaleness(ws.root, facts, new Date().toISOString());\n const stale = [...view.recorded, ...view.detected];\n add('facts', 'pass', `${facts.facts.length} fact(s) stored`);\n if (stale.length > 0) add('staleness', 'warn', `${stale.length} stale fact(s): ${stale.slice(0, 5).map((f) => `${f.key} (${f.reason})`).join('; ')}`, 'Run: devworkspace refresh, then re-check the listed facts against the repository.');\n else if (facts.facts.length > 0) add('staleness', 'pass', 'No stale facts recorded');\n } catch (e) {\n add('facts', 'fail', (e as Error).message.split('\\n')[0]!, 'Restore .devworkspace/context/facts.json from Git or a backup under .devworkspace/local/backups.');\n }\n\n if (await pathExists(ws.commands)) {\n try {\n const c = (await readVersioned(ws.commands, 'commands', SCHEMA_VERSION, validateCommands)).data;\n add('contract', 'pass', 'Testing contract present');\n if (!c.checks.some((x) => x.id === 'unit' && x.available)) add('tests-available', 'warn', 'No unit-test command detected', 'Add a test script or edit .devworkspace/context/commands.json; tasks will not be able to demand tests.');\n if (!c.checks.some((x) => x.id === 'build' && x.available)) add('build-available', 'info', 'No build command detected');\n const configured = c.checks.filter((x) => x.available);\n if (configured.length > 0) {\n const ids = [...new Set(configured.map((x) => x.id))];\n const dirs = [...new Set(configured.map((x) => x.cwd).filter((d): d is string => !!d))];\n add('verification-commands', 'pass', `${ids.length} verification check(s) configured: ${ids.join(', ')}${dirs.length ? ` (in ${dirs.join(', ')})` : ''}`);\n\n const drift = await detectContractDrift(ws.root, c.checks);\n if (drift.hasDrift) {\n const summary = drift.issues.slice(0, 3).map((i) => `${i.id}${i.cwd ? ` [${i.cwd}]` : ''}: ${i.message}`).join('; ');\n const more = drift.issues.length > 3 ? ` (+${drift.issues.length - 3} more)` : '';\n add(\n 'contract-drift',\n 'warn',\n `Verification contract has drifted from actual repository scripts (${drift.issues.length} issue(s): ${summary}${more})`,\n 'Run \"devworkspace refresh\" to resynchronize with package manifests, or edit .devworkspace/context/commands.json.',\n );\n } else {\n add('contract-drift', 'pass', 'Verification commands match repository manifests and directories');\n }\n } else if (acknowledgedNoVerification) {\n add('verification-commands', 'info', 'No verification commands; acknowledged in project.json (settings.acknowledgeNoVerification)');\n } else {\n add(\n 'verification-commands',\n 'warn',\n 'No verification commands (tests, lint, typecheck, build) are configured, so tasks cannot require any verification',\n 'Run: devworkspace analyze. If the project intentionally has none, set \"acknowledgeNoVerification\": true under settings in .devworkspace/project.json.',\n );\n }\n } catch (e) {\n add('contract', 'fail', (e as Error).message.split('\\n')[0]!, 'Fix commands.json or re-run: devworkspace analyze');\n }\n } else add('contract', 'warn', 'Testing contract not generated yet', 'Run: devworkspace analyze');\n\n if (await pathExists(ws.features)) {\n try {\n const f = await loadFeatures(ws);\n const rep = await validateFeatureMap(ws.root, f.features);\n if (rep.total === 0) {\n add('features', 'info', 'Feature map present but contains no features (.devworkspace/context/features.json)');\n } else if (rep.unknown > 0 || rep.features.some((x) => !x.valid)) {\n const broken = rep.features.filter((x) => !x.valid).map((x) => `${x.featureId}: ${x.issues[0]}`).slice(0, 3).join('; ');\n add(\n 'features',\n 'warn',\n `${rep.total} feature(s) mapped, but some contain missing files or broken symbols (${broken})`,\n 'Run \"devworkspace feature validate\" or update .devworkspace/context/features.json.',\n );\n } else {\n add('features', 'pass', `${rep.total} feature(s) mapped: ${rep.verified} verified, ${rep.inferred} inferred`);\n }\n } catch (e) {\n add('features', 'fail', (e as Error).message.split('\\n')[0]!, 'Fix .devworkspace/context/features.json');\n }\n } else {\n add('features', 'info', 'No feature map defined (.devworkspace/context/features.json is optional)');\n }\n\n await checkDiscovery(ws, add);\n\n if (await pathExists(ws.analysisState)) {\n try {\n const a = (await readVersioned(ws.analysisState, 'analysis', SCHEMA_VERSION, validateAnalysisState)).data;\n add('analysis', 'pass', `Last analysis ${a.analyzedAt}${a.truncated ? ' (partial: size limits hit)' : ''}`);\n } catch (e) {\n add('analysis', 'fail', (e as Error).message.split('\\n')[0]!, 'Re-run: devworkspace analyze');\n }\n } else add('analysis', 'warn', 'Repository has not been analyzed', 'Run: devworkspace analyze');\n\n // Prompt quality (when present).\n if (await pathExists(ws.onboardingPrompt)) {\n const text = (await readTextBounded(ws.onboardingPrompt, 1024 * 1024)) ?? '';\n const missing = validatePrompt(text, ONBOARDING_REQUIREMENTS);\n if (missing.length === 0) add('onboarding-prompt', 'pass', 'Onboarding prompt satisfies all behavioural requirements');\n else add('onboarding-prompt', 'fail', `Onboarding prompt is missing: ${missing.join(', ')}`, 'Re-run: devworkspace analyze');\n }\n\n // Agent wiring.\n const installedAgents = await detectInstalledAgents(ws);\n if (installedAgents.length > 0) {\n const names = installedAgents.map((a) => a.displayName).join(', ');\n const msg = installedAgents.length === 1 && installedAgents[0]!.id === 'claude'\n ? 'Claude instructions and skill installed'\n : `${names} instructions installed`;\n add('agent-instructions', 'pass', msg);\n\n // Read-only: plan() only computes what an install would write; nothing is touched here.\n const projectName = (await loadProject(ws).catch(() => null))?.name ?? path.basename(root);\n const outdatedByAgent: { agent: AgentAdapter; paths: string[] }[] = [];\n for (const adapter of installedAgents) {\n const planned = await adapter.plan({ root, projectName });\n const outdated = planned.filter((c) => c.kind === 'update').map((c) => c.path);\n if (outdated.length > 0) {\n outdatedByAgent.push({ agent: adapter, paths: outdated });\n }\n }\n if (outdatedByAgent.length > 0) {\n const allPaths = outdatedByAgent.flatMap((x) => x.paths);\n const namesStale = outdatedByAgent.map((x) => x.agent.displayName).join(', ');\n add(\n 'agent-freshness',\n 'warn',\n `Installed ${namesStale} instructions are older than this DevWorkspace version (${allPaths.join(', ')})`,\n 'Run: devworkspace agent install (add --dry-run to preview; only the managed block and the devworkspace skill change).',\n );\n } else {\n add(\n 'agent-freshness',\n 'pass',\n installedAgents.length === 1 && installedAgents[0]!.id === 'claude'\n ? 'Installed Claude instructions and skill match this DevWorkspace version'\n : `Installed ${names} instructions match this DevWorkspace version`,\n );\n }\n } else {\n add(\n 'agent-instructions',\n 'warn',\n 'Agent instructions are not installed (or the managed section is missing)',\n 'Run: devworkspace agent install',\n );\n }\n if (await knowledgeWritten(ws)) add('onboarding', 'pass', 'Architecture knowledge written');\n else add('onboarding', 'warn', 'Onboarding is not complete: .devworkspace/context/architecture.md is missing or empty', 'Paste .devworkspace/analysis/onboarding-prompt.md into your coding agent (Claude Code, Cursor, Copilot, Codex, etc.).');\n\n // MCP launcher configuration verification\n await checkMcpLauncher(root, add);\n await checkGraphLayout(root, add);\n\n // Security and portability.\n const wsFiles = (await listFilesRecursive(ws.dir, 3000)).filter((f) => !f.startsWith(ws.localDir) && !/\\.tmp$/.test(f));\n const secretHits: string[] = [];\n const absHits: string[] = [];\n for (const f of wsFiles) {\n if (!/\\.(json|md)$/.test(f)) continue;\n const rel = path.relative(ws.dir, f).replace(/\\\\/g, '/');\n const text = await readTextBounded(f, 1024 * 1024);\n if (!text) continue;\n if (findSecrets(text).length > 0) secretHits.push(rel);\n if (rel !== 'analysis/onboarding-prompt.md' && rel !== 'analysis/refresh-prompt.md' && findAbsolutePaths(text).length > 0) absHits.push(rel);\n }\n if (secretHits.length === 0) add('secrets', 'pass', 'No secret-like values in .devworkspace');\n else add('secrets', 'fail', `Secret-like values found in: ${secretHits.join(', ')}`, 'Remove the values, rotate the credential if it was real, and re-run doctor.');\n if (absHits.length === 0) add('portability', 'pass', 'No machine-specific absolute paths in portable knowledge');\n else add('portability', 'warn', `Absolute paths found in: ${absHits.join(', ')}`, 'Replace them with project-relative paths so the workspace works after the project moves.');\n\n const git = await getGitState(root);\n if (git.isRepo) {\n const tracked = await gitTrackedFiles(root);\n const bad = (tracked ?? []).filter((f) => isSensitiveFile(f));\n if (bad.length > 0) add('tracked-secrets', 'warn', `Credential-like files are tracked by Git: ${bad.slice(0, 5).join(', ')}`, 'Remove them from Git history if they hold real secrets (git rm --cached, then rotate).');\n else add('tracked-secrets', 'pass', 'No credential-like files tracked by Git');\n }\n\n const leftovers = wsFiles.filter((f) => f.endsWith('.tmp'));\n const allTmp = (await listFilesRecursive(ws.dir, 3000)).filter((f) => f.endsWith('.tmp'));\n if (allTmp.length > 0 || leftovers.length > 0) add('tmp-files', 'warn', `${allTmp.length} leftover temporary file(s) from an interrupted write`, 'They are safe to delete: ' + allTmp.slice(0, 3).map((f) => path.relative(root, f).replace(/\\\\/g, '/')).join(', '));\n\n // Tasks and decisions.\n const { tasks, corrupt } = await listTasks(ws, { includeCompleted: true });\n if (corrupt.length > 0) add('tasks', 'fail', `${corrupt.length} unreadable task file(s): ${corrupt.map((c) => c.file).join(', ')}`, 'Restore them from Git or delete the broken file.');\n else add('tasks', 'pass', `${tasks.length} task(s) readable`);\n const dec = await listDecisions(ws);\n if (dec.unreadable.length > 0) add('decisions', 'warn', `Unreadable decision file(s): ${dec.unreadable.join(', ')}`, 'Check their front matter.');\n\n return finish(root, checks, fixed, ws, o);\n}\n\nasync function finish(root: string | null, checks: DoctorCheck[], fixed: string[], ws: Ws | undefined, o: DoctorOptions): Promise<DoctorResult> {\n const counts = { pass: 0, warn: 0, fail: 0, info: 0 };\n for (const c of checks) counts[c.status]++;\n let ready = false;\n const discoveryOk = !checks.some((c) => DISCOVERY_CHECKS.has(c.id) && c.status === 'warn');\n if (ws) ready = counts.fail === 0 && discoveryOk && (await instructionsInstalled(ws)) && (await knowledgeWritten(ws));\n // Integrations are observed (tools are run), and reported separately: a missing optional tool never makes the core workspace unhealthy.\n const integrations = root && ws ? await inspectAll(ws, managerEnv(o, root), { deep: true }) : [];\n const s = summarize(integrations);\n return { root, checks, counts, healthy: counts.fail === 0, ready, fixed, integrations, integrationSummary: { complete: integrations.length > 0 && s.complete, required: s.required, verified: s.verified } };\n}\n\n/** Doctor checks that say whether the repository was actually understood, as opposed to the folder merely existing. */\nconst DISCOVERY_CHECKS = new Set(['discovery-incomplete', 'discovery-ecosystem', 'verification-commands']);\n\n/** package.json files near the top of the tree (two levels), found without a full scan. */\nasync function findNearbyManifests(root: string): Promise<string[]> {\n const found: string[] = [];\n const skip = (name: string, rel: string): boolean => name.startsWith('.') || ALWAYS_SKIP_DIRS.has(name) || isAuxPath(`${rel}/x`);\n async function dirs(rel: string): Promise<string[]> {\n try {\n return (await fs.readdir(path.join(root, rel), { withFileTypes: true })).filter((e) => e.isDirectory() && !skip(e.name, rel ? `${rel}/${e.name}` : e.name)).map((e) => (rel ? `${rel}/${e.name}` : e.name));\n } catch {\n return [];\n }\n }\n for (const d1 of await dirs('')) {\n if (await pathExists(path.join(root, d1, 'package.json'))) found.push(`${d1}/package.json`);\n for (const d2 of (await dirs(d1)).slice(0, 100)) if (await pathExists(path.join(root, d2, 'package.json'))) found.push(`${d2}/package.json`);\n }\n return found.sort();\n}\n\nasync function checkDiscovery(ws: Ws, add: (id: string, status: CheckStatus, message: string, remediation?: string) => void): Promise<void> {\n if (!(await pathExists(ws.discovery))) return; // \"not analyzed yet\" is reported by the analysis check\n let d: { ecosystems?: string[]; languages?: { name: string; files: number }[]; manifests?: string[]; monorepo?: { packages?: { path: string }[] }; scan?: { fileCount?: number } };\n try {\n d = (await readJsonFile(ws.discovery)) as typeof d;\n } catch (e) {\n add('discovery-ecosystem', 'fail', (e as Error).message.split('\\n')[0]!, 'Re-run: devworkspace analyze');\n return;\n }\n const eco = d.ecosystems ?? [];\n const languages = (d.languages ?? []).map((l) => l.name);\n // Manifests the analysis recorded. Older reports lack the list, so reconstruct it from the packages they did record.\n const known = new Set<string>(d.manifests ?? []);\n for (const p of d.monorepo?.packages ?? []) known.add(`${p.path}/package.json`);\n if (eco.includes('node')) known.add('package.json');\n const missed = (await findNearbyManifests(ws.root)).filter((m) => !known.has(m));\n if (missed.length > 0) {\n add(\n 'discovery-incomplete',\n 'warn',\n `The repository has package manifest(s) the last analysis did not record: ${missed.slice(0, 4).join(', ')}${missed.length > 4 ? ', ...' : ''}`,\n 'Run: devworkspace analyze (current versions detect nested packages). Commands you confirmed earlier are kept.',\n );\n } else if (eco.length === 0 && languages.length > 0) {\n add(\n 'discovery-ecosystem',\n 'warn',\n `No ecosystem was detected although ${d.scan?.fileCount ?? 'several'} files were scanned (${languages.slice(0, 3).join(', ')}), so build and test tooling is unknown`,\n 'Run: devworkspace analyze. If the project has no package manifest, record its commands by hand in .devworkspace/context/commands.json.',\n );\n } else if (eco.length > 0) {\n const n = d.monorepo?.packages?.length ?? 0;\n add('discovery-ecosystem', 'pass', `Detected ${eco.join(', ')}${n > 0 ? ` (${n} package${n === 1 ? '' : 's'})` : ''}`);\n } else {\n add('discovery-ecosystem', 'info', 'No source files or manifests detected');\n }\n}\n\n/** Graphify's own commands hardcode root graphify-out/, so that stays; say so, and flag a duplicate in .devworkspace/graph. */\nasync function checkGraphLayout(\n root: string,\n add: (id: string, status: CheckStatus, message: string, remediation?: string) => void,\n): Promise<void> {\n const g = await resolveGraphifyGraph(root);\n if (!g.exists) return;\n const rel = path.relative(root, g.file).replace(/\\\\/g, '/');\n if (g.conflict) {\n add('graph-layout', 'warn', `Graphify graphs exist in two locations; reading ${rel} (most recent). ${path.relative(root, g.conflict.other).replace(/\\\\/g, '/')} is ignored.`,\n 'Keep one: delete the stale copy yourself, or regenerate with \"graphify update .\" (nothing is moved or deleted automatically).');\n }\n // Staleness: Graphify records the commit it was built at as the last key; compare with HEAD without parsing the whole file.\n const built = await readGraphCommit(g.file);\n const head = (await getGitState(root).catch(() => null))?.head ?? null;\n if (built && head && built !== head) {\n add('graph-stale', 'warn', `Graph was built at commit ${built.slice(0, 8)} but HEAD is ${head.slice(0, 8)}; relationships may be stale.`,\n 'Run \"graphify update .\" (no LLM cost) to refresh it. Uncommitted edits are not reflected in either case.');\n }\n if (!g.conflict && g.location === 'tool-owned-root') {\n add('graph-layout', 'pass', `Graph at ${rel} (Graphify-owned location; \"graphify update\" and the /graphify skill require it at the project root)`);\n } else if (!g.conflict) {\n add('graph-layout', 'pass', `Graph at ${rel} (DevWorkspace-managed location)`);\n }\n}\n\nasync function readGraphCommit(file: string): Promise<string | null> {\n try {\n const fh = await fs.open(file, 'r');\n try {\n const { size } = await fh.stat();\n const len = Math.min(size, 512);\n const buf = Buffer.alloc(len);\n await fh.read(buf, 0, len, size - len);\n return /\"built_at_commit\"\\s*:\\s*\"([0-9a-f]{7,40})\"/.exec(buf.toString('utf8'))?.[1] ?? null;\n } finally {\n await fh.close();\n }\n } catch {\n return null;\n }\n}\n\nasync function checkMcpLauncher(\n root: string,\n add: (id: string, status: CheckStatus, message: string, remediation?: string) => void,\n): Promise<void> {\n const configs = [\n { file: '.mcp.json' },\n { file: 'mcp.json' },\n { file: path.join('.antigravity', 'mcp.json') },\n ];\n\n const found: { file: string; command: string; args: string[] }[] = [];\n for (const cfg of configs) {\n const full = path.join(root, cfg.file);\n if (await pathExists(full)) {\n try {\n const raw = await readJsonFile(full);\n const obj = typeof raw === 'object' && raw !== null ? (raw as Record<string, unknown>) : null;\n const servers = obj?.mcpServers && typeof obj.mcpServers === 'object' ? (obj.mcpServers as Record<string, unknown>) : null;\n const devServer = servers?.devworkspace && typeof servers.devworkspace === 'object' ? (servers.devworkspace as Record<string, unknown>) : null;\n if (devServer && typeof devServer.command === 'string') {\n found.push({\n file: cfg.file,\n command: devServer.command,\n args: Array.isArray(devServer.args) ? devServer.args.map(String) : [],\n });\n }\n } catch {\n // syntax error\n }\n }\n }\n\n // Codex: project-scoped TOML written by `setup --agent codex` (our managed block only).\n const toml = await readTextBounded(path.join(root, '.codex', 'config.toml'), 200_000).catch(() => null);\n const tomlCmd = toml ? /\\[mcp_servers\\.devworkspace\\][^[]*?command\\s*=\\s*\"([^\"]+)\"[^[]*?args\\s*=\\s*(\\[[^\\]]*\\])/s.exec(toml) : null;\n if (tomlCmd) {\n let args: string[] = [];\n try { args = (JSON.parse(tomlCmd[2]!) as unknown[]).map(String); } catch { /* unparsable args: report the command alone */ }\n found.push({ file: '.codex/config.toml', command: tomlCmd[1]!, args });\n }\n\n // Files earlier versions wrote that no supported client reads. Never deleted automatically.\n const legacy: string[] = [];\n for (const f of ['mcp.json', path.join('.antigravity', 'mcp.json')]) {\n const text = await readTextBounded(path.join(root, f), 200_000).catch(() => null);\n if (text && /\"devworkspace\"\\s*:/.test(text)) legacy.push(f.split(path.sep).join('/'));\n }\n if (legacy.length > 0) {\n add('mcp-legacy-config', 'warn', `${legacy.join(', ')} contain a devworkspace MCP entry, but Codex reads .codex/config.toml and Antigravity reads a user-level mcp_config.json; these files are not consumed by those agents.`,\n 'Run: devworkspace setup --agent codex (writes .codex/config.toml). The old file can be deleted by you; DevWorkspace will not delete it.');\n }\n\n if (found.length === 0) return;\n\n const badLaunchers: { file: string; command: string; reason: string }[] = [];\n for (const item of found) {\n if (item.command === 'devworkspace') {\n const onPath = await which('devworkspace');\n if (!onPath) {\n badLaunchers.push({\n file: item.file,\n command: item.command,\n reason: '\"devworkspace\" binary was not found on PATH',\n });\n }\n } else if (item.command === 'npx') {\n const onPath = await which('npx');\n if (!onPath) {\n badLaunchers.push({\n file: item.file,\n command: item.command,\n reason: '\"npx\" binary was not found on PATH',\n });\n }\n } else {\n const onPath = await which(item.command);\n const isLocal = await pathExists(path.resolve(root, item.command));\n if (!onPath && !isLocal) {\n badLaunchers.push({\n file: item.file,\n command: item.command,\n reason: `command \"${item.command}\" was not found on PATH or workspace root`,\n });\n }\n }\n }\n\n if (badLaunchers.length > 0) {\n const details = badLaunchers.map((b) => `${b.file}: ${b.reason}`).join('; ');\n add(\n 'mcp-launcher',\n 'warn',\n `Configured MCP launcher cannot be resolved: ${details}`,\n 'Install DevWorkspace globally (npm install -g devworkspace) or re-run: devworkspace setup --agent claude-code --launcher npx',\n );\n } else {\n const launchers = [...new Set(found.map((f) => [f.command, ...f.args].join(' ')))].join('; ');\n add('mcp-launcher', 'pass', `Configured MCP launcher is resolvable (${launchers})`);\n }\n}\n"]}
|
package/dist/services/graph.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { type ResolvedGraph } from '../core/artifacts.js';
|
|
1
2
|
import type { ServiceOptions } from './common.js';
|
|
2
3
|
export type NodeVerificationStatus = 'verified' | 'hypothesis';
|
|
4
|
+
/** Edge confidence as reported by Graphify. Absent on older graphs; never fabricated. */
|
|
5
|
+
export type EdgeConfidence = 'EXTRACTED' | 'INFERRED';
|
|
6
|
+
/** How an edge is backed: extracted from the AST, inferred by Graphify, or unknown (older graphs). */
|
|
7
|
+
export type EdgeProvenance = 'extracted' | 'inferred' | 'unknown';
|
|
3
8
|
export interface RawGraphNode {
|
|
4
9
|
id: string;
|
|
5
10
|
name?: string;
|
|
@@ -7,6 +12,10 @@ export interface RawGraphNode {
|
|
|
7
12
|
type?: string;
|
|
8
13
|
path?: string;
|
|
9
14
|
file?: string;
|
|
15
|
+
/** Graphify: workspace-relative source file. */
|
|
16
|
+
source_file?: string;
|
|
17
|
+
/** Graphify: e.g. "L4". */
|
|
18
|
+
source_location?: string;
|
|
10
19
|
[key: string]: unknown;
|
|
11
20
|
}
|
|
12
21
|
export interface RawGraphEdge {
|
|
@@ -16,6 +25,7 @@ export interface RawGraphEdge {
|
|
|
16
25
|
type?: string;
|
|
17
26
|
label?: string;
|
|
18
27
|
weight?: number;
|
|
28
|
+
confidence?: string;
|
|
19
29
|
[key: string]: unknown;
|
|
20
30
|
}
|
|
21
31
|
export interface RawGraphData {
|
|
@@ -30,6 +40,10 @@ export interface TracedNode {
|
|
|
30
40
|
type: string;
|
|
31
41
|
path: string | null;
|
|
32
42
|
symbol: string | null;
|
|
43
|
+
/** Raw location string from the graph (e.g. "L4"), when present. */
|
|
44
|
+
sourceLocation: string | null;
|
|
45
|
+
/** 1-based line parsed from sourceLocation; null when absent or malformed. */
|
|
46
|
+
line: number | null;
|
|
33
47
|
depth: number;
|
|
34
48
|
status: NodeVerificationStatus;
|
|
35
49
|
fileExists: boolean;
|
|
@@ -40,7 +54,14 @@ export interface TracedEdge {
|
|
|
40
54
|
source: string;
|
|
41
55
|
target: string;
|
|
42
56
|
relation: string;
|
|
57
|
+
/** 'verified' only for AST-extracted edges whose endpoints were verified on disk and whose source line (if given) was not contradicted. */
|
|
43
58
|
status: NodeVerificationStatus;
|
|
59
|
+
confidence: EdgeConfidence | null;
|
|
60
|
+
provenance: EdgeProvenance;
|
|
61
|
+
/** Smaller of the two endpoint depths. */
|
|
62
|
+
depth: number;
|
|
63
|
+
/** Whether the edge's own source line (Graphify `source_file`/`source_location`) mentions an endpoint symbol. */
|
|
64
|
+
sourceCheck: 'confirmed' | 'unconfirmed' | 'unavailable';
|
|
44
65
|
}
|
|
45
66
|
export interface GraphStatusResult {
|
|
46
67
|
available: boolean;
|
|
@@ -55,10 +76,14 @@ export interface GraphTraceResult {
|
|
|
55
76
|
available: boolean;
|
|
56
77
|
query: string;
|
|
57
78
|
depth: number;
|
|
79
|
+
maxNodes: number;
|
|
58
80
|
matchedNode: TracedNode | null;
|
|
81
|
+
matchStrength?: MatchStrength;
|
|
59
82
|
totalNodes: number;
|
|
60
83
|
verifiedNodes: number;
|
|
61
84
|
hypothesisNodes: number;
|
|
85
|
+
/** True when the node cap stopped the traversal from including every reachable node within the depth bound. */
|
|
86
|
+
truncated: boolean;
|
|
62
87
|
nodes: TracedNode[];
|
|
63
88
|
edges: TracedEdge[];
|
|
64
89
|
warnings: string[];
|
|
@@ -73,6 +98,8 @@ export declare function getGraphPath(root: string): string;
|
|
|
73
98
|
export declare function loadGraphData(root: string): Promise<{
|
|
74
99
|
exists: boolean;
|
|
75
100
|
path: string;
|
|
101
|
+
location: ResolvedGraph['location'];
|
|
102
|
+
conflict?: ResolvedGraph['conflict'];
|
|
76
103
|
data?: {
|
|
77
104
|
nodes: RawGraphNode[];
|
|
78
105
|
edges: RawGraphEdge[];
|
|
@@ -82,21 +109,61 @@ export declare function loadGraphData(root: string): Promise<{
|
|
|
82
109
|
* Reports the presence, size, and basic schema health of the Graphify graph.
|
|
83
110
|
*/
|
|
84
111
|
export declare function getGraphStatusService(o: ServiceOptions): Promise<GraphStatusResult>;
|
|
112
|
+
export type MatchStrength = 'exact' | 'strong' | 'weak';
|
|
113
|
+
export interface NormalizedNode {
|
|
114
|
+
/** Workspace-relative POSIX path, or null when absent/unsafe. */
|
|
115
|
+
relPath: string | null;
|
|
116
|
+
symbol: string | null;
|
|
117
|
+
sourceLocation: string | null;
|
|
118
|
+
line: number | null;
|
|
119
|
+
/** Set when a path was declared but rejected (absolute, traversal, malformed). */
|
|
120
|
+
invalidPath?: string;
|
|
121
|
+
}
|
|
122
|
+
/** Parses "L4", "L4-L9", "4" or "4:2" into a 1-based line; null for anything else. */
|
|
123
|
+
export declare function parseSourceLocation(loc: unknown): number | null;
|
|
85
124
|
/**
|
|
86
|
-
*
|
|
125
|
+
* Normalizes any supported node shape (Graphify `source_file`/`label`/`source_location`,
|
|
126
|
+
* or older `path`/`file`/`name` and `file::symbol` ids) into one representation.
|
|
87
127
|
*/
|
|
128
|
+
export declare function normalizeNode(node: RawGraphNode): NormalizedNode;
|
|
129
|
+
/** Extracts a candidate file path and symbol from a node definition. */
|
|
88
130
|
export declare function extractPathAndSymbol(node: RawGraphNode): {
|
|
89
131
|
relPath: string | null;
|
|
90
132
|
symbol: string | null;
|
|
91
133
|
};
|
|
134
|
+
/** Verifies whether a node's physical path and symbol exist on disk. */
|
|
135
|
+
export declare function verifyNode(root: string, node: RawGraphNode, depth: number): Promise<TracedNode>;
|
|
136
|
+
/** Splits identifiers, paths and prose into lower-case tokens (camelCase, snake_case, kebab-case, dots, slashes). */
|
|
137
|
+
export declare function tokenize(text: string): string[];
|
|
138
|
+
export interface RankedNode {
|
|
139
|
+
node: RawGraphNode;
|
|
140
|
+
score: number;
|
|
141
|
+
strength: MatchStrength;
|
|
142
|
+
reasons: string[];
|
|
143
|
+
}
|
|
144
|
+
export interface RankOptions {
|
|
145
|
+
/** Lower-weight terms, e.g. synonym expansions of the query. */
|
|
146
|
+
extraTerms?: string[];
|
|
147
|
+
/** Terms that name the project/package and must not act as domain terms. */
|
|
148
|
+
ignoreTerms?: string[];
|
|
149
|
+
limit?: number;
|
|
150
|
+
}
|
|
92
151
|
/**
|
|
93
|
-
*
|
|
152
|
+
* Deterministic relevance ranking. Whole-token matches on labels and paths score; arbitrary substrings do not,
|
|
153
|
+
* so "erp" cannot select "PageHeaderProps". Ties break on score, shorter label, then id.
|
|
94
154
|
*/
|
|
155
|
+
export declare function rankGraphNodes(nodes: RawGraphNode[], query: string, opts?: RankOptions): RankedNode[];
|
|
156
|
+
/** Finds the best starting node for a query, or null when nothing relevant matches. */
|
|
95
157
|
export declare function findMatchingStartNode(nodes: RawGraphNode[], query: string): RawGraphNode | null;
|
|
158
|
+
/**
|
|
159
|
+
* Direct edges touching the matched nodes. `relevance` maps matched node id -> match score. Order: stronger evidence
|
|
160
|
+
* (EXTRACTED first), then edges whose endpoints are more relevant to the task, then a deterministic id tie-break.
|
|
161
|
+
*/
|
|
162
|
+
export declare function topEdgesFor(relevance: Map<string, number>, edges: RawGraphEdge[], limit: number): TracedEdge[];
|
|
96
163
|
/**
|
|
97
164
|
* Performs a bounded graph trace starting from a specified file or symbol node up to maxDepth.
|
|
98
|
-
*
|
|
99
|
-
*
|
|
165
|
+
* Breadth-first; the node cap is enforced during neighbour expansion, so a high-degree hub cannot overshoot it.
|
|
166
|
+
* Within a node, neighbours are admitted by evidence strength (EXTRACTED before INFERRED), then id.
|
|
100
167
|
*/
|
|
101
168
|
export declare function traceGraphService(o: ServiceOptions, query: string, options?: {
|
|
102
169
|
depth?: number;
|