cognis-engine 0.3.0__tar.gz

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 (250) hide show
  1. cognis_engine-0.3.0/.gitignore +129 -0
  2. cognis_engine-0.3.0/CHANGELOG.md +271 -0
  3. cognis_engine-0.3.0/LICENSE +201 -0
  4. cognis_engine-0.3.0/Makefile +79 -0
  5. cognis_engine-0.3.0/PKG-INFO +492 -0
  6. cognis_engine-0.3.0/README.md +251 -0
  7. cognis_engine-0.3.0/apps/cognis-cli/cognis_cli/__init__.py +1 -0
  8. cognis_engine-0.3.0/apps/cognis-indexd/cognis_indexd/__init__.py +1 -0
  9. cognis_engine-0.3.0/apps/cognis-indexd/cognis_indexd/main.py +691 -0
  10. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/__init__.py +16 -0
  11. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/app/__init__.py +1 -0
  12. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/audit.py +78 -0
  13. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/embedder_pool.py +94 -0
  14. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/errors.py +93 -0
  15. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/main.py +128 -0
  16. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/metrics.py +275 -0
  17. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/result_cache.py +81 -0
  18. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/server.py +272 -0
  19. cognis_engine-0.3.0/apps/cognis-mcpd/cognis_mcpd/tools.py +1837 -0
  20. cognis_engine-0.3.0/apps/cognis-vscode/.vscodeignore +7 -0
  21. cognis_engine-0.3.0/apps/cognis-vscode/LICENSE.txt +201 -0
  22. cognis_engine-0.3.0/apps/cognis-vscode/README.md +203 -0
  23. cognis_engine-0.3.0/apps/cognis-vscode/media/command.png +0 -0
  24. cognis_engine-0.3.0/apps/cognis-vscode/media/icon.png +0 -0
  25. cognis_engine-0.3.0/apps/cognis-vscode/media/logo.png +0 -0
  26. cognis_engine-0.3.0/apps/cognis-vscode/media/sidebar.png +0 -0
  27. cognis_engine-0.3.0/apps/cognis-vscode/package-lock.json +4667 -0
  28. cognis_engine-0.3.0/apps/cognis-vscode/package.json +240 -0
  29. cognis_engine-0.3.0/apps/cognis-vscode/src/backend.ts +321 -0
  30. cognis_engine-0.3.0/apps/cognis-vscode/src/cli.ts +82 -0
  31. cognis_engine-0.3.0/apps/cognis-vscode/src/extension.ts +711 -0
  32. cognis_engine-0.3.0/apps/cognis-vscode/src/gitignore.ts +105 -0
  33. cognis_engine-0.3.0/apps/cognis-vscode/src/guidance.ts +360 -0
  34. cognis_engine-0.3.0/apps/cognis-vscode/src/health.ts +14 -0
  35. cognis_engine-0.3.0/apps/cognis-vscode/src/indexd.ts +426 -0
  36. cognis_engine-0.3.0/apps/cognis-vscode/src/mcpConfig.ts +382 -0
  37. cognis_engine-0.3.0/apps/cognis-vscode/src/mcpConfigPaths.ts +61 -0
  38. cognis_engine-0.3.0/apps/cognis-vscode/src/mcpEnv.ts +35 -0
  39. cognis_engine-0.3.0/apps/cognis-vscode/src/mcpServerName.ts +17 -0
  40. cognis_engine-0.3.0/apps/cognis-vscode/src/panel.ts +1322 -0
  41. cognis_engine-0.3.0/apps/cognis-vscode/src/prerequisites.ts +86 -0
  42. cognis_engine-0.3.0/apps/cognis-vscode/src/python.ts +86 -0
  43. cognis_engine-0.3.0/apps/cognis-vscode/src/reconcile.ts +158 -0
  44. cognis_engine-0.3.0/apps/cognis-vscode/src/repairPlan.ts +41 -0
  45. cognis_engine-0.3.0/apps/cognis-vscode/src/state.ts +145 -0
  46. cognis_engine-0.3.0/apps/cognis-vscode/src/test/backend.test.ts +43 -0
  47. cognis_engine-0.3.0/apps/cognis-vscode/src/test/contractParity.test.ts +199 -0
  48. cognis_engine-0.3.0/apps/cognis-vscode/src/test/criticalPaths.test.ts +156 -0
  49. cognis_engine-0.3.0/apps/cognis-vscode/src/test/freshSetup.integration.test.ts +219 -0
  50. cognis_engine-0.3.0/apps/cognis-vscode/src/test/mcpCleanup.test.ts +35 -0
  51. cognis_engine-0.3.0/apps/cognis-vscode/src/test/panelPrerequisites.test.ts +107 -0
  52. cognis_engine-0.3.0/apps/cognis-vscode/src/test/panelStepper.test.ts +175 -0
  53. cognis_engine-0.3.0/apps/cognis-vscode/src/test/prerequisites.integration.test.ts +195 -0
  54. cognis_engine-0.3.0/apps/cognis-vscode/src/test/testHarness.ts +554 -0
  55. cognis_engine-0.3.0/apps/cognis-vscode/src/types.ts +125 -0
  56. cognis_engine-0.3.0/apps/cognis-vscode/src/workspace.ts +845 -0
  57. cognis_engine-0.3.0/apps/cognis-vscode/tsconfig.json +16 -0
  58. cognis_engine-0.3.0/assets/logo.png +0 -0
  59. cognis_engine-0.3.0/deploy/compose.yaml +61 -0
  60. cognis_engine-0.3.0/docs/README.md +42 -0
  61. cognis_engine-0.3.0/docs/architecture.md +171 -0
  62. cognis_engine-0.3.0/docs/csar.md +193 -0
  63. cognis_engine-0.3.0/docs/deps.md +48 -0
  64. cognis_engine-0.3.0/docs/e2e-testing.md +101 -0
  65. cognis_engine-0.3.0/docs/eval/phase1-baseline.md +108 -0
  66. cognis_engine-0.3.0/docs/eval/swe-bench-methodology.md +115 -0
  67. cognis_engine-0.3.0/docs/getting-started.md +251 -0
  68. cognis_engine-0.3.0/docs/install.md +213 -0
  69. cognis_engine-0.3.0/docs/mcp-client-config.md +234 -0
  70. cognis_engine-0.3.0/docs/observability.md +110 -0
  71. cognis_engine-0.3.0/docs/operations.md +114 -0
  72. cognis_engine-0.3.0/docs/performance.md +201 -0
  73. cognis_engine-0.3.0/docs/production-flow.md +110 -0
  74. cognis_engine-0.3.0/docs/quickstart.md +177 -0
  75. cognis_engine-0.3.0/docs/release-notes-v0.1.17.md +136 -0
  76. cognis_engine-0.3.0/docs/release-notes-v0.2.0.md +99 -0
  77. cognis_engine-0.3.0/docs/release-notes-v0.2.1.md +66 -0
  78. cognis_engine-0.3.0/docs/release-notes-v0.3.0.md +83 -0
  79. cognis_engine-0.3.0/docs/release.md +126 -0
  80. cognis_engine-0.3.0/docs/security.md +94 -0
  81. cognis_engine-0.3.0/docs/troubleshooting-huggingface.md +84 -0
  82. cognis_engine-0.3.0/eval-baselines/phase1.json +8 -0
  83. cognis_engine-0.3.0/packages/adapters/cognis_adapters/__init__.py +1 -0
  84. cognis_engine-0.3.0/packages/core/cognis/__init__.py +35 -0
  85. cognis_engine-0.3.0/packages/core/cognis/assets/logo.png +0 -0
  86. cognis_engine-0.3.0/packages/core/cognis/branding.py +29 -0
  87. cognis_engine-0.3.0/packages/core/cognis/capsule/__init__.py +42 -0
  88. cognis_engine-0.3.0/packages/core/cognis/capsule/composer.py +553 -0
  89. cognis_engine-0.3.0/packages/core/cognis/capsule/models.py +261 -0
  90. cognis_engine-0.3.0/packages/core/cognis/capsule/token_estimator.py +136 -0
  91. cognis_engine-0.3.0/packages/core/cognis/cli/__init__.py +1 -0
  92. cognis_engine-0.3.0/packages/core/cognis/cli/main.py +1831 -0
  93. cognis_engine-0.3.0/packages/core/cognis/config.py +533 -0
  94. cognis_engine-0.3.0/packages/core/cognis/db.py +747 -0
  95. cognis_engine-0.3.0/packages/core/cognis/migrations/001_initial.sql +188 -0
  96. cognis_engine-0.3.0/packages/core/cognis/migrations/__init__.py +7 -0
  97. cognis_engine-0.3.0/packages/core/cognis/models.py +188 -0
  98. cognis_engine-0.3.0/packages/core/cognis/planner.py +433 -0
  99. cognis_engine-0.3.0/packages/core/cognis/py.typed +0 -0
  100. cognis_engine-0.3.0/packages/core/cognis/schemas/__init__.py +1 -0
  101. cognis_engine-0.3.0/packages/core/cognis/schemas/capsule.v1.json +383 -0
  102. cognis_engine-0.3.0/packages/eval/cognis_eval/__init__.py +57 -0
  103. cognis_engine-0.3.0/packages/eval/cognis_eval/models.py +184 -0
  104. cognis_engine-0.3.0/packages/eval/cognis_eval/runner.py +404 -0
  105. cognis_engine-0.3.0/packages/eval/cognis_eval/strategy.py +87 -0
  106. cognis_engine-0.3.0/packages/indexer/cognis_indexer/__init__.py +4 -0
  107. cognis_engine-0.3.0/packages/indexer/cognis_indexer/embedder.py +508 -0
  108. cognis_engine-0.3.0/packages/indexer/cognis_indexer/enricher/__init__.py +27 -0
  109. cognis_engine-0.3.0/packages/indexer/cognis_indexer/enricher/attributes.py +316 -0
  110. cognis_engine-0.3.0/packages/indexer/cognis_indexer/enricher/enricher.py +199 -0
  111. cognis_engine-0.3.0/packages/indexer/cognis_indexer/enricher/secrets.py +231 -0
  112. cognis_engine-0.3.0/packages/indexer/cognis_indexer/parsers/__init__.py +25 -0
  113. cognis_engine-0.3.0/packages/indexer/cognis_indexer/parsers/_normalize.py +102 -0
  114. cognis_engine-0.3.0/packages/indexer/cognis_indexer/parsers/base.py +94 -0
  115. cognis_engine-0.3.0/packages/indexer/cognis_indexer/parsers/go.py +342 -0
  116. cognis_engine-0.3.0/packages/indexer/cognis_indexer/parsers/python.py +412 -0
  117. cognis_engine-0.3.0/packages/indexer/cognis_indexer/parsers/typescript.py +469 -0
  118. cognis_engine-0.3.0/packages/indexer/cognis_indexer/pipeline.py +1028 -0
  119. cognis_engine-0.3.0/packages/indexer/cognis_indexer/resolver/__init__.py +24 -0
  120. cognis_engine-0.3.0/packages/indexer/cognis_indexer/resolver/base.py +77 -0
  121. cognis_engine-0.3.0/packages/indexer/cognis_indexer/resolver/heuristic.py +173 -0
  122. cognis_engine-0.3.0/packages/indexer/cognis_indexer/resolver/lsp.py +109 -0
  123. cognis_engine-0.3.0/packages/indexer/cognis_indexer/resolver/pipeline.py +112 -0
  124. cognis_engine-0.3.0/packages/indexer/cognis_indexer/watcher/__init__.py +29 -0
  125. cognis_engine-0.3.0/packages/indexer/cognis_indexer/watcher/debounce.py +131 -0
  126. cognis_engine-0.3.0/packages/indexer/cognis_indexer/watcher/events.py +72 -0
  127. cognis_engine-0.3.0/packages/indexer/cognis_indexer/watcher/gitignore.py +178 -0
  128. cognis_engine-0.3.0/packages/indexer/cognis_indexer/watcher/watcher.py +326 -0
  129. cognis_engine-0.3.0/packages/indexer/cognis_indexer/writer.py +477 -0
  130. cognis_engine-0.3.0/packages/retrieval/cognis_retrieval/__init__.py +66 -0
  131. cognis_engine-0.3.0/packages/retrieval/cognis_retrieval/base.py +64 -0
  132. cognis_engine-0.3.0/packages/retrieval/cognis_retrieval/csar.py +551 -0
  133. cognis_engine-0.3.0/packages/retrieval/cognis_retrieval/lexical.py +179 -0
  134. cognis_engine-0.3.0/packages/retrieval/cognis_retrieval/query_rewriter.py +191 -0
  135. cognis_engine-0.3.0/packages/retrieval/cognis_retrieval/semantic.py +232 -0
  136. cognis_engine-0.3.0/packages/retrieval/cognis_retrieval/structural.py +220 -0
  137. cognis_engine-0.3.0/pyproject.toml +273 -0
  138. cognis_engine-0.3.0/tasks.py +131 -0
  139. cognis_engine-0.3.0/tests/__init__.py +0 -0
  140. cognis_engine-0.3.0/tests/benchmark/__init__.py +1 -0
  141. cognis_engine-0.3.0/tests/benchmark/_helpers.py +60 -0
  142. cognis_engine-0.3.0/tests/benchmark/test_latency.py +581 -0
  143. cognis_engine-0.3.0/tests/conftest.py +39 -0
  144. cognis_engine-0.3.0/tests/e2e/__init__.py +0 -0
  145. cognis_engine-0.3.0/tests/e2e/conftest.py +32 -0
  146. cognis_engine-0.3.0/tests/e2e/contracts/bootstrap.json +35 -0
  147. cognis_engine-0.3.0/tests/e2e/contracts/health.json +10 -0
  148. cognis_engine-0.3.0/tests/e2e/contracts/indexd_status.json +20 -0
  149. cognis_engine-0.3.0/tests/e2e/contracts/mcp_config.json +37 -0
  150. cognis_engine-0.3.0/tests/e2e/contracts/paths.json +20 -0
  151. cognis_engine-0.3.0/tests/e2e/harness.py +282 -0
  152. cognis_engine-0.3.0/tests/e2e/test_contract_snapshots.py +132 -0
  153. cognis_engine-0.3.0/tests/e2e/test_full_flow.py +309 -0
  154. cognis_engine-0.3.0/tests/eval/__init__.py +0 -0
  155. cognis_engine-0.3.0/tests/fixtures/eval/golden.jsonl +126 -0
  156. cognis_engine-0.3.0/tests/fixtures/repos/.gitkeep +0 -0
  157. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/README.md +139 -0
  158. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/cmd/server/main.go +108 -0
  159. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/expected_symbols.json +273 -0
  160. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/go.mod +24 -0
  161. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/auth/jwt.go +137 -0
  162. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/config/config.go +184 -0
  163. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/db/repo.go +282 -0
  164. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/handlers/legacy.go +90 -0
  165. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/handlers/orders.go +230 -0
  166. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/middleware/logging.go +118 -0
  167. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/middleware/ratelimit.go +136 -0
  168. cognis_engine-0.3.0/tests/fixtures/repos/mini-go-svc/internal/validation/orders.go +175 -0
  169. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/README.md +119 -0
  170. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/expected_symbols.json +287 -0
  171. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/pyproject.toml +49 -0
  172. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/api/__init__.py +2 -0
  173. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/api/auth.py +114 -0
  174. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/api/health.py +39 -0
  175. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/api/users.py +183 -0
  176. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/app/__init__.py +2 -0
  177. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/app/config.py +118 -0
  178. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/app/dependencies.py +121 -0
  179. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/app/main.py +112 -0
  180. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/app/security.py +141 -0
  181. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/app/startup.py +120 -0
  182. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/db/__init__.py +2 -0
  183. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/db/connection.py +88 -0
  184. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/db/orders_repo.py +125 -0
  185. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/db/users_repo.py +135 -0
  186. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/utils/__init__.py +2 -0
  187. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/utils/logging.py +79 -0
  188. cognis_engine-0.3.0/tests/fixtures/repos/mini-py-svc/src/utils/secrets.py +164 -0
  189. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/.env.example +13 -0
  190. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/.gitignore +10 -0
  191. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/README.md +89 -0
  192. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/expected_symbols.json +392 -0
  193. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/package.json +47 -0
  194. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/app.ts +89 -0
  195. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/auth/jwt.ts +271 -0
  196. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/db/userRepo.ts +216 -0
  197. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/middleware/auth.ts +186 -0
  198. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/middleware/errorHandler.ts +208 -0
  199. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/middleware/logging.ts +160 -0
  200. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/routes/health.ts +64 -0
  201. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/routes/index.ts +46 -0
  202. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/routes/login.ts +173 -0
  203. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/routes/users.ts +201 -0
  204. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/server.ts +58 -0
  205. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/utils/logger.ts +128 -0
  206. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/utils/secrets.ts +159 -0
  207. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/src/utils/time.ts +87 -0
  208. cognis_engine-0.3.0/tests/fixtures/repos/mini-ts-app/tsconfig.json +26 -0
  209. cognis_engine-0.3.0/tests/integration/__init__.py +0 -0
  210. cognis_engine-0.3.0/tests/integration/conftest.py +276 -0
  211. cognis_engine-0.3.0/tests/integration/test_bootstrap_mcp_flow.py +144 -0
  212. cognis_engine-0.3.0/tests/integration/test_indexd_daemon.py +345 -0
  213. cognis_engine-0.3.0/tests/integration/test_indexer_pipeline.py +285 -0
  214. cognis_engine-0.3.0/tests/integration/test_mcp_integration.py +639 -0
  215. cognis_engine-0.3.0/tests/pbt/__init__.py +0 -0
  216. cognis_engine-0.3.0/tests/pbt/test_capsule_pbt.py +235 -0
  217. cognis_engine-0.3.0/tests/pbt/test_config_roundtrip.py +184 -0
  218. cognis_engine-0.3.0/tests/pbt/test_csar_pbt.py +236 -0
  219. cognis_engine-0.3.0/tests/pbt/test_db_roundtrip.py +283 -0
  220. cognis_engine-0.3.0/tests/pbt/test_embedder_pbt.py +233 -0
  221. cognis_engine-0.3.0/tests/pbt/test_enricher_pbt.py +307 -0
  222. cognis_engine-0.3.0/tests/pbt/test_mcp_pbt.py +319 -0
  223. cognis_engine-0.3.0/tests/pbt/test_parser_pbt.py +369 -0
  224. cognis_engine-0.3.0/tests/pbt/test_planner_pbt.py +228 -0
  225. cognis_engine-0.3.0/tests/pbt/test_retrieval_pbt.py +223 -0
  226. cognis_engine-0.3.0/tests/pbt/test_watcher_pbt.py +192 -0
  227. cognis_engine-0.3.0/tests/pbt/test_writer_pbt.py +264 -0
  228. cognis_engine-0.3.0/tests/unit/__init__.py +0 -0
  229. cognis_engine-0.3.0/tests/unit/test_capsule.py +633 -0
  230. cognis_engine-0.3.0/tests/unit/test_cli.py +686 -0
  231. cognis_engine-0.3.0/tests/unit/test_config.py +348 -0
  232. cognis_engine-0.3.0/tests/unit/test_csar.py +418 -0
  233. cognis_engine-0.3.0/tests/unit/test_db.py +405 -0
  234. cognis_engine-0.3.0/tests/unit/test_embedder.py +352 -0
  235. cognis_engine-0.3.0/tests/unit/test_enricher.py +572 -0
  236. cognis_engine-0.3.0/tests/unit/test_eval_runner.py +579 -0
  237. cognis_engine-0.3.0/tests/unit/test_fixture_expected_symbols.py +80 -0
  238. cognis_engine-0.3.0/tests/unit/test_indexd_daemon.py +236 -0
  239. cognis_engine-0.3.0/tests/unit/test_mcp_runtime_cache.py +142 -0
  240. cognis_engine-0.3.0/tests/unit/test_mcp_server.py +1308 -0
  241. cognis_engine-0.3.0/tests/unit/test_mcpd_main.py +138 -0
  242. cognis_engine-0.3.0/tests/unit/test_metrics.py +37 -0
  243. cognis_engine-0.3.0/tests/unit/test_parser_snapshots.py +234 -0
  244. cognis_engine-0.3.0/tests/unit/test_parsers.py +446 -0
  245. cognis_engine-0.3.0/tests/unit/test_planner.py +365 -0
  246. cognis_engine-0.3.0/tests/unit/test_resolver.py +473 -0
  247. cognis_engine-0.3.0/tests/unit/test_retrieval.py +379 -0
  248. cognis_engine-0.3.0/tests/unit/test_scaffold.py +31 -0
  249. cognis_engine-0.3.0/tests/unit/test_watcher.py +313 -0
  250. cognis_engine-0.3.0/tests/unit/test_writer.py +519 -0
@@ -0,0 +1,129 @@
1
+ # Deprecated duplicate of assets/logo.png (use scripts/prepare-branding.py)
2
+ /logo.png
3
+
4
+ # cognis runtime state
5
+ .cognis/
6
+
7
+ # Editor-local MCP wiring (generated by cognis-vscode; paths are machine-specific)
8
+ .cursor/mcp.json
9
+ .vscode/mcp.json
10
+
11
+ # Generated eval / benchmark output (regenerated by scripts/run_eval.py and the
12
+ # nightly CI workflows). Methodology lives in docs/eval/; the committed CI gate
13
+ # thresholds live in eval-baselines/ (intentionally tracked, NOT ignored).
14
+ eval-reports/
15
+ benchmark-reports/
16
+ .benchmarks/
17
+ audit.log
18
+ audit.log.*
19
+
20
+ # Python build artifacts
21
+ __pycache__/
22
+ *.py[cod]
23
+ *$py.class
24
+ *.so
25
+ *.egg
26
+ *.egg-info/
27
+ .eggs/
28
+ build/
29
+ dist/
30
+ wheels/
31
+ sdist/
32
+ pip-wheel-metadata/
33
+ *.pyd
34
+ *.pyi.bak
35
+
36
+ # Packaging caches
37
+ .uv/
38
+ .pdm-python
39
+ .pdm-build/
40
+ __pypackages__/
41
+
42
+ # Tooling caches
43
+ .mypy_cache/
44
+ .dmypy.json
45
+ .pyre/
46
+ .pytype/
47
+ .ruff_cache/
48
+ .pytest_cache/
49
+ .tox/
50
+ .nox/
51
+ .cache/
52
+ .coverage
53
+ .coverage.*
54
+ coverage.xml
55
+ htmlcov/
56
+ .hypothesis/
57
+
58
+ # Virtual environments
59
+ .venv/
60
+ .venv-*/
61
+ .venv-bootstrap/
62
+ venv/
63
+ .envrc
64
+ .direnv/
65
+ env/
66
+ ENV/
67
+ .python-version
68
+
69
+ # IDE / editor
70
+ .idea/
71
+ .vscode/
72
+ *.swp
73
+ *.swo
74
+ .DS_Store
75
+ Thumbs.db
76
+
77
+ # VS Code extension build/package artifacts
78
+ apps/cognis-vscode/.vscode/
79
+ apps/cognis-vscode/out/
80
+ apps/cognis-vscode/.vscode-test/
81
+ apps/cognis-vscode/.vscode-test-web/
82
+ apps/cognis-vscode/*.vsix
83
+
84
+ # Tree-sitter build outputs
85
+ *.dylib
86
+ *.dll
87
+ build-tree-sitter/
88
+ tree_sitter_languages_build/
89
+
90
+ # Local secrets — never commit
91
+ .env
92
+ .env.*
93
+ !.env.example
94
+ *.pem
95
+ *.key
96
+ *.p12
97
+ *.pfx
98
+ secrets/
99
+
100
+ # Local scratch helpers / dumps
101
+ scratch_*
102
+
103
+ # Logs & local databases / indexes
104
+ *.log
105
+ *.pid
106
+ *.sqlite
107
+ *.sqlite-journal
108
+ *.sqlite-wal
109
+ *.sqlite-shm
110
+ *.db
111
+ *.db-journal
112
+ *.db-wal
113
+ *.db-shm
114
+ *.duckdb
115
+ *.duckdb-journal
116
+ *.idx
117
+ *.index
118
+
119
+ .kiro/
120
+ .cursor/
121
+
122
+ # OS / misc
123
+ *.bak
124
+ *.tmp
125
+ *.temp
126
+ *.orig
127
+ *.rej
128
+ Desktop.ini
129
+ node_modules/
@@ -0,0 +1,271 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. Format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.3.0] — 2026-06-05
10
+
11
+ ### Added
12
+
13
+ - **One-click backend install/uninstall.** The VS Code / Cursor panel now
14
+ installs the Cognis Python backend for you — it creates a private environment
15
+ it manages (no terminal, no `pip`, no choosing a Python) and offers to set up
16
+ the workspace right after. The **Danger zone → Remove everything** action
17
+ reverses it, deleting that managed environment cleanly. If you bring your own
18
+ Python via `cognis.pythonPath`, install/uninstall operate on the `cognis`
19
+ package there and never touch your environment. New `cognis.installBackend`
20
+ command and `cognis.backendPackageSpec` setting.
21
+ - **Lifecycle removal commands.** `cognis.removeFromWorkspace` stops indexing,
22
+ disconnects this repo's MCP entry, and deletes the local `.cognis/`.
23
+ `cognis.prepareUninstall` additionally strips every `cognis-*` server from the
24
+ shared MCP config and uninstalls the managed backend, so nothing is orphaned
25
+ after the extension is removed.
26
+ - **Onboarding stepper.** The panel shows a fixed 4-step path
27
+ (Backend → Components → Index synced → AI connected) so a first-time user
28
+ always sees where they are and the single next action. A dedicated "Install
29
+ the Cognis backend" state guides fresh machines instead of failing setup with
30
+ a raw import error.
31
+
32
+ ### Changed
33
+
34
+ - **`.cognis/` is added to `.gitignore` automatically** after setup when the
35
+ workspace is a git repo and the entry is missing (idempotent), with a
36
+ non-blocking notice — instead of a prompt with a "Don't ask again" choice.
37
+ - **Plainer, behavior-based wording.** Removed the term "interpreter" from
38
+ user-facing copy; renamed **Repair Setup → Troubleshoot & Repair** and
39
+ **Clear Index & Re-index → Rebuild Index** (command IDs unchanged). The status
40
+ bar now uses a short, stable vocabulary (Indexing / Ready / Action needed /
41
+ Not set up).
42
+ - The VS Code / Cursor panel's **Prerequisites checklist now collapses** once
43
+ every required component is installed, showing a one-line "Ready" summary
44
+ instead of the full list. It auto-expands when a required component is missing
45
+ so the install action stays obvious, and can be expanded manually any time to
46
+ re-check or install optional extras.
47
+
48
+ ### Fixed
49
+
50
+ - **Live indexing from the extension now makes the workspace searchable in
51
+ seconds instead of appearing to fail.** The `cognis-indexd` cold rebuild
52
+ (spawned by the extension's "Set Up for AI" / live indexing) embedded *every*
53
+ symbol before writing any of them, so on a real repository the index DB stayed
54
+ empty — and the health panel reported `index: fail` ("0 files … excluded by
55
+ .gitignore") — for the entire multi-minute embed. The daemon now cold-indexes
56
+ in two phases: lexical + structural data first (fast, commits immediately so
57
+ search works and health flips to `ok`), then backfills semantic embeddings in
58
+ the background. Manual `cognis-cli index` was unaffected because operators
59
+ waited for it (or used `--skip-embeddings`); the failure only surfaced through
60
+ the daemon path.
61
+ - `cognis-cli health` and the `index --clear` diagnosis no longer blame
62
+ `.gitignore` / `repo.ignore` when the real cause is an unfinished index run.
63
+ When indexable source exists but the DB is empty, they now point to running
64
+ `index --full` instead of asserting the source was excluded.
65
+
66
+ ## [0.2.1] — 2026-06-02
67
+
68
+ ### Added
69
+
70
+ - **Prerequisite checklist in the VS Code / Cursor panel.** Before setup, the
71
+ panel now lists each installable backend component (parsers, local embeddings,
72
+ vector search, MCP server, tokenizers) with an installed/missing marker and a
73
+ per-item **Install** button (plus **Install all**). Backed by a new
74
+ `cognis-cli doctor --json` command. **Set Up for AI** is blocked until the
75
+ required components are installed, so a fresh user is never left with a
76
+ half-provisioned workspace.
77
+ - **`.gitignore` reminder.** After setup, in a git repository, the extension
78
+ offers to add `.cognis/` to `.gitignore` (with a "Don't ask again" option) so
79
+ the local index database, caches, and audit log are never committed.
80
+
81
+ ### Changed
82
+
83
+ - **The extension no longer auto-creates `.cognis/` on activation.** Opening a
84
+ folder leaves the repository untouched; `.cognis/` is created only when the
85
+ user explicitly runs **Set Up for AI**. Activation still auto-manages
86
+ workspaces that are already configured.
87
+
88
+ ## [0.2.0] — 2026-06-02
89
+
90
+ ### Fixed
91
+
92
+ - **`semantic_search` (and the semantic stage of `retrieve_context_capsule`)
93
+ no longer hang / time out on first use over MCP stdio.** The embedder
94
+ (`sentence-transformers`/`torch`) was being loaded for the first time on a
95
+ spawned worker thread inside the server; first-time torch initialization off
96
+ the main thread hangs, so the tool blocked until the MCP deadline fired and
97
+ returned a `TIMEOUT`. `cognis-mcpd` now warms the shared semantic layer
98
+ **synchronously on the main thread** before serving, so every tool call
99
+ reuses the cached singleton. Disable with
100
+ `COGNIS_MCP_WARM_SEMANTIC_ON_STARTUP=0` (re-exposes the off-main-thread
101
+ first-load hang for semantic tools).
102
+ - `cognis-mcpd` warms the UCKG `Database` (and the optional `sqlite-vec`/`numpy`
103
+ import) on the main thread before serving, avoiding an import-lock deadlock
104
+ when the first tool call would otherwise trigger that import on a FastMCP
105
+ worker thread (observed on Python 3.14 / Windows).
106
+ - `cognis-indexd` releases its SQLite connections on shutdown (dedicated
107
+ single-thread writer executor) and writes its status file atomically with a
108
+ retry, fixing a Windows `os.replace` sharing-violation crash when an IDE polls
109
+ the status file concurrently.
110
+
111
+ ### Added
112
+
113
+ - Cross-app **end-to-end test suite** (`tests/e2e/`, marker `e2e`) that drives
114
+ the real `cognis-cli`, `cognis-indexd`, and `cognis-mcpd` over process
115
+ boundaries (CLI JSON, the live status file, and MCP stdio), plus committed
116
+ JSON **contract snapshots** verified against the VS Code extension's
117
+ TypeScript interfaces (`apps/cognis-vscode/src/test/contractParity.test.ts`).
118
+ Includes a regression test that indexes with embeddings and asserts
119
+ `semantic_search` returns over stdio instead of hanging. See
120
+ `docs/e2e-testing.md`.
121
+
122
+ ## [0.1.17] — 2026-05-31
123
+
124
+ ### Added
125
+
126
+ - **CSAR — Code Spreading-Activation Retrieval**, the new primary retrieval
127
+ engine. Seeds a relevance distribution from cheap lexical + semantic matches
128
+ and diffuses it across the Unified Code Knowledge Graph via Personalized
129
+ PageRank (random walk with restart), recovering on-path symbols that
130
+ independent embedding/lexical ranking misses. Includes exact, power-iteration,
131
+ and Andersen–Chung–Lang forward-push solvers. The forward-push solver has a
132
+ provable work bound `1/(alpha*eps)` independent of repository size. Math and
133
+ proofs in `docs/csar.md`; verified by `tests/unit/test_csar.py` and
134
+ `tests/pbt/test_csar_pbt.py` (CP-CSAR-1..5).
135
+ - MCP tool `diffuse_context` — flagship CSAR retrieval; returns a unified ranked
136
+ shortlist (with `on_path` flags) in one round trip, replacing separate
137
+ `discover_symbols` + `dependency_trace` calls. Tunable via `COGNIS_MCP_CSAR_*`.
138
+ - `retrieve_context_capsule` structural stage is now CSAR-powered: lexical +
139
+ semantic hits seed a graph diffusion whose on-path symbols feed the bug /
140
+ root-cause sections, replacing the previous single-hop BFS.
141
+ - **Clear & Re-index**: a managed reset that deletes the stored index (UCKG
142
+ database, WAL/SHM sidecars, capsule cache) and rebuilds from scratch while
143
+ preserving `config.yaml` and MCP wiring. Available as the VS Code / Cursor
144
+ command `Cognis: Clear Index & Re-index` (and a button in the panel's Index
145
+ Status section, with a confirmation prompt) and as the CLI flag
146
+ `cognis-cli index --clear`.
147
+ - MCP tool `discover_symbols` — hybrid lexical + semantic discovery with
148
+ reciprocal-rank fusion in one call.
149
+ - MCP tool `resolve_symbols` — batch hydrate up to 50 symbol ids without repeated
150
+ `symbol_lookup` round trips.
151
+ - Enriched `semantic_search` payloads (file location, signature, docstring) plus
152
+ optional `kind` / path filters; batch SQL hydration replaces per-hit lookups.
153
+ - Short-lived in-process result cache for search tools (`COGNIS_MCP_CACHE_TTL_S`,
154
+ default 60s).
155
+ - MCP tool `symbol_search` for top-k symbol discovery with optional `kind` and
156
+ `file_path` filters.
157
+ - `dependency_trace` hit payloads enriched with symbol metadata (qualified name,
158
+ kind, file path, line range when available).
159
+ - Process-wide embedder reuse for semantic MCP tools to reduce repeated model
160
+ load latency.
161
+
162
+ ### Changed
163
+
164
+ - Default MCP tool allowlist and `McpToolName` now include `diffuse_context` as
165
+ the first (flagship) tool.
166
+ - Documentation and tests steer agents toward `diffuse_context` for
167
+ flow-oriented retrieval, `discover_symbols` for quick discovery,
168
+ `resolve_symbols` for batch hydration, `symbol_lookup` for exact resolution,
169
+ and `retrieve_context_capsule` for low-round-trip task context.
170
+ - `cognis-cli init` now additively migrates stale `.cognis/config.yaml`
171
+ defaults, writes config revision metadata, and keeps runtime loading aligned
172
+ with newer ignore/tool defaults without clobbering user overrides.
173
+ - Generated MCP config now always includes `COGNIS_REPO_ROOT`; on Windows it
174
+ also applies safer semantic timeout defaults unless the operator overrides the
175
+ corresponding `COGNIS_MCP_*` env vars.
176
+ - Windows MCP defaults raised to soft/hard/discover timeouts of 30/60/30 seconds
177
+ and `COGNIS_MCP_WARM_SEMANTIC_ON_STARTUP=1` to reduce first-query timeouts.
178
+ - VS Code / Cursor extension writes MCP config to workspace `.cursor/mcp.json` or
179
+ `.vscode/mcp.json` by default (`cognis.mcpConfigScope`), with global config as
180
+ an opt-in fallback.
181
+ - MCP servers are registered as `cognis-<repo-slug>` (for example
182
+ `cognis-cognis`, `cognis-edittruyentranh`) and merged additively into global
183
+ MCP config so multiple indexed repositories can stay connected at once.
184
+ - Generated MCP config defaults to minimal env (`COGNIS_DB_PATH` plus Windows
185
+ timeout defaults); repo root and audit log are inferred by `cognis-mcpd`.
186
+ - Successful semantic retrieval is now checked against the hard timeout only, so
187
+ cold-start model loads no longer fail with a follow-up soft-timeout after the
188
+ semantic stage already completed.
189
+
190
+ [Unreleased]: https://github.com/buimanhtoan-it/cognis/compare/v0.3.0...HEAD
191
+ [0.3.0]: https://github.com/buimanhtoan-it/cognis/compare/v0.2.1...v0.3.0
192
+ [0.2.1]: https://github.com/buimanhtoan-it/cognis/compare/v0.2.0...v0.2.1
193
+ [0.2.0]: https://github.com/buimanhtoan-it/cognis/compare/v0.1.17...v0.2.0
194
+ [0.1.17]: https://github.com/buimanhtoan-it/cognis/compare/v0.1.0...v0.1.17
195
+
196
+ ---
197
+
198
+ ## [0.1.0] — Phase 1 MVP
199
+
200
+ ### Added
201
+
202
+ **Phase 0 — Foundations**
203
+
204
+ - Repo scaffold per design "Build and Release" layout (`apps/`, `packages/`, `tests/`).
205
+ - `pyproject.toml` pinning Python ≥ 3.11 and Phase 0/1 dev dependencies (ruff,
206
+ mypy, pytest, pytest-asyncio, pytest-benchmark, hypothesis).
207
+ - `Makefile` and `tasks.py` recipes for `lint`, `typecheck`, `test`, `bench`, `eval`.
208
+ - GitHub Actions workflows: lint+unit on push, integration on PR, nightly eval.
209
+ - `pre-commit` config: ruff format + lint + mypy.
210
+ - Apache-2.0 `LICENSE`, README skeleton, `.gitignore` covering `.cognis/` and build artifacts.
211
+ - `packages/core/cognis/config.py`: Pydantic-validated config loader for `.cognis/config.yaml`.
212
+ - `cognis-cli` (Click) with commands: `init`, `index`, `eval`, `health`, `up`, `down`,
213
+ `mcp-conformance`, `profile`.
214
+ - SQLite schema bootstrap in WAL mode with FTS5 and sqlite-vec virtual tables.
215
+ - Migration runner with `meta.index_version` tracking.
216
+ - Eval harness skeleton (`packages/eval/runner.py`) with Recall@k, MRR metrics.
217
+ - Test fixture repos: `mini-ts-app`, `mini-py-svc`, `mini-go-svc` with planted bugs.
218
+
219
+ **Phase 1 — MVP Cognition**
220
+
221
+ - Tree-sitter parsers for TypeScript, Python, and Go.
222
+ - File watcher with 200ms debounce and `.gitignore` awareness (`watchdog`).
223
+ - Edge resolver: LSP-first with heuristic fallback, confidence-scored edges.
224
+ - Enricher: `db_table`, `http_route`, `env_var`, `external_call` detection.
225
+ - Secret redactor: Shannon entropy + pattern matching for AWS/GCP/Azure/GitHub/OpenAI/JWT/PEM.
226
+ - Embedder with local `bge-small-en-v1.5` (384d) backend; optional Voyage API.
227
+ - Writer with single-writer thread, per-file transactions, cascade deletion.
228
+ - Retrieval layers: Lexical (FTS5), Semantic (sqlite-vec KNN), Structural (recursive CTE).
229
+ - Cognitive Context Planner: rule-based classify + layer_plan + allocate_budget, < 30ms.
230
+ - Capsule composer v1 with Pydantic schema, tiktoken budget, untrusted content wrapping.
231
+ - MCP server (`cognis-mcpd`) with 4 tools: `symbol_lookup`, `semantic_search`,
232
+ `dependency_trace`, `retrieve_context_capsule`.
233
+ - Hard limits enforcement: depth ≤ 8, k ≤ 50, max_tokens ≤ 32000, 10s hard timeout.
234
+ - Audit log (append-only JSONL, args hash only).
235
+
236
+ **Phase 1 — Conformance, Eval, Performance, Release (Tasks 16–18)**
237
+
238
+ - `cognis-cli mcp-conformance`: built-in conformance check for all 4 tools; optional
239
+ upstream harness integration when `mcp_conformance` package is installed.
240
+ - Integration tests (`tests/integration/test_mcp_integration.py`) for all 4 tools,
241
+ planted auth-timeout bug detection, and incremental write API verification.
242
+ - Cross-platform CI: integration tests run on ubuntu-latest, macos-latest, windows-latest.
243
+ - Golden query set expanded to 110 queries (20 each for bugfix/feature/refactor/explain/review,
244
+ 10 for migrate) across all 3 fixture repos.
245
+ - `scripts/run_eval.py`: standalone eval runner script.
246
+ - `docs/eval/phase1-baseline.md`: methodology, baseline placeholder, tuning approach,
247
+ Phase 1 gate criteria.
248
+ - `docs/eval/swe-bench-methodology.md`: SWE-bench Lite mini-run methodology.
249
+ - `tests/benchmark/test_latency.py`: `@pytest.mark.benchmark` tests for all 4 hot-path
250
+ latency budgets.
251
+ - `apps/cognis-mcpd/cognis_mcpd/metrics.py`: in-memory Counter/Histogram/Gauge with stdlib only.
252
+ - `docs/install.md`, `docs/quickstart.md`, `docs/mcp-client-config.md`: user-facing docs.
253
+ - `docs/performance.md`: performance guide, known gaps, profiling instructions.
254
+ - `docs/observability.md`: metrics, logging, audit log, Phase 2 Prometheus migration plan.
255
+ - `docs/release.md`: release procedure, Docker, cibuildwheel notes.
256
+ - `docs/release-notes-v0.1.17.md`: release notes for the v0.1.x line.
257
+ - `Dockerfile`: multi-stage build with bge-small-en-v1.5 pre-cached, non-root user.
258
+
259
+ ### Fixed
260
+
261
+ - `mcp-conformance` CLI command: upgraded from stub to functional implementation.
262
+
263
+ ### Notes on Phase 2+
264
+
265
+ - Behavioral (runtime) layer: no-op at MVP; OTel adapter planned for Phase 3.
266
+ - Temporal (git history) layer: Phase 2.
267
+ - Reranker (bge-reranker-v2-m3): Phase 2.
268
+ - SSE transport: Phase 2.
269
+ - Prometheus `/metrics` HTTP endpoint: Phase 2.
270
+
271
+ [0.1.0]: https://github.com/buimanhtoan-it/cognis/releases/tag/v0.1.0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 cognis maintainers
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,79 @@
1
+ # cognis developer Makefile
2
+ #
3
+ # Mirrors `tasks.py` (Invoke). Both expose the same recipes so contributors can
4
+ # pick whichever fits their shell. The CI pipeline uses these targets verbatim.
5
+
6
+ PYTHON ?= python
7
+ PIP ?= $(PYTHON) -m pip
8
+ PYTEST ?= $(PYTHON) -m pytest
9
+ RUFF ?= $(PYTHON) -m ruff
10
+ MYPY ?= $(PYTHON) -m mypy
11
+ COGNIS_CLI ?= $(PYTHON) -m cognis.cli.main
12
+
13
+ # Strict-typing scope per Task 1 — start with packages/core, expand later.
14
+ MYPY_STRICT_PATHS ?= packages/core
15
+ PYTEST_ARGS ?=
16
+
17
+ .DEFAULT_GOAL := help
18
+
19
+ .PHONY: help
20
+ help:
21
+ @echo "cognis dev recipes:"
22
+ @echo " make lint # ruff format --check + ruff check"
23
+ @echo " make format # ruff format (writes changes)"
24
+ @echo " make typecheck # mypy (strict on $(MYPY_STRICT_PATHS))"
25
+ @echo " make test # pytest unit + property tests"
26
+ @echo " make e2e # full cross-app end-to-end flow (CLI+indexd+mcpd)"
27
+ @echo " make bench # pytest --benchmark-only"
28
+ @echo " make eval # cognis-cli eval (golden-set runner)"
29
+ @echo " make clean # remove build / cache artifacts"
30
+ @echo " make install-dev # editable install + dev deps + extension compile"
31
+ @echo " make install-extension # npm install + compile apps/cognis-vscode"
32
+
33
+ .PHONY: install-extension
34
+ install-extension:
35
+ $(PYTHON) scripts/setup_extension.py
36
+
37
+ .PHONY: install-dev
38
+ install-dev:
39
+ $(PIP) install -e ".[indexer,embed-local,vector,tokenizers,mcp]"
40
+ $(PIP) install --group dev || $(PIP) install ruff mypy pytest pytest-asyncio pytest-benchmark hypothesis pre-commit invoke
41
+ pre-commit install || true
42
+ -$(PYTHON) scripts/prepare-branding.py
43
+ $(PYTHON) scripts/setup_extension.py
44
+
45
+ .PHONY: lint
46
+ lint:
47
+ $(RUFF) format --check .
48
+ $(RUFF) check .
49
+
50
+ .PHONY: format
51
+ format:
52
+ $(RUFF) format .
53
+ $(RUFF) check --fix .
54
+
55
+ .PHONY: typecheck
56
+ typecheck:
57
+ $(MYPY) $(MYPY_STRICT_PATHS)
58
+
59
+ .PHONY: test
60
+ test:
61
+ $(PYTEST) -m "not benchmark and not eval and not e2e" $(PYTEST_ARGS)
62
+
63
+ .PHONY: e2e
64
+ e2e:
65
+ $(PYTEST) -m e2e $(PYTEST_ARGS)
66
+
67
+ .PHONY: bench
68
+ bench:
69
+ $(PYTEST) -m benchmark --benchmark-only $(PYTEST_ARGS)
70
+
71
+ .PHONY: eval
72
+ eval:
73
+ $(COGNIS_CLI) eval $(EVAL_ARGS)
74
+
75
+ .PHONY: clean
76
+ clean:
77
+ $(PYTHON) -c "import shutil, os; [shutil.rmtree(p, ignore_errors=True) for p in ['build','dist','.pytest_cache','.mypy_cache','.ruff_cache','.hypothesis','.benchmarks','htmlcov']]"
78
+ $(PYTHON) -c "import pathlib; [p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')]"
79
+ $(PYTHON) -c "import pathlib, shutil; [shutil.rmtree(p, ignore_errors=True) for p in pathlib.Path('.').rglob('__pycache__')]"