feat(coder-utils): nest logs under module_directory/logs#870
Merged
Conversation
Move pre_install.log, install.log, post_install.log, and start.log from the flat module_directory to a logs/ subdirectory. This keeps the scripts directory (install.sh, pre_install.sh, etc.) clean and separates executable artifacts from runtime output. Each coder_script mkdirs the logs/ sub-path before tee runs so the directory exists even when the post_install or start script is the first consumer after install. Breaking for consumers that read pre_install.log et al. directly from module_directory; they must look under module_directory/logs instead.
This was referenced Apr 23, 2026
35C4n0r
reviewed
Apr 23, 2026
35C4n0r
reviewed
Apr 23, 2026
35C4n0r
reviewed
Apr 23, 2026
35C4n0r
approved these changes
Apr 23, 2026
…l and start post_install sync-depends on install, and start sync-depends on install (and post_install when present). The install script (and pre_install when configured) mkdirs the logs/ sub-path, so later scripts find it already present. Addresses review feedback on #870.
matifali
added a commit
that referenced
this pull request
Apr 23, 2026
v1.2.0 of coder-utils (#870) is the first release that nests logs under ${module_directory}/logs/, matching the $HOME/.coder-modules/coder/claude-code/logs/ paths documented and tested in this module. Move the source ref off the feature branch and onto the release tag now that it has shipped. The registry proxy at registry.coder.com does not yet index v1.2.0, so keep the git:: source for now and swap to the HCP-style source in a follow-up once indexing catches up.
This was referenced Apr 23, 2026
matifali
added a commit
that referenced
this pull request
Apr 23, 2026
## Summary
Move script files from the flat `${module_directory}` to a `scripts/`
subdirectory, and prefix each script's filename with
`${agent_name}-utils-` so multiple `coder-utils` instances can safely
share a `module_directory`. Mirrors the layout #870 established for
`logs/` and aligns with the Module Data Layout standard in `AGENTS.md`
(#869).
## Changes
- Compute `local.scripts_directory = "${var.module_directory}/scripts"`
and use it for every `*.sh` path.
- Script filenames are now
`${agent_name}-utils-{pre_install,install,post_install,start}.sh` so two
`coder-utils` instances don't collide on disk.
- Pre-install and install `coder_script`s `mkdir -p` the `scripts/`
sub-path before writing their `.sh`; post-install and start sync-depend
on install, so the directory already exists by the time they run.
- Update the `module_directory` description to call out the nested
`scripts/` and `logs/` paths.
- Add `test_scripts_nested_under_module_directory` asserting the new
paths (including the `${agent_name}-utils-` prefix) and the `mkdir -p`
in each script.
- README: add a "Script file locations" section documenting the new
layout.
- Bump module version to `v1.3.0`.
## Breaking Changes
Consumers reading `${module_directory}/install.sh` (and friends)
directly must look under
`${module_directory}/scripts/${agent_name}-utils-install.sh` instead. No
in-repo consumers exist today.
## Validation
- `terraform fmt -recursive` clean
- `terraform validate` clean
- `terraform test` → 16/16 pass (includes the new
`test_scripts_nested_under_module_directory`)
- `bun test main.test.ts` → 5/5 pass
- `prettier --check` clean
> 🤖 This PR was created with the help of Coder Agents, and needs a human
review. 🧑💻
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move
pre_install.log,install.log,post_install.log, andstart.logfrom the flat${module_directory}to alogs/subdirectory. Keeps the scripts directory clean and separates executable artifacts from runtime output.Changes
local.log_directory = "${var.module_directory}/logs"and use it for every*.logpath.coder_scriptmkdir -ps thelogs/sub-path so the directory exists even whenpost_installorstartis the first consumer afterinstall.module_directorydescription to call out the nested logs path.logs/prefix.test_logs_nested_under_module_directoryasserting the new paths and themkdir -pin each script.v1.2.0.Breaking Changes
Consumers reading
${module_directory}/install.log(and friends) directly must look under${module_directory}/logs/instead. The only in-repo consumer (coder/claude-code) is migrating in #861.Validation
terraform fmt -recursivecleanterraform validatecleanterraform test→ 15/15 passprettier --checkclean