Skip to content

docs: standardize module data layout under ~/.coder-modules#869

Merged
matifali merged 8 commits intomainfrom
matifali/agents-md-module-data-layout
Apr 24, 2026
Merged

docs: standardize module data layout under ~/.coder-modules#869
matifali merged 8 commits intomainfrom
matifali/agents-md-module-data-layout

Conversation

@matifali
Copy link
Copy Markdown
Member

@matifali matifali commented Apr 23, 2026

Summary

Standardize where modules write runtime data on the workspace so troubleshooting has a single, predictable location, and point module authors at coder-utils for script orchestration.

All runtime data now lives under $HOME/.coder-modules/<namespace>/<module-name>/, with standard subdirs for logs/ and scripts/. Tool-specific config and state (wherever the tool expects them) are explicitly out of scope so we don't fight the tool.

Changes

  • Added a Module Data Layout section to AGENTS.md (picked up by CLAUDE.md via the existing symlink).
  • Specified the per-module root and standard subdirectories (logs/, scripts/).
  • Added a Use coder-utils for Script Orchestration section recommending coder-utils for any new or reworked module.
  • Marked the layout as MUST for new modules and migrate-on-touch for existing ones.

Notes

Existing Coder-owned modules (e.g. claude-code, aider, goose, amazon-q) still use the old ~/.<module>-module/ paths. They are intentionally out of scope for this PR and will be migrated individually so each change can be reviewed and version-bumped independently.

Addresses: #782 (comment)

@matifali matifali marked this pull request as ready for review April 23, 2026 06:33
@matifali matifali requested a review from mafredri April 23, 2026 12:36
Copy link
Copy Markdown
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Clean docs-only PR with a clear scope and good structure. One P2 finding from the first pass.

This is a first-pass review from Netero only. The full review panel has not yet reviewed this PR. The panel will review after this finding is addressed.

"Logs go to module_directory/*.log, not module_directory/logs/*.log. Scripts similarly go to module_directory/*.sh, not module_directory/scripts/*.sh. The 'aligns with' and 'for free' claims are false." - Netero

🤖 This review was automatically generated with Coder Agents.

Comment thread AGENTS.md Outdated
@matifali matifali force-pushed the matifali/agents-md-module-data-layout branch from 16fee81 to aa8e551 Compare April 23, 2026 16:34
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. 🧑‍💻
Copy link
Copy Markdown
Collaborator

@DevelopmentCats DevelopmentCats left a comment

Choose a reason for hiding this comment

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

Honestly @matifali this looks perfect for all the new logic, and I have no complaints ❤️

@matifali matifali marked this pull request as draft April 23, 2026 17:36
…form conventions

- Remove agent_name-utils- prefix reference (dropped in PR 874)
- Add templatefile() pattern with encoding rules table for .tftpl variables
- Add start_script to coder-utils example (was missing)
- Add scripts output pass-through pattern
- Add variable/output ordering convention and sensitive = true guidance
- Add .tftest.hcl command = plan vs apply guidance
- Add count vs for_each rule for optional singletons
@matifali matifali marked this pull request as ready for review April 24, 2026 16:14
@matifali matifali enabled auto-merge (squash) April 24, 2026 16:28
@matifali matifali merged commit 3494da4 into main Apr 24, 2026
4 checks passed
@matifali matifali deleted the matifali/agents-md-module-data-layout branch April 24, 2026 16:29
Copy link
Copy Markdown
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Post-merge approve. Looks good, nice job! 👍🏻

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.

3 participants