@shipdit/cli 0.5.0 → 0.7.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 +110 -22
- package/dist/index.mjs +582 -256
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,35 +1,123 @@
|
|
|
1
1
|
# @shipdit/cli
|
|
2
2
|
|
|
3
|
-
Command-line interface for shipd
|
|
3
|
+
Command-line interface for managing [shipd](https://useshipd.com) feature flags
|
|
4
|
+
and targeting rules from TypeScript or Go config files.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
Requires Node.js 22.12+.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install -g @shipdit/cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Get started
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
shipd login
|
|
8
18
|
shipd pull
|
|
9
19
|
shipd diff
|
|
10
|
-
shipd push
|
|
11
|
-
|
|
20
|
+
shipd push
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`shipd login` opens the browser to select your organization, project, and
|
|
24
|
+
environment, then stores a scoped management API key locally. `shipd pull`
|
|
25
|
+
downloads published flags into a config file and generates types. Review the
|
|
26
|
+
generated source, edit your definitions, then use `shipd diff` and `shipd push`
|
|
27
|
+
to preview and apply changes.
|
|
28
|
+
|
|
29
|
+
If you already have a local config, commit or back it up before pulling: pull
|
|
30
|
+
regenerates source and replaces comments and helper code.
|
|
31
|
+
|
|
32
|
+
## TypeScript projects
|
|
33
|
+
|
|
34
|
+
Install the SDK in your application:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm install shipdit
|
|
12
38
|
```
|
|
13
39
|
|
|
14
|
-
`shipd
|
|
40
|
+
Create `shipd.config.ts` in your project root:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { defineFlags } from 'shipdit/config';
|
|
44
|
+
|
|
45
|
+
export default defineFlags({
|
|
46
|
+
'new-checkout': {
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
default: false,
|
|
49
|
+
description: 'Redesigned checkout flow',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Run `shipd diff` and `shipd push` to sync it. Push and pull generate
|
|
55
|
+
`src/generated/flags.ts`; `shipd types gen` regenerates types locally without
|
|
56
|
+
syncing. Import the generated `FlagDefinitions` type into your SDK client for
|
|
57
|
+
typed flag keys and return values.
|
|
15
58
|
|
|
16
59
|
## Go projects
|
|
17
60
|
|
|
18
|
-
|
|
19
|
-
`var Config = config.ShipdConfig{...}` using
|
|
20
|
-
`github.com/alasti-company/useshipd.com/sdks/go/config`. Go 1.23+ and Node.js 22.12+
|
|
21
|
-
are needed for CLI commands; the application runtime only needs Go.
|
|
61
|
+
Install the Go SDK in your application module:
|
|
22
62
|
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
shipd push
|
|
26
|
-
shipd types gen
|
|
27
|
-
shipd pull
|
|
63
|
+
```sh
|
|
64
|
+
go get github.com/alasti-company/useshipd.com/sdks/go
|
|
28
65
|
```
|
|
29
66
|
|
|
30
|
-
Go
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
Go 1.23+ is required. Create `shipd.config.go` using your directory's package name:
|
|
68
|
+
|
|
69
|
+
```go
|
|
70
|
+
package main
|
|
71
|
+
|
|
72
|
+
import "github.com/alasti-company/useshipd.com/sdks/go/config"
|
|
73
|
+
|
|
74
|
+
var Config = config.ShipdConfig{
|
|
75
|
+
"new-checkout": {
|
|
76
|
+
Type: "boolean",
|
|
77
|
+
Default: false,
|
|
78
|
+
Description: "Redesigned checkout flow",
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The CLI reads the exported `Config` directly and generates Go accessors in
|
|
84
|
+
`internal/flags/flags_gen.go`. Run the same `shipd diff`, `shipd push`,
|
|
85
|
+
`shipd pull`, and `shipd types gen` commands as for TypeScript. The application
|
|
86
|
+
runtime only needs Go; Node.js is needed to run the CLI.
|
|
87
|
+
|
|
88
|
+
Keep the definition file self-contained. Imported packages and helpers declared
|
|
89
|
+
in that file work; sibling files are not loaded. Do not define `main` in it.
|
|
90
|
+
Pull regenerates `shipd.config.go` and its accessors.
|
|
91
|
+
|
|
92
|
+
## Targeting rules and sync
|
|
93
|
+
|
|
94
|
+
Add optional `targeting` to manage an environment's enabled state, ordered rules,
|
|
95
|
+
and fallthrough. Omitting it preserves dashboard rules and enabled state;
|
|
96
|
+
setting `rules: []` explicitly clears rules. Optional per-flag `traits`
|
|
97
|
+
declarations describe the accepted targeting inputs.
|
|
98
|
+
|
|
99
|
+
Targeting changes apply to the selected environment. Production targeting uses
|
|
100
|
+
the dashboard draft and approval workflow. Flag definitions and trait contracts
|
|
101
|
+
are shared across environments and update project-wide immediately.
|
|
102
|
+
|
|
103
|
+
Pull reads published state. The CLI detects conflicting targeting edits using a
|
|
104
|
+
local sync baseline; review conflicts before using a force option. Ignore
|
|
105
|
+
`**/.shipd/sync/` in version control to cover nested projects too.
|
|
106
|
+
|
|
107
|
+
## CI
|
|
108
|
+
|
|
109
|
+
Set `SHIPD_API_KEY` to a management API key with permission for your target
|
|
110
|
+
project and environment. Keep it in your CI secret store. Use `--yes` for
|
|
111
|
+
non-interactive pushes:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
shipd diff --env development
|
|
115
|
+
shipd push --env development --yes
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
SDK keys used by application clients do not authorize CLI management operations.
|
|
119
|
+
Run `shipd --help` or `shipd <command> --help` for available commands and options.
|
|
120
|
+
|
|
121
|
+
See the [CLI reference](https://docs.useshipd.com/reference/cli),
|
|
122
|
+
[TypeScript and Go configuration examples](https://docs.useshipd.com/reference/config),
|
|
123
|
+
and [sync conflict guide](https://docs.useshipd.com/config-as-code/conflicts).
|