@testdriverai/mcp 7.9.133-test → 7.9.135-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/init-project.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const { execSync, spawn } = require("child_process");
|
|
4
|
+
const { active: ACTIVE_CHANNEL } = require("./resolve-channel.js");
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Run an npm install command with an animated progress bar
|
|
@@ -40,11 +41,15 @@ function runInstall(cmd, args, cwd, label) {
|
|
|
40
41
|
* @param {boolean} [options.skipInstall=false] - Skip npm install step
|
|
41
42
|
* @param {boolean} [options.interactive=false] - Whether to prompt for missing values (CLI mode)
|
|
42
43
|
* @param {string[]} [options.clients] - AI client ids to wire up (e.g. ["claude-code","cursor"] or ["all"]). When set, native per-client config is written instead of the interactive add-mcp flow.
|
|
44
|
+
* @param {string} [options.channel] - Release channel (dev|test|canary|stable) the generated GitHub workflow should pin the action to. Defaults to the SDK's own active channel.
|
|
43
45
|
* @param {function} [options.onProgress] - Callback for progress updates (receives message string)
|
|
44
46
|
* @returns {Promise<{success: boolean, results: string[], errors: string[]}>}
|
|
45
47
|
*/
|
|
46
48
|
async function initProject(options = {}) {
|
|
47
49
|
const targetDir = options.targetDir || process.cwd();
|
|
50
|
+
// Which TestDriver channel the generated workflow should target. A -test SDK
|
|
51
|
+
// scaffolds a test-pinned workflow, -canary -> canary, clean semver -> stable.
|
|
52
|
+
const channel = options.channel || ACTIVE_CHANNEL;
|
|
48
53
|
const results = [];
|
|
49
54
|
const errors = [];
|
|
50
55
|
|
|
@@ -235,6 +240,10 @@ export default defineConfig({
|
|
|
235
240
|
|
|
236
241
|
const workflowFile = path.join(workflowDir, "testdriver.yml");
|
|
237
242
|
if (!fs.existsSync(workflowFile)) {
|
|
243
|
+
// The published action is tagged test/canary/stable. `dev` runs locally and
|
|
244
|
+
// isn't published, so pin its `uses:` ref to the test action while still
|
|
245
|
+
// passing channel: dev so the action targets the dev API root.
|
|
246
|
+
const actionRef = channel === "dev" ? "test" : channel;
|
|
238
247
|
const workflowContent = `name: TestDriver.ai Tests
|
|
239
248
|
|
|
240
249
|
on:
|
|
@@ -242,10 +251,14 @@ on:
|
|
|
242
251
|
branches: [ main, master ]
|
|
243
252
|
pull_request:
|
|
244
253
|
branches: [ main, master ]
|
|
254
|
+
workflow_dispatch:
|
|
245
255
|
|
|
246
256
|
jobs:
|
|
247
257
|
test:
|
|
248
258
|
runs-on: ubuntu-latest
|
|
259
|
+
permissions:
|
|
260
|
+
id-token: write # required to mint the OIDC token for auth
|
|
261
|
+
contents: read
|
|
249
262
|
|
|
250
263
|
steps:
|
|
251
264
|
- uses: actions/checkout@v4
|
|
@@ -259,9 +272,16 @@ jobs:
|
|
|
259
272
|
- name: Install dependencies
|
|
260
273
|
run: npm ci
|
|
261
274
|
|
|
275
|
+
# Authenticate to TestDriver via GitHub OIDC (no stored secret needed once the
|
|
276
|
+
# TestDriver GitHub App is authorized for your org). Falls back to a TD_API_KEY
|
|
277
|
+
# secret if you set one. Exports TD_API_KEY for the test step below.
|
|
278
|
+
- name: Authenticate to TestDriver
|
|
279
|
+
uses: testdriverai/action@${actionRef}
|
|
280
|
+
with:
|
|
281
|
+
channel: ${channel}
|
|
282
|
+
api-key: \${{ secrets.TD_API_KEY }}
|
|
283
|
+
|
|
262
284
|
- name: Run TestDriver.ai tests
|
|
263
|
-
env:
|
|
264
|
-
TD_API_KEY: \${{ secrets.TD_API_KEY }}
|
|
265
285
|
run: npx vitest run
|
|
266
286
|
|
|
267
287
|
- name: Upload test results
|