@yolo-labs/yolo-cli 0.44.1 → 0.45.0

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/cli.js CHANGED
@@ -62,6 +62,8 @@ function printHelp() {
62
62
  ' [--workspace <wsId>] Sanity-check the workspace bound to this session.',
63
63
  ' kanban import <boardId> <file> Rebuild a board from a seed document (additive; never overwrites).',
64
64
  ' [--workspace <wsId>] Sanity-check the workspace bound to this session.',
65
+ ' kanban models List the model ids a card can be pinned to, and whether each can run now.',
66
+ ' [--json] [--workspace <wsId>] Raw JSON instead of the table; sanity-check the workspace.',
65
67
  ' git doctor [opts] Diagnose why git (not gh) can\'t authenticate to github.com.',
66
68
  ' [--fix] Repair what is safe to (store file, helpers, remote URL), then re-check.',
67
69
  ' [--offline] [--remote <name>] [--json] Skip network checks; remote to probe (default: origin); JSON output.',
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * `yolo kanban export` / `yolo kanban import` — move a board seed document
3
- * between a workspace and a file, with no model in the loop.
3
+ * between a workspace and a file, with no model in the loop. Plus
4
+ * `yolo kanban models`, the pinnable model ids (`studio.kanban_list_models`
5
+ * from a shell, on the same user-token surface).
4
6
  *
5
7
  * A board lives in Mongo, scoped to a workspace that can wedge. The seed
6
8
  * document (`common-api/src/services/kanban-board-seed.ts`) is the only copy
@@ -144,6 +146,44 @@ export async function runKanbanImport(options) {
144
146
  workspaceId,
145
147
  };
146
148
  }
149
+ export async function runKanbanModels(options = {}) {
150
+ const env = options.env ?? process.env;
151
+ const resolved = resolveContext(env, options.workspaceFlag);
152
+ if (!resolved.ok)
153
+ return resolved.failure;
154
+ const { commonApiUrl, userToken, workspaceId } = resolved;
155
+ let response;
156
+ try {
157
+ response = await userRouteRequest({ commonApiUrl, userToken, fetchImpl: options.fetchImpl }, `/workspaces/${encodeURIComponent(workspaceId)}/kanban/models`, { method: 'GET' });
158
+ }
159
+ catch (err) {
160
+ return fail('http', `kanban.models.list failed: ${describeError(err)}`);
161
+ }
162
+ const body = await safeReadText(response);
163
+ if (!response.ok) {
164
+ return fail('http', `kanban.models.list failed: HTTP ${response.status} — ${body}`, { status: response.status });
165
+ }
166
+ if (options.json)
167
+ return { ok: true, output: body, raw: true, workspaceId };
168
+ return { ok: true, output: formatModels(body), raw: false, workspaceId };
169
+ }
170
+ /** One id per line — the value `model` takes — then whether it can run now and why not. */
171
+ export function formatModels(body) {
172
+ let models;
173
+ try {
174
+ models = JSON.parse(body).models ?? [];
175
+ }
176
+ catch {
177
+ return body;
178
+ }
179
+ if (models.length === 0)
180
+ return 'No models are discovered for this workspace right now.';
181
+ const idCol = Math.max(...models.map((m) => m.id.length));
182
+ return models.map((m) => {
183
+ const state = m.available ? 'available' : `unavailable${m.unavailableReason ? ` — ${m.unavailableReason}` : ''}`;
184
+ return `${m.id.padEnd(idCol)} ${m.isDefault ? 'default ' : ' '}${state}`;
185
+ }).join('\n');
186
+ }
147
187
  /**
148
188
  * `key → cardId`, one per line, under a count. That map is what a caller
149
189
  * needs to say anything at all about the board it just rebuilt, and it is
@@ -197,6 +237,48 @@ function resolveContext(env, workspaceFlag) {
197
237
  // ─── CLI surface ──────────────────────────────────────────────────────────
198
238
  const EXPORT_USAGE = 'Usage: yolo kanban export <tileId> [-o <file>] [--workspace <wsId>]\n';
199
239
  const IMPORT_USAGE = 'Usage: yolo kanban import <boardId> <file> [--workspace <wsId>]\n';
240
+ const MODELS_USAGE = 'Usage: yolo kanban models [--json] [--workspace <wsId>]\n';
241
+ const KANBAN_USAGE = [
242
+ 'Usage: yolo kanban <subcommand>',
243
+ '',
244
+ 'Subcommands:',
245
+ ' export <tileId> [-o <file>] Write a board\'s seed document to a file or stdout',
246
+ ' import <boardId> <file> Create cards on a board from a seed document',
247
+ ' models [--json] List the model ids a card can be pinned to',
248
+ '',
249
+ 'Every subcommand takes --workspace <wsId> (defaults to this session\'s workspace).',
250
+ '',
251
+ ].join('\n');
252
+ const isHelp = (a) => a === '--help' || a === '-h' || a === 'help';
253
+ export function parseKanbanModelsArgs(args) {
254
+ let json = false;
255
+ let workspaceFlag;
256
+ for (let i = 0; i < args.length; i++) {
257
+ const a = args[i];
258
+ if (a === '--json') {
259
+ json = true;
260
+ }
261
+ else if (a === '--workspace') {
262
+ const v = args[++i];
263
+ if (!v || v.startsWith('--'))
264
+ return { ok: false, message: '--workspace requires a value' };
265
+ workspaceFlag = v;
266
+ }
267
+ else if (a.startsWith('--workspace=')) {
268
+ const v = a.slice('--workspace='.length);
269
+ if (!v)
270
+ return { ok: false, message: '--workspace requires a value' };
271
+ workspaceFlag = v;
272
+ }
273
+ else if (a.startsWith('-')) {
274
+ return { ok: false, message: `unknown option: ${a}` };
275
+ }
276
+ else {
277
+ return { ok: false, message: `unexpected positional argument: ${a}` };
278
+ }
279
+ }
280
+ return { ok: true, json, workspaceFlag };
281
+ }
200
282
  export function parseKanbanExportArgs(args) {
201
283
  let tileId;
202
284
  let outFile;
@@ -271,6 +353,25 @@ export function parseKanbanImportArgs(args) {
271
353
  /** `args` is everything after `kanban`. */
272
354
  export async function runKanbanCmd(args) {
273
355
  const sub = args[0];
356
+ if (isHelp(sub)) {
357
+ process.stdout.write(KANBAN_USAGE);
358
+ return 0;
359
+ }
360
+ // `yolo kanban <sub> --help` prints that subcommand's usage rather than failing its parse.
361
+ const subUsage = sub === 'export' ? EXPORT_USAGE : sub === 'import' ? IMPORT_USAGE : sub === 'models' ? MODELS_USAGE : null;
362
+ if (subUsage && args.slice(1).some((a) => a === '--help' || a === '-h')) {
363
+ process.stdout.write(subUsage);
364
+ return 0;
365
+ }
366
+ if (sub === 'models') {
367
+ const parsed = parseKanbanModelsArgs(args.slice(1));
368
+ if (!parsed.ok) {
369
+ process.stderr.write(`yolo: kanban models: ${parsed.message}\n`);
370
+ process.stderr.write(MODELS_USAGE);
371
+ return 64;
372
+ }
373
+ return report(await runKanbanModels({ json: parsed.json, workspaceFlag: parsed.workspaceFlag }));
374
+ }
274
375
  if (sub === 'export') {
275
376
  const parsed = parseKanbanExportArgs(args.slice(1));
276
377
  if (!parsed.ok) {
@@ -297,12 +398,8 @@ export async function runKanbanCmd(args) {
297
398
  workspaceFlag: parsed.workspaceFlag,
298
399
  }));
299
400
  }
300
- if (!sub) {
301
- process.stderr.write('yolo: kanban requires a subcommand (export, import)\n');
302
- return 64;
303
- }
304
- process.stderr.write(`yolo: unknown kanban subcommand '${sub}'\n`);
305
- process.stderr.write('Subcommands: export, import\n');
401
+ process.stderr.write(sub ? `yolo: unknown kanban subcommand '${sub}'\n` : 'yolo: kanban requires a subcommand\n');
402
+ process.stderr.write(KANBAN_USAGE);
306
403
  return 64;
307
404
  }
308
405
  function report(result) {
@@ -148,8 +148,9 @@ export function runTileAppInit(opts) {
148
148
  // calculator/grapher), write a real parser here (tokenizer → shunting-yard →
149
149
  // RPN eval) rather than reaching for eval. Keep everything self-contained.
150
150
  //
151
- // To call HOST capabilities (LLM, MCP tools, files), vendor @yololabs/app-sdk's
152
- // browser build into ./vendor/app-sdk/ and request matching permissions in
151
+ // To call HOST capabilities (LLM, MCP tools, files), vendor @yolo-labs/app-sdk's
152
+ // browser build (npm i @yolo-labs/app-sdk, then copy its dist/) into
153
+ // ./vendor/app-sdk/ and request matching permissions in
153
154
  // tileapp.json (permissions.required / optional):
154
155
  // import { createTileApp } from './vendor/app-sdk/index.js';
155
156
  // const app = createTileApp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-labs/yolo-cli",
3
- "version": "0.44.1",
3
+ "version": "0.45.0",
4
4
  "description": "YOLO Studio CLI for workspace context, artifacts, personal apps and hosting.",
5
5
  "license": "MIT",
6
6
  "repository": {