@secretstartups/workshop 0.5.0 → 0.7.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/CHANGELOG.md +32 -0
- package/README.md +21 -0
- package/dist/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/common/api/api.service.d.ts +1 -0
- package/dist/common/api/api.service.js +3 -0
- package/dist/common/api/api.service.js.map +1 -1
- package/dist/sandbox/sandbox-spec.d.ts +24 -0
- package/dist/sandbox/sandbox-spec.js +71 -0
- package/dist/sandbox/sandbox-spec.js.map +1 -0
- package/dist/sandbox/sandbox.commands.d.ts +169 -0
- package/dist/sandbox/sandbox.commands.js +706 -0
- package/dist/sandbox/sandbox.commands.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,38 @@ who use the CLI, not for people reading the diff.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.7.0] - 2026-11-25
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **`workshop sandbox up --dry-run`**: what the sandbox would run before making it: each service copied
|
|
17
|
+
from the base environment, built from a branch (and why: one the environment doesn't run is built
|
|
18
|
+
from its branch), or unable to run, plus what would stop its builds (a Dockerfile the branch doesn't
|
|
19
|
+
have, private packages over SSH). With `--base <environment>` and no `--service`, it suggests what
|
|
20
|
+
that environment runs plus what those services need. Exits non-zero when something would fail.
|
|
21
|
+
|
|
22
|
+
## [0.6.0] - 2026-11-24
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **`workshop sandbox`**: spin up an ephemeral environment of a project's services, for testing,
|
|
27
|
+
a demo or anything else, without a pull request. Each service runs the version you choose:
|
|
28
|
+
its base image, a branch (`feat/x`, rebuilt on pushes, or `held:feat/x`, built once), a
|
|
29
|
+
commit (`commit:main@abc1234`) or an image tag (`image:v1.4.2`).
|
|
30
|
+
- `sandbox up <name>` from services (`-s api=feat/x`), a copy of an environment
|
|
31
|
+
(`--from-env staging`) or a saved template (`--template`), with `--ttl`, `--wait`, and `--shared`
|
|
32
|
+
to use the base environment's data instead of throwaway databases.
|
|
33
|
+
- `sandbox ls`, `set` (change its services, `--remove` one), `var` (its own variable values),
|
|
34
|
+
`pin` / `unpin` (keep it alive with no expiry), `save` (as a template), `templates` and `down`.
|
|
35
|
+
- Once up it is a preview: `workshop preview status|logs|extend|share <id>` work on it.
|
|
36
|
+
- **`workshop sandbox deploy <environment>`**: deploy several services to an environment at once,
|
|
37
|
+
each after the services it requires (`-s api=v2.3.0`, or `--all`). Images only; a production
|
|
38
|
+
environment needs `--confirm <its name>`.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Needs a Workshop server with sandboxes; an older one answers the `sandbox` commands with "not found".
|
|
43
|
+
|
|
12
44
|
## [0.5.0] - 2026-11-19
|
|
13
45
|
|
|
14
46
|
### Added
|
package/README.md
CHANGED
|
@@ -289,6 +289,27 @@ workshop preview down <previewId> # Delete it (and its --snapshot branch)
|
|
|
289
289
|
|
|
290
290
|
By default it previews every service built from `git remote get-url origin`. The branch gets a workspace of its own on the project's preview environment, deleted with its last preview; `--workspace` previews in one of yours instead. A change across repositories whose branches are named differently adds the others with `--also <repository>=<branch>` (repeatable); the preview warns about any service asked for whose repository lacks its branch. `--snapshot` pushes your working tree to `workshop-preview/cli-<hash>`; your branch, index and HEAD stay untouched.
|
|
291
291
|
|
|
292
|
+
### Sandboxes (ephemeral environments)
|
|
293
|
+
|
|
294
|
+
A short-lived copy of a project's services, with no pull request or branch behind it: each service at its base image, a branch, a commit or an image tag, with throwaway databases and addresses of its own. Start from scratch, clone what an environment runs, or use a saved template. Services are named or given by id; `--project` defaults to `workshop project use`.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
workshop sandbox up demo -s api=feat/checkout -s web=image:v1.4.2 --wait
|
|
298
|
+
workshop sandbox up staging-copy --from-env staging -s api=commit:main@abc1234
|
|
299
|
+
workshop sandbox up demo2 --template "checkout demo" --ttl 72
|
|
300
|
+
workshop sandbox up try-it --base dev --dry-run # what it would run (copied or built) and what would stop it; makes nothing
|
|
301
|
+
workshop sandbox ls [--mine]
|
|
302
|
+
workshop sandbox set <sandboxId> -s api=held:main --remove worker
|
|
303
|
+
workshop sandbox var <sandboxId> api FEATURE_X=on # its own value (FEATURE_X= removes it); never a credential
|
|
304
|
+
workshop sandbox pin <sandboxId> # keep it alive (no expiry); unpin to let it go
|
|
305
|
+
workshop sandbox save <sandboxId> "checkout demo" # save it as a template
|
|
306
|
+
workshop sandbox templates
|
|
307
|
+
workshop sandbox down <sandboxId>
|
|
308
|
+
workshop sandbox deploy staging -s api=v2.3.0 -s web # several services to an environment, each after what it requires
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
A source is `base`, `<branch>` (or `branch:<branch>`, rebuilt on pushes), `held:<branch>` (built once, not rebuilt), `commit:<branch>@<sha>` or `image:<tag>`. Once up, a sandbox is a preview: `workshop preview status|logs|extend|share <id>` work on it. `sandbox deploy` takes images only (a production environment needs `--confirm <its name>`); unmerged branches go to sandboxes.
|
|
312
|
+
|
|
292
313
|
### Clusters
|
|
293
314
|
|
|
294
315
|
```bash
|
package/dist/app.module.js
CHANGED
|
@@ -25,6 +25,7 @@ const config_module_1 = require("./config/config.module");
|
|
|
25
25
|
const common_module_1 = require("./common/common.module");
|
|
26
26
|
const agent_module_1 = require("./agent/agent.module");
|
|
27
27
|
const preview_commands_1 = require("./preview/preview.commands");
|
|
28
|
+
const sandbox_commands_1 = require("./sandbox/sandbox.commands");
|
|
28
29
|
let AppModule = class AppModule {
|
|
29
30
|
};
|
|
30
31
|
exports.AppModule = AppModule;
|
|
@@ -39,6 +40,7 @@ exports.AppModule = AppModule = __decorate([
|
|
|
39
40
|
env_module_1.EnvModule,
|
|
40
41
|
service_module_1.ServiceModule,
|
|
41
42
|
preview_commands_1.PreviewModule,
|
|
43
|
+
sandbox_commands_1.SandboxModule,
|
|
42
44
|
cluster_module_1.ClusterModule,
|
|
43
45
|
vpn_module_1.VpnModule,
|
|
44
46
|
runners_module_1.RunnersModule,
|
package/dist/app.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,oDAAgD;AAChD,iDAA6C;AAC7C,6DAAyD;AACzD,iDAA6C;AAC7C,6DAAyD;AACzD,6DAAyD;AACzD,iDAA6C;AAC7C,6DAAyD;AACzD,uDAAmD;AACnD,oEAA8D;AAC9D,8CAA0C;AAC1C,0DAAsD;AACtD,+EAA2E;AAC3E,0DAAsD;AACtD,0DAAsD;AACtD,uDAAmD;AACnD,iEAA2D;
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,oDAAgD;AAChD,iDAA6C;AAC7C,6DAAyD;AACzD,iDAA6C;AAC7C,6DAAyD;AACzD,6DAAyD;AACzD,iDAA6C;AAC7C,6DAAyD;AACzD,uDAAmD;AACnD,oEAA8D;AAC9D,8CAA0C;AAC1C,0DAAsD;AACtD,+EAA2E;AAC3E,0DAAsD;AACtD,0DAAsD;AACtD,uDAAmD;AACnD,iEAA2D;AAC3D,iEAA2D;AAwBpD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IAtBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,0BAAW;YACX,wBAAU;YACV,sBAAS;YACT,8BAAa;YACb,sBAAS;YACT,8BAAa;YACb,gCAAa;YACb,gCAAa;YACb,8BAAa;YACb,sBAAS;YACT,8BAAa;YACb,0BAAW;YACX,kCAAc;YACd,oBAAQ;YACR,4BAAY;YACZ,0CAAmB;YACnB,4BAAY;SACb;KACF,CAAC;GACW,SAAS,CAAG"}
|
|
@@ -7,6 +7,7 @@ export declare class ApiService {
|
|
|
7
7
|
get<T = any>(path: string, params?: Record<string, any>, config?: AxiosRequestConfig): Promise<T>;
|
|
8
8
|
post<T = any>(path: string, data?: any): Promise<T>;
|
|
9
9
|
patch<T = any>(path: string, data?: any): Promise<T>;
|
|
10
|
+
put<T = any>(path: string, data?: any): Promise<T>;
|
|
10
11
|
delete<T = any>(path: string, params?: Record<string, any>): Promise<T>;
|
|
11
12
|
getStream(path: string, config?: AxiosRequestConfig): Promise<NodeJS.ReadableStream>;
|
|
12
13
|
private request;
|
|
@@ -45,6 +45,9 @@ let ApiService = class ApiService {
|
|
|
45
45
|
async patch(path, data) {
|
|
46
46
|
return this.request({ method: 'PATCH', url: path, data });
|
|
47
47
|
}
|
|
48
|
+
async put(path, data) {
|
|
49
|
+
return this.request({ method: 'PUT', url: path, data });
|
|
50
|
+
}
|
|
48
51
|
async delete(path, params) {
|
|
49
52
|
return this.request({ method: 'DELETE', url: path, params });
|
|
50
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../../../src/common/api/api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,kDAAiE;AACjE,qEAAgE;AAIhE,MAAM,OAAO,GAAW,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAG1D,IAAM,UAAU,GAAhB,MAAM,UAAU;IAGrB,YAA6B,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;QACnD,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,EAAE,CAAC;QAE7B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAC3C,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE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CACb,6BAA6B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CACrF,CAAC;gBACJ,CAAC;gBACD,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;oBACnB,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;gBACzF,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YACjF,CAAC;YAED,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CACb,qBAAqB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,0BAA0B,CACvE,CAAC;YACJ,CAAC;YAED,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAA;AA1GY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;qCAI0B,qCAAgB;GAH1C,UAAU,CA0GtB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type SandboxSource = {
|
|
2
|
+
kind: 'base';
|
|
3
|
+
} | {
|
|
4
|
+
kind: 'branch';
|
|
5
|
+
ref: string;
|
|
6
|
+
follow?: boolean;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'commit';
|
|
9
|
+
ref: string;
|
|
10
|
+
sha: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'image';
|
|
13
|
+
imageTag: string;
|
|
14
|
+
};
|
|
15
|
+
export interface ServiceSpecArg {
|
|
16
|
+
service: string;
|
|
17
|
+
source: SandboxSource;
|
|
18
|
+
}
|
|
19
|
+
export declare function parseServiceSpec(value: string): ServiceSpecArg;
|
|
20
|
+
export declare function pick<T extends {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
}>(rows: T[], want: string, what: string): T;
|
|
24
|
+
export declare function describeSource(s: SandboxSource): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseServiceSpec = parseServiceSpec;
|
|
4
|
+
exports.pick = pick;
|
|
5
|
+
exports.describeSource = describeSource;
|
|
6
|
+
const HOW = '--service takes <service>=<source>: base, branch:<ref> (or just <ref>), held:<ref>, commit:<ref>@<sha> or image:<tag>';
|
|
7
|
+
function parseServiceSpec(value) {
|
|
8
|
+
const at = value.indexOf('=');
|
|
9
|
+
const service = (at >= 0 ? value.slice(0, at) : value).trim();
|
|
10
|
+
const raw = at >= 0 ? value.slice(at + 1).trim() : 'base';
|
|
11
|
+
if (!service || !raw)
|
|
12
|
+
throw new Error(`${HOW} (got "${value}")`);
|
|
13
|
+
return { service, source: parseSource(raw, value) };
|
|
14
|
+
}
|
|
15
|
+
function parseSource(raw, whole) {
|
|
16
|
+
if (raw === 'base')
|
|
17
|
+
return { kind: 'base' };
|
|
18
|
+
const colon = raw.indexOf(':');
|
|
19
|
+
const kind = colon > 0 ? raw.slice(0, colon) : '';
|
|
20
|
+
const rest = colon > 0 ? raw.slice(colon + 1).trim() : '';
|
|
21
|
+
switch (kind) {
|
|
22
|
+
case 'branch':
|
|
23
|
+
if (!rest)
|
|
24
|
+
break;
|
|
25
|
+
return { kind: 'branch', ref: rest };
|
|
26
|
+
case 'held':
|
|
27
|
+
if (!rest)
|
|
28
|
+
break;
|
|
29
|
+
return { kind: 'branch', ref: rest, follow: false };
|
|
30
|
+
case 'commit': {
|
|
31
|
+
const sep = rest.lastIndexOf('@');
|
|
32
|
+
const ref = sep > 0 ? rest.slice(0, sep) : '';
|
|
33
|
+
const sha = sep > 0 ? rest.slice(sep + 1) : '';
|
|
34
|
+
if (!ref || !/^[0-9a-f]{7,40}$/i.test(sha))
|
|
35
|
+
break;
|
|
36
|
+
return { kind: 'commit', ref, sha };
|
|
37
|
+
}
|
|
38
|
+
case 'image':
|
|
39
|
+
if (!rest)
|
|
40
|
+
break;
|
|
41
|
+
return { kind: 'image', imageTag: rest };
|
|
42
|
+
default:
|
|
43
|
+
if (colon < 0)
|
|
44
|
+
return { kind: 'branch', ref: raw };
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`${HOW} (got "${whole}")`);
|
|
47
|
+
}
|
|
48
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
49
|
+
function pick(rows, want, what) {
|
|
50
|
+
const found = UUID.test(want)
|
|
51
|
+
? rows.find((r) => r.id === want)
|
|
52
|
+
: rows.find((r) => r.name.toLowerCase() === want.toLowerCase());
|
|
53
|
+
if (!found) {
|
|
54
|
+
const names = rows.map((r) => r.name).join(', ') || 'none';
|
|
55
|
+
throw new Error(`No ${what} "${want}" in this project (there are: ${names})`);
|
|
56
|
+
}
|
|
57
|
+
return found;
|
|
58
|
+
}
|
|
59
|
+
function describeSource(s) {
|
|
60
|
+
switch (s.kind) {
|
|
61
|
+
case 'base':
|
|
62
|
+
return 'base image';
|
|
63
|
+
case 'branch':
|
|
64
|
+
return s.follow === false ? `${s.ref} (held)` : s.ref;
|
|
65
|
+
case 'commit':
|
|
66
|
+
return `${s.ref}@${s.sha.slice(0, 7)}`;
|
|
67
|
+
case 'image':
|
|
68
|
+
return `image ${s.imageTag}`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=sandbox-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-spec.js","sourceRoot":"","sources":["../../src/sandbox/sandbox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CommandRunner } from 'nest-commander';
|
|
2
|
+
import { ApiService } from '../common/api/api.service';
|
|
3
|
+
import { CliConfigService } from '../common/config/cli-config.service';
|
|
4
|
+
import { OutputService } from '../common/output/output.service';
|
|
5
|
+
import type { PreviewView } from '../preview/preview.commands';
|
|
6
|
+
import { type SandboxSource, type ServiceSpecArg } from './sandbox-spec';
|
|
7
|
+
type SandboxView = Omit<PreviewView, 'services'> & {
|
|
8
|
+
sandbox?: {
|
|
9
|
+
name: string;
|
|
10
|
+
pinned: boolean;
|
|
11
|
+
variables: Record<string, Record<string, string>>;
|
|
12
|
+
} | null;
|
|
13
|
+
services: Array<PreviewView['services'][number] & {
|
|
14
|
+
serviceId: string;
|
|
15
|
+
imageTag?: string | null;
|
|
16
|
+
imageSource?: string | null;
|
|
17
|
+
ref?: string | null;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
interface Named {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
}
|
|
24
|
+
declare abstract class SandboxSub extends CommandRunner {
|
|
25
|
+
protected readonly api: ApiService;
|
|
26
|
+
protected readonly config: CliConfigService;
|
|
27
|
+
protected readonly output: OutputService;
|
|
28
|
+
constructor(api: ApiService, config: CliConfigService, output: OutputService);
|
|
29
|
+
protected org(): string;
|
|
30
|
+
protected project(given?: string): string;
|
|
31
|
+
protected base(): string;
|
|
32
|
+
protected previews(): string;
|
|
33
|
+
protected services(projectId: string): Promise<Named[]>;
|
|
34
|
+
protected environments(projectId: string): Promise<Named[]>;
|
|
35
|
+
protected specs(projectId: string, args?: ServiceSpecArg[]): Promise<{
|
|
36
|
+
serviceId: string;
|
|
37
|
+
source: SandboxSource;
|
|
38
|
+
}[]>;
|
|
39
|
+
protected show(p: SandboxView): void;
|
|
40
|
+
protected waitFor(id: string, json?: boolean): Promise<SandboxView>;
|
|
41
|
+
protected fail(err: unknown): void;
|
|
42
|
+
}
|
|
43
|
+
interface UpOptions {
|
|
44
|
+
project?: string;
|
|
45
|
+
service?: ServiceSpecArg[];
|
|
46
|
+
template?: string;
|
|
47
|
+
fromEnv?: string;
|
|
48
|
+
base?: string;
|
|
49
|
+
ttl?: number;
|
|
50
|
+
shared?: boolean;
|
|
51
|
+
wait?: boolean;
|
|
52
|
+
json?: boolean;
|
|
53
|
+
dryRun?: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface SandboxPlan {
|
|
56
|
+
base: {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
};
|
|
60
|
+
services: Array<{
|
|
61
|
+
serviceId: string;
|
|
62
|
+
name: string;
|
|
63
|
+
inBase: boolean;
|
|
64
|
+
selected: boolean;
|
|
65
|
+
requiredBy: string[];
|
|
66
|
+
runs: {
|
|
67
|
+
kind: 'base';
|
|
68
|
+
imageTag: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: 'build';
|
|
71
|
+
ref: string;
|
|
72
|
+
why: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'image';
|
|
75
|
+
imageTag: string;
|
|
76
|
+
} | {
|
|
77
|
+
kind: 'unavailable';
|
|
78
|
+
why: string;
|
|
79
|
+
} | null;
|
|
80
|
+
}>;
|
|
81
|
+
suggested: string[];
|
|
82
|
+
blockers: string[];
|
|
83
|
+
warnings: string[];
|
|
84
|
+
}
|
|
85
|
+
export declare function planRuns(p: SandboxPlan['services'][number], baseName: string): string;
|
|
86
|
+
export declare class SandboxUpCommand extends SandboxSub {
|
|
87
|
+
run([name]: string[], o: UpOptions): Promise<void>;
|
|
88
|
+
parseProject(v: string): string;
|
|
89
|
+
parseService(v: string, prev?: ServiceSpecArg[]): ServiceSpecArg[];
|
|
90
|
+
parseTemplate(v: string): string;
|
|
91
|
+
parseFromEnv(v: string): string;
|
|
92
|
+
parseBase(v: string): string;
|
|
93
|
+
parseTtl(v: string): number;
|
|
94
|
+
parseShared(): boolean;
|
|
95
|
+
parseDryRun(): boolean;
|
|
96
|
+
parseWait(): boolean;
|
|
97
|
+
parseJson(): boolean;
|
|
98
|
+
}
|
|
99
|
+
export declare class SandboxListCommand extends SandboxSub {
|
|
100
|
+
run(_a: string[], o: {
|
|
101
|
+
project?: string;
|
|
102
|
+
mine?: boolean;
|
|
103
|
+
json?: boolean;
|
|
104
|
+
}): Promise<void>;
|
|
105
|
+
parseProject(v: string): string;
|
|
106
|
+
parseMine(): boolean;
|
|
107
|
+
parseJson(): boolean;
|
|
108
|
+
}
|
|
109
|
+
export declare class SandboxSetCommand extends SandboxSub {
|
|
110
|
+
run([id]: string[], o: {
|
|
111
|
+
project?: string;
|
|
112
|
+
service?: ServiceSpecArg[];
|
|
113
|
+
remove?: string[];
|
|
114
|
+
json?: boolean;
|
|
115
|
+
}): Promise<void>;
|
|
116
|
+
parseProject(v: string): string;
|
|
117
|
+
parseService(v: string, prev?: ServiceSpecArg[]): ServiceSpecArg[];
|
|
118
|
+
parseRemove(v: string, prev?: string[]): string[];
|
|
119
|
+
parseJson(): boolean;
|
|
120
|
+
}
|
|
121
|
+
export declare class SandboxVarCommand extends SandboxSub {
|
|
122
|
+
run([id, service, pair]: string[], o: {
|
|
123
|
+
json?: boolean;
|
|
124
|
+
}): Promise<void>;
|
|
125
|
+
parseJson(): boolean;
|
|
126
|
+
}
|
|
127
|
+
export declare class SandboxPinCommand extends SandboxSub {
|
|
128
|
+
run([id]: string[]): Promise<void>;
|
|
129
|
+
}
|
|
130
|
+
export declare class SandboxUnpinCommand extends SandboxSub {
|
|
131
|
+
run([id]: string[]): Promise<void>;
|
|
132
|
+
}
|
|
133
|
+
export declare class SandboxSaveCommand extends SandboxSub {
|
|
134
|
+
run([id, name]: string[], o: {
|
|
135
|
+
json?: boolean;
|
|
136
|
+
}): Promise<void>;
|
|
137
|
+
parseJson(): boolean;
|
|
138
|
+
}
|
|
139
|
+
export declare class SandboxTemplatesCommand extends SandboxSub {
|
|
140
|
+
run(_a: string[], o: {
|
|
141
|
+
project?: string;
|
|
142
|
+
json?: boolean;
|
|
143
|
+
}): Promise<void>;
|
|
144
|
+
parseProject(v: string): string;
|
|
145
|
+
parseJson(): boolean;
|
|
146
|
+
}
|
|
147
|
+
export declare class SandboxDownCommand extends SandboxSub {
|
|
148
|
+
run([id]: string[]): Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
export declare class SandboxDeployCommand extends SandboxSub {
|
|
151
|
+
run([environment]: string[], o: {
|
|
152
|
+
project?: string;
|
|
153
|
+
service?: string[];
|
|
154
|
+
all?: boolean;
|
|
155
|
+
confirm?: string;
|
|
156
|
+
json?: boolean;
|
|
157
|
+
}): Promise<void>;
|
|
158
|
+
parseProject(v: string): string;
|
|
159
|
+
parseService(v: string, prev?: string[]): string[];
|
|
160
|
+
parseAll(): boolean;
|
|
161
|
+
parseConfirm(v: string): string;
|
|
162
|
+
parseJson(): boolean;
|
|
163
|
+
}
|
|
164
|
+
export declare class SandboxCommand extends CommandRunner {
|
|
165
|
+
run(): Promise<void>;
|
|
166
|
+
}
|
|
167
|
+
export declare class SandboxModule {
|
|
168
|
+
}
|
|
169
|
+
export {};
|