code-foundry 1.15.0 → 1.17.0

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.
@@ -0,0 +1,95 @@
1
+ name: Consumer Qualification
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ billing-pause-bypass:
7
+ description: Allow an explicitly dispatched release to qualify while shared CI remains paused.
8
+ required: false
9
+ type: boolean
10
+ default: false
11
+
12
+ permissions:
13
+ actions: read
14
+ contents: read
15
+
16
+ jobs:
17
+ pack:
18
+ name: Pack candidate once
19
+ if: vars.CI_BILLING_PAUSED != 'true' || inputs['billing-pause-bypass'] == true
20
+ runs-on: ubuntu-24.04
21
+ timeout-minutes: 10
22
+ outputs:
23
+ filename: ${{ steps.pack.outputs.filename }}
24
+ steps:
25
+ - name: Checkout candidate
26
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
27
+ with:
28
+ persist-credentials: false
29
+ - name: Setup packaging Node
30
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
31
+ with:
32
+ node-version: '24'
33
+ - name: Pack the distributable once
34
+ id: pack
35
+ run: |
36
+ set -euo pipefail
37
+ mkdir -p "$RUNNER_TEMP/candidate"
38
+ npm pack --ignore-scripts --json --pack-destination "$RUNNER_TEMP/candidate" > "$RUNNER_TEMP/candidate/pack.json"
39
+ PACKAGE=$(node -e 'const p=require(process.argv[1]); if(p.length!==1 || !/^[A-Za-z0-9._-]+\.tgz$/.test(p[0].filename)) process.exit(1); console.log(p[0].filename)' "$RUNNER_TEMP/candidate/pack.json")
40
+ echo "filename=$PACKAGE" >> "$GITHUB_OUTPUT"
41
+ - name: Retain the shared candidate
42
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
43
+ with:
44
+ name: qualification-candidate-${{ github.run_id }}
45
+ path: ${{ runner.temp }}/candidate/*
46
+ if-no-files-found: error
47
+ overwrite: true
48
+ retention-days: 14
49
+
50
+ qualify:
51
+ name: Node ${{ matrix.node }}
52
+ needs: pack
53
+ if: vars.CI_BILLING_PAUSED != 'true' || inputs['billing-pause-bypass'] == true
54
+ runs-on: ubuntu-24.04
55
+ timeout-minutes: 15
56
+ strategy:
57
+ fail-fast: false
58
+ matrix:
59
+ node: ['20', '22', '24']
60
+ steps:
61
+ - name: Checkout qualification runtime
62
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
63
+ with:
64
+ persist-credentials: false
65
+ - name: Setup Node
66
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
67
+ with:
68
+ node-version: ${{ matrix.node }}
69
+ - name: Retrieve the shared archive from this attempt
70
+ env:
71
+ GH_TOKEN: ${{ github.token }}
72
+ run: |
73
+ gh run download "$GITHUB_RUN_ID" --repo "$GITHUB_REPOSITORY" \
74
+ --name "qualification-candidate-$GITHUB_RUN_ID" \
75
+ --dir "$RUNNER_TEMP/candidate"
76
+ - name: Install pinned workflow validator
77
+ run: go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12
78
+ - name: Qualify the exact shared distributable
79
+ env:
80
+ PACKAGE: ${{ needs.pack.outputs.filename }}
81
+ run: |
82
+ set -euo pipefail
83
+ node src/lib/consumer-qualification.mjs \
84
+ "$RUNNER_TEMP/candidate/$PACKAGE" \
85
+ "$(git rev-parse HEAD)" \
86
+ "$RUNNER_TEMP/report.json" \
87
+ "$(go env GOPATH)/bin/actionlint"
88
+ - name: Retain qualification evidence
89
+ if: always()
90
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
91
+ with:
92
+ name: consumer-qualification-${{ github.run_attempt }}-node-${{ matrix.node }}
93
+ path: ${{ runner.temp }}/report.json
94
+ if-no-files-found: warn
95
+ retention-days: 14
@@ -0,0 +1,19 @@
1
+ name: Qualification
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ types: [ready_for_review]
7
+
8
+ permissions:
9
+ actions: read
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: qualification-${{ github.event_name }}-${{ github.event.pull_request.number }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ consumers:
18
+ if: vars.CI_BILLING_PAUSED != 'true' && github.event.pull_request.draft == false
19
+ uses: ./.github/workflows/consumer-qualification.yml
@@ -19,8 +19,18 @@ permissions:
19
19
  id-token: write
20
20
 
21
21
  jobs:
22
+ qualification:
23
+ name: Qualify consumers
24
+ if: vars.CI_BILLING_PAUSED != 'true' || (github.event_name == 'workflow_dispatch' && inputs['release-while-paused'] == true)
25
+ uses: ./.github/workflows/consumer-qualification.yml
26
+ with:
27
+ billing-pause-bypass: ${{ github.event_name == 'workflow_dispatch' && inputs['release-while-paused'] == true }}
28
+ permissions:
29
+ actions: read
30
+ contents: read
22
31
  release:
23
32
  name: Release
33
+ needs: qualification
24
34
  if: vars.CI_BILLING_PAUSED != 'true' || (github.event_name == 'workflow_dispatch' && inputs['release-while-paused'] == true)
25
35
  uses: ./.github/workflows/release.yml
26
36
  with:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.17.0](https://github.com/0xPlayerOne/code-foundry/compare/v1.16.0...v1.17.0) (2026-09-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * **quality:** add opt-in site, app, Worker, and package acceptance profiles ([#545](https://github.com/0xPlayerOne/code-foundry/issues/545)) ([1201793](https://github.com/0xPlayerOne/code-foundry/commit/1201793805b443c835b608609704bc43bcb035f5))
9
+
10
+ ## [1.16.0](https://github.com/0xPlayerOne/code-foundry/compare/v1.15.0...v1.16.0) (2026-09-09)
11
+
12
+
13
+ ### Features
14
+
15
+ * **qualification:** gate releases on installed consumer compatibility ([#544](https://github.com/0xPlayerOne/code-foundry/issues/544)) ([33c759b](https://github.com/0xPlayerOne/code-foundry/commit/33c759be8c78c633f55a58dc6144986758676336))
16
+
3
17
  ## [1.15.0](https://github.com/0xPlayerOne/code-foundry/compare/v1.14.0...v1.15.0) (2026-09-09)
4
18
 
5
19
 
package/README.md CHANGED
@@ -39,6 +39,8 @@ contract. For normal updates, edit that file and run `npx code-foundry sync`.
39
39
  audits, Draft Guard, Draft PR, Release PR, and Release.
40
40
  - A deterministic performance lane with ordered command support, stable result
41
41
  artifacts, and an optional shared Node package budget profile.
42
+ - An opt-in product-quality runner for static sites, web apps, Workers, and
43
+ published packages.
42
44
  - A small `.githooks/pre-commit` launcher with language-aware formatting and
43
45
  linting.
44
46
  - An optional `.mise.toml`/`mise.lock`, repository profile configuration, and
@@ -15,14 +15,22 @@ belong to the run that produced them, not the source tree.
15
15
  | Format, lint, type-check, and build | 15 s | Bound the local CI feedback loop |
16
16
  | Runtime dependencies | 0 | Keep the installed CLI dependency-free |
17
17
  | Development dependencies | 4 | Prevent unreviewed toolchain growth |
18
- | Packed artifact | 210 kB | Bound registry transfer and install cost |
19
- | Unpacked artifact | 820 kB | Bound installed footprint |
20
- | Packed files | 92 | Detect accidental release contents |
18
+ | Packed artifact | 240 kB | Bound registry transfer and install cost |
19
+ | Unpacked artifact | 900 kB | Bound installed footprint |
20
+ | Packed files | 110 | Detect accidental release contents |
21
21
 
22
22
  The performance workflow disables build-cache reads and writes for this task.
23
23
  That makes timing comparisons independent of a warm protected-branch cache and
24
24
  prevents benchmark code from populating shared cache entries.
25
25
 
26
+ The consumer qualification workflow adds the installed-package harness and
27
+ workflow contract to the distributable. The merged candidate measured 221,495
28
+ packed bytes, 853,573 unpacked bytes, and 100 files on Node 24.18.0; the updated
29
+ budgets leave a small margin while continuing to bound package growth. The
30
+ product-quality profiles and consumer qualification workflow measured 232,650
31
+ packed bytes, 890,418 unpacked bytes, and 103 files on Node 24.18.0, so the
32
+ limits remain intentionally bounded while covering both opt-in feature sets.
33
+
26
34
  ## v1.6.1 baseline
27
35
 
28
36
  Measurements were taken on 2026-09-08 with Node 24.18.0. Process startup used
package/docs/README.md CHANGED
@@ -15,6 +15,7 @@ its own names, environments, and deployment details.
15
15
  - [Caching and remote caching](CACHING.md)
16
16
  - [Performance budgets and baselines](PERFORMANCE.md)
17
17
  - [Required capabilities and task evidence](required-capabilities.md)
18
+ - [Product quality profiles](product-quality.md)
18
19
  - [Agent-facing validation commands](agent-validation.md)
19
20
  - [Declarative fleet inventory and staged rollouts](fleet-rollouts.md)
20
21
 
@@ -0,0 +1,48 @@
1
+ # Consumer Qualification
2
+
3
+ Release-candidate compatibility checks against the distributable package.
4
+
5
+ **Status:** Opt-in reusable workflow; required by Code Foundry's own release caller.
6
+ **Scope:** Package installation, CLI initialization/synchronization, generated workflow contracts.
7
+
8
+ `consumer-qualification.yml` packs the checked-out candidate once, shares that archive across all supported
9
+ Node majors using an artifact scoped to the same workflow run (including failed-job reruns), installs it offline with lifecycle scripts disabled,
10
+ and executes its public CLI from the installed package. The harness does not
11
+ import the source checkout's initializer as a substitute for package testing.
12
+
13
+ The matrix covers npm, pnpm, Yarn, Bun, direct and staging-release topologies,
14
+ authored documentation and workflows, an existing mise selection, and nested
15
+ Rust/Python manifests. It checks detected package managers, byte preservation,
16
+ and two successive no-change synchronizations. Lockfiles are detection fixtures:
17
+ this suite does not claim to install or execute every ecosystem toolchain.
18
+ Repository unit/policy suites and real consumer canaries remain required.
19
+
20
+ Actionlint checks copies of generated callers against the candidate's local
21
+ reusable workflows. Only exact candidate repository/ref calls are localized;
22
+ production callers and custom workflows are never edited by this step. Shellcheck
23
+ and Pyflakes are disabled here because this gate tests Actions contracts; existing
24
+ shell/security validation remains independent. Actionlint is pinned to v1.7.12.
25
+
26
+ ```sh
27
+ npm pack --ignore-scripts --pack-destination /tmp/candidate
28
+ node src/lib/consumer-qualification.mjs \
29
+ /tmp/candidate/code-foundry-VERSION.tgz \
30
+ "$(git rev-parse HEAD)" /tmp/qualification.json /absolute/path/to/actionlint
31
+ ```
32
+
33
+ The JSON report binds the result to the source SHA, archive SHA-256, Node version,
34
+ and completed fixtures. Failed runs retain `complete: false`. Running without
35
+ Actionlint is a local structural probe only (`actionlint: false`), not release
36
+ qualification. Downstream eligibility must require both `complete` and
37
+ `actionlint`, the expected source/digest, and successful reports for every matrix
38
+ member. Reports are evidence, not signatures or a substitute for release identity
39
+ verification.
40
+
41
+ The self release caller cannot start Release Please or npm publication until all
42
+ qualification jobs succeed. An explicit `release-while-paused` dispatch is passed
43
+ through to the reusable workflow; ordinary calls remain blocked by the billing pause.
44
+ Consumer-generated release callers do not inherit this Code Foundry-specific
45
+ qualification job. This does not yet guarantee that its legacy publishing job uses
46
+ this same archive; the verified-publication workflow handles that separate
47
+ requirement. No branch protections, repository settings, credentials, or consumer
48
+ runtimes are changed by this feature.
@@ -0,0 +1,173 @@
1
+ # Product Quality Profiles
2
+
3
+ Opt-in acceptance checks for built sites, interactive applications, Workers, and packages.
4
+
5
+ **Status:** Additive runner; existing repositories are not opted in automatically.
6
+ **Evidence:** Fresh per-run reports under `.code-foundry/quality/`.
7
+
8
+ ## Activation
9
+
10
+ Commit a version-1 JSON manifest and use the installed, pinned Foundry runtime:
11
+
12
+ ```json
13
+ {
14
+ "scripts": {
15
+ "quality:build": "node node_modules/code-foundry/src/quality.mjs .github/product-quality.json build",
16
+ "quality:browser": "node node_modules/code-foundry/src/quality.mjs .github/product-quality.json browser"
17
+ }
18
+ }
19
+ ```
20
+
21
+ Wire these scripts into the consumer's existing validation entrypoints. The
22
+ Foundry runtime discovers only `performance:check`/`perf:check` and
23
+ `test:e2e`/`e2e`; if those names do not already exist, they can run
24
+ `bun run quality:build` and `bun run quality:browser`. If they do exist, preserve their current
25
+ commands and compose the quality command after them rather than replacing the
26
+ existing performance or E2E checks. The standalone entrypoint deliberately avoids
27
+ changing the public CLI dispatch being introduced in the separate agent-validation
28
+ PR. Install the reviewed Foundry version in the consumer's existing dependency
29
+ manager and lockfile, not an unpinned network invocation. Add `.code-foundry/` to
30
+ Git/package ignores and retain selected evidence through the consumer workflow's
31
+ artifact uploader. Reports and browser traces may contain application data; review
32
+ retention and never upload authenticated traces publicly without sanitization.
33
+
34
+ ```json
35
+ {
36
+ "schema_version": 1,
37
+ "prepare": { "build": [["bun", "run", "build"]] },
38
+ "profiles": [
39
+ {
40
+ "id": "marketing",
41
+ "type": "static-site",
42
+ "dist": "dist",
43
+ "origin": "https://example.com",
44
+ "routes": [{ "path": "/", "html": "index.html", "javascriptAssets": [] }],
45
+ "budgets": { "htmlBytes": 100000, "javascriptBytes": 80000, "imageBytes": 600000 },
46
+ "sitemap": "sitemap.xml",
47
+ "robots": "robots.txt",
48
+ "redirects": { "file": "_redirects", "rules": [{ "from": "/old", "to": "/", "status": 301 }] }
49
+ }
50
+ ]
51
+ }
52
+ ```
53
+
54
+ Example numbers are not fleet defaults. Measure and review thresholds in the
55
+ consumer repository. `prepare` runs once per selected phase, so several profiles
56
+ can share one build without repeating it. A phase with no applicable profiles
57
+ fails instead of pretending to validate something. Available phases are `build`,
58
+ `browser`, and `deployed`; assign a profile's `phase` explicitly to override its
59
+ default (`browser` for web-app, `build` for the others).
60
+
61
+ ## Static sites
62
+
63
+ The static profile checks explicit rendered routes for titles, descriptions,
64
+ canonical identity, accidental noindex, local links/anchors, directly referenced
65
+ resources, declared additional JavaScript chunks, sitemap inclusion, robots
66
+ sitemap declaration, and exact simple `_redirects` rules. All responsive image
67
+ candidates count toward the asset budget. Budgets measure build bytes, not an
68
+ estimate of browser transfer size or Core Web Vitals. `javascriptAssets` must
69
+ include transitive chunks selected from the consumer's bundler manifest; this
70
+ runner does not invent a framework dependency graph. External resources fail
71
+ closed rather than being treated as zero-byte dependencies.
72
+
73
+ This conservative generated-HTML parser is not a browser DOM or a complete HTML
74
+ conformance validator. Complex base-element routing, sitemap indexes, wildcard or
75
+ conditional redirects, client-only metadata, and CDN behavior need repository-owned
76
+ or deployed tests. All generated/public routes should be declared (or the manifest
77
+ generated from the framework's route output) to avoid untested routes. Redirect
78
+ checks prove the artifact declaration, not production routing behavior.
79
+
80
+ ## Interactive applications
81
+
82
+ ```json
83
+ {
84
+ "id": "application",
85
+ "type": "web-app",
86
+ "baseURL": "http://127.0.0.1:4321",
87
+ "webServerCommand": "bun run preview --host 127.0.0.1",
88
+ "journeys": "tests/quality-journeys.mjs",
89
+ "snapshots": "tests/quality-snapshots",
90
+ "routes": [{ "id": "home", "path": "/", "readySelector": "main h1", "visual": true }]
91
+ }
92
+ ```
93
+
94
+ `baseURL` must be an HTTP(S) origin without a path, query, or fragment; routes
95
+ are root-relative paths on that origin. Use the repository's locked
96
+ `@playwright/test`, `@axe-core/playwright`, and matching Chromium installation.
97
+ No browser tooling is silently downloaded. The runner
98
+ imports the consumer's journey module and requires at least one additional real
99
+ passing test beyond its generated route tests. Skips, flakes, expected-failure
100
+ annotations, incomplete results, and missing routes fail the evidence check.
101
+ Each generated route validates navigation, waits for the declared readiness
102
+ selector, checks page runtime errors, and performs axe WCAG 2/2.1 A/AA checks.
103
+ Automation does not establish complete accessibility compliance.
104
+
105
+ Selected visual routes compare repository-owned baselines with
106
+ `updateSnapshots: none`. Missing baselines fail; this runner never approves them.
107
+ Create and review baselines separately in the same browser/OS/font environment.
108
+ The generated configuration fixes Chromium, viewport, retries, and screenshot
109
+ animation handling; specialized device/authentication fixtures remain in the
110
+ consumer's journey tests. Remote base URLs require explicit `allowRemote: true`;
111
+ that is consent to network testing, not isolation. Secrets, account fixtures, and
112
+ production-safe test behavior remain the consumer's responsibility.
113
+
114
+ ## Cloudflare Workers
115
+
116
+ ```json
117
+ {
118
+ "id": "worker",
119
+ "type": "worker",
120
+ "buildCommand": ["bun", "run", "worker:bundle", "{output}"],
121
+ "files": ["worker.js"],
122
+ "budgets": { "rawBytes": 1000000, "gzipBytes": 250000 },
123
+ "runtimeCommand": ["bun", "run", "worker:compatibility", "{output}"]
124
+ }
125
+ ```
126
+
127
+ The build command must emit selected bundles into the fresh output directory.
128
+ `{output}` arguments and `CODE_FOUNDRY_QUALITY_OUTPUT_DIR` expose that directory.
129
+ Raw bytes and the sum of individually gzipped files are measured; they are not
130
+ claimed to equal Cloudflare's uploaded aggregate size or startup limits. Use
131
+ locked Wrangler/workerd to test compatibility dates, flags, and bindings in the
132
+ mandatory native runtime command. Production smoke probes belong in the verified
133
+ delivery workflow, not a hidden dependency of the deterministic build phase.
134
+ No Worker, Durable Object, binding, migration, or production resource is created.
135
+
136
+ ## Published packages
137
+
138
+ ```json
139
+ {
140
+ "id": "package",
141
+ "type": "package",
142
+ "imports": ["my-package", "my-package/feature"],
143
+ "runtimes": ["node"],
144
+ "offline": true
145
+ }
146
+ ```
147
+
148
+ The package profile packs once without lifecycle scripts, installs that archive
149
+ into an isolated temporary consumer, and exercises declared package exports using
150
+ Node and/or Bun already installed on the runner. Run build/test preparation
151
+ explicitly first. Both install scripts and package lifecycle hooks are disabled;
152
+ packages requiring installation hooks need a separately reviewed specialized
153
+ consumer suite. Runtime dependencies must be cached for the default offline mode;
154
+ `offline: false` explicitly permits normal registry resolution. Temporary package
155
+ installations are removed. Evidence is rejected if it leaks into the package.
156
+
157
+ ## Evidence and trust
158
+
159
+ Each summary has a unique run ID, manifest hash, phase, source commit/dirty status
160
+ when available, per-profile metrics or failure reasons, and final status. A new
161
+ output directory prevents old reports from becoming current evidence. The source
162
+ fields are descriptive, not a signed dirty-worktree snapshot. Commands are argv
163
+ arrays without shell expansion; repository-owned commands still have the normal
164
+ permissions of the executing process and are not sandboxed. Playwright's optional
165
+ web-server command is its native shell-command interface and must be reviewed.
166
+
167
+ The runner does not replace Lighthouse CI, native application tests, manual
168
+ accessibility testing, real consumer canaries, or release provenance. Existing
169
+ Lighthouse assertions can remain in repository-owned scripts/preparation; no
170
+ Lighthouse score or threshold is silently introduced by this feature.
171
+
172
+ References: [Playwright accessibility](https://playwright.dev/docs/accessibility-testing),
173
+ [Playwright snapshot configuration](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-foundry",
3
- "version": "1.15.0",
3
+ "version": "1.17.0",
4
4
  "description": "A fast, language-aware repository factory for agent-ready workflows, testing, security, and release automation.",
5
5
  "homepage": "https://github.com/0xPlayerOne/code-foundry#readme",
6
6
  "bugs": {
@@ -242,7 +242,15 @@ export function syncRepository(options) {
242
242
  }
243
243
  if (file.endsWith('.yml') && file.startsWith('.github/workflows/')) {
244
244
  content = Buffer.from(
245
- renderWorkflow(content.toString('utf8'), config, runtimeRepository, runtimeRef, rustCodeql)
245
+ renderWorkflow(
246
+ content.toString('utf8'),
247
+ config,
248
+ runtimeRepository,
249
+ runtimeRef,
250
+ rustCodeql,
251
+ file,
252
+ target === source
253
+ )
246
254
  )
247
255
  }
248
256
  if (file === '.github/dependabot.yml') {
@@ -537,8 +545,10 @@ function sourcePath(source, file) {
537
545
  * @param {string} repository
538
546
  * @param {string} ref
539
547
  * @param {{ shards: string, threads: string, maxParallel: string }} rustCodeql
548
+ * @param {string} file
549
+ * @param {boolean} selfRepository
540
550
  */
541
- function renderWorkflow(content, config, repository, ref, rustCodeql) {
551
+ function renderWorkflow(content, config, repository, ref, rustCodeql, file, selfRepository) {
542
552
  const localPrefix = 'uses: ./.github/workflows/'
543
553
  const remotePrefix = `uses: ${repository}/.github/workflows/`
544
554
  let rendered = content.replaceAll(localPrefix, remotePrefix)
@@ -578,7 +588,15 @@ function renderWorkflow(content, config, repository, ref, rustCodeql) {
578
588
  'release-pr': config.pr_runner ?? config.runner,
579
589
  release: config.release_runner ?? config.runner,
580
590
  }
581
- const workflow = content.match(/\.github\/workflows\/([^/]+)\.yml/)?.[1]
591
+ const workflow = file.match(/^\.github\/workflows\/([^/]+)\.yml$/)?.[1]
592
+ // Consumer release callers are generic package release workflows. The
593
+ // installed-consumer qualification harness is specific to Code Foundry's
594
+ // own package and must remain in the self workflow rather than being
595
+ // rendered into every consumer's release caller.
596
+ if (workflow === 'release' && !selfRepository) {
597
+ rendered = removeWorkflowBlock(rendered, 'qualification')
598
+ rendered = removeWorkflowNeed(rendered, 'release', 'qualification')
599
+ }
582
600
  // The staging-release topology validates and scans pull requests against
583
601
  // both main and the integration branch; direct repositories only ever
584
602
  // target main, so their callers trigger on main alone.
@@ -669,6 +687,26 @@ function removeWorkflowBlock(content, blockId) {
669
687
  return lines.join('\n')
670
688
  }
671
689
 
690
+ /**
691
+ * Remove a single root-job dependency while preserving the rest of the job.
692
+ * @param {string} content
693
+ * @param {string} jobId
694
+ * @param {string} dependency
695
+ * @returns {string}
696
+ */
697
+ function removeWorkflowNeed(content, jobId, dependency) {
698
+ const lines = content.split('\n')
699
+ const start = lines.findIndex((line) => line === ` ${jobId}:`)
700
+ if (start === -1) return content
701
+ let end = start + 1
702
+ while (end < lines.length && !/^ [A-Za-z0-9_-]+:\s*$/.test(lines[end])) end += 1
703
+ const need = lines.findIndex(
704
+ (line, index) => index > start && index < end && line === ` needs: ${dependency}`
705
+ )
706
+ if (need >= 0) lines.splice(need, 1)
707
+ return lines.join('\n')
708
+ }
709
+
672
710
  /**
673
711
  * Dependabot updates land on the repository's integration branch. Direct
674
712
  * repositories have no staging branch, so every update targets main. Cargo,