prjct-cli 0.44.1 → 0.45.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 (207) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/bin/prjct.ts +131 -10
  3. package/core/__tests__/agentic/memory-system.test.ts +39 -26
  4. package/core/__tests__/agentic/plan-mode.test.ts +64 -46
  5. package/core/__tests__/agentic/prompt-builder.test.ts +14 -14
  6. package/core/__tests__/services/project-index.test.ts +353 -0
  7. package/core/__tests__/types/fs.test.ts +3 -3
  8. package/core/__tests__/utils/date-helper.test.ts +10 -10
  9. package/core/__tests__/utils/output.test.ts +9 -6
  10. package/core/__tests__/utils/project-commands.test.ts +5 -6
  11. package/core/agentic/agent-router.ts +9 -10
  12. package/core/agentic/chain-of-thought.ts +16 -4
  13. package/core/agentic/command-executor.ts +66 -40
  14. package/core/agentic/context-builder.ts +8 -5
  15. package/core/agentic/ground-truth.ts +15 -9
  16. package/core/agentic/index.ts +145 -152
  17. package/core/agentic/loop-detector.ts +40 -11
  18. package/core/agentic/memory-system.ts +98 -35
  19. package/core/agentic/orchestrator-executor.ts +135 -71
  20. package/core/agentic/plan-mode.ts +46 -16
  21. package/core/agentic/prompt-builder.ts +108 -42
  22. package/core/agentic/services.ts +10 -9
  23. package/core/agentic/skill-loader.ts +9 -15
  24. package/core/agentic/smart-context.ts +129 -79
  25. package/core/agentic/template-executor.ts +13 -12
  26. package/core/agentic/template-loader.ts +7 -4
  27. package/core/agentic/tool-registry.ts +16 -13
  28. package/core/agents/index.ts +1 -1
  29. package/core/agents/performance.ts +10 -27
  30. package/core/ai-tools/formatters.ts +8 -6
  31. package/core/ai-tools/generator.ts +4 -4
  32. package/core/ai-tools/index.ts +1 -1
  33. package/core/ai-tools/registry.ts +21 -11
  34. package/core/bus/bus.ts +23 -16
  35. package/core/bus/index.ts +2 -2
  36. package/core/cli/linear.ts +3 -5
  37. package/core/cli/start.ts +28 -25
  38. package/core/commands/analysis.ts +287 -29
  39. package/core/commands/analytics.ts +52 -44
  40. package/core/commands/base.ts +15 -13
  41. package/core/commands/cleanup.ts +6 -13
  42. package/core/commands/command-data.ts +49 -8
  43. package/core/commands/commands.ts +60 -23
  44. package/core/commands/context.ts +4 -4
  45. package/core/commands/design.ts +3 -10
  46. package/core/commands/index.ts +5 -8
  47. package/core/commands/maintenance.ts +7 -4
  48. package/core/commands/planning.ts +179 -56
  49. package/core/commands/register.ts +14 -9
  50. package/core/commands/registry.ts +15 -14
  51. package/core/commands/setup.ts +26 -14
  52. package/core/commands/shipping.ts +11 -16
  53. package/core/commands/snapshots.ts +16 -32
  54. package/core/commands/uninstall.ts +541 -0
  55. package/core/commands/workflow.ts +24 -28
  56. package/core/constants/index.ts +10 -22
  57. package/core/context/generator.ts +82 -33
  58. package/core/context-tools/files-tool.ts +583 -0
  59. package/core/context-tools/imports-tool.ts +403 -0
  60. package/core/context-tools/index.ts +433 -0
  61. package/core/context-tools/recent-tool.ts +307 -0
  62. package/core/context-tools/signatures-tool.ts +501 -0
  63. package/core/context-tools/summary-tool.ts +307 -0
  64. package/core/context-tools/token-counter.ts +284 -0
  65. package/core/context-tools/types.ts +253 -0
  66. package/core/domain/agent-generator.ts +7 -5
  67. package/core/domain/agent-loader.ts +2 -2
  68. package/core/domain/analyzer.ts +19 -16
  69. package/core/domain/architecture-generator.ts +6 -3
  70. package/core/domain/context-estimator.ts +3 -4
  71. package/core/domain/snapshot-manager.ts +25 -22
  72. package/core/domain/task-stack.ts +24 -14
  73. package/core/errors.ts +1 -1
  74. package/core/events/events.ts +2 -4
  75. package/core/events/index.ts +1 -2
  76. package/core/index.ts +28 -12
  77. package/core/infrastructure/agent-detector.ts +3 -3
  78. package/core/infrastructure/ai-provider.ts +23 -20
  79. package/core/infrastructure/author-detector.ts +16 -10
  80. package/core/infrastructure/capability-installer.ts +2 -2
  81. package/core/infrastructure/claude-agent.ts +6 -6
  82. package/core/infrastructure/command-installer.ts +22 -17
  83. package/core/infrastructure/config-manager.ts +18 -14
  84. package/core/infrastructure/editors-config.ts +8 -4
  85. package/core/infrastructure/path-manager.ts +8 -6
  86. package/core/infrastructure/permission-manager.ts +20 -17
  87. package/core/infrastructure/setup.ts +42 -38
  88. package/core/infrastructure/update-checker.ts +5 -5
  89. package/core/integrations/issue-tracker/enricher.ts +8 -19
  90. package/core/integrations/issue-tracker/index.ts +2 -2
  91. package/core/integrations/issue-tracker/manager.ts +15 -15
  92. package/core/integrations/issue-tracker/types.ts +5 -22
  93. package/core/integrations/jira/client.ts +67 -59
  94. package/core/integrations/jira/index.ts +11 -14
  95. package/core/integrations/jira/mcp-adapter.ts +5 -10
  96. package/core/integrations/jira/service.ts +10 -10
  97. package/core/integrations/linear/client.ts +27 -18
  98. package/core/integrations/linear/index.ts +9 -12
  99. package/core/integrations/linear/service.ts +11 -11
  100. package/core/integrations/linear/sync.ts +8 -8
  101. package/core/outcomes/analyzer.ts +5 -18
  102. package/core/outcomes/index.ts +2 -2
  103. package/core/outcomes/recorder.ts +3 -3
  104. package/core/plugin/builtin/webhook.ts +19 -15
  105. package/core/plugin/hooks.ts +29 -21
  106. package/core/plugin/index.ts +7 -7
  107. package/core/plugin/loader.ts +19 -19
  108. package/core/plugin/registry.ts +12 -23
  109. package/core/schemas/agents.ts +1 -1
  110. package/core/schemas/analysis.ts +1 -1
  111. package/core/schemas/enriched-task.ts +62 -49
  112. package/core/schemas/ideas.ts +13 -13
  113. package/core/schemas/index.ts +17 -27
  114. package/core/schemas/issues.ts +40 -25
  115. package/core/schemas/metrics.ts +143 -0
  116. package/core/schemas/outcomes.ts +70 -62
  117. package/core/schemas/permissions.ts +15 -12
  118. package/core/schemas/prd.ts +27 -14
  119. package/core/schemas/project.ts +3 -3
  120. package/core/schemas/roadmap.ts +47 -34
  121. package/core/schemas/schemas.ts +3 -4
  122. package/core/schemas/shipped.ts +3 -3
  123. package/core/schemas/state.ts +43 -29
  124. package/core/server/index.ts +5 -6
  125. package/core/server/routes-extended.ts +68 -72
  126. package/core/server/routes.ts +3 -3
  127. package/core/server/server.ts +31 -26
  128. package/core/services/agent-generator.ts +237 -0
  129. package/core/services/agent-service.ts +2 -2
  130. package/core/services/breakdown-service.ts +2 -4
  131. package/core/services/context-generator.ts +299 -0
  132. package/core/services/context-selector.ts +420 -0
  133. package/core/services/doctor-service.ts +426 -0
  134. package/core/services/file-categorizer.ts +448 -0
  135. package/core/services/file-scorer.ts +270 -0
  136. package/core/services/git-analyzer.ts +267 -0
  137. package/core/services/index.ts +27 -10
  138. package/core/services/memory-service.ts +3 -4
  139. package/core/services/project-index.ts +911 -0
  140. package/core/services/project-service.ts +4 -4
  141. package/core/services/skill-installer.ts +14 -17
  142. package/core/services/skill-lock.ts +3 -3
  143. package/core/services/skill-service.ts +12 -6
  144. package/core/services/stack-detector.ts +245 -0
  145. package/core/services/sync-service.ts +170 -329
  146. package/core/services/watch-service.ts +294 -0
  147. package/core/session/compaction.ts +23 -31
  148. package/core/session/index.ts +11 -5
  149. package/core/session/log-migration.ts +3 -3
  150. package/core/session/metrics.ts +19 -14
  151. package/core/session/session-log-manager.ts +12 -17
  152. package/core/session/task-session-manager.ts +25 -25
  153. package/core/session/utils.ts +1 -1
  154. package/core/storage/ideas-storage.ts +41 -57
  155. package/core/storage/index-storage.ts +514 -0
  156. package/core/storage/index.ts +41 -13
  157. package/core/storage/metrics-storage.ts +320 -0
  158. package/core/storage/queue-storage.ts +35 -45
  159. package/core/storage/shipped-storage.ts +17 -20
  160. package/core/storage/state-storage.ts +50 -30
  161. package/core/storage/storage-manager.ts +6 -6
  162. package/core/storage/storage.ts +18 -15
  163. package/core/sync/auth-config.ts +3 -3
  164. package/core/sync/index.ts +13 -19
  165. package/core/sync/oauth-handler.ts +3 -3
  166. package/core/sync/sync-client.ts +4 -9
  167. package/core/sync/sync-manager.ts +12 -14
  168. package/core/types/commands.ts +42 -7
  169. package/core/types/index.ts +284 -302
  170. package/core/types/integrations.ts +3 -3
  171. package/core/types/storage.ts +49 -0
  172. package/core/types/utils.ts +3 -3
  173. package/core/utils/agent-stream.ts +3 -1
  174. package/core/utils/animations.ts +14 -11
  175. package/core/utils/branding.ts +7 -7
  176. package/core/utils/cache.ts +1 -3
  177. package/core/utils/collection-filters.ts +3 -15
  178. package/core/utils/date-helper.ts +2 -7
  179. package/core/utils/file-helper.ts +13 -8
  180. package/core/utils/jsonl-helper.ts +13 -10
  181. package/core/utils/keychain.ts +4 -8
  182. package/core/utils/logger.ts +1 -1
  183. package/core/utils/next-steps.ts +3 -3
  184. package/core/utils/output.ts +58 -11
  185. package/core/utils/project-commands.ts +6 -6
  186. package/core/utils/project-credentials.ts +5 -12
  187. package/core/utils/runtime.ts +2 -2
  188. package/core/utils/session-helper.ts +3 -4
  189. package/core/utils/version.ts +3 -3
  190. package/core/wizard/index.ts +13 -0
  191. package/core/wizard/onboarding.ts +633 -0
  192. package/core/workflow/state-machine.ts +7 -7
  193. package/dist/bin/prjct.mjs +18907 -13189
  194. package/dist/core/infrastructure/command-installer.js +96 -111
  195. package/dist/core/infrastructure/editors-config.js +6 -6
  196. package/dist/core/infrastructure/setup.js +256 -257
  197. package/dist/core/utils/version.js +9 -9
  198. package/package.json +11 -12
  199. package/scripts/build.js +3 -3
  200. package/scripts/postinstall.js +2 -2
  201. package/templates/mcp-config.json +6 -1
  202. package/templates/permissions/permissive.jsonc +1 -1
  203. package/templates/permissions/strict.jsonc +5 -9
  204. package/templates/global/docs/agents.md +0 -88
  205. package/templates/global/docs/architecture.md +0 -103
  206. package/templates/global/docs/commands.md +0 -96
  207. package/templates/global/docs/validation.md +0 -95
@@ -0,0 +1,433 @@
1
+ /**
2
+ * Context Tools - Smart context filtering for AI agents
3
+ *
4
+ * Provides terminal tools that Claude can use to explore codebases
5
+ * efficiently WITHOUT consuming tokens for filtering.
6
+ *
7
+ * Tools:
8
+ * - files: Find relevant files for a task
9
+ * - signatures: Extract code structure without implementation
10
+ * - imports: Build dependency graphs
11
+ * - recent: Find hot files from git history
12
+ * - summary: Intelligent file summarization
13
+ *
14
+ * @module context-tools
15
+ * @version 1.0.0
16
+ */
17
+
18
+ import { metricsStorage } from '../storage/metrics-storage'
19
+ import { getTimestamp } from '../utils/date-helper'
20
+ import { findRelevantFiles } from './files-tool'
21
+ import { analyzeImports } from './imports-tool'
22
+ import { getRecentFiles } from './recent-tool'
23
+ import { extractDirectorySignatures, extractSignatures } from './signatures-tool'
24
+ import { summarizeDirectory, summarizeFile } from './summary-tool'
25
+ import { combineMetrics } from './token-counter'
26
+ import type { ContextToolOutput, ContextToolUsage } from './types'
27
+
28
+ // =============================================================================
29
+ // CLI Dispatcher
30
+ // =============================================================================
31
+
32
+ /**
33
+ * Run a context tool from CLI arguments
34
+ *
35
+ * Usage:
36
+ * prjct context files "add authentication"
37
+ * prjct context signatures core/auth/service.ts
38
+ * prjct context imports core/auth/service.ts --reverse
39
+ * prjct context recent 50
40
+ * prjct context recent --branch
41
+ * prjct context summary core/auth/service.ts
42
+ *
43
+ * @param args - CLI arguments (tool name + args)
44
+ * @param projectId - Project ID for metrics tracking
45
+ * @param projectPath - Project root path
46
+ * @returns JSON output for Claude
47
+ */
48
+ export async function runContextTool(
49
+ args: string[],
50
+ projectId: string,
51
+ projectPath: string
52
+ ): Promise<ContextToolOutput> {
53
+ const startTime = Date.now()
54
+ const [toolName, ...toolArgs] = args
55
+
56
+ try {
57
+ let result: ContextToolOutput
58
+
59
+ switch (toolName) {
60
+ case 'files':
61
+ result = await runFilesTool(toolArgs, projectPath)
62
+ break
63
+
64
+ case 'signatures':
65
+ result = await runSignaturesTool(toolArgs, projectPath)
66
+ break
67
+
68
+ case 'imports':
69
+ result = await runImportsTool(toolArgs, projectPath)
70
+ break
71
+
72
+ case 'recent':
73
+ result = await runRecentTool(toolArgs, projectPath)
74
+ break
75
+
76
+ case 'summary':
77
+ result = await runSummaryTool(toolArgs, projectPath)
78
+ break
79
+
80
+ case 'help':
81
+ return {
82
+ tool: 'error',
83
+ result: {
84
+ error: getHelpText(),
85
+ code: 'HELP',
86
+ },
87
+ }
88
+
89
+ default:
90
+ return {
91
+ tool: 'error',
92
+ result: {
93
+ error: `Unknown tool: ${toolName}. Use 'prjct context help' for usage.`,
94
+ code: 'UNKNOWN_TOOL',
95
+ },
96
+ }
97
+ }
98
+
99
+ // Record usage metrics
100
+ const duration = Date.now() - startTime
101
+ const tokensSaved = getTokensSaved(result)
102
+ const compressionRate = getCompressionRate(result)
103
+
104
+ await recordToolUsage(projectId, {
105
+ tool: toolName as ContextToolUsage['tool'],
106
+ timestamp: getTimestamp(),
107
+ inputArgs: toolArgs.join(' '),
108
+ tokensSaved,
109
+ compressionRate,
110
+ duration,
111
+ })
112
+
113
+ return result
114
+ } catch (error) {
115
+ return {
116
+ tool: 'error',
117
+ result: {
118
+ error: (error as Error).message,
119
+ code: 'EXECUTION_ERROR',
120
+ },
121
+ }
122
+ }
123
+ }
124
+
125
+ // =============================================================================
126
+ // Tool Runners
127
+ // =============================================================================
128
+
129
+ async function runFilesTool(args: string[], projectPath: string): Promise<ContextToolOutput> {
130
+ // Parse options
131
+ const options: { maxFiles?: number; minScore?: number; includeTests?: boolean } = {}
132
+ const taskParts: string[] = []
133
+
134
+ for (let i = 0; i < args.length; i++) {
135
+ if (args[i] === '--max' && args[i + 1]) {
136
+ options.maxFiles = parseInt(args[++i], 10)
137
+ } else if (args[i] === '--min-score' && args[i + 1]) {
138
+ options.minScore = parseFloat(args[++i])
139
+ } else if (args[i] === '--include-tests') {
140
+ options.includeTests = true
141
+ } else {
142
+ taskParts.push(args[i])
143
+ }
144
+ }
145
+
146
+ const taskDescription = taskParts.join(' ')
147
+ if (!taskDescription) {
148
+ return {
149
+ tool: 'error',
150
+ result: {
151
+ error: 'Usage: prjct context files "<task description>"',
152
+ code: 'MISSING_ARG',
153
+ },
154
+ }
155
+ }
156
+
157
+ const result = await findRelevantFiles(taskDescription, projectPath, options)
158
+ return { tool: 'files', result }
159
+ }
160
+
161
+ async function runSignaturesTool(args: string[], projectPath: string): Promise<ContextToolOutput> {
162
+ const filePath = args[0]
163
+ if (!filePath) {
164
+ return {
165
+ tool: 'error',
166
+ result: {
167
+ error: 'Usage: prjct context signatures <file_or_directory>',
168
+ code: 'MISSING_ARG',
169
+ },
170
+ }
171
+ }
172
+
173
+ // Check if it's a directory
174
+ const fs = await import('node:fs/promises')
175
+ const path = await import('node:path')
176
+ const fullPath = path.isAbsolute(filePath) ? filePath : path.join(projectPath, filePath)
177
+
178
+ try {
179
+ const stat = await fs.stat(fullPath)
180
+ if (stat.isDirectory()) {
181
+ // Return multiple results
182
+ const results = await extractDirectorySignatures(filePath, projectPath, {
183
+ recursive: args.includes('--recursive') || args.includes('-r'),
184
+ })
185
+ // Combine into single output with cost savings
186
+ const combinedMetrics = combineMetrics(results.map((r) => r.metrics))
187
+ const combined = {
188
+ file: filePath,
189
+ language: 'multiple',
190
+ signatures: results.flatMap((r) => r.signatures.map((s) => ({ ...s, file: r.file }))),
191
+ fallback: false,
192
+ metrics: combinedMetrics,
193
+ }
194
+ return { tool: 'signatures', result: combined }
195
+ }
196
+ } catch {
197
+ // Not a directory, try as file
198
+ }
199
+
200
+ const result = await extractSignatures(filePath, projectPath)
201
+ return { tool: 'signatures', result }
202
+ }
203
+
204
+ async function runImportsTool(args: string[], projectPath: string): Promise<ContextToolOutput> {
205
+ const filePath = args[0]
206
+ if (!filePath) {
207
+ return {
208
+ tool: 'error',
209
+ result: {
210
+ error: 'Usage: prjct context imports <file> [--reverse] [--depth N]',
211
+ code: 'MISSING_ARG',
212
+ },
213
+ }
214
+ }
215
+
216
+ // Parse options
217
+ const options: { reverse?: boolean; depth?: number } = {}
218
+ for (let i = 1; i < args.length; i++) {
219
+ if (args[i] === '--reverse' || args[i] === '-r') {
220
+ options.reverse = true
221
+ } else if ((args[i] === '--depth' || args[i] === '-d') && args[i + 1]) {
222
+ options.depth = parseInt(args[++i], 10)
223
+ }
224
+ }
225
+
226
+ const result = await analyzeImports(filePath, projectPath, options)
227
+ return { tool: 'imports', result }
228
+ }
229
+
230
+ async function runRecentTool(args: string[], projectPath: string): Promise<ContextToolOutput> {
231
+ const options: { commits?: number; branch?: boolean; maxFiles?: number } = {}
232
+
233
+ for (let i = 0; i < args.length; i++) {
234
+ if (args[i] === '--branch' || args[i] === '-b') {
235
+ options.branch = true
236
+ } else if (args[i] === '--max' && args[i + 1]) {
237
+ options.maxFiles = parseInt(args[++i], 10)
238
+ } else if (/^\d+$/.test(args[i])) {
239
+ options.commits = parseInt(args[i], 10)
240
+ }
241
+ }
242
+
243
+ const result = await getRecentFiles(projectPath, options)
244
+ return { tool: 'recent', result }
245
+ }
246
+
247
+ async function runSummaryTool(args: string[], projectPath: string): Promise<ContextToolOutput> {
248
+ const targetPath = args[0]
249
+ if (!targetPath) {
250
+ return {
251
+ tool: 'error',
252
+ result: {
253
+ error: 'Usage: prjct context summary <file_or_directory> [--recursive]',
254
+ code: 'MISSING_ARG',
255
+ },
256
+ }
257
+ }
258
+
259
+ // Check if it's a directory
260
+ const fs = await import('node:fs/promises')
261
+ const path = await import('node:path')
262
+ const fullPath = path.isAbsolute(targetPath) ? targetPath : path.join(projectPath, targetPath)
263
+
264
+ try {
265
+ const stat = await fs.stat(fullPath)
266
+ if (stat.isDirectory()) {
267
+ const results = await summarizeDirectory(targetPath, projectPath, {
268
+ recursive: args.includes('--recursive') || args.includes('-r'),
269
+ })
270
+ // Combine into aggregate output
271
+ const combined = {
272
+ file: targetPath,
273
+ purpose: `Directory with ${results.length} files`,
274
+ publicAPI: results.flatMap((r) => r.publicAPI.map((api) => ({ ...api, file: r.file }))),
275
+ dependencies: [...new Set(results.flatMap((r) => r.dependencies))],
276
+ metrics: combineMetrics(results.map((r) => r.metrics)),
277
+ }
278
+ return { tool: 'summary', result: combined }
279
+ }
280
+ } catch {
281
+ // Not a directory, try as file
282
+ }
283
+
284
+ const result = await summarizeFile(targetPath, projectPath)
285
+ return { tool: 'summary', result }
286
+ }
287
+
288
+ // =============================================================================
289
+ // Metrics Helpers
290
+ // =============================================================================
291
+
292
+ function getTokensSaved(result: ContextToolOutput): number {
293
+ if (result.tool === 'error') return 0
294
+
295
+ switch (result.tool) {
296
+ case 'signatures':
297
+ case 'summary':
298
+ return result.result.metrics.tokens.saved
299
+ case 'files':
300
+ // Estimate tokens saved by returning fewer files
301
+ return result.result.metrics.filesScanned * 50 - result.result.metrics.filesReturned * 50
302
+ case 'imports':
303
+ // Estimate based on not needing to read full files
304
+ return result.result.metrics.totalImports * 20
305
+ case 'recent':
306
+ // Estimate based on focused file list
307
+ return result.result.metrics.totalFilesChanged * 30
308
+ default:
309
+ return 0
310
+ }
311
+ }
312
+
313
+ function getCompressionRate(result: ContextToolOutput): number {
314
+ if (result.tool === 'error') return 0
315
+
316
+ switch (result.tool) {
317
+ case 'signatures':
318
+ case 'summary':
319
+ return result.result.metrics.compression
320
+ case 'files': {
321
+ const scanned = result.result.metrics.filesScanned
322
+ const returned = result.result.metrics.filesReturned
323
+ return scanned > 0 ? (scanned - returned) / scanned : 0
324
+ }
325
+ default:
326
+ return 0
327
+ }
328
+ }
329
+
330
+ async function recordToolUsage(projectId: string, usage: ContextToolUsage): Promise<void> {
331
+ try {
332
+ // Record to metrics storage
333
+ await metricsStorage.recordSync(projectId, {
334
+ originalSize: usage.tokensSaved + 100, // Estimate original
335
+ filteredSize: 100, // Estimate filtered
336
+ duration: usage.duration,
337
+ isWatch: false,
338
+ agents: [`context-${usage.tool}`],
339
+ })
340
+ } catch {
341
+ // Metrics recording failure is non-fatal
342
+ }
343
+ }
344
+
345
+ // =============================================================================
346
+ // Help Text
347
+ // =============================================================================
348
+
349
+ function getHelpText(): string {
350
+ return `
351
+ Context Tools - Smart context filtering for AI agents
352
+
353
+ USAGE:
354
+ prjct context <tool> [args] [options]
355
+
356
+ TOOLS:
357
+
358
+ files <task>
359
+ Find files relevant to a task description.
360
+ Options:
361
+ --max N Maximum files to return (default: 30)
362
+ --min-score N Minimum relevance score 0-1 (default: 0.1)
363
+ --include-tests Include test files
364
+
365
+ Example:
366
+ prjct context files "add user authentication"
367
+
368
+ signatures <path>
369
+ Extract code structure without implementation (~90% compression).
370
+ Path can be a file or directory.
371
+ Options:
372
+ --recursive, -r Process directories recursively
373
+
374
+ Example:
375
+ prjct context signatures core/auth/service.ts
376
+ prjct context signatures core/auth/ --recursive
377
+
378
+ imports <file>
379
+ Analyze import/dependency relationships.
380
+ Options:
381
+ --reverse, -r Show files that import this file
382
+ --depth N, -d N Build dependency tree to depth N
383
+
384
+ Example:
385
+ prjct context imports core/auth/service.ts --reverse
386
+ prjct context imports core/auth/service.ts --depth 2
387
+
388
+ recent [commits]
389
+ Find recently modified "hot" files.
390
+ Options:
391
+ --branch, -b Only files changed in current branch vs main
392
+ --max N Maximum files to return (default: 50)
393
+
394
+ Example:
395
+ prjct context recent
396
+ prjct context recent 50
397
+ prjct context recent --branch
398
+
399
+ summary <path>
400
+ Generate intelligent file summary (public API + docs).
401
+ Options:
402
+ --recursive, -r Process directories recursively
403
+
404
+ Example:
405
+ prjct context summary core/auth/service.ts
406
+ prjct context summary core/services/ --recursive
407
+
408
+ OUTPUT:
409
+ All tools output JSON for easy parsing by AI agents.
410
+ Each output includes metrics showing token savings.
411
+ `.trim()
412
+ }
413
+
414
+ // =============================================================================
415
+ // Exports
416
+ // =============================================================================
417
+
418
+ export {
419
+ // Individual tools for programmatic use
420
+ findRelevantFiles,
421
+ extractSignatures,
422
+ extractDirectorySignatures,
423
+ analyzeImports,
424
+ getRecentFiles,
425
+ summarizeFile,
426
+ summarizeDirectory,
427
+ }
428
+
429
+ // Note: runContextTool is already exported at its definition (line 48)
430
+
431
+ export * from './token-counter'
432
+ // Re-export types
433
+ export * from './types'