From 3819c55a01f5db9033c04302a91f7afba538a611 Mon Sep 17 00:00:00 2001 From: myles Date: Sat, 5 Sep 2026 11:21:10 -0400 Subject: [PATCH 1/4] updates upload command with addtional arguments the upload command arguments now matches the arguments for add a block --- src/commands/upload.tsx | 32 +++++++++++++++++++++++-- src/lib/registry.tsx | 53 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 80 insertions(+), 5 deletions(-) diff --git a/src/commands/upload.tsx b/src/commands/upload.tsx index 3c100c2..d3e6ab5 100644 --- a/src/commands/upload.tsx +++ b/src/commands/upload.tsx @@ -4,15 +4,33 @@ import { client, getData } from "../api/client"; import { Spinner } from "../components/Spinner"; import { useCommand } from "../hooks/use-command"; import { uploadLocalFile } from "../lib/upload"; +import { Metadata } from "../api/types"; interface Props { file: string; channel: string; title?: string; description?: string; + altText?: string; + originalSourceUrl?: string; + originalSourceTitle?: string; + insertAt?: number; + metadata?: Metadata; + connectionMetadata?: Metadata; } -export function UploadCommand({ file, channel, title, description }: Props) { +export function UploadCommand({ + file, + channel, + title, + description, + altText, + originalSourceUrl, + originalSourceTitle, + insertAt, + metadata, + connectionMetadata, +}: Props) { const { data, error, loading } = useCommand(async () => { const { s3Url } = await uploadLocalFile(file); const ch = await getData( @@ -24,9 +42,19 @@ export function UploadCommand({ file, channel, title, description }: Props) { client.POST("/v3/blocks", { body: { value: s3Url, - channel_ids: [ch.id], + channels: [ + { + id: ch.id, + position: insertAt, + metadata: connectionMetadata, + }, + ], title, description, + alt_text: altText, + original_source_url: originalSourceUrl, + original_source_title: originalSourceTitle, + metadata, }, }), ); diff --git a/src/lib/registry.tsx b/src/lib/registry.tsx index 6a697fa..38504fc 100644 --- a/src/lib/registry.tsx +++ b/src/lib/registry.tsx @@ -693,7 +693,7 @@ export const commands: CommandDefinition[] = [ help: [ { usage: - "upload --channel [--title ] [--description ]", + "upload --channel [--title ] [--description ] [--alt-text ] [--original-source-url ] [--original-source-title ] [--insert-at ]", description: "Options", }, { @@ -701,6 +701,28 @@ export const commands: CommandDefinition[] = [ 'upload --channel --title "Title" --description "Notes"', description: "Example", }, + { + usage: 'upload --channel --alt-text "Accessible text"', + description: "Example", + }, + { + usage: + 'upload --channel --original-source-url --original-source-title "Source"', + description: "Example", + }, + { + usage: "upload --channel --insert-at 1", + description: "Example", + }, + { + usage: "upload --channel --metadata status=reviewed", + description: "Example", + }, + { + usage: + "upload --channel --connection-metadata placement=homepage", + description: "Example", + }, ], render(args, flags) { return ( @@ -709,23 +731,48 @@ export const commands: CommandDefinition[] = [ channel={requireFlag(flags, "channel")} title={flag(flags, "title")} description={flag(flags, "description")} + altText={flag(flags, "alt-text")} + originalSourceUrl={flag(flags, "original-source-url")} + originalSourceTitle={flag(flags, "original-source-title")} + insertAt={intFlag(flags, "insert-at")} + metadata={entityMetadataFlag(flags)} + connectionMetadata={entityMetadataFlag(flags, "connection-metadata")} /> ); }, async json(args, flags) { const file = requireArg(args, 0, "file"); - const channel = requireFlag(flags, "channel"); + const { s3Url } = await uploadLocalFile(file); + + const channel = requireFlag(flags, "channel"); const ch = await getData( client.GET("/v3/channels/{id}", { params: { path: { id: channel } } }), ); + + const metadata = entityMetadataFlag(flags); + const connectionMetadata = entityMetadataFlag( + flags, + "connection-metadata", + ); + return getData( client.POST("/v3/blocks", { body: { value: s3Url, - channel_ids: [ch.id], + channels: [ + { + id: ch.id, + position: intFlag(flags, "insert-at"), + metadata: connectionMetadata, + }, + ], title: flag(flags, "title"), description: flag(flags, "description"), + alt_text: flag(flags, "alt-text"), + original_source_url: flag(flags, "original-source-url"), + original_source_title: flag(flags, "original-source-title"), + metadata, }, }), ); From 93699fc31e4e62521f67a2471d2e9eb16a27623a Mon Sep 17 00:00:00 2001 From: myles Date: Sat, 5 Sep 2026 11:26:13 -0400 Subject: [PATCH 2/4] validate the upload args before uploading the file --- src/lib/registry.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/registry.tsx b/src/lib/registry.tsx index 38504fc..c8f521d 100644 --- a/src/lib/registry.tsx +++ b/src/lib/registry.tsx @@ -742,14 +742,14 @@ export const commands: CommandDefinition[] = [ }, async json(args, flags) { const file = requireArg(args, 0, "file"); - - const { s3Url } = await uploadLocalFile(file); - const channel = requireFlag(flags, "channel"); + const ch = await getData( client.GET("/v3/channels/{id}", { params: { path: { id: channel } } }), ); + const { s3Url } = await uploadLocalFile(file); + const metadata = entityMetadataFlag(flags); const connectionMetadata = entityMetadataFlag( flags, From 771edfbd346e6e7342e9c5fdcf9e840d02d5c02f Mon Sep 17 00:00:00 2001 From: myles Date: Sat, 5 Sep 2026 11:38:18 -0400 Subject: [PATCH 3/4] update the README with the new options --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index db938de..5ac1174 100644 --- a/README.md +++ b/README.md @@ -387,6 +387,8 @@ Examples: ```bash arena upload photo.jpg --channel my-channel arena upload photo.jpg --channel my-channel --title "Cover" --description "Homepage image" +arena upload photo.jpg --channel my-channel --alt-text "Cover image" --insert-at 1 +arena upload photo.jpg --channel my-channel --original-source-url https://source.com --original-source-title "Original" ``` Options: @@ -394,6 +396,10 @@ Options: - `--channel ` (required) - `--title ` - `--description ` +- `--alt-text ` +- `--original-source-url ` +- `--original-source-title ` +- `--insert-at ` #### `batch` From a00df47be6035f93798f2069ba838d9d9ea54dc3 Mon Sep 17 00:00:00 2001 From: myles Date: Sat, 5 Sep 2026 11:42:39 -0400 Subject: [PATCH 4/4] add the help text --- src/lib/registry.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/lib/registry.tsx b/src/lib/registry.tsx index c8f521d..80522c9 100644 --- a/src/lib/registry.tsx +++ b/src/lib/registry.tsx @@ -2089,8 +2089,26 @@ export const commandHelpDocs: Record = { flag: "--description ", description: "Optional block description", }, + { flag: "--alt-text ", description: "Optional block alt text" }, + { + flag: "--original-source-url ", + description: "Optional original source URL", + }, + { + flag: "--original-source-title ", + description: "Optional original source title", + }, + { + flag: "--insert-at ", + description: "Optional insert position within the channel", + }, + ], + examples: [ + "arena upload photo.jpg --channel my-channel", + 'arena upload photo.jpg --channel my-channel --title "Cover" --description "Homepage image"', + 'arena upload photo.jpg --channel my-channel --alt-text "Cover image" --insert-at 1', + 'arena upload photo.jpg --channel my-channel --original-source-url https://source.com --original-source-title "Original"', ], - examples: ["arena upload photo.jpg --channel my-channel"], seeAlso: ["add", "batch", "import"], }, batch: {