Skip to content

Commit 6e7a8b3

Browse files
jason-rlclaude
andauthored
feat: add --public flag to agent create, fix object upload --public (#219)
## Description Add a `--public` option to `rli agent create` and fix the existing broken `--public` on `rli object upload` so both pass `is_public: true` to their respective create API endpoints. The `is_public` field exists on the API but is absent from the SDK/OpenAPI spec, so this is useful for internal dev/staging use, or D2VPC customers who own their own platform and can upload whatever public stuff they want. Both `--public` flags are hidden from `--help` when `RUNLOOP_BASE_URL` is unset or points to the default `runloop.ai`, and become visible when a custom base URL is configured. ## Type of Change - [x] New feature (non-breaking change which adds functionality) ## Changes Made - `rli agent create --public` sets `is_public: true` in the agent create request - `rli object upload --public` now actually passes `is_public: true` to the object create request (was previously defined but never sent) - Both `--public` options are conditionally hidden from `--help` via a shared `publicOption()` helper that checks `runloopBaseDomain()` ## Testing - [x] I have tested locally - [x] All existing tests pass Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3ef6271 commit 6e7a8b3

4 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/commands/agent/create.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface CreateOptions {
1515
ref?: string;
1616
objectId?: string;
1717
setupCommands?: string[];
18+
public?: boolean;
1819
output?: string;
1920
}
2021

@@ -104,6 +105,7 @@ export async function createAgentCommand(
104105
const agent = await createAgent({
105106
name: options.name,
106107
...(options.agentVersion ? { version: options.agentVersion } : {}),
108+
...(options.public ? { is_public: true } : {}),
107109
source: { type: sourceType, [sourceType]: sourceOptions },
108110
});
109111

src/commands/object/upload.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ export async function uploadObject(options: UploadObjectOptions) {
241241
const createResponse = await client.objects.create({
242242
name,
243243
content_type: detectedContentType,
244-
});
244+
...(options.public ? { is_public: true } : {}),
245+
} as any);
245246

246247
// Step 2: Upload the file
247248
const uploadResponse = await fetch(createResponse.upload_url!, {

src/services/agentService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export async function listPublicAgents(
258258
export interface CreateAgentOptions {
259259
name: string;
260260
version?: string;
261+
is_public?: boolean;
261262
source?: {
262263
type: string;
263264
npm?: {
@@ -280,10 +281,11 @@ export interface CreateAgentOptions {
280281
*/
281282
export async function createAgent(options: CreateAgentOptions): Promise<Agent> {
282283
const client = getClient();
283-
const { version, ...rest } = options;
284+
const { version, is_public, ...rest } = options;
284285
// eslint-disable-next-line @typescript-eslint/no-explicit-any
285286
const params: any = { ...rest };
286287
if (version) params.version = version;
288+
if (is_public !== undefined) params.is_public = is_public;
287289
return client.agents.create(params);
288290
}
289291

src/utils/commands.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
import { Command } from "commander";
1+
import { Command, Option } from "commander";
22
import { VERSION } from "../version.js";
33
import { createDevbox } from "../commands/devbox/create.js";
44
import { listDevboxes } from "../commands/devbox/list.js";
55
import { deleteDevbox } from "../commands/devbox/delete.js";
66
import { execCommand } from "../commands/devbox/exec.js";
77
import { uploadFile } from "../commands/devbox/upload.js";
8+
import { runloopBaseDomain } from "./config.js";
9+
10+
function publicOption(description: string): Option {
11+
const opt = new Option("--public", description);
12+
if (runloopBaseDomain() === "runloop.ai") {
13+
opt.hideHelp();
14+
}
15+
return opt;
16+
}
817

918
/**
1019
* Creates and configures the Commander program with all commands.
@@ -657,7 +666,7 @@ export function createProgram(): Command {
657666
"--content-type <type>",
658667
"Content type: unspecified|text|binary|gzip|tar|tgz",
659668
)
660-
.option("--public", "Make object publicly accessible")
669+
.addOption(publicOption("Make object publicly accessible"))
661670
.option(
662671
"-o, --output [format]",
663672
"Output format: text|json|yaml (default: text)",
@@ -1210,6 +1219,7 @@ export function createProgram(): Command {
12101219
"--setup-commands <commands...>",
12111220
"Setup commands to run after installation",
12121221
)
1222+
.addOption(publicOption("Make agent publicly accessible"))
12131223
.option(
12141224
"-o, --output [format]",
12151225
"Output format: text|json|yaml (default: text)",

0 commit comments

Comments
 (0)