@keystrokehq/cli 0.0.129 → 0.0.130

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/index.mjs CHANGED
@@ -2099,6 +2099,14 @@ const CreateOrganizationRequestSchema = object({
2099
2099
  const UpdateOrganizationRequestSchema = object({ slug: ClaimableOrganizationSlugSchema });
2100
2100
  const CreateOrganizationResponseSchema = object({ organization: UserOrganizationSchema });
2101
2101
  const ListProjectsResponseSchema = object({ projects: array(ProjectSchema) });
2102
+ const ProjectListMetricsSchema = object({
2103
+ agentCount: number$1(),
2104
+ workflowCount: number$1(),
2105
+ skillCount: number$1(),
2106
+ credentialCount: number$1(),
2107
+ lastDeploymentAt: isoDateTime$3.nullable()
2108
+ });
2109
+ const ListProjectMetricsResponseSchema = object({ metrics: record(string(), ProjectListMetricsSchema) });
2102
2110
  const CreateProjectRequestSchema = object({
2103
2111
  name: string().trim().min(1),
2104
2112
  description: string().trim().min(1).optional()
@@ -5145,6 +5153,16 @@ function createProjectsResource(http) {
5145
5153
  }
5146
5154
  };
5147
5155
  }
5156
+ function createProjectMetricsResource(http) {
5157
+ return { async list() {
5158
+ try {
5159
+ const data = await http.get("/api/projects/metrics").json();
5160
+ return ListProjectMetricsResponseSchema.parse(data).metrics;
5161
+ } catch (error) {
5162
+ throw await toPlatformError(error);
5163
+ }
5164
+ } };
5165
+ }
5148
5166
  function createAgentsResource(http) {
5149
5167
  return {
5150
5168
  async list() {
@@ -6964,13 +6982,6 @@ function createDeploymentsResource() {
6964
6982
  }));
6965
6983
  }) };
6966
6984
  }
6967
- function createProjectMetricsResource() {
6968
- return { list: mock({
6969
- domain: "projectMetrics",
6970
- method: "list",
6971
- plannedEndpoint: "GET /api/projects/metrics"
6972
- }, async () => ({})) };
6973
- }
6974
6985
  const projectMembersStore = /* @__PURE__ */ new Map();
6975
6986
  function getProjectMembers(projectId) {
6976
6987
  let members = projectMembersStore.get(projectId);
@@ -8575,7 +8586,7 @@ function createPlatformClient(options) {
8575
8586
  history: createHistoryResource(),
8576
8587
  deployments: createDeploymentsResource(),
8577
8588
  gatewayAttachments: createGatewayAttachmentsResource(http),
8578
- projectMetrics: createProjectMetricsResource(),
8589
+ projectMetrics: createProjectMetricsResource(http),
8579
8590
  projectFiles: createProjectFilesResource(http),
8580
8591
  channels: createChannelsResource(),
8581
8592
  members: createMembersResource(http),
@@ -10159,6 +10170,13 @@ async function runProjectList(config) {
10159
10170
  writeInactiveDeployHints(projects);
10160
10171
  });
10161
10172
  }
10173
+ async function runProjectMetrics(config, options) {
10174
+ await withActivePlatformClient(config, async (platform) => {
10175
+ const metrics = await platform.projectMetrics.list();
10176
+ const output = options.projectId === void 0 ? metrics : Object.fromEntries(Object.entries(metrics).filter(([projectId]) => projectId === options.projectId));
10177
+ process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
10178
+ });
10179
+ }
10162
10180
  async function runProjectCreate(config, input) {
10163
10181
  await withActivePlatformClient(config, async (platform) => {
10164
10182
  const project = await platform.projects.create(input);
@@ -10195,6 +10213,18 @@ function registerProjectCommand(program) {
10195
10213
  process.exitCode = 1;
10196
10214
  }
10197
10215
  });
10216
+ project.command("metrics").description("List rollup metrics for projects in the active organization").option("--project <id>", "Return metrics for a single project").action(async (options) => {
10217
+ const config = createCliConfig();
10218
+ try {
10219
+ await runProjectMetrics(config, { ...options.project ? { projectId: options.project } : {} });
10220
+ } catch (error) {
10221
+ process.stderr.write(`${formatCliError(error, "List project metrics failed", {
10222
+ serverUrl: getPlatformUrl(config),
10223
+ webUrl: getWebUrl(config)
10224
+ })}\n`);
10225
+ process.exitCode = 1;
10226
+ }
10227
+ });
10198
10228
  project.command("create").description("Create a platform project in the active organization").requiredOption("--name <name>", "Project name").option("--description <description>", "Project description").action(async (options) => {
10199
10229
  const config = createCliConfig();
10200
10230
  try {