agentleFS
MicrosoftKnown publishermicrosoft/azure-devops-extension-tasks/.github/copilot-instructions.md

azure-devops-extension-tasks

Copilot instructions204 starsChanged 13 months agoMITView on GitHub

Purpose: Help agents quickly contribute to Azure DevOps Extension Tasks (publishing & packaging tasks for Azure/VS Marketplace).

The file

We split this copilot-instructions.md into the rules it gives an agent

11 rules. About 0 are common, 0 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Test scripts (test-*.cmd) emulate agent execution by setting INPUT_* env vars matching task.json inputs and running the task's generated JS …

    line 15
  2. Very specific:

    Use explicit relative imports ending in .js for runtime JS resolution (e.g.

    line 30
  3. Very specific:

    Keep side effects inside the runTfx callback.

    line 31
  4. Very specific:

    Prefer adding new shared logic to Common.ts instead of duplicating in tasks.

    line 32
  5. Very specific:

    Add the task path to vss-extension.json under files and a contribution entry under contributions if it's a new task.

    line 37
  6. Very specific:

    Run npm run build and ensure lint passes (npm run lint:tasks).

    line 38
  7. Very specific:

    If the task needs to modify the VSIX, reuse VsixEditor patterns from PublishExtension.ts.

    line 39
  8. Very specific:

    After build, pipeline deletes unnecessary files (*.map, tests, markdown, licenses, unused platform bins) from each task's node_modules to …

    line 42
  9. Very specific:

    Ensure new task inputs align with environment variable naming used in test scripts (INPUT_<uppercased input name> pattern in legacy tests).

    line 48
  10. Very specific:

    Put reusable helpers in Common.ts and import them.

    line 57
  11. Very specific:

    Ask whether a change affects packaging size.

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

AI Coding Agent Instructions

Purpose: Help agents quickly contribute to Azure DevOps Extension Tasks (publishing & packaging tasks for Azure/VS Marketplace).

Big Picture

  • This repo builds an Azure DevOps extension that contributes multiple pipeline tasks (see vss-extension.json > contributions). Each task lives under BuildTasks/<TaskName>/v5/ with a task.json (declarative metadata) and a TypeScript implementation file compiled to JS.
  • Tasks wrap the tfx-cli to package/publish/share/install/query Azure DevOps & Visual Studio extensions. Common cross-cutting logic (auth, arg building, JSON stream parsing, version utilities) is centralized in BuildTasks/Common/v5/Common.ts.
  • Build flow: install dependencies locally per task folder, compile TS with project references, lint, then prune/dedupe before packaging the VSIX manifest.
  • CI pipeline (azure-pipelines.yml) produces three VSIX variants (build/private/public) and optionally publishes them.

Key Workflows

  • Dev setup: run npm run initdev (installs root deps + each task's deps). Then npm run build compiles all tasks. Use npm run package for per-task dependency pruning before creating .vsix.
  • Packaging extension (local): tfx extension create --root . --output-path dist --manifest-globs vss-extension.json (scripted by package:tasks).
  • Manifest adjustments: fix-manifest-file.ps1 cleans & re-adds certain binary/no-extension files before packaging.
  • Test scripts (test-*.cmd) emulate agent execution by setting INPUT_* env vars matching task.json inputs and running the task's generated JS entrypoint.

Task Implementation Pattern

  • Entry script calls common.runTfx(async tfx => { ... }) providing an async block that builds CLI args then executes tfx.execAsync.
  • Inputs are fetched using azure-pipelines-task-lib (tl.getInput, tl.getBoolInput, tl.getPathInput, tl.getDelimitedInput). Task results set via tl.setResult and output variables with tl.setVariable.
  • File globbing: if a task allows wildcard inputs (e.g. vsixFile), use tl.findMatch(cwd, pattern) and enforce exactly one match.
  • Conditional arg inclusion uses tfx.argIf(condition, ["--flag", value]) (defined in common helpers).
  • JSON output capture: tasks redirect tfx output to stderr or stdout and then parse via new common.TfxJsonOutputStream(...) to inspect json.published or similar properties.

Version & Metadata Handling

  • Extension version sourced via common.getExtensionVersion() (uses manifest or task inputs). Task can update embedded task versions/IDs when packaging/publishing (updateTasksVersion, updateTasksId). Logic lives in Common utilities.
  • task.json declares execution targets for multiple Node versions (e.g. Node20_1, Node16), so generated JS must remain backward-compatible with both.

Conventions

  • Each task folder structure: BuildTasks/<Name>/v5/{<Name>.ts, task.json, package.json, tsconfig.json}; compiled JS ends parallel to TS. Avoid cross-imports between tasks except via ../Common/v5/Common.js.
  • Use explicit relative imports ending in .js for runtime JS resolution (e.g. import tl from "azure-pipelines-task-lib/task.js").
  • Keep side effects inside the runTfx callback; return a resolved true to signal completion.
  • Prefer adding new shared logic to Common.ts instead of duplicating in tasks.

Adding or Modifying a Task

  1. Copy an existing task folder structure (e.g. PublishExtension/v5) and adjust task.json metadata (id, name, inputs, demands, execution target).
  2. Implement logic following the existing pattern: gather inputs early; validate file existence; build tfx args; execute once; parse JSON; set result & output variable.
  3. Add the task path to vss-extension.json under files and a contribution entry under contributions if it's a new task.
  4. Run npm run build and ensure lint passes (npm run lint:tasks).
  5. If the task needs to modify the VSIX, reuse VsixEditor patterns from PublishExtension.ts.

Performance & Size Practices

  • After build, pipeline deletes unnecessary files (*.map, tests, markdown, licenses, unused platform bins) from each task's node_modules to shrink VSIX size.
  • Local dev shouldn’t manually prune during iteration; rely on CI or npm run package before shipping.

Common Pitfalls

  • Forgetting to install per-task dependencies after adding a new task: rerun npm run initdev.
  • Wildcard file patterns resolving to none or multiple files must fail early with tl.setResult(Failed, ...).
  • Ensure new task inputs align with environment variable naming used in test scripts (INPUT_<uppercased input name> pattern in legacy tests).
  • Maintain Node version compatibility (avoid APIs newer than Node16 unless guarded).

External Integrations

  • tfx-cli drives extension publishing, sharing, installing; tasks craft CLI args rather than reimplement REST calls.
  • Uses azure-pipelines-task-lib for agent interaction. Do not replace with ad-hoc env parsing.

When Unsure

  • Inspect a similar existing task’s TS + task.json pair.
  • Put reusable helpers in Common.ts and import them.
  • Ask whether a change affects packaging size; if yes, mirror cleanup logic or update azure-pipelines.yml pruning step.

Provide feedback on unclear sections or request deeper coverage (e.g. Common utilities breakdown) before expanding this doc.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.