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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ myagent/
# Serena MCP tooling
/.serena/

# Compiled TypeScript task output (from the Phase 2 branch; never belongs here)
# Compiled TypeScript task output (emitted in-place by tsc)
tb-*/index.js
tb-*/index.js.map
tb-*/tests/**/*.js
tb-*/tests/**/*.js.map

# Test run artifacts (task-lib mock-run / mock-test)
.taskkey
tb-*/tests/testingbot.json
67 changes: 42 additions & 25 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,58 @@ for what the package contains and contributes.

## Build & package

Requires Node.js >= 20. The build is npm-scripts + webpack 5 (there is no gulp).
Requires Node.js >= 20. The build is npm-scripts + TypeScript + webpack 5 (no gulp).

```bash
npm install # root build deps
npm run build # webpack: bundle the tab scripts + copy static files -> ./dist
npm run compile # tsc: compile each task's index.ts -> index.js
npm test # compile + mocha (task-lib mock-run/mock-test)
npm run package # full pipeline -> ./Packages/*.vsix
```

`npm run package` chains: `clean` (rimraf dist Packages) -> `build` (webpack) ->
`deps` (`scripts/install-task-deps.js` runs `npm ci --omit=dev` into each
`dist/tb-*` that has a `package.json`) -> `stamp` (`scripts/stamp-version.js`) ->
`create` (`tfx extension create`).
`npm run package` chains: `clean` -> `compile` (`tsc` per task, emitting
`index.js` next to `index.ts`) -> `build` (webpack: bundle the tab scripts + copy
static files, including the compiled task `index.js`, into `dist/`) -> `deps`
(`scripts/install-task-deps.js` runs `npm ci --omit=dev` into each `dist/tb-*`
that has a `package.json`) -> `stamp` (`scripts/stamp-version.js`) -> `create`
(`tfx extension create`). A `precompile` hook (`scripts/ensure-task-src-deps.js`)
installs each task's source `node_modules` so `tsc` can resolve library types.

Versioning: `package.json`'s `version` is the single source of truth. The stamp
step writes it into `dist/vss-extension.json` (flat semver) and both
`dist/tb-*/task.json` (`version.Major/Minor/Patch`). Source manifests keep a
placeholder version — only the `dist` copies are stamped, so don't rely on the
version in the checked-in `vss-extension.json` / `task.json`.

Tests: `npm test` compiles and runs the mocha suites under `tb-*/tests/` (they
use `azure-pipelines-task-lib`'s `mock-run`/`mock-test`; `MockTestRunner`
downloads the Node20 runtime on first run, so the first `npm test` is slow).
There is no lint wired up yet (the old `.eslintrc` targets the removed
babel-eslint) and no test suite — both are planned (see `MODERNIZATION.md`).
babel-eslint) — planned for Phase 4 (see `MODERNIZATION.md`).

## Architecture

The extension contributes three server-side pieces plus one endpoint type,
declared in `vss-extension.json` under `contributions`:

- **`tb-main/`** — Pipeline task "TestingBot Configuration" (`TBMain`). Node task
(`testingbot.js`) that reads a TestingBot service-endpoint credential, exports
`TB_KEY`/`TB_SECRET`/`SELENIUM_HOST`/etc. as pipeline variables so downstream
test steps can reach the grid, and optionally launches **TestingBot Tunnel**
(`tb-main/tunnel/2.30.jar`, spawned as a child process). It writes
`testingbot.json` and attaches it to the build via
`task.addattachment` with type `TestingBotBuildResult` — this attachment is how
the results tab (below) later finds the build's credentials and build name.
- **`tb-main/`** — Pipeline task "TestingBot Configuration" (`TBMain`). TypeScript
task (`index.ts`) that reads a TestingBot service-endpoint credential, exports
`TB_KEY`/`TB_SECRET`/`SELENIUM_HOST`/etc. as pipeline variables (the secret ones
via `setSecret` + a secret variable) so downstream test steps can reach the
grid, and optionally launches **TestingBot Tunnel** via the
`testingbot-tunnel-launcher` npm package (which downloads/caches the current
tunnel jar at runtime — nothing is bundled). It writes `testingbot.json` and
attaches it to the build via `task.addattachment` with type
`TestingBotBuildResult` — this attachment is how the results tab (below) later
finds the build's credentials and build name. The credentials still travel in
that attachment because the tab needs them to sign TestingBot `/mini` share
URLs; removing them from the browser (finding #1) is the Phase 3 tab redesign.

- **`tb-stop-tunnel/`** — Pipeline task "Stop TestingBot Tunnel" (`TBStopTunnel`).
Kills the tunnel process using the PID that `tb-main` stored in the
`TB_TUNNEL_PID` variable. Add this task after your test steps to tear the tunnel
down.
TypeScript task (`index.ts`) that kills the tunnel process using the PID that
`tb-main` stored in the `TB_TUNNEL_PID` variable (the launcher's in-process
`killAsync` can't reach a tunnel started by a different task). Add this task
after your test steps to tear the tunnel down.
Comment on lines +49 to +66

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the stale modernization roadmap.

These sections describe TypeScript task entrypoints, runtime tunnel downloads, and secret handling as implemented, but lines 121-123 still say this is Phase 1 and those capabilities are pending. Update the roadmap so contributors do not follow obsolete project guidance.

Also applies to: 85-98

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CLAUDE.md` around lines 49 - 66, Update the modernization roadmap sections
around the Phase 1 status to reflect that the TypeScript task entrypoints,
runtime tunnel downloads, and secret handling described by TBMain and
TBStopTunnel are already implemented. Remove or revise obsolete “pending”
guidance while preserving the roadmap’s remaining accurate phases and findings.


- **`tb-build-info/`** — A build-results web tab (`infoTab.html` +
`scripts/info.js`) shown inside the Azure DevOps build view. It reads the
Expand All @@ -70,15 +82,20 @@ service endpoint. The tab never sees raw credentials outside that attachment.

## Task vs. web code — two different runtimes

- **Task code** runs on the build agent under the `Node20_1` handler.
- `tb-main/testingbot.js` uses `azure-pipelines-task-lib/task` (`tl.getInput`,
`tl.getBoolInput`, `tl.setVariable`, `tl.command`). It declares its runtime
- **Task code** runs on the build agent under the `Node20_1` handler. Both tasks
are TypeScript (`index.ts` compiled to `index.js` in place).
- `tb-main/index.ts` uses `azure-pipelines-task-lib/task` (`tl.getInput`,
`tl.getBoolInput`, `tl.setVariable`, `tl.setSecret`, `tl.command`,
`tl.setResult`) and `testingbot-tunnel-launcher`. It declares those runtime
deps in `tb-main/package.json`; they are NOT committed — the `deps` build
step installs them into `dist/tb-main/node_modules` so the packaged task is
step installs them into `dist/tb-main/node_modules` so the task is
self-contained.
- `tb-stop-tunnel/sample.js` reads `TB_TUNNEL_PID` directly from `process.env`
and calls `process.kill`. It must stay **dependency-free** — do not add
`azure-pipelines-task-lib` or any other dependency to the stop task.
- `tb-stop-tunnel/index.ts` must stay **dependency-free** — it reads
`TB_TUNNEL_PID` directly from `process.env`, calls `process.kill`, and emits
the raw `##vso[task.complete …]` logging command itself. Do NOT add
`azure-pipelines-task-lib` (or any runtime dependency) to the stop task; its
`package.json` has no `dependencies`, so nothing is installed into
`dist/tb-stop-tunnel`.

- **Web/tab code** (`tb-build-info/scripts/*.js`) runs in the browser inside Azure
DevOps and is bundled by webpack (`webpack.config.js`) with AMD output and
Expand Down
Loading