@diffci.com/diffci 0.2.6 → 0.2.7

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/README.md CHANGED
@@ -104,13 +104,13 @@ jobs:
104
104
  - uses: actions/checkout@v4
105
105
  with:
106
106
  fetch-depth: 0
107
- - uses: DiffCI/DiffCI.com@0c4178e86cc462a7a6afaf906ca5076a47f69fee
107
+ - uses: DiffCI/DiffCI.com@e852523fade14bf5e0457a6331e97c8a76eedc2b
108
108
  ```
109
109
 
110
110
  Then check the workflow locally with `npx @diffci.com/diffci@latest verify-workflow`. Keep the observer
111
111
  out of required checks and other jobs' `needs` lists. The Action adds a job summary and a
112
112
  `diffci-observation` artifact to the run; it does not alter which tests your other jobs execute.
113
- The example pins release `v0.2.6` to its qualified feature commit SHA for reproducibility.
113
+ The example pins release `v0.2.7` to its qualified feature commit SHA for reproducibility.
114
114
 
115
115
  The CLI sends no report with `--no-send`. The Action uploads a GitHub artifact by default; sending to
116
116
  DiffCI's hosted service requires an explicitly configured endpoint and token.
@@ -306,7 +306,7 @@ npm run research:sandbox:deploy
306
306
  DiffCI is intended to be installable as infrastructure, not only as a hosted shadow experiment:
307
307
 
308
308
  ```yaml
309
- - uses: DiffCI/DiffCI.com@0c4178e86cc462a7a6afaf906ca5076a47f69fee
309
+ - uses: DiffCI/DiffCI.com@e852523fade14bf5e0457a6331e97c8a76eedc2b
310
310
  ```
311
311
 
312
312
  ```bash
@@ -32,6 +32,7 @@ import { observe, isInsideRepository } from "./observe.js";
32
32
  import { inferFullCommand, inferSelectedCommand } from "./full-command.js";
33
33
  import { addDiffciPackageScripts, installDiffci } from "./install.js";
34
34
  import { submitObservation } from "./submit.js";
35
+ import { sendUsageSignal } from "./usage-signal.js";
35
36
  import { formatVerifySavingsSummary, measureCommand, runVerifySavings, writeVerifySavingsReport } from "./verify-savings.js";
36
37
  import { auditWorkflows, isNonInterfering } from "./workflow-guard.js";
37
38
  function parseArgs(argv) {
@@ -302,6 +303,9 @@ async function runCheck(flags, env) {
302
303
  if (observationCode !== 0)
303
304
  return observationCode;
304
305
  const observation = JSON.parse(readFileSync(reportPath, "utf8"));
306
+ if ((flags["share-usage"] === true || env.DIFFCI_SHARE_USAGE === "1") && flags["no-send"] !== true) {
307
+ await sendUsageSignal({ command: "check", outcome: observation.status === "OBSERVED" ? "observed" : observation.status === "REFUSED" ? "refused" : "error", version: observerIdentity().version });
308
+ }
305
309
  const print = (message) => { if (flags.quiet !== true && flags.json !== true)
306
310
  console.log(message); };
307
311
  print(summarise(observation, true));
@@ -415,6 +419,9 @@ async function runObserve(flags, env) {
415
419
  });
416
420
  mkdirSync(dirname(reportPath), { recursive: true });
417
421
  writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`, "utf8");
422
+ if ((flags["share-usage"] === true || env.DIFFCI_SHARE_USAGE === "1") && flags["no-send"] !== true) {
423
+ await sendUsageSignal({ command: "observe", outcome: report.status === "OBSERVED" ? "observed" : report.status === "REFUSED" ? "refused" : "error", version: identity.version });
424
+ }
418
425
  const summary = summarise(report);
419
426
  if (flags.json === true) {
420
427
  console.log(JSON.stringify(report, null, 2));
@@ -612,11 +619,11 @@ Usage:
612
619
  diffci init [--repo <path>] [--workflow] [--install] [--force]
613
620
  diffci mcp
614
621
  diffci check [--repo <path>] [--out <file>] [--base <sha> --head <sha>]
615
- [--redact-paths] [--json] [--quiet] [--fail-on-error] [--timeout-ms <ms>]
622
+ [--redact-paths] [--json] [--quiet] [--fail-on-error] [--timeout-ms <ms>] [--share-usage]
616
623
  diffci pilot --full <command> [--repo <path>] [--out-dir <dir>] [--label <name>]
617
624
  diffci observe [--repo <path>] [--out <file>] [--base <sha> --head <sha>]
618
625
  [--redact-paths] [--json] [--quiet] [--fail-on-error]
619
- [--api-url <url> --api-token <token>] [--no-send]
626
+ [--api-url <url> --api-token <token>] [--no-send] [--share-usage]
620
627
  diffci verify-savings --repo <path> --full <command>
621
628
  (--selected <command> | --selected-from-report <file>)
622
629
  --out <file> [--markdown <file>] [--label <name>]
@@ -637,6 +644,8 @@ verify-workflow checks that the job running DiffCI cannot affect any other job,
637
644
  The report is sent only when both --api-url and --api-token are given (or DIFFCI_API_URL and
638
645
  DIFFCI_TOKEN are set). A failed send is reported and never fails the step - the report is on disk
639
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.
640
649
  `;
641
650
  async function main() {
642
651
  const { command, flags } = parseArgs(process.argv);
@@ -0,0 +1,18 @@
1
+ /** Explicit, best-effort aggregate usage signal. No repository or machine identifier is sent. */
2
+ export async function sendUsageSignal(input) {
3
+ const url = new URL(input.endpoint ?? "https://app.diffci.com/v1/usage-events");
4
+ if (url.protocol !== "https:")
5
+ return false;
6
+ try {
7
+ const response = await (input.fetchImpl ?? fetch)(url, {
8
+ method: "POST",
9
+ headers: { "Content-Type": "application/json" },
10
+ body: JSON.stringify({ schema: "diffci.usage.v1", command: input.command, outcome: input.outcome, version: input.version }),
11
+ signal: AbortSignal.timeout(2500),
12
+ });
13
+ return response.ok;
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ }
@@ -2,6 +2,21 @@
2
2
 
3
3
  Track adoption weekly after each outreach batch.
4
4
 
5
+ ## Opt-in CLI usage
6
+
7
+ Users can run `diffci check --share-usage` or set `DIFFCI_SHARE_USAGE=1` for `check` and
8
+ `observe`. `--no-send` overrides the opt-in. The CLI sends one HTTPS event after analysis to
9
+ `https://app.diffci.com/v1/usage-events` with only the command (`check` or `observe`), analysis
10
+ outcome (`observed`, `refused`, or `error`), and package version. It sends no repository identity,
11
+ paths, commits, test names, report, token, or stable installation identifier. Delivery failure is
12
+ best effort and cannot fail validation. The product Worker records `cli_usage_opt_in` in PostHog
13
+ when its existing `POSTHOG_API_KEY` is configured.
14
+
15
+ Count these events as **opted-in executions**, not unique users or repositories. Report the opt-in
16
+ count separately from npm downloads and external merged integrations. Because there is no stable
17
+ identifier, repeated runs by one user cannot be deduplicated. Network providers may still observe
18
+ connection metadata such as IP address.
19
+
5
20
  ## Package
6
21
 
7
22
  - npm latest version: `npm view "@diffci.com/diffci" version`
@@ -30,7 +30,7 @@ jobs:
30
30
  - uses: actions/checkout@v4
31
31
  with:
32
32
  fetch-depth: 0
33
- - uses: DiffCI/DiffCI.com@3aa76a84919691cf7e8f9d1f1f6a80399325d1ae # v0.2.2
33
+ - uses: DiffCI/DiffCI.com@e852523fade14bf5e0457a6331e97c8a76eedc2b # v0.2.7
34
34
  ```
35
35
 
36
36
  Run `npx @diffci.com/diffci@latest verify-workflow` before starting a pilot. The Action uploads a
@@ -48,7 +48,7 @@ and the [DiffCI submission packet](tidelift-submission.md).
48
48
 
49
49
  ## GitHub App
50
50
 
51
- The DiffCI Shadow GitHub App is the lowest-friction research and design-partner path. It receives
51
+ The unified read-only DiffCI GitHub App is the lowest-friction research and design-partner path. It receives
52
52
  repository events, runs shadow analysis outside the repository's CI jobs, and reconciles predictions
53
53
  against real CI outcomes. Use it when a maintainer wants observation without adding a workflow step.
54
54
 
@@ -68,10 +68,10 @@ jobs:
68
68
  - uses: actions/checkout@v4
69
69
  with:
70
70
  fetch-depth: 0
71
- - uses: DiffCI/DiffCI.com@3aa76a84919691cf7e8f9d1f1f6a80399325d1ae
71
+ - uses: DiffCI/DiffCI.com@e852523fade14bf5e0457a6331e97c8a76eedc2b
72
72
  ```
73
73
 
74
- The example pins release `v0.2.2` to its full commit SHA. `npx @diffci.com/diffci@latest verify-workflow`
74
+ The example pins release `v0.2.7` to its qualified feature commit SHA. `npx @diffci.com/diffci@latest verify-workflow`
75
75
  checks that the job is dedicated, read-only, not required by other jobs, and unable to alter the rest
76
76
  of CI.
77
77
 
@@ -106,7 +106,7 @@ Estimated CO2 xxx kg
106
106
  Estimated water xxx L
107
107
  ```
108
108
 
109
- That makes the open-source proposition explicit: install DiffCI Shadow, change nothing in CI, and learn
109
+ That makes the open-source proposition explicit: install DiffCI, change nothing in CI, and learn
110
110
  how much compute may be wasted.
111
111
 
112
112
  ## Future Package Managers
@@ -7,6 +7,17 @@ DiffCI's npm package should be promoted as a low-risk CI observer:
7
7
 
8
8
  ## Install
9
9
 
10
+ For a pinned project dependency, run the initializer from the repository root. It detects npm, pnpm,
11
+ Yarn, or Bun, adds the current DiffCI version as an exact development dependency, and updates the
12
+ corresponding lockfile:
13
+
14
+ ```bash
15
+ npx @diffci.com/diffci@latest init --install
16
+ ```
17
+
18
+ Add `--workflow` to also create the separate, non-blocking GitHub Actions observation job. Installation
19
+ is explicit: plain `init` never changes `package.json` or a lockfile.
20
+
10
21
  Use the npm CLI when someone wants to try DiffCI locally or inside an existing CI step:
11
22
 
12
23
  ```bash
@@ -27,7 +38,7 @@ jobs:
27
38
  - uses: actions/checkout@v4
28
39
  with:
29
40
  fetch-depth: 0
30
- - uses: DiffCI/DiffCI.com@dee4f7b938a7720d077c1124ef2ea050aa2625d6
41
+ - uses: DiffCI/DiffCI.com@e852523fade14bf5e0457a6331e97c8a76eedc2b
31
42
  ```
32
43
 
33
44
  ## Outreach Copy
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffci.com/diffci",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "DiffCI - deterministic change-aware CI planning",
5
5
  "keywords": [
6
6
  "ci",
@@ -65,7 +65,7 @@
65
65
  "typecheck": "tsc --noEmit",
66
66
  "build": "tsc",
67
67
  "test": "tsx --test \"tests/**/*.test.ts\"",
68
- "check": "npm run typecheck && npm run test",
68
+ "check": "npm run check:public-metadata && npm run typecheck && npm run test",
69
69
  "prepack": "npm run build:client",
70
70
  "package:smoke": "node scripts/package-smoke.mjs",
71
71
  "diffci": "tsx scripts/diffci.ts",
@@ -127,7 +127,8 @@
127
127
  "corpus:register": "tsx scripts/register-corpus-entry.ts",
128
128
  "ci:benchmark": "tsx scripts/ci-inference-benchmark.ts",
129
129
  "ci:reproduce": "tsx scripts/ci-reproduction.ts",
130
- "check:oss-boundary": "node scripts/check-oss-boundary.mjs"
130
+ "check:oss-boundary": "node scripts/check-oss-boundary.mjs",
131
+ "check:public-metadata": "node scripts/check-public-metadata.mjs"
131
132
  },
132
133
  "dependencies": {
133
134
  "@diffci.com/core": "git+https://github.com/DiffCI/core.git#db1d637dfcca8d8f7fa047500dfe0027d0d018a7",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.adityankale190895/diffci",
4
4
  "title": "DiffCI",
5
5
  "description": "Observation-only CI/CD validation for AI coding agents.",
6
- "version": "0.2.6",
6
+ "version": "0.2.7",
7
7
  "websiteUrl": "https://diffci.com/docs/ai-agents.html",
8
8
  "repository": {
9
9
  "url": "https://github.com/DiffCI/DiffCI.com",
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "@diffci.com/diffci",
16
- "version": "0.2.6",
16
+ "version": "0.2.7",
17
17
  "transport": {
18
18
  "type": "stdio"
19
19
  },