mdcontext 0.0.1 → 0.2.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.
Files changed (337) hide show
  1. package/.changeset/README.md +28 -0
  2. package/.changeset/config.json +11 -0
  3. package/.claude/settings.local.json +25 -0
  4. package/.github/workflows/ci.yml +83 -0
  5. package/.github/workflows/claude-code-review.yml +44 -0
  6. package/.github/workflows/claude.yml +85 -0
  7. package/.github/workflows/release.yml +113 -0
  8. package/.tldrignore +112 -0
  9. package/BACKLOG.md +338 -0
  10. package/CONTRIBUTING.md +186 -0
  11. package/NOTES/NOTES +44 -0
  12. package/README.md +434 -11
  13. package/biome.json +36 -0
  14. package/cspell.config.yaml +14 -0
  15. package/dist/chunk-23UPXDNL.js +3044 -0
  16. package/dist/chunk-2W7MO2DL.js +1366 -0
  17. package/dist/chunk-3NUAZGMA.js +1689 -0
  18. package/dist/chunk-7TOWB2XB.js +366 -0
  19. package/dist/chunk-7XOTOADQ.js +3065 -0
  20. package/dist/chunk-AH2PDM2K.js +3042 -0
  21. package/dist/chunk-BNXWSZ63.js +3742 -0
  22. package/dist/chunk-BTL5DJVU.js +3222 -0
  23. package/dist/chunk-HDHYG7E4.js +104 -0
  24. package/dist/chunk-HLR4KZBP.js +3234 -0
  25. package/dist/chunk-IP3FRFEB.js +1045 -0
  26. package/dist/chunk-KHU56VDO.js +3042 -0
  27. package/dist/chunk-KRYIFLQR.js +88 -0
  28. package/dist/chunk-LBSDNLEM.js +287 -0
  29. package/dist/chunk-MNTQ7HCP.js +2643 -0
  30. package/dist/chunk-MUJELQQ6.js +1387 -0
  31. package/dist/chunk-MXJGMSLV.js +2199 -0
  32. package/dist/chunk-N6QJGC3Z.js +2636 -0
  33. package/dist/chunk-OBELGBPM.js +1713 -0
  34. package/dist/chunk-OT7R5XTA.js +3192 -0
  35. package/dist/chunk-P7X4RA2T.js +106 -0
  36. package/dist/chunk-PIDUQNC2.js +3185 -0
  37. package/dist/chunk-POGCDIH4.js +3187 -0
  38. package/dist/chunk-PSIEOQGZ.js +3043 -0
  39. package/dist/chunk-PVRT3IHA.js +3238 -0
  40. package/dist/chunk-QNN4TT23.js +1430 -0
  41. package/dist/chunk-RE3R45RJ.js +3042 -0
  42. package/dist/chunk-S7E6TFX6.js +803 -0
  43. package/dist/chunk-SG6GLU4U.js +1378 -0
  44. package/dist/chunk-SJCDV2ST.js +274 -0
  45. package/dist/chunk-SYE5XLF3.js +104 -0
  46. package/dist/chunk-T5VLYBZD.js +103 -0
  47. package/dist/chunk-TOQB7VWU.js +3238 -0
  48. package/dist/chunk-VFNMZ4ZQ.js +3228 -0
  49. package/dist/chunk-VVTGZNBT.js +1629 -0
  50. package/dist/chunk-W7Q4RFEV.js +104 -0
  51. package/dist/chunk-XTYYVRLO.js +3190 -0
  52. package/dist/chunk-Y6MDYVJD.js +3063 -0
  53. package/dist/cli/main.d.ts +1 -0
  54. package/dist/cli/main.js +5458 -0
  55. package/dist/index.d.ts +653 -0
  56. package/dist/index.js +79 -0
  57. package/dist/mcp/server.d.ts +1 -0
  58. package/dist/mcp/server.js +472 -0
  59. package/dist/schema-BAWSG7KY.js +22 -0
  60. package/dist/schema-E3QUPL26.js +20 -0
  61. package/dist/schema-EHL7WUT6.js +20 -0
  62. package/docs/019-USAGE.md +625 -0
  63. package/docs/020-current-implementation.md +364 -0
  64. package/docs/021-DOGFOODING-FINDINGS.md +175 -0
  65. package/docs/BACKLOG.md +80 -0
  66. package/docs/CONFIG.md +1123 -0
  67. package/docs/DESIGN.md +439 -0
  68. package/docs/ERRORS.md +383 -0
  69. package/docs/PROJECT.md +88 -0
  70. package/docs/ROADMAP.md +407 -0
  71. package/docs/summarization.md +320 -0
  72. package/docs/test-links.md +9 -0
  73. package/justfile +40 -0
  74. package/package.json +74 -9
  75. package/pnpm-workspace.yaml +5 -0
  76. package/research/INDEX.md +315 -0
  77. package/research/code-review/README.md +90 -0
  78. package/research/code-review/cli-error-handling-review.md +979 -0
  79. package/research/code-review/code-review-validation-report.md +464 -0
  80. package/research/code-review/main-ts-review.md +1128 -0
  81. package/research/config-analysis/01-current-implementation.md +470 -0
  82. package/research/config-analysis/02-strategy-recommendation.md +428 -0
  83. package/research/config-analysis/03-task-candidates.md +715 -0
  84. package/research/config-analysis/033-research-configuration-management.md +828 -0
  85. package/research/config-analysis/034-research-effect-cli-config.md +1504 -0
  86. package/research/config-analysis/04-consolidated-task-candidates.md +277 -0
  87. package/research/config-docs/SUMMARY.md +357 -0
  88. package/research/config-docs/TEST-RESULTS.md +776 -0
  89. package/research/config-docs/TODO.md +542 -0
  90. package/research/config-docs/analysis.md +744 -0
  91. package/research/config-docs/fix-validation.md +502 -0
  92. package/research/config-docs/help-audit.md +264 -0
  93. package/research/config-docs/help-system-analysis.md +890 -0
  94. package/research/dogfood/consolidated-tool-evaluation.md +373 -0
  95. package/research/dogfood/strategy-a/a-synthesis.md +184 -0
  96. package/research/dogfood/strategy-a/a1-docs.md +226 -0
  97. package/research/dogfood/strategy-a/a2-amorphic.md +156 -0
  98. package/research/dogfood/strategy-a/a3-llm.md +164 -0
  99. package/research/dogfood/strategy-b/b-synthesis.md +228 -0
  100. package/research/dogfood/strategy-b/b1-architecture.md +207 -0
  101. package/research/dogfood/strategy-b/b2-gaps.md +258 -0
  102. package/research/dogfood/strategy-b/b3-workflows.md +250 -0
  103. package/research/dogfood/strategy-c/c-synthesis.md +451 -0
  104. package/research/dogfood/strategy-c/c1-explorer.md +192 -0
  105. package/research/dogfood/strategy-c/c2-diver-memory.md +145 -0
  106. package/research/dogfood/strategy-c/c3-diver-control.md +148 -0
  107. package/research/dogfood/strategy-c/c4-diver-failure.md +151 -0
  108. package/research/dogfood/strategy-c/c5-diver-execution.md +221 -0
  109. package/research/dogfood/strategy-c/c6-diver-org.md +221 -0
  110. package/research/effect-cli-error-handling.md +845 -0
  111. package/research/effect-errors-as-values.md +943 -0
  112. package/research/errors-task-analysis/00-consolidated-tasks.md +207 -0
  113. package/research/errors-task-analysis/cli-commands-analysis.md +909 -0
  114. package/research/errors-task-analysis/embeddings-analysis.md +709 -0
  115. package/research/errors-task-analysis/index-search-analysis.md +812 -0
  116. package/research/frontmatter/COMMENTS-ARE-SKIPPED.md +149 -0
  117. package/research/frontmatter/LLM-CODE-NAVIGATION.md +276 -0
  118. package/research/issue-review.md +603 -0
  119. package/research/llm-summarization/agent-cli-tools-2026.md +1082 -0
  120. package/research/llm-summarization/alternative-providers-2026.md +1428 -0
  121. package/research/llm-summarization/anthropic-2026.md +367 -0
  122. package/research/llm-summarization/claude-cli-integration.md +1706 -0
  123. package/research/llm-summarization/cli-integration-patterns.md +3155 -0
  124. package/research/llm-summarization/openai-2026.md +473 -0
  125. package/research/llm-summarization/openai-compatible-providers-2026.md +1022 -0
  126. package/research/llm-summarization/opencode-cli-integration.md +1552 -0
  127. package/research/llm-summarization/prompt-engineering-2026.md +1426 -0
  128. package/research/llm-summarization/prototype-results.md +56 -0
  129. package/research/llm-summarization/provider-switching-patterns-2026.md +2153 -0
  130. package/research/llm-summarization/typescript-llm-libraries-2026.md +2436 -0
  131. package/research/mdcontext-error-analysis.md +521 -0
  132. package/research/mdcontext-pudding/00-EXECUTIVE-SUMMARY.md +282 -0
  133. package/research/mdcontext-pudding/01-index-embed.md +956 -0
  134. package/research/mdcontext-pudding/02-search-COMMANDS.md +142 -0
  135. package/research/mdcontext-pudding/02-search-SUMMARY.md +146 -0
  136. package/research/mdcontext-pudding/02-search.md +970 -0
  137. package/research/mdcontext-pudding/03-context.md +779 -0
  138. package/research/mdcontext-pudding/04-navigation-and-analytics.md +803 -0
  139. package/research/mdcontext-pudding/04-tree.md +704 -0
  140. package/research/mdcontext-pudding/05-config.md +1038 -0
  141. package/research/mdcontext-pudding/06-links-summary.txt +87 -0
  142. package/research/mdcontext-pudding/06-links.md +679 -0
  143. package/research/mdcontext-pudding/07-stats.md +693 -0
  144. package/research/mdcontext-pudding/BUG-FIX-PLAN.md +388 -0
  145. package/research/mdcontext-pudding/P0-BUG-VALIDATION.md +167 -0
  146. package/research/mdcontext-pudding/README.md +168 -0
  147. package/research/mdcontext-pudding/TESTING-SUMMARY.md +128 -0
  148. package/research/npm_publish/011-npm-workflow-research-agent2.md +792 -0
  149. package/research/npm_publish/012-npm-workflow-research-agent1.md +530 -0
  150. package/research/npm_publish/013-npm-workflow-research-agent3.md +722 -0
  151. package/research/npm_publish/014-npm-workflow-synthesis.md +556 -0
  152. package/research/npm_publish/031-npm-workflow-task-analysis.md +134 -0
  153. package/research/research-quality-review.md +834 -0
  154. package/research/semantic-search/002-research-embedding-models.md +490 -0
  155. package/research/semantic-search/003-research-rag-alternatives.md +523 -0
  156. package/research/semantic-search/004-research-vector-search.md +841 -0
  157. package/research/semantic-search/032-research-semantic-search.md +427 -0
  158. package/research/semantic-search/embedding-text-analysis.md +156 -0
  159. package/research/semantic-search/multi-word-failure-reproduction.md +171 -0
  160. package/research/semantic-search/query-processing-analysis.md +207 -0
  161. package/research/semantic-search/root-cause-and-solution.md +114 -0
  162. package/research/semantic-search/threshold-validation-report.md +69 -0
  163. package/research/semantic-search/vector-search-analysis.md +63 -0
  164. package/research/task-management-2026/00-synthesis-recommendations.md +295 -0
  165. package/research/task-management-2026/01-ai-workflow-tools.md +416 -0
  166. package/research/task-management-2026/02-agent-framework-patterns.md +476 -0
  167. package/research/task-management-2026/03-lightweight-file-based.md +567 -0
  168. package/research/task-management-2026/04-established-tools-ai-features.md +541 -0
  169. package/research/task-management-2026/linear/01-core-features-workflow.md +771 -0
  170. package/research/task-management-2026/linear/02-api-integrations.md +930 -0
  171. package/research/task-management-2026/linear/03-ai-features.md +368 -0
  172. package/research/task-management-2026/linear/04-pricing-setup.md +205 -0
  173. package/research/task-management-2026/linear/05-usage-patterns-best-practices.md +605 -0
  174. package/research/test-path-issues.md +276 -0
  175. package/review/ALP-76/1-error-type-design.md +962 -0
  176. package/review/ALP-76/2-error-handling-patterns.md +906 -0
  177. package/review/ALP-76/3-error-presentation.md +624 -0
  178. package/review/ALP-76/4-test-coverage.md +625 -0
  179. package/review/ALP-76/5-migration-completeness.md +440 -0
  180. package/review/ALP-76/6-effect-best-practices.md +755 -0
  181. package/scripts/apply-branch-protection.sh +47 -0
  182. package/scripts/branch-protection-templates.json +79 -0
  183. package/scripts/prototype-summarization.ts +346 -0
  184. package/scripts/rebuild-hnswlib.js +58 -0
  185. package/scripts/setup-branch-protection.sh +64 -0
  186. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/active-provider.json +7 -0
  187. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/bm25.json +541 -0
  188. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/bm25.meta.json +5 -0
  189. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/config.json +8 -0
  190. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.bin +0 -0
  191. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.meta.bin +0 -0
  192. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/indexes/documents.json +60 -0
  193. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/indexes/links.json +13 -0
  194. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/indexes/sections.json +1197 -0
  195. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/configuration-management.md +99 -0
  196. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/distributed-systems.md +92 -0
  197. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/error-handling.md +78 -0
  198. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/failure-automation.md +55 -0
  199. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/job-context.md +69 -0
  200. package/src/__tests__/fixtures/semantic-search/multi-word-corpus/process-orchestration.md +99 -0
  201. package/src/cli/argv-preprocessor.test.ts +210 -0
  202. package/src/cli/argv-preprocessor.ts +202 -0
  203. package/src/cli/cli.test.ts +627 -0
  204. package/src/cli/commands/backlinks.ts +54 -0
  205. package/src/cli/commands/config-cmd.ts +642 -0
  206. package/src/cli/commands/context.ts +285 -0
  207. package/src/cli/commands/duplicates.ts +122 -0
  208. package/src/cli/commands/embeddings.ts +529 -0
  209. package/src/cli/commands/index-cmd.ts +480 -0
  210. package/src/cli/commands/index.ts +16 -0
  211. package/src/cli/commands/links.ts +52 -0
  212. package/src/cli/commands/search.ts +1281 -0
  213. package/src/cli/commands/stats.ts +149 -0
  214. package/src/cli/commands/tree.ts +128 -0
  215. package/src/cli/config-layer.ts +176 -0
  216. package/src/cli/error-handler.test.ts +235 -0
  217. package/src/cli/error-handler.ts +655 -0
  218. package/src/cli/flag-schemas.ts +341 -0
  219. package/src/cli/help.ts +588 -0
  220. package/src/cli/index.ts +9 -0
  221. package/src/cli/main.ts +435 -0
  222. package/src/cli/options.ts +41 -0
  223. package/src/cli/shared-error-handling.ts +199 -0
  224. package/src/cli/typo-suggester.test.ts +105 -0
  225. package/src/cli/typo-suggester.ts +130 -0
  226. package/src/cli/utils.ts +259 -0
  227. package/src/config/file-provider.test.ts +320 -0
  228. package/src/config/file-provider.ts +273 -0
  229. package/src/config/index.ts +72 -0
  230. package/src/config/integration.test.ts +667 -0
  231. package/src/config/precedence.test.ts +277 -0
  232. package/src/config/precedence.ts +451 -0
  233. package/src/config/schema.test.ts +414 -0
  234. package/src/config/schema.ts +603 -0
  235. package/src/config/service.test.ts +320 -0
  236. package/src/config/service.ts +243 -0
  237. package/src/config/testing.test.ts +264 -0
  238. package/src/config/testing.ts +110 -0
  239. package/src/core/index.ts +1 -0
  240. package/src/core/types.ts +113 -0
  241. package/src/duplicates/detector.test.ts +183 -0
  242. package/src/duplicates/detector.ts +414 -0
  243. package/src/duplicates/index.ts +18 -0
  244. package/src/embeddings/embedding-namespace.test.ts +300 -0
  245. package/src/embeddings/embedding-namespace.ts +947 -0
  246. package/src/embeddings/heading-boost.test.ts +222 -0
  247. package/src/embeddings/hnsw-build-options.test.ts +198 -0
  248. package/src/embeddings/hyde.test.ts +272 -0
  249. package/src/embeddings/hyde.ts +264 -0
  250. package/src/embeddings/index.ts +10 -0
  251. package/src/embeddings/openai-provider.ts +414 -0
  252. package/src/embeddings/pricing.json +22 -0
  253. package/src/embeddings/provider-constants.ts +204 -0
  254. package/src/embeddings/provider-errors.test.ts +967 -0
  255. package/src/embeddings/provider-errors.ts +565 -0
  256. package/src/embeddings/provider-factory.test.ts +240 -0
  257. package/src/embeddings/provider-factory.ts +225 -0
  258. package/src/embeddings/provider-integration.test.ts +788 -0
  259. package/src/embeddings/query-preprocessing.test.ts +187 -0
  260. package/src/embeddings/semantic-search-threshold.test.ts +508 -0
  261. package/src/embeddings/semantic-search.ts +1270 -0
  262. package/src/embeddings/types.ts +359 -0
  263. package/src/embeddings/vector-store.ts +708 -0
  264. package/src/embeddings/voyage-provider.ts +313 -0
  265. package/src/errors/errors.test.ts +845 -0
  266. package/src/errors/index.ts +533 -0
  267. package/src/index/ignore-patterns.test.ts +354 -0
  268. package/src/index/ignore-patterns.ts +305 -0
  269. package/src/index/index.ts +4 -0
  270. package/src/index/indexer.ts +684 -0
  271. package/src/index/storage.ts +260 -0
  272. package/src/index/types.ts +147 -0
  273. package/src/index/watcher.ts +189 -0
  274. package/src/index.ts +30 -0
  275. package/src/integration/search-keyword.test.ts +678 -0
  276. package/src/mcp/server.ts +612 -0
  277. package/src/parser/index.ts +1 -0
  278. package/src/parser/parser.test.ts +291 -0
  279. package/src/parser/parser.ts +394 -0
  280. package/src/parser/section-filter.test.ts +277 -0
  281. package/src/parser/section-filter.ts +392 -0
  282. package/src/search/__tests__/hybrid-search.test.ts +650 -0
  283. package/src/search/bm25-store.ts +366 -0
  284. package/src/search/cross-encoder.test.ts +253 -0
  285. package/src/search/cross-encoder.ts +406 -0
  286. package/src/search/fuzzy-search.test.ts +419 -0
  287. package/src/search/fuzzy-search.ts +273 -0
  288. package/src/search/hybrid-search.ts +448 -0
  289. package/src/search/path-matcher.test.ts +276 -0
  290. package/src/search/path-matcher.ts +33 -0
  291. package/src/search/query-parser.test.ts +260 -0
  292. package/src/search/query-parser.ts +319 -0
  293. package/src/search/searcher.test.ts +280 -0
  294. package/src/search/searcher.ts +724 -0
  295. package/src/search/wink-bm25.d.ts +30 -0
  296. package/src/summarization/cli-providers/claude.ts +202 -0
  297. package/src/summarization/cli-providers/detection.test.ts +273 -0
  298. package/src/summarization/cli-providers/detection.ts +118 -0
  299. package/src/summarization/cli-providers/index.ts +8 -0
  300. package/src/summarization/cost.test.ts +139 -0
  301. package/src/summarization/cost.ts +102 -0
  302. package/src/summarization/error-handler.test.ts +127 -0
  303. package/src/summarization/error-handler.ts +111 -0
  304. package/src/summarization/index.ts +102 -0
  305. package/src/summarization/pipeline.test.ts +498 -0
  306. package/src/summarization/pipeline.ts +231 -0
  307. package/src/summarization/prompts.test.ts +269 -0
  308. package/src/summarization/prompts.ts +133 -0
  309. package/src/summarization/provider-factory.test.ts +396 -0
  310. package/src/summarization/provider-factory.ts +178 -0
  311. package/src/summarization/types.ts +184 -0
  312. package/src/summarize/budget-bugs.test.ts +620 -0
  313. package/src/summarize/formatters.ts +419 -0
  314. package/src/summarize/index.ts +20 -0
  315. package/src/summarize/summarizer.test.ts +275 -0
  316. package/src/summarize/summarizer.ts +597 -0
  317. package/src/summarize/verify-bugs.test.ts +238 -0
  318. package/src/types/huggingface-transformers.d.ts +66 -0
  319. package/src/utils/index.ts +1 -0
  320. package/src/utils/tokens.test.ts +142 -0
  321. package/src/utils/tokens.ts +186 -0
  322. package/tests/fixtures/cli/.mdcontext/active-provider.json +7 -0
  323. package/tests/fixtures/cli/.mdcontext/config.json +8 -0
  324. package/tests/fixtures/cli/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.bin +0 -0
  325. package/tests/fixtures/cli/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.meta.bin +0 -0
  326. package/tests/fixtures/cli/.mdcontext/indexes/documents.json +33 -0
  327. package/tests/fixtures/cli/.mdcontext/indexes/links.json +12 -0
  328. package/tests/fixtures/cli/.mdcontext/indexes/sections.json +247 -0
  329. package/tests/fixtures/cli/README.md +9 -0
  330. package/tests/fixtures/cli/api-reference.md +11 -0
  331. package/tests/fixtures/cli/getting-started.md +11 -0
  332. package/tests/integration/embed-index.test.ts +712 -0
  333. package/tests/integration/search-context.test.ts +469 -0
  334. package/tests/integration/search-semantic.test.ts +522 -0
  335. package/tsconfig.json +26 -0
  336. package/vitest.config.ts +16 -0
  337. package/vitest.setup.ts +12 -0
@@ -0,0 +1,556 @@
1
+ # npm Publishing Workflow Synthesis: Final Recommendations for mdcontext
2
+
3
+ > Consolidated from 3 research agents | January 2026
4
+
5
+ This document synthesizes research from three independent agents into actionable recommendations for implementing a world-class npm publishing workflow for the `mdcontext` package.
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ 1. [Executive Summary](#executive-summary)
12
+ 2. [Consensus Analysis](#consensus-analysis)
13
+ 3. [Final Recommended Stack](#final-recommended-stack)
14
+ 4. [Bun Migration Verdict](#bun-migration-verdict)
15
+ 5. [Recommended GitHub Actions Workflow](#recommended-github-actions-workflow)
16
+ 6. [Quality Gates](#quality-gates)
17
+ 7. [Implementation Roadmap](#implementation-roadmap)
18
+
19
+ ---
20
+
21
+ ## Executive Summary
22
+
23
+ ### All Three Agents Agree On
24
+
25
+ | Decision | Consensus | Confidence |
26
+ | --------------------- | ---------------------------- | ---------- |
27
+ | **Package Manager** | pnpm (stay) | 100% |
28
+ | **Release Tool** | Changesets | 100% |
29
+ | **Authentication** | OIDC Trusted Publishing | 100% |
30
+ | **Bun Migration Now** | No | 100% |
31
+ | **Provenance** | Enable via `id-token: write` | 100% |
32
+ | **Quality Tools** | publint + attw | 100% |
33
+
34
+ ### Key Insight
35
+
36
+ All agents independently arrived at the same conclusion: **pnpm + Changesets + OIDC** is the optimal stack for mdcontext in 2026. This represents strong consensus across different research approaches.
37
+
38
+ ---
39
+
40
+ ## Consensus Analysis
41
+
42
+ ### Areas of Complete Agreement
43
+
44
+ #### 1. Package Manager: Stay with pnpm
45
+
46
+ All agents recommend staying with pnpm:
47
+
48
+ - **Agent 1**: "Migration effort not justified" for existing pnpm projects
49
+ - **Agent 2**: "pnpm" as primary recommendation, with Bun as speed alternative
50
+ - **Agent 3**: "pnpm + tsup workflow is working well"
51
+
52
+ **Rationale**:
53
+
54
+ - Mature ecosystem with excellent CI/CD support
55
+ - Native provenance support (`--provenance` flag)
56
+ - Workspace publishing is stable
57
+ - No migration cost
58
+
59
+ #### 2. Release Automation: Changesets
60
+
61
+ Unanimous recommendation for Changesets over semantic-release:
62
+
63
+ | Factor | Changesets | semantic-release |
64
+ | ---------------- | ------------------------ | -------------------- |
65
+ | Monorepo Support | Native, first-class | Via outdated plugins |
66
+ | Human Review | PR-based workflow | Fully automated |
67
+ | Control | High (edit after commit) | Low (commit-driven) |
68
+ | pnpm Integration | Official documentation | Community support |
69
+
70
+ **Why not semantic-release?**
71
+
72
+ - Agent 1: "semantic-release monorepo plugin (multi-release) is not well maintained"
73
+ - Agent 2: "No native monorepo support (requires community plugins)"
74
+ - Agent 3: "Version coupling with deploys causes cleanup issues on failure"
75
+
76
+ #### 3. Authentication: OIDC Trusted Publishing
77
+
78
+ All agents emphasize OIDC as the clear winner:
79
+
80
+ **Key Benefits**:
81
+
82
+ - No token management (classic tokens revoked Dec 9, 2025)
83
+ - Short-lived, cryptographically signed credentials
84
+ - Automatic provenance attestations
85
+ - Cannot be exfiltrated or reused
86
+
87
+ **Critical Configuration**:
88
+
89
+ ```yaml
90
+ permissions:
91
+ contents: write
92
+ id-token: write # Required for OIDC
93
+ ```
94
+
95
+ #### 4. Quality Tools
96
+
97
+ All agents recommend the same pre-publish validation:
98
+
99
+ | Tool | Purpose |
100
+ | ------------------ | ---------------------------------------------------- |
101
+ | **publint** | Package structure validation (exports, main, module) |
102
+ | **attw** | TypeScript types validation |
103
+ | **pnpm typecheck** | Compile-time type checking |
104
+
105
+ ### Minor Differences (Non-Conflicting)
106
+
107
+ | Topic | Agent 1 | Agent 2 | Agent 3 |
108
+ | ------------------ | ----------- | --------------------------------- | ---------------------- |
109
+ | Build Tool | tsup | **tsdown** (recommends migration) | tsup |
110
+ | Node Versions | 22 | 20, 22, 24 | 18, 20, 22 |
111
+ | OS Matrix | Ubuntu only | Ubuntu, macOS, Windows | Ubuntu, macOS, Windows |
112
+ | setup-node version | v4 | **v6** | v4 |
113
+
114
+ **Recommendations**:
115
+
116
+ - Build Tool: Keep tsup for now; tsdown migration is optional
117
+ - Node Versions: Test 20, 22 minimum; 18 for LTS users, 24 for forward compatibility
118
+ - OS Matrix: Add Windows/macOS for CLI tool (path handling differs)
119
+ - setup-node: Use v4 (stable); v6 may be cutting edge
120
+
121
+ ---
122
+
123
+ ## Final Recommended Stack
124
+
125
+ | Component | Choice | Rationale |
126
+ | ------------------- | -------------------------- | -------------------------------------------------- |
127
+ | **Package Manager** | pnpm 10 | Mature, stable, excellent CI support |
128
+ | **Release Tool** | Changesets | PR-based review, monorepo-ready, pnpm integration |
129
+ | **Authentication** | OIDC Trusted Publishing | No tokens, automatic provenance, industry standard |
130
+ | **Build Tool** | tsup (current) | Working well, tsdown migration optional |
131
+ | **CI Platform** | GitHub Actions | Native OIDC support, excellent pnpm integration |
132
+ | **Module Format** | ESM-first + CJS fallback | Maximum compatibility |
133
+ | **Quality Gates** | publint + attw + typecheck | Comprehensive pre-publish validation |
134
+
135
+ ---
136
+
137
+ ## Bun Migration Verdict
138
+
139
+ ### Decision: **Do NOT migrate now. Re-evaluate in 6-12 months.**
140
+
141
+ All three agents independently reached the same conclusion.
142
+
143
+ ### Why Not Now
144
+
145
+ | Issue | Impact | Source |
146
+ | ---------------------------- | ------------------------------------ | ---------------------- |
147
+ | No `--provenance` flag | Cannot generate SLSA attestations | Agent 1 (Issue #15601) |
148
+ | 34% compatibility challenges | Risk for production CLI | Agent 2, Agent 3 |
149
+ | Native addon issues | `hnswlib-node`, `tiktoken` may break | Agent 3 |
150
+ | Workspace publishing bugs | References may not resolve | Agent 1 (Issue #15246) |
151
+
152
+ ### mdcontext Specific Concerns
153
+
154
+ ```
155
+ Dependencies with Bun risk:
156
+ - hnswlib-node (native addon - vector search)
157
+ - tiktoken (native addon - tokenization)
158
+
159
+ Low-risk dependencies:
160
+ - openai, remark-*, unified (pure JS)
161
+ - gray-matter, chokidar (widely compatible)
162
+ ```
163
+
164
+ ### Future Consideration
165
+
166
+ **When to reconsider Bun:**
167
+
168
+ 1. `--provenance` flag is implemented (track Issue #15601)
169
+ 2. Native addon compatibility reaches 95%+
170
+ 3. `hnswlib-node` and `tiktoken` confirmed working
171
+ 4. mdcontext usage grows enough to warrant dual distribution
172
+
173
+ **Potential hybrid approach (future):**
174
+
175
+ - Keep Node.js as primary npm target
176
+ - Offer Bun-compiled binary as alternative distribution
177
+ - Use Bun for local development speed
178
+
179
+ ---
180
+
181
+ ## Recommended GitHub Actions Workflow
182
+
183
+ ### Complete Production-Ready Workflow
184
+
185
+ ```yaml
186
+ # .github/workflows/release.yml
187
+ name: Release
188
+
189
+ on:
190
+ push:
191
+ branches: [main]
192
+
193
+ permissions:
194
+ contents: write
195
+ pull-requests: write
196
+ id-token: write # Required for OIDC trusted publishing
197
+
198
+ jobs:
199
+ # ============================================
200
+ # Job 1: Quality Gates (fast feedback)
201
+ # ============================================
202
+ quality:
203
+ runs-on: ubuntu-latest
204
+ steps:
205
+ - uses: actions/checkout@v4
206
+
207
+ - uses: pnpm/action-setup@v4
208
+ with:
209
+ version: 10
210
+
211
+ - uses: actions/setup-node@v4
212
+ with:
213
+ node-version: "22"
214
+ cache: "pnpm"
215
+
216
+ - run: pnpm install --frozen-lockfile
217
+ - run: pnpm build
218
+
219
+ # Type checking
220
+ - run: pnpm typecheck
221
+
222
+ # Linting
223
+ - run: pnpm lint
224
+
225
+ # Package structure validation
226
+ - name: Validate package exports
227
+ run: npx publint
228
+
229
+ # TypeScript types validation
230
+ - name: Validate TypeScript types
231
+ run: npx attw --pack .
232
+
233
+ # ============================================
234
+ # Job 2: Test Matrix (parallel)
235
+ # ============================================
236
+ test:
237
+ strategy:
238
+ fail-fast: false # See all failures, not just first
239
+ matrix:
240
+ os: [ubuntu-latest, macos-latest, windows-latest]
241
+ node: [20, 22]
242
+ exclude:
243
+ # Skip known problematic combinations if any
244
+ - os: windows-latest
245
+ node: 20
246
+
247
+ runs-on: ${{ matrix.os }}
248
+ steps:
249
+ - uses: actions/checkout@v4
250
+
251
+ - uses: pnpm/action-setup@v4
252
+ with:
253
+ version: 10
254
+
255
+ - uses: actions/setup-node@v4
256
+ with:
257
+ node-version: ${{ matrix.node }}
258
+ cache: "pnpm"
259
+
260
+ - run: pnpm install --frozen-lockfile
261
+ - run: pnpm test
262
+ - run: pnpm build
263
+
264
+ # Test CLI binary actually works
265
+ - name: Test CLI execution
266
+ run: |
267
+ node dist/cli/main.js --version
268
+ node dist/cli/main.js --help
269
+
270
+ # ============================================
271
+ # Job 3: Release (after quality + tests pass)
272
+ # ============================================
273
+ release:
274
+ needs: [quality, test]
275
+ runs-on: ubuntu-latest
276
+ steps:
277
+ - uses: actions/checkout@v4
278
+ with:
279
+ fetch-depth: 0 # Required for changesets
280
+
281
+ - uses: pnpm/action-setup@v4
282
+ with:
283
+ version: 10
284
+
285
+ - uses: actions/setup-node@v4
286
+ with:
287
+ node-version: "22"
288
+ cache: "pnpm"
289
+ registry-url: "https://registry.npmjs.org"
290
+
291
+ - run: pnpm install --frozen-lockfile
292
+ - run: pnpm build
293
+
294
+ - name: Create Release Pull Request or Publish
295
+ uses: changesets/action@v1
296
+ with:
297
+ commit: "chore: release packages"
298
+ title: "chore: release packages"
299
+ publish: pnpm changeset publish
300
+ env:
301
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
302
+ # No NPM_TOKEN needed with OIDC trusted publishing!
303
+ ```
304
+
305
+ ### Separate CI Workflow (for PRs)
306
+
307
+ ```yaml
308
+ # .github/workflows/ci.yml
309
+ name: CI
310
+
311
+ on:
312
+ pull_request:
313
+ branches: [main]
314
+
315
+ jobs:
316
+ quality:
317
+ runs-on: ubuntu-latest
318
+ steps:
319
+ - uses: actions/checkout@v4
320
+
321
+ - uses: pnpm/action-setup@v4
322
+ with:
323
+ version: 10
324
+
325
+ - uses: actions/setup-node@v4
326
+ with:
327
+ node-version: "22"
328
+ cache: "pnpm"
329
+
330
+ - run: pnpm install --frozen-lockfile
331
+ - run: pnpm build
332
+ - run: pnpm typecheck
333
+ - run: pnpm lint
334
+ - run: npx publint
335
+ - run: npx attw --pack .
336
+
337
+ test:
338
+ strategy:
339
+ fail-fast: false
340
+ matrix:
341
+ os: [ubuntu-latest, macos-latest, windows-latest]
342
+ node: [20, 22]
343
+
344
+ runs-on: ${{ matrix.os }}
345
+ steps:
346
+ - uses: actions/checkout@v4
347
+
348
+ - uses: pnpm/action-setup@v4
349
+ with:
350
+ version: 10
351
+
352
+ - uses: actions/setup-node@v4
353
+ with:
354
+ node-version: ${{ matrix.node }}
355
+ cache: "pnpm"
356
+
357
+ - run: pnpm install --frozen-lockfile
358
+ - run: pnpm test
359
+ - run: pnpm build
360
+ - name: Test CLI
361
+ run: node dist/cli/main.js --help
362
+ ```
363
+
364
+ ---
365
+
366
+ ## Quality Gates
367
+
368
+ ### Pre-Publish Checklist (Automated)
369
+
370
+ | Gate | Tool | Blocks Publish |
371
+ | ---------------- | ------------------------------- | -------------- |
372
+ | Type Safety | `pnpm typecheck` | Yes |
373
+ | Linting | `pnpm lint` | Yes |
374
+ | Unit Tests | `pnpm test` | Yes |
375
+ | Build | `pnpm build` | Yes |
376
+ | Package Exports | `npx publint` | Yes |
377
+ | TypeScript Types | `npx attw --pack .` | Yes |
378
+ | CLI Works | `node dist/cli/main.js --help` | Yes |
379
+ | Cross-Platform | Matrix (Ubuntu, macOS, Windows) | Yes |
380
+ | Multi-Node | Matrix (Node 20, 22) | Yes |
381
+
382
+ ### Package.json Scripts
383
+
384
+ Add these scripts to support the workflow:
385
+
386
+ ```json
387
+ {
388
+ "scripts": {
389
+ "build": "tsup",
390
+ "test": "vitest run",
391
+ "typecheck": "tsc --noEmit",
392
+ "lint": "eslint .",
393
+ "quality": "pnpm build && npx publint && npx attw --pack .",
394
+ "prepublishOnly": "pnpm build && pnpm test && pnpm typecheck"
395
+ }
396
+ }
397
+ ```
398
+
399
+ ### Dev Dependencies to Add
400
+
401
+ ```bash
402
+ pnpm add -D @changesets/cli @changesets/changelog-github
403
+ ```
404
+
405
+ ---
406
+
407
+ ## Implementation Roadmap
408
+
409
+ ### Phase 1: Setup Changesets (Day 1)
410
+
411
+ ```bash
412
+ # 1. Install changesets
413
+ pnpm add -D @changesets/cli @changesets/changelog-github
414
+
415
+ # 2. Initialize
416
+ pnpm changeset init
417
+
418
+ # 3. Configure .changeset/config.json
419
+ ```
420
+
421
+ Create `.changeset/config.json`:
422
+
423
+ ```json
424
+ {
425
+ "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
426
+ "changelog": ["@changesets/changelog-github", { "repo": "alphab/mdcontext" }],
427
+ "commit": false,
428
+ "fixed": [],
429
+ "linked": [],
430
+ "access": "public",
431
+ "baseBranch": "main",
432
+ "updateInternalDependencies": "patch",
433
+ "ignore": []
434
+ }
435
+ ```
436
+
437
+ ### Phase 2: Configure OIDC Trusted Publishing (Day 1)
438
+
439
+ 1. **Go to npmjs.com** > Package (`mdcontext`) > Settings > Trusted Publishers
440
+ 2. **Add GitHub Actions** as trusted publisher:
441
+ - Organization/User: `alphab` (or your npm username)
442
+ - Repository: `mdcontext`
443
+ - Workflow file: `release.yml`
444
+ - Environment: (leave blank or use `production`)
445
+ 3. **Verify** the package is configured for OIDC
446
+
447
+ ### Phase 3: Create GitHub Actions Workflows (Day 1)
448
+
449
+ 1. Create `.github/workflows/ci.yml` (PR checks)
450
+ 2. Create `.github/workflows/release.yml` (main branch publish)
451
+ 3. Ensure `id-token: write` permission is set
452
+
453
+ ### Phase 4: Add Quality Tools (Day 1-2)
454
+
455
+ ```bash
456
+ # These are used via npx, no install needed
457
+ # But you can add them as dev dependencies if preferred:
458
+ pnpm add -D publint @arethetypeswrong/cli
459
+ ```
460
+
461
+ Update `package.json` with quality scripts.
462
+
463
+ ### Phase 5: Test the Workflow (Day 2)
464
+
465
+ 1. **Create a test changeset**:
466
+
467
+ ```bash
468
+ pnpm changeset
469
+ # Choose patch, describe the change
470
+ ```
471
+
472
+ 2. **Push to main** and verify:
473
+ - CI runs all quality gates
474
+ - Changesets action creates a "Version Packages" PR
475
+
476
+ 3. **Merge the Version PR** and verify:
477
+ - Package publishes to npm
478
+ - Provenance badge appears on npmjs.com
479
+ - GitHub release is created
480
+
481
+ ### Phase 6: Documentation (Day 2)
482
+
483
+ Add to `CONTRIBUTING.md`:
484
+
485
+ ```markdown
486
+ ## Releasing
487
+
488
+ This project uses [Changesets](https://github.com/changesets/changesets) for releases.
489
+
490
+ ### Creating a changeset
491
+
492
+ When you make a change that should be released:
493
+
494
+ \`\`\`bash
495
+ pnpm changeset
496
+ \`\`\`
497
+
498
+ Follow the prompts to:
499
+
500
+ 1. Select the package(s) to bump
501
+ 2. Choose the bump type (patch/minor/major)
502
+ 3. Write a summary of the change
503
+
504
+ ### Release process
505
+
506
+ 1. Push your changeset file with your PR
507
+ 2. Once merged, a "Version Packages" PR is automatically created
508
+ 3. When that PR is merged, packages are automatically published to npm
509
+ \`\`\`
510
+
511
+ ---
512
+
513
+ ## Summary
514
+
515
+ ### What You're Getting
516
+
517
+ | Feature | Benefit |
518
+ | ------------------------ | ------------------------------------------- |
519
+ | **OIDC Authentication** | No token rotation, automatic provenance |
520
+ | **Changesets** | Human-reviewable releases, monorepo-ready |
521
+ | **Quality Gates** | Catch issues before publish |
522
+ | **Matrix Testing** | Confidence across Node versions and OS |
523
+ | **Automatic Provenance** | SLSA Build Level 2, verifiable supply chain |
524
+
525
+ ### What You're Avoiding
526
+
527
+ | Risk | Mitigation |
528
+ | ------------------- | --------------------------------------- |
529
+ | Token leaks | OIDC eliminates long-lived tokens |
530
+ | Broken packages | publint + attw catch export issues |
531
+ | Type errors | attw validates TypeScript consumers |
532
+ | Platform bugs | Matrix testing across OS/Node |
533
+ | Accidental releases | Changesets requires explicit versioning |
534
+
535
+ ---
536
+
537
+ ## References
538
+
539
+ All research documents:
540
+
541
+ - `/docs/npm-workflow-research-agent1.md` - Focus: GitHub Actions, OIDC, Bun analysis
542
+ - `/docs/npm-workflow-research-agent2.md` - Focus: Release tools, CI/CD design, ESM/CJS
543
+ - `/docs/npm-workflow-research-agent3.md` - Focus: DX, quality tools, testing strategies
544
+
545
+ Key external sources:
546
+
547
+ - [npm Trusted Publishing with OIDC](https://github.blog/changelog/2025-07-31-npm-trusted-publishing-with-oidc-is-generally-available/)
548
+ - [Using Changesets with pnpm](https://pnpm.io/next/using-changesets)
549
+ - [publint](https://publint.dev/)
550
+ - [Are The Types Wrong?](https://arethetypeswrong.github.io/)
551
+
552
+ ---
553
+
554
+ _Synthesis completed January 2026_
555
+ _Ready for implementation_
556
+ ```
@@ -0,0 +1,134 @@
1
+ # NPM Workflow Task Analysis
2
+
3
+ Analysis of `/docs/014-npm-workflow-synthesis.md` against current implementation.
4
+
5
+ Date: January 2026
6
+
7
+ ---
8
+
9
+ ## Implemented (No Action Needed)
10
+
11
+ ### Package Manager: pnpm ✅
12
+
13
+ - `pnpm/action-setup@v4` in GitHub Actions
14
+ - Local environment running pnpm 10.28.0
15
+
16
+ ### Release Tool: Changesets ✅
17
+
18
+ - `.changeset/config.json` properly configured
19
+ - Uses `@changesets/changelog-github` for changelog generation
20
+ - Scripts: `"changeset": "changeset"`, `"release": "changeset publish"`
21
+
22
+ ### GitHub Actions Workflows ✅
23
+
24
+ - `.github/workflows/ci.yml` - PR quality checks
25
+ - `.github/workflows/release.yml` - Release automation
26
+ - OIDC permissions: `id-token: write` (correctly configured)
27
+ - `fetch-depth: 0` for proper changeset operation
28
+
29
+ ### Quality Gates ✅
30
+
31
+ - `"quality": "pnpm build && npx publint && npx attw --pack ."`
32
+ - `"prepublishOnly": "pnpm build && pnpm test && pnpm typecheck"`
33
+ - Biome for linting (modern ESLint alternative)
34
+
35
+ ### Build Tool: tsup ✅
36
+
37
+ - `"build": "tsup src/cli/main.ts src/mcp/server.ts src/index.ts --format esm --dts"`
38
+
39
+ ### Module Format: ESM-first ✅
40
+
41
+ - `"type": "module"` in package.json
42
+
43
+ ---
44
+
45
+ ## Task Candidates
46
+
47
+ ### 1. Configure OIDC Trusted Publishing on npm
48
+
49
+ **Priority:** Critical (releases will fail without this)
50
+
51
+ **Description:**
52
+ GitHub Actions workflow has `id-token: write` but npm package needs to be configured to accept OIDC tokens.
53
+
54
+ **Steps:**
55
+
56
+ 1. Go to npmjs.com > Package (`mdcontext`) > Settings > Trusted Publishers
57
+ 2. Add GitHub Actions as trusted publisher:
58
+ - Organization/User: `alphab`
59
+ - Repository: `mdcontext`
60
+ - Workflow file: `release.yml`
61
+ - Environment: (leave blank or use `production`)
62
+
63
+ **Why:** OIDC eliminates need for long-lived NPM tokens. Classic tokens were revoked Dec 9, 2025.
64
+
65
+ ---
66
+
67
+ ### 2. Create CONTRIBUTING.md with Release Documentation
68
+
69
+ **Priority:** Low
70
+
71
+ **Description:**
72
+ Document the Changesets workflow for contributors:
73
+
74
+ - How to create a changeset (`pnpm changeset`)
75
+ - What happens when changesets are merged (Version Packages PR created)
76
+ - What happens when Version Packages PR is merged (automatic npm publish)
77
+ - Guidelines for choosing semver bump types
78
+
79
+ **Why:** Reduces maintainer burden explaining the release process.
80
+
81
+ ---
82
+
83
+ ### 3. Test Complete Release Pipeline End-to-End
84
+
85
+ **Priority:** Medium
86
+
87
+ **Description:**
88
+ Validate the entire pipeline:
89
+
90
+ 1. Creating a changeset works
91
+ 2. Pushing to main triggers the release workflow
92
+ 3. Changesets action creates a "Version Packages" PR
93
+ 4. Merging the Version PR publishes to npm
94
+ 5. Provenance badge appears on npmjs.com
95
+ 6. GitHub release is created automatically
96
+
97
+ **Why:** Configuration bugs only discovered during actual release attempts.
98
+
99
+ ---
100
+
101
+ ### 4. Add --version Flag to CLI
102
+
103
+ **Priority:** Low
104
+
105
+ **Description:**
106
+ CLI should support `--version` flag returning current package version.
107
+
108
+ **Current:** CI tests `node dist/cli/main.js --help`
109
+ **Recommended:** Also test `node dist/cli/main.js --version`
110
+
111
+ **Why:** Users expect `--version` on CLI tools. Helps with debugging and support.
112
+
113
+ ---
114
+
115
+ ## Skipped (Not Applicable)
116
+
117
+ | Recommendation | Reason to Skip |
118
+ | ----------------- | ------------------------------------------------------------------------ |
119
+ | Bun migration | Explicitly "Do NOT migrate now" - no `--provenance`, native addon issues |
120
+ | tsdown migration | Optional - tsup working well |
121
+ | ESLint setup | Using Biome instead (modern alternative) |
122
+ | publint as devDep | `npx publint` works fine |
123
+
124
+ ---
125
+
126
+ ## Summary
127
+
128
+ | Category | Count |
129
+ | --------------- | ----------------- |
130
+ | Implemented | 6 major areas |
131
+ | Task Candidates | 4 items |
132
+ | Skipped | 4 recommendations |
133
+
134
+ **Critical action:** Configure OIDC on npm before attempting any release.