You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`repair`|`--download-only`|`SOCKET_DOWNLOAD_ONLY`| Repair-specific cleanup mode (mutually exclusive with `--offline`) |
66
-
|`setup`|(none beyond globals) | —|—|
66
+
|`setup`|`--check`, `--remove` (mutually exclusive); honors global `--ecosystems`|`SOCKET_ECOSYSTEMS`|Wire / verify / revert the automatic-patching install hooks. See [Setup command contract](#setup-command-contract)|
67
67
68
68
`scan --apply` opts JSON callers into the full discover → select → apply pipeline. Without it, `scan --json` stays read-only (discovery + `updates` array only). No effect outside `--json` mode — the non-JSON path always prompts the user interactively.
69
69
@@ -89,6 +89,155 @@ Contract details:
89
89
90
90
`repair` keeps its `gc` visible alias.
91
91
92
+
## Setup command contract
93
+
94
+
`setup` wires a repository for **automatic patching**: after the ecosystem's own install/build step
95
+
runs, locally-installed dependencies are re-patched to match the Socket manifest (`.socket/manifest.json`)
96
+
with no further human action. It does this by installing an ecosystem-native hook (see the support
97
+
matrix below). `setup --check` verifies that state; `setup --remove` reverts it.
98
+
99
+
The properties below are the public contract. Each is backed by a test under
100
+
`crates/socket-patch-cli/tests/setup_*.rs`; properties not yet fully implemented are called out
101
+
explicitly and guarded by a deliberately-failing (RED) test that encodes the intended behavior — these
102
+
are the executable spec for follow-up work, **not** regressions. Changing any property below is governed
103
+
by the [semver policy](#semver-policy) (scoping `setup` by `--ecosystems` and strengthening `--check`,
104
+
in particular, are behavior changes that gate a version bump when implemented).
105
+
106
+
1.**Idempotent.** Re-running `setup` on an already-configured repo changes nothing: status
107
+
`already_configured`, `updated: 0`, every manifest byte-identical. *(Implemented.)*
108
+
109
+
2.**Ecosystem-scoped.**`setup`, `setup --check`, and `setup --remove` honor the global
110
+
`--ecosystems` filter and act on only the named ecosystems; with no filter they act on every
**Exit codes** (all three): `0` when nothing errored and the operation was satisfiable (including
238
+
`no_files` and `not_configured`); `1` on any per-file error, partial failure, or — for `--check` — any
239
+
manifest that needs configuration. `setup --check --remove` is a clap usage error (exit `2`).
240
+
92
241
## Environment variables
93
242
94
243
All v3.0 env vars use the `SOCKET_*` prefix. Three legacy `SOCKET_PATCH_*` names are still honored at runtime for compatibility: on first read of any of the three the binary emits a one-shot deprecation warning to stderr (the warning fires unconditionally — even under `--silent` / `--json` — because it's a transition signal users need to see). The legacy names will be removed in the next major release.
@@ -247,7 +396,7 @@ The remaining commands still emit their pre-v3.0 ad-hoc JSON shapes and will mig
247
396
- ⏳ `scan` — still emits the discovery + `apply.patches[*]` + `gc.*` shape documented in earlier drafts of this file.
248
397
- ⏳ `get` — still emits per-patch action arrays.
249
398
- ⏳ `rollback` — still emits per-package result records.
- ⏳ `setup` — still emits its own `{ status, updated, alreadyConfigured, errors, files }` shape (and the `--check` / `--remove` variants), now documented in full under [Setup command contract](#setup-command-contract).
251
400
252
401
### `patches[]` entry shape for `get` and `scan --apply`
0 commit comments