Skip to content

chore(coder-utils): centralize script paths under agent-scoped utils directory#872

Closed
35C4n0r wants to merge 2 commits intomainfrom
35C4n0r/chore-utils-scripts
Closed

chore(coder-utils): centralize script paths under agent-scoped utils directory#872
35C4n0r wants to merge 2 commits intomainfrom
35C4n0r/chore-utils-scripts

Conversation

@35C4n0r
Copy link
Copy Markdown
Collaborator

@35C4n0r 35C4n0r commented Apr 23, 2026

Description

Moves lifecycle scripts from ${module_directory}/ into ${module_directory}/${agent_name}-utils/ so multiple modules sharing the same base directory no longer collide on script filenames.

Type of Change

  • Feature/enhancement

Module Information

Path: registry/coder/modules/coder-utils
Breaking change: [x] Yes (script paths change for existing consumers)

What changed

main.tf

  • New utils_script_path local: ${var.module_directory}/${var.agent_name}-utils.
  • pre_install_path, install_path, post_install_path, start_path now nest under utils_script_path.
  • mkdir -p in pre_install and install wrappers updated to create the utils directory (previously only created module_directory, which would leave the new intermediate directory missing at runtime).

main.tftest.hcl

  • test_scripts_nested_under_utils_directory: verifies mkdir, base64 write targets, and execution paths all reference the ${agent_name}-utils/ subdirectory for all four script types.
  • test_utils_directory_uses_agent_name: verifies a custom agent_name produces a distinct utils directory, preventing collisions.

Testing & Validation

  • Tests pass (terraform test: 17 passed, 0 failed)
  • Tests pass (bun test: 5 passed, 0 failed)
  • Changes tested locally

Related Issues

Closes #873

🤖 Generated with Coder Agents

35C4n0r and others added 2 commits April 23, 2026 15:02
Add test coverage for the new utils_script_path that nests scripts
under ${module_directory}/${agent_name}-utils/:

- test_scripts_nested_under_utils_directory: verifies mkdir, base64
  write, and execution paths all use the utils subdirectory.
- test_utils_directory_uses_agent_name: verifies the directory name
  includes agent_name to avoid collisions between modules sharing
  the same module_directory.

Also fix mkdir in pre_install and install wrappers to create the
utils directory instead of only the module_directory parent. Without
this, base64 -d would fail at runtime because the intermediate
directory would not exist.

🤖 Generated with [Coder Agents](https://coder.com)
@35C4n0r 35C4n0r changed the title 35 c4n0r/chore utils scripts chore(coder-utils): centralize script paths under agent-scoped utils directory Apr 23, 2026
@matifali
Copy link
Copy Markdown
Member

matifali commented Apr 23, 2026

Moves lifecycle scripts from ${module_directory}/ into ${module_directory}/${agent_name}-utils/ so multiple modules sharing the same base directory no longer collide on script filenames.

${module_directory} is. variable that already contains both the module_name(agent_name) and namespace. e.g. when claude-code uses coder-utils it passes module_directory = "$HOME/.coder-modules/coder/claude-code"

So IMO adding ${agent_name}_utils again would cause duplication, as the full path becomes "$HOME/.coder-modules/coder/claude-code/claude-code-utils"

I have an alternative proposal that instead places the scripts and logs in

  1. scripts --> "$HOME/.coder-modules/coder/claude-code/scripts" feat(coder-utils): nest scripts under module_directory/scripts #871
  2. logs --> "$HOME/.coder-modules/coder/claude-code/logs" feat(coder-utils): nest logs under module_directory/logs #870

@35C4n0r
Copy link
Copy Markdown
Collaborator Author

35C4n0r commented Apr 23, 2026

Closed in favour of #871

@35C4n0r 35C4n0r closed this Apr 23, 2026
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.

chore(coder-utils): centralize script paths under agent-scoped utils directory

2 participants