Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
```
Expand All @@ -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
Expand All @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions src/commands/actiondialogfields/actiondialogfields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('actiondialogfields command', () => {
'node',
'test',
'create',
'--config',
'--json-config',
'{"name":"Reason"}',
]);

Expand All @@ -81,7 +81,7 @@ describe('actiondialogfields command', () => {
'test',
'update',
'1',
'--config',
'--json-config',
'{"required":true}',
]);

Expand Down
8 changes: 4 additions & 4 deletions src/commands/actiondialogfields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ const getCommand = new Command('get')

const createCommand = new Command('create')
.description('Create a new action dialog field')
.requiredOption('--config <json>', 'action dialog field configuration as JSON')
.requiredOption('--json-config <json>', '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)');
}
Comment on lines +57 to 60
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix stale option name in validation errors.

Line [59] and Line [79] still reference --config, but the command now uses --json-config. This gives incorrect guidance on failure.

Suggested patch
-        throw new Error('--config must be a JSON object (not null, array, or primitive)');
+        throw new Error('--json-config must be a JSON object (not null, array, or primitive)');
...
-        throw new Error('--config must be a JSON object (not null, array, or primitive)');
+        throw new Error('--json-config must be a JSON object (not null, array, or primitive)');

Also applies to: 77-80

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/actiondialogfields/index.ts` around lines 57 - 60, The
validation error messages still refer to the old flag name '--config' despite
calling validateJSON(options.jsonConfig, '--json-config'); update the thrown
Error string(s) to reference '--json-config' instead of '--config' (specifically
in the block checking config after validateJSON and the similar check around
lines 77-80), ensuring any user-facing text passed from
validateJSON/options.jsonConfig mentions '--json-config' consistently.

Expand All @@ -69,12 +69,12 @@ const createCommand = new Command('create')
const updateCommand = new Command('update')
.description('Update an action dialog field')
.argument('<id>', 'action dialog field ID', parsePositiveInt)
.requiredOption('--config <json>', 'action dialog field configuration as JSON')
.requiredOption('--json-config <json>', '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)');
}
Expand Down
12 changes: 6 additions & 6 deletions src/commands/datasources/datasources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('datasources command', () => {
'node',
'test',
'create',
'--config',
'--json-config',
'{"type":"clickhouse"}',
]);

Expand All @@ -97,7 +97,7 @@ describe('datasources command', () => {
'test',
'update',
'1',
'--config',
'--json-config',
'{"type":"clickhouse"}',
]);

Expand All @@ -121,7 +121,7 @@ describe('datasources command', () => {
'node',
'test',
'test',
'--config',
'--json-config',
'{"type":"clickhouse"}',
]);

Expand All @@ -133,7 +133,7 @@ describe('datasources command', () => {
'node',
'test',
'introspect',
'--config',
'--json-config',
'{"type":"clickhouse"}',
]);

Expand All @@ -146,7 +146,7 @@ describe('datasources command', () => {
'node',
'test',
'validate-query',
'--config',
'--json-config',
'{"query":"SELECT 1"}',
]);

Expand All @@ -158,7 +158,7 @@ describe('datasources command', () => {
'node',
'test',
'preview-query',
'--config',
'--json-config',
'{"query":"SELECT 1"}',
]);

Expand Down
24 changes: 12 additions & 12 deletions src/commands/datasources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ const getCommand = new Command('get')

const createCommand = new Command('create')
.description('Create a new datasource')
.requiredOption('--config <json>', 'datasource configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
const result = await coreCreateDatasource(client, { config });
console.error(chalk.green(`✓ Datasource created`));
printFormatted(result.data, globalOptions);
Expand All @@ -68,12 +68,12 @@ const createCommand = new Command('create')
const updateCommand = new Command('update')
.description('Update a datasource')
.argument('<id>', 'datasource ID', parseDatasourceId)
.requiredOption('--config <json>', 'datasource configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
const result = await coreUpdateDatasource(client, { id, config });
console.error(chalk.green(`✓ Datasource ${id} updated`));
printFormatted(result.data, globalOptions);
Expand All @@ -96,51 +96,51 @@ const archiveCommand = new Command('archive')

const testCommand = new Command('test')
.description('Test datasource connection')
.requiredOption('--config <json>', 'datasource configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
await coreTestDatasource(client, { config });
console.log(chalk.green(`✓ Datasource connection test passed`));
})
);

const introspectCommand = new Command('introspect')
.description('Introspect datasource schema')
.requiredOption('--config <json>', 'datasource configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
const result = await coreIntrospectDatasource(client, { config });
printFormatted(result.data, globalOptions);
})
);

const validateQueryCommand = new Command('validate-query')
.description('Validate a datasource query')
.requiredOption('--config <json>', 'query configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
await coreValidateDatasourceQuery(client, { config });
console.log(chalk.green(`✓ Datasource query is valid`));
})
);

const previewQueryCommand = new Command('preview-query')
.description('Preview a datasource query')
.requiredOption('--config <json>', 'query configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
const result = await corePreviewDatasourceQuery(client, { config });
printFormatted(result.data, globalOptions);
})
Expand Down
4 changes: 2 additions & 2 deletions src/commands/exportconfigs/exportconfigs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('export-configs command', () => {
'node',
'test',
'create',
'--config',
'--json-config',
'{"name":"test"}',
]);

Expand All @@ -84,7 +84,7 @@ describe('export-configs command', () => {
'test',
'update',
'1',
'--config',
'--json-config',
'{"name":"updated"}',
]);

Expand Down
8 changes: 4 additions & 4 deletions src/commands/exportconfigs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ const getCommand = new Command('get')

const createCommand = new Command('create')
.description('Create a new export configuration')
.requiredOption('--config <json>', 'export configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
const result = await coreCreateExportConfig(client, { config });
console.log(chalk.green(`✓ Export configuration created`));
printFormatted(result.data, globalOptions);
Expand All @@ -61,12 +61,12 @@ const createCommand = new Command('create')
const updateCommand = new Command('update')
.description('Update an export configuration')
.argument('<id>', 'export config ID', parseExportConfigId)
.requiredOption('--config <json>', 'export configuration as JSON')
.requiredOption('--json-config <json>', '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<string, unknown>;
const config = validateJSON(options.jsonConfig, '--json-config') as Record<string, unknown>;
const result = await coreUpdateExportConfig(client, { id, config });
console.log(chalk.green(`✓ Export configuration ${id} updated`));
printFormatted(result.data, globalOptions);
Expand Down
12 changes: 6 additions & 6 deletions src/commands/statistics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>',
'--json-config <json>',
'power analysis configuration as JSON (alternative to individual options)'
)
.option('--analysis-type <type>', 'analysis type (e.g., group_sequential)')
Expand All @@ -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 (
Expand All @@ -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)'
);
}
}
Expand Down
Loading
Loading