@morehao/trendradar-contract 0.4.0 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ This project adheres to a `contract/vX.Y.Z` tag per release (npm + Go submodule)
7
7
 
8
8
  _Nothing yet._
9
9
 
10
+ ## 0.5.0
11
+
12
+ Single-repo release analysis. Wire integers unchanged (`ipcSchema = 2` /
13
+ `digestSchema = 2`); additive at the envelope level, so a plugin/core built
14
+ against 0.4.0 keeps working.
15
+
16
+ ### Added
17
+ - `RunRequest.command=run` may now carry `repo`: with `stages` including
18
+ `releases`, the run analyzes only that one subscribed repository's releases.
19
+ `repo` requires `stages` to contain `releases`; `run` still must not carry
20
+ `action`/`volume`. `serve`/`config`/`version` still must not carry `repo`.
21
+
10
22
  ## 0.4.0
11
23
 
12
24
  Weekly release records. The wire integers stay at `ipcSchema = 2` /
package/gen/ts/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import Ajv from 'ajv/dist/2020.js'
3
3
  import addFormats from 'ajv-formats'
4
4
 
5
- export const contractVersion = "0.4.0"
5
+ export const contractVersion = "0.5.0"
6
6
 
7
7
  export const errorCatalog = {
8
8
  "INTERNAL": {
@@ -1103,7 +1103,8 @@ const ipc = {
1103
1103
  },
1104
1104
  "repo": {
1105
1105
  "type": "string",
1106
- "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
1106
+ "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
1107
+ "description": "command=subscribe: the target repo for action=add/remove/releases. command=run: with stages including 'releases', analyze only this repository's releases (absent = every subscribed repo)."
1107
1108
  },
1108
1109
  "volume": {
1109
1110
  "type": "integer",
@@ -1123,7 +1124,7 @@ const ipc = {
1123
1124
  }
1124
1125
  }
1125
1126
  },
1126
- "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages.",
1127
+ "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages; when stages includes 'releases', repo optionally restricts the release analysis to a single repository.",
1127
1128
  "allOf": [
1128
1129
  {
1129
1130
  "if": {
@@ -1229,7 +1230,57 @@ const ipc = {
1229
1230
  "properties": {
1230
1231
  "command": {
1231
1232
  "enum": [
1232
- "run",
1233
+ "run"
1234
+ ]
1235
+ }
1236
+ },
1237
+ "required": [
1238
+ "command"
1239
+ ]
1240
+ },
1241
+ "then": {
1242
+ "not": {
1243
+ "anyOf": [
1244
+ {
1245
+ "required": [
1246
+ "action"
1247
+ ]
1248
+ },
1249
+ {
1250
+ "required": [
1251
+ "volume"
1252
+ ]
1253
+ }
1254
+ ]
1255
+ },
1256
+ "allOf": [
1257
+ {
1258
+ "if": {
1259
+ "required": [
1260
+ "repo"
1261
+ ]
1262
+ },
1263
+ "then": {
1264
+ "required": [
1265
+ "stages"
1266
+ ],
1267
+ "properties": {
1268
+ "stages": {
1269
+ "contains": {
1270
+ "const": "releases"
1271
+ }
1272
+ }
1273
+ }
1274
+ }
1275
+ }
1276
+ ]
1277
+ }
1278
+ },
1279
+ {
1280
+ "if": {
1281
+ "properties": {
1282
+ "command": {
1283
+ "enum": [
1233
1284
  "serve",
1234
1285
  "config",
1235
1286
  "version"
@@ -2339,7 +2390,7 @@ const errors = {
2339
2390
  }
2340
2391
  }
2341
2392
  }
2342
- const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.4.0\n description: |\n Read-only HTTP surface exposed by `trendradar serve`. All payloads reuse the\n contract schemas, so the plugin and any web UI consume the same shapes\n whether data comes from the filesystem or over HTTP. Historical v1 digests\n read from disk are normalized to the v2 shape with\n contentHashAlgo=legacy-struct-marshal-v1.\n\n Release endpoints are read-only. Token cost for a releases run is NOT part of\n a stored document (it describes one run and cannot be reproduced); it is\n reported in `releases.usage` of `trendradar run --json` and appended to\n `<repo>/.git/trendradar-usage.jsonl` with stage=\"releases\".\nservers:\n - url: http://127.0.0.1:8787\npaths:\n /api/v2/digests/{date}:\n get:\n operationId: getDigest\n summary: Fetch one day's digest\n parameters:\n - name: date\n in: path\n required: true\n schema:\n type: string\n format: date\n responses:\n \"200\":\n description: The digest document\n content:\n application/json:\n schema:\n $ref: \"./digest.v2.json\"\n \"404\":\n description: No digest for that date\n /api/v2/manifest:\n get:\n operationId: getManifest\n summary: List available dates and their content identity\n responses:\n \"200\":\n description: Manifest of available digests\n content:\n application/json:\n schema:\n type: object\n required: [entries]\n properties:\n coreVersion:\n type: string\n entries:\n type: array\n items:\n type: object\n required: [date, contentHash, schema, contentHashAlgo]\n properties:\n date:\n type: string\n format: date\n contentHash:\n type: string\n schema:\n type: integer\n contentHashAlgo:\n type: string\n enum: [jcs-sha256-v1, legacy-struct-marshal-v1]\n degraded:\n type: boolean\n /api/v2/releases:\n get:\n operationId: listReleases\n summary: List available release digests (newest first)\n description: |\n Returns an empty array (not 404) when no release digest exists yet.\n Entries carry no token cost because stored documents do not record it.\n parameters:\n - name: period\n in: query\n required: false\n schema:\n type: string\n enum: [daily, weekly, monthly]\n responses:\n \"200\":\n description: Manifest of release digests\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: \"./releases.v2.json#/$defs/ReleaseManifestEntry\"\n /api/v2/releases/{date}:\n get:\n operationId: getReleases\n summary: Fetch one period's release digest\n parameters:\n - name: date\n in: path\n required: true\n schema:\n type: string\n format: date\n - name: period\n in: query\n required: false\n schema:\n type: string\n enum: [daily, weekly, monthly]\n responses:\n \"200\":\n description: The release digest document\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json\"\n \"404\":\n description: No release digest for that date\n /api/v2/subscriptions:\n get:\n operationId: listSubscriptions\n summary: List the repo subscriptions the core will poll\n description: |\n Read-only mirror of the IPC `subscribe list` command: both return the\n same SubscriptionList. `repos` is the legacy field; `items` adds the\n per-repo row detail (latest tag, last summary date, check status) and is\n optional, so an older core still satisfies this schema. Writing\n subscriptions stays on the CLI / IPC subscribe command and is never\n exposed over HTTP.\n responses:\n \"200\":\n description: Current subscription list\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json#/$defs/SubscriptionList\"\n /api/v2/repos/{owner}/{repo}/releases:\n get:\n operationId: getSubscriptionDoc\n summary: Read one repo's release document\n description: |\n Read-only mirror of the IPC `subscribe releases` command. Returns the\n exact markdown file content (plus the volume index) so a client renders\n what the data repo stores instead of re-summarizing it. `volume`\n defaults to the newest volume. Only repos matching\n ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ are served: the path is resolved\n inside the releases document root and never escapes it.\n parameters:\n - name: owner\n in: path\n required: true\n schema:\n type: string\n pattern: \"^[A-Za-z0-9_.-]+$\"\n - name: repo\n in: path\n required: true\n schema:\n type: string\n pattern: \"^[A-Za-z0-9_.-]+$\"\n - name: volume\n in: query\n required: false\n schema:\n type: integer\n minimum: 1\n responses:\n \"200\":\n description: The repo's release document\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json#/$defs/SubscriptionDoc\"\n \"400\":\n description: Malformed owner/repo or non-positive volume\n \"404\":\n description: The repo has no release document, or that volume is absent\n /feed.xml:\n get:\n operationId: getFeed\n summary: RSS feed of the most recent digests\n responses:\n \"200\":\n description: RSS 2.0 feed\n content:\n application/rss+xml:\n schema:\n type: string\n"
2393
+ const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.5.0\n description: |\n Read-only HTTP surface exposed by `trendradar serve`. All payloads reuse the\n contract schemas, so the plugin and any web UI consume the same shapes\n whether data comes from the filesystem or over HTTP. Historical v1 digests\n read from disk are normalized to the v2 shape with\n contentHashAlgo=legacy-struct-marshal-v1.\n\n Release endpoints are read-only. Token cost for a releases run is NOT part of\n a stored document (it describes one run and cannot be reproduced); it is\n reported in `releases.usage` of `trendradar run --json` and appended to\n `<repo>/.git/trendradar-usage.jsonl` with stage=\"releases\".\nservers:\n - url: http://127.0.0.1:8787\npaths:\n /api/v2/digests/{date}:\n get:\n operationId: getDigest\n summary: Fetch one day's digest\n parameters:\n - name: date\n in: path\n required: true\n schema:\n type: string\n format: date\n responses:\n \"200\":\n description: The digest document\n content:\n application/json:\n schema:\n $ref: \"./digest.v2.json\"\n \"404\":\n description: No digest for that date\n /api/v2/manifest:\n get:\n operationId: getManifest\n summary: List available dates and their content identity\n responses:\n \"200\":\n description: Manifest of available digests\n content:\n application/json:\n schema:\n type: object\n required: [entries]\n properties:\n coreVersion:\n type: string\n entries:\n type: array\n items:\n type: object\n required: [date, contentHash, schema, contentHashAlgo]\n properties:\n date:\n type: string\n format: date\n contentHash:\n type: string\n schema:\n type: integer\n contentHashAlgo:\n type: string\n enum: [jcs-sha256-v1, legacy-struct-marshal-v1]\n degraded:\n type: boolean\n /api/v2/releases:\n get:\n operationId: listReleases\n summary: List available release digests (newest first)\n description: |\n Returns an empty array (not 404) when no release digest exists yet.\n Entries carry no token cost because stored documents do not record it.\n parameters:\n - name: period\n in: query\n required: false\n schema:\n type: string\n enum: [daily, weekly, monthly]\n responses:\n \"200\":\n description: Manifest of release digests\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: \"./releases.v2.json#/$defs/ReleaseManifestEntry\"\n /api/v2/releases/{date}:\n get:\n operationId: getReleases\n summary: Fetch one period's release digest\n parameters:\n - name: date\n in: path\n required: true\n schema:\n type: string\n format: date\n - name: period\n in: query\n required: false\n schema:\n type: string\n enum: [daily, weekly, monthly]\n responses:\n \"200\":\n description: The release digest document\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json\"\n \"404\":\n description: No release digest for that date\n /api/v2/subscriptions:\n get:\n operationId: listSubscriptions\n summary: List the repo subscriptions the core will poll\n description: |\n Read-only mirror of the IPC `subscribe list` command: both return the\n same SubscriptionList. `repos` is the legacy field; `items` adds the\n per-repo row detail (latest tag, last summary date, check status) and is\n optional, so an older core still satisfies this schema. Writing\n subscriptions stays on the CLI / IPC subscribe command and is never\n exposed over HTTP.\n responses:\n \"200\":\n description: Current subscription list\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json#/$defs/SubscriptionList\"\n /api/v2/repos/{owner}/{repo}/releases:\n get:\n operationId: getSubscriptionDoc\n summary: Read one repo's release document\n description: |\n Read-only mirror of the IPC `subscribe releases` command. Returns the\n exact markdown file content (plus the volume index) so a client renders\n what the data repo stores instead of re-summarizing it. `volume`\n defaults to the newest volume. Only repos matching\n ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ are served: the path is resolved\n inside the releases document root and never escapes it.\n parameters:\n - name: owner\n in: path\n required: true\n schema:\n type: string\n pattern: \"^[A-Za-z0-9_.-]+$\"\n - name: repo\n in: path\n required: true\n schema:\n type: string\n pattern: \"^[A-Za-z0-9_.-]+$\"\n - name: volume\n in: query\n required: false\n schema:\n type: integer\n minimum: 1\n responses:\n \"200\":\n description: The repo's release document\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json#/$defs/SubscriptionDoc\"\n \"400\":\n description: Malformed owner/repo or non-positive volume\n \"404\":\n description: The repo has no release document, or that volume is absent\n /feed.xml:\n get:\n operationId: getFeed\n summary: RSS feed of the most recent digests\n responses:\n \"200\":\n description: RSS 2.0 feed\n content:\n application/rss+xml:\n schema:\n type: string\n"
2343
2394
 
2344
2395
  export const rawSchema = { model, ipc, digest, releases, errors, versionInfo, api }
2345
2396
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morehao/trendradar-contract",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Language-neutral contract (JSON Schema, fixtures, generated Go & TypeScript types) shared by the trendradar Go core and its DSH plugin.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: trendradar serve API
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  description: |
6
6
  Read-only HTTP surface exposed by `trendradar serve`. All payloads reuse the
7
7
  contract schemas, so the plugin and any web UI consume the same shapes
@@ -124,7 +124,8 @@
124
124
  },
125
125
  "repo": {
126
126
  "type": "string",
127
- "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
127
+ "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
128
+ "description": "command=subscribe: the target repo for action=add/remove/releases. command=run: with stages including 'releases', analyze only this repository's releases (absent = every subscribed repo)."
128
129
  },
129
130
  "volume": {
130
131
  "type": "integer",
@@ -144,7 +145,7 @@
144
145
  }
145
146
  }
146
147
  },
147
- "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages.",
148
+ "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages; when stages includes 'releases', repo optionally restricts the release analysis to a single repository.",
148
149
  "allOf": [
149
150
  {
150
151
  "if": {
@@ -250,7 +251,57 @@
250
251
  "properties": {
251
252
  "command": {
252
253
  "enum": [
253
- "run",
254
+ "run"
255
+ ]
256
+ }
257
+ },
258
+ "required": [
259
+ "command"
260
+ ]
261
+ },
262
+ "then": {
263
+ "not": {
264
+ "anyOf": [
265
+ {
266
+ "required": [
267
+ "action"
268
+ ]
269
+ },
270
+ {
271
+ "required": [
272
+ "volume"
273
+ ]
274
+ }
275
+ ]
276
+ },
277
+ "allOf": [
278
+ {
279
+ "if": {
280
+ "required": [
281
+ "repo"
282
+ ]
283
+ },
284
+ "then": {
285
+ "required": [
286
+ "stages"
287
+ ],
288
+ "properties": {
289
+ "stages": {
290
+ "contains": {
291
+ "const": "releases"
292
+ }
293
+ }
294
+ }
295
+ }
296
+ }
297
+ ]
298
+ }
299
+ },
300
+ {
301
+ "if": {
302
+ "properties": {
303
+ "command": {
304
+ "enum": [
254
305
  "serve",
255
306
  "config",
256
307
  "version"
package/version-map.json CHANGED
@@ -34,14 +34,14 @@
34
34
  },
35
35
  "version-info.v2.json": {
36
36
  "wireKey": "contractVersion",
37
- "current": "0.4.0",
37
+ "current": "0.5.0",
38
38
  "breakingBump": [
39
39
  "packageMajor"
40
40
  ]
41
41
  },
42
42
  "api.v2.yaml": {
43
43
  "wireKey": "info.version",
44
- "current": "0.4.0",
44
+ "current": "0.5.0",
45
45
  "breakingBump": [
46
46
  "packageMajor"
47
47
  ]