@stackable-labs/cli-app-extension 1.36.1 → 1.36.3
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/dist/index.js +39 -24
- 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(
|
|
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("");
|
|
@@ -1861,7 +1867,6 @@ var App = ({ command, token, userId, orgId, initialName, initialExtensionId, opt
|
|
|
1861
1867
|
if (command === "update" /* UPDATE */ && initialExtensionId) skipped.add("extensionSelect");
|
|
1862
1868
|
if (studioProject) {
|
|
1863
1869
|
if (command === "create" /* CREATE */) {
|
|
1864
|
-
skipped.add("name");
|
|
1865
1870
|
skipped.add("template");
|
|
1866
1871
|
skipped.add("targets");
|
|
1867
1872
|
}
|
|
@@ -1900,12 +1905,7 @@ var App = ({ command, token, userId, orgId, initialName, initialExtensionId, opt
|
|
|
1900
1905
|
setExtensionId(project.extensionId);
|
|
1901
1906
|
}
|
|
1902
1907
|
if (command === "create" /* CREATE */) {
|
|
1903
|
-
|
|
1904
|
-
setOutputDir(join3(process.cwd(), toKebabCase(project.name)));
|
|
1905
|
-
setStep("confirm");
|
|
1906
|
-
} else {
|
|
1907
|
-
setStep("settings");
|
|
1908
|
-
}
|
|
1908
|
+
setStep("name");
|
|
1909
1909
|
} else if (command === "scaffold" /* SCAFFOLD */) {
|
|
1910
1910
|
if (project.extensionId) {
|
|
1911
1911
|
setStep("confirmTargets");
|
|
@@ -1985,6 +1985,21 @@ var App = ({ command, token, userId, orgId, initialName, initialExtensionId, opt
|
|
|
1985
1985
|
setStep("name");
|
|
1986
1986
|
}
|
|
1987
1987
|
};
|
|
1988
|
+
useEffect4(() => {
|
|
1989
|
+
if (!options?.appId) return;
|
|
1990
|
+
fetchApps(token).then((apps) => {
|
|
1991
|
+
const app = apps.find((a) => a.id === options.appId);
|
|
1992
|
+
if (app) {
|
|
1993
|
+
handleAppSelect(app);
|
|
1994
|
+
} else {
|
|
1995
|
+
setErrorMessage(`App "${options.appId}" not found or is disabled.`);
|
|
1996
|
+
setStep("error");
|
|
1997
|
+
}
|
|
1998
|
+
}).catch((err) => {
|
|
1999
|
+
setErrorMessage(err instanceof Error ? err.message : String(err));
|
|
2000
|
+
setStep("error");
|
|
2001
|
+
});
|
|
2002
|
+
}, []);
|
|
1988
2003
|
const handleExtensionSelect = async (ext) => {
|
|
1989
2004
|
setName(ext.manifest.name);
|
|
1990
2005
|
setExtensionId(ext.id);
|
|
@@ -2369,7 +2384,7 @@ var App = ({ command, token, userId, orgId, initialName, initialExtensionId, opt
|
|
|
2369
2384
|
};
|
|
2370
2385
|
|
|
2371
2386
|
// src/components/DevApp.tsx
|
|
2372
|
-
import { useRef, useState as useState13, useEffect as
|
|
2387
|
+
import { useRef, useState as useState13, useEffect as useEffect7, useCallback as useCallback3 } from "react";
|
|
2373
2388
|
import { useInput as useInput12, Box as Box19, Text as Text19 } from "ink";
|
|
2374
2389
|
|
|
2375
2390
|
// src/lib/devServer.ts
|
|
@@ -2443,12 +2458,12 @@ var startTunnel = async (port) => {
|
|
|
2443
2458
|
|
|
2444
2459
|
// src/components/DevSetup.tsx
|
|
2445
2460
|
import { Box as Box16, Text as Text16 } from "ink";
|
|
2446
|
-
import { useState as useState11, useEffect as
|
|
2461
|
+
import { useState as useState11, useEffect as useEffect5 } from "react";
|
|
2447
2462
|
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2448
2463
|
var DevSetup = ({ initialContext, token, onReady }) => {
|
|
2449
2464
|
const [step, setStep] = useState11("app");
|
|
2450
2465
|
const [selectedApp, setSelectedApp] = useState11(null);
|
|
2451
|
-
|
|
2466
|
+
useEffect5(() => {
|
|
2452
2467
|
if (initialContext.appId) {
|
|
2453
2468
|
setStep("extension");
|
|
2454
2469
|
}
|
|
@@ -2491,7 +2506,7 @@ var DevSetup = ({ initialContext, token, onReady }) => {
|
|
|
2491
2506
|
|
|
2492
2507
|
// src/components/DevDashboard.tsx
|
|
2493
2508
|
import { Box as Box18, Text as Text18, useInput as useInput11 } from "ink";
|
|
2494
|
-
import { useEffect as
|
|
2509
|
+
import { useEffect as useEffect6, useMemo } from "react";
|
|
2495
2510
|
|
|
2496
2511
|
// src/components/CopyableField.tsx
|
|
2497
2512
|
import { useState as useState12, useCallback as useCallback2 } from "react";
|
|
@@ -2570,7 +2585,7 @@ var DevDashboard = ({
|
|
|
2570
2585
|
devSessionToken,
|
|
2571
2586
|
onQuit
|
|
2572
2587
|
}) => {
|
|
2573
|
-
|
|
2588
|
+
useEffect6(() => {
|
|
2574
2589
|
const handler = () => {
|
|
2575
2590
|
onQuit();
|
|
2576
2591
|
};
|
|
@@ -2727,7 +2742,7 @@ var DevApp = ({ token, userId, orgId, options = {} }) => {
|
|
|
2727
2742
|
const [devSessionToken, setDevSessionToken] = useState13(null);
|
|
2728
2743
|
const shuttingDown = useRef(false);
|
|
2729
2744
|
const useTunnel = options.tunnel !== false;
|
|
2730
|
-
|
|
2745
|
+
useEffect7(() => {
|
|
2731
2746
|
const projectRoot = options.dir || process.cwd();
|
|
2732
2747
|
console.log(`[dev] Reading context from ${projectRoot}`);
|
|
2733
2748
|
readDevContext(projectRoot).then((ctx) => {
|
|
@@ -2807,7 +2822,7 @@ var DevApp = ({ token, userId, orgId, options = {} }) => {
|
|
|
2807
2822
|
console.log("[dev] Ready");
|
|
2808
2823
|
setState("running");
|
|
2809
2824
|
}, [devContext, token, options.extensionPort, options.previewPort, useTunnel]);
|
|
2810
|
-
|
|
2825
|
+
useEffect7(() => {
|
|
2811
2826
|
if (state === "setup" && devContext && devContext.appId && devContext.extensionId) {
|
|
2812
2827
|
handleSetupReady({
|
|
2813
2828
|
appId: devContext.appId,
|
|
@@ -2893,7 +2908,7 @@ var DevApp = ({ token, userId, orgId, options = {} }) => {
|
|
|
2893
2908
|
// src/components/AIScaffold.tsx
|
|
2894
2909
|
import { Box as Box20, Text as Text20, useApp as useApp2 } from "ink";
|
|
2895
2910
|
import Spinner4 from "ink-spinner";
|
|
2896
|
-
import { useState as useState14, useEffect as
|
|
2911
|
+
import { useState as useState14, useEffect as useEffect8 } from "react";
|
|
2897
2912
|
|
|
2898
2913
|
// src/lib/aiDocs.ts
|
|
2899
2914
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -2952,7 +2967,7 @@ var AIScaffold = ({ version: version2 }) => {
|
|
|
2952
2967
|
const [state, setState] = useState14("validating");
|
|
2953
2968
|
const [files, setFiles] = useState14([]);
|
|
2954
2969
|
const [errorMessage, setErrorMessage] = useState14("");
|
|
2955
|
-
|
|
2970
|
+
useEffect8(() => {
|
|
2956
2971
|
const run = async () => {
|
|
2957
2972
|
const projectDir = process.cwd();
|
|
2958
2973
|
const check = isExtensionProject(projectDir);
|
|
@@ -3014,7 +3029,7 @@ import { createServer } from "http";
|
|
|
3014
3029
|
import { Box as Box21, Text as Text21, useApp as useApp3 } from "ink";
|
|
3015
3030
|
import Spinner5 from "ink-spinner";
|
|
3016
3031
|
import open from "open";
|
|
3017
|
-
import { useState as useState15, useEffect as
|
|
3032
|
+
import { useState as useState15, useEffect as useEffect9 } from "react";
|
|
3018
3033
|
|
|
3019
3034
|
// src/lib/auth.ts
|
|
3020
3035
|
import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir2, unlink } from "fs/promises";
|
|
@@ -3083,7 +3098,7 @@ var AuthLogin = ({ dashboardUrl }) => {
|
|
|
3083
3098
|
const [userIdLabel, setUserIdLabel] = useState15("");
|
|
3084
3099
|
const [orgIdLabel, setOrgIdLabel] = useState15("");
|
|
3085
3100
|
const [errorMessage, setErrorMessage] = useState15("");
|
|
3086
|
-
|
|
3101
|
+
useEffect9(() => {
|
|
3087
3102
|
let server;
|
|
3088
3103
|
let timeout;
|
|
3089
3104
|
const run = async () => {
|
|
@@ -3196,12 +3211,12 @@ var AuthLogin = ({ dashboardUrl }) => {
|
|
|
3196
3211
|
};
|
|
3197
3212
|
|
|
3198
3213
|
// src/components/AuthLogout.tsx
|
|
3199
|
-
import { useEffect as
|
|
3214
|
+
import { useEffect as useEffect10 } from "react";
|
|
3200
3215
|
import { Box as Box22, Text as Text22, useApp as useApp4 } from "ink";
|
|
3201
3216
|
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3202
3217
|
var AuthLogout = () => {
|
|
3203
3218
|
const { exit } = useApp4();
|
|
3204
|
-
|
|
3219
|
+
useEffect10(() => {
|
|
3205
3220
|
exit();
|
|
3206
3221
|
}, [exit]);
|
|
3207
3222
|
return /* @__PURE__ */ jsxs21(Box22, { flexDirection: "column", children: [
|
|
@@ -3214,12 +3229,12 @@ var AuthLogout = () => {
|
|
|
3214
3229
|
};
|
|
3215
3230
|
|
|
3216
3231
|
// src/components/AuthStatus.tsx
|
|
3217
|
-
import { useEffect as
|
|
3232
|
+
import { useEffect as useEffect11 } from "react";
|
|
3218
3233
|
import { useApp as useApp5, Box as Box23, Text as Text23 } from "ink";
|
|
3219
3234
|
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3220
3235
|
var AuthStatus = ({ state, userId, orgId, expiry }) => {
|
|
3221
3236
|
const { exit } = useApp5();
|
|
3222
|
-
|
|
3237
|
+
useEffect11(() => {
|
|
3223
3238
|
exit();
|
|
3224
3239
|
}, [exit]);
|
|
3225
3240
|
return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", children: [
|