Skip to content

Subcommands only work from the exact launch directory (path-hashed container names) #69

Description

@alanbem

Problem

get_container_name() hashes $PWD, and every subcommand (stop, rm, exec, ssh server, update, git, aws, gh, attach) resolves the container from the current directory. Consequences:

cd ~/projects/myapp && dclaude        # creates container A
cd ~/projects/myapp/src
dclaude stop                          # "No container found for this directory"
dclaude                               # silently creates a SECOND container for the same project
  • Day-to-day commands fail confusingly from subdirectories
  • Plain dclaude from a subdirectory spawns a duplicate container (own volume mounts, own SSH port) for what the user thinks is the same project
  • Containers accumulate per-path with no dclaude ls to see them (cleanup requires the raw docker ps --filter name=dclaude incantation)

Proposed fix

  1. Resolve the "project root" before hashing — walk up to the nearest .dclaude file or .git directory (the .dclaude walk already exists in find_config_file()), falling back to $PWD
  2. Add dclaude ls to enumerate dclaude containers with their paths (path could be stored as a label at creation, e.g. dclaude.path=$HOST_PATH)

Backward-compat note: changing the hash input orphans existing containers; a transition warning or fallback lookup by label would help.


Found during a full-project code review.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions