hacklab 0.14.0 → 0.14.1

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 CHANGED
@@ -288,6 +288,9 @@ you logged in.
288
288
  the full precedence.
289
289
  - `HACKLAB_SESSION_PATH` — custom path for the session file
290
290
  (default `~/.hacklab/session.json`).
291
+ - `HACKLAB_DEV` — set to `1` to mark this as a developer run. `hacklab whoami`
292
+ then always prints the backend host, including production (which it otherwise
293
+ leaves out as noise). `0`, `false`, empty and unset are off.
291
294
  - `HACKLAB_NO_UPDATE_CHECK` — set to any value to disable the once-a-day
292
295
  "newer version available" nudge. The check is already skipped for piped /
293
296
  scripted / `--json` runs; this turns it off for interactive runs too.
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAGA,wBAAsB,MAAM,kBAoB3B"}
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAmBA,wBAAsB,MAAM,kBAsB3B"}
@@ -1,5 +1,21 @@
1
1
  import { envNameForUrl, loadSession, resolveAppUrl } from '../session.js';
2
2
  import { dim, error, info, success } from '../ui.js';
3
+ /**
4
+ * `HACKLAB_DEV` — an explicit developer opt-in, read at call time so a test (or
5
+ * a `hacklab` invoked from a script) can set it per run. Unset, empty, `0` and
6
+ * `false` are off; anything else (typically `1`) is on, so `HACKLAB_DEV=0`
7
+ * never turns something on.
8
+ *
9
+ * It's an env var rather than a filesystem guess: a deployed copy of the repo
10
+ * tree (nixpacks-style, `/app`) looks exactly like a source checkout on disk,
11
+ * so no path heuristic can tell a developer apart from a deploy.
12
+ */
13
+ function devMode() {
14
+ const raw = process.env.HACKLAB_DEV;
15
+ if (!raw)
16
+ return false;
17
+ return raw !== '0' && raw !== 'false';
18
+ }
3
19
  export async function whoami() {
4
20
  const session = await loadSession();
5
21
  if (!session) {
@@ -12,9 +28,11 @@ export async function whoami() {
12
28
  success(session.handle ? `@${session.handle}` : session.email);
13
29
  if (session.handle)
14
30
  info(session.email);
15
- // Production is the default — naming it is noise. Local/custom backends
16
- // are the case where you need to see which one you're talking to.
17
- if (envNameForUrl(server) !== 'production')
31
+ // Production is the default — for users, naming it is noise, and only a
32
+ // local/custom backend is worth calling out. Developers opt in with
33
+ // HACKLAB_DEV=1 to always see which backend they're talking to, production
34
+ // included.
35
+ if (envNameForUrl(server) !== 'production' || devMode())
18
36
  info(server);
19
37
  if (server !== loginServer) {
20
38
  info(dim(`logged in against ${loginServer}`));
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEpD,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAA;IAEnC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,KAAK,CAAC,eAAe,CAAC,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAA;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAErD,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9D,IAAI,OAAO,CAAC,MAAM;QAAE,IAAI,CAAC,OAAO,C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CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9D,IAAI,OAAO,CAAC,MAAM;QAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACvC,wEAAwE;IACxE,oEAAoE;IACpE,2EAA2E;IAC3E,YAAY;IACZ,IAAI,aAAa,CAAC,MAAM,CAAC,KAAK,YAAY,IAAI,OAAO,EAAE;QAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACrE,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,qBAAqB,WAAW,EAAE,CAAC,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hacklab",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"