diff --git a/README.md b/README.md index 5053bed..7a0e2fc 100644 --- a/README.md +++ b/README.md @@ -1217,7 +1217,7 @@ Statistical analysis tools for experiment planning. Aliases: `statistics`, `stats` ```bash -abs statistics power-matrix --config '{"split":[0.5,0.5],"metric_mean":100,"metric_variance":25,"metric_type":"count","powers":[0.8,0.9]}' +abs statistics power-matrix --json-config '{"split":[0.5,0.5],"metric_mean":100,"metric_variance":25,"metric_type":"count","powers":[0.8,0.9]}' ``` ### Storage configs @@ -1229,9 +1229,9 @@ Aliases: `storage-configs`, `storageconfigs` ```bash abs storage-configs list abs storage-configs get 1 -abs storage-configs create --config '{"type": "s3", ...}' -abs storage-configs update 1 --config '{"bucket": "new-bucket"}' -abs storage-configs test --config '{"type": "s3", ...}' +abs storage-configs create --json-config '{"type": "s3", ...}' +abs storage-configs update 1 --json-config '{"bucket": "new-bucket"}' +abs storage-configs test --json-config '{"type": "s3", ...}' ``` ### Action dialog fields @@ -1243,8 +1243,8 @@ Aliases: `action-dialog-fields`, `actiondialogfields` ```bash abs action-dialog-fields list abs action-dialog-fields get 1 -abs action-dialog-fields create --config '{"name": "Reason", "type": "text"}' -abs action-dialog-fields update 1 --config '{"required": true}' +abs action-dialog-fields create --json-config '{"name": "Reason", "type": "text"}' +abs action-dialog-fields update 1 --json-config '{"required": true}' ``` ### Platform configuration @@ -1280,13 +1280,13 @@ Aliases: `datasources`, `datasource`, `ds` ```bash abs datasources list abs datasources get 1 -abs datasources create --config '{"type": "postgres", ...}' -abs datasources update 1 --config '{"host": "new-host"}' +abs datasources create --json-config '{"type": "postgres", ...}' +abs datasources update 1 --json-config '{"host": "new-host"}' abs datasources archive 1 -abs datasources test --config '{"type": "postgres", ...}' -abs datasources introspect --config '{"type": "postgres", ...}' -abs datasources validate-query --config '{"query": "SELECT ..."}' -abs datasources preview-query --config '{"query": "SELECT ..."}' +abs datasources test --json-config '{"type": "postgres", ...}' +abs datasources introspect --json-config '{"type": "postgres", ...}' +abs datasources validate-query --json-config '{"query": "SELECT ..."}' +abs datasources preview-query --json-config '{"query": "SELECT ..."}' abs datasources set-default 1 abs datasources schema 1 ``` @@ -1300,8 +1300,8 @@ Aliases: `export-configs`, `exportconfigs`, `export-config` ```bash abs export-configs list abs export-configs get 1 -abs export-configs create --config '{"destination": "s3", ...}' -abs export-configs update 1 --config '{"schedule": "daily"}' +abs export-configs create --json-config '{"destination": "s3", ...}' +abs export-configs update 1 --json-config '{"schedule": "daily"}' abs export-configs archive 1 abs export-configs pause 1 abs export-configs histories 1 @@ -1317,8 +1317,8 @@ Aliases: `update-schedules`, `updateschedules` ```bash abs update-schedules list abs update-schedules get 1 -abs update-schedules create --config '{"interval": "1h"}' -abs update-schedules update 1 --config '{"interval": "30m"}' +abs update-schedules create --json-config '{"interval": "1h"}' +abs update-schedules update 1 --json-config '{"interval": "30m"}' abs update-schedules delete 1 ``` diff --git a/src/commands/actiondialogfields/actiondialogfields.test.ts b/src/commands/actiondialogfields/actiondialogfields.test.ts index cadef71..d41cf48 100644 --- a/src/commands/actiondialogfields/actiondialogfields.test.ts +++ b/src/commands/actiondialogfields/actiondialogfields.test.ts @@ -67,7 +67,7 @@ describe('actiondialogfields command', () => { 'node', 'test', 'create', - '--config', + '--json-config', '{"name":"Reason"}', ]); @@ -81,7 +81,7 @@ describe('actiondialogfields command', () => { 'test', 'update', '1', - '--config', + '--json-config', '{"required":true}', ]); diff --git a/src/commands/actiondialogfields/index.ts b/src/commands/actiondialogfields/index.ts index b249ade..53bec73 100644 --- a/src/commands/actiondialogfields/index.ts +++ b/src/commands/actiondialogfields/index.ts @@ -49,12 +49,12 @@ const getCommand = new Command('get') const createCommand = new Command('create') .description('Create a new action dialog field') - .requiredOption('--config ', 'action dialog field configuration as JSON') + .requiredOption('--json-config ', 'action dialog field configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(createCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config'); + const config = validateJSON(options.jsonConfig, '--json-config'); if (config === null || Array.isArray(config) || typeof config !== 'object') { throw new Error('--config must be a JSON object (not null, array, or primitive)'); } @@ -69,12 +69,12 @@ const createCommand = new Command('create') const updateCommand = new Command('update') .description('Update an action dialog field') .argument('', 'action dialog field ID', parsePositiveInt) - .requiredOption('--config ', 'action dialog field configuration as JSON') + .requiredOption('--json-config ', 'action dialog field configuration as JSON') .action( withErrorHandling(async (id: number, options) => { const globalOptions = getGlobalOptions(updateCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config'); + const config = validateJSON(options.jsonConfig, '--json-config'); if (config === null || Array.isArray(config) || typeof config !== 'object') { throw new Error('--config must be a JSON object (not null, array, or primitive)'); } diff --git a/src/commands/datasources/datasources.test.ts b/src/commands/datasources/datasources.test.ts index 2587271..e22e986 100644 --- a/src/commands/datasources/datasources.test.ts +++ b/src/commands/datasources/datasources.test.ts @@ -84,7 +84,7 @@ describe('datasources command', () => { 'node', 'test', 'create', - '--config', + '--json-config', '{"type":"clickhouse"}', ]); @@ -97,7 +97,7 @@ describe('datasources command', () => { 'test', 'update', '1', - '--config', + '--json-config', '{"type":"clickhouse"}', ]); @@ -121,7 +121,7 @@ describe('datasources command', () => { 'node', 'test', 'test', - '--config', + '--json-config', '{"type":"clickhouse"}', ]); @@ -133,7 +133,7 @@ describe('datasources command', () => { 'node', 'test', 'introspect', - '--config', + '--json-config', '{"type":"clickhouse"}', ]); @@ -146,7 +146,7 @@ describe('datasources command', () => { 'node', 'test', 'validate-query', - '--config', + '--json-config', '{"query":"SELECT 1"}', ]); @@ -158,7 +158,7 @@ describe('datasources command', () => { 'node', 'test', 'preview-query', - '--config', + '--json-config', '{"query":"SELECT 1"}', ]); diff --git a/src/commands/datasources/index.ts b/src/commands/datasources/index.ts index 7724885..0c2704d 100644 --- a/src/commands/datasources/index.ts +++ b/src/commands/datasources/index.ts @@ -53,12 +53,12 @@ const getCommand = new Command('get') const createCommand = new Command('create') .description('Create a new datasource') - .requiredOption('--config ', 'datasource configuration as JSON') + .requiredOption('--json-config ', 'datasource configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(createCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await coreCreateDatasource(client, { config }); console.error(chalk.green(`✓ Datasource created`)); printFormatted(result.data, globalOptions); @@ -68,12 +68,12 @@ const createCommand = new Command('create') const updateCommand = new Command('update') .description('Update a datasource') .argument('', 'datasource ID', parseDatasourceId) - .requiredOption('--config ', 'datasource configuration as JSON') + .requiredOption('--json-config ', 'datasource configuration as JSON') .action( withErrorHandling(async (id: DatasourceId, options) => { const globalOptions = getGlobalOptions(updateCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await coreUpdateDatasource(client, { id, config }); console.error(chalk.green(`✓ Datasource ${id} updated`)); printFormatted(result.data, globalOptions); @@ -96,12 +96,12 @@ const archiveCommand = new Command('archive') const testCommand = new Command('test') .description('Test datasource connection') - .requiredOption('--config ', 'datasource configuration as JSON') + .requiredOption('--json-config ', 'datasource configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(testCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; await coreTestDatasource(client, { config }); console.log(chalk.green(`✓ Datasource connection test passed`)); }) @@ -109,12 +109,12 @@ const testCommand = new Command('test') const introspectCommand = new Command('introspect') .description('Introspect datasource schema') - .requiredOption('--config ', 'datasource configuration as JSON') + .requiredOption('--json-config ', 'datasource configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(introspectCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await coreIntrospectDatasource(client, { config }); printFormatted(result.data, globalOptions); }) @@ -122,12 +122,12 @@ const introspectCommand = new Command('introspect') const validateQueryCommand = new Command('validate-query') .description('Validate a datasource query') - .requiredOption('--config ', 'query configuration as JSON') + .requiredOption('--json-config ', 'query configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(validateQueryCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; await coreValidateDatasourceQuery(client, { config }); console.log(chalk.green(`✓ Datasource query is valid`)); }) @@ -135,12 +135,12 @@ const validateQueryCommand = new Command('validate-query') const previewQueryCommand = new Command('preview-query') .description('Preview a datasource query') - .requiredOption('--config ', 'query configuration as JSON') + .requiredOption('--json-config ', 'query configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(previewQueryCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await corePreviewDatasourceQuery(client, { config }); printFormatted(result.data, globalOptions); }) diff --git a/src/commands/exportconfigs/exportconfigs.test.ts b/src/commands/exportconfigs/exportconfigs.test.ts index 9cc571f..ddcd1f3 100644 --- a/src/commands/exportconfigs/exportconfigs.test.ts +++ b/src/commands/exportconfigs/exportconfigs.test.ts @@ -71,7 +71,7 @@ describe('export-configs command', () => { 'node', 'test', 'create', - '--config', + '--json-config', '{"name":"test"}', ]); @@ -84,7 +84,7 @@ describe('export-configs command', () => { 'test', 'update', '1', - '--config', + '--json-config', '{"name":"updated"}', ]); diff --git a/src/commands/exportconfigs/index.ts b/src/commands/exportconfigs/index.ts index cd69e89..fb5accb 100644 --- a/src/commands/exportconfigs/index.ts +++ b/src/commands/exportconfigs/index.ts @@ -46,12 +46,12 @@ const getCommand = new Command('get') const createCommand = new Command('create') .description('Create a new export configuration') - .requiredOption('--config ', 'export configuration as JSON') + .requiredOption('--json-config ', 'export configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(createCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await coreCreateExportConfig(client, { config }); console.log(chalk.green(`✓ Export configuration created`)); printFormatted(result.data, globalOptions); @@ -61,12 +61,12 @@ const createCommand = new Command('create') const updateCommand = new Command('update') .description('Update an export configuration') .argument('', 'export config ID', parseExportConfigId) - .requiredOption('--config ', 'export configuration as JSON') + .requiredOption('--json-config ', 'export configuration as JSON') .action( withErrorHandling(async (id: ExportConfigId, options) => { const globalOptions = getGlobalOptions(updateCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await coreUpdateExportConfig(client, { id, config }); console.log(chalk.green(`✓ Export configuration ${id} updated`)); printFormatted(result.data, globalOptions); diff --git a/src/commands/statistics/index.ts b/src/commands/statistics/index.ts index 7ee5f3c..63dbd5e 100644 --- a/src/commands/statistics/index.ts +++ b/src/commands/statistics/index.ts @@ -196,10 +196,10 @@ Examples: --minimum-detectable-effects 0.05,0.10,0.15 --powers 0.8 # Raw JSON config (passed directly to the API) - abs stats power-matrix --config '{"sample_sizes":[2000,3000],...}'` + abs stats power-matrix --json-config '{"sample_sizes":[2000,3000],...}'` ) .option( - '--config ', + '--json-config ', 'power analysis configuration as JSON (alternative to individual options)' ) .option('--analysis-type ', 'analysis type (e.g., group_sequential)') @@ -226,8 +226,8 @@ Examples: const client = await getAPIClientFromOptions(globalOptions); let config: PowerMatrixConfig; - if (options.config) { - config = validateJSON(options.config, '--config') as PowerMatrixConfig; + if (options.jsonConfig) { + config = validateJSON(options.jsonConfig, '--json-config') as PowerMatrixConfig; } else { config = buildConfigFromOptions(options); if ( @@ -236,12 +236,12 @@ Examples: config.metric_variance === undefined ) { throw new Error( - 'Required: --metric-type, --metric-mean, and --metric-variance (or use --config with JSON)' + 'Required: --metric-type, --metric-mean, and --metric-variance (or use --json-config with JSON)' ); } if (!config.sample_sizes && !config.minimum_detectable_effects) { throw new Error( - 'Required: --sample-sizes or --minimum-detectable-effects (or use --config with JSON)' + 'Required: --sample-sizes or --minimum-detectable-effects (or use --json-config with JSON)' ); } } diff --git a/src/commands/statistics/statistics.test.ts b/src/commands/statistics/statistics.test.ts index 18a6618..6172a29 100644 --- a/src/commands/statistics/statistics.test.ts +++ b/src/commands/statistics/statistics.test.ts @@ -50,7 +50,7 @@ describe('statistics command', () => { 'node', 'test', 'power-matrix', - '--config', + '--json-config', '{"split":[0.5,0.5],"metric_mean":100,"metric_variance":25,"metric_type":"count","powers":[0.8],"sample_sizes":[2000,3000,4000]}', ]); @@ -76,7 +76,7 @@ describe('statistics command', () => { 'node', 'test', 'power-matrix', - '--config', + '--json-config', '{"sample_sizes":[2000,3000,4000],"powers":[0.8],"metric_mean":10,"metric_variance":10000,"metric_type":"goal_count","participants_per_week":1000}', ]); @@ -94,7 +94,7 @@ describe('statistics command', () => { 'node', 'test', 'power-matrix', - '--config', + '--json-config', '{"sample_sizes":[5000,10000],"powers":[0.8],"metric_mean":10,"metric_variance":10000,"metric_type":"goal_count"}', ]); @@ -281,7 +281,7 @@ describe('statistics command', () => { 'node', 'test', 'power-matrix', - '--config', + '--json-config', '{"sample_sizes":[2000],"powers":[0.8],"metric_mean":10,"metric_variance":10000,"metric_type":"goal_count"}', ]); @@ -303,7 +303,7 @@ describe('statistics command', () => { 'node', 'test', 'power-matrix', - '--config', + '--json-config', '{"sample_sizes":[2000,3000],"powers":[0.8,0.9],"metric_mean":10,"metric_variance":10000,"metric_type":"goal_count"}', ]); @@ -323,7 +323,7 @@ describe('statistics command', () => { 'node', 'test', 'power-matrix', - '--config', + '--json-config', '{"minimum_detectable_effects":[0.05,0.10],"powers":[0.8],"metric_mean":10,"metric_variance":10000,"metric_type":"goal_count"}', ]); diff --git a/src/commands/storageconfigs/index.ts b/src/commands/storageconfigs/index.ts index e430ee8..ae4f656 100644 --- a/src/commands/storageconfigs/index.ts +++ b/src/commands/storageconfigs/index.ts @@ -42,12 +42,12 @@ const getCommand = new Command('get') const createCommand = new Command('create') .description('Create a new storage config') - .requiredOption('--config ', 'storage config configuration as JSON') + .requiredOption('--json-config ', 'storage config configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(createCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await createStorageConfig(client, { config }); console.log(chalk.green(`✓ Storage config created`)); printFormatted(result.data, globalOptions); @@ -57,12 +57,12 @@ const createCommand = new Command('create') const updateCommand = new Command('update') .description('Update a storage config') .argument('', 'storage config ID', (v: string) => parseInt(v, 10)) - .requiredOption('--config ', 'storage config configuration as JSON') + .requiredOption('--json-config ', 'storage config configuration as JSON') .action( withErrorHandling(async (id: number, options) => { const globalOptions = getGlobalOptions(updateCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await updateStorageConfig(client, { id, config }); console.log(chalk.green(`✓ Storage config ${id} updated`)); printFormatted(result.data, globalOptions); @@ -71,12 +71,12 @@ const updateCommand = new Command('update') const testCommand = new Command('test') .description('Test storage config connection') - .requiredOption('--config ', 'storage config configuration as JSON') + .requiredOption('--json-config ', 'storage config configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(testCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; await testStorageConfig(client, { config }); console.log(chalk.green(`✓ Storage config connection test passed`)); }) diff --git a/src/commands/storageconfigs/storageconfigs.test.ts b/src/commands/storageconfigs/storageconfigs.test.ts index 0b0e15c..bfa5e47 100644 --- a/src/commands/storageconfigs/storageconfigs.test.ts +++ b/src/commands/storageconfigs/storageconfigs.test.ts @@ -64,7 +64,13 @@ describe('storage-configs command', () => { }); it('should create a storage config', async () => { - await storageConfigsCommand.parseAsync(['node', 'test', 'create', '--config', '{"type":"s3"}']); + await storageConfigsCommand.parseAsync([ + 'node', + 'test', + 'create', + '--json-config', + '{"type":"s3"}', + ]); expect(mockClient.createStorageConfig).toHaveBeenCalledWith({ type: 's3' }); expect(printFormatted).toHaveBeenCalled(); @@ -76,7 +82,7 @@ describe('storage-configs command', () => { 'test', 'update', '1', - '--config', + '--json-config', '{"bucket":"new"}', ]); @@ -85,7 +91,13 @@ describe('storage-configs command', () => { }); it('should test a storage config', async () => { - await storageConfigsCommand.parseAsync(['node', 'test', 'test', '--config', '{"type":"s3"}']); + await storageConfigsCommand.parseAsync([ + 'node', + 'test', + 'test', + '--json-config', + '{"type":"s3"}', + ]); expect(mockClient.testStorageConfig).toHaveBeenCalledWith({ type: 's3' }); expect(consoleSpy).toHaveBeenCalledWith( diff --git a/src/commands/updateschedules/index.ts b/src/commands/updateschedules/index.ts index 63079fe..d24f820 100644 --- a/src/commands/updateschedules/index.ts +++ b/src/commands/updateschedules/index.ts @@ -43,12 +43,12 @@ const getCommand = new Command('get') const createCommand = new Command('create') .description('Create a new update schedule') - .requiredOption('--config ', 'schedule configuration as JSON') + .requiredOption('--json-config ', 'schedule configuration as JSON') .action( withErrorHandling(async (options) => { const globalOptions = getGlobalOptions(createCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await createUpdateSchedule(client, { config }); console.log(chalk.green(`✓ Update schedule created`)); printFormatted(result.data, globalOptions); @@ -58,12 +58,12 @@ const createCommand = new Command('create') const updateCommand = new Command('update') .description('Update an update schedule') .argument('', 'update schedule ID', parseUpdateScheduleId) - .requiredOption('--config ', 'schedule configuration as JSON') + .requiredOption('--json-config ', 'schedule configuration as JSON') .action( withErrorHandling(async (id: UpdateScheduleId, options) => { const globalOptions = getGlobalOptions(updateCommand); const client = await getAPIClientFromOptions(globalOptions); - const config = validateJSON(options.config, '--config') as Record; + const config = validateJSON(options.jsonConfig, '--json-config') as Record; const result = await updateUpdateSchedule(client, { id, config }); console.log(chalk.green(`✓ Update schedule ${id} updated`)); printFormatted(result.data, globalOptions); diff --git a/src/commands/updateschedules/updateschedules.test.ts b/src/commands/updateschedules/updateschedules.test.ts index 48c0966..262e76a 100644 --- a/src/commands/updateschedules/updateschedules.test.ts +++ b/src/commands/updateschedules/updateschedules.test.ts @@ -68,7 +68,7 @@ describe('update-schedules command', () => { 'node', 'test', 'create', - '--config', + '--json-config', '{"name":"daily"}', ]); @@ -81,7 +81,7 @@ describe('update-schedules command', () => { 'test', 'update', '1', - '--config', + '--json-config', '{"name":"weekly"}', ]);