tracksiy 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.
Files changed (2) hide show
  1. package/dist/tracksiy.mjs +28 -5
  2. package/package.json +1 -1
package/dist/tracksiy.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
  import { readFileSync as readFileSync2 } from "node:fs";
5
5
 
6
6
  // src/version.ts
7
- var VERSION = true ? "0.4.0" : "0.0.0-dev";
7
+ var VERSION = true ? "0.5.0" : "0.0.0-dev";
8
8
  var USER_AGENT = `tracksiy-cli/${VERSION} (node ${process.versions.node}; ${process.platform})`;
9
9
 
10
10
  // src/core/errors.ts
@@ -1001,6 +1001,7 @@ var queries = {
1001
1001
  var fleet_default = [orgs, projects, overview, changes, health, monitorsList, monitorsDeclare, monitorsDelete, performance, queries];
1002
1002
 
1003
1003
  // src/commands/issues.ts
1004
+ import { writeFileSync } from "node:fs";
1004
1005
  var FILTERS = {
1005
1006
  status: { type: "string", enum: ["unresolved", "resolved", "ignored", "regressed", "all"], description: "Issue status. Server default: unresolved." },
1006
1007
  level: { type: "string", enum: ["sample", "debug", "info", "warning", "error", "fatal"], description: "Only this level." },
@@ -1010,7 +1011,9 @@ var FILTERS = {
1010
1011
  since: { type: "string", value: TIME, description: "Last seen at or after this (lastSeenSince)." },
1011
1012
  until: { type: "string", value: TIME, description: "Last seen before this (lastSeenBefore)." },
1012
1013
  "first-seen-since": { type: "string", value: TIME, description: "First seen at or after this: new issues only." },
1013
- "first-seen-until": { type: "string", value: TIME, description: "First seen before this." }
1014
+ "first-seen-until": { type: "string", value: TIME, description: "First seen before this." },
1015
+ "exclude-bots": { type: "boolean", description: "Leave out issues every event of which came from a crawler (ClaudeBot, Googlebot, ...)." },
1016
+ "only-bots": { type: "boolean", description: "Only issues that came entirely from crawlers." }
1014
1017
  };
1015
1018
  var WHY = {
1016
1019
  reason: { type: "string", enum: ["fixed", "duplicate", "third_party", "expected", "wont_fix"], description: "Why, recorded on the issue's activity log." },
@@ -1042,7 +1045,8 @@ function filterQuery(input) {
1042
1045
  lastSeenSince: since(input.since),
1043
1046
  lastSeenBefore: since(input.until, "until"),
1044
1047
  firstSeenSince: since(input.firstSeenSince, "first-seen-since"),
1045
- firstSeenBefore: since(input.firstSeenUntil, "first-seen-until")
1048
+ firstSeenBefore: since(input.firstSeenUntil, "first-seen-until"),
1049
+ bots: input.excludeBots ? "exclude" : input.onlyBots ? "only" : void 0
1046
1050
  });
1047
1051
  }
1048
1052
  var issueRows = (issues) => table(issues ?? [], [
@@ -1270,11 +1274,13 @@ var bulk = {
1270
1274
  effect: "write",
1271
1275
  endpoint: { method: "POST", path: "/api/agent/v1/projects/{org}/{project}/issues/status" },
1272
1276
  flags: {
1273
- to: { type: "string", required: true, enum: ["resolved", "ignored", "unresolved"], description: "New status." },
1277
+ to: { type: "string", enum: ["resolved", "ignored", "unresolved"], description: "New status (required unless --revert)." },
1274
1278
  ids: { type: "list", value: "<id,...>", description: "Exactly these issues." },
1275
1279
  ...FILTERS,
1276
1280
  all: { type: "boolean", description: "Every issue of the project (required when no other selector is given)." },
1277
1281
  apply: { type: "boolean", description: "Actually change them. Default is a dry run." },
1282
+ out: { type: "string", value: "<file.json>", description: "With --apply: write every changed issue and its previous status here, for --revert." },
1283
+ revert: { type: "string", value: "<file.json>", description: "Undo a saved --out: put each issue back to the status it had." },
1278
1284
  ...FIXED_IN,
1279
1285
  ...WHY
1280
1286
  },
@@ -1284,6 +1290,18 @@ var bulk = {
1284
1290
  ],
1285
1291
  output: "{dryRun, matched, changed, ids, ...} as reported by the server.",
1286
1292
  async run(ctx) {
1293
+ if (ctx.input.revert) {
1294
+ const saved = JSON.parse(textArg(`@${ctx.input.revert}`, "revert") ?? "{}");
1295
+ const changes2 = saved.changed ?? saved;
1296
+ const byStatus = /* @__PURE__ */ new Map();
1297
+ for (const c of changes2) if (c?.id && c.previousStatus) byStatus.set(c.previousStatus, [...byStatus.get(c.previousStatus) ?? [], String(c.id)]);
1298
+ const results = {};
1299
+ for (const [status2, ids] of byStatus) {
1300
+ results[status2] = await ctx.api.send("POST", await projectPath(ctx, "issues/status"), { status: status2, ids, dryRun: !ctx.input.apply, note: textArg(ctx.input.note, "note") ?? `revert of ${ctx.input.revert}` });
1301
+ }
1302
+ return { reverted: changes2.length, dryRun: !ctx.input.apply, results };
1303
+ }
1304
+ if (!ctx.input.to) throw usageError("missing_flag", "--to is required.", "Pass --to resolved|ignored|unresolved, or --revert <file>.");
1287
1305
  const filter = filterQuery(ctx.input);
1288
1306
  const hasFilter = Object.keys(filter).length > 0;
1289
1307
  const body = compact({
@@ -1294,7 +1312,12 @@ var bulk = {
1294
1312
  dryRun: !ctx.input.apply,
1295
1313
  ...whyBody(ctx.input)
1296
1314
  });
1297
- return ctx.api.send("POST", await projectPath(ctx, "issues/status"), body);
1315
+ const result = await ctx.api.send("POST", await projectPath(ctx, "issues/status"), body);
1316
+ if (ctx.input.out && ctx.input.apply) {
1317
+ writeFileSync(ctx.input.out, JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), status: ctx.input.to, changed: result?.changed ?? [] }, null, 2));
1318
+ ctx.log(`wrote ${result?.changed?.length ?? 0} change(s) to ${ctx.input.out}; undo with --revert ${ctx.input.out} --apply`);
1319
+ }
1320
+ return result;
1298
1321
  }
1299
1322
  };
1300
1323
  var issues_default = [list, view, resolve2, ignore, unresolve, bulk, comment, activity, verifyFixed, claim, unclaim];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tracksiy",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Agent-first CLI and MCP server for Tracksiy: errors, uptime, alerts, releases and source maps, from one token.",
5
5
  "type": "module",
6
6
  "bin": {