{"_id":"@armynante/fieldwork-deploy","name":"@armynante/fieldwork-deploy","dist-tags":{"latest":"0.1.14"},"versions":{"0.1.14":{"name":"@armynante/fieldwork-deploy","version":"0.1.14","description":"CLI for managing Fargate deployments with domain purchasing, multi-environment support, and optional services","type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"bin":{"fw-deploy":"dist/cli/index.js"},"scripts":{"build":"bun build ./src/index.ts --outdir ./dist --target bun && bun build ./src/cli/index.ts --outdir ./dist/cli --target bun && cp -r ./src/templates ./dist/","build:types":"tsc --emitDeclarationOnly --outDir ./dist","test":"bun run --bun vitest","test:watch":"bun run --bun vitest --watch","test:bail":"bun run --bun vitest --bail 1","test:unit":"bun run --bun vitest src/state src/services src/cli/commands","test:e2e":"bun run --bun vitest src/cli/agent-workflow.test.ts","test:integration":"bun run --bun vitest src/test/integration/","test:auth-oauth":"TEST_AUTH_STRATEGY=oauth-sandbox bun run --bun vitest src/test/workos-sandbox/","test:auth-api":"TEST_AUTH_STRATEGY=api-key bun run --bun vitest src/test/integration/","test:coverage":"bun run --bun vitest --coverage","dev":"bun --hot src/cli/index.ts","server":"bun src/web/server.ts","localstack:start":"docker compose -f ../fieldwork-api/docker-compose.yml up -d localstack","localstack:stop":"docker compose -f ../fieldwork-api/docker-compose.yml down","localstack:logs":"docker compose -f ../fieldwork-api/docker-compose.yml logs -f localstack","test:db:start":"docker compose -f ../fieldwork-api/docker-compose.yml --profile test up -d postgres-test","test:db:stop":"docker compose -f ../fieldwork-api/docker-compose.yml --profile test down","test:containers:start":"docker compose -f ../fieldwork-api/docker-compose.yml --profile test up -d postgres-test && docker compose -f ../fieldwork-api/docker-compose.yml up -d localstack","test:containers:stop":"docker compose -f ../fieldwork-api/docker-compose.yml --profile test down && docker compose -f ../fieldwork-api/docker-compose.yml down","dev:up":"./scripts/dev-up.sh","dev:down":"./scripts/dev-down.sh","prepublishOnly":"bun run build"},"dependencies":{"@armynante/fieldwork-core":"workspace:*","@armynante/fieldwork-runtime":"workspace:*","react":"^18.2.0","react-dom":"^18.2.0"},"devDependencies":{"@armynante/fieldwork-test-utils":"workspace:*","@types/bun":"latest","@types/react":"^18","@types/react-dom":"^18","typescript":"^5","vitest":"^3.0.0"},"keywords":["deploy","fargate","ecs","aws","terraform","cli","infrastructure","devops"],"author":{"name":"armynante"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/armynante/templates.git"},"gitHead":"b35b3ab33fa2b18877a3cc583e2b94f5ae811a8e","_id":"@armynante/fieldwork-deploy@0.1.14","bugs":{"url":"https://github.com/armynante/templates/issues"},"homepage":"https://github.com/armynante/templates#readme","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-HQjPiJT1uYhVneYOZJTjF/rI468ObHQzStMiuGcP585hT6sPSqfZjB/HsKgbD+6ckwJ4RYnftJ+2mXY+hg8NFg==","shasum":"1cd57f5186fa114d8e983a7187cd882ae9e04cc6","tarball":"https://registry.npmjs.org/@armynante/fieldwork-deploy/-/fieldwork-deploy-0.1.14.tgz","fileCount":11,"unpackedSize":344472,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDw2SVE+57rAH3nTByQ0go7Xu8dsG4dPPWP08MJ3d/lrgIhANcajAA5yr92x0POn1hU8l8EoDDGbzV59jEJ49kjA9lr"}]},"_npmUser":{"name":"armynante","email":"andrew.armenante@gmail.com"},"directories":{},"maintainers":[{"name":"armynante","email":"andrew.armenante@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fieldwork-deploy_0.1.14_1767651547973_0.0010509477687121738"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-05T22:19:07.884Z","0.1.14":"2026-01-05T22:19:08.118Z","modified":"2026-01-05T22:19:08.441Z"},"maintainers":[{"name":"armynante","email":"andrew.armenante@gmail.com"}],"description":"CLI for managing Fargate deployments with domain purchasing, multi-environment support, and optional services","homepage":"https://github.com/armynante/templates#readme","keywords":["deploy","fargate","ecs","aws","terraform","cli","infrastructure","devops"],"repository":{"type":"git","url":"git+https://github.com/armynante/templates.git"},"author":{"name":"armynante"},"bugs":{"url":"https://github.com/armynante/templates/issues"},"license":"MIT","readme":"# Deploy CLI\n\nA command-line interface for managing AWS Fargate deployments with domain purchasing, multi-environment support, and optional services (RDS, Redis, S3, SQS).\n\n## Installation\n\n```bash\nbun install\n```\n\n## Quick Start\n\n```bash\n# Initialize a new project\ndeploy init my-app\n\n# Create a staging environment\ndeploy env create staging\n\n# Apply infrastructure\ndeploy infra apply --env staging\n\n# Deploy your application\ndeploy deploy --env staging\n```\n\n## Commands\n\n### Project Commands\n\n| Command | Description |\n|---------|-------------|\n| `init [name]` | Initialize a new project (interactive or from config) |\n| `projects` | List all projects |\n| `project select <id>` | Set active project |\n| `project delete <id>` | Delete project and optionally destroy infrastructure |\n\n### Environment Commands\n\n| Command | Description |\n|---------|-------------|\n| `env create <name>` | Create environment (staging\\|prod) |\n| `env destroy <name>` | Tear down environment |\n| `env list` | List environments for current project |\n| `env switch <name>` | Switch active environment |\n| `env vars set <KEY> <VALUE>` | Set environment variable (use `--secret` for secrets) |\n| `env vars get <KEY>` | Get environment variable value |\n| `env vars list` | List all environment variables |\n| `env vars delete <KEY>` | Delete environment variable |\n| `env vars import <file>` | Import from .env file (use `--secrets KEY1,KEY2` for secrets) |\n\n### Domain Commands\n\n| Command | Description |\n|---------|-------------|\n| `domain list` | List all domains (registered + pending) |\n| `domain check <name>` | Check domain availability and price |\n| `domain purchase <name>` | Purchase domain (non-blocking, returns operation ID) |\n| `domain status <op-id>` | Check domain operation/provisioning status |\n| `domain info <name>` | Show detailed domain info and attachment |\n| `domain attach <name>` | Attach domain to deployment (--project, --env) |\n| `domain detach <name>` | Detach domain from deployment |\n| `domain delete <name>` | Delete domain (hosted zone + disable auto-renew) |\n| `domain sync` | Sync domain registry with Route53 |\n\n### Service Commands\n\n| Command | Description |\n|---------|-------------|\n| `service add <type>` | Add service (rds\\|redis\\|s3\\|sqs) |\n| `service remove <type>` | Remove service |\n| `service list` | List enabled services |\n\n### Deployment Commands\n\n| Command | Description |\n|---------|-------------|\n| `deploy [--env <name>]` | Build and deploy to environment |\n| `rollback [version]` | Rollback to previous or specific version |\n| `status` | Show deployment status |\n\n### Infrastructure Commands\n\n| Command | Description |\n|---------|-------------|\n| `infra configure --env <name>` | Configure infrastructure (CPU, memory, ports, etc.) |\n| `infra apply --env <name>` | Apply Terraform configuration |\n| `infra destroy --env <name>` | Destroy infrastructure |\n| `infra status --env <name>` | Show infrastructure status |\n| `infra health --env <name>` | Run health checks |\n| `infra check --env <name>` | Show pending infrastructure changes (terraform plan) |\n| `infra update --env <name>` | Apply infrastructure changes (with `--auto-approve` option) |\n| `infra diff --env <name>` | Show human-readable diff of pending changes |\n\n### Container Commands\n\n| Command | Description |\n|---------|-------------|\n| `logs [--follow]` | View CloudWatch logs |\n| `exec [command]` | ECS Exec into running container |\n\n### Config Commands\n\n| Command | Description |\n|---------|-------------|\n| `config show` | Show current configuration |\n| `config set <key> <val>` | Set default value |\n| `config export` | Export config to file |\n| `config import <file>` | Import config from file |\n\n### State & Migration Commands\n\n| Command | Description |\n|---------|-------------|\n| `state` | Show CLI state, AWS config, and validate access |\n| `info` | Alias for 'state' |\n| `migrate` | Migrate data from S3 to DynamoDB (one-time) |\n\n### Server Commands\n\n| Command | Description |\n|---------|-------------|\n| `server [--port <n>]` | Start web UI server (default: 4000) |\n\n### Claude Integration\n\n| Command | Description |\n|---------|-------------|\n| `install-agents` | Install Claude Code subagents |\n\n## Global Options\n\n| Option | Description |\n|--------|-------------|\n| `--project <id>` | Override active project |\n| `--env <name>` | Override active environment |\n| `--region <region>` | AWS region (default: us-east-1) |\n| `--profile <name>` | AWS profile to use |\n| `-v, --verbose` | Verbose output |\n| `-h, --help` | Show help message |\n| `--version` | Show version |\n\n## Examples\n\n### Domain Lifecycle\n\n```bash\n# Check domain availability\ndeploy domain check myapp.click\n\n# Purchase domain (non-blocking)\ndeploy domain purchase myapp.click\n# Returns operation ID immediately\n\n# Check provisioning status\ndeploy domain status <operation-id>\n\n# List all domains (shows pending + registered)\ndeploy domain list\n\n# Attach domain to deployment\ndeploy domain attach myapp.click --project abc123 --env staging\n\n# Delete domain (disables auto-renew, removes from registry)\ndeploy domain delete myapp.click\n```\n\n### Environment Variables Management\n\n```bash\n# Set a plain text environment variable\ndeploy env vars set API_URL https://api.example.com --env staging\n\n# Set a secret (stored in AWS SSM Parameter Store)\ndeploy env vars set DATABASE_PASSWORD mysecret --env staging --secret\n\n# Get a variable value\ndeploy env vars get API_URL --env staging\n\n# List all variables for an environment\ndeploy env vars list --env staging\n\n# Show values (including decrypted secrets)\ndeploy env vars list --env staging --show-values\n\n# Import from .env file (mark specific keys as secrets)\ndeploy env vars import .env.staging --env staging --secrets DATABASE_PASSWORD,API_KEY\n\n# Delete a variable\ndeploy env vars delete API_URL --env staging\n```\n\n### Full Deployment Flow\n\n```bash\n# Initialize project\ndeploy init my-app --domain myapp.click\n\n# Create and configure staging\ndeploy env create staging\ndeploy service add redis\ndeploy infra apply --env staging\n\n# Set environment variables\ndeploy env vars set NODE_ENV production --env staging\ndeploy env vars set DATABASE_URL postgres://... --env staging --secret\n\n# Deploy application\ndeploy deploy --env staging\n\n# View logs\ndeploy logs --follow\n\n# Exec into container\ndeploy exec /bin/sh\n```\n\n## Storage Architecture\n\nThe deploy-cli uses a **local-first** storage strategy with optional sync to the Fieldwork API.\n\n| Data Type | Storage Location | Purpose |\n|-----------|------------------|---------|\n| Light metadata | `~/.config/fieldwork/projects/{id}/` | Project config, environments, services |\n| Heavy data | `{project}/.deploy/` | Terraform logs, state backups |\n| Terraform state | Fieldwork API (HTTP backend) | Shared .tfstate storage |\n| Team sync | Fieldwork API (optional) | Shared visibility |\n\n### Local Storage Structure\n\n```\n~/.config/fieldwork/\n├── global/\n│   ├── user-defaults.json     # User preferences\n│   └── domains/               # Domain registry\n└── projects/\n    └── {uuid}/\n        ├── config.json        # Project config\n        ├── environments/      # Per-environment config\n        ├── infrastructure/    # Infrastructure settings\n        └── terraform/         # Local TF state (if not using Fieldwork API)\n```\n\nSee [STATE_MANAGEMENT.md](./STATE_MANAGEMENT.md) for detailed architecture documentation.\n\n## Testing\n\nThe deploy-cli uses a multi-layered testing approach:\n\n### Test Categories\n\n| Category | Location | Description |\n|----------|----------|-------------|\n| Unit tests | `src/services/*.test.ts` | Isolated service tests with mocked dependencies |\n| CLI tests | `src/cli/commands/*.test.ts` | Command parsing and output tests |\n| Integration tests | `src/test/integration/*.test.ts` | Tests against real Fieldwork API |\n| E2E tests | `src/cli/agent-workflow.test.ts` | Full CLI workflow tests |\n\n### Running Tests\n\nTests are orchestrated via root vitest.config.ts.\n\n```bash\n# Run all tests\nbun run test\n\n# Run specific test file\nbun run test src/cli/agent-workflow.test.ts\n\n# Run with verbose output\nbun run test --reporter=verbose\n\n# Run a specific test by name\nbun run test -t \"init creates project\"\n```\n\n### Test Infrastructure\n\nTests use an isolated environment to avoid conflicts:\n\n| Component | Test Value | Production Value |\n|-----------|------------|------------------|\n| State directory | `$TMPDIR/deploy-cli-test-*` | `~/.config/fieldwork/` |\n| API server | `localhost:3001` (test server) | `api.fieldwork.dev` |\n| Database | `localhost:5434` (test DB) | `localhost:5433` |\n| AWS | LocalStack (`localhost:4566`) | Real AWS |\n\n**Key environment variables for tests:**\n\n| Variable | Purpose |\n|----------|---------|\n| `FIELDWORK_STATE_DIR` | Override state directory location |\n| `FIELDWORK_API_URL` | Override API server URL |\n| `FIELDWORK_API_KEY` | API key for authentication |\n| `DEPLOY_CLI_OFFLINE` | Set to `true` to skip API calls entirely |\n\n### Test Authentication\n\nIntegration tests use **M2M (Machine-to-Machine) authentication**:\n\n1. Tests exchange WorkOS M2M client credentials for a JWT token\n2. The Fieldwork API auto-creates a service user for the M2M client ID\n3. Resources are scoped to this service user during tests\n\nThis allows tests to use the real API without requiring interactive login.\n\n### Test Isolation\n\nEach test run uses:\n- Unique state directory in `$TMPDIR`\n- Isolated database schema (when using TestContext)\n- Separate API port per worker for parallel execution\n- Automatic cleanup after tests complete\n\nSee [docs/TESTING-WORKOS.md](./docs/TESTING-WORKOS.md) for auth-specific testing details.\n\n## Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `AWS_REGION` | AWS region (default: us-east-1) |\n| `AWS_PROFILE` | AWS profile to use |\n| `FIELDWORK_API_URL` | Fieldwork API URL (default: https://api.fieldwork.dev) |\n| `FIELDWORK_API_KEY` | API key for Fieldwork API |\n| `DEPLOY_CLI_OFFLINE` | Skip Fieldwork API calls (for offline development) |\n\n## Web UI\n\nStart the web UI server:\n\n```bash\ndeploy server --port 4000\n```\n\nThen open http://localhost:4000 in your browser.\n\n## Publishing\n\nFrom the repository root:\n\n```bash\nbun run publish:deploy\n```\n\nOr directly:\n\n```bash\n./scripts/codeartifact-publish.sh Modules/deploy-cli\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-589485039e9a54190e0f1c95aa11f898"}