UNPKG

humanlayer

Version:

typescript client for humanlayer.dev

44 lines (43 loc) 1.55 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.main = main; const cloud_1 = require("./cloud"); async function main() { const command = process.argv[2]; if (command === 'info') { const apiKey = process.env.HUMANLAYER_API_KEY; const apiBase = process.env.HUMANLAYER_API_BASE; if (!apiKey) { console.error('Error: HUMANLAYER_API_KEY environment variable is required'); process.exit(1); } try { const connection = new cloud_1.HumanLayerCloudConnection(apiKey, apiBase); const projectInfo = await connection.getProjectInfo(); console.log('Project Information:'); console.log(`Name: ${projectInfo.name}`); console.log(`Slug: ${projectInfo.slug}`); if (projectInfo.organization) { console.log(`Organization: ${projectInfo.organization}`); } } catch (error) { if (error instanceof Error) { console.error('Error:', error.message); } else { console.error('An unknown error occurred'); } process.exit(1); } } else { console.log('Available commands:'); console.log(' info Show information about the current project'); } } // Only run the CLI when this file is being executed directly if (require.main === module || process.env.NODE_ENV === 'test') { main().catch(console.error); }