appydave-tools 0.84.0 → 0.86.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/CLAUDE.md +1 -1
  4. data/CONTEXT.md +133 -23
  5. data/bin/configuration.rb +20 -0
  6. data/bin/query_apps.rb +74 -0
  7. data/config/examples/locations.example.json +48 -0
  8. data/config/examples/settings.example.json +9 -0
  9. data/config/random-queries.yml +24 -45
  10. data/context.globs.json +24 -0
  11. data/docs/guides/tools/dam/dam-usage.md +261 -471
  12. data/docs/planning/multi-user-support.md +108 -0
  13. data/docs/planning/query-apps-design.md +344 -0
  14. data/docs/planning/query-skills-plan.md +354 -0
  15. data/docs/specs/jump-add-display-fix.md +249 -0
  16. data/exe/query_apps +7 -0
  17. data/lib/appydave/tools/app_context/app_finder.rb +176 -0
  18. data/lib/appydave/tools/app_context/globs_loader.rb +116 -0
  19. data/lib/appydave/tools/app_context/options.rb +28 -0
  20. data/lib/appydave/tools/bank_reconciliation/_doc.md +36 -0
  21. data/lib/appydave/tools/bank_reconciliation/clean/clean_transactions.rb +159 -0
  22. data/lib/appydave/tools/bank_reconciliation/clean/mapper.rb +133 -0
  23. data/lib/appydave/tools/bank_reconciliation/clean/read_transactions.rb +258 -0
  24. data/lib/appydave/tools/bank_reconciliation/models/transaction.rb +158 -0
  25. data/lib/appydave/tools/brain_context/options.rb +19 -2
  26. data/lib/appydave/tools/configuration/example_installer.rb +72 -0
  27. data/lib/appydave/tools/configuration/models/bank_reconciliation_config.rb +152 -0
  28. data/lib/appydave/tools/configuration/models/settings_config.rb +12 -0
  29. data/lib/appydave/tools/jump/formatters/table_formatter.rb +16 -5
  30. data/lib/appydave/tools/version.rb +1 -1
  31. data/lib/appydave/tools/zsh_history/config.rb +2 -2
  32. data/lib/appydave/tools/zsh_history/filter.rb +10 -4
  33. data/lib/appydave/tools.rb +12 -0
  34. data/package.json +1 -1
  35. metadata +36 -2
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: Multi-User Support — AppyDave Tools
3
+ status: planning
4
+ created: 2026-04-05
5
+ context: Lars onboarding — first external user of appydave-tools
6
+ ---
7
+
8
+ # Multi-User Support
9
+
10
+ ## Current State
11
+
12
+ AppyDave Tools was built for a single user on David's M4 creator machine. It is not intentionally single-user — the architecture is already mostly correct — but it has never been tested with a second person's folder structure.
13
+
14
+ **What works for multi-user today:**
15
+ - Config is stored in `~/.config/appydave/` — per-user, not shared, no collision
16
+ - `gem install appydave-tools` gives Lars a clean install with no locations
17
+ - All tools read their paths from `~/.config/appydave/locations.json` at runtime
18
+
19
+ **What doesn't work yet:**
20
+ - Lars starts with an empty `locations.json` — no seed, no onboarding flow
21
+ - Lars's dev folder structure is unknown (capturing via `ls ~/dev/` in next relay session)
22
+ - David's `locations.json` has 100 entries, all pointing to `/Users/davidcruwys/` — not portable
23
+ - Brain query, OMI query, and LLM context tools likely assume specific location keys exist (e.g., `brain`, `omi`) — if Lars's keys are different or missing, these will fail silently or error
24
+
25
+ ---
26
+
27
+ ## Tools Lars Needs
28
+
29
+ ### 1. Jump (immediate value)
30
+
31
+ The `jump` command generates shell aliases for folder navigation. Lars currently has only `jb` (jump to brain) — hardcoded, not managed by this tool.
32
+
33
+ **What Lars gets after setup:**
34
+ - Any folder registered in `locations.json` becomes a `j<alias>` shell alias
35
+ - Running `jump generate` writes a `.aliases` file; sourcing it activates them
36
+ - He can register his `~/dev/clients/`, relay folder, growth-intelligence repo, etc.
37
+
38
+ **Blocker:** He needs entries in `locations.json` before any aliases are generated.
39
+
40
+ ### 2. Brain Query
41
+
42
+ Queries Lars's second brain folder structure. Likely reads from a location keyed `brain` in `locations.json`.
43
+
44
+ **Risk:** Key name may be hardcoded. Need to verify the tool reads `brain` key or is configurable.
45
+
46
+ ### 3. OMI Query
47
+
48
+ Queries saved OMI transcripts. Likely reads from a location keyed `omi` or a path in `settings.json`.
49
+
50
+ **Risk:** Lars's OMI intake is at `~/dev/raw-intake/omi/` — this needs to be registered in his config.
51
+
52
+ ### 4. LLM Context Builder
53
+
54
+ Builds context bundles for pasting into LLM sessions. Probably reads from multiple registered locations.
55
+
56
+ **Risk:** May depend on several location keys existing. Needs testing with minimal config.
57
+
58
+ ---
59
+
60
+ ## Installation Plan for Lars
61
+
62
+ ```bash
63
+ gem install appydave-tools
64
+ ```
65
+
66
+ Then verify:
67
+
68
+ ```bash
69
+ appydave --version
70
+ appydave jump report
71
+ ```
72
+
73
+ `jump report` with an empty `locations.json` should return zero locations without error — if it crashes, that's the first bug to fix.
74
+
75
+ ### After Install — Bootstrap Lars's Locations
76
+
77
+ Lars needs a minimal seed `locations.json` tailored to his machine. Suggested starting set once we know his `~/dev/` structure:
78
+
79
+ | Key | Path (approximate) | Purpose |
80
+ |-----|--------------------|---------|
81
+ | `dev` | `~/dev` | Root dev folder |
82
+ | `brain` | `~/dev/brains/` | Second brain |
83
+ | `omi` | `~/dev/raw-intake/omi/` | OMI transcripts |
84
+ | `clients` | `~/dev/clients/` | Client work |
85
+ | `growth` | `~/dev/clients/lars-projects/growth-intelligence/` | Growth Intelligence repo |
86
+ | `relay` | `~/Dropbox/relay/people/david-lars/` | Relay folder |
87
+
88
+ Lars adds these via `appydave jump add` or by editing `~/.config/appydave/locations.json` directly.
89
+
90
+ ---
91
+
92
+ ## Known Gaps to Resolve
93
+
94
+ 1. **Empty-config behaviour** — run all four tools with a blank `locations.json` and confirm they fail gracefully, not with a Ruby stack trace
95
+ 2. **Location key conventions** — are keys like `brain` and `omi` hardcoded in brain-query and omi-query, or configurable? Document the expected keys.
96
+ 3. **Aliases output path** — `aliases-output-path` in `settings.json` tells jump where to write the `.aliases` file. Lars needs this set before `jump generate` works. Default: `~/.config/appydave/aliases.sh` (check current default).
97
+ 4. **Shell sourcing** — after `jump generate`, Lars needs `source ~/.config/appydave/aliases.sh` (or equivalent) in his `.zshrc`. This needs to be part of the setup guide.
98
+ 5. **Ruby version** — gemspec requires `>= 2.7`. Lars's Ruby version is unknown — check during session.
99
+
100
+ ---
101
+
102
+ ## What This Is Not
103
+
104
+ This is not a multi-tenant SaaS problem. Each user has their own machine, their own `~/.config/appydave/`, and their own gem install. There is no shared state. The "multi-user support" work is really:
105
+
106
+ - Making sure the tools don't assume David's paths
107
+ - Providing a repeatable onboarding flow for a new machine
108
+ - Writing a short setup guide Lars can follow independently next time
@@ -0,0 +1,344 @@
1
+ # query_apps — App File Discovery Tool
2
+
3
+ **Purpose**: A new CLI tool in appydave-tools that returns file paths from any registered application, using pre-computed named glob patterns stored in each project's `context.globs.json`.
4
+
5
+ **Status**: Planning
6
+ **Created**: 2026-04-05
7
+ **Backlog**: B041
8
+
9
+ ---
10
+
11
+ ## Problem
12
+
13
+ When an LLM agent (or David) needs files from a project, they currently have to:
14
+ 1. Know the project's directory structure
15
+ 2. Manually construct glob patterns
16
+ 3. Hope the patterns are still valid as the project evolves
17
+
18
+ There's no way to say "give me the backend code from FliHub" or "get me all docs from AngelEye" without prior knowledge of each project's layout. `query_brain` solves this for brains, `query_omi` solves it for OMI transcripts — but there's nothing for applications.
19
+
20
+ ---
21
+
22
+ ## Design
23
+
24
+ ### Architecture — Same Pattern as BrainQuery and OmiQuery
25
+
26
+ ```
27
+ bin/query_apps.rb CLI entry point
28
+ lib/appydave/tools/
29
+ app_context/
30
+ app_finder.rb Core query engine (like BrainQuery, OmiQuery)
31
+ options.rb CLI option parsing
32
+ spec/appydave/tools/
33
+ app_context/
34
+ app_query_spec.rb Unit tests
35
+ options_spec.rb
36
+ ```
37
+
38
+ ### Data Flow
39
+
40
+ ```
41
+ locations.json → Find app path by key/alias/fuzzy match
42
+
43
+ context.globs.json → Read named glob patterns from project root
44
+
45
+ Glob expansion → Resolve patterns against actual filesystem
46
+
47
+ File paths (stdout) → One per line, pipe to llm_context
48
+ ```
49
+
50
+ ### The Sidecar File — `context.globs.json`
51
+
52
+ Generated by the `system-context` skill alongside `CONTEXT.md`. Lives in each project root.
53
+
54
+ ```json
55
+ {
56
+ "generated": "2026-04-05",
57
+ "generator": "system-context",
58
+ "project": "flihub",
59
+ "pattern": "rvets",
60
+ "globs": {
61
+ "docs": ["docs/**/*.md", "BACKLOG.md"],
62
+ "types": ["shared/**/*.ts"],
63
+ "config": ["server/config.json", "*.config.*", ".env.example"],
64
+ "server": ["server/src/**/*.ts"],
65
+ "client": ["client/src/**/*.tsx"],
66
+ "services": ["server/src/services/**/*.ts"],
67
+ "routes": ["server/src/routes/**/*.ts"],
68
+ "components": ["client/src/components/**/*.tsx"],
69
+ "views": ["client/src/views/**/*.tsx"],
70
+ "tests": ["**/*.test.ts", "**/*.spec.ts"],
71
+ "styles": ["**/*.css"],
72
+ "mockups": [".mochaccino/designs/**/*.html"],
73
+ "planning": ["docs/prd/**/*.md", "docs/planning/**/*.md"],
74
+ "context": ["CLAUDE.md", "CONTEXT.md", "STEERING.md"]
75
+ },
76
+ "aliases": {
77
+ "backend": ["services", "routes"],
78
+ "frontend": ["components", "views", "styles"],
79
+ "api": ["routes", "types"],
80
+ "data-layer": ["types", "schema"],
81
+ "react": ["components", "views"],
82
+ "ui": ["components", "views", "styles"]
83
+ },
84
+ "composites": {
85
+ "understand": ["context", "docs", "types", "config"],
86
+ "codebase": ["services", "routes", "components", "views"],
87
+ "all-code": ["server", "client"],
88
+ "full": ["*"]
89
+ }
90
+ }
91
+ ```
92
+
93
+ **Key design choices:**
94
+ - **Globs, not file lists** — durable as files are added/removed; only stale if project structure changes fundamentally
95
+ - **Named categories** — "docs", "services", "types" are human-friendly handles
96
+ - **Aliases** — "backend" → services + routes. Handles vague user intent
97
+ - **Composites** — "understand" → context + docs + types + config. Pre-built bundles for common queries
98
+ - **Pattern type** — "rvets", "nextjs", "ruby-gem", "python" enables cross-app queries by architecture
99
+
100
+ ### App Resolution — 4-Tier (Same as BrainQuery)
101
+
102
+ ```
103
+ 1. Exact key match: "flihub" → locations.json key
104
+ 2. Alias match: "hub" → locations.json aliases (future)
105
+ 3. Jump alias match: "jfli-hub" → locations.json jump field
106
+ 4. Substring/fuzzy: "fli" → partial match on key or description
107
+ ```
108
+
109
+ Source: `~/.config/appydave/locations.json` (the `context` field tells us if `context.globs.json` exists).
110
+
111
+ ### Glob Resolution — 3-Tier
112
+
113
+ When the user asks for `--glob backend`:
114
+
115
+ ```
116
+ 1. Direct glob name: "services" → globs.services
117
+ 2. Alias match: "backend" → aliases.backend → [services, routes]
118
+ 3. Composite match: "understand" → composites.understand → [context, docs, types, config]
119
+ 4. Fuzzy fallback: "back" → closest match to "backend"
120
+ ```
121
+
122
+ ### CLI Interface
123
+
124
+ ```bash
125
+ # Basic: get docs from FliHub
126
+ query_apps flihub --glob docs
127
+
128
+ # Alias: "backend" resolves to services + routes
129
+ query_apps flihub --glob backend
130
+
131
+ # Composite: "understand" = context + docs + types + config
132
+ query_apps angeleye --glob understand
133
+
134
+ # Multiple globs (comma-separated)
135
+ query_apps flihub --glob docs,types,config
136
+
137
+ # Cross-app: all RVETS apps, backend code
138
+ query_apps --pattern rvets --glob backend
139
+
140
+ # List available globs for a project
141
+ query_apps flihub --list
142
+
143
+ # List all registered apps that have context.globs.json
144
+ query_apps --list-apps
145
+
146
+ # Meta output (JSON with file counts, not paths)
147
+ query_apps flihub --glob backend --meta
148
+
149
+ # Pipe to llm_context (the whole point)
150
+ query_apps flihub --glob understand | llm_context --stdin -f content
151
+ query_apps angeleye --glob services | llm_context --stdin -f tree
152
+ ```
153
+
154
+ ### Output
155
+
156
+ Default: one file path per line (same as `query_brain` and `query_omi`).
157
+
158
+ ```
159
+ /Users/davidcruwys/dev/ad/flivideo/flihub/server/src/services/watcher.service.ts
160
+ /Users/davidcruwys/dev/ad/flivideo/flihub/server/src/services/naming.service.ts
161
+ /Users/davidcruwys/dev/ad/flivideo/flihub/server/src/routes/index.ts
162
+ ```
163
+
164
+ With `--meta`:
165
+ ```json
166
+ {
167
+ "app": "flihub",
168
+ "path": "/Users/davidcruwys/dev/ad/flivideo/flihub",
169
+ "pattern": "rvets",
170
+ "matched_globs": ["services", "routes"],
171
+ "resolved_from": "backend (alias)",
172
+ "file_count": 14
173
+ }
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Standard Vocabulary
179
+
180
+ These category names are conventions enforced by `system-context` when generating `context.globs.json`. Projects can add custom categories beyond these.
181
+
182
+ | Category | Aliases | Description |
183
+ |----------|---------|-------------|
184
+ | `docs` | documentation, planning, specs | Markdown documentation |
185
+ | `types` | models, schema, data-layer | Type definitions / data shapes |
186
+ | `config` | settings, configuration | Config files |
187
+ | `services` | backend, business-logic | Server-side logic |
188
+ | `routes` | api, endpoints | API routes |
189
+ | `components` | ui, frontend, react | UI components |
190
+ | `views` | pages, screens | Page-level views |
191
+ | `tests` | specs, test | Test files |
192
+ | `styles` | css, styling | Stylesheets |
193
+ | `context` | meta, about | CLAUDE.md, CONTEXT.md, STEERING.md |
194
+
195
+ Standard composites:
196
+
197
+ | Composite | Expands to |
198
+ |-----------|-----------|
199
+ | `understand` | context + docs + types + config |
200
+ | `codebase` | services + routes + components + views |
201
+ | `full` | all glob categories |
202
+
203
+ ### Pattern-Specific Categories
204
+
205
+ These only appear in projects with the matching `pattern` type:
206
+
207
+ | Pattern | Extra Categories |
208
+ |---------|-----------------|
209
+ | `rvets` | mockups (`.mochaccino/`), shared |
210
+ | `nextjs` | actions, validation, auth, middleware, decisions (KDD) |
211
+ | `ruby-gem` | lib, bin, gemspec |
212
+ | `python` | src, requirements |
213
+ | `bmad` | bmad-config, bmad-output, workflows |
214
+
215
+ ---
216
+
217
+ ## System-Context Integration
218
+
219
+ The `system-context` skill (in appydave-plugins) needs a small addition:
220
+
221
+ 1. **After writing CONTEXT.md**, also generate `context.globs.json`
222
+ 2. **Detect project pattern** (rvets, nextjs, ruby-gem, python) from package.json / Gemfile / pyproject.toml
223
+ 3. **Scan the directory** and map discovered paths to standard category names
224
+ 4. **Add project-specific categories** for non-standard directories (e.g., `.mochaccino/` in RVETS apps)
225
+ 5. **Generate aliases and composites** using the standard vocabulary plus any project-specific additions
226
+
227
+ The `context.globs.json` file should be listed in CONTEXT.md's `sources:` frontmatter.
228
+
229
+ ---
230
+
231
+ ## Locations.json Integration
232
+
233
+ The `context` field in `locations.json` already points to `CONTEXT.md`. We can extend this:
234
+
235
+ ```json
236
+ {
237
+ "key": "flihub",
238
+ "path": "/Users/davidcruwys/dev/ad/flivideo/flihub",
239
+ "context": "CONTEXT.md",
240
+ "context_globs": "context.globs.json",
241
+ ...
242
+ }
243
+ ```
244
+
245
+ Or, simpler: `query_apps` can just check for `context.globs.json` in the same directory as `CONTEXT.md` without needing a separate field.
246
+
247
+ ---
248
+
249
+ ## Provenance Chain
250
+
251
+ ```
252
+ system-context skill (generates)
253
+
254
+ context.globs.json (sidecar in each project)
255
+
256
+ query_apps CLI tool (reads locations.json + globs file, resolves names, expands globs)
257
+
258
+ file paths on stdout
259
+
260
+ llm_context CLI tool (assembles content from file paths)
261
+
262
+ LLM-ready payload
263
+ ```
264
+
265
+ The full query ecosystem:
266
+
267
+ ```
268
+ query_brain → brain files ─┐
269
+ query_omi → OMI transcripts ├─→ llm_context → LLM payload
270
+ query_apps → app files ─┘
271
+ ```
272
+
273
+ ---
274
+
275
+ ## Skill Wrappers (Thin Shims)
276
+
277
+ Each query tool should have a corresponding skill in `appydave-plugins/appydave/skills/`:
278
+
279
+ | CLI Tool | Skill | Status |
280
+ |----------|-------|--------|
281
+ | `query_omi` | `omi-query` | Exists, correct pattern |
282
+ | `query_brain` | (none) | **Needs creating** — thin shim to `query_brain` |
283
+ | `query_apps` | (none) | **Create alongside CLI tool** |
284
+ | `llm_context` | (none) | **Needs creating** — downstream assembler, not a query |
285
+
286
+ The `focus` skill's `resolve_brain.py` should eventually be replaced by a call to `query_brain --find --meta` — the Ruby tool already has the same resolution logic with better test coverage.
287
+
288
+ ---
289
+
290
+ ## Implementation Phases
291
+
292
+ ### Phase 1: context.globs.json Generation
293
+ - Update `system-context` skill to generate `context.globs.json` alongside `CONTEXT.md`
294
+ - Generate for the 12 projects that already have `CONTEXT.md`
295
+ - Validate standard vocabulary coverage
296
+
297
+ ### Phase 2: query_apps CLI Tool
298
+ - `AppQuery` class following BrainQuery/OmiQuery pattern
299
+ - 4-tier app resolution from locations.json
300
+ - 3-tier glob resolution (direct → alias → composite → fuzzy)
301
+ - `find` (file paths) and `find_meta` (structured JSON) methods
302
+ - CLI entry point at `bin/query_apps.rb`
303
+ - Unit tests with fixtures
304
+
305
+ ### Phase 3: Skill Wrappers
306
+ - `app-query` skill in appydave-plugins (thin shim to `query_apps`)
307
+ - `brain-query` skill (thin shim to `query_brain`)
308
+ - `llm-context` skill (thin shim to `llm_context`)
309
+
310
+ ### Phase 4: Cross-App Queries
311
+ - `--pattern rvets` to query across all apps of a pattern type
312
+ - Aggregate results from multiple `context.globs.json` files
313
+
314
+ ---
315
+
316
+ ## Related Files
317
+
318
+ | What | Where |
319
+ |------|-------|
320
+ | BrainQuery (reference impl) | `lib/appydave/tools/brain_context/brain_finder.rb` |
321
+ | OmiQuery (reference impl) | `lib/appydave/tools/brain_context/omi_finder.rb` |
322
+ | FileCollector (downstream) | `lib/appydave/tools/llm_context/file_collector.rb` |
323
+ | Locations registry | `~/.config/appydave/locations.json` |
324
+ | System-context skill | `appydave-plugins/appydave/skills/system-context/SKILL.md` |
325
+ | omi-query skill (pattern) | `appydave-plugins/appydave/skills/omi-query/SKILL.md` |
326
+ | Brain query tests | `spec/appydave/tools/brain_context/brain_query_spec.rb` |
327
+ | OMI query tests | `spec/appydave/tools/brain_context/omi_query_spec.rb` |
328
+
329
+ ---
330
+
331
+ ## Open Questions
332
+
333
+ 1. Should `context.globs.json` live at project root or in `.claude/`?
334
+ - Root is simpler and visible; `.claude/` keeps it with other agent artifacts
335
+ - Leaning root (next to `CONTEXT.md`)
336
+
337
+ 2. Should fuzzy matching use Levenshtein distance or simpler substring?
338
+ - BrainQuery uses substring — probably sufficient here too
339
+
340
+ 3. Should `query_apps` live in `brain_context/` module or a new `app_context/` module?
341
+ - New module — apps are not brains, even though the query pattern is the same
342
+
343
+ 4. Should the `context` field in locations.json be extended to `context_globs`, or should query_apps just look for the file conventionally?
344
+ - Leaning conventional (just check for `context.globs.json` in the project dir)