@revition/plugin-dev 0.0.0-canary.a06d97b
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 +40 -0
- package/dist/api.js +16 -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 +28 -0
- package/dist/commands/eval/run.js +186 -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 +53 -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 +27 -0
- package/dist/commands/submissions/open.js +48 -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 +46 -0
- package/dist/commands/submit.js +81 -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 +27 -0
- package/dist/commands/versions/open.js +43 -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 +27 -0
- package/dist/commands/wallet/open.js.map +1 -0
- package/dist/commands/wallet/show.d.ts +25 -0
- package/dist/commands/wallet/show.js +46 -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,27 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
export declare const RELEASE_ACTIONS: readonly ["promote", "rollback", "advisory"];
|
|
3
|
+
/**
|
|
4
|
+
* The portal's release page: channels, rollouts (promote, advance, halt = rollback) and install advisories live on the
|
|
5
|
+
* Deployment & Distribution page, the same page the server names when it refuses a CLI token on a release write
|
|
6
|
+
* (sentinel/cli-scopes/human-only-routes.ts portalUrlFor: `/release/` -> `/foundry/distribution`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const RELEASE_PAGE_URL = "https://app.revition.com/foundry/distribution";
|
|
9
|
+
interface Out {
|
|
10
|
+
readonly appId: string;
|
|
11
|
+
readonly action: (typeof RELEASE_ACTIONS)[number] | null;
|
|
12
|
+
readonly url: string;
|
|
13
|
+
readonly opened: boolean;
|
|
14
|
+
}
|
|
15
|
+
export default class VersionsOpen extends RevitionCommand<Out> {
|
|
16
|
+
static summary: string;
|
|
17
|
+
static examples: string[];
|
|
18
|
+
static meta: CommandMeta;
|
|
19
|
+
static flags: {
|
|
20
|
+
action: import("@oclif/core/interfaces").OptionFlag<"promote" | "rollback" | "advisory" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
app: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
dir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
25
|
+
protected human(o: Out): HumanView;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { canOpenBrowser, openBrowser, RevitionCommand } from '@revition/cli-core';
|
|
3
|
+
import { assertOpenable } from '../submissions/open.js';
|
|
4
|
+
import { appOf } from '../submit.js';
|
|
5
|
+
import { appFlags } from './list.js';
|
|
6
|
+
export const RELEASE_ACTIONS = ['promote', 'rollback', 'advisory'];
|
|
7
|
+
/**
|
|
8
|
+
* The portal's release page: channels, rollouts (promote, advance, halt = rollback) and install advisories live on the
|
|
9
|
+
* Deployment & Distribution page, the same page the server names when it refuses a CLI token on a release write
|
|
10
|
+
* (sentinel/cli-scopes/human-only-routes.ts portalUrlFor: `/release/` -> `/foundry/distribution`).
|
|
11
|
+
*/
|
|
12
|
+
export const RELEASE_PAGE_URL = 'https://app.revition.com/foundry/distribution';
|
|
13
|
+
export default class VersionsOpen extends RevitionCommand {
|
|
14
|
+
static summary = 'Open the portal release page (promote, rollback, advisories are human steps there).';
|
|
15
|
+
static examples = ['revition versions open --app dapp_123', 'revition versions open --app dapp_123 --action rollback'];
|
|
16
|
+
static meta = {
|
|
17
|
+
id: 'versions:open',
|
|
18
|
+
summary: VersionsOpen.summary,
|
|
19
|
+
examples: VersionsOpen.examples,
|
|
20
|
+
requiredScopes: ['cli:read'],
|
|
21
|
+
mutates: false,
|
|
22
|
+
confirm: 'none',
|
|
23
|
+
jsonSchemaId: 'revition.versions.open.v1',
|
|
24
|
+
stability: 'stable',
|
|
25
|
+
};
|
|
26
|
+
static flags = {
|
|
27
|
+
...appFlags,
|
|
28
|
+
action: Flags.option({ options: RELEASE_ACTIONS, description: 'The release step you will take there.' })(),
|
|
29
|
+
};
|
|
30
|
+
async run2(ctx) {
|
|
31
|
+
const appId = appOf(ctx);
|
|
32
|
+
const a = ctx.commandFlags['action'];
|
|
33
|
+
const action = RELEASE_ACTIONS.find((x) => x === a) ?? null;
|
|
34
|
+
const url = assertOpenable(RELEASE_PAGE_URL);
|
|
35
|
+
const opened = !ctx.flags.json && canOpenBrowser(ctx.env, process.platform) ? await openBrowser(url) : false;
|
|
36
|
+
return { appId, action, url, opened };
|
|
37
|
+
}
|
|
38
|
+
human(o) {
|
|
39
|
+
const step = o.action === null ? 'release changes' : `the ${o.action}`;
|
|
40
|
+
return { text: `${o.opened ? 'Opened' : 'Open'} ${o.url} to take ${step} for ${o.appId} (a person does it there).\n` };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/versions/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAyD,MAAM,oBAAoB,CAAC;AAEzI,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC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,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACxC,CAAC;IAEkB,KAAK,CAAC,CAAM;QAC7B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QACvE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,YAAY,IAAI,QAAQ,CAAC,CAAC,KAAK,8BAA8B,EAAE,CAAC;IACzH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
interface RolloutView {
|
|
3
|
+
readonly channel: string;
|
|
4
|
+
readonly version: string;
|
|
5
|
+
readonly previous: string | null;
|
|
6
|
+
readonly plan: {
|
|
7
|
+
readonly stages: readonly number[];
|
|
8
|
+
};
|
|
9
|
+
readonly stageIndex: number;
|
|
10
|
+
readonly status: 'rolling' | 'halted' | 'complete';
|
|
11
|
+
}
|
|
12
|
+
interface Out {
|
|
13
|
+
readonly appId: string;
|
|
14
|
+
readonly rollouts: readonly RolloutView[];
|
|
15
|
+
}
|
|
16
|
+
export default class VersionsRollouts extends RevitionCommand<Out> {
|
|
17
|
+
static summary: string;
|
|
18
|
+
static examples: string[];
|
|
19
|
+
static meta: CommandMeta;
|
|
20
|
+
static flags: {
|
|
21
|
+
app: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
dir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
25
|
+
protected human(o: Out): HumanView;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RevitionCommand, renderTable, terminalTable } from '@revition/cli-core';
|
|
2
|
+
import { devApi, seg } from '../../api.js';
|
|
3
|
+
import { appOf } from '../submit.js';
|
|
4
|
+
import { appFlags } from './list.js';
|
|
5
|
+
export default class VersionsRollouts extends RevitionCommand {
|
|
6
|
+
static summary = "An app's staged rollouts: the version, its current stage and status on each channel.";
|
|
7
|
+
static examples = ['revition versions rollouts --app dapp_123', 'revition versions rollouts --app dapp_123 --json'];
|
|
8
|
+
static meta = {
|
|
9
|
+
id: 'versions:rollouts',
|
|
10
|
+
summary: VersionsRollouts.summary,
|
|
11
|
+
examples: VersionsRollouts.examples,
|
|
12
|
+
requiredScopes: ['cli:read'],
|
|
13
|
+
mutates: false,
|
|
14
|
+
confirm: 'none',
|
|
15
|
+
jsonSchemaId: 'revition.versions.rollouts.v1',
|
|
16
|
+
stability: 'stable',
|
|
17
|
+
};
|
|
18
|
+
static flags = appFlags;
|
|
19
|
+
async run2(ctx) {
|
|
20
|
+
const appId = appOf(ctx);
|
|
21
|
+
const api = await devApi(ctx);
|
|
22
|
+
return { appId, rollouts: (await api.request({ method: 'GET', path: `/release/apps/${seg(appId)}/rollouts` })).body.rollouts };
|
|
23
|
+
}
|
|
24
|
+
human(o) {
|
|
25
|
+
if (o.rollouts.length === 0)
|
|
26
|
+
return { text: `${o.appId} has no rollouts.\n` };
|
|
27
|
+
return {
|
|
28
|
+
text: renderTable(['channel', 'version', 'previous', 'stage', 'status'], o.rollouts.map((r) => [r.channel, r.version, r.previous ?? '-', `${r.plan.stages[r.stageIndex] ?? 100}%`, r.status]), terminalTable()),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=rollouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"r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AQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,qBAAqB,EAAE,CAAC;QAC9E,OAAO;YACL,IAAI,EAAE,WAAW,CACf,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,EACrD,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EACpH,aAAa,EAAE,CAChB;SACF,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
interface Out {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly opened: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** T2.4.3 - the portal wallet page: top-up is a portal step (the CLI never handles payment data). */
|
|
7
|
+
export default class WalletOpen extends RevitionCommand<Out> {
|
|
8
|
+
static summary: string;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static meta: CommandMeta;
|
|
11
|
+
protected run2(ctx: CommandContext): Promise<Out>;
|
|
12
|
+
protected human(o: Out): HumanView;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { canOpenBrowser, openBrowser, RevitionCommand } from '@revition/cli-core';
|
|
2
|
+
import { assertOpenable } from '../submissions/open.js';
|
|
3
|
+
import { WALLET_PAGE_URL } from './show.js';
|
|
4
|
+
/** T2.4.3 - the portal wallet page: top-up is a portal step (the CLI never handles payment data). */
|
|
5
|
+
export default class WalletOpen extends RevitionCommand {
|
|
6
|
+
static summary = 'Open the Developer Portal wallet (top-up happens there).';
|
|
7
|
+
static examples = ['revition wallet open'];
|
|
8
|
+
static meta = {
|
|
9
|
+
id: 'wallet:open',
|
|
10
|
+
summary: WalletOpen.summary,
|
|
11
|
+
examples: WalletOpen.examples,
|
|
12
|
+
requiredScopes: [],
|
|
13
|
+
mutates: false,
|
|
14
|
+
confirm: 'none',
|
|
15
|
+
jsonSchemaId: 'revition.wallet.open.v1',
|
|
16
|
+
stability: 'stable',
|
|
17
|
+
};
|
|
18
|
+
async run2(ctx) {
|
|
19
|
+
const url = assertOpenable(WALLET_PAGE_URL);
|
|
20
|
+
const opened = !ctx.flags.json && canOpenBrowser(ctx.env, process.platform) ? await openBrowser(url) : false;
|
|
21
|
+
return { url, opened };
|
|
22
|
+
}
|
|
23
|
+
human(o) {
|
|
24
|
+
return { text: `${o.opened ? 'Opened' : 'Open'} ${o.url} to see and top up your developer wallet.\n` };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/wallet/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAyD,MAAM,oBAAoB,CAAC;AAEzI,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAO5C,qGAAqG;AACrG,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,eAAoB;IAC1D,MAAM,CAAU,OAAO,GAAG,0DAA0D,CAAC;IACrF,MAAM,CAAU,QAAQ,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpD,MAAM,CAAC,IAAI,GAAgB;QACzB,EAAE,EAAE,aAAa;QACjB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,cAAc,EAAE,EAAE;QAClB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,yBAAyB;QACvC,SAAS,EAAE,QAAQ;KACpB,CAAC;IAEQ,KAAK,CAAC,IAAI,CAAC,GAAmB;QACtC,MAAM,GAAG,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACzB,CAAC;IAEkB,KAAK,CAAC,CAAM;QAC7B,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,6CAA6C,EAAE,CAAC;IACzG,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
|
|
2
|
+
/**
|
|
3
|
+
* T2.4.3 - `revition wallet`: the caller's own developer wallet (GET /dev/wallet: the subject, never a parameter).
|
|
4
|
+
* Amounts come from the server (Mint); only the three wallet fields are kept, so no payment data ever reaches the
|
|
5
|
+
* CLI's output. Top-up stays in the portal.
|
|
6
|
+
*/
|
|
7
|
+
export interface WalletView {
|
|
8
|
+
readonly credits: number;
|
|
9
|
+
readonly usd: number;
|
|
10
|
+
readonly usedPct: number;
|
|
11
|
+
/** false when no wallet is open yet (credits 0, with the portal top-up link). */
|
|
12
|
+
readonly open: boolean;
|
|
13
|
+
readonly topUpUrl: string;
|
|
14
|
+
}
|
|
15
|
+
/** The developer portal's home, where the wallet panel and its top-up live (devportal dev-dashboard.tsx). */
|
|
16
|
+
export declare const WALLET_PAGE_URL = "https://developer.revition.com/";
|
|
17
|
+
/** The server's answer reduced to the wallet's own fields (an allowlist: nothing else is passed on). PURE. */
|
|
18
|
+
export declare function walletOf(body: unknown): WalletView;
|
|
19
|
+
export default class WalletShow extends RevitionCommand<WalletView> {
|
|
20
|
+
static summary: string;
|
|
21
|
+
static examples: string[];
|
|
22
|
+
static meta: CommandMeta;
|
|
23
|
+
protected run2(ctx: CommandContext): Promise<WalletView>;
|
|
24
|
+
protected human(w: WalletView): HumanView;
|
|
25
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EXIT, RevitionCliError, RevitionCommand } from '@revition/cli-core';
|
|
2
|
+
import { devApi, DEVELOPER_PORTAL_URL } from '../../api.js';
|
|
3
|
+
/** The developer portal's home, where the wallet panel and its top-up live (devportal dev-dashboard.tsx). */
|
|
4
|
+
export const WALLET_PAGE_URL = `${DEVELOPER_PORTAL_URL}/`;
|
|
5
|
+
/** The server's answer reduced to the wallet's own fields (an allowlist: nothing else is passed on). PURE. */
|
|
6
|
+
export function walletOf(body) {
|
|
7
|
+
const b = (body ?? {});
|
|
8
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
9
|
+
return { credits: num(b['credits']), usd: num(b['usd']), usedPct: num(b['usedPct']), open: true, topUpUrl: WALLET_PAGE_URL };
|
|
10
|
+
}
|
|
11
|
+
export default class WalletShow extends RevitionCommand {
|
|
12
|
+
static summary = 'Your developer wallet balance (build credits), from Mint.';
|
|
13
|
+
static examples = ['revition wallet show', 'revition wallet show --json'];
|
|
14
|
+
static meta = {
|
|
15
|
+
id: 'wallet:show',
|
|
16
|
+
summary: WalletShow.summary,
|
|
17
|
+
examples: WalletShow.examples,
|
|
18
|
+
requiredScopes: ['cli:read'],
|
|
19
|
+
mutates: false,
|
|
20
|
+
confirm: 'none',
|
|
21
|
+
jsonSchemaId: 'revition.wallet.show.v1',
|
|
22
|
+
stability: 'stable',
|
|
23
|
+
};
|
|
24
|
+
async run2(ctx) {
|
|
25
|
+
const api = await devApi(ctx);
|
|
26
|
+
try {
|
|
27
|
+
return walletOf((await api.request({ method: 'GET', path: '/dev/wallet' })).body);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
// No wallet row yet: zero credits, and where to add some (edge case, plan :2455).
|
|
31
|
+
if (e instanceof RevitionCliError && e.exitCode === EXIT.notFound && e.error.code === 'WALLET_NOT_OPEN') {
|
|
32
|
+
return { credits: 0, usd: 0, usedPct: 0, open: false, topUpUrl: WALLET_PAGE_URL };
|
|
33
|
+
}
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
human(w) {
|
|
38
|
+
const balance = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(w.usd);
|
|
39
|
+
return {
|
|
40
|
+
text: w.open
|
|
41
|
+
? `Balance: ${balance} (${w.credits} credits), ${w.usedPct}% used.\nTop up in the Developer Portal: ${w.topUpUrl}\n`
|
|
42
|
+
: `No developer wallet yet: 0 credits.\nTop up in the Developer Portal: ${w.topUpUrl}\n`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show.js","sourceRoot":"","sources":["../../../src/commands/wallet/show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAyD,MAAM,oBAAoB,CAAC;AAEpI,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAgB5D,6GAA6G;AAC7G,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,oBAAoB,GAAG,CAAC;AAE1D,8GAA8G;AAC9G,MAAM,UAAU,QAAQ,CAAC,IAAa;IACpC,MAAM,CAAC,GAAG,CAAC,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EAAE,CAAC;YACX,kFAAkF;YAClF,IAAI,CAAC,YAAY,gBAAgB,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;gBACxG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;YACpF,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAEkB,KAAK,CAAC,CAAa;QACpC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACzJ,OAAO;YACL,IAAI,EAAE,CAAC,CAAC,IAAI;gBACV,CAAC,CAAC,YAAY,OAAO,KAAK,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,OAAO,4CAA4C,CAAC,CAAC,QAAQ,IAAI;gBACpH,CAAC,CAAC,wEAAwE,CAAC,CAAC,QAAQ,IAAI;SAC3F,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ApiClient } from '@revition/cli-core';
|
|
2
|
+
/**
|
|
3
|
+
* T2.1.4 - the cloud sandbox for one project (devportal/sandbox/dev-sandbox.ts): one session per project, metered to
|
|
4
|
+
* the developer wallet; the platform stops it after 5 idle minutes and at most 20 minutes after it starts. The sandbox
|
|
5
|
+
* runs the SAVED files, so every action saves first. A save from an older version is refused by the platform
|
|
6
|
+
* (409 AGENT_STATE_CONFLICT): another editor saved, and nothing is overwritten.
|
|
7
|
+
*/
|
|
8
|
+
export interface SandboxSessionView {
|
|
9
|
+
readonly sessionId: string;
|
|
10
|
+
readonly projectId: string;
|
|
11
|
+
readonly tier: string;
|
|
12
|
+
readonly provider: string;
|
|
13
|
+
readonly expiresAt: string;
|
|
14
|
+
readonly resumed: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface RunResult {
|
|
17
|
+
readonly ok: boolean;
|
|
18
|
+
readonly output?: unknown;
|
|
19
|
+
readonly message?: string;
|
|
20
|
+
readonly logs: readonly string[];
|
|
21
|
+
readonly wallMs: number;
|
|
22
|
+
}
|
|
23
|
+
export type Action = {
|
|
24
|
+
readonly kind: 'run';
|
|
25
|
+
readonly capabilityId: string;
|
|
26
|
+
readonly input: unknown;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'test';
|
|
29
|
+
readonly capabilityId: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'exec';
|
|
32
|
+
readonly command: string;
|
|
33
|
+
};
|
|
34
|
+
export declare class SandboxSession {
|
|
35
|
+
private readonly api;
|
|
36
|
+
readonly projectId: string;
|
|
37
|
+
private version;
|
|
38
|
+
constructor(api: ApiClient, projectId: string, baseVersion: number);
|
|
39
|
+
get baseVersion(): number;
|
|
40
|
+
static open(api: ApiClient, projectId: string): Promise<{
|
|
41
|
+
session: SandboxSession;
|
|
42
|
+
view: SandboxSessionView;
|
|
43
|
+
}>;
|
|
44
|
+
/** Saves the whole file set from the last known version; a 409 means someone else saved first. */
|
|
45
|
+
save(files: Readonly<Record<string, string>>): Promise<number>;
|
|
46
|
+
act(a: Action): Promise<unknown>;
|
|
47
|
+
dispose(): Promise<void>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EXIT, RevitionCliError } from '@revition/cli-core';
|
|
2
|
+
import { seg } from '../api.js';
|
|
3
|
+
export class SandboxSession {
|
|
4
|
+
api;
|
|
5
|
+
projectId;
|
|
6
|
+
version;
|
|
7
|
+
constructor(api, projectId, baseVersion) {
|
|
8
|
+
this.api = api;
|
|
9
|
+
this.projectId = projectId;
|
|
10
|
+
this.version = baseVersion;
|
|
11
|
+
}
|
|
12
|
+
get baseVersion() {
|
|
13
|
+
return this.version;
|
|
14
|
+
}
|
|
15
|
+
static async open(api, projectId) {
|
|
16
|
+
const project = (await api.request({ method: 'GET', path: `/dev/projects/${seg(projectId)}` })).body;
|
|
17
|
+
const view = (await api.request({ method: 'POST', path: `/dev/projects/${seg(projectId)}/sandbox` })).body;
|
|
18
|
+
return { session: new SandboxSession(api, projectId, project.version), view };
|
|
19
|
+
}
|
|
20
|
+
/** Saves the whole file set from the last known version; a 409 means someone else saved first. */
|
|
21
|
+
async save(files) {
|
|
22
|
+
try {
|
|
23
|
+
const meta = (await this.api.request({ method: 'PUT', path: `/dev/projects/${seg(this.projectId)}/files`, body: { files, baseVersion: this.version } })).body;
|
|
24
|
+
this.version = meta.version;
|
|
25
|
+
return meta.version;
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
if (e instanceof RevitionCliError && e.exitCode === EXIT.conflict) {
|
|
29
|
+
throw new RevitionCliError({
|
|
30
|
+
code: 'PROJECT_CHANGED_ELSEWHERE',
|
|
31
|
+
message: 'Another editor saved this project since you started: nothing was overwritten.',
|
|
32
|
+
hint: 'Reload the project (`revition dev --pull`) and apply your change again.',
|
|
33
|
+
}, EXIT.conflict);
|
|
34
|
+
}
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async act(a) {
|
|
39
|
+
const base = `/dev/projects/${seg(this.projectId)}/sandbox`;
|
|
40
|
+
if (a.kind === 'run')
|
|
41
|
+
return (await this.api.request({ method: 'POST', path: `${base}/run`, body: { capabilityId: a.capabilityId, input: a.input } })).body;
|
|
42
|
+
if (a.kind === 'test')
|
|
43
|
+
return (await this.api.request({ method: 'POST', path: `${base}/test`, body: { capabilityId: a.capabilityId } })).body;
|
|
44
|
+
return (await this.api.request({ method: 'POST', path: `${base}/exec`, body: { command: a.command } })).body;
|
|
45
|
+
}
|
|
46
|
+
async dispose() {
|
|
47
|
+
await this.api.request({ method: 'DELETE', path: `/dev/projects/${seg(this.projectId)}/sandbox` });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=sandbox-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-session.js","sourceRoot":"","sources":["../../src/dev/sandbox-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAkB,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AA8BhC,MAAM,OAAO,cAAc;IAIN;IACR;IAJH,OAAO,CAAS;IAExB,YACmB,GAAc,EACtB,SAAiB,EAC1B,WAAmB;QAFF,QAAG,GAAH,GAAG,CAAW;QACtB,cAAS,GAAT,SAAS,CAAQ;QAG1B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;IAC7B,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAc,EAAE,SAAiB;QACjD,MAAM,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,CAAsB,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1H,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,CAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/H,OAAO,EAAE,OAAO,EAAE,IAAI,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;IAChF,CAAC;IAED,kGAAkG;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AAO,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9I,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/G,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;IACrG,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** One ignore-file line as a matcher: `name`, `dir/`, `*.ext`, `a/**` (no negation). PURE. */
|
|
2
|
+
export declare function ignoreMatcher(line: string): ((path: string) => boolean) | null;
|
|
3
|
+
export declare function ignoredBy(dir: string): (path: string) => boolean;
|
|
4
|
+
export declare function secretIn(text: string): boolean;
|
|
5
|
+
export interface Upload {
|
|
6
|
+
readonly files: Readonly<Record<string, string>>;
|
|
7
|
+
readonly excluded: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
/** The files to upload, or a refusal naming every file that holds a secret (nothing is sent). PURE given the files. */
|
|
10
|
+
export declare function uploadSet(all: Readonly<Record<string, string>>, ignored: (path: string) => boolean): Upload;
|
|
11
|
+
export declare function projectUpload(dir: string): Upload;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { EXIT, RevitionCliError, SECRET_PATTERNS } from '@revition/cli-core';
|
|
4
|
+
import { readProjectDir } from '../project/read-project.js';
|
|
5
|
+
/**
|
|
6
|
+
* T2.1.4 - what `dev --sandbox` uploads: the FULL project file set (the platform stores whole revisions), minus what
|
|
7
|
+
* `.revitionignore` and `.gitignore` exclude, never `.env*`, key files or `.revition/` (hidden entries are never read),
|
|
8
|
+
* and NEVER a file whose content looks like a secret: one is found -> the upload is blocked, naming the file.
|
|
9
|
+
*/
|
|
10
|
+
const KEY_FILE = /(^|\/)(\.env[^/]*|id_(rsa|dsa|ecdsa|ed25519)[^/]*|[^/]+\.(pem|key|p12|pfx))$/i;
|
|
11
|
+
const PRIVATE_KEY_BLOCK = /-----BEGIN [A-Z ]*PRIVATE KEY-----/;
|
|
12
|
+
/** One ignore-file line as a matcher: `name`, `dir/`, `*.ext`, `a/**` (no negation). PURE. */
|
|
13
|
+
export function ignoreMatcher(line) {
|
|
14
|
+
const t = line.trim();
|
|
15
|
+
if (t === '' || t.startsWith('#') || t.startsWith('!'))
|
|
16
|
+
return null;
|
|
17
|
+
const dirOnly = t.endsWith('/');
|
|
18
|
+
const body = t.replace(/^\/+/, '').replace(/\/+$/, '');
|
|
19
|
+
const rx = body
|
|
20
|
+
.split('**')
|
|
21
|
+
.map((part) => part.split('*').map((s) => s.replace(/[.+?^${}()|[\]\\]/g, '\\$&')).join('[^/]*'))
|
|
22
|
+
.join('.*');
|
|
23
|
+
const anchored = t.startsWith('/') || body.includes('/');
|
|
24
|
+
const re = new RegExp(`${anchored ? '^' : '(^|/)'}${rx}${dirOnly ? '/' : '(/|$)'}`);
|
|
25
|
+
return (path) => re.test(dirOnly ? `${path}/` : path) || re.test(path);
|
|
26
|
+
}
|
|
27
|
+
export function ignoredBy(dir) {
|
|
28
|
+
const matchers = ['.revitionignore', '.gitignore']
|
|
29
|
+
.map((f) => join(dir, f))
|
|
30
|
+
.filter((f) => existsSync(f))
|
|
31
|
+
.flatMap((f) => readFileSync(f, 'utf8').split(/\r?\n/))
|
|
32
|
+
.map(ignoreMatcher)
|
|
33
|
+
.filter((m) => m !== null);
|
|
34
|
+
return (path) => matchers.some((m) => m(path));
|
|
35
|
+
}
|
|
36
|
+
export function secretIn(text) {
|
|
37
|
+
return PRIVATE_KEY_BLOCK.test(text) || SECRET_PATTERNS.some((p) => new RegExp(p.source, p.flags.replace('g', '')).test(text));
|
|
38
|
+
}
|
|
39
|
+
/** The files to upload, or a refusal naming every file that holds a secret (nothing is sent). PURE given the files. */
|
|
40
|
+
export function uploadSet(all, ignored) {
|
|
41
|
+
const files = {};
|
|
42
|
+
const excluded = [];
|
|
43
|
+
for (const [path, text] of Object.entries(all)) {
|
|
44
|
+
if (KEY_FILE.test(path) || ignored(path)) {
|
|
45
|
+
excluded.push(path);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
files[path] = text;
|
|
49
|
+
}
|
|
50
|
+
const leaking = Object.entries(files).filter(([, text]) => secretIn(text)).map(([p]) => p);
|
|
51
|
+
if (leaking.length > 0) {
|
|
52
|
+
throw new RevitionCliError({
|
|
53
|
+
code: 'UPLOAD_SECRET_REFUSED',
|
|
54
|
+
message: `Not uploaded: ${leaking.join(', ')} ${leaking.length === 1 ? 'contains' : 'contain'} what looks like a secret.`,
|
|
55
|
+
hint: 'Move the value to `revition secrets set` (server-side) or add the file to .revitionignore.',
|
|
56
|
+
}, EXIT.usage);
|
|
57
|
+
}
|
|
58
|
+
return { files, excluded };
|
|
59
|
+
}
|
|
60
|
+
export function projectUpload(dir) {
|
|
61
|
+
return uploadSet(readProjectDir(dir), ignoredBy(dir));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=uploader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../../src/dev/uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EA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AC;AACxD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* T2.1.4 - file changes, debounced (300 ms): a burst of saves is one change. Hidden entries, node_modules and dist
|
|
3
|
+
* never trigger. Returns a stop function.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEBOUNCE_MS = 300;
|
|
6
|
+
export declare function watchProject(dir: string, onChange: (paths: readonly string[]) => void, debounceMs?: number): () => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { watch } from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* T2.1.4 - file changes, debounced (300 ms): a burst of saves is one change. Hidden entries, node_modules and dist
|
|
4
|
+
* never trigger. Returns a stop function.
|
|
5
|
+
*/
|
|
6
|
+
export const DEBOUNCE_MS = 300;
|
|
7
|
+
export function watchProject(dir, onChange, debounceMs = DEBOUNCE_MS) {
|
|
8
|
+
let timer = null;
|
|
9
|
+
const pending = new Set();
|
|
10
|
+
const w = watch(dir, { recursive: true }, (_event, name) => {
|
|
11
|
+
const p = String(name ?? '').split('\\').join('/');
|
|
12
|
+
if (p === '' || p.split('/').some((s) => s.startsWith('.') || s === 'node_modules' || s === 'dist'))
|
|
13
|
+
return;
|
|
14
|
+
pending.add(p);
|
|
15
|
+
if (timer !== null)
|
|
16
|
+
clearTimeout(timer);
|
|
17
|
+
timer = setTimeout(() => {
|
|
18
|
+
timer = null;
|
|
19
|
+
const paths = [...pending].sort();
|
|
20
|
+
pending.clear();
|
|
21
|
+
onChange(paths);
|
|
22
|
+
}, debounceMs);
|
|
23
|
+
});
|
|
24
|
+
return () => {
|
|
25
|
+
if (timer !== null)
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
w.close();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=watcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watcher.js","sourceRoot":"","sources":["../../src/dev/watcher.ts"],"names":[],"mappings":"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,CAAC,KAAK,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* T2.3.1 - `revition eval`: the platform's evaluation quote, run record and job, and their terminal rendering. The
|
|
3
|
+
* report is the portal's own (apps/web eval-console `EvalRunView`): the same verdict words, pass rate and billed
|
|
4
|
+
* credits, which come from the server (Mint) and are never computed here.
|
|
5
|
+
*/
|
|
6
|
+
export interface EvalQuote {
|
|
7
|
+
readonly quoteId: string;
|
|
8
|
+
readonly appId: string;
|
|
9
|
+
readonly projectId: string;
|
|
10
|
+
readonly suiteId: string;
|
|
11
|
+
readonly digest: string;
|
|
12
|
+
readonly cases: number;
|
|
13
|
+
readonly modelCalls: number;
|
|
14
|
+
readonly estCredits: number | null;
|
|
15
|
+
readonly balanceCredits: number | null;
|
|
16
|
+
}
|
|
17
|
+
export interface UpliftReport {
|
|
18
|
+
readonly capabilityId: string;
|
|
19
|
+
readonly version: string;
|
|
20
|
+
readonly suiteId: string;
|
|
21
|
+
readonly baseline: Readonly<Record<string, number>>;
|
|
22
|
+
readonly withCapability: Readonly<Record<string, number>>;
|
|
23
|
+
readonly delta: Readonly<Record<string, number>>;
|
|
24
|
+
readonly verdict: 'improves' | 'neutral' | 'regresses';
|
|
25
|
+
}
|
|
26
|
+
export interface EvalRun {
|
|
27
|
+
readonly runId: string;
|
|
28
|
+
readonly appId: string;
|
|
29
|
+
readonly suiteId: string;
|
|
30
|
+
readonly projectId: string;
|
|
31
|
+
readonly projectVersion: number;
|
|
32
|
+
readonly digest: string;
|
|
33
|
+
readonly report: UpliftReport;
|
|
34
|
+
readonly passRate: number;
|
|
35
|
+
readonly cases: number;
|
|
36
|
+
readonly at: string;
|
|
37
|
+
readonly billedCredits?: number;
|
|
38
|
+
}
|
|
39
|
+
export type EvalJob = {
|
|
40
|
+
readonly jobId: string;
|
|
41
|
+
readonly status: 'running';
|
|
42
|
+
readonly at: string;
|
|
43
|
+
} | {
|
|
44
|
+
readonly jobId: string;
|
|
45
|
+
readonly status: 'done';
|
|
46
|
+
readonly runId: string;
|
|
47
|
+
readonly at: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly jobId: string;
|
|
50
|
+
readonly status: 'failed';
|
|
51
|
+
readonly error: string;
|
|
52
|
+
readonly at: string;
|
|
53
|
+
};
|
|
54
|
+
/** The portal's verdict words (eval-console.tsx VERDICT). */
|
|
55
|
+
export declare const VERDICT: Readonly<Record<UpliftReport['verdict'], string>>;
|
|
56
|
+
/** Where the developer reads the same run on the web. */
|
|
57
|
+
export declare const EVAL_PORTAL_URL = "https://developer.revition.com/apps";
|
|
58
|
+
export declare function quoteText(q: EvalQuote): string;
|
|
59
|
+
/** The run as the portal shows it: the headline, then each dimension without vs with the capability. */
|
|
60
|
+
export declare function reportText(r: EvalRun): string;
|
|
61
|
+
/**
|
|
62
|
+
* After a timed-out run call: the newest run of this suite on this exact snapshot, if the run landed (the list is
|
|
63
|
+
* newest first). PURE.
|
|
64
|
+
*/
|
|
65
|
+
export declare function landedRun(runs: readonly EvalRun[], suiteId: string, digest: string): EvalRun | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DEVELOPER_PORTAL_URL } from '../api.js';
|
|
2
|
+
/** The portal's verdict words (eval-console.tsx VERDICT). */
|
|
3
|
+
export const VERDICT = {
|
|
4
|
+
improves: 'Improves the agent',
|
|
5
|
+
neutral: 'Neutral: no dimension moved',
|
|
6
|
+
regresses: 'Regresses the agent',
|
|
7
|
+
};
|
|
8
|
+
/** Where the developer reads the same run on the web. */
|
|
9
|
+
export const EVAL_PORTAL_URL = `${DEVELOPER_PORTAL_URL}/apps`;
|
|
10
|
+
export function quoteText(q) {
|
|
11
|
+
const cost = q.estCredits === null
|
|
12
|
+
? 'the exact amount is billed to your developer wallet after the run'
|
|
13
|
+
: `about ${q.estCredits} credits`;
|
|
14
|
+
const balance = q.balanceCredits === null ? 'unknown' : `${q.balanceCredits} credits`;
|
|
15
|
+
return [
|
|
16
|
+
`quote ${q.quoteId}: suite ${q.suiteId} on project ${q.projectId}`,
|
|
17
|
+
` ${q.cases} cases, ${q.modelCalls} model calls (each case without, then with the capability)`,
|
|
18
|
+
` cost: ${cost}; balance: ${balance}`,
|
|
19
|
+
].join('\n');
|
|
20
|
+
}
|
|
21
|
+
/** The run as the portal shows it: the headline, then each dimension without vs with the capability. */
|
|
22
|
+
export function reportText(r) {
|
|
23
|
+
const billed = r.billedCredits === undefined ? '' : ` · Billed: ${r.billedCredits} credits`;
|
|
24
|
+
const head = `${VERDICT[r.report.verdict]} · ${r.suiteId} · ${r.cases} cases · ` +
|
|
25
|
+
`pass rate ${(r.passRate * 100).toFixed(0)}% with the capability${billed}`;
|
|
26
|
+
const rows = Object.keys(r.report.withCapability).map((d) => {
|
|
27
|
+
const without = r.report.baseline[d];
|
|
28
|
+
const delta = r.report.delta[d];
|
|
29
|
+
return (` ${d} without the capability: ${without === undefined ? '-' : without.toFixed(3)}` +
|
|
30
|
+
` | with it: ${(r.report.withCapability[d] ?? 0).toFixed(3)}` +
|
|
31
|
+
` | delta ${delta === undefined ? '-' : `${delta >= 0 ? '+' : ''}${delta.toFixed(3)}`}`);
|
|
32
|
+
});
|
|
33
|
+
return [head, ...rows, `run ${r.runId} · ${EVAL_PORTAL_URL}`].join('\n');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* After a timed-out run call: the newest run of this suite on this exact snapshot, if the run landed (the list is
|
|
37
|
+
* newest first). PURE.
|
|
38
|
+
*/
|
|
39
|
+
export function landedRun(runs, suiteId, digest) {
|
|
40
|
+
return runs.find((r) => r.suiteId === suiteId && r.digest === digest) ?? null;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/eval/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,C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