@sentry/junior 0.203.0 → 0.204.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/agent-CMyTD4DD.js +17509 -0
- package/dist/agent-hooks-Bbcp9e33.js +4040 -0
- package/dist/agent-runner-DNb1A49M.js +678 -0
- package/dist/api/schema.d.ts +2728 -2639
- package/dist/api/schema.js +4 -169
- package/dist/api.d.ts +23 -17
- package/dist/api.js +3881 -5326
- package/dist/app-B1TOqBI8.d.ts +246 -0
- package/dist/app.d.ts +4 -520
- package/dist/app.js +9522 -11875
- package/dist/auth-pause-state-DosEalIG.js +168 -0
- package/dist/catalog-runtime-BReos-D4.js +7 -0
- package/dist/checkpoint-CNrPyRJN.js +2450 -0
- package/dist/cli/chat.d.ts +20 -0
- package/dist/cli/chat.js +229 -336
- package/dist/cli/check.d.ts +8 -0
- package/dist/cli/check.js +513 -806
- package/dist/cli/env.d.ts +13 -0
- package/dist/cli/env.js +63 -12
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.js +90 -159
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +43 -64
- package/dist/cli/plugins.d.ts +13 -0
- package/dist/cli/plugins.js +148 -227
- package/dist/cli/run.d.ts +16 -0
- package/dist/cli/run.js +52 -8
- package/dist/cli/snapshot-create.d.ts +4 -0
- package/dist/cli/snapshot-create.js +71 -125
- package/dist/cli/upgrade.d.ts +15 -0
- package/dist/cli/upgrade.js +232 -335
- package/dist/config-nGCW1OTG.js +941 -0
- package/dist/context-B45_WqVX.js +298 -0
- package/dist/conversation-privacy-B4voFRSm.js +182 -0
- package/dist/conversation-work-C6y3T5Hx.js +51 -0
- package/dist/credential-sync-kXr1hvO1.js +2660 -0
- package/dist/db-BeyXKJOI.d.ts +5 -0
- package/dist/destinations-BeBiJeEM.js +29 -0
- package/dist/execution-stats-DWfSihcH.js +373 -0
- package/dist/executor-DcMSlI5c.js +721 -0
- package/dist/experimental-CIXf7Uye.js +46 -0
- package/dist/history-ClE4toxe.d.ts +32 -0
- package/dist/history-CqTuSAdI.js +441 -0
- package/dist/instrumentation.d.ts +3 -3
- package/dist/instrumentation.js +130 -176
- package/dist/job-queue-Drn_LXlM.js +63 -0
- package/dist/logging-BzAk1S_s.js +1210 -0
- package/dist/model-profile-CZmVoGdX.js +49 -0
- package/dist/nitro.d.ts +31 -36
- package/dist/nitro.js +275 -456
- package/dist/oauth-callback-server-JiftokvA.js +130 -0
- package/dist/oauth-relay-CdCnu80W.js +62 -0
- package/dist/package-discovery-7a9YqLhE.js +455 -0
- package/dist/pending-auth-CWmSdZVg.js +185 -0
- package/dist/plugin-module-BKGOXca2.js +81 -0
- package/dist/plugins-BI9A1vKA.d.ts +95 -0
- package/dist/plugins-egKWjgue.js +99 -0
- package/dist/private-trace-result-BLvBjy_e.js +16 -0
- package/dist/profile-CrT5nXbw.js +861 -0
- package/dist/registry-DH1xUo2N.js +1419 -0
- package/dist/reporting-schema-DosTN__Q.js +105 -0
- package/dist/resolve-CZHnfxaS.js +546 -0
- package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
- package/dist/runner-CZV2sC46.js +392 -0
- package/dist/sandbox-egress-signals-bHZfmhbd.js +46 -0
- package/dist/schema-Rn8-XEaN.js +1140 -0
- package/dist/sentry-CD3SdJl-.js +26 -0
- package/dist/skills-CIcDQSgM.js +316 -0
- package/dist/spawn-DdkUFRmq.js +29 -0
- package/dist/stats-DTUbAb88.js +2634 -0
- package/dist/store-C5qxF2ac.d.ts +208 -0
- package/dist/task-queue-CJIR4RF7.js +136 -0
- package/dist/task-runner-D-O3A-Cp.js +639 -0
- package/dist/thread-state-CRc9jTJS.js +431 -0
- package/dist/turn-execution-BkinIdJF.js +47 -0
- package/dist/turn-lifecycle-DQV19VTW.js +54 -0
- package/dist/usage-D3EbSO7w.js +296 -0
- package/dist/usage-schema-CKaDkH_j.js +20 -0
- package/dist/validation-C2CR-OX3.js +40 -0
- package/dist/vercel-queue-DIkVcfK4.js +167 -0
- package/dist/vercel.d.ts +6 -6
- package/dist/vercel.js +14 -6
- package/dist/version-CnXZ614E.d.ts +5 -0
- package/dist/version-DxcWdoKa.js +8 -0
- package/dist/version.d.ts +2 -4
- package/dist/version.js +2 -6
- package/dist/web-authorization-RMBxAR_t.js +76 -0
- package/dist/web-input-3EPfpf55.js +494 -0
- package/dist/work-fGofI7Op.js +509 -0
- package/dist/worker-CsOLq-mR.js +625 -0
- package/package.json +8 -8
- package/dist/agent-hooks-GB2VPTNA.js +0 -51
- package/dist/catalog-runtime-UBLIWD3O.js +0 -14
- package/dist/chunk-2LYHWMR4.js +0 -46
- package/dist/chunk-352OWAZH.js +0 -320
- package/dist/chunk-3Y47VMHV.js +0 -6
- package/dist/chunk-3YJSKOWF.js +0 -164
- package/dist/chunk-4KSSKTQ5.js +0 -229
- package/dist/chunk-4UO6FK4G.js +0 -64
- package/dist/chunk-5AHX53NQ.js +0 -717
- package/dist/chunk-5J3E5FWA.js +0 -700
- package/dist/chunk-5PDAG6O3.js +0 -206
- package/dist/chunk-6Y5B5PEX.js +0 -80
- package/dist/chunk-7GWQ5S5R.js +0 -2086
- package/dist/chunk-7H2VZTWN.js +0 -103
- package/dist/chunk-7NL7T6VU.js +0 -406
- package/dist/chunk-A5L27LE4.js +0 -387
- package/dist/chunk-ADIAWL34.js +0 -81
- package/dist/chunk-ASTEMBKJ.js +0 -519
- package/dist/chunk-CEMMLV5L.js +0 -98
- package/dist/chunk-CM5HNV2W.js +0 -131
- package/dist/chunk-CRTRBBRI.js +0 -105
- package/dist/chunk-DA2KGZZI.js +0 -13
- package/dist/chunk-DIB4GX3G.js +0 -8
- package/dist/chunk-DKIJ2RP5.js +0 -68
- package/dist/chunk-DWPN6SCH.js +0 -172
- package/dist/chunk-EDKUFGPL.js +0 -64
- package/dist/chunk-ENY6SKIU.js +0 -1228
- package/dist/chunk-F4MGCZOX.js +0 -2943
- package/dist/chunk-FA6POGLH.js +0 -70
- package/dist/chunk-FSUR7GTG.js +0 -20475
- package/dist/chunk-GKEOHJL5.js +0 -1856
- package/dist/chunk-GMCB6W5Y.js +0 -333
- package/dist/chunk-IE2VPG7O.js +0 -1135
- package/dist/chunk-IZ5B5IHQ.js +0 -3656
- package/dist/chunk-JAL3CH4G.js +0 -27
- package/dist/chunk-KIIEUXD3.js +0 -1764
- package/dist/chunk-KXU4NIL7.js +0 -692
- package/dist/chunk-MTM5IFCY.js +0 -1190
- package/dist/chunk-N7TMSOZH.js +0 -235
- package/dist/chunk-NCEBK6PH.js +0 -36
- package/dist/chunk-NHJU2ZAL.js +0 -56
- package/dist/chunk-P6KTRNVC.js +0 -321
- package/dist/chunk-PDO5BLNM.js +0 -22
- package/dist/chunk-PDRNLLFT.js +0 -3295
- package/dist/chunk-PEQXYSSE.js +0 -45
- package/dist/chunk-PKEX2AQX.js +0 -198
- package/dist/chunk-PSJCGIGO.js +0 -1163
- package/dist/chunk-PZUSUL55.js +0 -506
- package/dist/chunk-R45M4TUS.js +0 -37
- package/dist/chunk-RC745GGZ.js +0 -122
- package/dist/chunk-SP3QKZXJ.js +0 -820
- package/dist/chunk-TXKUKMVO.js +0 -417
- package/dist/chunk-UE4GPWSD.js +0 -931
- package/dist/chunk-UIE3R5XU.js +0 -17
- package/dist/chunk-UXPG6ZIN.js +0 -84
- package/dist/chunk-VFUK3X5B.js +0 -50
- package/dist/chunk-VNMJWREK.js +0 -787
- package/dist/chunk-VZ7CSOX2.js +0 -706
- package/dist/chunk-WCNQJKFT.js +0 -10
- package/dist/chunk-WDZR3QQM.js +0 -135
- package/dist/chunk-WLYVJCHV.js +0 -1433
- package/dist/chunk-WS7NAFTM.js +0 -1520
- package/dist/chunk-X6GDDWQH.js +0 -60
- package/dist/chunk-XPDEYNQI.js +0 -102
- package/dist/chunk-XRW44VGM.js +0 -58
- package/dist/chunk-Y2CM7HXH.js +0 -111
- package/dist/chunk-Y7X25LFY.js +0 -15
- package/dist/conversation-work-VIOQ5ZF3.js +0 -54
- package/dist/db-NGDJV7YH.js +0 -26
- package/dist/discovery-DWVDM7UK.js +0 -44
- package/dist/experimental-P5FZM4CU.js +0 -12
- package/dist/oauth-callback-server-YFY7YEGK.js +0 -243
- package/dist/oauth-relay-5XPVRPYB.js +0 -8
- package/dist/plugins-YTYJMMJF.js +0 -14
- package/dist/runner-ORTNSB2Q.js +0 -522
- package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
- package/dist/sentry-MB3NL3IR.js +0 -42
- package/dist/skills-H376WQOH.js +0 -27
- package/dist/spawn-T43WHLOS.js +0 -42
- package/dist/task-runner-LBZWF32V.js +0 -36
- package/dist/validation-REJLRKI6.js +0 -17
- package/dist/work-3KJ3RE76.js +0 -51
- package/dist/worker-QFEBU72E.js +0 -24
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/cli/env.d.ts
|
|
2
|
+
export declare const JUNIOR_LOCAL_DEV_INTERNAL_SECRET = "junior-local-dev-internal";
|
|
3
|
+
export declare const JUNIOR_LOCAL_DEV_HEARTBEAT_SECRET = "junior-local-dev-heartbeat";
|
|
4
|
+
/** Apply global development defaults after env files have been loaded. */
|
|
5
|
+
export declare function applyJuniorDevelopmentDefaults(env: NodeJS.ProcessEnv, options?: {
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
}): void;
|
|
8
|
+
/**
|
|
9
|
+
* Load CLI env files from the nearest package root and workspace root so
|
|
10
|
+
* `pnpm exec junior ...` sees the same credentials as local repo scripts.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadCliEnvFiles(cwd?: string): void;
|
|
13
|
+
//#endregion
|
package/dist/cli/env.js
CHANGED
|
@@ -1,12 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
//#region src/cli/env.ts
|
|
4
|
+
function envFileNames(nodeEnv) {
|
|
5
|
+
return [
|
|
6
|
+
`.env.${nodeEnv}.local`,
|
|
7
|
+
...nodeEnv === "test" ? [] : [".env.local"],
|
|
8
|
+
`.env.${nodeEnv}`,
|
|
9
|
+
".env",
|
|
10
|
+
".env.example"
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
const JUNIOR_LOCAL_DEV_INTERNAL_SECRET = "junior-local-dev-internal";
|
|
14
|
+
const JUNIOR_LOCAL_DEV_HEARTBEAT_SECRET = "junior-local-dev-heartbeat";
|
|
15
|
+
function hasValue(value) {
|
|
16
|
+
return typeof value === "string" && value.trim() !== "";
|
|
17
|
+
}
|
|
18
|
+
/** Apply global development defaults after env files have been loaded. */
|
|
19
|
+
function applyJuniorDevelopmentDefaults(env, options = {}) {
|
|
20
|
+
if ((env.NODE_ENV ?? "development") !== "development") return;
|
|
21
|
+
if (!hasValue(env.JUNIOR_SECRET)) env.JUNIOR_SECRET = JUNIOR_LOCAL_DEV_INTERNAL_SECRET;
|
|
22
|
+
if (!hasValue(env.JUNIOR_STATE_ADAPTER)) env.JUNIOR_STATE_ADAPTER = "memory";
|
|
23
|
+
if (!hasValue(env.JUNIOR_SCHEDULER_SECRET) && !hasValue(env.CRON_SECRET)) env.JUNIOR_SCHEDULER_SECRET = JUNIOR_LOCAL_DEV_HEARTBEAT_SECRET;
|
|
24
|
+
const baseUrl = options.baseUrl;
|
|
25
|
+
if (!hasValue(env.JUNIOR_BASE_URL) && hasValue(baseUrl)) env.JUNIOR_BASE_URL = baseUrl.trim();
|
|
26
|
+
}
|
|
27
|
+
function hasEnvRootMarker(dir) {
|
|
28
|
+
return fs.existsSync(path.join(dir, "package.json")) || fs.existsSync(path.join(dir, "pnpm-workspace.yaml"));
|
|
29
|
+
}
|
|
30
|
+
function resolveCliEnvRoots(cwd) {
|
|
31
|
+
const roots = [];
|
|
32
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33
|
+
const addRoot = (candidate) => {
|
|
34
|
+
const resolved = path.resolve(candidate);
|
|
35
|
+
if (seen.has(resolved)) return;
|
|
36
|
+
seen.add(resolved);
|
|
37
|
+
roots.push(resolved);
|
|
38
|
+
};
|
|
39
|
+
let current = path.resolve(cwd);
|
|
40
|
+
addRoot(current);
|
|
41
|
+
while (true) {
|
|
42
|
+
if (hasEnvRootMarker(current)) addRoot(current);
|
|
43
|
+
const parent = path.dirname(current);
|
|
44
|
+
if (parent === current) break;
|
|
45
|
+
current = parent;
|
|
46
|
+
}
|
|
47
|
+
return roots;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Load CLI env files from the nearest package root and workspace root so
|
|
51
|
+
* `pnpm exec junior ...` sees the same credentials as local repo scripts.
|
|
52
|
+
*/
|
|
53
|
+
function loadCliEnvFiles(cwd = process.cwd()) {
|
|
54
|
+
const nodeEnv = process.env.NODE_ENV ?? "development";
|
|
55
|
+
for (const root of resolveCliEnvRoots(cwd)) for (const envFile of envFileNames(nodeEnv)) {
|
|
56
|
+
const absolutePath = path.join(root, envFile);
|
|
57
|
+
if (!fs.existsSync(absolutePath)) continue;
|
|
58
|
+
process.loadEnvFile(absolutePath);
|
|
59
|
+
}
|
|
60
|
+
applyJuniorDevelopmentDefaults(process.env);
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { JUNIOR_LOCAL_DEV_HEARTBEAT_SECRET, JUNIOR_LOCAL_DEV_INTERNAL_SECRET, applyJuniorDevelopmentDefaults, loadCliEnvFiles };
|
package/dist/cli/init.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// src/cli/init.ts
|
|
6
|
-
import fs from "fs";
|
|
7
|
-
import path from "path";
|
|
1
|
+
import { juniorVercelConfig } from "../vercel.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
//#region src/cli/init.ts
|
|
8
5
|
function writeServerEntry(targetDir) {
|
|
9
|
-
|
|
10
|
-
path.join(targetDir, "server.ts"),
|
|
11
|
-
`import { initSentry } from "@sentry/junior/instrumentation";
|
|
6
|
+
fs.writeFileSync(path.join(targetDir, "server.ts"), `import { initSentry } from "@sentry/junior/instrumentation";
|
|
12
7
|
|
|
13
8
|
initSentry();
|
|
14
9
|
|
|
@@ -25,35 +20,26 @@ const app = await createApp({
|
|
|
25
20
|
});
|
|
26
21
|
|
|
27
22
|
export default app;
|
|
28
|
-
`
|
|
29
|
-
);
|
|
23
|
+
`);
|
|
30
24
|
}
|
|
31
25
|
function writeInstrumentFile(targetDir) {
|
|
32
|
-
|
|
33
|
-
path.join(targetDir, "instrument.mjs"),
|
|
34
|
-
`import { initSentry } from "@sentry/junior/instrumentation";
|
|
26
|
+
fs.writeFileSync(path.join(targetDir, "instrument.mjs"), `import { initSentry } from "@sentry/junior/instrumentation";
|
|
35
27
|
|
|
36
28
|
initSentry();
|
|
37
|
-
`
|
|
38
|
-
);
|
|
29
|
+
`);
|
|
39
30
|
}
|
|
40
31
|
function writePluginsFile(targetDir) {
|
|
41
|
-
|
|
42
|
-
path.join(targetDir, "plugins.ts"),
|
|
43
|
-
`import { defineJuniorPlugins } from "@sentry/junior";
|
|
32
|
+
fs.writeFileSync(path.join(targetDir, "plugins.ts"), `import { defineJuniorPlugins } from "@sentry/junior";
|
|
44
33
|
import { memoryPlugin } from "@sentry/junior-memory";
|
|
45
34
|
|
|
46
35
|
export const plugins = defineJuniorPlugins([
|
|
47
36
|
memoryPlugin(),
|
|
48
37
|
"@sentry/junior-maintenance",
|
|
49
38
|
]);
|
|
50
|
-
`
|
|
51
|
-
);
|
|
39
|
+
`);
|
|
52
40
|
}
|
|
53
41
|
function writeNitroConfig(targetDir) {
|
|
54
|
-
|
|
55
|
-
path.join(targetDir, "nitro.config.ts"),
|
|
56
|
-
`import { withSentryConfig } from "@sentry/nitro";
|
|
42
|
+
fs.writeFileSync(path.join(targetDir, "nitro.config.ts"), `import { withSentryConfig } from "@sentry/nitro";
|
|
57
43
|
import { defineConfig } from "nitro";
|
|
58
44
|
import { juniorNitro } from "@sentry/junior/nitro";
|
|
59
45
|
|
|
@@ -74,47 +60,29 @@ export default withSentryConfig(config, {
|
|
|
74
60
|
org: process.env.SENTRY_ORG,
|
|
75
61
|
project: process.env.SENTRY_PROJECT,
|
|
76
62
|
});
|
|
77
|
-
`
|
|
78
|
-
);
|
|
63
|
+
`);
|
|
79
64
|
}
|
|
80
65
|
function writeTsConfig(targetDir) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
extends: "nitro/tsconfig",
|
|
86
|
-
compilerOptions: {}
|
|
87
|
-
},
|
|
88
|
-
null,
|
|
89
|
-
2
|
|
90
|
-
)}
|
|
91
|
-
`
|
|
92
|
-
);
|
|
66
|
+
fs.writeFileSync(path.join(targetDir, "tsconfig.json"), `${JSON.stringify({
|
|
67
|
+
extends: "nitro/tsconfig",
|
|
68
|
+
compilerOptions: {}
|
|
69
|
+
}, null, 2)}\n`);
|
|
93
70
|
}
|
|
94
71
|
function writePnpmWorkspace(targetDir) {
|
|
95
|
-
|
|
96
|
-
path.join(targetDir, "pnpm-workspace.yaml"),
|
|
97
|
-
`minimumReleaseAge: 1440
|
|
72
|
+
fs.writeFileSync(path.join(targetDir, "pnpm-workspace.yaml"), `minimumReleaseAge: 1440
|
|
98
73
|
minimumReleaseAgeExclude:
|
|
99
74
|
- "@sentry/*"
|
|
100
75
|
allowBuilds:
|
|
101
76
|
"@sentry/cli": true
|
|
102
|
-
`
|
|
103
|
-
);
|
|
77
|
+
`);
|
|
104
78
|
}
|
|
105
79
|
function writeVercelJson(targetDir) {
|
|
106
|
-
|
|
107
|
-
path.join(targetDir, "vercel.json"),
|
|
108
|
-
`${JSON.stringify(juniorVercelConfig(), null, 2)}
|
|
109
|
-
`
|
|
110
|
-
);
|
|
80
|
+
fs.writeFileSync(path.join(targetDir, "vercel.json"), `${JSON.stringify(juniorVercelConfig(), null, 2)}\n`);
|
|
111
81
|
}
|
|
112
82
|
function writeGitHubWorkflow(targetDir) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
path.join(workflowDir, "ci.yml"),
|
|
117
|
-
`name: CI
|
|
83
|
+
const workflowDir = path.join(targetDir, ".github", "workflows");
|
|
84
|
+
fs.mkdirSync(workflowDir, { recursive: true });
|
|
85
|
+
fs.writeFileSync(path.join(workflowDir, "ci.yml"), `name: CI
|
|
118
86
|
|
|
119
87
|
on:
|
|
120
88
|
push:
|
|
@@ -136,101 +104,66 @@ jobs:
|
|
|
136
104
|
- run: pnpm install
|
|
137
105
|
- run: pnpm check
|
|
138
106
|
- run: pnpm build
|
|
139
|
-
`
|
|
140
|
-
);
|
|
107
|
+
`);
|
|
141
108
|
}
|
|
142
109
|
async function runInit(dir, log = console.log) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
`
|
|
193
|
-
);
|
|
194
|
-
const appDir = path.join(target, "app");
|
|
195
|
-
fs.mkdirSync(appDir, { recursive: true });
|
|
196
|
-
fs.writeFileSync(
|
|
197
|
-
path.join(appDir, "SOUL.md"),
|
|
198
|
-
`# ${name}
|
|
199
|
-
|
|
200
|
-
You are ${name}, a helpful assistant.
|
|
201
|
-
`
|
|
202
|
-
);
|
|
203
|
-
fs.writeFileSync(
|
|
204
|
-
path.join(appDir, "WORLD.md"),
|
|
205
|
-
`# ${name} World
|
|
206
|
-
|
|
207
|
-
Operational context and domain knowledge for ${name}.
|
|
208
|
-
`
|
|
209
|
-
);
|
|
210
|
-
fs.writeFileSync(
|
|
211
|
-
path.join(appDir, "DESCRIPTION.md"),
|
|
212
|
-
`${name} helps your team make progress directly in Slack.
|
|
213
|
-
`
|
|
214
|
-
);
|
|
215
|
-
const skillsDir = path.join(appDir, "skills");
|
|
216
|
-
fs.mkdirSync(skillsDir, { recursive: true });
|
|
217
|
-
fs.writeFileSync(path.join(skillsDir, ".gitkeep"), "");
|
|
218
|
-
const pluginsDir = path.join(appDir, "plugins");
|
|
219
|
-
fs.mkdirSync(pluginsDir, { recursive: true });
|
|
220
|
-
fs.writeFileSync(path.join(pluginsDir, ".gitkeep"), "");
|
|
221
|
-
fs.writeFileSync(
|
|
222
|
-
path.join(target, ".gitignore"),
|
|
223
|
-
`node_modules/
|
|
110
|
+
const targetDir = dir.trim();
|
|
111
|
+
if (!targetDir) throw new Error("usage: junior init <dir>");
|
|
112
|
+
const target = path.resolve(targetDir);
|
|
113
|
+
if (fs.existsSync(target)) {
|
|
114
|
+
if (!fs.statSync(target).isDirectory()) throw new Error(`refusing to initialize non-directory path: ${target}`);
|
|
115
|
+
if (fs.readdirSync(target).length > 0) throw new Error(`refusing to initialize non-empty directory: ${target}`);
|
|
116
|
+
} else fs.mkdirSync(target, { recursive: true });
|
|
117
|
+
const name = path.basename(target);
|
|
118
|
+
const pkg = {
|
|
119
|
+
name,
|
|
120
|
+
version: "0.1.0",
|
|
121
|
+
private: true,
|
|
122
|
+
type: "module",
|
|
123
|
+
scripts: {
|
|
124
|
+
dev: "cross-env NODE_OPTIONS=--import=./instrument.mjs nitro dev",
|
|
125
|
+
check: "junior check",
|
|
126
|
+
build: "junior snapshot create && nitro build",
|
|
127
|
+
preview: "cross-env NODE_OPTIONS=--import=./instrument.mjs nitro preview",
|
|
128
|
+
typecheck: "tsc --noEmit"
|
|
129
|
+
},
|
|
130
|
+
dependencies: {
|
|
131
|
+
"@opentelemetry/api": "1.9.1",
|
|
132
|
+
"@opentelemetry/core": "2.9.0",
|
|
133
|
+
"@sentry/junior": "latest",
|
|
134
|
+
"@sentry/junior-memory": "latest",
|
|
135
|
+
"@sentry/junior-maintenance": "latest",
|
|
136
|
+
"@sentry/nitro": "10.65.0",
|
|
137
|
+
hono: "^4.12.27"
|
|
138
|
+
},
|
|
139
|
+
devDependencies: {
|
|
140
|
+
"@types/node": "^25.9.1",
|
|
141
|
+
"cross-env": "^10.1.0",
|
|
142
|
+
jiti: "^2.7.0",
|
|
143
|
+
nitro: "3.0.260522-beta",
|
|
144
|
+
typescript: "^6.0.3"
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
fs.writeFileSync(path.join(target, "package.json"), `${JSON.stringify(pkg, null, 2)}\n`);
|
|
148
|
+
const appDir = path.join(target, "app");
|
|
149
|
+
fs.mkdirSync(appDir, { recursive: true });
|
|
150
|
+
fs.writeFileSync(path.join(appDir, "SOUL.md"), `# ${name}\n\nYou are ${name}, a helpful assistant.\n`);
|
|
151
|
+
fs.writeFileSync(path.join(appDir, "WORLD.md"), `# ${name} World\n\nOperational context and domain knowledge for ${name}.\n`);
|
|
152
|
+
fs.writeFileSync(path.join(appDir, "DESCRIPTION.md"), `${name} helps your team make progress directly in Slack.\n`);
|
|
153
|
+
const skillsDir = path.join(appDir, "skills");
|
|
154
|
+
fs.mkdirSync(skillsDir, { recursive: true });
|
|
155
|
+
fs.writeFileSync(path.join(skillsDir, ".gitkeep"), "");
|
|
156
|
+
const pluginsDir = path.join(appDir, "plugins");
|
|
157
|
+
fs.mkdirSync(pluginsDir, { recursive: true });
|
|
158
|
+
fs.writeFileSync(path.join(pluginsDir, ".gitkeep"), "");
|
|
159
|
+
fs.writeFileSync(path.join(target, ".gitignore"), `node_modules/
|
|
224
160
|
.vercel/
|
|
225
161
|
.output/
|
|
226
162
|
.nitro/
|
|
227
163
|
.env
|
|
228
164
|
.env.local
|
|
229
|
-
`
|
|
230
|
-
|
|
231
|
-
fs.writeFileSync(
|
|
232
|
-
path.join(target, ".env.example"),
|
|
233
|
-
`SLACK_BOT_TOKEN=
|
|
165
|
+
`);
|
|
166
|
+
fs.writeFileSync(path.join(target, ".env.example"), `SLACK_BOT_TOKEN=
|
|
234
167
|
SLACK_SIGNING_SECRET=
|
|
235
168
|
JUNIOR_SECRET=
|
|
236
169
|
JUNIOR_BOT_NAME=
|
|
@@ -257,21 +190,19 @@ SENTRY_ORG=
|
|
|
257
190
|
SENTRY_ORG_SLUG=
|
|
258
191
|
SENTRY_PROJECT=
|
|
259
192
|
SENTRY_AUTH_TOKEN=
|
|
260
|
-
`
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
log("");
|
|
193
|
+
`);
|
|
194
|
+
writeServerEntry(target);
|
|
195
|
+
writeInstrumentFile(target);
|
|
196
|
+
writePluginsFile(target);
|
|
197
|
+
writeNitroConfig(target);
|
|
198
|
+
writeTsConfig(target);
|
|
199
|
+
writePnpmWorkspace(target);
|
|
200
|
+
writeVercelJson(target);
|
|
201
|
+
writeGitHubWorkflow(target);
|
|
202
|
+
log(`Created ${name} at ${target}`);
|
|
203
|
+
log("");
|
|
204
|
+
log(` cd ${targetDir} && pnpm install && pnpm dev`);
|
|
205
|
+
log("");
|
|
274
206
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
};
|
|
207
|
+
//#endregion
|
|
208
|
+
export { runInit };
|
package/dist/cli/main.js
CHANGED
|
@@ -1,83 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../chunk-4UO6FK4G.js";
|
|
7
|
-
|
|
8
|
-
// src/cli/main.ts
|
|
9
|
-
import { pathToFileURL } from "url";
|
|
10
|
-
var SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
1
|
+
import { loadCliEnvFiles } from "./env.js";
|
|
2
|
+
import { runCli } from "./run.js";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
//#region src/cli/main.ts
|
|
5
|
+
const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
11
6
|
async function flushSentry() {
|
|
12
|
-
|
|
13
|
-
await mod.flush(SENTRY_FLUSH_TIMEOUT_MS);
|
|
7
|
+
await (await import("../sentry-CD3SdJl-.js").then((n) => n.u)).flush(SENTRY_FLUSH_TIMEOUT_MS);
|
|
14
8
|
}
|
|
15
9
|
async function initSentry() {
|
|
16
|
-
|
|
17
|
-
mod.initSentry();
|
|
10
|
+
(await import("../instrumentation.js")).initSentry();
|
|
18
11
|
}
|
|
19
12
|
async function runInit(dir) {
|
|
20
|
-
|
|
21
|
-
await mod.runInit(dir);
|
|
13
|
+
await (await import("./init.js")).runInit(dir);
|
|
22
14
|
}
|
|
23
15
|
async function runSnapshotCreate() {
|
|
24
|
-
|
|
25
|
-
await mod.runSnapshotCreate();
|
|
16
|
+
await (await import("./snapshot-create.js")).runSnapshotCreate();
|
|
26
17
|
}
|
|
27
18
|
async function runCheck(dir) {
|
|
28
|
-
|
|
29
|
-
await mod.runCheck(dir);
|
|
19
|
+
await (await import("./check.js")).runCheck(dir);
|
|
30
20
|
}
|
|
31
21
|
async function runUpgrade(pluginSet) {
|
|
32
|
-
|
|
33
|
-
await mod.runUpgrade(void 0, { pluginSet });
|
|
22
|
+
await (await import("./upgrade.js")).runUpgrade(void 0, { pluginSet });
|
|
34
23
|
}
|
|
35
24
|
async function runChat(argv, pluginSet) {
|
|
36
|
-
|
|
37
|
-
return await mod.runChat(argv, void 0, { pluginSet });
|
|
25
|
+
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
38
26
|
}
|
|
39
27
|
function topLevelCommand(argv) {
|
|
40
|
-
|
|
41
|
-
return normalized[0];
|
|
28
|
+
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
|
42
29
|
}
|
|
30
|
+
/** Run the packaged CLI entrypoint with plugin command bootstrap enabled. */
|
|
43
31
|
async function runMain(argv, options = {}) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (instrument) {
|
|
62
|
-
await flushSentry();
|
|
63
|
-
}
|
|
64
|
-
process.exit(exitCode);
|
|
32
|
+
loadCliEnvFiles();
|
|
33
|
+
const instrument = options.instrument ?? true;
|
|
34
|
+
if (instrument) await initSentry();
|
|
35
|
+
const command = topLevelCommand(argv);
|
|
36
|
+
const cliPluginsModule = command && command !== "init" ? await import("./plugins.js") : void 0;
|
|
37
|
+
const pluginSet = cliPluginsModule ? await cliPluginsModule.loadCliPluginSet() ?? null : void 0;
|
|
38
|
+
const pluginCommands = cliPluginsModule ? await cliPluginsModule.loadCliPluginCommands(pluginSet) : void 0;
|
|
39
|
+
const exitCode = await runCli(argv, {
|
|
40
|
+
runChat: async (chatArgv) => await runChat(chatArgv, pluginSet),
|
|
41
|
+
runInit,
|
|
42
|
+
runSnapshotCreate,
|
|
43
|
+
runCheck,
|
|
44
|
+
runUpgrade: async () => await runUpgrade(pluginSet),
|
|
45
|
+
...pluginCommands ? { runPluginCommand: pluginCommands.run } : void 0
|
|
46
|
+
});
|
|
47
|
+
if (instrument) await flushSentry();
|
|
48
|
+
process.exit(exitCode);
|
|
65
49
|
}
|
|
66
50
|
function isDirectCliEntry() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
export {
|
|
82
|
-
runMain
|
|
83
|
-
};
|
|
51
|
+
return Boolean(process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href);
|
|
52
|
+
}
|
|
53
|
+
if (isDirectCliEntry()) runMain(process.argv.slice(2)).catch((error) => {
|
|
54
|
+
(async () => {
|
|
55
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
+
console.error(`junior command failed: ${message}`);
|
|
57
|
+
await flushSentry();
|
|
58
|
+
process.exit(1);
|
|
59
|
+
})();
|
|
60
|
+
});
|
|
61
|
+
//#endregion
|
|
62
|
+
export { runMain };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { n as JuniorPluginSet } from "../plugins-BI9A1vKA.js";
|
|
2
|
+
import { PluginCliIo } from "@sentry/junior-plugin-api";
|
|
3
|
+
//#region src/cli/plugins.d.ts
|
|
4
|
+
export type PluginCommandIo = PluginCliIo;
|
|
5
|
+
export interface CliPluginCommandDispatcher {
|
|
6
|
+
commandNames: string[];
|
|
7
|
+
run(commandName: string, argv: string[], io?: PluginCommandIo): Promise<number | undefined>;
|
|
8
|
+
}
|
|
9
|
+
/** Load the app plugin set once for one CLI process. */
|
|
10
|
+
export declare function loadCliPluginSet(): Promise<JuniorPluginSet | undefined>;
|
|
11
|
+
/** Import configured app plugins and build the plugin CLI command dispatcher. */
|
|
12
|
+
export declare function loadCliPluginCommands(pluginSet?: JuniorPluginSet | null): Promise<CliPluginCommandDispatcher>;
|
|
13
|
+
//#endregion
|