@farthershore/cli 0.3.0 → 0.3.1

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/client.d.ts CHANGED
@@ -81,5 +81,18 @@ export declare function createClient(opts: {
81
81
  message: string;
82
82
  }>;
83
83
  }>;
84
+ managementCompile: (productId: string) => Promise<{
85
+ success: boolean;
86
+ errors?: Array<{
87
+ code?: string;
88
+ message: string;
89
+ }>;
90
+ warnings?: Array<{
91
+ code?: string;
92
+ message: string;
93
+ }>;
94
+ }>;
95
+ managementListProducts: () => Promise<Product[]>;
96
+ isMakerToken: () => boolean;
84
97
  };
85
98
  export type ApiClient = ReturnType<typeof createClient>;
package/dist/client.js CHANGED
@@ -68,5 +68,9 @@ export function createClient(opts) {
68
68
  getUsage: (productId) => request("GET", `/products/${productId}/usage`),
69
69
  // --- Compile ---
70
70
  compileProduct: (productId) => request("POST", `/products/${productId}/compile`),
71
+ // --- Management (maker token) ---
72
+ managementCompile: (productId) => request("POST", `/management/products/${productId}/compile`),
73
+ managementListProducts: () => request("GET", "/management/products"),
74
+ isMakerToken: () => opts.token.startsWith("mk_"),
71
75
  };
72
76
  }
@@ -33,9 +33,11 @@ async function resolveProductId(client, arg) {
33
33
  /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(slug)) {
34
34
  return slug;
35
35
  }
36
- // Slug — resolve via product list
36
+ // Slug — resolve via product list (use management API for maker tokens)
37
37
  try {
38
- const products = await client.listProducts();
38
+ const products = client.isMakerToken()
39
+ ? await client.managementListProducts()
40
+ : await client.listProducts();
39
41
  const match = products.find((p) => p.name === slug || p.name.toLowerCase() === slug.toLowerCase());
40
42
  return match?.id ?? null;
41
43
  }
@@ -64,7 +66,9 @@ export function registerApplyCommand(program, getClient) {
64
66
  return;
65
67
  }
66
68
  try {
67
- const result = await client.compileProduct(productId);
69
+ const result = client.isMakerToken()
70
+ ? await client.managementCompile(productId)
71
+ : await client.compileProduct(productId);
68
72
  // GitHub Actions annotations
69
73
  if (CI) {
70
74
  for (const err of result.errors ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farthershore/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "FartherShore CLI — create and configure API products",
5
5
  "type": "module",
6
6
  "bin": {