tracksiy 0.7.0 → 0.8.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 +48 -8
  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.7.0" : "0.0.0-dev";
7
+ var VERSION = true ? "0.8.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
@@ -822,7 +822,7 @@ var monitorsList = {
822
822
  status: { type: "string", enum: ["all", "up", "down", "never"], description: "Filter by state. Default all." },
823
823
  type: { type: "string", enum: ["heartbeat", "get", "ping", "ssl", "ingest"], description: "Only this monitor type." }
824
824
  },
825
- output: "{summary{total, up, down, never, unalertable}, monitors:[{id, name, project, monitorType, url, upNow, lastCheck, overdue, alertable, checkInUrl}], notes[]}",
825
+ output: "{summary{total, up, down, never, unalertable}, monitors:[{id, name, project, monitorType, url, upNow, lastCheck, overdue, alertable, checkInUrl, downReason, lastCheckDetail{status, expectedStatus, bytes, truncated, expectedTextFound, forbiddenTextFound, error, ms}}], notes[]}",
826
826
  text: (d) => `${kv(d.summary ?? {})}
827
827
 
828
828
  ${table(d.monitors ?? [], [
@@ -830,6 +830,7 @@ ${table(d.monitors ?? [], [
830
830
  "project",
831
831
  "monitorType",
832
832
  ["up", (r) => r.upNow == null ? "never" : r.upNow],
833
+ ["why down", (r) => r.downReason ?? ""],
833
834
  ["last check", (r) => ago(r.lastCheck)],
834
835
  ["alertable", (r) => r.alertable]
835
836
  ])}`,
@@ -1073,7 +1074,7 @@ var settingsSet = {
1073
1074
  flags: {
1074
1075
  environments: { type: "list", value: "<env,...>", description: "The environments this project reports from (empty string: any)." },
1075
1076
  "environment-policy": { type: "string", enum: ["flag", "drop"], description: "What happens to an event from another environment." },
1076
- "source-root": { type: "list", split: false, value: "<path> | strip=<path>,prepend=<dir/>[,surface=<surface>]", description: "How frame paths become repo paths: a prefix to strip, or strip + prepend (for an SDK that already sends /app/... of a repo's backend/), optionally for one surface. Repeatable; replaces the list." },
1077
+ "source-root": { type: "list", split: false, value: "<path> | strip=<path>,prepend=<dir/>[,surface=<surface>]", description: "How frame paths become repo paths: a prefix to strip, or strip + prepend, optionally for one surface. Each rule is tried on the frame's abs_path first (sentry-laravel: the full server path, /home/admin/web/shop/backend/app/...), then on filename (/app/...). Repeatable; replaces the list." },
1077
1078
  "fingerprint-rule": { type: "list", split: false, value: "type=<glob>,message=<glob>,fingerprint=<name>", description: "Group matching events into one issue. Repeatable; replaces the list." },
1078
1079
  "privacy-rule": { type: "list", split: false, value: "dropHeader=<name> | mask=<email|iban|card_number|tckn|jwt>,field=<path|*>", description: "Scrub before storage. Repeatable; replaces the list." },
1079
1080
  body: { type: "json", value: "<json|@file|->", description: "The whole declaration; overrides the flags." }
@@ -1082,7 +1083,7 @@ var settingsSet = {
1082
1083
  { command: "tracksiy settings set --environments production,staging --environment-policy drop", description: "local and local1 stop reaching Tracksiy." },
1083
1084
  { command: "tracksiy settings set --fingerprint-rule 'type=ViewException,message=syntax error*,fingerprint=blade-syntax'", description: "Every half-written template is one issue." },
1084
1085
  { command: "tracksiy settings set --source-root /home/admin/web/shop/", description: "Frames carry repoPath." },
1085
- { command: "tracksiy settings set --source-root 'strip=/,prepend=backend/,surface=backend'", description: "Laravel sends /app/Http/...; the repo has it under backend/." }
1086
+ { command: "tracksiy settings set --source-root 'strip=/var/www/shop/,prepend=backend/,surface=backend'", description: "The server checkout is only the repo's backend/ directory." }
1086
1087
  ],
1087
1088
  output: "{sourceRoots[], environments[], environmentPolicy, fingerprintRules[], privacyRules[]}",
1088
1089
  async run(ctx) {
@@ -1826,6 +1827,7 @@ var rotate = {
1826
1827
  var keys_default = [list2, set2, rotate];
1827
1828
 
1828
1829
  // src/commands/releases.ts
1830
+ import { execFileSync } from "node:child_process";
1829
1831
  var list3 = {
1830
1832
  path: ["releases", "list"],
1831
1833
  aliases: [["releases"]],
@@ -1879,19 +1881,57 @@ var declare = {
1879
1881
  ref: { type: "string", value: "<commit>", description: "Commit or tag it was built from." },
1880
1882
  url: { type: "string", value: "<url>", description: "Link to the release (changelog, CI run)." },
1881
1883
  released: { type: "boolean", description: "Mark it released now (if not already). --no-released clears it." },
1882
- "released-at": { type: "string", value: "<iso>", description: "Mark it released at this time." }
1884
+ "released-at": { type: "string", value: "<iso>", description: "Mark it released at this time." },
1885
+ commits: {
1886
+ type: "list",
1887
+ value: "<prev>..<head> | <sha,...>",
1888
+ description: "The commits this release ships, so `issues resolve --in-commit` with any of them binds here (a push is more than its HEAD). A git range is expanded with `git rev-list` in the current directory (at most 1000). Replaces the list."
1889
+ }
1883
1890
  },
1884
1891
  examples: [
1885
- { command: "tracksiy releases declare shop@$(git rev-parse --short HEAD) --ref $(git rev-parse HEAD) --released", description: "From a deploy script." }
1892
+ { command: "tracksiy releases declare shop@$(git rev-parse --short HEAD) --ref $(git rev-parse HEAD) --released", description: "From a deploy script." },
1893
+ { command: "tracksiy releases declare shop@$(git rev-parse HEAD) --ref $(git rev-parse HEAD) --commits $LAST_DEPLOYED..HEAD --released", description: "Every commit of the push: a fix resolved --in-commit with any of them binds to this release." }
1886
1894
  ],
1887
- output: "{version, ref, url, released, created, projects[], artifacts}",
1895
+ output: "{version, ref, url, released, commitCount, boundResolutions, created, projects[], artifacts}",
1888
1896
  async run(ctx) {
1889
1897
  const i = ctx.input;
1890
1898
  if (i.released !== void 0 && i.releasedAt) throw usageError("conflict", "Pass --released or --released-at, not both.");
1891
1899
  if (i.releasedAt && !Number.isFinite(Date.parse(i.releasedAt))) throw usageError("bad_value", `--released-at is not a time: ${i.releasedAt}`);
1892
- return ctx.api.send("PUT", await projectPath(ctx, `releases/${seg(i.version)}`), compact({ ref: i.ref, url: i.url, released: i.releasedAt ?? i.released }));
1900
+ return ctx.api.send(
1901
+ "PUT",
1902
+ await projectPath(ctx, `releases/${seg(i.version)}`),
1903
+ compact({ ref: i.ref, url: i.url, released: i.releasedAt ?? i.released, commits: i.commits ? commitList(i.commits) : void 0 })
1904
+ );
1893
1905
  }
1894
1906
  };
1907
+ var MAX_COMMITS = 1e3;
1908
+ var SHA = /^[0-9a-f]{7,40}$/i;
1909
+ function commitList(values, git = runGit) {
1910
+ const out = [];
1911
+ for (const raw of values) {
1912
+ const value = raw.trim();
1913
+ if (!value) continue;
1914
+ if (value.includes("..")) {
1915
+ let listed;
1916
+ try {
1917
+ listed = git(["rev-list", `--max-count=${MAX_COMMITS + 1}`, value]);
1918
+ } catch (err) {
1919
+ throw usageError("bad_value", `--commits ${value}: git rev-list failed: ${String(err?.stderr || err?.message || err).trim().split("\n")[0]}`, "Run it inside the repository, with both ends fetched (e.g. git fetch --unshallow in CI).");
1920
+ }
1921
+ out.push(...listed.split(/\s+/).filter(Boolean));
1922
+ } else if (SHA.test(value)) {
1923
+ out.push(value.toLowerCase());
1924
+ } else {
1925
+ throw usageError("bad_value", `--commits: ${JSON.stringify(value)} is neither a sha nor a <prev>..<head> range.`);
1926
+ }
1927
+ }
1928
+ const unique = [...new Set(out.map((c) => c.toLowerCase()))];
1929
+ if (unique.length > MAX_COMMITS) throw usageError("bad_value", `--commits names more than ${MAX_COMMITS} commits.`, "Is the range's base the last deployed commit?");
1930
+ return unique;
1931
+ }
1932
+ function runGit(args) {
1933
+ return execFileSync("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
1934
+ }
1895
1935
  var releases_default = [list3, health2, declare];
1896
1936
 
1897
1937
  // src/commands/artifacts.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tracksiy",
3
- "version": "0.7.0",
3
+ "version": "0.8.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": {