@secretstartups/workshop 0.3.0 → 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/CHANGELOG.md +39 -1
- package/README.md +18 -0
- package/dist/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/common/api/api.service.js +2 -0
- package/dist/common/api/api.service.js.map +1 -1
- package/dist/preview/git.d.ts +8 -0
- package/dist/preview/git.js +99 -0
- package/dist/preview/git.js.map +1 -0
- package/dist/preview/preview.commands.d.ts +126 -0
- package/dist/preview/preview.commands.js +638 -0
- package/dist/preview/preview.commands.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,42 @@ who use the CLI, not for people reading the diff.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.5.0] - 2026-11-19
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **`workshop preview up --also <repository>=<branch>`**: preview a change that spans
|
|
17
|
+
repositories whose branches are named differently, in one preview. Repeat it for each other
|
|
18
|
+
repository (a service id works in place of the repository). The preview is still named by
|
|
19
|
+
its main branch, so running it again updates the same preview.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- When a service you asked for isn't built from your branch (its repository doesn't have it),
|
|
24
|
+
`preview up` and `preview status` now say so, and how to include it with `--also`, instead
|
|
25
|
+
of leaving it out silently.
|
|
26
|
+
- Without `--workspace`, a branch's preview now gets a workspace of its own, on the project's
|
|
27
|
+
preview environment, instead of landing in a workspace someone else uses. `--workspace`
|
|
28
|
+
previews in one of yours.
|
|
29
|
+
- Needs a Workshop server with these previews; an older one refuses `--also`.
|
|
30
|
+
|
|
31
|
+
## [0.4.0] - 2026-11-18
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- **`workshop preview`**: try a branch at an address of its own before you merge it. Workshop
|
|
36
|
+
builds it on its runners and runs it with throwaway data. Only members of your organization
|
|
37
|
+
can open it, unless you share a link.
|
|
38
|
+
- `preview up` previews the current branch, for every service built from
|
|
39
|
+
`git remote get-url origin`. It must be pushed; `--snapshot` includes uncommitted work
|
|
40
|
+
instead, without touching your branch, index or HEAD. `--wait` follows it until it is
|
|
41
|
+
ready or fails, and `--open` opens it.
|
|
42
|
+
- `preview ls` (`--mine`, `--here` for this branch), `status <id> [--wait]`,
|
|
43
|
+
`logs <id>` (why a service failed), `extend <id> --hours N`, `share <id>` (a link for
|
|
44
|
+
someone outside the organization, 24 hours) and `down <id>`.
|
|
45
|
+
- Every subcommand takes `--json`, so coding agents and scripts can drive it.
|
|
46
|
+
- Needs a Workshop server with previews by branch.
|
|
47
|
+
|
|
12
48
|
## [0.3.0] - 2026-11-10
|
|
13
49
|
|
|
14
50
|
### Added
|
|
@@ -117,7 +153,9 @@ who use the CLI, not for people reading the diff.
|
|
|
117
153
|
|
|
118
154
|
- First public release on npm.
|
|
119
155
|
|
|
120
|
-
[Unreleased]: https://github.com/secretstartups/workshop-cli/compare/v0.
|
|
156
|
+
[Unreleased]: https://github.com/secretstartups/workshop-cli/compare/v0.4.0...HEAD
|
|
157
|
+
[0.4.0]: https://github.com/secretstartups/workshop-cli/compare/v0.3.0...v0.4.0
|
|
158
|
+
[0.3.0]: https://github.com/secretstartups/workshop-cli/compare/v0.2.0...v0.3.0
|
|
121
159
|
[0.2.0]: https://github.com/secretstartups/workshop-cli/compare/v0.1.3...v0.2.0
|
|
122
160
|
[0.1.3]: https://github.com/secretstartups/workshop-cli/compare/v0.1.2...v0.1.3
|
|
123
161
|
[0.1.2]: https://github.com/secretstartups/workshop-cli/compare/v0.1.1...v0.1.2
|
package/README.md
CHANGED
|
@@ -271,6 +271,24 @@ workshop service rollback <serviceId> # Rollback to the previous deployment
|
|
|
271
271
|
workshop service stop <serviceId> # Stop (undeploy) a service
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
+
### Previews
|
|
275
|
+
|
|
276
|
+
Put a branch at an address of its own to try it before merging. It builds on Workshop's runners, runs with throwaway data, and only members of the organization can open it. Coding agents can drive it with `--json`.
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
workshop preview up # Preview the current branch (it must be pushed)
|
|
280
|
+
workshop preview up --snapshot --wait # Include uncommitted work, wait until it's up
|
|
281
|
+
workshop preview up -b feat/x -s <serviceId> --open
|
|
282
|
+
workshop preview ls [--mine] [--here] # Live previews (--here: this branch's)
|
|
283
|
+
workshop preview status <previewId> [--wait]
|
|
284
|
+
workshop preview logs <previewId> # Why a service failed: build and run logs
|
|
285
|
+
workshop preview extend <previewId> --hours 24
|
|
286
|
+
workshop preview share <previewId> # A link for someone outside the organization (24h)
|
|
287
|
+
workshop preview down <previewId> # Delete it (and its --snapshot branch)
|
|
288
|
+
```
|
|
289
|
+
|
|
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
|
+
|
|
274
292
|
### Clusters
|
|
275
293
|
|
|
276
294
|
```bash
|
package/dist/app.module.js
CHANGED
|
@@ -24,6 +24,7 @@ const observability_module_1 = require("./observability/observability.module");
|
|
|
24
24
|
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
|
+
const preview_commands_1 = require("./preview/preview.commands");
|
|
27
28
|
let AppModule = class AppModule {
|
|
28
29
|
};
|
|
29
30
|
exports.AppModule = AppModule;
|
|
@@ -37,6 +38,7 @@ exports.AppModule = AppModule = __decorate([
|
|
|
37
38
|
project_module_1.ProjectModule,
|
|
38
39
|
env_module_1.EnvModule,
|
|
39
40
|
service_module_1.ServiceModule,
|
|
41
|
+
preview_commands_1.PreviewModule,
|
|
40
42
|
cluster_module_1.ClusterModule,
|
|
41
43
|
vpn_module_1.VpnModule,
|
|
42
44
|
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;
|
|
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;AAuBpD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IArBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,0BAAW;YACX,wBAAU;YACV,sBAAS;YACT,8BAAa;YACb,sBAAS;YACT,8BAAa;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"}
|
|
@@ -16,6 +16,7 @@ exports.ApiService = void 0;
|
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
|
18
18
|
const cli_config_service_1 = require("../config/cli-config.service");
|
|
19
|
+
const VERSION = require('../../../package.json').version;
|
|
19
20
|
let ApiService = class ApiService {
|
|
20
21
|
constructor(config) {
|
|
21
22
|
this.config = config;
|
|
@@ -31,6 +32,7 @@ let ApiService = class ApiService {
|
|
|
31
32
|
if (orgId) {
|
|
32
33
|
req.headers['x-organization-id'] = orgId;
|
|
33
34
|
}
|
|
35
|
+
req.headers['x-workshop-client'] = `cli/${VERSION}`;
|
|
34
36
|
return req;
|
|
35
37
|
});
|
|
36
38
|
}
|
|
@@ -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;
|
|
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,CAAC;YACtC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,IAA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AG,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;AAtGY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;qCAI0B,qCAAgB;GAH1C,UAAU,CAsGtB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function currentBranch(cwd?: string): string | null;
|
|
2
|
+
export declare function originUrl(cwd?: string): string | null;
|
|
3
|
+
export declare function isDirty(cwd?: string): boolean;
|
|
4
|
+
export declare function unpushedCount(branch: string, cwd?: string): number | null;
|
|
5
|
+
export declare function snapshotRef(branch: string, remote: string): string;
|
|
6
|
+
export declare function isSnapshotRef(ref: string): boolean;
|
|
7
|
+
export declare function pushSnapshot(ref: string, cwd?: string): string;
|
|
8
|
+
export declare function deleteRemoteBranch(ref: string, cwd?: string): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.currentBranch = currentBranch;
|
|
4
|
+
exports.originUrl = originUrl;
|
|
5
|
+
exports.isDirty = isDirty;
|
|
6
|
+
exports.unpushedCount = unpushedCount;
|
|
7
|
+
exports.snapshotRef = snapshotRef;
|
|
8
|
+
exports.isSnapshotRef = isSnapshotRef;
|
|
9
|
+
exports.pushSnapshot = pushSnapshot;
|
|
10
|
+
exports.deleteRemoteBranch = deleteRemoteBranch;
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
12
|
+
const crypto_1 = require("crypto");
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const os_1 = require("os");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
function git(args, opts = {}) {
|
|
17
|
+
return (0, child_process_1.execFileSync)('git', args, {
|
|
18
|
+
cwd: opts.cwd,
|
|
19
|
+
env: opts.env ?? process.env,
|
|
20
|
+
encoding: 'utf8',
|
|
21
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
22
|
+
}).trim();
|
|
23
|
+
}
|
|
24
|
+
function currentBranch(cwd) {
|
|
25
|
+
try {
|
|
26
|
+
const name = git(['branch', '--show-current'], { cwd });
|
|
27
|
+
return name || null;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function originUrl(cwd) {
|
|
34
|
+
try {
|
|
35
|
+
return git(['remote', 'get-url', 'origin'], { cwd }) || null;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isDirty(cwd) {
|
|
42
|
+
return git(['status', '--porcelain'], { cwd }).length > 0;
|
|
43
|
+
}
|
|
44
|
+
function unpushedCount(branch, cwd) {
|
|
45
|
+
try {
|
|
46
|
+
git(['fetch', '--quiet', 'origin', branch], { cwd });
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
return Number(git(['rev-list', '--count', `origin/${branch}..HEAD`], { cwd }));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function snapshotRef(branch, remote) {
|
|
59
|
+
const id = (0, crypto_1.createHash)('sha256')
|
|
60
|
+
.update(`${remote}\n${branch}`)
|
|
61
|
+
.digest('hex')
|
|
62
|
+
.slice(0, 12);
|
|
63
|
+
return `workshop-preview/cli-${id}`;
|
|
64
|
+
}
|
|
65
|
+
function isSnapshotRef(ref) {
|
|
66
|
+
return /^workshop-preview\/cli-[0-9a-f]{12}$/.test(ref);
|
|
67
|
+
}
|
|
68
|
+
function pushSnapshot(ref, cwd) {
|
|
69
|
+
if (!isSnapshotRef(ref))
|
|
70
|
+
throw new Error(`Refusing to push a snapshot to ${ref}`);
|
|
71
|
+
const dir = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), 'workshop-preview-'));
|
|
72
|
+
try {
|
|
73
|
+
const env = { ...process.env, GIT_INDEX_FILE: (0, path_1.join)(dir, 'index') };
|
|
74
|
+
git(['read-tree', 'HEAD'], { cwd, env });
|
|
75
|
+
git(['add', '-A'], { cwd, env });
|
|
76
|
+
const tree = git(['write-tree'], { cwd, env });
|
|
77
|
+
const sha = git([
|
|
78
|
+
'commit-tree',
|
|
79
|
+
tree,
|
|
80
|
+
'-p',
|
|
81
|
+
'HEAD',
|
|
82
|
+
'-m',
|
|
83
|
+
'Workshop preview snapshot (uncommitted work)',
|
|
84
|
+
], { cwd, env });
|
|
85
|
+
git(['push', '--force', '--quiet', 'origin', `${sha}:refs/heads/${ref}`], {
|
|
86
|
+
cwd,
|
|
87
|
+
});
|
|
88
|
+
return sha;
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
(0, fs_1.rmSync)(dir, { recursive: true, force: true });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function deleteRemoteBranch(ref, cwd) {
|
|
95
|
+
if (!isSnapshotRef(ref))
|
|
96
|
+
throw new Error(`Refusing to delete ${ref}`);
|
|
97
|
+
git(['push', '--quiet', 'origin', '--delete', ref], { cwd });
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/preview/git.ts"],"names":[],"mappings":";;AAwBA,sCAOC;AAED,8BAMC;AAGD,0BAEC;AAGD,sCAaC;AAQD,kCAMC;AAGD,sCAEC;AAQD,oCA2BC;AAED,gDAGC;AAvHD,iDAA6C;AAC7C,mCAAoC;AACpC,2BAAyC;AACzC,2BAA4B;AAC5B,+BAA4B;AAQ5B,SAAS,GAAG,CACV,IAAc,EACd,OAAkD,EAAE;IAEpD,OAAO,IAAA,4BAAY,EAAC,KAAK,EAAE,IAAI,EAAE;QAC/B,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG;QAC5B,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,SAAgB,aAAa,CAAC,GAAY;IACxC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACxD,OAAO,IAAI,IAAI,IAAI,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAgB,SAAS,CAAC,GAAY;IACpC,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAGD,SAAgB,OAAO,CAAC,GAA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
1
|
+
import { 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
|
+
export interface PreviewView {
|
|
6
|
+
id: string;
|
|
7
|
+
status: string;
|
|
8
|
+
settled: boolean;
|
|
9
|
+
summary: string;
|
|
10
|
+
url: string | null;
|
|
11
|
+
openUrl: string;
|
|
12
|
+
access: 'org' | 'public';
|
|
13
|
+
accessNote: string | null;
|
|
14
|
+
branch: string | null;
|
|
15
|
+
origin: string;
|
|
16
|
+
originClient: string | null;
|
|
17
|
+
expiresAt: string;
|
|
18
|
+
workspace: {
|
|
19
|
+
id: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
};
|
|
22
|
+
workspaceUrl: string | null;
|
|
23
|
+
services: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
role: string;
|
|
26
|
+
state: string;
|
|
27
|
+
url: string | null;
|
|
28
|
+
error: string | null;
|
|
29
|
+
}>;
|
|
30
|
+
notes?: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface PreviewAlso {
|
|
33
|
+
branch: string;
|
|
34
|
+
repository?: string;
|
|
35
|
+
serviceIds?: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function parseAlso(value: string): PreviewAlso;
|
|
38
|
+
declare abstract class PreviewSub extends CommandRunner {
|
|
39
|
+
protected readonly api: ApiService;
|
|
40
|
+
protected readonly config: CliConfigService;
|
|
41
|
+
protected readonly output: OutputService;
|
|
42
|
+
constructor(api: ApiService, config: CliConfigService, output: OutputService);
|
|
43
|
+
protected base(): string;
|
|
44
|
+
protected show(p: PreviewView): void;
|
|
45
|
+
protected waitFor(id: string, json?: boolean): Promise<PreviewView>;
|
|
46
|
+
protected fail(err: unknown): void;
|
|
47
|
+
}
|
|
48
|
+
interface UpOptions {
|
|
49
|
+
branch?: string;
|
|
50
|
+
service?: string[];
|
|
51
|
+
also?: PreviewAlso[];
|
|
52
|
+
workspace?: string;
|
|
53
|
+
repository?: string;
|
|
54
|
+
ttl?: number;
|
|
55
|
+
snapshot?: boolean;
|
|
56
|
+
wait?: boolean;
|
|
57
|
+
open?: boolean;
|
|
58
|
+
json?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export declare class PreviewUpCommand extends PreviewSub {
|
|
61
|
+
run(_args: string[], o: UpOptions): Promise<void>;
|
|
62
|
+
parseBranch(v: string): string;
|
|
63
|
+
parseService(v: string, prev?: string[]): string[];
|
|
64
|
+
parseAlso(v: string, prev?: PreviewAlso[]): PreviewAlso[];
|
|
65
|
+
parseWorkspace(v: string): string;
|
|
66
|
+
parseRepository(v: string): string;
|
|
67
|
+
parseTtl(v: string): number;
|
|
68
|
+
parseSnapshot(): boolean;
|
|
69
|
+
parseWait(): boolean;
|
|
70
|
+
parseOpen(): boolean;
|
|
71
|
+
parseJson(): boolean;
|
|
72
|
+
}
|
|
73
|
+
export declare class PreviewListCommand extends PreviewSub {
|
|
74
|
+
run(_args: string[], o: {
|
|
75
|
+
mine?: boolean;
|
|
76
|
+
here?: boolean;
|
|
77
|
+
json?: boolean;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
parseMine(): boolean;
|
|
80
|
+
parseHere(): boolean;
|
|
81
|
+
parseJson(): boolean;
|
|
82
|
+
}
|
|
83
|
+
export declare class PreviewStatusCommand extends PreviewSub {
|
|
84
|
+
run([id]: string[], o: {
|
|
85
|
+
wait?: boolean;
|
|
86
|
+
json?: boolean;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
parseWait(): boolean;
|
|
89
|
+
parseJson(): boolean;
|
|
90
|
+
}
|
|
91
|
+
export declare class PreviewLogsCommand extends PreviewSub {
|
|
92
|
+
run([id]: string[], o: {
|
|
93
|
+
service?: string;
|
|
94
|
+
json?: boolean;
|
|
95
|
+
}): Promise<void>;
|
|
96
|
+
parseService(v: string): string;
|
|
97
|
+
parseJson(): boolean;
|
|
98
|
+
}
|
|
99
|
+
export declare class PreviewExtendCommand extends PreviewSub {
|
|
100
|
+
run([id]: string[], o: {
|
|
101
|
+
hours?: number;
|
|
102
|
+
json?: boolean;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
parseHours(v: string): number;
|
|
105
|
+
parseJson(): boolean;
|
|
106
|
+
}
|
|
107
|
+
export declare class PreviewShareCommand extends PreviewSub {
|
|
108
|
+
run([id]: string[], o: {
|
|
109
|
+
hours?: number;
|
|
110
|
+
json?: boolean;
|
|
111
|
+
}): Promise<void>;
|
|
112
|
+
parseHours(v: string): number;
|
|
113
|
+
parseJson(): boolean;
|
|
114
|
+
}
|
|
115
|
+
export declare class PreviewDownCommand extends PreviewSub {
|
|
116
|
+
run([id]: string[], o: {
|
|
117
|
+
json?: boolean;
|
|
118
|
+
}): Promise<void>;
|
|
119
|
+
parseJson(): boolean;
|
|
120
|
+
}
|
|
121
|
+
export declare class PreviewCommand extends CommandRunner {
|
|
122
|
+
run(): Promise<void>;
|
|
123
|
+
}
|
|
124
|
+
export declare class PreviewModule {
|
|
125
|
+
}
|
|
126
|
+
export {};
|