prjct-cli 1.22.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/bin/prjct +30 -13
  3. package/dist/bin/prjct.mjs +917 -35845
  4. package/dist/bin/prjct.mjs.map +7 -0
  5. package/dist/cli/linear.mjs +16 -0
  6. package/dist/cli/linear.mjs.map +7 -0
  7. package/dist/templates.json +1 -0
  8. package/package.json +4 -5
  9. package/bin/prjct.ts +0 -342
  10. package/core/__tests__/agentic/analysis-injection.test.ts +0 -377
  11. package/core/__tests__/agentic/cache-eviction.test.ts +0 -294
  12. package/core/__tests__/agentic/command-context.test.ts +0 -281
  13. package/core/__tests__/agentic/command-executor.test.ts +0 -659
  14. package/core/__tests__/agentic/domain-classifier.test.ts +0 -330
  15. package/core/__tests__/agentic/injection-validator.test.ts +0 -255
  16. package/core/__tests__/agentic/memory-system.test.ts +0 -281
  17. package/core/__tests__/agentic/plan-mode.test.ts +0 -386
  18. package/core/__tests__/agentic/prompt-assembly.test.ts +0 -298
  19. package/core/__tests__/agentic/prompt-builder.test.ts +0 -243
  20. package/core/__tests__/agentic/response-validator.test.ts +0 -263
  21. package/core/__tests__/agentic/semantic-matching.test.ts +0 -131
  22. package/core/__tests__/agentic/smart-context.test.ts +0 -372
  23. package/core/__tests__/agentic/tech-normalizer.test.ts +0 -136
  24. package/core/__tests__/agentic/token-budget.test.ts +0 -294
  25. package/core/__tests__/ai-tools/formatters.test.ts +0 -476
  26. package/core/__tests__/domain/bm25.test.ts +0 -225
  27. package/core/__tests__/domain/change-propagator.test.ts +0 -100
  28. package/core/__tests__/domain/fibonacci.test.ts +0 -113
  29. package/core/__tests__/domain/file-hasher.test.ts +0 -146
  30. package/core/__tests__/domain/file-ranker.test.ts +0 -169
  31. package/core/__tests__/domain/git-cochange.test.ts +0 -121
  32. package/core/__tests__/domain/import-graph.test.ts +0 -156
  33. package/core/__tests__/domain/velocity.test.ts +0 -623
  34. package/core/__tests__/infrastructure/performance-tracker.test.ts +0 -328
  35. package/core/__tests__/schemas/model.test.ts +0 -272
  36. package/core/__tests__/services/dependency-validator.test.ts +0 -175
  37. package/core/__tests__/services/hierarchical-agent-resolver.test.ts +0 -359
  38. package/core/__tests__/services/nested-context-resolver.test.ts +0 -443
  39. package/core/__tests__/services/project-index.test.ts +0 -355
  40. package/core/__tests__/services/staleness-checker.test.ts +0 -204
  41. package/core/__tests__/storage/analysis-storage.test.ts +0 -641
  42. package/core/__tests__/storage/archive-storage.test.ts +0 -455
  43. package/core/__tests__/storage/safe-reader.test.ts +0 -262
  44. package/core/__tests__/storage/sqlite-migration.test.ts +0 -1016
  45. package/core/__tests__/storage/state-storage-feedback.test.ts +0 -463
  46. package/core/__tests__/storage/state-storage-history.test.ts +0 -469
  47. package/core/__tests__/storage/storage-manager.test.ts +0 -383
  48. package/core/__tests__/storage/subtask-handoff.test.ts +0 -237
  49. package/core/__tests__/types/fs.test.ts +0 -125
  50. package/core/__tests__/utils/date-helper.test.ts +0 -449
  51. package/core/__tests__/utils/output.test.ts +0 -278
  52. package/core/__tests__/utils/preserve-sections.test.ts +0 -216
  53. package/core/__tests__/utils/project-commands.test.ts +0 -71
  54. package/core/__tests__/utils/retry.test.ts +0 -381
  55. package/core/__tests__/workflow/state-machine.test.ts +0 -216
  56. package/core/agentic/agent-router.ts +0 -150
  57. package/core/agentic/anti-hallucination.ts +0 -141
  58. package/core/agentic/chain-of-thought.ts +0 -234
  59. package/core/agentic/command-classifier.ts +0 -141
  60. package/core/agentic/command-context.ts +0 -168
  61. package/core/agentic/command-executor.ts +0 -471
  62. package/core/agentic/context-builder.ts +0 -285
  63. package/core/agentic/domain-classifier.ts +0 -525
  64. package/core/agentic/environment-block.ts +0 -102
  65. package/core/agentic/ground-truth.ts +0 -706
  66. package/core/agentic/index.ts +0 -193
  67. package/core/agentic/injection-validator.ts +0 -208
  68. package/core/agentic/loop-detector.ts +0 -451
  69. package/core/agentic/memory-system.ts +0 -1547
  70. package/core/agentic/orchestrator-executor.ts +0 -579
  71. package/core/agentic/plan-mode.ts +0 -525
  72. package/core/agentic/prompt-builder.ts +0 -1069
  73. package/core/agentic/response-validator.ts +0 -98
  74. package/core/agentic/services.ts +0 -167
  75. package/core/agentic/skill-loader.ts +0 -106
  76. package/core/agentic/smart-context.ts +0 -393
  77. package/core/agentic/tech-normalizer.ts +0 -167
  78. package/core/agentic/template-executor.ts +0 -272
  79. package/core/agentic/template-loader.ts +0 -109
  80. package/core/agentic/token-budget.ts +0 -226
  81. package/core/agentic/tool-registry.ts +0 -146
  82. package/core/agents/index.ts +0 -28
  83. package/core/agents/performance.ts +0 -429
  84. package/core/ai-tools/formatters.ts +0 -341
  85. package/core/ai-tools/generator.ts +0 -144
  86. package/core/ai-tools/index.ts +0 -15
  87. package/core/ai-tools/registry.ts +0 -201
  88. package/core/bus/bus.ts +0 -314
  89. package/core/bus/index.ts +0 -8
  90. package/core/cli/linear.ts +0 -500
  91. package/core/cli/lint-meta-commentary.ts +0 -177
  92. package/core/cli/start.ts +0 -386
  93. package/core/commands/analysis.ts +0 -1274
  94. package/core/commands/analytics.ts +0 -342
  95. package/core/commands/base.ts +0 -118
  96. package/core/commands/cleanup.ts +0 -157
  97. package/core/commands/command-data.ts +0 -463
  98. package/core/commands/commands.ts +0 -306
  99. package/core/commands/context.ts +0 -238
  100. package/core/commands/design.ts +0 -77
  101. package/core/commands/index.ts +0 -19
  102. package/core/commands/maintenance.ts +0 -77
  103. package/core/commands/performance.ts +0 -114
  104. package/core/commands/planning.ts +0 -662
  105. package/core/commands/register.ts +0 -127
  106. package/core/commands/registry.ts +0 -444
  107. package/core/commands/setup.ts +0 -280
  108. package/core/commands/shipping.ts +0 -267
  109. package/core/commands/snapshots.ts +0 -297
  110. package/core/commands/uninstall.ts +0 -542
  111. package/core/commands/velocity.ts +0 -149
  112. package/core/commands/workflow.ts +0 -505
  113. package/core/config/command-context.config.json +0 -66
  114. package/core/constants/index.ts +0 -379
  115. package/core/context/generator.ts +0 -368
  116. package/core/context-tools/files-tool.ts +0 -577
  117. package/core/context-tools/imports-tool.ts +0 -400
  118. package/core/context-tools/index.ts +0 -434
  119. package/core/context-tools/recent-tool.ts +0 -301
  120. package/core/context-tools/signatures-tool.ts +0 -495
  121. package/core/context-tools/summary-tool.ts +0 -301
  122. package/core/context-tools/token-counter.ts +0 -273
  123. package/core/context-tools/types.ts +0 -253
  124. package/core/domain/agent-generator.ts +0 -186
  125. package/core/domain/agent-loader.ts +0 -419
  126. package/core/domain/analyzer.ts +0 -387
  127. package/core/domain/architecture-generator.ts +0 -108
  128. package/core/domain/bm25.ts +0 -525
  129. package/core/domain/change-propagator.ts +0 -162
  130. package/core/domain/context-estimator.ts +0 -175
  131. package/core/domain/fibonacci.ts +0 -128
  132. package/core/domain/file-hasher.ts +0 -296
  133. package/core/domain/file-ranker.ts +0 -151
  134. package/core/domain/git-cochange.ts +0 -250
  135. package/core/domain/import-graph.ts +0 -315
  136. package/core/domain/snapshot-manager.ts +0 -415
  137. package/core/domain/task-stack.ts +0 -578
  138. package/core/domain/velocity.ts +0 -470
  139. package/core/errors.ts +0 -335
  140. package/core/events/events.ts +0 -85
  141. package/core/events/index.ts +0 -8
  142. package/core/index.ts +0 -481
  143. package/core/infrastructure/agent-detector.ts +0 -135
  144. package/core/infrastructure/ai-provider.ts +0 -578
  145. package/core/infrastructure/author-detector.ts +0 -133
  146. package/core/infrastructure/capability-installer.ts +0 -76
  147. package/core/infrastructure/claude-agent.ts +0 -297
  148. package/core/infrastructure/command-installer.ts +0 -752
  149. package/core/infrastructure/config-manager.ts +0 -364
  150. package/core/infrastructure/editors-config.ts +0 -172
  151. package/core/infrastructure/path-manager.ts +0 -571
  152. package/core/infrastructure/performance-tracker.ts +0 -326
  153. package/core/infrastructure/permission-manager.ts +0 -289
  154. package/core/infrastructure/setup.ts +0 -1061
  155. package/core/infrastructure/update-checker.ts +0 -246
  156. package/core/integrations/issue-tracker/enricher.ts +0 -271
  157. package/core/integrations/issue-tracker/index.ts +0 -8
  158. package/core/integrations/issue-tracker/manager.ts +0 -286
  159. package/core/integrations/issue-tracker/types.ts +0 -310
  160. package/core/integrations/jira/cache.ts +0 -57
  161. package/core/integrations/jira/client.ts +0 -688
  162. package/core/integrations/jira/index.ts +0 -23
  163. package/core/integrations/jira/service.ts +0 -244
  164. package/core/integrations/linear/cache.ts +0 -68
  165. package/core/integrations/linear/client.ts +0 -436
  166. package/core/integrations/linear/index.ts +0 -20
  167. package/core/integrations/linear/service.ts +0 -260
  168. package/core/integrations/linear/sync.ts +0 -314
  169. package/core/outcomes/analyzer.ts +0 -286
  170. package/core/outcomes/index.ts +0 -34
  171. package/core/outcomes/recorder.ts +0 -195
  172. package/core/plugin/builtin/webhook.ts +0 -148
  173. package/core/plugin/hooks.ts +0 -315
  174. package/core/plugin/index.ts +0 -50
  175. package/core/plugin/loader.ts +0 -354
  176. package/core/plugin/registry.ts +0 -326
  177. package/core/schemas/agents.ts +0 -27
  178. package/core/schemas/analysis.ts +0 -530
  179. package/core/schemas/classification.ts +0 -91
  180. package/core/schemas/command-context.ts +0 -29
  181. package/core/schemas/enriched-task.ts +0 -291
  182. package/core/schemas/ideas.ts +0 -114
  183. package/core/schemas/index.ts +0 -53
  184. package/core/schemas/issues.ts +0 -159
  185. package/core/schemas/llm-output.ts +0 -170
  186. package/core/schemas/metrics.ts +0 -143
  187. package/core/schemas/model.ts +0 -153
  188. package/core/schemas/outcomes.ts +0 -487
  189. package/core/schemas/performance.ts +0 -128
  190. package/core/schemas/permissions.ts +0 -180
  191. package/core/schemas/prd.ts +0 -450
  192. package/core/schemas/project.ts +0 -57
  193. package/core/schemas/roadmap.ts +0 -322
  194. package/core/schemas/schemas.ts +0 -38
  195. package/core/schemas/shipped.ts +0 -109
  196. package/core/schemas/state.ts +0 -284
  197. package/core/schemas/velocity.ts +0 -103
  198. package/core/server/index.ts +0 -21
  199. package/core/server/routes-extended.ts +0 -566
  200. package/core/server/routes.ts +0 -176
  201. package/core/server/server.ts +0 -149
  202. package/core/server/sse.ts +0 -192
  203. package/core/services/agent-generator.ts +0 -385
  204. package/core/services/agent-service.ts +0 -168
  205. package/core/services/breakdown-service.ts +0 -124
  206. package/core/services/context-generator.ts +0 -445
  207. package/core/services/context-selector.ts +0 -429
  208. package/core/services/dependency-validator.ts +0 -318
  209. package/core/services/diff-generator.ts +0 -313
  210. package/core/services/doctor-service.ts +0 -423
  211. package/core/services/file-categorizer.ts +0 -448
  212. package/core/services/file-scorer.ts +0 -270
  213. package/core/services/git-analyzer.ts +0 -293
  214. package/core/services/hierarchical-agent-resolver.ts +0 -236
  215. package/core/services/hooks-service.ts +0 -685
  216. package/core/services/index.ts +0 -46
  217. package/core/services/local-state-generator.ts +0 -158
  218. package/core/services/memory-service.ts +0 -181
  219. package/core/services/nested-context-resolver.ts +0 -842
  220. package/core/services/project-index.ts +0 -911
  221. package/core/services/project-service.ts +0 -155
  222. package/core/services/session-tracker.ts +0 -287
  223. package/core/services/skill-installer.ts +0 -447
  224. package/core/services/skill-lock.ts +0 -132
  225. package/core/services/skill-service.ts +0 -306
  226. package/core/services/stack-detector.ts +0 -229
  227. package/core/services/staleness-checker.ts +0 -327
  228. package/core/services/sync-service.ts +0 -1515
  229. package/core/services/sync-verifier.ts +0 -253
  230. package/core/services/watch-service.ts +0 -312
  231. package/core/session/compaction.ts +0 -248
  232. package/core/session/index.ts +0 -35
  233. package/core/session/log-migration.ts +0 -88
  234. package/core/session/metrics.ts +0 -323
  235. package/core/session/session-log-manager.ts +0 -307
  236. package/core/session/task-session-manager.ts +0 -404
  237. package/core/session/utils.ts +0 -51
  238. package/core/storage/analysis-storage.ts +0 -373
  239. package/core/storage/archive-storage.ts +0 -205
  240. package/core/storage/database.ts +0 -575
  241. package/core/storage/ideas-storage.ts +0 -298
  242. package/core/storage/index-storage.ts +0 -523
  243. package/core/storage/index.ts +0 -79
  244. package/core/storage/metrics-storage.ts +0 -321
  245. package/core/storage/migrate-json.ts +0 -720
  246. package/core/storage/queue-storage.ts +0 -336
  247. package/core/storage/safe-reader.ts +0 -105
  248. package/core/storage/shipped-storage.ts +0 -253
  249. package/core/storage/state-storage.ts +0 -1035
  250. package/core/storage/storage-manager.ts +0 -205
  251. package/core/storage/storage.ts +0 -177
  252. package/core/storage/velocity-storage.ts +0 -149
  253. package/core/sync/auth-config.ts +0 -138
  254. package/core/sync/index.ts +0 -31
  255. package/core/sync/oauth-handler.ts +0 -143
  256. package/core/sync/sync-client.ts +0 -251
  257. package/core/sync/sync-manager.ts +0 -327
  258. package/core/tsconfig.json +0 -22
  259. package/core/types/agentic.ts +0 -760
  260. package/core/types/agents.ts +0 -150
  261. package/core/types/bus.ts +0 -193
  262. package/core/types/citations.ts +0 -22
  263. package/core/types/commands.ts +0 -399
  264. package/core/types/config.ts +0 -92
  265. package/core/types/core.ts +0 -96
  266. package/core/types/diff.ts +0 -41
  267. package/core/types/domain.ts +0 -71
  268. package/core/types/errors.ts +0 -111
  269. package/core/types/events.ts +0 -42
  270. package/core/types/fs.ts +0 -72
  271. package/core/types/index.ts +0 -510
  272. package/core/types/infrastructure.ts +0 -210
  273. package/core/types/integrations.ts +0 -31
  274. package/core/types/jira.ts +0 -51
  275. package/core/types/logger.ts +0 -17
  276. package/core/types/memory.ts +0 -313
  277. package/core/types/outcomes.ts +0 -190
  278. package/core/types/output.ts +0 -47
  279. package/core/types/plugin.ts +0 -25
  280. package/core/types/project-sync.ts +0 -129
  281. package/core/types/provider.ts +0 -163
  282. package/core/types/server.ts +0 -71
  283. package/core/types/services.ts +0 -84
  284. package/core/types/session.ts +0 -135
  285. package/core/types/stack.ts +0 -19
  286. package/core/types/storage.ts +0 -318
  287. package/core/types/sync-verifier.ts +0 -33
  288. package/core/types/sync.ts +0 -121
  289. package/core/types/task.ts +0 -72
  290. package/core/types/template.ts +0 -24
  291. package/core/types/utils.ts +0 -92
  292. package/core/types/workflow.ts +0 -23
  293. package/core/utils/agent-stream.ts +0 -140
  294. package/core/utils/animations.ts +0 -251
  295. package/core/utils/branding.ts +0 -88
  296. package/core/utils/cache.ts +0 -187
  297. package/core/utils/citations.ts +0 -39
  298. package/core/utils/collection-filters.ts +0 -209
  299. package/core/utils/date-helper.ts +0 -176
  300. package/core/utils/error-messages.ts +0 -38
  301. package/core/utils/file-helper.ts +0 -277
  302. package/core/utils/fs-helpers.ts +0 -14
  303. package/core/utils/help.ts +0 -314
  304. package/core/utils/jsonl-helper.ts +0 -290
  305. package/core/utils/keychain.ts +0 -127
  306. package/core/utils/logger.ts +0 -77
  307. package/core/utils/markdown-builder.ts +0 -280
  308. package/core/utils/next-steps.ts +0 -95
  309. package/core/utils/output.ts +0 -403
  310. package/core/utils/preserve-sections.ts +0 -218
  311. package/core/utils/project-commands.ts +0 -126
  312. package/core/utils/project-credentials.ts +0 -143
  313. package/core/utils/provider-cache.ts +0 -49
  314. package/core/utils/retry.ts +0 -318
  315. package/core/utils/runtime.ts +0 -108
  316. package/core/utils/session-helper.ts +0 -278
  317. package/core/utils/subtask-table.ts +0 -227
  318. package/core/utils/version.ts +0 -128
  319. package/core/wizard/index.ts +0 -13
  320. package/core/wizard/onboarding.ts +0 -633
  321. package/core/workflow/index.ts +0 -7
  322. package/core/workflow/state-machine.ts +0 -198
  323. package/core/workflow/workflow-preferences.ts +0 -294
  324. package/dist/core/infrastructure/command-installer.js +0 -1141
  325. package/dist/core/infrastructure/editors-config.js +0 -177
  326. package/dist/core/infrastructure/setup.js +0 -2244
  327. package/dist/core/utils/version.js +0 -141
  328. package/templates/agentic/agent-routing.md +0 -45
  329. package/templates/agentic/agents/uxui.md +0 -63
  330. package/templates/agentic/checklist-routing.md +0 -98
  331. package/templates/agentic/orchestrator.md +0 -68
  332. package/templates/agentic/task-fragmentation.md +0 -89
  333. package/templates/agents/AGENTS.md +0 -68
  334. package/templates/analysis/analyze.md +0 -84
  335. package/templates/analysis/patterns.md +0 -60
  336. package/templates/antigravity/SKILL.md +0 -39
  337. package/templates/architect/discovery.md +0 -67
  338. package/templates/architect/phases.md +0 -59
  339. package/templates/checklists/architecture.md +0 -28
  340. package/templates/checklists/code-quality.md +0 -28
  341. package/templates/checklists/data.md +0 -33
  342. package/templates/checklists/documentation.md +0 -33
  343. package/templates/checklists/infrastructure.md +0 -33
  344. package/templates/checklists/performance.md +0 -33
  345. package/templates/checklists/security.md +0 -33
  346. package/templates/checklists/testing.md +0 -33
  347. package/templates/checklists/ux-ui.md +0 -37
  348. package/templates/commands/analyze.md +0 -56
  349. package/templates/commands/auth.md +0 -234
  350. package/templates/commands/bug.md +0 -163
  351. package/templates/commands/cleanup.md +0 -19
  352. package/templates/commands/dash.md +0 -99
  353. package/templates/commands/design.md +0 -15
  354. package/templates/commands/done.md +0 -291
  355. package/templates/commands/enrich.md +0 -174
  356. package/templates/commands/git.md +0 -295
  357. package/templates/commands/history.md +0 -389
  358. package/templates/commands/idea.md +0 -88
  359. package/templates/commands/impact.md +0 -864
  360. package/templates/commands/init.md +0 -54
  361. package/templates/commands/jira.md +0 -278
  362. package/templates/commands/linear.md +0 -288
  363. package/templates/commands/merge.md +0 -206
  364. package/templates/commands/next.md +0 -80
  365. package/templates/commands/p.md +0 -67
  366. package/templates/commands/p.toml +0 -37
  367. package/templates/commands/pause.md +0 -136
  368. package/templates/commands/plan.md +0 -696
  369. package/templates/commands/prd.md +0 -356
  370. package/templates/commands/resume.md +0 -171
  371. package/templates/commands/review.md +0 -276
  372. package/templates/commands/serve.md +0 -118
  373. package/templates/commands/setup.md +0 -91
  374. package/templates/commands/ship.md +0 -475
  375. package/templates/commands/skill.md +0 -259
  376. package/templates/commands/spec.md +0 -218
  377. package/templates/commands/status.md +0 -207
  378. package/templates/commands/sync.md +0 -104
  379. package/templates/commands/task.md +0 -312
  380. package/templates/commands/test.md +0 -93
  381. package/templates/commands/update.md +0 -63
  382. package/templates/commands/verify.md +0 -204
  383. package/templates/commands/workflow.md +0 -150
  384. package/templates/config/skill-mappings.json +0 -82
  385. package/templates/context/dashboard.md +0 -256
  386. package/templates/context/roadmap.md +0 -221
  387. package/templates/cursor/commands/bug.md +0 -8
  388. package/templates/cursor/commands/done.md +0 -4
  389. package/templates/cursor/commands/pause.md +0 -6
  390. package/templates/cursor/commands/resume.md +0 -4
  391. package/templates/cursor/commands/ship.md +0 -8
  392. package/templates/cursor/commands/sync.md +0 -4
  393. package/templates/cursor/commands/task.md +0 -8
  394. package/templates/cursor/p.md +0 -29
  395. package/templates/cursor/router.mdc +0 -28
  396. package/templates/design/api.md +0 -95
  397. package/templates/design/architecture.md +0 -77
  398. package/templates/design/component.md +0 -89
  399. package/templates/design/database.md +0 -78
  400. package/templates/design/flow.md +0 -94
  401. package/templates/global/ANTIGRAVITY.md +0 -254
  402. package/templates/global/CLAUDE.md +0 -497
  403. package/templates/global/CURSOR.mdc +0 -266
  404. package/templates/global/GEMINI.md +0 -293
  405. package/templates/global/STORAGE-SPEC.md +0 -391
  406. package/templates/global/WINDSURF.md +0 -266
  407. package/templates/global/modules/CLAUDE-commands.md +0 -70
  408. package/templates/global/modules/CLAUDE-core.md +0 -105
  409. package/templates/global/modules/CLAUDE-git.md +0 -50
  410. package/templates/global/modules/CLAUDE-intelligence.md +0 -92
  411. package/templates/global/modules/CLAUDE-storage.md +0 -50
  412. package/templates/global/modules/module-config.json +0 -36
  413. package/templates/mcp-config.json +0 -19
  414. package/templates/permissions/default.jsonc +0 -60
  415. package/templates/permissions/permissive.jsonc +0 -49
  416. package/templates/permissions/strict.jsonc +0 -58
  417. package/templates/planning-methodology.md +0 -195
  418. package/templates/skills/code-review.md +0 -47
  419. package/templates/skills/debug.md +0 -61
  420. package/templates/skills/refactor.md +0 -47
  421. package/templates/subagents/agent-base.md +0 -20
  422. package/templates/subagents/domain/backend.md +0 -109
  423. package/templates/subagents/domain/database.md +0 -121
  424. package/templates/subagents/domain/devops.md +0 -152
  425. package/templates/subagents/domain/frontend.md +0 -103
  426. package/templates/subagents/domain/testing.md +0 -169
  427. package/templates/subagents/pm-expert.md +0 -366
  428. package/templates/subagents/workflow/chief-architect.md +0 -657
  429. package/templates/subagents/workflow/prjct-planner.md +0 -159
  430. package/templates/subagents/workflow/prjct-shipper.md +0 -188
  431. package/templates/subagents/workflow/prjct-workflow.md +0 -98
  432. package/templates/tools/bash.txt +0 -22
  433. package/templates/tools/edit.txt +0 -18
  434. package/templates/tools/glob.txt +0 -19
  435. package/templates/tools/grep.txt +0 -21
  436. package/templates/tools/read.txt +0 -14
  437. package/templates/tools/task.txt +0 -20
  438. package/templates/tools/webfetch.txt +0 -16
  439. package/templates/tools/websearch.txt +0 -18
  440. package/templates/tools/write.txt +0 -17
  441. package/templates/windsurf/router.md +0 -28
  442. package/templates/windsurf/workflows/bug.md +0 -8
  443. package/templates/windsurf/workflows/done.md +0 -4
  444. package/templates/windsurf/workflows/pause.md +0 -4
  445. package/templates/windsurf/workflows/resume.md +0 -4
  446. package/templates/windsurf/workflows/ship.md +0 -8
  447. package/templates/windsurf/workflows/sync.md +0 -4
  448. package/templates/windsurf/workflows/task.md +0 -8
@@ -1,1141 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __esm = (fn, res) => function __init() {
10
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
- };
12
- var __export = (target, all) => {
13
- for (var name in all)
14
- __defProp(target, name, { get: all[name], enumerable: true });
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
- mod
31
- ));
32
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
-
34
- // core/schemas/model.ts
35
- function compareSemver(a, b) {
36
- const pa = a.split(".").map(Number);
37
- const pb = b.split(".").map(Number);
38
- for (let i = 0; i < 3; i++) {
39
- const va = pa[i] ?? 0;
40
- const vb = pb[i] ?? 0;
41
- if (va < vb) return -1;
42
- if (va > vb) return 1;
43
- }
44
- return 0;
45
- }
46
- var import_zod, ClaudeModelSchema, GeminiModelSchema, AIModelSchema, ModelMetadataSchema, ModelPreferenceSchema;
47
- var init_model = __esm({
48
- "core/schemas/model.ts"() {
49
- "use strict";
50
- import_zod = require("zod");
51
- ClaudeModelSchema = import_zod.z.enum(["opus", "sonnet", "haiku"]);
52
- GeminiModelSchema = import_zod.z.enum(["2.5-pro", "2.5-flash", "2.0-flash"]);
53
- AIModelSchema = import_zod.z.string().min(1);
54
- ModelMetadataSchema = import_zod.z.object({
55
- /** Provider name (e.g., 'claude', 'gemini') */
56
- provider: import_zod.z.string(),
57
- /** Model identifier (e.g., 'opus', 'sonnet', '2.5-pro') */
58
- model: import_zod.z.string(),
59
- /** CLI version used */
60
- cliVersion: import_zod.z.string().optional(),
61
- /** When this was recorded */
62
- recordedAt: import_zod.z.string()
63
- });
64
- ModelPreferenceSchema = import_zod.z.object({
65
- /** Preferred model for this project */
66
- preferredModel: import_zod.z.string().optional(),
67
- /** Model used for last analysis (for mismatch detection) */
68
- lastAnalysisModel: ModelMetadataSchema.optional()
69
- });
70
- __name(compareSemver, "compareSemver");
71
- }
72
- });
73
-
74
- // core/utils/fs-helpers.ts
75
- async function fileExists(filePath) {
76
- try {
77
- await import_promises.default.access(filePath);
78
- return true;
79
- } catch {
80
- return false;
81
- }
82
- }
83
- var import_promises;
84
- var init_fs_helpers = __esm({
85
- "core/utils/fs-helpers.ts"() {
86
- "use strict";
87
- import_promises = __toESM(require("node:fs/promises"));
88
- __name(fileExists, "fileExists");
89
- }
90
- });
91
-
92
- // core/utils/provider-cache.ts
93
- async function readProviderCache() {
94
- try {
95
- const raw = await import_promises2.default.readFile(CACHE_FILE, "utf-8");
96
- const cache = JSON.parse(raw);
97
- if (!cache.timestamp || !cache.detection) return null;
98
- const age = Date.now() - new Date(cache.timestamp).getTime();
99
- if (age > TTL_MS) return null;
100
- return cache.detection;
101
- } catch {
102
- return null;
103
- }
104
- }
105
- async function writeProviderCache(detection) {
106
- const cache = {
107
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
108
- detection
109
- };
110
- await import_promises2.default.mkdir(CACHE_DIR, { recursive: true });
111
- await import_promises2.default.writeFile(CACHE_FILE, JSON.stringify(cache, null, 2));
112
- }
113
- var import_promises2, import_node_os, import_node_path2, CACHE_DIR, CACHE_FILE, TTL_MS;
114
- var init_provider_cache = __esm({
115
- "core/utils/provider-cache.ts"() {
116
- "use strict";
117
- import_promises2 = __toESM(require("node:fs/promises"));
118
- import_node_os = __toESM(require("node:os"));
119
- import_node_path2 = __toESM(require("node:path"));
120
- CACHE_DIR = import_node_path2.default.join(import_node_os.default.homedir(), ".prjct-cli", "cache");
121
- CACHE_FILE = import_node_path2.default.join(CACHE_DIR, "providers.json");
122
- TTL_MS = 10 * 60 * 1e3;
123
- __name(readProviderCache, "readProviderCache");
124
- __name(writeProviderCache, "writeProviderCache");
125
- }
126
- });
127
-
128
- // core/infrastructure/ai-provider.ts
129
- var ai_provider_exports = {};
130
- __export(ai_provider_exports, {
131
- AntigravityProvider: () => AntigravityProvider,
132
- ClaudeProvider: () => ClaudeProvider,
133
- CursorProvider: () => CursorProvider,
134
- GeminiProvider: () => GeminiProvider,
135
- Providers: () => Providers,
136
- WindsurfProvider: () => WindsurfProvider,
137
- detectAllProviders: () => detectAllProviders,
138
- detectAntigravity: () => detectAntigravity,
139
- detectCursorProject: () => detectCursorProject,
140
- detectProvider: () => detectProvider,
141
- detectWindsurfProject: () => detectWindsurfProject,
142
- getActiveProvider: () => getActiveProvider,
143
- getCommandsDir: () => getCommandsDir,
144
- getGlobalContextPath: () => getGlobalContextPath,
145
- getGlobalSettingsPath: () => getGlobalSettingsPath,
146
- getProjectCommandsPath: () => getProjectCommandsPath,
147
- getProviderBranding: () => getProviderBranding,
148
- getSkillsPath: () => getSkillsPath,
149
- hasProviderConfig: () => hasProviderConfig,
150
- needsCursorRouterRegeneration: () => needsCursorRouterRegeneration,
151
- needsWindsurfRouterRegeneration: () => needsWindsurfRouterRegeneration,
152
- selectProvider: () => selectProvider,
153
- validateCliVersion: () => validateCliVersion
154
- });
155
- async function whichCommand(command) {
156
- try {
157
- const { stdout } = await execAsync(`which ${command}`, { timeout: SPAWN_TIMEOUT_MS });
158
- return stdout.trim();
159
- } catch {
160
- return null;
161
- }
162
- }
163
- async function getCliVersion(command) {
164
- try {
165
- const { stdout } = await execAsync(`${command} --version`, { timeout: SPAWN_TIMEOUT_MS });
166
- const match = stdout.match(/\d+\.\d+\.\d+/);
167
- return match ? match[0] : stdout.trim();
168
- } catch {
169
- return null;
170
- }
171
- }
172
- async function detectProvider(provider) {
173
- const config = Providers[provider];
174
- if (!config.cliCommand) {
175
- return { installed: false };
176
- }
177
- const cliPath = await whichCommand(config.cliCommand);
178
- if (!cliPath) {
179
- return { installed: false };
180
- }
181
- const version = await getCliVersion(config.cliCommand);
182
- const versionWarning = validateCliVersion(provider, version || void 0);
183
- return {
184
- installed: true,
185
- version: version || void 0,
186
- path: cliPath,
187
- versionWarning: versionWarning || void 0
188
- };
189
- }
190
- function validateCliVersion(provider, version) {
191
- const config = Providers[provider];
192
- if (!config.minCliVersion || !version) return null;
193
- if (compareSemver(version, config.minCliVersion) < 0) {
194
- return `\u26A0\uFE0F ${config.displayName} v${version} is below minimum v${config.minCliVersion}. Some features may not work correctly.`;
195
- }
196
- return null;
197
- }
198
- async function detectAllProviders(refresh = false) {
199
- if (!refresh) {
200
- const cached = await readProviderCache();
201
- if (cached) return cached;
202
- }
203
- const [claude, gemini] = await Promise.all([detectProvider("claude"), detectProvider("gemini")]);
204
- const detection = { claude, gemini };
205
- await writeProviderCache(detection).catch(() => {
206
- });
207
- return detection;
208
- }
209
- async function getActiveProvider(projectProvider) {
210
- if (projectProvider && Providers[projectProvider]) {
211
- return Providers[projectProvider];
212
- }
213
- const detection = await detectAllProviders();
214
- if (detection.claude.installed && !detection.gemini.installed) {
215
- return ClaudeProvider;
216
- }
217
- if (detection.gemini.installed && !detection.claude.installed) {
218
- return GeminiProvider;
219
- }
220
- return ClaudeProvider;
221
- }
222
- async function hasProviderConfig(provider) {
223
- const config = Providers[provider];
224
- if (!config.configDir) {
225
- return false;
226
- }
227
- return fileExists(config.configDir);
228
- }
229
- function getProviderBranding(provider) {
230
- const commitFooter = `Generated with [p/](https://www.prjct.app/)`;
231
- const signatures = {
232
- claude: "\u26A1 prjct + Claude",
233
- gemini: "\u26A1 prjct + Gemini",
234
- cursor: "\u26A1 prjct + Cursor",
235
- antigravity: "\u26A1 prjct + Antigravity",
236
- windsurf: "\u26A1 prjct + Windsurf"
237
- };
238
- return {
239
- commitFooter,
240
- signature: signatures[provider] || "\u26A1 prjct"
241
- };
242
- }
243
- async function detectCursorProject(projectRoot) {
244
- const cursorDir = import_node_path3.default.join(projectRoot, ".cursor");
245
- const rulesDir = import_node_path3.default.join(cursorDir, "rules");
246
- const routerPath = import_node_path3.default.join(rulesDir, "prjct.mdc");
247
- const [detected, routerInstalled] = await Promise.all([
248
- fileExists(cursorDir),
249
- fileExists(routerPath)
250
- ]);
251
- return {
252
- detected,
253
- routerInstalled,
254
- projectRoot: detected ? projectRoot : void 0
255
- };
256
- }
257
- async function needsCursorRouterRegeneration(projectRoot) {
258
- const detection = await detectCursorProject(projectRoot);
259
- return detection.detected && !detection.routerInstalled;
260
- }
261
- async function detectWindsurfProject(projectRoot) {
262
- const windsurfDir = import_node_path3.default.join(projectRoot, ".windsurf");
263
- const rulesDir = import_node_path3.default.join(windsurfDir, "rules");
264
- const routerPath = import_node_path3.default.join(rulesDir, "prjct.md");
265
- const [detected, routerInstalled] = await Promise.all([
266
- fileExists(windsurfDir),
267
- fileExists(routerPath)
268
- ]);
269
- return {
270
- detected,
271
- routerInstalled,
272
- projectRoot: detected ? projectRoot : void 0
273
- };
274
- }
275
- async function needsWindsurfRouterRegeneration(projectRoot) {
276
- const detection = await detectWindsurfProject(projectRoot);
277
- return detection.detected && !detection.routerInstalled;
278
- }
279
- async function detectAntigravity() {
280
- const configPath = AntigravityProvider.configDir;
281
- if (!configPath) {
282
- return { installed: false, skillInstalled: false };
283
- }
284
- const skillPath = import_node_path3.default.join(configPath, "skills", "prjct", "SKILL.md");
285
- const [installed, skillInstalled] = await Promise.all([
286
- fileExists(configPath),
287
- fileExists(skillPath)
288
- ]);
289
- return {
290
- installed,
291
- skillInstalled,
292
- configPath: installed ? configPath : void 0
293
- };
294
- }
295
- function getGlobalContextPath(provider) {
296
- const config = Providers[provider];
297
- if (!config.configDir) {
298
- return null;
299
- }
300
- return import_node_path3.default.join(config.configDir, config.contextFile);
301
- }
302
- function getGlobalSettingsPath(provider) {
303
- const config = Providers[provider];
304
- if (!config.configDir || !config.settingsFile) {
305
- return null;
306
- }
307
- return import_node_path3.default.join(config.configDir, config.settingsFile);
308
- }
309
- function getSkillsPath(provider) {
310
- return Providers[provider].skillsDir;
311
- }
312
- function getCommandsDir(provider) {
313
- return Providers[provider].commandsDir;
314
- }
315
- function getProjectCommandsPath(provider, projectRoot) {
316
- const config = Providers[provider];
317
- return import_node_path3.default.join(projectRoot, config.commandsDir);
318
- }
319
- async function selectProvider() {
320
- const detection = await detectAllProviders();
321
- const claudeInstalled = detection.claude.installed;
322
- const geminiInstalled = detection.gemini.installed;
323
- if (!claudeInstalled && !geminiInstalled) {
324
- return {
325
- provider: "claude",
326
- userSelected: false,
327
- detection
328
- };
329
- }
330
- if (claudeInstalled && !geminiInstalled) {
331
- return {
332
- provider: "claude",
333
- userSelected: false,
334
- detection
335
- };
336
- }
337
- if (geminiInstalled && !claudeInstalled) {
338
- return {
339
- provider: "gemini",
340
- userSelected: false,
341
- detection
342
- };
343
- }
344
- return {
345
- provider: "claude",
346
- userSelected: true,
347
- // Indicates user should be prompted
348
- detection
349
- };
350
- }
351
- var import_node_child_process, import_node_os2, import_node_path3, import_node_util, execAsync, SPAWN_TIMEOUT_MS, ClaudeProvider, GeminiProvider, AntigravityProvider, CursorProvider, WindsurfProvider, Providers;
352
- var init_ai_provider = __esm({
353
- "core/infrastructure/ai-provider.ts"() {
354
- "use strict";
355
- import_node_child_process = require("node:child_process");
356
- import_node_os2 = __toESM(require("node:os"));
357
- import_node_path3 = __toESM(require("node:path"));
358
- import_node_util = require("node:util");
359
- init_model();
360
- init_fs_helpers();
361
- init_provider_cache();
362
- execAsync = (0, import_node_util.promisify)(import_node_child_process.exec);
363
- SPAWN_TIMEOUT_MS = 2e3;
364
- ClaudeProvider = {
365
- name: "claude",
366
- displayName: "Claude Code",
367
- cliCommand: "claude",
368
- configDir: import_node_path3.default.join(import_node_os2.default.homedir(), ".claude"),
369
- contextFile: "CLAUDE.md",
370
- skillsDir: import_node_path3.default.join(import_node_os2.default.homedir(), ".claude", "skills"),
371
- commandsDir: ".claude/commands",
372
- commandFormat: "md",
373
- settingsFile: "settings.json",
374
- projectSettingsFile: "settings.local.json",
375
- ignoreFile: ".claudeignore",
376
- websiteUrl: "https://www.anthropic.com/claude",
377
- docsUrl: "https://docs.anthropic.com/claude-code",
378
- defaultModel: "sonnet",
379
- supportedModels: ["opus", "sonnet", "haiku"],
380
- minCliVersion: "1.0.0"
381
- };
382
- GeminiProvider = {
383
- name: "gemini",
384
- displayName: "Gemini CLI",
385
- cliCommand: "gemini",
386
- configDir: import_node_path3.default.join(import_node_os2.default.homedir(), ".gemini"),
387
- contextFile: "GEMINI.md",
388
- skillsDir: import_node_path3.default.join(import_node_os2.default.homedir(), ".gemini", "skills"),
389
- commandsDir: ".gemini/commands",
390
- commandFormat: "toml",
391
- settingsFile: "settings.json",
392
- projectSettingsFile: "settings.json",
393
- ignoreFile: ".geminiignore",
394
- websiteUrl: "https://geminicli.com",
395
- docsUrl: "https://geminicli.com/docs",
396
- defaultModel: "2.5-flash",
397
- supportedModels: ["2.5-pro", "2.5-flash", "2.0-flash"],
398
- minCliVersion: "1.0.0"
399
- };
400
- AntigravityProvider = {
401
- name: "antigravity",
402
- displayName: "Google Antigravity",
403
- cliCommand: null,
404
- // Not a CLI command, but a platform/app
405
- configDir: import_node_path3.default.join(import_node_os2.default.homedir(), ".gemini", "antigravity"),
406
- contextFile: "ANTIGRAVITY.md",
407
- skillsDir: import_node_path3.default.join(import_node_os2.default.homedir(), ".gemini", "antigravity", "global_skills"),
408
- commandsDir: ".agent/skills",
409
- // Antigravity uses .agent/skills in projects
410
- commandFormat: "md",
411
- // Uses SKILL.md
412
- settingsFile: "mcp_config.json",
413
- // Uses MCP config
414
- projectSettingsFile: null,
415
- ignoreFile: ".agentignore",
416
- // Assumed
417
- websiteUrl: "https://gemini.google.com/app/antigravity",
418
- docsUrl: "https://gemini.google.com/app/antigravity",
419
- defaultModel: null,
420
- // Platform-managed
421
- supportedModels: [],
422
- minCliVersion: null
423
- };
424
- CursorProvider = {
425
- name: "cursor",
426
- displayName: "Cursor IDE",
427
- cliCommand: null,
428
- // Not a CLI - GUI app
429
- configDir: null,
430
- // No global config directory
431
- contextFile: "prjct.mdc",
432
- // Uses .mdc format with frontmatter
433
- skillsDir: null,
434
- // No skills directory
435
- commandsDir: ".cursor/commands",
436
- rulesDir: ".cursor/rules",
437
- // Cursor-specific: rules directory
438
- commandFormat: "md",
439
- settingsFile: null,
440
- projectSettingsFile: null,
441
- ignoreFile: ".cursorignore",
442
- isProjectLevel: true,
443
- // Config is project-level only
444
- websiteUrl: "https://cursor.com",
445
- docsUrl: "https://cursor.com/docs",
446
- defaultModel: null,
447
- // Multi-model IDE, user selects
448
- supportedModels: [],
449
- minCliVersion: null
450
- };
451
- WindsurfProvider = {
452
- name: "windsurf",
453
- displayName: "Windsurf IDE",
454
- cliCommand: null,
455
- // Not a CLI - GUI app
456
- configDir: null,
457
- // No global config directory
458
- contextFile: "prjct.md",
459
- // Uses .md format (not .mdc)
460
- skillsDir: null,
461
- // No skills directory
462
- commandsDir: ".windsurf/workflows",
463
- // Windsurf uses "workflows" not "commands"
464
- rulesDir: ".windsurf/rules",
465
- commandFormat: "md",
466
- settingsFile: null,
467
- projectSettingsFile: null,
468
- ignoreFile: ".windsurfignore",
469
- isProjectLevel: true,
470
- // Config is project-level only
471
- websiteUrl: "https://windsurf.com",
472
- docsUrl: "https://docs.windsurf.com",
473
- defaultModel: null,
474
- // Multi-model IDE, user selects
475
- supportedModels: [],
476
- minCliVersion: null
477
- };
478
- Providers = {
479
- claude: ClaudeProvider,
480
- gemini: GeminiProvider,
481
- cursor: CursorProvider,
482
- antigravity: AntigravityProvider,
483
- windsurf: WindsurfProvider
484
- };
485
- __name(whichCommand, "whichCommand");
486
- __name(getCliVersion, "getCliVersion");
487
- __name(detectProvider, "detectProvider");
488
- __name(validateCliVersion, "validateCliVersion");
489
- __name(detectAllProviders, "detectAllProviders");
490
- __name(getActiveProvider, "getActiveProvider");
491
- __name(hasProviderConfig, "hasProviderConfig");
492
- __name(getProviderBranding, "getProviderBranding");
493
- __name(detectCursorProject, "detectCursorProject");
494
- __name(needsCursorRouterRegeneration, "needsCursorRouterRegeneration");
495
- __name(detectWindsurfProject, "detectWindsurfProject");
496
- __name(needsWindsurfRouterRegeneration, "needsWindsurfRouterRegeneration");
497
- __name(detectAntigravity, "detectAntigravity");
498
- __name(getGlobalContextPath, "getGlobalContextPath");
499
- __name(getGlobalSettingsPath, "getGlobalSettingsPath");
500
- __name(getSkillsPath, "getSkillsPath");
501
- __name(getCommandsDir, "getCommandsDir");
502
- __name(getProjectCommandsPath, "getProjectCommandsPath");
503
- __name(selectProvider, "selectProvider");
504
- }
505
- });
506
-
507
- // core/infrastructure/command-installer.ts
508
- var command_installer_exports = {};
509
- __export(command_installer_exports, {
510
- CommandInstaller: () => CommandInstaller,
511
- composeGlobalTemplate: () => composeGlobalTemplate,
512
- default: () => command_installer_default,
513
- getProfileForCommand: () => getProfileForCommand,
514
- getProviderPaths: () => getProviderPaths,
515
- installDocs: () => installDocs,
516
- installGlobalConfig: () => installGlobalConfig,
517
- isRouterInstalled: () => isRouterInstalled
518
- });
519
- module.exports = __toCommonJS(command_installer_exports);
520
- var import_promises3 = __toESM(require("node:fs/promises"));
521
- var import_node_os3 = __toESM(require("node:os"));
522
- var import_node_path4 = __toESM(require("node:path"));
523
-
524
- // core/types/fs.ts
525
- function isNodeError(error) {
526
- return error instanceof Error && "code" in error;
527
- }
528
- __name(isNodeError, "isNodeError");
529
- function isNotFoundError(error) {
530
- return isNodeError(error) && error.code === "ENOENT";
531
- }
532
- __name(isNotFoundError, "isNotFoundError");
533
- function getErrorMessage(error) {
534
- if (error instanceof Error) return error.message;
535
- if (typeof error === "string") return error;
536
- return "Unknown error";
537
- }
538
- __name(getErrorMessage, "getErrorMessage");
539
-
540
- // core/utils/version.ts
541
- var import_node_fs = __toESM(require("node:fs"));
542
- var import_node_path = __toESM(require("node:path"));
543
- var cachedVersion = null;
544
- var cachedPackageJson = null;
545
- var cachedPackageRoot = null;
546
- function getPackageRoot() {
547
- if (cachedPackageRoot) {
548
- return cachedPackageRoot;
549
- }
550
- let currentDir = __dirname;
551
- for (let i = 0; i < 5; i++) {
552
- const packageJsonPath = import_node_path.default.join(currentDir, "package.json");
553
- if (import_node_fs.default.existsSync(packageJsonPath)) {
554
- try {
555
- const pkg = JSON.parse(import_node_fs.default.readFileSync(packageJsonPath, "utf-8"));
556
- if (pkg.name === "prjct-cli") {
557
- cachedPackageRoot = currentDir;
558
- return currentDir;
559
- }
560
- } catch (_error) {
561
- }
562
- }
563
- currentDir = import_node_path.default.dirname(currentDir);
564
- }
565
- cachedPackageRoot = import_node_path.default.join(__dirname, "..", "..", "..");
566
- return cachedPackageRoot;
567
- }
568
- __name(getPackageRoot, "getPackageRoot");
569
- function getVersion() {
570
- if (cachedVersion) {
571
- return cachedVersion;
572
- }
573
- try {
574
- const packageJsonPath = import_node_path.default.join(getPackageRoot(), "package.json");
575
- const packageJson = JSON.parse(import_node_fs.default.readFileSync(packageJsonPath, "utf-8"));
576
- cachedVersion = packageJson.version;
577
- cachedPackageJson = packageJson;
578
- return cachedVersion;
579
- } catch (error) {
580
- console.error("Failed to read version from package.json:", getErrorMessage(error));
581
- return "0.0.0";
582
- }
583
- }
584
- __name(getVersion, "getVersion");
585
- var VERSION = getVersion();
586
- var PACKAGE_ROOT = getPackageRoot();
587
-
588
- // core/infrastructure/command-installer.ts
589
- async function loadModuleConfig() {
590
- try {
591
- const configPath = import_node_path4.default.join(PACKAGE_ROOT, "templates/global/modules/module-config.json");
592
- const content = await import_promises3.default.readFile(configPath, "utf-8");
593
- return JSON.parse(content);
594
- } catch {
595
- return null;
596
- }
597
- }
598
- __name(loadModuleConfig, "loadModuleConfig");
599
- async function composeGlobalTemplate(profile) {
600
- const config = await loadModuleConfig();
601
- const modulesDir = import_node_path4.default.join(PACKAGE_ROOT, "templates/global/modules");
602
- if (!config) {
603
- const legacyPath = import_node_path4.default.join(PACKAGE_ROOT, "templates/global/CLAUDE.md");
604
- return import_promises3.default.readFile(legacyPath, "utf-8");
605
- }
606
- const profileName = profile || config.default;
607
- const selectedProfile = config.profiles[profileName];
608
- if (!selectedProfile) {
609
- const defaultProfile = config.profiles[config.default];
610
- if (!defaultProfile) {
611
- const legacyPath = import_node_path4.default.join(PACKAGE_ROOT, "templates/global/CLAUDE.md");
612
- return import_promises3.default.readFile(legacyPath, "utf-8");
613
- }
614
- }
615
- const modules = (selectedProfile || config.profiles[config.default]).modules;
616
- const parts = [];
617
- parts.push("<!-- prjct:start - DO NOT REMOVE THIS MARKER -->");
618
- for (const moduleName of modules) {
619
- try {
620
- const modulePath = import_node_path4.default.join(modulesDir, moduleName);
621
- const content = await import_promises3.default.readFile(modulePath, "utf-8");
622
- parts.push("");
623
- parts.push(content);
624
- } catch {
625
- console.warn(`Module not found: ${moduleName}`);
626
- }
627
- }
628
- parts.push("");
629
- parts.push("<!-- prjct:end - DO NOT REMOVE THIS MARKER -->");
630
- parts.push("");
631
- return parts.join("\n");
632
- }
633
- __name(composeGlobalTemplate, "composeGlobalTemplate");
634
- async function getProfileForCommand(command) {
635
- const config = await loadModuleConfig();
636
- if (!config) return "standard";
637
- return config.commandProfiles[command] || config.default;
638
- }
639
- __name(getProfileForCommand, "getProfileForCommand");
640
- async function installDocs() {
641
- try {
642
- const docsDir = import_node_path4.default.join(import_node_os3.default.homedir(), ".prjct-cli", "docs");
643
- const templateDocsDir = import_node_path4.default.join(PACKAGE_ROOT, "templates/global/docs");
644
- await import_promises3.default.mkdir(docsDir, { recursive: true });
645
- const docFiles = await import_promises3.default.readdir(templateDocsDir);
646
- for (const file of docFiles) {
647
- if (file.endsWith(".md")) {
648
- const srcPath = import_node_path4.default.join(templateDocsDir, file);
649
- const destPath = import_node_path4.default.join(docsDir, file);
650
- const content = await import_promises3.default.readFile(srcPath, "utf-8");
651
- await import_promises3.default.writeFile(destPath, content, "utf-8");
652
- }
653
- }
654
- return { success: true };
655
- } catch (error) {
656
- return { success: false, error: getErrorMessage(error) };
657
- }
658
- }
659
- __name(installDocs, "installDocs");
660
- async function installGlobalConfig() {
661
- const aiProvider = (init_ai_provider(), __toCommonJS(ai_provider_exports));
662
- const activeProvider = await aiProvider.getActiveProvider();
663
- const providerName = activeProvider.name;
664
- const detection = await aiProvider.detectProvider(providerName);
665
- if (!detection.installed && !activeProvider.configDir) {
666
- return {
667
- success: false,
668
- error: `${activeProvider.displayName} not detected`,
669
- action: "skipped"
670
- };
671
- }
672
- try {
673
- await import_promises3.default.mkdir(activeProvider.configDir, { recursive: true });
674
- const globalConfigPath = import_node_path4.default.join(activeProvider.configDir, activeProvider.contextFile);
675
- const templatePath = import_node_path4.default.join(PACKAGE_ROOT, "templates", "global", activeProvider.contextFile);
676
- let templateContent = "";
677
- try {
678
- templateContent = await import_promises3.default.readFile(templatePath, "utf-8");
679
- } catch (_error) {
680
- if (providerName === "claude") {
681
- try {
682
- templateContent = await composeGlobalTemplate("standard");
683
- } catch {
684
- const fallbackTemplatePath = import_node_path4.default.join(PACKAGE_ROOT, "templates/global/CLAUDE.md");
685
- templateContent = await import_promises3.default.readFile(fallbackTemplatePath, "utf-8");
686
- }
687
- } else {
688
- const fallbackTemplatePath = import_node_path4.default.join(PACKAGE_ROOT, "templates/global/CLAUDE.md");
689
- templateContent = await import_promises3.default.readFile(fallbackTemplatePath, "utf-8");
690
- if (providerName === "gemini") {
691
- templateContent = templateContent.replace(/Claude/g, "Gemini");
692
- }
693
- }
694
- }
695
- let existingContent = "";
696
- let fileExists2 = false;
697
- try {
698
- existingContent = await import_promises3.default.readFile(globalConfigPath, "utf-8");
699
- fileExists2 = true;
700
- } catch (error) {
701
- if (isNotFoundError(error)) {
702
- fileExists2 = false;
703
- } else {
704
- throw error;
705
- }
706
- }
707
- if (!fileExists2) {
708
- await import_promises3.default.writeFile(globalConfigPath, templateContent, "utf-8");
709
- return {
710
- success: true,
711
- action: "created",
712
- path: globalConfigPath
713
- };
714
- } else {
715
- const startMarker = "<!-- prjct:start - DO NOT REMOVE THIS MARKER -->";
716
- const endMarker = "<!-- prjct:end - DO NOT REMOVE THIS MARKER -->";
717
- const hasMarkers = existingContent.includes(startMarker) && existingContent.includes(endMarker);
718
- if (!hasMarkers) {
719
- const updatedContent = `${existingContent}
720
-
721
- ${templateContent}`;
722
- await import_promises3.default.writeFile(globalConfigPath, updatedContent, "utf-8");
723
- return {
724
- success: true,
725
- action: "appended",
726
- path: globalConfigPath
727
- };
728
- } else {
729
- const beforeMarker = existingContent.substring(0, existingContent.indexOf(startMarker));
730
- const afterMarker = existingContent.substring(
731
- existingContent.indexOf(endMarker) + endMarker.length
732
- );
733
- const prjctSection = templateContent.substring(
734
- templateContent.indexOf(startMarker),
735
- templateContent.indexOf(endMarker) + endMarker.length
736
- );
737
- const updatedContent = beforeMarker + prjctSection + afterMarker;
738
- await import_promises3.default.writeFile(globalConfigPath, updatedContent, "utf-8");
739
- return {
740
- success: true,
741
- action: "updated",
742
- path: globalConfigPath
743
- };
744
- }
745
- }
746
- } catch (error) {
747
- return {
748
- success: false,
749
- error: getErrorMessage(error),
750
- action: "failed"
751
- };
752
- }
753
- }
754
- __name(installGlobalConfig, "installGlobalConfig");
755
- var CommandInstaller = class {
756
- static {
757
- __name(this, "CommandInstaller");
758
- }
759
- homeDir;
760
- claudeCommandsPath = "";
761
- claudeConfigPath = "";
762
- templatesDir;
763
- _initialized = false;
764
- constructor() {
765
- this.homeDir = import_node_os3.default.homedir();
766
- this.templatesDir = import_node_path4.default.join(PACKAGE_ROOT, "templates", "commands");
767
- }
768
- async ensureInit() {
769
- if (this._initialized) return;
770
- const aiProvider = (init_ai_provider(), __toCommonJS(ai_provider_exports));
771
- const activeProvider = await aiProvider.getActiveProvider();
772
- if (activeProvider.name === "gemini") {
773
- this.claudeCommandsPath = import_node_path4.default.join(activeProvider.configDir, "commands");
774
- } else {
775
- this.claudeCommandsPath = import_node_path4.default.join(activeProvider.configDir, "commands", "p");
776
- }
777
- this.claudeConfigPath = activeProvider.configDir;
778
- this._initialized = true;
779
- }
780
- /**
781
- * Detect if active provider is installed
782
- */
783
- async detectActiveProvider() {
784
- await this.ensureInit();
785
- try {
786
- await import_promises3.default.access(this.claudeConfigPath);
787
- return true;
788
- } catch (error) {
789
- if (isNotFoundError(error)) {
790
- return false;
791
- }
792
- throw error;
793
- }
794
- }
795
- /**
796
- * Detect if Claude is installed (legacy support)
797
- */
798
- async detectClaude() {
799
- return this.detectActiveProvider();
800
- }
801
- /**
802
- * Get list of command files to install
803
- */
804
- async getCommandFiles() {
805
- try {
806
- const files = await import_promises3.default.readdir(this.templatesDir);
807
- return files.filter((f) => f.endsWith(".md"));
808
- } catch (_error) {
809
- return [
810
- "init.md",
811
- "now.md",
812
- "done.md",
813
- "ship.md",
814
- "next.md",
815
- "idea.md",
816
- "recap.md",
817
- "progress.md",
818
- "stuck.md",
819
- "context.md",
820
- "analyze.md",
821
- "sync.md",
822
- "roadmap.md",
823
- "task.md",
824
- "git.md",
825
- "fix.md",
826
- "test.md",
827
- "cleanup.md",
828
- "design.md"
829
- ];
830
- }
831
- }
832
- /**
833
- * Install commands to active AI agent
834
- */
835
- async installCommands() {
836
- const providerDetected = await this.detectActiveProvider();
837
- const aiProvider = (init_ai_provider(), __toCommonJS(ai_provider_exports));
838
- const activeProvider = await aiProvider.getActiveProvider();
839
- if (!providerDetected) {
840
- return {
841
- success: false,
842
- error: `${activeProvider.displayName} not detected. Please install it first.`
843
- };
844
- }
845
- try {
846
- await this.installRouter();
847
- await import_promises3.default.mkdir(this.claudeCommandsPath, { recursive: true });
848
- const commandFiles = await this.getCommandFiles();
849
- const installed = [];
850
- const errors = [];
851
- for (const file of commandFiles) {
852
- try {
853
- const sourcePath = import_node_path4.default.join(this.templatesDir, file);
854
- const destPath = import_node_path4.default.join(this.claudeCommandsPath, file);
855
- const content = await import_promises3.default.readFile(sourcePath, "utf-8");
856
- await import_promises3.default.writeFile(destPath, content, "utf-8");
857
- installed.push(file.replace(".md", ""));
858
- } catch (error) {
859
- errors.push({ file, error: getErrorMessage(error) });
860
- }
861
- }
862
- return {
863
- success: true,
864
- installed,
865
- errors,
866
- path: this.claudeCommandsPath
867
- };
868
- } catch (error) {
869
- return {
870
- success: false,
871
- error: getErrorMessage(error)
872
- };
873
- }
874
- }
875
- /**
876
- * Uninstall commands from Claude
877
- */
878
- async uninstallCommands() {
879
- try {
880
- const commandFiles = await this.getCommandFiles();
881
- const uninstalled = [];
882
- const errors = [];
883
- for (const file of commandFiles) {
884
- try {
885
- const filePath = import_node_path4.default.join(this.claudeCommandsPath, file);
886
- await import_promises3.default.unlink(filePath);
887
- uninstalled.push(file.replace(".md", ""));
888
- } catch (error) {
889
- if (error.code !== "ENOENT") {
890
- errors.push({ file, error: getErrorMessage(error) });
891
- }
892
- }
893
- }
894
- try {
895
- await import_promises3.default.rmdir(this.claudeCommandsPath);
896
- } catch (_error) {
897
- }
898
- return {
899
- success: true,
900
- uninstalled,
901
- errors
902
- };
903
- } catch (error) {
904
- return {
905
- success: false,
906
- error: getErrorMessage(error)
907
- };
908
- }
909
- }
910
- /**
911
- * Check if commands are already installed
912
- */
913
- async checkInstallation() {
914
- const claudeDetected = await this.detectClaude();
915
- if (!claudeDetected) {
916
- return {
917
- installed: false,
918
- claudeDetected: false
919
- };
920
- }
921
- try {
922
- await import_promises3.default.access(this.claudeCommandsPath);
923
- const files = await import_promises3.default.readdir(this.claudeCommandsPath);
924
- const installedCommands = files.filter((f) => f.endsWith(".md")).map((f) => f.replace(".md", ""));
925
- return {
926
- installed: installedCommands.length > 0,
927
- claudeDetected: true,
928
- commands: installedCommands,
929
- path: this.claudeCommandsPath
930
- };
931
- } catch (error) {
932
- if (isNotFoundError(error)) {
933
- return {
934
- installed: false,
935
- claudeDetected: true,
936
- commands: []
937
- };
938
- }
939
- throw error;
940
- }
941
- }
942
- /**
943
- * Update commands (reinstall with latest templates)
944
- */
945
- async updateCommands() {
946
- console.log("Updating commands with latest templates...");
947
- const result = await this.installCommands();
948
- if (result.success && result.installed) {
949
- console.log(`Updated ${result.installed.length} commands`);
950
- }
951
- return result;
952
- }
953
- /**
954
- * Install to all detected editors (alias for installCommands)
955
- */
956
- async installToAll() {
957
- return await this.installCommands();
958
- }
959
- /**
960
- * Get installation path for Claude commands
961
- */
962
- async getInstallPath() {
963
- await this.ensureInit();
964
- return this.claudeCommandsPath;
965
- }
966
- /**
967
- * Verify command template exists
968
- */
969
- async verifyTemplate(commandName) {
970
- try {
971
- const templatePath = import_node_path4.default.join(this.templatesDir, `${commandName}.md`);
972
- await import_promises3.default.access(templatePath);
973
- return true;
974
- } catch (error) {
975
- if (isNotFoundError(error)) {
976
- return false;
977
- }
978
- throw error;
979
- }
980
- }
981
- /**
982
- * Install the router (p.md for Claude, p.toml for Gemini) to commands directory
983
- * This enables the "p. task" natural language trigger
984
- */
985
- async installRouter() {
986
- const aiProvider = (init_ai_provider(), __toCommonJS(ai_provider_exports));
987
- const activeProvider = await aiProvider.getActiveProvider();
988
- const routerFile = activeProvider.name === "gemini" ? "p.toml" : "p.md";
989
- try {
990
- const routerSource = import_node_path4.default.join(this.templatesDir, routerFile);
991
- const routerDest = import_node_path4.default.join(activeProvider.configDir, "commands", routerFile);
992
- await import_promises3.default.mkdir(import_node_path4.default.dirname(routerDest), { recursive: true });
993
- const content = await import_promises3.default.readFile(routerSource, "utf-8");
994
- await import_promises3.default.writeFile(routerDest, content, "utf-8");
995
- return true;
996
- } catch (error) {
997
- if (isNotFoundError(error)) {
998
- return false;
999
- }
1000
- throw error;
1001
- }
1002
- }
1003
- /**
1004
- * Remove legacy p.*.md files from commands root directory
1005
- * These were replaced by the p/ subdirectory structure in v0.50+
1006
- */
1007
- async removeLegacyCommands() {
1008
- const aiProvider = (init_ai_provider(), __toCommonJS(ai_provider_exports));
1009
- const activeProvider = await aiProvider.getActiveProvider();
1010
- const commandsRoot = import_node_path4.default.join(activeProvider.configDir, "commands");
1011
- let removed = 0;
1012
- try {
1013
- const files = await import_promises3.default.readdir(commandsRoot);
1014
- const legacyFiles = files.filter((f) => f.startsWith("p.") && f.endsWith(".md"));
1015
- for (const file of legacyFiles) {
1016
- try {
1017
- await import_promises3.default.unlink(import_node_path4.default.join(commandsRoot, file));
1018
- removed++;
1019
- } catch {
1020
- }
1021
- }
1022
- } catch {
1023
- }
1024
- return removed;
1025
- }
1026
- /**
1027
- * Sync commands - intelligent update that detects and removes orphans
1028
- */
1029
- async syncCommands() {
1030
- const providerDetected = await this.detectActiveProvider();
1031
- if (!providerDetected) {
1032
- return {
1033
- success: false,
1034
- error: "AI agent not detected",
1035
- added: 0,
1036
- updated: 0,
1037
- removed: 0
1038
- };
1039
- }
1040
- try {
1041
- await this.installRouter();
1042
- await import_promises3.default.mkdir(this.claudeCommandsPath, { recursive: true });
1043
- const templateFiles = await this.getCommandFiles();
1044
- let installedFiles = [];
1045
- try {
1046
- installedFiles = await import_promises3.default.readdir(this.claudeCommandsPath);
1047
- installedFiles = installedFiles.filter((f) => f.endsWith(".md"));
1048
- } catch (error) {
1049
- if (isNotFoundError(error)) {
1050
- installedFiles = [];
1051
- } else {
1052
- throw error;
1053
- }
1054
- }
1055
- const results = {
1056
- success: true,
1057
- added: 0,
1058
- updated: 0,
1059
- removed: 0,
1060
- errors: []
1061
- };
1062
- for (const file of templateFiles) {
1063
- try {
1064
- const sourcePath = import_node_path4.default.join(this.templatesDir, file);
1065
- const destPath = import_node_path4.default.join(this.claudeCommandsPath, file);
1066
- const exists = installedFiles.includes(file);
1067
- const content = await import_promises3.default.readFile(sourcePath, "utf-8");
1068
- await import_promises3.default.writeFile(destPath, content, "utf-8");
1069
- if (!exists) {
1070
- results.added++;
1071
- } else {
1072
- results.updated++;
1073
- }
1074
- } catch (error) {
1075
- results.errors.push({ file, error: getErrorMessage(error) });
1076
- }
1077
- }
1078
- await this.removeLegacyCommands();
1079
- return results;
1080
- } catch (error) {
1081
- return {
1082
- success: false,
1083
- error: getErrorMessage(error),
1084
- added: 0,
1085
- updated: 0,
1086
- removed: 0
1087
- };
1088
- }
1089
- }
1090
- /**
1091
- * Install or update global AI agent configuration (CLAUDE.md / GEMINI.md)
1092
- */
1093
- async installGlobalConfig() {
1094
- return installGlobalConfig();
1095
- }
1096
- /**
1097
- * Install documentation files to ~/.prjct-cli/docs/
1098
- */
1099
- async installDocs() {
1100
- return installDocs();
1101
- }
1102
- };
1103
- function getProviderPaths() {
1104
- const homeDir = import_node_os3.default.homedir();
1105
- return {
1106
- claude: {
1107
- commands: import_node_path4.default.join(homeDir, ".claude", "commands", "p"),
1108
- config: import_node_path4.default.join(homeDir, ".claude"),
1109
- router: import_node_path4.default.join(homeDir, ".claude", "commands", "p.md")
1110
- },
1111
- gemini: {
1112
- commands: import_node_path4.default.join(homeDir, ".gemini", "commands"),
1113
- config: import_node_path4.default.join(homeDir, ".gemini"),
1114
- router: import_node_path4.default.join(homeDir, ".gemini", "commands", "p.toml")
1115
- }
1116
- };
1117
- }
1118
- __name(getProviderPaths, "getProviderPaths");
1119
- async function isRouterInstalled(provider) {
1120
- const paths = getProviderPaths();
1121
- const routerPath = paths[provider].router;
1122
- try {
1123
- await import_promises3.default.access(routerPath);
1124
- return true;
1125
- } catch {
1126
- return false;
1127
- }
1128
- }
1129
- __name(isRouterInstalled, "isRouterInstalled");
1130
- var commandInstaller = new CommandInstaller();
1131
- var command_installer_default = commandInstaller;
1132
- // Annotate the CommonJS export names for ESM import in node:
1133
- 0 && (module.exports = {
1134
- CommandInstaller,
1135
- composeGlobalTemplate,
1136
- getProfileForCommand,
1137
- getProviderPaths,
1138
- installDocs,
1139
- installGlobalConfig,
1140
- isRouterInstalled
1141
- });