@lightdash/cli 0.2420.0 → 0.2422.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/dbt/models.js +1 -1
- package/dist/globalState.d.ts +3 -0
- package/dist/globalState.d.ts.map +1 -1
- package/dist/globalState.js +7 -0
- package/dist/handlers/createProject.d.ts +1 -0
- package/dist/handlers/createProject.d.ts.map +1 -1
- package/dist/handlers/createProject.js +26 -15
- package/dist/handlers/dbt/getDbtVersion.js +2 -2
- package/dist/handlers/deploy.d.ts +1 -0
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/deploy.js +2 -1
- package/dist/handlers/login.d.ts +2 -0
- package/dist/handlers/login.d.ts.map +1 -1
- package/dist/handlers/login.js +87 -1
- package/dist/handlers/setProject.d.ts.map +1 -1
- package/dist/handlers/setProject.js +4 -1
- package/dist/index.js +11 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -67,3 +67,131 @@ node ./packages/cli/dist/index.js dbt run --project-dir ./examples/full-jaffle-s
|
|
|
67
67
|
### Testing different dbt versions
|
|
68
68
|
|
|
69
69
|
If you want to test different dbt versions, you can replace the string `dbt` in the "execa" calls in the package with `dbt${YOUR_VERSION}`, eg: `dbt1.8`.
|
|
70
|
+
|
|
71
|
+
## Automation, CI & Agentic Usage
|
|
72
|
+
|
|
73
|
+
The CLI supports non-interactive usage for CI/CD pipelines and agentic LLM coding tools (Claude Code, Cursor, Windsurf, etc.).
|
|
74
|
+
|
|
75
|
+
The `--non-interactive` flag is designed for environments where interactive prompts would block execution, such as automated pipelines or when an AI coding agent is running CLI commands on your behalf.
|
|
76
|
+
|
|
77
|
+
### Global Options
|
|
78
|
+
|
|
79
|
+
| Flag | Description |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| `--non-interactive` | Disable all interactive prompts. Commands auto-select defaults where possible. Designed for CI/CD and agentic coding tools. |
|
|
82
|
+
|
|
83
|
+
### Command-Specific Options
|
|
84
|
+
|
|
85
|
+
| Command | Flag | Description |
|
|
86
|
+
|---------|------|-------------|
|
|
87
|
+
| `login` | `--token <token>` | Authenticate with personal access token (bypasses OAuth) |
|
|
88
|
+
| `login` | `--email <email>` | Login with email and password |
|
|
89
|
+
| `login` | `--project <uuid>` | Select a specific project by UUID after login |
|
|
90
|
+
| `deploy` | `-y, --assume-yes` | Answer yes to all confirmation prompts |
|
|
91
|
+
| `generate` | `-y, --assume-yes` | Answer yes to prompts |
|
|
92
|
+
| `dbt run` | `-y, --assume-yes` | Answer yes to prompts |
|
|
93
|
+
| `rename` | `-y, --assume-yes` | Answer yes to prompts |
|
|
94
|
+
|
|
95
|
+
### Environment Variables
|
|
96
|
+
|
|
97
|
+
| Variable | Description |
|
|
98
|
+
|----------|-------------|
|
|
99
|
+
| `CI=true` | Equivalent to `--non-interactive` |
|
|
100
|
+
| `LIGHTDASH_API_KEY` | API token for authentication (can be used instead of `--token`) |
|
|
101
|
+
|
|
102
|
+
### Example Automation Scripts
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Login with token (auto-selects first project in non-interactive mode)
|
|
106
|
+
lightdash login https://app.lightdash.cloud \
|
|
107
|
+
--token $LIGHTDASH_API_KEY \
|
|
108
|
+
--non-interactive
|
|
109
|
+
|
|
110
|
+
# Login with token and specific project
|
|
111
|
+
lightdash login https://app.lightdash.cloud \
|
|
112
|
+
--token $LIGHTDASH_API_KEY \
|
|
113
|
+
--project abc-123-uuid \
|
|
114
|
+
--non-interactive
|
|
115
|
+
|
|
116
|
+
# Login with email/password
|
|
117
|
+
# Option 1: Use environment variables (recommended - avoids shell history)
|
|
118
|
+
export LIGHTDASH_CLI_EMAIL=demo@lightdash.com
|
|
119
|
+
export LIGHTDASH_CLI_PASSWORD='your_password'
|
|
120
|
+
lightdash login http://localhost:3000
|
|
121
|
+
|
|
122
|
+
# Option 2: Interactive password prompt (password not in shell history)
|
|
123
|
+
lightdash login http://localhost:3000 --email demo@lightdash.com
|
|
124
|
+
# You will be prompted to enter your password securely
|
|
125
|
+
|
|
126
|
+
# Deploy to existing project non-interactively
|
|
127
|
+
lightdash deploy \
|
|
128
|
+
--project-dir ./dbt \
|
|
129
|
+
--profiles-dir ./profiles \
|
|
130
|
+
--non-interactive
|
|
131
|
+
|
|
132
|
+
# Create new project non-interactively
|
|
133
|
+
lightdash deploy \
|
|
134
|
+
--create "My New Project" \
|
|
135
|
+
--assume-yes \
|
|
136
|
+
--non-interactive \
|
|
137
|
+
--project-dir ./dbt \
|
|
138
|
+
--profiles-dir ./profiles
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Behavior in Non-Interactive Mode
|
|
142
|
+
|
|
143
|
+
When `--non-interactive` is set (or `CI=true`):
|
|
144
|
+
- **Project selection**: Automatically selects the first available project
|
|
145
|
+
- **Confirmation prompts**: Fail with descriptive error unless `--assume-yes` is provided
|
|
146
|
+
- **OAuth login**: Not available - use `--token` or `--email` with `LIGHTDASH_CLI_PASSWORD` env var instead
|
|
147
|
+
|
|
148
|
+
### Email/Password Login
|
|
149
|
+
|
|
150
|
+
You can use email/password authentication with the CLI:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Option 1: Environment variables (recommended)
|
|
154
|
+
export LIGHTDASH_CLI_EMAIL=demo@lightdash.com
|
|
155
|
+
export LIGHTDASH_CLI_PASSWORD='your_password'
|
|
156
|
+
lightdash login http://localhost:3000
|
|
157
|
+
|
|
158
|
+
# Option 2: Interactive password prompt
|
|
159
|
+
lightdash login http://localhost:3000 --email demo@lightdash.com
|
|
160
|
+
# Password will be prompted securely (not visible in shell history)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Note**: For production CI/CD pipelines, consider using `--token` with a personal access token instead.
|
|
164
|
+
|
|
165
|
+
### Claude Code / Agentic Tools: Passwords with Special Characters
|
|
166
|
+
|
|
167
|
+
When using Claude Code or similar agentic coding tools, passwords containing special characters like `!` will fail with "Email and password not recognized" even when the credentials are correct.
|
|
168
|
+
|
|
169
|
+
**Why this happens**: Characters like `!` have special meaning in bash (history expansion). Even with single quotes, some shells still interpret them, causing the password to be mangled before it reaches the CLI.
|
|
170
|
+
|
|
171
|
+
**Solution**: Write the password to a file using a heredoc, which treats content as completely literal:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Write password to file using heredoc (bypasses all shell escaping)
|
|
175
|
+
cat > /tmp/lightdash_pass.txt << 'EOF'
|
|
176
|
+
your_password_with_special_chars!
|
|
177
|
+
EOF
|
|
178
|
+
|
|
179
|
+
# Set environment variables from the file
|
|
180
|
+
export LIGHTDASH_CLI_EMAIL=demo@lightdash.com
|
|
181
|
+
export LIGHTDASH_CLI_PASSWORD=$(cat /tmp/lightdash_pass.txt)
|
|
182
|
+
|
|
183
|
+
# Login using environment variables
|
|
184
|
+
lightdash login http://localhost:3000 --non-interactive
|
|
185
|
+
|
|
186
|
+
# Clean up
|
|
187
|
+
rm /tmp/lightdash_pass.txt
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Important**: The `<< 'EOF'` syntax (with quotes around EOF) is critical - it prevents any shell interpretation of the content.
|
|
191
|
+
|
|
192
|
+
The CLI supports these environment variables for authentication:
|
|
193
|
+
|
|
194
|
+
| Variable | Description |
|
|
195
|
+
|----------|-------------|
|
|
196
|
+
| `LIGHTDASH_CLI_EMAIL` | Email for login (alternative to `--email`) |
|
|
197
|
+
| `LIGHTDASH_CLI_PASSWORD` | Password for email login (used with `--email`) |
|