Skip to content

fix: move run-install-scripts under runtimes.node#36029

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-run-install-scripts-structure
May 31, 2026
Merged

fix: move run-install-scripts under runtimes.node#36029
pelikhan merged 5 commits into
mainfrom
copilot/fix-run-install-scripts-structure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 31, 2026

run-install-scripts only affects npm install commands, which are exclusively generated by the Node.js runtime. Having it as a top-level frontmatter field was misleading — it belongs under runtimes.node.

Parser / types

  • Remove RunInstallScripts *bool from FrontmatterConfig (top-level struct)
  • Drop frontmatter parameter from resolveRunInstallScripts() — only runtimes.node.run-install-scripts and the merged-imports flag are checked
  • Remove hasTopLevelRunInstallScripts() from import_field_extractor.go

Schema & generated docs

  • Remove top-level run-install-scripts from main_workflow_schema.json
  • Regenerate frontmatter-full.md and autocomplete-data.json

Before / after

# before (top-level)
run-install-scripts: true

# after (nested under runtimes.node)
runtimes:
  node:
    run-install-scripts: true

Codemod

The migration is implemented as a Go codemod (getRunInstallScriptsToRuntimesNodeCodemod) registered in the fix command registry, so it runs automatically via gh aw fix. It handles all cases:

  • No runtimes: block → appends a new runtimes.node block
  • runtimes: exists without node: → inserts a node: sub-block
  • runtimes.node exists → injects the field into the existing block
  • Both top-level and nested forms present → removes the top-level duplicate (idempotent)

Copilot AI and others added 3 commits May 31, 2026 00:33
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Remove top-level `run-install-scripts` from FrontmatterConfig struct
- Update resolveRunInstallScripts() to accept only runtimes map (no global frontmatter check)
- Remove hasTopLevelRunInstallScripts() from import_field_extractor.go
- Remove top-level property from main_workflow_schema.json
- Regenerate frontmatter-full.md and autocomplete-data.json from schema
- Update tests to reflect new signature and remove global-form cases
- Update syntax.md and compiler-threat-detection-spec.md docs
- Add scripts/codemod-run-install-scripts.js to migrate existing workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… check)

- Detect tab-based indent in addition to space-based
- Consume consecutive blank lines after removed top-level field
- Check for runtimes.node.run-install-scripts specifically (not any indented match)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title fix: move run-install-scripts under runtimes.node, add codemod fix: move run-install-scripts under runtimes.node May 31, 2026
Copilot AI requested a review from pelikhan May 31, 2026 00:44
@pelikhan pelikhan marked this pull request as ready for review May 31, 2026 01:13
Copilot AI review requested due to automatic review settings May 31, 2026 01:13
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot the codemods must be implement in go and run as part of the fix command

@github-actions
Copy link
Copy Markdown
Contributor

@copilot please implement the Go codemods and report any remaining blockers.

Generated by 👨‍🍳 PR Sous Chef · gpt54 6M ·

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

@copilot please implement the Go codemods and report any remaining blockers.

Generated by 👨‍🍳 PR Sous Chef · gpt54 6M ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 31, 2026

@copilot the codemods must be implement in go and run as part of the fix command

Done. The codemod is now implemented in Go as getRunInstallScriptsToRuntimesNodeCodemod() in pkg/cli/codemod_run_install_scripts.go and registered in GetAllCodemods() so it runs automatically as part of gh aw fix. The JS script has been removed.

The codemod handles all migration cases:

  • No runtimes: block → appends a new runtimes.node block
  • runtimes: exists without node: → inserts a node: sub-block
  • runtimes.node exists → injects the field into the existing block
  • Both top-level and nested forms present → removes the top-level duplicate (idempotent)

Committed in 8f8e636.

@pelikhan pelikhan merged commit f4bfe0e into main May 31, 2026
@pelikhan pelikhan deleted the copilot/fix-run-install-scripts-structure branch May 31, 2026 01:48
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