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.
- package/.changeset/README.md +28 -0
- package/.changeset/config.json +11 -0
- package/.claude/settings.local.json +25 -0
- package/.github/workflows/ci.yml +83 -0
- package/.github/workflows/claude-code-review.yml +44 -0
- package/.github/workflows/claude.yml +85 -0
- package/.github/workflows/release.yml +113 -0
- package/.tldrignore +112 -0
- package/BACKLOG.md +338 -0
- package/CONTRIBUTING.md +186 -0
- package/NOTES/NOTES +44 -0
- package/README.md +434 -11
- package/biome.json +36 -0
- package/cspell.config.yaml +14 -0
- package/dist/chunk-23UPXDNL.js +3044 -0
- package/dist/chunk-2W7MO2DL.js +1366 -0
- package/dist/chunk-3NUAZGMA.js +1689 -0
- package/dist/chunk-7TOWB2XB.js +366 -0
- package/dist/chunk-7XOTOADQ.js +3065 -0
- package/dist/chunk-AH2PDM2K.js +3042 -0
- package/dist/chunk-BNXWSZ63.js +3742 -0
- package/dist/chunk-BTL5DJVU.js +3222 -0
- package/dist/chunk-HDHYG7E4.js +104 -0
- package/dist/chunk-HLR4KZBP.js +3234 -0
- package/dist/chunk-IP3FRFEB.js +1045 -0
- package/dist/chunk-KHU56VDO.js +3042 -0
- package/dist/chunk-KRYIFLQR.js +88 -0
- package/dist/chunk-LBSDNLEM.js +287 -0
- package/dist/chunk-MNTQ7HCP.js +2643 -0
- package/dist/chunk-MUJELQQ6.js +1387 -0
- package/dist/chunk-MXJGMSLV.js +2199 -0
- package/dist/chunk-N6QJGC3Z.js +2636 -0
- package/dist/chunk-OBELGBPM.js +1713 -0
- package/dist/chunk-OT7R5XTA.js +3192 -0
- package/dist/chunk-P7X4RA2T.js +106 -0
- package/dist/chunk-PIDUQNC2.js +3185 -0
- package/dist/chunk-POGCDIH4.js +3187 -0
- package/dist/chunk-PSIEOQGZ.js +3043 -0
- package/dist/chunk-PVRT3IHA.js +3238 -0
- package/dist/chunk-QNN4TT23.js +1430 -0
- package/dist/chunk-RE3R45RJ.js +3042 -0
- package/dist/chunk-S7E6TFX6.js +803 -0
- package/dist/chunk-SG6GLU4U.js +1378 -0
- package/dist/chunk-SJCDV2ST.js +274 -0
- package/dist/chunk-SYE5XLF3.js +104 -0
- package/dist/chunk-T5VLYBZD.js +103 -0
- package/dist/chunk-TOQB7VWU.js +3238 -0
- package/dist/chunk-VFNMZ4ZQ.js +3228 -0
- package/dist/chunk-VVTGZNBT.js +1629 -0
- package/dist/chunk-W7Q4RFEV.js +104 -0
- package/dist/chunk-XTYYVRLO.js +3190 -0
- package/dist/chunk-Y6MDYVJD.js +3063 -0
- package/dist/cli/main.d.ts +1 -0
- package/dist/cli/main.js +5458 -0
- package/dist/index.d.ts +653 -0
- package/dist/index.js +79 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +472 -0
- package/dist/schema-BAWSG7KY.js +22 -0
- package/dist/schema-E3QUPL26.js +20 -0
- package/dist/schema-EHL7WUT6.js +20 -0
- package/docs/019-USAGE.md +625 -0
- package/docs/020-current-implementation.md +364 -0
- package/docs/021-DOGFOODING-FINDINGS.md +175 -0
- package/docs/BACKLOG.md +80 -0
- package/docs/CONFIG.md +1123 -0
- package/docs/DESIGN.md +439 -0
- package/docs/ERRORS.md +383 -0
- package/docs/PROJECT.md +88 -0
- package/docs/ROADMAP.md +407 -0
- package/docs/summarization.md +320 -0
- package/docs/test-links.md +9 -0
- package/justfile +40 -0
- package/package.json +74 -9
- package/pnpm-workspace.yaml +5 -0
- package/research/INDEX.md +315 -0
- package/research/code-review/README.md +90 -0
- package/research/code-review/cli-error-handling-review.md +979 -0
- package/research/code-review/code-review-validation-report.md +464 -0
- package/research/code-review/main-ts-review.md +1128 -0
- package/research/config-analysis/01-current-implementation.md +470 -0
- package/research/config-analysis/02-strategy-recommendation.md +428 -0
- package/research/config-analysis/03-task-candidates.md +715 -0
- package/research/config-analysis/033-research-configuration-management.md +828 -0
- package/research/config-analysis/034-research-effect-cli-config.md +1504 -0
- package/research/config-analysis/04-consolidated-task-candidates.md +277 -0
- package/research/config-docs/SUMMARY.md +357 -0
- package/research/config-docs/TEST-RESULTS.md +776 -0
- package/research/config-docs/TODO.md +542 -0
- package/research/config-docs/analysis.md +744 -0
- package/research/config-docs/fix-validation.md +502 -0
- package/research/config-docs/help-audit.md +264 -0
- package/research/config-docs/help-system-analysis.md +890 -0
- package/research/dogfood/consolidated-tool-evaluation.md +373 -0
- package/research/dogfood/strategy-a/a-synthesis.md +184 -0
- package/research/dogfood/strategy-a/a1-docs.md +226 -0
- package/research/dogfood/strategy-a/a2-amorphic.md +156 -0
- package/research/dogfood/strategy-a/a3-llm.md +164 -0
- package/research/dogfood/strategy-b/b-synthesis.md +228 -0
- package/research/dogfood/strategy-b/b1-architecture.md +207 -0
- package/research/dogfood/strategy-b/b2-gaps.md +258 -0
- package/research/dogfood/strategy-b/b3-workflows.md +250 -0
- package/research/dogfood/strategy-c/c-synthesis.md +451 -0
- package/research/dogfood/strategy-c/c1-explorer.md +192 -0
- package/research/dogfood/strategy-c/c2-diver-memory.md +145 -0
- package/research/dogfood/strategy-c/c3-diver-control.md +148 -0
- package/research/dogfood/strategy-c/c4-diver-failure.md +151 -0
- package/research/dogfood/strategy-c/c5-diver-execution.md +221 -0
- package/research/dogfood/strategy-c/c6-diver-org.md +221 -0
- package/research/effect-cli-error-handling.md +845 -0
- package/research/effect-errors-as-values.md +943 -0
- package/research/errors-task-analysis/00-consolidated-tasks.md +207 -0
- package/research/errors-task-analysis/cli-commands-analysis.md +909 -0
- package/research/errors-task-analysis/embeddings-analysis.md +709 -0
- package/research/errors-task-analysis/index-search-analysis.md +812 -0
- package/research/frontmatter/COMMENTS-ARE-SKIPPED.md +149 -0
- package/research/frontmatter/LLM-CODE-NAVIGATION.md +276 -0
- package/research/issue-review.md +603 -0
- package/research/llm-summarization/agent-cli-tools-2026.md +1082 -0
- package/research/llm-summarization/alternative-providers-2026.md +1428 -0
- package/research/llm-summarization/anthropic-2026.md +367 -0
- package/research/llm-summarization/claude-cli-integration.md +1706 -0
- package/research/llm-summarization/cli-integration-patterns.md +3155 -0
- package/research/llm-summarization/openai-2026.md +473 -0
- package/research/llm-summarization/openai-compatible-providers-2026.md +1022 -0
- package/research/llm-summarization/opencode-cli-integration.md +1552 -0
- package/research/llm-summarization/prompt-engineering-2026.md +1426 -0
- package/research/llm-summarization/prototype-results.md +56 -0
- package/research/llm-summarization/provider-switching-patterns-2026.md +2153 -0
- package/research/llm-summarization/typescript-llm-libraries-2026.md +2436 -0
- package/research/mdcontext-error-analysis.md +521 -0
- package/research/mdcontext-pudding/00-EXECUTIVE-SUMMARY.md +282 -0
- package/research/mdcontext-pudding/01-index-embed.md +956 -0
- package/research/mdcontext-pudding/02-search-COMMANDS.md +142 -0
- package/research/mdcontext-pudding/02-search-SUMMARY.md +146 -0
- package/research/mdcontext-pudding/02-search.md +970 -0
- package/research/mdcontext-pudding/03-context.md +779 -0
- package/research/mdcontext-pudding/04-navigation-and-analytics.md +803 -0
- package/research/mdcontext-pudding/04-tree.md +704 -0
- package/research/mdcontext-pudding/05-config.md +1038 -0
- package/research/mdcontext-pudding/06-links-summary.txt +87 -0
- package/research/mdcontext-pudding/06-links.md +679 -0
- package/research/mdcontext-pudding/07-stats.md +693 -0
- package/research/mdcontext-pudding/BUG-FIX-PLAN.md +388 -0
- package/research/mdcontext-pudding/P0-BUG-VALIDATION.md +167 -0
- package/research/mdcontext-pudding/README.md +168 -0
- package/research/mdcontext-pudding/TESTING-SUMMARY.md +128 -0
- package/research/npm_publish/011-npm-workflow-research-agent2.md +792 -0
- package/research/npm_publish/012-npm-workflow-research-agent1.md +530 -0
- package/research/npm_publish/013-npm-workflow-research-agent3.md +722 -0
- package/research/npm_publish/014-npm-workflow-synthesis.md +556 -0
- package/research/npm_publish/031-npm-workflow-task-analysis.md +134 -0
- package/research/research-quality-review.md +834 -0
- package/research/semantic-search/002-research-embedding-models.md +490 -0
- package/research/semantic-search/003-research-rag-alternatives.md +523 -0
- package/research/semantic-search/004-research-vector-search.md +841 -0
- package/research/semantic-search/032-research-semantic-search.md +427 -0
- package/research/semantic-search/embedding-text-analysis.md +156 -0
- package/research/semantic-search/multi-word-failure-reproduction.md +171 -0
- package/research/semantic-search/query-processing-analysis.md +207 -0
- package/research/semantic-search/root-cause-and-solution.md +114 -0
- package/research/semantic-search/threshold-validation-report.md +69 -0
- package/research/semantic-search/vector-search-analysis.md +63 -0
- package/research/task-management-2026/00-synthesis-recommendations.md +295 -0
- package/research/task-management-2026/01-ai-workflow-tools.md +416 -0
- package/research/task-management-2026/02-agent-framework-patterns.md +476 -0
- package/research/task-management-2026/03-lightweight-file-based.md +567 -0
- package/research/task-management-2026/04-established-tools-ai-features.md +541 -0
- package/research/task-management-2026/linear/01-core-features-workflow.md +771 -0
- package/research/task-management-2026/linear/02-api-integrations.md +930 -0
- package/research/task-management-2026/linear/03-ai-features.md +368 -0
- package/research/task-management-2026/linear/04-pricing-setup.md +205 -0
- package/research/task-management-2026/linear/05-usage-patterns-best-practices.md +605 -0
- package/research/test-path-issues.md +276 -0
- package/review/ALP-76/1-error-type-design.md +962 -0
- package/review/ALP-76/2-error-handling-patterns.md +906 -0
- package/review/ALP-76/3-error-presentation.md +624 -0
- package/review/ALP-76/4-test-coverage.md +625 -0
- package/review/ALP-76/5-migration-completeness.md +440 -0
- package/review/ALP-76/6-effect-best-practices.md +755 -0
- package/scripts/apply-branch-protection.sh +47 -0
- package/scripts/branch-protection-templates.json +79 -0
- package/scripts/prototype-summarization.ts +346 -0
- package/scripts/rebuild-hnswlib.js +58 -0
- package/scripts/setup-branch-protection.sh +64 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/active-provider.json +7 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/bm25.json +541 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/bm25.meta.json +5 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/config.json +8 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.bin +0 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.meta.bin +0 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/indexes/documents.json +60 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/indexes/links.json +13 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/.mdcontext/indexes/sections.json +1197 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/configuration-management.md +99 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/distributed-systems.md +92 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/error-handling.md +78 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/failure-automation.md +55 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/job-context.md +69 -0
- package/src/__tests__/fixtures/semantic-search/multi-word-corpus/process-orchestration.md +99 -0
- package/src/cli/argv-preprocessor.test.ts +210 -0
- package/src/cli/argv-preprocessor.ts +202 -0
- package/src/cli/cli.test.ts +627 -0
- package/src/cli/commands/backlinks.ts +54 -0
- package/src/cli/commands/config-cmd.ts +642 -0
- package/src/cli/commands/context.ts +285 -0
- package/src/cli/commands/duplicates.ts +122 -0
- package/src/cli/commands/embeddings.ts +529 -0
- package/src/cli/commands/index-cmd.ts +480 -0
- package/src/cli/commands/index.ts +16 -0
- package/src/cli/commands/links.ts +52 -0
- package/src/cli/commands/search.ts +1281 -0
- package/src/cli/commands/stats.ts +149 -0
- package/src/cli/commands/tree.ts +128 -0
- package/src/cli/config-layer.ts +176 -0
- package/src/cli/error-handler.test.ts +235 -0
- package/src/cli/error-handler.ts +655 -0
- package/src/cli/flag-schemas.ts +341 -0
- package/src/cli/help.ts +588 -0
- package/src/cli/index.ts +9 -0
- package/src/cli/main.ts +435 -0
- package/src/cli/options.ts +41 -0
- package/src/cli/shared-error-handling.ts +199 -0
- package/src/cli/typo-suggester.test.ts +105 -0
- package/src/cli/typo-suggester.ts +130 -0
- package/src/cli/utils.ts +259 -0
- package/src/config/file-provider.test.ts +320 -0
- package/src/config/file-provider.ts +273 -0
- package/src/config/index.ts +72 -0
- package/src/config/integration.test.ts +667 -0
- package/src/config/precedence.test.ts +277 -0
- package/src/config/precedence.ts +451 -0
- package/src/config/schema.test.ts +414 -0
- package/src/config/schema.ts +603 -0
- package/src/config/service.test.ts +320 -0
- package/src/config/service.ts +243 -0
- package/src/config/testing.test.ts +264 -0
- package/src/config/testing.ts +110 -0
- package/src/core/index.ts +1 -0
- package/src/core/types.ts +113 -0
- package/src/duplicates/detector.test.ts +183 -0
- package/src/duplicates/detector.ts +414 -0
- package/src/duplicates/index.ts +18 -0
- package/src/embeddings/embedding-namespace.test.ts +300 -0
- package/src/embeddings/embedding-namespace.ts +947 -0
- package/src/embeddings/heading-boost.test.ts +222 -0
- package/src/embeddings/hnsw-build-options.test.ts +198 -0
- package/src/embeddings/hyde.test.ts +272 -0
- package/src/embeddings/hyde.ts +264 -0
- package/src/embeddings/index.ts +10 -0
- package/src/embeddings/openai-provider.ts +414 -0
- package/src/embeddings/pricing.json +22 -0
- package/src/embeddings/provider-constants.ts +204 -0
- package/src/embeddings/provider-errors.test.ts +967 -0
- package/src/embeddings/provider-errors.ts +565 -0
- package/src/embeddings/provider-factory.test.ts +240 -0
- package/src/embeddings/provider-factory.ts +225 -0
- package/src/embeddings/provider-integration.test.ts +788 -0
- package/src/embeddings/query-preprocessing.test.ts +187 -0
- package/src/embeddings/semantic-search-threshold.test.ts +508 -0
- package/src/embeddings/semantic-search.ts +1270 -0
- package/src/embeddings/types.ts +359 -0
- package/src/embeddings/vector-store.ts +708 -0
- package/src/embeddings/voyage-provider.ts +313 -0
- package/src/errors/errors.test.ts +845 -0
- package/src/errors/index.ts +533 -0
- package/src/index/ignore-patterns.test.ts +354 -0
- package/src/index/ignore-patterns.ts +305 -0
- package/src/index/index.ts +4 -0
- package/src/index/indexer.ts +684 -0
- package/src/index/storage.ts +260 -0
- package/src/index/types.ts +147 -0
- package/src/index/watcher.ts +189 -0
- package/src/index.ts +30 -0
- package/src/integration/search-keyword.test.ts +678 -0
- package/src/mcp/server.ts +612 -0
- package/src/parser/index.ts +1 -0
- package/src/parser/parser.test.ts +291 -0
- package/src/parser/parser.ts +394 -0
- package/src/parser/section-filter.test.ts +277 -0
- package/src/parser/section-filter.ts +392 -0
- package/src/search/__tests__/hybrid-search.test.ts +650 -0
- package/src/search/bm25-store.ts +366 -0
- package/src/search/cross-encoder.test.ts +253 -0
- package/src/search/cross-encoder.ts +406 -0
- package/src/search/fuzzy-search.test.ts +419 -0
- package/src/search/fuzzy-search.ts +273 -0
- package/src/search/hybrid-search.ts +448 -0
- package/src/search/path-matcher.test.ts +276 -0
- package/src/search/path-matcher.ts +33 -0
- package/src/search/query-parser.test.ts +260 -0
- package/src/search/query-parser.ts +319 -0
- package/src/search/searcher.test.ts +280 -0
- package/src/search/searcher.ts +724 -0
- package/src/search/wink-bm25.d.ts +30 -0
- package/src/summarization/cli-providers/claude.ts +202 -0
- package/src/summarization/cli-providers/detection.test.ts +273 -0
- package/src/summarization/cli-providers/detection.ts +118 -0
- package/src/summarization/cli-providers/index.ts +8 -0
- package/src/summarization/cost.test.ts +139 -0
- package/src/summarization/cost.ts +102 -0
- package/src/summarization/error-handler.test.ts +127 -0
- package/src/summarization/error-handler.ts +111 -0
- package/src/summarization/index.ts +102 -0
- package/src/summarization/pipeline.test.ts +498 -0
- package/src/summarization/pipeline.ts +231 -0
- package/src/summarization/prompts.test.ts +269 -0
- package/src/summarization/prompts.ts +133 -0
- package/src/summarization/provider-factory.test.ts +396 -0
- package/src/summarization/provider-factory.ts +178 -0
- package/src/summarization/types.ts +184 -0
- package/src/summarize/budget-bugs.test.ts +620 -0
- package/src/summarize/formatters.ts +419 -0
- package/src/summarize/index.ts +20 -0
- package/src/summarize/summarizer.test.ts +275 -0
- package/src/summarize/summarizer.ts +597 -0
- package/src/summarize/verify-bugs.test.ts +238 -0
- package/src/types/huggingface-transformers.d.ts +66 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/tokens.test.ts +142 -0
- package/src/utils/tokens.ts +186 -0
- package/tests/fixtures/cli/.mdcontext/active-provider.json +7 -0
- package/tests/fixtures/cli/.mdcontext/config.json +8 -0
- package/tests/fixtures/cli/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.bin +0 -0
- package/tests/fixtures/cli/.mdcontext/embeddings/openai_text-embedding-3-small_512/vectors.meta.bin +0 -0
- package/tests/fixtures/cli/.mdcontext/indexes/documents.json +33 -0
- package/tests/fixtures/cli/.mdcontext/indexes/links.json +12 -0
- package/tests/fixtures/cli/.mdcontext/indexes/sections.json +247 -0
- package/tests/fixtures/cli/README.md +9 -0
- package/tests/fixtures/cli/api-reference.md +11 -0
- package/tests/fixtures/cli/getting-started.md +11 -0
- package/tests/integration/embed-index.test.ts +712 -0
- package/tests/integration/search-context.test.ts +469 -0
- package/tests/integration/search-semantic.test.ts +522 -0
- package/tsconfig.json +26 -0
- package/vitest.config.ts +16 -0
- package/vitest.setup.ts +12 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
# npm Publishing Workflow Research: 2026 Best Practices
|
|
2
|
+
|
|
3
|
+
> Research conducted January 2026 | pnpm + GitHub Actions focus
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [GitHub Actions Workflow Patterns](#1-github-actions-workflow-patterns)
|
|
8
|
+
2. [pnpm-Specific Considerations](#2-pnpm-specific-considerations)
|
|
9
|
+
3. [Versioning Strategies](#3-versioning-strategies)
|
|
10
|
+
4. [Security: Provenance, SLSA, and 2FA](#4-security-provenance-slsa-and-2fa)
|
|
11
|
+
5. [Monorepo vs Single Package](#5-monorepo-vs-single-package)
|
|
12
|
+
6. [Should You Migrate to Bun in 2026?](#6-should-you-migrate-to-bun-in-2026)
|
|
13
|
+
7. [Recommendations](#7-recommendations)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. GitHub Actions Workflow Patterns
|
|
18
|
+
|
|
19
|
+
### Current Best Practice: OIDC Trusted Publishing
|
|
20
|
+
|
|
21
|
+
As of **July 31, 2025**, npm trusted publishing with OIDC is generally available. This is now the recommended approach over token-based authentication.
|
|
22
|
+
|
|
23
|
+
**Key Benefits:**
|
|
24
|
+
|
|
25
|
+
- No token management required
|
|
26
|
+
- Short-lived, cryptographically signed credentials
|
|
27
|
+
- Automatic provenance attestation
|
|
28
|
+
- Cannot be exfiltrated or reused
|
|
29
|
+
|
|
30
|
+
### Basic pnpm Publish Workflow (Single Package)
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
name: Publish to npm
|
|
34
|
+
|
|
35
|
+
on:
|
|
36
|
+
release:
|
|
37
|
+
types: [published]
|
|
38
|
+
|
|
39
|
+
permissions:
|
|
40
|
+
contents: read
|
|
41
|
+
id-token: write # Required for OIDC trusted publishing
|
|
42
|
+
|
|
43
|
+
jobs:
|
|
44
|
+
publish:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- name: Checkout
|
|
48
|
+
uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Install pnpm
|
|
51
|
+
uses: pnpm/action-setup@v4
|
|
52
|
+
with:
|
|
53
|
+
version: 10
|
|
54
|
+
|
|
55
|
+
- name: Setup Node.js
|
|
56
|
+
uses: actions/setup-node@v4
|
|
57
|
+
with:
|
|
58
|
+
node-version: "22"
|
|
59
|
+
cache: "pnpm"
|
|
60
|
+
registry-url: "https://registry.npmjs.org"
|
|
61
|
+
|
|
62
|
+
- name: Install dependencies
|
|
63
|
+
run: pnpm install --frozen-lockfile
|
|
64
|
+
|
|
65
|
+
- name: Build
|
|
66
|
+
run: pnpm build
|
|
67
|
+
|
|
68
|
+
- name: Publish
|
|
69
|
+
run: pnpm publish --access public --no-git-checks
|
|
70
|
+
# No NODE_AUTH_TOKEN needed with OIDC trusted publishing!
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Alternative: Token-Based Publishing (Granular Tokens)
|
|
74
|
+
|
|
75
|
+
If OIDC isn't configured, use granular access tokens:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
- name: Publish
|
|
79
|
+
run: pnpm publish --access public --no-git-checks
|
|
80
|
+
env:
|
|
81
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Important Notes:**
|
|
85
|
+
|
|
86
|
+
- Use `NODE_AUTH_TOKEN`, not `NPM_TOKEN` (the action requires this specific name)
|
|
87
|
+
- The `--no-git-checks` flag bypasses pnpm's detached HEAD check in GitHub Actions
|
|
88
|
+
- Granular tokens now have a **maximum 90-day expiration** (as of October 2025)
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 2. pnpm-Specific Considerations
|
|
93
|
+
|
|
94
|
+
### Lockfile Handling
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
# Always use frozen-lockfile in CI
|
|
98
|
+
- run: pnpm install --frozen-lockfile
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Rules:**
|
|
102
|
+
|
|
103
|
+
- Always commit `pnpm-lock.yaml`
|
|
104
|
+
- pnpm automatically adds `--frozen-lockfile` in CI (since v6.10)
|
|
105
|
+
- Never use `--no-frozen-lockfile` in production CI
|
|
106
|
+
|
|
107
|
+
### Caching Strategy
|
|
108
|
+
|
|
109
|
+
**Option A: Built-in pnpm Caching (Recommended)**
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
- uses: pnpm/action-setup@v4
|
|
113
|
+
with:
|
|
114
|
+
version: 10
|
|
115
|
+
|
|
116
|
+
- uses: actions/setup-node@v4
|
|
117
|
+
with:
|
|
118
|
+
node-version: "22"
|
|
119
|
+
cache: "pnpm" # Automatic caching based on lockfile hash
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Option B: Manual Store Caching (More Control)**
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
- name: Get pnpm store directory
|
|
126
|
+
shell: bash
|
|
127
|
+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
128
|
+
|
|
129
|
+
- name: Setup pnpm cache
|
|
130
|
+
uses: actions/cache@v4
|
|
131
|
+
with:
|
|
132
|
+
path: ${{ env.STORE_PATH }}
|
|
133
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
134
|
+
restore-keys: |
|
|
135
|
+
${{ runner.os }}-pnpm-store-
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Workspace Support
|
|
139
|
+
|
|
140
|
+
For monorepos with workspaces:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
- uses: actions/setup-node@v4
|
|
144
|
+
with:
|
|
145
|
+
node-version: "22"
|
|
146
|
+
cache: "pnpm"
|
|
147
|
+
cache-dependency-path: "**/pnpm-lock.yaml" # Handles monorepo structure
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 3. Versioning Strategies
|
|
153
|
+
|
|
154
|
+
### Comparison Matrix
|
|
155
|
+
|
|
156
|
+
| Aspect | Changesets | semantic-release | Manual |
|
|
157
|
+
| ------------------ | ---------------- | --------------------- | ------ |
|
|
158
|
+
| **Automation** | Semi-automatic | Fully automatic | None |
|
|
159
|
+
| **Monorepo** | First-class | Via plugin (outdated) | Manual |
|
|
160
|
+
| **Control** | High (PR review) | Low (commit-driven) | Total |
|
|
161
|
+
| **Learning Curve** | Medium | Low | None |
|
|
162
|
+
| **Changelog** | Collaborative | Auto-generated | Manual |
|
|
163
|
+
|
|
164
|
+
### Recommendation: Changesets for Most Projects
|
|
165
|
+
|
|
166
|
+
**Why Changesets wins in 2026:**
|
|
167
|
+
|
|
168
|
+
1. **Monorepo-first design** - Manages inter-package dependencies automatically
|
|
169
|
+
2. **PR-based workflow** - Review changelogs before release
|
|
170
|
+
3. **Batch releases** - Group changes into meaningful releases
|
|
171
|
+
4. **pnpm integration** - Official documentation and support
|
|
172
|
+
|
|
173
|
+
### Changesets Workflow Example
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
name: Release
|
|
177
|
+
|
|
178
|
+
on:
|
|
179
|
+
push:
|
|
180
|
+
branches: [main]
|
|
181
|
+
|
|
182
|
+
permissions:
|
|
183
|
+
contents: write
|
|
184
|
+
pull-requests: write
|
|
185
|
+
id-token: write
|
|
186
|
+
|
|
187
|
+
jobs:
|
|
188
|
+
release:
|
|
189
|
+
runs-on: ubuntu-latest
|
|
190
|
+
steps:
|
|
191
|
+
- uses: actions/checkout@v4
|
|
192
|
+
|
|
193
|
+
- uses: pnpm/action-setup@v4
|
|
194
|
+
with:
|
|
195
|
+
version: 10
|
|
196
|
+
|
|
197
|
+
- uses: actions/setup-node@v4
|
|
198
|
+
with:
|
|
199
|
+
node-version: "22"
|
|
200
|
+
cache: "pnpm"
|
|
201
|
+
registry-url: "https://registry.npmjs.org"
|
|
202
|
+
|
|
203
|
+
- run: pnpm install --frozen-lockfile
|
|
204
|
+
|
|
205
|
+
- name: Create Release Pull Request or Publish
|
|
206
|
+
uses: changesets/action@v1
|
|
207
|
+
with:
|
|
208
|
+
commit: "chore: release packages"
|
|
209
|
+
title: "chore: release packages"
|
|
210
|
+
publish: pnpm -r publish --access public --no-git-checks
|
|
211
|
+
env:
|
|
212
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
213
|
+
# Omit NPM_TOKEN if using OIDC trusted publishing
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### When to Use semantic-release
|
|
217
|
+
|
|
218
|
+
- Single-package repos with disciplined conventional commits
|
|
219
|
+
- Teams wanting zero manual intervention
|
|
220
|
+
- Projects where every merge should potentially release
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 4. Security: Provenance, SLSA, and 2FA
|
|
225
|
+
|
|
226
|
+
### npm Security Landscape (December 2025)
|
|
227
|
+
|
|
228
|
+
**Critical Changes:**
|
|
229
|
+
|
|
230
|
+
- **Classic tokens permanently revoked** (December 9, 2025)
|
|
231
|
+
- **Granular tokens**: 90-day max expiration, 7-day default for write-enabled
|
|
232
|
+
- **TOTP 2FA being phased out** - Use WebAuthn/passkeys instead
|
|
233
|
+
- **OIDC trusted publishing** is the recommended path forward
|
|
234
|
+
|
|
235
|
+
### npm Provenance (SLSA Build Level 2)
|
|
236
|
+
|
|
237
|
+
Provenance creates a verifiable link between your published package and its source code.
|
|
238
|
+
|
|
239
|
+
**With OIDC Trusted Publishing (Automatic):**
|
|
240
|
+
|
|
241
|
+
```yaml
|
|
242
|
+
permissions:
|
|
243
|
+
id-token: write # This enables automatic provenance
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**With Token-Based Publishing:**
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
- run: pnpm publish --provenance --access public --no-git-checks
|
|
250
|
+
env:
|
|
251
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Setting Up Trusted Publishing
|
|
255
|
+
|
|
256
|
+
1. Go to npmjs.com > Package Settings > Trusted Publishing
|
|
257
|
+
2. Configure your GitHub repository, workflow file, and environment
|
|
258
|
+
3. Ensure your workflow has `id-token: write` permission
|
|
259
|
+
4. Remove any `NODE_AUTH_TOKEN` from your workflow (OIDC only works without tokens)
|
|
260
|
+
|
|
261
|
+
### 2FA Requirements
|
|
262
|
+
|
|
263
|
+
All packages now require either:
|
|
264
|
+
|
|
265
|
+
- Two-factor authentication (2FA), OR
|
|
266
|
+
- Granular access token with "Bypass 2FA" enabled
|
|
267
|
+
|
|
268
|
+
For CI/CD, use granular tokens with:
|
|
269
|
+
|
|
270
|
+
- "Bypass 2FA" enabled
|
|
271
|
+
- Scoped to specific packages
|
|
272
|
+
- Rotation schedule (max 90 days)
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 5. Monorepo vs Single Package
|
|
277
|
+
|
|
278
|
+
### Single Package Pattern
|
|
279
|
+
|
|
280
|
+
```yaml
|
|
281
|
+
# Simple, direct workflow
|
|
282
|
+
name: Publish
|
|
283
|
+
|
|
284
|
+
on:
|
|
285
|
+
release:
|
|
286
|
+
types: [published]
|
|
287
|
+
|
|
288
|
+
jobs:
|
|
289
|
+
publish:
|
|
290
|
+
runs-on: ubuntu-latest
|
|
291
|
+
permissions:
|
|
292
|
+
contents: read
|
|
293
|
+
id-token: write
|
|
294
|
+
steps:
|
|
295
|
+
- uses: actions/checkout@v4
|
|
296
|
+
- uses: pnpm/action-setup@v4
|
|
297
|
+
with:
|
|
298
|
+
version: 10
|
|
299
|
+
- uses: actions/setup-node@v4
|
|
300
|
+
with:
|
|
301
|
+
node-version: "22"
|
|
302
|
+
cache: "pnpm"
|
|
303
|
+
registry-url: "https://registry.npmjs.org"
|
|
304
|
+
- run: pnpm install --frozen-lockfile
|
|
305
|
+
- run: pnpm build
|
|
306
|
+
- run: pnpm publish --access public --no-git-checks
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Monorepo Pattern (with Changesets)
|
|
310
|
+
|
|
311
|
+
```yaml
|
|
312
|
+
name: Release
|
|
313
|
+
|
|
314
|
+
on:
|
|
315
|
+
push:
|
|
316
|
+
branches: [main]
|
|
317
|
+
|
|
318
|
+
jobs:
|
|
319
|
+
release:
|
|
320
|
+
runs-on: ubuntu-latest
|
|
321
|
+
permissions:
|
|
322
|
+
contents: write
|
|
323
|
+
pull-requests: write
|
|
324
|
+
id-token: write
|
|
325
|
+
steps:
|
|
326
|
+
- uses: actions/checkout@v4
|
|
327
|
+
with:
|
|
328
|
+
fetch-depth: 0 # Required for changesets
|
|
329
|
+
|
|
330
|
+
- uses: pnpm/action-setup@v4
|
|
331
|
+
with:
|
|
332
|
+
version: 10
|
|
333
|
+
|
|
334
|
+
- uses: actions/setup-node@v4
|
|
335
|
+
with:
|
|
336
|
+
node-version: "22"
|
|
337
|
+
cache: "pnpm"
|
|
338
|
+
registry-url: "https://registry.npmjs.org"
|
|
339
|
+
|
|
340
|
+
- run: pnpm install --frozen-lockfile
|
|
341
|
+
|
|
342
|
+
- name: Build all packages
|
|
343
|
+
run: pnpm -r build
|
|
344
|
+
|
|
345
|
+
- uses: changesets/action@v1
|
|
346
|
+
with:
|
|
347
|
+
publish: pnpm -r publish --access public --no-git-checks
|
|
348
|
+
env:
|
|
349
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Key Differences
|
|
353
|
+
|
|
354
|
+
| Aspect | Single Package | Monorepo |
|
|
355
|
+
| -------------- | ------------------- | --------------------------- |
|
|
356
|
+
| **Versioning** | Direct release tags | Changesets PR workflow |
|
|
357
|
+
| **Build** | `pnpm build` | `pnpm -r build` (recursive) |
|
|
358
|
+
| **Publish** | `pnpm publish` | `pnpm -r publish` |
|
|
359
|
+
| **Complexity** | Low | Medium-High |
|
|
360
|
+
| **Changelog** | Manual or automated | Changesets-managed |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## 6. Should You Migrate to Bun in 2026?
|
|
365
|
+
|
|
366
|
+
### Current State of Bun (January 2026)
|
|
367
|
+
|
|
368
|
+
**The good:**
|
|
369
|
+
|
|
370
|
+
- **4-7x faster** than pnpm for package installs (real-world, not marketing claims)
|
|
371
|
+
- **Anthropic acquisition** (December 2025) ensures long-term viability
|
|
372
|
+
- **All-in-one toolchain**: runtime, bundler, test runner, package manager
|
|
373
|
+
- Production-grade stability for most use cases
|
|
374
|
+
|
|
375
|
+
**The concerning:**
|
|
376
|
+
|
|
377
|
+
- **No `--provenance` flag** - Cannot generate SLSA attestations natively
|
|
378
|
+
- **34% compatibility issues** with native dependencies
|
|
379
|
+
- **Workspace publishing bugs** - References may not resolve correctly
|
|
380
|
+
- **Less CI/CD ecosystem support** than pnpm
|
|
381
|
+
|
|
382
|
+
### Bun npm Publishing: Current Limitations
|
|
383
|
+
|
|
384
|
+
| Feature | npm/pnpm | Bun |
|
|
385
|
+
| --------------------------- | -------- | ------------------------ |
|
|
386
|
+
| OIDC Trusted Publishing | Yes | Partial (via `bunx npm`) |
|
|
387
|
+
| `--provenance` flag | Yes | No (open issue #15601) |
|
|
388
|
+
| Workspace publishing | Mature | Buggy |
|
|
389
|
+
| CI/CD templates | Abundant | Limited |
|
|
390
|
+
| Deprecated package handling | Correct | Buggy |
|
|
391
|
+
|
|
392
|
+
### Performance Comparison (CI/CD)
|
|
393
|
+
|
|
394
|
+
| Metric | pnpm | Bun |
|
|
395
|
+
| -------------- | ------ | ------ |
|
|
396
|
+
| Clean install | 14s | 3s |
|
|
397
|
+
| Cached install | 3s | 1s |
|
|
398
|
+
| Total job time | 2m 08s | 1m 52s |
|
|
399
|
+
|
|
400
|
+
_Note: Build time dominates, making install speed less impactful overall_
|
|
401
|
+
|
|
402
|
+
### Workaround for Bun Publishing
|
|
403
|
+
|
|
404
|
+
If you want Bun's speed but need provenance:
|
|
405
|
+
|
|
406
|
+
```yaml
|
|
407
|
+
- name: Install with Bun
|
|
408
|
+
run: bun install
|
|
409
|
+
|
|
410
|
+
- name: Build with Bun
|
|
411
|
+
run: bun run build
|
|
412
|
+
|
|
413
|
+
- name: Publish with npm (for provenance)
|
|
414
|
+
run: bunx npm publish --provenance --access public
|
|
415
|
+
env:
|
|
416
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Verdict: Should You Migrate?
|
|
420
|
+
|
|
421
|
+
| Project Type | Recommendation |
|
|
422
|
+
| ----------------------------- | ------------------------------------------------------- |
|
|
423
|
+
| **New greenfield project** | Consider Bun, but use `bunx npm publish` for provenance |
|
|
424
|
+
| **Existing pnpm project** | Stay with pnpm - migration effort not justified |
|
|
425
|
+
| **Enterprise monorepo** | Stay with pnpm - stability and features matter more |
|
|
426
|
+
| **Security-critical package** | Stay with pnpm/npm - provenance is non-negotiable |
|
|
427
|
+
| **Internal tools/prototypes** | Bun is a good fit |
|
|
428
|
+
|
|
429
|
+
**TL;DR:** Bun is production-viable in 2026 but **not yet ready to replace pnpm for npm publishing workflows** due to missing provenance support and workspace publishing issues.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## 7. Recommendations
|
|
434
|
+
|
|
435
|
+
### For New Single-Package Projects
|
|
436
|
+
|
|
437
|
+
1. **Use pnpm** for package management
|
|
438
|
+
2. **Use OIDC trusted publishing** (no tokens)
|
|
439
|
+
3. **Enable provenance** automatically via `id-token: write`
|
|
440
|
+
4. **Trigger on releases** for controlled publishing
|
|
441
|
+
|
|
442
|
+
```yaml
|
|
443
|
+
name: Publish
|
|
444
|
+
|
|
445
|
+
on:
|
|
446
|
+
release:
|
|
447
|
+
types: [published]
|
|
448
|
+
|
|
449
|
+
permissions:
|
|
450
|
+
contents: read
|
|
451
|
+
id-token: write
|
|
452
|
+
|
|
453
|
+
jobs:
|
|
454
|
+
publish:
|
|
455
|
+
runs-on: ubuntu-latest
|
|
456
|
+
steps:
|
|
457
|
+
- uses: actions/checkout@v4
|
|
458
|
+
- uses: pnpm/action-setup@v4
|
|
459
|
+
with:
|
|
460
|
+
version: 10
|
|
461
|
+
- uses: actions/setup-node@v4
|
|
462
|
+
with:
|
|
463
|
+
node-version: "22"
|
|
464
|
+
cache: "pnpm"
|
|
465
|
+
registry-url: "https://registry.npmjs.org"
|
|
466
|
+
- run: pnpm install --frozen-lockfile
|
|
467
|
+
- run: pnpm build
|
|
468
|
+
- run: pnpm publish --access public --no-git-checks
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### For Monorepos
|
|
472
|
+
|
|
473
|
+
1. **Use pnpm workspaces** with `workspace:*` protocol
|
|
474
|
+
2. **Use Changesets** for versioning and changelog
|
|
475
|
+
3. **Configure OIDC** for all publishable packages
|
|
476
|
+
4. **Set up the Changesets GitHub Action**
|
|
477
|
+
|
|
478
|
+
### Security Checklist
|
|
479
|
+
|
|
480
|
+
- [ ] Configure OIDC trusted publishing for each package
|
|
481
|
+
- [ ] Remove all classic tokens (they're revoked anyway)
|
|
482
|
+
- [ ] Set up WebAuthn/passkey 2FA (not TOTP)
|
|
483
|
+
- [ ] Verify provenance appears on npmjs.com after publishing
|
|
484
|
+
- [ ] Run `npm audit signatures` to verify attestations
|
|
485
|
+
|
|
486
|
+
### When to Consider Bun
|
|
487
|
+
|
|
488
|
+
- Local development speed is a priority
|
|
489
|
+
- You don't need SLSA provenance attestations
|
|
490
|
+
- You're building internal tools or prototypes
|
|
491
|
+
- You're starting a greenfield project and can accept some risk
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## Sources
|
|
496
|
+
|
|
497
|
+
### GitHub Actions & npm Publishing
|
|
498
|
+
|
|
499
|
+
- [Automatically publish your Node package to NPM (with PNPM and GitHub actions)](https://dev.to/receter/automatically-publish-your-node-package-to-npm-with-pnpm-and-github-actions-22eg)
|
|
500
|
+
- [pnpm Continuous Integration Guide](https://pnpm.io/continuous-integration)
|
|
501
|
+
- [Using Changesets with pnpm](https://pnpm.io/next/using-changesets)
|
|
502
|
+
- [GitHub Actions Setup Node Documentation](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md)
|
|
503
|
+
|
|
504
|
+
### npm Security & Trusted Publishing
|
|
505
|
+
|
|
506
|
+
- [npm Trusted Publishing with OIDC GA Announcement](https://github.blog/changelog/2025-07-31-npm-trusted-publishing-with-oidc-is-generally-available/)
|
|
507
|
+
- [npm Classic Tokens Revoked](https://github.blog/changelog/2025-12-09-npm-classic-tokens-revoked-session-based-auth-and-cli-token-management-now-available/)
|
|
508
|
+
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/trusted-publishers/)
|
|
509
|
+
- [Generating Provenance Statements](https://docs.npmjs.com/generating-provenance-statements/)
|
|
510
|
+
- [Introducing npm Package Provenance](https://github.blog/security/supply-chain-security/introducing-npm-package-provenance/)
|
|
511
|
+
|
|
512
|
+
### Versioning Strategies
|
|
513
|
+
|
|
514
|
+
- [Changesets vs Semantic Release](https://brianschiller.com/blog/2023/09/18/changesets-vs-semantic-release/)
|
|
515
|
+
- [The Ultimate Guide to NPM Release Automation](https://oleksiipopov.com/blog/npm-release-automation/)
|
|
516
|
+
- [Complete Monorepo Guide: pnpm + Workspace + Changesets (2025)](https://jsdev.space/complete-monorepo-guide/)
|
|
517
|
+
|
|
518
|
+
### Bun Assessment
|
|
519
|
+
|
|
520
|
+
- [Is Bun Production-Ready in 2026?](https://dev.to/last9/is-bun-production-ready-in-2026-a-practical-assessment-181h)
|
|
521
|
+
- [pnpm vs npm vs yarn vs Bun: The 2026 Package Manager Showdown](https://dev.to/pockit_tools/pnpm-vs-npm-vs-yarn-vs-bun-the-2026-package-manager-showdown-51dc)
|
|
522
|
+
- [bun publish Documentation](https://bun.com/docs/pm/cli/publish)
|
|
523
|
+
- [Bun --provenance Feature Request (Issue #15601)](https://github.com/oven-sh/bun/issues/15601)
|
|
524
|
+
- [Bun Workspace Publishing Issues (Issue #15246)](https://github.com/oven-sh/bun/issues/15246)
|
|
525
|
+
|
|
526
|
+
### Package Manager Comparisons
|
|
527
|
+
|
|
528
|
+
- [PNPM vs. Bun Install vs. Yarn Berry](https://betterstack.com/community/guides/scaling-nodejs/pnpm-vs-bun-install-vs-yarn/)
|
|
529
|
+
- [Choosing the Right JavaScript Package Manager in 2025](https://dev.to/kirteshbansal/choosing-the-right-javascript-package-manager-in-2025-npm-vs-yarn-vs-pnpm-vs-bun-2jie)
|
|
530
|
+
- [npm vs pnpm vs Yarn vs Bun Comparison](https://vibepanda.io/resources/guide/javascript-package-managers)
|