docuvia 1.17.2 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast-worker.js +1 -1
- package/dist/ast-worker.js.map +1 -1
- package/dist/{chunk-4EBYMWAR.js → chunk-5QNBUBRK.js} +2 -2
- package/dist/{chunk-4EBYMWAR.js.map → chunk-5QNBUBRK.js.map} +1 -1
- package/dist/chunk-5YVZPH7A.js +99 -0
- package/dist/chunk-5YVZPH7A.js.map +1 -0
- package/dist/{chunk-6U56UWBD.js → chunk-FAPB7UNG.js} +2 -2
- package/dist/chunk-LAYFAWSJ.js +62 -0
- package/dist/chunk-LAYFAWSJ.js.map +1 -0
- package/dist/cli.js +303 -162
- package/dist/cli.js.map +1 -1
- package/dist/fs-utils-LSXZPCGZ.js +3 -0
- package/dist/{init-templates-HK62SFL5.js → init-templates-WYU7EKWT.js} +2 -2
- package/dist/migrations/0013_call_site_resolutions.sql +70 -0
- package/dist/migrations/0014_call_site_resolution_dependencies.sql +14 -0
- package/dist/migrations/0015_call_site_rule_quarantines.sql +15 -0
- package/dist/migrations/0016_call_site_projection_callers.sql +10 -0
- package/dist/migrations/0017_verified_call_site_targets.sql +118 -0
- package/package.json +1 -1
- package/dist/chunk-DXPDAPXW.js +0 -62
- package/dist/chunk-DXPDAPXW.js.map +0 -1
- package/dist/chunk-HYERMOZO.js +0 -99
- package/dist/chunk-HYERMOZO.js.map +0 -1
- package/dist/fs-utils-YXYBKROA.js +0 -3
- /package/dist/{chunk-6U56UWBD.js.map → chunk-FAPB7UNG.js.map} +0 -0
- /package/dist/{fs-utils-YXYBKROA.js.map → fs-utils-LSXZPCGZ.js.map} +0 -0
- /package/dist/{init-templates-HK62SFL5.js.map → init-templates-WYU7EKWT.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/init-templates.ts"],"sourcesContent":["// Shared with lib/ui-core's DoctorWorkflow agent-hooks diagnostic -- defined in\n// @workspace/contracts so neither side depends on the other; re-exported here so this file\n// stays the single import path\n// every platform installer already uses. Also imported (not just re-exported) below so\n// CLAUDE_PROJECT_HOOKS_DIR can build off the same value instead of re-typing it.\nimport { CLAUDE_HOOKS_DIR } from \"@workspace/contracts\";\nexport {\n CLAUDE_HOOKS_DIR,\n CURSOR_HOOKS_DIR,\n DOCUVIA_HOOK_JS_FILENAME,\n DOCUVIA_HOOK_CJS_FILENAME,\n} from \"@workspace/contracts\";\n// `context-injection`'s enforcement gate (issue #42 §7.5): this file is itself normal\n// TypeScript, so it can import the shared literal values and interpolate them into the\n// generated `.js` template text at compile time -- the *generated* raw hook script on disk just\n// contains the resolved strings, no runtime import (a standalone `.js` hook file has no\n// `@workspace/contracts` to import from).\nimport {\n HookNames,\n HOOKS_CONFIG_FILE_NAME,\n DOCUVIA_DIR_NAME,\n} from \"@workspace/contracts\";\n\nexport const GITHUB_DIR = \".github\";\nexport const CLAUDE_DIR = \".claude\";\n\nexport const HOOKS_CONFIG_FILENAME = \"hooks.json\";\nexport const SETTINGS_JSON_FILENAME = \"settings.json\";\n\nexport const CURSOR_MCP_CONFIG_PATH = \".cursor/mcp.json\";\nexport const CLAUDE_DESKTOP_CONFIG_FILENAME = \"claude_desktop_config.json\";\nexport const MCP_SERVER_ALIAS = \"docuvia-local\";\n\nexport const COPILOT_INSTRUCTIONS_FILENAME = \"copilot-instructions.md\";\nexport const CLAUDE_MD_FILENAME = \"CLAUDE.md\";\nexport const CURSOR_RULES_FILENAME = \".cursorrules\";\nexport const AGENT_INSTRUCTIONS_MARKER = \"docuvia:start\";\nexport const AGENT_INSTRUCTIONS_END_MARKER = \"docuvia:end\";\n\n// PLAT-008 legacy-only: these two files were written by the retired \"Markdown Agents\" catch-all\n// and are never installed to anymore, but `uninstall` still best-effort cleans them up for repos\n// set up under an older Docuvia version.\nexport const WINDSURF_RULES_FILENAME = \".windsurfrules\";\nexport const LLMS_TXT_FILENAME = \"llms.txt\";\n\nexport const AGENTS_MD_FILENAME = \"AGENTS.md\";\nexport const HERMES_MD_FILENAME = \".hermes.md\";\nexport const CONTINUE_RULES_DIR = \".continue/rules\";\nexport const CONTINUE_RULES_FILENAME = \"docuvia.md\";\n\nexport const PLATFORM_NAME_CURSOR = \"Cursor\";\nexport const PLATFORM_NAME_CLAUDE = \"Claude\";\nexport const PLATFORM_NAME_COPILOT = \"GitHub Copilot\";\nexport const PLATFORM_NAME_CODEX = \"Codex\";\nexport const PLATFORM_NAME_CONTINUE = \"Continue\";\nexport const PLATFORM_NAME_HERMES = \"Hermes Agent\";\n\n// Stable, CLI-facing identifiers for --platform= — PLATFORM_NAME_* above is the display name only.\nexport const PLATFORM_SLUG_CURSOR = \"cursor\";\nexport const PLATFORM_SLUG_CLAUDE = \"claude\";\nexport const PLATFORM_SLUG_COPILOT = \"copilot\";\nexport const PLATFORM_SLUG_CODEX = \"codex\";\nexport const PLATFORM_SLUG_CONTINUE = \"continue\";\nexport const PLATFORM_SLUG_HERMES = \"hermes\";\n\n// Literal placeholder text written into each platform's hooks.json `${HOOKS_DIR}` substitution —\n// the platform itself expands these at runtime, so they must stay un-interpolated here.\nexport const CLAUDE_PLUGIN_HOOKS_DIR = \"${CLAUDE_PLUGIN_ROOT}/hooks\";\nexport const CURSOR_PLUGIN_HOOKS_DIR = \"${CURSOR_PLUGIN_ROOT}/hooks\";\n\n// Project-level equivalent of CLAUDE_PLUGIN_HOOKS_DIR above. `${CLAUDE_PLUGIN_ROOT}` only resolves\n// inside a formal Claude Code plugin install (and is currently broken there too --\n// anthropics/claude-code#24529); `${CLAUDE_PROJECT_DIR}` resolves correctly today in a project-level\n// `.claude/settings.json` hook, so ClaudePlatform also writes a hook entry through this path,\n// pointing at the same `.claude/hooks` dir `configureHooks` already writes `docuvia-hook.js` into\n// (roadmap-and-open-items.md item 26).\nexport const CLAUDE_PROJECT_HOOKS_DIR =\n \"${CLAUDE_PROJECT_DIR}/\" + CLAUDE_HOOKS_DIR;\n\nexport const NPX_COMMAND = \"npx\";\nexport const NPX_YES_FLAG = \"-y\";\nexport const NPX_NO_INSTALL_FLAG = \"--no-install\";\nexport const DOCUVIA_MCP_LAUNCH_ARGS = [\"docuvia\", \"mcp\"];\nexport const DOCUVIA_WORKSPACE_ROOT_ENV_VAR = \"DOCUVIA_WORKSPACE_ROOT\";\n\nexport const DOCUVIA_HOOK_JS = `#!/usr/bin/env node\n/**\n * Docuvia Agent Hook\n * Intercepts AI searches and augments with high-density AST context from local SQLite.\n */\nconst { execFileSync } = require('child_process');\n\nfunction readInput() {\n try {\n const data = require('fs').readFileSync(0, 'utf-8');\n return JSON.parse(data);\n } catch {\n return {};\n }\n}\n\n// \\`docuvia hooks disable ${HookNames.CONTEXT_INJECTION}\\`'s enforcement (issue #42 §7.5) -- a\n// plain synchronous read, no subprocess: this hook fires on every Grep/Glob/Bash/Read, so a\n// second \\`npx docuvia ...\\` spawn per call would be a real, continuous latency cost, not a\n// one-off. Missing/unparseable config -> enabled (fail open, matches the always-on behavior this\n// toggle is retrofitted onto).\nfunction isEnabled() {\n try {\n const config = JSON.parse(\n require('fs').readFileSync('${DOCUVIA_DIR_NAME}/${HOOKS_CONFIG_FILE_NAME}', 'utf-8'),\n );\n return config['${HookNames.CONTEXT_INJECTION}'] !== false;\n } catch {\n return true;\n }\n}\n\nconst input = readInput();\n// Use the query arguments as the target to retrieve context\nconst target = input.args ? input.args.query || input.args.pattern : null;\n\nif (target && isEnabled()) {\n try {\n // Call the local Docuvia CLI to retrieve exact L2/L3 structural context. target is passed as a\n // literal argv element via execFileSync (no shell) instead of string-interpolated into an\n // execSync shell command (issue #51): target is tool-call input (Grep/Glob/Bash/Read\n // query/pattern) that an agent or, transitively, a prompt can influence, so the old\n // interpolation was a real shell-injection exposure. npx is a .cmd shim on Windows that\n // execFileSync can't spawn as a bare name, so resolve the platform-specific name inline (this\n // standalone script can't import windows-shell-spawn.ts).\n const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';\n const context = execFileSync(\n npx,\n ['--no-install', 'docuvia', 'query', target, '--format=prompt'],\n { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] },\n );\n if (context && context.trim().length > 0) {\n console.log(\"=== Docuvia Context injected ===\");\n console.log(context);\n console.log(\"================================\");\n }\n } catch (e) {\n const errorMsg = e instanceof Error ? e.message : String(e);\n console.error(\"[Docuvia Pre-Command] Failed to retrieve context: \" + errorMsg);\n }\n}\n`;\n\n// Named so the merge/prune logic in claude.platform.ts's project-level `.claude/settings.json`\n// support reuses this exact key instead of re-typing the literal (a typo there would silently\n// desync the two).\nexport const HOOK_EVENT_PRE_TOOL_USE = \"PreToolUse\";\n\nexport const HOOKS_JSON = JSON.stringify(\n {\n [HOOK_EVENT_PRE_TOOL_USE]: [\n {\n hooks: [\n {\n command: \"node ${HOOKS_DIR}/docuvia-hook.js\",\n statusMessage: \"Enriching with Docuvia architectural context...\",\n timeout: 5,\n type: \"command\",\n },\n ],\n matcher: \"Grep|Glob|Bash|Read\",\n },\n ],\n },\n null,\n 2,\n);\n\nexport const AGENT_INSTRUCTIONS = `\n<!-- ${AGENT_INSTRUCTIONS_MARKER} -->\n# Docuvia — Codebase Knowledge Evolver\n\nThis project uses Docuvia to manage architectural context and prevent blast-radius regressions.\nGrep/Glob/Read are the most expensive tools available to you — before reaching for them to explore the codebase, query the local knowledge graph instead, and before editing a symbol or file, check its blast radius:\n\nRun: \\`npx --no-install docuvia query \"<concept_or_file>\" --format=prompt\\`\nRun: \\`npx --no-install docuvia impact <symbolOrFile>\\`\n\nUse the results to understand architectural boundaries, historical decisions, and potential blast radius before modifying code. Only fall back to Grep/Glob/Read when the graph returns nothing, the target is flagged \\`tier_b_status=\"unprocessed\"\\` (unknown, not zero), you need exact source text/formatting a structural query can't capture, or \\`query\\` returns a non-\\`exact\\` \\`match_type\\` (keyword/neighbor) for what should be a well-known symbol or file.\n\nAfter making a code change that reflects a real architectural decision, rule, or notable rationale, stage it so the graph picks it up without a separate write step:\n\nRun: \\`npx --no-install docuvia analyze <file> --agent-authored --stage\\`\n\nPipe a JSON payload on stdin (default) — \\`{\"decisions\":[{\"title\":string,\"content\":string,\"nodeType\":\"change\"|\"rule\"|\"decision\"|\"context\",\"confidence\":number}]}\\` — or pass \\`--decisions-file=<path>\\` instead. Put \\`--agent-authored\\`/\\`--stage\\` after the positional \\`<file>\\`, not before — a flag preceding the path silently swallows it as the flag's own value. Staged decisions flush into the knowledge graph automatically the next time you commit a change touching that file — nothing else to run.\n<!-- docuvia:end -->\n`;\n"],"mappings":";+DAuBO,IAAMA,EAAa,UACbC,EAAa,UAEbC,EAAwB,aACxBC,EAAyB,gBAEzBC,EAAyB,mBACzBC,EAAiC,6BACjCC,EAAmB,gBAEnBC,EAAgC,0BAChCC,EAAqB,YACrBC,EAAwB,eACxBC,EAA4B,gBAC5BC,EAAgC,cAKhCC,EAA0B,iBAC1BC,EAAoB,WAEpBC,EAAqB,YACrBC,EAAqB,aACrBC,EAAqB,kBACrBC,EAA0B,aAE1BC,EAAuB,SACvBC,EAAuB,SACvBC,EAAwB,iBACxBC,EAAsB,QACtBC,EAAyB,WACzBC,EAAuB,eAGvBC,EAAuB,SACvBC,EAAuB,SACvBC,EAAwB,UACxBC,EAAsB,QACtBC,EAAyB,WACzBC,EAAuB,SAIvBC,EAA0B,8BAC1BC,EAA0B,8BAQ1BC,EACX,yBAA2BC,EAEhBC,EAAc,MACdC,EAAe,KACfC,EAAsB,eACtBC,EAA0B,CAAC,UAAW,KAAK,EAC3CC,EAAiC,yBAEjCC,EAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAgBFC,EAAU,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAQpBC,CAAgB,IAAIC,CAAsB;AAAA;AAAA,qBAEzDF,EAAU,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwCnCG,EAA0B,aAE1BC,EAAa,KAAK,UAC7B,CACE,CAACD,CAAuB,EAAG,CACzB,CACE,MAAO,CACL,CACE,QAAS,oCACT,cAAe,kDACf,QAAS,EACT,KAAM,SACR,CACF,EACA,QAAS,qBACX,CACF,CACF,EACA,KACA,CACF,EAEaE,EAAqB;AAAA,OAC3BnC,CAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":["GITHUB_DIR","CLAUDE_DIR","HOOKS_CONFIG_FILENAME","SETTINGS_JSON_FILENAME","CURSOR_MCP_CONFIG_PATH","CLAUDE_DESKTOP_CONFIG_FILENAME","MCP_SERVER_ALIAS","COPILOT_INSTRUCTIONS_FILENAME","CLAUDE_MD_FILENAME","CURSOR_RULES_FILENAME","AGENT_INSTRUCTIONS_MARKER","AGENT_INSTRUCTIONS_END_MARKER","WINDSURF_RULES_FILENAME","LLMS_TXT_FILENAME","AGENTS_MD_FILENAME","HERMES_MD_FILENAME","CONTINUE_RULES_DIR","CONTINUE_RULES_FILENAME","PLATFORM_NAME_CURSOR","PLATFORM_NAME_CLAUDE","PLATFORM_NAME_COPILOT","PLATFORM_NAME_CODEX","PLATFORM_NAME_CONTINUE","PLATFORM_NAME_HERMES","PLATFORM_SLUG_CURSOR","PLATFORM_SLUG_CLAUDE","PLATFORM_SLUG_COPILOT","PLATFORM_SLUG_CODEX","PLATFORM_SLUG_CONTINUE","PLATFORM_SLUG_HERMES","CLAUDE_PLUGIN_HOOKS_DIR","CURSOR_PLUGIN_HOOKS_DIR","CLAUDE_PROJECT_HOOKS_DIR","CLAUDE_HOOKS_DIR","NPX_COMMAND","NPX_YES_FLAG","NPX_NO_INSTALL_FLAG","DOCUVIA_MCP_LAUNCH_ARGS","DOCUVIA_WORKSPACE_ROOT_ENV_VAR","DOCUVIA_HOOK_JS","HookNames","DOCUVIA_DIR_NAME","HOOKS_CONFIG_FILE_NAME","HOOK_EVENT_PRE_TOOL_USE","HOOKS_JSON","AGENT_INSTRUCTIONS"]}
|
|
1
|
+
{"version":3,"sources":["../src/constants/init-templates.ts"],"sourcesContent":["// Shared with lib/ui-core's DoctorWorkflow agent-hooks diagnostic -- defined in\n// @workspace/contracts so neither side depends on the other; re-exported here so this file\n// stays the single import path\n// every platform installer already uses. Also imported (not just re-exported) below so\n// CLAUDE_PROJECT_HOOKS_DIR can build off the same value instead of re-typing it.\nimport { CLAUDE_HOOKS_DIR } from \"@workspace/contracts\";\nexport {\n CLAUDE_HOOKS_DIR,\n CURSOR_HOOKS_DIR,\n DOCUVIA_HOOK_JS_FILENAME,\n DOCUVIA_HOOK_CJS_FILENAME,\n} from \"@workspace/contracts\";\n// `context-injection`'s enforcement gate (issue #42 §7.5): this file is itself normal\n// TypeScript, so it can import the shared literal values and interpolate them into the\n// generated `.js` template text at compile time -- the *generated* raw hook script on disk just\n// contains the resolved strings, no runtime import (a standalone `.js` hook file has no\n// `@workspace/contracts` to import from).\nimport {\n HookNames,\n HOOKS_CONFIG_FILE_NAME,\n DOCUVIA_DIR_NAME,\n} from \"@workspace/contracts\";\n\nexport const GITHUB_DIR = \".github\";\nexport const CLAUDE_DIR = \".claude\";\n\nexport const HOOKS_CONFIG_FILENAME = \"hooks.json\";\nexport const SETTINGS_JSON_FILENAME = \"settings.json\";\n\nexport const CURSOR_MCP_CONFIG_PATH = \".cursor/mcp.json\";\nexport const CLAUDE_DESKTOP_CONFIG_FILENAME = \"claude_desktop_config.json\";\nexport const MCP_SERVER_ALIAS = \"docuvia-local\";\n\nexport const COPILOT_INSTRUCTIONS_FILENAME = \"copilot-instructions.md\";\nexport const CLAUDE_MD_FILENAME = \"CLAUDE.md\";\nexport const CURSOR_RULES_FILENAME = \".cursorrules\";\nexport const AGENT_INSTRUCTIONS_MARKER = \"docuvia:start\";\nexport const AGENT_INSTRUCTIONS_END_MARKER = \"docuvia:end\";\n\n// PLAT-008 legacy-only: these two files were written by the retired \"Markdown Agents\" catch-all\n// and are never installed to anymore, but `uninstall` still best-effort cleans them up for repos\n// set up under an older Docuvia version.\nexport const WINDSURF_RULES_FILENAME = \".windsurfrules\";\nexport const LLMS_TXT_FILENAME = \"llms.txt\";\n\nexport const AGENTS_MD_FILENAME = \"AGENTS.md\";\nexport const HERMES_MD_FILENAME = \".hermes.md\";\nexport const CONTINUE_RULES_DIR = \".continue/rules\";\nexport const CONTINUE_RULES_FILENAME = \"docuvia.md\";\n\nexport const PLATFORM_NAME_CURSOR = \"Cursor\";\nexport const PLATFORM_NAME_CLAUDE = \"Claude\";\nexport const PLATFORM_NAME_COPILOT = \"GitHub Copilot\";\nexport const PLATFORM_NAME_CODEX = \"Codex\";\nexport const PLATFORM_NAME_CONTINUE = \"Continue\";\nexport const PLATFORM_NAME_HERMES = \"Hermes Agent\";\n\n// Stable, CLI-facing identifiers for --platform= — PLATFORM_NAME_* above is the display name only.\nexport const PLATFORM_SLUG_CURSOR = \"cursor\";\nexport const PLATFORM_SLUG_CLAUDE = \"claude\";\nexport const PLATFORM_SLUG_COPILOT = \"copilot\";\nexport const PLATFORM_SLUG_CODEX = \"codex\";\nexport const PLATFORM_SLUG_CONTINUE = \"continue\";\nexport const PLATFORM_SLUG_HERMES = \"hermes\";\n\n// Literal placeholder text written into each platform's hooks.json `${HOOKS_DIR}` substitution —\n// the platform itself expands these at runtime, so they must stay un-interpolated here.\nexport const CLAUDE_PLUGIN_HOOKS_DIR = \"${CLAUDE_PLUGIN_ROOT}/hooks\";\nexport const CURSOR_PLUGIN_HOOKS_DIR = \"${CURSOR_PLUGIN_ROOT}/hooks\";\n\n// Project-level equivalent of CLAUDE_PLUGIN_HOOKS_DIR above. `${CLAUDE_PLUGIN_ROOT}` only resolves\n// inside a formal Claude Code plugin install (and is currently broken there too --\n// anthropics/claude-code#24529); `${CLAUDE_PROJECT_DIR}` resolves correctly today in a project-level\n// `.claude/settings.json` hook, so ClaudePlatform also writes a hook entry through this path,\n// pointing at the same `.claude/hooks` dir `configureHooks` already writes `docuvia-hook.js` into\n// (roadmap-and-open-items.md item 26).\nexport const CLAUDE_PROJECT_HOOKS_DIR =\n \"${CLAUDE_PROJECT_DIR}/\" + CLAUDE_HOOKS_DIR;\n\nexport const NPX_COMMAND = \"npx\";\nexport const NPX_YES_FLAG = \"-y\";\nexport const NPX_NO_INSTALL_FLAG = \"--no-install\";\nexport const DOCUVIA_MCP_LAUNCH_ARGS = [\"docuvia\", \"mcp\"];\nexport const DOCUVIA_WORKSPACE_ROOT_ENV_VAR = \"DOCUVIA_WORKSPACE_ROOT\";\n\nexport const DOCUVIA_HOOK_JS = `#!/usr/bin/env node\n/**\n * Docuvia Agent Hook\n * Intercepts AI searches and augments with high-density AST context from local SQLite.\n */\nconst { execFileSync } = require('child_process');\n\nfunction readInput() {\n try {\n const data = require('fs').readFileSync(0, 'utf-8');\n return JSON.parse(data);\n } catch {\n return {};\n }\n}\n\n// \\`docuvia hooks disable ${HookNames.CONTEXT_INJECTION}\\`'s enforcement (issue #42 §7.5) -- a\n// plain synchronous read, no subprocess: this hook fires on every Grep/Glob/Bash/Read, so a\n// second \\`npx docuvia ...\\` spawn per call would be a real, continuous latency cost, not a\n// one-off. Missing/unparseable config -> enabled (fail open, matches the always-on behavior this\n// toggle is retrofitted onto).\nfunction isEnabled() {\n try {\n const config = JSON.parse(\n require('fs').readFileSync('${DOCUVIA_DIR_NAME}/${HOOKS_CONFIG_FILE_NAME}', 'utf-8'),\n );\n return config['${HookNames.CONTEXT_INJECTION}'] !== false;\n } catch {\n return true;\n }\n}\n\nconst input = readInput();\n// Use the query arguments as the target to retrieve context\nconst target = input.args ? input.args.query || input.args.pattern : null;\n\nif (target && isEnabled()) {\n try {\n // Call the local Docuvia CLI to retrieve exact L2/L3 structural context. target is passed as a\n // literal argv element via execFileSync (no shell) instead of string-interpolated into an\n // execSync shell command (issue #51): target is tool-call input (Grep/Glob/Bash/Read\n // query/pattern) that an agent or, transitively, a prompt can influence, so the old\n // interpolation was a real shell-injection exposure. npx is a .cmd shim on Windows that\n // execFileSync can't spawn as a bare name, so resolve the platform-specific name inline (this\n // standalone script can't import windows-shell-spawn.ts).\n const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';\n const context = execFileSync(\n npx,\n ['--no-install', 'docuvia', 'query', target, '--format=prompt'],\n { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] },\n );\n if (context && context.trim().length > 0) {\n console.log(\"=== Docuvia Context injected ===\");\n console.log(context);\n console.log(\"================================\");\n }\n } catch (e) {\n const errorMsg = e instanceof Error ? e.message : String(e);\n console.error(\"[Docuvia Pre-Command] Failed to retrieve context: \" + errorMsg);\n }\n}\n`;\n\n// Named so the merge/prune logic in claude.platform.ts's project-level `.claude/settings.json`\n// support reuses this exact key instead of re-typing the literal (a typo there would silently\n// desync the two).\nexport const HOOK_EVENT_PRE_TOOL_USE = \"PreToolUse\";\n\nexport const HOOKS_JSON = JSON.stringify(\n {\n [HOOK_EVENT_PRE_TOOL_USE]: [\n {\n hooks: [\n {\n command: \"node ${HOOKS_DIR}/docuvia-hook.js\",\n statusMessage: \"Enriching with Docuvia architectural context...\",\n timeout: 5,\n type: \"command\",\n },\n ],\n matcher: \"Grep|Glob|Bash|Read\",\n },\n ],\n },\n null,\n 2,\n);\n\nexport const AGENT_INSTRUCTIONS = `\n<!-- ${AGENT_INSTRUCTIONS_MARKER} -->\n# Docuvia — Codebase Knowledge Evolver\n\nThis project uses Docuvia to manage architectural context and prevent blast-radius regressions.\nGrep/Glob/Read are the most expensive tools available to you — before reaching for them to explore the codebase, query the local knowledge graph instead, and before editing a symbol or file, check its blast radius:\n\nRun: \\`npx --no-install docuvia query \"<concept_or_file>\" --format=prompt\\`\nRun: \\`npx --no-install docuvia impact <symbolOrFile>\\`\n\nUse the results to understand architectural boundaries, historical decisions, and potential blast radius before modifying code. Only fall back to Grep/Glob/Read when the graph returns nothing, the target is flagged \\`tier_b_status=\"unprocessed\"\\` (unknown, not zero), you need exact source text/formatting a structural query can't capture, or \\`query\\` returns a non-\\`exact\\` \\`match_type\\` (keyword/neighbor) for what should be a well-known symbol or file.\n\nAfter making a code change that reflects a real architectural decision, rule, or notable rationale, stage it so the graph picks it up without a separate write step:\n\nRun: \\`npx --no-install docuvia analyze <file> --agent-authored --stage\\`\n\nPipe a JSON payload on stdin (default) — \\`{\"decisions\":[{\"title\":string,\"content\":string,\"nodeType\":\"change\"|\"rule\"|\"decision\"|\"context\",\"confidence\":number}]}\\` — or pass \\`--decisions-file=<path>\\` instead. Put \\`--agent-authored\\`/\\`--stage\\` after the positional \\`<file>\\`, not before — a flag preceding the path silently swallows it as the flag's own value. Staged decisions flush into the knowledge graph automatically the next time you commit a change touching that file — nothing else to run.\n<!-- docuvia:end -->\n`;\n"],"mappings":";iEAuBO,IAAMA,EAAa,UACbC,EAAa,UAEbC,EAAwB,aACxBC,EAAyB,gBAEzBC,EAAyB,mBACzBC,EAAiC,6BACjCC,EAAmB,gBAEnBC,EAAgC,0BAChCC,EAAqB,YACrBC,EAAwB,eACxBC,EAA4B,gBAC5BC,EAAgC,cAKhCC,EAA0B,iBAC1BC,EAAoB,WAEpBC,EAAqB,YACrBC,EAAqB,aACrBC,EAAqB,kBACrBC,EAA0B,aAE1BC,EAAuB,SACvBC,EAAuB,SACvBC,EAAwB,iBACxBC,EAAsB,QACtBC,EAAyB,WACzBC,EAAuB,eAGvBC,EAAuB,SACvBC,EAAuB,SACvBC,EAAwB,UACxBC,EAAsB,QACtBC,EAAyB,WACzBC,EAAuB,SAIvBC,EAA0B,8BAC1BC,EAA0B,8BAQ1BC,EACX,yBAA2BC,EAEhBC,EAAc,MACdC,EAAe,KACfC,EAAsB,eACtBC,EAA0B,CAAC,UAAW,KAAK,EAC3CC,EAAiC,yBAEjCC,EAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAgBFC,EAAU,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAQpBC,CAAgB,IAAIC,CAAsB;AAAA;AAAA,qBAEzDF,EAAU,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwCnCG,EAA0B,aAE1BC,EAAa,KAAK,UAC7B,CACE,CAACD,CAAuB,EAAG,CACzB,CACE,MAAO,CACL,CACE,QAAS,oCACT,cAAe,kDACf,QAAS,EACT,KAAM,SACR,CACF,EACA,QAAS,qBACX,CACF,CACF,EACA,KACA,CACF,EAEaE,EAAqB;AAAA,OAC3BnC,CAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":["GITHUB_DIR","CLAUDE_DIR","HOOKS_CONFIG_FILENAME","SETTINGS_JSON_FILENAME","CURSOR_MCP_CONFIG_PATH","CLAUDE_DESKTOP_CONFIG_FILENAME","MCP_SERVER_ALIAS","COPILOT_INSTRUCTIONS_FILENAME","CLAUDE_MD_FILENAME","CURSOR_RULES_FILENAME","AGENT_INSTRUCTIONS_MARKER","AGENT_INSTRUCTIONS_END_MARKER","WINDSURF_RULES_FILENAME","LLMS_TXT_FILENAME","AGENTS_MD_FILENAME","HERMES_MD_FILENAME","CONTINUE_RULES_DIR","CONTINUE_RULES_FILENAME","PLATFORM_NAME_CURSOR","PLATFORM_NAME_CLAUDE","PLATFORM_NAME_COPILOT","PLATFORM_NAME_CODEX","PLATFORM_NAME_CONTINUE","PLATFORM_NAME_HERMES","PLATFORM_SLUG_CURSOR","PLATFORM_SLUG_CLAUDE","PLATFORM_SLUG_COPILOT","PLATFORM_SLUG_CODEX","PLATFORM_SLUG_CONTINUE","PLATFORM_SLUG_HERMES","CLAUDE_PLUGIN_HOOKS_DIR","CURSOR_PLUGIN_HOOKS_DIR","CLAUDE_PROJECT_HOOKS_DIR","CLAUDE_HOOKS_DIR","NPX_COMMAND","NPX_YES_FLAG","NPX_NO_INSTALL_FLAG","DOCUVIA_MCP_LAUNCH_ARGS","DOCUVIA_WORKSPACE_ROOT_ENV_VAR","DOCUVIA_HOOK_JS","HookNames","DOCUVIA_DIR_NAME","HOOKS_CONFIG_FILE_NAME","HOOK_EVENT_PRE_TOOL_USE","HOOKS_JSON","AGENT_INSTRUCTIONS"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var a={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"};var d="ipc-log",te=new Set(Object.values(a));function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R(e){if(!v(e))return!1;let{type:t,level:n,message:o,context:i}=e;return t===d&&typeof n=="string"&&te.has(n)&&typeof o=="string"&&(i===void 0||v(i))}var f=class{constructor(t){this.postMessageFn=t}postMessageFn;debug(t,n){this.send(a.DEBUG,t,n)}info(t,n){this.send(a.INFO,t,n)}warn(t,n){this.send(a.WARN,t,n)}error(t,n){this.send(a.ERROR,t,n)}onLog(){return()=>{}}send(t,n,o){let i=o?{type:d,level:t,message:n,context:o}:{type:d,level:t,message:n};this.postMessageFn(i)}};var y={CONTEXT_INJECTION:"context-injection",COMMIT_L3_WRITE:"commit-l3-write",TIER_B_C_PREPUSH:"tier-b-c-prepush"},ne={[y.CONTEXT_INJECTION]:!0,[y.COMMIT_L3_WRITE]:!0,[y.TIER_B_C_PREPUSH]:!0};var C=".docuvia",oe="logs",re="init.log",ie="clean.log",se="status.log",ae="sync.log",le="analyze.log",ce="review.log",de="impact.log",pe="query.log",ue="export-topology.log",ge="snapshot.log",ye="hydrate.log",me="sync-knowledge.log",A="node_modules",Se="local.db",Ee="init.lock",_e="tierC.lock",Re="sync-state.json",fe="hooks-config.json",Ce="pending-l3-decisions.json";var Ae="utf8";var Te="sha256";var s={TYPESCRIPT:"typescript",JAVASCRIPT:"javascript",PYTHON:"python",RUST:"rust",GO:"go",JAVA:"java",C:"c",CPP:"cpp",RUBY:"ruby",PHP:"php",CSHARP:"csharp"};var x=".claude/hooks",P=".cursor/hooks",b="docuvia-hook.js",M="docuvia-hook.cjs";var Ie=[`${x}/${b}`,`${P}/${M}`];function T(e){let t=e.replaceAll("\\","/");return Ie.includes(t)}var Le="EEXIST",Ne="ENOENT",Oe="EPERM",he="EACCES",De="EBUSY",ve="win32";var p=class{listeners=new Set;debug(t,n){this.emit(a.DEBUG,t,n)}info(t,n){this.emit(a.INFO,t,n)}warn(t,n){this.emit(a.WARN,t,n)}error(t,n){this.emit(a.ERROR,t,n)}onLog(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t,n,o){let i=o?{level:t,message:n,context:o}:{level:t,message:n};for(let u of this.listeners)u(i)}};function xe(){return new p}var I=class{constructor(t){this.logger=t}logger;handleMessage(t){return R(t)?(this.logger[t.level](t.message,t.context),!0):!1}};var c={GIT_COMMAND_FAILED:"GIT_COMMAND_FAILED",GIT_NETWORK_TIMEOUT:"GIT_NETWORK_TIMEOUT",GIT_NOT_A_REPOSITORY:"GIT_NOT_A_REPOSITORY",GIT_BRANCH_CREATE_FAILED:"GIT_BRANCH_CREATE_FAILED",GIT_HOOK_INSTALL_FAILED:"GIT_HOOK_INSTALL_FAILED",GIT_FAST_IMPORT_FAILED:"GIT_FAST_IMPORT_FAILED",DB_OPEN_FAILED:"DB_OPEN_FAILED",DB_NOT_FOUND:"DB_NOT_FOUND",DB_MIGRATION_FAILED:"DB_MIGRATION_FAILED",DB_QUERY_FAILED:"DB_QUERY_FAILED",DB_LOCKED:"DB_LOCKED",AST_WORKER_CRASHED:"AST_WORKER_CRASHED",AST_PARSE_FAILED:"AST_PARSE_FAILED",CALL_RESOLUTION_PROJECTION_SOURCE_MISSING:"CALL_RESOLUTION_PROJECTION_SOURCE_MISSING",FS_READ_FAILED:"FS_READ_FAILED",FS_PATH_TRAVERSAL:"FS_PATH_TRAVERSAL",FACTORY_TOKEN_NOT_REGISTERED:"FACTORY_TOKEN_NOT_REGISTERED",FACTORY_LOCKED:"FACTORY_LOCKED",MEMORY_SCOPE_NOT_FOUND:"MEMORY_SCOPE_NOT_FOUND",SYNC_FETCH_FAILED:"SYNC_FETCH_FAILED",SYNC_PUSH_FAILED:"SYNC_PUSH_FAILED",LLM_NOT_INITIALIZED:"LLM_NOT_INITIALIZED",LLM_CHAT_COMPLETION_FAILED:"LLM_CHAT_COMPLETION_FAILED",LLM_HTTP_FAILED:"LLM_HTTP_FAILED",LLM_RATE_LIMITED:"LLM_RATE_LIMITED",LLM_AUTH_FAILED:"LLM_AUTH_FAILED",LLM_STREAM_FAILED:"LLM_STREAM_FAILED",LLM_INVALID_RESPONSE:"LLM_INVALID_RESPONSE",SEMANTIC_CORPUS_LEAKAGE:"SEMANTIC_CORPUS_LEAKAGE",SEMANTIC_CORPUS_IO_FAILED:"SEMANTIC_CORPUS_IO_FAILED",SEMANTIC_CORPUS_INVALID:"SEMANTIC_CORPUS_INVALID",SEMANTIC_INVALID_REQUEST:"SEMANTIC_INVALID_REQUEST",SEMANTIC_INVALID_RESPONSE:"SEMANTIC_INVALID_RESPONSE",SEMANTIC_INPUT_LIMIT_EXCEEDED:"SEMANTIC_INPUT_LIMIT_EXCEEDED",SEMANTIC_CANCELLED:"SEMANTIC_CANCELLED",SEMANTIC_DEADLINE_EXCEEDED:"SEMANTIC_DEADLINE_EXCEEDED",SEMANTIC_INFERENCE_FAILED:"SEMANTIC_INFERENCE_FAILED",INIT_WORKFLOW_FAILED:"INIT_WORKFLOW_FAILED",CLEAN_WORKFLOW_FAILED:"CLEAN_WORKFLOW_FAILED",UNINSTALL_WORKFLOW_FAILED:"UNINSTALL_WORKFLOW_FAILED",INVALID_INPUT:"INVALID_INPUT"};var Pe="DocuviaError",l=class e extends Error{code;cause;constructor(t,n,o){super(n),this.name=Pe,this.code=t,this.cause=o}static wrap(t,n,o){if(o instanceof e)return o;let i=o instanceof Error?o.message:String(o);return new e(t,`${n}: ${i}`,o)}};var be={WORKSPACE_ROOT:"workspaceRoot",API_URL:"apiUrl",PROJECT_ID:"projectId",COMMIT_SHA:"commitSha",TARGET_PATH:"targetPath",LLM_BASE_URL:"llmBaseUrl",LLM_MODEL:"llmModel",BASE_REF:"baseRef",HEAD_REF:"headRef",TARGET:"target",ESCALATE_TO_LSP:"escalateToLsp",TIER_B_FULL_RESYNC:"tierBFullResync",LIMIT:"limit",EXPLAIN_RESOLUTION:"explainResolution",COLLAPSE:"collapse",KEEP_DB:"keepDb",LSP_BINARY_OVERRIDE:"lspBinaryOverride",LSP_ARGS_OVERRIDE:"lspArgsOverride",LSP_TIMEOUT_MS:"lspTimeoutMs",LSP_MAX_PROCESSES:"lspMaxProcesses",TIER_B_COMMIT_CAP:"tierBCommitCap",TIER_C_DAILY_CALL_CAP:"tierCDailyCallCap",TIER_C_DAILY_TOKEN_CAP:"tierCDailyTokenCap",TIER_C_WALL_CLOCK_MS:"tierCWallClockMs",TIER_C_ITEM_CAP:"tierCItemCap",TIER_C_LOAD_THRESHOLD:"tierCLoadThreshold",GIT_NETWORK_TIMEOUT_MS:"gitNetworkTimeoutMs",FORCE:"force",TIER_C_DRAIN_ALL:"tierCDrainAll",AGENT_AUTHORED_DECISIONS:"agentAuthoredDecisions",HOOK_NAME:"hookName",HOOK_ENABLED:"hookEnabled",FLUSH_STAGED_L3:"flushStagedL3"},Me={SCOPE_NOT_FOUND:(e,t)=>`Cannot set "${e}": memory scope "${t}" was never created`},m=class{scopes=new Map;createScope(t){this.scopes.has(t)||this.scopes.set(t,new Map)}set(t,n,o){let i=this.scopes.get(t);if(!i)throw new l(c.MEMORY_SCOPE_NOT_FOUND,Me.SCOPE_NOT_FOUND(n,t));i.set(n,o)}get(t,n){return this.scopes.get(t)?.get(n)}deleteScope(t){this.scopes.delete(t)}hasScope(t){return this.scopes.has(t)}},Fe=new m;var F={REGISTER_LOCKED:e=>`Cannot register "${e}": factory is locked (test isolation)`,PROVIDER_NOT_REGISTERED:e=>`No provider registered for "${e}" \u2014 the implementation library that owns it was never imported for its registration side effect`},S=class{providers=new Map;locked=!1;register(t,n){if(this.locked)throw new l(c.FACTORY_LOCKED,F.REGISTER_LOCKED(String(t.description)));this.providers.set(t,n)}resolve(t,n){let o=this.providers.get(t);if(!o)throw new l(c.FACTORY_TOKEN_NOT_REGISTERED,F.PROVIDER_NOT_REGISTERED(String(t.description)));return o(this,n)}has(t){return this.providers.has(t)}lock(){this.locked=!0}unlock(){this.locked=!1}reset(){this.providers.clear(),this.locked=!1}},k=new S;function r(e){return Symbol(e)}var ke={HostEnvironment:r("HostEnvironmentSnapshot"),GitProvider:r("IGitProvider"),LineBlameProvider:r("ILineBlameProvider"),KnowledgeGitService:r("IKnowledgeGitService"),FileDiscovery:r("IFileDiscovery"),ConfigScanner:r("IConfigScanner"),VcsScanner:r("IVcsScanner"),AstProcessor:r("IAstProcessor"),GraphPersister:r("IGraphPersister"),TempFileManager:r("TempFileManager"),GraphStoreOpener:r("GraphStoreOpener"),ProcessLock:r("ProcessLock"),RemoteSyncClient:r("RemoteSyncClient"),LlmClient:r("LlmClient"),QueryService:r("IQueryService"),TierBCoverageHintProvider:r("ITierBCoverageHintProvider"),ImpactService:r("IImpactService"),ChangeDetectionService:r("IChangeDetectionService"),TopologyBuilder:r("ITopologyBuilder"),SnapshotRenderer:r("ISnapshotRenderer"),HydrationService:r("IHydrationService"),DiagnosticRunnerDb:r("DiagnosticRunnerDb"),DiagnosticRunnerGit:r("DiagnosticRunnerGit"),SemanticDiffAnalyzer:r("ISemanticDiffAnalyzer"),SemanticCorpusService:r("ISemanticCorpusService"),SemanticDecisionValidator:r("ISemanticDecisionValidator"),SemanticDecisionProvider:r("ISemanticDecisionProvider"),CallResolutionHypothesisService:r("ICallResolutionHypothesisService"),EdgeResolutionProviders:r("EdgeResolutionProviders")};var we={ADDED:"added",MODIFIED:"modified",DELETED:"deleted",RENAMED:"renamed"};var He={LSP:"lsp",LLM_INFERRED:"llm-inferred"},Ue={TYPESCRIPT:"typescript",PYTHON:"python",GO:"go",RUST:"rust",JAVA:"java",CPP:"cpp",CSHARP:"csharp",PHP:"php",RUBY:"ruby"};var Ke={EDGE_RELATION:"edge-relation",IMPACT_RELEVANCE:"impact-relevance",NEEDS_VERIFICATION:"needs-verification"};var Ge={CANDIDATE:"candidate",UNKNOWN:"unknown",VERIFY:"verify"},Be=1,Ve={MAX_CANDIDATES:32,MAX_OPTIONS:34,MAX_INPUT_BYTES:32*1024},je={SCORED:"scored",UNAVAILABLE:"unavailable"},Ye={RAW:"raw",CALIBRATED:"calibrated"},We={MODEL_NOT_INSTALLED:"model-not-installed",UNSUPPORTED_CAPABILITY:"unsupported-capability"};var Qe={NO_REMOTE:"no-remote",UP_TO_DATE:"up-to-date",FAST_FORWARDED_LOCAL:"fast-forwarded-local",PUSHED_LOCAL:"pushed-local",MERGED:"merged"};import{createHash as qe}from"crypto";function Xe(e){let t=Je(e.filePath);if(!/^[a-f0-9]{64}$/.test(e.sourceContentHash))throw new Error("Call-site source content hash must be a lowercase SHA-256 hex digest");if(!Number.isSafeInteger(e.startLine)||e.startLine<0)throw new Error("Call-site start line must be a non-negative zero-based integer");if(!Number.isSafeInteger(e.startColumn)||e.startColumn<0)throw new Error("Call-site start column must be a non-negative zero-based integer");if(!w(e.calleeKind))throw new Error("Call-site callee kind must be a non-empty string without NUL bytes");if(!w(e.calleeName))throw new Error("Call-site callee name must be a non-empty string without NUL bytes");return`call-site:v1:${qe("sha256").update([t,e.sourceContentHash,String(e.startLine),String(e.startColumn),e.calleeKind,e.calleeName].join("\0"),"utf8").digest("hex")}`}function Je(e){if(typeof e!="string")throw new Error("Call-site path must be a workspace-relative POSIX path");if([e.length===0,e.endsWith("/"),e.startsWith("/"),/^[a-zA-Z]:/.test(e),e.includes("\\"),e.includes("\0")].some(Boolean))throw new Error("Call-site path must be a workspace-relative POSIX path");let n=[];for(let o of e.split("/"))if(!(!o||o===".")){if(o!==".."){n.push(o);continue}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");n.pop()}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");return n.join("/")}function w(e){return typeof e=="string"&&e.trim().length>0&&!e.includes("\0")}var ze="declared-member-hypothesis-v7",$e="ordered-evidence-v1";var Ze="q2:reexport-trace:v1",et="q3:super-call:v1",tt="q3:this-inherited:v1",nt="q3:typed-receiver:v1",ot="q3:new-receiver:v1";var rt={MODULE:"module",PACKAGE:"package",PCD:"pcd"},it={CONTAINS:"contains",CALLS:"calls",IMPLEMENTS:"implements",EXTENDS:"extends",IMPORTS:"imports",DEPENDS_ON:"depends_on",DECISION:"decision"},L={CHANGE:"change",RULE:"rule",DECISION:"decision",CONTEXT:"context"},st={PENDING:"pending",ACTIVE:"active",DRAFT:"draft",GARBAGE:"garbage"},at={ANALYZE:"analyze",AGENT_AUTHORED:"agent-authored"},lt={PROVEN:"proven",LIKELY:"likely",AMBIGUOUS:"ambiguous",UNRESOLVED:"unresolved",EXTERNAL:"external",UNSUPPORTED:"unsupported"},ct={TIER_B_TARGET_MISMATCH:"tier-b-target-mismatch"},dt={UNVERIFIED:"unverified",VERIFIED:"verified",CONTRADICTED:"contradicted"},pt="sha256-callsite-rule-v2",ut={SCOPE_RESOLVER:"scope-resolver",STRICT_PROOF:"strict-proof",HYPOTHESIS:"hypothesis",TIER_B:"tier-b"};var gt=L,yt={AUTO_FULL_INGESTION:"autoFullIngestion",AUTO_DELTA:"autoDelta",AUTO_DELTA_NOOP:"autoDeltaNoop",DECISION_EXTRACTION:"decisionExtraction",TIER_B_BATCH:"tierBBatch",FLUSH_STAGED_L3:"flushStagedL3"},mt={NO_GRAPH:"no-graph",ANCHOR_NOT_IN_GRAPH:"anchor-not-in-graph"};var St={CREATE_L3:"CREATE_L3"};var Et={SYSTEM:"system",USER:"user",ASSISTANT:"assistant",TOOL:"tool"},_t="function";var Rt={LOW:"LOW",MEDIUM:"MEDIUM",HIGH:"HIGH",CRITICAL:"CRITICAL",UNKNOWN:"UNKNOWN"},ft={EXACT:"exact",LOWER_BOUND:"lower-bound"},Ct={BOUNDED:"bounded",UNRESOLVED:"unresolved"},At={DYNAMIC_IMPORT:"dynamic-import"},Tt={CORRUPT_JSON:"corrupt-json",NOT_ARRAY:"not-array",INVALID_RECORD:"invalid-record",MISSING:"missing",INCOMPLETE_SCAN:"incomplete-scan"},It={AVAILABLE:"available",UNAVAILABLE:"unavailable"},Lt={LSP_FALLBACK:"lsp-fallback",DYNAMIC_CANDIDATE:"dynamic-candidate"};var Nt={L2:"l2",L3:"l3"};var Ot={FILE:"file",SYMBOL:"symbol",DECISION:"decision"},ht={AUTO:"auto",FILE:"file",SYMBOL:"symbol"},Dt={L1_TAG:"l1_tag",DIRECTORY:"directory"};var E={COMMIT_MESSAGE:"commitMessage",CONTRACT_SYMBOL:"contractSymbol"};function vt(e){if(e===void 0)return Mt();let t;try{t=JSON.parse(e)}catch{return H()}if(!Array.isArray(t))return H();let n=[],o=0;for(let i of t)xt(i)?n.push(i):o++;return{entries:n,invalidCount:o,corrupt:!1}}function xt(e){return!Pt(e)||typeof e.target!="string"||typeof e.commitSha!="string"||!bt(e)?!1:e.kind===E.COMMIT_MESSAGE?typeof e.message=="string":e.kind===E.CONTRACT_SYMBOL?typeof e.file=="string":!1}function Pt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bt(e){return e.failCount===void 0||typeof e.failCount=="number"&&Number.isInteger(e.failCount)&&e.failCount>=0}function Mt(){return{entries:[],invalidCount:0,corrupt:!1}}function H(){return{entries:[],invalidCount:0,corrupt:!0}}var Ft={TYPESCRIPT:"typescript",REACT:"react",EXPRESS:"express",VUE:"vue"},kt={UNKNOWN:"unknown",JAVASCRIPT:"javascript",GENERIC:"generic",RUST:"rust",PYTHON:"python",GO:"go"},wt="general",Ht={FRONTEND:"frontend",BACKEND:"backend",NEXTJS:"nextjs",SSR:"ssr",DRIZZLE:"drizzle",DATABASE:"database",TAILWINDCSS:"tailwindcss",CSS:"css",JEST:"jest",TESTING:"testing",VITEST:"vitest",POSTGRES:"postgres",MONOREPO:"monorepo",TOKIO:"tokio",ASYNC:"async",ACTIX:"actix",SERDE:"serde",TAURI:"tauri",DESKTOP:"desktop",DJANGO:"django",FASTAPI:"fastapi",PANDAS:"pandas",DATA:"data",GIN:"gin",STRICT_TS:"strict-ts",VITE:"vite",BUILD_TOOL:"build-tool"};var U="origin",N={KNOWLEDGE_ROOT:"docuvia-knowledge",KNOWLEDGE_LOG_SCAN_LIMIT:5e3,KNOWLEDGE_DIR_NAME:"knowledge",GRAPH_DIR_NAME:"graph",L3_DIR_NAME:"_l3",NODES_JSONL_NAME:"nodes.jsonl",EDGES_JSONL_NAME:"edges.jsonl",METADATA_JSON_NAME:"metadata.json",SOURCE_COMMIT_TRAILER_KEY:"Docuvia-Source",POST_COMMIT_HOOK_NAME:"post-commit",POST_COMMIT_HOOK_MARKER:"docuvia analyze",POST_COMMIT_FLUSH_L3_MARKER:"docuvia analyze --flush-staged-l3",POST_COMMIT_NOHUP_MARKER:"nohup npx --no-install docuvia analyze",DOCUVIA_HOOK_HEADER_COMMENT:"# Docuvia Knowledge Graph Evolver Hook",POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
|
|
3
|
+
# Docuvia Knowledge Graph Evolver Hook
|
|
4
|
+
# Non-intrusively extracts AST deltas in the background
|
|
5
|
+
if command -v npx > /dev/null 2>&1; then
|
|
6
|
+
mkdir -p .docuvia/logs
|
|
7
|
+
# Fire and forget (do not block commit) -- nohup keeps the process alive after this hook's
|
|
8
|
+
# shell exits; output goes to a log file (not /dev/null) so failures are visible (issue #58).
|
|
9
|
+
nohup npx --no-install docuvia analyze >> .docuvia/logs/post-commit-hook.log 2>&1 &
|
|
10
|
+
# Flush any staged agent-authored L3 decisions for this commit (roadmap items 32-34, issue #42).
|
|
11
|
+
# Self-gated internally on the commit-l3-write toggle -- see run-flush-staged-l3.ts.
|
|
12
|
+
nohup npx --no-install docuvia analyze --flush-staged-l3 >> .docuvia/logs/post-commit-hook.log 2>&1 &
|
|
13
|
+
fi
|
|
14
|
+
`,PRE_FLUSH_L3_POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
|
|
15
|
+
# Docuvia Knowledge Graph Evolver Hook
|
|
16
|
+
# Non-intrusively extracts AST deltas in the background
|
|
17
|
+
if command -v npx > /dev/null 2>&1; then
|
|
18
|
+
# Fire and forget (do not block commit)
|
|
19
|
+
npx --no-install docuvia analyze > /dev/null 2>&1 &
|
|
20
|
+
fi
|
|
21
|
+
`,PRE_NOHUP_POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
|
|
22
|
+
# Docuvia Knowledge Graph Evolver Hook
|
|
23
|
+
# Non-intrusively extracts AST deltas in the background
|
|
24
|
+
if command -v npx > /dev/null 2>&1; then
|
|
25
|
+
# Fire and forget (do not block commit)
|
|
26
|
+
npx --no-install docuvia analyze > /dev/null 2>&1 &
|
|
27
|
+
# Flush any staged agent-authored L3 decisions for this commit (roadmap items 32-34, issue #42).
|
|
28
|
+
# Self-gated internally on the commit-l3-write toggle -- see run-flush-staged-l3.ts.
|
|
29
|
+
npx --no-install docuvia analyze --flush-staged-l3 > /dev/null 2>&1 &
|
|
30
|
+
fi
|
|
31
|
+
`,LEGACY_POST_COMMIT_HOOK_MARKER:"docuvia snapshot",LEGACY_POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
|
|
32
|
+
# Docuvia Knowledge Graph Evolver Hook
|
|
33
|
+
# Non-intrusively extracts AST deltas in the background
|
|
34
|
+
if command -v npx &> /dev/null; then
|
|
35
|
+
# Fire and forget (do not block commit)
|
|
36
|
+
npx --no-install docuvia snapshot > /dev/null 2>&1 &
|
|
37
|
+
fi
|
|
38
|
+
`,LOCAL_REMOTE_URL_SCHEME:"file://",DEFAULT_REMOTE_NAME:U,REMOTE_REF_PREFIX:"refs/remotes/",HEAD_REF:"HEAD",DEFAULT_LOCAL_PROJECT_ID:1,META_KEY_KNOWLEDGE_TIP_SHA:"hydratedKnowledgeSha",META_KEY_LAST_INGESTED_SOURCE_SHA:"lastIngestedSourceSha",META_KEY_NODE_KEY_FORMAT_VERSION:"nodeKeyFormatVersion",META_KEY_TIER_B_QUEUE:"tierBQueue",EMPTY_KNOWLEDGE_TEMP_DIR_PREFIX:"docuvia-empty-knowledge-",META_KEY_LAST_TIER_B_BATCH_SHA:"lastTierBBatchSha",META_KEY_TIER_B_BATCH_PENDING:"tierBBatchPending",META_KEY_KNOWLEDGE_PACK_PENDING:"knowledgePackPending",META_KEY_TIER_B_CHANGED_BYTES:"tierBChangedBytes",DEFAULT_TIER_B_COMMIT_CAP_BYTES:512e3,DEFAULT_TIER_B_COVERAGE_FAIL_THRESHOLD:.5,DEFAULT_L2_SEMANTIC_COVERAGE_FAIL_THRESHOLD:.1,DEFAULT_STAGED_L3_STRANDED_AFTER_MS:864e5,META_KEY_TIER_B_ZERO_PROGRESS_BATCHES:"tierBZeroProgressBatches",DEFAULT_TIER_B_ZERO_PROGRESS_MAX_BATCHES:3,DEFAULT_POST_COMMIT_INGESTION_GRACE_MS:6e5,META_KEY_CALL_RESOLUTION_STATS:"callResolutionStats",DEFAULT_CALL_RESOLUTION_NOTE_THRESHOLD:.5,DEFAULT_CALL_RESOLUTION_MIN_SAMPLE:5,DEFAULT_CANARY_SAMPLE_SIZE:20,PRE_PUSH_HOOK_NAME:"pre-push",PRE_PUSH_HOOK_MARKER:"docuvia analyze --escalate-to-lsp",PRE_PUSH_SYNC_KNOWLEDGE_MARKER:"docuvia sync-knowledge",PRE_PUSH_ENV_GATE_MARKER:"--fallback-ast",PRE_PUSH_HOOKS_CHECK_MARKER:"docuvia hooks check",PRE_PUSH_FAILURE_HINT_MARKER:"tier-b/sync failed",PRE_PUSH_HOOK_CONTENT:`#!/bin/bash
|
|
39
|
+
# Docuvia Tier B Batch Hook (LSP escalation + snapshot + knowledge sync)
|
|
40
|
+
# Runs synchronously (generous timeout) so pushed code carries corrected knowledge -- see
|
|
41
|
+
# docs/gitbook/analysis/phase1-decision-integration.md \xA78h and
|
|
42
|
+
# docs/gitbook/analysis/phase2-sync-knowledge-scheduling.md.
|
|
43
|
+
if command -v npx > /dev/null 2>&1; then
|
|
44
|
+
npx --no-install docuvia hooks check tier-b-c-prepush && { npx --no-install docuvia analyze --escalate-to-lsp --fallback-ast && npx --no-install docuvia snapshot && npx --no-install docuvia sync-knowledge || echo "docuvia: tier-b/sync failed for this push -- run 'docuvia doctor' for details"; }
|
|
45
|
+
fi
|
|
46
|
+
# Never blocks the push on a Tier B/sync-knowledge failure -- PLAT-007's reliability
|
|
47
|
+
# requirement (failures surface as a one-line push-time hint plus JSONL logs / doctor,
|
|
48
|
+
# never as a blocked push).
|
|
49
|
+
exit 0
|
|
50
|
+
`,HOOKS_CHECK_PRE_PUSH_HOOK_CONTENT:`#!/bin/bash
|
|
51
|
+
# Docuvia Tier B Batch Hook (LSP escalation + snapshot + knowledge sync)
|
|
52
|
+
# Runs synchronously (generous timeout) so pushed code carries corrected knowledge -- see
|
|
53
|
+
# docs/gitbook/analysis/phase1-decision-integration.md \xA78h and
|
|
54
|
+
# docs/gitbook/analysis/phase2-sync-knowledge-scheduling.md.
|
|
55
|
+
if command -v npx > /dev/null 2>&1; then
|
|
56
|
+
npx --no-install docuvia hooks check tier-b-c-prepush && npx --no-install docuvia analyze --escalate-to-lsp --fallback-ast && npx --no-install docuvia snapshot && npx --no-install docuvia sync-knowledge
|
|
57
|
+
fi
|
|
58
|
+
# Never blocks the push on a Tier B/sync-knowledge failure -- PLAT-007's reliability
|
|
59
|
+
# requirement (failures only ever surface via JSONL logs / doctor, never to the pushing
|
|
60
|
+
# developer).
|
|
61
|
+
exit 0
|
|
62
|
+
`,ENV_GATE_PRE_PUSH_HOOK_CONTENT:`#!/bin/bash
|
|
63
|
+
# Docuvia Tier B Batch Hook (LSP escalation + snapshot + knowledge sync)
|
|
64
|
+
# Runs synchronously (generous timeout) so pushed code carries corrected knowledge -- see
|
|
65
|
+
# docs/gitbook/analysis/phase1-decision-integration.md \xA78h and
|
|
66
|
+
# docs/gitbook/analysis/phase2-sync-knowledge-scheduling.md.
|
|
67
|
+
if command -v npx > /dev/null 2>&1; then
|
|
68
|
+
npx --no-install docuvia analyze --escalate-to-lsp --fallback-ast && npx --no-install docuvia snapshot && npx --no-install docuvia sync-knowledge
|
|
69
|
+
fi
|
|
70
|
+
# Never blocks the push on a Tier B/sync-knowledge failure -- PLAT-007's reliability
|
|
71
|
+
# requirement (failures only ever surface via JSONL logs / doctor, never to the pushing
|
|
72
|
+
# developer).
|
|
73
|
+
exit 0
|
|
74
|
+
`,SYNC_KNOWLEDGE_PRE_PUSH_HOOK_CONTENT:`#!/bin/bash
|
|
75
|
+
# Docuvia Tier B Batch Hook (LSP escalation + snapshot + knowledge sync)
|
|
76
|
+
# Runs synchronously (generous timeout) so pushed code carries corrected knowledge -- see
|
|
77
|
+
# docs/gitbook/analysis/phase1-decision-integration.md \xA78h and
|
|
78
|
+
# docs/gitbook/analysis/phase2-sync-knowledge-scheduling.md.
|
|
79
|
+
if command -v npx > /dev/null 2>&1; then
|
|
80
|
+
npx --no-install docuvia analyze --escalate-to-lsp && npx --no-install docuvia snapshot && npx --no-install docuvia sync-knowledge
|
|
81
|
+
fi
|
|
82
|
+
# Never blocks the push on a Tier B/sync-knowledge failure -- PLAT-007's reliability
|
|
83
|
+
# requirement (failures only ever surface via JSONL logs / doctor, never to the pushing
|
|
84
|
+
# developer).
|
|
85
|
+
exit 0
|
|
86
|
+
`,LEGACY_PRE_PUSH_HOOK_CONTENT:`#!/bin/bash
|
|
87
|
+
# Docuvia Tier B Batch Hook (LSP escalation + snapshot)
|
|
88
|
+
# Runs synchronously (generous timeout) so pushed code carries corrected knowledge -- see
|
|
89
|
+
# docs/gitbook/analysis/phase1-decision-integration.md \xA78h.
|
|
90
|
+
if command -v npx &> /dev/null; then
|
|
91
|
+
npx --no-install docuvia analyze --escalate-to-lsp && npx --no-install docuvia snapshot
|
|
92
|
+
# Phase 2: a sync-knowledge step composes here -- must not double-fetch (see \xA77a-5).
|
|
93
|
+
fi
|
|
94
|
+
# Never blocks the push on a Tier B failure -- PLAT-007's reliability requirement (failures
|
|
95
|
+
# only ever surface via JSONL logs / doctor, never to the pushing developer).
|
|
96
|
+
exit 0
|
|
97
|
+
`,META_KEY_TIER_C_QUEUE:"tierCQueue",META_KEY_TIER_C_BUDGET:"tierCBudget",DEFAULT_TIER_C_DAILY_CALL_CAP:50,DEFAULT_TIER_C_DAILY_TOKEN_CAP:1e5,DEFAULT_TIER_C_WALL_CLOCK_MS:12e3,DEFAULT_TIER_C_ITEM_CAP:20,DEFAULT_TIER_C_LOAD_THRESHOLD:.8,DEFAULT_TIER_C_MAX_ITEM_FAILURES:3};import _ from"path";var K=[".ts",".tsx",".mts",".cts"],G=[".js",".jsx",".mjs",".cjs"],B=[".py"],V=[".rs"],j=[".go"],Y=[".java"],W=[".c",".h"],Q=[".cpp",".cxx",".cc",".hpp",".hxx",".hh",".cu",".cuh"],q=[".rb",".rake",".gemspec"],X=[".php",".phtml",".php3",".php4",".php5",".phps"],J=[".cs"],O=new Set(["Rakefile","Gemfile","Guardfile","Vagrantfile","Brewfile"]),h=(()=>{let e=new Map,t=[[s.TYPESCRIPT,K],[s.JAVASCRIPT,G],[s.PYTHON,B],[s.RUST,V],[s.GO,j],[s.JAVA,Y],[s.C,W],[s.CPP,Q],[s.RUBY,q],[s.PHP,X],[s.CSHARP,J]];for(let[n,o]of t)for(let i of o)e.set(i,n);return e})();function Ut(e){let t=h.get(_.extname(e).toLowerCase());return t||(O.has(_.basename(e))?s.RUBY:void 0)}function z(e){return h.has(_.extname(e).toLowerCase())?!0:O.has(_.basename(e))}function Kt(){return Array.from(h.keys()).map(e=>e.replace(/^\./,""))}function Gt(e){return!T(e)&&z(e)&&!e.includes(`${A}/`)&&!e.includes(`${C}/`)}var Bt="call-sites.jsonl";var Vt="call-resolutions.jsonl",jt="impact.dynamic-dependencies.v1:",Yt="snapshot.call-sites.availability.v1:",Wt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},Qt="snapshot-call-sites-unavailable",qt="snapshot.call-resolutions.availability.v1:",Xt={AVAILABLE:"available",UNAVAILABLE:"unavailable"};var Jt={TIMED_OUT_WAITING:e=>`Timed out waiting for the lock at ${e} \u2014 another process may be stuck`},D=class extends Error{constructor(t){super(Jt.TIMED_OUT_WAITING(t)),this.name="ProcessLockTimeoutError"}};var $=`${N.SOURCE_COMMIT_TRAILER_KEY}: `;function zt(e){for(let t of e.split(`
|
|
98
|
+
`)){let n=t.trim();if(n.startsWith($))return n.slice($.length).trim()}}function $t(e,t,n,o){if(!n&&!o)return;let u=(t?e.files.getTierBFileStatus(t):void 0)?.lastProcessedAt??null,Z=o&&u===null,g=e.files.getTierBCoverage(),ee=n&&g.processedFiles<g.totalFiles;if(!(!Z&&!ee))return{ownFileLastProcessedAt:u,workspaceFilesProcessed:g.processedFiles,workspaceFilesTotal:g.totalFiles}}function Zt(e){let t={total:0,resolved:0,selfDiscarded:0,unresolved:0,unresolvable:0,external:0,unknownReceiver:0};for(let n of Object.values(e))t.total+=n.total,t.resolved+=n.resolved,t.selfDiscarded+=n.selfDiscarded,t.unresolvable=(t.unresolvable??0)+(n.unresolvable??0),t.external=(t.external??0)+(n.external??0),t.unknownReceiver=(t.unknownReceiver??0)+(n.unknownReceiver??0),t.unresolved+=n.unresolved;return t}function en(e){return e.total-e.selfDiscarded-(e.unresolvable??0)-(e.external??0)-(e.unknownReceiver??0)}var tn={PASS:"pass",FAIL:"fail"};export{a,p as b,xe as c,f as d,I as e,c as f,l as g,be as h,Fe as i,k as j,ke as k,we as l,He as m,Ue as n,Ke as o,Ge as p,Be as q,Ve as r,je as s,Ye as t,We as u,Qe as v,Xe as w,ze as x,$e as y,Ze as z,et as A,tt as B,nt as C,ot as D,rt as E,it as F,st as G,at as H,lt as I,ct as J,dt as K,pt as L,ut as M,gt as N,yt as O,mt as P,St as Q,Et as R,_t as S,Rt as T,ft as U,Ct as V,At as W,Tt as X,It as Y,Lt as Z,Nt as _,Ot as $,ht as aa,Dt as ba,y as ca,ne as da,E as ea,vt as fa,C as ga,oe as ha,re as ia,ie as ja,se as ka,ae as la,le as ma,ce as na,de as oa,pe as pa,ue as qa,ge as ra,ye as sa,me as ta,A as ua,Se as va,Ee as wa,_e as xa,Re as ya,fe as za,Ce as Aa,Ft as Ba,kt as Ca,wt as Da,Ht as Ea,Ae as Fa,Te as Ga,U as Ha,N as Ia,s as Ja,x as Ka,P as La,b as Ma,M as Na,T as Oa,K as Pa,G as Qa,B as Ra,V as Sa,j as Ta,Y as Ua,W as Va,Q as Wa,q as Xa,X as Ya,J as Za,O as _a,Ut as $a,z as ab,Kt as bb,Gt as cb,Bt as db,Vt as eb,jt as fb,Yt as gb,Wt as hb,Qt as ib,qt as jb,Xt as kb,Le as lb,Ne as mb,Oe as nb,he as ob,De as pb,ve as qb,D as rb,zt as sb,$t as tb,Zt as ub,en as vb,tn as wb};
|
|
99
|
+
//# sourceMappingURL=chunk-5YVZPH7A.js.map
|