praetom 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.js +11 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/commands/connect.d.ts +13 -0
- package/dist/cli/commands/connect.d.ts.map +1 -0
- package/dist/cli/commands/connect.js +106 -0
- package/dist/cli/commands/connect.js.map +1 -0
- package/dist/cli/commands/discover.d.ts.map +1 -1
- package/dist/cli/commands/discover.js +4 -6
- package/dist/cli/commands/discover.js.map +1 -1
- package/dist/cli/commands/features.d.ts.map +1 -1
- package/dist/cli/commands/features.js +65 -49
- package/dist/cli/commands/features.js.map +1 -1
- package/dist/cli/commands/init.d.ts +16 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +59 -40
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +20 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +82 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/login.d.ts +1 -1
- package/dist/cli/commands/login.d.ts.map +1 -1
- package/dist/cli/commands/login.js +59 -45
- package/dist/cli/commands/login.js.map +1 -1
- package/dist/cli/commands/logout.d.ts.map +1 -1
- package/dist/cli/commands/logout.js +10 -10
- package/dist/cli/commands/logout.js.map +1 -1
- package/dist/cli/commands/rotate.d.ts.map +1 -1
- package/dist/cli/commands/rotate.js +29 -23
- package/dist/cli/commands/rotate.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +38 -12
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +63 -51
- package/dist/cli/commands/uninstall.js.map +1 -1
- package/dist/cli/commands/usage.d.ts.map +1 -1
- package/dist/cli/commands/usage.js +12 -12
- package/dist/cli/commands/usage.js.map +1 -1
- package/dist/cli/commands/whoami.d.ts.map +1 -1
- package/dist/cli/commands/whoami.js +22 -25
- package/dist/cli/commands/whoami.js.map +1 -1
- package/dist/cli/util/api.d.ts +9 -0
- package/dist/cli/util/api.d.ts.map +1 -1
- package/dist/cli/util/api.js +14 -1
- package/dist/cli/util/api.js.map +1 -1
- package/dist/cli/util/output.d.ts +55 -0
- package/dist/cli/util/output.d.ts.map +1 -0
- package/dist/cli/util/output.js +170 -0
- package/dist/cli/util/output.js.map +1 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +12 -4
|
@@ -1,63 +1,75 @@
|
|
|
1
|
-
import { apiRequest, NotAuthenticatedError, workspaceQuery } from "../util/api.js";
|
|
1
|
+
import { apiRequest, NotAuthenticatedError, workspaceQuery, } from "../util/api.js";
|
|
2
2
|
import { resolveRepo } from "../util/git.js";
|
|
3
|
+
import { colors, logError, result, runTasks } from "../util/output.js";
|
|
3
4
|
export async function uninstallCommand(ctx) {
|
|
4
5
|
const repo = await resolveRepo(ctx.repo);
|
|
5
6
|
if (!repo) {
|
|
6
|
-
|
|
7
|
+
logError(ctx, "Couldn't determine the repository. Pass --repo owner/name, or run this from inside a git checkout with a GitHub remote.");
|
|
8
|
+
process.exit(1);
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
let result;
|
|
10
|
+
const slug = `${repo.owner}/${repo.name}`;
|
|
11
|
+
const out = { response: null };
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
await runTasks(ctx, [
|
|
14
|
+
{
|
|
15
|
+
title: `Uninstalling praetom from ${slug}`,
|
|
16
|
+
task: async (t) => {
|
|
17
|
+
try {
|
|
18
|
+
out.response = await apiRequest("/api/cli/uninstall", {
|
|
19
|
+
method: "POST",
|
|
20
|
+
body: { owner: repo.owner, name: repo.name },
|
|
21
|
+
query: workspaceQuery(ctx),
|
|
22
|
+
});
|
|
23
|
+
const r = out.response;
|
|
24
|
+
const counts = [
|
|
25
|
+
`${r.filesDeleted.length} deleted`,
|
|
26
|
+
`${r.filesEdited.length} edited`,
|
|
27
|
+
];
|
|
28
|
+
if (r.filesSkipped.length > 0)
|
|
29
|
+
counts.push(`${r.filesSkipped.length} skipped`);
|
|
30
|
+
t.setTitle(`Uninstall PR opened for ${slug} ${colors.dim(`(${counts.join(", ")})`)}`);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
if (e instanceof NotAuthenticatedError) {
|
|
34
|
+
throw new Error(`${e.message} Run \`praetom login\` first.`);
|
|
35
|
+
}
|
|
36
|
+
throw e;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
18
41
|
}
|
|
19
|
-
catch
|
|
20
|
-
|
|
21
|
-
fail(ctx, e.message);
|
|
22
|
-
}
|
|
23
|
-
throw e;
|
|
42
|
+
catch {
|
|
43
|
+
process.exit(1);
|
|
24
44
|
}
|
|
25
|
-
|
|
26
|
-
|
|
45
|
+
const r = out.response;
|
|
46
|
+
if (!r)
|
|
27
47
|
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
result(ctx, { repo: slug, ...r }, () => {
|
|
49
|
+
const lines = ["", `${colors.dim("Pull request:")} ${r.prUrl}`, ""];
|
|
50
|
+
if (r.filesDeleted.length > 0) {
|
|
51
|
+
lines.push(`${colors.bold(`Deleted ${r.filesDeleted.length} file(s):`)}`);
|
|
52
|
+
for (const p of r.filesDeleted)
|
|
53
|
+
lines.push(` ${colors.red("-")} ${colors.dim(p)}`);
|
|
54
|
+
}
|
|
55
|
+
if (r.filesEdited.length > 0) {
|
|
56
|
+
lines.push(`${colors.bold(`Edited ${r.filesEdited.length} file(s)`)} ${colors.dim("(stripped @praetom/* entries):")}`);
|
|
57
|
+
for (const p of r.filesEdited)
|
|
58
|
+
lines.push(` ${colors.yellow("~")} ${colors.dim(p)}`);
|
|
59
|
+
}
|
|
60
|
+
if (r.filesSkipped.length > 0) {
|
|
61
|
+
lines.push("");
|
|
62
|
+
lines.push(colors.yellow("Needs manual cleanup — these files were modified rather than added by install, so safe-revert isn't possible:"));
|
|
63
|
+
for (const p of r.filesSkipped)
|
|
64
|
+
lines.push(` ${colors.yellow("!")} ${colors.dim(p)}`);
|
|
65
|
+
}
|
|
41
66
|
lines.push("");
|
|
42
|
-
lines.push(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
: "No active ingest token to revoke (already revoked, or never issued).");
|
|
50
|
-
lines.push("");
|
|
51
|
-
lines.push("Merge and deploy to stop reporting telemetry from this repository.");
|
|
52
|
-
process.stdout.write(lines.join("\n") + "\n");
|
|
53
|
-
}
|
|
54
|
-
function fail(ctx, message) {
|
|
55
|
-
if (ctx.json) {
|
|
56
|
-
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
process.stderr.write(`${message}\n`);
|
|
60
|
-
}
|
|
61
|
-
process.exit(1);
|
|
67
|
+
lines.push(r.tokenRevoked
|
|
68
|
+
? `${colors.red("⚠")} ${colors.bold("Per-repository ingest token revoked")} ${colors.dim("on praetom's side.")}`
|
|
69
|
+
: `${colors.dim("No active ingest token to revoke (already revoked, or never issued).")}`);
|
|
70
|
+
lines.push("");
|
|
71
|
+
lines.push(colors.dim("Merge and deploy to stop reporting telemetry from this repository."));
|
|
72
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
73
|
+
});
|
|
62
74
|
}
|
|
63
75
|
//# sourceMappingURL=uninstall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/cli/commands/uninstall.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/cli/commands/uninstall.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAavE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAe;IACpD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,QAAQ,CACN,GAAG,EACH,yHAAyH,CAC1H,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1C,MAAM,GAAG,GAA2C,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAEvE,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,GAAG,EAAE;YAClB;gBACE,KAAK,EAAE,6BAA6B,IAAI,EAAE;gBAC1C,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;oBAChB,IAAI,CAAC;wBACH,GAAG,CAAC,QAAQ,GAAG,MAAM,UAAU,CAC7B,oBAAoB,EACpB;4BACE,MAAM,EAAE,MAAM;4BACd,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;4BAC5C,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC;yBAC3B,CACF,CAA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AC,GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;YAChH,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,sEAAsE,CAAC,EAAE,CAC5F,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CACR,MAAM,CAAC,GAAG,CACR,oEAAoE,CACrE,CACF,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAChD,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAcjD,wBAAsB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBjE"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { apiRequest, workspaceQuery } from "../util/api.js";
|
|
2
|
+
import { colors, result } from "../util/output.js";
|
|
2
3
|
export async function usageCommand(ctx) {
|
|
3
4
|
const res = await apiRequest("/api/cli/usage", {
|
|
4
5
|
query: workspaceQuery(ctx),
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`spans (30d) ${res.spans30d ?? "—"}\n`);
|
|
7
|
+
result(ctx, res, () => {
|
|
8
|
+
const row = (label, value) => `${colors.dim(label.padEnd(18))}${colors.bold(String(value))}\n`;
|
|
9
|
+
process.stdout.write(`${colors.bold("Usage")} ${colors.dim(`— ${res.workspaceSlug}`)}\n` +
|
|
10
|
+
`${colors.dim("─".repeat(40))}\n` +
|
|
11
|
+
row("features", res.features) +
|
|
12
|
+
row("repositories", res.repositories) +
|
|
13
|
+
row("installs", res.installs) +
|
|
14
|
+
row(" live", res.liveInstalls) +
|
|
15
|
+
row("ingest tokens", res.ingestTokens) +
|
|
16
|
+
row("spans (30d)", res.spans30d ?? "—"));
|
|
17
|
+
});
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=usage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/cli/commands/usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/cli/commands/usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAYnD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAe;IAChD,MAAM,GAAG,GAAG,MAAM,UAAU,CAAgB,gBAAgB,EAAE;QAC5D,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC;KAC3B,CAAC,CAAC;IAEH,MAAM,CACJ,GAAG,EACH,GAAyC,EACzC,GAAG,EAAE;QACH,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,KAAsB,EAAE,EAAE,CACpD,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;QACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,aAAa,EAAE,CAAC,IAAI;YACjE,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI;YACjC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC;YAC7B,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,YAAY,CAAC;YACrC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC;YAC7B,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC;YAC/B,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,YAAY,CAAC;YACtC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,CAC1C,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAyBjD,wBAAsB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA4ClE"}
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
import { apiRequest, NotAuthenticatedError } from "../util/api.js";
|
|
1
|
+
import { apiRequest, AuthRejectedError, NotAuthenticatedError, } from "../util/api.js";
|
|
2
|
+
import { colors, logError, result } from "../util/output.js";
|
|
2
3
|
export async function whoamiCommand(ctx) {
|
|
3
4
|
let me;
|
|
4
5
|
try {
|
|
5
6
|
me = await apiRequest("/api/cli/me");
|
|
6
7
|
}
|
|
7
8
|
catch (e) {
|
|
8
|
-
if (e instanceof NotAuthenticatedError) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
process.stderr.write(`${e.message}\n`);
|
|
14
|
-
}
|
|
9
|
+
if (e instanceof NotAuthenticatedError || e instanceof AuthRejectedError) {
|
|
10
|
+
const reason = e instanceof AuthRejectedError ? "rejected" : "missing";
|
|
11
|
+
result(ctx, { authenticated: false, reason }, () => {
|
|
12
|
+
logError(ctx, e.message);
|
|
13
|
+
});
|
|
15
14
|
process.exit(1);
|
|
16
15
|
}
|
|
17
16
|
throw e;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`auth ${me.authMode}\n` +
|
|
35
|
-
(me.repoSlug ? `repo ${me.repoSlug}\n` : ""));
|
|
18
|
+
result(ctx, { authenticated: true, ...me }, () => {
|
|
19
|
+
if (me.kind === "user") {
|
|
20
|
+
process.stdout.write(`${colors.bold("user")} ${me.userId}\n` +
|
|
21
|
+
`${colors.dim("scope")} ${colors.cyan(me.scope)}\n` +
|
|
22
|
+
`${colors.dim("auth")} ${colors.dim(me.authMode)}\n` +
|
|
23
|
+
`\n${colors.dim("This token is user-scoped. Workspace-specific commands (init, status, features, rotate) need a workspace-scoped token until --workspace selection lands on the server.")}\n`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
process.stdout.write(`${colors.bold("workspace")} ${colors.bold(me.workspaceName)} ${colors.dim(`(${me.workspaceSlug})`)}\n` +
|
|
27
|
+
`${colors.dim("scope")} ${colors.cyan(me.scope)}\n` +
|
|
28
|
+
`${colors.dim("auth")} ${colors.dim(me.authMode)}\n` +
|
|
29
|
+
(me.repoSlug
|
|
30
|
+
? `${colors.dim("repo")} ${me.repoSlug}\n`
|
|
31
|
+
: ""));
|
|
32
|
+
});
|
|
36
33
|
}
|
|
37
34
|
//# sourceMappingURL=whoami.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../src/cli/commands/whoami.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../src/cli/commands/whoami.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAmB7D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAe;IACjD,IAAI,EAAc,CAAC;IACnB,IAAI,CAAC;QACH,EAAE,GAAG,MAAM,UAAU,CAAa,aAAa,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,qBAAqB,IAAI,CAAC,YAAY,iBAAiB,EAAE,CAAC;YACzE,MAAM,MAAM,GAAG,CAAC,YAAY,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;YACvE,MAAM,CACJ,GAAG,EACH,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,EAChC,GAAG,EAAE;gBACH,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC,CACF,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;IAED,MAAM,CACJ,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,15 @@ export declare class ApiError extends Error {
|
|
|
11
11
|
export declare class NotAuthenticatedError extends Error {
|
|
12
12
|
constructor();
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* The local auth artifact exists, but the server rejected it (401). The
|
|
16
|
+
* token may have been revoked, expired, or never had the right scope.
|
|
17
|
+
* Distinct from NotAuthenticatedError so the CLI can tell the user that
|
|
18
|
+
* their stored credential is the problem, not the absence of one.
|
|
19
|
+
*/
|
|
20
|
+
export declare class AuthRejectedError extends Error {
|
|
21
|
+
constructor();
|
|
22
|
+
}
|
|
14
23
|
export declare function requireAuth(): Promise<AuthState>;
|
|
15
24
|
interface RequestOptions {
|
|
16
25
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/cli/util/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE1D,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;gBACD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAM3D;AAED,qBAAa,qBAAsB,SAAQ,KAAK;;CAO/C;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC,CAItD;AAED,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3C,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,eAAe,CAAC,EAA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ACxB,OAAO,CAAC,CAAC,CAAC,CAmCZ;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACrC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAGhD"}
|
package/dist/cli/util/api.js
CHANGED
|
@@ -19,6 +19,19 @@ export class NotAuthenticatedError extends Error {
|
|
|
19
19
|
this.name = "NotAuthenticatedError";
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* The local auth artifact exists, but the server rejected it (401). The
|
|
24
|
+
* token may have been revoked, expired, or never had the right scope.
|
|
25
|
+
* Distinct from NotAuthenticatedError so the CLI can tell the user that
|
|
26
|
+
* their stored credential is the problem, not the absence of one.
|
|
27
|
+
*/
|
|
28
|
+
export class AuthRejectedError extends Error {
|
|
29
|
+
constructor() {
|
|
30
|
+
super("Your stored praetom token was rejected by the server. " +
|
|
31
|
+
"Run `praetom logout && praetom login` to issue a fresh token.");
|
|
32
|
+
this.name = "AuthRejectedError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
22
35
|
export async function requireAuth() {
|
|
23
36
|
const auth = await readAuth();
|
|
24
37
|
if (!auth)
|
|
@@ -57,7 +70,7 @@ export async function apiRequest(path, opts = {}) {
|
|
|
57
70
|
const text = await res.text().catch(() => "");
|
|
58
71
|
if (!res.ok) {
|
|
59
72
|
if (res.status === 401) {
|
|
60
|
-
throw new
|
|
73
|
+
throw new AuthRejectedError();
|
|
61
74
|
}
|
|
62
75
|
throw new ApiError(res.status, text);
|
|
63
76
|
}
|
package/dist/cli/util/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/cli/util/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAE1D,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AsC;IAEtC,IAAI,CAAC,GAAG,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output abstraction for the praetom CLI. Switches between three modes:
|
|
3
|
+
*
|
|
4
|
+
* - **human, interactive TTY**: listr2 task lists with spinners,
|
|
5
|
+
* picocolors for status text, ora for one-shot waits. The fancy mode.
|
|
6
|
+
* - **human, non-TTY** (piped, redirected to a file): plain text. listr2
|
|
7
|
+
* and ora auto-detect this and degrade; we just call them anyway.
|
|
8
|
+
* - **agent / json**: NDJSON status events, one per line. Suitable for
|
|
9
|
+
* a coding agent (Claude Code, Cursor) parsing the CLI's output as
|
|
10
|
+
* it streams. No ANSI, no animations.
|
|
11
|
+
*
|
|
12
|
+
* Every command should funnel its progress + final result through this
|
|
13
|
+
* module so the agent/human switch is in one place.
|
|
14
|
+
*/
|
|
15
|
+
export interface RunContext {
|
|
16
|
+
workspace: string | undefined;
|
|
17
|
+
repo: string | undefined;
|
|
18
|
+
json: boolean;
|
|
19
|
+
nonInteractive: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface TaskSpec<T = void> {
|
|
22
|
+
title: string;
|
|
23
|
+
/** Skip this task without printing it when this returns false. */
|
|
24
|
+
enabled?: () => boolean | Promise<boolean>;
|
|
25
|
+
/** Called with a small surface to update the task title or skip mid-run. */
|
|
26
|
+
task: (ctx: TaskCtx) => Promise<T> | T;
|
|
27
|
+
/** Sub-tasks; rendered nested under this one. Run sequentially. */
|
|
28
|
+
subtasks?: () => Promise<TaskSpec[]> | TaskSpec[];
|
|
29
|
+
}
|
|
30
|
+
export interface TaskCtx {
|
|
31
|
+
/** Update the task's displayed title (e.g. "Detecting framework" → "Detecting framework Next.js 16"). */
|
|
32
|
+
setTitle: (s: string) => void;
|
|
33
|
+
/** Skip this task with a brief reason (shows as "✓ ... [skipped]" in human, "task_skip" in JSON). */
|
|
34
|
+
skip: (reason: string) => never;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Run a list of tasks with the right rendering for the current mode.
|
|
38
|
+
* In JSON mode emits NDJSON `{event,...}` rows. In human mode uses
|
|
39
|
+
* listr2 (loaded lazily so its ESM import doesn't slow `--help`).
|
|
40
|
+
*/
|
|
41
|
+
export declare function runTasks(ctx: RunContext, tasks: TaskSpec[]): Promise<void>;
|
|
42
|
+
export declare function logInfo(ctx: RunContext, message: string): void;
|
|
43
|
+
export declare function logSuccess(ctx: RunContext, message: string): void;
|
|
44
|
+
export declare function logWarn(ctx: RunContext, message: string): void;
|
|
45
|
+
export declare function logError(ctx: RunContext, message: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Final result block for a command. Prints a structured summary the
|
|
48
|
+
* caller composes (key/value pairs). In JSON mode emits one
|
|
49
|
+
* `{event:"result",...}` payload.
|
|
50
|
+
*/
|
|
51
|
+
export declare function result(ctx: RunContext, payload: Record<string, unknown>, human?: () => void): void;
|
|
52
|
+
export declare const colors: import("picocolors/types").Colors & {
|
|
53
|
+
createColors: (enabled?: boolean) => import("picocolors/types").Colors;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/cli/util/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,IAAI;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,OAAO,GA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+
* - **human, interactive TTY**: listr2 task lists with spinners,
|
|
5
|
+
* picocolors for status text, ora for one-shot waits. The fancy mode.
|
|
6
|
+
* - **human, non-TTY** (piped, redirected to a file): plain text. listr2
|
|
7
|
+
* and ora auto-detect this and degrade; we just call them anyway.
|
|
8
|
+
* - **agent / json**: NDJSON status events, one per line. Suitable for
|
|
9
|
+
* a coding agent (Claude Code, Cursor) parsing the CLI's output as
|
|
10
|
+
* it streams. No ANSI, no animations.
|
|
11
|
+
*
|
|
12
|
+
* Every command should funnel its progress + final result through this
|
|
13
|
+
* module so the agent/human switch is in one place.
|
|
14
|
+
*/
|
|
15
|
+
import pc from "picocolors";
|
|
16
|
+
class TaskSkipped extends Error {
|
|
17
|
+
reason;
|
|
18
|
+
constructor(reason) {
|
|
19
|
+
super(reason);
|
|
20
|
+
this.reason = reason;
|
|
21
|
+
this.name = "TaskSkipped";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Run a list of tasks with the right rendering for the current mode.
|
|
26
|
+
* In JSON mode emits NDJSON `{event,...}` rows. In human mode uses
|
|
27
|
+
* listr2 (loaded lazily so its ESM import doesn't slow `--help`).
|
|
28
|
+
*/
|
|
29
|
+
export async function runTasks(ctx, tasks) {
|
|
30
|
+
if (ctx.json) {
|
|
31
|
+
await runTasksJson(tasks);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await runTasksListr(tasks);
|
|
35
|
+
}
|
|
36
|
+
async function runTasksJson(tasks) {
|
|
37
|
+
for (const t of tasks) {
|
|
38
|
+
if (t.enabled && !(await t.enabled())) {
|
|
39
|
+
emit({ event: "task_skip", title: t.title, reason: "disabled" });
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
emit({ event: "task_start", title: t.title });
|
|
43
|
+
const inner = { current: t.title };
|
|
44
|
+
const ctx = {
|
|
45
|
+
setTitle: (s) => {
|
|
46
|
+
inner.current = s;
|
|
47
|
+
emit({ event: "task_update", title: s });
|
|
48
|
+
},
|
|
49
|
+
skip: (reason) => {
|
|
50
|
+
throw new TaskSkipped(reason);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
await t.task(ctx);
|
|
55
|
+
if (t.subtasks) {
|
|
56
|
+
const subs = await t.subtasks();
|
|
57
|
+
await runTasksJson(subs);
|
|
58
|
+
}
|
|
59
|
+
emit({ event: "task_done", title: inner.current });
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
if (e instanceof TaskSkipped) {
|
|
63
|
+
emit({ event: "task_skip", title: inner.current, reason: e.reason });
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
emit({
|
|
67
|
+
event: "task_error",
|
|
68
|
+
title: inner.current,
|
|
69
|
+
error: e.message,
|
|
70
|
+
});
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function runTasksListr(tasks) {
|
|
76
|
+
const { Listr } = await import("listr2");
|
|
77
|
+
// listr2's TaskWrapper has a complex generic signature; we use the
|
|
78
|
+
// looser shape (title + skip + newListr) so the wrapper stays
|
|
79
|
+
// self-contained. Cast at the boundary.
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
const list = new Listr(toListrTasks(tasks), {
|
|
82
|
+
rendererOptions: {
|
|
83
|
+
collapseSubtasks: false,
|
|
84
|
+
showSubtasks: true,
|
|
85
|
+
},
|
|
86
|
+
exitOnError: true,
|
|
87
|
+
});
|
|
88
|
+
await list.run();
|
|
89
|
+
}
|
|
90
|
+
function toListrTasks(tasks) {
|
|
91
|
+
return tasks.map((t) => ({
|
|
92
|
+
title: t.title,
|
|
93
|
+
enabled: t.enabled,
|
|
94
|
+
task: async (_innerCtx, listrTask) => {
|
|
95
|
+
const ctx = {
|
|
96
|
+
setTitle: (s) => {
|
|
97
|
+
listrTask.title = s;
|
|
98
|
+
},
|
|
99
|
+
skip: (reason) => {
|
|
100
|
+
listrTask.skip(reason);
|
|
101
|
+
throw new TaskSkipped(reason);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
try {
|
|
105
|
+
await t.task(ctx);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
if (e instanceof TaskSkipped)
|
|
109
|
+
return;
|
|
110
|
+
throw e;
|
|
111
|
+
}
|
|
112
|
+
if (t.subtasks) {
|
|
113
|
+
const subs = await t.subtasks();
|
|
114
|
+
return listrTask.newListr(toListrTasks(subs), {
|
|
115
|
+
rendererOptions: { collapseSubtasks: false },
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
function emit(payload) {
|
|
122
|
+
process.stdout.write(JSON.stringify(payload) + "\n");
|
|
123
|
+
}
|
|
124
|
+
/* ── Plain log helpers ───────────────────────────────────────────────
|
|
125
|
+
* Use these for one-shot output that doesn't need a task spinner.
|
|
126
|
+
* In JSON mode they emit `{event:"log",level,message}`.
|
|
127
|
+
*/
|
|
128
|
+
export function logInfo(ctx, message) {
|
|
129
|
+
if (ctx.json) {
|
|
130
|
+
emit({ event: "log", level: "info", message });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
process.stdout.write(`${message}\n`);
|
|
134
|
+
}
|
|
135
|
+
export function logSuccess(ctx, message) {
|
|
136
|
+
if (ctx.json) {
|
|
137
|
+
emit({ event: "log", level: "success", message });
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
process.stdout.write(`${pc.green("✓")} ${message}\n`);
|
|
141
|
+
}
|
|
142
|
+
export function logWarn(ctx, message) {
|
|
143
|
+
if (ctx.json) {
|
|
144
|
+
emit({ event: "log", level: "warn", message });
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
process.stderr.write(`${pc.yellow("!")} ${message}\n`);
|
|
148
|
+
}
|
|
149
|
+
export function logError(ctx, message) {
|
|
150
|
+
if (ctx.json) {
|
|
151
|
+
emit({ event: "log", level: "error", message });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
process.stderr.write(`${pc.red("✗")} ${message}\n`);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Final result block for a command. Prints a structured summary the
|
|
158
|
+
* caller composes (key/value pairs). In JSON mode emits one
|
|
159
|
+
* `{event:"result",...}` payload.
|
|
160
|
+
*/
|
|
161
|
+
export function result(ctx, payload, human) {
|
|
162
|
+
if (ctx.json) {
|
|
163
|
+
emit({ event: "result", ...payload });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (human)
|
|
167
|
+
human();
|
|
168
|
+
}
|
|
169
|
+
export const colors = pc;
|
|
170
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/cli/util/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AA0B5B,MAAM,WAAY,SAAQ,KAAK;IACV;IAAnB,YAAmB,MAAc;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;QADG,WAAM,GAAN,MAAM,CAAQ;QAE/B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,GAAe,EACf,KAAiB;IAEjB,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IACD,MAAM,aAAa,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,KAAiB;IAC3C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,EAA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CAAC;QACb,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/C,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAe,EAAE,OAAe;IACvD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CACpB,GAAe,EACf,OAAgC,EAChC,KAAkB;IAElB,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACtC,OAAO;IACT,CAAC;IACD,IAAI,KAAK;QAAE,KAAK,EAAE,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* - Live map updates. v1 fetches once on boot. SSE subscription is
|
|
41
41
|
* a follow-up.
|
|
42
42
|
*/
|
|
43
|
-
import { emit, wrapEntryPoint } from "./_internal";
|
|
43
|
+
import { emit, wrapEntryPoint } from "./_internal.js";
|
|
44
44
|
export interface RegisterOptions {
|
|
45
45
|
/** Override the ingest token (defaults to PRAETOM_INGEST_ID env var). */
|
|
46
46
|
ingestId?: string;
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,EAAE,IAAI,EAAQ,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,EAAE,IAAI,EAAQ,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAuB5D,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAID,wBAAsB,QAAQ,CAAC,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwDxE;AA4GD,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,uBAAiB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAGrC"}
|
package/dist/server.js
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
*/
|
|
43
43
|
import Module from "node:module";
|
|
44
44
|
import { register as registerEsmLoader } from "node:module";
|
|
45
|
-
import { emit, init, wrapEntryPoint } from "./_internal";
|
|
45
|
+
import { emit, init, wrapEntryPoint } from "./_internal.js";
|
|
46
46
|
const mapByPath = new Map();
|
|
47
47
|
let _hookInstalled = false;
|
|
48
48
|
const DEFAULT_CONFIG_ENDPOINT = "https://praetom.com/api/runtime/config";
|