appydave-tools 0.70.0 → 0.71.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/brainstorming-agent.md +227 -0
  3. data/.claude/commands/cli-test.md +251 -0
  4. data/.claude/commands/dev.md +234 -0
  5. data/.claude/commands/po.md +227 -0
  6. data/.claude/commands/progress.md +51 -0
  7. data/.claude/commands/uat.md +321 -0
  8. data/.rubocop.yml +9 -0
  9. data/AGENTS.md +43 -0
  10. data/CHANGELOG.md +12 -0
  11. data/CLAUDE.md +26 -3
  12. data/README.md +15 -0
  13. data/bin/dam +21 -1
  14. data/bin/jump.rb +29 -0
  15. data/bin/subtitle_processor.rb +54 -1
  16. data/bin/zsh_history.rb +846 -0
  17. data/docs/README.md +162 -69
  18. data/docs/architecture/cli/exe-bin-convention.md +434 -0
  19. data/docs/architecture/cli-patterns.md +631 -0
  20. data/docs/architecture/gpt-context/gpt-context-architecture.md +325 -0
  21. data/docs/architecture/gpt-context/gpt-context-implementation-guide.md +419 -0
  22. data/docs/architecture/gpt-context/gpt-context-vision.md +179 -0
  23. data/docs/architecture/testing/testing-patterns.md +762 -0
  24. data/docs/backlog.md +120 -0
  25. data/docs/cli-tests/FR-3-jump-location-tool.md +515 -0
  26. data/docs/specs/fr-002-gpt-context-help-system.md +265 -0
  27. data/docs/specs/fr-003-jump-location-tool.md +779 -0
  28. data/docs/specs/zsh-history-tool.md +820 -0
  29. data/docs/uat/FR-3-jump-location-tool.md +741 -0
  30. data/exe/jump +11 -0
  31. data/exe/{subtitle_manager → subtitle_processor} +1 -1
  32. data/exe/zsh_history +11 -0
  33. data/lib/appydave/tools/configuration/openai.rb +1 -1
  34. data/lib/appydave/tools/dam/file_helper.rb +28 -0
  35. data/lib/appydave/tools/dam/project_listing.rb +4 -30
  36. data/lib/appydave/tools/dam/s3_operations.rb +2 -1
  37. data/lib/appydave/tools/dam/ssd_status.rb +226 -0
  38. data/lib/appydave/tools/dam/status.rb +3 -51
  39. data/lib/appydave/tools/jump/cli.rb +561 -0
  40. data/lib/appydave/tools/jump/commands/add.rb +52 -0
  41. data/lib/appydave/tools/jump/commands/base.rb +43 -0
  42. data/lib/appydave/tools/jump/commands/generate.rb +153 -0
  43. data/lib/appydave/tools/jump/commands/remove.rb +58 -0
  44. data/lib/appydave/tools/jump/commands/report.rb +214 -0
  45. data/lib/appydave/tools/jump/commands/update.rb +42 -0
  46. data/lib/appydave/tools/jump/commands/validate.rb +54 -0
  47. data/lib/appydave/tools/jump/config.rb +233 -0
  48. data/lib/appydave/tools/jump/formatters/base.rb +48 -0
  49. data/lib/appydave/tools/jump/formatters/json_formatter.rb +19 -0
  50. data/lib/appydave/tools/jump/formatters/paths_formatter.rb +21 -0
  51. data/lib/appydave/tools/jump/formatters/table_formatter.rb +183 -0
  52. data/lib/appydave/tools/jump/location.rb +134 -0
  53. data/lib/appydave/tools/jump/path_validator.rb +47 -0
  54. data/lib/appydave/tools/jump/search.rb +230 -0
  55. data/lib/appydave/tools/subtitle_processor/transcript.rb +51 -0
  56. data/lib/appydave/tools/version.rb +1 -1
  57. data/lib/appydave/tools/zsh_history/command.rb +37 -0
  58. data/lib/appydave/tools/zsh_history/config.rb +235 -0
  59. data/lib/appydave/tools/zsh_history/filter.rb +184 -0
  60. data/lib/appydave/tools/zsh_history/formatter.rb +75 -0
  61. data/lib/appydave/tools/zsh_history/parser.rb +101 -0
  62. data/lib/appydave/tools.rb +25 -0
  63. data/package.json +1 -1
  64. metadata +51 -4
@@ -0,0 +1,325 @@
1
+ # GPT Context Gatherer - Architecture & Data Flow
2
+
3
+ **Overview**: A lightweight, stateless file collection system with three core components.
4
+
5
+ ---
6
+
7
+ ## System Overview
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────────────────────────────────┐
11
+ │ GPT Context System │
12
+ ├─────────────────────────────────────────────────────────────────────┤
13
+ │ │
14
+ │ ┌─────────────┐ ┌─────────────────┐ ┌──────────────────┐ │
15
+ │ │ CLI │───▶│ FileCollector │───▶│ OutputHandler │ │
16
+ │ │ (bin/gpt_ │ │ │ │ │ │
17
+ │ │ context.rb)│ │ - Pattern match │ │ - Clipboard │ │
18
+ │ └─────────────┘ │ - Tree build │ │ - File write │ │
19
+ │ │ │ - Content read │ └──────────────────┘ │
20
+ │ │ │ - JSON format │ │ │
21
+ │ ▼ │ - Aider format │ ▼ │
22
+ │ ┌─────────────┐ └─────────────────┘ ┌──────────────────┐ │
23
+ │ │ Options │ │ Output │ │
24
+ │ │ (Struct) │ │ - Clipboard │ │
25
+ │ └─────────────┘ │ - Files (.txt) │ │
26
+ │ │ - JSON │ │
27
+ │ └──────────────────┘ │
28
+ └─────────────────────────────────────────────────────────────────────┘
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Core Components
34
+
35
+ ### 1. Options (Configuration)
36
+
37
+ **File**: `lib/appydave/tools/gpt_context/options.rb`
38
+
39
+ A `Struct` with keyword initialization that holds all configuration:
40
+
41
+ | Property | Type | Default | Purpose |
42
+ |----------|------|---------|---------|
43
+ | `include_patterns` | Array | `[]` | Glob patterns for files to include |
44
+ | `exclude_patterns` | Array | `[]` | Glob patterns for files to exclude |
45
+ | `format` | String | `'tree,content'` | Output format(s), comma-separated |
46
+ | `line_limit` | Integer | `nil` | Max lines per file (nil = unlimited) |
47
+ | `debug` | String | `'none'` | Debug level: none, info, params, debug |
48
+ | `output_target` | Array | `[]` | Output destinations (clipboard/files) |
49
+ | `working_directory` | String | `nil` | Base directory for file collection |
50
+ | `prompt` | String | `nil` | Prompt text for aider format |
51
+
52
+ **Design choice**: Using `Struct` provides:
53
+ - Lightweight data container
54
+ - Named parameters via `keyword_init: true`
55
+ - Default values in initializer
56
+ - No ActiveModel dependency
57
+
58
+ ### 2. FileCollector (Core Logic)
59
+
60
+ **File**: `lib/appydave/tools/gpt_context/file_collector.rb`
61
+
62
+ The heart of the system. Responsibilities:
63
+
64
+ 1. **Pattern matching** - Expand glob patterns to file lists
65
+ 2. **Exclusion filtering** - Remove files matching exclude patterns
66
+ 3. **Content reading** - Read file contents with optional line limits
67
+ 4. **Format generation** - Build output in requested format(s)
68
+
69
+ **Key methods**:
70
+
71
+ | Method | Purpose |
72
+ |--------|---------|
73
+ | `build` | Main entry point, orchestrates format generation |
74
+ | `build_tree` | Generate ASCII tree structure |
75
+ | `build_content` | Concatenate file contents with headers |
76
+ | `build_json` | Generate JSON with tree and content |
77
+ | `build_aider` | Generate aider CLI command |
78
+ | `excluded?` | Check if file matches exclusion patterns |
79
+
80
+ ### 3. OutputHandler (Delivery)
81
+
82
+ **File**: `lib/appydave/tools/gpt_context/output_handler.rb`
83
+
84
+ Handles output to multiple targets:
85
+
86
+ | Target | Behavior |
87
+ |--------|----------|
88
+ | `clipboard` | Uses `Clipboard` gem to copy content |
89
+ | File path | Writes content to specified file |
90
+
91
+ **Path resolution**: Relative paths are resolved against `working_directory`.
92
+
93
+ ---
94
+
95
+ ## Data Flow
96
+
97
+ ### 1. Input Processing
98
+
99
+ ```
100
+ CLI Arguments
101
+
102
+
103
+ OptionParser ──────▶ Options Struct
104
+
105
+
106
+ Validation (patterns required)
107
+
108
+
109
+ Default application (clipboard if no -o)
110
+ ```
111
+
112
+ ### 2. File Collection
113
+
114
+ ```
115
+ Include Patterns ──────┐
116
+
117
+ Dir.glob()
118
+
119
+
120
+ ┌──────────────────┐
121
+ │ For each file: │
122
+ │ - Check exclude │
123
+ │ - Skip if dir │
124
+ │ - Add to list │
125
+ └──────────────────┘
126
+
127
+
128
+ Filtered File List
129
+ ```
130
+
131
+ ### 3. Format Generation
132
+
133
+ ```
134
+ Format String (e.g., "tree,content")
135
+
136
+
137
+ Split by comma
138
+
139
+ ├──▶ 'tree' ──▶ build_tree()
140
+ ├──▶ 'content' ──▶ build_content()
141
+ ├──▶ 'json' ──▶ build_json()
142
+ └──▶ 'aider' ──▶ build_aider()
143
+
144
+
145
+ Join with "\n\n"
146
+
147
+
148
+ Combined Output String
149
+ ```
150
+
151
+ ### 4. Output Delivery
152
+
153
+ ```
154
+ Combined Output
155
+
156
+
157
+ OutputHandler.execute()
158
+
159
+ ├──▶ 'clipboard' ──▶ Clipboard.copy()
160
+
161
+ └──▶ file path ──▶ File.write()
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Output Formats
167
+
168
+ ### Tree Format
169
+
170
+ ASCII art directory structure:
171
+
172
+ ```
173
+ ├─ lib
174
+ │ ├─ appydave
175
+ │ │ └─ tools
176
+ │ │ └─ gpt_context
177
+ │ │ ├─ file_collector.rb
178
+ │ │ ├─ options.rb
179
+ │ │ └─ output_handler.rb
180
+ └─ bin
181
+ └─ gpt_context.rb
182
+ ```
183
+
184
+ **Algorithm**: Build nested hash from path parts, then render with box-drawing characters.
185
+
186
+ ### Content Format
187
+
188
+ Concatenated file contents with headers:
189
+
190
+ ```
191
+ # file: lib/appydave/tools/gpt_context/options.rb
192
+
193
+ # frozen_string_literal: true
194
+
195
+ module Appydave
196
+ module Tools
197
+ module GptContext
198
+ Options = Struct.new(
199
+ ...
200
+ )
201
+ end
202
+ end
203
+ end
204
+
205
+ # file: lib/appydave/tools/gpt_context/file_collector.rb
206
+
207
+ # frozen_string_literal: true
208
+ ...
209
+ ```
210
+
211
+ ### JSON Format
212
+
213
+ Structured data with both tree and content:
214
+
215
+ ```json
216
+ {
217
+ "tree": {
218
+ "lib": {
219
+ "appydave": {
220
+ "tools": {
221
+ "gpt_context": {
222
+ "options.rb": {},
223
+ "file_collector.rb": {}
224
+ }
225
+ }
226
+ }
227
+ }
228
+ },
229
+ "content": [
230
+ {
231
+ "file": "lib/appydave/tools/gpt_context/options.rb",
232
+ "content": "# frozen_string_literal: true\n..."
233
+ }
234
+ ]
235
+ }
236
+ ```
237
+
238
+ ### Aider Format
239
+
240
+ Command-line for aider tool:
241
+
242
+ ```
243
+ aider --message "Add logging to all methods" lib/foo.rb lib/bar.rb lib/baz.rb
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Pattern Matching
249
+
250
+ ### Include Patterns
251
+
252
+ Uses Ruby's `Dir.glob` with standard glob syntax:
253
+
254
+ | Pattern | Matches |
255
+ |---------|---------|
256
+ | `*.rb` | Ruby files in current directory |
257
+ | `**/*.rb` | Ruby files in all subdirectories |
258
+ | `lib/**/*.rb` | Ruby files under lib/ |
259
+ | `{lib,spec}/**/*.rb` | Ruby files under lib/ or spec/ |
260
+
261
+ ### Exclude Patterns
262
+
263
+ Uses `File.fnmatch` with `FNM_PATHNAME | FNM_DOTMATCH` flags:
264
+
265
+ | Pattern | Excludes |
266
+ |---------|----------|
267
+ | `spec/**/*` | Everything under spec/ |
268
+ | `**/node_modules/**/*` | All node_modules directories |
269
+ | `*.log` | Log files |
270
+
271
+ **Important**: Exclude patterns are checked AFTER include patterns match.
272
+
273
+ ---
274
+
275
+ ## State Management
276
+
277
+ GPT Context is **stateless**:
278
+
279
+ - No database
280
+ - No configuration files (beyond CLI options)
281
+ - No history tracking
282
+ - No caching
283
+
284
+ Each invocation:
285
+ 1. Reads options from CLI
286
+ 2. Collects files from filesystem
287
+ 3. Outputs result
288
+ 4. Exits
289
+
290
+ This simplicity is intentional - it's a utility, not an application.
291
+
292
+ ---
293
+
294
+ ## Dependencies
295
+
296
+ | Dependency | Purpose | Required? |
297
+ |------------|---------|-----------|
298
+ | `clipboard` | Clipboard operations | Yes |
299
+ | `json` | JSON formatting (stdlib) | Yes |
300
+ | `fileutils` | Directory operations (stdlib) | Yes |
301
+ | `optparse` | CLI parsing (stdlib) | Yes |
302
+
303
+ No external services. No network access. No configuration files.
304
+
305
+ ---
306
+
307
+ ## Error Handling
308
+
309
+ Current approach is minimal (by design):
310
+
311
+ | Scenario | Behavior |
312
+ |----------|----------|
313
+ | No patterns provided | Shows help message, exits |
314
+ | Invalid directory | `Dir.exist?` check, falls back to pwd |
315
+ | File read error | Not explicitly handled (Ruby exception) |
316
+ | Clipboard unavailable | Not explicitly handled (Clipboard gem exception) |
317
+
318
+ **Philosophy**: Fail fast, fail loudly. Users can debug from error messages.
319
+
320
+ ---
321
+
322
+ **Related Documentation**:
323
+ - [Vision & Strategy](./gpt-context-vision.md)
324
+ - [Implementation Guide](./gpt-context-implementation-guide.md)
325
+ - [Usage Guide](../../guides/tools/gpt-context.md)