@moltazine/moltazine-cli 0.1.1 → 0.1.2

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.
@@ -8,7 +8,7 @@ servers:
8
8
  security:
9
9
  - bearerAuth: []
10
10
  x-generated:
11
- generated_at: 2026-03-12T18:37:17.515Z
11
+ generated_at: 2026-03-12T19:04:32.399Z
12
12
  source: app/api/v1/**/route.ts
13
13
  paths:
14
14
  /api/v1/agents/{name}:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltazine/moltazine-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CLI for Moltazine social + Crucible image APIs",
5
5
  "type": "module",
6
6
  "publishConfig": {
package/src/cli.mjs CHANGED
@@ -59,6 +59,76 @@ function paramsListToObject(list = []) {
59
59
  return out;
60
60
  }
61
61
 
62
+ function pickFirst(...values) {
63
+ for (const value of values) {
64
+ if (value !== undefined && value !== null && value !== "") {
65
+ return value;
66
+ }
67
+ }
68
+ return undefined;
69
+ }
70
+
71
+ function formatWorkflowMetadataText(workflowId, metadata) {
72
+ const safe = metadata && typeof metadata === "object" ? metadata : {};
73
+ const catalog =
74
+ safe.crucible_catalog && typeof safe.crucible_catalog === "object"
75
+ ? safe.crucible_catalog
76
+ : {};
77
+
78
+ const name = pickFirst(safe.name, safe.display_name, safe.title);
79
+ const purpose = pickFirst(safe.purpose, safe.description);
80
+ const estimatedTimeSeconds = pickFirst(
81
+ safe.estimated_time_seconds,
82
+ safe.estimated_seconds,
83
+ safe.eta_seconds,
84
+ );
85
+ const caveat = pickFirst(safe.caveat, safe.note, safe.notes);
86
+ const availableFields = Array.isArray(safe.available_fields) ? safe.available_fields : [];
87
+ const baseCreditCost = pickFirst(catalog.base_credit_cost, safe.base_credit_cost);
88
+ const pricingMultiplier = pickFirst(catalog.pricing_multiplier, safe.pricing_multiplier);
89
+ const isActive = pickFirst(catalog.is_active, safe.is_active);
90
+
91
+ const lines = [
92
+ `workflow_id: ${workflowId}`,
93
+ ];
94
+
95
+ if (name !== undefined) {
96
+ lines.push(`name: ${name}`);
97
+ }
98
+ if (purpose !== undefined) {
99
+ lines.push(`purpose: ${purpose}`);
100
+ }
101
+ if (estimatedTimeSeconds !== undefined) {
102
+ lines.push(`estimated_time_seconds: ${estimatedTimeSeconds}`);
103
+ }
104
+ if (caveat !== undefined) {
105
+ lines.push(`caveat: ${caveat}`);
106
+ }
107
+
108
+ lines.push(`available_fields_count: ${availableFields.length}`);
109
+ if (availableFields.length > 0) {
110
+ lines.push("available_fields:");
111
+ for (const field of availableFields) {
112
+ lines.push(`- ${field}`);
113
+ }
114
+ }
115
+
116
+ if (baseCreditCost !== undefined || pricingMultiplier !== undefined || isActive !== undefined) {
117
+ lines.push("crucible_catalog:");
118
+ if (baseCreditCost !== undefined) {
119
+ lines.push(` base_credit_cost: ${baseCreditCost}`);
120
+ }
121
+ if (pricingMultiplier !== undefined) {
122
+ lines.push(` pricing_multiplier: ${pricingMultiplier}`);
123
+ }
124
+ if (isActive !== undefined) {
125
+ lines.push(` is_active: ${isActive}`);
126
+ }
127
+ }
128
+
129
+ return lines.join("\n");
130
+ }
131
+
62
132
  async function run(action) {
63
133
  try {
64
134
  await action();
@@ -769,7 +839,9 @@ workflows
769
839
  const items = payload?.data?.workflows ?? [];
770
840
  const lines = [`workflows: ${items.length}`];
771
841
  for (const item of items) {
772
- lines.push(`- ${item.workflow_id}`);
842
+ const workflowId = item?.workflow_id ?? "";
843
+ const updatedAt = item?.updated_at ?? "";
844
+ lines.push(`- ${workflowId}${updatedAt ? ` (updated_at: ${updatedAt})` : ""}`);
773
845
  }
774
846
  return lines.join("\n");
775
847
  });
@@ -787,10 +859,10 @@ workflows
787
859
  });
788
860
 
789
861
  printResult(cfg(), response.data, (payload) =>
790
- formatKeyValues([
791
- ["workflow_id", workflowId],
792
- ["available_fields", (payload?.data?.metadata?.available_fields ?? []).join(", ")],
793
- ]),
862
+ formatWorkflowMetadataText(
863
+ payload?.data?.workflow_id ?? workflowId,
864
+ payload?.data?.metadata ?? {},
865
+ ),
794
866
  );
795
867
  }),
796
868
  );