deepline 0.3.294 → 0.3.296
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/dist/bundling-sources/sdk/src/compat.ts +35 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +108 -35
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +14 -1
- package/dist/cli/auth-JCGIDVDF.mjs +31 -0
- package/dist/cli/auth-QDWV3TXX.js +31 -0
- package/dist/cli/billing-OQBSIXRG.mjs +1749 -0
- package/dist/cli/billing-YBK3J4WP.js +1749 -0
- package/dist/cli/chunk-2C3AVPTY.js +5688 -0
- package/dist/cli/chunk-2MZ5EQZE.mjs +499 -0
- package/dist/cli/chunk-3KC45UVF.js +150 -0
- package/dist/cli/chunk-3XX5TEA4.js +15 -0
- package/dist/cli/chunk-4MBOJQPL.mjs +0 -0
- package/dist/cli/chunk-4Y6CG4GE.js +2240 -0
- package/dist/cli/chunk-4ZB3CJRD.js +1269 -0
- package/dist/cli/chunk-5JLQPVNX.js +3056 -0
- package/dist/cli/chunk-6A3TJUWC.js +76 -0
- package/dist/cli/chunk-6HPEDBSJ.js +1995 -0
- package/dist/cli/chunk-7D6QG5KF.js +890 -0
- package/dist/cli/chunk-7P5AA3SN.js +344 -0
- package/dist/cli/chunk-7UAO5MWV.mjs +190 -0
- package/dist/cli/chunk-A7427JJH.js +190 -0
- package/dist/cli/chunk-AQRTLPHZ.js +735 -0
- package/dist/cli/chunk-AYHLUHE5.js +52 -0
- package/dist/cli/chunk-BZ77OTRF.mjs +923 -0
- package/dist/cli/chunk-CBVIJSHF.mjs +560 -0
- package/dist/cli/chunk-COGTRVWW.js +30 -0
- package/dist/cli/chunk-DLIRSHV6.mjs +28 -0
- package/dist/cli/chunk-DYWHXO7O.mjs +34 -0
- package/dist/cli/chunk-EDWJY6T4.mjs +3056 -0
- package/dist/cli/chunk-EXMLR72R.mjs +0 -0
- package/dist/cli/chunk-G46HHFNB.mjs +1269 -0
- package/dist/cli/chunk-GAMFK2ZP.mjs +148 -0
- package/dist/cli/chunk-GLKUGBTP.mjs +2240 -0
- package/dist/cli/chunk-GONRLVV3.js +3440 -0
- package/dist/cli/chunk-GVUJJJ5G.mjs +76 -0
- package/dist/cli/chunk-H7HIDGZ7.mjs +150 -0
- package/dist/cli/chunk-HUZXWOSK.mjs +503 -0
- package/dist/cli/chunk-I5YZLGMG.js +1 -0
- package/dist/cli/chunk-ITOFSXIU.mjs +15 -0
- package/dist/cli/chunk-J2D3VDOU.mjs +5688 -0
- package/dist/cli/chunk-J5NA2TTX.js +503 -0
- package/dist/cli/chunk-JCS5TPNY.mjs +3440 -0
- package/dist/cli/chunk-JNNOCMQY.js +47 -0
- package/dist/cli/chunk-KRD6H754.mjs +30 -0
- package/dist/cli/chunk-L4HBNHFW.js +34 -0
- package/dist/cli/chunk-LA46MMTL.js +560 -0
- package/dist/cli/chunk-LIKFCE7Z.js +190 -0
- package/dist/cli/chunk-MIMASXO4.mjs +389 -0
- package/dist/cli/chunk-NPPJX3BL.mjs +1995 -0
- package/dist/cli/chunk-NTEZFZLE.mjs +890 -0
- package/dist/cli/chunk-NXDRDJ4K.js +389 -0
- package/dist/cli/chunk-NXGCO4JB.mjs +344 -0
- package/dist/cli/chunk-OG64RBAC.js +6 -0
- package/dist/cli/chunk-OWJZUE3Y.mjs +103 -0
- package/dist/cli/chunk-QSIO4TX2.mjs +190 -0
- package/dist/cli/chunk-RCUE5C5C.mjs +735 -0
- package/dist/cli/chunk-SDK3ZA2C.js +103 -0
- package/dist/cli/chunk-SFLARO4Y.mjs +47 -0
- package/dist/cli/chunk-TAC3JIFE.mjs +354 -0
- package/dist/cli/chunk-UC6GHEL4.js +499 -0
- package/dist/cli/chunk-UFS752TU.mjs +52 -0
- package/dist/cli/chunk-UNEMDKXN.js +1 -0
- package/dist/cli/chunk-WB6Z2Q44.mjs +1622 -0
- package/dist/cli/chunk-WJYPBHTE.js +148 -0
- package/dist/cli/chunk-WOHBA5PV.js +354 -0
- package/dist/cli/chunk-WZYKRD7T.mjs +6 -0
- package/dist/cli/chunk-XNYIZMNQ.js +28 -0
- package/dist/cli/chunk-ZDO3TO3M.js +1622 -0
- package/dist/cli/chunk-ZDOC4HFL.js +923 -0
- package/dist/cli/client-CZDA4JKO.mjs +20 -0
- package/dist/cli/client-IZGIN2ZA.js +20 -0
- package/dist/cli/csv-6KOMZA2H.mjs +585 -0
- package/dist/cli/csv-UTEQY3NA.js +585 -0
- package/dist/cli/db-D5EP6TKO.mjs +486 -0
- package/dist/cli/db-SIBLPIKC.js +486 -0
- package/dist/cli/executions-2PHT57IO.js +28 -0
- package/dist/cli/executions-DFWM2YYY.mjs +28 -0
- package/dist/cli/feedback-GZW37JMI.mjs +107 -0
- package/dist/cli/feedback-IQVWIJZ4.js +107 -0
- package/dist/cli/getting-started.js +18 -76
- package/dist/cli/getting-started.mjs +10 -37
- package/dist/cli/git-563GYLMA.js +23 -0
- package/dist/cli/git-B72Y4FFQ.mjs +23 -0
- package/dist/cli/index.js +291 -54294
- package/dist/cli/index.mjs +209 -54352
- package/dist/cli/legacy-noops-37F5MX2P.mjs +157 -0
- package/dist/cli/legacy-noops-IFGVDCOM.js +157 -0
- package/dist/cli/monitors-42H6LOVT.mjs +3251 -0
- package/dist/cli/monitors-GQCHXBXZ.js +3251 -0
- package/dist/cli/org-4GCPBTGR.js +849 -0
- package/dist/cli/org-JYZA3ZRJ.mjs +849 -0
- package/dist/cli/play-46ZJ4FMI.js +18439 -0
- package/dist/cli/play-Q2XV3FZZ.mjs +18439 -0
- package/dist/cli/providers-CTKQP45X.mjs +95 -0
- package/dist/cli/providers-PCNF5E3K.js +95 -0
- package/dist/cli/proxy-env-EBANZHPV.js +161 -0
- package/dist/cli/proxy-env-M4ZHXHRL.mjs +161 -0
- package/dist/cli/quickstart-FTHWRVWN.js +69 -0
- package/dist/cli/quickstart-X7EVVWRG.mjs +69 -0
- package/dist/cli/search-73YPOFDO.mjs +18 -0
- package/dist/cli/search-XA5UVC3G.js +18 -0
- package/dist/cli/secrets-OUMPT4FX.mjs +400 -0
- package/dist/cli/secrets-UOEVR73Q.js +400 -0
- package/dist/cli/sessions-CMKXCN5Y.js +15 -0
- package/dist/cli/sessions-ZIFGDZE7.mjs +15 -0
- package/dist/cli/settings-OO5R3G52.mjs +846 -0
- package/dist/cli/settings-ULZT2NIC.js +846 -0
- package/dist/cli/setup-6GZH52OZ.mjs +1257 -0
- package/dist/cli/setup-DHGERXPZ.js +1257 -0
- package/dist/cli/skills-Q7NUCS2W.js +28 -0
- package/dist/cli/skills-T3EY2656.mjs +28 -0
- package/dist/cli/tools-BIMOAOTX.mjs +2955 -0
- package/dist/cli/tools-ODXVCKO7.js +2955 -0
- package/dist/cli/update-UMB3ULBR.js +28 -0
- package/dist/cli/update-X4HX7Z3M.mjs +28 -0
- package/dist/cli/workflow-EAUFVPIP.mjs +1936 -0
- package/dist/cli/workflow-IVLCPFTG.js +1936 -0
- package/dist/helpers.js +6 -32
- package/dist/helpers.mjs +2 -0
- package/dist/index.js +1972 -12825
- package/dist/index.mjs +1910 -12672
- package/dist/install-integrity.json +110 -0
- package/dist/monitor-fleet-contract.js +31 -730
- package/dist/monitor-fleet-contract.mjs +18 -667
- package/dist/monitor-input-contract.js +10 -390
- package/dist/monitor-input-contract.mjs +7 -348
- package/dist/plays/bundle-play-file.mjs +13 -5178
- package/dist/plays/csv-data-input.js +5 -3132
- package/dist/plays/csv-data-input.mjs +5 -3105
- package/dist/plays/run-request.js +56 -664
- package/dist/plays/run-request.mjs +30 -588
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +5 -212
- package/dist/release.mjs +5 -185
- package/package.json +1 -1
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk7D6QG5KFjs = require('./chunk-7D6QG5KF.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk6HPEDBSJjs = require('./chunk-6HPEDBSJ.js');
|
|
9
|
+
|
|
10
|
+
// src/cli/commands/git.ts
|
|
11
|
+
function shellQuote(value) {
|
|
12
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
13
|
+
}
|
|
14
|
+
function renderProject(project) {
|
|
15
|
+
const root = project.rootDirectory ? ` (${project.rootDirectory})` : "";
|
|
16
|
+
const flags = [
|
|
17
|
+
project.disabled ? "unlinked" : "linked",
|
|
18
|
+
`deploys ${project.productionBranch}`,
|
|
19
|
+
project.checkOnPullRequest ? "PR checks on" : "PR checks off"
|
|
20
|
+
].join(", ");
|
|
21
|
+
return `${project.id} ${project.repoFullName}${root} - ${flags}`;
|
|
22
|
+
}
|
|
23
|
+
function renderDeployment(deployment) {
|
|
24
|
+
const fromDirectory = deployment.playProjectId === null;
|
|
25
|
+
const kind = fromDirectory ? "directory deploy" : deployment.isProduction ? "production" : deployment.trigger === "pull_request" ? `pr #${_nullishCoalesce(deployment.pullRequestNumber, () => ( "?"))}` : deployment.trigger;
|
|
26
|
+
const suffix = deployment.error ? ` - ${deployment.error.slice(0, 80)}` : "";
|
|
27
|
+
const source = [
|
|
28
|
+
_optionalChain([deployment, 'access', _ => _.commitSha, 'optionalAccess', _2 => _2.slice, 'call', _3 => _3(0, 10)]),
|
|
29
|
+
_optionalChain([deployment, 'access', _4 => _4.ref, 'optionalAccess', _5 => _5.replace, 'call', _6 => _6("refs/heads/", "")]),
|
|
30
|
+
fromDirectory ? deployment.repoFullName : null
|
|
31
|
+
].filter(Boolean).join(" ") || "no git metadata";
|
|
32
|
+
return `${deployment.id} ${source} (${kind}) - ${deployment.status}${suffix}`;
|
|
33
|
+
}
|
|
34
|
+
async function handleList(options) {
|
|
35
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
36
|
+
const payload = await http.get(
|
|
37
|
+
`/api/v2/play-projects${options.all ? "?includeDisabled=1" : ""}`
|
|
38
|
+
);
|
|
39
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
40
|
+
{
|
|
41
|
+
projects: payload.projects,
|
|
42
|
+
count: payload.projects.length,
|
|
43
|
+
render: {
|
|
44
|
+
sections: [
|
|
45
|
+
{
|
|
46
|
+
title: "linked repositories",
|
|
47
|
+
lines: payload.projects.length ? payload.projects.map(renderProject) : [
|
|
48
|
+
"No repositories are linked. Run `deepline git repos` to see what the GitHub installation can reach, then `deepline git link`."
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{ json: options.json }
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function describeInstallationStatus(installation) {
|
|
58
|
+
switch (installation.status) {
|
|
59
|
+
case "active":
|
|
60
|
+
return [
|
|
61
|
+
`Connected to ${installation.accountLogin} (installation ${installation.installationId}).`
|
|
62
|
+
];
|
|
63
|
+
case "uninstalled":
|
|
64
|
+
return [
|
|
65
|
+
`The Deepline GitHub App was uninstalled from ${installation.accountLogin}${installation.uninstalledAt ? ` at ${new Date(installation.uninstalledAt).toISOString()}` : ""}.`,
|
|
66
|
+
"Deploys are paused for every linked repository. Run `deepline git connect`, then `deepline git link <owner/repo>` again for each repository; links from the old installation cannot be resumed."
|
|
67
|
+
];
|
|
68
|
+
case "suspended":
|
|
69
|
+
return [
|
|
70
|
+
`GitHub suspended the Deepline App on ${installation.accountLogin}${installation.suspendedAt ? ` at ${new Date(installation.suspendedAt).toISOString()}` : ""}.`,
|
|
71
|
+
"Pushes are not delivered while it is suspended; unsuspend it in GitHub settings."
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function handleStatus(options) {
|
|
76
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
77
|
+
const payload = await http.get("/api/v2/github/installation");
|
|
78
|
+
const installation = payload.installation;
|
|
79
|
+
const others = (_nullishCoalesce(payload.installations, () => ( []))).filter(
|
|
80
|
+
(row) => row.installationId !== _optionalChain([installation, 'optionalAccess', _7 => _7.installationId])
|
|
81
|
+
);
|
|
82
|
+
const lines = installation ? describeInstallationStatus(installation) : [
|
|
83
|
+
"No GitHub installation is connected to this workspace. Run `deepline git connect`."
|
|
84
|
+
];
|
|
85
|
+
for (const other of others) {
|
|
86
|
+
lines.push(
|
|
87
|
+
`Also: ${other.accountLogin} (installation ${other.installationId}) is ${other.status}.`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
const byId = new Map(
|
|
91
|
+
(_nullishCoalesce(payload.installations, () => ( []))).map((row) => [row.installationId, row])
|
|
92
|
+
);
|
|
93
|
+
const { projects } = await http.get(
|
|
94
|
+
"/api/v2/play-projects?includeDisabled=1"
|
|
95
|
+
);
|
|
96
|
+
const affected_links = projects.map((project) => {
|
|
97
|
+
const own = byId.get(project.installationId);
|
|
98
|
+
const verdict = !own ? "unknown" : own.status === "active" ? null : own.status;
|
|
99
|
+
return verdict ? {
|
|
100
|
+
id: project.id,
|
|
101
|
+
repoId: project.repoId,
|
|
102
|
+
repoFullName: project.repoFullName,
|
|
103
|
+
rootDirectory: project.rootDirectory,
|
|
104
|
+
productionBranch: project.productionBranch,
|
|
105
|
+
manifestPath: project.manifestPath,
|
|
106
|
+
checkOnPullRequest: project.checkOnPullRequest,
|
|
107
|
+
disabled: project.disabled,
|
|
108
|
+
installationId: project.installationId,
|
|
109
|
+
installationStatus: verdict
|
|
110
|
+
} : null;
|
|
111
|
+
}).filter((row) => row !== null);
|
|
112
|
+
const activeInstallations = (_nullishCoalesce(payload.installations, () => ( []))).filter(
|
|
113
|
+
(row) => row.status === "active"
|
|
114
|
+
);
|
|
115
|
+
const relinkCommand = (link) => [
|
|
116
|
+
// The numeric repo id, not the name: a repository renamed while the
|
|
117
|
+
// App was gone keeps a stale name here, and `git link` accepts the id.
|
|
118
|
+
`deepline git link ${link.repoId}`,
|
|
119
|
+
// Stored values are admin-controlled text and this line is
|
|
120
|
+
// copy-pasted into a shell by whoever reads it, so every
|
|
121
|
+
// interpolated value below is quoted.
|
|
122
|
+
`--branch ${shellQuote(link.productionBranch)}`,
|
|
123
|
+
link.rootDirectory ? `--root-dir ${shellQuote(link.rootDirectory)}` : "",
|
|
124
|
+
link.manifestPath && link.manifestPath !== "deepline.json" ? `--manifest ${shellQuote(link.manifestPath)}` : "",
|
|
125
|
+
link.checkOnPullRequest ? "" : "--no-pr-checks",
|
|
126
|
+
// With several active installations no id is guessed: the reader picks.
|
|
127
|
+
activeInstallations.length > 1 ? "--installation <id>" : ""
|
|
128
|
+
].filter(Boolean).join(" ");
|
|
129
|
+
for (const link of affected_links) {
|
|
130
|
+
const label = `${link.repoFullName}${link.rootDirectory ? ` (${link.rootDirectory})` : ""}`;
|
|
131
|
+
lines.push(
|
|
132
|
+
link.installationStatus !== "suspended" ? `Link again: ${label} \u2014 its installation ${link.installationId} is ${link.installationStatus}; run \`${relinkCommand(link)}\`${activeInstallations.length > 1 ? ` with <id> being the installation that reaches this repo: ${activeInstallations.map((row) => `${row.installationId} (${row.accountLogin})`).join(", ")}` : ""}.` : (
|
|
133
|
+
// A link disabled during the suspension stays disabled; only an
|
|
134
|
+
// enabled one picks up again on its own when GitHub unsuspends.
|
|
135
|
+
link.disabled ? `Paused and disabled: ${label} \u2014 its installation is suspended, and the link stays disabled after GitHub unsuspends it until you run \`deepline git set ${link.id} --enabled\`.` : `Paused: ${label} \u2014 its installation is suspended; pushes resume when GitHub unsuspends it.`
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
140
|
+
{
|
|
141
|
+
installation,
|
|
142
|
+
installations: _nullishCoalesce(payload.installations, () => ( [])),
|
|
143
|
+
affected_links,
|
|
144
|
+
render: { sections: [{ title: "github installation", lines }] }
|
|
145
|
+
},
|
|
146
|
+
{ json: options.json }
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
async function handleRepos(options) {
|
|
150
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
151
|
+
const query = options.installation ? `?installationId=${encodeURIComponent(options.installation)}` : "";
|
|
152
|
+
const payload = await http.get(`/api/v2/github/repos${query}`);
|
|
153
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
154
|
+
{
|
|
155
|
+
installation: payload.installation,
|
|
156
|
+
repositories: payload.repositories,
|
|
157
|
+
count: payload.repositories.length,
|
|
158
|
+
render: {
|
|
159
|
+
sections: [
|
|
160
|
+
{
|
|
161
|
+
title: `repos on installation @${payload.installation.accountLogin} (${payload.installation.repositorySelection})`,
|
|
162
|
+
lines: payload.repositories.map(
|
|
163
|
+
(repo) => `${repo.repoId} ${repo.fullName} (default: ${repo.defaultBranch}${repo.private ? ", private" : ""}${repo.fork ? ", fork" : ""})`
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{ json: options.json }
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
async function resolveRepoId(repo, installation) {
|
|
173
|
+
if (/^\d+$/.test(repo)) return Number(repo);
|
|
174
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
175
|
+
const query = installation ? `?installationId=${encodeURIComponent(installation)}` : "";
|
|
176
|
+
const payload = await http.get(
|
|
177
|
+
`/api/v2/github/repos${query}`
|
|
178
|
+
);
|
|
179
|
+
const match = payload.repositories.find(
|
|
180
|
+
(entry) => entry.fullName.toLowerCase() === repo.toLowerCase()
|
|
181
|
+
);
|
|
182
|
+
if (!match) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
`Repo "${repo}" is not accessible to the workspace's GitHub installation. Run \`deepline git repos\` to list what is.`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return match.repoId;
|
|
188
|
+
}
|
|
189
|
+
async function handleLink(repo, options) {
|
|
190
|
+
const repoId = await resolveRepoId(repo, options.installation);
|
|
191
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
192
|
+
const payload = await http.post("/api/v2/play-projects", {
|
|
193
|
+
repoId,
|
|
194
|
+
...options.installation !== void 0 ? { installationId: options.installation } : {},
|
|
195
|
+
...options.rootDir !== void 0 ? { rootDirectory: options.rootDir } : {},
|
|
196
|
+
...options.manifest !== void 0 ? { manifestPath: options.manifest } : {},
|
|
197
|
+
...options.branch !== void 0 ? { productionBranch: options.branch } : {},
|
|
198
|
+
...options.prChecks !== void 0 ? { checkOnPullRequest: options.prChecks } : {}
|
|
199
|
+
});
|
|
200
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
201
|
+
{
|
|
202
|
+
project: payload.project,
|
|
203
|
+
render: {
|
|
204
|
+
sections: [
|
|
205
|
+
{
|
|
206
|
+
title: "linked",
|
|
207
|
+
lines: [
|
|
208
|
+
renderProject(payload.project),
|
|
209
|
+
...(_nullishCoalesce(payload.warnings, () => ( []))).map(
|
|
210
|
+
(warning) => `WARNING: ${warning}`
|
|
211
|
+
),
|
|
212
|
+
"Pushes to the production branch now register and promote changed plays.",
|
|
213
|
+
"Anyone who can push to this repo can change what runs in this workspace."
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{ json: options.json }
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
async function handleGet(id, options) {
|
|
223
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
224
|
+
const payload = await http.get(
|
|
225
|
+
`/api/v2/play-projects/${encodeURIComponent(id)}`
|
|
226
|
+
);
|
|
227
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
228
|
+
{
|
|
229
|
+
project: payload.project,
|
|
230
|
+
render: {
|
|
231
|
+
sections: [
|
|
232
|
+
{
|
|
233
|
+
title: "linked repository",
|
|
234
|
+
lines: [renderProject(payload.project)]
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{ json: options.json }
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
async function handleSet(id, options) {
|
|
243
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
244
|
+
const payload = await http.patch(
|
|
245
|
+
`/api/v2/play-projects/${encodeURIComponent(id)}`,
|
|
246
|
+
{
|
|
247
|
+
...options.branch !== void 0 ? { productionBranch: options.branch } : {},
|
|
248
|
+
...options.rootDir !== void 0 ? { rootDirectory: options.rootDir } : {},
|
|
249
|
+
...options.manifest !== void 0 ? { manifestPath: options.manifest } : {},
|
|
250
|
+
...options.prChecks !== void 0 ? { checkOnPullRequest: options.prChecks } : {},
|
|
251
|
+
...options.disabled !== void 0 ? { disabled: options.disabled } : {}
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
255
|
+
{
|
|
256
|
+
project: payload.project,
|
|
257
|
+
render: {
|
|
258
|
+
sections: [
|
|
259
|
+
{ title: "updated", lines: [renderProject(payload.project)] }
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{ json: options.json }
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
async function handleUnlink(id, options) {
|
|
267
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
268
|
+
await http.delete(`/api/v2/play-projects/${encodeURIComponent(id)}`);
|
|
269
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
270
|
+
{
|
|
271
|
+
ok: true,
|
|
272
|
+
id,
|
|
273
|
+
render: {
|
|
274
|
+
sections: [
|
|
275
|
+
{
|
|
276
|
+
title: "unlinked",
|
|
277
|
+
lines: [
|
|
278
|
+
`Repository link ${id} removed. Deployments stop immediately and in-flight deploy credentials die; live plays keep running.`,
|
|
279
|
+
"Plays this repository deployed are released: they keep their live version, stop showing it as their source, and are no longer marked drifted from it."
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{ json: options.json }
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
async function handleConnect(options) {
|
|
289
|
+
const baseUrl = _chunk6HPEDBSJjs.resolveBaseUrlOnly.call(void 0, );
|
|
290
|
+
const connectUrl = `${baseUrl.replace(/\/$/, "")}/api/v2/github/connect`;
|
|
291
|
+
const opened = _chunk7D6QG5KFjs.openInBrowser.call(void 0, connectUrl);
|
|
292
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
293
|
+
{
|
|
294
|
+
connectUrl,
|
|
295
|
+
browser: opened,
|
|
296
|
+
render: {
|
|
297
|
+
sections: [
|
|
298
|
+
{
|
|
299
|
+
title: "connect GitHub",
|
|
300
|
+
lines: [
|
|
301
|
+
"Git deploys is in beta and requires workspace enablement. Contact the Deepline team to request enablement if interested.",
|
|
302
|
+
opened === "opened" ? `Opened ${connectUrl} in your browser.` : `Open ${connectUrl} in your browser.`,
|
|
303
|
+
"Sign in as a workspace admin if prompted, approve the GitHub",
|
|
304
|
+
"installation, then return here and run `deepline git repos`."
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{ json: options.json }
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
async function handleDeploymentsList(options) {
|
|
314
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
315
|
+
const query = new URLSearchParams();
|
|
316
|
+
if (options.repo) query.set("projectId", options.repo);
|
|
317
|
+
if (options.limit) query.set("limit", options.limit);
|
|
318
|
+
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
319
|
+
const payload = await http.get(
|
|
320
|
+
`/api/v2/deployments${suffix}`
|
|
321
|
+
);
|
|
322
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
323
|
+
{
|
|
324
|
+
deployments: payload.deployments,
|
|
325
|
+
count: payload.deployments.length,
|
|
326
|
+
render: {
|
|
327
|
+
sections: [
|
|
328
|
+
{
|
|
329
|
+
title: "deployments",
|
|
330
|
+
lines: payload.deployments.length ? payload.deployments.map(renderDeployment) : [
|
|
331
|
+
"No deployments yet. Push to a linked repository, or run `deepline plays deploy`."
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{ json: options.json }
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
function renderDeploymentPlayLines(results) {
|
|
341
|
+
const plays = _optionalChain([results, 'optionalAccess', _8 => _8.plays]);
|
|
342
|
+
if (!Array.isArray(plays)) return [];
|
|
343
|
+
return plays.flatMap((play) => {
|
|
344
|
+
const version = play.version === void 0 ? "" : play.previousVersion === void 0 ? ` v${play.version}` : ` v${play.previousVersion} -> v${play.version}`;
|
|
345
|
+
const file = play.file ? ` (${play.file})` : "";
|
|
346
|
+
const sdkUpdated = play.sdkUpdated ? " (SDK updated)" : "";
|
|
347
|
+
return [
|
|
348
|
+
`${_nullishCoalesce(play.name, () => ( "?"))}${file} - ${_nullishCoalesce(play.status, () => ( "?"))}${version}${sdkUpdated}`,
|
|
349
|
+
...play.error ? [` error: ${play.error}`] : [],
|
|
350
|
+
...play.warning ? [` warning: ${play.warning}`] : []
|
|
351
|
+
];
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function renderDeploymentMonitorLines(results) {
|
|
355
|
+
const monitors = _optionalChain([results, 'optionalAccess', _9 => _9.monitors]);
|
|
356
|
+
if (!Array.isArray(monitors)) return [];
|
|
357
|
+
return monitors.flatMap((monitor) => [
|
|
358
|
+
`${_nullishCoalesce(monitor.key, () => ( "?"))}${monitor.file ? ` (${monitor.file})` : ""} - ${_nullishCoalesce(monitor.status, () => ( "?"))}`,
|
|
359
|
+
...monitor.jobId ? [` job: ${monitor.jobId}`] : [],
|
|
360
|
+
...monitor.credits != null ? [` Deepline credits: ${monitor.credits}`] : [],
|
|
361
|
+
...monitor.error ? [` error: ${monitor.error}`] : [],
|
|
362
|
+
...monitor.warning ? [` warning: ${monitor.warning}`] : []
|
|
363
|
+
]);
|
|
364
|
+
}
|
|
365
|
+
async function handleDeploymentGet(id, options) {
|
|
366
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
367
|
+
const payload = await http.get(`/api/v2/deployments/${encodeURIComponent(id)}`);
|
|
368
|
+
const playLines = renderDeploymentPlayLines(payload.deployment.results);
|
|
369
|
+
const monitorLines = renderDeploymentMonitorLines(payload.deployment.results);
|
|
370
|
+
const repository = _nullishCoalesce(_optionalChain([payload, 'access', _10 => _10.project, 'optionalAccess', _11 => _11.repoFullName]), () => ( payload.deployment.repoFullName));
|
|
371
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
372
|
+
{
|
|
373
|
+
deployment: payload.deployment,
|
|
374
|
+
project: payload.project,
|
|
375
|
+
render: {
|
|
376
|
+
sections: [
|
|
377
|
+
{
|
|
378
|
+
title: `deployment ${payload.deployment.id}${repository ? ` (${repository})` : ""}`,
|
|
379
|
+
lines: [renderDeployment(payload.deployment)]
|
|
380
|
+
},
|
|
381
|
+
...playLines.length ? [{ title: "plays", lines: playLines }] : [],
|
|
382
|
+
...monitorLines.length ? [{ title: "monitors", lines: monitorLines }] : []
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
{ json: options.json }
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
async function handleDeploymentCancel(id, options) {
|
|
390
|
+
const { http } = _chunk7D6QG5KFjs.getAuthedHttpClient.call(void 0, );
|
|
391
|
+
const payload = await http.post(`/api/v2/deployments/${encodeURIComponent(id)}/cancel`, {});
|
|
392
|
+
_chunk7D6QG5KFjs.printCommandEnvelope.call(void 0,
|
|
393
|
+
{
|
|
394
|
+
cancelled: payload.cancelled,
|
|
395
|
+
deployment: payload.deployment,
|
|
396
|
+
render: {
|
|
397
|
+
sections: [
|
|
398
|
+
{
|
|
399
|
+
title: payload.cancelled ? "cancelled" : "already cancelled",
|
|
400
|
+
lines: [
|
|
401
|
+
payload.deployment ? renderDeployment(payload.deployment) : `Deployment ${id} cancelled.`,
|
|
402
|
+
"The build stops at its next step and nothing from it goes live."
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
{ json: options.json }
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
function registerGitCommands(program) {
|
|
412
|
+
const git = program.command("git").alias("projects").description(
|
|
413
|
+
"Git deploys (beta): link repositories and deploy plays on push."
|
|
414
|
+
).addHelpText(
|
|
415
|
+
"after",
|
|
416
|
+
`
|
|
417
|
+
Git deploys is in beta and requires workspace enablement.
|
|
418
|
+
If it is not enabled for your workspace, contact the Deepline team to request
|
|
419
|
+
enablement.
|
|
420
|
+
|
|
421
|
+
Examples:
|
|
422
|
+
deepline git connect
|
|
423
|
+
deepline git status
|
|
424
|
+
deepline git repos
|
|
425
|
+
deepline git link acme/growth --branch main
|
|
426
|
+
deepline git list
|
|
427
|
+
deepline git set <id> --branch release
|
|
428
|
+
deepline git unlink <id>
|
|
429
|
+
deepline git deployments --repo <id>
|
|
430
|
+
deepline git cancel <deployment-id>
|
|
431
|
+
|
|
432
|
+
After linking, push committed Play changes to the configured production branch:
|
|
433
|
+
git push origin main
|
|
434
|
+
|
|
435
|
+
Guide: https://deepline.com/docs/sdk-v2/git-deploys
|
|
436
|
+
`
|
|
437
|
+
);
|
|
438
|
+
git.command("connect").description("Connect a GitHub installation (browser step).").option("--json", "Emit JSON output").action(async (options) => handleConnect(options));
|
|
439
|
+
git.command("status").description(
|
|
440
|
+
"Show the workspace's GitHub installation and whether it is still usable."
|
|
441
|
+
).option("--json", "Emit JSON output").action(async (options) => handleStatus(options));
|
|
442
|
+
git.command("repos").description("List repos the workspace's GitHub installation can reach.").option(
|
|
443
|
+
"--installation <id>",
|
|
444
|
+
"GitHub installation id (required when several are connected)"
|
|
445
|
+
).option("--json", "Emit JSON output").action(
|
|
446
|
+
async (options) => handleRepos(options)
|
|
447
|
+
);
|
|
448
|
+
git.command("list").description("List linked repositories.").option("--all", "Include unlinked repositories").option("--json", "Emit JSON output").action(
|
|
449
|
+
async (options) => handleList(options)
|
|
450
|
+
);
|
|
451
|
+
git.command("link").description("Link a repository to this workspace for deploy-on-push.").argument("<repo>", "Repo full name (owner/name) or numeric repo id").option("--root-dir <path>", "Base path inside the repo for this link").option("--branch <name>", "Production branch (default: repo default)").option(
|
|
452
|
+
"--manifest <file>",
|
|
453
|
+
"Manifest file name under the base path (default: deepline.json)"
|
|
454
|
+
).option(
|
|
455
|
+
"--installation <id>",
|
|
456
|
+
"GitHub installation id (required when several are connected)"
|
|
457
|
+
).option("--no-pr-checks", "Skip Check Runs on pull requests").option("--json", "Emit JSON output").action(
|
|
458
|
+
async (repo, options) => handleLink(repo, options)
|
|
459
|
+
);
|
|
460
|
+
git.command("get").description("Show one linked repository.").argument("<id>", "Repository link id").option("--json", "Emit JSON output").action(async (id, options) => handleGet(id, options));
|
|
461
|
+
git.command("set").description("Update a linked repository.").argument("<id>", "Repository link id").option("--branch <name>", "Production branch").option("--root-dir <path>", "Base path inside the repo for this link").option(
|
|
462
|
+
"--manifest <file>",
|
|
463
|
+
"Manifest file name under the base path (default: deepline.json)"
|
|
464
|
+
).option("--pr-checks", "Enable Check Runs on pull requests").option("--no-pr-checks", "Disable Check Runs on pull requests").option("--disabled", "Pause deployments for this link").option("--enabled", "Resume deployments for this link").option("--json", "Emit JSON output").action(
|
|
465
|
+
async (id, options) => handleSet(id, {
|
|
466
|
+
...options,
|
|
467
|
+
disabled: options.enabled === true ? false : options.disabled === true ? true : void 0
|
|
468
|
+
})
|
|
469
|
+
);
|
|
470
|
+
git.command("unlink").description(
|
|
471
|
+
"Unlink a repository (live plays keep running, and are released from it)."
|
|
472
|
+
).argument("<id>", "Repository link id").option("--json", "Emit JSON output").action(
|
|
473
|
+
async (id, options) => handleUnlink(id, options)
|
|
474
|
+
);
|
|
475
|
+
git.command("deployments").description("Deployment history; pass an id for one deployment.").argument("[id]", "Deployment id (omit to list)").option("--repo <id>", "Filter to one repository link").option("--limit <n>", "Max rows (default 50)").option("--json", "Emit JSON output").action(
|
|
476
|
+
async (id, options) => id ? handleDeploymentGet(id, options) : handleDeploymentsList(options)
|
|
477
|
+
);
|
|
478
|
+
git.command("cancel").description(
|
|
479
|
+
"Cancel a queued or running deployment before its plays go live (admin)."
|
|
480
|
+
).argument("<id>", "Deployment id").option("--json", "Emit JSON output").action(
|
|
481
|
+
async (id, options) => handleDeploymentCancel(id, options)
|
|
482
|
+
);
|
|
483
|
+
const deployments = program.command("deployments", { hidden: true });
|
|
484
|
+
deployments.command("list").option("--project <id>", "Filter to one repository link").option("--limit <n>", "Max rows (default 50)").option("--json", "Emit JSON output").action(
|
|
485
|
+
async (options) => handleDeploymentsList({ ...options, repo: options.project })
|
|
486
|
+
);
|
|
487
|
+
deployments.command("get").argument("<id>", "Deployment id").option("--json", "Emit JSON output").action(
|
|
488
|
+
async (id, options) => handleDeploymentGet(id, options)
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
exports.renderDeployment = renderDeployment; exports.handleDeploymentsList = handleDeploymentsList; exports.renderDeploymentPlayLines = renderDeploymentPlayLines; exports.renderDeploymentMonitorLines = renderDeploymentMonitorLines; exports.handleDeploymentGet = handleDeploymentGet; exports.registerGitCommands = registerGitCommands;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/cli/trace.ts
|
|
2
|
+
var cliTraceStartedAt = Date.now();
|
|
3
|
+
function isTruthyEnv(value) {
|
|
4
|
+
return value === "1" || value === "true" || value === "yes";
|
|
5
|
+
}
|
|
6
|
+
function isCliTraceEnabled() {
|
|
7
|
+
return isTruthyEnv(process.env.DEEPLINE_CLI_TRACE);
|
|
8
|
+
}
|
|
9
|
+
function recordCliTrace(event) {
|
|
10
|
+
if (!isCliTraceEnabled()) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
const payload = {
|
|
15
|
+
ts: now,
|
|
16
|
+
source: "cli",
|
|
17
|
+
sinceStartMs: now - cliTraceStartedAt,
|
|
18
|
+
...event
|
|
19
|
+
};
|
|
20
|
+
process.stderr.write(`[cli-trace] ${JSON.stringify(payload)}
|
|
21
|
+
`);
|
|
22
|
+
}
|
|
23
|
+
async function traceCliSpan(phase, fields, run) {
|
|
24
|
+
if (!isCliTraceEnabled()) {
|
|
25
|
+
return run();
|
|
26
|
+
}
|
|
27
|
+
const startedAt = Date.now();
|
|
28
|
+
try {
|
|
29
|
+
const result = await run();
|
|
30
|
+
recordCliTrace({
|
|
31
|
+
phase,
|
|
32
|
+
ms: Date.now() - startedAt,
|
|
33
|
+
ok: true,
|
|
34
|
+
...fields
|
|
35
|
+
});
|
|
36
|
+
return result;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
recordCliTrace({
|
|
39
|
+
phase,
|
|
40
|
+
ms: Date.now() - startedAt,
|
|
41
|
+
ok: false,
|
|
42
|
+
error: error instanceof Error ? error.message : String(error),
|
|
43
|
+
...fields
|
|
44
|
+
});
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
recordCliTrace,
|
|
51
|
+
traceCliSpan
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|