xtctx 0.3.2 → 0.11.3

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 (308) hide show
  1. package/CHANGELOG.md +317 -122
  2. package/LICENSE +21 -21
  3. package/README.md +154 -121
  4. package/dist/src/cli/disconnect.d.ts +8 -0
  5. package/dist/src/cli/disconnect.d.ts.map +1 -0
  6. package/dist/src/cli/disconnect.js +42 -0
  7. package/dist/src/cli/disconnect.js.map +1 -0
  8. package/dist/src/cli/hook.d.ts +7 -0
  9. package/dist/src/cli/hook.d.ts.map +1 -0
  10. package/dist/src/cli/hook.js +32 -0
  11. package/dist/src/cli/hook.js.map +1 -0
  12. package/dist/src/cli/index.d.ts.map +1 -1
  13. package/dist/src/cli/index.js +86 -33
  14. package/dist/src/cli/index.js.map +1 -1
  15. package/dist/src/cli/setup.d.ts +8 -0
  16. package/dist/src/cli/setup.d.ts.map +1 -0
  17. package/dist/src/cli/setup.js +76 -0
  18. package/dist/src/cli/setup.js.map +1 -0
  19. package/dist/src/cli/status.d.ts +7 -0
  20. package/dist/src/cli/status.d.ts.map +1 -0
  21. package/dist/src/cli/status.js +133 -0
  22. package/dist/src/cli/status.js.map +1 -0
  23. package/dist/src/config/disconnect.d.ts +34 -0
  24. package/dist/src/config/disconnect.d.ts.map +1 -0
  25. package/dist/src/config/disconnect.js +386 -0
  26. package/dist/src/config/disconnect.js.map +1 -0
  27. package/dist/src/config/managed-block.d.ts +29 -0
  28. package/dist/src/config/managed-block.d.ts.map +1 -0
  29. package/dist/src/config/managed-block.js +67 -0
  30. package/dist/src/config/managed-block.js.map +1 -0
  31. package/dist/src/config/mcp-config.d.ts +93 -0
  32. package/dist/src/config/mcp-config.d.ts.map +1 -0
  33. package/dist/src/config/mcp-config.js +556 -0
  34. package/dist/src/config/mcp-config.js.map +1 -0
  35. package/dist/src/config/setup.d.ts +39 -0
  36. package/dist/src/config/setup.d.ts.map +1 -0
  37. package/dist/src/config/setup.js +379 -0
  38. package/dist/src/config/setup.js.map +1 -0
  39. package/dist/src/config/skills.d.ts +73 -0
  40. package/dist/src/config/skills.d.ts.map +1 -0
  41. package/dist/src/config/skills.js +427 -0
  42. package/dist/src/config/skills.js.map +1 -0
  43. package/dist/src/handoff/embeddings.d.ts +26 -0
  44. package/dist/src/handoff/embeddings.d.ts.map +1 -0
  45. package/dist/src/handoff/embeddings.js +132 -0
  46. package/dist/src/handoff/embeddings.js.map +1 -0
  47. package/dist/src/handoff/sqlite-index.d.ts +52 -0
  48. package/dist/src/handoff/sqlite-index.d.ts.map +1 -0
  49. package/dist/src/handoff/sqlite-index.js +905 -0
  50. package/dist/src/handoff/sqlite-index.js.map +1 -0
  51. package/dist/src/handoff/types.d.ts +63 -0
  52. package/dist/src/handoff/types.d.ts.map +1 -0
  53. package/dist/src/handoff/types.js +2 -0
  54. package/dist/src/handoff/types.js.map +1 -0
  55. package/dist/src/handoff/vector.d.ts +4 -0
  56. package/dist/src/handoff/vector.d.ts.map +1 -0
  57. package/dist/src/handoff/vector.js +31 -0
  58. package/dist/src/handoff/vector.js.map +1 -0
  59. package/dist/src/mcp/server.d.ts +3 -20
  60. package/dist/src/mcp/server.d.ts.map +1 -1
  61. package/dist/src/mcp/server.js +90 -205
  62. package/dist/src/mcp/server.js.map +1 -1
  63. package/dist/src/mcp/tools/continuity.d.ts +21 -0
  64. package/dist/src/mcp/tools/continuity.d.ts.map +1 -0
  65. package/dist/src/mcp/tools/continuity.js +55 -0
  66. package/dist/src/mcp/tools/continuity.js.map +1 -0
  67. package/dist/src/mcp/tools/manifest.d.ts +40 -0
  68. package/dist/src/mcp/tools/manifest.d.ts.map +1 -0
  69. package/dist/src/mcp/tools/manifest.js +105 -0
  70. package/dist/src/mcp/tools/manifest.js.map +1 -0
  71. package/dist/src/mcp/tools/sessions.d.ts +18 -31
  72. package/dist/src/mcp/tools/sessions.d.ts.map +1 -1
  73. package/dist/src/mcp/tools/sessions.js +109 -16
  74. package/dist/src/mcp/tools/sessions.js.map +1 -1
  75. package/dist/src/runtime/services.d.ts +11 -38
  76. package/dist/src/runtime/services.d.ts.map +1 -1
  77. package/dist/src/runtime/services.js +61 -200
  78. package/dist/src/runtime/services.js.map +1 -1
  79. package/dist/src/scrapers/antigravity.d.ts +52 -0
  80. package/dist/src/scrapers/antigravity.d.ts.map +1 -0
  81. package/dist/src/scrapers/antigravity.js +869 -0
  82. package/dist/src/scrapers/antigravity.js.map +1 -0
  83. package/dist/src/scrapers/base.d.ts +53 -1
  84. package/dist/src/scrapers/base.d.ts.map +1 -1
  85. package/dist/src/scrapers/base.js +93 -4
  86. package/dist/src/scrapers/base.js.map +1 -1
  87. package/dist/src/scrapers/claude-code.d.ts +37 -6
  88. package/dist/src/scrapers/claude-code.d.ts.map +1 -1
  89. package/dist/src/scrapers/claude-code.js +214 -40
  90. package/dist/src/scrapers/claude-code.js.map +1 -1
  91. package/dist/src/scrapers/codex.d.ts +36 -6
  92. package/dist/src/scrapers/codex.d.ts.map +1 -1
  93. package/dist/src/scrapers/codex.js +283 -60
  94. package/dist/src/scrapers/codex.js.map +1 -1
  95. package/dist/src/scrapers/copilot-cli.d.ts +34 -0
  96. package/dist/src/scrapers/copilot-cli.d.ts.map +1 -0
  97. package/dist/src/scrapers/copilot-cli.js +342 -0
  98. package/dist/src/scrapers/copilot-cli.js.map +1 -0
  99. package/dist/src/scrapers/copilot.d.ts +41 -8
  100. package/dist/src/scrapers/copilot.d.ts.map +1 -1
  101. package/dist/src/scrapers/copilot.js +256 -118
  102. package/dist/src/scrapers/copilot.js.map +1 -1
  103. package/dist/src/scrapers/cursor.d.ts +24 -9
  104. package/dist/src/scrapers/cursor.d.ts.map +1 -1
  105. package/dist/src/scrapers/cursor.js +259 -152
  106. package/dist/src/scrapers/cursor.js.map +1 -1
  107. package/dist/src/scrapers/index.d.ts +23 -0
  108. package/dist/src/scrapers/index.d.ts.map +1 -0
  109. package/dist/src/scrapers/index.js +22 -0
  110. package/dist/src/scrapers/index.js.map +1 -0
  111. package/dist/src/scrapers/opencode.d.ts +37 -0
  112. package/dist/src/scrapers/opencode.d.ts.map +1 -0
  113. package/dist/src/scrapers/opencode.js +277 -0
  114. package/dist/src/scrapers/opencode.js.map +1 -0
  115. package/dist/src/scrapers/registry.d.ts +1 -0
  116. package/dist/src/scrapers/registry.d.ts.map +1 -1
  117. package/dist/src/scrapers/registry.js +3 -0
  118. package/dist/src/scrapers/registry.js.map +1 -1
  119. package/dist/src/tools/sources.d.ts +28 -0
  120. package/dist/src/tools/sources.d.ts.map +1 -0
  121. package/dist/src/tools/sources.js +149 -0
  122. package/dist/src/tools/sources.js.map +1 -0
  123. package/dist/src/types/config.d.ts +24 -37
  124. package/dist/src/types/config.d.ts.map +1 -1
  125. package/dist/src/types/index.d.ts +0 -2
  126. package/dist/src/types/index.d.ts.map +1 -1
  127. package/dist/src/types/index.js +0 -2
  128. package/dist/src/types/index.js.map +1 -1
  129. package/dist/src/types/scraper.d.ts +34 -5
  130. package/dist/src/types/scraper.d.ts.map +1 -1
  131. package/dist/src/utils/atomic-file.d.ts +8 -0
  132. package/dist/src/utils/atomic-file.d.ts.map +1 -0
  133. package/dist/src/utils/atomic-file.js +15 -0
  134. package/dist/src/utils/atomic-file.js.map +1 -0
  135. package/dist/src/utils/errors.d.ts +7 -0
  136. package/dist/src/utils/errors.d.ts.map +1 -0
  137. package/dist/src/utils/errors.js +16 -0
  138. package/dist/src/utils/errors.js.map +1 -0
  139. package/dist/src/utils/package-info.d.ts +11 -0
  140. package/dist/src/utils/package-info.d.ts.map +1 -0
  141. package/dist/src/utils/package-info.js +30 -0
  142. package/dist/src/utils/package-info.js.map +1 -0
  143. package/dist/src/utils/project-scope.d.ts +19 -0
  144. package/dist/src/utils/project-scope.d.ts.map +1 -0
  145. package/dist/src/utils/project-scope.js +61 -0
  146. package/dist/src/utils/project-scope.js.map +1 -0
  147. package/package.json +70 -66
  148. package/dist/src/api/routes/config.d.ts +0 -4
  149. package/dist/src/api/routes/config.d.ts.map +0 -1
  150. package/dist/src/api/routes/config.js +0 -61
  151. package/dist/src/api/routes/config.js.map +0 -1
  152. package/dist/src/api/routes/knowledge.d.ts +0 -4
  153. package/dist/src/api/routes/knowledge.d.ts.map +0 -1
  154. package/dist/src/api/routes/knowledge.js +0 -40
  155. package/dist/src/api/routes/knowledge.js.map +0 -1
  156. package/dist/src/api/routes/search.d.ts +0 -7
  157. package/dist/src/api/routes/search.d.ts.map +0 -1
  158. package/dist/src/api/routes/search.js +0 -108
  159. package/dist/src/api/routes/search.js.map +0 -1
  160. package/dist/src/api/routes/sources.d.ts +0 -12
  161. package/dist/src/api/routes/sources.d.ts.map +0 -1
  162. package/dist/src/api/routes/sources.js +0 -70
  163. package/dist/src/api/routes/sources.js.map +0 -1
  164. package/dist/src/api/server.d.ts +0 -26
  165. package/dist/src/api/server.d.ts.map +0 -1
  166. package/dist/src/api/server.js +0 -312
  167. package/dist/src/api/server.js.map +0 -1
  168. package/dist/src/cli/ingest.d.ts +0 -6
  169. package/dist/src/cli/ingest.d.ts.map +0 -1
  170. package/dist/src/cli/ingest.js +0 -11
  171. package/dist/src/cli/ingest.js.map +0 -1
  172. package/dist/src/cli/init.d.ts +0 -6
  173. package/dist/src/cli/init.d.ts.map +0 -1
  174. package/dist/src/cli/init.js +0 -105
  175. package/dist/src/cli/init.js.map +0 -1
  176. package/dist/src/cli/serve.d.ts +0 -7
  177. package/dist/src/cli/serve.d.ts.map +0 -1
  178. package/dist/src/cli/serve.js +0 -100
  179. package/dist/src/cli/serve.js.map +0 -1
  180. package/dist/src/cli/sync.d.ts +0 -5
  181. package/dist/src/cli/sync.d.ts.map +0 -1
  182. package/dist/src/cli/sync.js +0 -13
  183. package/dist/src/cli/sync.js.map +0 -1
  184. package/dist/src/compaction/pipeline.d.ts +0 -19
  185. package/dist/src/compaction/pipeline.d.ts.map +0 -1
  186. package/dist/src/compaction/pipeline.js +0 -37
  187. package/dist/src/compaction/pipeline.js.map +0 -1
  188. package/dist/src/compaction/providers/cli.d.ts +0 -13
  189. package/dist/src/compaction/providers/cli.d.ts.map +0 -1
  190. package/dist/src/compaction/providers/cli.js +0 -60
  191. package/dist/src/compaction/providers/cli.js.map +0 -1
  192. package/dist/src/compaction/rule-based.d.ts +0 -8
  193. package/dist/src/compaction/rule-based.d.ts.map +0 -1
  194. package/dist/src/compaction/rule-based.js +0 -120
  195. package/dist/src/compaction/rule-based.js.map +0 -1
  196. package/dist/src/config/loader.d.ts +0 -12
  197. package/dist/src/config/loader.d.ts.map +0 -1
  198. package/dist/src/config/loader.js +0 -76
  199. package/dist/src/config/loader.js.map +0 -1
  200. package/dist/src/config/mappings/claude-code.d.ts +0 -3
  201. package/dist/src/config/mappings/claude-code.d.ts.map +0 -1
  202. package/dist/src/config/mappings/claude-code.js +0 -31
  203. package/dist/src/config/mappings/claude-code.js.map +0 -1
  204. package/dist/src/config/mappings/codex.d.ts +0 -3
  205. package/dist/src/config/mappings/codex.d.ts.map +0 -1
  206. package/dist/src/config/mappings/codex.js +0 -31
  207. package/dist/src/config/mappings/codex.js.map +0 -1
  208. package/dist/src/config/mappings/copilot.d.ts +0 -3
  209. package/dist/src/config/mappings/copilot.d.ts.map +0 -1
  210. package/dist/src/config/mappings/copilot.js +0 -33
  211. package/dist/src/config/mappings/copilot.js.map +0 -1
  212. package/dist/src/config/mappings/cursor.d.ts +0 -3
  213. package/dist/src/config/mappings/cursor.d.ts.map +0 -1
  214. package/dist/src/config/mappings/cursor.js +0 -29
  215. package/dist/src/config/mappings/cursor.js.map +0 -1
  216. package/dist/src/config/sync.d.ts +0 -13
  217. package/dist/src/config/sync.d.ts.map +0 -1
  218. package/dist/src/config/sync.js +0 -96
  219. package/dist/src/config/sync.js.map +0 -1
  220. package/dist/src/ingestion/coordinator.d.ts +0 -37
  221. package/dist/src/ingestion/coordinator.d.ts.map +0 -1
  222. package/dist/src/ingestion/coordinator.js +0 -127
  223. package/dist/src/ingestion/coordinator.js.map +0 -1
  224. package/dist/src/ingestion/daemon.d.ts +0 -17
  225. package/dist/src/ingestion/daemon.d.ts.map +0 -1
  226. package/dist/src/ingestion/daemon.js +0 -35
  227. package/dist/src/ingestion/daemon.js.map +0 -1
  228. package/dist/src/ingestion/watcher.d.ts +0 -19
  229. package/dist/src/ingestion/watcher.d.ts.map +0 -1
  230. package/dist/src/ingestion/watcher.js +0 -70
  231. package/dist/src/ingestion/watcher.js.map +0 -1
  232. package/dist/src/knowledge/autotag.d.ts +0 -3
  233. package/dist/src/knowledge/autotag.d.ts.map +0 -1
  234. package/dist/src/knowledge/autotag.js +0 -24
  235. package/dist/src/knowledge/autotag.js.map +0 -1
  236. package/dist/src/knowledge/dedup.d.ts +0 -7
  237. package/dist/src/knowledge/dedup.d.ts.map +0 -1
  238. package/dist/src/knowledge/dedup.js +0 -15
  239. package/dist/src/knowledge/dedup.js.map +0 -1
  240. package/dist/src/knowledge/repository.d.ts +0 -12
  241. package/dist/src/knowledge/repository.d.ts.map +0 -1
  242. package/dist/src/knowledge/repository.js +0 -74
  243. package/dist/src/knowledge/repository.js.map +0 -1
  244. package/dist/src/mcp/tools/config.d.ts +0 -36
  245. package/dist/src/mcp/tools/config.d.ts.map +0 -1
  246. package/dist/src/mcp/tools/config.js +0 -54
  247. package/dist/src/mcp/tools/config.js.map +0 -1
  248. package/dist/src/mcp/tools/knowledge.d.ts +0 -17
  249. package/dist/src/mcp/tools/knowledge.d.ts.map +0 -1
  250. package/dist/src/mcp/tools/knowledge.js +0 -46
  251. package/dist/src/mcp/tools/knowledge.js.map +0 -1
  252. package/dist/src/mcp/tools/search.d.ts +0 -22
  253. package/dist/src/mcp/tools/search.d.ts.map +0 -1
  254. package/dist/src/mcp/tools/search.js +0 -30
  255. package/dist/src/mcp/tools/search.js.map +0 -1
  256. package/dist/src/mcp/tools/write.d.ts +0 -38
  257. package/dist/src/mcp/tools/write.d.ts.map +0 -1
  258. package/dist/src/mcp/tools/write.js +0 -97
  259. package/dist/src/mcp/tools/write.js.map +0 -1
  260. package/dist/src/runtime/ingestion.d.ts +0 -17
  261. package/dist/src/runtime/ingestion.d.ts.map +0 -1
  262. package/dist/src/runtime/ingestion.js +0 -106
  263. package/dist/src/runtime/ingestion.js.map +0 -1
  264. package/dist/src/scrapers/gemini.d.ts +0 -17
  265. package/dist/src/scrapers/gemini.d.ts.map +0 -1
  266. package/dist/src/scrapers/gemini.js +0 -245
  267. package/dist/src/scrapers/gemini.js.map +0 -1
  268. package/dist/src/store/embeddings.d.ts +0 -9
  269. package/dist/src/store/embeddings.d.ts.map +0 -1
  270. package/dist/src/store/embeddings.js +0 -28
  271. package/dist/src/store/embeddings.js.map +0 -1
  272. package/dist/src/store/lance.d.ts +0 -25
  273. package/dist/src/store/lance.d.ts.map +0 -1
  274. package/dist/src/store/lance.js +0 -74
  275. package/dist/src/store/lance.js.map +0 -1
  276. package/dist/src/store/search.d.ts +0 -18
  277. package/dist/src/store/search.d.ts.map +0 -1
  278. package/dist/src/store/search.js +0 -55
  279. package/dist/src/store/search.js.map +0 -1
  280. package/dist/src/types/compaction.d.ts +0 -29
  281. package/dist/src/types/compaction.d.ts.map +0 -1
  282. package/dist/src/types/compaction.js +0 -2
  283. package/dist/src/types/compaction.js.map +0 -1
  284. package/dist/src/types/context.d.ts +0 -33
  285. package/dist/src/types/context.d.ts.map +0 -1
  286. package/dist/src/types/context.js +0 -18
  287. package/dist/src/types/context.js.map +0 -1
  288. package/dist/src/utils/retry.d.ts +0 -11
  289. package/dist/src/utils/retry.d.ts.map +0 -1
  290. package/dist/src/utils/retry.js +0 -46
  291. package/dist/src/utils/retry.js.map +0 -1
  292. package/dist/src/utils/shutdown.d.ts +0 -25
  293. package/dist/src/utils/shutdown.d.ts.map +0 -1
  294. package/dist/src/utils/shutdown.js +0 -56
  295. package/dist/src/utils/shutdown.js.map +0 -1
  296. package/dist/web/apple-touch-icon.png +0 -0
  297. package/dist/web/assets/index-Nuadr5ox.css +0 -1
  298. package/dist/web/assets/index-aA0u8eXA.js +0 -3504
  299. package/dist/web/assets/primeicons-C6QP2o4f.woff2 +0 -0
  300. package/dist/web/assets/primeicons-DMOk5skT.eot +0 -0
  301. package/dist/web/assets/primeicons-Dr5RGzOO.svg +0 -345
  302. package/dist/web/assets/primeicons-MpK4pl85.ttf +0 -0
  303. package/dist/web/assets/primeicons-WjwUDZjB.woff +0 -0
  304. package/dist/web/favicon.ico +0 -0
  305. package/dist/web/favicon.svg +0 -21
  306. package/dist/web/index.html +0 -21
  307. package/dist/web/site.webmanifest +0 -19
  308. package/dist/web/vite.svg +0 -1
package/README.md CHANGED
@@ -1,149 +1,182 @@
1
1
  # xtctx
2
2
 
3
- [![CI](https://github.com/fstubner/xtctx/actions/workflows/ci.yml/badge.svg)](https://github.com/fstubner/xtctx/actions/workflows/ci.yml)
4
- [![Release Please](https://github.com/fstubner/xtctx/actions/workflows/release-please.yml/badge.svg)](https://github.com/fstubner/xtctx/actions/workflows/release-please.yml)
5
- [![Latest Release](https://img.shields.io/github/v/release/fstubner/xtctx?sort=semver)](https://github.com/fstubner/xtctx/releases)
3
+ [![CI](https://github.com/fstubner/xtctx/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fstubner/xtctx/actions/workflows/ci.yml)
4
+ [![Landing Deploy](https://github.com/fstubner/xtctx/actions/workflows/deploy-landing.yml/badge.svg?branch=main)](https://github.com/fstubner/xtctx/actions/workflows/deploy-landing.yml)
5
+ [![Release Please](https://github.com/fstubner/xtctx/actions/workflows/release-please.yml/badge.svg?branch=main)](https://github.com/fstubner/xtctx/actions/workflows/release-please.yml)
6
+ [![npm Publish](https://github.com/fstubner/xtctx/actions/workflows/publish.yml/badge.svg)](https://github.com/fstubner/xtctx/actions/workflows/publish.yml)
7
+ [![Latest Release](https://img.shields.io/github/v/release/fstubner/xtctx?display_name=tag&sort=semver)](https://github.com/fstubner/xtctx/releases)
6
8
  [![License](https://img.shields.io/github/license/fstubner/xtctx)](LICENSE)
7
- [![Node >=20](https://img.shields.io/badge/node-%3E%3D20-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
9
+ [![Node >=24](https://img.shields.io/badge/node-%3E%3D24-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
8
10
 
9
- xtctx is a local-first context runtime for AI coding assistants.
11
+ xtctx is local cross-tool handoff for AI coding agents.
10
12
 
11
- It lets Claude Code, Codex, Cursor, Copilot, and Gemini share the same project memory so you can switch tools without re-briefing each session.
13
+ It configures your project so the next tool you open can find recent local
14
+ transcript sessions and retrieve the raw messages through MCP. It does not run
15
+ a daemon, host an API, generate summaries, or maintain durable project memory.
12
16
 
13
- ## Core Capabilities
17
+ The intended user is a solo developer who switches between local coding agents
18
+ and wants the next agent to recover recent context without a pasted recap.
14
19
 
15
- - Cross-tool retrieval with MCP tools (`xtctx_search`, `xtctx_project_knowledge`, etc.)
16
- - Durable project knowledge in `.xtctx/knowledge`
17
- - File-first config sync into tool-native instruction files
18
- - One runtime process that serves:
19
- - MCP server
20
- - HTTP API (`/api/*`)
21
- - bundled web UI (`/`)
22
-
23
- ## Knowledge Types
24
-
25
- xtctx stores structured records as:
26
-
27
- - `decision`
28
- - `error_solution`
29
- - `insight`
30
- - `convention`
31
- - `gotcha`
32
- - `faq`
33
-
34
- ## Practical Workflow (Tool Handoff)
35
-
36
- 1. Start in your repo with `xtctx init`.
37
- 2. Define shared rules in `.xtctx/tool-config/shared.yaml`.
38
- 3. Run `xtctx sync` to generate managed sections for each tool.
39
- 4. Start `xtctx serve`.
40
- 5. At the beginning of every coding session:
41
- - call `xtctx_search`
42
- - call `xtctx_project_knowledge`
43
- 6. After finishing work, write outcomes back with:
44
- - `xtctx_save_decision`
45
- - `xtctx_save_error_solution`
46
- - `xtctx_save_insight`
47
- - `xtctx_save_faq`
48
-
49
- This gives a repeatable loop: recall -> implement -> write back.
50
-
51
- ## Quick Start
52
-
53
- Install and build:
54
-
55
- ```bash
56
- npm ci
57
- npm --prefix web ci
58
- npm --prefix landing ci
59
- npm run build
60
- ```
61
-
62
- Initialize project context:
63
-
64
- ```bash
65
- npx xtctx init
66
- ```
67
-
68
- Sync shared config into tool-native files:
69
-
70
- ```bash
71
- npx xtctx sync
72
- ```
73
-
74
- Start runtime services:
20
+ ## Workflow
75
21
 
76
22
  ```bash
77
- npx xtctx serve
23
+ npx -y xtctx setup
24
+ npx -y xtctx status
25
+ npx -y xtctx disconnect antigravity
78
26
  ```
79
27
 
80
- Open:
81
-
82
- - Runtime web app: `http://127.0.0.1:3232/`
83
- - Health: `http://127.0.0.1:3232/health`
84
- - API: `http://127.0.0.1:3232/api/*`
85
-
86
- Optional full re-index:
87
-
88
- ```bash
89
- npx xtctx ingest --full
90
- ```
91
-
92
- ## MCP Client Command
28
+ `xtctx setup` writes project-level MCP config with `npx -y xtctx`, installs
29
+ real hooks where a tool supports them, and writes managed instruction blocks
30
+ that point agents to the MCP retrieval tools. It also syncs selected project
31
+ skills from `.xtctx/skills` into verified native or adapter surfaces for
32
+ supported tools. Antigravity MCP is always written to the app-level config
33
+ because Antigravity has no project MCP file. Use `xtctx setup --global-mcp`
34
+ to also configure the global-only GitHub Copilot CLI surface.
35
+
36
+ `xtctx status` reports actual handoff state: config, MCP command, local SQLite
37
+ index, detected transcript stores, hook mode, managed-block drift, and stale
38
+ generated references. It also reports selected skills, generated skill targets,
39
+ target drift, and tools that do not have a verified skill surface.
40
+ It reports the current local cache rather than forcing a transcript scan. If
41
+ the index is empty, ask a configured agent to call `xtctx_recent_sessions`.
42
+
43
+ `xtctx disconnect <tool>` stops xtctx from managing one tool for the project.
44
+ It removes the xtctx MCP entry for that tool, removes managed instruction
45
+ blocks where that tool owns them, removes supported startup hooks, and marks the
46
+ tool disabled in `.xtctx/config.yaml`. It removes generated skill adapters for
47
+ that tool. It does not delete transcript sources, canonical project skills, or
48
+ the local SQLite cache. Use `xtctx disconnect --all` to remove xtctx from every
49
+ supported tool. Antigravity stores MCP config at app level, so
50
+ `xtctx disconnect antigravity` removes the xtctx entry from Antigravity for the
51
+ current user account.
52
+
53
+ Generated MCP clients should use:
93
54
 
94
55
  ```json
95
56
  {
96
- "command": "npx",
97
- "args": ["xtctx", "serve", "--mcp-only", "--project", "/absolute/path/to/project"]
57
+ "mcpServers": {
58
+ "xtctx": {
59
+ "command": "npx",
60
+ "args": ["-y", "xtctx"]
61
+ }
62
+ }
98
63
  }
99
64
  ```
100
65
 
101
- ## File-First Configuration
102
-
103
- Primary config source is `.xtctx/config.yaml`.
66
+ When invoked by an MCP client over stdio, bare `xtctx` starts the MCP server.
67
+ When invoked in a normal terminal, it shows the human CLI.
68
+
69
+ ## MCP Tools
70
+
71
+ - `xtctx_recent_sessions` lists recent indexed transcript sessions.
72
+ - `xtctx_session_detail` returns raw messages for a `session_ref`.
73
+ - `xtctx_search_sessions` hybrid-searches chronological transcript windows with local semantic vectors plus keyword fallback.
74
+ - `xtctx_continuity_status` reports wiring and local index diagnostics.
75
+ - `xtctx_handoff_manifest` returns a read-only orchestrator envelope with stable
76
+ session handoff IDs and pointers to raw-detail retrieval. A caller can attach
77
+ a correlation ID; xtctx echoes it but does not persist task state.
78
+
79
+ The MCP tools scan transcript stores lazily and update `.xtctx/state/xtctx.db`
80
+ on demand. The database is a rebuildable cache; the source transcripts remain
81
+ authoritative.
82
+
83
+ Semantic search embeds sliding windows of raw transcript turns, not generated
84
+ summaries. Window text includes role, timestamp, and message order so retrieval
85
+ can prefer the relevant point in the conversation, then return the matching
86
+ message range for `xtctx_session_detail`.
87
+
88
+ ## Supported Tools
89
+
90
+ - Claude Code
91
+ - Cursor
92
+ - Codex
93
+ - GitHub Copilot
94
+ - Google Antigravity
95
+ - opencode
96
+ - GitHub Copilot CLI
97
+
98
+ Each tool has a scraper for local handoff storage. Antigravity support reads
99
+ full transcript steps from the running local Antigravity language server when
100
+ it is available, and falls back to readable `brain` artifacts when the encrypted
101
+ `.pb` conversation store cannot be queried. Setup writes Antigravity MCP config
102
+ and a managed `GEMINI.md` handoff block (Antigravity CLI keeps project-memory
103
+ compatibility with that file). Some tools have native MCP config or executable
104
+ startup hooks; others receive MCP config plus managed instructions only.
105
+ `xtctx status` labels the real mode for each integration.
106
+
107
+ ## Limits
108
+
109
+ - xtctx is local-only. It does not upload transcripts or run telemetry.
110
+ - Transcript formats belong to each upstream tool and can drift. The drift
111
+ tests and nightly canary exist to catch parser breakage, but `xtctx status`
112
+ is still the source of truth for your machine.
113
+ - Semantic search is lazy. The first semantic or hybrid query may initialize
114
+ the local embedding provider and create local vectors; hybrid search falls
115
+ back to keyword search if vector generation is unavailable.
116
+ - Antigravity conversation `.pb` files are not parsed directly; retrieval uses
117
+ the local language-server API when available, otherwise readable `brain`
118
+ artifacts.
119
+
120
+ ## Skill Sync
121
+
122
+ Project skills live in `.xtctx/skills/<skill-id>/SKILL.md`. Fresh setup writes
123
+ the built-in `xtctx-handoff` skill. Interactive setup also inventories skills
124
+ from connected tool surfaces and lets you select which ones to keep in sync for
125
+ the project. Non-interactive `xtctx setup --yes` is conservative: it syncs the
126
+ built-in skill plus any skills already selected in `.xtctx/config.yaml`.
127
+
128
+ Skill sync uses real target surfaces only:
129
+
130
+ - Claude Code receives native project skills under `.claude/skills/`.
131
+ - Cursor receives generated rule adapters under `.cursor/rules/xtctx-skills/`.
132
+ - GitHub Copilot receives generated instruction adapters under `.github/instructions/`.
133
+ - Antigravity, Codex, opencode, and Copilot CLI receive skill pointers through
134
+ managed handoff blocks (`GEMINI.md` / `AGENTS.md` / Copilot instructions).
135
+ - Tools without a verified native or adapter surface are reported as unsupported.
136
+
137
+ ## Project Files
138
+
139
+ - `.xtctx/config.yaml`: project xtctx configuration
140
+ - `.xtctx/skills/<skill-id>/SKILL.md`: canonical local project skills
141
+ - `.xtctx/state/xtctx.db`: local handoff cache, never commit
142
+ - `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.cursor/rules/xtctx.mdc`, `.github/copilot-instructions.md`: managed handoff instructions where applicable
143
+
144
+ Content outside `<!-- xtctx:begin -->` / `<!-- xtctx:end -->` fences is
145
+ preserved. Run `xtctx setup --repair` to replace stale or duplicated generated
146
+ blocks.
104
147
 
105
- Environment variables are optional explicit overrides only.
106
-
107
- Security-related overrides:
108
-
109
- - `XTCTX_API_TOKEN`
110
- - `XTCTX_ALLOWED_ORIGINS`
111
- - `XTCTX_ALLOW_LOCALHOST_ORIGINS`
112
- - `XTCTX_RATE_LIMIT_WINDOW_MS`
113
- - `XTCTX_RATE_LIMIT_MAX`
114
-
115
- ## UIs
116
-
117
- - `web/`: runtime product UI served by `xtctx serve` (dark mode default with toggle)
118
- - `landing/`: public landing site deployed to GitHub Pages (dark mode default with toggle)
119
-
120
- Local previews:
148
+ ## Development
121
149
 
122
150
  ```bash
123
- npm run web:dev
124
- npm run landing:dev
125
- npm run landing:preview
151
+ npm ci
152
+ npm --prefix landing ci
153
+ npm run verify:release
126
154
  ```
127
155
 
128
- ## CLI Commands
129
-
130
- - `xtctx init [path]`
131
- - `xtctx serve [--mcp-only] [--project <path>]`
132
- - `xtctx ingest [--full] [--project <path>]`
133
- - `xtctx sync [--project <path>]`
134
-
135
- ## Development
136
-
137
- Full validation:
156
+ Useful focused checks:
138
157
 
139
158
  ```bash
140
- npm run verify:release
159
+ npm test
160
+ npm run test:drift
161
+ npm run lint
162
+ npm run build
163
+ npm run demo:public
141
164
  ```
142
165
 
143
- Release automation:
166
+ `npm run demo:public` creates synthetic Claude Code and Codex transcript stores
167
+ in a temporary project, starts the built MCP server, and calls the public
168
+ handoff tools. It does not scan private local transcript directories. See
169
+ [`docs/demo.md`](docs/demo.md).
170
+
171
+ ## Orchestrator Integration
172
+
173
+ xtctx is supporting fabric, not an orchestrator. An external control plane can
174
+ call `xtctx_handoff_manifest` to obtain project-scoped handoff IDs and the
175
+ corresponding `xtctx_session_detail` calls, then retain its own task, branch,
176
+ ownership, and scheduling state. See
177
+ [`docs/orchestrator-integration.md`](docs/orchestrator-integration.md).
144
178
 
145
- - Conventional commits feed Release Please
146
- - Release PR merge on `main` creates GitHub release
147
- - GitHub release publication triggers npm publish via OIDC trusted publishing
179
+ ## Release
148
180
 
149
- See `CONTRIBUTING.md` and `SECURITY.md` for contributor and security policy details.
181
+ Release Please manages versions and changelog. GitHub Releases publish to npm
182
+ through OIDC trusted publishing.
@@ -0,0 +1,8 @@
1
+ export interface DisconnectCliOptions {
2
+ projectPath?: string;
3
+ tool?: string;
4
+ all?: boolean;
5
+ yes?: boolean;
6
+ }
7
+ export declare function runDisconnect(options?: DisconnectCliOptions): Promise<void>;
8
+ //# sourceMappingURL=disconnect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disconnect.d.ts","sourceRoot":"","sources":["../../../src/cli/disconnect.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAerF"}
@@ -0,0 +1,42 @@
1
+ import { createInterface } from "node:readline/promises";
2
+ import { stdin as input, stdout as output } from "node:process";
3
+ import { describeDisconnectPlan, disconnectProject, printDisconnectResult, } from "../config/disconnect.js";
4
+ export async function runDisconnect(options = {}) {
5
+ if (!options.yes) {
6
+ const confirmed = await confirmDisconnect(options);
7
+ if (!confirmed) {
8
+ process.stdout.write("xtctx disconnect cancelled.\n");
9
+ return;
10
+ }
11
+ }
12
+ const result = await disconnectProject({
13
+ projectPath: options.projectPath,
14
+ tool: options.tool,
15
+ all: options.all,
16
+ });
17
+ printDisconnectResult(result);
18
+ }
19
+ async function confirmDisconnect(options) {
20
+ const plan = describeDisconnectPlan(options);
21
+ process.stdout.write(`xtctx disconnect will remove handoff management for ${plan.tools.join(", ")}\n`);
22
+ process.stdout.write(`Project: ${plan.projectRoot}\n`);
23
+ for (const write of plan.writes) {
24
+ const note = write.note ? ` (${write.note})` : "";
25
+ process.stdout.write(` ${write.kind.padEnd(22)} ${write.path}${note}\n`);
26
+ }
27
+ for (const warning of plan.warnings) {
28
+ process.stdout.write(` warning ${warning}\n`);
29
+ }
30
+ if (input.isTTY !== true || output.isTTY !== true) {
31
+ throw new Error("Refusing non-interactive disconnect without --yes.");
32
+ }
33
+ const rl = createInterface({ input, output });
34
+ try {
35
+ const answer = await rl.question("Apply these changes? [y/N] ");
36
+ return answer.trim().toLowerCase() === "y" || answer.trim().toLowerCase() === "yes";
37
+ }
38
+ finally {
39
+ rl.close();
40
+ }
41
+ }
42
+ //# sourceMappingURL=disconnect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disconnect.js","sourceRoot":"","sources":["../../../src/cli/disconnect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AASjC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAgC,EAAE;IACpE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC;QACrC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;IACH,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,OAA6B;IAC5D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CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface HookOptions {
2
+ projectPath?: string;
3
+ tool?: string;
4
+ event?: string;
5
+ }
6
+ export declare function runHook(options?: HookOptions): Promise<void>;
7
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/cli/hook.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,OAAO,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BtE"}
@@ -0,0 +1,32 @@
1
+ import { createProjectServices } from "../runtime/services.js";
2
+ export async function runHook(options = {}) {
3
+ if (options.event && options.event !== "session-start") {
4
+ return;
5
+ }
6
+ // Fail open throughout: this runs inside the host agent's session startup,
7
+ // so a broken index or config must never surface as a startup error there.
8
+ let services;
9
+ try {
10
+ services = await createProjectServices(options.projectPath);
11
+ const status = await services.sessions.getStatus();
12
+ const tool = options.tool ?? "unknown";
13
+ process.stdout.write([
14
+ "# xtctx handoff",
15
+ "",
16
+ `Tool: ${tool}`,
17
+ `Project root: ${services.projectRoot}`,
18
+ `Last scan: ${status.last_scan_at ?? "never"}`,
19
+ "",
20
+ "Recent transcript context is available through MCP.",
21
+ "Call `xtctx_recent_sessions`, then `xtctx_session_detail` for relevant sessions.",
22
+ "",
23
+ ].join("\n"));
24
+ }
25
+ catch {
26
+ return;
27
+ }
28
+ finally {
29
+ await services?.sessions.close().catch(() => { });
30
+ }
31
+ }
32
+ //# sourceMappingURL=hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.js","sourceRoot":"","sources":["../../../src/cli/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAQ/D,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,UAAuB,EAAE;IACrD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,KAAK,eAAe,EAAE,CAAC;QACvD,OAAO;IACT,CAAC;IAED,2EAA2E;IAC3E,2EAA2E;IAC3E,IAAI,QAAuE,CAAC;IAC5E,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC;QAEvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB;YACE,iBAAiB;YACjB,EAAE;YACF,SAAS,IAAI,EAAE;YACf,iBAAiB,QAAQ,CAAC,WAAW,EAAE;YACvC,cAAc,MAAM,CAAC,YAAY,IAAI,OAAO,EAAE;YAC9C,EAAE;YACF,qDAAqD;YACrD,kFAAkF;YAClF,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":";AASA,wBAAsB,IAAI,CAAC,IAAI,WAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAkD7D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":";AAYA,wBAAsB,IAAI,CAAC,IAAI,WAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAsG7D"}
@@ -1,55 +1,108 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
- import { runIngest } from "./ingest.js";
4
- import { runInit } from "./init.js";
5
- import { runServe } from "./serve.js";
6
- import { runSync } from "./sync.js";
7
- const CLI_VERSION = "0.1.0";
3
+ import { runDisconnect } from "./disconnect.js";
4
+ import { runHook } from "./hook.js";
5
+ import { runSetup } from "./setup.js";
6
+ import { runStatus } from "./status.js";
7
+ import { createProjectServices } from "../runtime/services.js";
8
+ import { startMcpServer } from "../mcp/server.js";
9
+ import { readXtctxPackage } from "../utils/package-info.js";
10
+ const { version: CLI_VERSION } = readXtctxPackage(import.meta.url);
8
11
  export async function main(argv = process.argv) {
12
+ if (shouldStartMcp(argv)) {
13
+ const services = await createProjectServices(process.cwd());
14
+ let closed = false;
15
+ const shutdown = (exit) => {
16
+ if (closed)
17
+ return;
18
+ closed = true;
19
+ void services.sessions
20
+ .close()
21
+ .catch(() => { })
22
+ .finally(() => {
23
+ if (exit)
24
+ process.exit(0);
25
+ });
26
+ };
27
+ process.once("SIGINT", () => shutdown(true));
28
+ process.once("SIGTERM", () => shutdown(true));
29
+ await startMcpServer({ sessions: services.sessions }, () => shutdown(false));
30
+ return;
31
+ }
9
32
  const program = new Command();
10
33
  program
11
34
  .name("xtctx")
12
- .description("Cross-tool context for AI coding agents")
13
- .version(CLI_VERSION);
35
+ .description("Local cross-tool handoff for AI coding agents")
36
+ .version(CLI_VERSION)
37
+ .showHelpAfterError();
14
38
  program
15
- .command("init")
16
- .argument("[projectPath]", "Project root to initialize")
17
- .option("-f, --force", "Overwrite existing xtctx config files", false)
18
- .description("Scaffold .xtctx in the target project")
39
+ .command("setup")
40
+ .argument("[projectPath]", "Project root to configure")
41
+ .option("-p, --project <path>", "Project root to configure")
42
+ .option("-y, --yes", "Apply setup without prompting", false)
43
+ .option("--repair", "Remove legacy generated xtctx config before writing current setup", false)
44
+ .option("--global-mcp", "Also configure Copilot CLI global MCP (Antigravity MCP is always configured)", false)
45
+ .description("Configure MCP, hooks, managed handoff instructions, and synced skills")
19
46
  .action(async (projectPath, options) => {
20
- await runInit({ projectPath, force: options.force });
21
- });
22
- program
23
- .command("serve")
24
- .option("-p, --project <path>", "Project root (defaults to cwd)")
25
- .option("--mcp-only", "Only start MCP server (skip ingestion/web notices)", false)
26
- .description("Start xtctx services (currently MCP server)")
27
- .action(async (options) => {
28
- await runServe({
29
- projectPath: options.project,
30
- mcpOnly: options.mcpOnly,
47
+ const globalOptions = program.opts();
48
+ await runSetup({
49
+ projectPath: options.project ?? globalOptions.project ?? projectPath,
50
+ yes: options.yes,
51
+ repair: options.repair,
52
+ includeGlobalMcp: options.globalMcp,
31
53
  });
32
54
  });
33
55
  program
34
- .command("sync")
56
+ .command("status")
35
57
  .option("-p, --project <path>", "Project root (defaults to cwd)")
36
- .description("Generate tool-native config files from shared config")
58
+ .description("Diagnose xtctx handoff wiring and local transcript index")
37
59
  .action(async (options) => {
38
- await runSync({ projectPath: options.project });
60
+ const globalOptions = program.opts();
61
+ await runStatus({ projectPath: options.project ?? globalOptions.project });
39
62
  });
40
63
  program
41
- .command("ingest")
42
- .option("-p, --project <path>", "Project root (defaults to cwd)")
43
- .option("--full", "Run a full re-sync instead of incremental", false)
44
- .description("Manually trigger ingestion")
45
- .action(async (options) => {
46
- await runIngest({
47
- projectPath: options.project,
48
- full: options.full,
64
+ .command("disconnect")
65
+ .argument("[tool]", "Tool to stop managing for this project")
66
+ .option("--all", "Disconnect xtctx from all supported tools", false)
67
+ .option("-p, --project <path>", "Project root")
68
+ .option("-y, --yes", "Apply disconnect without prompting", false)
69
+ .description("Remove xtctx management from a tool without deleting transcript data")
70
+ .action(async (tool, options) => {
71
+ const globalOptions = program.opts();
72
+ await runDisconnect({
73
+ tool,
74
+ all: options.all,
75
+ projectPath: options.project ?? globalOptions.project,
76
+ yes: options.yes,
49
77
  });
50
78
  });
79
+ program
80
+ .option("--hook <event>", "Internal hook event name")
81
+ .option("--tool <tool>", "Tool invoking an internal hook")
82
+ .option("-p, --project <path>", "Project root");
83
+ program.action(async () => {
84
+ const options = program.opts();
85
+ if (options.hook) {
86
+ await runHook({
87
+ event: options.hook,
88
+ tool: options.tool,
89
+ projectPath: options.project,
90
+ });
91
+ return;
92
+ }
93
+ program.outputHelp();
94
+ });
51
95
  await program.parseAsync(argv);
52
96
  }
97
+ function shouldStartMcp(argv) {
98
+ if (argv.length > 2) {
99
+ return false;
100
+ }
101
+ if (process.env.XTCTX_NO_AUTO_MCP === "1") {
102
+ return false;
103
+ }
104
+ return process.stdin.isTTY !== true && process.stdout.isTTY !== true;
105
+ }
53
106
  main().catch((error) => {
54
107
  const message = error instanceof Error ? error.message : String(error);
55
108
  console.error(message);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI;IAC5C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,OAAO,CAAC;SACb,WAAW,CAAC,yCAAyC,CAAC;SACtD,OAAO,CAAC,WAAW,CAAC,CAAC;IAExB,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,eAAe,EAAE,4BAA4B,CAAC;SACvD,MAAM,CAAC,aAAa,EAAE,uCAAuC,EAAE,KAAK,CAAC;SACrE,WAAW,CAAC,uCAAuC,CAAC;SACpD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AC"}
@@ -0,0 +1,8 @@
1
+ export interface SetupCliOptions {
2
+ projectPath?: string;
3
+ yes?: boolean;
4
+ repair?: boolean;
5
+ includeGlobalMcp?: boolean;
6
+ }
7
+ export declare function runSetup(options?: SetupCliOptions): Promise<void>;
8
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/cli/setup.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAsB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB3E"}