@nodaro/cli 1.9.0 → 1.11.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/README.md CHANGED
@@ -149,6 +149,8 @@ nodaro media download <url> [--max-height 720] [--section 30-90] --watch
149
149
  nodaro media metadata <url>
150
150
  nodaro media trim-video --video <url> --start 12 --end 48 --watch
151
151
  nodaro media trim-audio --video <url> --format wav --watch
152
+ nodaro media still-to-video --image <url> --audio <url> --motion ken-burns --watch
153
+ nodaro media slideshow --images <url1> <url2> <url3> --audio <url> --transition dissolve --watch
152
154
  nodaro media save <url> [--type video] --watch
153
155
 
154
156
  # Audio — separation, isolation, fx, mix, level, combine
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var require_package = __commonJS({
29
29
  "package.json"(exports$1, module) {
30
30
  module.exports = {
31
31
  name: "@nodaro/cli",
32
- version: "1.9.0",
32
+ version: "1.11.0",
33
33
  description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
34
34
  type: "module",
35
35
  license: "Apache-2.0",
@@ -70,11 +70,11 @@ var require_package = __commonJS({
70
70
  "@inquirer/confirm": "^6.0.12",
71
71
  "@inquirer/input": "^5.0.12",
72
72
  "@inquirer/select": "^5.1.4",
73
- "@nodaro/sdk": "^1.17.0",
74
- "@nodaro/shared": "^2.6.0",
73
+ "@nodaro/sdk": "^1.19.0",
74
+ "@nodaro/shared": "^2.10.0",
75
75
  commander: "^12.1.0",
76
76
  picocolors: "^1.1.1",
77
- "@nodaro/prompts": "^1.7.1"
77
+ "@nodaro/prompts": "^1.7.3"
78
78
  },
79
79
  devDependencies: {
80
80
  tsup: "^8.5.0",
@@ -373,7 +373,32 @@ function maskToken(token) {
373
373
  if (token.length <= 12) return "****";
374
374
  return token.slice(0, 8) + "\u2026" + token.slice(-4);
375
375
  }
376
- var CLI_VERSION = "1.9.0" ;
376
+
377
+ // src/workspace.ts
378
+ var flagOverride;
379
+ function setWorkspaceFlag(workspaceId) {
380
+ flagOverride = workspaceId?.trim() || void 0;
381
+ }
382
+ function resolveWorkspace(profile) {
383
+ if (flagOverride) return { workspaceId: flagOverride, source: "flag" };
384
+ const env = process.env.NODARO_WORKSPACE?.trim();
385
+ if (env) return { workspaceId: env, source: "env" };
386
+ const saved = profile?.workspace?.trim();
387
+ if (saved) return { workspaceId: saved, source: "profile" };
388
+ return { workspaceId: void 0, source: "none" };
389
+ }
390
+ function saveWorkspace(profileName, workspaceId) {
391
+ const { name, profile } = getProfile(profileName);
392
+ if (!profile) throw new Error(`no credentials for profile "${name}" \u2014 run: nodaro auth login`);
393
+ const next = { ...profile };
394
+ if (workspaceId) next.workspace = workspaceId;
395
+ else delete next.workspace;
396
+ setProfile(name, next);
397
+ return name;
398
+ }
399
+
400
+ // src/client.ts
401
+ var CLI_VERSION = "1.11.0" ;
377
402
  function buildClient(profileName) {
378
403
  const { name, profile } = getProfile(profileName);
379
404
  if (!profile) {
@@ -381,9 +406,12 @@ function buildClient(profileName) {
381
406
  console.error(pc3.dim(` run: nodaro auth login${profileName ? ` --profile ${profileName}` : ""}`));
382
407
  process.exit(1);
383
408
  }
409
+ const { workspaceId } = resolveWorkspace(profile);
384
410
  return createClient({
385
411
  baseUrl: profile.baseUrl,
386
412
  auth: new StaticTokenAuth(profile.token),
413
+ // Scope, not access — see ./workspace.ts. Absent means the personal space.
414
+ ...workspaceId ? { workspaceId } : {},
387
415
  // Without this the CLI is indistinguishable from any other SDK consumer:
388
416
  // it IS an SDK consumer, so it would otherwise report `sdk/<sdk version>`
389
417
  // and every CLI-created job would be filed under the wrong surface.
@@ -2082,7 +2110,7 @@ function parseSection(raw) {
2082
2110
  }
2083
2111
  function mediaCommand() {
2084
2112
  const cmd = new Command("media").description(
2085
- "media ingestion + compositing \u2014 pull a social video into storage, trim video/audio, collage images, save a URL to storage, probe metadata"
2113
+ "media ingestion + compositing \u2014 pull a social video into storage, trim video/audio, still-to-video, slideshow, collage images, save a URL to storage, probe metadata"
2086
2114
  );
2087
2115
  cmd.command("download <url>").description("download a social video (YouTube / TikTok / Instagram / X / Facebook) into your storage").option("--max-height <px>", "cap the resolution (e.g. 720); omit for best available", (v) => parseInt(v, 10)).option("--section <a-b>", 'fetch ONLY this time range in seconds (e.g. "30-90"); the cut lands on keyframes, so pad and trim after').option("--watch", "stream the download's live progress until it completes").option("--profile <name>").option("--json").addHelpText("after", `
2088
2116
  Examples:
@@ -2179,6 +2207,66 @@ Examples:
2179
2207
  }
2180
2208
  }
2181
2209
  );
2210
+ cmd.command("still-to-video").description("one still image + one audio track -> MP4 (local FFmpeg, zero credits; length = the audio's length)").requiredOption("--image <url>", "still image URL").requiredOption("--audio <url>", "audio URL - sets the output length (no duration option by design)").option("--motion <preset>", "none|zoom-in|zoom-out|pan-left|pan-right|ken-burns", "none").option("--intensity <1-10>", "motion strength (ignored for none)", (v) => parseInt(v, 10)).option("--resolution <res>", "720p|1080p|4K", "1080p").option("--aspect-ratio <ratio>", "16:9|9:16|1:1|4:3", "16:9").option("--fps <fps>", "24|30", (v) => parseInt(v, 10)).option("--fit <mode>", "cover (crop to fill) | contain (letterbox)", "cover").option("--pad-color <hex>", "letterbox color when --fit contain (#RRGGBB)").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
2211
+ Examples:
2212
+ $ nodaro media still-to-video --image https://.../cover.png --audio https://.../track.mp3 --watch
2213
+ $ nodaro media still-to-video --image https://.../photo.png --audio https://.../vo.wav --motion ken-burns --intensity 4 --watch`).action(
2214
+ async (opts) => {
2215
+ try {
2216
+ const client = buildClient(opts.profile);
2217
+ const result = await client.media.stillToVideo({
2218
+ imageUrl: opts.image,
2219
+ audioUrl: opts.audio,
2220
+ ...opts.motion !== void 0 ? { motion: opts.motion } : {},
2221
+ ...opts.intensity !== void 0 ? { intensity: opts.intensity } : {},
2222
+ ...opts.resolution !== void 0 ? { resolution: opts.resolution } : {},
2223
+ ...opts.aspectRatio !== void 0 ? { aspectRatio: opts.aspectRatio } : {},
2224
+ ...opts.fps !== void 0 ? { fps: opts.fps } : {},
2225
+ ...opts.fit !== void 0 ? { fit: opts.fit } : {},
2226
+ ...opts.padColor !== void 0 ? { padColor: opts.padColor } : {}
2227
+ });
2228
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "still to video" });
2229
+ } catch (err) {
2230
+ handleError(err);
2231
+ }
2232
+ }
2233
+ );
2234
+ cmd.command("slideshow").description("2-100 images + one optional audio track -> MP4 slideshow (local FFmpeg, zero credits)").requiredOption("--images <urls...>", "2-100 image URLs, in slide order").option("--audio <url>", "audio URL - wired, it sets the output length (never cropped)").option("--durations <secs>", 'comma-separated per-slide seconds; use "auto" for unpinned rows (e.g. "10,4,auto,auto")').option("--per-image <sec>", "seconds per slide when NO audio is wired (default 3)", parseFloat).option("--transition <id>", "xfade id or transition-picker id (cut, fade, dissolve, dip-to-black, ...); unknown -> cut", "cut").option("--transition-duration <sec>", "seconds (default 0.5)", parseFloat).option("--motion <preset>", "none|zoom-in|zoom-out|ken-burns|alternate", "none").option("--intensity <1-10>", "motion strength", (v) => parseInt(v, 10)).option("--resolution <res>", "720p|1080p|4K", "1080p").option("--aspect-ratio <ratio>", "16:9|9:16|1:1|4:3", "16:9").option("--fps <fps>", "24|30", (v) => parseInt(v, 10)).option("--fit <mode>", "cover|contain", "cover").option("--pad-color <hex>", "letterbox color when --fit contain (#RRGGBB)").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
2235
+ Examples:
2236
+ $ nodaro media slideshow --images https://.../a.png https://.../b.png https://.../c.png --audio https://.../track.mp3 --transition dissolve --watch
2237
+ $ nodaro media slideshow --images https://.../a.png https://.../b.png --per-image 2.5 --motion alternate --watch`).action(
2238
+ async (opts) => {
2239
+ try {
2240
+ if (opts.images.length < 2) {
2241
+ warn("Slideshow needs at least 2 images. For a single still, use: nodaro media still-to-video");
2242
+ process.exit(1);
2243
+ }
2244
+ const imageDurations = opts.durations ? opts.durations.split(",").map((d) => {
2245
+ const t = d.trim().toLowerCase();
2246
+ return t === "auto" || t === "" ? null : parseFloat(t);
2247
+ }) : void 0;
2248
+ const client = buildClient(opts.profile);
2249
+ const result = await client.media.slideshow({
2250
+ imageUrls: opts.images,
2251
+ ...opts.audio !== void 0 ? { audioUrl: opts.audio } : {},
2252
+ ...imageDurations !== void 0 ? { imageDurations } : {},
2253
+ ...opts.perImage !== void 0 ? { perImageDuration: opts.perImage } : {},
2254
+ ...opts.transition !== void 0 ? { transition: opts.transition } : {},
2255
+ ...opts.transitionDuration !== void 0 ? { transitionDuration: opts.transitionDuration } : {},
2256
+ ...opts.motion !== void 0 ? { motion: opts.motion } : {},
2257
+ ...opts.intensity !== void 0 ? { intensity: opts.intensity } : {},
2258
+ ...opts.resolution !== void 0 ? { resolution: opts.resolution } : {},
2259
+ ...opts.aspectRatio !== void 0 ? { aspectRatio: opts.aspectRatio } : {},
2260
+ ...opts.fps !== void 0 ? { fps: opts.fps } : {},
2261
+ ...opts.fit !== void 0 ? { fit: opts.fit } : {},
2262
+ ...opts.padColor !== void 0 ? { padColor: opts.padColor } : {}
2263
+ });
2264
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "slideshow" });
2265
+ } catch (err) {
2266
+ handleError(err);
2267
+ }
2268
+ }
2269
+ );
2182
2270
  cmd.command("trim-audio").description("trim (and extract) audio from a video or audio source").option("--video <url>", "video URL to extract + trim audio from").option("--audio <url>", "audio URL to trim").option("--start <sec>", "range start in seconds", parseFloat).option("--end <sec>", "range end in seconds", parseFloat).option("--format <fmt>", "output format: mp3 (default), wav, or aac").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
2183
2271
  Example:
2184
2272
  $ nodaro media trim-audio --video https://.../clip.mp4 --start 0 --end 30 --format wav --watch`).action(
@@ -3727,6 +3815,316 @@ function objectsCommand() {
3727
3815
  function registerObjectsCommands(program2) {
3728
3816
  program2.addCommand(objectsCommand());
3729
3817
  }
3818
+ function orgCommand() {
3819
+ const cmd = new Command("org").description("organizations, their members, and invitations");
3820
+ cmd.command("list").description("the organizations this account belongs to").option("--profile <name>").option("--json").action(async (opts) => {
3821
+ try {
3822
+ const client = buildClient(opts.profile);
3823
+ const { data } = await client.organizations.list();
3824
+ if (opts.json) {
3825
+ emit(data, opts);
3826
+ return;
3827
+ }
3828
+ if (data.length === 0) {
3829
+ info("this account belongs to no organizations");
3830
+ return;
3831
+ }
3832
+ table(
3833
+ data.map((o) => ({ id: o.id, name: o.name, kind: o.kind, status: o.status, role: o.role ?? "" })),
3834
+ ["id", "name", "kind", "status", "role"]
3835
+ );
3836
+ } catch (err) {
3837
+ handleError(err);
3838
+ }
3839
+ });
3840
+ cmd.command("get <id>").description("show one organization").option("--profile <name>").option("--json").action(async (id, opts) => {
3841
+ try {
3842
+ const client = buildClient(opts.profile);
3843
+ const { data } = await client.organizations.get(id);
3844
+ if (opts.json) emit(data, opts);
3845
+ else detail(data);
3846
+ } catch (err) {
3847
+ handleError(err);
3848
+ }
3849
+ });
3850
+ cmd.command("create").description("create an organization").requiredOption("--name <name>", "organization name").requiredOption("--kind <kind>", "school or team").option("--slug <slug>", "url slug (derived from the name when omitted)").option("--accept-terms", "accept the terms, where the instance requires it").option("--profile <name>").option("--json").action(async (opts) => {
3851
+ try {
3852
+ if (opts.kind !== "school" && opts.kind !== "team") {
3853
+ throw new Error("--kind must be school or team");
3854
+ }
3855
+ const client = buildClient(opts.profile);
3856
+ const { data } = await client.organizations.create({
3857
+ name: opts.name,
3858
+ kind: opts.kind,
3859
+ ...opts.slug ? { slug: opts.slug } : {},
3860
+ ...opts.acceptTerms ? { acceptTerms: true } : {}
3861
+ });
3862
+ if (opts.json) {
3863
+ emit(data, opts);
3864
+ return;
3865
+ }
3866
+ success(`created ${data.name} (${data.id})`);
3867
+ if (data.status === "pending") {
3868
+ warn("status is pending \u2014 it grants nothing until a platform admin approves it");
3869
+ }
3870
+ } catch (err) {
3871
+ handleError(err);
3872
+ }
3873
+ });
3874
+ cmd.command("members <orgId>").description("who is in an organization").option("--limit <n>", "page size", (v) => Number(v)).option("--cursor <cursor>", "continue a previous page").option("--profile <name>").option("--json").action(async (orgId, opts) => {
3875
+ try {
3876
+ const client = buildClient(opts.profile);
3877
+ const page = await client.organizations.listMembers(orgId, { limit: opts.limit, cursor: opts.cursor });
3878
+ if (opts.json) {
3879
+ emit(page, opts);
3880
+ return;
3881
+ }
3882
+ table(
3883
+ page.data.map((m) => ({
3884
+ userId: m.userId,
3885
+ name: m.displayName ?? "",
3886
+ email: m.email ?? "",
3887
+ role: m.role,
3888
+ status: m.status
3889
+ })),
3890
+ ["userId", "name", "email", "role", "status"]
3891
+ );
3892
+ if (page.nextCursor) dim(`more: --cursor ${page.nextCursor}`);
3893
+ } catch (err) {
3894
+ handleError(err);
3895
+ }
3896
+ });
3897
+ cmd.command("invite <orgId>").description("invite people by email (repeat --email, or pass a comma-separated list)").option("--email <email...>", "one or more addresses").option("--role <role>", "org role: admin or member", "member").option("--workspace <id>", "also place them in this workspace on accept").option("--workspace-role <role>", "workspace role: admin or member").option("--profile <name>").option("--json").action(
3898
+ async (orgId, opts) => {
3899
+ try {
3900
+ const emails = (opts.email ?? []).flatMap((e) => e.split(",")).map((e) => e.trim()).filter(Boolean);
3901
+ if (emails.length === 0) throw new Error("no addresses \u2014 pass --email at least once");
3902
+ if (opts.role !== "admin" && opts.role !== "member") {
3903
+ throw new Error("--role must be admin or member");
3904
+ }
3905
+ if (opts.workspaceRole && opts.workspaceRole !== "admin" && opts.workspaceRole !== "member") {
3906
+ throw new Error("--workspace-role must be admin or member");
3907
+ }
3908
+ const client = buildClient(opts.profile);
3909
+ const { data } = await client.organizations.invite(orgId, {
3910
+ emails,
3911
+ orgRole: opts.role,
3912
+ ...opts.workspace ? { workspaceId: opts.workspace } : {},
3913
+ ...opts.workspaceRole ? { workspaceRole: opts.workspaceRole } : {}
3914
+ });
3915
+ if (opts.json) {
3916
+ emit(data, opts);
3917
+ return;
3918
+ }
3919
+ for (const row of data) {
3920
+ if (row.status === "sent") success(`${row.email} \u2014 emailed`);
3921
+ else if (row.link) {
3922
+ warn(`${row.email} \u2014 not emailed (${row.status}); send this link yourself:`);
3923
+ info(` ${row.link}`);
3924
+ } else {
3925
+ warn(`${row.email} \u2014 ${row.status}, and no link was returned`);
3926
+ }
3927
+ }
3928
+ } catch (err) {
3929
+ handleError(err);
3930
+ }
3931
+ }
3932
+ );
3933
+ cmd.command("invitations <orgId>").description("outstanding invitations").option("--status <status>", "open, accepted, revoked or expired").option("--limit <n>", "page size", (v) => Number(v)).option("--cursor <cursor>", "continue a previous page").option("--profile <name>").option("--json").action(async (orgId, opts) => {
3934
+ try {
3935
+ const client = buildClient(opts.profile);
3936
+ const page = await client.organizations.listInvitations(orgId, {
3937
+ ...opts.status ? { status: opts.status } : {},
3938
+ limit: opts.limit,
3939
+ cursor: opts.cursor
3940
+ });
3941
+ if (opts.json) {
3942
+ emit(page, opts);
3943
+ return;
3944
+ }
3945
+ table(
3946
+ page.data.map((i) => ({
3947
+ id: i.id,
3948
+ email: i.email,
3949
+ role: i.orgRole,
3950
+ state: i.state,
3951
+ expiresAt: i.expiresAt
3952
+ })),
3953
+ ["id", "email", "role", "state", "expiresAt"]
3954
+ );
3955
+ if (page.nextCursor) dim(`more: --cursor ${page.nextCursor}`);
3956
+ } catch (err) {
3957
+ handleError(err);
3958
+ }
3959
+ });
3960
+ cmd.command("revoke <invitationId>").description("revoke an invitation").option("--profile <name>").option("--json").action(async (id, opts) => {
3961
+ try {
3962
+ const client = buildClient(opts.profile);
3963
+ const { data } = await client.organizations.revokeInvitation(id);
3964
+ if (opts.json) emit(data, opts);
3965
+ else success(`revoked invitation ${id}`);
3966
+ } catch (err) {
3967
+ handleError(err);
3968
+ }
3969
+ });
3970
+ cmd.command("audit <orgId>").description("what happened in an organization, newest first").option("--limit <n>", "page size", (v) => Number(v)).option("--cursor <cursor>", "continue a previous page").option("--profile <name>").option("--json").action(async (orgId, opts) => {
3971
+ try {
3972
+ const client = buildClient(opts.profile);
3973
+ const page = await client.organizations.audit(orgId, { limit: opts.limit, cursor: opts.cursor });
3974
+ if (opts.json) {
3975
+ emit(page, opts);
3976
+ return;
3977
+ }
3978
+ table(
3979
+ page.data.map((e) => ({
3980
+ at: e.createdAt,
3981
+ action: e.action,
3982
+ actor: e.actor?.displayName ?? e.actor?.email ?? e.actor?.userId ?? "system",
3983
+ target: e.targetId ?? ""
3984
+ })),
3985
+ ["at", "action", "actor", "target"]
3986
+ );
3987
+ if (page.nextCursor) dim(`more: --cursor ${page.nextCursor}`);
3988
+ } catch (err) {
3989
+ handleError(err);
3990
+ }
3991
+ });
3992
+ return cmd;
3993
+ }
3994
+ function workspaceCommand() {
3995
+ const cmd = new Command("workspace").description("choose which workspace the CLI works in");
3996
+ cmd.command("list").description("the workspaces this account belongs to").option("--profile <name>").option("--json").action(async (opts) => {
3997
+ try {
3998
+ const client = buildClient(opts.profile);
3999
+ const { data, lastWorkspaceId } = await client.workspaces.list();
4000
+ if (opts.json) {
4001
+ emit({ data, lastWorkspaceId }, opts);
4002
+ return;
4003
+ }
4004
+ if (data.length === 0) {
4005
+ info("this account belongs to no workspaces \u2014 everything happens in its personal space");
4006
+ return;
4007
+ }
4008
+ const active = resolveWorkspace(getProfile(opts.profile).profile).workspaceId;
4009
+ table(
4010
+ data.map((w) => ({
4011
+ id: w.id,
4012
+ name: w.name,
4013
+ role: w.role,
4014
+ archived: w.archived ? "yes" : "",
4015
+ active: w.id === active ? "\u2190" : ""
4016
+ })),
4017
+ ["id", "name", "role", "archived", "active"]
4018
+ );
4019
+ } catch (err) {
4020
+ handleError(err);
4021
+ }
4022
+ });
4023
+ cmd.command("current").description("which workspace this profile is working in, and why").option("--profile <name>").option("--json").action((opts) => {
4024
+ const { name, profile } = getProfile(opts.profile);
4025
+ const { workspaceId, source } = resolveWorkspace(profile);
4026
+ if (opts.json) {
4027
+ emit({ profile: name, workspaceId: workspaceId ?? null, source }, opts);
4028
+ return;
4029
+ }
4030
+ info(`profile: ${pc3.cyan(name)}`);
4031
+ info(`workspace: ${workspaceId ?? "(personal space)"}`);
4032
+ if (!profile) {
4033
+ warn(`no credentials for profile "${name}" \u2014 run: nodaro auth login`);
4034
+ return;
4035
+ }
4036
+ if (!workspaceId) return;
4037
+ dim(`from: ${SOURCE_LABELS[source]}`);
4038
+ });
4039
+ cmd.command("use <id>").description("remember this workspace for the profile").option("--profile <name>").option("--json").action(async (id, opts) => {
4040
+ try {
4041
+ const client = buildClient(opts.profile);
4042
+ const { data: mine } = await client.workspaces.list();
4043
+ const data = mine.find((w) => w.id === id);
4044
+ if (!data) {
4045
+ throw new Error(
4046
+ `${id} is not one of the workspaces this account can work in \u2014 run: nodaro workspace list`
4047
+ );
4048
+ }
4049
+ const name = saveWorkspace(opts.profile, id);
4050
+ if (opts.json) {
4051
+ emit({ profile: name, workspaceId: id, workspace: data }, opts);
4052
+ return;
4053
+ }
4054
+ success(`profile "${name}" now works in ${data.name} (${id})`);
4055
+ if (data.archived) warn("this workspace is archived \u2014 reads work, new work does not");
4056
+ const { source } = resolveWorkspace(getProfile(opts.profile).profile);
4057
+ if (source !== "profile") {
4058
+ warn(`saved, but ${SOURCE_LABELS[source]} still wins for now`);
4059
+ }
4060
+ } catch (err) {
4061
+ handleError(err);
4062
+ }
4063
+ });
4064
+ cmd.command("clear").description("go back to the personal space").option("--profile <name>").action((opts) => {
4065
+ try {
4066
+ const name = saveWorkspace(opts.profile, null);
4067
+ success(`profile "${name}" now works in its personal space`);
4068
+ const { source } = resolveWorkspace(getProfile(opts.profile).profile);
4069
+ if (source !== "none") warn(`cleared, but ${SOURCE_LABELS[source]} still wins`);
4070
+ } catch (err) {
4071
+ handleError(err);
4072
+ }
4073
+ });
4074
+ cmd.command("members <id>").description("who is in a workspace").option("--limit <n>", "page size", (v) => Number(v)).option("--cursor <cursor>", "continue a previous page").option("--profile <name>").option("--json").action(async (id, opts) => {
4075
+ try {
4076
+ const client = buildClient(opts.profile);
4077
+ const page = await client.workspaces.listMembers(id, { limit: opts.limit, cursor: opts.cursor });
4078
+ if (opts.json) {
4079
+ emit(page, opts);
4080
+ return;
4081
+ }
4082
+ table(
4083
+ page.data.map((m) => ({
4084
+ userId: m.userId,
4085
+ name: m.displayName ?? "",
4086
+ role: m.role,
4087
+ status: m.status ?? ""
4088
+ })),
4089
+ ["userId", "name", "role", "status"]
4090
+ );
4091
+ if (page.nextCursor) dim(`more: --cursor ${page.nextCursor}`);
4092
+ } catch (err) {
4093
+ handleError(err);
4094
+ }
4095
+ });
4096
+ cmd.command("join <code>").description("join a workspace with a join code").option("--profile <name>").option("--json").action(async (code, opts) => {
4097
+ try {
4098
+ const client = buildClient(opts.profile);
4099
+ const { data } = await client.workspaces.join(code);
4100
+ if (opts.json) {
4101
+ emit(data, opts);
4102
+ return;
4103
+ }
4104
+ success(`joined workspace ${data.workspaceId}`);
4105
+ dim(`work in it: nodaro workspace use ${data.workspaceId}`);
4106
+ } catch (err) {
4107
+ handleError(err);
4108
+ }
4109
+ });
4110
+ cmd.command("get <id>").description("show one workspace").option("--profile <name>").option("--json").action(async (id, opts) => {
4111
+ try {
4112
+ const client = buildClient(opts.profile);
4113
+ const { data } = await client.workspaces.get(id);
4114
+ if (opts.json) emit(data, opts);
4115
+ else detail(data);
4116
+ } catch (err) {
4117
+ handleError(err);
4118
+ }
4119
+ });
4120
+ return cmd;
4121
+ }
4122
+ var SOURCE_LABELS = {
4123
+ flag: "--workspace on this command",
4124
+ env: "the NODARO_WORKSPACE environment variable",
4125
+ profile: "the profile's saved workspace",
4126
+ none: "nothing \u2014 the personal space"
4127
+ };
3730
4128
 
3731
4129
  // src/index.ts
3732
4130
  function readVersion() {
@@ -3736,7 +4134,10 @@ function readVersion() {
3736
4134
  return "0.0.0-dev";
3737
4135
  }
3738
4136
  }
3739
- var program = new Command().name("nodaro").description("Nodaro command-line interface \u2014 list and run workflows, inspect jobs and executions, manage projects.").version(readVersion(), "-v, --version");
4137
+ var program = new Command().name("nodaro").description("Nodaro command-line interface \u2014 list and run workflows, inspect jobs and executions, manage projects.").version(readVersion(), "-v, --version").option("--workspace <id>", "work in this workspace for this command only");
4138
+ program.hook("preAction", () => {
4139
+ setWorkspaceFlag(program.opts().workspace);
4140
+ });
3740
4141
  program.addCommand(authCommand());
3741
4142
  program.addCommand(projectsCommand());
3742
4143
  program.addCommand(workflowsCommand());
@@ -3756,6 +4157,8 @@ program.addCommand(pickerCatalogsCommand());
3756
4157
  program.addCommand(modelsCommand());
3757
4158
  program.addCommand(shotsCommand());
3758
4159
  program.addCommand(recastCommand());
4160
+ program.addCommand(orgCommand());
4161
+ program.addCommand(workspaceCommand());
3759
4162
  registerLocationsCommands(program);
3760
4163
  registerObjectsCommands(program);
3761
4164
  program.parseAsync().catch((err) => {