devworkspace 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/README.md +14 -6
- package/dist/cli/args.d.ts +37 -0
- package/dist/cli/args.js +12 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/help.js +141 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/render.d.ts +8 -1
- package/dist/cli/render.js +124 -0
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/run.js +364 -4
- package/dist/cli/run.js.map +1 -1
- package/dist/core/contracts.d.ts +70 -0
- package/dist/core/contracts.js +88 -0
- package/dist/core/contracts.js.map +1 -0
- package/dist/discovery/commands.d.ts +1 -1
- package/dist/discovery/commands.js.map +1 -1
- package/dist/discovery/detect.d.ts +2 -70
- package/dist/discovery/detect.js.map +1 -1
- package/dist/discovery/entrypoints.d.ts +2 -11
- package/dist/discovery/entrypoints.js.map +1 -1
- package/dist/discovery/types.d.ts +79 -0
- package/dist/discovery/types.js +2 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/dx/dashboard.d.ts +21 -0
- package/dist/dx/dashboard.js +274 -0
- package/dist/dx/dashboard.js.map +1 -0
- package/dist/dx/guidance.d.ts +21 -0
- package/dist/dx/guidance.js +266 -0
- package/dist/dx/guidance.js.map +1 -0
- package/dist/dx/index.d.ts +4 -0
- package/dist/dx/index.js +5 -0
- package/dist/dx/index.js.map +1 -0
- package/dist/dx/onboarding.d.ts +23 -0
- package/dist/dx/onboarding.js +155 -0
- package/dist/dx/onboarding.js.map +1 -0
- package/dist/dx/types.d.ts +70 -0
- package/dist/dx/types.js +3 -0
- package/dist/dx/types.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/adapters/pluginSkill.js +15 -1
- package/dist/integrations/adapters/pluginSkill.js.map +1 -1
- package/dist/integrations/persistentPath.d.ts +2 -9
- package/dist/integrations/persistentPath.js.map +1 -1
- package/dist/integrations/types.d.ts +4 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/intelligence/agents/profiles.d.ts +2 -0
- package/dist/intelligence/agents/profiles.js +326 -0
- package/dist/intelligence/agents/profiles.js.map +1 -0
- package/dist/intelligence/agents/registry.d.ts +15 -0
- package/dist/intelligence/agents/registry.js +108 -0
- package/dist/intelligence/agents/registry.js.map +1 -0
- package/dist/intelligence/agents/types.d.ts +43 -0
- package/dist/intelligence/agents/types.js +2 -0
- package/dist/intelligence/agents/types.js.map +1 -0
- package/dist/intelligence/observability/tracer.d.ts +13 -0
- package/dist/intelligence/observability/tracer.js +129 -0
- package/dist/intelligence/observability/tracer.js.map +1 -0
- package/dist/intelligence/observability/types.d.ts +38 -0
- package/dist/intelligence/observability/types.js +2 -0
- package/dist/intelligence/observability/types.js.map +1 -0
- package/dist/intelligence/orchestration/engine.d.ts +42 -0
- package/dist/intelligence/orchestration/engine.js +418 -0
- package/dist/intelligence/orchestration/engine.js.map +1 -0
- package/dist/intelligence/orchestration/lock-manager.d.ts +21 -0
- package/dist/intelligence/orchestration/lock-manager.js +70 -0
- package/dist/intelligence/orchestration/lock-manager.js.map +1 -0
- package/dist/intelligence/orchestration/store.d.ts +11 -0
- package/dist/intelligence/orchestration/store.js +73 -0
- package/dist/intelligence/orchestration/store.js.map +1 -0
- package/dist/intelligence/orchestration/types.d.ts +100 -0
- package/dist/intelligence/orchestration/types.js +48 -0
- package/dist/intelligence/orchestration/types.js.map +1 -0
- package/dist/intelligence/routing/matcher.d.ts +7 -0
- package/dist/intelligence/routing/matcher.js +96 -0
- package/dist/intelligence/routing/matcher.js.map +1 -0
- package/dist/intelligence/routing/router.d.ts +9 -0
- package/dist/intelligence/routing/router.js +198 -0
- package/dist/intelligence/routing/router.js.map +1 -0
- package/dist/intelligence/routing/types.d.ts +64 -0
- package/dist/intelligence/routing/types.js +2 -0
- package/dist/intelligence/routing/types.js.map +1 -0
- package/dist/intelligence/runtime/adk/adapter.d.ts +7 -0
- package/dist/intelligence/runtime/adk/adapter.js +60 -0
- package/dist/intelligence/runtime/adk/adapter.js.map +1 -0
- package/dist/intelligence/runtime/adk/detector.d.ts +7 -0
- package/dist/intelligence/runtime/adk/detector.js +28 -0
- package/dist/intelligence/runtime/adk/detector.js.map +1 -0
- package/dist/intelligence/runtime/external.d.ts +9 -0
- package/dist/intelligence/runtime/external.js +102 -0
- package/dist/intelligence/runtime/external.js.map +1 -0
- package/dist/intelligence/runtime/native.d.ts +19 -0
- package/dist/intelligence/runtime/native.js +99 -0
- package/dist/intelligence/runtime/native.js.map +1 -0
- package/dist/intelligence/runtime/types.d.ts +49 -0
- package/dist/intelligence/runtime/types.js +2 -0
- package/dist/intelligence/runtime/types.js.map +1 -0
- package/dist/intelligence/security/audit.d.ts +8 -0
- package/dist/intelligence/security/audit.js +43 -0
- package/dist/intelligence/security/audit.js.map +1 -0
- package/dist/intelligence/security/policy.d.ts +12 -0
- package/dist/intelligence/security/policy.js +153 -0
- package/dist/intelligence/security/policy.js.map +1 -0
- package/dist/intelligence/security/types.d.ts +25 -0
- package/dist/intelligence/security/types.js +2 -0
- package/dist/intelligence/security/types.js.map +1 -0
- package/dist/intelligence/skills/builtins.d.ts +2 -0
- package/dist/intelligence/skills/builtins.js +379 -0
- package/dist/intelligence/skills/builtins.js.map +1 -0
- package/dist/intelligence/skills/loader.d.ts +4 -0
- package/dist/intelligence/skills/loader.js +84 -0
- package/dist/intelligence/skills/loader.js.map +1 -0
- package/dist/intelligence/skills/registry.d.ts +15 -0
- package/dist/intelligence/skills/registry.js +134 -0
- package/dist/intelligence/skills/registry.js.map +1 -0
- package/dist/intelligence/skills/types.d.ts +35 -0
- package/dist/intelligence/skills/types.js +2 -0
- package/dist/intelligence/skills/types.js.map +1 -0
- package/dist/intelligence/verification/engine.d.ts +23 -0
- package/dist/intelligence/verification/engine.js +66 -0
- package/dist/intelligence/verification/engine.js.map +1 -0
- package/dist/intelligence/verification/reviewer.d.ts +8 -0
- package/dist/intelligence/verification/reviewer.js +55 -0
- package/dist/intelligence/verification/reviewer.js.map +1 -0
- package/dist/intelligence/verification/types.d.ts +32 -0
- package/dist/intelligence/verification/types.js +2 -0
- package/dist/intelligence/verification/types.js.map +1 -0
- package/dist/mcp/setup.d.ts +23 -4
- package/dist/mcp/setup.js +107 -22
- package/dist/mcp/setup.js.map +1 -1
- package/dist/mcp/tools.js +6 -6
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +4 -0
- package/dist/mcp/types.js.map +1 -1
- package/dist/mcp/verify.d.ts +1 -1
- package/dist/mcp/verify.js +45 -10
- package/dist/mcp/verify.js.map +1 -1
- package/dist/security/redact.js +3 -2
- package/dist/security/redact.js.map +1 -1
- package/dist/services/doctor.js +4 -0
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/graph.d.ts +21 -0
- package/dist/services/graph.js +222 -3
- package/dist/services/graph.js.map +1 -1
- package/dist/services/intelligence.d.ts +44 -0
- package/dist/services/intelligence.js +119 -0
- package/dist/services/intelligence.js.map +1 -0
- package/dist/services/standards.d.ts +85 -0
- package/dist/services/standards.js +230 -0
- package/dist/services/standards.js.map +1 -0
- package/dist/services/taskContext.js +4 -0
- package/dist/services/taskContext.js.map +1 -1
- package/dist/standards/acquisition/ingest.d.ts +12 -0
- package/dist/standards/acquisition/ingest.js +98 -0
- package/dist/standards/acquisition/ingest.js.map +1 -0
- package/dist/standards/applicability/engine.d.ts +38 -0
- package/dist/standards/applicability/engine.js +250 -0
- package/dist/standards/applicability/engine.js.map +1 -0
- package/dist/standards/builtin/code-quality.d.ts +2 -0
- package/dist/standards/builtin/code-quality.js +53 -0
- package/dist/standards/builtin/code-quality.js.map +1 -0
- package/dist/standards/builtin/database-safety.d.ts +2 -0
- package/dist/standards/builtin/database-safety.js +56 -0
- package/dist/standards/builtin/database-safety.js.map +1 -0
- package/dist/standards/builtin/index.d.ts +8 -0
- package/dist/standards/builtin/index.js +14 -0
- package/dist/standards/builtin/index.js.map +1 -0
- package/dist/standards/builtin/security-baseline.d.ts +2 -0
- package/dist/standards/builtin/security-baseline.js +64 -0
- package/dist/standards/builtin/security-baseline.js.map +1 -0
- package/dist/standards/builtin/testing-contracts.d.ts +2 -0
- package/dist/standards/builtin/testing-contracts.js +54 -0
- package/dist/standards/builtin/testing-contracts.js.map +1 -0
- package/dist/standards/builtin/undo-kit.d.ts +8 -0
- package/dist/standards/builtin/undo-kit.js +106 -0
- package/dist/standards/builtin/undo-kit.js.map +1 -0
- package/dist/standards/config/config.d.ts +12 -0
- package/dist/standards/config/config.js +110 -0
- package/dist/standards/config/config.js.map +1 -0
- package/dist/standards/distribution/cache.d.ts +57 -0
- package/dist/standards/distribution/cache.js +411 -0
- package/dist/standards/distribution/cache.js.map +1 -0
- package/dist/standards/distribution/index.d.ts +6 -0
- package/dist/standards/distribution/index.js +7 -0
- package/dist/standards/distribution/index.js.map +1 -0
- package/dist/standards/distribution/keys.d.ts +53 -0
- package/dist/standards/distribution/keys.js +269 -0
- package/dist/standards/distribution/keys.js.map +1 -0
- package/dist/standards/distribution/package.d.ts +25 -0
- package/dist/standards/distribution/package.js +248 -0
- package/dist/standards/distribution/package.js.map +1 -0
- package/dist/standards/distribution/server.d.ts +38 -0
- package/dist/standards/distribution/server.js +204 -0
- package/dist/standards/distribution/server.js.map +1 -0
- package/dist/standards/distribution/sync.d.ts +51 -0
- package/dist/standards/distribution/sync.js +212 -0
- package/dist/standards/distribution/sync.js.map +1 -0
- package/dist/standards/distribution/types.d.ts +140 -0
- package/dist/standards/distribution/types.js +26 -0
- package/dist/standards/distribution/types.js.map +1 -0
- package/dist/standards/engine/compliance.d.ts +2 -0
- package/dist/standards/engine/compliance.js +45 -0
- package/dist/standards/engine/compliance.js.map +1 -0
- package/dist/standards/engine/engine.d.ts +14 -0
- package/dist/standards/engine/engine.js +114 -0
- package/dist/standards/engine/engine.js.map +1 -0
- package/dist/standards/engine/reporter.d.ts +2 -0
- package/dist/standards/engine/reporter.js +42 -0
- package/dist/standards/engine/reporter.js.map +1 -0
- package/dist/standards/index.d.ts +18 -0
- package/dist/standards/index.js +19 -0
- package/dist/standards/index.js.map +1 -0
- package/dist/standards/registry/registry.d.ts +29 -0
- package/dist/standards/registry/registry.js +210 -0
- package/dist/standards/registry/registry.js.map +1 -0
- package/dist/standards/schema/types.d.ts +133 -0
- package/dist/standards/schema/types.js +33 -0
- package/dist/standards/schema/types.js.map +1 -0
- package/dist/standards/schema/validate.d.ts +6 -0
- package/dist/standards/schema/validate.js +131 -0
- package/dist/standards/schema/validate.js.map +1 -0
- package/dist/standards/templates/index.d.ts +11 -0
- package/dist/standards/templates/index.js +176 -0
- package/dist/standards/templates/index.js.map +1 -0
- package/dist/standards/validators/database.d.ts +5 -0
- package/dist/standards/validators/database.js +122 -0
- package/dist/standards/validators/database.js.map +1 -0
- package/dist/standards/validators/quality.d.ts +6 -0
- package/dist/standards/validators/quality.js +91 -0
- package/dist/standards/validators/quality.js.map +1 -0
- package/dist/standards/validators/registry.d.ts +11 -0
- package/dist/standards/validators/registry.js +83 -0
- package/dist/standards/validators/registry.js.map +1 -0
- package/dist/standards/validators/security.d.ts +7 -0
- package/dist/standards/validators/security.js +182 -0
- package/dist/standards/validators/security.js.map +1 -0
- package/dist/standards/validators/testing.d.ts +6 -0
- package/dist/standards/validators/testing.js +142 -0
- package/dist/standards/validators/testing.js.map +1 -0
- package/dist/standards/validators/types.d.ts +11 -0
- package/dist/standards/validators/types.js +2 -0
- package/dist/standards/validators/types.js.map +1 -0
- package/dist/standards/validators/undo-kit.d.ts +7 -0
- package/dist/standards/validators/undo-kit.js +334 -0
- package/dist/standards/validators/undo-kit.js.map +1 -0
- package/dist/tasks/routing.js +5 -3
- package/dist/tasks/routing.js.map +1 -1
- package/dist/utils/fs.d.ts +1 -1
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/lock.js +11 -3
- package/dist/utils/lock.js.map +1 -1
- package/dist/utils/paths.js +29 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/proc.js +21 -3
- package/dist/utils/proc.js.map +1 -1
- package/docs/contributing.md +9 -0
- package/docs/getting-started.md +7 -0
- package/docs/integrations.md +2 -2
- package/docs/mcp.md +8 -3
- package/docs/security/HOME_SERVER_THREAT_MODEL.md +72 -0
- package/docs/security/THREAT_MODEL.md +101 -0
- package/docs/standards.md +143 -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,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEpF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,C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;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"]}
|
|
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,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,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 for (const part of w.split('-')) {\n if (part.length >= 2 && !STOP.has(part)) expanded.add(part);\n }\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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EngineeringStandard, StandardCategory } from '../schema/types.js';
|
|
2
|
+
export interface IngestionResult {
|
|
3
|
+
standard: EngineeringStandard;
|
|
4
|
+
createdFile: string;
|
|
5
|
+
recommendations: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function ingestStandardFromFile(workspaceDir: string, filePath: string, overrides?: {
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
category?: StandardCategory;
|
|
11
|
+
overwrite?: boolean;
|
|
12
|
+
}): Promise<IngestionResult>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { validateStandard } from '../schema/validate.js';
|
|
4
|
+
import { STANDARD_CATEGORIES } from '../schema/types.js';
|
|
5
|
+
import { DevWorkspaceError } from '../../errors/index.js';
|
|
6
|
+
const BUILTIN_STANDARD_IDS = new Set([
|
|
7
|
+
'security-baseline',
|
|
8
|
+
'database-destructive-change-prevention',
|
|
9
|
+
'deployment-safety-and-rollback',
|
|
10
|
+
'code-quality',
|
|
11
|
+
'testing-standards',
|
|
12
|
+
]);
|
|
13
|
+
export async function ingestStandardFromFile(workspaceDir, filePath, overrides) {
|
|
14
|
+
const fullPath = path.resolve(filePath);
|
|
15
|
+
const raw = await fs.readFile(fullPath, 'utf8');
|
|
16
|
+
let parsed;
|
|
17
|
+
if (fullPath.endsWith('.json')) {
|
|
18
|
+
parsed = JSON.parse(raw);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
// Markdown document ingestion
|
|
22
|
+
const baseName = path.basename(filePath, path.extname(filePath));
|
|
23
|
+
const lines = raw.split('\n');
|
|
24
|
+
const titleLine = lines.find((l) => l.startsWith('# '));
|
|
25
|
+
const title = titleLine ? titleLine.replace(/^#\s*/, '').trim() : baseName;
|
|
26
|
+
// Extract requirements from bullet points
|
|
27
|
+
const bullets = lines
|
|
28
|
+
.filter((l) => l.trim().startsWith('- ') || l.trim().startsWith('* '))
|
|
29
|
+
.map((l) => l.trim().replace(/^[-*]\s*/, ''));
|
|
30
|
+
const id = (overrides?.id || baseName).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
31
|
+
parsed = {
|
|
32
|
+
id: id || 'custom-standard',
|
|
33
|
+
name: overrides?.name || title,
|
|
34
|
+
description: `Engineering standard imported from ${path.basename(filePath)}.`,
|
|
35
|
+
category: overrides?.category || 'development',
|
|
36
|
+
version: '1.0.0',
|
|
37
|
+
status: 'DRAFT', // Newly ingested standards start in DRAFT
|
|
38
|
+
applicability: { all: true },
|
|
39
|
+
requirements: bullets.slice(0, 10).length > 0 ? bullets.slice(0, 10) : ['Follow engineering guidelines defined in source document.'],
|
|
40
|
+
guidelines: lines.filter((l) => l.trim().length > 0 && !l.startsWith('#')).slice(0, 8),
|
|
41
|
+
rules: [
|
|
42
|
+
{
|
|
43
|
+
id: `${id || 'custom'}.adherence`,
|
|
44
|
+
title: `Adhere to ${title}`,
|
|
45
|
+
description: `Verify project adheres to principles outlined in ${path.basename(filePath)}.`,
|
|
46
|
+
severity: 'medium',
|
|
47
|
+
enforcement: 'recommended',
|
|
48
|
+
remediation: `Review ${path.basename(filePath)} and apply required patterns.`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
enforcement: 'recommended',
|
|
52
|
+
references: [path.basename(filePath)],
|
|
53
|
+
metadata: {
|
|
54
|
+
createdAt: new Date().toISOString(),
|
|
55
|
+
updatedAt: new Date().toISOString(),
|
|
56
|
+
author: 'Imported via devworkspace standards add',
|
|
57
|
+
tags: ['custom', 'imported'],
|
|
58
|
+
source: filePath,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (overrides?.id)
|
|
63
|
+
parsed.id = overrides.id;
|
|
64
|
+
if (overrides?.name)
|
|
65
|
+
parsed.name = overrides.name;
|
|
66
|
+
if (overrides?.category && STANDARD_CATEGORIES.includes(overrides.category)) {
|
|
67
|
+
parsed.category = overrides.category;
|
|
68
|
+
}
|
|
69
|
+
const validated = validateStandard(parsed);
|
|
70
|
+
if (BUILTIN_STANDARD_IDS.has(validated.id)) {
|
|
71
|
+
throw new DevWorkspaceError('USAGE', `Cannot ingest standard with ID "${validated.id}": conflicts with built-in standard. Choose a unique ID.`);
|
|
72
|
+
}
|
|
73
|
+
// Save to project custom standards directory
|
|
74
|
+
const customDir = path.join(workspaceDir, '.devworkspace', 'standards', 'custom');
|
|
75
|
+
await fs.mkdir(customDir, { recursive: true });
|
|
76
|
+
const targetFile = path.join(customDir, `${validated.id}.json`);
|
|
77
|
+
try {
|
|
78
|
+
await fs.access(targetFile);
|
|
79
|
+
if (!overrides?.overwrite) {
|
|
80
|
+
throw new DevWorkspaceError('USAGE', `Standard "${validated.id}" already exists at ${targetFile}. Use --force to overwrite or choose another ID.`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
if (err instanceof DevWorkspaceError)
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
await fs.writeFile(targetFile, JSON.stringify(validated, null, 2), 'utf8');
|
|
88
|
+
return {
|
|
89
|
+
standard: validated,
|
|
90
|
+
createdFile: targetFile,
|
|
91
|
+
recommendations: [
|
|
92
|
+
`Standard imported with status "${validated.status}".`,
|
|
93
|
+
`Inspect ${targetFile} to refine rules, applicability, and validation logic.`,
|
|
94
|
+
`Promote to APPROVED with "devworkspace standards approve ${validated.id}".`,
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=ingest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../src/standards/acquisition/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAA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AAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAClF,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;IAEhE,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5B,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,iBAAiB,CACzB,OAAO,EACP,aAAa,SAAS,CAAC,EAAE,uBAAuB,UAAU,kDAAkD,CAC7G,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAI,GAAG,YAAY,iBAAiB;YAAE,MAAM,GAAG,CAAC;IAClD,CAAC;IAED,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAE3E,OAAO;QACL,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,UAAU;QACvB,eAAe,EAAE;YACf,kCAAkC,SAAS,CAAC,MAAM,IAAI;YACtD,WAAW,UAAU,wDAAwD;YAC7E,4DAA4D,SAAS,CAAC,EAAE,IAAI;SAC7E;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { validateStandard } from '../schema/validate.js';\nimport type { EngineeringStandard, StandardCategory } from '../schema/types.js';\nimport { STANDARD_CATEGORIES } from '../schema/types.js';\nimport { DevWorkspaceError } from '../../errors/index.js';\n\nexport interface IngestionResult {\n standard: EngineeringStandard;\n createdFile: string;\n recommendations: string[];\n}\n\nconst BUILTIN_STANDARD_IDS = new Set([\n 'security-baseline',\n 'database-destructive-change-prevention',\n 'deployment-safety-and-rollback',\n 'code-quality',\n 'testing-standards',\n]);\n\nexport async function ingestStandardFromFile(\n workspaceDir: string,\n filePath: string,\n overrides?: { id?: string; name?: string; category?: StandardCategory; overwrite?: boolean },\n): Promise<IngestionResult> {\n const fullPath = path.resolve(filePath);\n const raw = await fs.readFile(fullPath, 'utf8');\n\n let parsed: Partial<EngineeringStandard>;\n\n if (fullPath.endsWith('.json')) {\n parsed = JSON.parse(raw);\n } else {\n // Markdown document ingestion\n const baseName = path.basename(filePath, path.extname(filePath));\n const lines = raw.split('\\n');\n const titleLine = lines.find((l) => l.startsWith('# '));\n const title = titleLine ? titleLine.replace(/^#\\s*/, '').trim() : baseName;\n\n // Extract requirements from bullet points\n const bullets = lines\n .filter((l) => l.trim().startsWith('- ') || l.trim().startsWith('* '))\n .map((l) => l.trim().replace(/^[-*]\\s*/, ''));\n\n const id = (overrides?.id || baseName).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\n\n parsed = {\n id: id || 'custom-standard',\n name: overrides?.name || title,\n description: `Engineering standard imported from ${path.basename(filePath)}.`,\n category: overrides?.category || 'development',\n version: '1.0.0',\n status: 'DRAFT', // Newly ingested standards start in DRAFT\n applicability: { all: true },\n requirements: bullets.slice(0, 10).length > 0 ? bullets.slice(0, 10) : ['Follow engineering guidelines defined in source document.'],\n guidelines: lines.filter((l) => l.trim().length > 0 && !l.startsWith('#')).slice(0, 8),\n rules: [\n {\n id: `${id || 'custom'}.adherence`,\n title: `Adhere to ${title}`,\n description: `Verify project adheres to principles outlined in ${path.basename(filePath)}.`,\n severity: 'medium',\n enforcement: 'recommended',\n remediation: `Review ${path.basename(filePath)} and apply required patterns.`,\n },\n ],\n enforcement: 'recommended',\n references: [path.basename(filePath)],\n metadata: {\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n author: 'Imported via devworkspace standards add',\n tags: ['custom', 'imported'],\n source: filePath,\n },\n };\n }\n\n if (overrides?.id) parsed.id = overrides.id;\n if (overrides?.name) parsed.name = overrides.name;\n if (overrides?.category && STANDARD_CATEGORIES.includes(overrides.category)) {\n parsed.category = overrides.category;\n }\n\n const validated = validateStandard(parsed);\n\n if (BUILTIN_STANDARD_IDS.has(validated.id)) {\n throw new DevWorkspaceError(\n 'USAGE',\n `Cannot ingest standard with ID \"${validated.id}\": conflicts with built-in standard. Choose a unique ID.`,\n );\n }\n\n // Save to project custom standards directory\n const customDir = path.join(workspaceDir, '.devworkspace', 'standards', 'custom');\n await fs.mkdir(customDir, { recursive: true });\n const targetFile = path.join(customDir, `${validated.id}.json`);\n\n try {\n await fs.access(targetFile);\n if (!overrides?.overwrite) {\n throw new DevWorkspaceError(\n 'USAGE',\n `Standard \"${validated.id}\" already exists at ${targetFile}. Use --force to overwrite or choose another ID.`,\n );\n }\n } catch (err: any) {\n if (err instanceof DevWorkspaceError) throw err;\n }\n\n await fs.writeFile(targetFile, JSON.stringify(validated, null, 2), 'utf8');\n\n return {\n standard: validated,\n createdFile: targetFile,\n recommendations: [\n `Standard imported with status \"${validated.status}\".`,\n `Inspect ${targetFile} to refine rules, applicability, and validation logic.`,\n `Promote to APPROVED with \"devworkspace standards approve ${validated.id}\".`,\n ],\n };\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ApplicabilityCriteria, EngineeringStandard } from '../schema/types.js';
|
|
2
|
+
export interface ProjectTechnologies {
|
|
3
|
+
ecosystems: string[];
|
|
4
|
+
languages: string[];
|
|
5
|
+
frameworks: string[];
|
|
6
|
+
databases: string[];
|
|
7
|
+
platforms: string[];
|
|
8
|
+
appTypes: string[];
|
|
9
|
+
manifests: string[];
|
|
10
|
+
fileList: string[];
|
|
11
|
+
testing?: string[];
|
|
12
|
+
isMonorepo?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface StandardMatch {
|
|
15
|
+
standard: EngineeringStandard;
|
|
16
|
+
reasons: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface ProjectApplicabilityReport {
|
|
19
|
+
technologies: ProjectTechnologies;
|
|
20
|
+
applicable: StandardMatch[];
|
|
21
|
+
excluded: StandardMatch[];
|
|
22
|
+
}
|
|
23
|
+
export declare class ProjectApplicabilityEngine {
|
|
24
|
+
readonly workspaceDir?: string | undefined;
|
|
25
|
+
constructor(workspaceDir?: string | undefined);
|
|
26
|
+
/** Synchronous detection of project stack */
|
|
27
|
+
detectTechnologies(workspaceDir?: string): ProjectTechnologies;
|
|
28
|
+
/** Asynchronous detection of project stack */
|
|
29
|
+
detectProjectTechnologies(workspaceDir: string): Promise<ProjectTechnologies>;
|
|
30
|
+
/** Evaluates criteria matching against detected technologies */
|
|
31
|
+
isApplicable(criteria: ApplicabilityCriteria, tech?: ProjectTechnologies): boolean;
|
|
32
|
+
/** Evaluates standard against tech */
|
|
33
|
+
evaluateStandard(standard: EngineeringStandard, tech: ProjectTechnologies, _workspaceDir?: string): {
|
|
34
|
+
applicable: boolean;
|
|
35
|
+
reasons: string[];
|
|
36
|
+
};
|
|
37
|
+
evaluateApplicability(standards: EngineeringStandard[], workspaceDir: string): Promise<ProjectApplicabilityReport>;
|
|
38
|
+
}
|