mdcontext 0.0.1 → 0.1.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 (140) hide show
  1. package/.changeset/README.md +28 -0
  2. package/.changeset/config.json +11 -0
  3. package/.github/workflows/ci.yml +83 -0
  4. package/.github/workflows/release.yml +113 -0
  5. package/.tldrignore +112 -0
  6. package/AGENTS.md +46 -0
  7. package/BACKLOG.md +338 -0
  8. package/README.md +231 -11
  9. package/biome.json +36 -0
  10. package/cspell.config.yaml +14 -0
  11. package/dist/chunk-KRYIFLQR.js +92 -0
  12. package/dist/chunk-S7E6TFX6.js +742 -0
  13. package/dist/chunk-VVTGZNBT.js +1519 -0
  14. package/dist/cli/main.d.ts +1 -0
  15. package/dist/cli/main.js +2015 -0
  16. package/dist/index.d.ts +266 -0
  17. package/dist/index.js +86 -0
  18. package/dist/mcp/server.d.ts +1 -0
  19. package/dist/mcp/server.js +376 -0
  20. package/docs/019-USAGE.md +586 -0
  21. package/docs/020-current-implementation.md +364 -0
  22. package/docs/021-DOGFOODING-FINDINGS.md +175 -0
  23. package/docs/BACKLOG.md +80 -0
  24. package/docs/DESIGN.md +439 -0
  25. package/docs/PROJECT.md +88 -0
  26. package/docs/ROADMAP.md +407 -0
  27. package/docs/test-links.md +9 -0
  28. package/package.json +69 -10
  29. package/pnpm-workspace.yaml +5 -0
  30. package/research/config-analysis/01-current-implementation.md +470 -0
  31. package/research/config-analysis/02-strategy-recommendation.md +428 -0
  32. package/research/config-analysis/03-task-candidates.md +715 -0
  33. package/research/config-analysis/033-research-configuration-management.md +828 -0
  34. package/research/config-analysis/034-research-effect-cli-config.md +1504 -0
  35. package/research/config-analysis/04-consolidated-task-candidates.md +277 -0
  36. package/research/dogfood/consolidated-tool-evaluation.md +373 -0
  37. package/research/dogfood/strategy-a/a-synthesis.md +184 -0
  38. package/research/dogfood/strategy-a/a1-docs.md +226 -0
  39. package/research/dogfood/strategy-a/a2-amorphic.md +156 -0
  40. package/research/dogfood/strategy-a/a3-llm.md +164 -0
  41. package/research/dogfood/strategy-b/b-synthesis.md +228 -0
  42. package/research/dogfood/strategy-b/b1-architecture.md +207 -0
  43. package/research/dogfood/strategy-b/b2-gaps.md +258 -0
  44. package/research/dogfood/strategy-b/b3-workflows.md +250 -0
  45. package/research/dogfood/strategy-c/c-synthesis.md +451 -0
  46. package/research/dogfood/strategy-c/c1-explorer.md +192 -0
  47. package/research/dogfood/strategy-c/c2-diver-memory.md +145 -0
  48. package/research/dogfood/strategy-c/c3-diver-control.md +148 -0
  49. package/research/dogfood/strategy-c/c4-diver-failure.md +151 -0
  50. package/research/dogfood/strategy-c/c5-diver-execution.md +221 -0
  51. package/research/dogfood/strategy-c/c6-diver-org.md +221 -0
  52. package/research/effect-cli-error-handling.md +845 -0
  53. package/research/effect-errors-as-values.md +943 -0
  54. package/research/errors-task-analysis/00-consolidated-tasks.md +207 -0
  55. package/research/errors-task-analysis/cli-commands-analysis.md +909 -0
  56. package/research/errors-task-analysis/embeddings-analysis.md +709 -0
  57. package/research/errors-task-analysis/index-search-analysis.md +812 -0
  58. package/research/mdcontext-error-analysis.md +521 -0
  59. package/research/npm_publish/011-npm-workflow-research-agent2.md +792 -0
  60. package/research/npm_publish/012-npm-workflow-research-agent1.md +530 -0
  61. package/research/npm_publish/013-npm-workflow-research-agent3.md +722 -0
  62. package/research/npm_publish/014-npm-workflow-synthesis.md +556 -0
  63. package/research/npm_publish/031-npm-workflow-task-analysis.md +134 -0
  64. package/research/semantic-search/002-research-embedding-models.md +490 -0
  65. package/research/semantic-search/003-research-rag-alternatives.md +523 -0
  66. package/research/semantic-search/004-research-vector-search.md +841 -0
  67. package/research/semantic-search/032-research-semantic-search.md +427 -0
  68. package/research/task-management-2026/00-synthesis-recommendations.md +295 -0
  69. package/research/task-management-2026/01-ai-workflow-tools.md +416 -0
  70. package/research/task-management-2026/02-agent-framework-patterns.md +476 -0
  71. package/research/task-management-2026/03-lightweight-file-based.md +567 -0
  72. package/research/task-management-2026/04-established-tools-ai-features.md +541 -0
  73. package/research/task-management-2026/linear/01-core-features-workflow.md +771 -0
  74. package/research/task-management-2026/linear/02-api-integrations.md +930 -0
  75. package/research/task-management-2026/linear/03-ai-features.md +368 -0
  76. package/research/task-management-2026/linear/04-pricing-setup.md +205 -0
  77. package/research/task-management-2026/linear/05-usage-patterns-best-practices.md +605 -0
  78. package/scripts/rebuild-hnswlib.js +63 -0
  79. package/src/cli/argv-preprocessor.test.ts +210 -0
  80. package/src/cli/argv-preprocessor.ts +202 -0
  81. package/src/cli/cli.test.ts +430 -0
  82. package/src/cli/commands/backlinks.ts +54 -0
  83. package/src/cli/commands/context.ts +197 -0
  84. package/src/cli/commands/index-cmd.ts +300 -0
  85. package/src/cli/commands/index.ts +13 -0
  86. package/src/cli/commands/links.ts +52 -0
  87. package/src/cli/commands/search.ts +451 -0
  88. package/src/cli/commands/stats.ts +146 -0
  89. package/src/cli/commands/tree.ts +107 -0
  90. package/src/cli/flag-schemas.ts +275 -0
  91. package/src/cli/help.ts +386 -0
  92. package/src/cli/index.ts +9 -0
  93. package/src/cli/main.ts +145 -0
  94. package/src/cli/options.ts +31 -0
  95. package/src/cli/typo-suggester.test.ts +105 -0
  96. package/src/cli/typo-suggester.ts +130 -0
  97. package/src/cli/utils.ts +126 -0
  98. package/src/core/index.ts +1 -0
  99. package/src/core/types.ts +140 -0
  100. package/src/embeddings/index.ts +8 -0
  101. package/src/embeddings/openai-provider.ts +165 -0
  102. package/src/embeddings/semantic-search.ts +583 -0
  103. package/src/embeddings/types.ts +82 -0
  104. package/src/embeddings/vector-store.ts +299 -0
  105. package/src/index/index.ts +4 -0
  106. package/src/index/indexer.ts +446 -0
  107. package/src/index/storage.ts +196 -0
  108. package/src/index/types.ts +109 -0
  109. package/src/index/watcher.ts +131 -0
  110. package/src/index.ts +8 -0
  111. package/src/mcp/server.ts +483 -0
  112. package/src/parser/index.ts +1 -0
  113. package/src/parser/parser.test.ts +291 -0
  114. package/src/parser/parser.ts +395 -0
  115. package/src/parser/section-filter.ts +270 -0
  116. package/src/search/query-parser.test.ts +260 -0
  117. package/src/search/query-parser.ts +319 -0
  118. package/src/search/searcher.test.ts +182 -0
  119. package/src/search/searcher.ts +602 -0
  120. package/src/summarize/budget-bugs.test.ts +620 -0
  121. package/src/summarize/formatters.ts +419 -0
  122. package/src/summarize/index.ts +20 -0
  123. package/src/summarize/summarizer.test.ts +275 -0
  124. package/src/summarize/summarizer.ts +528 -0
  125. package/src/summarize/verify-bugs.test.ts +238 -0
  126. package/src/utils/index.ts +1 -0
  127. package/src/utils/tokens.test.ts +142 -0
  128. package/src/utils/tokens.ts +186 -0
  129. package/tests/fixtures/cli/.mdcontext/config.json +8 -0
  130. package/tests/fixtures/cli/.mdcontext/indexes/documents.json +33 -0
  131. package/tests/fixtures/cli/.mdcontext/indexes/links.json +12 -0
  132. package/tests/fixtures/cli/.mdcontext/indexes/sections.json +233 -0
  133. package/tests/fixtures/cli/.mdcontext/vectors.bin +0 -0
  134. package/tests/fixtures/cli/.mdcontext/vectors.meta.json +1264 -0
  135. package/tests/fixtures/cli/README.md +9 -0
  136. package/tests/fixtures/cli/api-reference.md +11 -0
  137. package/tests/fixtures/cli/getting-started.md +11 -0
  138. package/tsconfig.json +26 -0
  139. package/vitest.config.ts +21 -0
  140. package/vitest.setup.ts +12 -0
@@ -0,0 +1,28 @@
1
+ # Changesets
2
+
3
+ This project uses [Changesets](https://github.com/changesets/changesets) for versioning and releases.
4
+
5
+ ## Creating a changeset
6
+
7
+ When you make a change that should be released:
8
+
9
+ ```bash
10
+ pnpm changeset
11
+ ```
12
+
13
+ Follow the prompts to:
14
+ 1. Select the package(s) to bump
15
+ 2. Choose the bump type (patch/minor/major)
16
+ 3. Write a summary of the change
17
+
18
+ ## Release process
19
+
20
+ 1. Push your changeset file with your PR
21
+ 2. Once merged to main, a "Version Packages" PR is automatically created
22
+ 3. When that PR is merged, packages are automatically published to npm
23
+
24
+ ## Commit conventions
25
+
26
+ - `patch`: Bug fixes, documentation updates
27
+ - `minor`: New features (backwards compatible)
28
+ - `major`: Breaking changes
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3
+ "changelog": ["@changesets/changelog-github", { "repo": "alphab/mdcontext" }],
4
+ "commit": false,
5
+ "fixed": [],
6
+ "linked": [],
7
+ "access": "public",
8
+ "baseBranch": "main",
9
+ "updateInternalDependencies": "patch",
10
+ "ignore": []
11
+ }
@@ -0,0 +1,83 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+ inputs:
8
+ include_embed_tests:
9
+ description: 'Run full test suite including embedding/semantic search tests'
10
+ required: false
11
+ default: false
12
+ type: boolean
13
+
14
+ jobs:
15
+ quality:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - uses: pnpm/action-setup@v4
21
+ with:
22
+ version: 10
23
+
24
+ - uses: actions/setup-node@v4
25
+ with:
26
+ node-version: '22'
27
+ cache: 'pnpm'
28
+
29
+ - uses: actions/setup-python@v5
30
+ with:
31
+ python-version: '3.12'
32
+
33
+ - run: pnpm install --frozen-lockfile
34
+ - run: pnpm build
35
+ - run: pnpm typecheck
36
+ - run: pnpm lint
37
+
38
+ - name: Validate package exports
39
+ run: npx publint
40
+
41
+ - name: Validate TypeScript types
42
+ run: npx attw --pack .
43
+
44
+ test:
45
+ strategy:
46
+ fail-fast: false
47
+ matrix:
48
+ os: [ubuntu-latest, macos-latest, windows-latest]
49
+ node: [20, 22]
50
+
51
+ runs-on: ${{ matrix.os }}
52
+ steps:
53
+ - uses: actions/checkout@v4
54
+
55
+ - uses: pnpm/action-setup@v4
56
+ with:
57
+ version: 10
58
+
59
+ - uses: actions/setup-node@v4
60
+ with:
61
+ node-version: ${{ matrix.node }}
62
+ cache: 'pnpm'
63
+
64
+ - uses: actions/setup-python@v5
65
+ with:
66
+ python-version: '3.12'
67
+
68
+ - run: pnpm install --frozen-lockfile
69
+ - run: pnpm build
70
+
71
+ - name: Run tests (default - no embeddings)
72
+ if: ${{ !inputs.include_embed_tests }}
73
+ run: pnpm test
74
+
75
+ - name: Run full tests (with embeddings)
76
+ if: ${{ inputs.include_embed_tests }}
77
+ env:
78
+ INCLUDE_EMBED_TESTS: true
79
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
80
+ run: pnpm test
81
+
82
+ - name: Test CLI execution
83
+ run: node dist/cli/main.js --help
@@ -0,0 +1,113 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ permissions:
8
+ contents: write
9
+ pull-requests: write
10
+ id-token: write # Required for OIDC trusted publishing
11
+
12
+ jobs:
13
+ quality:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - uses: pnpm/action-setup@v4
19
+ with:
20
+ version: 10
21
+
22
+ - uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '22'
25
+ cache: 'pnpm'
26
+
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: '3.12'
30
+
31
+ - run: pnpm install --frozen-lockfile
32
+ - run: pnpm build
33
+ - run: pnpm typecheck
34
+ - run: pnpm lint
35
+
36
+ - name: Validate package exports
37
+ run: npx publint
38
+
39
+ - name: Validate TypeScript types
40
+ run: npx attw --pack .
41
+
42
+ test:
43
+ strategy:
44
+ fail-fast: false
45
+ matrix:
46
+ os: [ubuntu-latest, macos-latest, windows-latest]
47
+ node: [20, 22]
48
+
49
+ runs-on: ${{ matrix.os }}
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+
53
+ - uses: pnpm/action-setup@v4
54
+ with:
55
+ version: 10
56
+
57
+ - uses: actions/setup-node@v4
58
+ with:
59
+ node-version: ${{ matrix.node }}
60
+ cache: 'pnpm'
61
+
62
+ - uses: actions/setup-python@v5
63
+ with:
64
+ python-version: '3.12'
65
+
66
+ - run: pnpm install --frozen-lockfile
67
+ - run: pnpm build
68
+ - run: pnpm test
69
+
70
+ - name: Test CLI execution
71
+ run: node dist/cli/main.js --help
72
+
73
+ release:
74
+ needs: [quality, test]
75
+ runs-on: ubuntu-latest
76
+ permissions:
77
+ contents: write
78
+ pull-requests: write
79
+ id-token: write
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+ with:
83
+ fetch-depth: 0 # Required for changesets
84
+
85
+ - uses: pnpm/action-setup@v4
86
+ with:
87
+ version: 10
88
+
89
+ - uses: actions/setup-node@v4
90
+ with:
91
+ node-version: '22'
92
+ cache: 'pnpm'
93
+ registry-url: 'https://registry.npmjs.org'
94
+
95
+ - name: Upgrade npm for OIDC support
96
+ run: npm install -g npm@latest
97
+
98
+ - uses: actions/setup-python@v5
99
+ with:
100
+ python-version: '3.12'
101
+
102
+ - run: pnpm install --frozen-lockfile
103
+ - run: pnpm build
104
+
105
+ - name: Create Release Pull Request or Publish
106
+ uses: changesets/action@v1
107
+ with:
108
+ commit: "chore: release packages"
109
+ title: "chore: release packages"
110
+ publish: pnpm changeset publish
111
+ env:
112
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113
+ NPM_CONFIG_PROVENANCE: true
package/.tldrignore ADDED
@@ -0,0 +1,112 @@
1
+ # TLDR ignore patterns (gitignore syntax)
2
+
3
+ # Auto-generated - review and customize for your project
4
+
5
+ # Docs: <https://git-scm.com/docs/gitignore>
6
+
7
+ # ===================
8
+
9
+ # Dependencies
10
+
11
+ # ===================
12
+
13
+ node_modules/
14
+ .venv/
15
+ venv/
16
+ env/
17
+ **pycache**/
18
+ .tox/
19
+ .nox/
20
+ .pytest_cache/
21
+ .mypy_cache/
22
+ .ruff_cache/
23
+ vendor/
24
+ Pods/
25
+
26
+ # ===================
27
+
28
+ # Build outputs
29
+
30
+ # ===================
31
+
32
+ dist/
33
+ build/
34
+ out/
35
+ target/
36
+ _.egg-info/
37
+ _.whl
38
+ _.pyc
39
+ _.pyo
40
+
41
+ # ===================
42
+
43
+ # Binary/large files
44
+
45
+ # ===================
46
+
47
+ _.so
48
+ _.dylib
49
+ _.dll
50
+ _.exe
51
+ _.bin
52
+ _.o
53
+ _.a
54
+ _.lib
55
+
56
+ # ===================
57
+
58
+ # IDE/editors
59
+
60
+ # ===================
61
+
62
+ .idea/
63
+ .vscode/
64
+ _.swp
65
+ _.swo
66
+ \*~
67
+
68
+ # ===================
69
+
70
+ # Security (always exclude)
71
+
72
+ # ===================
73
+
74
+ .env
75
+ .env.\*
76
+ _.pem
77
+ _.key
78
+ _.p12
79
+ _.pfx
80
+ credentials._
81
+ secrets._
82
+
83
+ # ===================
84
+
85
+ # Version control
86
+
87
+ # ===================
88
+
89
+ .git/
90
+ .hg/
91
+ .svn/
92
+
93
+ # ===================
94
+
95
+ # OS files
96
+
97
+ # ===================
98
+
99
+ .DS_Store
100
+ Thumbs.db
101
+
102
+ # ===================
103
+
104
+ # Project-specific
105
+
106
+ # Add your custom patterns below
107
+
108
+ # ===================
109
+
110
+ # large_test_fixtures/
111
+
112
+ # data/
package/AGENTS.md ADDED
@@ -0,0 +1,46 @@
1
+ # HumanWork - Partnership Guidelines
2
+
3
+ ## Hello, my friend. I'm Stuart, your AI partner in building this product together. Let's create something amazing
4
+
5
+ ## You Are a Co-Builder
6
+
7
+ This is not a task queue. You are building this product with me. That means:
8
+
9
+ - **Own the vision.** Understand where we're going and why. Push back when something doesn't fit.
10
+ - **Anticipate.** Don't wait to be told. If you see a problem coming, flag it. If you see an opportunity, propose it.
11
+ - **Think in WOW.** Every feature should make someone say "that's clever" or "I love that." Functional is the floor, not the ceiling.
12
+ - **Challenge me.** If my idea is mediocre, say so. Offer something better. I want your best thinking, not compliance.
13
+
14
+ ## How We Work
15
+
16
+ **Brainstorm freely.** When exploring ideas, throw out multiple options. Think out loud. Connect dots I might miss.
17
+
18
+ **Be decisive.** When it's time to build, commit fully. No hedging, no "we could maybe..." — make a call and execute.
19
+
20
+ **Move fast, stay sharp.** Speed matters, but not at the cost of quality. If something feels hacky, say so and fix it right.
21
+
22
+ **Show, don't ask.** If you can try something quickly, do it. Show me the result. Don't ask permission for exploration.
23
+
24
+ **consequences, consequences, consequences** Always think about the consequences of our actions. What are down and up stream of the changes you are making. Code bases are complex. Even a one line change could break something else. Always look at the bigger picture. Think in terms of consequences.
25
+
26
+ ## What I Expect
27
+
28
+ - **Proactive ideas.** "Have you considered..." or "What if we..." — bring fresh thinking.
29
+ - **Pattern recognition.** You've seen a lot of code. Spot when we're reinventing a wheel or missing an elegant solution.
30
+ - **Quality instincts.** Care about the details. Names matter. Structure matters. UX matters.
31
+ - **Energy.** This should be fun. Bring enthusiasm. We're building something cool.
32
+
33
+ ## What I Don't Want
34
+
35
+ - Asking obvious clarifying questions when you could just try it
36
+ - Doing the minimum to satisfy a request
37
+ - Waiting for instructions when you know what needs to happen
38
+ - Treating every decision as equal weight — some things just need doing
39
+
40
+ ## The Product
41
+
42
+ A tool to help our main product HumanWork = Human intent + Agent agency, unified.
43
+
44
+ We're building orchestration infrastructure where humans and AI agents collaborate on complex tasks. The human grounds direction, the agent executes with capability. Eventually, even the "human" role becomes an interface an agent can fill.
45
+
46
+ This is ambitious. Build it like it matters.