From d5d011881993f7ee9522641d6be33a387c290da4 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Sun, 15 Feb 2026 08:39:04 -0500 Subject: [PATCH 01/18] feat: Add registry developer account registration command - Add 'flb register' command for creating Registry Developer Accounts - Interactive prompts for username, email, password, and name - Input validation for username format and password length - Calls /~registry/v1/developer-account/register API endpoint - Provides clear success/error messages - Guides users to login after successful registration --- index.js | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ace79d8..60ed342 100755 --- a/index.js +++ b/index.js @@ -721,7 +721,102 @@ async function versionBump (options) { } } -// Command to handle login +// Command to handle registration +async function registerCommand(options) { + const registrationApi = 'https://api.fleetbase.io/~registry/v1/developer-account/register'; + + try { + // Collect registration information + const answers = await prompt([ + { + type: 'input', + name: 'username', + message: 'Username:', + initial: options.username, + skip: !!options.username, + validate: (value) => { + if (!value || value.length < 3) { + return 'Username must be at least 3 characters'; + } + if (!/^[a-zA-Z0-9_-]+$/.test(value)) { + return 'Username can only contain letters, numbers, hyphens, and underscores'; + } + return true; + } + }, + { + type: 'input', + name: 'email', + message: 'Email:', + initial: options.email, + skip: !!options.email, + validate: (value) => { + if (!value || !value.includes('@')) { + return 'Please enter a valid email address'; + } + return true; + } + }, + { + type: 'password', + name: 'password', + message: 'Password:', + skip: !!options.password, + validate: (value) => { + if (!value || value.length < 8) { + return 'Password must be at least 8 characters'; + } + return true; + } + }, + { + type: 'input', + name: 'name', + message: 'Full Name (optional):', + initial: options.name + } + ]); + + const registrationData = { + username: options.username || answers.username, + email: options.email || answers.email, + password: options.password || answers.password, + name: options.name || answers.name || undefined + }; + + console.log('\nRegistering account...'); + + // Make API call to register + const response = await axios.post(registrationApi, registrationData); + + if (response.data.status === 'success') { + console.log('\nāœ“ Account created successfully!'); + console.log('āœ“ Please check your email to verify your account.'); + console.log(`\nāœ“ Once verified, you can login with: flb login -u ${registrationData.username}`); + } else { + console.error('Registration failed:', response.data.message || 'Unknown error'); + process.exit(1); + } + } catch (error) { + if (error.response && error.response.data) { + const errorData = error.response.data; + if (errorData.errors) { + console.error('\nRegistration failed with the following errors:'); + Object.keys(errorData.errors).forEach(field => { + errorData.errors[field].forEach(message => { + console.error(` - ${field}: ${message}`); + }); + }); + } else { + console.error('Registration failed:', errorData.message || 'Unknown error'); + } + } else { + console.error('Registration failed:', error.message); + } + process.exit(1); + } +} + function loginCommand (options) { const npmLogin = require('npm-cli-login'); const username = options.username; @@ -875,6 +970,15 @@ program .option('--pre-release [identifier]', 'Add pre-release identifier') .action(versionBump); +program + .command('register') + .description('Register a new Registry Developer Account') + .option('-u, --username ', 'Username for the registry') + .option('-e, --email ', 'Email address') + .option('-p, --password ', 'Password') + .option('-n, --name ', 'Your full name (optional)') + .action(registerCommand); + program .command('login') .description('Log in to the Fleetbase registry') From 79a214867ac73a7872b63e989890fdaed2dcb4a8 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Mon, 23 Feb 2026 14:51:37 +0800 Subject: [PATCH 02/18] v0.0.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 84efe6e..963204a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fleetbase/cli", - "version": "0.0.3", + "version": "0.0.4", "description": "CLI tool for managing Fleetbase Extensions", "repository": "https://github.com/fleetbase/fleetbase", "license": "AGPL-3.0-or-later", From e47167ed97982aaf57f56bac9f90731fb5e14b88 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 01:57:11 -0500 Subject: [PATCH 03/18] feat: Add install-fleetbase command (merged with register command) This commit adds the install-fleetbase command functionality on top of the dev-v0.0.4 branch which includes the register command. Both commands now coexist: - register: Register a new Registry Developer Account - install-fleetbase: Install Fleetbase using Docker The install command includes: - Interactive prompts for host, environment, and directory - Automatic APP_KEY generation - Docker compose configuration - Console environment file updates - Deployment automation --- index.js | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) mode change 100755 => 100644 index.js diff --git a/index.js b/index.js old mode 100755 new mode 100644 index 60ed342..a867c85 --- a/index.js +++ b/index.js @@ -817,6 +817,199 @@ async function registerCommand(options) { } } +// Command to install Fleetbase via Docker +async function installFleetbaseCommand(options) { + const crypto = require('crypto'); + const os = require('os'); + + console.log('\nšŸš€ Fleetbase Installation\n'); + + try { + // Collect installation parameters + const answers = await prompt([ + { + type: 'input', + name: 'host', + message: 'Enter host or IP address to bind to:', + initial: options.host || 'localhost', + validate: (value) => { + if (!value) { + return 'Host is required'; + } + return true; + } + }, + { + type: 'select', + name: 'environment', + message: 'Choose environment:', + initial: options.environment === 'production' ? 1 : 0, + choices: [ + { title: 'Development', value: 'development' }, + { title: 'Production', value: 'production' } + ] + }, + { + type: 'input', + name: 'directory', + message: 'Installation directory:', + initial: options.directory || process.cwd(), + validate: (value) => { + if (!value) { + return 'Directory is required'; + } + return true; + } + } + ]); + + const host = options.host || answers.host; + const environment = options.environment || answers.environment; + const directory = options.directory || answers.directory; + + // Determine configuration based on environment + const useHttps = environment === 'production'; + const appDebug = environment === 'development'; + const scSecure = environment === 'production'; + const schemeApi = useHttps ? 'https' : 'http'; + const schemeConsole = useHttps ? 'https' : 'http'; + + console.log(`\nšŸ“‹ Configuration:`); + console.log(` Host: ${host}`); + console.log(` Environment: ${environment}`); + console.log(` Directory: ${directory}`); + console.log(` HTTPS: ${useHttps}`); + + // Check if directory exists and has Fleetbase files + if (!await fs.pathExists(directory)) { + console.error(`\nāœ– Directory does not exist: ${directory}`); + console.log('\nā„¹ļø Please clone the Fleetbase repository first:'); + console.log(' git clone https://github.com/fleetbase/fleetbase.git'); + process.exit(1); + } + + const dockerComposePath = path.join(directory, 'docker-compose.yml'); + if (!await fs.pathExists(dockerComposePath)) { + console.error(`\nāœ– docker-compose.yml not found in ${directory}`); + console.log('\nā„¹ļø Please ensure you are in the Fleetbase root directory.'); + process.exit(1); + } + + // Generate APP_KEY + console.log('\nā³ Generating APP_KEY...'); + const appKey = 'base64:' + crypto.randomBytes(32).toString('base64'); + console.log('āœ” APP_KEY generated'); + + // Create docker-compose.override.yml + console.log('ā³ Creating docker-compose.override.yml...'); + const overrideContent = `services: + application: + environment: + APP_KEY: "${appKey}" + CONSOLE_HOST: "${schemeConsole}://${host}:4200" + ENVIRONMENT: "${environment}" + APP_DEBUG: "${appDebug}" +`; + const overridePath = path.join(directory, 'docker-compose.override.yml'); + await fs.writeFile(overridePath, overrideContent); + console.log('āœ” docker-compose.override.yml created'); + + // Create console/fleetbase.config.json (for development runtime config) + console.log('ā³ Creating console/fleetbase.config.json...'); + const configDir = path.join(directory, 'console'); + await fs.ensureDir(configDir); + const configContent = { + API_HOST: `${schemeApi}://${host}:8000`, + SOCKETCLUSTER_HOST: host, + SOCKETCLUSTER_PORT: '38000', + SOCKETCLUSTER_SECURE: scSecure + }; + const configPath = path.join(configDir, 'fleetbase.config.json'); + await fs.writeJson(configPath, configContent, { spaces: 2 }); + console.log('āœ” console/fleetbase.config.json created'); + + // Update console environment files (.env.development and .env.production) + console.log('ā³ Updating console environment files...'); + const environmentsDir = path.join(configDir, 'environments'); + + // Update .env.development + const envDevelopmentContent = `API_HOST=http://${host}:8000 +API_NAMESPACE=int/v1 +SOCKETCLUSTER_PATH=/socketcluster/ +SOCKETCLUSTER_HOST=${host} +SOCKETCLUSTER_SECURE=false +SOCKETCLUSTER_PORT=38000 +OSRM_HOST=https://router.project-osrm.org +`; + const envDevelopmentPath = path.join(environmentsDir, '.env.development'); + await fs.writeFile(envDevelopmentPath, envDevelopmentContent); + + // Update .env.production + const envProductionContent = `API_HOST=https://${host}:8000 +API_NAMESPACE=int/v1 +API_SECURE=true +SOCKETCLUSTER_PATH=/socketcluster/ +SOCKETCLUSTER_HOST=${host} +SOCKETCLUSTER_SECURE=true +SOCKETCLUSTER_PORT=38000 +OSRM_HOST=https://router.project-osrm.org +`; + const envProductionPath = path.join(environmentsDir, '.env.production'); + await fs.writeFile(envProductionPath, envProductionContent); + + console.log('āœ” Console environment files updated'); + + // Start Docker containers + console.log('\nā³ Starting Fleetbase containers...'); + console.log(' This may take a few minutes on first run...\n'); + + exec('docker compose up -d', { cwd: directory, maxBuffer: maxBuffer }, async (error, stdout, stderr) => { + if (error) { + console.error(`\nāœ– Error starting containers: ${error.message}`); + if (stderr) console.error(stderr); + process.exit(1); + } + + console.log(stdout); + console.log('āœ” Containers started'); + + // Wait for database + console.log('\nā³ Waiting for database to be ready...'); + await new Promise(resolve => setTimeout(resolve, 15000)); // Wait 15 seconds + console.log('āœ” Database should be ready'); + + // Run deploy script + console.log('\nā³ Running deployment script...'); + exec('docker compose exec -T application bash -c "./deploy.sh"', { cwd: directory, maxBuffer: maxBuffer }, (deployError, deployStdout, deployStderr) => { + if (deployError) { + console.error(`\nāœ– Error during deployment: ${deployError.message}`); + if (deployStderr) console.error(deployStderr); + console.log('\nā„¹ļø You may need to run the deployment manually:'); + console.log(' docker compose exec application bash -c "./deploy.sh"'); + } else { + console.log(deployStdout); + console.log('āœ” Deployment complete'); + } + + // Restart containers to ensure all changes are applied + exec('docker compose up -d', { cwd: directory }, () => { + console.log('\nšŸ Fleetbase is up!'); + console.log(` API → ${schemeApi}://${host}:8000`); + console.log(` Console → ${schemeConsole}://${host}:4200\n`); + console.log('ā„¹ļø Default credentials:'); + console.log(' Email: admin@fleetbase.io'); + console.log(' Password: password\n'); + }); + }); + }); + } catch (error) { + console.error('\nāœ– Installation failed:', error.message); + process.exit(1); + } +} + + + function loginCommand (options) { const npmLogin = require('npm-cli-login'); const username = options.username; @@ -979,6 +1172,14 @@ program .option('-n, --name ', 'Your full name (optional)') .action(registerCommand); +program + .command('install-fleetbase') + .description('Install Fleetbase using Docker') + .option('--host ', 'Host or IP address to bind to (default: localhost)') + .option('--environment ', 'Environment: development or production (default: development)') + .option('--directory ', 'Installation directory (default: current directory)') + .action(installFleetbaseCommand); + program .command('login') .description('Log in to the Fleetbase registry') From 7d9233fbaf7ae3aafef6c4881c547caaa7f1d1d9 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 02:17:10 -0500 Subject: [PATCH 04/18] fix: Restore executable permission on index.js --- index.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 index.js diff --git a/index.js b/index.js old mode 100644 new mode 100755 From e63a888cf2353456176a236a5a838aef26324e7e Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 02:32:56 -0500 Subject: [PATCH 05/18] feat: Auto-clone Fleetbase repository if not present The install-fleetbase command now automatically clones the Fleetbase repository into the target directory if docker-compose.yml is not found. This improves the user experience by eliminating the need to manually clone the repository before running the install command. Changes: - Automatically detects if Fleetbase files are missing - Clones repository using 'git clone' if needed - Creates target directory if it doesn't exist - Provides clear feedback during the cloning process - Gracefully handles clone failures with helpful error messages --- index.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index a867c85..41b7d0f 100755 --- a/index.js +++ b/index.js @@ -881,18 +881,29 @@ async function installFleetbaseCommand(options) { console.log(` HTTPS: ${useHttps}`); // Check if directory exists and has Fleetbase files - if (!await fs.pathExists(directory)) { - console.error(`\nāœ– Directory does not exist: ${directory}`); - console.log('\nā„¹ļø Please clone the Fleetbase repository first:'); - console.log(' git clone https://github.com/fleetbase/fleetbase.git'); - process.exit(1); - } - const dockerComposePath = path.join(directory, 'docker-compose.yml'); - if (!await fs.pathExists(dockerComposePath)) { - console.error(`\nāœ– docker-compose.yml not found in ${directory}`); - console.log('\nā„¹ļø Please ensure you are in the Fleetbase root directory.'); - process.exit(1); + const needsClone = !await fs.pathExists(dockerComposePath); + + if (needsClone) { + console.log('\nā³ Fleetbase repository not found, cloning...'); + + // Ensure parent directory exists + await fs.ensureDir(directory); + + // Clone the repository + const { execSync } = require('child_process'); + try { + execSync('git clone https://github.com/fleetbase/fleetbase.git .', { + cwd: directory, + stdio: 'inherit' + }); + console.log('āœ” Repository cloned successfully'); + } catch (error) { + console.error('\nāœ– Failed to clone repository:', error.message); + console.log('\nā„¹ļø You can manually clone with:'); + console.log(' git clone https://github.com/fleetbase/fleetbase.git'); + process.exit(1); + } } // Generate APP_KEY From 117da69c5fc6736f7f1ad9638af74ef9cf83bd87 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 04:35:30 -0500 Subject: [PATCH 06/18] feat: Add --host parameter to register command The register command now accepts a --host parameter to allow users to register against self-hosted Fleetbase instances instead of only the default api.fleetbase.io. Usage: flb register --host myinstance.com flb register -h myinstance.com Changes: - Added --host/-h option to register command - Defaults to api.fleetbase.io if not specified - Dynamically builds registration API URL based on host - Updates login suggestion to include --host if used during registration --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 41b7d0f..b672f8b 100755 --- a/index.js +++ b/index.js @@ -723,7 +723,8 @@ async function versionBump (options) { // Command to handle registration async function registerCommand(options) { - const registrationApi = 'https://api.fleetbase.io/~registry/v1/developer-account/register'; + const host = options.host || 'api.fleetbase.io'; + const registrationApi = `https://${host}/~registry/v1/developer-account/register`; try { // Collect registration information @@ -792,7 +793,8 @@ async function registerCommand(options) { if (response.data.status === 'success') { console.log('\nāœ“ Account created successfully!'); console.log('āœ“ Please check your email to verify your account.'); - console.log(`\nāœ“ Once verified, you can login with: flb login -u ${registrationData.username}`); + const loginCmd = options.host ? `flb login -u ${registrationData.username} --host ${options.host}` : `flb login -u ${registrationData.username}`; + console.log(`\nāœ“ Once verified, you can login with: ${loginCmd}`); } else { console.error('Registration failed:', response.data.message || 'Unknown error'); process.exit(1); @@ -1181,6 +1183,7 @@ program .option('-e, --email ', 'Email address') .option('-p, --password ', 'Password') .option('-n, --name ', 'Your full name (optional)') + .option('-h, --host ', 'API host (default: api.fleetbase.io)') .action(registerCommand); program From d7e9e88e658298526b17474f73541d9d16f3ae13 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 04:51:10 -0500 Subject: [PATCH 07/18] fix: Support full URL with protocol in --host parameter The --host parameter now accepts full URLs with protocol (http:// or https://) instead of hardcoding https. This allows users to register against local development instances using http://localhost:8000. Changes: - Accept full URL: https://api.fleetbase.io or http://localhost:8000 - Auto-add https:// if protocol is missing (backward compatible) - Updated option description to clarify full URL format Examples: flb register --host https://api.fleetbase.io flb register --host http://localhost:8000 flb register --host myinstance.com (defaults to https://) --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b672f8b..b03a30c 100755 --- a/index.js +++ b/index.js @@ -723,8 +723,10 @@ async function versionBump (options) { // Command to handle registration async function registerCommand(options) { - const host = options.host || 'api.fleetbase.io'; - const registrationApi = `https://${host}/~registry/v1/developer-account/register`; + const host = options.host || 'https://api.fleetbase.io'; + // Ensure host has protocol, add https:// if missing + const apiHost = host.startsWith('http://') || host.startsWith('https://') ? host : `https://${host}`; + const registrationApi = `${apiHost}/~registry/v1/developer-account/register`; try { // Collect registration information @@ -1183,7 +1185,7 @@ program .option('-e, --email ', 'Email address') .option('-p, --password ', 'Password') .option('-n, --name ', 'Your full name (optional)') - .option('-h, --host ', 'API host (default: api.fleetbase.io)') + .option('-h, --host ', 'API host with protocol (default: https://api.fleetbase.io)') .action(registerCommand); program From 88f85643bee3e755f0e1a29e86bf6d20f5116932 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 04:55:05 -0500 Subject: [PATCH 08/18] fix: Handle both array and string error formats in register command Fixed TypeError when API returns error messages as strings instead of arrays. The error handling now properly handles both formats: - Array: ['error message 1', 'error message 2'] - String: 'error message' This prevents crashes when displaying validation errors from the API. --- index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b03a30c..22470a4 100755 --- a/index.js +++ b/index.js @@ -807,9 +807,15 @@ async function registerCommand(options) { if (errorData.errors) { console.error('\nRegistration failed with the following errors:'); Object.keys(errorData.errors).forEach(field => { - errorData.errors[field].forEach(message => { - console.error(` - ${field}: ${message}`); - }); + const fieldErrors = errorData.errors[field]; + // Handle both array and string error formats + if (Array.isArray(fieldErrors)) { + fieldErrors.forEach(message => { + console.error(` - ${field}: ${message}`); + }); + } else { + console.error(` - ${field}: ${fieldErrors}`); + } }); } else { console.error('Registration failed:', errorData.message || 'Unknown error'); From 037434b79744d1588571c5705d7728a13ccd7539 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 05:01:18 -0500 Subject: [PATCH 09/18] debug: Add detailed logging to register command Added debug logging to help diagnose network request issues: - Log the constructed API endpoint URL - Log the request data being sent - Log detailed error information including error codes - Log when no response is received from server This will help identify if: - The URL is being constructed correctly - The request is actually being made - There are network connectivity issues - The server is responding --- index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.js b/index.js index 22470a4..c56d5ed 100755 --- a/index.js +++ b/index.js @@ -788,6 +788,8 @@ async function registerCommand(options) { }; console.log('\nRegistering account...'); + console.log(`API Endpoint: ${registrationApi}`); + console.log(`Request Data:`, JSON.stringify(registrationData, null, 2)); // Make API call to register const response = await axios.post(registrationApi, registrationData); @@ -802,6 +804,12 @@ async function registerCommand(options) { process.exit(1); } } catch (error) { + console.error('\n[DEBUG] Error caught:', error.message); + if (error.code) console.error('[DEBUG] Error code:', error.code); + if (error.request && !error.response) { + console.error('[DEBUG] No response received from server'); + console.error('[DEBUG] Request was made to:', registrationApi); + } if (error.response && error.response.data) { const errorData = error.response.data; if (errorData.errors) { From b71c14c39ddd194807ab2ae7deac73f7a8914ac3 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 20:42:14 -0500 Subject: [PATCH 10/18] feat: Add verify command and improve registration UX Added new 'flb verify' command to verify developer account emails: - Interactive prompts for email and verification code - Supports --host parameter for self-hosted instances - Clear success/error messages Updated registration success message: - Shows verification code was sent - Displays exact verify command to run - Guides user through next steps This makes the verification flow much clearer for users. --- index.js | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index c56d5ed..d9cbf0c 100755 --- a/index.js +++ b/index.js @@ -796,9 +796,12 @@ async function registerCommand(options) { if (response.data.status === 'success') { console.log('\nāœ“ Account created successfully!'); - console.log('āœ“ Please check your email to verify your account.'); - const loginCmd = options.host ? `flb login -u ${registrationData.username} --host ${options.host}` : `flb login -u ${registrationData.username}`; - console.log(`\nāœ“ Once verified, you can login with: ${loginCmd}`); + console.log('āœ“ A verification code has been sent to your email.'); + console.log('\nšŸ‘‰ Next step: Verify your email address'); + const verifyCmd = `flb verify -e ${registrationData.email}` + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : ''); + console.log(` Run: ${verifyCmd}`); + const loginCmd = `flb login -u ${registrationData.username}` + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : ''); + console.log(`\nāœ“ After verification, login with: ${loginCmd}`); } else { console.error('Registration failed:', response.data.message || 'Unknown error'); process.exit(1); @@ -835,6 +838,65 @@ async function registerCommand(options) { } } +// Command to verify developer account email +async function verifyCommand(options) { + console.log('\nšŸ“§ Verify Your Registry Developer Account\n'); + + try { + // Collect verification parameters + const answers = await prompt([ + { + type: 'input', + name: 'email', + message: 'Email address:', + initial: options.email, + validate: (value) => value ? true : 'Email is required' + }, + { + type: 'input', + name: 'code', + message: 'Verification code (from email):', + initial: options.code, + validate: (value) => value ? true : 'Verification code is required' + } + ]); + + const email = options.email || answers.email; + const code = options.code || answers.code; + const host = options.host || 'https://api.fleetbase.io'; + + // Ensure host has protocol + const apiHost = host.startsWith('http://') || host.startsWith('https://') + ? host + : `https://${host}`; + const verificationApi = `${apiHost}/~registry/v1/developer-account/verify`; + + console.log('\nVerifying account...'); + + // Make API call to verify + const response = await axios.post(verificationApi, { + email: email, + code: code + }); + + if (response.data.status === 'success') { + console.log('\nāœ“ Email verified successfully!'); + console.log('āœ“ You can now login with: flb login -u ' + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); + } else { + console.error('Verification failed:', response.data.message || 'Unknown error'); + process.exit(1); + } + } catch (error) { + if (error.response && error.response.data) { + const errorData = error.response.data; + console.error('\nVerification failed:', errorData.message || 'Unknown error'); + } else { + console.error('\nVerification failed:', error.message); + } + process.exit(1); + } +} + // Command to install Fleetbase via Docker async function installFleetbaseCommand(options) { const crypto = require('crypto'); @@ -1202,6 +1264,14 @@ program .option('-h, --host ', 'API host with protocol (default: https://api.fleetbase.io)') .action(registerCommand); +program + .command('verify') + .description('Verify your Registry Developer Account email') + .option('-e, --email ', 'Email address') + .option('-c, --code ', 'Verification code from email') + .option('-h, --host ', 'API host with protocol (default: https://api.fleetbase.io)') + .action(verifyCommand); + program .command('install-fleetbase') .description('Install Fleetbase using Docker') From 09765b400081dd2850ffb422bb7e70f321ef4912 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 20:57:12 -0500 Subject: [PATCH 11/18] fix: Skip prompts when verify options provided and improve error messages Fixed two UX issues with the verify command: 1. Skip prompts when options are provided - If -e and -c are passed, don't prompt the user - Much better UX when copy/pasting from email 2. Better error handling and debugging - Show actual error messages instead of 'Unknown error' - Added debug logging for API endpoint, request data, and response - Helps diagnose verification issues Now users can simply copy/paste the command from their email and it works without any prompts. --- index.js | 66 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/index.js b/index.js index d9cbf0c..041e6ca 100755 --- a/index.js +++ b/index.js @@ -843,28 +843,34 @@ async function verifyCommand(options) { console.log('\nšŸ“§ Verify Your Registry Developer Account\n'); try { - // Collect verification parameters - const answers = await prompt([ - { - type: 'input', - name: 'email', - message: 'Email address:', - initial: options.email, - validate: (value) => value ? true : 'Email is required' - }, - { - type: 'input', - name: 'code', - message: 'Verification code (from email):', - initial: options.code, - validate: (value) => value ? true : 'Verification code is required' - } - ]); - - const email = options.email || answers.email; - const code = options.code || answers.code; + let email = options.email; + let code = options.code; const host = options.host || 'https://api.fleetbase.io'; + // Only prompt if values not provided + if (!email || !code) { + const answers = await prompt([ + { + type: 'input', + name: 'email', + message: 'Email address:', + initial: email, + skip: () => !!email, + validate: (value) => value ? true : 'Email is required' + }, + { + type: 'input', + name: 'code', + message: 'Verification code (from email):', + initial: code, + skip: () => !!code, + validate: (value) => value ? true : 'Verification code is required' + } + ]); + email = email || answers.email; + code = code || answers.code; + } + // Ensure host has protocol const apiHost = host.startsWith('http://') || host.startsWith('https://') ? host @@ -872,6 +878,9 @@ async function verifyCommand(options) { const verificationApi = `${apiHost}/~registry/v1/developer-account/verify`; console.log('\nVerifying account...'); + console.log(`API Endpoint: ${verificationApi}`); + console.log(`Email: ${email}`); + console.log(`Code: ${code}`); // Make API call to verify const response = await axios.post(verificationApi, { @@ -879,17 +888,28 @@ async function verifyCommand(options) { code: code }); + console.log('\n[DEBUG] Response status:', response.status); + console.log('[DEBUG] Response data:', JSON.stringify(response.data, null, 2)); + if (response.data.status === 'success') { console.log('\nāœ“ Email verified successfully!'); console.log('āœ“ You can now login with: flb login -u ' + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); } else { - console.error('Verification failed:', response.data.message || 'Unknown error'); + console.error('\nVerification failed:', response.data.message || 'Unknown error'); process.exit(1); } } catch (error) { - if (error.response && error.response.data) { + console.error('\n[DEBUG] Error caught:', error.message); + if (error.code) console.error('[DEBUG] Error code:', error.code); + if (error.response) { + console.error('[DEBUG] Response status:', error.response.status); + console.error('[DEBUG] Response data:', JSON.stringify(error.response.data, null, 2)); const errorData = error.response.data; - console.error('\nVerification failed:', errorData.message || 'Unknown error'); + console.error('\nVerification failed:', errorData.message || errorData.error || 'Unknown error'); + } else if (error.request) { + console.error('[DEBUG] No response received from server'); + console.error('[DEBUG] Request was made to:', verificationApi); + console.error('\nVerification failed: No response from server'); } else { console.error('\nVerification failed:', error.message); } From 0e44a575ee2bd4f4e044a4156795ff68c7b80b0b Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 21:02:44 -0500 Subject: [PATCH 12/18] fix: Handle array-based error responses in verify command Fixed error message display when API returns errors as an array: - Check for errorData.errors array and join messages - Now shows actual error instead of 'Unknown error' Example: {"errors": ["Invalid or expired verification code."]} Now displays: "Invalid or expired verification code." instead of "Unknown error" --- index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 041e6ca..dd32ee7 100755 --- a/index.js +++ b/index.js @@ -905,7 +905,18 @@ async function verifyCommand(options) { console.error('[DEBUG] Response status:', error.response.status); console.error('[DEBUG] Response data:', JSON.stringify(error.response.data, null, 2)); const errorData = error.response.data; - console.error('\nVerification failed:', errorData.message || errorData.error || 'Unknown error'); + + // Handle different error response formats + let errorMessage = 'Unknown error'; + if (errorData.message) { + errorMessage = errorData.message; + } else if (errorData.error) { + errorMessage = errorData.error; + } else if (errorData.errors && Array.isArray(errorData.errors)) { + errorMessage = errorData.errors.join(', '); + } + + console.error('\nVerification failed:', errorMessage); } else if (error.request) { console.error('[DEBUG] No response received from server'); console.error('[DEBUG] Request was made to:', verificationApi); From 26cdd4a3e6d8ddbe2b012d610f2fa7241785119e Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 21:25:26 -0500 Subject: [PATCH 13/18] feat: Add resend-verification command for expired codes Added new 'flb resend-verification' command to request a new verification code if the original expires or is lost. Features: - Interactive prompt for email or use -e flag - Supports --host parameter for self-hosted instances - Clear instructions on what to do after resending - Proper error handling for all response formats Usage: flb resend-verification -e email@example.com flb resend-verification -e email@example.com --host http://localhost:8000 This solves the problem of users being stuck if their verification code expires (1 hour expiration). --- index.js | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/index.js b/index.js index dd32ee7..458eb69 100755 --- a/index.js +++ b/index.js @@ -928,6 +928,73 @@ async function verifyCommand(options) { } } +// Command to resend verification code +async function resendVerificationCommand(options) { + console.log('\nšŸ“§ Resend Verification Code\n'); + + try { + let email = options.email; + const host = options.host || 'https://api.fleetbase.io'; + + // Prompt for email if not provided + if (!email) { + const answers = await prompt([ + { + type: 'input', + name: 'email', + message: 'Email address:', + validate: (value) => value ? true : 'Email is required' + } + ]); + email = answers.email; + } + + // Ensure host has protocol + const apiHost = host.startsWith('http://') || host.startsWith('https://') + ? host + : `https://${host}`; + const resendApi = `${apiHost}/~registry/v1/developer-account/resend-verification`; + + console.log('\nResending verification code...'); + + // Make API call to resend + const response = await axios.post(resendApi, { + email: email + }); + + if (response.data.status === 'success') { + console.log('\nāœ“ Verification code sent!'); + console.log('āœ“ Check your email for the new verification code.'); + console.log('\nšŸ‘‰ Once you receive it, run:'); + console.log(` flb verify -e ${email}` + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); + } else { + console.error('\nFailed to resend:', response.data.message || 'Unknown error'); + process.exit(1); + } + } catch (error) { + if (error.response) { + const errorData = error.response.data; + + // Handle different error response formats + let errorMessage = 'Unknown error'; + if (errorData.message) { + errorMessage = errorData.message; + } else if (errorData.error) { + errorMessage = errorData.error; + } else if (errorData.errors && Array.isArray(errorData.errors)) { + errorMessage = errorData.errors.join(', '); + } + + console.error('\nFailed to resend:', errorMessage); + } else if (error.request) { + console.error('\nFailed to resend: No response from server'); + } else { + console.error('\nFailed to resend:', error.message); + } + process.exit(1); + } +} + // Command to install Fleetbase via Docker async function installFleetbaseCommand(options) { const crypto = require('crypto'); @@ -1303,6 +1370,13 @@ program .option('-h, --host ', 'API host with protocol (default: https://api.fleetbase.io)') .action(verifyCommand); +program + .command('resend-verification') + .description('Resend verification code to your email') + .option('-e, --email ', 'Email address') + .option('-h, --host ', 'API host with protocol (default: https://api.fleetbase.io)') + .action(resendVerificationCommand); + program .command('install-fleetbase') .description('Install Fleetbase using Docker') From c1facb8beeee3cabc55b90a75b56ce21e506c0ad Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 22:05:21 -0500 Subject: [PATCH 14/18] Update verify command to display registry token after verification --- index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 458eb69..c331d78 100755 --- a/index.js +++ b/index.js @@ -893,7 +893,16 @@ async function verifyCommand(options) { if (response.data.status === 'success') { console.log('\nāœ“ Email verified successfully!'); - console.log('āœ“ You can now login with: flb login -u ' + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); + + // Display registry token if provided + if (response.data.token) { + console.log('\nšŸ”‘ Your Registry Token:'); + console.log(` ${response.data.token}`); + console.log('\nšŸ’” Save this token securely! You\'ll need it to authenticate with the registry.'); + console.log(' Use: flb set-auth ' + response.data.token + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); + } + + console.log('\nāœ“ You can now login with: flb login -u ' + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); } else { console.error('\nVerification failed:', response.data.message || 'Unknown error'); process.exit(1); From a1eb17f0e91ae0fa469f0cbfab82568ee6ae5e7b Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 22:19:28 -0500 Subject: [PATCH 15/18] feat: Add generate-token command for creating/regenerating registry tokens --- index.js | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/index.js b/index.js index c331d78..582242a 100755 --- a/index.js +++ b/index.js @@ -937,6 +937,87 @@ async function verifyCommand(options) { } } +// Command to generate or regenerate registry token +async function generateTokenCommand(options) { + console.log('\nšŸ”‘ Generate Registry Token\n'); + + try { + let email = options.email; + let password = options.password; + const host = options.host || 'https://api.fleetbase.io'; + + // Prompt for credentials if not provided + if (!email || !password) { + const answers = await prompt([ + { + type: 'input', + name: 'email', + message: 'Email address:', + initial: email, + skip: () => !!email, + validate: (value) => value ? true : 'Email is required' + }, + { + type: 'password', + name: 'password', + message: 'Password:', + skip: () => !!password, + validate: (value) => value ? true : 'Password is required' + } + ]); + email = email || answers.email; + password = password || answers.password; + } + + // Ensure host has protocol + const apiHost = host.startsWith('http://') || host.startsWith('https://') + ? host + : `https://${host}`; + const generateTokenApi = `${apiHost}/~registry/v1/developer-account/generate-token`; + + console.log('\nGenerating token...'); + + // Make API call to generate token + const response = await axios.post(generateTokenApi, { + email: email, + password: password + }); + + if (response.data.status === 'success') { + console.log('\nāœ“ ' + response.data.message); + console.log('\nšŸ”‘ Your Registry Token:'); + console.log(` ${response.data.token}`); + console.log('\nšŸ’” Save this token securely! You\'ll need it to authenticate with the registry.'); + console.log(' Use: flb set-auth ' + response.data.token + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); + console.log('\nāš ļø Note: This replaces any previously generated token.'); + } else { + console.error('\nToken generation failed:', response.data.message || 'Unknown error'); + process.exit(1); + } + } catch (error) { + if (error.response) { + const errorData = error.response.data; + + // Handle different error response formats + let errorMessage = 'Unknown error'; + if (errorData.message) { + errorMessage = errorData.message; + } else if (errorData.error) { + errorMessage = errorData.error; + } else if (errorData.errors && Array.isArray(errorData.errors)) { + errorMessage = errorData.errors.join(', '); + } + + console.error('\nToken generation failed:', errorMessage); + } else if (error.request) { + console.error('\nToken generation failed: No response from server'); + } else { + console.error('\nToken generation failed:', error.message); + } + process.exit(1); + } +} + // Command to resend verification code async function resendVerificationCommand(options) { console.log('\nšŸ“§ Resend Verification Code\n'); @@ -1386,6 +1467,14 @@ program .option('-h, --host ', 'API host with protocol (default: https://api.fleetbase.io)') .action(resendVerificationCommand); +program + .command('generate-token') + .description('Generate or regenerate your registry authentication token') + .option('-e, --email ', 'Email address') + .option('-p, --password ', 'Password') + .option('-h, --host ', 'API host with protocol (default: https://api.fleetbase.io)') + .action(generateTokenCommand); + program .command('install-fleetbase') .description('Install Fleetbase using Docker') From 13f8ea4e1d7d2d5d85247e6013a87591ecd8a1a6 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 22:31:17 -0500 Subject: [PATCH 16/18] fix: Correct set-auth to use --registry parameter and update install completion message --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 582242a..d98e711 100755 --- a/index.js +++ b/index.js @@ -899,7 +899,7 @@ async function verifyCommand(options) { console.log('\nšŸ”‘ Your Registry Token:'); console.log(` ${response.data.token}`); console.log('\nšŸ’” Save this token securely! You\'ll need it to authenticate with the registry.'); - console.log(' Use: flb set-auth ' + response.data.token + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); + console.log(' Use: flb set-auth ' + response.data.token + (host !== 'https://api.fleetbase.io' ? ` --registry ${host}` : '')); } console.log('\nāœ“ You can now login with: flb login -u ' + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); @@ -988,7 +988,7 @@ async function generateTokenCommand(options) { console.log('\nšŸ”‘ Your Registry Token:'); console.log(` ${response.data.token}`); console.log('\nšŸ’” Save this token securely! You\'ll need it to authenticate with the registry.'); - console.log(' Use: flb set-auth ' + response.data.token + (host !== 'https://api.fleetbase.io' ? ` --host ${host}` : '')); + console.log(' Use: flb set-auth ' + response.data.token + (host !== 'https://api.fleetbase.io' ? ` --registry ${host}` : '')); console.log('\nāš ļø Note: This replaces any previously generated token.'); } else { console.error('\nToken generation failed:', response.data.message || 'Unknown error'); @@ -1275,9 +1275,9 @@ OSRM_HOST=https://router.project-osrm.org console.log('\nšŸ Fleetbase is up!'); console.log(` API → ${schemeApi}://${host}:8000`); console.log(` Console → ${schemeConsole}://${host}:4200\n`); - console.log('ā„¹ļø Default credentials:'); - console.log(' Email: admin@fleetbase.io'); - console.log(' Password: password\n'); + console.log('ā„¹ļø Next steps:'); + console.log(' 1. Open the Console URL in your browser'); + console.log(' 2. Complete the onboarding process to create your admin account\n'); }); }); }); From 1a758a2e281242e93e92d9fda47547a7d6cd5870 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 22:53:00 -0500 Subject: [PATCH 17/18] chore: Remove debug console logs from register and verify commands --- index.js | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/index.js b/index.js index d98e711..771cc18 100755 --- a/index.js +++ b/index.js @@ -788,8 +788,6 @@ async function registerCommand(options) { }; console.log('\nRegistering account...'); - console.log(`API Endpoint: ${registrationApi}`); - console.log(`Request Data:`, JSON.stringify(registrationData, null, 2)); // Make API call to register const response = await axios.post(registrationApi, registrationData); @@ -807,12 +805,6 @@ async function registerCommand(options) { process.exit(1); } } catch (error) { - console.error('\n[DEBUG] Error caught:', error.message); - if (error.code) console.error('[DEBUG] Error code:', error.code); - if (error.request && !error.response) { - console.error('[DEBUG] No response received from server'); - console.error('[DEBUG] Request was made to:', registrationApi); - } if (error.response && error.response.data) { const errorData = error.response.data; if (errorData.errors) { @@ -878,9 +870,6 @@ async function verifyCommand(options) { const verificationApi = `${apiHost}/~registry/v1/developer-account/verify`; console.log('\nVerifying account...'); - console.log(`API Endpoint: ${verificationApi}`); - console.log(`Email: ${email}`); - console.log(`Code: ${code}`); // Make API call to verify const response = await axios.post(verificationApi, { @@ -888,9 +877,6 @@ async function verifyCommand(options) { code: code }); - console.log('\n[DEBUG] Response status:', response.status); - console.log('[DEBUG] Response data:', JSON.stringify(response.data, null, 2)); - if (response.data.status === 'success') { console.log('\nāœ“ Email verified successfully!'); @@ -908,11 +894,7 @@ async function verifyCommand(options) { process.exit(1); } } catch (error) { - console.error('\n[DEBUG] Error caught:', error.message); - if (error.code) console.error('[DEBUG] Error code:', error.code); if (error.response) { - console.error('[DEBUG] Response status:', error.response.status); - console.error('[DEBUG] Response data:', JSON.stringify(error.response.data, null, 2)); const errorData = error.response.data; // Handle different error response formats @@ -927,8 +909,6 @@ async function verifyCommand(options) { console.error('\nVerification failed:', errorMessage); } else if (error.request) { - console.error('[DEBUG] No response received from server'); - console.error('[DEBUG] Request was made to:', verificationApi); console.error('\nVerification failed: No response from server'); } else { console.error('\nVerification failed:', error.message); From 4f006ff5f3ef21bb83c04e78259203c5e2106ec5 Mon Sep 17 00:00:00 2001 From: Manus AI Date: Mon, 23 Feb 2026 23:04:11 -0500 Subject: [PATCH 18/18] docs: Update README with developer account commands and registration guide --- README.md | 283 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 237 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 8d8deca..0c56e4c 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,15 @@ FLB (Fleetbase CLI) is a command-line interface tool designed for managing Fleet ## Features -- Publish Fleetbase Extensions to a specified registry. -- Unpublish Extensions from the registry. -- Automatically convert `composer.json` to `package.json` for PHP packages. -- Scaffold new Fleetbase extensions. -- Set registry token to a fleetbase instance. -- Install and Uninstall extensions. -- Flexible registry configuration. +- Register and manage Registry Developer Accounts for self-hosted instances +- Publish Fleetbase Extensions to a specified registry +- Unpublish Extensions from the registry +- Install Fleetbase using Docker +- Automatically convert `composer.json` to `package.json` for PHP packages +- Scaffold new Fleetbase extensions +- Set registry token to a Fleetbase instance +- Install and Uninstall extensions +- Flexible registry configuration ## Installation @@ -20,8 +22,148 @@ To install FLB, run the following command: npm install -g @fleetbase/cli ``` +## Quick Start: Developer Account Registration + +If you're using a self-hosted Fleetbase instance and want to publish or install extensions, you'll need to register a Registry Developer Account. Follow these steps: + +### Step 1: Register Your Account + +```bash +flb register --host localhost:8000 +``` + +You'll be prompted for: +- **Username**: Your desired username (alphanumeric, hyphens, and underscores only) +- **Email**: Your email address +- **Password**: A secure password (minimum 8 characters) +- **Name**: Your display name (optional) + +### Step 2: Verify Your Email + +Check your email for a verification code, then run: + +```bash +flb verify -e your@email.com -c 123456 --host localhost:8000 +``` + +Or use the command provided in the verification email. Upon successful verification, you'll receive your registry token. + +### Step 3: Set Your Registry Token + +Use the token from the verification step: + +```bash +flb set-auth flb_your_token_here --registry http://localhost:8000 +``` + +### Step 4: You're Ready! + +You can now publish extensions, install extensions, and manage your Fleetbase instance through the CLI. + +**Note:** If you need to regenerate your token later, use: + +```bash +flb generate-token -e your@email.com --host localhost:8000 +``` + ## Usage +### Registry Developer Account Commands + +#### Register a Developer Account + +Create a new Registry Developer Account for publishing and installing extensions on self-hosted instances. + +```bash +flb register +``` + +**Options:** +- `-u, --username `: Username for your account +- `-e, --email `: Email address +- `-p, --password `: Password (minimum 8 characters) +- `-n, --name `: Display name (optional) +- `-h, --host `: API host (default: `https://api.fleetbase.io`) + +**Example:** +```bash +flb register --host localhost:8000 +flb register -u myusername -e my@email.com -p mypassword --host localhost:8000 +``` + +#### Verify Email Address + +Verify your email address using the code sent to your email. + +```bash +flb verify +``` + +**Options:** +- `-e, --email `: Email address +- `-c, --code `: Verification code from email +- `-h, --host `: API host (default: `https://api.fleetbase.io`) + +**Example:** +```bash +flb verify -e my@email.com -c 123456 --host localhost:8000 +``` + +#### Resend Verification Code + +Request a new verification code if the previous one expired. + +```bash +flb resend-verification +``` + +**Options:** +- `-e, --email `: Email address +- `-h, --host `: API host (default: `https://api.fleetbase.io`) + +**Example:** +```bash +flb resend-verification -e my@email.com --host localhost:8000 +``` + +#### Generate or Regenerate Registry Token + +Generate a new registry authentication token or regenerate an existing one. Useful for existing accounts created before automatic token generation, or if you need to regenerate your token for security reasons. + +```bash +flb generate-token +``` + +**Options:** +- `-e, --email `: Email address +- `-p, --password `: Password +- `-h, --host `: API host (default: `https://api.fleetbase.io`) + +**Example:** +```bash +flb generate-token -e my@email.com --host localhost:8000 +``` + +**Note:** This command requires your account to be verified. Each time you generate a token, it replaces the previous one. + +### Installing Fleetbase + +Install Fleetbase using Docker with a single command. + +```bash +flb install-fleetbase +``` + +**Options:** +- `--host `: Host or IP address to bind to (default: `localhost`) +- `--environment `: Environment: `development` or `production` (default: `development`) +- `--directory `: Installation directory (default: current directory) + +**Example:** +```bash +flb install-fleetbase --host 0.0.0.0 --environment production --directory /opt/fleetbase +``` + ### Publishing a Extension To publish a extension, navigate to the extension directory and run: @@ -46,31 +188,44 @@ flb unpublish [extension] ### Setup Registry Auth Token -To install purchased extensions you must setup authorization first which is linked to your Fleetbase account. You can generate a registry token at [https://console.fleetbase.io/extensions/developers/credentials](https://console.fleetbase.io/extensions/developers/credentials) +To install purchased extensions you must setup authorization first which is linked to your Fleetbase account. For cloud users, you can generate a registry token at [https://console.fleetbase.io/extensions/developers/credentials](https://console.fleetbase.io/extensions/developers/credentials). For self-hosted users, use the `flb register` and `flb verify` commands to get your token. To setup registry auth use: ```bash -flb set-auth [token] --path /fleetbase +flb set-auth [token] ``` -- `-p, --path`: (Optional) The path to the fleetbase instance directory. Defaults to the current directory. +**Options:** +- `-p, --path `: Path of the Fleetbase instance to install setup for (default: `.`) +- `-r, --registry `: Registry URL the credentials are for (default: `https://registry.fleetbase.io`) + +**Example:** +```bash +flb set-auth flb_your_token_here --registry http://localhost:8000 +``` ### Login to the Fleetbase Registry Login to the Fleetbase registry. This command authenticates you with the Fleetbase registry by saving your credentials to your local `.npmrc` file. ```bash -flb login [options] +flb login ``` -- `-u, --username `: Username for the registry. -- `-p, --password `: Password for the registry. -- `-e, --email `: Email associated with your account. -- `-r, --registry `: Registry URL (default: `https://registry.fleetbase.io`). -- `--scope `: Scope for the registry (optional). -- `--quotes `: Quotes option for `npm-cli-login` (optional). -- `--config-path `: Path to the npm config file (optional). +**Options:** +- `-u, --username `: Username for the registry +- `-p, --password `: Password for the registry +- `-e, --email `: Email associated with your account +- `-r, --registry `: Registry URL (default: `https://registry.fleetbase.io`) +- `--scope `: Scope for the registry (optional) +- `--quotes `: Quotes option for `npm-cli-login` (optional) +- `--config-path `: Path to the npm config file (optional) + +**Example:** +```bash +flb login -u myusername -r http://localhost:8000 +``` ### Scaffolding a Extension @@ -82,36 +237,49 @@ To scaffold a extension, use: flb scaffold ``` -- `-p, --path`: The path to place the scaffold extension. -- `-n, --name`: The name of the extension to scaffold. -- `-d, --description`: The description of the extension to scaffold. -- `-a, --author`: The name of the extension author. -- `-e, --email`: The email of the extension author. -- `-k, --keywords`: The keywords of the extension to scaffold. -- `-n, --namespace`: The PHP Namespace of the extension to scaffold. -- `-r, --repo`: The Repository URL of the extension to scaffold. +**Options:** +- `-p, --path`: The path to place the scaffold extension +- `-n, --name`: The name of the extension to scaffold +- `-d, --description`: The description of the extension to scaffold +- `-a, --author`: The name of the extension author +- `-e, --email`: The email of the extension author +- `-k, --keywords`: The keywords of the extension to scaffold +- `-n, --namespace`: The PHP Namespace of the extension to scaffold +- `-r, --repo`: The Repository URL of the extension to scaffold ### Installing a Extension To install a extension, use: ```bash -flb install [extension] --path /fleetbase +flb install [extension] ``` -- `[extension]`: The name of the extension to install. -- `-p, --path`: (Optional) The path to the fleetbase instance directory. Defaults to the current directory. +**Options:** +- `[extension]`: The name of the extension to install +- `-p, --path`: (Optional) The path to the fleetbase instance directory. Defaults to the current directory + +**Example:** +```bash +flb install @fleetbase/storefront-api --path /opt/fleetbase +``` ### Uninstalling a Extension To uninstall a extension, use: ```bash -flb uninstall [extension] --path /fleetbase +flb uninstall [extension] ``` -- `[extension]`: The name of the extension to install. -- `-p, --path`: (Optional) The path to the fleetbase instance directory. Defaults to the current directory. +**Options:** +- `[extension]`: The name of the extension to uninstall +- `-p, --path`: (Optional) The path to the fleetbase instance directory. Defaults to the current directory + +**Example:** +```bash +flb uninstall @fleetbase/storefront-api --path /opt/fleetbase +``` ### Bundling a Extension @@ -127,10 +295,11 @@ or to bundle and upload the created bundle, use: flb bundle --upload ``` -- `-p, --path `: Path of the Fleetbase extension (default: `.`). -- `--upload`: After bundling, upload the bundle to the Fleetbase registry using your authentication token. -- `--auth-token `: Auth token for uploading the bundle (used with `--upload` option). -- `-r, --registry `: Registry URL (default: `https://registry.fleetbase.io`). +**Options:** +- `-p, --path `: Path of the Fleetbase extension (default: `.`) +- `--upload`: After bundling, upload the bundle to the Fleetbase registry using your authentication token +- `--auth-token `: Auth token for uploading the bundle (used with `--upload` option) +- `-r, --registry `: Registry URL (default: `https://registry.fleetbase.io`) ### Uploading a Extension Bundle @@ -140,10 +309,11 @@ To upload an extension bundle, use: flb bundle-upload ``` -- `[bundleFile]`: Path to the bundle file to upload. If not provided, it will look for the bundle in the current directory. -- `-p, --path `: Path where the bundle is located (default: `.`). -- `--auth-token `: Auth token for uploading the bundle. If not provided, the token will be read from the `.npmrc` file. -- `-r, --registry `: Registry URL (default: `https://registry.fleetbase.io`). +**Options:** +- `[bundleFile]`: Path to the bundle file to upload. If not provided, it will look for the bundle in the current directory +- `-p, --path `: Path where the bundle is located (default: `.`) +- `--auth-token `: Auth token for uploading the bundle. If not provided, the token will be read from the `.npmrc` file +- `-r, --registry `: Registry URL (default: `https://registry.fleetbase.io`) ### Version Bump and Extension @@ -153,11 +323,12 @@ To bump the version on an extension, use: flb version-bump ``` -- `-p, --path `: Path of the Fleetbase extension (default: `.`). -- `--major`: Bump major version (e.g., `1.0.0` → `2.0.0`). -- `--minor`: Bump minor version (e.g., `1.0.0` → `1.1.0`). -- `--patch`: Bump patch version (e.g., `1.0.0` → `1.0.1`). This is the default if no flag is provided. -- `--pre-release [identifier]`: Add a pre-release identifier (e.g., `1.0.0` → `1.0.0-beta`). +**Options:** +- `-p, --path `: Path of the Fleetbase extension (default: `.`) +- `--major`: Bump major version (e.g., `1.0.0` → `2.0.0`) +- `--minor`: Bump minor version (e.g., `1.0.0` → `1.1.0`) +- `--patch`: Bump patch version (e.g., `1.0.0` → `1.0.1`). This is the default if no flag is provided +- `--pre-release [identifier]`: Add a pre-release identifier (e.g., `1.0.0` → `1.0.0-beta`) ### Setting a Custom Registry @@ -172,7 +343,27 @@ flb unpublish -r http://my-registry.com FLB can be configured via command-line options. The most common options include: -- `-r, --registry [url]`: Specify a custom registry URL. +- `-r, --registry [url]`: Specify a custom registry URL +- `-h, --host [url]`: Specify the API host for developer account operations + +## Self-Hosted vs Cloud + +### Self-Hosted Users + +If you're running Fleetbase on your own infrastructure: + +1. Use `flb register` to create a Registry Developer Account +2. Verify your email with `flb verify` +3. Use the provided token with `flb set-auth` +4. Specify `--host` parameter for all commands to point to your instance + +### Cloud Users + +If you're using Fleetbase Cloud (console.fleetbase.io): + +1. Generate a registry token from the Console at [Extensions > Developers > Credentials](https://console.fleetbase.io/extensions/developers/credentials) +2. Use the token with `flb set-auth` +3. No need to specify `--host` parameter (defaults to cloud) ## Contributing