@devdogsuga/devtools 0.1.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/README.md +44 -0
- package/bin/devtools-ci-bare.mjs +48 -0
- package/bin/devtools-ci.mjs +17 -0
- package/bin/devtools.mjs +27 -0
- package/dist/args.d.ts +26 -0
- package/dist/args.js +78 -0
- package/dist/bws/bw.d.ts +9 -0
- package/dist/bws/bw.js +49 -0
- package/dist/bws/client.d.ts +43 -0
- package/dist/bws/client.js +363 -0
- package/dist/bws/environments.d.ts +96 -0
- package/dist/bws/environments.js +111 -0
- package/dist/bws/pace.d.ts +27 -0
- package/dist/bws/pace.js +43 -0
- package/dist/bws/retry.d.ts +12 -0
- package/dist/bws/retry.js +39 -0
- package/dist/bws/store.d.ts +1 -0
- package/dist/bws/store.js +32 -0
- package/dist/bws/token.d.ts +31 -0
- package/dist/bws/token.js +88 -0
- package/dist/bws/vault.d.ts +29 -0
- package/dist/bws/vault.js +200 -0
- package/dist/catalog.d.ts +55 -0
- package/dist/catalog.js +81 -0
- package/dist/cf/commands.d.ts +1 -0
- package/dist/cf/commands.js +182 -0
- package/dist/cf/local-env.d.ts +44 -0
- package/dist/cf/local-env.js +148 -0
- package/dist/ci.d.ts +1 -0
- package/dist/ci.js +319 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +1077 -0
- package/dist/commands.d.ts +255 -0
- package/dist/commands.js +1279 -0
- package/dist/completions.d.ts +4 -0
- package/dist/completions.js +110 -0
- package/dist/cron/commands.d.ts +47 -0
- package/dist/cron/commands.js +372 -0
- package/dist/cron/discovery.d.ts +55 -0
- package/dist/cron/discovery.js +85 -0
- package/dist/cron/schema.d.ts +45 -0
- package/dist/cron/schema.js +35 -0
- package/dist/db/config-push.d.ts +8 -0
- package/dist/db/config-push.js +11 -0
- package/dist/db/connection.d.ts +79 -0
- package/dist/db/connection.js +114 -0
- package/dist/db/exec.d.ts +1 -0
- package/dist/db/exec.js +11 -0
- package/dist/db/generate-migration.d.ts +1 -0
- package/dist/db/generate-migration.js +67 -0
- package/dist/db/generate-types.d.ts +1 -0
- package/dist/db/generate-types.js +4 -0
- package/dist/db/introspect.d.ts +1 -0
- package/dist/db/introspect.js +113 -0
- package/dist/db/local-env.d.ts +65 -0
- package/dist/db/local-env.js +23 -0
- package/dist/db/new-migration.d.ts +1 -0
- package/dist/db/new-migration.js +8 -0
- package/dist/db/run.d.ts +70 -0
- package/dist/db/run.js +158 -0
- package/dist/db/seed-buckets.d.ts +2 -0
- package/dist/db/seed-buckets.js +4 -0
- package/dist/db/seed-production.d.ts +8 -0
- package/dist/db/seed-production.js +73 -0
- package/dist/db/seed-roles.d.ts +7 -0
- package/dist/db/seed-roles.js +31 -0
- package/dist/db/session-refresh.d.ts +43 -0
- package/dist/db/session-refresh.js +40 -0
- package/dist/deploy/migrations.d.ts +20 -0
- package/dist/deploy/migrations.js +68 -0
- package/dist/deploy/orphans.d.ts +20 -0
- package/dist/deploy/orphans.js +177 -0
- package/dist/deploy/preflight.d.ts +53 -0
- package/dist/deploy/preflight.js +189 -0
- package/dist/deploy/report.d.ts +26 -0
- package/dist/deploy/report.js +70 -0
- package/dist/deploy/require-planner.d.ts +2 -0
- package/dist/deploy/require-planner.js +60 -0
- package/dist/deploy/require-token.d.ts +15 -0
- package/dist/deploy/require-token.js +78 -0
- package/dist/deploy/secrets-file.d.ts +17 -0
- package/dist/deploy/secrets-file.js +167 -0
- package/dist/deploy/write-env.d.ts +40 -0
- package/dist/deploy/write-env.js +393 -0
- package/dist/docs/index-pages.d.ts +36 -0
- package/dist/docs/index-pages.js +184 -0
- package/dist/doctor.d.ts +62 -0
- package/dist/doctor.js +225 -0
- package/dist/emails/commands.d.ts +15 -0
- package/dist/emails/commands.js +130 -0
- package/dist/emails/email-types.d.ts +13 -0
- package/dist/emails/email-types.js +1 -0
- package/dist/emails/fixtures.d.ts +20 -0
- package/dist/emails/fixtures.js +20 -0
- package/dist/env/audit.d.ts +206 -0
- package/dist/env/audit.js +436 -0
- package/dist/env/cloudflare.d.ts +21 -0
- package/dist/env/cloudflare.js +61 -0
- package/dist/env/commands.d.ts +99 -0
- package/dist/env/commands.js +612 -0
- package/dist/env/discovery.d.ts +15 -0
- package/dist/env/discovery.js +226 -0
- package/dist/env/document.d.ts +119 -0
- package/dist/env/document.js +323 -0
- package/dist/env/example.d.ts +68 -0
- package/dist/env/example.js +603 -0
- package/dist/env/selection.d.ts +105 -0
- package/dist/env/selection.js +226 -0
- package/dist/environment.d.ts +92 -0
- package/dist/environment.js +206 -0
- package/dist/fingerprint.d.ts +10 -0
- package/dist/fingerprint.js +18 -0
- package/dist/gen/campus-map.d.ts +1 -0
- package/dist/gen/campus-map.js +473 -0
- package/dist/gen/commands.d.ts +1 -0
- package/dist/gen/commands.js +25 -0
- package/dist/gen/hypno.d.ts +1 -0
- package/dist/gen/hypno.js +134 -0
- package/dist/gh/client.d.ts +80 -0
- package/dist/gh/client.js +258 -0
- package/dist/gh/environments.d.ts +83 -0
- package/dist/gh/environments.js +178 -0
- package/dist/gh/rulesets/actors.d.ts +14 -0
- package/dist/gh/rulesets/actors.js +68 -0
- package/dist/gh/rulesets/api.d.ts +15 -0
- package/dist/gh/rulesets/api.js +99 -0
- package/dist/gh/rulesets/commands.d.ts +3 -0
- package/dist/gh/rulesets/commands.js +203 -0
- package/dist/gh/rulesets/desired.d.ts +112 -0
- package/dist/gh/rulesets/desired.js +247 -0
- package/dist/gh/rulesets/diff.d.ts +65 -0
- package/dist/gh/rulesets/diff.js +134 -0
- package/dist/gh/rulesets/types.d.ts +76 -0
- package/dist/gh/rulesets/types.js +13 -0
- package/dist/gh/settings/api.d.ts +40 -0
- package/dist/gh/settings/api.js +172 -0
- package/dist/gh/settings/commands.d.ts +1 -0
- package/dist/gh/settings/commands.js +245 -0
- package/dist/gh/settings/desired.d.ts +53 -0
- package/dist/gh/settings/desired.js +39 -0
- package/dist/gh/settings/diff.d.ts +57 -0
- package/dist/gh/settings/diff.js +156 -0
- package/dist/gh/settings/types.d.ts +92 -0
- package/dist/gh/settings/types.js +11 -0
- package/dist/gh/settings/workflows.d.ts +41 -0
- package/dist/gh/settings/workflows.js +124 -0
- package/dist/grantRoot.d.ts +42 -0
- package/dist/grantRoot.js +89 -0
- package/dist/help.d.ts +18 -0
- package/dist/help.js +169 -0
- package/dist/images/commands.d.ts +35 -0
- package/dist/images/commands.js +233 -0
- package/dist/images/events.d.ts +36 -0
- package/dist/images/events.js +152 -0
- package/dist/images/graphics.d.ts +70 -0
- package/dist/images/graphics.js +233 -0
- package/dist/images/open-graph-types.d.ts +75 -0
- package/dist/images/open-graph-types.js +1 -0
- package/dist/images/prompts.d.ts +34 -0
- package/dist/images/prompts.js +100 -0
- package/dist/images/render.d.ts +21 -0
- package/dist/images/render.js +57 -0
- package/dist/images/select.d.ts +64 -0
- package/dist/images/select.js +96 -0
- package/dist/instance.d.ts +67 -0
- package/dist/instance.js +129 -0
- package/dist/invocation.d.ts +49 -0
- package/dist/invocation.js +78 -0
- package/dist/launch-ci.d.ts +1 -0
- package/dist/launch-ci.js +86 -0
- package/dist/launch.d.ts +29 -0
- package/dist/launch.js +371 -0
- package/dist/menu.d.ts +31 -0
- package/dist/menu.js +277 -0
- package/dist/newsletter/commands.d.ts +16 -0
- package/dist/newsletter/commands.js +311 -0
- package/dist/newsletter/imap.d.ts +17 -0
- package/dist/newsletter/imap.js +127 -0
- package/dist/newsletter/loopback.d.ts +24 -0
- package/dist/newsletter/loopback.js +100 -0
- package/dist/newsletter/oauth.d.ts +26 -0
- package/dist/newsletter/oauth.js +130 -0
- package/dist/newsletter/smtp.d.ts +23 -0
- package/dist/newsletter/smtp.js +133 -0
- package/dist/oauth/browser.d.ts +1 -0
- package/dist/oauth/browser.js +13 -0
- package/dist/oauth/config.d.ts +24 -0
- package/dist/oauth/config.js +24 -0
- package/dist/oauth/connect-url.d.ts +17 -0
- package/dist/oauth/connect-url.js +23 -0
- package/dist/oauth/db.d.ts +37 -0
- package/dist/oauth/db.js +108 -0
- package/dist/oauth/device.d.ts +93 -0
- package/dist/oauth/device.js +190 -0
- package/dist/oauth/discovery.d.ts +28 -0
- package/dist/oauth/discovery.js +54 -0
- package/dist/oauth/env-file.d.ts +6 -0
- package/dist/oauth/env-file.js +35 -0
- package/dist/oauth/exchange.d.ts +43 -0
- package/dist/oauth/exchange.js +87 -0
- package/dist/oauth/label.d.ts +1 -0
- package/dist/oauth/label.js +25 -0
- package/dist/oauth/loopback.d.ts +52 -0
- package/dist/oauth/loopback.js +162 -0
- package/dist/oauth/pkce.d.ts +6 -0
- package/dist/oauth/pkce.js +34 -0
- package/dist/oauth/target.d.ts +54 -0
- package/dist/oauth/target.js +102 -0
- package/dist/oauth/transport.d.ts +41 -0
- package/dist/oauth/transport.js +32 -0
- package/dist/oauth/wizard.d.ts +33 -0
- package/dist/oauth/wizard.js +571 -0
- package/dist/pick.d.ts +6 -0
- package/dist/pick.js +64 -0
- package/dist/planner/checks.d.ts +26 -0
- package/dist/planner/checks.js +104 -0
- package/dist/planner/commands.d.ts +10 -0
- package/dist/planner/commands.js +367 -0
- package/dist/planner/db.d.ts +15 -0
- package/dist/planner/db.js +33 -0
- package/dist/planner/role.d.ts +33 -0
- package/dist/planner/role.js +68 -0
- package/dist/repo/peers.d.ts +24 -0
- package/dist/repo/peers.js +114 -0
- package/dist/repo/preflight.d.ts +109 -0
- package/dist/repo/preflight.js +266 -0
- package/dist/repo/resolve.d.ts +41 -0
- package/dist/repo/resolve.js +152 -0
- package/dist/repo/root.d.ts +23 -0
- package/dist/repo/root.js +91 -0
- package/dist/repo/source.d.ts +14 -0
- package/dist/repo/source.js +54 -0
- package/dist/repo/tsx-loader.d.ts +6 -0
- package/dist/repo/tsx-loader.js +41 -0
- package/dist/run/pick.d.ts +60 -0
- package/dist/run/pick.js +559 -0
- package/dist/setup.d.ts +1 -0
- package/dist/setup.js +152 -0
- package/dist/stack.d.ts +48 -0
- package/dist/stack.js +290 -0
- package/dist/telemetry.d.ts +34 -0
- package/dist/telemetry.js +93 -0
- package/dist/tier.d.ts +40 -0
- package/dist/tier.js +93 -0
- package/dist/tsconfig.typecheck.tsbuildinfo +1 -0
- package/dist/ui.d.ts +25 -0
- package/dist/ui.js +51 -0
- package/dist/workers.d.ts +5 -0
- package/dist/workers.js +35 -0
- package/dist/workflows/commands.d.ts +44 -0
- package/dist/workflows/commands.js +668 -0
- package/env.ts +158 -0
- package/package.json +80 -0
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function bail(message?: string): never;
|
|
2
|
+
/** Exits cleanly on Ctrl-C rather than letting a cancel symbol leak onward. */
|
|
3
|
+
export declare function unwrap<T>(value: T | symbol): T;
|
|
4
|
+
/**
|
|
5
|
+
* Reports a failure with the next thing to try.
|
|
6
|
+
*
|
|
7
|
+
* `hints` is not decoration: for most of these failures the fix is one command,
|
|
8
|
+
* and printing it is the difference between a contributor continuing and a
|
|
9
|
+
* contributor asking in Discord.
|
|
10
|
+
*/
|
|
11
|
+
export declare function explain(summary: string, detail: string, hints?: string[]): void;
|
|
12
|
+
export declare function errorMessage(err: unknown): string;
|
|
13
|
+
export interface CheckResult {
|
|
14
|
+
name: string;
|
|
15
|
+
ok: boolean;
|
|
16
|
+
detail: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A pass/fail list.
|
|
20
|
+
*
|
|
21
|
+
* Deliberately plain text rather than a box-drawing table: these lines get
|
|
22
|
+
* pasted into Discord and GitHub issues, where anything fancier turns to
|
|
23
|
+
* rubble.
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderChecks(checks: CheckResult[]): string;
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared prompt plumbing.
|
|
3
|
+
*
|
|
4
|
+
* The audience here is a contributor who may not be comfortable in a terminal
|
|
5
|
+
* at all, so two rules apply throughout:
|
|
6
|
+
*
|
|
7
|
+
* * Nothing requires knowing a command. Running `pnpm devtools` with no
|
|
8
|
+
* arguments opens a menu, and every prompt has a sensible default.
|
|
9
|
+
* * A failure says what to do next. `explain()` exists so no error path
|
|
10
|
+
* ends at a stack trace.
|
|
11
|
+
*/
|
|
12
|
+
import { cancel, isCancel, log, note } from "@clack/prompts";
|
|
13
|
+
export function bail(message = "Cancelled.") {
|
|
14
|
+
cancel(message);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
/** Exits cleanly on Ctrl-C rather than letting a cancel symbol leak onward. */
|
|
18
|
+
export function unwrap(value) {
|
|
19
|
+
if (isCancel(value))
|
|
20
|
+
bail();
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reports a failure with the next thing to try.
|
|
25
|
+
*
|
|
26
|
+
* `hints` is not decoration: for most of these failures the fix is one command,
|
|
27
|
+
* and printing it is the difference between a contributor continuing and a
|
|
28
|
+
* contributor asking in Discord.
|
|
29
|
+
*/
|
|
30
|
+
export function explain(summary, detail, hints = []) {
|
|
31
|
+
log.error(summary);
|
|
32
|
+
if (detail)
|
|
33
|
+
log.message(detail);
|
|
34
|
+
if (hints.length > 0)
|
|
35
|
+
note(hints.join("\n"), "Try this");
|
|
36
|
+
}
|
|
37
|
+
export function errorMessage(err) {
|
|
38
|
+
return err instanceof Error ? err.message : String(err);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A pass/fail list.
|
|
42
|
+
*
|
|
43
|
+
* Deliberately plain text rather than a box-drawing table: these lines get
|
|
44
|
+
* pasted into Discord and GitHub issues, where anything fancier turns to
|
|
45
|
+
* rubble.
|
|
46
|
+
*/
|
|
47
|
+
export function renderChecks(checks) {
|
|
48
|
+
return checks
|
|
49
|
+
.map((c) => `${c.ok ? "PASS" : "FAIL"} ${c.name}\n ${c.detail}`)
|
|
50
|
+
.join("\n");
|
|
51
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Workspace-relative paths, exactly as listed in root `workers.json`. */
|
|
2
|
+
export declare function workerPaths(): readonly string[];
|
|
3
|
+
/** Basenames, e.g. `"schedule-builder"` — the `pnpm --filter` / CLI slug. */
|
|
4
|
+
export declare function workerApps(): readonly string[];
|
|
5
|
+
export declare function isWorkerApp(value: string): boolean;
|
package/dist/workers.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one list of Worker apps, read from root `workers.json`.
|
|
3
|
+
*
|
|
4
|
+
* Six call sites across `devtools` and `env` used to carry their own copy of
|
|
5
|
+
* `["platform", "sandbox", "schedule-builder"]` — a CLI's app-choice list, a
|
|
6
|
+
* deploy guard, an env-registry consumer, a cron drift test, and more — with
|
|
7
|
+
* nothing to say when one of them drifted from the rest. `workers.test.ts`
|
|
8
|
+
* covers the drift; this module is the one place to fix it.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { basename, join } from "node:path";
|
|
12
|
+
import { findRepoRoot } from "./repo/root.js";
|
|
13
|
+
// Both lists used to be top-level `const`s, evaluated the instant this
|
|
14
|
+
// module was imported — which meant `findRepoRoot()` ran (and threw
|
|
15
|
+
// `RepoNotFoundError`) at IMPORT time for anything that pulled this module
|
|
16
|
+
// in transitively, `devtools --help` and `devtools setup` included, even
|
|
17
|
+
// outside any repo. Lazy + memoized getters fix that: nothing here touches
|
|
18
|
+
// the filesystem until a caller actually asks for the list, by which point
|
|
19
|
+
// it is a real repo-dependent command that is supposed to refuse outside a
|
|
20
|
+
// repo anyway.
|
|
21
|
+
let cachedWorkerPaths;
|
|
22
|
+
/** Workspace-relative paths, exactly as listed in root `workers.json`. */
|
|
23
|
+
export function workerPaths() {
|
|
24
|
+
if (cachedWorkerPaths === undefined) {
|
|
25
|
+
cachedWorkerPaths = JSON.parse(readFileSync(join(findRepoRoot(), "workers.json"), "utf8"));
|
|
26
|
+
}
|
|
27
|
+
return cachedWorkerPaths;
|
|
28
|
+
}
|
|
29
|
+
/** Basenames, e.g. `"schedule-builder"` — the `pnpm --filter` / CLI slug. */
|
|
30
|
+
export function workerApps() {
|
|
31
|
+
return workerPaths().map((path) => basename(path));
|
|
32
|
+
}
|
|
33
|
+
export function isWorkerApp(value) {
|
|
34
|
+
return workerApps().includes(value);
|
|
35
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type AppWranglerConfig, type CronTier } from "../cron/discovery.js";
|
|
2
|
+
export interface WorkflowChoice {
|
|
3
|
+
app: string;
|
|
4
|
+
tier: CronTier;
|
|
5
|
+
binding: string;
|
|
6
|
+
name: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
interface WorkflowOptions {
|
|
10
|
+
app?: string;
|
|
11
|
+
tier?: string;
|
|
12
|
+
workflow?: string;
|
|
13
|
+
params?: string;
|
|
14
|
+
port?: string;
|
|
15
|
+
yes: boolean;
|
|
16
|
+
json: boolean;
|
|
17
|
+
instanceId?: string;
|
|
18
|
+
}
|
|
19
|
+
export { renderWranglerEnvFile } from "../cf/local-env.js";
|
|
20
|
+
export declare function workflowChoices(configs: readonly AppWranglerConfig[], tiers?: readonly CronTier[]): WorkflowChoice[];
|
|
21
|
+
export declare function workflowTriggerArgs(choice: WorkflowChoice, options: Pick<WorkflowOptions, "params" | "port" | "instanceId">): string[];
|
|
22
|
+
/** Wait until a locally-triggered instance finishes before its server is stopped. */
|
|
23
|
+
export declare function waitForLocalWorkflow(workflowName: string, instanceId: string, port: string, options?: {
|
|
24
|
+
timeoutMs?: number;
|
|
25
|
+
pollMs?: number;
|
|
26
|
+
fetcher?: typeof fetch;
|
|
27
|
+
}): Promise<number>;
|
|
28
|
+
export declare function wranglerDevArgs(app: string, port: string): string[];
|
|
29
|
+
/** Probe Wrangler's Workflow explorer API, rather than merely checking a port. */
|
|
30
|
+
export declare function isWranglerDevRunning(port: string, timeoutMs?: number, fetcher?: typeof fetch): Promise<boolean>;
|
|
31
|
+
/** Whether nothing is bound to `port` on loopback — a real bind test, not a
|
|
32
|
+
* connect probe, so it answers the only question that matters here: can Wrangler
|
|
33
|
+
* take this port? */
|
|
34
|
+
export declare function isPortFree(port: number): Promise<boolean>;
|
|
35
|
+
/** The first free port at or after `from`, or null if a bounded scan finds
|
|
36
|
+
* none. Bounded so an exhausted range fails loudly instead of looping. */
|
|
37
|
+
export declare function findFreePort(from: number, attempts?: number): Promise<number | null>;
|
|
38
|
+
export declare function isWranglerDevConnectionFailure(stderr: string): boolean;
|
|
39
|
+
export declare function wranglerDevConnectionHint(app: string, port: string): string;
|
|
40
|
+
export declare function wranglerDevNotRunningHint(app: string, port: string): string;
|
|
41
|
+
export declare function runWorkflowsList(argv: readonly string[]): Promise<number>;
|
|
42
|
+
export declare function runWorkflowsRun(argv: readonly string[]): Promise<number>;
|
|
43
|
+
export declare function runWorkflowsServe(argv: readonly string[]): Promise<number>;
|
|
44
|
+
export declare function runWorkflows(argv: readonly string[]): Promise<number>;
|