make the app-dir (.coily) configurable so the framework owns no consumer's filesystem layout #50

Closed
opened 2026-06-03 10:12:17 +00:00 by coilysiren · 1 comment
Owner

Problem (split out of #49)

cli-guard hardcodes the consumer coily's directory name .coily as a functional default in several places, so the framework owns a specific consumer's filesystem layout:

  • config/paths.go: GlobalDirName = ".coily", LocalDirName = ".coily" (config dir + filename).
  • stscache/stscache.go, scope/scope.go, ghidcache/ghidcache.go: filepath.Join(home, ".coily", "cache").
  • dispatch/interactive.go: /tmp/coily-dispatch-queue.

This is a real leak, not cosmetics:

  • A second consumer (ward) currently inherits ~/.coily/cache, so ward's cache state lands in coily's dir.
  • The framework cannot be adopted by a third consumer without colliding on ~/.coily.

Ask

Make the app-dir (and the derived config/cache/queue paths) configurable. The consumer supplies its own name; cli-guard carries no default tied to one consumer.

  • Add an app-dir/namespace to the relevant Config(s) (or a small paths.Namespace the packages take), e.g. coily passes .coily, ward passes .ward.
  • Route config/paths.go, the three *cache packages, and the dispatch queue dir through it.
  • Update consumers: coily passes .coily (no behavior change for coily), ward passes .ward.
  • Keep the generic-library contract: no consumer name as a default anywhere in the package.

Blast radius

cli-guard API change + coordinated coily and ward updates. Land cli-guard first (consumers pin a commit), then bump each consumer.

Cross-ref

Split from #49 (cosmetic scrub). #49 covers comments/prose/issue-refs/test-fixtures/docs; this covers the functional defaults.

## Problem (split out of #49) cli-guard hardcodes the consumer `coily`'s directory name `.coily` as a functional default in several places, so the framework owns a specific consumer's filesystem layout: - `config/paths.go`: `GlobalDirName = ".coily"`, `LocalDirName = ".coily"` (config dir + filename). - `stscache/stscache.go`, `scope/scope.go`, `ghidcache/ghidcache.go`: `filepath.Join(home, ".coily", "cache")`. - `dispatch/interactive.go`: `/tmp/coily-dispatch-queue`. This is a real leak, not cosmetics: - A second consumer (ward) currently inherits `~/.coily/cache`, so ward's cache state lands in coily's dir. - The framework cannot be adopted by a third consumer without colliding on `~/.coily`. ## Ask Make the app-dir (and the derived config/cache/queue paths) configurable. The consumer supplies its own name; cli-guard carries no default tied to one consumer. - Add an app-dir/namespace to the relevant Config(s) (or a small `paths.Namespace` the packages take), e.g. coily passes `.coily`, ward passes `.ward`. - Route `config/paths.go`, the three `*cache` packages, and the dispatch queue dir through it. - Update consumers: coily passes `.coily` (no behavior change for coily), ward passes `.ward`. - Keep the generic-library contract: no consumer name as a default anywhere in the package. ## Blast radius cli-guard API change + coordinated coily and ward updates. Land cli-guard first (consumers pin a commit), then bump each consumer. ## Cross-ref Split from #49 (cosmetic scrub). #49 covers comments/prose/issue-refs/test-fixtures/docs; this covers the functional defaults.
Author
Owner

Additional functional sites surfaced during the Part A scrub (#49)

The cosmetic scrub deliberately left these functional consumer-specific defaults for this refactor. Full list to genericize when making the app-namespace configurable:

  • config/paths.go: GlobalDirName/LocalDirName = ".coily" + the derived ~/.coily/... paths.
  • stscache/, scope/, ghidcache/: filepath.Join(home, ".coily", "cache").
  • dispatch/interactive.go: defaultDispatchQueueDir = "/tmp/coily-dispatch-queue".
  • dispatch/cascade.go: COILY_DISPATCH_CASCADE_DEPTH env var (parent->child cross-process contract).
  • lockdown/user_hook.go: the _coily settings.json marker key (consumer's hook-entry identity, matched on re-read).
  • lockdown/defaults.yaml: ships Bash(coily:*) allow + coily pkg/ops/... deny rules and coily-named comments (a consumer-specific default config baked into the framework). lockdown/*_test.go still asserts Bash(coily:*) against this unchanged file.
  • workdir/: SourceCoilysiren const, coilysirenRepo(), COILY_PRIMARY_DIR env, and the ~/projects/coilysiren/ workspace detection (+ matching test assertions).

All are consumer identity/layout the framework should not own. Consumer supplies its namespace; coily passes .coily/COILY_/coily, ward passes its own.

## Additional functional sites surfaced during the Part A scrub (#49) The cosmetic scrub deliberately left these functional consumer-specific defaults for this refactor. Full list to genericize when making the app-namespace configurable: - `config/paths.go`: `GlobalDirName`/`LocalDirName = ".coily"` + the derived `~/.coily/...` paths. - `stscache/`, `scope/`, `ghidcache/`: `filepath.Join(home, ".coily", "cache")`. - `dispatch/interactive.go`: `defaultDispatchQueueDir = "/tmp/coily-dispatch-queue"`. - `dispatch/cascade.go`: `COILY_DISPATCH_CASCADE_DEPTH` env var (parent->child cross-process contract). - `lockdown/user_hook.go`: the `_coily` settings.json marker key (consumer's hook-entry identity, matched on re-read). - `lockdown/defaults.yaml`: ships `Bash(coily:*)` allow + `coily pkg/ops/...` deny rules and coily-named comments (a consumer-specific default config baked into the framework). `lockdown/*_test.go` still asserts `Bash(coily:*)` against this unchanged file. - `workdir/`: `SourceCoilysiren` const, `coilysirenRepo()`, `COILY_PRIMARY_DIR` env, and the `~/projects/coilysiren/` workspace detection (+ matching test assertions). All are consumer identity/layout the framework should not own. Consumer supplies its namespace; coily passes `.coily`/`COILY_`/`coily`, ward passes its own.
Sign in to join this conversation.
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
coilyco-flight-deck/cli-guard#50
No description provided.