@ainyc/canonry 1.20.0 → 1.20.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.
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  setGoogleAuthConfig,
21
21
  showFirstRunNotice,
22
22
  trackEvent
23
- } from "./chunk-V7JJJDPL.js";
23
+ } from "./chunk-YXYC7NGJ.js";
24
24
 
25
25
  // src/cli.ts
26
26
  import { parseArgs } from "util";
@@ -554,6 +554,9 @@ var ApiClient = class {
554
554
  async getRun(id) {
555
555
  return this.request("GET", `/runs/${encodeURIComponent(id)}`);
556
556
  }
557
+ async cancelRun(id) {
558
+ return this.request("POST", `/runs/${encodeURIComponent(id)}/cancel`);
559
+ }
557
560
  async getTimeline(project) {
558
561
  return this.request("GET", `/projects/${encodeURIComponent(project)}/timeline`);
559
562
  }
@@ -978,7 +981,7 @@ function getClient4() {
978
981
  const config = loadConfig();
979
982
  return new ApiClient(config.apiUrl, config.apiKey);
980
983
  }
981
- var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "partial", "failed"]);
984
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
982
985
  async function triggerRun(project, opts) {
983
986
  const client = getClient4();
984
987
  const body = {};
@@ -1118,6 +1121,29 @@ async function triggerRunAll(opts) {
1118
1121
  console.log(` ${proj} ${id} ${r.status}`);
1119
1122
  }
1120
1123
  }
1124
+ async function cancelRun(project, runId, format) {
1125
+ const client = getClient4();
1126
+ let targetId = runId;
1127
+ if (!targetId) {
1128
+ const runs = await client.listRuns(project);
1129
+ const active = runs.find((r) => r.status === "queued" || r.status === "running");
1130
+ if (!active) {
1131
+ console.error(
1132
+ `Error: canonry run cancel "${project}" \u2014 no active run found (status must be queued or running).
1133
+ Check run status : canonry status ${project}
1134
+ To cancel by ID : canonry run cancel ${project} <run-id>`
1135
+ );
1136
+ process.exit(1);
1137
+ }
1138
+ targetId = active.id;
1139
+ }
1140
+ const result = await client.cancelRun(targetId);
1141
+ if (format === "json") {
1142
+ console.log(JSON.stringify(result, null, 2));
1143
+ return;
1144
+ }
1145
+ console.log(`Run ${result.id} cancelled.`);
1146
+ }
1121
1147
  async function showRun(id, format) {
1122
1148
  const client = getClient4();
1123
1149
  const run = await client.getRun(id);
@@ -2952,6 +2978,16 @@ async function main() {
2952
2978
  await showRun(id, format);
2953
2979
  break;
2954
2980
  }
2981
+ if (args[1] === "cancel") {
2982
+ const project = args[2];
2983
+ if (!project) {
2984
+ console.error("Error: project name is required\nUsage: canonry run cancel <project> [run-id]");
2985
+ process.exit(1);
2986
+ }
2987
+ const runId = args[3];
2988
+ await cancelRun(project, runId, format);
2989
+ break;
2990
+ }
2955
2991
  const runParsed = parseArgs({
2956
2992
  args: args.slice(1),
2957
2993
  options: {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createServer,
3
3
  loadConfig
4
- } from "./chunk-V7JJJDPL.js";
4
+ } from "./chunk-YXYC7NGJ.js";
5
5
  export {
6
6
  createServer,
7
7
  loadConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainyc/canonry",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "type": "module",
5
5
  "description": "The ultimate open-source AEO monitoring tool - track how answer engines cite your domain",
6
6
  "license": "FSL-1.1-ALv2",
@@ -55,14 +55,14 @@
55
55
  "@ainyc/canonry-api-routes": "0.0.0",
56
56
  "@ainyc/canonry-config": "0.0.0",
57
57
  "@ainyc/canonry-provider-claude": "0.0.0",
58
- "@ainyc/canonry-contracts": "0.0.0",
59
- "@ainyc/canonry-db": "0.0.0",
60
58
  "@ainyc/canonry-provider-gemini": "0.0.0",
59
+ "@ainyc/canonry-db": "0.0.0",
61
60
  "@ainyc/canonry-provider-cdp": "0.0.0",
62
- "@ainyc/canonry-provider-local": "0.0.0",
63
- "@ainyc/canonry-integration-google": "0.0.0",
61
+ "@ainyc/canonry-integration-bing": "0.0.0",
64
62
  "@ainyc/canonry-provider-openai": "0.0.0",
65
- "@ainyc/canonry-integration-bing": "0.0.0"
63
+ "@ainyc/canonry-integration-google": "0.0.0",
64
+ "@ainyc/canonry-contracts": "0.0.0",
65
+ "@ainyc/canonry-provider-local": "0.0.0"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsup && tsx build-web.ts",