@diffci.com/diffci 0.2.7 → 0.2.8
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/LICENSE +1 -1
- package/README.md +322 -320
- package/action.yml +154 -154
- package/dist-client/src/client/cli.js +100 -97
- package/dist-client/src/client/verify-savings.js +17 -0
- package/docs/adoption-metrics.md +107 -34
- package/docs/adoption-outreach.md +99 -62
- package/docs/agent-adoption-kit.md +78 -67
- package/docs/agent-adoption-targets.md +62 -62
- package/docs/ai-agents.md +102 -102
- package/docs/claude-code.md +2 -2
- package/docs/codex.md +2 -2
- package/docs/copilot.md +2 -2
- package/docs/cursor.md +2 -2
- package/docs/distribution.md +131 -131
- package/docs/grok.md +2 -2
- package/docs/language-support.md +118 -118
- package/docs/mcp.md +70 -70
- package/docs/npm-adoption.md +147 -134
- package/llms.txt +39 -39
- package/node_modules/@babel/parser/bin/babel-parser.js +0 -0
- package/node_modules/nanoid/bin/nanoid.cjs +0 -0
- package/node_modules/typescript/bin/tsc +0 -0
- package/node_modules/typescript/bin/tsserver +0 -0
- package/node_modules/yaml/bin.mjs +0 -0
- package/package.json +157 -154
- package/server.json +28 -28
- package/node_modules/@babel/parser/CHANGELOG.md +0 -1073
- package/node_modules/estree-walker/CHANGELOG.md +0 -92
package/action.yml
CHANGED
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
# DiffCI observer - the GitHub Action a third-party repository installs (Phase 02, 2026-08-26).
|
|
2
|
-
#
|
|
3
|
-
# WHAT THIS DOES: analyses one commit range against the checkout the job already has, writes a JSON
|
|
4
|
-
# report to the runner's temp directory, prints a summary to the job log and the job summary, optionally
|
|
5
|
-
# uploads the report as an artifact, and - only when `api-url` and `api-token` are both set - sends that
|
|
6
|
-
# same report to DiffCI. With no token configured nothing leaves the runner at all.
|
|
7
|
-
#
|
|
8
|
-
# WHAT THIS DOES NOT DO, and cannot: run tests, skip tests, cancel a job, re-order steps, write to the
|
|
9
|
-
# repository, comment on a pull request, or set a check status. There is no input below that turns any
|
|
10
|
-
# of that on, because the claim being tested for seven days is that installing DiffCI leaves CI
|
|
11
|
-
# byte-identical, and a flag that could change what CI runs would eventually be set by accident.
|
|
12
|
-
#
|
|
13
|
-
# INSTALL IT AS ITS OWN JOB. A job of its own is what makes the claim structural rather than careful:
|
|
14
|
-
#
|
|
15
|
-
# jobs:
|
|
16
|
-
# diffci:
|
|
17
|
-
# runs-on: ubuntu-latest
|
|
18
|
-
# continue-on-error: true # a DiffCI failure must not become the workflow's conclusion
|
|
19
|
-
# permissions:
|
|
20
|
-
# contents: read
|
|
21
|
-
# steps:
|
|
22
|
-
# - uses: actions/checkout@v4
|
|
23
|
-
# with:
|
|
24
|
-
# fetch-depth: 0 # the base commit must exist locally, or DiffCI refuses
|
|
1
|
+
# DiffCI observer - the GitHub Action a third-party repository installs (Phase 02, 2026-08-26).
|
|
2
|
+
#
|
|
3
|
+
# WHAT THIS DOES: analyses one commit range against the checkout the job already has, writes a JSON
|
|
4
|
+
# report to the runner's temp directory, prints a summary to the job log and the job summary, optionally
|
|
5
|
+
# uploads the report as an artifact, and - only when `api-url` and `api-token` are both set - sends that
|
|
6
|
+
# same report to DiffCI. With no token configured nothing leaves the runner at all.
|
|
7
|
+
#
|
|
8
|
+
# WHAT THIS DOES NOT DO, and cannot: run tests, skip tests, cancel a job, re-order steps, write to the
|
|
9
|
+
# repository, comment on a pull request, or set a check status. There is no input below that turns any
|
|
10
|
+
# of that on, because the claim being tested for seven days is that installing DiffCI leaves CI
|
|
11
|
+
# byte-identical, and a flag that could change what CI runs would eventually be set by accident.
|
|
12
|
+
#
|
|
13
|
+
# INSTALL IT AS ITS OWN JOB. A job of its own is what makes the claim structural rather than careful:
|
|
14
|
+
#
|
|
15
|
+
# jobs:
|
|
16
|
+
# diffci:
|
|
17
|
+
# runs-on: ubuntu-latest
|
|
18
|
+
# continue-on-error: true # a DiffCI failure must not become the workflow's conclusion
|
|
19
|
+
# permissions:
|
|
20
|
+
# contents: read
|
|
21
|
+
# steps:
|
|
22
|
+
# - uses: actions/checkout@v4
|
|
23
|
+
# with:
|
|
24
|
+
# fetch-depth: 0 # the base commit must exist locally, or DiffCI refuses
|
|
25
25
|
# - uses: DiffCI/DiffCI.com@<40-character commit sha>
|
|
26
|
-
#
|
|
27
|
-
# `diffci verify-workflow` checks those properties against your own workflow files and exits non-zero
|
|
28
|
-
# if any of them does not hold. Run it before the observation window starts.
|
|
29
|
-
name: DiffCI observer
|
|
30
|
-
description: Observation-only change-aware CI analysis. Runs nothing, changes nothing, skips nothing.
|
|
31
|
-
branding:
|
|
32
|
-
icon: eye
|
|
33
|
-
color: gray-dark
|
|
34
|
-
|
|
35
|
-
inputs:
|
|
36
|
-
repository-path:
|
|
37
|
-
description: The checkout to observe. Defaults to the workspace.
|
|
38
|
-
required: false
|
|
39
|
-
default: ${{ github.workspace }}
|
|
40
|
-
base-sha:
|
|
41
|
-
description: Base commit. Leave empty to derive it from the event (pull request base, push before).
|
|
42
|
-
required: false
|
|
43
|
-
default: ""
|
|
44
|
-
head-sha:
|
|
45
|
-
description: Head commit. Must be given together with base-sha.
|
|
46
|
-
required: false
|
|
47
|
-
default: ""
|
|
48
|
-
node-version:
|
|
49
|
-
description: Node version used to run the observer. Only affects this job.
|
|
50
|
-
required: false
|
|
51
|
-
default: "22"
|
|
52
|
-
report-path:
|
|
53
|
-
description: Where to write the report. Must be outside the checkout. Defaults to RUNNER_TEMP.
|
|
54
|
-
required: false
|
|
55
|
-
default: ""
|
|
56
|
-
redact-paths:
|
|
57
|
-
description: Replace every file path in the report with a stable 12-character digest.
|
|
58
|
-
required: false
|
|
59
|
-
default: "false"
|
|
60
|
-
upload-artifact:
|
|
61
|
-
description: Upload the report as a workflow artifact.
|
|
62
|
-
required: false
|
|
63
|
-
default: "true"
|
|
64
|
-
artifact-name:
|
|
65
|
-
description: Name of the uploaded artifact.
|
|
66
|
-
required: false
|
|
67
|
-
default: diffci-observation
|
|
68
|
-
artifact-retention-days:
|
|
69
|
-
description: Retention for the uploaded artifact.
|
|
70
|
-
required: false
|
|
71
|
-
default: "7"
|
|
72
|
-
api-url:
|
|
73
|
-
description: >-
|
|
74
|
-
DiffCI ingest endpoint. Leave empty and nothing is sent anywhere - the report stays on the runner
|
|
75
|
-
as an artifact. Must be https.
|
|
76
|
-
required: false
|
|
77
|
-
default: ""
|
|
78
|
-
api-token:
|
|
79
|
-
description: >-
|
|
80
|
-
Ingest token for THIS repository, from a repository secret. Pass it as the workflow expression
|
|
81
|
-
for secrets.DIFFCI_TOKEN, never as a literal. Nothing is sent without it. (This text deliberately
|
|
82
|
-
does not spell out the expression: GitHub evaluates expressions inside action metadata, and
|
|
83
|
-
"secrets" is not a context an action file may use - a literal expression here made the whole
|
|
84
|
-
action fail to load on every run until 2026-09-06.)
|
|
85
|
-
required: false
|
|
86
|
-
default: ""
|
|
87
|
-
fail-on-error:
|
|
88
|
-
description: >-
|
|
89
|
-
Fail this step when the observation refuses or errors. Default false, so a DiffCI problem never
|
|
90
|
-
shows up as a red step in your CI. Turn it on only while debugging an installation.
|
|
91
|
-
required: false
|
|
92
|
-
default: "false"
|
|
93
|
-
|
|
94
|
-
outputs:
|
|
95
|
-
report-path:
|
|
96
|
-
description: Absolute path of the written report.
|
|
97
|
-
value: ${{ steps.observe.outputs.report-path }}
|
|
98
|
-
status:
|
|
99
|
-
description: OBSERVED, REFUSED, or ERROR.
|
|
100
|
-
value: ${{ steps.observe.outputs.status }}
|
|
101
|
-
|
|
102
|
-
runs:
|
|
103
|
-
using: composite
|
|
104
|
-
steps:
|
|
105
|
-
- name: Set up Node for the observer
|
|
106
|
-
uses: actions/setup-node@v4
|
|
107
|
-
with:
|
|
108
|
-
node-version: ${{ inputs.node-version }}
|
|
109
|
-
|
|
110
|
-
# Installed into the action's own directory, never into the observed repository: nothing here
|
|
111
|
-
# touches the workspace, its node_modules, or its lockfile. --omit=dev keeps this to TypeScript and
|
|
112
|
-
# a YAML parser; --ignore-scripts means no dependency of DiffCI's runs code on your runner.
|
|
113
|
-
- name: Install observer dependencies
|
|
114
|
-
shell: bash
|
|
115
|
-
working-directory: ${{ github.action_path }}
|
|
116
|
-
run: npm ci --omit=dev --no-audit --fund=false --ignore-scripts
|
|
117
|
-
|
|
118
|
-
- name: Build observer
|
|
119
|
-
shell: bash
|
|
120
|
-
working-directory: ${{ github.action_path }}
|
|
121
|
-
run: node_modules/.bin/tsc -p tsconfig.client.json
|
|
122
|
-
|
|
123
|
-
- name: Observe
|
|
124
|
-
id: observe
|
|
125
|
-
shell: bash
|
|
126
|
-
env:
|
|
127
|
-
DIFFCI_REPO: ${{ inputs.repository-path }}
|
|
128
|
-
DIFFCI_BASE: ${{ inputs.base-sha }}
|
|
129
|
-
DIFFCI_HEAD: ${{ inputs.head-sha }}
|
|
130
|
-
DIFFCI_OUT: ${{ inputs.report-path }}
|
|
131
|
-
DIFFCI_REDACT: ${{ inputs.redact-paths }}
|
|
132
|
-
DIFFCI_FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
|
|
133
|
-
# Passed through the environment, never on the command line: an argv is visible to every other
|
|
134
|
-
# process on the runner and shows up in traces. The observer reads these directly and never
|
|
135
|
-
# prints them.
|
|
136
|
-
DIFFCI_API_URL: ${{ inputs.api-url }}
|
|
137
|
-
DIFFCI_TOKEN: ${{ inputs.api-token }}
|
|
138
|
-
run: |
|
|
139
|
-
set -euo pipefail
|
|
140
|
-
args=(observe --repo "$DIFFCI_REPO")
|
|
141
|
-
if [ -n "$DIFFCI_BASE" ]; then args+=(--base "$DIFFCI_BASE"); fi
|
|
142
|
-
if [ -n "$DIFFCI_HEAD" ]; then args+=(--head "$DIFFCI_HEAD"); fi
|
|
143
|
-
if [ -n "$DIFFCI_OUT" ]; then args+=(--out "$DIFFCI_OUT"); fi
|
|
144
|
-
if [ "$DIFFCI_REDACT" = "true" ]; then args+=(--redact-paths); fi
|
|
145
|
-
if [ "$DIFFCI_FAIL_ON_ERROR" = "true" ]; then args+=(--fail-on-error); fi
|
|
146
|
-
node "$GITHUB_ACTION_PATH/dist-client/src/client/cli.js" "${args[@]}"
|
|
147
|
-
|
|
148
|
-
- name: Upload observation report
|
|
149
|
-
if: ${{ inputs.upload-artifact == 'true' && steps.observe.outputs.report-path != '' }}
|
|
150
|
-
uses: actions/upload-artifact@v4
|
|
151
|
-
with:
|
|
152
|
-
name: ${{ inputs.artifact-name }}
|
|
153
|
-
path: ${{ steps.observe.outputs.report-path }}
|
|
154
|
-
retention-days: ${{ inputs.artifact-retention-days }}
|
|
155
|
-
if-no-files-found: warn
|
|
26
|
+
#
|
|
27
|
+
# `diffci verify-workflow` checks those properties against your own workflow files and exits non-zero
|
|
28
|
+
# if any of them does not hold. Run it before the observation window starts.
|
|
29
|
+
name: DiffCI observer
|
|
30
|
+
description: Observation-only change-aware CI analysis. Runs nothing, changes nothing, skips nothing.
|
|
31
|
+
branding:
|
|
32
|
+
icon: eye
|
|
33
|
+
color: gray-dark
|
|
34
|
+
|
|
35
|
+
inputs:
|
|
36
|
+
repository-path:
|
|
37
|
+
description: The checkout to observe. Defaults to the workspace.
|
|
38
|
+
required: false
|
|
39
|
+
default: ${{ github.workspace }}
|
|
40
|
+
base-sha:
|
|
41
|
+
description: Base commit. Leave empty to derive it from the event (pull request base, push before).
|
|
42
|
+
required: false
|
|
43
|
+
default: ""
|
|
44
|
+
head-sha:
|
|
45
|
+
description: Head commit. Must be given together with base-sha.
|
|
46
|
+
required: false
|
|
47
|
+
default: ""
|
|
48
|
+
node-version:
|
|
49
|
+
description: Node version used to run the observer. Only affects this job.
|
|
50
|
+
required: false
|
|
51
|
+
default: "22"
|
|
52
|
+
report-path:
|
|
53
|
+
description: Where to write the report. Must be outside the checkout. Defaults to RUNNER_TEMP.
|
|
54
|
+
required: false
|
|
55
|
+
default: ""
|
|
56
|
+
redact-paths:
|
|
57
|
+
description: Replace every file path in the report with a stable 12-character digest.
|
|
58
|
+
required: false
|
|
59
|
+
default: "false"
|
|
60
|
+
upload-artifact:
|
|
61
|
+
description: Upload the report as a workflow artifact.
|
|
62
|
+
required: false
|
|
63
|
+
default: "true"
|
|
64
|
+
artifact-name:
|
|
65
|
+
description: Name of the uploaded artifact.
|
|
66
|
+
required: false
|
|
67
|
+
default: diffci-observation
|
|
68
|
+
artifact-retention-days:
|
|
69
|
+
description: Retention for the uploaded artifact.
|
|
70
|
+
required: false
|
|
71
|
+
default: "7"
|
|
72
|
+
api-url:
|
|
73
|
+
description: >-
|
|
74
|
+
DiffCI ingest endpoint. Leave empty and nothing is sent anywhere - the report stays on the runner
|
|
75
|
+
as an artifact. Must be https.
|
|
76
|
+
required: false
|
|
77
|
+
default: ""
|
|
78
|
+
api-token:
|
|
79
|
+
description: >-
|
|
80
|
+
Ingest token for THIS repository, from a repository secret. Pass it as the workflow expression
|
|
81
|
+
for secrets.DIFFCI_TOKEN, never as a literal. Nothing is sent without it. (This text deliberately
|
|
82
|
+
does not spell out the expression: GitHub evaluates expressions inside action metadata, and
|
|
83
|
+
"secrets" is not a context an action file may use - a literal expression here made the whole
|
|
84
|
+
action fail to load on every run until 2026-09-06.)
|
|
85
|
+
required: false
|
|
86
|
+
default: ""
|
|
87
|
+
fail-on-error:
|
|
88
|
+
description: >-
|
|
89
|
+
Fail this step when the observation refuses or errors. Default false, so a DiffCI problem never
|
|
90
|
+
shows up as a red step in your CI. Turn it on only while debugging an installation.
|
|
91
|
+
required: false
|
|
92
|
+
default: "false"
|
|
93
|
+
|
|
94
|
+
outputs:
|
|
95
|
+
report-path:
|
|
96
|
+
description: Absolute path of the written report.
|
|
97
|
+
value: ${{ steps.observe.outputs.report-path }}
|
|
98
|
+
status:
|
|
99
|
+
description: OBSERVED, REFUSED, or ERROR.
|
|
100
|
+
value: ${{ steps.observe.outputs.status }}
|
|
101
|
+
|
|
102
|
+
runs:
|
|
103
|
+
using: composite
|
|
104
|
+
steps:
|
|
105
|
+
- name: Set up Node for the observer
|
|
106
|
+
uses: actions/setup-node@v4
|
|
107
|
+
with:
|
|
108
|
+
node-version: ${{ inputs.node-version }}
|
|
109
|
+
|
|
110
|
+
# Installed into the action's own directory, never into the observed repository: nothing here
|
|
111
|
+
# touches the workspace, its node_modules, or its lockfile. --omit=dev keeps this to TypeScript and
|
|
112
|
+
# a YAML parser; --ignore-scripts means no dependency of DiffCI's runs code on your runner.
|
|
113
|
+
- name: Install observer dependencies
|
|
114
|
+
shell: bash
|
|
115
|
+
working-directory: ${{ github.action_path }}
|
|
116
|
+
run: npm ci --omit=dev --no-audit --fund=false --ignore-scripts
|
|
117
|
+
|
|
118
|
+
- name: Build observer
|
|
119
|
+
shell: bash
|
|
120
|
+
working-directory: ${{ github.action_path }}
|
|
121
|
+
run: node_modules/.bin/tsc -p tsconfig.client.json
|
|
122
|
+
|
|
123
|
+
- name: Observe
|
|
124
|
+
id: observe
|
|
125
|
+
shell: bash
|
|
126
|
+
env:
|
|
127
|
+
DIFFCI_REPO: ${{ inputs.repository-path }}
|
|
128
|
+
DIFFCI_BASE: ${{ inputs.base-sha }}
|
|
129
|
+
DIFFCI_HEAD: ${{ inputs.head-sha }}
|
|
130
|
+
DIFFCI_OUT: ${{ inputs.report-path }}
|
|
131
|
+
DIFFCI_REDACT: ${{ inputs.redact-paths }}
|
|
132
|
+
DIFFCI_FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
|
|
133
|
+
# Passed through the environment, never on the command line: an argv is visible to every other
|
|
134
|
+
# process on the runner and shows up in traces. The observer reads these directly and never
|
|
135
|
+
# prints them.
|
|
136
|
+
DIFFCI_API_URL: ${{ inputs.api-url }}
|
|
137
|
+
DIFFCI_TOKEN: ${{ inputs.api-token }}
|
|
138
|
+
run: |
|
|
139
|
+
set -euo pipefail
|
|
140
|
+
args=(observe --repo "$DIFFCI_REPO")
|
|
141
|
+
if [ -n "$DIFFCI_BASE" ]; then args+=(--base "$DIFFCI_BASE"); fi
|
|
142
|
+
if [ -n "$DIFFCI_HEAD" ]; then args+=(--head "$DIFFCI_HEAD"); fi
|
|
143
|
+
if [ -n "$DIFFCI_OUT" ]; then args+=(--out "$DIFFCI_OUT"); fi
|
|
144
|
+
if [ "$DIFFCI_REDACT" = "true" ]; then args+=(--redact-paths); fi
|
|
145
|
+
if [ "$DIFFCI_FAIL_ON_ERROR" = "true" ]; then args+=(--fail-on-error); fi
|
|
146
|
+
node "$GITHUB_ACTION_PATH/dist-client/src/client/cli.js" "${args[@]}"
|
|
147
|
+
|
|
148
|
+
- name: Upload observation report
|
|
149
|
+
if: ${{ inputs.upload-artifact == 'true' && steps.observe.outputs.report-path != '' }}
|
|
150
|
+
uses: actions/upload-artifact@v4
|
|
151
|
+
with:
|
|
152
|
+
name: ${{ inputs.artifact-name }}
|
|
153
|
+
path: ${{ steps.observe.outputs.report-path }}
|
|
154
|
+
retention-days: ${{ inputs.artifact-retention-days }}
|
|
155
|
+
if-no-files-found: warn
|
|
@@ -101,76 +101,79 @@ function defaultReportPath(env) {
|
|
|
101
101
|
const stamp = env.GITHUB_RUN_ID ? `${env.GITHUB_RUN_ID}-${env.GITHUB_RUN_ATTEMPT ?? "1"}` : String(Date.now());
|
|
102
102
|
return join(base, `diffci-observation-${stamp}.json`);
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
104
|
+
// Quoting the scoped package keeps the same command valid in POSIX shells, cmd.exe, and
|
|
105
|
+
// PowerShell, where an unquoted leading `@` is parsed as the splatting operator.
|
|
106
|
+
const AGENT_DEFAULT_COMMAND = 'npx "@diffci.com/diffci@latest" check';
|
|
107
|
+
const AGENT_INSTRUCTIONS = `# DiffCI Agent Instructions
|
|
108
|
+
|
|
109
|
+
Use DiffCI as the default CI/CD validation lens before proposing, committing, or opening pull requests.
|
|
110
|
+
|
|
111
|
+
Default command:
|
|
112
|
+
|
|
113
|
+
\`\`\`bash
|
|
114
|
+
${AGENT_DEFAULT_COMMAND}
|
|
115
|
+
\`\`\`
|
|
116
|
+
|
|
117
|
+
What this does:
|
|
118
|
+
|
|
119
|
+
- analyzes the current checkout and commit range;
|
|
120
|
+
- runs the repository's inferred full test command and DiffCI's selected command when safe to compare;
|
|
121
|
+
- prints measured paired runtime when both commands pass;
|
|
122
|
+
- writes reports outside the repository and sends nothing;
|
|
123
|
+
- does not skip, cancel, or reorder required CI tests.
|
|
124
|
+
|
|
125
|
+
Test commands may write generated files to the checkout. Use \`observe --no-send\` when analysis
|
|
126
|
+
without test execution is needed.
|
|
127
|
+
|
|
128
|
+
If DiffCI reports \`REFUSED\` or \`ERROR\`, treat that as an installation or analysis issue and continue with the repository's normal test commands. If DiffCI reports a selected command, prefer using it as evidence for what changed, not as permission to skip required CI.
|
|
126
129
|
`;
|
|
127
|
-
const CURSOR_RULE = `---
|
|
128
|
-
description: Use DiffCI as the default CI/CD validation lens
|
|
129
|
-
alwaysApply: true
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
Before proposing, committing, or opening pull requests, run:
|
|
133
|
-
|
|
134
|
-
\`\`\`bash
|
|
135
|
-
|
|
136
|
-
\`\`\`
|
|
137
|
-
|
|
138
|
-
DiffCI check analyzes the change and runs full and selected test commands when it can infer them. It sends nothing. Test commands may write generated files. Use observe --no-send for analysis without execution. Required project CI remains authoritative.
|
|
130
|
+
const CURSOR_RULE = `---
|
|
131
|
+
description: Use DiffCI as the default CI/CD validation lens
|
|
132
|
+
alwaysApply: true
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
Before proposing, committing, or opening pull requests, run:
|
|
136
|
+
|
|
137
|
+
\`\`\`bash
|
|
138
|
+
${AGENT_DEFAULT_COMMAND}
|
|
139
|
+
\`\`\`
|
|
140
|
+
|
|
141
|
+
DiffCI check analyzes the change and runs full and selected test commands when it can infer them. It sends nothing. Test commands may write generated files. Use observe --no-send for analysis without execution. Required project CI remains authoritative.
|
|
139
142
|
`;
|
|
140
|
-
const GITHUB_COPILOT_INSTRUCTIONS = `# Repository CI/CD Validation
|
|
141
|
-
|
|
142
|
-
Use DiffCI as the default change-aware CI/CD validation lens:
|
|
143
|
-
|
|
144
|
-
\`\`\`bash
|
|
145
|
-
|
|
146
|
-
\`\`\`
|
|
147
|
-
|
|
148
|
-
DiffCI check analyzes the change and runs inferred full and selected test commands to measure a paired runtime. It sends nothing; required repository checks remain authoritative.
|
|
143
|
+
const GITHUB_COPILOT_INSTRUCTIONS = `# Repository CI/CD Validation
|
|
144
|
+
|
|
145
|
+
Use DiffCI as the default change-aware CI/CD validation lens:
|
|
146
|
+
|
|
147
|
+
\`\`\`bash
|
|
148
|
+
${AGENT_DEFAULT_COMMAND}
|
|
149
|
+
\`\`\`
|
|
150
|
+
|
|
151
|
+
DiffCI check analyzes the change and runs inferred full and selected test commands to measure a paired runtime. It sends nothing; required repository checks remain authoritative.
|
|
149
152
|
`;
|
|
150
153
|
const DIFFCI_CONFIG = `{
|
|
151
154
|
"$schema": "https://diffci.com/schemas/diffci.config.schema.json",
|
|
152
|
-
"agentDefaultCommand":
|
|
153
|
-
"mode": "check",
|
|
154
|
-
"sendReports": false
|
|
155
|
-
}
|
|
155
|
+
"agentDefaultCommand": ${JSON.stringify(AGENT_DEFAULT_COMMAND)},
|
|
156
|
+
"mode": "check",
|
|
157
|
+
"sendReports": false
|
|
158
|
+
}
|
|
156
159
|
`;
|
|
157
160
|
function diffciWorkflow(version) {
|
|
158
|
-
return `name: DiffCI observation
|
|
159
|
-
on: [push, pull_request]
|
|
160
|
-
permissions:
|
|
161
|
-
contents: read
|
|
162
|
-
jobs:
|
|
163
|
-
diffci:
|
|
164
|
-
runs-on: ubuntu-latest
|
|
165
|
-
continue-on-error: true
|
|
166
|
-
steps:
|
|
167
|
-
- uses: actions/checkout@v4
|
|
168
|
-
with:
|
|
169
|
-
fetch-depth: 0
|
|
170
|
-
- uses: actions/setup-node@v4
|
|
171
|
-
with:
|
|
172
|
-
node-version: 22
|
|
173
|
-
- run: npx @diffci.com/diffci@${version} observe --no-send
|
|
161
|
+
return `name: DiffCI observation
|
|
162
|
+
on: [push, pull_request]
|
|
163
|
+
permissions:
|
|
164
|
+
contents: read
|
|
165
|
+
jobs:
|
|
166
|
+
diffci:
|
|
167
|
+
runs-on: ubuntu-latest
|
|
168
|
+
continue-on-error: true
|
|
169
|
+
steps:
|
|
170
|
+
- uses: actions/checkout@v4
|
|
171
|
+
with:
|
|
172
|
+
fetch-depth: 0
|
|
173
|
+
- uses: actions/setup-node@v4
|
|
174
|
+
with:
|
|
175
|
+
node-version: 22
|
|
176
|
+
- run: npx "@diffci.com/diffci@${version}" observe --no-send
|
|
174
177
|
`;
|
|
175
178
|
}
|
|
176
179
|
function writeInitFile(repoPath, relativePath, content, force) {
|
|
@@ -221,7 +224,7 @@ function runInit(flags, env) {
|
|
|
221
224
|
console.log(" skipped package installation (pass --install to add an exact dev dependency)");
|
|
222
225
|
if (!includeWorkflow)
|
|
223
226
|
console.log(" skipped .github/workflows/diffci.yml (pass --workflow to add it)");
|
|
224
|
-
console.log(
|
|
227
|
+
console.log(`\nDefault agent command: ${AGENT_DEFAULT_COMMAND}`);
|
|
225
228
|
return 0;
|
|
226
229
|
}
|
|
227
230
|
function runMcp() {
|
|
@@ -613,39 +616,39 @@ async function runPilot(flags, env) {
|
|
|
613
616
|
console.log(` markdown: ${markdownPath}`);
|
|
614
617
|
return savings.comparison.evidenceValid ? 0 : 1;
|
|
615
618
|
}
|
|
616
|
-
const USAGE = `diffci - change-aware CI analysis and paired timing
|
|
617
|
-
|
|
618
|
-
Usage:
|
|
619
|
-
diffci init [--repo <path>] [--workflow] [--install] [--force]
|
|
620
|
-
diffci mcp
|
|
621
|
-
diffci check [--repo <path>] [--out <file>] [--base <sha> --head <sha>]
|
|
622
|
-
[--redact-paths] [--json] [--quiet] [--fail-on-error] [--timeout-ms <ms>] [--share-usage]
|
|
623
|
-
diffci pilot --full <command> [--repo <path>] [--out-dir <dir>] [--label <name>]
|
|
624
|
-
diffci observe [--repo <path>] [--out <file>] [--base <sha> --head <sha>]
|
|
625
|
-
[--redact-paths] [--json] [--quiet] [--fail-on-error]
|
|
626
|
-
[--api-url <url> --api-token <token>] [--no-send] [--share-usage]
|
|
627
|
-
diffci verify-savings --repo <path> --full <command>
|
|
628
|
-
(--selected <command> | --selected-from-report <file>)
|
|
629
|
-
--out <file> [--markdown <file>] [--label <name>]
|
|
630
|
-
diffci verify-workflow [--repo <path>]
|
|
631
|
-
diffci version
|
|
632
|
-
|
|
633
|
-
init writes AGENTS.md, CLAUDE.md, Cursor rules, Copilot instructions, and diffci.config.json.
|
|
634
|
-
--workflow adds a separate non-blocking observation workflow. --install detects npm, pnpm, Yarn,
|
|
635
|
-
or Bun, installs this DiffCI version as an exact dev dependency, updates the manager's lockfile,
|
|
636
|
-
and adds diffci:check and diffci:observe package scripts without replacing existing scripts.
|
|
637
|
-
mcp runs the stdio MCP server for native agent integrations.
|
|
638
|
-
check analyzes the change, runs inferred full and selected commands, and shows measured savings.
|
|
639
|
-
pilot runs observe and verify-savings together, writing reports to ../diffci-output by default.
|
|
640
|
-
observe analyses the checkout and writes one JSON report. It runs nothing and changes nothing.
|
|
641
|
-
verify-savings runs both commands and reports measured paired runtime; it is an opt-in pilot command.
|
|
642
|
-
verify-workflow checks that the job running DiffCI cannot affect any other job, and exits 1 if it can.
|
|
643
|
-
|
|
644
|
-
The report is sent only when both --api-url and --api-token are given (or DIFFCI_API_URL and
|
|
645
|
-
DIFFCI_TOKEN are set). A failed send is reported and never fails the step - the report is on disk
|
|
646
|
-
either way. Plain http is refused; the token is never printed.
|
|
647
|
-
--share-usage (or DIFFCI_SHARE_USAGE=1) sends only command, outcome, and version to DiffCI.
|
|
648
|
-
No repository, commit, test, report, or persistent identifier is sent. --no-send disables it.
|
|
619
|
+
const USAGE = `diffci - change-aware CI analysis and paired timing
|
|
620
|
+
|
|
621
|
+
Usage:
|
|
622
|
+
diffci init [--repo <path>] [--workflow] [--install] [--force]
|
|
623
|
+
diffci mcp
|
|
624
|
+
diffci check [--repo <path>] [--out <file>] [--base <sha> --head <sha>]
|
|
625
|
+
[--redact-paths] [--json] [--quiet] [--fail-on-error] [--timeout-ms <ms>] [--share-usage]
|
|
626
|
+
diffci pilot --full <command> [--repo <path>] [--out-dir <dir>] [--label <name>]
|
|
627
|
+
diffci observe [--repo <path>] [--out <file>] [--base <sha> --head <sha>]
|
|
628
|
+
[--redact-paths] [--json] [--quiet] [--fail-on-error]
|
|
629
|
+
[--api-url <url> --api-token <token>] [--no-send] [--share-usage]
|
|
630
|
+
diffci verify-savings --repo <path> --full <command>
|
|
631
|
+
(--selected <command> | --selected-from-report <file>)
|
|
632
|
+
--out <file> [--markdown <file>] [--label <name>]
|
|
633
|
+
diffci verify-workflow [--repo <path>]
|
|
634
|
+
diffci version
|
|
635
|
+
|
|
636
|
+
init writes AGENTS.md, CLAUDE.md, Cursor rules, Copilot instructions, and diffci.config.json.
|
|
637
|
+
--workflow adds a separate non-blocking observation workflow. --install detects npm, pnpm, Yarn,
|
|
638
|
+
or Bun, installs this DiffCI version as an exact dev dependency, updates the manager's lockfile,
|
|
639
|
+
and adds diffci:check and diffci:observe package scripts without replacing existing scripts.
|
|
640
|
+
mcp runs the stdio MCP server for native agent integrations.
|
|
641
|
+
check analyzes the change, runs inferred full and selected commands, and shows measured savings.
|
|
642
|
+
pilot runs observe and verify-savings together, writing reports to ../diffci-output by default.
|
|
643
|
+
observe analyses the checkout and writes one JSON report. It runs nothing and changes nothing.
|
|
644
|
+
verify-savings runs both commands and reports measured paired runtime; it is an opt-in pilot command.
|
|
645
|
+
verify-workflow checks that the job running DiffCI cannot affect any other job, and exits 1 if it can.
|
|
646
|
+
|
|
647
|
+
The report is sent only when both --api-url and --api-token are given (or DIFFCI_API_URL and
|
|
648
|
+
DIFFCI_TOKEN are set). A failed send is reported and never fails the step - the report is on disk
|
|
649
|
+
either way. Plain http is refused; the token is never printed.
|
|
650
|
+
--share-usage (or DIFFCI_SHARE_USAGE=1) sends only command, outcome, and version to DiffCI.
|
|
651
|
+
No repository, commit, test, report, or persistent identifier is sent. --no-send disables it.
|
|
649
652
|
`;
|
|
650
653
|
async function main() {
|
|
651
654
|
const { command, flags } = parseArgs(process.argv);
|
|
@@ -188,6 +188,14 @@ export function renderVerifySavingsMarkdown(report) {
|
|
|
188
188
|
const selectionCounts = report.selectedTestCount !== undefined && report.totalTestCount !== undefined
|
|
189
189
|
? `\nSelected tests: ${report.selectedTestCount} of ${report.totalTestCount}\n`
|
|
190
190
|
: "";
|
|
191
|
+
const commandCoverage = report.selectionSource === "diffci-observation"
|
|
192
|
+
? "Selected command came from the observation report. If the repository needs a runner-specific command, rerun with an explicit selected command that covers the complete DiffCI selection."
|
|
193
|
+
: "Selected command was supplied manually. Confirm it covers the complete DiffCI selection before sharing this as maintainer evidence.";
|
|
194
|
+
const nextStep = !report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandSucceeded
|
|
195
|
+
? "Inspect the failed command output and rerun before treating this as savings evidence."
|
|
196
|
+
: !report.comparison.evidenceValid
|
|
197
|
+
? "Fix the checkout/provenance issue and rerun before treating this as savings evidence."
|
|
198
|
+
: "Repeat on the intended runner with controlled cache state before making a production-savings claim.";
|
|
191
199
|
return `${title}
|
|
192
200
|
|
|
193
201
|
Produced at: ${report.producedAt}
|
|
@@ -227,6 +235,15 @@ ${!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandS
|
|
|
227
235
|
| Full | ${report.full.exitCode ?? "signal"} | ${report.full.timedOut ? "yes" : "no"} | \`${report.full.command.replaceAll("|", "\\|")}\` |
|
|
228
236
|
| Selected | ${report.selected.exitCode ?? "signal"} | ${report.selected.timedOut ? "yes" : "no"} | \`${report.selected.command.replaceAll("|", "\\|")}\` |
|
|
229
237
|
|
|
238
|
+
## Maintainer Review
|
|
239
|
+
|
|
240
|
+
| Question | Answer |
|
|
241
|
+
| --- | --- |
|
|
242
|
+
| Command coverage | ${commandCoverage} |
|
|
243
|
+
| Cache state | Not controlled by this one report; repeat with documented warm/cold cache conditions before claiming savings. |
|
|
244
|
+
| Invalid evidence handling | Failed commands or unstable checkout provenance are labelled diagnostic only above. |
|
|
245
|
+
| Next step | ${nextStep} |
|
|
246
|
+
|
|
230
247
|
## Interpretation Notes
|
|
231
248
|
|
|
232
249
|
${report.notes.map((note) => `- ${note}`).join("\n")}
|