From be9e10d2fce50fa5e374f9e7d8e46b315040b5fa Mon Sep 17 00:00:00 2001 From: mimihalescu Date: Tue, 12 May 2026 11:09:40 +0300 Subject: [PATCH] feat: add set-url command to update specUrl in api-config.json Allows updating the upstream API spec URL stored in S3 without manually downloading, editing, and re-uploading api-config.json. Co-Authored-By: Claude Sonnet 4.6 --- src/commands/set-url.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/commands/set-url.ts diff --git a/src/commands/set-url.ts b/src/commands/set-url.ts new file mode 100644 index 0000000..fb97544 --- /dev/null +++ b/src/commands/set-url.ts @@ -0,0 +1,32 @@ +import { Args } from '@oclif/core' +import { S3 } from '../storage/s3' +import BaseCommand from '../base/base-command' +import ui from '../services/ui' + +export default class SetUrl extends BaseCommand { + static description = 'update the API spec URL in api-config.json' + + static examples = [ + '$ codex set-url https://api.example.com/swagger.json', + ] + + static flags = { ...BaseCommand.flags } + + static args = { + url: Args.string({ + required: true, + description: 'new API spec URL', + }) + } + + async run() { + const storage = new S3() + const apiConfig = await storage.getApiConfig() + const oldUrl = apiConfig.specUrl + + apiConfig.specUrl = this.args.url + await storage.writeApiConfig(apiConfig) + + ui.info(`spec URL updated: ${oldUrl} → ${this.args.url}`) + } +}