Skip to content

feat(coder-utils): nest logs under module_directory/logs#870

Merged
matifali merged 3 commits intomainfrom
feat/coder-utils-nest-logs
Apr 23, 2026
Merged

feat(coder-utils): nest logs under module_directory/logs#870
matifali merged 3 commits intomainfrom
feat/coder-utils-nest-logs

Conversation

@matifali
Copy link
Copy Markdown
Member

Summary

Move pre_install.log, install.log, post_install.log, and start.log from the flat ${module_directory} to a logs/ subdirectory. Keeps the scripts directory clean and separates executable artifacts from runtime output.

Changes

  • Compute local.log_directory = "${var.module_directory}/logs" and use it for every *.log path.
  • Each coder_script mkdir -ps the logs/ sub-path so the directory exists even when post_install or start is the first consumer after install.
  • Update the module_directory description to call out the nested logs path.
  • Update tee-regex tests to match the new logs/ prefix.
  • Add test_logs_nested_under_module_directory asserting the new paths and the mkdir -p in each script.
  • Bump module version to 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 -recursive clean
  • terraform validate clean
  • terraform test → 15/15 pass
  • prettier --check clean

🤖 This PR was created with the help of Coder Agents, and needs a human review. 🧑‍💻

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.
Comment thread registry/coder/modules/coder-utils/main.tf Outdated
Comment thread registry/coder/modules/coder-utils/main.tf Outdated
Copy link
Copy Markdown
Collaborator

@35C4n0r 35C4n0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nits, otherwise LGTM

…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 matifali merged commit f3475c0 into main Apr 23, 2026
4 checks passed
@matifali matifali deleted the feat/coder-utils-nest-logs branch April 23, 2026 06:40
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.
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. 🧑‍💻
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.

2 participants