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
- Very specific: line 15
Test scripts (test-*.cmd) emulate agent execution by setting INPUT_* env vars matching task.json inputs and running the task's generated JS …
- Very specific: line 30
Use explicit relative imports ending in .js for runtime JS resolution (e.g.
- Very specific: line 31
Keep side effects inside the runTfx callback.
- Very specific: line 32
Prefer adding new shared logic to Common.ts instead of duplicating in tasks.
- Very specific: line 37
Add the task path to vss-extension.json under files and a contribution entry under contributions if it's a new task.
- Very specific: line 38
Run npm run build and ensure lint passes (npm run lint:tasks).
- Very specific: line 39
If the task needs to modify the VSIX, reuse VsixEditor patterns from PublishExtension.ts.
- Very specific: line 42
After build, pipeline deletes unnecessary files (*.map, tests, markdown, licenses, unused platform bins) from each task's node_modules to …
- Very specific: line 48
Ensure new task inputs align with environment variable naming used in test scripts (INPUT_<uppercased input name> pattern in legacy tests).
- Very specific: line 57
Put reusable helpers in Common.ts and import them.
- Very specific: line 58
Ask whether a change affects packaging size.
≈ “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.
Files
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 underBuildTasks/<TaskName>/v5/with atask.json(declarative metadata) and a TypeScript implementation file compiled to JS. - Tasks wrap the
tfx-clito package/publish/share/install/query Azure DevOps & Visual Studio extensions. Common cross-cutting logic (auth, arg building, JSON stream parsing, version utilities) is centralized inBuildTasks/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). Thennpm run buildcompiles all tasks. Usenpm run packagefor per-task dependency pruning before creating .vsix. - Packaging extension (local):
tfx extension create --root . --output-path dist --manifest-globs vss-extension.json(scripted bypackage:tasks). - Manifest adjustments:
fix-manifest-file.ps1cleans & re-adds certain binary/no-extension files before packaging. - Test scripts (
test-*.cmd) emulate agent execution by settingINPUT_*env vars matchingtask.jsoninputs 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 executestfx.execAsync. - Inputs are fetched using
azure-pipelines-task-lib(tl.getInput,tl.getBoolInput,tl.getPathInput,tl.getDelimitedInput). Task results set viatl.setResultand output variables withtl.setVariable. - File globbing: if a task allows wildcard inputs (e.g.
vsixFile), usetl.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
tfxoutput to stderr or stdout and then parse vianew common.TfxJsonOutputStream(...)to inspectjson.publishedor 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.jsondeclares 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
.jsfor runtime JS resolution (e.g.import tl from "azure-pipelines-task-lib/task.js"). - Keep side effects inside the
runTfxcallback; return a resolvedtrueto signal completion. - Prefer adding new shared logic to
Common.tsinstead of duplicating in tasks.
Adding or Modifying a Task
- Copy an existing task folder structure (e.g.
PublishExtension/v5) and adjusttask.jsonmetadata (id, name, inputs, demands, execution target). - Implement logic following the existing pattern: gather inputs early; validate file existence; build
tfxargs; execute once; parse JSON; set result & output variable. - Add the task path to
vss-extension.jsonunderfilesand a contribution entry undercontributionsif it's a new task. - Run
npm run buildand ensure lint passes (npm run lint:tasks). - If the task needs to modify the VSIX, reuse
VsixEditorpatterns fromPublishExtension.ts.
Performance & Size Practices
- After build, pipeline deletes unnecessary files (
*.map, tests, markdown, licenses, unused platform bins) from each task'snode_modulesto shrink VSIX size. - Local dev shouldn’t manually prune during iteration; rely on CI or
npm run packagebefore 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-clidrives extension publishing, sharing, installing; tasks craft CLI args rather than reimplement REST calls.- Uses
azure-pipelines-task-libfor agent interaction. Do not replace with ad-hoc env parsing.
When Unsure
- Inspect a similar existing task’s TS +
task.jsonpair. - Put reusable helpers in
Common.tsand import them. - Ask whether a change affects packaging size; if yes, mirror cleanup logic or update
azure-pipelines.ymlpruning step.
Provide feedback on unclear sections or request deeper coverage (e.g. Common utilities breakdown) before expanding this doc.
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
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.

