Skip to content

Add --internal flag to azd x init for scaffolding first-party Go extensions#8570

Draft
Copilot wants to merge 7 commits into
mainfrom
copilot/add-internal-flag-azd-x-init
Draft

Add --internal flag to azd x init for scaffolding first-party Go extensions#8570
Copilot wants to merge 7 commits into
mainfrom
copilot/add-internal-flag-azd-x-init

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Resolves #8569

This PR adds an --internal flag to azd x init that scaffolds a first-party Go extension directly into the Azure/azure-dev repository, wiring up the CI, release, and ownership plumbing that every in-repo extension needs.

When --internal is set, language selection is skipped and defaults to Go, as internal scaffolding currently only supports Go. A companion --codeowners flag (also promptable in interactive mode) controls the GitHub handles/teams added to .github/CODEOWNERS.

The scaffold writes files in two locations. Inside the new extension directory (cli/azd/extensions/<id>/):

  • ci-build.ps1 — build script
  • ci-test.ps1 — test script
  • version.txt — initial version (0.0.1)
  • cspell.yaml — extension-local spelling config importing the shared config
  • .golangci.yaml — linter config matching the other first-party extensions

At the repository level:

  • .github/workflows/lint-ext-<id>.yml — per-extension lint workflow
  • eng/pipelines/release-ext-<id>.yml — per-extension release pipeline
  • A .github/CODEOWNERS entry, inserted in alphabetical order within the extensions block (CODEOWNERS is last-match-wins, so ordering matters) and idempotent on re-run

The extension id is validated before any paths are derived, and the repository root is located by walking up from the working directory and checking for the expected repo markers. Templates are embedded via go:embed (the .golangci.yaml template is stored dotless because go:embed excludes dotfiles, then written with the leading dot).

Tests cover the generated scaffold contents, CODEOWNERS ordering and idempotency, CODEOWNERS parsing, and the .golangci.yaml output. The cspell words specific to this extension now live in the extension's own cspell.yaml rather than the central config.

Screenshots

image image

Copilot AI changed the title [WIP] Add support for --internal flag to azd x init Add internal Go extension scaffolding to azd x init Jun 8, 2026
Copilot AI requested a review from JeffreyCA June 8, 2026 22:38
@JeffreyCA

Copy link
Copy Markdown
Contributor

@copilot could we have the template files be separate files instead of being inlined? Like what's in cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/go/

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot could we have the template files be separate files instead of being inlined? Like what's in cli/azd/extensions/microsoft.azd.extensions/internal/resources/languages/go/

Addressed in b92ef04 by moving the internal scaffold templates into embedded resource files and updating azd x init --internal to load them from there.

Copilot AI and others added 4 commits June 9, 2026 18:50
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
- Introduced a constant for the default extension version.
- Updated internal scaffold logic to use the new version constant.
- Refactored codeowners handling in the internal scaffold process.
- Enhanced tests to reflect changes in default version behavior.
@JeffreyCA JeffreyCA force-pushed the copilot/add-internal-flag-azd-x-init branch from b92ef04 to 2795dfb Compare June 9, 2026 18:51
@github-actions github-actions Bot added the ext-x microsoft.azd.extensions developer extension (azd x) label Jun 9, 2026
@JeffreyCA JeffreyCA force-pushed the copilot/add-internal-flag-azd-x-init branch from 1355d8e to c2224cf Compare June 9, 2026 21:44
@JeffreyCA JeffreyCA changed the title Add internal Go extension scaffolding to azd x init Add --internal flag to azd x init for scaffolding first-party Go extensions Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the microsoft.azd.extensions developer-kit extension by adding an --internal mode to azd x init that scaffolds additional first-party (in-repo) Go extension assets (CI workflow, release pipeline, CODEOWNERS entry, and standard repo scripts/config) into the Azure/azure-dev repository layout.

Changes:

  • Add --internal (Go-only) and --codeowners support to azd x init, including CODEOWNERS insertion logic and internal repo-root discovery.
  • Add embedded internal scaffold templates for per-extension GitHub Actions lint workflow, Azure Pipelines release pipeline, and standard extension files (ci scripts, version.txt, cspell, golangci).
  • Update spelling configuration and bump the developer-kit extension’s version/changelog.
Show a summary per file
File Description
cli/azd/extensions/microsoft.azd.extensions/version.txt Bumps the developer-kit extension version.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/resources.go Embeds the new internal/ template tree for internal scaffolding.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/workflows/lint-ext.yml.tmpl Template for generated per-extension lint workflow.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/pipelines/release-ext.yml.tmpl Template for generated per-extension release pipeline.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/version.txt.tmpl Template for generated extension version.txt.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/golangci.yaml Dotless .golangci.yaml template content for generated extensions.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/cspell.yaml Generated extension-local cspell config template.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/ci-test.ps1 Generated extension test script template.
cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/ci-build.ps1.tmpl Generated extension build script template.
cli/azd/extensions/microsoft.azd.extensions/internal/cmd/init.go Implements --internal scaffolding flow, CODEOWNERS handling, and repo-root discovery.
cli/azd/extensions/microsoft.azd.extensions/internal/cmd/init_test.go Adds tests for internal scaffold output and CODEOWNERS behavior.
cli/azd/extensions/microsoft.azd.extensions/cspell.yaml Moves/extends extension-local spelling overrides for new terminology.
cli/azd/extensions/microsoft.azd.extensions/CHANGELOG.md Starts a new unreleased section and records the new feature.
cli/azd/.vscode/cspell.yaml Removes a now-extension-scoped spelling override.

Copilot's findings

  • Files reviewed: 14/14 changed files
  • Comments generated: 3

Comment thread cli/azd/extensions/microsoft.azd.extensions/CHANGELOG.md
Comment on lines 497 to +502
func collectExtensionMetadataFromFlags(flags *initFlags) (*models.ExtensionSchema, error) {
language := flags.language
if flags.internalScaffold && language == "" {
language = "go"
}

@@ -1 +1 @@
0.11.2 No newline at end of file
0.12.0 No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-x microsoft.azd.extensions developer extension (azd x)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

azd x init - support --internal flag that scaffolds required files for 1P extensions in repo

3 participants