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
3 changes: 2 additions & 1 deletion src/api/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ export async function searchComparisons(client, name, filters = {}) {
throw new VizzlyError('name is required and must be a non-empty string');
}

let { branch, limit = 50, offset = 0 } = filters;
let { branch, project, limit = 50, offset = 0 } = filters;
let params = { name, limit: String(limit), offset: String(offset) };
if (branch) params.branch = branch;
if (project) params.project = project;

let endpoint = buildEndpointWithParams('/api/sdk/comparisons/search', params);
return client.request(endpoint);
Expand Down
69 changes: 3 additions & 66 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ import { loginCommand, validateLoginOptions } from './commands/login.js';
import { logoutCommand, validateLogoutOptions } from './commands/logout.js';
import { orgsCommand, validateOrgsOptions } from './commands/orgs.js';
import { previewCommand, validatePreviewOptions } from './commands/preview.js';
import {
projectListCommand,
projectRemoveCommand,
projectSelectCommand,
projectTokenCommand,
validateProjectOptions,
} from './commands/project.js';
import {
projectsCommand,
validateProjectsOptions,
Expand Down Expand Up @@ -138,17 +131,6 @@ const formatHelp = (cmd, helper) => {
title: 'Account',
names: ['login', 'logout', 'whoami', 'orgs', 'projects'],
},
{
key: 'project',
icon: 'β–Έ',
title: 'Projects',
names: [
'project:select',
'project:list',
'project:token',
'project:remove',
],
},
];

let grouped = {
Expand All @@ -157,7 +139,6 @@ const formatHelp = (cmd, helper) => {
setup: [],
advanced: [],
auth: [],
project: [],
other: [],
};

Expand Down Expand Up @@ -644,6 +625,7 @@ program
'Filter by status (created, pending, processing, completed, failed)'
)
.option('--environment <env>', 'Filter by environment')
.option('-p, --project <slug>', 'Filter by project slug')
.option(
'--limit <n>',
'Maximum results to return (1-250)',
Expand All @@ -658,6 +640,7 @@ program
Examples:
$ vizzly builds # List recent builds
$ vizzly builds --branch main # Filter by branch
$ vizzly builds --project abc123 # Filter by project
$ vizzly builds --status completed # Filter by status
$ vizzly builds -b abc123-def456 # Get specific build by ID
$ vizzly builds -b abc123 --comparisons # Include comparisons
Expand Down Expand Up @@ -695,6 +678,7 @@ program
50
)
.option('--offset <n>', 'Skip first N results', val => parseInt(val, 10), 0)
.option('-p, --project <slug>', 'Filter by project slug')
.addHelpText(
'after',
`
Expand Down Expand Up @@ -1157,53 +1141,6 @@ program
await whoamiCommand(options, globalOptions);
});

program
.command('project:select')
.description('Configure project for current directory')
.option('--api-url <url>', 'API URL override')
.action(async options => {
const globalOptions = program.opts();

// Validate options
const validationErrors = validateProjectOptions(options);
if (validationErrors.length > 0) {
output.error('Validation errors:');
for (let error of validationErrors) {
output.printErr(` - ${error}`);
}
process.exit(1);
}

await projectSelectCommand(options, globalOptions);
});

program
.command('project:list')
.description('Show all configured projects')
.action(async options => {
const globalOptions = program.opts();

await projectListCommand(options, globalOptions);
});

program
.command('project:token')
.description('Show project token for current directory')
.action(async options => {
const globalOptions = program.opts();

await projectTokenCommand(options, globalOptions);
});

program
.command('project:remove')
.description('Remove project configuration for current directory')
.action(async options => {
const globalOptions = program.opts();

await projectRemoveCommand(options, globalOptions);
});

// Save user's PATH for menubar app (non-blocking, runs in background)
// This auto-configures the menubar app so it can find npx/node
saveUserPath().catch(() => {});
Expand Down
1 change: 1 addition & 0 deletions src/commands/builds.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export async function buildsCommand(
if (options.branch) filters.branch = options.branch;
if (options.status) filters.status = options.status;
if (options.environment) filters.environment = options.environment;
if (options.project) filters.project = options.project;

let response = await getBuilds(client, filters);
output.stopSpinner();
Expand Down
1 change: 1 addition & 0 deletions src/commands/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export async function comparisonsCommand(
output.startSpinner('Searching comparisons...');
let filters = {
branch: options.branch,
project: options.project,
limit: options.limit || 50,
offset: options.offset || 0,
};
Expand Down
24 changes: 0 additions & 24 deletions src/commands/config-cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
* Config command - query and display configuration
*/

import { resolve } from 'node:path';
import { loadConfig as defaultLoadConfig } from '../utils/config-loader.js';
import { getProjectMapping as defaultGetProjectMapping } from '../utils/global-config.js';
import * as defaultOutput from '../utils/output.js';

/**
Expand All @@ -22,7 +20,6 @@ export async function configCommand(
) {
let {
loadConfig = defaultLoadConfig,
getProjectMapping = defaultGetProjectMapping,
output = defaultOutput,
exit = code => process.exit(code),
} = deps;
Expand All @@ -41,10 +38,6 @@ export async function configCommand(
});
let configFile = config._configPath || null;

// Get project mapping if available
let currentDir = resolve(process.cwd());
let projectMapping = await getProjectMapping(currentDir);

// Build the config object to display
let displayConfig = {
server: config.server || { port: 47392, timeout: 30000 },
Expand Down Expand Up @@ -94,13 +87,6 @@ export async function configCommand(
output.data({
configFile,
config: displayConfig,
project: projectMapping
? {
name: projectMapping.projectName,
slug: projectMapping.projectSlug,
organization: projectMapping.organizationSlug,
}
: null,
});
output.cleanup();
return;
Expand All @@ -117,16 +103,6 @@ export async function configCommand(
}
output.blank();

// Project context if available
if (projectMapping) {
output.labelValue(
'Project',
`${projectMapping.projectName} (${projectMapping.projectSlug})`
);
output.labelValue('Organization', projectMapping.organizationSlug);
output.blank();
}

// Display configuration sections
displaySection(output, 'Server', displayConfig.server);
displaySection(output, 'Comparison', displayConfig.comparison);
Expand Down
Loading