Skip to content

feat(figspec): use filepaths zip helper + Generators array for azd extension install#8887

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/azd-update-figspec-generation
Draft

feat(figspec): use filepaths zip helper + Generators array for azd extension install#8887
Copilot wants to merge 2 commits into
mainfrom
copilot/azd-update-figspec-generation

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

The azd extension install arg was using a template: 'filepaths' fallback that didn't restrict completions to .zip files and didn't align with VS Code's filepaths helper API. This updates the Fig spec generator to emit the correct multi-generator array form with a scoped filepaths({ extensions: ['zip'] }) entry.

Changes

  • Arg struct (types.go): Added Generators []string field (takes precedence over Generator when non-empty); removed dead Template string field.
  • Renderer (typescript_renderer.go): Emits generators: [a, b] array form when Generators has multiple entries; auto-prepends import { filepaths } from '../helpers/filepaths'; to every generated spec.
  • Constants (fig_generators.go): Added FigGenFilepathsZip and filepathsHelperImport constants.
  • Customization (customizations.go): azd extension install now uses Generators: []string{FigGenListExtensions, FigGenFilepathsZip}.
  • Docs (fig-spec.md): Added missing listConfigKeys table row; added subsection explaining multi-generator args and the auto-emitted import.
  • Snapshot (TestFigSpec.ts): Updated to reflect import preamble and new generators array.

Generated output for azd extension install:

import { filepaths } from '../helpers/filepaths';
// ...
args: {
  name: 'extension-id|extension-bundle.zip',
  generators: [azdGenerators.listExtensions, filepaths({ extensions: ['zip'] })],
},
Original prompt

open pr against azure/azure-dev

**Chronological Review:**
  1. Initial request: User switched to main branch and provided a git patch from the VS Code repo (extensions/terminal-suggest/src/completions/azd.ts) that changed the azd ext install argument from template: 'filepaths' to generators: [azdGenerators.listExtensions, filepaths({ extensions: ['zip'] })] with an added import. They asked me to update azd's figspec generation to produce this output.

  2. Exploration phase: I grepped for figspec-related files, discovering the generation lives in cli/azd/internal/figspec/. I examined customizations.go, fig_generators.go, types.go, typescript_renderer.go, the snapshot cmd/testdata/TestFigSpec.ts, resources/generators.ts, the tests, and the doc docs/fig-spec.md. Found the existing customization used Generator: FigGenListExtensions, Template: "filepaths".

  3. Implementation phase 1 (main task): Added FigGenFilepathsZip and filepathsHelperImport constants; added Generators []string to Arg; updated renderer to emit import preamble + render multiple generators as array; switched azd extension install customization; updated tests; manually edited the snapshot (2 spots: import at top, ext-install arg block). Verified with go build, go test ./cmd -run TestFigSpec (passed, 27.9s), gofmt, golangci-lint, cspell — all clean.

  4. Second request (doc review): User asked to review all recent figspec changes and ensure the .md docs are up to date. I checked git history, reviewed the full diff, and found the generators table in fig-spec.md was missing listConfigKeys (pre-existing gap), and nothing documented the new filepaths helper. Added the listConfigKeys table row and a "Combining generators: the filepaths helper" subsection (using bold-subhead style to match existing section conventions). Fixed a botched edit that truncated a paragraph.

  5. Third request (cleanup - MOST RECENT): I noted that Arg.Template was now dead code; user said "Sure can we clean that up." I removed the Template field and all references.

Intent Mapping:

  • "update figspec generation accordingly to this patch, to handle extension id generator properly matching zip files" → completed
  • "review all the changes made to internal/figspec recently, and ensure the docs .md for it are up to date and are sound" → completed
  • "Sure can we clean that up" (remove unused Arg.Template) → completed

Technical Inventory:

  • Go (1.26), Cobra/pflag, text/template, go:embed
  • Fig autocomplete spec (TypeScript) for VS Code terminal-suggest IntelliSense
  • Snapshot testing via test/snapshot
  • Tools: gofmt, golangci-lint, cspell

Code Archaeology: Files modified — fig_generators.go, types.go, typescript_renderer.go, customizations.go, customizations_test.go, typescript_renderer_test.go, cmd/testdata/TestFigSpec.ts, docs/fig-spec.md.

Progress Assessment: All three user requests complete and verified.

Recent Commands Analysis: The most recent operations were the Arg.Template cleanup: edits to 4 files removing the field/rendering/tests, followed by verification commands (gofmt/test/lint all passing, grep confirming no remaining references, grep confirming snapshot unaffected).

1. Conversation Overview

  • Primary Objectives:

    1. "can you update figspec generation accordingly to this patch, to handle extension id generator properly matching zip files?" — Update azd's Fig spec generator so the generated VS Code completion spec uses generators: [azdGenerators.listExtensions, filepaths({ extensions: ['zip'] })] (with the required import) instead of template: 'filepaths' for azd extension install.
    2. "can you also review all the changes made to internal/figspec recently, and ensure the docs .md for it are up to date and are sound?"
    3. "Sure can we clean that up" — Remove the now-unused Arg.Template field flagged in my review.
  • Session Context: Working in /workspaces/azure-dev, on branch main, in the cli/azd Go module. The figspec package generates a TypeScript Fig autocomplete spec (copied into VS Code's extensions/terminal-suggest/src/completions/azd.ts) for terminal IntelliSense.

  • User Intent Evolution: Started with a focused feature change (matching a VS Code patch), expanded to documentation accuracy review, then to dead-code cleanup. All three are complete.

2. Technical Foundation

  • Go 1.26: figspec package in cli/azd/internal/figspec/.
  • Cobra/pflag: Command tree introspected by spec_builder.go to build the spec.
  • text/template + go:embed: typescript_renderer.go renders the spec; resources/generators.ts is embedded via figGeneratorDefinitionsTS.
  • Fig spec model: Spec/Subcommand/Option/Arg structs in types.go. Generators are raw TS expressions (e.g. "azdGenerators.listExtensions").
  • Snapshot test: TestFigSpec in `cmd/figspec_...

Created from Copilot CLI via the copilot delegate command.

- Add FigGenFilepathsZip constant and filepathsHelperImport for VS Code's
  filepaths({ extensions: ['zip'] }) helper
- Add Generators []string to Arg struct (takes precedence over Generator);
  remove unused Template string field
- Update typescript_renderer to emit the filepaths import preamble and
  render Generators as an array when multiple entries are present
- Switch azd extension install customization to use
  Generators: [listExtensions, filepaths({extensions:['zip']})]
- Update tests and snapshot accordingly
- Update docs/fig-spec.md: add listConfigKeys table row and filepaths
  helper subsection

Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Copilot AI changed the title [WIP] Update azd figspec generation for new extension argument feat(figspec): use filepaths zip helper + Generators array for azd extension install Jun 30, 2026
Copilot AI requested a review from JeffreyCA June 30, 2026 18:29
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