@phpsandbox/cli 0.4.1 → 0.5.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 +46 -42
- package/bin/{phpsandbox.js → psb.js} +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -8,59 +8,63 @@ With Node.js 22 or newer:
|
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
10
|
npm install --global @phpsandbox/cli@latest
|
|
11
|
-
|
|
11
|
+
psb --version
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Bun is not required to use the npm package. Keep npm's optional dependencies enabled: they provide the executable for your platform.
|
|
15
15
|
|
|
16
16
|
For an executable with no Node.js or Bun requirement, download a binary and its `.sha256` file from [GitHub Releases](https://github.com/phpsandbox/cli/releases). Available targets are macOS arm64/x64, Linux arm64/x64 with glibc or musl, and Windows x64.
|
|
17
17
|
|
|
18
|
-
On macOS or Linux, verify the checksum, make the file executable, rename it to `
|
|
18
|
+
On macOS or Linux, verify the checksum, make the file executable, rename it to `psb`, and place it in a directory on your `PATH`. For example, after downloading the macOS arm64 assets:
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
|
-
shasum -a 256 -c
|
|
22
|
-
chmod +x
|
|
21
|
+
shasum -a 256 -c psb-darwin-arm64.sha256
|
|
22
|
+
chmod +x psb-darwin-arm64
|
|
23
23
|
mkdir -p "$HOME/.local/bin"
|
|
24
|
-
mv
|
|
24
|
+
mv psb-darwin-arm64 "$HOME/.local/bin/psb"
|
|
25
25
|
export PATH="$HOME/.local/bin:$PATH"
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
On Windows, download `
|
|
28
|
+
On Windows, download `psb-windows-x64.exe`, compare `Get-FileHash -Algorithm SHA256` with its checksum file, rename it to `psb.exe`, and add its directory to your user `Path`.
|
|
29
|
+
|
|
30
|
+
`psb` is the command name. The npm package remains `@phpsandbox/cli`; npm also installs `phpsandbox` as a compatibility alias. Existing environment variables and `.phpsandbox.json` files continue to work.
|
|
29
31
|
|
|
30
32
|
## Your first sandbox
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Run `psb auth login` to sign in through your browser. Compare the code, select one or more subscribed Helfer organizations, and approve. The CLI stores a separate key for each in your operating system credential store.
|
|
33
35
|
|
|
34
36
|
```sh
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
psb auth login
|
|
38
|
+
psb whoami
|
|
39
|
+
psb create --template standard --name first-sandbox
|
|
40
|
+
psb status
|
|
41
|
+
psb exec -- php -v
|
|
42
|
+
psb exec -- php -r 'echo "Hello from PHPSandbox\n";'
|
|
43
|
+
psb files list
|
|
44
|
+
psb open
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
`
|
|
47
|
+
Use `psb auth use ORGANIZATION` to switch saved organizations, or add `--org ORGANIZATION` to a single command. Use `psb auth login --api-key` to paste an existing key, or `--token-stdin` for scripts.
|
|
48
|
+
|
|
49
|
+
`create` waits for provisioning and selects the new sandbox. `open` opens its preview; use `open --print` to print the URL. Run `psb shell` for an interactive shell.
|
|
46
50
|
|
|
47
51
|
When you finish:
|
|
48
52
|
|
|
49
53
|
```sh
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
psb stop # Keep the notebook; stop its runtime
|
|
55
|
+
psb ready # Start or restore it and wait until ready
|
|
56
|
+
psb delete # Permanently delete after confirmation
|
|
53
57
|
```
|
|
54
58
|
|
|
55
|
-
For an existing sandbox, run `
|
|
59
|
+
For an existing sandbox, run `psb use SANDBOX_ID` in your project directory. This writes `.phpsandbox.json` with the sandbox ID and API endpoint. To target one command explicitly, use `--sandbox SANDBOX_ID`.
|
|
56
60
|
|
|
57
61
|
## Explore
|
|
58
62
|
|
|
59
63
|
```sh
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
psb --help
|
|
65
|
+
psb files --help
|
|
66
|
+
psb git checkpoint --help
|
|
67
|
+
psb list --json
|
|
64
68
|
```
|
|
65
69
|
|
|
66
70
|
- [Command reference](https://github.com/phpsandbox/cli/blob/main/docs/commands.md): all commands, arguments, flags, and defaults, generated from the CLI.
|
|
@@ -73,8 +77,8 @@ phpsandbox list --json
|
|
|
73
77
|
Provide your API key as `PHPSANDBOX_TOKEN` using your CI secret store. Add `--json` to commands that return structured data, and `--yes` to confirmed destructive operations. Remote `exec` commands preserve their exit code.
|
|
74
78
|
|
|
75
79
|
```sh
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
psb exec --sandbox SANDBOX_ID --json -- php -v
|
|
81
|
+
psb delete SANDBOX_ID --yes --json
|
|
78
82
|
```
|
|
79
83
|
|
|
80
84
|
Progress goes to stderr; JSON results go to stdout. Commands that follow logs or other streams emit JSON Lines with `--json`.
|
|
@@ -84,12 +88,12 @@ Progress goes to stderr; JSON results go to stdout. Commands that follow logs or
|
|
|
84
88
|
Inspect your app and the destination before publishing:
|
|
85
89
|
|
|
86
90
|
```sh
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
psb publication readiness
|
|
92
|
+
psb publication catalog ssh-server --server SERVER_ID
|
|
93
|
+
psb publication catalog laravel-cloud
|
|
94
|
+
psb publication catalog cloudflare-containers
|
|
95
|
+
psb publication plan publish.json
|
|
96
|
+
psb publish publish.json
|
|
93
97
|
```
|
|
94
98
|
|
|
95
99
|
Use your connected server or provider account. The catalog returns the same resource choices as the publishing panel. Plans show missing settings and resource choices without creating resources. Publishing asks for confirmation; use `--yes` for scripts. For repository-based publishing, workspace changes are committed and pushed before deployment. Provider resources may incur charges.
|
|
@@ -113,12 +117,12 @@ For example, an SSH publishing file can create a separate production MySQL datab
|
|
|
113
117
|
For Laravel Cloud, use `{"name":"laravel-cloud","region":"eu-central-1","setup":{"repositoryAccessConfirmed":true}}` as the provider. Choose resource types, sizes and configuration from its catalog. For Cloudflare Containers, use `{"name":"cloudflare-containers","accountId":"ACCOUNT_ID"}`. Cloudflare does not provision databases, caches or file storage through this integration. Declaring a resource `external` only records your choice; configure its connection separately in Production secrets.
|
|
114
118
|
|
|
115
119
|
```sh
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
psb publish --yes # Publish changes with the existing setup
|
|
121
|
+
psb publication status --json
|
|
122
|
+
psb publication resources --json
|
|
123
|
+
psb publication build-logs
|
|
124
|
+
psb publication delete # Unpublish and retain resources
|
|
125
|
+
psb publication delete --delete-resources # Remove app-owned resources and their data
|
|
122
126
|
```
|
|
123
127
|
|
|
124
128
|
Publishing follows progress and build logs by default. `--no-wait` returns after the publishing stream attaches; deployment continues on the server. Removing resources permanently deletes their data. Resources reused from elsewhere remain managed separately.
|
|
@@ -136,13 +140,13 @@ MIT.
|
|
|
136
140
|
Use `application plan` to prepare a server-owned review. It never builds or creates resources. The returned review includes blockers, the bound publication identity, resolved destination, required production settings and source snapshot. The platform determines supported choices; use `publication catalog` and `publication resources` for discovery.
|
|
137
141
|
|
|
138
142
|
```sh
|
|
139
|
-
|
|
143
|
+
psb application plan --provider ssh-server --server SERVER_ID \
|
|
140
144
|
--component web --dockerfile Dockerfile --port 3333 --health-path / \
|
|
141
145
|
--database-resource create --database-type mysql --database-version 8.4 \
|
|
142
146
|
--cache-resource create --cache-type redis --cache-version 7
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
psb application publish REVIEW_ID --yes --wait
|
|
148
|
+
psb application status APPLICATION_ID
|
|
149
|
+
psb application retry APPLICATION_ID --yes --wait
|
|
146
150
|
```
|
|
147
151
|
|
|
148
152
|
Only confirm a ready review after checking its choices. Confirmation sends its reference to Core; the CLI does not recreate source, resource or retry logic. A corrected review keeps the publication's identity and address. `--wait` observes platform state, and stopping the CLI leaves the platform operation running. A timeout requires inspection before retrying. `application plan application.json` or stdin supports multi-component plans; it cannot be mixed with native plan flags. Production settings use `secrets set NAME --environment production`, with values from stdin or a hidden prompt.
|
|
@@ -25,7 +25,7 @@ function packageName(platform) {
|
|
|
25
25
|
return `@phpsandbox/cli-${platform.id}`;
|
|
26
26
|
}
|
|
27
27
|
function binaryName(platform) {
|
|
28
|
-
return platform.os === "win32" ? "
|
|
28
|
+
return platform.os === "win32" ? "psb.exe" : "psb";
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// src/distribution/launcher.ts
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.5.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"description": "A friendly command-line workspace for PHPSandbox",
|
|
13
13
|
"type": "module",
|
|
14
14
|
"bin": {
|
|
15
|
-
"
|
|
15
|
+
"psb": "bin/psb.js",
|
|
16
|
+
"phpsandbox": "bin/psb.js"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"bin"
|
|
@@ -21,12 +22,12 @@
|
|
|
21
22
|
"node": ">=22"
|
|
22
23
|
},
|
|
23
24
|
"optionalDependencies": {
|
|
24
|
-
"@phpsandbox/cli-darwin-arm64": "0.
|
|
25
|
-
"@phpsandbox/cli-darwin-x64": "0.
|
|
26
|
-
"@phpsandbox/cli-linux-x64": "0.
|
|
27
|
-
"@phpsandbox/cli-linux-arm64": "0.
|
|
28
|
-
"@phpsandbox/cli-linux-x64-musl": "0.
|
|
29
|
-
"@phpsandbox/cli-linux-arm64-musl": "0.
|
|
30
|
-
"@phpsandbox/cli-windows-x64": "0.
|
|
25
|
+
"@phpsandbox/cli-darwin-arm64": "0.5.0",
|
|
26
|
+
"@phpsandbox/cli-darwin-x64": "0.5.0",
|
|
27
|
+
"@phpsandbox/cli-linux-x64": "0.5.0",
|
|
28
|
+
"@phpsandbox/cli-linux-arm64": "0.5.0",
|
|
29
|
+
"@phpsandbox/cli-linux-x64-musl": "0.5.0",
|
|
30
|
+
"@phpsandbox/cli-linux-arm64-musl": "0.5.0",
|
|
31
|
+
"@phpsandbox/cli-windows-x64": "0.5.0"
|
|
31
32
|
}
|
|
32
33
|
}
|