npm package: @hlos/cli
Description: HLOS CLI - Secrets management and AI assistant for developers
Author: HLOS
Latest version: 0.1.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @hlos/cli

**HLOS CLI** - Secrets management and AI assistant for developers.

*Hidden Layers for Open Secrets*

## Installation

```bash
npm install -g @hlos/cli
```

Or use with npx:

```bash
npx @hlos/cli --help
```

## Quick Start

```bash
# Authenticate with HLOS
hlos auth login

# Initialize your project
hlos init

# Set some secrets
hlos secrets set DATABASE_URL=postgres://localhost/myapp
hlos secrets set API_KEY=sk-abc123 --description "Production API key"

# Run your app with secrets injected
hlos run npm start
```

## Commands

### Authentication

```bash
# Log in via browser OAuth
hlos auth login

# Show current user
hlos auth whoami

# Log out
hlos auth logout
```

### Secrets Management

```bash
# List all secrets in current space
hlos secrets list

# List secrets in specific space
hlos secrets list --space space_abc123

# Set a secret
hlos secrets set DATABASE_URL=postgres://localhost/myapp
hlos secrets set API_KEY=sk-abc123 --description "Production API key"

# Get a secret value (raw output, great for piping)
hlos secrets get API_KEY
export API_KEY=$(hlos secrets get API_KEY)

# Delete a secret
hlos secrets delete OLD_API_KEY

# Export secrets
hlos secrets export > .env
hlos secrets export --format json > secrets.json
hlos secrets export --format shell  # Outputs: export KEY="value"
```

### Running Commands

```bash
# Run a command with secrets injected as environment variables
hlos run npm start
hlos run node server.js
hlos run -- docker-compose up -d

# Use specific space
hlos run --space space_abc123 npm test
```

### Project Initialization

```bash
# Interactive setup
hlos init

# Use specific space
hlos init --space space_abc123

# Import existing .env file
hlos init --import .env
```

### Configuration

```bash
# List all config
hlos config list

# Get config value
hlos config get apiUrl

# Set config value
hlos config set defaultSpace space_abc123
hlos config set apiUrl https://custom.hlos.com

# Reset all config
hlos config reset
```

## Project Configuration

Create an `hlos.yaml` file in your project root:

```yaml
space: space_abc123
# Optional: environment name
# env: production
```

This allows you to run commands without specifying `--space` every time.

## How It Works

1. **Authenticate**: `hlos auth login` opens your browser for secure OAuth authentication
2. **Configure**: `hlos init` links your project to an HLOS space
3. **Manage**: Use `hlos secrets` to manage your environment variables
4. **Run**: `hlos run <command>` fetches secrets and injects them as env vars

Your secrets are stored securely in HLOS and never touch your local filesystem (except temporarily in memory during command execution).

## Environment Variables

The CLI respects these environment variables:

- `HLOS_API_URL` - Override the API URL (default: https://hlos.ai)
- `HLOS_SPACE` - Default space ID

## Security

- Secrets are fetched over HTTPS and held only in memory
- OAuth tokens are stored in your OS keychain/credential store
- Secrets are never written to disk
- Each project can have its own space with isolated secrets

## Examples

### Basic Node.js Project

```bash
# Initialize
cd my-node-app
hlos init

# Add your secrets
hlos secrets set DATABASE_URL=postgres://user:pass@localhost/mydb
hlos secrets set JWT_SECRET=super-secret-key
hlos secrets set STRIPE_KEY=sk_test_...

# Run your app
hlos run npm start
```

### Docker Compose

```bash
# Export secrets to .env for Docker
hlos secrets export > .env

# Or run directly
hlos run docker-compose up
```

### CI/CD Integration

```bash
# In your CI script
npm install -g @hlos/cli
echo "$HLOS_TOKEN" | hlos auth token  # Future: direct token auth
hlos secrets export > .env
```

## Contributing

See the main [HLOS repository](https://github.com/hlos-ai/hlos) for contribution guidelines.

## License

MIT