auto-discover org containers in code() launcher #13

Merged
bryan merged 1 commit from code-fn-auto-discover-org-containers into main 2026-04-23 15:47:31 +00:00
Owner

Summary

code <name> failed to find projects in new ~/code/*/ org-style containers because the function hardcoded only HHS/ and department-of-veterans-affairs/ as fallback search paths. The VA dir no longer exists, and newer containers (common-grants/, games/) weren't reachable.

Replaces the hardcoded fallback with auto-discovery: after checking ~/code/$1, scan ~/code/*/ for any directory matching $1. Containers that are themselves git repos are skipped so a top-level project with a same-named subdir isn't mistaken for a container. Ambiguous matches produce a warning + suggestion to use the explicit container/project form (which already resolves via the direct path).

Changes

  • dot-config/zsh/functions.zsh — replace fixed HHS/department-of-veterans-affairs fallback with ~/code/*/ scan; add ambiguity warning.

Newly reachable projects

  • burnt-ice, playable-workshop-learning-demo (under games/)
  • py-cg-grants-gov, ts-cg-grants-gov (under common-grants/)
  • Any future ~/code/<org>/<project> dir — no edit needed.

Test plan

Verified in a stubbed zsh session (session-script replaced with an echo):

  • Top-level repo: code dotfiles~/code/dotfiles
  • Nested via auto-discovery: code burnt-ice~/code/games/burnt-ice
  • Nested via auto-discovery: code py-cg-grants-gov~/code/common-grants/py-cg-grants-gov
  • Still works for previously hardcoded path: code simpler-grants-protocol~/code/HHS/simpler-grants-protocol
  • Explicit container/project form: code HHS/simpler-grants-protocol → same
  • Missing project: prints "Directory X not found in ~/code or any ~/code/*/ container" and returns 1

Notes

  • Removes the stale department-of-veterans-affairs reference from the error message too.
  • No changes to the . / no-arg behavior.
## Summary `code <name>` failed to find projects in new `~/code/*/` org-style containers because the function hardcoded only `HHS/` and `department-of-veterans-affairs/` as fallback search paths. The VA dir no longer exists, and newer containers (`common-grants/`, `games/`) weren't reachable. Replaces the hardcoded fallback with auto-discovery: after checking `~/code/$1`, scan `~/code/*/` for any directory matching `$1`. Containers that are themselves git repos are skipped so a top-level project with a same-named subdir isn't mistaken for a container. Ambiguous matches produce a warning + suggestion to use the explicit `container/project` form (which already resolves via the direct path). ## Changes - `dot-config/zsh/functions.zsh` — replace fixed `HHS`/`department-of-veterans-affairs` fallback with `~/code/*/` scan; add ambiguity warning. ## Newly reachable projects - `burnt-ice`, `playable-workshop-learning-demo` (under `games/`) - `py-cg-grants-gov`, `ts-cg-grants-gov` (under `common-grants/`) - Any future `~/code/<org>/<project>` dir — no edit needed. ## Test plan Verified in a stubbed zsh session (session-script replaced with an echo): - [x] Top-level repo: `code dotfiles` → `~/code/dotfiles` - [x] Nested via auto-discovery: `code burnt-ice` → `~/code/games/burnt-ice` - [x] Nested via auto-discovery: `code py-cg-grants-gov` → `~/code/common-grants/py-cg-grants-gov` - [x] Still works for previously hardcoded path: `code simpler-grants-protocol` → `~/code/HHS/simpler-grants-protocol` - [x] Explicit container/project form: `code HHS/simpler-grants-protocol` → same - [x] Missing project: prints "Directory X not found in ~/code or any ~/code/*/ container" and returns 1 ## Notes - Removes the stale `department-of-veterans-affairs` reference from the error message too. - No changes to the `.` / no-arg behavior.
The code function hardcoded HHS/ and department-of-veterans-affairs/ as the
only container dirs to search under ~/code. department-of-veterans-affairs/
is gone, and new containers (common-grants/, games/) weren't reachable.

Replace the hardcoded fallback with a scan of ~/code/*/ for any directory
matching the argument. Skip containers that are themselves git repos so a
top-level project with a same-named subdir isn't mistaken for a container.
Warn on ambiguity and suggest the explicit container/project form (which
already resolves via the direct ~/code/$1 path).
bryan changed title from auto-discover org containers in code() launcher to WIP: auto-discover org containers in code() launcher 2026-04-23 14:26:11 +00:00
bryan changed title from WIP: auto-discover org containers in code() launcher to auto-discover org containers in code() launcher 2026-04-23 15:20:07 +00:00
bryan merged commit e206cad825 into main 2026-04-23 15:47:31 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bryan/dotfiles!13
No description provided.