Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
run: |
set -euo pipefail
cd scripts
zip -r ../ado-script.zip ado-script/gate.js ado-script/import.js ado-script/exec-context-pr.js ado-script/exec-context-pr-synth.js
zip -r ../ado-script.zip ado-script/gate.js ado-script/import.js ado-script/exec-context-pr.js ado-script/exec-context-pr-synth.js ado-script/exec-context-manual.js ado-script/exec-context-pipeline.js ado-script/exec-context-ci-push.js ado-script/exec-context-workitem.js ado-script/exec-context-schedule.js ado-script/exec-context-pr-checks.js ado-script/exec-context-repo.js

- name: Upload release assets
env:
Expand Down
55 changes: 40 additions & 15 deletions docs/ado-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ pipeline** as runtime helpers. Today it produces four bundles:
PR-identifier variables into the stable `AW_PR_*` namespace,
promoting CI builds with an open PR to PR semantics (Setup job,
before any gate step).
- `exec-context-manual.js` — Manual-context precompute that stages
`aw-context/manual/{requested-for, parameters.json}` for
manually-queued builds and appends a `## Manual run context`
fragment to the agent prompt (Agent job; see
[`execution-context.md`](execution-context.md)).
- `exec-context-pipeline.js` — Pipeline-completion precompute that
fetches upstream-build metadata via the Build REST API and stages
`aw-context/pipeline/upstream-*` files plus a `## Pipeline-completion
context` prompt fragment (Agent job; see
[`execution-context.md`](execution-context.md)).

> **Internal-only.** `ado-script` is not a user-facing front-matter
> feature. Authors never write an `ado-script:` block in their agent
Expand Down Expand Up @@ -63,7 +73,8 @@ not re-expanded).

The bundle lives at `import.js` and ships in the same
`ado-script.zip` release asset as `gate.js`, `exec-context-pr.js`,
and `exec-context-pr-synth.js`, so pipelines download it through the
`exec-context-pr-synth.js`, `exec-context-manual.js`, and
`exec-context-pipeline.js`, so pipelines download it through the
same Agent-job asset flow.
`import.js` uses only the Node standard library, so the ncc bundle is
small (~1.5 KB) and carries no SDK dependency.
Expand Down Expand Up @@ -341,7 +352,12 @@ scripts/ado-script/
│ │ ├── ado-client.ts # azure-devops-node-api wrapper + retry + timeout + pagination
│ │ ├── env-facts.ts # Pipeline-variable readers + ENV_BY_FACT + BRANCH_FACTS + ref-prefix stripping
│ │ ├── policy.ts # PolicyTracker state machine
│ │ └── vso-logger.ts # ##vso[…] emitters with property/message escaping; complete() is idempotent
│ │ ├── vso-logger.ts # ##vso[…] emitters with property/message escaping; complete() is idempotent
│ │ ├── git.ts # execFile wrappers + bearerEnv helper (promoted from exec-context-pr/ in Stage 0)
│ │ ├── merge-base.ts # synthetic-merge detection + progressive-deepening fetch (promoted from exec-context-pr/)
│ │ ├── validate.ts # identifier regex guards (promoted from exec-context-pr/)
│ │ ├── prompt.ts # agent-prompt-file append helpers (promoted from exec-context-pr/)
│ │ └── build.ts # Build REST helpers (added in Stage 2; used by pipeline / ci-push / pr.checks)
│ ├── gate/ # gate.js entry point + per-concern modules
│ │ ├── index.ts # main(): decode → preflight → bypass → facts → eval → emit
│ │ ├── bypass.ts # build-reason auto-pass
Expand All @@ -353,28 +369,37 @@ scripts/ado-script/
│ │ └── __tests__/ # marker, path-resolution, and single-pass coverage
│ ├── exec-context-pr/ # exec-context-pr.js entry point + PR precompute
│ │ ├── index.ts # main(): validate → resolve merge-base → stage SHAs → append prompt
│ │ ├── validate.ts # identifier regex guards
│ │ ├── git.ts # execFile wrappers + bearerEnv helper
│ │ ├── merge-base.ts # synthetic-merge detection + progressive-deepening fetch
│ │ ├── prompt.ts # success / failure prompt-fragment writers
│ │ └── __tests__/ # 32 unit tests across the four modules
│ └── exec-context-pr-synth/ # exec-context-pr-synth.js entry point + synthetic-PR resolver
│ ├── index.ts # main(): real-PR / GitHub / synth-promote branch resolution → emit AW_PR_*
│ ├── match.ts # branch/path include-exclude glob matching
│ ├── spec.ts # PR_SYNTH_SPEC base64 decode + validation
│ └── __tests__/ # unit tests across the three modules
│ │ │ # (imports validate/git/merge-base/prompt from ../shared/)
│ │ └── __tests__/ # end-to-end / integration tests live here; the
│ │ # per-module unit tests moved with their modules
│ │ # into ../shared/__tests__/
│ ├── exec-context-pr-synth/ # exec-context-pr-synth.js entry point + synthetic-PR resolver
│ │ ├── index.ts # main(): real-PR / GitHub / synth-promote branch resolution → emit AW_PR_*
│ │ ├── match.ts # branch/path include-exclude glob matching
│ │ ├── spec.ts # PR_SYNTH_SPEC base64 decode + validation
│ │ └── __tests__/ # unit tests across the three modules
│ ├── exec-context-manual/ # exec-context-manual.js entry point + manual-context precompute
│ │ ├── index.ts # main(): collect PARAM_* env vars → JSON snapshot → prompt fragment
│ │ └── __tests__/ # unit tests for success / failure / sanitisation paths
│ └── exec-context-pipeline/ # exec-context-pipeline.js entry point + pipeline-completion precompute
│ ├── index.ts # main(): validate TriggeredBy ids → fetch upstream Build via REST → stage + prompt
│ └── __tests__/ # unit tests for validate / success / failure / sanitisation paths
├── test/ # End-to-end smoke tests (gate, import, exec-context-pr)
├── gate.js # ncc bundle output (gitignored)
├── import.js # ncc bundle output (gitignored)
├── exec-context-pr.js # ncc bundle output (gitignored)
└── exec-context-pr-synth.js # ncc bundle output (gitignored)
├── exec-context-pr-synth.js # ncc bundle output (gitignored)
├── exec-context-manual.js # ncc bundle output (gitignored)
└── exec-context-pipeline.js # ncc bundle output (gitignored)
```

The release workflow (`.github/workflows/release.yml`) runs
`npm ci && npm run build`, then zips `scripts/ado-script/gate.js`,
`scripts/ado-script/import.js`,
`scripts/ado-script/exec-context-pr.js`, and
`scripts/ado-script/exec-context-pr-synth.js` into the
`scripts/ado-script/exec-context-pr.js`,
`scripts/ado-script/exec-context-pr-synth.js`,
`scripts/ado-script/exec-context-manual.js`, and
`scripts/ado-script/exec-context-pipeline.js` into the
`ado-script.zip` release asset. Pipelines download that asset at
runtime by URL pinned to the compiler's `CARGO_PKG_VERSION`, verify
its SHA-256 against the `checksums.txt` asset, then extract.
Expand Down
Loading
Loading