@phpsandbox/cli 0.4.1 → 0.6.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 +48 -42
- package/bin/{phpsandbox.js → psb.js} +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -8,59 +8,65 @@ 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.
|
|
31
|
+
|
|
32
|
+
Project features use an explicit product workspace ID: `psb feedback list --project PROJECT_ID`, `psb payments show --project PROJECT_ID`, and `psb publication status --project PROJECT_ID`. Compute commands continue to use `--sandbox` or the selected sandbox.
|
|
29
33
|
|
|
30
34
|
## Your first sandbox
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
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
37
|
|
|
34
38
|
```sh
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
psb auth login
|
|
40
|
+
psb whoami
|
|
41
|
+
psb create --template standard --name first-sandbox
|
|
42
|
+
psb status
|
|
43
|
+
psb exec -- php -v
|
|
44
|
+
psb exec -- php -r 'echo "Hello from PHPSandbox\n";'
|
|
45
|
+
psb files list
|
|
46
|
+
psb open
|
|
43
47
|
```
|
|
44
48
|
|
|
45
|
-
`
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
`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
52
|
|
|
47
53
|
When you finish:
|
|
48
54
|
|
|
49
55
|
```sh
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
psb stop # Keep the notebook; stop its runtime
|
|
57
|
+
psb ready # Start or restore it and wait until ready
|
|
58
|
+
psb delete # Permanently delete after confirmation
|
|
53
59
|
```
|
|
54
60
|
|
|
55
|
-
For an existing sandbox, run `
|
|
61
|
+
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
62
|
|
|
57
63
|
## Explore
|
|
58
64
|
|
|
59
65
|
```sh
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
psb --help
|
|
67
|
+
psb files --help
|
|
68
|
+
psb git checkpoint --help
|
|
69
|
+
psb list --json
|
|
64
70
|
```
|
|
65
71
|
|
|
66
72
|
- [Command reference](https://github.com/phpsandbox/cli/blob/main/docs/commands.md): all commands, arguments, flags, and defaults, generated from the CLI.
|
|
@@ -73,8 +79,8 @@ phpsandbox list --json
|
|
|
73
79
|
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
80
|
|
|
75
81
|
```sh
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
psb exec --sandbox SANDBOX_ID --json -- php -v
|
|
83
|
+
psb delete SANDBOX_ID --yes --json
|
|
78
84
|
```
|
|
79
85
|
|
|
80
86
|
Progress goes to stderr; JSON results go to stdout. Commands that follow logs or other streams emit JSON Lines with `--json`.
|
|
@@ -84,12 +90,12 @@ Progress goes to stderr; JSON results go to stdout. Commands that follow logs or
|
|
|
84
90
|
Inspect your app and the destination before publishing:
|
|
85
91
|
|
|
86
92
|
```sh
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
psb publication readiness
|
|
94
|
+
psb publication catalog ssh-server --server SERVER_ID
|
|
95
|
+
psb publication catalog laravel-cloud
|
|
96
|
+
psb publication catalog cloudflare-containers
|
|
97
|
+
psb publication plan publish.json
|
|
98
|
+
psb publish publish.json
|
|
93
99
|
```
|
|
94
100
|
|
|
95
101
|
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 +119,12 @@ For example, an SSH publishing file can create a separate production MySQL datab
|
|
|
113
119
|
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
120
|
|
|
115
121
|
```sh
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
psb publish --yes # Publish changes with the existing setup
|
|
123
|
+
psb publication status --json
|
|
124
|
+
psb publication resources --json
|
|
125
|
+
psb publication build-logs
|
|
126
|
+
psb publication delete # Unpublish and retain resources
|
|
127
|
+
psb publication delete --delete-resources # Remove app-owned resources and their data
|
|
122
128
|
```
|
|
123
129
|
|
|
124
130
|
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 +142,13 @@ MIT.
|
|
|
136
142
|
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
143
|
|
|
138
144
|
```sh
|
|
139
|
-
|
|
145
|
+
psb application plan --provider ssh-server --server SERVER_ID \
|
|
140
146
|
--component web --dockerfile Dockerfile --port 3333 --health-path / \
|
|
141
147
|
--database-resource create --database-type mysql --database-version 8.4 \
|
|
142
148
|
--cache-resource create --cache-type redis --cache-version 7
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
psb application publish REVIEW_ID --yes --wait
|
|
150
|
+
psb application status APPLICATION_ID
|
|
151
|
+
psb application retry APPLICATION_ID --yes --wait
|
|
146
152
|
```
|
|
147
153
|
|
|
148
154
|
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.6.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.6.0",
|
|
26
|
+
"@phpsandbox/cli-darwin-x64": "0.6.0",
|
|
27
|
+
"@phpsandbox/cli-linux-x64": "0.6.0",
|
|
28
|
+
"@phpsandbox/cli-linux-arm64": "0.6.0",
|
|
29
|
+
"@phpsandbox/cli-linux-x64-musl": "0.6.0",
|
|
30
|
+
"@phpsandbox/cli-linux-arm64-musl": "0.6.0",
|
|
31
|
+
"@phpsandbox/cli-windows-x64": "0.6.0"
|
|
31
32
|
}
|
|
32
33
|
}
|