@devdogsuga/devtools 0.1.26 → 0.1.28
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/README.md +72 -11
- package/bin/devtools.mjs +4 -4
- package/dist/cli-CZKkNHK5.js +6619 -0
- package/dist/failure-log-BBPGejQv.js +256 -0
- package/dist/launch.js +267 -281
- package/dist/local-env-D8HC2JK_.js +351 -0
- package/dist/local-env-DrBCXqD8.js +2 -0
- package/dist/menu-CQBsQRgH.js +1684 -0
- package/dist/peer-redirect-hooks.js +15 -0
- package/dist/peers-RBplwovA.js +229 -0
- package/dist/root-C2OmZDwD.js +94 -0
- package/dist/stack-Bx-55oi_.js +2 -0
- package/dist/stack-BynCgRVS.js +181 -0
- package/dist/supabase-project-0knM0mqd.js +426 -0
- package/dist/telemetry-C4foD8MD.js +249 -0
- package/dist/telemetry.js +2 -148
- package/package.json +10 -29
- package/bin/devtools-ci-bare.mjs +0 -48
- package/bin/devtools-ci.mjs +0 -31
- package/dist/args.d.ts +0 -26
- package/dist/args.js +0 -78
- package/dist/bws/bw.d.ts +0 -18
- package/dist/bws/bw.js +0 -70
- package/dist/bws/client.d.ts +0 -43
- package/dist/bws/client.js +0 -363
- package/dist/bws/environments.d.ts +0 -96
- package/dist/bws/environments.js +0 -111
- package/dist/bws/pace.d.ts +0 -25
- package/dist/bws/pace.js +0 -43
- package/dist/bws/retry.d.ts +0 -12
- package/dist/bws/retry.js +0 -39
- package/dist/bws/store.d.ts +0 -1
- package/dist/bws/store.js +0 -32
- package/dist/bws/token.d.ts +0 -31
- package/dist/bws/token.js +0 -88
- package/dist/bws/vault.d.ts +0 -29
- package/dist/bws/vault.js +0 -200
- package/dist/catalog.d.ts +0 -57
- package/dist/catalog.js +0 -57
- package/dist/cf/build.d.ts +0 -13
- package/dist/cf/build.js +0 -65
- package/dist/cf/commands.d.ts +0 -1
- package/dist/cf/commands.js +0 -172
- package/dist/cf/local-env.d.ts +0 -58
- package/dist/cf/local-env.js +0 -177
- package/dist/ci.d.ts +0 -1
- package/dist/ci.js +0 -328
- package/dist/cli.d.ts +0 -11
- package/dist/cli.js +0 -1094
- package/dist/commands.d.ts +0 -261
- package/dist/commands.js +0 -1318
- package/dist/completions.d.ts +0 -4
- package/dist/completions.js +0 -110
- package/dist/cron/commands.d.ts +0 -47
- package/dist/cron/commands.js +0 -372
- package/dist/cron/discovery.d.ts +0 -55
- package/dist/cron/discovery.js +0 -85
- package/dist/cron/schema.d.ts +0 -45
- package/dist/cron/schema.js +0 -35
- package/dist/db/config-push.d.ts +0 -8
- package/dist/db/config-push.js +0 -11
- package/dist/db/connection.d.ts +0 -79
- package/dist/db/connection.js +0 -114
- package/dist/db/exec.d.ts +0 -1
- package/dist/db/exec.js +0 -11
- package/dist/db/generate-types.d.ts +0 -1
- package/dist/db/generate-types.js +0 -4
- package/dist/db/generated-env.d.ts +0 -69
- package/dist/db/generated-env.js +0 -113
- package/dist/db/introspect.d.ts +0 -1
- package/dist/db/introspect.js +0 -122
- package/dist/db/local-env.d.ts +0 -65
- package/dist/db/local-env.js +0 -23
- package/dist/db/new-migration.d.ts +0 -8
- package/dist/db/new-migration.js +0 -69
- package/dist/db/pooler.d.ts +0 -23
- package/dist/db/pooler.js +0 -55
- package/dist/db/run.d.ts +0 -68
- package/dist/db/run.js +0 -156
- package/dist/db/seed-buckets.d.ts +0 -2
- package/dist/db/seed-buckets.js +0 -4
- package/dist/db/seed-production.d.ts +0 -8
- package/dist/db/seed-production.js +0 -79
- package/dist/db/seed-roles.d.ts +0 -7
- package/dist/db/seed-roles.js +0 -33
- package/dist/db/session-refresh.d.ts +0 -43
- package/dist/db/session-refresh.js +0 -40
- package/dist/deploy/migrations.d.ts +0 -20
- package/dist/deploy/migrations.js +0 -68
- package/dist/deploy/orphans.d.ts +0 -20
- package/dist/deploy/orphans.js +0 -177
- package/dist/deploy/preflight.d.ts +0 -53
- package/dist/deploy/preflight.js +0 -189
- package/dist/deploy/report.d.ts +0 -26
- package/dist/deploy/report.js +0 -70
- package/dist/deploy/require-planner.d.ts +0 -2
- package/dist/deploy/require-planner.js +0 -60
- package/dist/deploy/require-token.d.ts +0 -15
- package/dist/deploy/require-token.js +0 -78
- package/dist/deploy/secrets-file.d.ts +0 -17
- package/dist/deploy/secrets-file.js +0 -166
- package/dist/deploy/write-env.d.ts +0 -40
- package/dist/deploy/write-env.js +0 -395
- package/dist/docs/index-pages.d.ts +0 -38
- package/dist/docs/index-pages.js +0 -186
- package/dist/emails/commands.d.ts +0 -15
- package/dist/emails/commands.js +0 -130
- package/dist/emails/email-types.d.ts +0 -13
- package/dist/emails/email-types.js +0 -1
- package/dist/emails/fixtures.d.ts +0 -20
- package/dist/emails/fixtures.js +0 -20
- package/dist/env/audit.d.ts +0 -206
- package/dist/env/audit.js +0 -436
- package/dist/env/cloudflare.d.ts +0 -21
- package/dist/env/cloudflare.js +0 -61
- package/dist/env/commands.d.ts +0 -99
- package/dist/env/commands.js +0 -613
- package/dist/env/discovery.d.ts +0 -15
- package/dist/env/discovery.js +0 -239
- package/dist/env/document.d.ts +0 -119
- package/dist/env/document.js +0 -323
- package/dist/env/example.d.ts +0 -68
- package/dist/env/example.js +0 -605
- package/dist/env/selection.d.ts +0 -105
- package/dist/env/selection.js +0 -228
- package/dist/env-entry.d.ts +0 -49
- package/dist/env-entry.js +0 -204
- package/dist/environment-doctor.d.ts +0 -45
- package/dist/environment-doctor.js +0 -429
- package/dist/environment.d.ts +0 -92
- package/dist/environment.js +0 -185
- package/dist/fingerprint.d.ts +0 -10
- package/dist/fingerprint.js +0 -18
- package/dist/gen/campus-map.d.ts +0 -1
- package/dist/gen/campus-map.js +0 -473
- package/dist/gen/commands.d.ts +0 -1
- package/dist/gen/commands.js +0 -25
- package/dist/gen/hypno.d.ts +0 -1
- package/dist/gen/hypno.js +0 -134
- package/dist/gh/client.d.ts +0 -80
- package/dist/gh/client.js +0 -259
- package/dist/gh/environments.d.ts +0 -83
- package/dist/gh/environments.js +0 -178
- package/dist/gh/rulesets/actors.d.ts +0 -14
- package/dist/gh/rulesets/actors.js +0 -69
- package/dist/gh/rulesets/api.d.ts +0 -15
- package/dist/gh/rulesets/api.js +0 -104
- package/dist/gh/rulesets/commands.d.ts +0 -3
- package/dist/gh/rulesets/commands.js +0 -203
- package/dist/gh/rulesets/desired.d.ts +0 -112
- package/dist/gh/rulesets/desired.js +0 -271
- package/dist/gh/rulesets/diff.d.ts +0 -65
- package/dist/gh/rulesets/diff.js +0 -170
- package/dist/gh/rulesets/types.d.ts +0 -76
- package/dist/gh/rulesets/types.js +0 -13
- package/dist/gh/settings/api.d.ts +0 -40
- package/dist/gh/settings/api.js +0 -180
- package/dist/gh/settings/commands.d.ts +0 -1
- package/dist/gh/settings/commands.js +0 -254
- package/dist/gh/settings/desired.d.ts +0 -53
- package/dist/gh/settings/desired.js +0 -43
- package/dist/gh/settings/diff.d.ts +0 -57
- package/dist/gh/settings/diff.js +0 -161
- package/dist/gh/settings/types.d.ts +0 -92
- package/dist/gh/settings/types.js +0 -11
- package/dist/gh/settings/workflows.d.ts +0 -41
- package/dist/gh/settings/workflows.js +0 -128
- package/dist/grantRoot.d.ts +0 -42
- package/dist/grantRoot.js +0 -89
- package/dist/help.d.ts +0 -18
- package/dist/help.js +0 -169
- package/dist/images/commands.d.ts +0 -32
- package/dist/images/commands.js +0 -231
- package/dist/images/events.d.ts +0 -47
- package/dist/images/events.js +0 -116
- package/dist/images/graphics.d.ts +0 -70
- package/dist/images/graphics.js +0 -234
- package/dist/images/open-graph-types.d.ts +0 -75
- package/dist/images/open-graph-types.js +0 -1
- package/dist/images/prompts.d.ts +0 -34
- package/dist/images/prompts.js +0 -100
- package/dist/images/render.d.ts +0 -21
- package/dist/images/render.js +0 -61
- package/dist/images/select.d.ts +0 -64
- package/dist/images/select.js +0 -96
- package/dist/instance.d.ts +0 -69
- package/dist/instance.js +0 -102
- package/dist/invocation.d.ts +0 -49
- package/dist/invocation.js +0 -78
- package/dist/launch-ci.d.ts +0 -1
- package/dist/launch-ci.js +0 -90
- package/dist/launch.d.ts +0 -18
- package/dist/menu.d.ts +0 -43
- package/dist/menu.js +0 -300
- package/dist/moderation.d.ts +0 -70
- package/dist/moderation.js +0 -128
- package/dist/oauth/browser.d.ts +0 -1
- package/dist/oauth/browser.js +0 -13
- package/dist/oauth/config.d.ts +0 -24
- package/dist/oauth/config.js +0 -24
- package/dist/oauth/connect-url.d.ts +0 -17
- package/dist/oauth/connect-url.js +0 -23
- package/dist/oauth/db.d.ts +0 -37
- package/dist/oauth/db.js +0 -108
- package/dist/oauth/device.d.ts +0 -93
- package/dist/oauth/device.js +0 -198
- package/dist/oauth/discovery.d.ts +0 -28
- package/dist/oauth/discovery.js +0 -54
- package/dist/oauth/env-file.d.ts +0 -6
- package/dist/oauth/env-file.js +0 -35
- package/dist/oauth/exchange.d.ts +0 -43
- package/dist/oauth/exchange.js +0 -93
- package/dist/oauth/label.d.ts +0 -1
- package/dist/oauth/label.js +0 -25
- package/dist/oauth/loopback.d.ts +0 -52
- package/dist/oauth/loopback.js +0 -168
- package/dist/oauth/pkce.d.ts +0 -6
- package/dist/oauth/pkce.js +0 -34
- package/dist/oauth/target.d.ts +0 -54
- package/dist/oauth/target.js +0 -102
- package/dist/oauth/transport.d.ts +0 -41
- package/dist/oauth/transport.js +0 -32
- package/dist/oauth/wizard.d.ts +0 -40
- package/dist/oauth/wizard.js +0 -578
- package/dist/persona.d.ts +0 -18
- package/dist/persona.js +0 -221
- package/dist/pick.d.ts +0 -6
- package/dist/pick.js +0 -64
- package/dist/pipes.d.ts +0 -1
- package/dist/pipes.js +0 -25
- package/dist/planner/checks.d.ts +0 -26
- package/dist/planner/checks.js +0 -104
- package/dist/planner/commands.d.ts +0 -10
- package/dist/planner/commands.js +0 -367
- package/dist/planner/db.d.ts +0 -15
- package/dist/planner/db.js +0 -33
- package/dist/planner/role.d.ts +0 -33
- package/dist/planner/role.js +0 -68
- package/dist/repo/peer-redirect-hooks.d.ts +0 -16
- package/dist/repo/peer-redirect-hooks.js +0 -10
- package/dist/repo/peer-redirect.d.ts +0 -4
- package/dist/repo/peer-redirect.js +0 -26
- package/dist/repo/peers.d.ts +0 -39
- package/dist/repo/peers.js +0 -139
- package/dist/repo/resolve.d.ts +0 -41
- package/dist/repo/resolve.js +0 -152
- package/dist/repo/root.d.ts +0 -23
- package/dist/repo/root.js +0 -91
- package/dist/repo/source.d.ts +0 -14
- package/dist/repo/source.js +0 -54
- package/dist/repo/supabase-project.d.ts +0 -60
- package/dist/repo/supabase-project.js +0 -124
- package/dist/repo/tsx-loader.d.ts +0 -6
- package/dist/repo/tsx-loader.js +0 -41
- package/dist/run/pick.d.ts +0 -90
- package/dist/run/pick.js +0 -664
- package/dist/setup.d.ts +0 -1
- package/dist/setup.js +0 -280
- package/dist/stack.d.ts +0 -48
- package/dist/stack.js +0 -403
- package/dist/telemetry.d.ts +0 -59
- package/dist/tier.d.ts +0 -40
- package/dist/tier.js +0 -96
- package/dist/ui.d.ts +0 -40
- package/dist/ui.js +0 -71
- package/dist/version.d.ts +0 -7
- package/dist/version.js +0 -17
- package/dist/workers.d.ts +0 -5
- package/dist/workers.js +0 -33
- package/dist/workflows/commands.d.ts +0 -54
- package/dist/workflows/commands.js +0 -763
package/dist/telemetry.js
CHANGED
|
@@ -1,148 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* `@devdogsuga/telemetry` like `apps/platform`, `apps/schedule-builder`, and
|
|
4
|
-
* `apps/sandbox`, but on `@sentry/node` rather than a framework SDK: a CLI
|
|
5
|
-
* process starts, runs one command, and exits, with none of a server's
|
|
6
|
-
* request lifecycle for a framework integration to hook into.
|
|
7
|
-
*
|
|
8
|
-
* ## Reporting is on by default
|
|
9
|
-
*
|
|
10
|
-
* Every other `*_SENTRY_DSN` in this org is optional-and-empty until
|
|
11
|
-
* configured (see `@devdogsuga/telemetry`'s no-op-without-DSN contract), and
|
|
12
|
-
* so is this one — empty means `buildSentryOptions` returns `undefined` and
|
|
13
|
-
* `Sentry.init` never runs — but the DEFAULT here is reporting ON once a DSN
|
|
14
|
-
* exists, unlike a feature a contributor opts into. `DEVTOOLS_TELEMETRY=0` is
|
|
15
|
-
* the one escape hatch, checked before `Sentry.init` and before every capture
|
|
16
|
-
* call, so it also works as a kill switch after init already ran (a
|
|
17
|
-
* long-lived `pnpm devtools` menu session, for instance).
|
|
18
|
-
*
|
|
19
|
-
* ## Where the DSN comes from
|
|
20
|
-
*
|
|
21
|
-
* Baked in at build time, not read from the consumer's environment: devtools
|
|
22
|
-
* runs on contributors' machines, where no `.env` could be relied on to carry
|
|
23
|
-
* it. `scripts/write-build-info.mjs` writes `dist/build-info.json` from the
|
|
24
|
-
* build's `DEVTOOLS_SENTRY_DSN`, which Backstage's `publish.yaml` sets from
|
|
25
|
-
* the repo's Actions variable of the same name. Every other build bakes ""
|
|
26
|
-
* and reports nothing. `DEVTOOLS_SENTRY_DSN` in the run-time environment still
|
|
27
|
-
* wins, for pointing a local build at a test project.
|
|
28
|
-
*/
|
|
29
|
-
import { readFileSync } from "node:fs";
|
|
30
|
-
import * as Sentry from "@sentry/node";
|
|
31
|
-
import { buildSentryOptions } from "@devdogsuga/telemetry";
|
|
32
|
-
import { discoverRepoRoot } from "./repo/root.js";
|
|
33
|
-
import { ownVersion } from "./version.js";
|
|
34
|
-
/** The DSN baked into this build, or "" if there is none (a source run under
|
|
35
|
-
* tsx, or a build made without `DEVTOOLS_SENTRY_DSN`). */
|
|
36
|
-
function bakedSentryDsn() {
|
|
37
|
-
try {
|
|
38
|
-
const info = JSON.parse(readFileSync(new URL("./build-info.json", import.meta.url), "utf8"));
|
|
39
|
-
return typeof info.sentryDsn === "string" ? info.sentryDsn : "";
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return "";
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/** The run-time `DEVTOOLS_SENTRY_DSN` if set, else the baked one. */
|
|
46
|
-
export function resolveDevtoolsDsn(env, baked) {
|
|
47
|
-
// An empty override (`DEVTOOLS_SENTRY_DSN=`) must fall back to the baked DSN.
|
|
48
|
-
const override = env.DEVTOOLS_SENTRY_DSN ?? "";
|
|
49
|
-
return override || baked;
|
|
50
|
-
}
|
|
51
|
-
let initialized = false;
|
|
52
|
-
/**
|
|
53
|
-
* `'ci'` in every GitHub Actions job (`CI` is set by the runner itself,
|
|
54
|
-
* before any workflow-authored env), `'local'` on a contributor's machine.
|
|
55
|
-
* One of `@devdogsuga/telemetry`'s `ENVIRONMENTS`.
|
|
56
|
-
*/
|
|
57
|
-
export function devtoolsEnvironment() {
|
|
58
|
-
return process.env.CI ? "ci" : "local";
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* `DEVTOOLS_TELEMETRY=0` (any other value, including unset, leaves reporting
|
|
62
|
-
* on) is the only opt-out. Checked by both `initDevtoolsTelemetry` (skips
|
|
63
|
-
* `Sentry.init` outright) and `captureDevtoolsError` (so setting it mid-run,
|
|
64
|
-
* or between two invocations in the same process, still works).
|
|
65
|
-
*/
|
|
66
|
-
export function devtoolsTelemetryEnabled() {
|
|
67
|
-
return process.env.DEVTOOLS_TELEMETRY !== "0";
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Whether anyone is actually using devtools in this process. Package-registry
|
|
71
|
-
* scanners install every published version within minutes and run it in a
|
|
72
|
-
* throwaway sandbox (random `DESKTOP-xxxxxx` hosts, Firecracker VMs, a fuzzer
|
|
73
|
-
* that turns `process.exit` into a throw). Left unfiltered, each release filed
|
|
74
|
-
* the same two issues from them. They run with no DevDogsUGA checkout and no
|
|
75
|
-
* terminal. A person has at least one of the two (`setup` runs outside a
|
|
76
|
-
* checkout, but in a terminal), and CI always has a checkout.
|
|
77
|
-
*/
|
|
78
|
-
export function hasRealCaller(inRepo, isTTY) {
|
|
79
|
-
return inRepo || isTTY;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Initializes `@sentry/node` for this CLI process. Safe to call more than
|
|
83
|
-
* once (idempotent) and safe to call with no DSN configured (no-ops via
|
|
84
|
-
* `buildSentryOptions`, see its header).
|
|
85
|
-
*
|
|
86
|
-
* `command` becomes a `command` tag on every event this process reports, so
|
|
87
|
-
* an issue in Sentry names the subcommand it came from (`db reset`,
|
|
88
|
-
* `deploy platform`, …) without anyone opening the job log first.
|
|
89
|
-
*/
|
|
90
|
-
export function initDevtoolsTelemetry(command) {
|
|
91
|
-
if (initialized)
|
|
92
|
-
return;
|
|
93
|
-
initialized = true;
|
|
94
|
-
if (!devtoolsTelemetryEnabled())
|
|
95
|
-
return;
|
|
96
|
-
if (!hasRealCaller(discoverRepoRoot() !== null, process.stdin.isTTY === true)) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const options = buildSentryOptions({
|
|
100
|
-
service: "devtools",
|
|
101
|
-
environment: devtoolsEnvironment(),
|
|
102
|
-
dsn: resolveDevtoolsDsn(process.env, bakedSentryDsn()),
|
|
103
|
-
// The published version, so an issue names the release it came from; a
|
|
104
|
-
// dlx run has no SENTRY_RELEASE of its own.
|
|
105
|
-
release: `devtools@${ownVersion()}`,
|
|
106
|
-
});
|
|
107
|
-
if (!options)
|
|
108
|
-
return;
|
|
109
|
-
Sentry.init(options);
|
|
110
|
-
Sentry.getCurrentScope().setTag("command", command);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Reports an error nothing below the entry points caught — `launch.ts`'s
|
|
114
|
-
* `dispatch`, `launch-ci.ts`, and the bins — then flushes before the process
|
|
115
|
-
* exits. Node's event loop dies with `process.exit`, taking any in-flight
|
|
116
|
-
* request to Sentry's ingest endpoint with it, so the flush must be awaited
|
|
117
|
-
* BEFORE that call — never after.
|
|
118
|
-
*
|
|
119
|
-
* A short timeout: a CLI exiting on error should not hang perceptibly longer
|
|
120
|
-
* because Sentry's ingest is slow or unreachable.
|
|
121
|
-
*/
|
|
122
|
-
export async function captureDevtoolsError(err) {
|
|
123
|
-
if (!devtoolsTelemetryEnabled())
|
|
124
|
-
return;
|
|
125
|
-
Sentry.captureException(err);
|
|
126
|
-
await Sentry.flush(2000);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Reports an error a command caught and explained to the reader itself
|
|
130
|
-
* (`explainError` in `ui.ts`, `devtools-ci deploy`'s catch), then carried on
|
|
131
|
-
* to a normal exit. Not flushed: the SDK's in-flight request keeps the event
|
|
132
|
-
* loop alive until it lands, so a natural exit waits for it on its own. A
|
|
133
|
-
* path that ends in `process.exit` instead must use `captureDevtoolsError`.
|
|
134
|
-
*/
|
|
135
|
-
export function reportDevtoolsError(err) {
|
|
136
|
-
if (!devtoolsTelemetryEnabled())
|
|
137
|
-
return;
|
|
138
|
-
Sentry.captureException(err);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Reports a failure that has no error object — a subprocess or deploy step
|
|
142
|
-
* that exited non-zero. Same no-flush contract as `reportDevtoolsError`.
|
|
143
|
-
*/
|
|
144
|
-
export function reportDevtoolsFailure(message, extra = {}) {
|
|
145
|
-
if (!devtoolsTelemetryEnabled())
|
|
146
|
-
return;
|
|
147
|
-
Sentry.captureMessage(message, { level: "error", extra });
|
|
148
|
-
}
|
|
1
|
+
import { a as hasRealCaller, c as reportDevtoolsError, i as devtoolsTelemetryEnabled, l as reportDevtoolsFailure, n as captureDevtoolsError, o as initDevtoolsTelemetry, r as devtoolsEnvironment, s as lastSentryEventId, t as captureDevtoolsDeprecation, u as resolveDevtoolsDsn } from "./telemetry-C4foD8MD.js";
|
|
2
|
+
export { captureDevtoolsDeprecation, captureDevtoolsError, devtoolsEnvironment, devtoolsTelemetryEnabled, hasRealCaller, initDevtoolsTelemetry, lastSentryEventId, reportDevtoolsError, reportDevtoolsFailure, resolveDevtoolsDsn };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devdogsuga/devtools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Contributor CLI for a DevDogsUGA checkout:
|
|
6
|
+
"description": "Contributor CLI for a DevDogsUGA checkout: the real tools with the session's tier filled in, a menu over them, and the checks CI runs. Ships built JS; run via `pnpm dlx @devdogsuga/devtools` (or the `devtools` bin once installed) from inside a DevDogsUGA clone.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
"provenance": true
|
|
16
16
|
},
|
|
17
17
|
"bin": {
|
|
18
|
-
"devtools": "./bin/devtools.mjs"
|
|
19
|
-
"devtools-ci": "./bin/devtools-ci.mjs",
|
|
20
|
-
"devtools-ci-bare": "./bin/devtools-ci-bare.mjs"
|
|
18
|
+
"devtools": "./bin/devtools.mjs"
|
|
21
19
|
},
|
|
22
20
|
"files": [
|
|
23
21
|
"bin",
|
|
@@ -25,59 +23,42 @@
|
|
|
25
23
|
"env.ts"
|
|
26
24
|
],
|
|
27
25
|
"dependencies": {
|
|
28
|
-
"@bitwarden/cli": "2026.7.0",
|
|
29
|
-
"@bitwarden/sdk-napi": "1.0.0",
|
|
30
26
|
"@clack/prompts": "1.7.0",
|
|
31
|
-
"@resvg/resvg-js": "^2.6.2",
|
|
32
27
|
"@sentry/node": "10.75.1",
|
|
33
28
|
"@supabase/supabase-js": "^2.112.3",
|
|
34
29
|
"dotenv": "^17.4.2",
|
|
35
30
|
"postgres": "^3.4.9",
|
|
36
|
-
"satori": "^0.33.4",
|
|
37
|
-
"sharp": "0.35.3",
|
|
38
31
|
"tsx": "^4.23.12",
|
|
39
32
|
"typescript": "^6.0.3",
|
|
40
33
|
"zod": "4.4.3",
|
|
41
|
-
"@devdogsuga/telemetry": "0.1.
|
|
34
|
+
"@devdogsuga/telemetry": "0.1.3"
|
|
42
35
|
},
|
|
43
36
|
"peerDependencies": {
|
|
44
|
-
"@devdogsuga/brand": "*",
|
|
45
37
|
"@devdogsuga/db": "*",
|
|
46
|
-
"@devdogsuga/env": "*"
|
|
47
|
-
"@devdogsuga/events": "*"
|
|
38
|
+
"@devdogsuga/env": "*"
|
|
48
39
|
},
|
|
49
40
|
"peerDependenciesMeta": {
|
|
50
|
-
"@devdogsuga/brand": {
|
|
51
|
-
"optional": true
|
|
52
|
-
},
|
|
53
41
|
"@devdogsuga/db": {
|
|
54
42
|
"optional": true
|
|
55
43
|
},
|
|
56
44
|
"@devdogsuga/env": {
|
|
57
45
|
"optional": true
|
|
58
|
-
},
|
|
59
|
-
"@devdogsuga/events": {
|
|
60
|
-
"optional": true
|
|
61
46
|
}
|
|
62
47
|
},
|
|
63
48
|
"devDependencies": {
|
|
64
49
|
"@types/node": "^26.2.0",
|
|
65
|
-
"@types/react": "^19.2.18",
|
|
66
50
|
"@vitest/coverage-v8": "^4.1.11",
|
|
67
51
|
"eslint": "^9.39.5",
|
|
68
|
-
"
|
|
52
|
+
"tsdown": "^0.23.0",
|
|
69
53
|
"vitest": "^4.1.11",
|
|
70
|
-
"@devdogsuga/
|
|
71
|
-
"@devdogsuga/
|
|
54
|
+
"@devdogsuga/env": "0.1.5",
|
|
55
|
+
"@devdogsuga/cli-core": "0.0.0",
|
|
72
56
|
"@devdogsuga/config": "0.1.2",
|
|
73
|
-
"@devdogsuga/
|
|
74
|
-
"@devdogsuga/brand": "0.1.4"
|
|
57
|
+
"@devdogsuga/db": "0.1.3"
|
|
75
58
|
},
|
|
76
59
|
"scripts": {
|
|
77
|
-
"build": "
|
|
60
|
+
"build": "tsdown && node scripts/write-build-info.mjs && node ../../scripts/check-bundle-imports.mjs",
|
|
78
61
|
"cli": "node ./bin/devtools.mjs",
|
|
79
|
-
"ci": "node ./dist/ci.js",
|
|
80
|
-
"ci:env": "node ./bin/devtools-ci.mjs",
|
|
81
62
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
82
63
|
"test": "vitest run",
|
|
83
64
|
"test:watch": "vitest",
|
package/bin/devtools-ci-bare.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Entry point for the `devtools-ci-bare` bin: `ci.ts`'s `main()` with no tier
|
|
4
|
-
* resolution and no env-file loading — the counterpart to the old in-repo
|
|
5
|
-
* `"ci": "tsx --conditions=devdogs-source src/ci.ts"` package script.
|
|
6
|
-
*
|
|
7
|
-
* `devtools-ci` (`bin/devtools-ci.mjs` -> `src/launch-ci.ts`) ALWAYS resolves
|
|
8
|
-
* a deploy tier and calls `enterEnvironment` before dispatching to `ci.ts`.
|
|
9
|
-
* That's wrong for two kinds of CI step: `deploy write-env`, which CREATES
|
|
10
|
-
* the env file tier resolution would otherwise insist on reading first (a
|
|
11
|
-
* bootstrap cycle), and the handful of steps that hold one narrow credential
|
|
12
|
-
* via the job's own `env:` block and compose no env file at all (`preflight`,
|
|
13
|
-
* `migrate`, `plan`, `require-planner`, `require-token`, `orphans`). Those
|
|
14
|
-
* steps need `ci.ts`'s `main()` with nothing in front of it.
|
|
15
|
-
*
|
|
16
|
-
* Same technique as `bin/devtools.mjs` and `bin/devtools-ci.mjs` — see
|
|
17
|
-
* `bin/devtools.mjs`'s header — except it imports `dist/ci.js` directly
|
|
18
|
-
* rather than going through a `launch*.ts` wrapper: `ci.ts` has no
|
|
19
|
-
* tier-resolution step to run first, so there is nothing for a wrapper
|
|
20
|
-
* module to do. `dist/ci.js`'s own self-invoke guard
|
|
21
|
-
* (`import.meta.url === file://${process.argv[1]}`) does not fire here —
|
|
22
|
-
* `process.argv[1]` is this bin script, not `dist/ci.js` — so importing it
|
|
23
|
-
* only defines `main`, exactly like `bin/devtools-ci.mjs`'s import of
|
|
24
|
-
* `launch-ci.js` relies on.
|
|
25
|
-
*/
|
|
26
|
-
import { dirname, join } from "node:path";
|
|
27
|
-
import { fileURLToPath } from "node:url";
|
|
28
|
-
|
|
29
|
-
const ciEntry = join(
|
|
30
|
-
dirname(fileURLToPath(import.meta.url)),
|
|
31
|
-
"..",
|
|
32
|
-
"dist",
|
|
33
|
-
"ci.js",
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const { main } = await import(ciEntry);
|
|
37
|
-
try {
|
|
38
|
-
await main(process.argv.slice(2));
|
|
39
|
-
} catch (err) {
|
|
40
|
-
process.stderr.write(
|
|
41
|
-
`devtools-ci-bare: ${err instanceof Error ? err.message : String(err)}\n`,
|
|
42
|
-
);
|
|
43
|
-
const { captureDevtoolsError } = await import(
|
|
44
|
-
join(dirname(fileURLToPath(import.meta.url)), "..", "dist", "telemetry.js")
|
|
45
|
-
);
|
|
46
|
-
await captureDevtoolsError(err);
|
|
47
|
-
process.exitCode = 1;
|
|
48
|
-
}
|
package/bin/devtools-ci.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Entry point for the `devtools-ci` bin. Same technique as `bin/devtools.mjs`
|
|
4
|
-
* — see that file's header — pointed at `dist/launch-ci.js` instead.
|
|
5
|
-
*/
|
|
6
|
-
import { dirname, join } from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
|
|
9
|
-
const launchCiEntry = join(
|
|
10
|
-
dirname(fileURLToPath(import.meta.url)),
|
|
11
|
-
"..",
|
|
12
|
-
"dist",
|
|
13
|
-
"launch-ci.js",
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
const { launchCi } = await import(launchCiEntry);
|
|
17
|
-
try {
|
|
18
|
-
await launchCi(process.argv.slice(2));
|
|
19
|
-
} catch (err) {
|
|
20
|
-
// Whatever escapes before a command is dispatched (repo discovery, tier
|
|
21
|
-
// resolution, env entry) — the dispatch itself reports its own. See
|
|
22
|
-
// `bin/devtools-ci-bare.mjs` for the same shape.
|
|
23
|
-
process.stderr.write(
|
|
24
|
-
`devtools-ci: ${err instanceof Error ? err.message : String(err)}\n`,
|
|
25
|
-
);
|
|
26
|
-
const { captureDevtoolsError } = await import(
|
|
27
|
-
join(dirname(fileURLToPath(import.meta.url)), "..", "dist", "telemetry.js")
|
|
28
|
-
);
|
|
29
|
-
await captureDevtoolsError(err);
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
}
|
package/dist/args.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Positional arguments, with flag values excluded.
|
|
3
|
-
*
|
|
4
|
-
* Its own module because of one bug it prevents. The first positional is the
|
|
5
|
-
* subcommand, and `pull`, `push` and `audit` do very different things to live
|
|
6
|
-
* credentials. A naive `filter((a) => !a.startsWith("--"))` reads a flag's
|
|
7
|
-
* VALUE as a positional, so `env --file notes.env audit` fails loudly:
|
|
8
|
-
* `notes.env` is not a subcommand and the command refuses. The quiet version
|
|
9
|
-
* is the one that matters:
|
|
10
|
-
*
|
|
11
|
-
* env --file push audit
|
|
12
|
-
*
|
|
13
|
-
* which runs `push`, writing to Bitwarden and GitHub, when the caller asked
|
|
14
|
-
* for `audit`, which writes nothing at all.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Flags that consume the token after them.
|
|
18
|
-
*
|
|
19
|
-
* `--env` is here even though nothing accepts it any more. It was this CLI's
|
|
20
|
-
* spelling of `--target` until the two vocabularies behind it were merged, and
|
|
21
|
-
* a stale `env push --env staging` in somebody's shell history must not read
|
|
22
|
-
* `staging` as the subcommand. `cli.ts` rejects the flag by name instead,
|
|
23
|
-
* which says what happened.
|
|
24
|
-
*/
|
|
25
|
-
export declare const VALUE_FLAGS: Set<string>;
|
|
26
|
-
export declare function positionals(argv: readonly string[]): string[];
|
package/dist/args.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Positional arguments, with flag values excluded.
|
|
3
|
-
*
|
|
4
|
-
* Its own module because of one bug it prevents. The first positional is the
|
|
5
|
-
* subcommand, and `pull`, `push` and `audit` do very different things to live
|
|
6
|
-
* credentials. A naive `filter((a) => !a.startsWith("--"))` reads a flag's
|
|
7
|
-
* VALUE as a positional, so `env --file notes.env audit` fails loudly:
|
|
8
|
-
* `notes.env` is not a subcommand and the command refuses. The quiet version
|
|
9
|
-
* is the one that matters:
|
|
10
|
-
*
|
|
11
|
-
* env --file push audit
|
|
12
|
-
*
|
|
13
|
-
* which runs `push`, writing to Bitwarden and GitHub, when the caller asked
|
|
14
|
-
* for `audit`, which writes nothing at all.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Flags that consume the token after them.
|
|
18
|
-
*
|
|
19
|
-
* `--env` is here even though nothing accepts it any more. It was this CLI's
|
|
20
|
-
* spelling of `--target` until the two vocabularies behind it were merged, and
|
|
21
|
-
* a stale `env push --env staging` in somebody's shell history must not read
|
|
22
|
-
* `staging` as the subcommand. `cli.ts` rejects the flag by name instead,
|
|
23
|
-
* which says what happened.
|
|
24
|
-
*/
|
|
25
|
-
export const VALUE_FLAGS = new Set([
|
|
26
|
-
"--access-token",
|
|
27
|
-
// `qr`: every value flag, so `qr --out poster.png https://…` still reads
|
|
28
|
-
// the URL as the text and not `poster.png`.
|
|
29
|
-
"--background",
|
|
30
|
-
"--color",
|
|
31
|
-
"--ecl",
|
|
32
|
-
"--format",
|
|
33
|
-
// `images`: so `images --format og page/events` reads `og` as the format and
|
|
34
|
-
// `page/events` as the graphic, not both as graphics.
|
|
35
|
-
"--format",
|
|
36
|
-
"--logo",
|
|
37
|
-
"--logo-padding",
|
|
38
|
-
"--logo-size",
|
|
39
|
-
"--margin",
|
|
40
|
-
"--out",
|
|
41
|
-
"--size",
|
|
42
|
-
"--text",
|
|
43
|
-
"--version",
|
|
44
|
-
"--app",
|
|
45
|
-
"--apps",
|
|
46
|
-
"--base-url",
|
|
47
|
-
"--env",
|
|
48
|
-
"--file",
|
|
49
|
-
"--source",
|
|
50
|
-
"--target",
|
|
51
|
-
"--tier",
|
|
52
|
-
"--cron",
|
|
53
|
-
"--workflow",
|
|
54
|
-
"--params",
|
|
55
|
-
"--port",
|
|
56
|
-
"--preview-url",
|
|
57
|
-
"--db-url",
|
|
58
|
-
"--user",
|
|
59
|
-
"--filter",
|
|
60
|
-
"--shell",
|
|
61
|
-
]);
|
|
62
|
-
export function positionals(argv) {
|
|
63
|
-
const found = [];
|
|
64
|
-
for (let i = 0; i < argv.length; i += 1) {
|
|
65
|
-
const arg = argv[i];
|
|
66
|
-
if (!arg.startsWith("-")) {
|
|
67
|
-
found.push(arg);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
// Skip the value, but only if it looks like one. `--file --yes` is a
|
|
71
|
-
// mistake, and swallowing `--yes` would turn it into a silent one.
|
|
72
|
-
const next = argv[i + 1];
|
|
73
|
-
if (VALUE_FLAGS.has(arg) && next !== undefined && !next.startsWith("-")) {
|
|
74
|
-
i += 1;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return found;
|
|
78
|
-
}
|
package/dist/bws/bw.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `[command, args]` pair that runs the bundled Bitwarden CLI.
|
|
3
|
-
*
|
|
4
|
-
* Runs `build/bw.js` under this Node rather than through a shim, so it works
|
|
5
|
-
* the same wherever devtools is installed. Falls back to `bw` on PATH when the
|
|
6
|
-
* package cannot be resolved, which keeps a missing install surfacing as the
|
|
7
|
-
* ENOENT every caller already handles.
|
|
8
|
-
*/
|
|
9
|
-
export declare function bwCommand(args: string[]): [string, string[]];
|
|
10
|
-
/**
|
|
11
|
-
* Runs the Bitwarden CLI with `args`, then exits with its status.
|
|
12
|
-
*
|
|
13
|
-
* Returns a promise that never settles, because every path out of it ends in
|
|
14
|
-
* `process.exit`. That signature is load-bearing rather than pedantic: a
|
|
15
|
-
* `void` return would let the caller carry on and print `outro("Done.")`
|
|
16
|
-
* while `bw login` was still waiting for a master password.
|
|
17
|
-
*/
|
|
18
|
-
export declare function runBw(args: string[]): Promise<never>;
|
package/dist/bws/bw.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `pnpm devtools bw …`, the Bitwarden CLI passed through untouched.
|
|
3
|
-
*
|
|
4
|
-
* This is not a command of this CLI wearing a Bitwarden hat. Everything after
|
|
5
|
-
* `bw` goes to the real binary verbatim, and its exit code comes back
|
|
6
|
-
* verbatim, because the thing people actually run is `bw login` and its
|
|
7
|
-
* session handling is Bitwarden's business rather than ours.
|
|
8
|
-
*
|
|
9
|
-
* It exists because `@bitwarden/cli` is a dependency of this package, so the
|
|
10
|
-
* binary sits in devtools' own `node_modules/.bin` and nowhere else. Before
|
|
11
|
-
* this, reaching it meant a root alias (`pnpm bw`) that ran
|
|
12
|
-
* `pnpm --filter @devdogsuga/devtools exec bw`, the last script at the
|
|
13
|
-
* workspace root whose whole job was to reach into this package.
|
|
14
|
-
*
|
|
15
|
-
* ⚠️ The binary is resolved from `@bitwarden/cli` itself, never looked up on
|
|
16
|
-
* PATH. A dependency's bin is only linked into the `node_modules/.bin` of the
|
|
17
|
-
* package that depends on it, so under `pnpm dlx`, or with devtools installed
|
|
18
|
-
* in a clone, nothing puts `bw` on PATH and a bare `spawn("bw")` is ENOENT.
|
|
19
|
-
*/
|
|
20
|
-
import { spawn } from "node:child_process";
|
|
21
|
-
import { createRequire } from "node:module";
|
|
22
|
-
import { dirname, join } from "node:path";
|
|
23
|
-
/**
|
|
24
|
-
* The `[command, args]` pair that runs the bundled Bitwarden CLI.
|
|
25
|
-
*
|
|
26
|
-
* Runs `build/bw.js` under this Node rather than through a shim, so it works
|
|
27
|
-
* the same wherever devtools is installed. Falls back to `bw` on PATH when the
|
|
28
|
-
* package cannot be resolved, which keeps a missing install surfacing as the
|
|
29
|
-
* ENOENT every caller already handles.
|
|
30
|
-
*/
|
|
31
|
-
export function bwCommand(args) {
|
|
32
|
-
try {
|
|
33
|
-
const require_ = createRequire(import.meta.url);
|
|
34
|
-
const pkgPath = require_.resolve("@bitwarden/cli/package.json");
|
|
35
|
-
const pkg = require_(pkgPath);
|
|
36
|
-
return [process.execPath, [join(dirname(pkgPath), pkg.bin.bw), ...args]];
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return ["bw", args];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Runs the Bitwarden CLI with `args`, then exits with its status.
|
|
44
|
-
*
|
|
45
|
-
* Returns a promise that never settles, because every path out of it ends in
|
|
46
|
-
* `process.exit`. That signature is load-bearing rather than pedantic: a
|
|
47
|
-
* `void` return would let the caller carry on and print `outro("Done.")`
|
|
48
|
-
* while `bw login` was still waiting for a master password.
|
|
49
|
-
*/
|
|
50
|
-
export function runBw(args) {
|
|
51
|
-
return new Promise(() => {
|
|
52
|
-
const child = spawn(...bwCommand(args), { stdio: "inherit" });
|
|
53
|
-
child.on("error", (err) => {
|
|
54
|
-
// ENOENT here means the dependency is not installed rather than that the
|
|
55
|
-
// user mistyped, so say the thing that fixes it.
|
|
56
|
-
console.error(`bw: ${err.message}\n` +
|
|
57
|
-
"The Bitwarden CLI ships as a devtools dependency — " +
|
|
58
|
-
"run `pnpm install` at the repo root.");
|
|
59
|
-
process.exit(1);
|
|
60
|
-
});
|
|
61
|
-
child.on("exit", (code, signal) => {
|
|
62
|
-
// Re-raise rather than translating to a number: a Ctrl-C in `bw login`
|
|
63
|
-
// should look to the shell exactly like a Ctrl-C in `bw login`.
|
|
64
|
-
if (signal)
|
|
65
|
-
process.kill(process.pid, signal);
|
|
66
|
-
else
|
|
67
|
-
process.exit(code ?? 1);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
package/dist/bws/client.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare class BwsError extends Error {
|
|
2
|
-
}
|
|
3
|
-
export interface BwsSecret {
|
|
4
|
-
id: string;
|
|
5
|
-
key: string;
|
|
6
|
-
value: string;
|
|
7
|
-
note: string;
|
|
8
|
-
projectId: string;
|
|
9
|
-
/**
|
|
10
|
-
* ISO 8601, when this secret last changed.
|
|
11
|
-
*
|
|
12
|
-
* Optional because push and pull do not need it. It is the whole basis of
|
|
13
|
-
* the staleness half of `env audit`, which cannot compare values (GitHub
|
|
14
|
-
* secrets are write-only) and instead asks whether GitHub was updated after
|
|
15
|
-
* this.
|
|
16
|
-
*/
|
|
17
|
-
revisionDate?: string;
|
|
18
|
-
}
|
|
19
|
-
/** Records `--access-token`, before any command runs. */
|
|
20
|
-
export declare function setExplicitAccessToken(token: string | undefined): void;
|
|
21
|
-
/**
|
|
22
|
-
* The access token, found once per process.
|
|
23
|
-
*
|
|
24
|
-
* Memoized as a **promise**, not a value: resolution can prompt, and a single
|
|
25
|
-
* command makes several Secrets Manager calls. Caching the value alone would
|
|
26
|
-
* still let two concurrent calls open two prompts over each other.
|
|
27
|
-
*
|
|
28
|
-
* Whatever the source, the token reaches the SDK as a function argument in
|
|
29
|
-
* this process, never argv, never a child's environment.
|
|
30
|
-
*/
|
|
31
|
-
export declare function accessToken(): Promise<string>;
|
|
32
|
-
/** Resolves a project name to its id. Names are unique within an org. */
|
|
33
|
-
export declare function projectIdFor(name: string): Promise<string>;
|
|
34
|
-
export declare function listSecrets(projectId: string): Promise<BwsSecret[]>;
|
|
35
|
-
export declare function createSecret(projectId: string, key: string, value: string, note: string): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Takes the whole secret rather than an id: the SDK's update is a full
|
|
38
|
-
* replace (organization, key, project list included), and every caller
|
|
39
|
-
* already holds the listed secret it is updating.
|
|
40
|
-
*/
|
|
41
|
-
export declare function updateSecret(secret: BwsSecret, value: string, note: string): Promise<void>;
|
|
42
|
-
export declare function deleteSecrets(ids: string[]): Promise<void>;
|
|
43
|
-
export declare function byKey(secrets: BwsSecret[]): Map<string, BwsSecret>;
|