mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 04:59:34 +01:00
`readCodemanEnv()` in cli.ts and `parseEnvFile()`/`readCodemanCredentials()` in tui-client.ts were two copies of the same `.env` reader (the TUI's said so in a comment), and `codeman agent` was about to need a third. They move into `src/codeman-credentials.ts`; `codeman attach` and the TUI read from it, and the TUI keeps re-exporting its names so nothing that imports them changes. The lookup order is one pure function, `credentialsFrom(env, fileEnv)`: each field from the environment, then the file, username defaulting to `admin` — the order attach and the TUI already used. `readCodemanCredentials` takes the environment as a parameter so a caller with its own (the agent CLI's guard) gets the same answer. The parser now also tolerates an `export ` prefix, which the agent skill's preamble already accepted in the same file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>