@haystackeditor/cli 0.24.1 → 0.25.1

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.
Files changed (51) hide show
  1. package/dist/assets/capture/capture.cb4204fcc997d8e8.js +2 -0
  2. package/dist/assets/capture/release.json +4 -0
  3. package/dist/assets/telemetry/runtime.cjs +829 -1254
  4. package/dist/capture/adapters/client-routes.js +383 -0
  5. package/dist/capture/adapters/django.js +134 -0
  6. package/dist/capture/adapters/files.js +77 -0
  7. package/dist/capture/adapters/index.js +74 -0
  8. package/dist/capture/adapters/jsx-edit.js +81 -0
  9. package/dist/capture/adapters/next-build.js +113 -0
  10. package/dist/capture/adapters/next.js +494 -0
  11. package/dist/capture/adapters/nuxt.js +199 -0
  12. package/dist/capture/adapters/rails.js +178 -0
  13. package/dist/capture/adapters/react-router.js +439 -0
  14. package/dist/capture/adapters/sveltekit.js +109 -0
  15. package/dist/capture/adapters/types.js +4 -0
  16. package/dist/capture/adapters/vite.js +135 -0
  17. package/dist/capture/app-config.js +107 -0
  18. package/dist/capture/consent.js +127 -0
  19. package/dist/capture/csp.js +332 -0
  20. package/dist/capture/html.js +74 -0
  21. package/dist/capture/js-ast.js +400 -0
  22. package/dist/capture/manifest.js +95 -0
  23. package/dist/capture/project.js +177 -0
  24. package/dist/capture/route-pattern.js +119 -0
  25. package/dist/capture/script-release.js +47 -0
  26. package/dist/capture/tag.js +74 -0
  27. package/dist/capture/url-rewrites.js +232 -0
  28. package/dist/capture-step.js +56 -0
  29. package/dist/commands/capture-brief.js +92 -0
  30. package/dist/commands/capture-contract.js +46 -0
  31. package/dist/commands/capture-manifest.js +86 -0
  32. package/dist/commands/init-capture.js +426 -0
  33. package/dist/commands/init-telemetry.js +1028 -0
  34. package/dist/commands/init.js +78 -5
  35. package/dist/commands/server-telemetry-contract.d.ts +66 -0
  36. package/dist/commands/server-telemetry-contract.js +127 -0
  37. package/dist/commands/telemetry-token.js +238 -0
  38. package/dist/commands/telemetry.d.ts +161 -8
  39. package/dist/commands/telemetry.js +940 -158
  40. package/dist/commands/verify-onboarding.js +21 -1
  41. package/dist/commands/verify.js +56 -9
  42. package/dist/index.js +85 -6
  43. package/dist/schema.js +2 -2
  44. package/dist/telemetry/next-loader.cjs +66 -9
  45. package/dist/telemetry/next.d.ts +11 -3
  46. package/dist/telemetry/next.js +95 -15
  47. package/dist/telemetry/typed-source.d.ts +47 -0
  48. package/dist/telemetry/typed-source.js +379 -0
  49. package/package.json +4 -2
  50. package/schemas/init.v1.json +63 -4
  51. package/schemas/pre-verify.v1.json +60 -3
@@ -2,12 +2,12 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://docs.haystackeditor.com/cli/schemas/init.v1.json",
4
4
  "title": "Haystack init: this repository's setup for `haystack verify`",
5
- "description": "Machine-readable output of `haystack init --json`. `changes` are the project-local changes init planned (made when status is done); `onboarding` is the base's OnboardingStatusV1 (onboarding_contracts.ts, APP-ONBOARDING-V1) as POST /api/agent/cloud-verifier/onboarding returns it, null unless status is done. `notes` says what became of `--notes`: \"written\" (the repository's onboarding notes are now these), \"unchanged\" (they already were), null without `--notes` or when init stopped before writing them. Exit codes: 0 done (onboarding running or ready), 1 failed (the error envelope), 2 planned (nothing written; run with --yes), 3 done but onboarding blocked, 4 login-required, 5 app-required (install the Haystack GitHub App), 6 done but onboarding stopped before finishing (run init again).",
5
+ "description": "Machine-readable output of `haystack init --json`. `changes` are the project-local changes init planned (made when status is done); `onboarding` is the base's OnboardingStatusV1 (onboarding_contracts.ts, APP-ONBOARDING-V1) as POST /api/agent/cloud-verifier/onboarding returns it, null unless status is done. `notes` says what became of `--notes`: \"written\" (the repository's onboarding notes are now these), \"unchanged\" (they already were), null without `--notes` or when init stopped before writing them. Exit codes: 0 done (onboarding running or ready), 1 failed (the error envelope), 2 planned (nothing written; run with --yes), 3 done but onboarding blocked, 4 login-required, 5 app-required (install the Haystack GitHub App), 6 done but onboarding stopped before finishing (run init again). `telemetry` (CAPTURE-V1 rule 8e, InitTelemetryReport in capture_contracts.ts) is what telemetry does (status done) or will do (planned, login-required: the same report before anything is written, every `received` null because nothing was checked): per part (`capture`, the browser tag; `server`, server telemetry) `installed`, `manual` with the exact `steps`, or `unsupported` with `why`, and `received`, the newest telemetry Haystack holds for this application (null when none; `stale` past 24 hours), plus `dbProfileCommand`, the `haystack db profile` command for the user to run with production read access (null when the app's database is not one it profiles). `telemetrySteps` is what the person does next for telemetry to arrive, in order, including the off switches; [] without telemetry.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
- "required": ["schema_version", "status", "repository", "changes", "notices", "notes", "onboarding"],
8
+ "required": ["schema_version", "status", "repository", "changes", "notices", "notes", "onboarding", "telemetry", "telemetrySteps"],
9
9
  "properties": {
10
- "schema_version": { "const": "1.0.1" },
10
+ "schema_version": { "const": "1.0.2" },
11
11
  "status": { "enum": ["done", "planned", "login-required", "app-required"] },
12
12
  "repository": { "type": "string" },
13
13
  "changes": {
@@ -18,7 +18,7 @@
18
18
  "required": ["path", "action", "reason", "diff"],
19
19
  "properties": {
20
20
  "path": { "type": "string" },
21
- "action": { "enum": ["create", "update"] },
21
+ "action": { "enum": ["create", "update", "delete"] },
22
22
  "reason": { "type": "string" },
23
23
  "diff": { "type": "array", "items": { "type": "string" } }
24
24
  }
@@ -31,6 +31,65 @@
31
31
  { "type": "null" },
32
32
  { "$ref": "verify.v1.json#/$defs/onboardingStatus" }
33
33
  ]
34
+ },
35
+ "telemetry": {
36
+ "oneOf": [
37
+ { "type": "null" },
38
+ {
39
+ "type": "object",
40
+ "additionalProperties": false,
41
+ "required": ["capture", "server", "dbProfileCommand"],
42
+ "properties": {
43
+ "capture": { "$ref": "#/$defs/telemetryPart" },
44
+ "server": { "$ref": "#/$defs/telemetryPart" },
45
+ "dbProfileCommand": { "type": ["string", "null"] }
46
+ }
47
+ }
48
+ ]
49
+ },
50
+ "telemetrySteps": { "type": "array", "items": { "type": "string" } }
51
+ },
52
+ "$defs": {
53
+ "telemetryPart": {
54
+ "oneOf": [
55
+ {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["status", "received"],
59
+ "properties": { "status": { "const": "installed" }, "received": { "$ref": "#/$defs/telemetryReceived" } }
60
+ },
61
+ {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": ["status", "steps", "received"],
65
+ "properties": {
66
+ "status": { "const": "manual" },
67
+ "steps": { "type": "array", "items": { "type": "string" } },
68
+ "received": { "$ref": "#/$defs/telemetryReceived" }
69
+ }
70
+ },
71
+ {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "required": ["status", "why"],
75
+ "properties": { "status": { "const": "unsupported" }, "why": { "type": "string" } }
76
+ }
77
+ ]
78
+ },
79
+ "telemetryReceived": {
80
+ "oneOf": [
81
+ { "type": "null" },
82
+ {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["lastSeenAt", "release", "stale"],
86
+ "properties": {
87
+ "lastSeenAt": { "type": "string" },
88
+ "release": { "type": ["string", "null"] },
89
+ "stale": { "type": "boolean" }
90
+ }
91
+ }
92
+ ]
34
93
  }
35
94
  }
36
95
  }
@@ -4,9 +4,9 @@
4
4
  "title": "haystack pre-verify --json",
5
5
  "description": "CRAWL-V1 amendment 18: the brief of the current change before any crawl: the functions it touches (the front half's blast radius, nearest first) and, when incident planning ran, Haystack's own ideas of what could break. `run` is the run of this capture that holds or will hold the brief; `brief` is null until it does (or when the run ended without one).",
6
6
  "type": "object",
7
- "required": ["schema_version", "change", "onboarding", "run", "brief"],
7
+ "required": ["schema_version", "change", "onboarding", "run", "brief", "capture"],
8
8
  "properties": {
9
- "schema_version": { "const": "1.0.1" },
9
+ "schema_version": { "const": "1.0.2" },
10
10
  "change": {
11
11
  "type": "object",
12
12
  "required": ["baseCommit", "workCommit", "files"],
@@ -30,9 +30,66 @@
30
30
  }
31
31
  ]
32
32
  },
33
- "brief": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/brief" }] }
33
+ "brief": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/brief" }] },
34
+ "capture": {
35
+ "description": "CAPTURE-V1 rule 7b (1.0.2): what consenting real users do on the routes this change touches, from Haystack's capture tag; null when the checkout has no .haystack/capture.json (capture not set up). The change's files (the brief's function files and the changed files) are joined to routes through the route manifest's source entries; shares are of distinct captured sessions over the window; sessions on pages no route names are `unmapped`, never counted as zero. A read that fails is `unavailable` and never fails the command.",
36
+ "oneOf": [
37
+ { "type": "null" },
38
+ {
39
+ "type": "object", "additionalProperties": false, "required": ["applicationId", "state", "window"],
40
+ "properties": { "applicationId": { "type": "string" }, "state": { "const": "ready" }, "window": { "$ref": "#/$defs/captureWindow" } }
41
+ },
42
+ {
43
+ "type": "object", "additionalProperties": false, "required": ["applicationId", "state"],
44
+ "properties": { "applicationId": { "type": "string" }, "state": { "const": "no-data" } }
45
+ },
46
+ {
47
+ "type": "object", "additionalProperties": false, "required": ["applicationId", "state", "reason"],
48
+ "properties": { "applicationId": { "oneOf": [{ "type": "null" }, { "type": "string" }] }, "state": { "const": "unavailable" }, "reason": { "type": "string" } }
49
+ }
50
+ ]
51
+ }
34
52
  },
35
53
  "$defs": {
54
+ "captureWindow": {
55
+ "type": "object",
56
+ "required": ["applicationId", "days", "newestHour", "ageHours", "stale", "sessions", "routes", "union", "unmapped", "releasesWithoutManifest", "dropped"],
57
+ "properties": {
58
+ "applicationId": { "type": "string" },
59
+ "days": { "description": "The UTC days the window covers, oldest first.", "type": "array", "items": { "type": "string" } },
60
+ "newestHour": { "description": "The newest receipt hour holding events, yyyy-mm-ddThh (UTC).", "oneOf": [{ "type": "null" }, { "type": "string" }] },
61
+ "ageHours": { "oneOf": [{ "type": "null" }, { "type": "number", "minimum": 0 }] },
62
+ "stale": { "description": "Older than 24 hours, or no data.", "type": "boolean" },
63
+ "sessions": { "description": "Distinct captured sessions in the window.", "type": "integer", "minimum": 0 },
64
+ "routes": {
65
+ "description": "The changed routes, most sessions first.",
66
+ "type": "array",
67
+ "items": {
68
+ "type": "object",
69
+ "required": ["route", "match", "source", "sessions", "share"],
70
+ "properties": {
71
+ "route": { "description": "The route id from the app's route manifest.", "type": "string" },
72
+ "match": { "description": "Its match rule, in the framework adapter's syntax.", "type": "string" },
73
+ "source": { "description": "The repository file that defines it.", "type": "string" },
74
+ "sessions": { "type": "integer", "minimum": 0 },
75
+ "share": { "oneOf": [{ "type": "null" }, { "type": "number", "minimum": 0, "maximum": 1 }] }
76
+ }
77
+ }
78
+ },
79
+ "union": {
80
+ "description": "Sessions that visited at least one changed route (exact, not a sum).",
81
+ "type": "object", "required": ["sessions", "share"],
82
+ "properties": { "sessions": { "type": "integer", "minimum": 0 }, "share": { "oneOf": [{ "type": "null" }, { "type": "number", "minimum": 0, "maximum": 1 }] } }
83
+ },
84
+ "unmapped": {
85
+ "description": "Sessions on pages no route names: unknown whether they reach the change.",
86
+ "oneOf": [{ "type": "null" }, { "type": "object", "required": ["sessions", "share"],
87
+ "properties": { "sessions": { "type": "integer", "minimum": 0 }, "share": { "oneOf": [{ "type": "null" }, { "type": "number", "minimum": 0, "maximum": 1 }] } } }]
88
+ },
89
+ "releasesWithoutManifest": { "description": "Releases whose route manifest Haystack does not hold; their pages are unmapped.", "type": "array", "items": { "type": "string" } },
90
+ "dropped": { "description": "Events dropped at ingest in the window, per reason.", "type": "object", "additionalProperties": { "type": "integer", "minimum": 0 } }
91
+ }
92
+ },
36
93
  "brief": {
37
94
  "type": "object",
38
95
  "required": ["functions", "leftOut", "planning"],