hookdeck-cli 1.2.0 → 1.3.0-beta.1
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 +125 -34
- package/bin/hookdeck +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -471,7 +471,7 @@ hookdeck connection unpause # Unpause a connection
|
|
|
471
471
|
|
|
472
472
|
If you are a part of multiple projects, you can switch between them using our project management commands.
|
|
473
473
|
|
|
474
|
-
|
|
474
|
+
#### List projects
|
|
475
475
|
|
|
476
476
|
```sh
|
|
477
477
|
# List all projects
|
|
@@ -480,58 +480,149 @@ My Org / My Project (current)
|
|
|
480
480
|
My Org / Another Project
|
|
481
481
|
Another Org / Yet Another One
|
|
482
482
|
|
|
483
|
-
#
|
|
483
|
+
# Filter by organization and project name
|
|
484
484
|
$ hookdeck project list Org Proj
|
|
485
485
|
My Org / My Project (current)
|
|
486
486
|
My Org / Another Project
|
|
487
487
|
```
|
|
488
488
|
|
|
489
|
-
|
|
489
|
+
#### Select active project
|
|
490
490
|
|
|
491
491
|
```console
|
|
492
|
-
hookdeck project use [<organization_name> [<project_name>]]
|
|
492
|
+
hookdeck project use [<organization_name> [<project_name>]] [--local]
|
|
493
|
+
|
|
494
|
+
Flags:
|
|
495
|
+
--local Save project to current directory (.hookdeck/config.toml)
|
|
493
496
|
```
|
|
494
497
|
|
|
495
|
-
**
|
|
498
|
+
**Project Selection Modes:**
|
|
496
499
|
|
|
497
|
-
-
|
|
498
|
-
|
|
500
|
+
- **No arguments**: Interactive prompt to select organization and project
|
|
501
|
+
- **One argument**: Filter by organization name (prompts if multiple projects)
|
|
502
|
+
- **Two arguments**: Directly select organization and project
|
|
499
503
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
My Org
|
|
505
|
-
▸ Another Org
|
|
506
|
-
...
|
|
507
|
-
? Select Project (Another Org):
|
|
508
|
-
Project X
|
|
509
|
-
▸ Project Y
|
|
510
|
-
Selecting project Project Y
|
|
511
|
-
Successfully set active project to: [Another Org] Project Y
|
|
512
|
-
```
|
|
504
|
+
```sh
|
|
505
|
+
$ hookdeck project use my-org my-project
|
|
506
|
+
Successfully set active project to: my-org / my-project
|
|
507
|
+
```
|
|
513
508
|
|
|
514
|
-
|
|
515
|
-
Filters projects by the specified `<organization_name>`.
|
|
509
|
+
#### Configuration scope: Global vs Local
|
|
516
510
|
|
|
517
|
-
|
|
518
|
-
- If only one project exists, it will be selected automatically.
|
|
511
|
+
By default, `project use` saves your selection to the **global configuration** (`~/.config/hookdeck/config.toml`). You can pin a specific project to the **current directory** using the `--local` flag.
|
|
519
512
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
513
|
+
**Configuration file precedence (only ONE is used):**
|
|
514
|
+
|
|
515
|
+
The CLI uses exactly one configuration file based on this precedence:
|
|
516
|
+
|
|
517
|
+
1. **Custom config** (via `--config` flag) - highest priority
|
|
518
|
+
2. **Local config** - `${PWD}/.hookdeck/config.toml` (if exists)
|
|
519
|
+
3. **Global config** - `~/.config/hookdeck/config.toml` (default)
|
|
520
|
+
|
|
521
|
+
Unlike Git, Hookdeck **does not merge** multiple config files - only the highest precedence config is used.
|
|
522
|
+
|
|
523
|
+
**Examples:**
|
|
524
|
+
|
|
525
|
+
```sh
|
|
526
|
+
# No local config exists → saves to global
|
|
527
|
+
$ hookdeck project use my-org my-project
|
|
528
|
+
Successfully set active project to: my-org / my-project
|
|
529
|
+
Saved to: ~/.config/hookdeck/config.toml
|
|
530
|
+
|
|
531
|
+
# Local config exists → automatically updates local
|
|
532
|
+
$ cd ~/repo-with-local-config # has .hookdeck/config.toml
|
|
533
|
+
$ hookdeck project use another-org another-project
|
|
534
|
+
Successfully set active project to: another-org / another-project
|
|
535
|
+
Updated: .hookdeck/config.toml
|
|
536
|
+
|
|
537
|
+
# Create new local config
|
|
538
|
+
$ cd ~/my-new-repo # no .hookdeck/ directory
|
|
539
|
+
$ hookdeck project use my-org my-project --local
|
|
540
|
+
Successfully set active project to: my-org / my-project
|
|
541
|
+
Created: .hookdeck/config.toml
|
|
542
|
+
⚠️ Security: Add .hookdeck/ to .gitignore (contains credentials)
|
|
543
|
+
|
|
544
|
+
# Update existing local config with confirmation
|
|
545
|
+
$ hookdeck project use another-org another-project --local
|
|
546
|
+
Local configuration already exists at: .hookdeck/config.toml
|
|
547
|
+
? Overwrite with new project configuration? (y/N) y
|
|
548
|
+
Successfully set active project to: another-org / another-project
|
|
549
|
+
Updated: .hookdeck/config.toml
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
**Smart default behavior:**
|
|
553
|
+
|
|
554
|
+
When you run `project use` without `--local`:
|
|
555
|
+
- **If `.hookdeck/config.toml` exists**: Updates the local config
|
|
556
|
+
- **Otherwise**: Updates the global config
|
|
557
|
+
|
|
558
|
+
This ensures your directory-specific configuration is preserved when it exists.
|
|
559
|
+
|
|
560
|
+
**Flag validation:**
|
|
561
|
+
|
|
562
|
+
```sh
|
|
563
|
+
# ✅ Valid
|
|
564
|
+
hookdeck project use my-org my-project
|
|
565
|
+
hookdeck project use my-org my-project --local
|
|
566
|
+
|
|
567
|
+
# ❌ Invalid (cannot combine --config with --local)
|
|
568
|
+
hookdeck --config custom.toml project use my-org my-project --local
|
|
569
|
+
Error: --local and --config flags cannot be used together
|
|
570
|
+
--local creates config at: .hookdeck/config.toml
|
|
571
|
+
--config uses custom path: custom.toml
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
#### Benefits of local project pinning
|
|
575
|
+
|
|
576
|
+
- **Per-repository configuration**: Each repository can use a different Hookdeck project
|
|
577
|
+
- **Team collaboration**: Commit `.hookdeck/config.toml` to private repos (see security note)
|
|
578
|
+
- **No context switching**: Automatically uses the right project when you `cd` into a directory
|
|
579
|
+
- **CI/CD friendly**: Works seamlessly in automated environments
|
|
580
|
+
|
|
581
|
+
#### Security: Config files and source control
|
|
582
|
+
|
|
583
|
+
⚠️ **IMPORTANT**: Configuration files contain your Hookdeck credentials and should be treated as sensitive.
|
|
584
|
+
|
|
585
|
+
**Credential Types:**
|
|
586
|
+
|
|
587
|
+
- **CLI Key**: Created when you run `hookdeck login` (interactive authentication)
|
|
588
|
+
- **CI Key**: Created in the Hookdeck dashboard for use in CI/CD pipelines
|
|
589
|
+
- Both are stored as `api_key` in config files
|
|
590
|
+
|
|
591
|
+
**Recommended practices:**
|
|
592
|
+
|
|
593
|
+
- **Private repositories**: You MAY commit `.hookdeck/config.toml` if your repository is guaranteed to remain private and all collaborators should have access to the credentials.
|
|
594
|
+
|
|
595
|
+
- **Public repositories**: You MUST add `.hookdeck/` to your `.gitignore`:
|
|
596
|
+
```gitignore
|
|
597
|
+
# Hookdeck CLI configuration (contains credentials)
|
|
598
|
+
.hookdeck/
|
|
524
599
|
```
|
|
525
600
|
|
|
526
|
-
-
|
|
527
|
-
Directly selects the project `<project_name>` under the organization `<organization_name>`.
|
|
601
|
+
- **CI/CD environments**: Use the `HOOKDECK_API_KEY` environment variable:
|
|
528
602
|
```sh
|
|
529
|
-
|
|
530
|
-
|
|
603
|
+
# The ci command automatically reads HOOKDECK_API_KEY
|
|
604
|
+
export HOOKDECK_API_KEY="your-ci-key"
|
|
605
|
+
hookdeck ci
|
|
606
|
+
hookdeck listen 3000
|
|
531
607
|
```
|
|
532
608
|
|
|
533
|
-
|
|
534
|
-
|
|
609
|
+
**Checking which config is active:**
|
|
610
|
+
|
|
611
|
+
```sh
|
|
612
|
+
$ hookdeck whoami
|
|
613
|
+
Logged in as: user@example.com
|
|
614
|
+
Active project: my-org / my-project
|
|
615
|
+
Config file: /Users/username/my-repo/.hookdeck/config.toml (local)
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
**Removing local configuration:**
|
|
619
|
+
|
|
620
|
+
To stop using local configuration and switch back to global:
|
|
621
|
+
|
|
622
|
+
```sh
|
|
623
|
+
$ rm -rf .hookdeck/
|
|
624
|
+
# Now CLI uses global config
|
|
625
|
+
```
|
|
535
626
|
|
|
536
627
|
### Manage connections
|
|
537
628
|
|
package/bin/hookdeck
CHANGED
|
Binary file
|