@devpad/cli 2.1.8 → 2.1.10

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/index.js +185 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -10488,6 +10488,95 @@ var ApiClient2 = class {
10488
10488
  history: () => wrap(() => this.clients.auth.get("/user/history")),
10489
10489
  preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", { body: data }))
10490
10490
  };
10491
+ this.pulse = {
10492
+ summary: (input) => wrap(() => this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
10493
+ query: typeof input.range === "string" ? { range: input.range } : { from: String(input.range.from), to: String(input.range.to) }
10494
+ })),
10495
+ events: (input) => wrap(() => {
10496
+ const query = {};
10497
+ if (input.name)
10498
+ query.name = input.name;
10499
+ if (input.level)
10500
+ query.level = input.level;
10501
+ if (typeof input.ts_from === "number")
10502
+ query.ts_from = String(input.ts_from);
10503
+ if (typeof input.ts_to === "number")
10504
+ query.ts_to = String(input.ts_to);
10505
+ if (input.search)
10506
+ query.search = input.search;
10507
+ if (input.limit)
10508
+ query.limit = String(input.limit);
10509
+ if (input.cursor)
10510
+ query.cursor = input.cursor;
10511
+ return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
10512
+ }),
10513
+ errors: (input) => wrap(() => {
10514
+ const query = {};
10515
+ if (typeof input.range === "string") {
10516
+ query.range = input.range;
10517
+ } else {
10518
+ query.from = String(input.range.from);
10519
+ query.to = String(input.range.to);
10520
+ }
10521
+ if (input.group_by_fingerprint)
10522
+ query.group_by_fingerprint = "true";
10523
+ return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
10524
+ }),
10525
+ logs: (input) => wrap(() => {
10526
+ const query = {};
10527
+ if (typeof input.range === "string") {
10528
+ query.range = input.range;
10529
+ } else {
10530
+ query.from = String(input.range.from);
10531
+ query.to = String(input.range.to);
10532
+ }
10533
+ if (input.level)
10534
+ query.level = input.level;
10535
+ if (input.search)
10536
+ query.search = input.search;
10537
+ return this.clients.pulse.get("/logs/:project_id".replace(":project_id", input.project_id), { query });
10538
+ }),
10539
+ latency: (input) => wrap(() => {
10540
+ const query = {};
10541
+ if (typeof input.range === "string") {
10542
+ query.range = input.range;
10543
+ } else {
10544
+ query.from = String(input.range.from);
10545
+ query.to = String(input.range.to);
10546
+ }
10547
+ if (input.route)
10548
+ query.route = input.route;
10549
+ if (input.percentiles && input.percentiles.length > 0)
10550
+ query.percentiles = input.percentiles.join(",");
10551
+ return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
10552
+ }),
10553
+ subs: {
10554
+ list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
10555
+ create: (input) => wrap(() => this.clients.pulse.post("/admin/subs", {
10556
+ body: {
10557
+ project_id: input.project_id,
10558
+ name: input.name,
10559
+ filter: input.filter,
10560
+ channel: input.channel,
10561
+ cooldown_seconds: input.cooldown_seconds
10562
+ }
10563
+ })),
10564
+ get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
10565
+ update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
10566
+ delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
10567
+ },
10568
+ keys: {
10569
+ list: (input) => wrap(() => this.clients.pulse.get("/admin/keys", { query: { project_id: input.project_id } })),
10570
+ create: (input) => wrap(() => this.clients.pulse.post("/admin/keys", {
10571
+ body: {
10572
+ project_id: input.project_id,
10573
+ name: input.name,
10574
+ rate_limit_per_min: input.rate_limit_per_min
10575
+ }
10576
+ })),
10577
+ delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, { query: { project_id: input.project_id } }))
10578
+ }
10579
+ };
10491
10580
  const base_url = options.base_url || "http://localhost:4321/api/v1";
10492
10581
  this._api_key = options.api_key ?? "";
10493
10582
  this._auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
@@ -10515,7 +10604,8 @@ var ApiClient2 = class {
10515
10604
  github: new ApiClient({ ...clientOptions, category: "github" }),
10516
10605
  tags: new ApiClient({ ...clientOptions, category: "tags" }),
10517
10606
  blog: new ApiClient({ ...clientOptions, category: "blog" }),
10518
- media: new ApiClient({ ...clientOptions, category: "media" })
10607
+ media: new ApiClient({ ...clientOptions, category: "media" }),
10608
+ pulse: new ApiClient({ ...clientOptions, category: "pulse" })
10519
10609
  };
10520
10610
  }
10521
10611
  history() {
@@ -10980,6 +11070,100 @@ var tools = {
10980
11070
  const { user_id, ...params } = input;
10981
11071
  return unwrap2(await client.media.timeline.get(user_id, params));
10982
11072
  }
11073
+ },
11074
+ devpad_pulse_summary: {
11075
+ name: "devpad_pulse_summary",
11076
+ description: "Get summary analytics for a project (pageviews, sessions, errors, latency)",
11077
+ inputSchema: exports_external.object({
11078
+ project_id: exports_external.string().describe("Project ID"),
11079
+ range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range")
11080
+ }),
11081
+ execute: async (client, input) => unwrap2(await client.pulse.summary({ project_id: input.project_id, range: input.range }))
11082
+ },
11083
+ devpad_pulse_events: {
11084
+ name: "devpad_pulse_events",
11085
+ description: "List events for a project with optional filtering",
11086
+ inputSchema: exports_external.object({
11087
+ project_id: exports_external.string().describe("Project ID"),
11088
+ name: exports_external.string().optional().describe("Event name filter (pageview, error, log, etc)"),
11089
+ level: exports_external.string().optional().describe("Log level filter (debug, info, warn, error, critical)"),
11090
+ ts_from: exports_external.number().optional().describe("Start timestamp (unix ms)"),
11091
+ ts_to: exports_external.number().optional().describe("End timestamp (unix ms)"),
11092
+ search: exports_external.string().optional().describe("Search substring in event properties"),
11093
+ limit: exports_external.number().optional().describe("Max events to return (max 500)"),
11094
+ cursor: exports_external.string().optional().describe("Pagination cursor")
11095
+ }),
11096
+ execute: async (client, input) => unwrap2(await client.pulse.events(input))
11097
+ },
11098
+ devpad_pulse_errors: {
11099
+ name: "devpad_pulse_errors",
11100
+ description: "List error issues for a project, optionally grouped by fingerprint",
11101
+ inputSchema: exports_external.object({
11102
+ project_id: exports_external.string().describe("Project ID"),
11103
+ range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range"),
11104
+ group_by_fingerprint: exports_external.boolean().optional().describe("Group by error fingerprint (true) or list all (false)")
11105
+ }),
11106
+ execute: async (client, input) => unwrap2(await client.pulse.errors({ project_id: input.project_id, range: input.range, group_by_fingerprint: input.group_by_fingerprint }))
11107
+ },
11108
+ devpad_pulse_logs: {
11109
+ name: "devpad_pulse_logs",
11110
+ description: "List logs for a project with optional level and message filtering",
11111
+ inputSchema: exports_external.object({
11112
+ project_id: exports_external.string().describe("Project ID"),
11113
+ range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range"),
11114
+ level: exports_external.string().optional().describe("Log level filter"),
11115
+ search: exports_external.string().optional().describe("Search in log messages")
11116
+ }),
11117
+ execute: async (client, input) => unwrap2(await client.pulse.logs(input))
11118
+ },
11119
+ devpad_pulse_latency: {
11120
+ name: "devpad_pulse_latency",
11121
+ description: "Get request latency metrics (p50, p95, p99) for a project",
11122
+ inputSchema: exports_external.object({
11123
+ project_id: exports_external.string().describe("Project ID"),
11124
+ range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range"),
11125
+ route: exports_external.string().optional().describe("Filter by HTTP route"),
11126
+ percentiles: exports_external.array(exports_external.number()).optional().describe("Percentiles to compute (default [50, 95, 99])")
11127
+ }),
11128
+ execute: async (client, input) => unwrap2(await client.pulse.latency(input))
11129
+ },
11130
+ devpad_alerts_list: {
11131
+ name: "devpad_alerts_list",
11132
+ description: "List notification subscriptions (alerts) for a project",
11133
+ inputSchema: exports_external.object({
11134
+ project_id: exports_external.string().describe("Project ID")
11135
+ }),
11136
+ execute: async (client, input) => unwrap2(await client.pulse.subs.list(input))
11137
+ },
11138
+ devpad_alerts_subscribe: {
11139
+ name: "devpad_alerts_subscribe",
11140
+ description: "Create a new notification subscription (alert) for events",
11141
+ inputSchema: exports_external.object({
11142
+ project_id: exports_external.string().describe("Project ID"),
11143
+ name: exports_external.string().describe("Subscription name"),
11144
+ filter: exports_external.record(exports_external.any()).describe("Event filter (name, level, url_pattern, properties)"),
11145
+ channel: exports_external.record(exports_external.any()).describe("Notification channel (kind + config: discord, ntfy, email)"),
11146
+ cooldown_seconds: exports_external.number().optional().describe("Cooldown between notifications (default 60)")
11147
+ }),
11148
+ execute: async (client, input) => unwrap2(await client.pulse.subs.create(input))
11149
+ },
11150
+ devpad_alerts_unsubscribe: {
11151
+ name: "devpad_alerts_unsubscribe",
11152
+ description: "Delete a notification subscription by ID",
11153
+ inputSchema: exports_external.object({
11154
+ id: exports_external.string().describe("Subscription ID")
11155
+ }),
11156
+ execute: async (client, input) => unwrap2(await client.pulse.subs.delete(input.id))
11157
+ },
11158
+ devpad_pulse_key_create: {
11159
+ name: "devpad_pulse_key_create",
11160
+ description: "Create a new ingest key for a project (returns plaintext once)",
11161
+ inputSchema: exports_external.object({
11162
+ project_id: exports_external.string().describe("Project ID"),
11163
+ name: exports_external.string().optional().describe("Key name/label"),
11164
+ rate_limit_per_min: exports_external.number().optional().describe("Rate limit in requests per minute (default 600)")
11165
+ }),
11166
+ execute: async (client, input) => unwrap2(await client.pulse.keys.create(input))
10983
11167
  }
10984
11168
  };
10985
11169
  var toolNames = Object.keys(tools);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devpad/cli",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "description": "Command line interface for devpad project management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "dependencies": {},
46
46
  "devDependencies": {
47
- "@devpad/api": "^2.1.8",
48
- "@devpad/schema": "^2.1.8",
47
+ "@devpad/api": "^2.1.10",
48
+ "@devpad/schema": "^2.1.10",
49
49
  "@types/node": "^20.11.24",
50
50
  "bun-types": "latest",
51
51
  "chalk": "^5.3.0",