@guanjinke/artifact-client 1.3.0 → 1.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.
Files changed (69) hide show
  1. package/README.md +186 -229
  2. package/dist/cli/config-manager.d.ts +15 -0
  3. package/dist/cli/config-manager.d.ts.map +1 -1
  4. package/dist/cli/config-manager.js +31 -0
  5. package/dist/cli/config-manager.js.map +1 -1
  6. package/dist/cli/environment.d.ts +7 -0
  7. package/dist/cli/environment.d.ts.map +1 -0
  8. package/dist/cli/environment.js +200 -0
  9. package/dist/cli/environment.js.map +1 -0
  10. package/dist/cli/setup.d.ts.map +1 -1
  11. package/dist/cli/setup.js +160 -2
  12. package/dist/cli/setup.js.map +1 -1
  13. package/dist/cli.js +4 -1
  14. package/dist/cli.js.map +1 -1
  15. package/dist/environment/archive.d.ts +7 -0
  16. package/dist/environment/archive.d.ts.map +1 -0
  17. package/dist/environment/archive.js +132 -0
  18. package/dist/environment/archive.js.map +1 -0
  19. package/dist/environment/builder.d.ts +6 -0
  20. package/dist/environment/builder.d.ts.map +1 -0
  21. package/dist/environment/builder.js +323 -0
  22. package/dist/environment/builder.js.map +1 -0
  23. package/dist/environment/catalog.d.ts +9 -0
  24. package/dist/environment/catalog.d.ts.map +1 -0
  25. package/dist/environment/catalog.js +35 -0
  26. package/dist/environment/catalog.js.map +1 -0
  27. package/dist/environment/config.d.ts +8 -0
  28. package/dist/environment/config.d.ts.map +1 -0
  29. package/dist/environment/config.js +60 -0
  30. package/dist/environment/config.js.map +1 -0
  31. package/dist/environment/manager.d.ts +43 -0
  32. package/dist/environment/manager.d.ts.map +1 -0
  33. package/dist/environment/manager.js +383 -0
  34. package/dist/environment/manager.js.map +1 -0
  35. package/dist/environment/plan.d.ts +10 -0
  36. package/dist/environment/plan.d.ts.map +1 -0
  37. package/dist/environment/plan.js +131 -0
  38. package/dist/environment/plan.js.map +1 -0
  39. package/dist/environment/process.d.ts +94 -0
  40. package/dist/environment/process.d.ts.map +1 -0
  41. package/dist/environment/process.js +381 -0
  42. package/dist/environment/process.js.map +1 -0
  43. package/dist/environment/registry.d.ts +45 -0
  44. package/dist/environment/registry.d.ts.map +1 -0
  45. package/dist/environment/registry.js +157 -0
  46. package/dist/environment/registry.js.map +1 -0
  47. package/dist/environment/root.d.ts +33 -0
  48. package/dist/environment/root.d.ts.map +1 -0
  49. package/dist/environment/root.js +119 -0
  50. package/dist/environment/root.js.map +1 -0
  51. package/dist/environment/types.d.ts +66 -0
  52. package/dist/environment/types.d.ts.map +1 -0
  53. package/dist/environment/types.js +3 -0
  54. package/dist/environment/types.js.map +1 -0
  55. package/dist/environment/update.d.ts +106 -0
  56. package/dist/environment/update.d.ts.map +1 -0
  57. package/dist/environment/update.js +810 -0
  58. package/dist/environment/update.js.map +1 -0
  59. package/dist/environment/validate.d.ts +36 -0
  60. package/dist/environment/validate.d.ts.map +1 -0
  61. package/dist/environment/validate.js +147 -0
  62. package/dist/environment/validate.js.map +1 -0
  63. package/dist/index.d.ts +13 -0
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +29 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/types.d.ts +6 -0
  68. package/dist/types.d.ts.map +1 -1
  69. package/package.json +13 -4
package/README.md CHANGED
@@ -1,229 +1,186 @@
1
- # @guanjinke/artifact-client
2
-
3
- Artifact management client and CLI for Azure Blob Storage and Aliyun OSS.
4
-
5
- Manage plugin build artifacts stored in `plugin_artifacts/` — list plugins, versions, artifacts, upload, download, and record which version each product major version currently releases.
6
-
7
- ## Installation
8
-
9
- ```bash
10
- npm install @guanjinke/artifact-client
11
- ```
12
-
13
- Requires Node.js >= 20.
14
-
15
- ## Usage
16
-
17
- ### As a Library
18
-
19
- ```typescript
20
- import { ArtifactClient } from '@guanjinke/artifact-client';
21
-
22
- // Azure Storage
23
- const azClient = new ArtifactClient('az', {
24
- sasUrl: 'https://<account>.blob.core.windows.net/<container>?<SAS token>',
25
- });
26
-
27
- // Aliyun OSS
28
- const ossClient = new ArtifactClient('oss', {
29
- keyId: 'your-access-key-id',
30
- key: 'your-access-key-secret',
31
- bucket: 'your-bucket',
32
- region: 'oss-cn-hangzhou', // optional, defaults to oss-cn-hangzhou
33
- });
34
-
35
- // List all plugins
36
- const plugins = await client.listPlugins();
37
- // [{ name: 'myPlugin', path: 'plugin_artifacts/myPlugin/' }, ...]
38
-
39
- // List plugins with sizes
40
- const pluginsWithSize = await client.listPlugins({ includeSize: true });
41
-
42
- // List major versions of a plugin
43
- const majors = await client.listMajorVersions('myPlugin');
44
- // [{ majorVersion: '1.0', latestVersion: '1.0.5', minorCount: 3, path: '...' }, ...]
45
-
46
- // List major versions sorted ascending
47
- const majorsAsc = await client.listMajorVersions('myPlugin', { sortOrder: 'asc' });
48
-
49
- // Get the latest version for a major
50
- const latest = await client.getLatestVersion('myPlugin', '1.0');
51
- // { version: '1.0.5', path: 'plugin_artifacts/myPlugin/1.0.5/' }
52
-
53
- // List all minor versions under a major
54
- const minors = await client.listMinorVersions('myPlugin', '1.0');
55
- // [{ version: '1.0.5', path: '...' }, { version: '1.0.4', path: '...' }, ...]
56
-
57
- // List artifacts in a specific version
58
- const artifacts = await client.listArtifacts('myPlugin', '1.0.5');
59
- // [{ name: 'bundle.zip', path: '...', sizeMB: 12.5 }, ...]
60
-
61
- // Upload an artifact into a version directory (a plain write: no major version pointer
62
- // pointer is touched)
63
- await client.uploadArtifact('myPlugin', '1.0.6', 'bundle.zip', './dist/bundle.zip');
64
-
65
- // Separately, record it as the latest version of a product major version
66
- await client.updateLatestVersion('myPlugin', '9.1-hotfix1', '1.0.6');
67
-
68
- // Download by full path
69
- await client.downloadArtifactByPath(
70
- 'plugin_artifacts/myPlugin/1.0.5/bundle.zip',
71
- './downloads'
72
- );
73
-
74
- // Download by name
75
- await client.downloadArtifact('myPlugin', '1.0.5', 'bundle.zip', './downloads');
76
-
77
- // Download all artifacts for a version
78
- const files = await client.downloadVersion('myPlugin', '1.0.5', './downloads');
79
- // ['bundle.zip', 'checksum.txt']
80
- ```
81
-
82
- ### As a CLI
83
-
84
- ```bash
85
- # Login (saves credentials to ~/.afm/config.json; set AFM_CONFIG_DIR to use another directory)
86
- afm az login --sasurl "https://..."
87
- afm oss login --keyid "your-id" --key "your-key" --bucket "my-bucket"
88
-
89
- # Or pass credentials inline
90
- afm az list-plugins --sasurl "https://..."
91
-
92
- # List plugins
93
- afm az list-plugins
94
- afm az list-plugins --size
95
-
96
- # List major versions
97
- afm az list-majors myPlugin
98
- afm az list-majors myPlugin --size --sort asc
99
-
100
- # Get latest version for a major
101
- afm az get-latest myPlugin 1.0
102
-
103
- # List minor versions
104
- afm az list-minors myPlugin 1.0
105
- afm az list-minors myPlugin 1.0 --sort asc
106
-
107
- # List artifacts in a version
108
- afm az list-artifacts myPlugin 1.0.5
109
- afm az list-artifacts myPlugin 1.0.5 --size
110
-
111
- # Upload
112
- afm az upload myPlugin 1.0.6 bundle.zip ./dist/bundle.zip
113
- afm az set-latest myPlugin 1.0 1.0.6
114
-
115
- # Download by full path
116
- afm az download --path "plugin_artifacts/myPlugin/1.0.5/bundle.zip" --out ./downloads
117
-
118
- # Download by name
119
- afm az download --plugin myPlugin --ver 1.0.5 --file bundle.zip --out ./downloads
120
-
121
- # Download all artifacts for a version
122
- afm az download --plugin myPlugin --ver 1.0.5 --all --out ./downloads
123
-
124
- # Download the latest version of a major version (all artifacts by default)
125
- afm az download --plugin myPlugin --major 1.0 --out ./downloads
126
-
127
- # ... or a single artifact from that major's latest version
128
- afm az download --plugin myPlugin --major 1.0 --file bundle.zip --out ./downloads
129
-
130
- # Manage config
131
- afm az config show
132
- afm az config clear
133
- ```
134
-
135
- #### OSS Commands
136
-
137
- Same as above, replace `az` with `oss`:
138
-
139
- ```bash
140
- afm oss list-plugins --keyid "id" --key "secret"
141
- afm oss upload myPlugin 1.0.6 bundle.zip ./dist/bundle.zip
142
- afm oss set-latest myPlugin 9.1-hotfix1 1.0.6
143
- ```
144
-
145
- ## Major Versions and Channels
146
-
147
- A **product major version** (主版本号) is a label rather than a semver:
148
-
149
- | Major version | Meaning |
150
- |---|---|
151
- | `10.0`, `9.0` | first product major of the year |
152
- | `8.1`, `9.1`, `10.1` | second product major of the year |
153
- | `9.1-oem` | major version for a specific OEM customer |
154
- | `9.1-hotfix1` | hotfix major version built on top of `9.1` |
155
- | `dev` | development major version, tracked in `versiondev.txt` |
156
-
157
- - Every major version owns a version file `version<major>.txt` recording its latest artifact
158
- version, and `get-latest <plugin> <major>` reads exactly that file — so
159
- `afm oss get-latest gces-server 9.1-hotfix2` needs no special casing.
160
- - Artifact versions are **independent** of the major version: they usually repeat the major
161
- version's first two segments, but a dev artifact may be `10.0.1` (identity artifacts stay
162
- compatible with the license control system). Uploading a file and moving a major version's latest
163
- version are therefore **separate steps** — `upload` only writes the file, while
164
- `set-latest <plugin> <major> <version>` records a version as that major version's latest (or
165
- `upload --set-latest --major <major>` does both at once). A hotfix upload can no longer move
166
- `version9.1.txt` by accident, and a dev build such as `10.0.1` never lands in `version10.0.txt`.
167
- - `list-majors` reports every major version it finds — directory-derived majors and file-declared
168
- channel majors — with the latest version each one points at. Channel majors (`minorCount: 0`)
169
- publish into plain version directories, so their history cannot be enumerated; `list-minors
170
- <channel>` reports the version that major currently points at.
171
- - A version file without a pointer is a reserved major version and is not listed.
172
- - `get-latest` checks that the version a major version points at actually holds artifacts and warns
173
- on stderr when it does not — production still contains pointers to pruned versions — while still
174
- printing the pointer. `--no-verify` skips that extra listing.
175
- - `set-latest` warns when the version holds no artifacts but records it anyway — a major version is
176
- often published before every file has landed — and `--no-verify` skips that check too.
177
- - `download --plugin <plugin> --major <major>` needs no `--ver`: it resolves the major's latest
178
- version first and then downloads all of that version's artifacts, so `--all` is implied.
179
- `--file` narrows it to a single artifact of that version. `--major` and `--ver` are mutually
180
- exclusive. Artifacts that live in a sub-directory keep it locally: `patched/X.dll` is written to
181
- `<out>/patched/X.dll`.
182
-
183
- ## Storage Layout
184
-
185
- ```
186
- <container/bucket>/
187
- └── plugin_artifacts/
188
- ├── pluginA/
189
- │ ├── version1.0.txt # Tracks latest 1.0.x version
190
- │ ├── version9.1-hotfix1.txt # Tracks latest version of the 9.1-hotfix1 major version
191
- │ ├── versiondev.txt # Tracks latest dev version
192
- │ ├── 1.0.5/
193
- │ │ ├── bundle.zip
194
- │ │ └── checksum.txt
195
- │ └── 1.0.6/
196
- │ └── bundle.zip
197
- └── pluginB/
198
- └── ...
199
- ```
200
-
201
- - **Version files** (`version<major>.txt`, `versiondev.txt`): track the latest full version per major version
202
- - The dev major version is usually the whole `0.x` range: the dev pipeline publishes a plugin-specific minor
203
- (`0.0`, `0.1`, `0.2` and `0.3` are all in use) and always tracks it in `versiondev.txt`, so
204
- read it with `get-latest <plugin> dev` (the numeric `0.x` spelling is accepted as an alias).
205
- Some plugins publish dev artifacts under a different core (the production `gcef-identity-service`
206
- currently points `dev` at `8.1.7-beta`), which is exactly why the version file is authoritative.
207
- - Azure: latest version stored in blob metadata (`latestversion`)
208
- - OSS: latest version stored in object tag (`latestversion`)
209
-
210
- ## API Reference
211
-
212
- ### `ArtifactClient`
213
-
214
- | Method | Description |
215
- |---|---|
216
- | `listPlugins(opts?)` | List all plugins |
217
- | `listMajorVersions(plugin, opts?)` | List major versions with latest version and count |
218
- | `getLatestVersion(plugin, major, opts?)` | Get latest minor version for a major |
219
- | `listMinorVersions(plugin, major, opts?)` | List all minor versions under a major |
220
- | `listArtifacts(plugin, version, opts?)` | List all artifact files in a version |
221
- | `uploadArtifact(plugin, version, name, localPath)` | Upload a file into a version directory; major version pointers are left untouched |
222
- | `updateLatestVersion(plugin, major, version)` | Record a version as a major version's latest (creates `version<major>.txt` when absent) |
223
- | `downloadArtifactByPath(fullPath, localDir)` | Download by full storage path |
224
- | `downloadArtifact(plugin, version, fileName, localDir)` | Download by name |
225
- | `downloadVersion(plugin, version, localDir)` | Download all artifacts for a version |
226
-
227
- ## License
228
-
229
- MIT
1
+ # @guanjinke/artifact-client
2
+
3
+ Upload, browse and download build artifacts on **Azure Blob Storage** and **Aliyun OSS**, and build and manage local **Wyn environments** from those artifacts.
4
+
5
+ Requires Node.js >= 20. `az` commands talk to Azure, `oss` commands to Aliyun OSS; below they are interchangeable unless noted.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @guanjinke/artifact-client
11
+ afm --version
12
+ ```
13
+
14
+ ## Credentials
15
+
16
+ ```bash
17
+ afm az login --sasurl "https://<account>.blob.core.windows.net/<container>?<SAS>"
18
+ afm oss login --keyid <id> --key <secret> --bucket <bucket> [--region oss-cn-hangzhou]
19
+
20
+ # or pass them inline on any command: --sasurl, --keyid/--key/--bucket/--region
21
+ afm az list-plugins --sasurl "https://..."
22
+
23
+ afm az config show # print the saved credentials
24
+ afm az config clear # remove them
25
+ ```
26
+
27
+ Saved settings live in `~/.afm/config.json`; set `AFM_CONFIG_DIR` to use another directory.
28
+
29
+ ## Browse artifacts
30
+
31
+ ```bash
32
+ afm az list-plugins [--size]
33
+ afm az list-majors <plugin> [--size] [--sort asc|desc]
34
+ afm az get-latest <plugin> <major> [--size] [--no-verify]
35
+ afm az list-minors <plugin> <major> [--size] [--sort asc|desc]
36
+ afm az list-artifacts <plugin> <version> [--size]
37
+ ```
38
+
39
+ A **major** (`9.1`, `9.0`, `9.1-hotfix1`, `9.1-oem`, `dev`, ...) is a product label, not an artifact version. Each major owns a version file (`version9.1.txt`, `versiondev.txt`) that records the version it currently points at; `get-latest` reads it and warns on stderr when that version no longer holds artifacts (`--no-verify` skips the check).
40
+
41
+ ## Upload
42
+
43
+ ```bash
44
+ # Write the file into the version directory (major pointers untouched)
45
+ afm az upload <plugin> <version> <artifact-name> <local-file>
46
+
47
+ # ... and record it as the latest of a major in the same step
48
+ afm az upload <plugin> <version> <artifact-name> <local-file> --set-latest --major 9.1
49
+
50
+ # Or move a major separately
51
+ afm az set-latest <plugin> <major> <version> [--no-verify]
52
+ ```
53
+
54
+ Uploading and moving a major are deliberately separate: a hotfix upload cannot accidentally move `version9.1.txt`.
55
+
56
+ ## Download
57
+
58
+ ```bash
59
+ afm az download --path "<full/storage/path>" [--out ./dir]
60
+ afm az download --plugin <plugin> --ver <version> --file <name> [--out ./dir]
61
+ afm az download --plugin <plugin> --ver <version> --all [--out ./dir]
62
+ afm az download --plugin <plugin> --major <major> [--file <name>] [--out ./dir]
63
+ ```
64
+
65
+ `--major` resolves that major's latest version first, so `--all` is implied; `--major` and `--ver` are mutually exclusive. Artifacts keep their sub-directory: `patched/X.dll` is written to `<out>/patched/X.dll`.
66
+
67
+ ## Local Wyn environments (Windows)
68
+
69
+ Assembling and running environments is Windows-only. `oss`/`az` only decide where the artifacts come from.
70
+
71
+ ```bash
72
+ # Optionally pick one directory for every environment (stored in config.json)
73
+ afm env root D:\wyn-envs # validate, create if missing, remember
74
+ afm env root # print it
75
+ afm env root --json # { configured, root, exists, configPath }
76
+ afm env root --unset
77
+
78
+ # Assemble a fresh embedded environment (nothing is started or registered as a Windows service)
79
+ afm oss create-env D:\wyn-envs\demo --name demo --major 9.1 \
80
+ [--modules dashboard reporting] [--edition en] [--port 51980] [--dry-run]
81
+
82
+ # With a configured environment root the path can be omitted
83
+ afm oss create-env --name demo --major 9.1
84
+ ```
85
+
86
+ Server, Monitor, Account, Dataset, AnalysisModel and CotWorker are always included; `--modules` adds `dashboard`, `reporting` and (EN edition only) `sheets`. The default port is `51980`. `--dry-run` resolves everything and writes nothing. The result warns when the Server package ships no XSD for the detected configuration schema.
87
+
88
+ ```bash
89
+ afm env list [--json] # state, port, edition, major, root, local overrides, PID
90
+ afm env start <name> [--foreground|--background]
91
+ afm env stop <name>
92
+ afm env restart <name> [--foreground|--background]
93
+ afm env delete <name> [--yes]
94
+ ```
95
+
96
+ * Background output is appended to `<root>\logs\server.stdout.log` and `server.stderr.log`.
97
+ * `running` means the monitor process is alive — not that Wyn finished starting or that the port answers.
98
+ * A stopped environment keeps its reserved port and name; nothing is reassigned automatically.
99
+ * `delete` stops the environment, then removes its directory and its registry record; `--yes` is required when stdin is not a terminal.
100
+ * Environments are listed from `~/.afm/environments.json` (`AFM_CONFIG_DIR` for another profile).
101
+
102
+ ## Update the modules of an environment
103
+
104
+ ```bash
105
+ afm oss update-env <name> --modules dashboard # latest for the recorded major
106
+ afm oss update-env <name> --modules dashboard:0.1.12345 # pinned version
107
+ afm oss update-env <name> --modules dashboard=D:\build\Wyn.Dashboards.Plugin.dll
108
+ afm oss update-env <name> --modules all # every configured module except local ones
109
+ afm oss update-env <name> --modules dashboard --dry-run
110
+ ```
111
+
112
+ Remote updates download, verify (SHA256 + archive checks) and replace the deployed files; the environment must be observed `ready` or `stopped` (`running`/`unknown` is refused — stop it first). A **local source copies nothing**: the deployed `Plugins\<module>` directory is removed and `conf\Wyn.conf` is pointed straight at your build, so the Server loads it; restart the environment to load the change. Modules that were never installed are installed.
113
+
114
+ A module can own several assemblies (`gces-common` = two plugins + one worker; `dashboard`/`reporting` = plugin + worker), so local sources resolve per assembly:
115
+
116
+ | Spec | Selects |
117
+ |---|---|
118
+ | `dashboard=D:\build\Wyn.Dashboards.Plugin.dll` | the target whose file name matches |
119
+ | `dashboard=D:\build\out` | every assembly of that module found in the directory |
120
+ | `dashboard#Wyn.Dashboards.Worker.dll=D:\build\worker.dll` | that target explicitly |
121
+ | repeated `common=` specs | one target each, as long as no target is selected twice |
122
+
123
+ ```bash
124
+ afm oss update-env demo --modules \
125
+ common=D:\gces-common\src\Wyn.Dataset.Plugin\bin\release\net8.0\Wyn.Dataset.Plugin.dll \
126
+ common=D:\gces-common\src\Wyn.Account.Plugin\bin\release\net8.0\Wyn.Account.Plugin.dll \
127
+ common=D:\gces-common\src\Wyn.CotWorker\bin\release\net8.0\Wyn.CotWorker.dll
128
+ ```
129
+
130
+ The override is recorded in the environment manifest (`moduleSources`) and shown by `env list` in a `local` column; switching the module back to a remote spec deletes the override and restores the deployed files.
131
+
132
+ ## Apply a local build while starting
133
+
134
+ ```bash
135
+ afm env start demo --background --modules dashboard=D:\build\Wyn.Dashboards.Plugin.dll
136
+ afm env restart demo --modules common=D:\build\common,common#Wyn.CotWorker.dll=D:\build\Wyn.CotWorker.dll
137
+ ```
138
+
139
+ Same specs as `update-env`, but only local sources are accepted here (`env` has no cloud provider — use `update-env` for artifacts). `start` applies the override and then starts; `restart` stops, applies and starts again, which is the usual "rebuild, then reload" loop.
140
+
141
+ ## Library
142
+
143
+ ```ts
144
+ import { ArtifactClient, buildEnvironmentPlan, executeEnvironmentPlan } from '@guanjinke/artifact-client';
145
+
146
+ const client = new ArtifactClient('oss', { keyId: 'id', key: 'secret', bucket: 'my-bucket' });
147
+
148
+ await client.listPlugins({ includeSize: true });
149
+ await client.listMajorVersions('myPlugin', { sortOrder: 'asc' });
150
+ await client.getLatestVersion('gces-server', '9.1');
151
+ await client.listArtifacts('gces-server', '9.1.21042', { includeSize: true });
152
+ await client.uploadArtifact('myPlugin', '1.0.6', 'bundle.zip', './dist/bundle.zip');
153
+ await client.updateLatestVersion('myPlugin', '9.1-hotfix1', '1.0.6');
154
+ await client.downloadArtifact('myPlugin', '1.0.5', 'bundle.zip', './downloads');
155
+ await client.downloadArtifactByPath('plugin_artifacts/myPlugin/1.0.5/bundle.zip', './downloads');
156
+ const files = await client.downloadVersion('myPlugin', '1.0.5', './downloads');
157
+
158
+ // Plan resolutely (no downloads or writes), then assemble and register an environment
159
+ const plan = await buildEnvironmentPlan({ root: 'D:/wyn/demo', major: '9.1', modules: ['dashboard'] }, client);
160
+ const result = await executeEnvironmentPlan(plan, { client });
161
+ ```
162
+
163
+ | Method | Description |
164
+ |---|---|
165
+ | `listPlugins(opts?)` | List plugins (optionally with total size) |
166
+ | `listMajorVersions(plugin, opts?)` | Majors with the version each one points at |
167
+ | `getLatestVersion(plugin, major, opts?)` | Version a major currently points at |
168
+ | `listMinorVersions(plugin, major, opts?)` | Versions under a major |
169
+ | `listArtifacts(plugin, version, opts?)` | Files of a version (optionally with sizes) |
170
+ | `uploadArtifact(plugin, version, name, localPath)` | Upload one file into a version directory |
171
+ | `updateLatestVersion(plugin, major, version)` | Move a major's latest pointer |
172
+ | `downloadArtifactByPath(fullPath, localDir)` | Download by full storage path |
173
+ | `downloadArtifact(plugin, version, fileName, localDir)` | Download by name |
174
+ | `downloadVersion(plugin, version, localDir)` | Download every file of a version |
175
+
176
+ `client` is a small typed interface, so tests can inject a stub. Environment APIs are Windows-only for execution; planning and listing work anywhere.
177
+
178
+ ## Notes
179
+
180
+ * Stopping is a forced process-tree termination, not a graceful HTTP shutdown.
181
+ * A missing or unknown process identity blocks start/stop/delete instead of guessing.
182
+ * Version resolution never selects a different archive by size: only the exact expected file name is used.
183
+
184
+ Design details, safety semantics and development notes live in the repository.
185
+
186
+ MIT
@@ -32,4 +32,19 @@ export declare function saveOSSConfig(config: OSSConfig): void;
32
32
  * Clear all stored configuration.
33
33
  */
34
34
  export declare function clearConfig(): void;
35
+ /**
36
+ * Read the unified environment root, i.e. the directory that holds managed
37
+ * environments. Returns undefined when it has not been configured.
38
+ */
39
+ export declare function getEnvironmentRoot(): string | undefined;
40
+ /**
41
+ * Persist the unified environment root. The path is stored as an absolute path
42
+ * so later `create-env` calls do not depend on the current working directory.
43
+ * Credentials and other settings in the config file are preserved.
44
+ */
45
+ export declare function setEnvironmentRoot(directory: string): void;
46
+ /**
47
+ * Remove the unified environment root setting. Other settings are preserved.
48
+ */
49
+ export declare function clearEnvironmentRoot(): void;
35
50
  //# sourceMappingURL=config-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/cli/config-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAYD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAWtC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAGnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAIzD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAIrD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC"}
1
+ {"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/cli/config-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAYD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAWtC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAGnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAIzD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAIrD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAK1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C"}
@@ -40,6 +40,9 @@ exports.writeConfig = writeConfig;
40
40
  exports.saveAzureConfig = saveAzureConfig;
41
41
  exports.saveOSSConfig = saveOSSConfig;
42
42
  exports.clearConfig = clearConfig;
43
+ exports.getEnvironmentRoot = getEnvironmentRoot;
44
+ exports.setEnvironmentRoot = setEnvironmentRoot;
45
+ exports.clearEnvironmentRoot = clearEnvironmentRoot;
43
46
  const fs = __importStar(require("fs"));
44
47
  const path = __importStar(require("path"));
45
48
  const os = __importStar(require("os"));
@@ -118,4 +121,32 @@ function clearConfig() {
118
121
  ensureConfigDir();
119
122
  writeConfig({});
120
123
  }
124
+ /**
125
+ * Read the unified environment root, i.e. the directory that holds managed
126
+ * environments. Returns undefined when it has not been configured.
127
+ */
128
+ function getEnvironmentRoot() {
129
+ const configured = readConfig().environmentRoot;
130
+ return typeof configured === 'string' && configured.trim() !== '' ? path.resolve(configured) : undefined;
131
+ }
132
+ /**
133
+ * Persist the unified environment root. The path is stored as an absolute path
134
+ * so later `create-env` calls do not depend on the current working directory.
135
+ * Credentials and other settings in the config file are preserved.
136
+ */
137
+ function setEnvironmentRoot(directory) {
138
+ if (typeof directory !== 'string' || directory.trim() === '')
139
+ throw new Error('Environment root must be a non-empty directory path.');
140
+ const config = readConfig();
141
+ config.environmentRoot = path.resolve(directory);
142
+ writeConfig(config);
143
+ }
144
+ /**
145
+ * Remove the unified environment root setting. Other settings are preserved.
146
+ */
147
+ function clearEnvironmentRoot() {
148
+ const config = readConfig();
149
+ delete config.environmentRoot;
150
+ writeConfig(config);
151
+ }
121
152
  //# sourceMappingURL=config-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../../src/cli/config-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,oCAGC;AAMD,sCAEC;AAgBD,gCAWC;AAKD,kCAGC;AAKD,0CAIC;AAKD,sCAIC;AAKD,kCAGC;AAtFD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAGzB,MAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC;;;;;GAKG;AACH,SAAgB,YAAY;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC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,WAAW,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB;IAChC,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC,eAAe,CAAC;IAChD,OAAO,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3G,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,SAAiB;IAClD,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtI,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjD,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB;IAClC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,eAAe,CAAC;IAC9B,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Command } from 'commander';
2
+ import { EnvironmentManager } from '../environment/manager';
3
+ import { EnvironmentRecord } from '../environment/registry';
4
+ import { EnvironmentUpdater } from '../environment/update';
5
+ export declare function confirmDeletion(entry: EnvironmentRecord, yes: boolean): Promise<boolean>;
6
+ export declare function addEnvironmentCommands(program: Command, factory?: () => EnvironmentManager, updaterFactory?: () => EnvironmentUpdater): void;
7
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/cli/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAW,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAoB,MAAM,uBAAuB,CAAC;AA+C7E,wBAAsB,eAAe,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAO9F;AA0CD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,MAAM,kBAAoG,EAAE,cAAc,GAAE,MAAM,kBAAoG,GAAG,IAAI,CA4C9S"}