nexus-agents 8.8.0 → 8.8.2

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.
Files changed (147) hide show
  1. package/dist/{ast-rule-runner-IESI3WWR.js → ast-rule-runner-WANOR3MX.js} +5 -5
  2. package/dist/{child-mcp-config-WQNW5YFO.js → child-mcp-config-N4HLLCEH.js} +5 -5
  3. package/dist/{chunk-TQT2BIZ7.js → chunk-276GRITW.js} +4 -4
  4. package/dist/{chunk-DEXENQXS.js → chunk-3CLKYFE3.js} +74 -7
  5. package/dist/chunk-3CLKYFE3.js.map +1 -0
  6. package/dist/{chunk-YUMKCIEL.js → chunk-3XQK4MEF.js} +2 -2
  7. package/dist/{chunk-6AGNJBHE.js → chunk-3YKFLM2B.js} +2 -2
  8. package/dist/{chunk-4HZCKQ25.js → chunk-64VMTY3M.js} +2 -2
  9. package/dist/{chunk-DY6DVTX2.js → chunk-6HETGJSB.js} +3 -3
  10. package/dist/{chunk-ODBLHHTP.js → chunk-6URMW3DB.js} +2 -2
  11. package/dist/{chunk-BNPXE7BD.js → chunk-7AU5WLAJ.js} +2 -2
  12. package/dist/{chunk-66GKBIY2.js → chunk-7J7UYJXC.js} +7 -7
  13. package/dist/{chunk-BIHRU7WA.js → chunk-7QQ5F7T5.js} +9 -9
  14. package/dist/{chunk-ITCKXMOH.js → chunk-7WJGV5DN.js} +2 -2
  15. package/dist/{chunk-ZN6BTFLD.js → chunk-AOS7F4QR.js} +2 -2
  16. package/dist/{chunk-7BYI5CBK.js → chunk-CQCVEC7P.js} +124 -111
  17. package/dist/{chunk-7BYI5CBK.js.map → chunk-CQCVEC7P.js.map} +1 -1
  18. package/dist/{chunk-4HXPNLZS.js → chunk-DKHBIJO4.js} +2 -2
  19. package/dist/{chunk-37ONEK7R.js → chunk-EALWAQAQ.js} +12 -12
  20. package/dist/chunk-EALWAQAQ.js.map +1 -0
  21. package/dist/{chunk-HEV2C6VS.js → chunk-ERL3XHQO.js} +6 -6
  22. package/dist/{chunk-OLR2RIN2.js → chunk-F2GERNMF.js} +2 -2
  23. package/dist/{chunk-7BNB4YVO.js → chunk-FBWOWMEB.js} +3 -3
  24. package/dist/{chunk-W5VBFX65.js → chunk-FKKVZRSY.js} +2 -2
  25. package/dist/{chunk-3SO5DMHS.js → chunk-GXLI2E4U.js} +4 -4
  26. package/dist/chunk-H5DTHO7O.js +7 -0
  27. package/dist/{chunk-RWZJ2D2N.js → chunk-II5NJRKH.js} +2 -2
  28. package/dist/{chunk-MM223CVS.js → chunk-J7QCZRVK.js} +6 -1
  29. package/dist/{chunk-MM223CVS.js.map → chunk-J7QCZRVK.js.map} +1 -1
  30. package/dist/{chunk-F26X4N73.js → chunk-K2PVLCHR.js} +2 -2
  31. package/dist/{chunk-DZ5V47RU.js → chunk-MXQG3A5W.js} +6 -6
  32. package/dist/{chunk-4AE2QO7Q.js → chunk-N347WXTT.js} +2 -2
  33. package/dist/{chunk-CRKF5LUZ.js → chunk-NR62IQDC.js} +6 -6
  34. package/dist/{chunk-REY2B5LO.js → chunk-Q5V3KTUL.js} +2 -2
  35. package/dist/{chunk-NSHGFRGF.js → chunk-QCSXKQTK.js} +2 -2
  36. package/dist/{chunk-HQ6K7OYH.js → chunk-QY3HOLGD.js} +10 -10
  37. package/dist/{chunk-SNEUKIBK.js → chunk-SNSPYZQT.js} +5 -5
  38. package/dist/{chunk-36AR3GCF.js → chunk-SQCFKQUR.js} +56 -23
  39. package/dist/{chunk-36AR3GCF.js.map → chunk-SQCFKQUR.js.map} +1 -1
  40. package/dist/{chunk-GUOMNRXZ.js → chunk-TZWJ7QLW.js} +2 -2
  41. package/dist/{chunk-PX422NHD.js → chunk-VADACTVB.js} +2 -2
  42. package/dist/{chunk-ZQD67JES.js → chunk-W6SM3MU5.js} +4 -4
  43. package/dist/{chunk-W37HHXDL.js → chunk-WXU4Y5T3.js} +2 -2
  44. package/dist/{chunk-OPHI2RB6.js → chunk-YQUM3UWK.js} +5 -5
  45. package/dist/{chunk-BBMGN7FS.js → chunk-ZGHJMFQ6.js} +3 -3
  46. package/dist/{cli-circuit-breaker-YAAGSJ5N.js → cli-circuit-breaker-AAHYLFXZ.js} +5 -5
  47. package/dist/cli.js +47 -47
  48. package/dist/{composite-router-TU6MVJBG.js → composite-router-VAVDLJGT.js} +4 -4
  49. package/dist/{consensus-vote-FJWLHMQL.js → consensus-vote-L4CN33XE.js} +21 -21
  50. package/dist/{context-retriever-A4BZMTWM.js → context-retriever-MYKBBDAN.js} +11 -11
  51. package/dist/doctor-deep-AKOPPCXB.js +13 -0
  52. package/dist/{doctor-live-G3EO5LQD.js → doctor-live-3PVIYQST.js} +12 -12
  53. package/dist/{expert-bridge-IKY5TTAH.js → expert-bridge-G3KN7QWL.js} +6 -6
  54. package/dist/factory-KVMLFEWJ.js +15 -0
  55. package/dist/factory-ROTP63IZ.js +25 -0
  56. package/dist/{improvement-review-JNHEZ2DJ.js → improvement-review-WTZ4JV5V.js} +8 -8
  57. package/dist/index.d.ts +49 -0
  58. package/dist/index.js +36 -36
  59. package/dist/{init-opencode-KENOM2HA.js → init-opencode-C63LASGX.js} +8 -8
  60. package/dist/issue-triage-PIE3YVCV.js +17 -0
  61. package/dist/{learning-persistence-7N5SZHNX.js → learning-persistence-JK2FELZL.js} +3 -3
  62. package/dist/{pr-reviewer-helpers-C72VNWXU.js → pr-reviewer-helpers-4VDGMGV5.js} +6 -6
  63. package/dist/{registry-command-53E7LRNR.js → registry-command-IRDP2L2R.js} +4 -4
  64. package/dist/{repo-security-plan-ZSXHLYMU.js → repo-security-plan-NS47HQEF.js} +5 -5
  65. package/dist/research-helpers-synthesize-5NBL637T.js +14 -0
  66. package/dist/{routing-memory-5RYZJE45.js → routing-memory-2IELT5GT.js} +4 -4
  67. package/dist/{session-memory-3GE74TXJ.js → session-memory-CH3CVLIT.js} +5 -5
  68. package/dist/setup-config-MKZZDUJP.js +11 -0
  69. package/dist/{setup-custom-api-5ZZQJ5WX.js → setup-custom-api-2I52S7XU.js} +6 -6
  70. package/dist/setup-data-dir-NU3YBIZB.js +29 -0
  71. package/dist/{tool-memory-ZW2J3PMR.js → tool-memory-STS3DWOK.js} +8 -8
  72. package/dist/{tool-memory-registry-adapters-PCOYMYRF.js → tool-memory-registry-adapters-MZ5CSCYW.js} +3 -3
  73. package/dist/unified-registry-NJS4ZWC3.js +26 -0
  74. package/dist/{weather-report-OQ2UA3DZ.js → weather-report-YG4T4Q23.js} +4 -4
  75. package/package.json +1 -1
  76. package/dist/chunk-37ONEK7R.js.map +0 -1
  77. package/dist/chunk-DEXENQXS.js.map +0 -1
  78. package/dist/chunk-SAKV5TSH.js +0 -7
  79. package/dist/doctor-deep-N4IFVZLP.js +0 -13
  80. package/dist/factory-EJ2ZMEQ7.js +0 -15
  81. package/dist/factory-VGRG7M62.js +0 -25
  82. package/dist/issue-triage-IWMHDNUY.js +0 -17
  83. package/dist/research-helpers-synthesize-X4O3S4SH.js +0 -14
  84. package/dist/setup-config-YGTQJTTC.js +0 -11
  85. package/dist/setup-data-dir-NKG6L7FO.js +0 -29
  86. package/dist/unified-registry-IH3UEZLZ.js +0 -26
  87. /package/dist/{ast-rule-runner-IESI3WWR.js.map → ast-rule-runner-WANOR3MX.js.map} +0 -0
  88. /package/dist/{child-mcp-config-WQNW5YFO.js.map → child-mcp-config-N4HLLCEH.js.map} +0 -0
  89. /package/dist/{chunk-TQT2BIZ7.js.map → chunk-276GRITW.js.map} +0 -0
  90. /package/dist/{chunk-YUMKCIEL.js.map → chunk-3XQK4MEF.js.map} +0 -0
  91. /package/dist/{chunk-6AGNJBHE.js.map → chunk-3YKFLM2B.js.map} +0 -0
  92. /package/dist/{chunk-4HZCKQ25.js.map → chunk-64VMTY3M.js.map} +0 -0
  93. /package/dist/{chunk-DY6DVTX2.js.map → chunk-6HETGJSB.js.map} +0 -0
  94. /package/dist/{chunk-ODBLHHTP.js.map → chunk-6URMW3DB.js.map} +0 -0
  95. /package/dist/{chunk-BNPXE7BD.js.map → chunk-7AU5WLAJ.js.map} +0 -0
  96. /package/dist/{chunk-66GKBIY2.js.map → chunk-7J7UYJXC.js.map} +0 -0
  97. /package/dist/{chunk-BIHRU7WA.js.map → chunk-7QQ5F7T5.js.map} +0 -0
  98. /package/dist/{chunk-ITCKXMOH.js.map → chunk-7WJGV5DN.js.map} +0 -0
  99. /package/dist/{chunk-ZN6BTFLD.js.map → chunk-AOS7F4QR.js.map} +0 -0
  100. /package/dist/{chunk-4HXPNLZS.js.map → chunk-DKHBIJO4.js.map} +0 -0
  101. /package/dist/{chunk-HEV2C6VS.js.map → chunk-ERL3XHQO.js.map} +0 -0
  102. /package/dist/{chunk-OLR2RIN2.js.map → chunk-F2GERNMF.js.map} +0 -0
  103. /package/dist/{chunk-7BNB4YVO.js.map → chunk-FBWOWMEB.js.map} +0 -0
  104. /package/dist/{chunk-W5VBFX65.js.map → chunk-FKKVZRSY.js.map} +0 -0
  105. /package/dist/{chunk-3SO5DMHS.js.map → chunk-GXLI2E4U.js.map} +0 -0
  106. /package/dist/{chunk-SAKV5TSH.js.map → chunk-H5DTHO7O.js.map} +0 -0
  107. /package/dist/{chunk-RWZJ2D2N.js.map → chunk-II5NJRKH.js.map} +0 -0
  108. /package/dist/{chunk-F26X4N73.js.map → chunk-K2PVLCHR.js.map} +0 -0
  109. /package/dist/{chunk-DZ5V47RU.js.map → chunk-MXQG3A5W.js.map} +0 -0
  110. /package/dist/{chunk-4AE2QO7Q.js.map → chunk-N347WXTT.js.map} +0 -0
  111. /package/dist/{chunk-CRKF5LUZ.js.map → chunk-NR62IQDC.js.map} +0 -0
  112. /package/dist/{chunk-REY2B5LO.js.map → chunk-Q5V3KTUL.js.map} +0 -0
  113. /package/dist/{chunk-NSHGFRGF.js.map → chunk-QCSXKQTK.js.map} +0 -0
  114. /package/dist/{chunk-HQ6K7OYH.js.map → chunk-QY3HOLGD.js.map} +0 -0
  115. /package/dist/{chunk-SNEUKIBK.js.map → chunk-SNSPYZQT.js.map} +0 -0
  116. /package/dist/{chunk-GUOMNRXZ.js.map → chunk-TZWJ7QLW.js.map} +0 -0
  117. /package/dist/{chunk-PX422NHD.js.map → chunk-VADACTVB.js.map} +0 -0
  118. /package/dist/{chunk-ZQD67JES.js.map → chunk-W6SM3MU5.js.map} +0 -0
  119. /package/dist/{chunk-W37HHXDL.js.map → chunk-WXU4Y5T3.js.map} +0 -0
  120. /package/dist/{chunk-OPHI2RB6.js.map → chunk-YQUM3UWK.js.map} +0 -0
  121. /package/dist/{chunk-BBMGN7FS.js.map → chunk-ZGHJMFQ6.js.map} +0 -0
  122. /package/dist/{cli-circuit-breaker-YAAGSJ5N.js.map → cli-circuit-breaker-AAHYLFXZ.js.map} +0 -0
  123. /package/dist/{composite-router-TU6MVJBG.js.map → composite-router-VAVDLJGT.js.map} +0 -0
  124. /package/dist/{consensus-vote-FJWLHMQL.js.map → consensus-vote-L4CN33XE.js.map} +0 -0
  125. /package/dist/{context-retriever-A4BZMTWM.js.map → context-retriever-MYKBBDAN.js.map} +0 -0
  126. /package/dist/{doctor-deep-N4IFVZLP.js.map → doctor-deep-AKOPPCXB.js.map} +0 -0
  127. /package/dist/{doctor-live-G3EO5LQD.js.map → doctor-live-3PVIYQST.js.map} +0 -0
  128. /package/dist/{expert-bridge-IKY5TTAH.js.map → expert-bridge-G3KN7QWL.js.map} +0 -0
  129. /package/dist/{factory-EJ2ZMEQ7.js.map → factory-KVMLFEWJ.js.map} +0 -0
  130. /package/dist/{factory-VGRG7M62.js.map → factory-ROTP63IZ.js.map} +0 -0
  131. /package/dist/{improvement-review-JNHEZ2DJ.js.map → improvement-review-WTZ4JV5V.js.map} +0 -0
  132. /package/dist/{init-opencode-KENOM2HA.js.map → init-opencode-C63LASGX.js.map} +0 -0
  133. /package/dist/{issue-triage-IWMHDNUY.js.map → issue-triage-PIE3YVCV.js.map} +0 -0
  134. /package/dist/{learning-persistence-7N5SZHNX.js.map → learning-persistence-JK2FELZL.js.map} +0 -0
  135. /package/dist/{pr-reviewer-helpers-C72VNWXU.js.map → pr-reviewer-helpers-4VDGMGV5.js.map} +0 -0
  136. /package/dist/{registry-command-53E7LRNR.js.map → registry-command-IRDP2L2R.js.map} +0 -0
  137. /package/dist/{repo-security-plan-ZSXHLYMU.js.map → repo-security-plan-NS47HQEF.js.map} +0 -0
  138. /package/dist/{research-helpers-synthesize-X4O3S4SH.js.map → research-helpers-synthesize-5NBL637T.js.map} +0 -0
  139. /package/dist/{routing-memory-5RYZJE45.js.map → routing-memory-2IELT5GT.js.map} +0 -0
  140. /package/dist/{session-memory-3GE74TXJ.js.map → session-memory-CH3CVLIT.js.map} +0 -0
  141. /package/dist/{setup-config-YGTQJTTC.js.map → setup-config-MKZZDUJP.js.map} +0 -0
  142. /package/dist/{setup-custom-api-5ZZQJ5WX.js.map → setup-custom-api-2I52S7XU.js.map} +0 -0
  143. /package/dist/{setup-data-dir-NKG6L7FO.js.map → setup-data-dir-NU3YBIZB.js.map} +0 -0
  144. /package/dist/{tool-memory-ZW2J3PMR.js.map → tool-memory-STS3DWOK.js.map} +0 -0
  145. /package/dist/{tool-memory-registry-adapters-PCOYMYRF.js.map → tool-memory-registry-adapters-MZ5CSCYW.js.map} +0 -0
  146. /package/dist/{unified-registry-IH3UEZLZ.js.map → unified-registry-NJS4ZWC3.js.map} +0 -0
  147. /package/dist/{weather-report-OQ2UA3DZ.js.map → weather-report-YG4T4Q23.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cli/research-helpers-io.ts","../src/security/safe-path.ts","../src/cli/research-scaffold.ts"],"sourcesContent":["/**\n * Research Registry I/O Operations\n *\n * File operations for loading and saving research registry YAML files.\n * Includes path traversal protection per Issue #353.\n *\n * @see docs/research/RESEARCH_INDEX.md\n * @see Issue #237 (Epic #225)\n * @see Issue #353 (Security - Path traversal fix)\n */\n\nimport * as fs from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport { resolveInsideRoot } from '../security/safe-path.js';\nimport { parse as parseYaml, stringify as stringifyYaml } from 'yaml';\nimport type { Result } from '../core/index.js';\nimport { SecurityError, getErrorMessage } from '../core/index.js';\nimport { ParseError } from '../core/types/workflow.js';\nimport type { TechniquesRegistry, PapersRegistry } from './research-types.js';\nimport { ensureRegistryFile } from './research-scaffold.js';\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\n/** Path to research registry directory relative to project root */\nexport const REGISTRY_PATH = 'docs/research/registry';\n\n/** Filename for techniques registry */\nexport const TECHNIQUES_FILE = 'techniques.yaml';\n\n/** Filename for papers registry */\nexport const PAPERS_FILE = 'papers.yaml';\n\n// =============================================================================\n// PROJECT ROOT\n// =============================================================================\n\n/**\n * Get the project root directory.\n * Note: Returns cwd since registry operations use explicit rootDir parameter\n */\nexport function getProjectRoot(): string {\n return process.cwd();\n}\n\n// =============================================================================\n// PATH VALIDATION\n// =============================================================================\n\n/**\n * Validates that a constructed path stays within the allowed root directory.\n * Prevents path traversal attacks (e.g., ../../../etc/passwd).\n *\n * @param constructedPath - The full path to validate\n * @param allowedRoot - The root directory that paths must be within\n * @returns Result with validated absolute path or SecurityError\n */\nfunction validatePath(constructedPath: string, allowedRoot: string): Result<string, SecurityError> {\n const resolved = resolveInsideRoot(constructedPath, allowedRoot);\n if (resolved === null) {\n return {\n ok: false,\n error: new SecurityError('Path traversal detected: path escapes allowed root directory', {\n context: { constructedPath, allowedRoot: resolve(allowedRoot) },\n }),\n };\n }\n return { ok: true, value: resolved };\n}\n\n// =============================================================================\n// LOAD OPERATIONS\n// =============================================================================\n\n/**\n * Load techniques registry from YAML file.\n * Validates path to prevent directory traversal attacks.\n *\n * @param rootDir - Project root directory (defaults to cwd)\n * @returns Result with TechniquesRegistry or SecurityError/ParseError\n */\nexport async function loadTechniquesRegistry(\n rootDir?: string\n): Promise<Result<TechniquesRegistry, SecurityError | ParseError>> {\n const root = rootDir ?? process.cwd();\n const filePath = join(root, REGISTRY_PATH, TECHNIQUES_FILE);\n\n const pathValidation = validatePath(filePath, root);\n if (!pathValidation.ok) {\n return pathValidation;\n }\n\n // #2470: try to scaffold an empty techniques.yaml on first run so research_*\n // workflows don't error on a fresh install. No-op when file exists.\n // When scaffold refuses (e.g. <rootDir>/docs/ doesn't exist, or\n // NEXUS_NO_SCAFFOLD=1), fall through and let readFile produce the original\n // ENOENT error — that's the existing contract.\n await ensureRegistryFile(root, TECHNIQUES_FILE);\n\n try {\n const content = await fs.readFile(pathValidation.value, 'utf-8');\n return { ok: true, value: parseYaml(content) as TechniquesRegistry };\n } catch (error) {\n const message = getErrorMessage(error);\n return { ok: false, error: new ParseError(`Failed to load techniques registry: ${message}`) };\n }\n}\n\n/**\n * Load papers registry from YAML file.\n * Validates path to prevent directory traversal attacks.\n *\n * @param rootDir - Project root directory (defaults to cwd)\n * @returns Result with PapersRegistry or SecurityError/ParseError\n */\nexport async function loadPapersRegistry(\n rootDir?: string\n): Promise<Result<PapersRegistry, SecurityError | ParseError>> {\n const root = rootDir ?? process.cwd();\n const filePath = join(root, REGISTRY_PATH, PAPERS_FILE);\n\n const pathValidation = validatePath(filePath, root);\n if (!pathValidation.ok) {\n return pathValidation;\n }\n\n // #2470: try to scaffold an empty papers.yaml on first run so research_*\n // workflows don't error on a fresh install. No-op when file exists; falls\n // through silently when scaffold refuses (no docs/ root, or NEXUS_NO_SCAFFOLD).\n await ensureRegistryFile(root, PAPERS_FILE);\n\n try {\n const content = await fs.readFile(pathValidation.value, 'utf-8');\n return { ok: true, value: parseYaml(content) as PapersRegistry };\n } catch (error) {\n const message = getErrorMessage(error);\n return { ok: false, error: new ParseError(`Failed to load papers registry: ${message}`) };\n }\n}\n\n// =============================================================================\n// SAVE OPERATIONS\n// =============================================================================\n\n/**\n * Save techniques registry to YAML file.\n * Validates path to prevent directory traversal attacks.\n *\n * @param registry - The techniques registry to save\n * @param rootDir - Project root directory (defaults to cwd)\n * @returns Result with void on success or SecurityError/ParseError on failure\n */\nexport async function saveTechniquesRegistry(\n registry: TechniquesRegistry,\n rootDir?: string\n): Promise<Result<void, SecurityError | ParseError>> {\n const root = rootDir ?? process.cwd();\n const filePath = join(root, REGISTRY_PATH, TECHNIQUES_FILE);\n\n const pathValidation = validatePath(filePath, root);\n if (!pathValidation.ok) {\n return pathValidation;\n }\n\n try {\n const content = stringifyYaml(registry, { lineWidth: 100 });\n await fs.writeFile(pathValidation.value, content, 'utf-8');\n return { ok: true, value: undefined };\n } catch (error) {\n const message = getErrorMessage(error);\n return { ok: false, error: new ParseError(`Failed to save techniques registry: ${message}`) };\n }\n}\n\n/**\n * Save papers registry to YAML file.\n * Validates path to prevent directory traversal attacks.\n *\n * @param registry - The papers registry to save\n * @param rootDir - Project root directory (defaults to cwd)\n * @returns Result with void on success or SecurityError/ParseError on failure\n */\nexport async function savePapersRegistry(\n registry: PapersRegistry,\n rootDir?: string\n): Promise<Result<void, SecurityError | ParseError>> {\n const root = rootDir ?? process.cwd();\n const filePath = join(root, REGISTRY_PATH, PAPERS_FILE);\n\n const pathValidation = validatePath(filePath, root);\n if (!pathValidation.ok) {\n return pathValidation;\n }\n\n try {\n const content = stringifyYaml(registry, { lineWidth: 100 });\n await fs.writeFile(pathValidation.value, content, 'utf-8');\n return { ok: true, value: undefined };\n } catch (error) {\n const message = getErrorMessage(error);\n return { ok: false, error: new ParseError(`Failed to save papers registry: ${message}`) };\n }\n}\n","/**\n * Safe Path — Path traversal guards for scanner-controlled inputs (#1813, #1814)\n *\n * When reading files whose path comes from untrusted input (e.g., SARIF\n * scanner output), we must verify the resolved path stays within the\n * workspace root. Without this, a malicious scanner can cause arbitrary\n * file reads whose contents are exfiltrated via downstream LLM prompts\n * (CWE-22).\n *\n * Shared helper to prevent the finding-triage/fix-generator drift that\n * required two separate fixes.\n *\n * @module security/safe-path\n */\n\nimport { resolve, sep } from 'node:path';\n\n/**\n * Resolve a scanner-supplied path against the workspace root, returning null\n * if it escapes. Null means the caller must fall back to a safe alternative\n * (e.g., scanner-provided snippet) rather than reading the file.\n *\n * @param filePath - Scanner-supplied path (may be relative or absolute)\n * @param root - Workspace root (defaults to process.cwd())\n * @returns Resolved absolute path if inside root, null otherwise\n */\nexport function resolveInsideRoot(filePath: string, root: string = process.cwd()): string | null {\n const resolvedRoot = resolve(root);\n const resolved = resolve(resolvedRoot, filePath);\n if (resolved === resolvedRoot) return resolved;\n if (resolved.startsWith(resolvedRoot + sep)) return resolved;\n return null;\n}\n","/**\n * research-scaffold — auto-create empty research registry files when missing.\n *\n * On a fresh install or in a sandboxed environment where the project doesn't\n * have `docs/research/registry/`, the research workflows previously errored\n * with `Failed to load papers registry: ENOENT`. The user has no idea what\n * to do.\n *\n * This module provides `ensureResearchRegistry()`: idempotent scaffolding\n * that creates empty YAML registries on ENOENT, announces what it did to\n * stderr (so the operator knows), and returns the path that's now safe to\n * read.\n *\n * Source: Issue #2470 (epic #2467 child).\n */\n\nimport * as fs from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { stringify as stringifyYaml } from 'yaml';\n\nimport type { Result } from '../core/index.js';\nimport { ok, err, getErrorMessage } from '../core/index.js';\nimport { ParseError } from '../core/types/workflow.js';\n\nimport { REGISTRY_PATH, PAPERS_FILE, TECHNIQUES_FILE } from './research-helpers-io.js';\nimport { parseBoolEnv } from '../config/defaults-env.js';\n\n/**\n * Names of the registry files this scaffolder knows how to create.\n * `sources.yaml` and `alignments.yaml` live alongside but are populated by\n * different code paths; this scaffolder only owns the two YAML registries\n * that block `research_query` / `research_synthesize` on a fresh install.\n */\ntype ScaffoldedFile = typeof PAPERS_FILE | typeof TECHNIQUES_FILE;\n\nconst SCHEMA_VERSION = '1.0';\n\nconst ANNOUNCED = new Set<string>();\n\nfunction announceOnce(path: string, kind: ScaffoldedFile): void {\n // De-dupe so that running multiple research commands in one session\n // produces one announcement per scaffolded file, not per call.\n if (ANNOUNCED.has(path)) return;\n ANNOUNCED.add(path);\n process.stderr.write(\n `[scaffold] Created empty ${kind} at ${path}; add entries via 'nexus-agents research add' or research_add MCP tool.\\n`\n );\n}\n\n/**\n * Operator opt-out. When set, scaffolding errors loudly with an actionable\n * message instead of silently writing files. Useful for CI and for\n * environments that want strict \"fail when state is wrong\" semantics.\n */\nfunction scaffoldDisabled(): boolean {\n return parseBoolEnv('NEXUS_NO_SCAFFOLD', false);\n}\n\nfunction emptyPapersYaml(): string {\n return stringifyYaml({ schema_version: SCHEMA_VERSION, papers: {} });\n}\n\nfunction emptyTechniquesYaml(): string {\n return stringifyYaml({ schema_version: SCHEMA_VERSION, techniques: {} });\n}\n\n/**\n * Create the registry directory + an empty YAML file if either is missing.\n * Idempotent: existing files are left untouched.\n *\n * Scaffolds only when `<rootDir>/docs/` already exists. That guard keeps\n * tests, vitest's package cwd, and random scratch directories from getting\n * a `docs/research/` subtree implicitly. Operators on a real project root\n * (which always has `docs/`, either from cloning the repo or running\n * `nexus-agents init`) still get the auto-create behavior the issue asks for.\n *\n * Returns the resolved file path on success, or a ParseError when scaffolding\n * is disabled / refused (so the caller can pass the error through unchanged\n * for backwards compat with existing call sites).\n */\nexport async function ensureRegistryFile(\n rootDir: string,\n filename: ScaffoldedFile\n): Promise<Result<string, ParseError>> {\n const filePath = resolve(rootDir, REGISTRY_PATH, filename);\n\n if (existsSync(filePath)) return ok(filePath);\n\n if (scaffoldDisabled()) {\n return err(\n new ParseError(\n `Registry file missing: ${filePath}. Scaffolding disabled (NEXUS_NO_SCAFFOLD=1). Create the file manually or unset the env var.`\n )\n );\n }\n\n // Refuse to create a docs/ subtree in directories that aren't already\n // documented project roots. The presence of `<rootDir>/docs/` is the\n // strong signal we use.\n if (!existsSync(resolve(rootDir, 'docs'))) {\n return err(\n new ParseError(\n `Registry file missing: ${filePath}. ${rootDir}/docs/ does not exist; ` +\n `refusing to create a Nexus subtree in a non-documented root. ` +\n `Run 'nexus-agents init' first, or create ${rootDir}/docs/ manually.`\n )\n );\n }\n\n try {\n await fs.mkdir(dirname(filePath), { recursive: true });\n const content = filename === PAPERS_FILE ? emptyPapersYaml() : emptyTechniquesYaml();\n await fs.writeFile(filePath, content, 'utf-8');\n announceOnce(filePath, filename);\n return ok(filePath);\n } catch (e: unknown) {\n return err(\n new ParseError(\n `Failed to scaffold ${filename} at ${filePath}: ${getErrorMessage(e)}. Set NEXUS_NO_SCAFFOLD=1 and create manually if scaffolding is unwanted.`\n )\n );\n }\n}\n\n/**\n * Convenience: scaffold both papers.yaml and techniques.yaml. Used by the\n * research workflow startup paths that need both registries available.\n */\nexport async function ensureResearchRegistry(rootDir?: string): Promise<Result<void, ParseError>> {\n const root = rootDir ?? process.cwd();\n const papers = await ensureRegistryFile(root, PAPERS_FILE);\n if (!papers.ok) return papers;\n const techniques = await ensureRegistryFile(root, TECHNIQUES_FILE);\n if (!techniques.ok) return techniques;\n return ok(undefined);\n}\n\n/**\n * Test-only reset of the announcement de-dupe set. Production code never\n * needs this; tests do because Vitest reuses process state across files.\n */\nexport function _resetAnnouncedForTests(): void {\n ANNOUNCED.clear();\n}\n"],"mappings":";;;;;;;;;;AAWA,YAAYA,SAAQ;AACpB,SAAS,MAAM,WAAAC,gBAAe;;;ACG9B,SAAS,SAAS,WAAW;AAWtB,SAAS,kBAAkB,UAAkB,OAAe,QAAQ,IAAI,GAAkB;AAC/F,QAAM,eAAe,QAAQ,IAAI;AACjC,QAAM,WAAW,QAAQ,cAAc,QAAQ;AAC/C,MAAI,aAAa,aAAc,QAAO;AACtC,MAAI,SAAS,WAAW,eAAe,GAAG,EAAG,QAAO;AACpD,SAAO;AACT;;;ADlBA,SAAS,SAAS,WAAW,aAAaC,sBAAqB;;;AEE/D,YAAY,QAAQ;AACpB,SAAS,kBAAkB;AAC3B,SAAS,SAAS,WAAAC,gBAAe;AACjC,SAAS,aAAa,qBAAqB;AAiB3C,IAAM,iBAAiB;AAEvB,IAAM,YAAY,oBAAI,IAAY;AAElC,SAAS,aAAa,MAAc,MAA4B;AAG9D,MAAI,UAAU,IAAI,IAAI,EAAG;AACzB,YAAU,IAAI,IAAI;AAClB,UAAQ,OAAO;AAAA,IACb,4BAA4B,IAA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O,EAAE,EAAE;AAAA,EAC1F;AACF;AA4CA,eAAsB,mBACpB,UACA,SACmD;AACnD,QAAM,OAAO,WAAW,QAAQ,IAAI;AACpC,QAAM,WAAW,KAAK,MAAM,eAAe,WAAW;AAEtD,QAAM,iBAAiB,aAAa,UAAU,IAAI;AAClD,MAAI,CAAC,eAAe,IAAI;AACtB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,UAAUC,eAAc,UAAU,EAAE,WAAW,IAAI,CAAC;AAC1D,UAAS,cAAU,eAAe,OAAO,SAAS,OAAO;AACzD,WAAO,EAAE,IAAI,MAAM,OAAO,OAAU;AAAA,EACtC,SAAS,OAAO;AACd,UAAM,UAAU,gBAAgB,KAAK;AACrC,WAAO,EAAE,IAAI,OAAO,OAAO,IAAI,WAAW,mCAAmC,OAAO,EAAE,EAAE;AAAA,EAC1F;AACF;","names":["fs","resolve","stringifyYaml","resolve","resolve","resolve","stringifyYaml"]}
@@ -1,7 +0,0 @@
1
- // src/version.ts
2
- var VERSION = true ? "8.8.0" : "dev";
3
-
4
- export {
5
- VERSION
6
- };
7
- //# sourceMappingURL=chunk-SAKV5TSH.js.map
@@ -1,13 +0,0 @@
1
- import {
2
- formatDeepDiagnostics,
3
- runDeepDiagnostics
4
- } from "./chunk-ZN6BTFLD.js";
5
- import "./chunk-HEV2C6VS.js";
6
- import "./chunk-ITCKXMOH.js";
7
- import "./chunk-MM223CVS.js";
8
- import "./chunk-ZPWHCABL.js";
9
- export {
10
- formatDeepDiagnostics,
11
- runDeepDiagnostics
12
- };
13
- //# sourceMappingURL=doctor-deep-N4IFVZLP.js.map
@@ -1,15 +0,0 @@
1
- import {
2
- createGitHubProvider,
3
- createScmProvider
4
- } from "./chunk-3SO5DMHS.js";
5
- import "./chunk-REY2B5LO.js";
6
- import "./chunk-RWZJ2D2N.js";
7
- import "./chunk-HEV2C6VS.js";
8
- import "./chunk-ITCKXMOH.js";
9
- import "./chunk-MM223CVS.js";
10
- import "./chunk-ZPWHCABL.js";
11
- export {
12
- createGitHubProvider,
13
- createScmProvider
14
- };
15
- //# sourceMappingURL=factory-EJ2ZMEQ7.js.map
@@ -1,25 +0,0 @@
1
- import {
2
- createAllAdapters,
3
- createCliAdapter,
4
- getAvailableClis,
5
- isCliAvailable
6
- } from "./chunk-BIHRU7WA.js";
7
- import "./chunk-W5VBFX65.js";
8
- import "./chunk-NSHGFRGF.js";
9
- import "./chunk-OLR2RIN2.js";
10
- import "./chunk-4HXPNLZS.js";
11
- import "./chunk-GUOMNRXZ.js";
12
- import "./chunk-QZUG667L.js";
13
- import "./chunk-W37HHXDL.js";
14
- import "./chunk-PX422NHD.js";
15
- import "./chunk-HEV2C6VS.js";
16
- import "./chunk-ITCKXMOH.js";
17
- import "./chunk-MM223CVS.js";
18
- import "./chunk-ZPWHCABL.js";
19
- export {
20
- createAllAdapters,
21
- createCliAdapter,
22
- getAvailableClis,
23
- isCliAvailable
24
- };
25
- //# sourceMappingURL=factory-VGRG7M62.js.map
@@ -1,17 +0,0 @@
1
- import {
2
- IssueTriage,
3
- createIssueTriage
4
- } from "./chunk-DZ5V47RU.js";
5
- import "./chunk-REY2B5LO.js";
6
- import "./chunk-4AE2QO7Q.js";
7
- import "./chunk-6AGNJBHE.js";
8
- import "./chunk-RWZJ2D2N.js";
9
- import "./chunk-HEV2C6VS.js";
10
- import "./chunk-ITCKXMOH.js";
11
- import "./chunk-MM223CVS.js";
12
- import "./chunk-ZPWHCABL.js";
13
- export {
14
- IssueTriage,
15
- createIssueTriage
16
- };
17
- //# sourceMappingURL=issue-triage-IWMHDNUY.js.map
@@ -1,14 +0,0 @@
1
- import {
2
- AttributedInsightSchema,
3
- synthesizeResearch
4
- } from "./chunk-BBMGN7FS.js";
5
- import "./chunk-DEXENQXS.js";
6
- import "./chunk-HEV2C6VS.js";
7
- import "./chunk-ITCKXMOH.js";
8
- import "./chunk-MM223CVS.js";
9
- import "./chunk-ZPWHCABL.js";
10
- export {
11
- AttributedInsightSchema,
12
- synthesizeResearch
13
- };
14
- //# sourceMappingURL=research-helpers-synthesize-X4O3S4SH.js.map
@@ -1,11 +0,0 @@
1
- import {
2
- runConfigInitSync
3
- } from "./chunk-4HZCKQ25.js";
4
- import "./chunk-HEV2C6VS.js";
5
- import "./chunk-ITCKXMOH.js";
6
- import "./chunk-MM223CVS.js";
7
- import "./chunk-ZPWHCABL.js";
8
- export {
9
- runConfigInitSync
10
- };
11
- //# sourceMappingURL=setup-config-YGTQJTTC.js.map
@@ -1,29 +0,0 @@
1
- import {
2
- NEXUS_DATA_DIR,
3
- describeDataDirFix,
4
- initDataDirectories
5
- } from "./chunk-HQ6K7OYH.js";
6
- import "./chunk-SNEUKIBK.js";
7
- import "./chunk-DY6DVTX2.js";
8
- import "./chunk-OQB3XC5O.js";
9
- import "./chunk-SAKV5TSH.js";
10
- import "./chunk-6T3EPABN.js";
11
- import "./chunk-BIHRU7WA.js";
12
- import "./chunk-W5VBFX65.js";
13
- import "./chunk-NSHGFRGF.js";
14
- import "./chunk-OLR2RIN2.js";
15
- import "./chunk-4HXPNLZS.js";
16
- import "./chunk-GUOMNRXZ.js";
17
- import "./chunk-QZUG667L.js";
18
- import "./chunk-W37HHXDL.js";
19
- import "./chunk-PX422NHD.js";
20
- import "./chunk-HEV2C6VS.js";
21
- import "./chunk-ITCKXMOH.js";
22
- import "./chunk-MM223CVS.js";
23
- import "./chunk-ZPWHCABL.js";
24
- export {
25
- NEXUS_DATA_DIR,
26
- describeDataDirFix,
27
- initDataDirectories
28
- };
29
- //# sourceMappingURL=setup-data-dir-NKG6L7FO.js.map
@@ -1,26 +0,0 @@
1
- import {
2
- UnifiedAdapterRegistry,
3
- createUnifiedRegistry,
4
- getGlobalRegistry,
5
- resetGlobalRegistry
6
- } from "./chunk-TQT2BIZ7.js";
7
- import "./chunk-BIHRU7WA.js";
8
- import "./chunk-W5VBFX65.js";
9
- import "./chunk-NSHGFRGF.js";
10
- import "./chunk-OLR2RIN2.js";
11
- import "./chunk-4HXPNLZS.js";
12
- import "./chunk-GUOMNRXZ.js";
13
- import "./chunk-QZUG667L.js";
14
- import "./chunk-W37HHXDL.js";
15
- import "./chunk-PX422NHD.js";
16
- import "./chunk-HEV2C6VS.js";
17
- import "./chunk-ITCKXMOH.js";
18
- import "./chunk-MM223CVS.js";
19
- import "./chunk-ZPWHCABL.js";
20
- export {
21
- UnifiedAdapterRegistry,
22
- createUnifiedRegistry,
23
- getGlobalRegistry,
24
- resetGlobalRegistry
25
- };
26
- //# sourceMappingURL=unified-registry-IH3UEZLZ.js.map