perstack 0.0.101 → 0.0.103

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/bin/cli.js CHANGED
@@ -21133,6 +21133,25 @@ function createStudioClient(options) {
21133
21133
  });
21134
21134
  }
21135
21135
 
21136
+ //#endregion
21137
+ //#region ../../packages/studio/src/application-handlers.ts
21138
+ async function applicationsListHandler(options) {
21139
+ const result = await createStudioClient({
21140
+ apiKey: resolveApiKey(options.apiKey),
21141
+ baseUrl: options.baseUrl
21142
+ }).applications.list();
21143
+ if (!result.ok) throw new PerstackError(`Failed to list applications: ${result.error.message}`);
21144
+ const { applications } = result.data.data;
21145
+ if (applications.length === 0) {
21146
+ console.log("No applications found.");
21147
+ return;
21148
+ }
21149
+ for (const app of applications) {
21150
+ console.log(` ${app.name}`);
21151
+ console.log(` ID: ${app.id}`);
21152
+ }
21153
+ }
21154
+
21136
21155
  //#endregion
21137
21156
  //#region ../../packages/studio/src/draft-handlers.ts
21138
21157
  async function expertListHandler(options) {
@@ -21174,15 +21193,15 @@ async function expertCreateHandler(scopeName, options) {
21174
21193
  console.log(` Name: ${draft.name}`);
21175
21194
  console.log(` ID: ${draft.id}`);
21176
21195
  }
21177
- async function expertDeleteHandler(draftId, options) {
21196
+ async function expertDeleteHandler(draftScopeId, options) {
21178
21197
  const result = await createStudioClient({
21179
21198
  apiKey: resolveApiKey(options.apiKey),
21180
21199
  baseUrl: options.baseUrl
21181
- }).expertDrafts.delete(draftId);
21200
+ }).expertDrafts.delete(draftScopeId);
21182
21201
  if (!result.ok) throw new PerstackError(`Failed to delete draft: ${result.error.message}`);
21183
- console.log(`Draft scope deleted: ${draftId}`);
21202
+ console.log(`Draft scope deleted: ${draftScopeId}`);
21184
21203
  }
21185
- async function expertPushHandler(draftId, options) {
21204
+ async function expertPushHandler(draftScopeId, options) {
21186
21205
  const client = createStudioClient({
21187
21206
  apiKey: resolveApiKey(options.apiKey),
21188
21207
  baseUrl: options.baseUrl
@@ -21190,7 +21209,7 @@ async function expertPushHandler(draftId, options) {
21190
21209
  const perstackConfig = await getPerstackConfig(options.config);
21191
21210
  if (!perstackConfig.experts || Object.keys(perstackConfig.experts).length === 0) throw new PerstackError("No experts defined in perstack.toml");
21192
21211
  const experts = Object.entries(perstackConfig.experts).map(([key, configExpert]) => configExpertToExpert(key, configExpert));
21193
- const result = await client.expertDrafts.refs.create(draftId, { experts });
21212
+ const result = await client.expertDrafts.refs.create(draftScopeId, { experts });
21194
21213
  if (!result.ok) throw new PerstackError(`Failed to push experts: ${result.error.message}`);
21195
21214
  const { draftRef, definition } = result.data.data;
21196
21215
  const expertKeys = Object.keys(definition.experts);
@@ -21198,11 +21217,11 @@ async function expertPushHandler(draftId, options) {
21198
21217
  console.log(` Ref ID: ${draftRef.id}`);
21199
21218
  console.log(` Experts: ${expertKeys.join(", ")}`);
21200
21219
  }
21201
- async function expertRefsHandler(draftId, options) {
21220
+ async function expertRefsHandler(draftScopeId, options) {
21202
21221
  const result = await createStudioClient({
21203
21222
  apiKey: resolveApiKey(options.apiKey),
21204
21223
  baseUrl: options.baseUrl
21205
- }).expertDrafts.refs.list(draftId, {
21224
+ }).expertDrafts.refs.list(draftScopeId, {
21206
21225
  take: options.take,
21207
21226
  skip: options.skip
21208
21227
  });
@@ -21249,14 +21268,14 @@ async function expertYankHandler(key, options) {
21249
21268
 
21250
21269
  //#endregion
21251
21270
  //#region ../../packages/studio/src/version-handlers.ts
21252
- async function expertVersionHandler(draftId, refId, version, options) {
21271
+ async function expertVersionHandler(draftScopeId, refId, version, options) {
21253
21272
  const client = createStudioClient({
21254
21273
  apiKey: resolveApiKey(options.apiKey),
21255
21274
  baseUrl: options.baseUrl
21256
21275
  });
21257
21276
  let readme;
21258
21277
  if (options.readme) readme = await readFile(options.readme, "utf-8");
21259
- const result = await client.expertDrafts.refs.assignVersion(draftId, refId, {
21278
+ const result = await client.expertDrafts.refs.assignVersion(draftScopeId, refId, {
21260
21279
  version,
21261
21280
  tag: options.tag,
21262
21281
  readme
@@ -119756,7 +119775,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
119756
119775
  //#endregion
119757
119776
  //#region package.json
119758
119777
  var name = "perstack";
119759
- var version = "0.0.101";
119778
+ var version = "0.0.103";
119760
119779
  var description = "PerStack CLI";
119761
119780
 
119762
119781
  //#endregion
@@ -119820,23 +119839,23 @@ expertCmd.command("create").description("Create a new draft scope").argument("<s
119820
119839
  ...options
119821
119840
  });
119822
119841
  });
119823
- expertCmd.command("delete").description("Delete a draft scope").argument("<draftId>", "Draft scope ID").action(async function(draftId) {
119824
- await expertDeleteHandler(draftId, getParentOptions(this));
119842
+ expertCmd.command("delete").description("Delete a draft scope").argument("<draftScopeId>", "Draft scope ID").action(async function(draftScopeId) {
119843
+ await expertDeleteHandler(draftScopeId, getParentOptions(this));
119825
119844
  });
119826
- expertCmd.command("push").description("Push local expert definitions to a draft ref").argument("<draftId>", "Draft scope ID").option("--config <path>", "Path to perstack.toml config file").action(async function(draftId, options) {
119827
- await expertPushHandler(draftId, {
119845
+ expertCmd.command("push").description("Push local expert definitions to a draft ref").argument("<draftScopeId>", "Draft scope ID").option("--config <path>", "Path to perstack.toml config file").action(async function(draftScopeId, options) {
119846
+ await expertPushHandler(draftScopeId, {
119828
119847
  ...getParentOptions(this),
119829
119848
  ...options
119830
119849
  });
119831
119850
  });
119832
- expertCmd.command("refs").description("List draft refs for a draft scope").argument("<draftId>", "Draft scope ID").option("--take <n>", "Limit results", Number.parseInt).option("--skip <n>", "Offset", Number.parseInt).action(async function(draftId, options) {
119833
- await expertRefsHandler(draftId, {
119851
+ expertCmd.command("refs").description("List draft refs for a draft scope").argument("<draftScopeId>", "Draft scope ID").option("--take <n>", "Limit results", Number.parseInt).option("--skip <n>", "Offset", Number.parseInt).action(async function(draftScopeId, options) {
119852
+ await expertRefsHandler(draftScopeId, {
119834
119853
  ...getParentOptions(this),
119835
119854
  ...options
119836
119855
  });
119837
119856
  });
119838
- expertCmd.command("version").description("Assign a version to a draft ref").argument("<draftId>", "Draft scope ID").argument("<refId>", "Draft ref ID").argument("<version>", "Semantic version (e.g., 1.0.0)").option("--tag <tag>", "Version tag (e.g., latest)").option("--readme <path>", "Path to README file").action(async function(draftId, refId, version, options) {
119839
- await expertVersionHandler(draftId, refId, version, {
119857
+ expertCmd.command("version").description("Assign a version to a draft ref").argument("<draftScopeId>", "Draft scope ID").argument("<refId>", "Draft ref ID").argument("<version>", "Semantic version (e.g., 1.0.0)").option("--tag <tag>", "Version tag (e.g., latest)").option("--readme <path>", "Path to README file").action(async function(draftScopeId, refId, version, options) {
119858
+ await expertVersionHandler(draftScopeId, refId, version, {
119840
119859
  ...getParentOptions(this),
119841
119860
  ...options
119842
119861
  });
@@ -119853,6 +119872,9 @@ expertCmd.command("unpublish").description("Make an expert scope private").argum
119853
119872
  expertCmd.command("yank").description("Deprecate a specific expert version").argument("<key>", "Expert key with version (e.g., my-expert@1.0.0)").action(async function(key) {
119854
119873
  await expertYankHandler(key, getParentOptions(this));
119855
119874
  });
119875
+ program.command("application").description("Manage applications on Perstack API").option("--api-key <key>", "Perstack API key (default: PERSTACK_API_KEY env)").option("--base-url <url>", "Custom API base URL").command("list").description("List applications").action(async function() {
119876
+ await applicationsListHandler(getParentOptions(this));
119877
+ });
119856
119878
  program.parseAsync().catch((error) => {
119857
119879
  if (error instanceof PerstackError) {
119858
119880
  console.error(error.message);