Skip to content

Commit 99b7ab3

Browse files
authored
feat(cli): move upload/download under secrets with deprecated aliases (#37)
1 parent 1f00371 commit 99b7ab3

6 files changed

Lines changed: 49 additions & 36 deletions

File tree

β€ŽREADME.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ kfl projects create my-api
3838
kfl env create production --project my-api
3939

4040
# Upload secrets from a .env file
41-
kfl upload .env.production --project my-api --env production
41+
kfl secrets upload .env.production --project my-api --env production
4242

4343
# Inject secrets into a command
4444
kfl run --project my-api --env production -- npm run build
4545

4646
# Download secrets as .env file
47-
kfl download --project my-api --env production --output .env
47+
kfl secrets download --project my-api --env production --output .env
4848
```
4949

5050
## Documentation

β€Ždocs/cli/overview.mdxβ€Ž

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,37 +163,26 @@ kfl secrets list --project <name> --env <env>
163163

164164
# Delete a secret
165165
kfl secrets delete <KEY> --project <name> --env <env>
166-
```
167-
168-
---
169166

170-
### `kfl upload`
167+
# Upload from .env (full override)
168+
kfl secrets upload <file> --project <name> --env <env>
171169

172-
Upload a `.env` file (full override).
173-
174-
```bash
175-
kfl upload <file> --project <name> --env <env>
170+
# Download secrets
171+
kfl secrets download --project <name> --env <env> [options]
176172
```
177173

178174
<Warning>
179175
Upload replaces ALL existing secrets in the target environment.
180176
</Warning>
181177

182-
---
183-
184-
### `kfl download`
185-
186-
Download secrets in various formats.
187-
188-
```bash
189-
kfl download --project <name> --env <env> [options]
190-
```
191178

192179
| Option | Description |
193180
| ----------------- | ------------------------------------------------------- |
194181
| `--format <fmt>` | Output format: `env` (default), `json`, `yaml`, `shell` |
195182
| `--output <file>` | Write to file (default: stdout) |
196183

184+
Legacy aliases are still available but deprecated: `kfl upload`, `kfl download`.
185+
197186
---
198187

199188
### `kfl run`
@@ -268,4 +257,4 @@ kfl keys revoke <prefix>
268257
| 2 | Authentication error |
269258
| 3 | Authorization error |
270259
| 4 | Resource not found |
271-
| 5 | Network error |
260+
| 5 | Network error |

β€Ždocs/guides/secrets.mdxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ kfl secrets set \
3232
Upload an entire `.env` file. **This is a full override** β€” all existing secrets are replaced.
3333

3434
```bash
35-
kfl upload .env.production --project my-api --env production
35+
kfl secrets upload .env.production --project my-api --env production
3636
```
3737

3838
<Warning>
@@ -113,4 +113,4 @@ kfl run -- npm run dev
113113
<Card href="/guides/api-keys" title="API Keys">
114114
Create scoped keys for CI/CD and services.
115115
</Card>
116-
</CardGroup>
116+
</CardGroup>

β€Ždocs/guides/using-secrets.mdxβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ Download secrets in various formats:
99

1010
```bash
1111
# As .env format (default)
12-
kfl download --project my-api --env production
12+
kfl secrets download --project my-api --env production
1313

1414
# As JSON
15-
kfl download --project my-api --env production --format json
15+
kfl secrets download --project my-api --env production --format json
1616

1717
# As YAML
18-
kfl download --project my-api --env production --format yaml
18+
kfl secrets download --project my-api --env production --format yaml
1919

2020
# To a file
21-
kfl download --project my-api --env production --output .env
21+
kfl secrets download --project my-api --env production --output .env
2222
```
2323

2424
## Format Examples
@@ -147,4 +147,4 @@ kfl run -- npm run dev
147147
<Card href="/guides/api-keys" title="API Keys">
148148
Create scoped keys for CI/CD and services.
149149
</Card>
150-
</CardGroup>
150+
</CardGroup>

β€Žpackages/cli/README.mdβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ kfl projects create my-api
2525
kfl env create production --project my-api
2626

2727
# Upload secrets from a .env file
28-
kfl upload .env.production --project my-api --env production
28+
kfl secrets upload .env.production --project my-api --env production
2929

3030
# Inject secrets into a command at runtime (no disk writes)
3131
kfl run --project my-api --env production -- npm start
3232

3333
# Download secrets as a .env file
34-
kfl download --project my-api --env production --output .env
34+
kfl secrets download --project my-api --env production --output .env
3535
```
3636

3737
## Configuration
@@ -55,8 +55,8 @@ After `kfl init`, credentials are stored in `~/.config/keyflare/`. You can overr
5555
| `kfl projects list/create/delete` | Manage projects |
5656
| `kfl env list/create/delete` | Manage environments |
5757
| `kfl secrets set/get/delete/list` | Manage individual secrets |
58-
| `kfl upload <file>` | Upload a `.env` file (full replace) |
59-
| `kfl download` | Download secrets (`.env`, JSON, YAML) |
58+
| `kfl secrets upload <file>` | Upload a `.env` file (full replace) |
59+
| `kfl secrets download` | Download secrets (`.env`, JSON, YAML) |
6060
| `kfl run -- <cmd>` | Inject secrets into a child process |
6161
| `kfl keys list/create/revoke` | Manage API keys |
6262
| `kfl dev init/server` | Local development helpers |

β€Žpackages/cli/src/index.tsβ€Ž

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
runKeysUpdate,
3333
} from "./commands/keys.js";
3434
import { readConfig } from "./config.js";
35-
import { error } from "./output/log.js";
35+
import { error, warn } from "./output/log.js";
3636
import { makeDebug } from "./debug.js";
3737

3838
const program = new Command();
@@ -203,8 +203,7 @@ secrets
203203
await runSecretsDelete(key, opts.project, opts.env).catch(handleError);
204204
});
205205

206-
// ─── kfl upload ──────────────────────────────────────────────
207-
program
206+
secrets
208207
.command("upload <file>")
209208
.description(
210209
"Upload a .env file β€” REPLACES all secrets in the target environment"
@@ -216,8 +215,7 @@ program
216215
await runUpload(file, opts.project, opts.env, opts).catch(handleError);
217216
});
218217

219-
// ─── kfl download ────────────────────────────────────────────
220-
program
218+
secrets
221219
.command("download")
222220
.description("Download secrets to stdout or a file")
223221
.requiredOption("--project <name>", "Project name", resolveProject())
@@ -228,6 +226,32 @@ program
228226
await runDownload(opts.project, opts.env, opts).catch(handleError);
229227
});
230228

229+
// ─── Deprecated aliases: kfl upload/download ────────────────
230+
program
231+
.command("upload <file>", { hidden: true })
232+
.description(
233+
"Upload a .env file β€” REPLACES all secrets in the target environment"
234+
)
235+
.requiredOption("--project <name>", "Project name", resolveProject())
236+
.requiredOption("--env <name>", "Environment name", resolveEnvironment())
237+
.option("--force", "Skip confirmation prompt")
238+
.action(async (file: string, opts: { project: string; env: string; force?: boolean }) => {
239+
warn("`kfl upload` is deprecated; use `kfl secrets upload`");
240+
await runUpload(file, opts.project, opts.env, opts).catch(handleError);
241+
});
242+
243+
program
244+
.command("download", { hidden: true })
245+
.description("Download secrets to stdout or a file")
246+
.requiredOption("--project <name>", "Project name", resolveProject())
247+
.requiredOption("--env <name>", "Environment name", resolveEnvironment())
248+
.option("--format <fmt>", "Output format: env, json, yaml, shell", "env")
249+
.option("--output <file>", "Write to file instead of stdout")
250+
.action(async (opts: { project: string; env: string; format?: string; output?: string }) => {
251+
warn("`kfl download` is deprecated; use `kfl secrets download`");
252+
await runDownload(opts.project, opts.env, opts).catch(handleError);
253+
});
254+
231255
// ─── kfl run ─────────────────────────────────────────────────
232256
program
233257
.command("run")

0 commit comments

Comments
Β (0)