@stackable-labs/cli-app-extension 1.36.0 → 1.36.2

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 (2) hide show
  1. package/dist/index.js +38 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { render } from "ink";
9
9
  import { readFile as readFile3 } from "fs/promises";
10
10
  import { join as join3 } from "path";
11
11
  import { Box as Box15, Text as Text15, useApp } from "ink";
12
- import { useCallback, useState as useState10 } from "react";
12
+ import { useCallback, useEffect as useEffect4, useState as useState10 } from "react";
13
13
 
14
14
  // src/components/Confirm.tsx
15
15
  import { Box as Box2, Text as Text2, useFocus, useFocusManager, useInput as useInput2 } from "ink";
@@ -1813,7 +1813,13 @@ var deriveRegistryPermissions = (targets) => {
1813
1813
  };
1814
1814
  var App = ({ command, token, userId, orgId, initialName, initialExtensionId, options }) => {
1815
1815
  const { exit } = useApp();
1816
- const [step, setStep] = useState10("app");
1816
+ const [step, setStep] = useState10(() => {
1817
+ if (options?.appId) {
1818
+ const base = STEPS[command];
1819
+ return base.find((s) => s !== "app") ?? "app";
1820
+ }
1821
+ return "app";
1822
+ });
1817
1823
  const [name, setName] = useState10(initialName ?? options?.name ?? "");
1818
1824
  const [extensionId, setExtensionId] = useState10(initialExtensionId ?? "");
1819
1825
  const [extensionVersion, setExtensionVersion] = useState10("");
@@ -1985,6 +1991,21 @@ var App = ({ command, token, userId, orgId, initialName, initialExtensionId, opt
1985
1991
  setStep("name");
1986
1992
  }
1987
1993
  };
1994
+ useEffect4(() => {
1995
+ if (!options?.appId) return;
1996
+ fetchApps(token).then((apps) => {
1997
+ const app = apps.find((a) => a.id === options.appId);
1998
+ if (app) {
1999
+ handleAppSelect(app);
2000
+ } else {
2001
+ setErrorMessage(`App "${options.appId}" not found or is disabled.`);
2002
+ setStep("error");
2003
+ }
2004
+ }).catch((err) => {
2005
+ setErrorMessage(err instanceof Error ? err.message : String(err));
2006
+ setStep("error");
2007
+ });
2008
+ }, []);
1988
2009
  const handleExtensionSelect = async (ext) => {
1989
2010
  setName(ext.manifest.name);
1990
2011
  setExtensionId(ext.id);
@@ -2369,7 +2390,7 @@ var App = ({ command, token, userId, orgId, initialName, initialExtensionId, opt
2369
2390
  };
2370
2391
 
2371
2392
  // src/components/DevApp.tsx
2372
- import { useRef, useState as useState13, useEffect as useEffect6, useCallback as useCallback3 } from "react";
2393
+ import { useRef, useState as useState13, useEffect as useEffect7, useCallback as useCallback3 } from "react";
2373
2394
  import { useInput as useInput12, Box as Box19, Text as Text19 } from "ink";
2374
2395
 
2375
2396
  // src/lib/devServer.ts
@@ -2443,12 +2464,12 @@ var startTunnel = async (port) => {
2443
2464
 
2444
2465
  // src/components/DevSetup.tsx
2445
2466
  import { Box as Box16, Text as Text16 } from "ink";
2446
- import { useState as useState11, useEffect as useEffect4 } from "react";
2467
+ import { useState as useState11, useEffect as useEffect5 } from "react";
2447
2468
  import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
2448
2469
  var DevSetup = ({ initialContext, token, onReady }) => {
2449
2470
  const [step, setStep] = useState11("app");
2450
2471
  const [selectedApp, setSelectedApp] = useState11(null);
2451
- useEffect4(() => {
2472
+ useEffect5(() => {
2452
2473
  if (initialContext.appId) {
2453
2474
  setStep("extension");
2454
2475
  }
@@ -2491,7 +2512,7 @@ var DevSetup = ({ initialContext, token, onReady }) => {
2491
2512
 
2492
2513
  // src/components/DevDashboard.tsx
2493
2514
  import { Box as Box18, Text as Text18, useInput as useInput11 } from "ink";
2494
- import { useEffect as useEffect5, useMemo } from "react";
2515
+ import { useEffect as useEffect6, useMemo } from "react";
2495
2516
 
2496
2517
  // src/components/CopyableField.tsx
2497
2518
  import { useState as useState12, useCallback as useCallback2 } from "react";
@@ -2570,7 +2591,7 @@ var DevDashboard = ({
2570
2591
  devSessionToken,
2571
2592
  onQuit
2572
2593
  }) => {
2573
- useEffect5(() => {
2594
+ useEffect6(() => {
2574
2595
  const handler = () => {
2575
2596
  onQuit();
2576
2597
  };
@@ -2727,7 +2748,7 @@ var DevApp = ({ token, userId, orgId, options = {} }) => {
2727
2748
  const [devSessionToken, setDevSessionToken] = useState13(null);
2728
2749
  const shuttingDown = useRef(false);
2729
2750
  const useTunnel = options.tunnel !== false;
2730
- useEffect6(() => {
2751
+ useEffect7(() => {
2731
2752
  const projectRoot = options.dir || process.cwd();
2732
2753
  console.log(`[dev] Reading context from ${projectRoot}`);
2733
2754
  readDevContext(projectRoot).then((ctx) => {
@@ -2807,7 +2828,7 @@ var DevApp = ({ token, userId, orgId, options = {} }) => {
2807
2828
  console.log("[dev] Ready");
2808
2829
  setState("running");
2809
2830
  }, [devContext, token, options.extensionPort, options.previewPort, useTunnel]);
2810
- useEffect6(() => {
2831
+ useEffect7(() => {
2811
2832
  if (state === "setup" && devContext && devContext.appId && devContext.extensionId) {
2812
2833
  handleSetupReady({
2813
2834
  appId: devContext.appId,
@@ -2893,7 +2914,7 @@ var DevApp = ({ token, userId, orgId, options = {} }) => {
2893
2914
  // src/components/AIScaffold.tsx
2894
2915
  import { Box as Box20, Text as Text20, useApp as useApp2 } from "ink";
2895
2916
  import Spinner4 from "ink-spinner";
2896
- import { useState as useState14, useEffect as useEffect7 } from "react";
2917
+ import { useState as useState14, useEffect as useEffect8 } from "react";
2897
2918
 
2898
2919
  // src/lib/aiDocs.ts
2899
2920
  import { existsSync, readFileSync } from "fs";
@@ -2952,7 +2973,7 @@ var AIScaffold = ({ version: version2 }) => {
2952
2973
  const [state, setState] = useState14("validating");
2953
2974
  const [files, setFiles] = useState14([]);
2954
2975
  const [errorMessage, setErrorMessage] = useState14("");
2955
- useEffect7(() => {
2976
+ useEffect8(() => {
2956
2977
  const run = async () => {
2957
2978
  const projectDir = process.cwd();
2958
2979
  const check = isExtensionProject(projectDir);
@@ -3014,7 +3035,7 @@ import { createServer } from "http";
3014
3035
  import { Box as Box21, Text as Text21, useApp as useApp3 } from "ink";
3015
3036
  import Spinner5 from "ink-spinner";
3016
3037
  import open from "open";
3017
- import { useState as useState15, useEffect as useEffect8 } from "react";
3038
+ import { useState as useState15, useEffect as useEffect9 } from "react";
3018
3039
 
3019
3040
  // src/lib/auth.ts
3020
3041
  import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir2, unlink } from "fs/promises";
@@ -3083,7 +3104,7 @@ var AuthLogin = ({ dashboardUrl }) => {
3083
3104
  const [userIdLabel, setUserIdLabel] = useState15("");
3084
3105
  const [orgIdLabel, setOrgIdLabel] = useState15("");
3085
3106
  const [errorMessage, setErrorMessage] = useState15("");
3086
- useEffect8(() => {
3107
+ useEffect9(() => {
3087
3108
  let server;
3088
3109
  let timeout;
3089
3110
  const run = async () => {
@@ -3196,12 +3217,12 @@ var AuthLogin = ({ dashboardUrl }) => {
3196
3217
  };
3197
3218
 
3198
3219
  // src/components/AuthLogout.tsx
3199
- import { useEffect as useEffect9 } from "react";
3220
+ import { useEffect as useEffect10 } from "react";
3200
3221
  import { Box as Box22, Text as Text22, useApp as useApp4 } from "ink";
3201
3222
  import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
3202
3223
  var AuthLogout = () => {
3203
3224
  const { exit } = useApp4();
3204
- useEffect9(() => {
3225
+ useEffect10(() => {
3205
3226
  exit();
3206
3227
  }, [exit]);
3207
3228
  return /* @__PURE__ */ jsxs21(Box22, { flexDirection: "column", children: [
@@ -3214,12 +3235,12 @@ var AuthLogout = () => {
3214
3235
  };
3215
3236
 
3216
3237
  // src/components/AuthStatus.tsx
3217
- import { useEffect as useEffect10 } from "react";
3238
+ import { useEffect as useEffect11 } from "react";
3218
3239
  import { useApp as useApp5, Box as Box23, Text as Text23 } from "ink";
3219
3240
  import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
3220
3241
  var AuthStatus = ({ state, userId, orgId, expiry }) => {
3221
3242
  const { exit } = useApp5();
3222
- useEffect10(() => {
3243
+ useEffect11(() => {
3223
3244
  exit();
3224
3245
  }, [exit]);
3225
3246
  return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackable-labs/cli-app-extension",
3
- "version": "1.36.0",
3
+ "version": "1.36.2",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "bin": {