@moneydevkit/create 0.3.0 → 0.3.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 +38 -32
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,22 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Developer onboarding CLI for Money Dev Kit. This package publishes the interactive `npx @moneydevkit/create` flow that provisions API keys, webhook secrets, and a Lightning mnemonic for local development.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Run `npx @moneydevkit/create@latest` from the root of your project. The CLI walks you through login, webhook verification, and writes your secrets to `.env.local` (or a path you pick) while also copying them to the clipboard by default.
|
|
8
|
+
2. Follow the prompts. When you reach your editor again, `MDK_ACCESS_TOKEN`, `MDK_WEBHOOK_SECRET`, and `MDK_MNEMONIC` are ready to go.
|
|
9
|
+
|
|
10
|
+
### Customize the flow with flags
|
|
11
|
+
|
|
12
|
+
Pass any of the options from the table below to skip prompts or run non-interactively (add `--json` for machine-readable output). Example:
|
|
6
13
|
|
|
7
14
|
```bash
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
npx @moneydevkit/create@latest \
|
|
16
|
+
--dir ./apps/storefront \
|
|
17
|
+
--env-target .env.production \
|
|
18
|
+
--webhook-url https://example.com/webhooks/mdk \
|
|
19
|
+
--project-name "Storefront" \
|
|
20
|
+
--no-open --no-clipboard
|
|
12
21
|
```
|
|
13
22
|
|
|
14
|
-
|
|
23
|
+
### Manual login (optional)
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
2. Push the commit, then create a GitHub release (or annotated tag) named `create-vX.Y.Z` that matches the new version string.
|
|
18
|
-
3. The `publish-create` workflow will detect that tag, run the build, and execute `npm publish packages/create --access public` using the repo’s `NPM_TOKEN`.
|
|
25
|
+
You can reuse an existing dashboard session instead of waiting for device auth:
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
1. Sign into https://moneydevkit.com in the browser and keep the tab open.
|
|
28
|
+
2. Copy the `better-auth.session_token` cookie (`name=value`).
|
|
29
|
+
3. Run `npx @moneydevkit/create@latest --manual-login "better-auth.session_token=..." --webhook-url https://yourapp.com --no-open` (combine with `--json` for scripts).
|
|
30
|
+
|
|
31
|
+
The CLI still creates a device code but immediately authorises it using your cookie, then prints the same outputs as the interactive flow.
|
|
21
32
|
|
|
22
33
|
## What the CLI does
|
|
23
34
|
|
|
@@ -26,28 +37,6 @@ Once that workflow succeeds, `npx @moneydevkit/create` automatically downloads t
|
|
|
26
37
|
3. Polls until the dashboard authorises the device, then provisions an API key + webhook secret, and generates a mnemonic locally via BIP-39.
|
|
27
38
|
4. Shows an env diff, writes `.env.local` (or a user-specified file), and optionally copies secrets to the clipboard.
|
|
28
39
|
|
|
29
|
-
### Running headlessly (for LLMs/automation)
|
|
30
|
-
|
|
31
|
-
Manual mode still uses the device-auth flow—the only difference is that you reuse an *existing* dashboard session instead of waiting for a browser round trip. The steps are:
|
|
32
|
-
|
|
33
|
-
1. **Sign in via the dashboard UI** (browser) and keep the tab open.
|
|
34
|
-
2. **Copy the `better-auth.session_token` cookie** from your browser’s developer tools (Application → Storage → Cookies or the Network panel). Copy the full `name=value` pair.
|
|
35
|
-
3. **Pass that cookie to the CLI** using `--manual-login`. Example:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
SESSION_COOKIE='better-auth.session_token=eyJhbGciOiJI...'
|
|
39
|
-
|
|
40
|
-
npx @moneydevkit/create \
|
|
41
|
-
--base-url http://localhost:3900 \
|
|
42
|
-
--dir /tmp/mdk-demo \
|
|
43
|
-
--env-target .env.local \
|
|
44
|
-
--webhook-url https://example.com \
|
|
45
|
-
--manual-login "$SESSION_COOKIE" \
|
|
46
|
-
--json --no-open --no-clipboard
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
The CLI still requests a device code, immediately authorises it using the provided cookie, and emits a JSON payload containing the secrets plus the env-file path—no username/password ever touch the terminal.
|
|
50
|
-
|
|
51
40
|
## Flags
|
|
52
41
|
|
|
53
42
|
| Flag | Description |
|
|
@@ -64,3 +53,20 @@ The CLI still requests a device code, immediately authorises it using the provid
|
|
|
64
53
|
| `--force-new-webhook` | Force creation of a new webhook even if one already exists for the URL. |
|
|
65
54
|
|
|
66
55
|
Manual login mode calls `POST /api/cli/device/authorize` with the supplied session cookie. When used with `--json`, pass `--webhook-url` to avoid interactive prompts.
|
|
56
|
+
|
|
57
|
+
## Local Development
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install
|
|
61
|
+
npm run dev # watch mode via tsup
|
|
62
|
+
npm run build # produce dist/ bundle + types
|
|
63
|
+
npm run run:local # talk to a dashboard at http://localhost:3900
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Releasing to npm
|
|
67
|
+
|
|
68
|
+
1. Bump the version in `packages/create/package.json` (for example: `npm version 0.2.0 --workspace packages/create --no-git-tag-version`) and commit the resulting `package-lock.json` change.
|
|
69
|
+
2. Push the commit, then create a GitHub release (or annotated tag) named `create-vX.Y.Z` that matches the new version string.
|
|
70
|
+
3. The `publish-create` workflow will detect that tag, run the build, and execute `npm publish packages/create --access public` using trusted publishing.
|
|
71
|
+
|
|
72
|
+
Once that workflow succeeds, `npx @moneydevkit/create@latest` automatically downloads the freshly published build.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneydevkit/create",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Interactive CLI for bootstrapping Money Dev Kit credentials.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -50,9 +50,10 @@
|
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/moneydevkit/
|
|
53
|
+
"url": "git+https://github.com/moneydevkit/mdk-checkout.git",
|
|
54
54
|
"directory": "packages/create"
|
|
55
55
|
},
|
|
56
|
+
"homepage": "https://github.com/moneydevkit/mdk-checkout/blob/main/packages/create/README.md",
|
|
56
57
|
"publishConfig": {
|
|
57
58
|
"access": "public"
|
|
58
59
|
},
|