Skip to content

fix(add): name the local stack's Compose project after the repository - #273

Merged
Bccorb merged 1 commit into
mainfrom
fix/add-compose-project-name
Oct 13, 2026
Merged

Bccorb merged 1 commit into
mainfrom
fix/add-compose-project-name

Conversation

@Bccorb

@Bccorb Bccorb commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Closes #270

Problem

seamless add --local wrote seamless/docker-compose.yml without a top-level name:, so Compose named the project after the folder holding the file: seamless, in every repository. Two repositories on one machine shared containers and the seamless_pgdata and seamless_auth-keys volumes, so users, sessions and signing keys leaked between unrelated projects.

Change

  • generateAuthStack writes name: <repo>-seamless. composeProjectName derives <repo> from the repository directory: NFKD-normalized with combining marks dropped, lowercased, every run of characters outside [a-z0-9_-] turned into one dash, and leading non-alphanumerics and trailing dashes or underscores trimmed. A name with nothing left (for example 日本語) falls back to app-seamless. Volumes become <repo>-seamless_pgdata and <repo>-seamless_auth-keys.
  • A re-run (interactive replace or --force) keeps the name: already in the file, so a stack keeps its volumes, and a hand-edited name survives.
  • When add replaces a compose file that has no name: (one written by 0.23.0 or earlier), it prints one line saying the old stack ran as project seamless and how to stop it: docker compose -p seamless -f seamless/docker-compose.yml down. Its containers would otherwise keep holding port 5312.
  • The Wrote seamless/ line names the Compose project. seamless help add and the README say how the project is named.
  • The changeset carries the upgrade note: the new name starts with empty volumes, and the old seamless_* volumes may hold other repositories' data, so remove them once nothing uses them.

Known limit: two repositories with the same directory name (for example two checkouts both called api) still get the same project name. The name stays readable on purpose, and a hand edit to name: is kept on later runs.

seamless init

Not changed. init writes docker-compose.yml at the root of the new app directory, so Compose already names the project after the app (my-app_pgdata). The problem here came from add always using a folder named seamless. A name: in the init file would only restate that default. Separately, the init stack pins container_name (seamless-db, seamless-auth), so two init stacks cannot run at the same time. Compose refuses the second one, so nothing is silently shared.

Tests

  • composeProjectName: different repositories give different names, and odd directory names are cleaned up (spaces, uppercase, a leading dot or dash or underscore, accented and non-Latin unicode, parentheses, dots). Every result matches ^[a-z0-9][a-z0-9_-]*$.
  • generateAuthStack: writes name:, keeps it across re-runs and after a hand edit, and reports when it replaces an unnamed stack.
  • add: two repositories get distinct project names. --force keeps the name, and the notice prints only when an unnamed stack is replaced.

Verification

npm run build, npm test (63 files, 1289 passed, 4 skipped), npm run check:types-current, npm run check:templates-pin, and the pre-commit coverage run all pass.

Real run of the built CLI (add --local --yes --skip-install --email=you@example.com </dev/null) in two scratch repositories, Shop App and .blog, then docker compose -f seamless/docker-compose.yml config (Docker 29.8.2):

shop-app-seamless ['shop-app-seamless_auth-keys', 'shop-app-seamless_pgdata']
blog-seamless ['blog-seamless_auth-keys', 'blog-seamless_pgdata']

A --force re-run kept shop-app-seamless. After name: was deleted from the file, a --force run printed the notice and wrote shop-app-seamless again.

Docs to update after release (fells-code/seamless-auth-docs)

  • src/content/docs/operate/add-to-existing-app.mdx L102: sample output now reads Wrote seamless/: docker-compose.yml (Compose project <repo>-seamless), .env, .gitignore.
  • same file, L119 (seamless/docker-compose.yml row) and L123-126 (re-running add --local): add that the compose project is <repo>-seamless and is kept on a re-run, plus the upgrade note for stacks written by 0.23.0 or earlier.
  • src/content/docs/reference/cli-commands.mdx L284-286 (seamless/docker-compose.yml bullet under ### --local): mention the name: <repo>-seamless project and the volume names.

seamless add --local wrote seamless/docker-compose.yml without a top-level name, so Compose named every repository's stack after the seamless/ folder and they shared containers, the database and the signing keys. The file now names its project <repo>-seamless, keeps an existing name on a re-run, and add prints how to stop the old seamless project when it replaces an unnamed stack.

Closes #270
@Bccorb
Bccorb merged commit 253f900 into main Oct 13, 2026
5 checks passed
@Bccorb
Bccorb deleted the fix/add-compose-project-name branch October 15, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

seamless add: every repo's local stack shares the Compose project name 'seamless'

1 participant