devworkspace 0.4.2 → 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 +51 -0
- package/README.md +299 -27
- package/dist/cli/args.d.ts +9 -0
- package/dist/cli/args.js +3 -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 +42 -17
- 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 +97 -2
- package/dist/mcp/setup.js +280 -67
- package/dist/mcp/setup.js.map +1 -1
- package/dist/mcp/tools.d.ts +6 -0
- package/dist/mcp/tools.js +140 -18
- 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 +139 -0
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/graph.d.ts +77 -3
- package/dist/services/graph.js +336 -185
- package/dist/services/graph.js.map +1 -1
- package/dist/services/init.js +5 -1
- package/dist/services/init.js.map +1 -1
- package/dist/services/setup.js +4 -0
- package/dist/services/setup.js.map +1 -1
- package/dist/services/taskContext.d.ts +24 -2
- package/dist/services/taskContext.js +72 -26
- package/dist/services/taskContext.js.map +1 -1
- package/dist/tasks/routing.js +4 -1
- package/dist/tasks/routing.js.map +1 -1
- package/docs/agents.md +18 -4
- package/docs/claude.md +13 -0
- package/docs/getting-started.md +40 -1
- package/docs/integrations.md +16 -1
- package/docs/mcp.md +46 -14
- package/docs/troubleshooting.md +5 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskContext.js","sourceRoot":"","sources":["../../src/services/taskContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAgC,MAAM,sBAAsB,CAAC;AACtG,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAGzE,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,aAAmC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AA6CD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC;IACnB,KAAK,EAAE,KAAK,EAAE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UAAU;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzD,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;YAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,IAAI,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,QAAQ,IAAI,EAAE;QAClB,MAAM,EAAE,wBAAwB,IAAI,4CAA4C;KACjF,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,IAAI;QACP,IAAI;QACJ,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,eAAe;QAC1B,KAAK,EAAE,YAAY;QACnB,QAAQ;QACR,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACpD,SAAS,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC7D,SAAS,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC9D;QACD,YAAY;QACZ,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { SCHEMA_VERSION, validateCommands, type CommandEntry, type Fact } from '../config/schemas.js';\nimport { loadProject, requireWorkspace } from '../core/workspace.js';\nimport { readVersioned } from '../core/versioned.js';\nimport { listDecisions } from '../decisions/decision.js';\nimport { loadFacts } from '../knowledge/facts.js';\nimport { classifyRequest } from '../tasks/routing.js';\nimport type { TaskType } from '../tasks/task.js';\nimport { pathExists } from '../utils/fs.js';\nimport { classifyCommand, readManifestEvidence } from '../verification/safety.js';\nimport { dirtyFiles, packageDirs } from '../verification/scope.js';\nimport { SAFETY_RULES, type ContextResult } from './knowledge.js';\nimport type { ServiceOptions } from './common.js';\nimport { loadFeatures } from './features.js';\nimport { loadGraphData, findMatchingStartNode } from './graph.js';\n\nexport const CONTEXT_ROLES = ['explorer', 'tester', 'reviewer'] as const;\nexport type ContextRole = (typeof CONTEXT_ROLES)[number];\n\nexport function isContextRole(v: unknown): v is ContextRole {\n return typeof v === 'string' && (CONTEXT_ROLES as readonly string[]).includes(v);\n}\n\nexport interface ContextItem {\n kind: 'fact' | 'check' | 'decision' | 'document' | 'rule';\n id: string;\n /** Why this item is in the context; every item carries one. */\n reason: string;\n}\n\nexport interface TaskContextResult {\n project: { name: string; id: string };\n request: string;\n type: TaskType;\n confidence: 'high' | 'low';\n readOnly: boolean;\n /** `clipped` = characters left out of a long detector-derived value; the full value is in facts.json. */\n facts: (Fact & { clipped?: number })[];\n /** Detector facts folded into another fact with the identical value; nothing is deleted from facts.json. */\n aliases: { key: string; sameAs: string }[];\n checks: CommandEntry[];\n safety: ContextResult['safety'];\n rules: string[];\n decisions: { number: number; title: string; status: string; file: string }[];\n /** Detailed documents are referenced by name, never embedded. */\n documents: { name: string; bytes: number }[];\n packages: string[];\n included: ContextItem[];\n counts: { facts: [number, number]; checks: [number, number]; decisions: [number, number]; documents: [number, number] };\n role?: ContextRole;\n roleGuidance?: string[];\n roleFindings?: {\n entryPoints?: string[];\n graphNodes?: { id: string; status: string; path: string | null; symbol: string | null }[];\n features?: {\n id: string;\n name: string;\n status?: string;\n components?: { type: string; path: string; symbol?: string }[];\n }[];\n testFrameworks?: string[];\n zeroTestSafeguards?: string[];\n diffNotice?: string;\n };\n}\n\nconst STOP = new Set([\n 'the', 'and', 'for', 'with', 'that', 'this', 'from', 'into', 'does', 'how',\n 'what', 'where', 'why', 'when', 'which', 'fix', 'add', 'bug', 'make', 'new',\n 'can', 'are', 'not', 'our', 'all', 'use', 'get', 'set', 'let', 'may'\n]);\nconst WEAK_TERMS = new Set(['error', 'errors', 'check', 'checks', 'data', 'improve', 'update', 'run', 'test', 'handle', 'handling', 'code']);\nconst PATH_STRUCTURAL_TERMS = new Set([\n 'backend', 'frontend', 'service', 'services', 'controller', 'controllers',\n 'worker', 'workers', 'dto', 'dtos', 'src', 'modules', 'app', 'tests',\n 'unit', 'integration', 'test', 'spec', 'ts', 'tsx', 'js', 'jsx', 'json', 'md'\n]);\nconst CLIP = 400;\nconst SECURITY_WORDS = /auth|tenant|permission|rbac|security|isolation|role|session|ownership/i;\nconst ISSUE_KEY = /^(?:issue|limit|known|bug|risk)/i;\n/** Facts that describe the stack and layout; implementation-style tasks need them, a lookup question does not. */\nconst STACK_KEY = /^(?:stack\\.|repo\\.packages|repo\\.monorepo|repo\\.entry-points|convention|style|arch|pattern|testing)/i;\nconst BROAD_TYPES: TaskType[] = ['FEATURE', 'REFACTOR', 'ARCHITECTURE', 'TESTING', 'PERFORMANCE', 'MAINTENANCE', 'RELEASE'];\n\n/** Normalizes words by stripping standard English inflectional suffixes deterministically. */\nfunction normalizeStem(w: string): string {\n const s = w.toLowerCase().trim();\n if (s.endsWith('ies') && s.length > 4) return s.slice(0, -3) + 'y';\n if (s.endsWith('es') && s.length > 4 && /[sxz]|ch|sh$/.test(s.slice(0, -2))) return s.slice(0, -2);\n if (s.endsWith('s') && s.length > 3 && !s.endsWith('ss')) return s.slice(0, -1);\n if (s.endsWith('ing') && s.length > 5) return s.slice(0, -3);\n if (s.endsWith('tion') && s.length > 6) return s.slice(0, -4);\n if (s.endsWith('ed') && s.length > 4) return s.slice(0, -2);\n return s;\n}\n\n/** Explicit domain synonym dictionary grounded in engineering tasks and repository knowledge. */\nconst DOMAIN_SYNONYMS: Record<string, string[]> = {\n // Database, migrations, schema and persistence\n table: ['database', 'schema', 'orm', 'migration', 'sql'],\n column: ['database', 'schema', 'migration', 'sql'],\n schema: ['database', 'orm', 'migration', 'sql', 'drizzle', 'postgres'],\n migration: ['database', 'schema', 'migrate', 'sql', 'drizzle'],\n migrate: ['database', 'schema', 'migration', 'sql'],\n sql: ['database', 'postgres', 'drizzle', 'query'],\n db: ['database', 'postgres', 'drizzle', 'orm'],\n database: ['db', 'schema', 'orm', 'postgres', 'drizzle'],\n drizzle: ['database', 'orm', 'schema'],\n postgres: ['database', 'sql'],\n\n // Authentication, tenancy, and authorization\n auth: ['jwt', 'session', 'security', 'tenant', 'permission'],\n jwt: ['auth', 'session', 'token', 'security'],\n password: ['hash', 'argon2', 'auth', 'security'],\n hash: ['password', 'argon2', 'security'],\n tenant: ['tenancy', 'isolation', 'security', 'auth'],\n tenancy: ['tenant', 'isolation', 'security'],\n isolation: ['tenant', 'tenancy', 'security'],\n\n // Billing and financial\n invoice: ['billing', 'cents', 'precision'],\n billing: ['invoice', 'cents', 'precision'],\n cents: ['billing', 'invoice', 'precision'],\n payment: ['stripe', 'gateway'],\n\n // API, HTTP, and Backend Services\n endpoint: ['api', 'controller', 'service', 'dto'],\n api: ['endpoint', 'controller', 'service', 'dto'],\n supplier: ['supplier', 'dto', 'service'],\n controller: ['service', 'dto', 'api', 'endpoint'],\n dto: ['validation', 'typebox', 'schema', 'controller'],\n\n // Frontend and UI\n component: ['ui', 'frontend', 'page', 'react'],\n pagination: ['ui', 'component', 'frontend', 'table'],\n frontend: ['ui', 'component', 'react'],\n ui: ['component', 'frontend', 'react'],\n react: ['ui', 'component', 'frontend'],\n\n // Inventory and Stock\n stock: ['inventory', 'product', 'service'],\n inventory: ['stock', 'product', 'service'],\n product: ['inventory', 'stock', 'service'],\n sku: ['product', 'inventory', 'barcode'],\n barcode: ['sku', 'product', 'inventory']\n};\n\n/** Extracts words from text without punctuation. */\nexport const words = (text: string): string[] =>\n [...new Set((text.toLowerCase().match(/[a-z0-9_][a-z0-9_.-]{1,}/g) ?? []).filter((w) => !STOP.has(w)))].sort();\n\n/** Expands terms using word stemming and explicit domain synonym clusters. */\nexport function expandQueryTerms(rawWords: string[]): string[] {\n const expanded = new Set<string>(rawWords);\n for (const w of rawWords) {\n const stem = normalizeStem(w);\n if (stem.length >= 2) expanded.add(stem);\n const syns = DOMAIN_SYNONYMS[w] ?? DOMAIN_SYNONYMS[stem];\n if (syns) {\n for (const s of syns) expanded.add(s);\n }\n }\n return [...expanded].sort();\n}\n\n/** Matches terms against text with token/boundary precision. */\nexport function matchesQuery(text: string, terms: string[]): string[] {\n const lower = text.toLowerCase();\n const matched: string[] = [];\n for (const term of terms) {\n if (term.includes('.') || term.includes('/')) {\n if (lower.includes(term)) matched.push(term);\n } else {\n const re = new RegExp(`(?:^|[\\\\s._/:-])${term}(?:$|[\\\\s._/:-])`, 'i');\n if (re.test(lower)) matched.push(term);\n }\n }\n return matched;\n}\n\nconst norm = (s: string): string => s.toLowerCase().replace(/\\s+/g, ' ').trim();\n\n/** Which context documents are worth pointing at for a task type. */\nconst DOCS_BY_TYPE: Partial<Record<TaskType, string[]>> = {\n ARCHITECTURE: ['architecture.md', 'integrations.md'],\n REFACTOR: ['architecture.md', 'conventions.md'],\n FEATURE: ['architecture.md', 'conventions.md'],\n BUG: ['testing.md'],\n TESTING: ['testing.md'],\n SECURITY: ['testing.md', 'architecture.md'],\n PERFORMANCE: ['architecture.md'],\n RELEASE: ['testing.md'],\n};\n\n/**\n * Task-aware context. Selection is deterministic (sorted inputs, no clocks, no randomness) and rule-based: the request is\n * classified, its keywords select facts/decisions/packages, and the type decides which broader groups come along.\n * Safety rules are included for every type; the per-package \"not run automatically\" list whenever checks are included.\n */\nexport async function buildBaseTaskContext(o: ServiceOptions, request: string): Promise<TaskContextResult> {\n const ws = await requireWorkspace(o.cwd);\n const project = await loadProject(ws);\n const cls = classifyRequest(request);\n const type = cls.type;\n const kw = words(request);\n const expandedTerms = expandQueryTerms(kw);\n const included: ContextItem[] = [];\n const hit = (text: string): string[] => matchesQuery(text, expandedTerms);\n\n // Packages and the testing contract\n let allChecks: CommandEntry[] = [];\n if (await pathExists(ws.commands)) allChecks = (await readVersioned(ws.commands, 'commands', SCHEMA_VERSION, validateCommands)).data.checks;\n const pkgReason = new Map<string, string>();\n for (const d of packageDirs(allChecks)) {\n const m = matchesQuery(request, [d]);\n if (m.length > 0) pkgReason.set(d, `request names \"${m[0]}\"`);\n }\n\n // Enhanced package discovery from domain context when not explicitly named\n if (pkgReason.size === 0 && packageDirs(allChecks).length > 1) {\n const hasBackend = matchesQuery(request, ['api', 'endpoint', 'endpoints', 'controller', 'controllers', 'dto', 'dtos', 'database', 'migration', 'migrations', 'migrate', 'sql', 'postgres', 'drizzle', 'orm', 'fastify', 'server', 'jwt', 'argon2', 'service', 'services', 'invoice']).length > 0;\n const hasFrontend = matchesQuery(request, ['ui', 'component', 'components', 'frontend', 'page', 'pages', 'pagination', 'react', 'vite', 'view', 'views', 'button', 'modal']).length > 0;\n const available = packageDirs(allChecks);\n if (hasBackend && !hasFrontend && available.includes('backend')) {\n pkgReason.set('backend', 'inferred from backend domain terminology');\n } else if (hasFrontend && !hasBackend && available.includes('frontend')) {\n pkgReason.set('frontend', 'inferred from frontend UI terminology');\n } else if (hasBackend && hasFrontend) {\n if (available.includes('backend')) pkgReason.set('backend', 'request spans backend');\n if (available.includes('frontend')) pkgReason.set('frontend', 'request spans frontend');\n }\n }\n\n // dirtyFiles already leaves out documentation and tool-managed files, so a docs-only change selects no package.\n // Only worth the Git calls when the request did not already pick a package and there is more than one to choose from.\n const dirty = type !== 'QUESTION' && type !== 'DOCUMENTATION' && pkgReason.size === 0 && packageDirs(allChecks).length > 1 ? await dirtyFiles(ws.root) : null;\n for (const f of Object.keys(dirty?.files ?? {})) {\n const d = packageDirs(allChecks).find((x) => f === x || f.startsWith(`${x}/`));\n if (d && !pkgReason.has(d)) pkgReason.set(d, 'has uncommitted code changes');\n }\n\n // Facts\n const all = (await loadFacts(ws)).facts;\n const picked = new Map<string, string>();\n const isSinglePackage = pkgReason.size === 1;\n const targetPkg = isSinglePackage ? [...pkgReason.keys()][0] : null;\n\n for (const f of all) {\n // If request confidently targets a single package, avoid pulling in unrelated package facts\n if (targetPkg === 'backend') {\n if (f.source.startsWith('frontend/') || f.key === 'stack.ui' || f.key.startsWith('convention.frontend')) {\n continue;\n }\n } else if (targetPkg === 'frontend') {\n if (f.source.startsWith('backend/') || f.key === 'stack.database' || f.key === 'stack.orm' || f.key.startsWith('testing.db')) {\n continue;\n }\n }\n\n // Match terms against fact key and value; only match source path against specific non-structural request words\n const mText = hit(`${f.key} ${f.value}`);\n const mSource = matchesQuery(f.source, kw.filter((w) => !PATH_STRUCTURAL_TERMS.has(w)));\n const m = [...new Set([...mText, ...mSource])];\n const nonWeak = m.filter(w => !WEAK_TERMS.has(w));\n if (nonWeak.length > 0) picked.set(f.key, `matches \"${nonWeak.slice(0, 3).join('\", \"')}\"`);\n }\n\n const group = (re: RegExp, why: string, also?: (f: Fact) => boolean): void => {\n for (const f of all) {\n if (picked.has(f.key)) continue;\n if (targetPkg === 'backend' && (f.source.startsWith('frontend/') || f.key === 'stack.ui' || f.key.startsWith('convention.frontend'))) continue;\n if (targetPkg === 'frontend' && (f.source.startsWith('backend/') || f.key === 'stack.database' || f.key === 'stack.orm' || f.key.startsWith('testing.db'))) continue;\n if (re.test(f.key) || also?.(f)) picked.set(f.key, why);\n }\n };\n\n // Package layout facts: include in multi-package/cross-package/uncertain contexts, omit global entry points in single-package tasks\n if (type !== 'QUESTION' && type !== 'DOCUMENTATION') {\n if (!isSinglePackage || type === 'ARCHITECTURE') {\n group(/^repo\\.(?:packages|entry-points|monorepo)$/, `package layout (${type})`);\n }\n }\n\n if (type === 'BUG' || type === 'SECURITY') group(ISSUE_KEY, 'known issue / limitation', (f) => f.status === 'STALE' && f.sourceType !== 'detector');\n\n if (BROAD_TYPES.includes(type)) {\n group(/^stack\\.ecosystem$/, `stack and conventions (${type})`);\n if (targetPkg === 'backend' || !isSinglePackage) {\n group(/^(?:arch\\.modules|convention\\.service-layer)$/, `architecture conventions (${type})`);\n group(/^(?:stack\\.framework|stack\\.database|stack\\.orm)$/, `backend stack (${type})`);\n }\n if (targetPkg === 'frontend' || !isSinglePackage) {\n group(/^(?:convention\\.frontend-components|stack\\.ui)$/, `frontend stack (${type})`);\n }\n }\n\n if (type === 'SECURITY') group(/^$/, 'security / authorization rule', (f) => SECURITY_WORDS.test(`${f.key} ${f.value}`));\n if (type === 'DOCUMENTATION') group(/^repo\\.docs$/, 'documentation index');\n const selected = all.filter((f) => picked.has(f.key));\n\n // Compaction: a detector fact whose value equals another selected fact's is folded into it. Human-authored facts are never folded or clipped.\n const aliases: TaskContextResult['aliases'] = [];\n const owners = new Map<string, string>();\n for (const f of [...selected].sort((a, b) => Number(a.sourceType === 'detector') - Number(b.sourceType === 'detector') || a.key.localeCompare(b.key))) {\n if (!owners.has(norm(f.value))) owners.set(norm(f.value), f.key);\n }\n const facts: TaskContextResult['facts'] = [];\n for (const f of [...selected].sort((a, b) => a.key.localeCompare(b.key))) {\n const owner = owners.get(norm(f.value))!;\n if (owner !== f.key && f.sourceType === 'detector') {\n aliases.push({ key: f.key, sameAs: owner });\n continue;\n }\n const clip = f.sourceType === 'detector' && f.value.length > CLIP;\n facts.push(clip ? { ...f, value: f.value.slice(0, CLIP), clipped: f.value.length - CLIP } : f);\n included.push({ kind: 'fact', id: f.key, reason: picked.get(f.key)! });\n }\n\n const usable = allChecks.filter((c) => c.available);\n const scoped = pkgReason.size > 0 ? usable.filter((c) => !c.cwd || c.cwd === '.' || pkgReason.has(c.cwd)) : usable;\n const checks = type === 'QUESTION' || type === 'DOCUMENTATION' ? [] : scoped;\n for (const c of checks) included.push({ kind: 'check', id: `${c.cwd ?? '.'}:${c.id}`, reason: c.cwd && pkgReason.has(c.cwd) ? `package: ${pkgReason.get(c.cwd)}` : `testing contract (${type})` });\n\n // Commands that must not run unguarded stay visible whenever their package's checks are in play.\n const safety: ContextResult['safety'] = [];\n for (const c of checks) {\n const s = classifyCommand(c, await readManifestEvidence(ws.root, c));\n if (s.safety !== 'safe') safety.push({ package: c.cwd ?? '.', check: c.id, command: c.command, safety: s.safety, reasons: s.reasons });\n }\n SAFETY_RULES.forEach((_, i) => included.push({ kind: 'rule', id: `safety-${i + 1}`, reason: 'safety rule, included in every context' }));\n\n // Decisions: titles, context, decision, consequences, and file references\n const decs = (await listDecisions(ws)).decisions;\n const wantAll = type === 'ARCHITECTURE' || type === 'SECURITY';\n const decisions: TaskContextResult['decisions'] = [];\n for (const d of decs) {\n const fullText = `${d.title} ${d.decision} ${d.context} ${d.consequences} ${d.file}`;\n const m = matchesQuery(fullText, expandedTerms);\n const nonWeak = m.filter(w => !WEAK_TERMS.has(w));\n if (d.status === 'superseded' && nonWeak.length === 0) continue;\n if (nonWeak.length > 0 || wantAll) {\n decisions.push({ number: d.number, title: d.title, status: d.status, file: d.file });\n included.push({ kind: 'decision', id: String(d.number).padStart(4, '0'), reason: nonWeak.length > 0 ? `matches \"${nonWeak[0]}\"` : `${type} tasks review all decisions` });\n }\n }\n\n // Documents: referenced, never embedded\n const documents: TaskContextResult['documents'] = [];\n let docCount = 0;\n if (await pathExists(ws.contextDir)) {\n for (const name of (await fs.readdir(ws.contextDir)).filter((n) => n.endsWith('.md')).sort()) {\n docCount++;\n const byType = (DOCS_BY_TYPE[type] ?? []).includes(name);\n const m = matchesQuery(name, expandedTerms);\n if (byType || m.length > 0) {\n documents.push({ name, bytes: (await fs.stat(path.join(ws.contextDir, name))).size });\n included.push({ kind: 'document', id: name, reason: byType ? `reference for ${type}` : `request names \"${m[0]}\"` });\n }\n }\n }\n\n return {\n project: { name: project.name, id: project.projectId },\n request,\n type,\n confidence: cls.confidence,\n readOnly: cls.readOnly,\n facts,\n aliases,\n checks,\n safety,\n rules: SAFETY_RULES,\n decisions,\n documents,\n packages: [...pkgReason.keys()].sort(),\n included,\n counts: { facts: [facts.length, all.length], checks: [checks.length, usable.length], decisions: [decisions.length, decs.length], documents: [documents.length, docCount] },\n };\n}\n\nexport async function getTaskContext(\n o: ServiceOptions,\n opts: { request: string; role?: ContextRole },\n): Promise<TaskContextResult> {\n const base = await buildBaseTaskContext(o, opts.request);\n if (!opts.role) return base;\n return getAgentContextSlice(o, { request: opts.request, role: opts.role, base });\n}\n\nexport async function getAgentContextSlice(\n o: ServiceOptions,\n opts: { request: string; role: ContextRole; base?: TaskContextResult },\n): Promise<TaskContextResult> {\n const ws = await requireWorkspace(o.cwd);\n const base = opts.base ?? (await buildBaseTaskContext(o, opts.request));\n const role = opts.role;\n const kw = words(opts.request);\n const expandedTerms = expandQueryTerms(kw);\n const hit = (text: string): string[] => matchesQuery(text, expandedTerms);\n\n let slicedFacts = [...base.facts];\n let slicedChecks = [...base.checks];\n let slicedDecisions = [...base.decisions];\n let slicedDocuments = [...base.documents];\n let roleGuidance: string[] = [];\n const roleFindings: NonNullable<TaskContextResult['roleFindings']> = {};\n\n if (role === 'explorer') {\n // Explorer: Prioritize entry points, symbols, features, graph connections.\n // Avoid unrelated test commands, entire file contents, complete repo dumps.\n slicedChecks = [];\n slicedFacts = base.facts.filter((f) => {\n if (/^repo\\.(?:entry-points|packages|monorepo)$/.test(f.key)) return true;\n if (STACK_KEY.test(f.key) && !/^convention\\.test/i.test(f.key)) return true;\n const m = hit(`${f.key} ${f.value}`);\n return m.length > 0 && !/^convention\\.test/i.test(f.key);\n });\n\n slicedDecisions = base.decisions.slice(0, 3);\n slicedDocuments = base.documents.filter((d) => ['architecture.md', 'integrations.md'].includes(d.name));\n\n // Entry points from facts or packages\n const epFact = base.facts.find((f) => f.key === 'repo.entry-points');\n const entryPoints: string[] = [];\n if (epFact && epFact.value) {\n for (const p of epFact.value.split(',').map((x) => x.trim()).filter(Boolean)) {\n if (!entryPoints.includes(p)) entryPoints.push(p);\n }\n }\n if (entryPoints.length === 0 && base.packages.length > 0) {\n entryPoints.push(...base.packages);\n }\n if (entryPoints.length > 0) roleFindings.entryPoints = entryPoints.slice(0, 10);\n\n // Feature knowledge map references\n try {\n const featFile = await loadFeatures(ws);\n const matchedFeats = featFile.features.filter((f) => {\n const text = `${f.id} ${f.name} ${f.description ?? ''} ${(f.tags ?? []).join(' ')}`;\n return hit(text).length > 0;\n });\n if (matchedFeats.length > 0) {\n roleFindings.features = matchedFeats.slice(0, 8).map((f) => ({\n id: f.id,\n name: f.name,\n status: f.status,\n }));\n }\n } catch {\n // Graceful fallback if features file unreadable\n }\n\n // Graphify graph lookup\n try {\n const graph = await loadGraphData(ws.root);\n if (graph.exists && graph.data && graph.data.nodes) {\n const matchedNodes: NonNullable<TaskContextResult['roleFindings']>['graphNodes'] = [];\n for (const w of expandedTerms) {\n const n = findMatchingStartNode(graph.data.nodes, w);\n if (n && !matchedNodes.some((x) => x.id === n.id)) {\n matchedNodes.push({\n id: n.id,\n status: typeof n.status === 'string' ? n.status : 'symbol',\n path: n.path || n.file || null,\n symbol: typeof n.name === 'string' ? n.name : null,\n });\n }\n if (matchedNodes.length >= 6) break;\n }\n if (matchedNodes.length > 0) roleFindings.graphNodes = matchedNodes;\n }\n } catch {\n // Graceful fallback if graph lookup fails\n }\n\n roleGuidance = [\n 'Investigate referenced entry points and feature components before reading full files.',\n 'Trace deep call dependencies with \"devworkspace graph trace <symbol>\".',\n 'Conclude exploration with a concise handoff: identified files, uncertainty, and next step.',\n ];\n } else if (role === 'tester') {\n // Tester: Prioritize test files, test framework conventions, verification contracts, zero-test safeguards.\n slicedFacts = base.facts.filter((f) => {\n if (/^convention\\.test/i.test(f.key) || ISSUE_KEY.test(f.key)) return true;\n if (STACK_KEY.test(f.key) && /test/i.test(f.key + f.value)) return true;\n const m = hit(`${f.key} ${f.value}`.toLowerCase());\n return m.length > 0;\n });\n\n slicedChecks = base.checks;\n slicedDocuments = base.documents.filter((d) => d.name === 'testing.md');\n slicedDecisions = base.decisions.filter((d) => /test|verify|quality/i.test(d.title));\n\n roleFindings.zeroTestSafeguards = [\n 'Zero-test pass detection active across Vitest, Jest, Pytest, Mocha, Go, and Cargo.',\n 'Commands exiting code 0 with 0 tests executed are classified as unverified false passes.',\n 'Record baseline before modifications: devworkspace task tests <id> --phase baseline --passed <n> --failed <n>.',\n \"Execute verification via 'devworkspace task run <id> <check>'.\",\n ];\n\n roleGuidance = [\n 'Verify required contract commands for affected packages before claiming completion.',\n 'Write focused regression tests covering defect reproduction or feature acceptance criteria.',\n 'Never run destructive commands or test suites touching unmanaged databases without \"testenv declare\".',\n ];\n } else if (role === 'reviewer') {\n // Reviewer: Prioritize git diff/changed files, permanent safety rules, ADRs, potential regressions.\n slicedFacts = base.facts.filter((f) => {\n if (SECURITY_WORDS.test(`${f.key} ${f.value}`)) return true;\n if (/^convention\\./i.test(f.key)) return true;\n const m = hit(`${f.key} ${f.value}`.toLowerCase());\n return m.length > 0;\n });\n\n // Keep review-relevant checks (lint, typecheck, review, and test suites)\n if (base.checks.length > 0) {\n slicedChecks = base.checks.filter((c) => /lint|typecheck|review|test/i.test(c.id));\n } else {\n try {\n if (await pathExists(ws.commands)) {\n const contract = (await readVersioned(ws.commands, 'commands', SCHEMA_VERSION, validateCommands)).data.checks;\n const usable = contract.filter((c) => c.available && /lint|typecheck|review|test/i.test(c.id));\n slicedChecks = base.packages.length > 0\n ? usable.filter((c) => !c.cwd || c.cwd === '.' || base.packages.includes(c.cwd))\n : usable;\n }\n } catch {\n slicedChecks = [];\n }\n }\n slicedDecisions = base.decisions;\n slicedDocuments = base.documents.filter((d) => ['conventions.md', 'architecture.md'].includes(d.name));\n\n try {\n const dirty = await dirtyFiles(ws.root);\n const dirtyList = dirty ? Object.keys(dirty.files) : [];\n if (dirtyList.length > 0) {\n const preview = dirtyList.slice(0, 5).join(', ') + (dirtyList.length > 5 ? ` (+${dirtyList.length - 5} more)` : '');\n roleFindings.diffNotice = `${dirtyList.length} uncommitted file(s) detected: ${preview}. Inspect exact diff with \"git diff\".`;\n } else {\n roleFindings.diffNotice = 'No uncommitted changes detected in working tree. When reviewing a branch or PR, the caller must supply the target diff or commit range.';\n }\n } catch {\n roleFindings.diffNotice = 'Could not inspect git working tree status. The caller must supply the diff or commit range.';\n }\n\n roleGuidance = [\n 'Audit diff against permanent SAFETY_RULES (no secrets in code/logs, no path traversals, untrusted commands).',\n 'Verify changes strictly comply with recorded decisions (ADRs) and feature contracts.',\n 'Ensure required verification checks have executed results before approving the completion gate.',\n ];\n }\n\n const factKeys = new Set(slicedFacts.map((f) => f.key));\n const checkIds = new Set(slicedChecks.map((c) => `${c.cwd ?? '.'}:${c.id}`));\n const decIds = new Set(slicedDecisions.map((d) => String(d.number).padStart(4, '0')));\n const docNames = new Set(slicedDocuments.map((d) => d.name));\n\n const included: ContextItem[] = base.included.filter((item) => {\n if (item.kind === 'rule') return true;\n if (item.kind === 'fact') return factKeys.has(item.id);\n if (item.kind === 'check') return checkIds.has(item.id);\n if (item.kind === 'decision') return decIds.has(item.id);\n if (item.kind === 'document') return docNames.has(item.id);\n return false;\n });\n\n included.push({\n kind: 'rule',\n id: `role:${role}`,\n reason: `context tailored for ${role} role (Phase 1 role-based context slicing)`,\n });\n\n return {\n ...base,\n role,\n facts: slicedFacts,\n checks: slicedChecks,\n decisions: slicedDecisions,\n documents: slicedDocuments,\n rules: SAFETY_RULES,\n included,\n counts: {\n facts: [slicedFacts.length, base.counts.facts[1]],\n checks: [slicedChecks.length, base.counts.checks[1]],\n decisions: [slicedDecisions.length, base.counts.decisions[1]],\n documents: [slicedDocuments.length, base.counts.documents[1]],\n },\n roleGuidance,\n roleFindings,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"taskContext.js","sourceRoot":"","sources":["../../src/services/taskContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAgC,MAAM,sBAAsB,CAAC;AACtG,OAAO,EAAE,WAAW,EAAE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M,EAAE,wBAAwB,IAAI,4CAA4C;KACjF,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,IAAI;QACP,IAAI;QACJ,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,eAAe;QAC1B,KAAK,EAAE,YAAY;QACnB,QAAQ;QACR,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACpD,SAAS,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC7D,SAAS,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC9D;QACD,YAAY;QACZ,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { SCHEMA_VERSION, validateCommands, type CommandEntry, type Fact } from '../config/schemas.js';\nimport { loadProject, requireWorkspace } from '../core/workspace.js';\nimport { readVersioned } from '../core/versioned.js';\nimport { listDecisions } from '../decisions/decision.js';\nimport { loadFacts } from '../knowledge/facts.js';\nimport { classifyRequest } from '../tasks/routing.js';\nimport type { TaskType } from '../tasks/task.js';\nimport { pathExists } from '../utils/fs.js';\nimport { classifyCommand, readManifestEvidence } from '../verification/safety.js';\nimport { dirtyFiles, packageDirs } from '../verification/scope.js';\nimport { SAFETY_RULES, type ContextResult } from './knowledge.js';\nimport type { ServiceOptions } from './common.js';\nimport { loadFeatures } from './features.js';\nimport { loadGraphData, rankGraphNodes, verifyNode, topEdgesFor } from './graph.js';\n\nexport const CONTEXT_ROLES = ['explorer', 'tester', 'reviewer'] as const;\nexport type ContextRole = (typeof CONTEXT_ROLES)[number];\n\nexport function isContextRole(v: unknown): v is ContextRole {\n return typeof v === 'string' && (CONTEXT_ROLES as readonly string[]).includes(v);\n}\n\nexport interface ContextItem {\n kind: 'fact' | 'check' | 'decision' | 'document' | 'rule';\n id: string;\n /** Why this item is in the context; every item carries one. */\n reason: string;\n}\n\nexport interface TaskContextResult {\n project: { name: string; id: string };\n request: string;\n type: TaskType;\n confidence: 'high' | 'low';\n readOnly: boolean;\n /** `clipped` = characters left out of a long detector-derived value; the full value is in facts.json. */\n facts: (Fact & { clipped?: number })[];\n /** Detector facts folded into another fact with the identical value; nothing is deleted from facts.json. */\n aliases: { key: string; sameAs: string }[];\n checks: CommandEntry[];\n safety: ContextResult['safety'];\n rules: string[];\n decisions: { number: number; title: string; status: string; file: string }[];\n /** Detailed documents are referenced by name, never embedded. */\n documents: { name: string; bytes: number }[];\n packages: string[];\n included: ContextItem[];\n counts: { facts: [number, number]; checks: [number, number]; decisions: [number, number]; documents: [number, number] };\n role?: ContextRole;\n roleGuidance?: string[];\n roleFindings?: {\n entryPoints?: string[];\n graphNodes?: {\n id: string;\n /** Graph node type (class, function, file...), not a verification state. */\n nodeType: string;\n /** Source verification: 'verified' = file and symbol confirmed on disk; 'unverified' = graph claim only. */\n status: 'verified' | 'unverified';\n path: string | null;\n /** Present only when it is not already the tail of `id`. */\n symbol?: string;\n sourceLocation?: string;\n line?: number;\n /** Set only for weak matches: treat as a lead to confirm, not an answer. */\n weak?: true;\n /** Strongest reason this node matched the request. */\n why: string;\n reason?: string;\n }[];\n /** Direct graph edges around the matched nodes; `provenance` says whether the edge is AST-extracted or inferred. */\n graphRelationships?: { source: string; target: string; relation: string; confidence: 'EXTRACTED' | 'INFERRED' | null }[];\n graphNotice?: string;\n features?: {\n id: string;\n name: string;\n status?: string;\n components?: { type: string; path: string; symbol?: string }[];\n }[];\n testFrameworks?: string[];\n zeroTestSafeguards?: string[];\n diffNotice?: string;\n };\n}\n\nexport const STOP = new Set([\n 'the', 'and', 'for', 'with', 'that', 'this', 'from', 'into', 'does', 'how',\n 'what', 'where', 'why', 'when', 'which', 'fix', 'add', 'bug', 'make', 'new',\n 'can', 'are', 'not', 'our', 'all', 'use', 'get', 'set', 'let', 'may',\n 'to', 'in', 'of', 'at', 'by', 'on', 'as', 'an', 'a', 'or', 'is', 'it', 'be', 'so'\n]);\nexport const WEAK_TERMS = new Set(['error', 'errors', 'check', 'checks', 'data', 'improve', 'update', 'run', 'test', 'handle', 'handling', 'code']);\nexport const PATH_STRUCTURAL_TERMS = new Set([\n 'backend', 'frontend', 'service', 'services', 'controller', 'controllers',\n 'worker', 'workers', 'dto', 'dtos', 'src', 'modules', 'app', 'tests',\n 'unit', 'integration', 'test', 'spec', 'ts', 'tsx', 'js', 'jsx', 'json', 'md'\n]);\nconst CLIP = 400;\nconst SECURITY_WORDS = /auth|tenant|permission|rbac|security|isolation|role|session|ownership/i;\nconst ISSUE_KEY = /^(?:issue|limit|known|bug|risk)/i;\n/** Facts that describe the stack and layout; implementation-style tasks need them, a lookup question does not. */\nconst STACK_KEY = /^(?:stack\\.|repo\\.packages|repo\\.monorepo|repo\\.entry-points|convention|style|arch|pattern|testing)/i;\nconst BROAD_TYPES: TaskType[] = ['FEATURE', 'REFACTOR', 'ARCHITECTURE', 'TESTING', 'PERFORMANCE', 'MAINTENANCE', 'RELEASE'];\n\n/** Normalizes words by stripping standard English inflectional suffixes deterministically. */\nfunction normalizeStem(w: string): string {\n const s = w.toLowerCase().trim();\n if (s.endsWith('ies') && s.length > 4) return s.slice(0, -3) + 'y';\n if (s.endsWith('es') && s.length > 4 && /[sxz]|ch|sh$/.test(s.slice(0, -2))) return s.slice(0, -2);\n if (s.endsWith('s') && s.length > 3 && !s.endsWith('ss')) return s.slice(0, -1);\n if (s.endsWith('ing') && s.length > 5) return s.slice(0, -3);\n if (s.endsWith('tion') && s.length > 6) return s.slice(0, -4);\n if (s.endsWith('ed') && s.length > 4) return s.slice(0, -2);\n return s;\n}\n\n/** Explicit domain synonym dictionary grounded in engineering tasks and repository knowledge. */\nconst DOMAIN_SYNONYMS: Record<string, string[]> = {\n // Database, migrations, schema and persistence\n table: ['database', 'schema', 'orm', 'migration', 'sql'],\n column: ['database', 'schema', 'migration', 'sql'],\n schema: ['database', 'orm', 'migration', 'sql', 'drizzle', 'postgres'],\n migration: ['database', 'schema', 'migrate', 'sql', 'drizzle'],\n migrate: ['database', 'schema', 'migration', 'sql'],\n sql: ['database', 'postgres', 'drizzle', 'query'],\n db: ['database', 'postgres', 'drizzle', 'orm'],\n database: ['db', 'schema', 'orm', 'postgres', 'drizzle'],\n drizzle: ['database', 'orm', 'schema'],\n postgres: ['database', 'sql'],\n\n // Authentication, tenancy, and authorization\n auth: ['authentication', 'authenticate', 'login', 'signin', 'sign-in', 'session', 'token', 'jwt', 'security', 'tenant', 'permission'],\n authentication: ['auth', 'authenticate', 'login', 'signin', 'sign-in', 'session', 'token', 'jwt', 'security'],\n authenticate: ['auth', 'authentication', 'login', 'signin', 'session', 'token', 'security'],\n authenticat: ['auth', 'authentication', 'authenticate', 'login', 'session', 'token'],\n authentica: ['auth', 'authentication', 'authenticate', 'login', 'session', 'token'],\n login: ['auth', 'authentication', 'signin', 'sign-in', 'session', 'token', 'jwt'],\n signin: ['login', 'sign-in', 'auth', 'authentication', 'session'],\n 'sign-in': ['login', 'signin', 'auth', 'authentication', 'session'],\n session: ['auth', 'authentication', 'jwt', 'token', 'login'],\n token: ['jwt', 'auth', 'session', 'authentication'],\n jwt: ['auth', 'session', 'token', 'security', 'authentication'],\n password: ['hash', 'argon2', 'auth', 'security'],\n hash: ['password', 'argon2', 'security'],\n tenant: ['tenancy', 'isolation', 'security', 'auth'],\n tenancy: ['tenant', 'isolation', 'security'],\n isolation: ['tenant', 'tenancy', 'security'],\n\n // Billing and financial\n invoice: ['billing', 'cents', 'precision'],\n billing: ['invoice', 'cents', 'precision'],\n cents: ['billing', 'invoice', 'precision'],\n payment: ['stripe', 'gateway'],\n\n // API, HTTP, and Backend Services\n endpoint: ['api', 'controller', 'service', 'dto'],\n api: ['endpoint', 'controller', 'service', 'dto'],\n supplier: ['supplier', 'dto', 'service'],\n controller: ['service', 'dto', 'api', 'endpoint'],\n dto: ['validation', 'typebox', 'schema', 'controller'],\n\n // Frontend and UI\n component: ['ui', 'frontend', 'page', 'react'],\n pagination: ['ui', 'component', 'frontend', 'table'],\n frontend: ['ui', 'component', 'react'],\n ui: ['component', 'frontend', 'react'],\n react: ['ui', 'component', 'frontend'],\n\n // Inventory and Stock\n stock: ['inventory', 'product', 'service'],\n inventory: ['stock', 'product', 'service'],\n product: ['inventory', 'stock', 'service'],\n sku: ['product', 'inventory', 'barcode'],\n barcode: ['sku', 'product', 'inventory']\n};\n\n/** Extracts words from text without punctuation. */\nexport const words = (text: string): string[] => {\n const matches = text.toLowerCase().match(/[a-z0-9_.-]+/g) ?? [];\n const cleaned = matches\n .map((w) => w.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, ''))\n .filter((w) => w.length >= 2 && !STOP.has(w));\n return [...new Set(cleaned)].sort();\n};\n\n/** Expands terms using word stemming and explicit domain synonym clusters. */\nexport function expandQueryTerms(rawWords: string[]): string[] {\n const expanded = new Set<string>(rawWords);\n for (const w of rawWords) {\n if (w.includes('-')) {\n const unhyphenated = w.replace(/-/g, '');\n if (unhyphenated.length >= 2 && !STOP.has(unhyphenated)) expanded.add(unhyphenated);\n }\n const stem = normalizeStem(w);\n if (stem.length >= 2 && !STOP.has(stem)) expanded.add(stem);\n const syns = DOMAIN_SYNONYMS[w] ?? DOMAIN_SYNONYMS[stem];\n if (syns) {\n for (const s of syns) {\n if (!STOP.has(s)) expanded.add(s);\n }\n }\n }\n return [...expanded].sort();\n}\n\n/** Matches terms against text with token/boundary precision. */\nexport function matchesQuery(text: string, terms: string[]): string[] {\n const lower = text.toLowerCase();\n const matched: string[] = [];\n for (const term of terms) {\n if (term.includes('.') || term.includes('/')) {\n if (lower.includes(term)) matched.push(term);\n } else {\n const re = new RegExp(`(?:^|[\\\\s._/:-])${term}(?:$|[\\\\s._/:-])`, 'i');\n if (re.test(lower)) matched.push(term);\n }\n }\n return matched;\n}\n\nconst norm = (s: string): string => s.toLowerCase().replace(/\\s+/g, ' ').trim();\n\n/** Which context documents are worth pointing at for a task type. */\nconst DOCS_BY_TYPE: Partial<Record<TaskType, string[]>> = {\n ARCHITECTURE: ['architecture.md', 'integrations.md'],\n REFACTOR: ['architecture.md', 'conventions.md'],\n FEATURE: ['architecture.md', 'conventions.md'],\n BUG: ['testing.md'],\n TESTING: ['testing.md'],\n SECURITY: ['testing.md', 'architecture.md'],\n PERFORMANCE: ['architecture.md'],\n RELEASE: ['testing.md'],\n};\n\n/**\n * Task-aware context. Selection is deterministic (sorted inputs, no clocks, no randomness) and rule-based: the request is\n * classified, its keywords select facts/decisions/packages, and the type decides which broader groups come along.\n * Safety rules are included for every type; the per-package \"not run automatically\" list whenever checks are included.\n */\nexport async function buildBaseTaskContext(o: ServiceOptions, request: string): Promise<TaskContextResult> {\n const ws = await requireWorkspace(o.cwd);\n const project = await loadProject(ws);\n const cls = classifyRequest(request);\n const type = cls.type;\n const kw = words(request);\n const expandedTerms = expandQueryTerms(kw);\n const included: ContextItem[] = [];\n const hit = (text: string): string[] => matchesQuery(text, expandedTerms);\n\n // Packages and the testing contract\n let allChecks: CommandEntry[] = [];\n if (await pathExists(ws.commands)) allChecks = (await readVersioned(ws.commands, 'commands', SCHEMA_VERSION, validateCommands)).data.checks;\n const pkgReason = new Map<string, string>();\n for (const d of packageDirs(allChecks)) {\n const m = matchesQuery(request, [d]);\n if (m.length > 0) pkgReason.set(d, `request names \"${m[0]}\"`);\n }\n\n // Enhanced package discovery from domain context when not explicitly named\n if (pkgReason.size === 0 && packageDirs(allChecks).length > 1) {\n const hasBackend = matchesQuery(request, ['api', 'endpoint', 'endpoints', 'controller', 'controllers', 'dto', 'dtos', 'database', 'migration', 'migrations', 'migrate', 'sql', 'postgres', 'drizzle', 'orm', 'fastify', 'server', 'jwt', 'argon2', 'service', 'services', 'invoice']).length > 0;\n const hasFrontend = matchesQuery(request, ['ui', 'component', 'components', 'frontend', 'page', 'pages', 'pagination', 'react', 'vite', 'view', 'views', 'button', 'modal']).length > 0;\n const available = packageDirs(allChecks);\n if (hasBackend && !hasFrontend && available.includes('backend')) {\n pkgReason.set('backend', 'inferred from backend domain terminology');\n } else if (hasFrontend && !hasBackend && available.includes('frontend')) {\n pkgReason.set('frontend', 'inferred from frontend UI terminology');\n } else if (hasBackend && hasFrontend) {\n if (available.includes('backend')) pkgReason.set('backend', 'request spans backend');\n if (available.includes('frontend')) pkgReason.set('frontend', 'request spans frontend');\n }\n }\n\n // dirtyFiles already leaves out documentation and tool-managed files, so a docs-only change selects no package.\n // Only worth the Git calls when the request did not already pick a package and there is more than one to choose from.\n const dirty = type !== 'QUESTION' && type !== 'DOCUMENTATION' && pkgReason.size === 0 && packageDirs(allChecks).length > 1 ? await dirtyFiles(ws.root) : null;\n for (const f of Object.keys(dirty?.files ?? {})) {\n const d = packageDirs(allChecks).find((x) => f === x || f.startsWith(`${x}/`));\n if (d && !pkgReason.has(d)) pkgReason.set(d, 'has uncommitted code changes');\n }\n\n // Facts\n const all = (await loadFacts(ws)).facts;\n const picked = new Map<string, string>();\n const isSinglePackage = pkgReason.size === 1;\n const targetPkg = isSinglePackage ? [...pkgReason.keys()][0] : null;\n\n for (const f of all) {\n // If request confidently targets a single package, avoid pulling in unrelated package facts\n if (targetPkg === 'backend') {\n if (f.source.startsWith('frontend/') || f.key === 'stack.ui' || f.key.startsWith('convention.frontend')) {\n continue;\n }\n } else if (targetPkg === 'frontend') {\n if (f.source.startsWith('backend/') || f.key === 'stack.database' || f.key === 'stack.orm' || f.key.startsWith('testing.db')) {\n continue;\n }\n }\n\n // Match terms against fact key and value; only match source path against specific non-structural request words\n const mText = hit(`${f.key} ${f.value}`);\n const mSource = matchesQuery(f.source, kw.filter((w) => !PATH_STRUCTURAL_TERMS.has(w)));\n const m = [...new Set([...mText, ...mSource])];\n const nonWeak = m.filter(w => !WEAK_TERMS.has(w));\n if (nonWeak.length > 0) picked.set(f.key, `matches \"${nonWeak.slice(0, 3).join('\", \"')}\"`);\n }\n\n const group = (re: RegExp, why: string, also?: (f: Fact) => boolean): void => {\n for (const f of all) {\n if (picked.has(f.key)) continue;\n if (targetPkg === 'backend' && (f.source.startsWith('frontend/') || f.key === 'stack.ui' || f.key.startsWith('convention.frontend'))) continue;\n if (targetPkg === 'frontend' && (f.source.startsWith('backend/') || f.key === 'stack.database' || f.key === 'stack.orm' || f.key.startsWith('testing.db'))) continue;\n if (re.test(f.key) || also?.(f)) picked.set(f.key, why);\n }\n };\n\n // Package layout facts: include in multi-package/cross-package/uncertain contexts, omit global entry points in single-package tasks\n if (type !== 'QUESTION' && type !== 'DOCUMENTATION') {\n if (!isSinglePackage || type === 'ARCHITECTURE') {\n group(/^repo\\.(?:packages|entry-points|monorepo)$/, `package layout (${type})`);\n }\n }\n\n if (type === 'BUG' || type === 'SECURITY') group(ISSUE_KEY, 'known issue / limitation', (f) => f.status === 'STALE' && f.sourceType !== 'detector');\n\n if (BROAD_TYPES.includes(type)) {\n group(/^stack\\.ecosystem$/, `stack and conventions (${type})`);\n if (targetPkg === 'backend' || !isSinglePackage) {\n group(/^(?:arch\\.modules|convention\\.service-layer)$/, `architecture conventions (${type})`);\n group(/^(?:stack\\.framework|stack\\.database|stack\\.orm)$/, `backend stack (${type})`);\n }\n if (targetPkg === 'frontend' || !isSinglePackage) {\n group(/^(?:convention\\.frontend-components|stack\\.ui)$/, `frontend stack (${type})`);\n }\n }\n\n if (type === 'SECURITY') group(/^$/, 'security / authorization rule', (f) => SECURITY_WORDS.test(`${f.key} ${f.value}`));\n if (type === 'DOCUMENTATION') group(/^repo\\.docs$/, 'documentation index');\n const selected = all.filter((f) => picked.has(f.key));\n\n // Compaction: a detector fact whose value equals another selected fact's is folded into it. Human-authored facts are never folded or clipped.\n const aliases: TaskContextResult['aliases'] = [];\n const owners = new Map<string, string>();\n for (const f of [...selected].sort((a, b) => Number(a.sourceType === 'detector') - Number(b.sourceType === 'detector') || a.key.localeCompare(b.key))) {\n if (!owners.has(norm(f.value))) owners.set(norm(f.value), f.key);\n }\n const facts: TaskContextResult['facts'] = [];\n for (const f of [...selected].sort((a, b) => a.key.localeCompare(b.key))) {\n const owner = owners.get(norm(f.value))!;\n if (owner !== f.key && f.sourceType === 'detector') {\n aliases.push({ key: f.key, sameAs: owner });\n continue;\n }\n const clip = f.sourceType === 'detector' && f.value.length > CLIP;\n facts.push(clip ? { ...f, value: f.value.slice(0, CLIP), clipped: f.value.length - CLIP } : f);\n included.push({ kind: 'fact', id: f.key, reason: picked.get(f.key)! });\n }\n\n const usable = allChecks.filter((c) => c.available);\n const scoped = pkgReason.size > 0 ? usable.filter((c) => !c.cwd || c.cwd === '.' || pkgReason.has(c.cwd)) : usable;\n const checks = type === 'QUESTION' || type === 'DOCUMENTATION' ? [] : scoped;\n for (const c of checks) included.push({ kind: 'check', id: `${c.cwd ?? '.'}:${c.id}`, reason: c.cwd && pkgReason.has(c.cwd) ? `package: ${pkgReason.get(c.cwd)}` : `testing contract (${type})` });\n\n // Commands that must not run unguarded stay visible whenever their package's checks are in play.\n const safety: ContextResult['safety'] = [];\n for (const c of checks) {\n const s = classifyCommand(c, await readManifestEvidence(ws.root, c));\n if (s.safety !== 'safe') safety.push({ package: c.cwd ?? '.', check: c.id, command: c.command, safety: s.safety, reasons: s.reasons });\n }\n SAFETY_RULES.forEach((_, i) => included.push({ kind: 'rule', id: `safety-${i + 1}`, reason: 'safety rule, included in every context' }));\n\n // Decisions: titles, context, decision, consequences, and file references\n const decs = (await listDecisions(ws)).decisions;\n const wantAll = type === 'ARCHITECTURE' || type === 'SECURITY';\n const decisions: TaskContextResult['decisions'] = [];\n for (const d of decs) {\n const fullText = `${d.title} ${d.decision} ${d.context} ${d.consequences} ${d.file}`;\n const m = matchesQuery(fullText, expandedTerms);\n const nonWeak = m.filter(w => !WEAK_TERMS.has(w));\n if (d.status === 'superseded' && nonWeak.length === 0) continue;\n if (nonWeak.length > 0 || wantAll) {\n decisions.push({ number: d.number, title: d.title, status: d.status, file: d.file });\n included.push({ kind: 'decision', id: String(d.number).padStart(4, '0'), reason: nonWeak.length > 0 ? `matches \"${nonWeak[0]}\"` : `${type} tasks review all decisions` });\n }\n }\n\n // Documents: referenced, never embedded\n const documents: TaskContextResult['documents'] = [];\n let docCount = 0;\n if (await pathExists(ws.contextDir)) {\n for (const name of (await fs.readdir(ws.contextDir)).filter((n) => n.endsWith('.md')).sort()) {\n docCount++;\n const byType = (DOCS_BY_TYPE[type] ?? []).includes(name);\n const m = matchesQuery(name, expandedTerms);\n if (byType || m.length > 0) {\n documents.push({ name, bytes: (await fs.stat(path.join(ws.contextDir, name))).size });\n included.push({ kind: 'document', id: name, reason: byType ? `reference for ${type}` : `request names \"${m[0]}\"` });\n }\n }\n }\n\n return {\n project: { name: project.name, id: project.projectId },\n request,\n type,\n confidence: cls.confidence,\n readOnly: cls.readOnly,\n facts,\n aliases,\n checks,\n safety,\n rules: SAFETY_RULES,\n decisions,\n documents,\n packages: [...pkgReason.keys()].sort(),\n included,\n counts: { facts: [facts.length, all.length], checks: [checks.length, usable.length], decisions: [decisions.length, decs.length], documents: [documents.length, docCount] },\n };\n}\n\nexport async function getTaskContext(\n o: ServiceOptions,\n opts: { request: string; role?: ContextRole },\n): Promise<TaskContextResult> {\n const base = await buildBaseTaskContext(o, opts.request);\n if (!opts.role) return base;\n return getAgentContextSlice(o, { request: opts.request, role: opts.role, base });\n}\n\nexport async function getAgentContextSlice(\n o: ServiceOptions,\n opts: { request: string; role: ContextRole; base?: TaskContextResult },\n): Promise<TaskContextResult> {\n const ws = await requireWorkspace(o.cwd);\n const base = opts.base ?? (await buildBaseTaskContext(o, opts.request));\n const role = opts.role;\n const kw = words(opts.request);\n const expandedTerms = expandQueryTerms(kw);\n const hit = (text: string): string[] => matchesQuery(text, expandedTerms);\n\n let slicedFacts = [...base.facts];\n let slicedChecks = [...base.checks];\n let slicedDecisions = [...base.decisions];\n let slicedDocuments = [...base.documents];\n let roleGuidance: string[] = [];\n const roleFindings: NonNullable<TaskContextResult['roleFindings']> = {};\n\n if (role === 'explorer') {\n // Explorer: Prioritize entry points, symbols, features, graph connections.\n // Avoid unrelated test commands, entire file contents, complete repo dumps.\n slicedChecks = [];\n slicedFacts = base.facts.filter((f) => {\n if (/^repo\\.(?:entry-points|packages|monorepo)$/.test(f.key)) return true;\n if (STACK_KEY.test(f.key) && !/^convention\\.test/i.test(f.key)) return true;\n const m = hit(`${f.key} ${f.value}`);\n return m.length > 0 && !/^convention\\.test/i.test(f.key);\n });\n\n slicedDecisions = base.decisions.slice(0, 3);\n slicedDocuments = base.documents.filter((d) => ['architecture.md', 'integrations.md'].includes(d.name));\n\n // Entry points from facts or packages\n const epFact = base.facts.find((f) => f.key === 'repo.entry-points');\n const entryPoints: string[] = [];\n if (epFact && epFact.value) {\n for (const p of epFact.value.split(',').map((x) => x.trim()).filter(Boolean)) {\n if (!entryPoints.includes(p)) entryPoints.push(p);\n }\n }\n if (entryPoints.length === 0 && base.packages.length > 0) {\n entryPoints.push(...base.packages);\n }\n if (entryPoints.length > 0) roleFindings.entryPoints = entryPoints.slice(0, 10);\n\n // Feature knowledge map references\n try {\n const featFile = await loadFeatures(ws);\n const matchedFeats = featFile.features.filter((f) => {\n const text = `${f.id} ${f.name} ${f.description ?? ''} ${(f.tags ?? []).join(' ')}`;\n return hit(text).length > 0;\n });\n if (matchedFeats.length > 0) {\n roleFindings.features = matchedFeats.slice(0, 8).map((f) => ({\n id: f.id,\n name: f.name,\n status: f.status,\n }));\n }\n } catch {\n // Graceful fallback if features file unreadable\n }\n\n // Graphify graph lookup\n try {\n const graph = await loadGraphData(ws.root);\n if (graph.exists && graph.data && graph.data.nodes) {\n const project = await loadProject(ws);\n const extra = expandedTerms.filter((w) => !kw.includes(w) && !STOP.has(w) && !WEAK_TERMS.has(w));\n const ranked = rankGraphNodes(graph.data.nodes, opts.request, {\n extraTerms: extra,\n // The project and package names are identity, not domain terms.\n ignoreTerms: [project.name, ...base.packages, ...WEAK_TERMS],\n limit: 6,\n });\n const matchedNodes: NonNullable<TaskContextResult['roleFindings']>['graphNodes'] = [];\n for (const r of ranked) {\n const v = await verifyNode(ws.root, r.node, 0);\n matchedNodes.push({\n id: r.node.id,\n nodeType: v.type,\n status: v.status === 'verified' ? 'verified' : 'unverified',\n path: v.path,\n ...(v.symbol && !r.node.id.endsWith(v.symbol) ? { symbol: v.symbol } : {}),\n ...(v.sourceLocation ? { sourceLocation: v.sourceLocation } : {}),\n ...(v.line ? { line: v.line } : {}),\n ...(r.strength === 'weak' ? { weak: true as const } : {}),\n why: r.reasons[0] ?? '',\n ...(v.reason ? { reason: v.reason } : {}),\n });\n }\n if (matchedNodes.length > 0) {\n const relevance = new Map(ranked.map((r) => [r.node.id, r.score] as const));\n roleFindings.graphRelationships = topEdgesFor(relevance, graph.data.edges, 4).map((e) => ({\n source: e.source, target: e.target, relation: e.relation, confidence: e.confidence,\n }));\n }\n if (matchedNodes.length > 0) {\n roleFindings.graphNodes = matchedNodes;\n } else {\n roleFindings.graphNotice = 'Graphify knowledge graph is present but no graph nodes matched this query. Use \"devworkspace graph trace <symbol>\" for targeted symbol lookup.';\n }\n } else {\n roleFindings.graphNotice = 'No Graphify knowledge graph found at graphify-out/graph.json. Run \"graphify update .\" or \"/graphify .\" in Claude Code to map symbol dependencies.';\n }\n } catch (err) {\n roleFindings.graphNotice = `Graphify knowledge graph unavailable (${(err as Error).message}). Retrieval continuing without graph symbol data.`;\n }\n\n roleGuidance = [\n 'Investigate referenced entry points and feature components before reading full files.',\n 'Trace deep call dependencies with \"devworkspace graph trace <symbol>\".',\n 'Conclude exploration with a concise handoff: identified files, uncertainty, and next step.',\n ];\n } else if (role === 'tester') {\n // Tester: Prioritize test files, test framework conventions, verification contracts, zero-test safeguards.\n slicedFacts = base.facts.filter((f) => {\n if (/^convention\\.test/i.test(f.key) || ISSUE_KEY.test(f.key)) return true;\n if (STACK_KEY.test(f.key) && /test/i.test(f.key + f.value)) return true;\n const m = hit(`${f.key} ${f.value}`.toLowerCase());\n return m.length > 0;\n });\n\n slicedChecks = base.checks;\n slicedDocuments = base.documents.filter((d) => d.name === 'testing.md');\n slicedDecisions = base.decisions.filter((d) => /test|verify|quality/i.test(d.title));\n\n roleFindings.zeroTestSafeguards = [\n 'Zero-test pass detection active across Vitest, Jest, Pytest, Mocha, Go, and Cargo.',\n 'Commands exiting code 0 with 0 tests executed are classified as unverified false passes.',\n 'Record baseline before modifications: devworkspace task tests <id> --phase baseline --passed <n> --failed <n>.',\n \"Execute verification via 'devworkspace task run <id> <check>'.\",\n ];\n\n roleGuidance = [\n 'Verify required contract commands for affected packages before claiming completion.',\n 'Write focused regression tests covering defect reproduction or feature acceptance criteria.',\n 'Never run destructive commands or test suites touching unmanaged databases without \"testenv declare\".',\n ];\n } else if (role === 'reviewer') {\n // Reviewer: Prioritize git diff/changed files, permanent safety rules, ADRs, potential regressions.\n slicedFacts = base.facts.filter((f) => {\n if (SECURITY_WORDS.test(`${f.key} ${f.value}`)) return true;\n if (/^convention\\./i.test(f.key)) return true;\n const m = hit(`${f.key} ${f.value}`.toLowerCase());\n return m.length > 0;\n });\n\n // Keep review-relevant checks (lint, typecheck, review, and test suites)\n if (base.checks.length > 0) {\n slicedChecks = base.checks.filter((c) => /lint|typecheck|review|test/i.test(c.id));\n } else {\n try {\n if (await pathExists(ws.commands)) {\n const contract = (await readVersioned(ws.commands, 'commands', SCHEMA_VERSION, validateCommands)).data.checks;\n const usable = contract.filter((c) => c.available && /lint|typecheck|review|test/i.test(c.id));\n slicedChecks = base.packages.length > 0\n ? usable.filter((c) => !c.cwd || c.cwd === '.' || base.packages.includes(c.cwd))\n : usable;\n }\n } catch {\n slicedChecks = [];\n }\n }\n slicedDecisions = base.decisions;\n slicedDocuments = base.documents.filter((d) => ['conventions.md', 'architecture.md'].includes(d.name));\n\n try {\n const dirty = await dirtyFiles(ws.root);\n const dirtyList = dirty ? Object.keys(dirty.files) : [];\n if (dirtyList.length > 0) {\n const preview = dirtyList.slice(0, 5).join(', ') + (dirtyList.length > 5 ? ` (+${dirtyList.length - 5} more)` : '');\n roleFindings.diffNotice = `${dirtyList.length} uncommitted file(s) detected: ${preview}. Inspect exact diff with \"git diff\".`;\n } else {\n roleFindings.diffNotice = 'No uncommitted changes detected in working tree. When reviewing a branch or PR, the caller must supply the target diff or commit range.';\n }\n } catch {\n roleFindings.diffNotice = 'Could not inspect git working tree status. The caller must supply the diff or commit range.';\n }\n\n roleGuidance = [\n 'Audit diff against permanent SAFETY_RULES (no secrets in code/logs, no path traversals, untrusted commands).',\n 'Verify changes strictly comply with recorded decisions (ADRs) and feature contracts.',\n 'Ensure required verification checks have executed results before approving the completion gate.',\n ];\n }\n\n const factKeys = new Set(slicedFacts.map((f) => f.key));\n const checkIds = new Set(slicedChecks.map((c) => `${c.cwd ?? '.'}:${c.id}`));\n const decIds = new Set(slicedDecisions.map((d) => String(d.number).padStart(4, '0')));\n const docNames = new Set(slicedDocuments.map((d) => d.name));\n\n const included: ContextItem[] = base.included.filter((item) => {\n if (item.kind === 'rule') return true;\n if (item.kind === 'fact') return factKeys.has(item.id);\n if (item.kind === 'check') return checkIds.has(item.id);\n if (item.kind === 'decision') return decIds.has(item.id);\n if (item.kind === 'document') return docNames.has(item.id);\n return false;\n });\n\n included.push({\n kind: 'rule',\n id: `role:${role}`,\n reason: `context tailored for ${role} role (Phase 1 role-based context slicing)`,\n });\n\n return {\n ...base,\n role,\n facts: slicedFacts,\n checks: slicedChecks,\n decisions: slicedDecisions,\n documents: slicedDocuments,\n rules: SAFETY_RULES,\n included,\n counts: {\n facts: [slicedFacts.length, base.counts.facts[1]],\n checks: [slicedChecks.length, base.counts.checks[1]],\n decisions: [slicedDecisions.length, base.counts.decisions[1]],\n documents: [slicedDocuments.length, base.counts.documents[1]],\n },\n roleGuidance,\n roleFindings,\n };\n}\n"]}
|
package/dist/tasks/routing.js
CHANGED
|
@@ -157,7 +157,8 @@ const OVERRIDE_PATTERNS = [
|
|
|
157
157
|
export function detectConstraints(text) {
|
|
158
158
|
return OVERRIDE_PATTERNS.filter(([, re]) => re.test(text)).map(([c]) => c);
|
|
159
159
|
}
|
|
160
|
-
const QUESTION_START = /^\s*(?:where|what|which|who|when|how\s+(?:does|do|is|are|can|should)|why|explain|describe|show\s+me|walk\s+me|is\s+there|are\s+there|can\s+you\s+(?:explain|tell|show)|tell\s+me|list|find)\b/i;
|
|
160
|
+
const QUESTION_START = /^\s*(?:where|what|which|who|when|how\s+(?:does|do|is|are|can|should)|why|explain|describe|show\s+me|walk\s+me|is\s+there|are\s+there|can\s+you\s+(?:explain|tell|show)|tell\s+me|list|find|trace|follow|inspect)\b/i;
|
|
161
|
+
const EXPLORATION_START = /^\s*(?:investigate|examine|explore|audit)\b/i;
|
|
161
162
|
const IMPERATIVE_START = /^\s*(?:fix|add|implement|create|build|refactor|remove|delete|update|change|rename|write|make|migrate|upgrade|optimi[sz]e|release|publish|validate|ensure|prevent|enforce|guard|reject|restrict|handle|resolve|patch|repair|address|correct|replace|move|extract|rewrite|convert|improve|enable|disable|support|introduce|apply|configure|install|harden|secure|scope|isolate|architect|design)\b/i;
|
|
162
163
|
/** A direct yes/no or open question: it ends in a question mark and does not start like an instruction. */
|
|
163
164
|
const DIRECT_QUESTION = /\?\s*$/;
|
|
@@ -202,6 +203,8 @@ export function classifyRequest(text) {
|
|
|
202
203
|
return make('ARCHITECTURE', 'high');
|
|
203
204
|
if (/\b(?:add|implement|create|build|support|introduce|enable|new)\b/i.test(t))
|
|
204
205
|
return make('FEATURE', 'high');
|
|
206
|
+
if (EXPLORATION_START.test(t))
|
|
207
|
+
return make('QUESTION', 'high');
|
|
205
208
|
// An instruction we cannot place is still a request to change something. Never default it to a read-only question.
|
|
206
209
|
if (IMPERATIVE_START.test(t))
|
|
207
210
|
return make('FEAT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AY,MAAM,CAAC,CAAC,YAAY,IAAI,CAAC;IAC7E,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,gDAAgD,EAAE,2BAA2B,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["import type { TaskType } from './task.js';\n\nexport type Constraint = 'no-modify' | 'plan-only' | 'no-commit' | 'no-e2e' | 'no-tests' | 'no-fix';\n\nexport interface WorkflowSpec {\n type: TaskType;\n /** Highest context level normally needed (1 instructions … 6 tests/implementation). */\n contextDepth: 1 | 2 | 3 | 4 | 5 | 6;\n readOnly: boolean;\n trackTask: boolean;\n steps: string[];\n verification: string;\n agentSkills: string[];\n ponytail: string;\n knowledgeUpdate: string;\n}\n\n/** Single source of truth for routing. The generated Claude skill and docs/routing.md are rendered from this table. */\nexport const WORKFLOWS: Record<TaskType, WorkflowSpec> = {\n QUESTION: {\n type: 'QUESTION',\n contextDepth: 5,\n readOnly: true,\n trackTask: false,\n steps: [\n 'Read .devworkspace/context facts relevant to the topic (devworkspace context --topic <area>).',\n 'Use Graphify (if ready) or targeted search to locate the code; read only the files needed.',\n 'Answer with file references. State uncertainty explicitly.',\n ],\n verification: 'None. Do not modify files or run tests.',\n agentSkills: [],\n ponytail: 'Not used.',\n knowledgeUpdate: 'Only if you discovered a durable fact that is missing; record it with \"devworkspace fact add\".',\n },\n BUG: {\n type: 'BUG',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: [\n 'Check git status; protect uncommitted user changes.',\n 'Investigate and reproduce where practical.',\n 'Write a regression test and confirm it fails.',\n 'Fix the cause, confirm the test passes.',\n 'Run the applicable regression suite, then typecheck/lint/build as required by the testing contract.',\n 'Review the diff; record results with \"devworkspace task verify\".',\n ],\n verification: 'Regression test, applicable suite, typecheck, lint, build (whatever the testing contract marks required).',\n agentSkills: ['/test', '/review'],\n ponytail: 'Light review of the diff when review level is not \"off\".',\n knowledgeUpdate: 'Only if the bug revealed a persistent constraint or convention.',\n },\n FEATURE: {\n type: 'FEATURE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: [\n 'Check git status. Read relevant facts and decisions.',\n 'Write acceptance criteria and a short plan (task update).',\n 'Write tests for the criteria, then implement.',\n 'Run targeted tests, then regression, then typecheck/lint/build.',\n 'Review the diff.',\n 'Update project knowledge for architecture, conventions or decisions that changed.',\n ],\n verification: 'Targeted tests, regression, typecheck, lint, build, review.',\n agentSkills: ['/spec', '/plan', '/build', '/test', '/review'],\n ponytail: 'Review for unnecessary complexity before completion.',\n knowledgeUpdate: 'Yes when the feature adds a module, integration, business rule or decision.',\n },\n REFACTOR: {\n type: 'REFACTOR',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: [\n 'Check git status. Analyse architecture, decisions and dependents (Graphify).',\n 'Record a baseline test result (devworkspace task tests --phase baseline).',\n 'Plan, then refactor in small verified steps.',\n 'Run targeted verification and the full regression suite; compare against the baseline.',\n 'Review the diff.',\n ],\n verification: 'Baseline vs after (no regressions), typecheck, lint, build, review.',\n agentSkills: ['/plan', '/code-simplify', '/review'],\n ponytail: 'Use for simplification review.',\n knowledgeUpdate: 'Yes if structure or conventions changed.',\n },\n DOCUMENTATION: {\n type: 'DOCUMENTATION',\n contextDepth: 4,\n readOnly: false,\n trackTask: false,\n steps: ['Read the code or facts being documented.', 'Edit documentation only.', 'Run documentation checks if the project has them (link or lint checks).'],\n verification: 'Only checks that apply to documentation.',\n agentSkills: [],\n ponytail: 'Not used.',\n knowledgeUpdate: 'Rarely.',\n },\n TESTING: {\n type: 'TESTING',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status.', 'Find existing test conventions.', 'Add tests; confirm they fail for the right reason where applicable.', 'Run the affected suite plus typecheck and lint.'],\n verification: 'Affected tests, typecheck, lint.',\n agentSkills: ['/test'],\n ponytail: 'Optional.',\n knowledgeUpdate: 'If the testing strategy or commands changed.',\n },\n PERFORMANCE: {\n type: 'PERFORMANCE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Measure first; record the baseline.', 'Change one thing at a time.', 'Re-measure and run the regression suite and build.', 'Review.'],\n verification: 'Before/after measurement, regression suite, build.',\n agentSkills: ['/webperf', '/review'],\n ponytail: 'Review for added complexity.',\n knowledgeUpdate: 'If a persistent constraint or decision emerged.',\n },\n SECURITY: {\n type: 'SECURITY',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status.', 'Understand the threat and the affected paths.', 'Test that demonstrates the issue, then fix.', 'Regression suite, typecheck, lint, build.', 'Security-focused review. Never print secret values.'],\n verification: 'Regression and exploit test, typecheck, lint, build, review.',\n agentSkills: ['/test', '/review'],\n ponytail: 'Use for bug and security review of the diff.',\n knowledgeUpdate: 'Yes for new security conventions or decisions.',\n },\n ARCHITECTURE: {\n type: 'ARCHITECTURE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Read facts, decisions and architecture notes; map structure with Graphify.', 'Present options and record the chosen one with \"devworkspace decision add\".', 'Plan and implement in verified steps.', 'Full verification and review.'],\n verification: 'Baseline vs after, typecheck, lint, build, review.',\n agentSkills: ['/spec', '/plan', '/build', '/review'],\n ponytail: 'Review for unnecessary abstraction.',\n knowledgeUpdate: 'Always: architecture notes and the decision record.',\n },\n RELEASE: {\n type: 'RELEASE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status and branch.', 'Run the full testing contract including integration/e2e where available.', 'Update changelog and version per project convention.', 'Do not publish or push without explicit user authorisation.'],\n verification: 'Everything in the testing contract.',\n agentSkills: ['/ship'],\n ponytail: 'Optional final review.',\n knowledgeUpdate: 'If release process facts changed.',\n },\n MAINTENANCE: {\n type: 'MAINTENANCE',\n contextDepth: 4,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status.', 'Make the change.', 'Run lint and build; run tests when behaviour could change.'],\n verification: 'Lint, build, tests if behaviour could change.',\n agentSkills: [],\n ponytail: 'Optional.',\n knowledgeUpdate: 'Only for changed commands or tooling.',\n },\n};\n\nconst OVERRIDE_PATTERNS: [Constraint, RegExp][] = [\n ['no-modify', /\\b(?:only|just)\\s+(?:explain|describe|investigate|look|read|review)\\b|\\b(?:do\\s*n[o']t|don'?t|never|without)\\s+(?:modify|modifying|change|changing|edit|editing|touch|touching)\\b|\\bread[- ]only\\b|\\bno\\s+changes\\b/i],\n ['plan-only', /\\b(?:only|just)\\s+(?:make\\s+|write\\s+|give\\s+me\\s+)?a\\s+plan\\b|\\bplan\\s+only\\b|\\bwithout\\s+implementing(?:\\s+it)?\\b/i],\n ['no-commit', /\\b(?:do\\s*n[o']t|don'?t|never)\\s+commit\\b|\\bno\\s+commits?\\b/i],\n ['no-e2e', /\\b(?:do\\s*n[o']t|don'?t|skip|no)\\s+(?:run\\s+)?(?:the\\s+)?(?:e2e|end[- ]to[- ]end)\\b/i],\n ['no-tests', /\\b(?:do\\s*n[o']t|don'?t|skip)\\s+(?:run\\s+)?(?:any\\s+|the\\s+)?tests\\b(?!\\s+but)/i],\n ['no-fix', /\\b(?:do\\s*n[o']t|don'?t|never)\\s+fix\\b|\\bwithout\\s+fixing\\b|\\bno[- ]fix\\b/i],\n];\n\nexport function detectConstraints(text: string): Constraint[] {\n return OVERRIDE_PATTERNS.filter(([, re]) => re.test(text)).map(([c]) => c);\n}\n\nexport interface Classification {\n type: TaskType;\n confidence: 'high' | 'low';\n constraints: Constraint[];\n /** True when the request must not change files (question type, or an explicit user override). */\n readOnly: boolean;\n}\n\nconst QUESTION_START = /^\\s*(?:where|what|which|who|when|how\\s+(?:does|do|is|are|can|should)|why|explain|describe|show\\s+me|walk\\s+me|is\\s+there|are\\s+there|can\\s+you\\s+(?:explain|tell|show)|tell\\s+me|list|find)\\b/i;\nconst IMPERATIVE_START =\n /^\\s*(?:fix|add|implement|create|build|refactor|remove|delete|update|change|rename|write|make|migrate|upgrade|optimi[sz]e|release|publish|validate|ensure|prevent|enforce|guard|reject|restrict|handle|resolve|patch|repair|address|correct|replace|move|extract|rewrite|convert|improve|enable|disable|support|introduce|apply|configure|install|harden|secure|scope|isolate|architect|design)\\b/i;\n/** A direct yes/no or open question: it ends in a question mark and does not start like an instruction. */\nconst DIRECT_QUESTION = /\\?\\s*$/;\n/** Action-oriented release phrases where releasing is the primary engineering intent. */\nconst ACTIVE_RELEASE = /\\b(?:prepare\\s+release|cut\\s+release|ready\\s+release)\\b|\\b(?:release|publish|deploy|ship)\\s+(?:the\\s+)?(?:package|project|build|app|version|v\\d+)\\b|^\\s*(?:release|publish|deploy|ship)\\b|\\brelease\\s+(?:version\\s+)?v?\\d+/i;\n\n/** Heuristic classifier used to propose a task type. The agent may override it; ambiguous input defaults to the safest (read-only) type. */\nexport function classifyRequest(text: string): Classification {\n const constraints = detectConstraints(text);\n // Negated phrases (\"don't fix anything\") describe limits, not the task itself.\n const t = OVERRIDE_PATTERNS.reduce((acc, [, re]) => acc.replace(new RegExp(re.source, re.flags + 'g'), ' '), text).trim();\n const make = (type: TaskType, confidence: 'high' | 'low'): Classification => ({\n type,\n confidence,\n constraints,\n readOnly: WORKFLOWS[type].readOnly || constraints.includes('no-modify') || constraints.includes('plan-only') || constraints.includes('no-fix'),\n });\n if ((QUESTION_START.test(t) || DIRECT_QUESTION.test(t)) && !IMPERATIVE_START.test(t)) return make('QUESTION', 'high');\n if (/\\b(?:add|write|improve|increase)\\s+(?:\\w+\\s+)?(?:unit\\s+|e2e\\s+|integration\\s+|regression\\s+|smoke\\s+)?tests?\\b|\\btest coverage\\b|^\\s*run\\s+(?:the\\s+|all\\s+)?(?:\\w+\\s+)?tests?\\b|\\b(?:mock|stub|fixture|fake|harness)\\w*(?:\\s+\\w+)?\\s+for\\s+(?:\\w+\\s+)*tests?\\b/i.test(t)) return make('TESTING', 'high');\n if (/\\b(?:upgrade|bump|update\\s+(?:\\w+\\s+)?dependenc\\w*)\\b/i.test(t)) return make('MAINTENANCE', 'high');\n if (/\\b(?:vulnerab\\w*|csrf|xss|sql injection|cve-\\d+|cross-?tenant|tenant isolation|privilege escalation|idor)\\b/i.test(t)) return make('SECURITY', 'high');\n if (/\\b(?:fix|bug|broken|crash(?:es|ing)?|regression|not working|fails?|failing|exception|error|memory\\s+leak|resource\\s+leak|leak(?:s|ing)?|deadlock|infinite\\s+loop)\\b/i.test(t)) return make('BUG', 'high');\n if (/\\b(?:refactor|restructure|reorgani[sz]e|clean\\s?up|simplify|de-?duplicate)\\b/i.test(t)) return make('REFACTOR', 'high');\n if (/\\b(?:vulnerab\\w*|security|csrf|xss|sql injection|sanitiz\\w*|harden\\w*|cve-\\d+|cross-?tenant|tenant isolation|ownership|authori[sz]ation|privilege escalation|idor)\\b/i.test(t)) return make('SECURITY', 'high');\n if (/\\b(?:performance|slow|latency|speed up|optimi[sz]e|throughput)\\b/i.test(t)) return make('PERFORMANCE', 'high');\n if (ACTIVE_RELEASE.test(t)) return make('RELEASE', 'high');\n if (/\\b(?:document\\w*|readme|docs?|changelog|jsdoc|docstring|guide)\\b/i.test(t)) return make('DOCUMENTATION', 'high');\n if (/\\b(?:release|publish|deploy|ship|version bump)\\b/i.test(t)) return make('RELEASE', 'high');\n if (/\\b(?:upgrade|bump|update\\s+dependenc\\w*|chore|lint(?:ing)?|format(?:ting)?)\\b/i.test(t)) return make('MAINTENANCE', 'high');\n if (/\\b(?:redesign|(?:re-?)?architect\\w*|migrate\\s+to|architecture)\\b/i.test(t)) return make('ARCHITECTURE', 'high');\n if (/\\b(?:add|implement|create|build|support|introduce|enable|new)\\b/i.test(t)) return make('FEATURE', 'high');\n // An instruction we cannot place is still a request to change something. Never default it to a read-only question.\n if (IMPERATIVE_START.test(t)) return make('FEATURE', 'low');\n return make('QUESTION', 'low');\n}\n\nexport function renderRoutingTable(): string {\n const rows = (Object.values(WORKFLOWS) as WorkflowSpec[]).map((w) => {\n const flags = [w.readOnly ? 'read-only' : 'modifies code', w.trackTask ? 'tracked task' : 'no task file'].join(', ');\n return `| ${w.type} | ${flags} | L${w.contextDepth} | ${w.verification} |`;\n });\n return ['| Type | Nature | Max context | Verification |', '| --- | --- | --- | --- |', ...rows].join('\\n');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/tasks/routing.ts"],"names":[],"mappings":"AAiBA,uHAAuH;AACvH,MAAM,CAAC,MAAM,SAAS,GAAmC;IACvD,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE;YACL,+FAA+F;YAC/F,4FAA4F;YAC5F,4DAA4D;SAC7D;QACD,YAAY,EAAE,yCAAyC;QACvD,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,WAAW;QACrB,eAAe,EAAE,gGAAgG;KAClH;IACD,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,IAAI;QACf,KAAK,EAAE;YACL,qDAAqD;YACrD,4CAA4C;YAC5C,+CAA+C;YAC/C,yCAAyC;YACzC,qGAAqG;YACrG,kEAAkE;SACnE;QACD,YAAY,EAAE,2GAA2G;QACzH,WAAW,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;QACjC,QAAQ,EAAE,0DAA0D;QACpE,eAAe,EAAE,iEAAiE;KACnF;IACD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,IAAI;QACf,KAAK,EAAE;YACL,sDAAsD;YACtD,2DAA2D;YAC3D,+CAA+C;YAC/C,iEAAiE;YACjE,kBAAkB;YAClB,mFAAmF;SACpF;QACD,YAAY,EAAE,6DAA6D;QAC3E,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;QAC7D,QAAQ,EAAE,sDAAsD;QAChE,eAAe,EAAE,6EAA6E;K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AAe,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrH,OAAO,KAAK,CAAC,CAAC,IAAI,MAAM,KAAK,OAAO,CAAC,CAAC,YAAY,MAAM,CAAC,CAAC,YAAY,IAAI,CAAC;IAC7E,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,gDAAgD,EAAE,2BAA2B,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["import type { TaskType } from './task.js';\n\nexport type Constraint = 'no-modify' | 'plan-only' | 'no-commit' | 'no-e2e' | 'no-tests' | 'no-fix';\n\nexport interface WorkflowSpec {\n type: TaskType;\n /** Highest context level normally needed (1 instructions … 6 tests/implementation). */\n contextDepth: 1 | 2 | 3 | 4 | 5 | 6;\n readOnly: boolean;\n trackTask: boolean;\n steps: string[];\n verification: string;\n agentSkills: string[];\n ponytail: string;\n knowledgeUpdate: string;\n}\n\n/** Single source of truth for routing. The generated Claude skill and docs/routing.md are rendered from this table. */\nexport const WORKFLOWS: Record<TaskType, WorkflowSpec> = {\n QUESTION: {\n type: 'QUESTION',\n contextDepth: 5,\n readOnly: true,\n trackTask: false,\n steps: [\n 'Read .devworkspace/context facts relevant to the topic (devworkspace context --topic <area>).',\n 'Use Graphify (if ready) or targeted search to locate the code; read only the files needed.',\n 'Answer with file references. State uncertainty explicitly.',\n ],\n verification: 'None. Do not modify files or run tests.',\n agentSkills: [],\n ponytail: 'Not used.',\n knowledgeUpdate: 'Only if you discovered a durable fact that is missing; record it with \"devworkspace fact add\".',\n },\n BUG: {\n type: 'BUG',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: [\n 'Check git status; protect uncommitted user changes.',\n 'Investigate and reproduce where practical.',\n 'Write a regression test and confirm it fails.',\n 'Fix the cause, confirm the test passes.',\n 'Run the applicable regression suite, then typecheck/lint/build as required by the testing contract.',\n 'Review the diff; record results with \"devworkspace task verify\".',\n ],\n verification: 'Regression test, applicable suite, typecheck, lint, build (whatever the testing contract marks required).',\n agentSkills: ['/test', '/review'],\n ponytail: 'Light review of the diff when review level is not \"off\".',\n knowledgeUpdate: 'Only if the bug revealed a persistent constraint or convention.',\n },\n FEATURE: {\n type: 'FEATURE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: [\n 'Check git status. Read relevant facts and decisions.',\n 'Write acceptance criteria and a short plan (task update).',\n 'Write tests for the criteria, then implement.',\n 'Run targeted tests, then regression, then typecheck/lint/build.',\n 'Review the diff.',\n 'Update project knowledge for architecture, conventions or decisions that changed.',\n ],\n verification: 'Targeted tests, regression, typecheck, lint, build, review.',\n agentSkills: ['/spec', '/plan', '/build', '/test', '/review'],\n ponytail: 'Review for unnecessary complexity before completion.',\n knowledgeUpdate: 'Yes when the feature adds a module, integration, business rule or decision.',\n },\n REFACTOR: {\n type: 'REFACTOR',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: [\n 'Check git status. Analyse architecture, decisions and dependents (Graphify).',\n 'Record a baseline test result (devworkspace task tests --phase baseline).',\n 'Plan, then refactor in small verified steps.',\n 'Run targeted verification and the full regression suite; compare against the baseline.',\n 'Review the diff.',\n ],\n verification: 'Baseline vs after (no regressions), typecheck, lint, build, review.',\n agentSkills: ['/plan', '/code-simplify', '/review'],\n ponytail: 'Use for simplification review.',\n knowledgeUpdate: 'Yes if structure or conventions changed.',\n },\n DOCUMENTATION: {\n type: 'DOCUMENTATION',\n contextDepth: 4,\n readOnly: false,\n trackTask: false,\n steps: ['Read the code or facts being documented.', 'Edit documentation only.', 'Run documentation checks if the project has them (link or lint checks).'],\n verification: 'Only checks that apply to documentation.',\n agentSkills: [],\n ponytail: 'Not used.',\n knowledgeUpdate: 'Rarely.',\n },\n TESTING: {\n type: 'TESTING',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status.', 'Find existing test conventions.', 'Add tests; confirm they fail for the right reason where applicable.', 'Run the affected suite plus typecheck and lint.'],\n verification: 'Affected tests, typecheck, lint.',\n agentSkills: ['/test'],\n ponytail: 'Optional.',\n knowledgeUpdate: 'If the testing strategy or commands changed.',\n },\n PERFORMANCE: {\n type: 'PERFORMANCE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Measure first; record the baseline.', 'Change one thing at a time.', 'Re-measure and run the regression suite and build.', 'Review.'],\n verification: 'Before/after measurement, regression suite, build.',\n agentSkills: ['/webperf', '/review'],\n ponytail: 'Review for added complexity.',\n knowledgeUpdate: 'If a persistent constraint or decision emerged.',\n },\n SECURITY: {\n type: 'SECURITY',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status.', 'Understand the threat and the affected paths.', 'Test that demonstrates the issue, then fix.', 'Regression suite, typecheck, lint, build.', 'Security-focused review. Never print secret values.'],\n verification: 'Regression and exploit test, typecheck, lint, build, review.',\n agentSkills: ['/test', '/review'],\n ponytail: 'Use for bug and security review of the diff.',\n knowledgeUpdate: 'Yes for new security conventions or decisions.',\n },\n ARCHITECTURE: {\n type: 'ARCHITECTURE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Read facts, decisions and architecture notes; map structure with Graphify.', 'Present options and record the chosen one with \"devworkspace decision add\".', 'Plan and implement in verified steps.', 'Full verification and review.'],\n verification: 'Baseline vs after, typecheck, lint, build, review.',\n agentSkills: ['/spec', '/plan', '/build', '/review'],\n ponytail: 'Review for unnecessary abstraction.',\n knowledgeUpdate: 'Always: architecture notes and the decision record.',\n },\n RELEASE: {\n type: 'RELEASE',\n contextDepth: 6,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status and branch.', 'Run the full testing contract including integration/e2e where available.', 'Update changelog and version per project convention.', 'Do not publish or push without explicit user authorisation.'],\n verification: 'Everything in the testing contract.',\n agentSkills: ['/ship'],\n ponytail: 'Optional final review.',\n knowledgeUpdate: 'If release process facts changed.',\n },\n MAINTENANCE: {\n type: 'MAINTENANCE',\n contextDepth: 4,\n readOnly: false,\n trackTask: true,\n steps: ['Check git status.', 'Make the change.', 'Run lint and build; run tests when behaviour could change.'],\n verification: 'Lint, build, tests if behaviour could change.',\n agentSkills: [],\n ponytail: 'Optional.',\n knowledgeUpdate: 'Only for changed commands or tooling.',\n },\n};\n\nconst OVERRIDE_PATTERNS: [Constraint, RegExp][] = [\n ['no-modify', /\\b(?:only|just)\\s+(?:explain|describe|investigate|look|read|review)\\b|\\b(?:do\\s*n[o']t|don'?t|never|without)\\s+(?:modify|modifying|change|changing|edit|editing|touch|touching)\\b|\\bread[- ]only\\b|\\bno\\s+changes\\b/i],\n ['plan-only', /\\b(?:only|just)\\s+(?:make\\s+|write\\s+|give\\s+me\\s+)?a\\s+plan\\b|\\bplan\\s+only\\b|\\bwithout\\s+implementing(?:\\s+it)?\\b/i],\n ['no-commit', /\\b(?:do\\s*n[o']t|don'?t|never)\\s+commit\\b|\\bno\\s+commits?\\b/i],\n ['no-e2e', /\\b(?:do\\s*n[o']t|don'?t|skip|no)\\s+(?:run\\s+)?(?:the\\s+)?(?:e2e|end[- ]to[- ]end)\\b/i],\n ['no-tests', /\\b(?:do\\s*n[o']t|don'?t|skip)\\s+(?:run\\s+)?(?:any\\s+|the\\s+)?tests\\b(?!\\s+but)/i],\n ['no-fix', /\\b(?:do\\s*n[o']t|don'?t|never)\\s+fix\\b|\\bwithout\\s+fixing\\b|\\bno[- ]fix\\b/i],\n];\n\nexport function detectConstraints(text: string): Constraint[] {\n return OVERRIDE_PATTERNS.filter(([, re]) => re.test(text)).map(([c]) => c);\n}\n\nexport interface Classification {\n type: TaskType;\n confidence: 'high' | 'low';\n constraints: Constraint[];\n /** True when the request must not change files (question type, or an explicit user override). */\n readOnly: boolean;\n}\n\nconst QUESTION_START = /^\\s*(?:where|what|which|who|when|how\\s+(?:does|do|is|are|can|should)|why|explain|describe|show\\s+me|walk\\s+me|is\\s+there|are\\s+there|can\\s+you\\s+(?:explain|tell|show)|tell\\s+me|list|find|trace|follow|inspect)\\b/i;\nconst EXPLORATION_START = /^\\s*(?:investigate|examine|explore|audit)\\b/i;\nconst IMPERATIVE_START =\n /^\\s*(?:fix|add|implement|create|build|refactor|remove|delete|update|change|rename|write|make|migrate|upgrade|optimi[sz]e|release|publish|validate|ensure|prevent|enforce|guard|reject|restrict|handle|resolve|patch|repair|address|correct|replace|move|extract|rewrite|convert|improve|enable|disable|support|introduce|apply|configure|install|harden|secure|scope|isolate|architect|design)\\b/i;\n/** A direct yes/no or open question: it ends in a question mark and does not start like an instruction. */\nconst DIRECT_QUESTION = /\\?\\s*$/;\n/** Action-oriented release phrases where releasing is the primary engineering intent. */\nconst ACTIVE_RELEASE = /\\b(?:prepare\\s+release|cut\\s+release|ready\\s+release)\\b|\\b(?:release|publish|deploy|ship)\\s+(?:the\\s+)?(?:package|project|build|app|version|v\\d+)\\b|^\\s*(?:release|publish|deploy|ship)\\b|\\brelease\\s+(?:version\\s+)?v?\\d+/i;\n\n/** Heuristic classifier used to propose a task type. The agent may override it; ambiguous input defaults to the safest (read-only) type. */\nexport function classifyRequest(text: string): Classification {\n const constraints = detectConstraints(text);\n // Negated phrases (\"don't fix anything\") describe limits, not the task itself.\n const t = OVERRIDE_PATTERNS.reduce((acc, [, re]) => acc.replace(new RegExp(re.source, re.flags + 'g'), ' '), text).trim();\n const make = (type: TaskType, confidence: 'high' | 'low'): Classification => ({\n type,\n confidence,\n constraints,\n readOnly: WORKFLOWS[type].readOnly || constraints.includes('no-modify') || constraints.includes('plan-only') || constraints.includes('no-fix'),\n });\n if ((QUESTION_START.test(t) || DIRECT_QUESTION.test(t)) && !IMPERATIVE_START.test(t)) return make('QUESTION', 'high');\n if (/\\b(?:add|write|improve|increase)\\s+(?:\\w+\\s+)?(?:unit\\s+|e2e\\s+|integration\\s+|regression\\s+|smoke\\s+)?tests?\\b|\\btest coverage\\b|^\\s*run\\s+(?:the\\s+|all\\s+)?(?:\\w+\\s+)?tests?\\b|\\b(?:mock|stub|fixture|fake|harness)\\w*(?:\\s+\\w+)?\\s+for\\s+(?:\\w+\\s+)*tests?\\b/i.test(t)) return make('TESTING', 'high');\n if (/\\b(?:upgrade|bump|update\\s+(?:\\w+\\s+)?dependenc\\w*)\\b/i.test(t)) return make('MAINTENANCE', 'high');\n if (/\\b(?:vulnerab\\w*|csrf|xss|sql injection|cve-\\d+|cross-?tenant|tenant isolation|privilege escalation|idor)\\b/i.test(t)) return make('SECURITY', 'high');\n if (/\\b(?:fix|bug|broken|crash(?:es|ing)?|regression|not working|fails?|failing|exception|error|memory\\s+leak|resource\\s+leak|leak(?:s|ing)?|deadlock|infinite\\s+loop)\\b/i.test(t)) return make('BUG', 'high');\n if (/\\b(?:refactor|restructure|reorgani[sz]e|clean\\s?up|simplify|de-?duplicate)\\b/i.test(t)) return make('REFACTOR', 'high');\n if (/\\b(?:vulnerab\\w*|security|csrf|xss|sql injection|sanitiz\\w*|harden\\w*|cve-\\d+|cross-?tenant|tenant isolation|ownership|authori[sz]ation|privilege escalation|idor)\\b/i.test(t)) return make('SECURITY', 'high');\n if (/\\b(?:performance|slow|latency|speed up|optimi[sz]e|throughput)\\b/i.test(t)) return make('PERFORMANCE', 'high');\n if (ACTIVE_RELEASE.test(t)) return make('RELEASE', 'high');\n if (/\\b(?:document\\w*|readme|docs?|changelog|jsdoc|docstring|guide)\\b/i.test(t)) return make('DOCUMENTATION', 'high');\n if (/\\b(?:release|publish|deploy|ship|version bump)\\b/i.test(t)) return make('RELEASE', 'high');\n if (/\\b(?:upgrade|bump|update\\s+dependenc\\w*|chore|lint(?:ing)?|format(?:ting)?)\\b/i.test(t)) return make('MAINTENANCE', 'high');\n if (/\\b(?:redesign|(?:re-?)?architect\\w*|migrate\\s+to|architecture)\\b/i.test(t)) return make('ARCHITECTURE', 'high');\n if (/\\b(?:add|implement|create|build|support|introduce|enable|new)\\b/i.test(t)) return make('FEATURE', 'high');\n if (EXPLORATION_START.test(t)) return make('QUESTION', 'high');\n // An instruction we cannot place is still a request to change something. Never default it to a read-only question.\n if (IMPERATIVE_START.test(t)) return make('FEATURE', 'low');\n return make('QUESTION', 'low');\n}\n\nexport function renderRoutingTable(): string {\n const rows = (Object.values(WORKFLOWS) as WorkflowSpec[]).map((w) => {\n const flags = [w.readOnly ? 'read-only' : 'modifies code', w.trackTask ? 'tracked task' : 'no task file'].join(', ');\n return `| ${w.type} | ${flags} | L${w.contextDepth} | ${w.verification} |`;\n });\n return ['| Type | Nature | Max context | Verification |', '| --- | --- | --- | --- |', ...rows].join('\\n');\n}\n"]}
|
package/docs/agents.md
CHANGED
|
@@ -58,10 +58,10 @@ For agents that support the Model Context Protocol (such as Claude Code, OpenAI
|
|
|
58
58
|
# Configure Claude Code (.mcp.json)
|
|
59
59
|
devworkspace setup --agent claude-code
|
|
60
60
|
|
|
61
|
-
# Configure OpenAI Codex (
|
|
61
|
+
# Configure OpenAI Codex (.codex/config.toml)
|
|
62
62
|
devworkspace setup --agent codex
|
|
63
63
|
|
|
64
|
-
#
|
|
64
|
+
# Antigravity: prints the user-level mcp_config.json entry to add (writes no project files)
|
|
65
65
|
devworkspace setup --agent antigravity
|
|
66
66
|
|
|
67
67
|
# Preview planned configuration changes without modifying files:
|
|
@@ -78,9 +78,23 @@ DevWorkspace strictly segregates standard CLI instructions from MCP instructions
|
|
|
78
78
|
|
|
79
79
|
Both sets of instructions can coexist in the same project files (e.g. `CLAUDE.md`, `AGENTS.md`, or `.antigravity/rules`). Running `devworkspace agent install` or `devworkspace setup --agent <name>` will never overwrite or clobber the other block, and all custom user notes outside the blocks are preserved byte-for-byte.
|
|
80
80
|
|
|
81
|
-
### MCP
|
|
81
|
+
### MCP Launcher Resolution
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
DevWorkspace automatically determines the optimal launcher for your agent configuration:
|
|
84
|
+
- **Global Binary (`command: "devworkspace"`):** Used when `devworkspace` is installed globally or found on system `PATH`.
|
|
85
|
+
- **npx Launcher (`command: "npx"`, `args: ["-y", "devworkspace", "mcp", "serve"]`):** Used automatically when running via `npx` or when no global `devworkspace` executable is detected on `PATH`. No manual edits to `.mcp.json` are required.
|
|
86
|
+
|
|
87
|
+
You can explicitly control the launcher strategy via the `--launcher` flag during setup:
|
|
88
|
+
```bash
|
|
89
|
+
# Force npx launcher:
|
|
90
|
+
devworkspace setup --agent claude-code --launcher npx
|
|
91
|
+
|
|
92
|
+
# Force direct global binary:
|
|
93
|
+
devworkspace setup --agent claude-code --launcher direct
|
|
94
|
+
|
|
95
|
+
# Automatically detect (default):
|
|
96
|
+
devworkspace setup --agent claude-code --launcher auto
|
|
97
|
+
```
|
|
84
98
|
|
|
85
99
|
## Adding a New Agent Adapter
|
|
86
100
|
|
package/docs/claude.md
CHANGED
|
@@ -45,6 +45,19 @@ DevWorkspace records what it manages in `project.json` → `managedFiles` (`owne
|
|
|
45
45
|
|
|
46
46
|
Onboarding tells Claude to run `devworkspace setup --integrations` (after asking you once) rather than installing tools by hand, so installs are previewed, consent-gated, protected and verified the same way whether you or Claude run them. See [integrations.md](integrations.md).
|
|
47
47
|
|
|
48
|
+
### Reloading Claude Code after installing skills (`/reload-plugins`)
|
|
49
|
+
|
|
50
|
+
Claude Code discovers skills and slash commands (from `.claude/skills/` and registered plugins) when a session starts.
|
|
51
|
+
|
|
52
|
+
If skills such as `.claude/skills/graphify/` or `.claude/skills/devworkspace/` are installed while a Claude Code session is already open:
|
|
53
|
+
- Running `/graphify .` will report: `"/graphify" isn't installed in this session`.
|
|
54
|
+
- Running `devworkspace doctor` will report: `RESTART_REQUIRED`.
|
|
55
|
+
|
|
56
|
+
To load the newly installed skills into the active session:
|
|
57
|
+
1. Type `/reload-plugins` in your Claude Code prompt (or restart the Claude Code session / restart VS Code).
|
|
58
|
+
2. Run `/graphify .` to build the graph.
|
|
59
|
+
3. In your terminal, clear the pending notice: `devworkspace integrations status --restarted`.
|
|
60
|
+
|
|
48
61
|
## Keeping Claude-specific code isolated
|
|
49
62
|
|
|
50
63
|
Everything Claude-specific lives in `src/agents/claude/`. Core code talks to the `AgentAdapter` interface (`detectExisting`, `plan`), so a Cursor/Codex/Gemini adapter is a new directory implementing the same interface, not a change to core.
|
package/docs/getting-started.md
CHANGED
|
@@ -65,13 +65,52 @@ Open `.devworkspace/analysis/onboarding-prompt.md` and paste it into Claude Code
|
|
|
65
65
|
|
|
66
66
|
It is told not to modify application source during onboarding.
|
|
67
67
|
|
|
68
|
+
### Configuring Agent Instructions & Skills Manually
|
|
69
|
+
|
|
70
|
+
You can also install the agent instructions and skills directly from your terminal:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Install Claude operating instructions and .claude/skills/devworkspace/SKILL.md
|
|
74
|
+
npx devworkspace agent install --agent claude
|
|
75
|
+
|
|
76
|
+
# Or configure MCP stdio tools (.mcp.json)
|
|
77
|
+
npx devworkspace setup --agent claude-code
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Setting Up Graphify & Building the Graph
|
|
81
|
+
|
|
82
|
+
To enable structural knowledge graphs:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Install Graphify CLI and the project skill (.claude/skills/graphify/SKILL.md)
|
|
86
|
+
npx devworkspace setup --integrations --yes
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> [!IMPORTANT]
|
|
90
|
+
> **Claude Code Session Reload Requirement:**
|
|
91
|
+
> Claude Code indexes skills and slash commands only when a session starts. If Claude Code is already running when `setup --integrations` or `agent install` writes skills:
|
|
92
|
+
> - Running `/graphify .` will output: `"/graphify" isn't installed in this session`.
|
|
93
|
+
> - **Solution:** In your Claude Code chat prompt, run `/reload-plugins` (or restart the Claude Code session / reload VS Code).
|
|
94
|
+
> - Then run `/graphify .` to build the graph (`graphify-out/graph.json`).
|
|
95
|
+
> - Once restarted, acknowledge the restart in DevWorkspace:
|
|
96
|
+
> ```bash
|
|
97
|
+
> npx devworkspace integrations status --restarted
|
|
98
|
+
> ```
|
|
99
|
+
|
|
68
100
|
## 4. Verify
|
|
69
101
|
|
|
70
102
|
```bash
|
|
71
103
|
npx devworkspace doctor
|
|
72
104
|
```
|
|
73
105
|
|
|
74
|
-
`Core workspace: READY
|
|
106
|
+
- `Core workspace: READY`: Workspace is healthy, instructions are installed and architecture knowledge exists.
|
|
107
|
+
- `Integrations` status:
|
|
108
|
+
- `VERIFIED`: CLI executable, project skill, and hooks are confirmed working.
|
|
109
|
+
- `RESTART_REQUIRED`: Skills or plugins were installed; run `/reload-plugins` or restart Claude Code, then acknowledge with `npx devworkspace integrations status --restarted`.
|
|
110
|
+
- `DEGRADED (cli without project skill)`: The Graphify CLI exists, but `.claude/skills/graphify/SKILL.md` is missing. Fix by running `npx devworkspace setup --integrations --yes`.
|
|
111
|
+
- `NOT_INSTALLED`: Optional integration is absent. Missing optional integrations do not fail core checks.
|
|
112
|
+
|
|
113
|
+
Run `npx devworkspace setup --integrations --dry-run` to see what setup would do, and `--yes` to do it.
|
|
75
114
|
|
|
76
115
|
## 5. Work normally
|
|
77
116
|
|
package/docs/integrations.md
CHANGED
|
@@ -65,7 +65,7 @@ Setup is non-interactive. It never prompts, so it cannot hang in CI; when it nee
|
|
|
65
65
|
|
|
66
66
|
Python detection runs `--version` on each candidate (`py -3`, `python3`, `python`). On Windows the Microsoft Store `python` shortcut exists on PATH but is not Python, and is correctly rejected.
|
|
67
67
|
|
|
68
|
-
**Graphify edits your files.** `graphify install --project` appends a section to `CLAUDE.md`, creates `.claude/CLAUDE.md` and registers Claude Code `PreToolUse` hooks in `.claude/settings.json`. It merges and is idempotent. DevWorkspace snapshots those files first and, if anything you had is missing afterwards, restores them and fails the step. Review `git diff` after setup. Building the graph itself (`/graphify .`) uses the model, so DevWorkspace does not do it.
|
|
68
|
+
**Graphify edits your files.** `graphify install --project` appends a section to `CLAUDE.md`, creates `.claude/CLAUDE.md` and registers Claude Code `PreToolUse` hooks in `.claude/settings.json`. It merges and is idempotent. DevWorkspace snapshots those files first and, if anything you had is missing afterwards, restores them and fails the step. Review `git diff` after setup. Building the graph itself (`/graphify .`) uses the model, so DevWorkspace does not do it. If Claude Code is already running when `setup --integrations` installs the project skill, run `/reload-plugins` in Claude Code before running `/graphify .`, otherwise Claude Code will report that `"/graphify" isn't installed in this session`.
|
|
69
69
|
|
|
70
70
|
### Agent Skills and Ponytail
|
|
71
71
|
|
|
@@ -88,6 +88,21 @@ A marketplace being registered does not count as the plugin being installed; the
|
|
|
88
88
|
|
|
89
89
|
Portable installs record license/attribution in `.devworkspace/THIRD_PARTY_NOTICES.md` (both are MIT; the notice names the copyright holders).
|
|
90
90
|
|
|
91
|
+
## Where generated files live
|
|
92
|
+
|
|
93
|
+
DevWorkspace-owned data is under `.devworkspace/` (`context/`, `decisions/`, `tasks/`, `sessions/`, `analysis/`, `state/`, `local/`). Anything an agent or an external tool must find at a fixed location stays there. DevWorkspace edits only its managed sections of those files.
|
|
94
|
+
|
|
95
|
+
| Path | Owner | Why it is where it is |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `.devworkspace/**` | DevWorkspace | Portable knowledge is tracked; `local/`, `state/integrations.json`, generated prompts and `graph/` are git-ignored. |
|
|
98
|
+
| `.mcp.json` (Claude Code), `.codex/config.toml` (Codex) | Agent | MCP clients read these project files. Antigravity's MCP config is user-level and is never written for you. |
|
|
99
|
+
| `CLAUDE.md`, `AGENTS.md`, `.claude/` | Agent | Instruction and skill discovery. |
|
|
100
|
+
| `graphify-out/` | **Graphify** | `graphify update`, the `/graphify` skill and its hooks hardcode the project-root `graphify-out/`. Graphify (0.9.x) has no setting to relocate it for those commands, so DevWorkspace does not move it and does not use symlinks or junctions to fake it. |
|
|
101
|
+
|
|
102
|
+
The only relocation Graphify supports is `graphify extract <path> --out .devworkspace/graph/graphify`, which writes `.devworkspace/graph/graphify/graphify-out/`. DevWorkspace reads either location (`devworkspace graph status`, MCP tools). If both exist it reads the most recently written one and `devworkspace doctor` warns; nothing is copied, moved or deleted automatically.
|
|
103
|
+
|
|
104
|
+
**Existing workspaces need no migration.** The layout above is unchanged for them; `devworkspace init` is idempotent and only appends the `graph/` ignore rule to `.devworkspace/.gitignore` without touching your lines.
|
|
105
|
+
|
|
91
106
|
## Protection, idempotency and recovery
|
|
92
107
|
|
|
93
108
|
- Before each setup run, the files tools may edit (`CLAUDE.md`, `.claude/CLAUDE.md`, `AGENTS.md`, `.claude/settings*.json`) and every existing file under `.claude/skills/` are snapshotted. After each step they are verified: text files may only gain lines, JSON may only gain keys, existing skill files must be byte-identical. Violations are restored and reported.
|