@devdogsuga/devtools 0.1.38 → 0.1.39

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.
Files changed (4) hide show
  1. package/LICENSE +28 -0
  2. package/dist/launch.js +35 -11
  3. package/env.ts +10 -0
  4. package/package.json +6 -6
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026 DevDogs at UGA contributors
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/dist/launch.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as cliName, t as installFailureLog } from "./failure-log-B5GG_8T1.js";
2
- import { C as helpPath, S as catalog, g as setMenuEnvHook, h as realEnvEntryDeps, m as enterSessionEnvironment, n as bareGroupStartPath, u as nonEmpty, v as errorMessage, x as unwrap } from "./menu-Craj11Sn.js";
2
+ import { C as helpPath, S as catalog, _ as bail, g as setMenuEnvHook, h as realEnvEntryDeps, m as enterSessionEnvironment, n as bareGroupStartPath, u as nonEmpty, v as errorMessage, x as unwrap } from "./menu-Craj11Sn.js";
3
3
  import { b as setDryRun, m as formatCommand, v as isDryRun, y as resolveDryRun } from "./supabase-project-Bw8sBFcE.js";
4
4
  import { n as discoverRepoRoot, r as findRepoRoot, t as RepoNotFoundError } from "./root-C2OmZDwD.js";
5
5
  import { i as loadEnvSession, r as loadEnvLoad } from "./peers-RBplwovA.js";
@@ -197,6 +197,27 @@ async function gated(tier, commandArgv, proceed, blocked) {
197
197
  return proceed();
198
198
  }
199
199
  /**
200
+ * The session resolution from before `askSession` existed, for a repo whose
201
+ * `@devdogsuga/env` does not have it yet: the development database is asked
202
+ * about every time and never remembered.
203
+ */
204
+ async function resolveAskingEveryTime(envSession, envLoad, opts) {
205
+ const deployEnv = process.env.DEPLOY_ENV ?? "";
206
+ const remoteCandidate = (process.env.DEV_DB ?? "") === "" && (opts.explicit === "development" || opts.explicit === void 0 && (deployEnv === "" || deployEnv === "development")) ? await envSession.developmentRemoteCandidate(opts.root) : void 0;
207
+ const localStackOnline = typeof remoteCandidate === "string" ? await envLoad.probeLocalStack() : void 0;
208
+ return envSession.resolveSessionTier({
209
+ explicit: opts.explicit,
210
+ deployEnv: process.env.DEPLOY_ENV,
211
+ devDb: process.env.DEV_DB,
212
+ available: opts.available,
213
+ isTTY: process.stdin.isTTY === true,
214
+ prompt: promptTier,
215
+ promptMessage: "Which environment should this session use?",
216
+ remoteCandidate,
217
+ localStackOnline
218
+ });
219
+ }
220
+ /**
200
221
  * Resolves the session's deploy tier, enters it (or defers entry to the
201
222
  * menu — see this file's header), and hands off to `cli.ts`.
202
223
  *
@@ -238,19 +259,22 @@ async function launch(argv) {
238
259
  process.stderr.write("devtools: no tier named. With no terminal (or CI=true) the tier must be explicit: pass --tier <development:local|development:remote|staging|production> or set DEPLOY_ENV.\n");
239
260
  process.exit(1);
240
261
  }
241
- const deployEnv = process.env.DEPLOY_ENV ?? "";
242
- const remoteCandidate = !noEnv && (process.env.DEV_DB ?? "") === "" && (explicit === "development" || explicit === void 0 && (deployEnv === "" || deployEnv === "development")) ? await envSession.developmentRemoteCandidate(findRepoRoot()) : void 0;
243
- const localStackOnline = typeof remoteCandidate === "string" ? await envLoad.probeLocalStack() : void 0;
244
- const resolution = noEnv ? resolveWithoutEnv(envSession, explicit) : await envSession.resolveSessionTier({
262
+ const repoRoot = findRepoRoot();
263
+ const available = noEnv ? [] : await envSession.availableTiers(repoRoot);
264
+ const resolution = noEnv ? resolveWithoutEnv(envSession, explicit) : typeof envSession.askSession === "function" ? await envSession.askSession({
265
+ root: repoRoot,
245
266
  explicit,
246
267
  deployEnv: process.env.DEPLOY_ENV,
247
268
  devDb: process.env.DEV_DB,
248
- available: await envSession.availableTiers(findRepoRoot()),
249
- isTTY: process.stdin.isTTY === true,
250
- prompt: promptTier,
251
- promptMessage: "Which environment should this session use?",
252
- remoteCandidate,
253
- localStackOnline
269
+ available,
270
+ canAsk: !isNonInteractive(),
271
+ unanswered: "refuse",
272
+ name: "devtools",
273
+ onCancel: () => bail()
274
+ }) : await resolveAskingEveryTime(envSession, envLoad, {
275
+ root: repoRoot,
276
+ explicit,
277
+ available
254
278
  });
255
279
  if (!resolution.ok) {
256
280
  process.stderr.write(`devtools: ${resolution.reason}\n`);
package/env.ts CHANGED
@@ -148,6 +148,16 @@ declare({
148
148
  scope: "developer",
149
149
  secrecy: "public",
150
150
  }),
151
+ DEV_DB: define(z.enum(["local", "remote"]).optional(), {
152
+ doc:
153
+ "Which development database this machine uses when .env names a " +
154
+ "remote DB_URL: local (the Docker stack) or remote (that DB_URL). " +
155
+ "Written by the first-run question in with-env and devtools when " +
156
+ 'you choose "Remember my decision"; delete it to be asked again. ' +
157
+ "An exported DEV_DB, or --tier development:local|remote, wins.",
158
+ scope: "developer",
159
+ secrecy: "public",
160
+ }),
151
161
  SKIP_ENV_VALIDATION: define(z.string().optional(), {
152
162
  doc:
153
163
  "Any non-empty value skips env-schema validation, for builds that " +
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@devdogsuga/devtools",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "private": false,
5
5
  "type": "module",
6
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
- "license": "MIT",
7
+ "license": "BSD-3-Clause",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/DevDogsUGA/Backstage.git",
@@ -31,7 +31,7 @@
31
31
  "tsx": "^4.23.12",
32
32
  "typescript": "^6.0.3",
33
33
  "zod": "4.4.3",
34
- "@devdogsuga/telemetry": "0.1.4"
34
+ "@devdogsuga/telemetry": "0.1.5"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@devdogsuga/db": "*",
@@ -51,10 +51,10 @@
51
51
  "eslint": "^9.39.5",
52
52
  "tsdown": "^0.23.0",
53
53
  "vitest": "^4.1.11",
54
- "@devdogsuga/db": "0.1.3",
54
+ "@devdogsuga/db": "0.1.4",
55
55
  "@devdogsuga/env": "0.1.5",
56
- "@devdogsuga/cli-core": "0.0.0",
57
- "@devdogsuga/config": "0.1.2"
56
+ "@devdogsuga/config": "0.1.3",
57
+ "@devdogsuga/cli-core": "0.0.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown && node scripts/write-build-info.mjs && node ../../scripts/check-bundle-imports.mjs",