Skip to content

docs(agents): standardize additional_args and input deprecation - #1202

Open
matifali wants to merge 6 commits into
mainfrom
claude/agents-md-additional-args
Open

matifali wants to merge 6 commits into
mainfrom
claude/agents-md-additional-args

Conversation

@matifali

@matifali matifali commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Description

Adds two rules to AGENTS.md (which CLAUDE.md links to).

Extra CLI arguments: additional_args

  • Name and type: additional_args, a list(string) with one element per argument. Not extra_args, additional_arguments, extra_flags, a map, or a free-form string.
  • Passing: each element is passed exactly as written and in order, so a flag can repeat (["--header", "a", "--header", "b"]). A map can't do that: Terraform silently keeps only the last value of a repeated map key, so an earlier version of this rule that used a map was changed after review.
  • Validation: no element may be empty or contain a newline. A second validation rejects flags the module already passes, checking each element with any =value stripped, with a keep-in-sync comment beside both the list and the command in the script.
  • Passing it to the script: base64-encode one argument per line, read it back into an array or set --, and never word-split or eval it. Use printf '%q' when writing it into another generated script.
  • Existing modules: keep the old input working, add additional_args beside it, and deprecate the old one under the rule below. code-server and ttyd are noted as predating the rule; their string additional_args stays so existing templates don't break.

Deprecating inputs

Terraform 1.15 added a deprecated argument for variable blocks. Terraform 1.14 and older reject it with An argument named "deprecated" is not expected here, even in templates that never set the input. Coder bundles Terraform 1.15.5 from v2.37.0; v2.31.0 through v2.36.0 bundle 1.14.5 (from TerraformVersion in provisioner/terraform/install.go at each tag). So the rule is:

  • Major version bump: set required_version = ">= 1.15" and give every deprecated input a deprecated argument, including inputs deprecated earlier by description only. Note the raised minimum as a breaking change.
  • Minor or patch bump: deprecate in the description only (Deprecated: use <new_input> instead.), without raising required_version.
  • The message: deprecated takes the warning text, not a boolean. deprecated = true prints the bare message true, and "" prints nothing, so the message must name the replacement. The example keeps the Deprecated: description prefix as well, so registry.coder.com shows the deprecation until coder/registry-server reads the native argument.

I checked this against Terraform 1.13.0 through 1.17.0: 1.15 and later warn only when a caller sets the deprecated input, and 1.13 and 1.14 fail to parse. The PR review checklist now covers both points.

Modules following these rules

Already merged and released:

Open:

  • coder/registry#1200 git-clone 2.1.0: deprecates extra_args by description, since this is a minor bump
  • coder/registry#1201 mux 2.1.0: deprecates additional_arguments by description, since this is a minor bump

Type of Change

  • New module
  • New template
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Testing & Validation

  • Tests pass (bun test) — documentation only
  • Code formatted (bun fmt)
  • Checked the deprecated behavior with Terraform 1.13.0, 1.14.0, 1.15.0, 1.16.0 and 1.17.0, and the list(string) validation on 1.9.8 and 1.17.0

Related Issues

None

🤖 Generated with Claude Code

https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt

Document the convention for modules that pass extra flags to a CLI:
name the input additional_args, make it a map(string) of flag to value
passed as written, validate keys and reject flags the module already
sets (kept in sync with the script by comments), pass it base64 one
argument per line, and deprecate rather than remove older names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt
On a major bump, require Terraform >= 1.15 and use the native
`deprecated` argument with a message naming the replacement; on a
minor or patch bump, deprecate by description only, since Terraform
1.14 and older (bundled with Coder v2.36 and earlier) reject the
argument. Point the additional_args rule at it and add both to the PR
review checklist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt
@matifali matifali changed the title docs(agents): standardize additional_args for extra CLI flags docs(agents): standardize additional_args and input deprecation Oct 22, 2026
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
}
```

### Deprecating inputs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This would need a follow up PR in coder/registry-server to properly handle deprecated variables.
Alternative we can add deprecation: <text> to description.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Keeping the major-bump rule. The description prefix is already part of it: on a minor or patch bump the Deprecated: use X instead. description is the only signal, and on a major bump the example keeps that prefix alongside deprecated = "...". So registry.coder.com shows the deprecation from the description until coder/registry-server reads the native argument, and that follow-up can land on its own schedule.


Generated by Claude Code

matifali added a commit that referenced this pull request Oct 23, 2026
Per review on #1202, a map cannot repeat a flag (a
repeated key silently keeps only the last value). additional_args is now
a list with one element per argument, passed in order, the same type as
the extra_args it replaces, so migrating is a rename. -b and --branch
are still rejected, with or without =value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt
matifali added a commit that referenced this pull request Oct 23, 2026
Per review on #1202, a map cannot repeat a flag (a
repeated key silently keeps only the last value). additional_args is now
a list with one element per argument, passed in order. --port and
--add-project are still rejected, with or without =value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt
Per review: a map cannot repeat a flag, and Terraform silently keeps only
the last value of a repeated key. The rule now uses list(string), one
element per argument, passed in order, with reserved flags checked after
stripping any =value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt
matifali and others added 2 commits October 23, 2026 11:14
…ion rules

- The coder-utils encoding table said lists go as base64 JSON; add a row
  for CLI argument lists, which use newline-joined base64 so scripts need
  no jq, and say why in the rule.
- Add `deprecated` to the variable block order.
- Only raise required_version on a major bump when the module has
  deprecated inputs.
- Note that the reserved-flag check is best effort.
- Note that output blocks accept `deprecated` too (Terraform 1.15+).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt
@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown

REG-135

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