@devdogsuga/backstage 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/env.ts ADDED
@@ -0,0 +1,163 @@
1
+ /**
2
+ * The operator manifest: keys no app schema reads. They belong to the person
3
+ * running devtools, pushing secrets, deploying.
4
+ *
5
+ * NOTHING IMPORTS THIS FILE at runtime. Like the other package-root manifests
6
+ * it exists for the registry's consumers: the completeness test, the
7
+ * `.env.example` generator, the `env push` routing. The package's `typecheck`
8
+ * script is what keeps the metadata honest.
9
+ *
10
+ * This is also where the `never-store` credential is declared, and the
11
+ * classification is the whole point. It is the most sensitive value in the
12
+ * repository, refused storage because storing it defeats the thing it
13
+ * protects. See the long-form reasoning in `src/bws/environments.ts`.
14
+ */
15
+ import { declare, define } from "@devdogsuga/env";
16
+ import { z } from "zod";
17
+
18
+ declare({
19
+ source: "devtools",
20
+ server: {
21
+ // Everything here is optional: these are operator credentials, and an
22
+ // app or CI that cannot boot without one of them would be wrong.
23
+ // Presence is checked at the point of use, with a named refusal.
24
+ //
25
+ // Local .env storage was refused here until 2026-08-19 and is now
26
+ // OFFERED (the prompt's default save destination), by decision. What
27
+ // held, holds: the refusals that matter are the REMOTE ones. `env push`
28
+ // refuses this key by name, `pull` will not write it back, and `audit`
29
+ // errors on any remote copy, because one
30
+ // `${{ secrets.BWS_ACCESS_TOKEN }}` would hand CI every secret we hold,
31
+ // and storing it in a Bitwarden project is a key locked inside the box
32
+ // it opens. A gitignored .env on the operator's own machine is neither
33
+ // store, and it already holds credentials of comparable reach after any
34
+ // `env pull --target production`. Note `with-env` loads .env for every
35
+ // wrapped command, dev servers included; the Password Manager vault
36
+ // remains the save destination for anyone who minds that.
37
+ BWS_ACCESS_TOKEN: define(z.string().min(1).optional(), {
38
+ doc:
39
+ "Unlocks every Bitwarden Secrets Manager project, so it must never " +
40
+ "reach a remote store: never IN one of those projects (a key locked " +
41
+ "inside the box it opens), never synced to GitHub (would hand CI " +
42
+ "every secret we hold) -- push refuses it by name. Lives on the " +
43
+ "operator's own machine: this file (the prompt offers to save it " +
44
+ "here) or their Password Manager vault.",
45
+ scope: "environment",
46
+ secrecy: "never-store",
47
+ }),
48
+ SUPABASE_ACCESS_TOKEN: define(z.string().min(1).optional(), {
49
+ doc:
50
+ "A Supabase personal access token, carrying full account privileges " +
51
+ "across both Supabase organizations. Only `supabase config push` " +
52
+ "needs it -- the one mutation with no dry run -- so in GitHub it " +
53
+ "reaches the production-apply environment only, behind required " +
54
+ "reviewers.",
55
+ scope: "environment",
56
+ secrecy: "secret",
57
+ tier: "apply",
58
+ commented: true,
59
+ }),
60
+ // Devops-only, per the model doc. It appears in no contributor flow:
61
+ // `pnpm dev`, `pnpm build` and every test suite run without it, so its
62
+ // absence can never fail validation or block a boot.
63
+ CLOUDFLARE_API_TOKEN: define(z.string().min(1).optional(), {
64
+ doc:
65
+ "Deploys Workers and sets bindings; only devops hold it. Deploy " +
66
+ "scripts must check for it first and exit naming who to ask, rather " +
67
+ "than falling into wrangler's interactive browser OAuth.",
68
+ scope: "environment",
69
+ secrecy: "secret",
70
+ commented: true,
71
+ }),
72
+ // The value is committed as the example: one account, public identifier
73
+ // (it is in every dashboard URL), same in every environment.
74
+ CLOUDFLARE_ACCOUNT_ID: define(
75
+ z
76
+ .string()
77
+ .regex(/^[0-9a-f]{32}$/)
78
+ .optional(),
79
+ {
80
+ doc:
81
+ "The Cloudflare account the Workers live in. Wrangler honors this " +
82
+ "public identifier in the environment; each app's wrangler config " +
83
+ "pins the same value so scoped deploy tokens never need account " +
84
+ "discovery. Identifies, does not authorize — every capability is " +
85
+ "the token's.",
86
+ scope: "default",
87
+ secrecy: "public",
88
+ example: "61d185ff419ef7bd5bd4b3d314081a49",
89
+ },
90
+ ),
91
+ // Read only by the deploy workflow's Sentry release step and the deploy
92
+ // smoke test, never by an app. Without the token, deploys skip the release
93
+ // and its source-map upload with a warning. With it, a failed upload fails
94
+ // the deploy.
95
+ SENTRY_AUTH_TOKEN: define(z.string().min(1).optional(), {
96
+ doc:
97
+ "A Sentry organization auth token. Deploys use it to create each " +
98
+ "release and upload its source maps, and the smoke test uses it to " +
99
+ "read cron check-ins. One token serves every environment.",
100
+ scope: "environment",
101
+ secrecy: "secret",
102
+ commented: true,
103
+ }),
104
+ SENTRY_ORG: define(z.string().min(1).optional(), {
105
+ doc:
106
+ "The Sentry organization slug the release step and smoke test " +
107
+ "address. Identifies, does not authorize.",
108
+ scope: "default",
109
+ secrecy: "public",
110
+ example: "devdogsuga",
111
+ }),
112
+ // Developer-scoped even though the VALUE is org-wide: only operators
113
+ // running `env pull/push/audit` on their own machines read it, no app and
114
+ // no CI job does, and developer scope is what keeps a purely local input
115
+ // out of every routed set. A public identifier: it names the org and
116
+ // authorizes nothing, every capability comes from BWS_ACCESS_TOKEN.
117
+ BWS_ORG_ID: define(z.uuid().optional(), {
118
+ doc:
119
+ "The Bitwarden organization id, needed since the Secrets Manager " +
120
+ "SDK replaced the bws binary (2026-08-19): every SDK call addresses " +
121
+ "the org explicitly, and nothing in its surface discovers it from " +
122
+ "the token. A public UUID -- it is in the Secrets Manager URL " +
123
+ "(bitwarden.com/#/sm/<org-id>/...) -- that identifies and does not " +
124
+ "authorize. Leave it unset and the first Secrets Manager command " +
125
+ "asks, then saves it here.",
126
+ scope: "developer",
127
+ secrecy: "public",
128
+ }),
129
+ DEV_VPN_HOST: define(z.string().min(1).optional(), {
130
+ doc:
131
+ "One machine's VPN IP, for testing on a phone over VPN (the HMR " +
132
+ "origin). Meaningless to anyone else, so never pushed anywhere.",
133
+ scope: "developer",
134
+ secrecy: "public",
135
+ }),
136
+ SKIP_ENV_VALIDATION: define(z.string().optional(), {
137
+ doc:
138
+ "Any non-empty value skips env-schema validation, for builds that " +
139
+ "run without secrets -- CI and Docker. Never set it locally: it " +
140
+ "turns misconfiguration from a build error into a runtime surprise.",
141
+ scope: "default",
142
+ secrecy: "public",
143
+ commented: true,
144
+ }),
145
+ // No DEVTOOLS_SENTRY_DSN here: the DSN is baked in at publish time, not
146
+ // configured by the consumer (see src/telemetry.ts).
147
+ //
148
+ // Reporting is ON by default in a published build -- unlike
149
+ // every other telemetry surface in this workspace, which a consumer
150
+ // opts INTO by configuring a DSN, this one an operator opts OUT of.
151
+ // `"0"` is the one recognized value; anything else, including unset,
152
+ // leaves reporting on. Developer-scoped: it is a per-machine (or
153
+ // per-job) preference, never something `env push` should route
154
+ // anywhere.
155
+ DEVTOOLS_TELEMETRY: define(z.string().optional(), {
156
+ doc:
157
+ 'Set to "0" to opt out of devtools\' Sentry error reporting (on by ' +
158
+ "default in published builds). See src/telemetry.ts.",
159
+ scope: "developer",
160
+ secrecy: "public",
161
+ }),
162
+ },
163
+ });
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@devdogsuga/backstage",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Officer and production CLI for DevDogsUGA: deploys, env sync with Bitwarden and GitHub, the migration planner role, club graphics and QR codes, GitHub rulesets and settings, and the newsletter. Ships built JS; run it anywhere with `pnpm dlx @devdogsuga/backstage` (no checkout needed to start; commands that read a checkout say so).",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/DevDogsUGA/Backstage.git",
11
+ "directory": "packages/backstage"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "provenance": true
16
+ },
17
+ "bin": {
18
+ "backstage": "./bin/backstage.mjs"
19
+ },
20
+ "exports": {
21
+ "./package.json": "./package.json"
22
+ },
23
+ "files": [
24
+ "bin",
25
+ "dist",
26
+ "env.ts"
27
+ ],
28
+ "dependencies": {
29
+ "@bitwarden/cli": "2026.7.0",
30
+ "@bitwarden/sdk-napi": "1.0.0",
31
+ "@clack/prompts": "1.7.0",
32
+ "@resvg/resvg-js": "^2.6.2",
33
+ "@sentry/node": "10.75.1",
34
+ "@supabase/supabase-js": "^2.112.3",
35
+ "dotenv": "^17.4.2",
36
+ "postgres": "^3.4.9",
37
+ "react": "^19.2.8",
38
+ "satori": "^0.33.4",
39
+ "sharp": "0.35.3",
40
+ "tsx": "^4.23.12",
41
+ "typescript": "^6.0.3",
42
+ "zod": "4.4.3",
43
+ "@devdogsuga/brand": "0.1.4",
44
+ "@devdogsuga/events": "0.1.4",
45
+ "@devdogsuga/newsletter": "0.1.7",
46
+ "@devdogsuga/telemetry": "0.1.2"
47
+ },
48
+ "peerDependencies": {
49
+ "@devdogsuga/db": "*",
50
+ "@devdogsuga/env": "*"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "@devdogsuga/db": {
54
+ "optional": true
55
+ },
56
+ "@devdogsuga/env": {
57
+ "optional": true
58
+ }
59
+ },
60
+ "devDependencies": {
61
+ "@types/node": "^26.2.0",
62
+ "@types/react": "^19.2.18",
63
+ "@vitest/coverage-v8": "^4.1.11",
64
+ "eslint": "^9.39.5",
65
+ "tsdown": "^0.23.0",
66
+ "vitest": "^4.1.11",
67
+ "@devdogsuga/cli-core": "0.0.0",
68
+ "@devdogsuga/config": "0.1.0",
69
+ "@devdogsuga/db": "0.1.2",
70
+ "@devdogsuga/env": "0.1.4"
71
+ },
72
+ "scripts": {
73
+ "build": "tsdown && node scripts/write-build-info.mjs && node ../../scripts/check-bundle-imports.mjs",
74
+ "cli": "node ./bin/backstage.mjs",
75
+ "typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
76
+ "test": "vitest run",
77
+ "test:watch": "vitest",
78
+ "test:contract": "vitest run --config vitest.contract.config.ts",
79
+ "lint": "eslint .",
80
+ "lint:fix": "eslint . --fix"
81
+ }
82
+ }