@revition/plugin-dev 0.0.0-canary.2a173bc
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/LICENSE +201 -0
- package/NOTICE +8 -0
- package/dist/api.d.ts +43 -0
- package/dist/api.js +19 -0
- package/dist/api.js.map +1 -0
- package/dist/apps/apps-api.d.ts +12 -0
- package/dist/apps/apps-api.js +19 -0
- package/dist/apps/apps-api.js.map +1 -0
- package/dist/apps/keys.d.ts +26 -0
- package/dist/apps/keys.js +13 -0
- package/dist/apps/keys.js.map +1 -0
- package/dist/checks/local-checks.d.ts +40 -0
- package/dist/checks/local-checks.js +123 -0
- package/dist/checks/local-checks.js.map +1 -0
- package/dist/commands/account/link-workspace.d.ts +12 -0
- package/dist/commands/account/link-workspace.js +29 -0
- package/dist/commands/account/link-workspace.js.map +1 -0
- package/dist/commands/account/register.d.ts +14 -0
- package/dist/commands/account/register.js +51 -0
- package/dist/commands/account/register.js.map +1 -0
- package/dist/commands/account/status.d.ts +9 -0
- package/dist/commands/account/status.js +33 -0
- package/dist/commands/account/status.js.map +1 -0
- package/dist/commands/analytics.d.ts +55 -0
- package/dist/commands/analytics.js +79 -0
- package/dist/commands/analytics.js.map +1 -0
- package/dist/commands/apps/create.d.ts +13 -0
- package/dist/commands/apps/create.js +39 -0
- package/dist/commands/apps/create.js.map +1 -0
- package/dist/commands/apps/keys/create.d.ts +19 -0
- package/dist/commands/apps/keys/create.js +39 -0
- package/dist/commands/apps/keys/create.js.map +1 -0
- package/dist/commands/apps/keys/list.d.ts +16 -0
- package/dist/commands/apps/keys/list.js +28 -0
- package/dist/commands/apps/keys/list.js.map +1 -0
- package/dist/commands/apps/keys/revoke.d.ts +19 -0
- package/dist/commands/apps/keys/revoke.js +35 -0
- package/dist/commands/apps/keys/revoke.js.map +1 -0
- package/dist/commands/apps/keys/rotate.d.ts +17 -0
- package/dist/commands/apps/keys/rotate.js +38 -0
- package/dist/commands/apps/keys/rotate.js.map +1 -0
- package/dist/commands/apps/list.d.ts +13 -0
- package/dist/commands/apps/list.js +26 -0
- package/dist/commands/apps/list.js.map +1 -0
- package/dist/commands/apps/listing.d.ts +11 -0
- package/dist/commands/apps/listing.js +26 -0
- package/dist/commands/apps/listing.js.map +1 -0
- package/dist/commands/apps/scopes/set.d.ts +25 -0
- package/dist/commands/apps/scopes/set.js +52 -0
- package/dist/commands/apps/scopes/set.js.map +1 -0
- package/dist/commands/apps/view.d.ts +12 -0
- package/dist/commands/apps/view.js +26 -0
- package/dist/commands/apps/view.js.map +1 -0
- package/dist/commands/audit.d.ts +31 -0
- package/dist/commands/audit.js +48 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/branches/eval.d.ts +42 -0
- package/dist/commands/branches/eval.js +104 -0
- package/dist/commands/branches/eval.js.map +1 -0
- package/dist/commands/branches/list.d.ts +21 -0
- package/dist/commands/branches/list.js +43 -0
- package/dist/commands/branches/list.js.map +1 -0
- package/dist/commands/branches/status.d.ts +26 -0
- package/dist/commands/branches/status.js +47 -0
- package/dist/commands/branches/status.js.map +1 -0
- package/dist/commands/branches/view.d.ts +19 -0
- package/dist/commands/branches/view.js +41 -0
- package/dist/commands/branches/view.js.map +1 -0
- package/dist/commands/build.d.ts +42 -0
- package/dist/commands/build.js +76 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/changelog.d.ts +41 -0
- package/dist/commands/changelog.js +44 -0
- package/dist/commands/changelog.js.map +1 -0
- package/dist/commands/deploy.d.ts +74 -0
- package/dist/commands/deploy.js +75 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/dev.d.ts +43 -0
- package/dist/commands/dev.js +191 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/docs.d.ts +33 -0
- package/dist/commands/docs.js +101 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/eval/list.d.ts +18 -0
- package/dist/commands/eval/list.js +49 -0
- package/dist/commands/eval/list.js.map +1 -0
- package/dist/commands/eval/run.d.ts +30 -0
- package/dist/commands/eval/run.js +190 -0
- package/dist/commands/eval/run.js.map +1 -0
- package/dist/commands/extension-points.d.ts +19 -0
- package/dist/commands/extension-points.js +26 -0
- package/dist/commands/extension-points.js.map +1 -0
- package/dist/commands/generate.d.ts +44 -0
- package/dist/commands/generate.js +145 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/init.d.ts +29 -0
- package/dist/commands/init.js +91 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/link.d.ts +19 -0
- package/dist/commands/link.js +54 -0
- package/dist/commands/link.js.map +1 -0
- package/dist/commands/logs.d.ts +77 -0
- package/dist/commands/logs.js +128 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/open.d.ts +28 -0
- package/dist/commands/open.js +54 -0
- package/dist/commands/open.js.map +1 -0
- package/dist/commands/runs/list.d.ts +31 -0
- package/dist/commands/runs/list.js +56 -0
- package/dist/commands/runs/list.js.map +1 -0
- package/dist/commands/scaffold.d.ts +22 -0
- package/dist/commands/scaffold.js +40 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/secrets/list.d.ts +13 -0
- package/dist/commands/secrets/list.js +32 -0
- package/dist/commands/secrets/list.js.map +1 -0
- package/dist/commands/secrets/set.d.ts +23 -0
- package/dist/commands/secrets/set.js +45 -0
- package/dist/commands/secrets/set.js.map +1 -0
- package/dist/commands/secrets/unset.d.ts +20 -0
- package/dist/commands/secrets/unset.js +33 -0
- package/dist/commands/secrets/unset.js.map +1 -0
- package/dist/commands/starters/list.d.ts +16 -0
- package/dist/commands/starters/list.js +33 -0
- package/dist/commands/starters/list.js.map +1 -0
- package/dist/commands/starters/view.d.ts +19 -0
- package/dist/commands/starters/view.js +27 -0
- package/dist/commands/starters/view.js.map +1 -0
- package/dist/commands/submissions/list.d.ts +18 -0
- package/dist/commands/submissions/list.js +35 -0
- package/dist/commands/submissions/list.js.map +1 -0
- package/dist/commands/submissions/open.d.ts +28 -0
- package/dist/commands/submissions/open.js +49 -0
- package/dist/commands/submissions/open.js.map +1 -0
- package/dist/commands/submissions/view.d.ts +16 -0
- package/dist/commands/submissions/view.js +32 -0
- package/dist/commands/submissions/view.js.map +1 -0
- package/dist/commands/submit.d.ts +48 -0
- package/dist/commands/submit.js +85 -0
- package/dist/commands/submit.js.map +1 -0
- package/dist/commands/test.d.ts +42 -0
- package/dist/commands/test.js +137 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/versions/channels.d.ts +26 -0
- package/dist/commands/versions/channels.js +34 -0
- package/dist/commands/versions/channels.js.map +1 -0
- package/dist/commands/versions/list.d.ts +27 -0
- package/dist/commands/versions/list.js +41 -0
- package/dist/commands/versions/list.js.map +1 -0
- package/dist/commands/versions/open.d.ts +29 -0
- package/dist/commands/versions/open.js +48 -0
- package/dist/commands/versions/open.js.map +1 -0
- package/dist/commands/versions/rollouts.d.ts +27 -0
- package/dist/commands/versions/rollouts.js +32 -0
- package/dist/commands/versions/rollouts.js.map +1 -0
- package/dist/commands/wallet/open.d.ts +14 -0
- package/dist/commands/wallet/open.js +28 -0
- package/dist/commands/wallet/open.js.map +1 -0
- package/dist/commands/wallet/show.d.ts +27 -0
- package/dist/commands/wallet/show.js +51 -0
- package/dist/commands/wallet/show.js.map +1 -0
- package/dist/dev/sandbox-session.d.ts +48 -0
- package/dist/dev/sandbox-session.js +50 -0
- package/dist/dev/sandbox-session.js.map +1 -0
- package/dist/dev/uploader.d.ts +11 -0
- package/dist/dev/uploader.js +63 -0
- package/dist/dev/uploader.js.map +1 -0
- package/dist/dev/watcher.d.ts +6 -0
- package/dist/dev/watcher.js +30 -0
- package/dist/dev/watcher.js.map +1 -0
- package/dist/eval/report.d.ts +65 -0
- package/dist/eval/report.js +42 -0
- package/dist/eval/report.js.map +1 -0
- package/dist/generate/manifest-patch.d.ts +18 -0
- package/dist/generate/manifest-patch.js +59 -0
- package/dist/generate/manifest-patch.js.map +1 -0
- package/dist/generate/render.d.ts +20 -0
- package/dist/generate/render.js +55 -0
- package/dist/generate/render.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/local/fixture-sdk.d.ts +27 -0
- package/dist/local/fixture-sdk.js +105 -0
- package/dist/local/fixture-sdk.js.map +1 -0
- package/dist/local/local-run.d.ts +58 -0
- package/dist/local/local-run.js +197 -0
- package/dist/local/local-run.js.map +1 -0
- package/dist/project/ownership.d.ts +8 -0
- package/dist/project/ownership.js +27 -0
- package/dist/project/ownership.js.map +1 -0
- package/dist/project/project-link.d.ts +13 -0
- package/dist/project/project-link.js +34 -0
- package/dist/project/project-link.js.map +1 -0
- package/dist/project/read-project.d.ts +6 -0
- package/dist/project/read-project.js +30 -0
- package/dist/project/read-project.js.map +1 -0
- package/dist/project/write-starter.d.ts +12 -0
- package/dist/project/write-starter.js +38 -0
- package/dist/project/write-starter.js.map +1 -0
- package/dist/secrets/secrets-api.d.ts +35 -0
- package/dist/secrets/secrets-api.js +54 -0
- package/dist/secrets/secrets-api.js.map +1 -0
- package/oclif.manifest.json +5658 -0
- package/package.json +72 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { RevitionCommand } from '@revition/cli-core';
|
|
3
|
+
import { devApi, seg } from '../../api.js';
|
|
4
|
+
export default class AppsListing extends RevitionCommand {
|
|
5
|
+
static summary = "Show an app's marketplace listing (GET /dev/apps/{appId}/listing).";
|
|
6
|
+
static examples = ['revition apps listing dapp_123 --json'];
|
|
7
|
+
static meta = {
|
|
8
|
+
id: 'apps:listing',
|
|
9
|
+
summary: AppsListing.summary,
|
|
10
|
+
examples: AppsListing.examples,
|
|
11
|
+
requiredScopes: ['cli:read'],
|
|
12
|
+
mutates: false,
|
|
13
|
+
confirm: 'none',
|
|
14
|
+
jsonSchemaId: 'revition.apps.listing.v1',
|
|
15
|
+
stability: 'stable',
|
|
16
|
+
};
|
|
17
|
+
static args = { id: Args.string({ required: true, description: 'The app id.' }) };
|
|
18
|
+
async run2(ctx) {
|
|
19
|
+
const api = await devApi(ctx);
|
|
20
|
+
return (await api.request({ method: 'GET', path: `/dev/apps/${seg(String(ctx.args['id']))}/listing` })).body;
|
|
21
|
+
}
|
|
22
|
+
human(d) {
|
|
23
|
+
return { text: `${JSON.stringify(d, null, 2)}\n` };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=listing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listing.js","sourceRoot":"","sources":["../../../src/commands/apps/listing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAyD,MAAM,oBAAoB,CAAC;AAE5G,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,eAAwC;IAC/E,MAAM,CAAU,OAAO,GAAG,oEAAoE,CAAC;IAC/F,MAAM,CAAU,QAAQ,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrE,MAAM,CAAC,IAAI,GAAgB;QACzB,EAAE,EAAE,cAAc;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,cAAc,EAAE,CAAC,UAAU,CAAC;QAC5B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,0BAA0B;QACxC,SAAS,EAAE,QAAQ;KACpB,CAAC;IACF,MAAM,CAAU,IAAI,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IAEjF,KAAK,CAAC,IAAI,CAAC,GAAmB;QACtC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO,CAAC,MAAM,GAAG,CAAC,OAAO,CAA0B,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACxI,CAAC;IAEkB,KAAK,CAAC,CAA0B;QACjD,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
import { type AppRegistration } from '../../../api.js';
|
|
3
|
+
interface Out {
|
|
4
|
+
readonly app: AppRegistration;
|
|
5
|
+
readonly added: readonly string[];
|
|
6
|
+
readonly removed: readonly string[];
|
|
7
|
+
readonly revokedKeys: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export default class AppsScopesSet extends RevitionCommand<Out> {
|
|
10
|
+
static summary: string;
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static meta: CommandMeta;
|
|
13
|
+
static args: {
|
|
14
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
15
|
+
};
|
|
16
|
+
static flags: {
|
|
17
|
+
scopes: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
private plan;
|
|
20
|
+
/** The permission diff, before the confirmation. */
|
|
21
|
+
protected beforeConfirm(ctx: CommandContext): Promise<void>;
|
|
22
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
23
|
+
protected human(o: Out): HumanView;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { RevitionCommand } from '@revition/cli-core';
|
|
3
|
+
import { devApi, seg } from '../../../api.js';
|
|
4
|
+
import { ownApp, parseScopes, scopeDiff } from '../../../apps/apps-api.js';
|
|
5
|
+
export default class AppsScopesSet extends RevitionCommand {
|
|
6
|
+
static summary = "Change an app's declared scopes: the permission diff is shown before you confirm.";
|
|
7
|
+
static examples = ['revition apps scopes set dapp_123 --scopes source:orders,data.read:orders', 'revition apps scopes set dapp_123 --scopes source:orders --yes'];
|
|
8
|
+
static meta = {
|
|
9
|
+
id: 'apps:scopes:set',
|
|
10
|
+
summary: AppsScopesSet.summary,
|
|
11
|
+
examples: AppsScopesSet.examples,
|
|
12
|
+
requiredScopes: ['cli:write'],
|
|
13
|
+
mutates: true,
|
|
14
|
+
confirm: 'prompt',
|
|
15
|
+
jsonSchemaId: 'revition.apps.scopes.set.v1',
|
|
16
|
+
stability: 'stable',
|
|
17
|
+
};
|
|
18
|
+
static args = { id: Args.string({ required: true, description: 'The app id.' }) };
|
|
19
|
+
static flags = { scopes: Flags.string({ required: true, description: 'The complete new scope list (comma-separated).' }) };
|
|
20
|
+
plan = null;
|
|
21
|
+
/** The permission diff, before the confirmation. */
|
|
22
|
+
async beforeConfirm(ctx) {
|
|
23
|
+
const app = await ownApp(await devApi(ctx), String(ctx.args['id']));
|
|
24
|
+
const next = parseScopes(ctx.commandFlags['scopes']);
|
|
25
|
+
const d = scopeDiff(app.declaredScopes, next);
|
|
26
|
+
this.plan = { app, next, ...d };
|
|
27
|
+
const lines = [`Scopes of ${app.appId}:`, ...d.added.map((s) => ` + ${s}`), ...d.removed.map((s) => ` - ${s}`)];
|
|
28
|
+
if (d.added.length === 0 && d.removed.length === 0)
|
|
29
|
+
lines.push(' (no change)');
|
|
30
|
+
if (d.added.length > 0)
|
|
31
|
+
lines.push('Widening the scopes re-issues every key of the app: the current keys stop working.');
|
|
32
|
+
ctx.io.err(`${lines.join('\n')}\n`);
|
|
33
|
+
}
|
|
34
|
+
async run2(ctx) {
|
|
35
|
+
if (this.plan === null)
|
|
36
|
+
await this.beforeConfirm(ctx);
|
|
37
|
+
const p = this.plan;
|
|
38
|
+
const api = await devApi(ctx);
|
|
39
|
+
// consent: true only after the confirmation (the platform refuses a widening without it).
|
|
40
|
+
const r = (await api.request({
|
|
41
|
+
method: 'PUT',
|
|
42
|
+
path: `/dev/apps/${seg(p.app.appId)}/scopes`,
|
|
43
|
+
body: { scopes: p.next, consent: true },
|
|
44
|
+
})).body;
|
|
45
|
+
return { app: r.app, added: p.added, removed: p.removed, revokedKeys: r.revokedKeys };
|
|
46
|
+
}
|
|
47
|
+
human(o) {
|
|
48
|
+
const keys = o.revokedKeys.length === 0 ? '' : ` ${o.revokedKeys.length} key(s) revoked: create new ones with \`revition apps keys create\`.`;
|
|
49
|
+
return { text: `Scopes of ${o.app.appId}: ${o.app.declaredScopes.join(', ') || '-'}.${keys}\n` };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../src/commands/apps/scopes/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAyD,MAAM,oBAAoB,CAAC;AAE5G,OAAO,EAAE,MAAM,EAAE,GAAG,EAAwB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAS3E,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,eAAoB;IAC7D,MAAM,CAAU,OAAO,GAAG,mFAAmF,CAAC;IAC9G,MAAM,CAAU,QAAQ,GAAG,CAAC,2EAA2E,EAAE,gEAAgE,CAAC,CAAC;IAC3K,MAAM,CAAC,IAAI,GAAgB;QACzB,EAAE,EAAE,iBAAiB;QACrB,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,QAAQ,EA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AC,WAAW,CAAC,MAAM,sEAAsE,CAAC;QAC9I,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;IACnG,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
import { type AppRegistration } from '../../api.js';
|
|
3
|
+
export default class AppsView extends RevitionCommand<AppRegistration> {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static meta: CommandMeta;
|
|
7
|
+
static args: {
|
|
8
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
protected run2(ctx: CommandContext): Promise<AppRegistration>;
|
|
11
|
+
protected human(a: AppRegistration): HumanView;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { RevitionCommand } from '@revition/cli-core';
|
|
3
|
+
import { devApi } from '../../api.js';
|
|
4
|
+
import { ownApp } from '../../apps/apps-api.js';
|
|
5
|
+
export default class AppsView extends RevitionCommand {
|
|
6
|
+
static summary = 'Show one of your apps.';
|
|
7
|
+
static examples = ['revition apps view dapp_123', 'revition apps view dapp_123 --json'];
|
|
8
|
+
static meta = {
|
|
9
|
+
id: 'apps:view',
|
|
10
|
+
summary: AppsView.summary,
|
|
11
|
+
examples: AppsView.examples,
|
|
12
|
+
requiredScopes: ['cli:read'],
|
|
13
|
+
mutates: false,
|
|
14
|
+
confirm: 'none',
|
|
15
|
+
jsonSchemaId: 'revition.apps.view.v1',
|
|
16
|
+
stability: 'stable',
|
|
17
|
+
};
|
|
18
|
+
static args = { id: Args.string({ required: true, description: 'The app id.' }) };
|
|
19
|
+
async run2(ctx) {
|
|
20
|
+
return ownApp(await devApi(ctx), String(ctx.args['id']));
|
|
21
|
+
}
|
|
22
|
+
human(a) {
|
|
23
|
+
return { text: `${a.appId}\nmanifest: ${a.manifestRef}\nscopes: ${a.declaredScopes.join(', ') || '-'}\ncreated: ${a.createdAt}\n` };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/commands/apps/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAyD,MAAM,oBAAoB,CAAC;AAE5G,OAAO,EAAE,MAAM,EAAwB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,eAAgC;IACpE,MAAM,CAAU,OAAO,GAAG,wBAAwB,CAAC;IACnD,MAAM,CAAU,QAAQ,GAAG,CAAC,6BAA6B,EAAE,oCAAoC,CAAC,CAAC;IACjG,MAAM,CAAC,IAAI,GAAgB;QACzB,EAAE,EAAE,WAAW;QACf,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,cAAc,EAAE,CAAC,UAAU,CAAC;QAC5B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,uBAAuB;QACrC,SAAS,EAAE,QAAQ;KACpB,CAAC;IACF,MAAM,CAAU,IAAI,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IAEjF,KAAK,CAAC,IAAI,CAAC,GAAmB;QACtC,OAAO,MAAM,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IAEkB,KAAK,CAAC,CAAkB;QACzC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,WAAW,aAAa,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC;IACtI,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
/**
|
|
3
|
+
* T2.4.2 - `revition audit`: the developer's own audit trail (GET /dev/audit, newest first), filtered here (the route
|
|
4
|
+
* takes no filters). Each event shows the client it came from (web / cli / pat / mcp / assist) when the record carries
|
|
5
|
+
* one. Read only.
|
|
6
|
+
*/
|
|
7
|
+
export type AuditEvent = Readonly<Record<string, unknown>> & {
|
|
8
|
+
readonly event: string;
|
|
9
|
+
readonly at: number | string;
|
|
10
|
+
};
|
|
11
|
+
/** `--since` and `--action` (the event name), applied locally. PURE. */
|
|
12
|
+
export declare function filterAudit(events: readonly AuditEvent[], f: {
|
|
13
|
+
readonly sinceMs: number | null;
|
|
14
|
+
readonly action: string | null;
|
|
15
|
+
readonly nowMs: number;
|
|
16
|
+
}): AuditEvent[];
|
|
17
|
+
interface Out {
|
|
18
|
+
readonly events: readonly AuditEvent[];
|
|
19
|
+
}
|
|
20
|
+
export default class Audit extends RevitionCommand<Out> {
|
|
21
|
+
static summary: string;
|
|
22
|
+
static examples: string[];
|
|
23
|
+
static meta: CommandMeta;
|
|
24
|
+
static flags: {
|
|
25
|
+
since: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
action: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
};
|
|
28
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
29
|
+
protected human(o: Out): HumanView;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { RevitionCommand, renderTable, terminalTable } from '@revition/cli-core';
|
|
3
|
+
import { devApi } from '../api.js';
|
|
4
|
+
import { parseDuration } from './runs/list.js';
|
|
5
|
+
const atMs = (e) => (typeof e.at === 'number' ? e.at : Date.parse(e.at));
|
|
6
|
+
/** `--since` and `--action` (the event name), applied locally. PURE. */
|
|
7
|
+
export function filterAudit(events, f) {
|
|
8
|
+
return events.filter((e) => (f.action === null || e.event === f.action) && (f.sinceMs === null || atMs(e) >= f.nowMs - f.sinceMs));
|
|
9
|
+
}
|
|
10
|
+
export default class Audit extends RevitionCommand {
|
|
11
|
+
static summary = 'Your developer audit trail: what was done, when, and from which client.';
|
|
12
|
+
static examples = ['revition audit', 'revition audit --since 1d --action app_registered', 'revition audit --json'];
|
|
13
|
+
static meta = {
|
|
14
|
+
id: 'audit',
|
|
15
|
+
summary: Audit.summary,
|
|
16
|
+
examples: Audit.examples,
|
|
17
|
+
requiredScopes: ['cli:read'],
|
|
18
|
+
mutates: false,
|
|
19
|
+
confirm: 'none',
|
|
20
|
+
jsonSchemaId: 'revition.audit.v1',
|
|
21
|
+
stability: 'stable',
|
|
22
|
+
};
|
|
23
|
+
static flags = {
|
|
24
|
+
since: Flags.string({ description: 'Only events newer than this (90s, 30m, 6h, 7d).' }),
|
|
25
|
+
action: Flags.string({ description: 'Only events with this name.' }),
|
|
26
|
+
};
|
|
27
|
+
async run2(ctx) {
|
|
28
|
+
const sinceMs = parseDuration(ctx.commandFlags['since']);
|
|
29
|
+
const action = typeof ctx.commandFlags['action'] === 'string' ? ctx.commandFlags['action'] : null;
|
|
30
|
+
const api = await devApi(ctx);
|
|
31
|
+
const events = (await api.request({ method: 'GET', path: '/dev/audit' })).body.events;
|
|
32
|
+
return { events: filterAudit(events, { sinceMs, action, nowMs: Date.now() }) };
|
|
33
|
+
}
|
|
34
|
+
human(o) {
|
|
35
|
+
if (o.events.length === 0)
|
|
36
|
+
return { text: 'No audit events match.\n' };
|
|
37
|
+
return {
|
|
38
|
+
text: renderTable(['at', 'event', 'client', 'details'], o.events.map((e) => {
|
|
39
|
+
const { event, at, client, ...rest } = e;
|
|
40
|
+
const details = Object.entries(rest)
|
|
41
|
+
.map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`)
|
|
42
|
+
.join(' ');
|
|
43
|
+
return [new Date(atMs({ event, at })).toISOString(), event, typeof client === 'string' ? client : '-', details];
|
|
44
|
+
}), terminalTable()),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAyD,MAAM,oBAAoB,CAAC;AAExI,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAS/C,MAAM,IAAI,GAAG,CAAC,CAAa,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7F,wEAAwE;AACxE,MAAM,UAAU,WAAW,CACzB,MAA6B,EAC7B,CAA8F;IAE9F,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAA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AAC,CAAC,EACF,aAAa,EAAE,CAChB;SACF,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
import type { PipelineStageRow } from '../deploy.js';
|
|
3
|
+
/**
|
|
4
|
+
* T2.3.2 / T2.3.1 AC4 - the legacy `revition eval --agent a --branch b`, kept with parity: the pipeline quote, then
|
|
5
|
+
* (confirmed) the pipeline on an approved branch (build, scan, sandbox tests, evaluation). The platform refuses an
|
|
6
|
+
* unapproved branch. A 202 runs in the background: the branch is read again until no stage is running.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PIPELINE_POLL_MS = 3000;
|
|
9
|
+
export declare const PIPELINE_WAIT_MS: number;
|
|
10
|
+
interface PipelineQuote {
|
|
11
|
+
readonly quoteId: string;
|
|
12
|
+
readonly sandboxRuns: number;
|
|
13
|
+
readonly limits: Readonly<Record<string, number>>;
|
|
14
|
+
}
|
|
15
|
+
interface PipelineEnd {
|
|
16
|
+
readonly artifactRef: string | null;
|
|
17
|
+
readonly stages: readonly PipelineStageRow[];
|
|
18
|
+
readonly promoted: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface Out {
|
|
21
|
+
readonly agentId: string;
|
|
22
|
+
readonly branchId: string;
|
|
23
|
+
readonly quote: PipelineQuote;
|
|
24
|
+
readonly ran: boolean;
|
|
25
|
+
readonly end: PipelineEnd | null;
|
|
26
|
+
/** The quote line was already shown above the interactive prompt. */
|
|
27
|
+
readonly quoteShown: boolean;
|
|
28
|
+
}
|
|
29
|
+
export default class BranchesEval extends RevitionCommand<Out> {
|
|
30
|
+
static summary: string;
|
|
31
|
+
static examples: string[];
|
|
32
|
+
static meta: CommandMeta;
|
|
33
|
+
static args: {
|
|
34
|
+
branch: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
35
|
+
};
|
|
36
|
+
static flags: {
|
|
37
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
};
|
|
39
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
40
|
+
protected human(o: Out): HumanView;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { canPrompt, confirmYes, EXIT, RevitionCliError, RevitionCommand, } from '@revition/cli-core';
|
|
3
|
+
import { devApi, seg } from '../../api.js';
|
|
4
|
+
import { agentFlag, listCodeBranches } from './list.js';
|
|
5
|
+
/**
|
|
6
|
+
* T2.3.2 / T2.3.1 AC4 - the legacy `revition eval --agent a --branch b`, kept with parity: the pipeline quote, then
|
|
7
|
+
* (confirmed) the pipeline on an approved branch (build, scan, sandbox tests, evaluation). The platform refuses an
|
|
8
|
+
* unapproved branch. A 202 runs in the background: the branch is read again until no stage is running.
|
|
9
|
+
*/
|
|
10
|
+
export const PIPELINE_POLL_MS = 3_000;
|
|
11
|
+
export const PIPELINE_WAIT_MS = 15 * 60_000;
|
|
12
|
+
/** The legacy canonical JSON (sorted keys), for the quote's limits. */
|
|
13
|
+
function canonical(v) {
|
|
14
|
+
if (Array.isArray(v))
|
|
15
|
+
return `[${v.map(canonical).join(',')}]`;
|
|
16
|
+
if (v !== null && typeof v === 'object') {
|
|
17
|
+
const o = v;
|
|
18
|
+
return `{${Object.keys(o).sort().map((k) => `${JSON.stringify(k)}:${canonical(o[k])}`).join(',')}}`;
|
|
19
|
+
}
|
|
20
|
+
return JSON.stringify(v ?? null);
|
|
21
|
+
}
|
|
22
|
+
const quoteLine = (q) => `quote ${q.quoteId}: ${q.sandboxRuns} sandbox test run(s) at ${canonical(q.limits)}`;
|
|
23
|
+
/** Promoted only when the evaluation stage passed (an artifactRef alone is not a promotion; legacy F5). */
|
|
24
|
+
const evaluationPassed = (stages) => stages.some((s) => s.stage === 'evaluation' && s.status === 'passed');
|
|
25
|
+
function promotedRef(r) {
|
|
26
|
+
const ref = typeof r.artifactRef === 'string' && r.artifactRef !== '' ? r.artifactRef : null;
|
|
27
|
+
return r.promoted ? ref : null;
|
|
28
|
+
}
|
|
29
|
+
function endLine(r) {
|
|
30
|
+
const promoted = promotedRef(r);
|
|
31
|
+
if (promoted !== null)
|
|
32
|
+
return `promoted to test as ${promoted}`;
|
|
33
|
+
const ref = typeof r.artifactRef === 'string' && r.artifactRef !== '' ? r.artifactRef : null;
|
|
34
|
+
const why = r.stages.find((s) => s.stage === 'evaluation' && s.status !== 'passed')?.detail ?? '';
|
|
35
|
+
const reason = why === '' ? '' : `: ${why}`;
|
|
36
|
+
return ref === null ? `not promoted${reason}` : `frozen as ${ref}; not promoted${reason}`;
|
|
37
|
+
}
|
|
38
|
+
async function awaitBackground(api, agentId, branchId) {
|
|
39
|
+
for (let waited = 0; waited <= PIPELINE_WAIT_MS; waited += PIPELINE_POLL_MS) {
|
|
40
|
+
await new Promise((r) => setTimeout(r, PIPELINE_POLL_MS));
|
|
41
|
+
const b = (await listCodeBranches(api, agentId)).find((x) => x.branchId === branchId);
|
|
42
|
+
const stages = b?.pipeline ?? [];
|
|
43
|
+
if (b !== undefined && stages.length > 0 && !stages.some((s) => s.status === 'running')) {
|
|
44
|
+
return { artifactRef: b.artifactRef ?? null, stages, promoted: b.status === 'promoted' };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
export default class BranchesEval extends RevitionCommand {
|
|
50
|
+
static summary = 'Run the pipeline on an approved code branch: the quote first, then (confirmed) the run.';
|
|
51
|
+
static examples = ['revition branches eval br_1 --agent dep_123', 'revition branches eval br_1 --agent dep_123 --yes'];
|
|
52
|
+
static meta = {
|
|
53
|
+
id: 'branches:eval',
|
|
54
|
+
summary: BranchesEval.summary,
|
|
55
|
+
examples: BranchesEval.examples,
|
|
56
|
+
requiredScopes: ['cli:write'],
|
|
57
|
+
// Quote first: the confirmation comes after the quote is shown, so the command confirms itself.
|
|
58
|
+
mutates: false,
|
|
59
|
+
confirm: 'none',
|
|
60
|
+
jsonSchemaId: 'revition.branches.eval.v1',
|
|
61
|
+
stability: 'stable',
|
|
62
|
+
paid: { quote: 'required' },
|
|
63
|
+
};
|
|
64
|
+
static args = { branch: Args.string({ required: true, description: 'The branch id.' }) };
|
|
65
|
+
static flags = { agent: agentFlag };
|
|
66
|
+
async run2(ctx) {
|
|
67
|
+
const agentId = String(ctx.commandFlags['agent']);
|
|
68
|
+
const branchId = String(ctx.args['branch']);
|
|
69
|
+
const api = await devApi(ctx);
|
|
70
|
+
const base = `/deployments/${seg(agentId)}/code-branches/${seg(branchId)}`;
|
|
71
|
+
const quote = (await api.request({ method: 'GET', path: `${base}/pipeline-quote` })).body;
|
|
72
|
+
let quoteShown = false;
|
|
73
|
+
if (!ctx.flags.yes) {
|
|
74
|
+
// Legacy: without --yes nothing runs (the quote is the answer). Interactive: the quote, then the question.
|
|
75
|
+
if (!canPrompt(ctx.io, { json: ctx.flags.json, noInput: ctx.flags.noInput }))
|
|
76
|
+
return { agentId, branchId, quote, ran: false, end: null, quoteShown };
|
|
77
|
+
ctx.io.err(`${quoteLine(quote)}\n`);
|
|
78
|
+
quoteShown = true;
|
|
79
|
+
if (!(await confirmYes(ctx.io, 'Run the pipeline against this quote?')))
|
|
80
|
+
throw new RevitionCliError({ code: 'CANCELLED', message: 'Cancelled.' }, EXIT.cancelled);
|
|
81
|
+
}
|
|
82
|
+
const ran = (await api.request({ method: 'POST', path: `${base}/pipeline`, body: { quoteId: quote.quoteId } })).body;
|
|
83
|
+
const end = 'artifactRef' in ran ? { artifactRef: ran.artifactRef ?? null, stages: ran.stages, promoted: evaluationPassed(ran.stages) } : await awaitBackground(api, agentId, branchId);
|
|
84
|
+
if (end === null) {
|
|
85
|
+
throw new RevitionCliError({ code: 'PIPELINE_STILL_RUNNING', message: `the pipeline is still running after ${PIPELINE_WAIT_MS / 60_000} min; re-read the branch later`, hint: `Run \`revition branches status ${branchId} --agent ${agentId}\`.` }, EXIT.general);
|
|
86
|
+
}
|
|
87
|
+
if (promotedRef(end) === null)
|
|
88
|
+
ctx.setExitCode?.(EXIT.general);
|
|
89
|
+
return { agentId, branchId, quote, ran: true, end, quoteShown };
|
|
90
|
+
}
|
|
91
|
+
human(o) {
|
|
92
|
+
const lines = o.quoteShown ? [] : [quoteLine(o.quote)];
|
|
93
|
+
if (!o.ran || o.end === null) {
|
|
94
|
+
lines.push('Nothing ran. Re-run with --yes to run the pipeline against this quote.');
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
for (const s of o.end.stages)
|
|
98
|
+
lines.push(`${s.stage}: ${s.status}${s.detail === '' ? '' : ` (${s.detail})`}`);
|
|
99
|
+
lines.push(endLine(o.end));
|
|
100
|
+
}
|
|
101
|
+
return { text: `${lines.join('\n')}\n` };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=eval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval.js","sourceRoot":"","sources":["../../../src/commands/branches/eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,SAAS,EACT,UAAU,EACV,IAAI,EACJ,gBAAgB,EAChB,eAAe,GAKhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,MAAM,CAAC;AAwB5C,uEAAuE;AACvE,SAAS,SAAS,CAAC,CAAU;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CA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IAAI,CAAC,CAAC,GAAG,CAAC,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;YAC9G,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC3C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RevitionCommand, type ApiClient, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
import type { CodeBranchView } from '../deploy.js';
|
|
3
|
+
/** T2.3.2 - the agent's code branches (newest first), as the platform lists them. Read only. */
|
|
4
|
+
export declare function listCodeBranches(api: ApiClient, agentId: string): Promise<readonly CodeBranchView[]>;
|
|
5
|
+
export declare function findCodeBranch(api: ApiClient, agentId: string, branchId: string): Promise<CodeBranchView>;
|
|
6
|
+
export declare const agentFlag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
interface Out {
|
|
8
|
+
readonly agentId: string;
|
|
9
|
+
readonly branches: readonly CodeBranchView[];
|
|
10
|
+
}
|
|
11
|
+
export default class BranchesList extends RevitionCommand<Out> {
|
|
12
|
+
static summary: string;
|
|
13
|
+
static examples: string[];
|
|
14
|
+
static meta: CommandMeta;
|
|
15
|
+
static flags: {
|
|
16
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
19
|
+
protected human(o: Out): HumanView;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { EXIT, RevitionCliError, RevitionCommand, renderTable, terminalTable, } from '@revition/cli-core';
|
|
3
|
+
import { devApi, seg } from '../../api.js';
|
|
4
|
+
/** T2.3.2 - the agent's code branches (newest first), as the platform lists them. Read only. */
|
|
5
|
+
export async function listCodeBranches(api, agentId) {
|
|
6
|
+
const r = await api.request({ method: 'GET', path: `/deployments/${seg(agentId)}/code-branches` });
|
|
7
|
+
return r.body.branches ?? [];
|
|
8
|
+
}
|
|
9
|
+
export async function findCodeBranch(api, agentId, branchId) {
|
|
10
|
+
const b = (await listCodeBranches(api, agentId)).find((x) => x.branchId === branchId);
|
|
11
|
+
if (b === undefined) {
|
|
12
|
+
throw new RevitionCliError({ code: 'BRANCH_NOT_FOUND', message: `Agent ${agentId} has no branch ${branchId}.`, hint: `Run \`revition branches list --agent ${agentId}\`.` }, EXIT.notFound);
|
|
13
|
+
}
|
|
14
|
+
return b;
|
|
15
|
+
}
|
|
16
|
+
export const agentFlag = Flags.string({ description: 'The agent (deployment id).', required: true });
|
|
17
|
+
export default class BranchesList extends RevitionCommand {
|
|
18
|
+
static summary = "List an agent's code branches and their review status.";
|
|
19
|
+
static examples = ['revition branches list --agent dep_123', 'revition branches list --agent dep_123 --json'];
|
|
20
|
+
static meta = {
|
|
21
|
+
id: 'branches:list',
|
|
22
|
+
summary: BranchesList.summary,
|
|
23
|
+
examples: BranchesList.examples,
|
|
24
|
+
requiredScopes: ['cli:read'],
|
|
25
|
+
mutates: false,
|
|
26
|
+
confirm: 'none',
|
|
27
|
+
jsonSchemaId: 'revition.branches.list.v1',
|
|
28
|
+
stability: 'stable',
|
|
29
|
+
};
|
|
30
|
+
static flags = { agent: agentFlag };
|
|
31
|
+
async run2(ctx) {
|
|
32
|
+
const agentId = String(ctx.commandFlags['agent']);
|
|
33
|
+
return { agentId, branches: await listCodeBranches(await devApi(ctx), agentId) };
|
|
34
|
+
}
|
|
35
|
+
human(o) {
|
|
36
|
+
if (o.branches.length === 0)
|
|
37
|
+
return { text: `Agent ${o.agentId} has no code branches. Propose one with \`revition deploy\`.\n` };
|
|
38
|
+
return {
|
|
39
|
+
text: renderTable(['branch', 'id', 'status', 'origin', 'created'], o.branches.map((b) => [b.branch, b.branchId, b.status, b.origin, b.createdAt.slice(0, 10)]), terminalTable()),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/branches/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,GAKd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAG3C,gGAAgG;AAChG,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAc,EAAE,OAAe;IACpE,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,OAAO,CAAkC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACpI,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAc,EAAE,OAAe,EAAE,QAAgB;IACpF,MAAM,CAAC,GAAG,CAAC,MAAM,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACtF,IAAI,CAAC,KAAK,SAAS,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;YAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,OAAO,gEAAgE,EAAE,CAAC;QACjI,OAAO;YACL,IAAI,EAAE,WAAW,CACf,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,EAC/C,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAC3F,aAAa,EAAE,CAChB;SACF,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
import { type PipelineStageRow } from '../deploy.js';
|
|
3
|
+
interface Out {
|
|
4
|
+
readonly agentId: string;
|
|
5
|
+
readonly branchId: string;
|
|
6
|
+
readonly status: string;
|
|
7
|
+
readonly reviewedBy: string | null;
|
|
8
|
+
readonly pipeline: readonly PipelineStageRow[];
|
|
9
|
+
readonly artifactRef: string | null;
|
|
10
|
+
readonly reviewUrl: string;
|
|
11
|
+
}
|
|
12
|
+
/** T2.3.2 - where a branch stands. Approval and merge happen in the portal (Relay); the CLI only shows them. */
|
|
13
|
+
export default class BranchesStatus extends RevitionCommand<Out> {
|
|
14
|
+
static summary: string;
|
|
15
|
+
static examples: string[];
|
|
16
|
+
static meta: CommandMeta;
|
|
17
|
+
static args: {
|
|
18
|
+
branch: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
19
|
+
};
|
|
20
|
+
static flags: {
|
|
21
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
};
|
|
23
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
24
|
+
protected human(o: Out): HumanView;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { RevitionCommand, webLinksOf } from '@revition/cli-core';
|
|
3
|
+
import { devApi } from '../../api.js';
|
|
4
|
+
import { branchReviewUrl } from '../deploy.js';
|
|
5
|
+
import { agentFlag, findCodeBranch } from './list.js';
|
|
6
|
+
/** T2.3.2 - where a branch stands. Approval and merge happen in the portal (Relay); the CLI only shows them. */
|
|
7
|
+
export default class BranchesStatus extends RevitionCommand {
|
|
8
|
+
static summary = "A code branch's review status and pipeline (approve and merge happen in the portal).";
|
|
9
|
+
static examples = ['revition branches status br_1 --agent dep_123', 'revition branches status br_1 --agent dep_123 --json'];
|
|
10
|
+
static meta = {
|
|
11
|
+
id: 'branches:status',
|
|
12
|
+
summary: BranchesStatus.summary,
|
|
13
|
+
examples: BranchesStatus.examples,
|
|
14
|
+
requiredScopes: ['cli:read'],
|
|
15
|
+
mutates: false,
|
|
16
|
+
confirm: 'none',
|
|
17
|
+
jsonSchemaId: 'revition.branches.status.v1',
|
|
18
|
+
stability: 'stable',
|
|
19
|
+
};
|
|
20
|
+
static args = { branch: Args.string({ required: true, description: 'The branch id.' }) };
|
|
21
|
+
static flags = { agent: agentFlag };
|
|
22
|
+
async run2(ctx) {
|
|
23
|
+
const agentId = String(ctx.commandFlags['agent']);
|
|
24
|
+
const b = await findCodeBranch(await devApi(ctx), agentId, String(ctx.args['branch']));
|
|
25
|
+
return {
|
|
26
|
+
agentId,
|
|
27
|
+
branchId: b.branchId,
|
|
28
|
+
status: b.status,
|
|
29
|
+
reviewedBy: b.reviewedBy ?? null,
|
|
30
|
+
pipeline: b.pipeline ?? [],
|
|
31
|
+
artifactRef: b.artifactRef ?? null,
|
|
32
|
+
reviewUrl: branchReviewUrl(agentId, await webLinksOf(ctx)),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
human(o) {
|
|
36
|
+
const stages = o.pipeline.map((s) => `${s.stage}: ${s.status}`).join(', ');
|
|
37
|
+
return {
|
|
38
|
+
text: `${[
|
|
39
|
+
`${o.branchId}: ${o.status}${o.reviewedBy === null ? '' : ` (reviewed by ${o.reviewedBy})`}`,
|
|
40
|
+
...(stages === '' ? [] : [`pipeline: ${stages}`]),
|
|
41
|
+
...(o.artifactRef === null ? [] : [`artifact: ${o.artifactRef}`]),
|
|
42
|
+
`review in the portal: ${o.reviewUrl}`,
|
|
43
|
+
].join('\n')}\n`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/branches/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAyD,MAAM,oBAAoB,CAAC;AAExH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,EAAyB,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAYtD,gHAAgH;AAChH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,eAAoB;IAC9D,MAAM,CAAU,OAAO,GAAG,sFAAsF,CAAC;IACjH,MAAM,CAAU,QAAQ,GAAG,CAAC,+CAA+C,EAAE,sDAAsD,CAAC,CAAC;IACrI,MAAM,CAAC,IAAI,GAAgB;QACzB,EAAE,EAAE,iBAAiB;QACrB,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,QAAQ,EAAE,cAAc,CAAC,QAAQ;QACjC,cAAc,EAAE,CAAC,UAAU,CAAC;QAC5B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,6BAA6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AC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,UAAU,GAAG,EAAE;gBAC5F,GAAG,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,MAAM,EAAE,CAAC,CAAC;gBACjD,GAAG,CAAC,CAAC,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;gBACjE,yBAAyB,CAAC,CAAC,SAAS,EAAE;aACvC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;SACjB,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
import { type CodeBranchView } from '../deploy.js';
|
|
3
|
+
interface Out extends CodeBranchView {
|
|
4
|
+
readonly reviewUrl: string;
|
|
5
|
+
}
|
|
6
|
+
export default class BranchesView extends RevitionCommand<Out> {
|
|
7
|
+
static summary: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static meta: CommandMeta;
|
|
10
|
+
static args: {
|
|
11
|
+
branch: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
static flags: {
|
|
14
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
17
|
+
protected human(b: Out): HumanView;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { RevitionCommand, webLinksOf } from '@revition/cli-core';
|
|
3
|
+
import { devApi } from '../../api.js';
|
|
4
|
+
import { branchReviewUrl, impactLines } from '../deploy.js';
|
|
5
|
+
import { agentFlag, findCodeBranch } from './list.js';
|
|
6
|
+
export default class BranchesView extends RevitionCommand {
|
|
7
|
+
static summary = 'Show one code branch: its files, permissions, impact, pipeline and history.';
|
|
8
|
+
static examples = ['revition branches view br_1 --agent dep_123'];
|
|
9
|
+
static meta = {
|
|
10
|
+
id: 'branches:view',
|
|
11
|
+
summary: BranchesView.summary,
|
|
12
|
+
examples: BranchesView.examples,
|
|
13
|
+
requiredScopes: ['cli:read'],
|
|
14
|
+
mutates: false,
|
|
15
|
+
confirm: 'none',
|
|
16
|
+
jsonSchemaId: 'revition.branches.view.v1',
|
|
17
|
+
stability: 'stable',
|
|
18
|
+
};
|
|
19
|
+
static args = { branch: Args.string({ required: true, description: 'The branch id.' }) };
|
|
20
|
+
static flags = { agent: agentFlag };
|
|
21
|
+
async run2(ctx) {
|
|
22
|
+
const agentId = String(ctx.commandFlags['agent']);
|
|
23
|
+
const b = await findCodeBranch(await devApi(ctx), agentId, String(ctx.args['branch']));
|
|
24
|
+
return { ...b, reviewUrl: branchReviewUrl(agentId, await webLinksOf(ctx)) };
|
|
25
|
+
}
|
|
26
|
+
human(b) {
|
|
27
|
+
return {
|
|
28
|
+
text: `${[
|
|
29
|
+
`${b.branch} (${b.branchId}) - ${b.status}${b.reviewedBy === undefined ? '' : ` by ${b.reviewedBy}`}`,
|
|
30
|
+
`summary: ${b.summary}`,
|
|
31
|
+
`files: ${b.files.join(', ')}`,
|
|
32
|
+
...b.permissionDiff.map((p) => ` needs ${p.permission}: an Owner or Admin must grant it`),
|
|
33
|
+
...impactLines(b.impact),
|
|
34
|
+
...(b.pipeline ?? []).map((s) => `${s.stage}: ${s.status}${s.detail === '' ? '' : ` (${s.detail})`}`),
|
|
35
|
+
...(b.history ?? []).map((h) => ` ${h.at} ${h.by}: ${h.event}`),
|
|
36
|
+
`review: ${b.reviewUrl}`,
|
|
37
|
+
].join('\n')}\n`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=view.js.map
|