@basictech/cli 0.0.30 → 0.0.32
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 +205 -217
- package/dist/lib/schema.d.ts +1 -0
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/schema.js +9 -0
- package/dist/lib/schema.js.map +1 -1
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +27 -8
- package/dist/lib/version.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
2
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
4
|
var __esm = (fn, res) => function __init() {
|
|
10
5
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
6
|
};
|
|
@@ -13,22 +8,6 @@ var __export = (target, all) => {
|
|
|
13
8
|
for (var name in all)
|
|
14
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
10
|
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
-
for (let key of __getOwnPropNames(from))
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
32
11
|
|
|
33
12
|
// dist/lib/constants.js
|
|
34
13
|
var CONSTANTS, COMMANDS, MESSAGES;
|
|
@@ -70,32 +49,44 @@ var init_constants = __esm({
|
|
|
70
49
|
});
|
|
71
50
|
|
|
72
51
|
// dist/lib/version.js
|
|
52
|
+
import { readFileSync } from "fs";
|
|
53
|
+
import { join, dirname } from "path";
|
|
54
|
+
import { fileURLToPath } from "url";
|
|
73
55
|
function getVersion() {
|
|
74
56
|
if (cachedVersion) {
|
|
75
57
|
return cachedVersion;
|
|
76
58
|
}
|
|
77
59
|
try {
|
|
78
|
-
const __filename =
|
|
79
|
-
const __dirname =
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
61
|
+
const __dirname = dirname(__filename);
|
|
62
|
+
const possiblePaths = [
|
|
63
|
+
join(__dirname, "package.json"),
|
|
64
|
+
join(__dirname, "../package.json"),
|
|
65
|
+
join(__dirname, "../../package.json"),
|
|
66
|
+
join(__dirname, "../../../package.json")
|
|
67
|
+
];
|
|
68
|
+
for (const path4 of possiblePaths) {
|
|
69
|
+
try {
|
|
70
|
+
const packageJson = JSON.parse(readFileSync(path4, "utf8"));
|
|
71
|
+
if (packageJson.name === "@basictech/cli") {
|
|
72
|
+
cachedVersion = packageJson.version;
|
|
73
|
+
return cachedVersion;
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
throw new Error("Could not find package.json");
|
|
84
80
|
} catch (error) {
|
|
85
|
-
|
|
86
|
-
const fallbackVersion = "0.0.22";
|
|
81
|
+
const fallbackVersion = "0.0.31";
|
|
87
82
|
cachedVersion = fallbackVersion;
|
|
88
83
|
return fallbackVersion;
|
|
89
84
|
}
|
|
90
85
|
}
|
|
91
|
-
var
|
|
86
|
+
var cachedVersion;
|
|
92
87
|
var init_version = __esm({
|
|
93
88
|
"dist/lib/version.js"() {
|
|
94
89
|
"use strict";
|
|
95
|
-
import_fs = require("fs");
|
|
96
|
-
import_path = require("path");
|
|
97
|
-
import_url = require("url");
|
|
98
|
-
import_meta = {};
|
|
99
90
|
cachedVersion = null;
|
|
100
91
|
}
|
|
101
92
|
});
|
|
@@ -183,6 +174,10 @@ var init_errors = __esm({
|
|
|
183
174
|
});
|
|
184
175
|
|
|
185
176
|
// dist/lib/platform.js
|
|
177
|
+
import { exec } from "child_process";
|
|
178
|
+
import { promisify } from "util";
|
|
179
|
+
import * as os from "os";
|
|
180
|
+
import * as path from "path";
|
|
186
181
|
function getConfigPath() {
|
|
187
182
|
const home = os.homedir();
|
|
188
183
|
return path.join(home, CONSTANTS.CLI_DIR, CONSTANTS.TOKEN_FILE);
|
|
@@ -275,26 +270,22 @@ function findSimilarCommands(input) {
|
|
|
275
270
|
function generateSlug(name) {
|
|
276
271
|
return name.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
277
272
|
}
|
|
278
|
-
var
|
|
273
|
+
var execAsync;
|
|
279
274
|
var init_platform = __esm({
|
|
280
275
|
"dist/lib/platform.js"() {
|
|
281
276
|
"use strict";
|
|
282
|
-
import_child_process = require("child_process");
|
|
283
|
-
import_util = require("util");
|
|
284
|
-
os = __toESM(require("os"), 1);
|
|
285
|
-
path = __toESM(require("path"), 1);
|
|
286
277
|
init_constants();
|
|
287
|
-
execAsync =
|
|
278
|
+
execAsync = promisify(exec);
|
|
288
279
|
}
|
|
289
280
|
});
|
|
290
281
|
|
|
291
282
|
// dist/lib/auth.js
|
|
292
|
-
|
|
283
|
+
import { createServer } from "http";
|
|
284
|
+
import { promises as fs } from "fs";
|
|
285
|
+
var AuthService;
|
|
293
286
|
var init_auth = __esm({
|
|
294
287
|
"dist/lib/auth.js"() {
|
|
295
288
|
"use strict";
|
|
296
|
-
import_http = require("http");
|
|
297
|
-
import_fs2 = require("fs");
|
|
298
289
|
init_constants();
|
|
299
290
|
init_platform();
|
|
300
291
|
init_errors();
|
|
@@ -324,7 +315,7 @@ var init_auth = __esm({
|
|
|
324
315
|
async getToken() {
|
|
325
316
|
try {
|
|
326
317
|
const tokenPath = getConfigPath();
|
|
327
|
-
const tokenData = await
|
|
318
|
+
const tokenData = await fs.readFile(tokenPath, "utf8");
|
|
328
319
|
const token = JSON.parse(tokenData);
|
|
329
320
|
if (token.expires_at && Date.now() > token.expires_at) {
|
|
330
321
|
const refreshedToken = await this.refreshToken(token);
|
|
@@ -356,7 +347,7 @@ var init_auth = __esm({
|
|
|
356
347
|
}
|
|
357
348
|
async startOAuthFlow() {
|
|
358
349
|
return new Promise((resolve, reject) => {
|
|
359
|
-
const server =
|
|
350
|
+
const server = createServer((req, res) => {
|
|
360
351
|
if (req.url?.startsWith("/callback")) {
|
|
361
352
|
const url = new URL(req.url, CONSTANTS.OAUTH_REDIRECT);
|
|
362
353
|
const code = url.searchParams.get("code");
|
|
@@ -451,13 +442,13 @@ var init_auth = __esm({
|
|
|
451
442
|
async saveToken(token) {
|
|
452
443
|
const tokenPath = getConfigPath();
|
|
453
444
|
const configDir = getConfigDir();
|
|
454
|
-
await
|
|
455
|
-
await
|
|
445
|
+
await fs.mkdir(configDir, { recursive: true });
|
|
446
|
+
await fs.writeFile(tokenPath, JSON.stringify(token, null, 2), { mode: 384 });
|
|
456
447
|
}
|
|
457
448
|
async deleteToken() {
|
|
458
449
|
const tokenPath = getConfigPath();
|
|
459
450
|
try {
|
|
460
|
-
await
|
|
451
|
+
await fs.unlink(tokenPath);
|
|
461
452
|
} catch (error) {
|
|
462
453
|
if (error.code !== "ENOENT") {
|
|
463
454
|
throw error;
|
|
@@ -806,6 +797,7 @@ var update_exports = {};
|
|
|
806
797
|
__export(update_exports, {
|
|
807
798
|
UpdateCommand: () => UpdateCommand
|
|
808
799
|
});
|
|
800
|
+
import { spawn } from "child_process";
|
|
809
801
|
async function UpdateCommand() {
|
|
810
802
|
try {
|
|
811
803
|
if (!await isOnline()) {
|
|
@@ -834,7 +826,7 @@ async function UpdateCommand() {
|
|
|
834
826
|
}
|
|
835
827
|
async function updatePackage() {
|
|
836
828
|
return new Promise((resolve, reject) => {
|
|
837
|
-
const updateProcess =
|
|
829
|
+
const updateProcess = spawn("npm", ["update", "-g", "@basictech/cli"], {
|
|
838
830
|
stdio: "pipe",
|
|
839
831
|
shell: true
|
|
840
832
|
});
|
|
@@ -872,11 +864,9 @@ async function updatePackage() {
|
|
|
872
864
|
});
|
|
873
865
|
});
|
|
874
866
|
}
|
|
875
|
-
var import_child_process2;
|
|
876
867
|
var init_update = __esm({
|
|
877
868
|
"dist/commands/update.js"() {
|
|
878
869
|
"use strict";
|
|
879
|
-
import_child_process2 = require("child_process");
|
|
880
870
|
init_version();
|
|
881
871
|
init_api();
|
|
882
872
|
init_platform();
|
|
@@ -901,16 +891,19 @@ var init_debug = __esm({
|
|
|
901
891
|
});
|
|
902
892
|
|
|
903
893
|
// dist/components/Table.js
|
|
894
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
895
|
+
import { useState, useEffect } from "react";
|
|
896
|
+
import { Box, Text, useInput } from "ink";
|
|
904
897
|
function Table({ columns, rows, onSelect, onCopy, onOpen, onNew, onExit, helpText }) {
|
|
905
|
-
const [selectedIndex, setSelectedIndex] =
|
|
906
|
-
const [notification, setNotification] =
|
|
898
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
899
|
+
const [notification, setNotification] = useState("");
|
|
907
900
|
const defaultHelpText = {
|
|
908
901
|
copyAction: "'c' to copy project ID",
|
|
909
902
|
openAction: "'o' to open in browser",
|
|
910
903
|
newAction: void 0
|
|
911
904
|
};
|
|
912
905
|
const currentHelpText = helpText || defaultHelpText;
|
|
913
|
-
|
|
906
|
+
useInput((input, key) => {
|
|
914
907
|
if (key.upArrow && rows.length > 0) {
|
|
915
908
|
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
916
909
|
} else if (key.downArrow && rows.length > 0) {
|
|
@@ -934,57 +927,53 @@ function Table({ columns, rows, onSelect, onCopy, onOpen, onNew, onExit, helpTex
|
|
|
934
927
|
}
|
|
935
928
|
}
|
|
936
929
|
});
|
|
937
|
-
|
|
930
|
+
useEffect(() => {
|
|
938
931
|
if (selectedIndex >= rows.length) {
|
|
939
932
|
setSelectedIndex(Math.max(0, rows.length - 1));
|
|
940
933
|
}
|
|
941
934
|
}, [rows.length, selectedIndex]);
|
|
942
|
-
const renderHeader = () => (
|
|
935
|
+
const renderHeader = () => _jsx(Box, { borderStyle: "single", borderBottom: true, paddingX: 1, children: _jsx(Box, { children: columns.map((column, index) => _jsx(Box, { width: column.width, marginRight: index < columns.length - 1 ? 1 : 0, children: _jsx(Text, { bold: true, children: column.title }) }, column.key)) }) });
|
|
943
936
|
const renderRow = (row, index) => {
|
|
944
937
|
const isSelected = index === selectedIndex;
|
|
945
|
-
return (
|
|
938
|
+
return _jsx(Box, { children: _jsx(Box, { paddingX: 1, children: columns.map((column, colIndex) => _jsx(Box, { width: column.width, marginRight: colIndex < columns.length - 1 ? 1 : 0, children: _jsx(Text, { color: isSelected ? "black" : void 0, backgroundColor: isSelected ? "magenta" : void 0, children: (row[column.key] || "").substring(0, column.width - 1) }) }, column.key)) }) }, index);
|
|
946
939
|
};
|
|
947
940
|
const renderHelp = () => {
|
|
948
941
|
const mainActionsText = [
|
|
949
942
|
currentHelpText.copyAction,
|
|
950
943
|
currentHelpText.openAction
|
|
951
944
|
].filter(Boolean).join(" \u2022 ");
|
|
952
|
-
return (
|
|
945
|
+
return _jsxs(Box, { marginTop: 2, children: [notification && _jsx(Box, { marginBottom: 2, children: _jsx(Text, { color: "blue", children: notification }) }), _jsxs(Box, { flexDirection: "column", children: [currentHelpText.newAction && _jsx(Text, { color: "gray", children: currentHelpText.newAction }), _jsx(Text, { color: "gray", children: mainActionsText }), _jsx(Text, { color: "gray", children: "\u2191/\u2193 to navigate \u2022 esc to quit" })] })] });
|
|
953
946
|
};
|
|
954
947
|
if (rows.length === 0) {
|
|
955
948
|
const itemType = helpText?.copyAction.includes("team") ? "teams" : "projects";
|
|
956
|
-
return (
|
|
949
|
+
return _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["No ", itemType, " found."] }), _jsxs(Box, { marginTop: 2, flexDirection: "column", children: [currentHelpText.newAction && _jsx(Text, { color: "gray", children: currentHelpText.newAction }), _jsx(Text, { color: "gray", children: "Press esc to quit" })] })] });
|
|
957
950
|
}
|
|
958
|
-
return (
|
|
951
|
+
return _jsxs(Box, { flexDirection: "column", children: [renderHeader(), _jsx(Box, { flexDirection: "column", children: rows.map((row, index) => renderRow(row, index)) }), renderHelp()] });
|
|
959
952
|
}
|
|
960
|
-
var import_jsx_runtime, import_react, import_ink;
|
|
961
953
|
var init_Table = __esm({
|
|
962
954
|
"dist/components/Table.js"() {
|
|
963
955
|
"use strict";
|
|
964
|
-
import_jsx_runtime = require("react/jsx-runtime");
|
|
965
|
-
import_react = require("react");
|
|
966
|
-
import_ink = require("ink");
|
|
967
956
|
}
|
|
968
957
|
});
|
|
969
958
|
|
|
970
959
|
// dist/components/Spinner.js
|
|
971
|
-
|
|
960
|
+
import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
961
|
+
import React from "react";
|
|
962
|
+
import { Text as Text2 } from "ink";
|
|
963
|
+
var spinnerFrames, Spinner;
|
|
972
964
|
var init_Spinner = __esm({
|
|
973
965
|
"dist/components/Spinner.js"() {
|
|
974
966
|
"use strict";
|
|
975
|
-
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
976
|
-
import_react2 = __toESM(require("react"), 1);
|
|
977
|
-
import_ink2 = require("ink");
|
|
978
967
|
spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
979
968
|
Spinner = ({ text = "Loading..." }) => {
|
|
980
|
-
const [frame, setFrame] =
|
|
981
|
-
|
|
969
|
+
const [frame, setFrame] = React.useState(0);
|
|
970
|
+
React.useEffect(() => {
|
|
982
971
|
const timer = setInterval(() => {
|
|
983
972
|
setFrame((prev) => (prev + 1) % spinnerFrames.length);
|
|
984
973
|
}, 80);
|
|
985
974
|
return () => clearInterval(timer);
|
|
986
975
|
}, []);
|
|
987
|
-
return (
|
|
976
|
+
return _jsxs2(Text2, { children: [_jsx2(Text2, { color: "cyan", children: spinnerFrames[frame] }), " ", text] });
|
|
988
977
|
};
|
|
989
978
|
}
|
|
990
979
|
});
|
|
@@ -994,13 +983,16 @@ var projects_exports = {};
|
|
|
994
983
|
__export(projects_exports, {
|
|
995
984
|
ProjectsCommand: () => ProjectsCommand
|
|
996
985
|
});
|
|
986
|
+
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
987
|
+
import React2 from "react";
|
|
988
|
+
import { render, Text as Text3 } from "ink";
|
|
997
989
|
function ProjectsApp() {
|
|
998
|
-
const [state, setState] =
|
|
990
|
+
const [state, setState] = React2.useState({
|
|
999
991
|
loading: true,
|
|
1000
992
|
projects: [],
|
|
1001
993
|
error: null
|
|
1002
994
|
});
|
|
1003
|
-
|
|
995
|
+
React2.useEffect(() => {
|
|
1004
996
|
async function loadProjects() {
|
|
1005
997
|
try {
|
|
1006
998
|
if (!await isOnline()) {
|
|
@@ -1046,10 +1038,10 @@ function ProjectsApp() {
|
|
|
1046
1038
|
process.exit(0);
|
|
1047
1039
|
};
|
|
1048
1040
|
if (state.loading) {
|
|
1049
|
-
return (
|
|
1041
|
+
return _jsx3(Spinner, { text: "Loading projects..." });
|
|
1050
1042
|
}
|
|
1051
1043
|
if (state.error) {
|
|
1052
|
-
return (
|
|
1044
|
+
return _jsx3(Text3, { color: "red", children: state.error });
|
|
1053
1045
|
}
|
|
1054
1046
|
const columns = [
|
|
1055
1047
|
{ title: "ID", width: 38, key: "id" },
|
|
@@ -1061,18 +1053,14 @@ function ProjectsApp() {
|
|
|
1061
1053
|
name: project.name,
|
|
1062
1054
|
team_name: project.team_name
|
|
1063
1055
|
}));
|
|
1064
|
-
return (
|
|
1056
|
+
return _jsx3(Table, { columns, rows, onCopy: handleCopy, onOpen: handleOpen, onExit: handleExit });
|
|
1065
1057
|
}
|
|
1066
1058
|
async function ProjectsCommand() {
|
|
1067
|
-
|
|
1059
|
+
render(_jsx3(ProjectsApp, {}));
|
|
1068
1060
|
}
|
|
1069
|
-
var import_jsx_runtime3, import_react3, import_ink3;
|
|
1070
1061
|
var init_projects = __esm({
|
|
1071
1062
|
"dist/commands/projects.js"() {
|
|
1072
1063
|
"use strict";
|
|
1073
|
-
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1074
|
-
import_react3 = __toESM(require("react"), 1);
|
|
1075
|
-
import_ink3 = require("ink");
|
|
1076
1064
|
init_Table();
|
|
1077
1065
|
init_Spinner();
|
|
1078
1066
|
init_api();
|
|
@@ -1083,8 +1071,11 @@ var init_projects = __esm({
|
|
|
1083
1071
|
});
|
|
1084
1072
|
|
|
1085
1073
|
// dist/components/TeamForm.js
|
|
1074
|
+
import { jsx as _jsx4, jsxs as _jsxs3 } from "react/jsx-runtime";
|
|
1075
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
1076
|
+
import { Box as Box2, Text as Text4, useInput as useInput2 } from "ink";
|
|
1086
1077
|
function TeamForm({ title, onSubmit, onCancel }) {
|
|
1087
|
-
const [state, setState] = (
|
|
1078
|
+
const [state, setState] = useState2({
|
|
1088
1079
|
teamName: "",
|
|
1089
1080
|
teamSlug: "",
|
|
1090
1081
|
currentField: "name",
|
|
@@ -1092,7 +1083,7 @@ function TeamForm({ title, onSubmit, onCancel }) {
|
|
|
1092
1083
|
slugAvailable: null,
|
|
1093
1084
|
error: null
|
|
1094
1085
|
});
|
|
1095
|
-
(
|
|
1086
|
+
useEffect2(() => {
|
|
1096
1087
|
if (state.teamName.trim()) {
|
|
1097
1088
|
const newSlug = generateSlug(state.teamName);
|
|
1098
1089
|
setState((prev) => ({
|
|
@@ -1110,7 +1101,7 @@ function TeamForm({ title, onSubmit, onCancel }) {
|
|
|
1110
1101
|
}));
|
|
1111
1102
|
}
|
|
1112
1103
|
}, [state.teamName]);
|
|
1113
|
-
(
|
|
1104
|
+
useEffect2(() => {
|
|
1114
1105
|
if (state.teamSlug.trim() && (state.currentField === "name" || state.currentField === "slug")) {
|
|
1115
1106
|
const checkAvailability = async () => {
|
|
1116
1107
|
setState((prev) => ({ ...prev, isCheckingSlug: true, error: null }));
|
|
@@ -1136,7 +1127,7 @@ function TeamForm({ title, onSubmit, onCancel }) {
|
|
|
1136
1127
|
return () => clearTimeout(timeoutId);
|
|
1137
1128
|
}
|
|
1138
1129
|
}, [state.teamSlug, state.currentField]);
|
|
1139
|
-
(
|
|
1130
|
+
useInput2((input, key) => {
|
|
1140
1131
|
if (state.currentField === "submitting") {
|
|
1141
1132
|
return;
|
|
1142
1133
|
}
|
|
@@ -1254,15 +1245,11 @@ function TeamForm({ title, onSubmit, onCancel }) {
|
|
|
1254
1245
|
}
|
|
1255
1246
|
return "esc to cancel";
|
|
1256
1247
|
};
|
|
1257
|
-
return (
|
|
1248
|
+
return _jsxs3(Box2, { flexDirection: "column", padding: 1, children: [_jsx4(Box2, { marginBottom: 2, children: _jsx4(Text4, { bold: true, color: "blue", children: title }) }), _jsxs3(Box2, { flexDirection: "column", marginBottom: 1, children: [_jsx4(Box2, { children: _jsxs3(Text4, { color: state.currentField === "name" ? "blue" : "gray", children: [state.currentField === "name" ? ">" : "\u2713", " Team Name:"] }) }), _jsx4(Box2, { marginLeft: 2, children: _jsxs3(Text4, { children: [state.teamName, state.currentField === "name" && _jsx4(Text4, { backgroundColor: "white", color: "black", children: "\u2588" })] }) })] }), state.teamSlug && _jsxs3(Box2, { flexDirection: "column", marginBottom: 1, children: [_jsx4(Box2, { children: _jsxs3(Text4, { color: state.currentField === "slug" ? "blue" : "gray", children: [state.currentField === "slug" ? ">" : "\u2713", " Team Slug", state.currentField === "name" ? " (auto-generated)" : "", ":"] }) }), _jsx4(Box2, { marginLeft: 2, children: _jsxs3(Text4, { children: [state.teamSlug, state.currentField === "slug" && _jsx4(Text4, { backgroundColor: "white", color: "black", children: "\u2588" })] }) }), getSlugStatus() && _jsx4(Box2, { marginLeft: 2, children: _jsx4(Text4, { color: getSlugStatusColor(), children: getSlugStatusText() }) })] }), state.error && _jsx4(Box2, { marginLeft: 2, marginBottom: 1, children: _jsxs3(Text4, { color: "red", children: ["Error: ", state.error] }) }), _jsx4(Box2, { marginTop: 2, children: _jsx4(Text4, { color: "gray", children: getHelpText() }) })] });
|
|
1258
1249
|
}
|
|
1259
|
-
var import_jsx_runtime4, import_react4, import_ink4;
|
|
1260
1250
|
var init_TeamForm = __esm({
|
|
1261
1251
|
"dist/components/TeamForm.js"() {
|
|
1262
1252
|
"use strict";
|
|
1263
|
-
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1264
|
-
import_react4 = require("react");
|
|
1265
|
-
import_ink4 = require("ink");
|
|
1266
1253
|
init_api();
|
|
1267
1254
|
init_platform();
|
|
1268
1255
|
}
|
|
@@ -1273,13 +1260,16 @@ var teams_exports = {};
|
|
|
1273
1260
|
__export(teams_exports, {
|
|
1274
1261
|
TeamsCommand: () => TeamsCommand
|
|
1275
1262
|
});
|
|
1263
|
+
import { jsx as _jsx5, jsxs as _jsxs4 } from "react/jsx-runtime";
|
|
1264
|
+
import React3 from "react";
|
|
1265
|
+
import { render as render2, Box as Box3, Text as Text5 } from "ink";
|
|
1276
1266
|
function TeamsApp() {
|
|
1277
|
-
const [state, setState] =
|
|
1267
|
+
const [state, setState] = React3.useState({
|
|
1278
1268
|
loading: true,
|
|
1279
1269
|
teams: [],
|
|
1280
1270
|
error: null
|
|
1281
1271
|
});
|
|
1282
|
-
|
|
1272
|
+
React3.useEffect(() => {
|
|
1283
1273
|
async function loadTeams() {
|
|
1284
1274
|
try {
|
|
1285
1275
|
if (!await isOnline()) {
|
|
@@ -1325,13 +1315,13 @@ function TeamsApp() {
|
|
|
1325
1315
|
process.exit(0);
|
|
1326
1316
|
};
|
|
1327
1317
|
const handleNew = () => {
|
|
1328
|
-
(
|
|
1318
|
+
render2(_jsx5(NewTeamApp, {}));
|
|
1329
1319
|
};
|
|
1330
1320
|
if (state.loading) {
|
|
1331
|
-
return (
|
|
1321
|
+
return _jsx5(Spinner, { text: "Loading teams..." });
|
|
1332
1322
|
}
|
|
1333
1323
|
if (state.error) {
|
|
1334
|
-
return (
|
|
1324
|
+
return _jsx5(Text5, { color: "red", children: state.error });
|
|
1335
1325
|
}
|
|
1336
1326
|
const columns = [
|
|
1337
1327
|
{ title: "ID", width: 38, key: "id" },
|
|
@@ -1344,14 +1334,14 @@ function TeamsApp() {
|
|
|
1344
1334
|
role_name: team.role_name || "Member",
|
|
1345
1335
|
slug: team.slug
|
|
1346
1336
|
}));
|
|
1347
|
-
return (
|
|
1337
|
+
return _jsx5(Table, { columns, rows, onCopy: handleCopy, onOpen: handleOpen, onExit: handleExit, onNew: handleNew, helpText: {
|
|
1348
1338
|
copyAction: "'c' to copy team ID",
|
|
1349
1339
|
openAction: "'o' to open in browser",
|
|
1350
1340
|
newAction: "'n' to create a new team"
|
|
1351
1341
|
} });
|
|
1352
1342
|
}
|
|
1353
1343
|
function NewTeamApp() {
|
|
1354
|
-
const [state, setState] =
|
|
1344
|
+
const [state, setState] = React3.useState({
|
|
1355
1345
|
loading: false,
|
|
1356
1346
|
error: null,
|
|
1357
1347
|
success: false,
|
|
@@ -1392,30 +1382,26 @@ function NewTeamApp() {
|
|
|
1392
1382
|
}
|
|
1393
1383
|
};
|
|
1394
1384
|
if (state.loading) {
|
|
1395
|
-
return (
|
|
1385
|
+
return _jsx5(Spinner, { text: "Creating team..." });
|
|
1396
1386
|
}
|
|
1397
1387
|
if (state.success) {
|
|
1398
|
-
return (
|
|
1388
|
+
return _jsxs4(Box3, { flexDirection: "column", children: [_jsxs4(Text5, { color: "green", children: ['\u2705 Team "', state.teamName, '" created successfully!'] }), _jsxs4(Text5, { children: ["Team slug: ", state.teamSlug] })] });
|
|
1399
1389
|
}
|
|
1400
1390
|
if (state.error) {
|
|
1401
|
-
return (
|
|
1391
|
+
return _jsx5(Text5, { color: "red", children: state.error });
|
|
1402
1392
|
}
|
|
1403
|
-
return (
|
|
1393
|
+
return _jsx5(TeamForm, { title: "Create New Team", onSubmit: handleSubmit, onCancel: () => process.exit(0) });
|
|
1404
1394
|
}
|
|
1405
1395
|
async function TeamsCommand(action) {
|
|
1406
1396
|
if (action === "new") {
|
|
1407
|
-
(
|
|
1397
|
+
render2(_jsx5(NewTeamApp, {}));
|
|
1408
1398
|
} else {
|
|
1409
|
-
(
|
|
1399
|
+
render2(_jsx5(TeamsApp, {}));
|
|
1410
1400
|
}
|
|
1411
1401
|
}
|
|
1412
|
-
var import_jsx_runtime5, import_react5, import_ink5;
|
|
1413
1402
|
var init_teams = __esm({
|
|
1414
1403
|
"dist/commands/teams.js"() {
|
|
1415
1404
|
"use strict";
|
|
1416
|
-
import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1417
|
-
import_react5 = __toESM(require("react"), 1);
|
|
1418
|
-
import_ink5 = require("ink");
|
|
1419
1405
|
init_Table();
|
|
1420
1406
|
init_Spinner();
|
|
1421
1407
|
init_TeamForm();
|
|
@@ -1430,9 +1416,13 @@ var init_teams = __esm({
|
|
|
1430
1416
|
var schema_exports = {};
|
|
1431
1417
|
__export(schema_exports, {
|
|
1432
1418
|
compareVersions: () => compareVersions,
|
|
1419
|
+
parseSchemaFile: () => parseSchemaFile,
|
|
1433
1420
|
readSchemaFromConfig: () => readSchemaFromConfig,
|
|
1434
1421
|
saveSchemaToConfig: () => saveSchemaToConfig
|
|
1435
1422
|
});
|
|
1423
|
+
import * as fs2 from "fs/promises";
|
|
1424
|
+
import * as path2 from "path";
|
|
1425
|
+
import { parse } from "@babel/parser";
|
|
1436
1426
|
async function readSchemaFromConfig(targetDir = process.cwd()) {
|
|
1437
1427
|
const possibleFiles = [
|
|
1438
1428
|
"basic.config.ts",
|
|
@@ -1469,7 +1459,7 @@ async function readSchemaFromConfig(targetDir = process.cwd()) {
|
|
|
1469
1459
|
}
|
|
1470
1460
|
function extractSchemaFromCode(content) {
|
|
1471
1461
|
try {
|
|
1472
|
-
const ast =
|
|
1462
|
+
const ast = parse(content, {
|
|
1473
1463
|
sourceType: "module",
|
|
1474
1464
|
plugins: ["typescript", "jsx"]
|
|
1475
1465
|
});
|
|
@@ -1605,13 +1595,16 @@ function compareVersions(local, remote) {
|
|
|
1605
1595
|
remoteVersion
|
|
1606
1596
|
};
|
|
1607
1597
|
}
|
|
1608
|
-
|
|
1598
|
+
async function parseSchemaFile(filePath) {
|
|
1599
|
+
const content = await fs2.readFile(filePath, "utf8");
|
|
1600
|
+
const ast = parse(content, {
|
|
1601
|
+
sourceType: "module",
|
|
1602
|
+
plugins: ["typescript"]
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1609
1605
|
var init_schema = __esm({
|
|
1610
1606
|
"dist/lib/schema.js"() {
|
|
1611
1607
|
"use strict";
|
|
1612
|
-
fs2 = __toESM(require("fs/promises"), 1);
|
|
1613
|
-
path2 = __toESM(require("path"), 1);
|
|
1614
|
-
import_parser = require("@babel/parser");
|
|
1615
1608
|
}
|
|
1616
1609
|
});
|
|
1617
1610
|
|
|
@@ -1620,12 +1613,15 @@ var status_exports = {};
|
|
|
1620
1613
|
__export(status_exports, {
|
|
1621
1614
|
StatusCommand: () => StatusCommand
|
|
1622
1615
|
});
|
|
1616
|
+
import { jsx as _jsx6, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
1617
|
+
import React4 from "react";
|
|
1618
|
+
import { render as render3, Box as Box4, Text as Text6 } from "ink";
|
|
1623
1619
|
function StatusApp() {
|
|
1624
|
-
const [state, setState] =
|
|
1620
|
+
const [state, setState] = React4.useState({
|
|
1625
1621
|
loading: true,
|
|
1626
1622
|
error: null
|
|
1627
1623
|
});
|
|
1628
|
-
|
|
1624
|
+
React4.useEffect(() => {
|
|
1629
1625
|
async function checkStatus() {
|
|
1630
1626
|
try {
|
|
1631
1627
|
if (!await isOnline()) {
|
|
@@ -1715,15 +1711,15 @@ function StatusApp() {
|
|
|
1715
1711
|
checkStatus();
|
|
1716
1712
|
}, []);
|
|
1717
1713
|
if (state.loading) {
|
|
1718
|
-
return (
|
|
1714
|
+
return _jsx6(Spinner, { text: "Checking status..." });
|
|
1719
1715
|
}
|
|
1720
1716
|
if (state.error) {
|
|
1721
|
-
return (
|
|
1717
|
+
return _jsx6(Box4, { flexDirection: "column", children: _jsxs5(Text6, { color: "red", children: ["Error: ", state.error] }) });
|
|
1722
1718
|
}
|
|
1723
1719
|
if (state.result) {
|
|
1724
|
-
return (
|
|
1720
|
+
return _jsx6(StatusDisplay, { result: state.result });
|
|
1725
1721
|
}
|
|
1726
|
-
return (
|
|
1722
|
+
return _jsx6(Text6, { children: "Unknown status" });
|
|
1727
1723
|
}
|
|
1728
1724
|
async function analyzeStatus(localConfig, remoteSchema, comparison) {
|
|
1729
1725
|
const apiClient = ApiClient.getInstance();
|
|
@@ -1969,20 +1965,16 @@ function StatusDisplay({ result }) {
|
|
|
1969
1965
|
}
|
|
1970
1966
|
};
|
|
1971
1967
|
const statusMessages = result.message.filter((msg) => !msg.startsWith("Project ID:") && !msg.startsWith("Remote schema version:"));
|
|
1972
|
-
return (
|
|
1968
|
+
return _jsxs5(Box4, { flexDirection: "column", children: [result.projectId && _jsxs5(Box4, { flexDirection: "column", marginBottom: 1, children: [_jsxs5(Text6, { color: "cyan", children: ["Project ID: ", result.projectId] }), _jsxs5(Box4, { children: [_jsxs5(Text6, { color: "gray", children: ["Local version: ", result.localVersion] }), result.remoteVersion > 0 && _jsxs5(Text6, { color: "gray", children: [" \u2022 Remote version: ", result.remoteVersion] })] })] }), _jsxs5(Box4, { flexDirection: "column", marginBottom: 1, children: [_jsx6(Box4, { marginBottom: 1, children: _jsxs5(Text6, { color: getStatusColor(), children: [getStatusIcon(), " ", getStatusDescription()] }) }), statusMessages.length > 0 && _jsx6(Box4, { flexDirection: "column", children: statusMessages.map((line, index) => _jsx6(Text6, { children: line }, index)) })] }), result.validationErrors && result.validationErrors.length > 0 && _jsxs5(Box4, { flexDirection: "column", marginBottom: 1, children: [_jsx6(Text6, { color: "red", children: "Validation errors:" }), result.validationErrors.map((error, index) => _jsxs5(Text6, { color: "red", children: ["\u2022 ", error.message, " at ", error.instancePath || "root"] }, index))] }), result.suggestions.length > 0 && _jsxs5(Box4, { flexDirection: "column", marginTop: 1, children: [_jsx6(Text6, { color: "blue", children: "Next steps:" }), result.suggestions.map((suggestion, index) => _jsxs5(Text6, { color: "gray", children: ["\u2022 ", suggestion] }, index))] })] });
|
|
1973
1969
|
}
|
|
1974
1970
|
async function StatusCommand() {
|
|
1975
|
-
const { waitUntilExit } = (
|
|
1971
|
+
const { waitUntilExit } = render3(_jsx6(StatusApp, {}));
|
|
1976
1972
|
await waitUntilExit();
|
|
1977
1973
|
process.exit(0);
|
|
1978
1974
|
}
|
|
1979
|
-
var import_jsx_runtime6, import_react6, import_ink6;
|
|
1980
1975
|
var init_status = __esm({
|
|
1981
1976
|
"dist/commands/status.js"() {
|
|
1982
1977
|
"use strict";
|
|
1983
|
-
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1984
|
-
import_react6 = __toESM(require("react"), 1);
|
|
1985
|
-
import_ink6 = require("ink");
|
|
1986
1978
|
init_Spinner();
|
|
1987
1979
|
init_api();
|
|
1988
1980
|
init_auth();
|
|
@@ -1997,13 +1989,16 @@ var pull_exports = {};
|
|
|
1997
1989
|
__export(pull_exports, {
|
|
1998
1990
|
PullCommand: () => PullCommand
|
|
1999
1991
|
});
|
|
1992
|
+
import { jsx as _jsx7, jsxs as _jsxs6, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1993
|
+
import React5 from "react";
|
|
1994
|
+
import { render as render4, Box as Box5, Text as Text7, useInput as useInput3 } from "ink";
|
|
2000
1995
|
function PullApp() {
|
|
2001
|
-
const [state, setState] =
|
|
1996
|
+
const [state, setState] = React5.useState({
|
|
2002
1997
|
phase: "checking",
|
|
2003
1998
|
error: null
|
|
2004
1999
|
});
|
|
2005
|
-
const [selectedOption, setSelectedOption] =
|
|
2006
|
-
|
|
2000
|
+
const [selectedOption, setSelectedOption] = React5.useState("yes");
|
|
2001
|
+
React5.useEffect(() => {
|
|
2007
2002
|
async function checkPullStatus() {
|
|
2008
2003
|
try {
|
|
2009
2004
|
if (!await isOnline()) {
|
|
@@ -2077,7 +2072,7 @@ function PullApp() {
|
|
|
2077
2072
|
}
|
|
2078
2073
|
checkPullStatus();
|
|
2079
2074
|
}, []);
|
|
2080
|
-
(
|
|
2075
|
+
useInput3((input, key) => {
|
|
2081
2076
|
if (state.phase === "confirming") {
|
|
2082
2077
|
if (key.upArrow || key.downArrow) {
|
|
2083
2078
|
setSelectedOption((prev) => prev === "yes" ? "no" : "yes");
|
|
@@ -2126,27 +2121,27 @@ function PullApp() {
|
|
|
2126
2121
|
}
|
|
2127
2122
|
};
|
|
2128
2123
|
if (state.phase === "checking") {
|
|
2129
|
-
return (
|
|
2124
|
+
return _jsx7(Spinner, { text: "Checking pull status..." });
|
|
2130
2125
|
}
|
|
2131
2126
|
if (state.phase === "pulling") {
|
|
2132
|
-
return (
|
|
2127
|
+
return _jsx7(Spinner, { text: "Pulling latest schema..." });
|
|
2133
2128
|
}
|
|
2134
2129
|
if (state.phase === "error") {
|
|
2135
2130
|
setTimeout(() => process.exit(1), 0);
|
|
2136
|
-
return (
|
|
2131
|
+
return _jsxs6(Box5, { flexDirection: "column", children: [_jsxs6(Text7, { color: "red", children: ["Error: ", state.error] }), _jsxs6(Box5, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [_jsx7(Text7, { color: "blue", children: "Next steps:" }), state.error?.includes("offline") || state.error?.includes("network") ? _jsxs6(_Fragment, { children: [_jsx7(Text7, { color: "gray", children: "\u2022 Check your internet connection" }), _jsx7(Text7, { color: "gray", children: "\u2022 Try again in a moment" })] }) : state.error?.includes("logged") || state.error?.includes("auth") ? _jsxs6(_Fragment, { children: [_jsx7(Text7, { color: "gray", children: "\u2022 Run 'basic login' to authenticate" }), _jsx7(Text7, { color: "gray", children: "\u2022 Ensure you have a valid account" })] }) : state.error?.includes("schema") || state.error?.includes("project") ? _jsxs6(_Fragment, { children: [_jsx7(Text7, { color: "gray", children: "\u2022 Check if the project ID is correct" }), _jsx7(Text7, { color: "gray", children: "\u2022 Ensure you have access to this project" }), _jsx7(Text7, { color: "gray", children: "\u2022 Run 'basic status' for more details" })] }) : _jsxs6(_Fragment, { children: [_jsx7(Text7, { color: "gray", children: "\u2022 Try running the command again" }), _jsx7(Text7, { color: "gray", children: "\u2022 Run 'basic status' to check your project state" }), _jsx7(Text7, { color: "gray", children: "\u2022 Check the Basic documentation if the issue persists" })] })] })] });
|
|
2137
2132
|
}
|
|
2138
2133
|
if (state.phase === "success" && state.pullResult) {
|
|
2139
2134
|
setTimeout(() => process.exit(0), 0);
|
|
2140
|
-
return (
|
|
2135
|
+
return _jsx7(PullSuccessDisplay, { result: state.pullResult });
|
|
2141
2136
|
}
|
|
2142
2137
|
if (state.phase === "confirming" && state.statusResult) {
|
|
2143
|
-
return (
|
|
2138
|
+
return _jsx7(PullConfirmationDialog, { statusResult: state.statusResult, selectedOption });
|
|
2144
2139
|
}
|
|
2145
2140
|
if (state.phase === "no-action" && state.statusResult) {
|
|
2146
2141
|
setTimeout(() => process.exit(0), 0);
|
|
2147
|
-
return (
|
|
2142
|
+
return _jsx7(PullStatusDisplay, { result: state.statusResult });
|
|
2148
2143
|
}
|
|
2149
|
-
return (
|
|
2144
|
+
return _jsx7(Text7, { children: "Unknown state" });
|
|
2150
2145
|
}
|
|
2151
2146
|
async function analyzePullAction(localConfig, remoteSchema, comparison, apiClient) {
|
|
2152
2147
|
const { projectId } = localConfig;
|
|
@@ -2271,7 +2266,7 @@ function PullConfirmationDialog({ statusResult, selectedOption }) {
|
|
|
2271
2266
|
return "blue";
|
|
2272
2267
|
}
|
|
2273
2268
|
};
|
|
2274
|
-
return (
|
|
2269
|
+
return _jsxs6(Box5, { flexDirection: "column", children: [_jsxs6(Box5, { flexDirection: "column", marginBottom: 1, children: [_jsxs6(Text7, { color: "cyan", children: ["Project ID: ", statusResult.projectId] }), _jsxs6(Box5, { children: [_jsxs6(Text7, { color: "gray", children: ["Local version: ", statusResult.localVersion] }), statusResult.remoteVersion > 0 && _jsxs6(Text7, { color: "gray", children: [" \u2022 Remote version: ", statusResult.remoteVersion] })] })] }), _jsx7(Box5, { marginBottom: 1, children: _jsxs6(Text7, { color: getStatusColor(), children: [getStatusIcon(), " ", getStatusText()] }) }), _jsx7(Box5, { flexDirection: "column", marginBottom: 2, children: statusResult.message.map((line, index) => _jsx7(Text7, { children: line }, index)) }), _jsxs6(Box5, { flexDirection: "column", children: [_jsx7(Box5, { children: _jsxs6(Text7, { color: selectedOption === "yes" ? "green" : "gray", children: [selectedOption === "yes" ? "\u276F" : " ", " Yes, pull changes"] }) }), _jsx7(Box5, { children: _jsxs6(Text7, { color: selectedOption === "no" ? "green" : "gray", children: [selectedOption === "no" ? "\u276F" : " ", " No, cancel"] }) })] }), _jsx7(Box5, { marginTop: 1, children: _jsx7(Text7, { color: "gray", children: "Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel" }) })] });
|
|
2275
2270
|
}
|
|
2276
2271
|
function PullStatusDisplay({ result }) {
|
|
2277
2272
|
const getStatusColor = () => {
|
|
@@ -2344,21 +2339,17 @@ function PullStatusDisplay({ result }) {
|
|
|
2344
2339
|
return [];
|
|
2345
2340
|
}
|
|
2346
2341
|
};
|
|
2347
|
-
return (
|
|
2342
|
+
return _jsxs6(Box5, { flexDirection: "column", children: [result.projectId && _jsxs6(Box5, { flexDirection: "column", marginBottom: 1, children: [_jsxs6(Text7, { color: "cyan", children: ["Project ID: ", result.projectId] }), _jsxs6(Box5, { children: [_jsxs6(Text7, { color: "gray", children: ["Local version: ", result.localVersion] }), result.remoteVersion > 0 && _jsxs6(Text7, { color: "gray", children: [" \u2022 Remote version: ", result.remoteVersion] })] })] }), _jsx7(Box5, { marginBottom: 1, children: _jsxs6(Text7, { color: getStatusColor(), children: [getStatusIcon(), " ", getStatusDescription()] }) }), _jsx7(Box5, { flexDirection: "column", marginBottom: 1, children: result.message.map((line, index) => _jsx7(Text7, { children: line }, index)) }), getNextSteps().length > 0 && _jsxs6(Box5, { flexDirection: "column", marginBottom: 1, children: [_jsx7(Text7, { color: "blue", children: "Next steps:" }), getNextSteps().map((step, index) => _jsxs6(Text7, { color: "gray", children: ["\u2022 ", step] }, index))] })] });
|
|
2348
2343
|
}
|
|
2349
2344
|
function PullSuccessDisplay({ result }) {
|
|
2350
|
-
return (
|
|
2345
|
+
return _jsxs6(Box5, { flexDirection: "column", children: [_jsx7(Box5, { marginBottom: 1, children: _jsx7(Text7, { color: "green", children: "\u2705 Schema updated successfully!" }) }), _jsxs6(Box5, { flexDirection: "column", marginBottom: 1, children: [_jsxs6(Text7, { children: ["Updated: ", result.filePath.split("/").pop()] }), _jsxs6(Text7, { children: ["Version: ", result.oldVersion, " \u2192 ", result.newVersion] }), _jsxs6(Text7, { children: ["Project: ", result.projectId] })] }), _jsxs6(Box5, { flexDirection: "column", marginTop: 1, children: [_jsx7(Text7, { color: "blue", children: "Next steps:" }), _jsx7(Text7, { color: "gray", children: "\u2022 Review the updated schema changes" }), _jsx7(Text7, { color: "gray", children: "\u2022 Continue working on your project" }), _jsx7(Text7, { color: "gray", children: "\u2022 Run 'basic status' to check your project state" })] })] });
|
|
2351
2346
|
}
|
|
2352
2347
|
async function PullCommand() {
|
|
2353
|
-
(
|
|
2348
|
+
render4(_jsx7(PullApp, {}));
|
|
2354
2349
|
}
|
|
2355
|
-
var import_jsx_runtime7, import_react7, import_ink7;
|
|
2356
2350
|
var init_pull = __esm({
|
|
2357
2351
|
"dist/commands/pull.js"() {
|
|
2358
2352
|
"use strict";
|
|
2359
|
-
import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2360
|
-
import_react7 = __toESM(require("react"), 1);
|
|
2361
|
-
import_ink7 = require("ink");
|
|
2362
2353
|
init_Spinner();
|
|
2363
2354
|
init_api();
|
|
2364
2355
|
init_auth();
|
|
@@ -2373,13 +2364,16 @@ var push_exports = {};
|
|
|
2373
2364
|
__export(push_exports, {
|
|
2374
2365
|
PushCommand: () => PushCommand
|
|
2375
2366
|
});
|
|
2367
|
+
import { jsx as _jsx8, jsxs as _jsxs7, Fragment as _Fragment2 } from "react/jsx-runtime";
|
|
2368
|
+
import React6 from "react";
|
|
2369
|
+
import { render as render5, Box as Box6, Text as Text8, useInput as useInput4 } from "ink";
|
|
2376
2370
|
function PushApp() {
|
|
2377
|
-
const [state, setState] =
|
|
2371
|
+
const [state, setState] = React6.useState({
|
|
2378
2372
|
phase: "checking",
|
|
2379
2373
|
error: null
|
|
2380
2374
|
});
|
|
2381
|
-
const [selectedOption, setSelectedOption] =
|
|
2382
|
-
|
|
2375
|
+
const [selectedOption, setSelectedOption] = React6.useState("yes");
|
|
2376
|
+
React6.useEffect(() => {
|
|
2383
2377
|
async function checkPushStatus() {
|
|
2384
2378
|
try {
|
|
2385
2379
|
if (!await isOnline()) {
|
|
@@ -2453,7 +2447,7 @@ function PushApp() {
|
|
|
2453
2447
|
}
|
|
2454
2448
|
checkPushStatus();
|
|
2455
2449
|
}, []);
|
|
2456
|
-
(
|
|
2450
|
+
useInput4((input, key) => {
|
|
2457
2451
|
if (state.phase === "confirming") {
|
|
2458
2452
|
if (key.upArrow || key.downArrow) {
|
|
2459
2453
|
setSelectedOption((prev) => prev === "yes" ? "no" : "yes");
|
|
@@ -2498,27 +2492,27 @@ function PushApp() {
|
|
|
2498
2492
|
}
|
|
2499
2493
|
};
|
|
2500
2494
|
if (state.phase === "checking") {
|
|
2501
|
-
return (
|
|
2495
|
+
return _jsx8(Spinner, { text: "Checking push status..." });
|
|
2502
2496
|
}
|
|
2503
2497
|
if (state.phase === "pushing") {
|
|
2504
|
-
return (
|
|
2498
|
+
return _jsx8(Spinner, { text: "Pushing schema to remote..." });
|
|
2505
2499
|
}
|
|
2506
2500
|
if (state.phase === "error") {
|
|
2507
2501
|
setTimeout(() => process.exit(1), 0);
|
|
2508
|
-
return (
|
|
2502
|
+
return _jsxs7(Box6, { flexDirection: "column", children: [_jsxs7(Text8, { color: "red", children: ["Error: ", state.error] }), _jsxs7(Box6, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [_jsx8(Text8, { color: "blue", children: "Next steps:" }), state.error?.includes("offline") || state.error?.includes("network") ? _jsxs7(_Fragment2, { children: [_jsx8(Text8, { color: "gray", children: "\u2022 Check your internet connection" }), _jsx8(Text8, { color: "gray", children: "\u2022 Try again in a moment" })] }) : state.error?.includes("logged") || state.error?.includes("auth") ? _jsxs7(_Fragment2, { children: [_jsx8(Text8, { color: "gray", children: "\u2022 Run 'basic login' to authenticate" }), _jsx8(Text8, { color: "gray", children: "\u2022 Ensure you have a valid account" })] }) : state.error?.includes("schema") || state.error?.includes("project") ? _jsxs7(_Fragment2, { children: [_jsx8(Text8, { color: "gray", children: "\u2022 Check if the project ID is correct" }), _jsx8(Text8, { color: "gray", children: "\u2022 Ensure you have access to this project" }), _jsx8(Text8, { color: "gray", children: "\u2022 Run 'basic status' for more details" })] }) : _jsxs7(_Fragment2, { children: [_jsx8(Text8, { color: "gray", children: "\u2022 Try running the command again" }), _jsx8(Text8, { color: "gray", children: "\u2022 Run 'basic status' to check your project state" }), _jsx8(Text8, { color: "gray", children: "\u2022 Check the Basic documentation if the issue persists" })] })] })] });
|
|
2509
2503
|
}
|
|
2510
2504
|
if (state.phase === "success" && state.pushResult) {
|
|
2511
2505
|
setTimeout(() => process.exit(0), 0);
|
|
2512
|
-
return (
|
|
2506
|
+
return _jsx8(PushSuccessDisplay, { result: state.pushResult });
|
|
2513
2507
|
}
|
|
2514
2508
|
if (state.phase === "confirming" && state.statusResult) {
|
|
2515
|
-
return (
|
|
2509
|
+
return _jsx8(PushConfirmationDialog, { statusResult: state.statusResult, selectedOption });
|
|
2516
2510
|
}
|
|
2517
2511
|
if (state.phase === "no-action" && state.statusResult) {
|
|
2518
2512
|
setTimeout(() => process.exit(0), 0);
|
|
2519
|
-
return (
|
|
2513
|
+
return _jsx8(PushStatusDisplay, { result: state.statusResult });
|
|
2520
2514
|
}
|
|
2521
|
-
return (
|
|
2515
|
+
return _jsx8(Text8, { children: "Unknown state" });
|
|
2522
2516
|
}
|
|
2523
2517
|
async function analyzePushAction(localConfig, remoteSchema, comparison, apiClient) {
|
|
2524
2518
|
const { projectId } = localConfig;
|
|
@@ -2677,7 +2671,7 @@ function PushConfirmationDialog({ statusResult, selectedOption }) {
|
|
|
2677
2671
|
return "blue";
|
|
2678
2672
|
}
|
|
2679
2673
|
};
|
|
2680
|
-
return (
|
|
2674
|
+
return _jsxs7(Box6, { flexDirection: "column", children: [_jsxs7(Box6, { flexDirection: "column", marginBottom: 1, children: [_jsxs7(Text8, { color: "cyan", children: ["Project ID: ", statusResult.projectId] }), _jsxs7(Box6, { children: [_jsxs7(Text8, { color: "gray", children: ["Local version: ", statusResult.localVersion] }), statusResult.remoteVersion > 0 && _jsxs7(Text8, { color: "gray", children: [" \u2022 Remote version: ", statusResult.remoteVersion] })] })] }), _jsx8(Box6, { marginBottom: 1, children: _jsxs7(Text8, { color: getStatusColor(), children: [getStatusIcon(), " ", getStatusText()] }) }), _jsx8(Box6, { flexDirection: "column", marginBottom: 2, children: statusResult.message.map((line, index) => _jsx8(Text8, { children: line }, index)) }), _jsxs7(Box6, { flexDirection: "column", children: [_jsx8(Box6, { children: _jsxs7(Text8, { color: selectedOption === "yes" ? "green" : "gray", children: [selectedOption === "yes" ? "\u276F" : " ", " Yes, push changes"] }) }), _jsx8(Box6, { children: _jsxs7(Text8, { color: selectedOption === "no" ? "green" : "gray", children: [selectedOption === "no" ? "\u276F" : " ", " No, cancel"] }) })] }), _jsx8(Box6, { marginTop: 1, children: _jsx8(Text8, { color: "gray", children: "Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel" }) })] });
|
|
2681
2675
|
}
|
|
2682
2676
|
function PushStatusDisplay({ result }) {
|
|
2683
2677
|
const getStatusColor = () => {
|
|
@@ -2750,21 +2744,17 @@ function PushStatusDisplay({ result }) {
|
|
|
2750
2744
|
return [];
|
|
2751
2745
|
}
|
|
2752
2746
|
};
|
|
2753
|
-
return (
|
|
2747
|
+
return _jsxs7(Box6, { flexDirection: "column", children: [result.projectId && _jsxs7(Box6, { flexDirection: "column", marginBottom: 1, children: [_jsxs7(Text8, { color: "cyan", children: ["Project ID: ", result.projectId] }), _jsxs7(Box6, { children: [_jsxs7(Text8, { color: "gray", children: ["Local version: ", result.localVersion] }), result.remoteVersion > 0 && _jsxs7(Text8, { color: "gray", children: [" \u2022 Remote version: ", result.remoteVersion] })] })] }), _jsx8(Box6, { marginBottom: 1, children: _jsxs7(Text8, { color: getStatusColor(), children: [getStatusIcon(), " ", getStatusDescription()] }) }), _jsx8(Box6, { flexDirection: "column", marginBottom: 1, children: result.message.map((line, index) => _jsx8(Text8, { children: line }, index)) }), result.validationErrors && result.validationErrors.length > 0 && _jsx8(Box6, { flexDirection: "column", marginBottom: 1, children: result.validationErrors.map((error, index) => _jsxs7(Text8, { color: "red", children: ["\u2022 ", error.message, " at ", error.instancePath || "root"] }, index)) }), getNextSteps().length > 0 && _jsxs7(Box6, { flexDirection: "column", marginBottom: 1, children: [_jsx8(Text8, { color: "blue", children: "Next steps:" }), getNextSteps().map((step, index) => _jsxs7(Text8, { color: "gray", children: ["\u2022 ", step] }, index))] })] });
|
|
2754
2748
|
}
|
|
2755
2749
|
function PushSuccessDisplay({ result }) {
|
|
2756
|
-
return (
|
|
2750
|
+
return _jsxs7(Box6, { flexDirection: "column", children: [_jsx8(Box6, { marginBottom: 1, children: _jsx8(Text8, { color: "green", children: "\u2705 Schema pushed successfully!" }) }), _jsxs7(Box6, { flexDirection: "column", marginBottom: 1, children: [_jsxs7(Text8, { children: ["Source: ", result.filePath.split("/").pop()] }), _jsxs7(Text8, { children: ["Version: ", result.oldVersion, " \u2192 ", result.newVersion] }), _jsxs7(Text8, { children: ["Project: ", result.projectId] })] }), _jsxs7(Box6, { flexDirection: "column", marginTop: 1, children: [_jsx8(Text8, { color: "blue", children: "Next steps:" }), _jsx8(Text8, { color: "gray", children: "\u2022 Your schema changes are now live" }), _jsx8(Text8, { color: "gray", children: "\u2022 Continue working on your project" }), _jsx8(Text8, { color: "gray", children: "\u2022 Run 'basic status' to check your project state" })] })] });
|
|
2757
2751
|
}
|
|
2758
2752
|
async function PushCommand() {
|
|
2759
|
-
(
|
|
2753
|
+
render5(_jsx8(PushApp, {}));
|
|
2760
2754
|
}
|
|
2761
|
-
var import_jsx_runtime8, import_react8, import_ink8;
|
|
2762
2755
|
var init_push = __esm({
|
|
2763
2756
|
"dist/commands/push.js"() {
|
|
2764
2757
|
"use strict";
|
|
2765
|
-
import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2766
|
-
import_react8 = __toESM(require("react"), 1);
|
|
2767
|
-
import_ink8 = require("ink");
|
|
2768
2758
|
init_Spinner();
|
|
2769
2759
|
init_api();
|
|
2770
2760
|
init_auth();
|
|
@@ -2783,6 +2773,8 @@ __export(config_templates_exports, {
|
|
|
2783
2773
|
generateConfigContent: () => generateConfigContent2,
|
|
2784
2774
|
readExistingConfig: () => readExistingConfig
|
|
2785
2775
|
});
|
|
2776
|
+
import * as fs3 from "fs/promises";
|
|
2777
|
+
import * as path3 from "path";
|
|
2786
2778
|
function generateConfigContent2(template, projectId, projectName) {
|
|
2787
2779
|
const baseConfig = {
|
|
2788
2780
|
project_id: projectId,
|
|
@@ -2871,12 +2863,10 @@ async function readExistingConfig(targetDir = process.cwd()) {
|
|
|
2871
2863
|
throw new Error(`Failed to read existing config: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2872
2864
|
}
|
|
2873
2865
|
}
|
|
2874
|
-
var
|
|
2866
|
+
var CONFIG_TEMPLATES;
|
|
2875
2867
|
var init_config_templates = __esm({
|
|
2876
2868
|
"dist/lib/config-templates.js"() {
|
|
2877
2869
|
"use strict";
|
|
2878
|
-
fs3 = __toESM(require("fs/promises"), 1);
|
|
2879
|
-
path3 = __toESM(require("path"), 1);
|
|
2880
2870
|
CONFIG_TEMPLATES = {
|
|
2881
2871
|
typescript: {
|
|
2882
2872
|
name: "TypeScript",
|
|
@@ -2901,8 +2891,11 @@ var init_config_templates = __esm({
|
|
|
2901
2891
|
});
|
|
2902
2892
|
|
|
2903
2893
|
// dist/components/InitForm.js
|
|
2894
|
+
import { jsx as _jsx9, jsxs as _jsxs8, Fragment as _Fragment3 } from "react/jsx-runtime";
|
|
2895
|
+
import { useState as useState3, useEffect as useEffect3 } from "react";
|
|
2896
|
+
import { Box as Box7, Text as Text9, useInput as useInput5 } from "ink";
|
|
2904
2897
|
function InitForm({ onSuccess, onCancel, initialData }) {
|
|
2905
|
-
const [state, setState] = (
|
|
2898
|
+
const [state, setState] = useState3({
|
|
2906
2899
|
step: initialData?.source ? initialData.source === "new" ? "project-details" : "existing-selection" : "source",
|
|
2907
2900
|
source: initialData?.source || null,
|
|
2908
2901
|
projectName: initialData?.projectName || "",
|
|
@@ -2915,9 +2908,9 @@ function InitForm({ onSuccess, onCancel, initialData }) {
|
|
|
2915
2908
|
isLoading: false,
|
|
2916
2909
|
error: null
|
|
2917
2910
|
});
|
|
2918
|
-
const [selectedOptionIndex, setSelectedOptionIndex] = (0
|
|
2919
|
-
const [showTeamForm, setShowTeamForm] = (
|
|
2920
|
-
(
|
|
2911
|
+
const [selectedOptionIndex, setSelectedOptionIndex] = useState3(0);
|
|
2912
|
+
const [showTeamForm, setShowTeamForm] = useState3(false);
|
|
2913
|
+
useEffect3(() => {
|
|
2921
2914
|
async function loadData() {
|
|
2922
2915
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
2923
2916
|
try {
|
|
@@ -2943,13 +2936,13 @@ function InitForm({ onSuccess, onCancel, initialData }) {
|
|
|
2943
2936
|
}
|
|
2944
2937
|
loadData();
|
|
2945
2938
|
}, []);
|
|
2946
|
-
(
|
|
2939
|
+
useEffect3(() => {
|
|
2947
2940
|
if (state.projectName.trim()) {
|
|
2948
2941
|
const newSlug = generateSlug(state.projectName);
|
|
2949
2942
|
setState((prev) => ({ ...prev, projectSlug: newSlug }));
|
|
2950
2943
|
}
|
|
2951
2944
|
}, [state.projectName]);
|
|
2952
|
-
(
|
|
2945
|
+
useInput5((input, key) => {
|
|
2953
2946
|
if (showTeamForm) {
|
|
2954
2947
|
return;
|
|
2955
2948
|
}
|
|
@@ -3178,38 +3171,38 @@ function InitForm({ onSuccess, onCancel, initialData }) {
|
|
|
3178
3171
|
}
|
|
3179
3172
|
};
|
|
3180
3173
|
if (showTeamForm) {
|
|
3181
|
-
return (
|
|
3174
|
+
return _jsx9(TeamForm, { title: "Create New Team", onSubmit: handleTeamCreated, onCancel: () => setShowTeamForm(false) });
|
|
3182
3175
|
}
|
|
3183
3176
|
if (state.isLoading) {
|
|
3184
|
-
return (
|
|
3177
|
+
return _jsx9(Spinner, { text: "Loading..." });
|
|
3185
3178
|
}
|
|
3186
3179
|
if (state.error) {
|
|
3187
|
-
return (
|
|
3180
|
+
return _jsxs8(Box7, { flexDirection: "column", children: [_jsxs8(Text9, { color: "red", children: ["Error: ", state.error] }), _jsx9(Text9, { color: "gray", children: "Press Esc to go back" })] });
|
|
3188
3181
|
}
|
|
3189
|
-
return (
|
|
3182
|
+
return _jsx9(Box7, { flexDirection: "column", padding: 1, children: renderCurrentStep() });
|
|
3190
3183
|
function renderCurrentStep() {
|
|
3191
3184
|
const stepNumber = getStepNumber();
|
|
3192
3185
|
const totalSteps = getTotalSteps();
|
|
3193
3186
|
switch (state.step) {
|
|
3194
3187
|
case "source":
|
|
3195
|
-
return (
|
|
3188
|
+
return _jsxs8(_Fragment3, { children: [_jsxs8(Text9, { bold: true, color: "blue", children: ["Project Setup (", stepNumber, "/", totalSteps, ")"] }), _jsx9(Box7, { marginTop: 1, marginBottom: 2, children: _jsx9(Text9, { children: "How would you like to proceed?" }) }), renderOptions(), _jsx9(Box7, { marginTop: 2, children: _jsx9(Text9, { color: "gray", children: "\u2191/\u2193 select \u2022 enter to continue \u2022 esc to cancel" }) })] });
|
|
3196
3189
|
case "project-details":
|
|
3197
|
-
return (
|
|
3190
|
+
return _jsxs8(_Fragment3, { children: [_jsxs8(Text9, { bold: true, color: "blue", children: ["Create New Project (", stepNumber, "/", totalSteps, ")"] }), _jsx9(Box7, { marginTop: 1, marginBottom: 1, children: _jsxs8(Text9, { color: "blue", children: [">", " Project Name:"] }) }), _jsx9(Box7, { marginLeft: 2, marginBottom: 1, children: _jsxs8(Text9, { children: [state.projectName, _jsx9(Text9, { backgroundColor: "white", color: "black", children: "\u2588" })] }) }), state.projectSlug && _jsxs8(Box7, { marginBottom: 1, children: [_jsx9(Box7, { children: _jsx9(Text9, { color: "gray", children: "\u2713 Project Slug (auto-generated):" }) }), _jsx9(Box7, { marginLeft: 2, children: _jsx9(Text9, { children: state.projectSlug }) })] }), _jsx9(Box7, { marginTop: 2, children: _jsx9(Text9, { color: "gray", children: state.projectName.trim() ? "Enter to continue \u2022 esc to go back" : "Type project name \u2022 esc to go back" }) })] });
|
|
3198
3191
|
case "team-selection":
|
|
3199
|
-
return (
|
|
3192
|
+
return _jsxs8(_Fragment3, { children: [_jsxs8(Text9, { bold: true, color: "blue", children: ["Create New Project (", stepNumber, "/", totalSteps, ")"] }), _jsxs8(Box7, { marginTop: 1, children: [_jsxs8(Text9, { color: "gray", children: ["\u2713 Project Name: ", state.projectName] }), _jsxs8(Text9, { color: "gray", children: ["\u2713 Project Slug: ", state.projectSlug] })] }), _jsx9(Box7, { marginTop: 1, marginBottom: 2, children: _jsx9(Text9, { children: "Select Team:" }) }), renderOptions(), _jsx9(Box7, { marginTop: 2, children: _jsx9(Text9, { color: "gray", children: "\u2191/\u2193 select \u2022 enter to continue \u2022 esc to go back" }) })] });
|
|
3200
3193
|
case "existing-selection":
|
|
3201
|
-
return (
|
|
3194
|
+
return _jsxs8(_Fragment3, { children: [_jsxs8(Text9, { bold: true, color: "blue", children: ["Import Existing Project (", stepNumber, "/", totalSteps, ")"] }), _jsx9(Box7, { marginTop: 1, marginBottom: 2, children: _jsx9(Text9, { children: "Select Project:" }) }), renderOptions(), _jsx9(Box7, { marginTop: 2, children: _jsx9(Text9, { color: "gray", children: "\u2191/\u2193 select \u2022 enter to continue \u2022 esc to go back" }) })] });
|
|
3202
3195
|
case "config-template":
|
|
3203
|
-
return (
|
|
3196
|
+
return _jsxs8(_Fragment3, { children: [_jsxs8(Text9, { bold: true, color: "blue", children: ["Configuration Setup (", stepNumber, "/", totalSteps, ")"] }), _jsx9(Box7, { marginTop: 1, marginBottom: 2, children: _jsx9(Text9, { children: "Choose config template:" }) }), renderOptions(), _jsx9(Box7, { marginTop: 2, children: _jsx9(Text9, { color: "gray", children: "\u2191/\u2193 select \u2022 enter to continue \u2022 esc to go back" }) })] });
|
|
3204
3197
|
case "confirmation":
|
|
3205
|
-
return (
|
|
3198
|
+
return _jsxs8(_Fragment3, { children: [_jsxs8(Text9, { bold: true, color: "blue", children: ["Ready to ", state.source === "new" ? "Create" : "Import", " (", stepNumber, "/", totalSteps, ")"] }), _jsxs8(Box7, { marginTop: 1, marginBottom: 2, flexDirection: "column", children: [state.source === "new" ? _jsxs8(_Fragment3, { children: [_jsxs8(Text9, { children: ["\u2713 Project: ", state.projectName] }), _jsxs8(Text9, { children: ["\u2713 Team: ", getSelectedTeamName()] })] }) : _jsxs8(Text9, { children: ["\u2713 Project: ", getSelectedProjectName()] }), _jsxs8(Text9, { children: ["\u2713 Config: ", getSelectedTemplateName()] }), state.configTemplate !== "none" && _jsxs8(Text9, { children: ["\u2713 Location: ./", CONFIG_TEMPLATES[state.configTemplate].filename] })] }), renderOptions(), _jsx9(Box7, { marginTop: 2, children: _jsx9(Text9, { color: "gray", children: "\u2191/\u2193 select \u2022 enter to confirm \u2022 esc to go back" }) })] });
|
|
3206
3199
|
default:
|
|
3207
|
-
return (
|
|
3200
|
+
return _jsx9(Text9, { children: "Unknown step" });
|
|
3208
3201
|
}
|
|
3209
3202
|
}
|
|
3210
3203
|
function renderOptions() {
|
|
3211
3204
|
const options = getOptionsForCurrentStep();
|
|
3212
|
-
return (
|
|
3205
|
+
return _jsx9(Box7, { flexDirection: "column", children: options.map((option, index) => _jsx9(Box7, { marginLeft: 2, children: _jsxs8(Text9, { color: index === selectedOptionIndex ? "blue" : "white", children: [index === selectedOptionIndex ? "\u25CF" : "\u25CB", " ", option.label] }) }, option.value)) });
|
|
3213
3206
|
}
|
|
3214
3207
|
function getStepNumber() {
|
|
3215
3208
|
const stepOrder = ["source", "project-details", "team-selection", "existing-selection", "config-template", "confirmation"];
|
|
@@ -3230,13 +3223,9 @@ function InitForm({ onSuccess, onCancel, initialData }) {
|
|
|
3230
3223
|
return state.configTemplate ? CONFIG_TEMPLATES[state.configTemplate].name : "None";
|
|
3231
3224
|
}
|
|
3232
3225
|
}
|
|
3233
|
-
var import_jsx_runtime9, import_react9, import_ink9;
|
|
3234
3226
|
var init_InitForm = __esm({
|
|
3235
3227
|
"dist/components/InitForm.js"() {
|
|
3236
3228
|
"use strict";
|
|
3237
|
-
import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3238
|
-
import_react9 = require("react");
|
|
3239
|
-
import_ink9 = require("ink");
|
|
3240
3229
|
init_api();
|
|
3241
3230
|
init_platform();
|
|
3242
3231
|
init_config_templates();
|
|
@@ -3250,14 +3239,17 @@ var init_exports = {};
|
|
|
3250
3239
|
__export(init_exports, {
|
|
3251
3240
|
InitCommand: () => InitCommand
|
|
3252
3241
|
});
|
|
3242
|
+
import { jsx as _jsx10, jsxs as _jsxs9 } from "react/jsx-runtime";
|
|
3243
|
+
import React7 from "react";
|
|
3244
|
+
import { render as render6, Box as Box8, Text as Text10 } from "ink";
|
|
3253
3245
|
function InitApp({ options }) {
|
|
3254
|
-
const [state, setState] =
|
|
3246
|
+
const [state, setState] = React7.useState({
|
|
3255
3247
|
loading: true,
|
|
3256
3248
|
error: null,
|
|
3257
3249
|
success: false
|
|
3258
3250
|
});
|
|
3259
|
-
const [initialData, setInitialData] =
|
|
3260
|
-
|
|
3251
|
+
const [initialData, setInitialData] = React7.useState(null);
|
|
3252
|
+
React7.useEffect(() => {
|
|
3261
3253
|
async function initialize() {
|
|
3262
3254
|
try {
|
|
3263
3255
|
if (!await isOnline()) {
|
|
@@ -3308,15 +3300,15 @@ To reinitialize, please remove the existing config file first.`,
|
|
|
3308
3300
|
process.exit(0);
|
|
3309
3301
|
};
|
|
3310
3302
|
if (state.loading) {
|
|
3311
|
-
return (
|
|
3303
|
+
return _jsx10(Spinner, { text: "Initializing..." });
|
|
3312
3304
|
}
|
|
3313
3305
|
if (state.error) {
|
|
3314
|
-
return (
|
|
3306
|
+
return _jsxs9(Box8, { flexDirection: "column", children: [_jsxs9(Text10, { color: "red", children: ["Error: ", state.error] }), _jsx10(Text10, { color: "gray", children: "Please resolve the issue and try again." })] });
|
|
3315
3307
|
}
|
|
3316
3308
|
if (state.success && state.result) {
|
|
3317
|
-
return (
|
|
3309
|
+
return _jsxs9(Box8, { flexDirection: "column", children: [_jsx10(Text10, { color: "green", children: "\u2705 Project setup complete!" }), _jsx10(Text10, {}), _jsxs9(Text10, { children: ["Project: ", state.result.projectName] }), _jsxs9(Text10, { children: ["Project ID: ", state.result.projectId] }), state.result.configPath && _jsxs9(Text10, { children: ["Config file: ", state.result.configPath] }), _jsx10(Text10, {}), _jsx10(Text10, { color: "gray", children: "Visit https://docs.basic.tech for next steps." })] });
|
|
3318
3310
|
}
|
|
3319
|
-
return (
|
|
3311
|
+
return _jsx10(InitForm, { onSuccess: handleSuccess, onCancel: handleCancel, initialData: initialData || void 0 });
|
|
3320
3312
|
}
|
|
3321
3313
|
function parseCliOptions(options) {
|
|
3322
3314
|
const result = {};
|
|
@@ -3340,15 +3332,11 @@ function parseCliOptions(options) {
|
|
|
3340
3332
|
return result;
|
|
3341
3333
|
}
|
|
3342
3334
|
async function InitCommand(args = {}) {
|
|
3343
|
-
(
|
|
3335
|
+
render6(_jsx10(InitApp, { options: args }));
|
|
3344
3336
|
}
|
|
3345
|
-
var import_jsx_runtime10, import_react10, import_ink10;
|
|
3346
3337
|
var init_init = __esm({
|
|
3347
3338
|
"dist/commands/init.js"() {
|
|
3348
3339
|
"use strict";
|
|
3349
|
-
import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3350
|
-
import_react10 = __toESM(require("react"), 1);
|
|
3351
|
-
import_ink10 = require("ink");
|
|
3352
3340
|
init_InitForm();
|
|
3353
3341
|
init_Spinner();
|
|
3354
3342
|
init_auth();
|
|
@@ -3359,11 +3347,11 @@ var init_init = __esm({
|
|
|
3359
3347
|
});
|
|
3360
3348
|
|
|
3361
3349
|
// dist/index.js
|
|
3362
|
-
var import_commander = require("commander");
|
|
3363
3350
|
init_constants();
|
|
3364
3351
|
init_version();
|
|
3365
3352
|
init_errors();
|
|
3366
3353
|
init_platform();
|
|
3354
|
+
import { program } from "commander";
|
|
3367
3355
|
process.on("uncaughtException", (error) => {
|
|
3368
3356
|
console.error("Fatal error:", error.message);
|
|
3369
3357
|
process.exit(1);
|
|
@@ -3372,8 +3360,8 @@ process.on("SIGINT", () => {
|
|
|
3372
3360
|
console.log("\nOperation cancelled");
|
|
3373
3361
|
process.exit(0);
|
|
3374
3362
|
});
|
|
3375
|
-
|
|
3376
|
-
|
|
3363
|
+
program.name("basic").description("Basic CLI for creating & managing your projects").version(getVersion());
|
|
3364
|
+
program.command("login").description("Login to your Basic account").action(async () => {
|
|
3377
3365
|
try {
|
|
3378
3366
|
const { LoginCommand: LoginCommand2 } = await Promise.resolve().then(() => (init_login(), login_exports));
|
|
3379
3367
|
await LoginCommand2();
|
|
@@ -3384,7 +3372,7 @@ import_commander.program.command("login").description("Login to your Basic accou
|
|
|
3384
3372
|
process.exit(1);
|
|
3385
3373
|
}
|
|
3386
3374
|
});
|
|
3387
|
-
|
|
3375
|
+
program.command("logout").description("Logout from your Basic account").action(async () => {
|
|
3388
3376
|
try {
|
|
3389
3377
|
const { LogoutCommand: LogoutCommand2 } = await Promise.resolve().then(() => (init_logout(), logout_exports));
|
|
3390
3378
|
await LogoutCommand2();
|
|
@@ -3395,7 +3383,7 @@ import_commander.program.command("logout").description("Logout from your Basic a
|
|
|
3395
3383
|
process.exit(1);
|
|
3396
3384
|
}
|
|
3397
3385
|
});
|
|
3398
|
-
|
|
3386
|
+
program.command("account").description("Show account information").action(async () => {
|
|
3399
3387
|
try {
|
|
3400
3388
|
const { AccountCommand: AccountCommand2 } = await Promise.resolve().then(() => (init_account(), account_exports));
|
|
3401
3389
|
await AccountCommand2();
|
|
@@ -3406,7 +3394,7 @@ import_commander.program.command("account").description("Show account informatio
|
|
|
3406
3394
|
process.exit(1);
|
|
3407
3395
|
}
|
|
3408
3396
|
});
|
|
3409
|
-
|
|
3397
|
+
program.command("version").description("Show CLI version").action(async () => {
|
|
3410
3398
|
try {
|
|
3411
3399
|
const { VersionCommand: VersionCommand2 } = await Promise.resolve().then(() => (init_version2(), version_exports));
|
|
3412
3400
|
await VersionCommand2();
|
|
@@ -3417,7 +3405,7 @@ import_commander.program.command("version").description("Show CLI version").acti
|
|
|
3417
3405
|
process.exit(1);
|
|
3418
3406
|
}
|
|
3419
3407
|
});
|
|
3420
|
-
|
|
3408
|
+
program.command("update").description("Update CLI to the latest version").action(async () => {
|
|
3421
3409
|
try {
|
|
3422
3410
|
const { UpdateCommand: UpdateCommand2 } = await Promise.resolve().then(() => (init_update(), update_exports));
|
|
3423
3411
|
await UpdateCommand2();
|
|
@@ -3428,10 +3416,10 @@ import_commander.program.command("update").description("Update CLI to the latest
|
|
|
3428
3416
|
process.exit(1);
|
|
3429
3417
|
}
|
|
3430
3418
|
});
|
|
3431
|
-
|
|
3432
|
-
|
|
3419
|
+
program.command("help").description("Show help information").action(() => {
|
|
3420
|
+
program.help();
|
|
3433
3421
|
});
|
|
3434
|
-
|
|
3422
|
+
program.command("debug").description("Show Basic config directory location").action(async () => {
|
|
3435
3423
|
try {
|
|
3436
3424
|
const { DebugCommand: DebugCommand2 } = await Promise.resolve().then(() => (init_debug(), debug_exports));
|
|
3437
3425
|
await DebugCommand2();
|
|
@@ -3442,7 +3430,7 @@ import_commander.program.command("debug").description("Show Basic config directo
|
|
|
3442
3430
|
process.exit(1);
|
|
3443
3431
|
}
|
|
3444
3432
|
});
|
|
3445
|
-
|
|
3433
|
+
program.command("projects").description("List and browse your projects").action(async () => {
|
|
3446
3434
|
try {
|
|
3447
3435
|
const { ProjectsCommand: ProjectsCommand2 } = await Promise.resolve().then(() => (init_projects(), projects_exports));
|
|
3448
3436
|
await ProjectsCommand2();
|
|
@@ -3452,7 +3440,7 @@ import_commander.program.command("projects").description("List and browse your p
|
|
|
3452
3440
|
process.exit(1);
|
|
3453
3441
|
}
|
|
3454
3442
|
});
|
|
3455
|
-
|
|
3443
|
+
program.command("teams").argument("[action]", "Teams action (new)", "list").description("List teams or create a new team").action(async (action) => {
|
|
3456
3444
|
try {
|
|
3457
3445
|
const { TeamsCommand: TeamsCommand2 } = await Promise.resolve().then(() => (init_teams(), teams_exports));
|
|
3458
3446
|
await TeamsCommand2(action);
|
|
@@ -3462,7 +3450,7 @@ import_commander.program.command("teams").argument("[action]", "Teams action (ne
|
|
|
3462
3450
|
process.exit(1);
|
|
3463
3451
|
}
|
|
3464
3452
|
});
|
|
3465
|
-
|
|
3453
|
+
program.command("status").description("Show project status").action(async () => {
|
|
3466
3454
|
try {
|
|
3467
3455
|
const { StatusCommand: StatusCommand2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
3468
3456
|
await StatusCommand2();
|
|
@@ -3472,7 +3460,7 @@ import_commander.program.command("status").description("Show project status").ac
|
|
|
3472
3460
|
process.exit(1);
|
|
3473
3461
|
}
|
|
3474
3462
|
});
|
|
3475
|
-
|
|
3463
|
+
program.command("pull").description("Pull schema from remote").action(async () => {
|
|
3476
3464
|
try {
|
|
3477
3465
|
const { PullCommand: PullCommand2 } = await Promise.resolve().then(() => (init_pull(), pull_exports));
|
|
3478
3466
|
await PullCommand2();
|
|
@@ -3482,7 +3470,7 @@ import_commander.program.command("pull").description("Pull schema from remote").
|
|
|
3482
3470
|
process.exit(1);
|
|
3483
3471
|
}
|
|
3484
3472
|
});
|
|
3485
|
-
|
|
3473
|
+
program.command("push").description("Push schema to remote").action(async () => {
|
|
3486
3474
|
try {
|
|
3487
3475
|
const { PushCommand: PushCommand2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
|
3488
3476
|
await PushCommand2();
|
|
@@ -3492,7 +3480,7 @@ import_commander.program.command("push").description("Push schema to remote").ac
|
|
|
3492
3480
|
process.exit(1);
|
|
3493
3481
|
}
|
|
3494
3482
|
});
|
|
3495
|
-
|
|
3483
|
+
program.command("init").description("Create a new project or import an existing project").option("--new", "Create a new project (skip project type selection)").option("--existing", "Import an existing project").option("--name <name>", "Project name for new projects").option("--project <id>", "Project ID for existing projects").option("--ts", "Use TypeScript configuration template").option("--js", "Use JavaScript configuration template").action(async (options) => {
|
|
3496
3484
|
try {
|
|
3497
3485
|
const { InitCommand: InitCommand2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
3498
3486
|
await InitCommand2(options);
|
|
@@ -3502,7 +3490,7 @@ import_commander.program.command("init").description("Create a new project or im
|
|
|
3502
3490
|
process.exit(1);
|
|
3503
3491
|
}
|
|
3504
3492
|
});
|
|
3505
|
-
|
|
3493
|
+
program.on("command:*", (operands) => {
|
|
3506
3494
|
const unknownCommand = operands[0];
|
|
3507
3495
|
const suggestions = findSimilarCommands(unknownCommand);
|
|
3508
3496
|
console.error(`Unknown command: ${unknownCommand}
|
|
@@ -3521,4 +3509,4 @@ if (process.argv.length <= 2) {
|
|
|
3521
3509
|
console.log(MESSAGES.WELCOME);
|
|
3522
3510
|
process.exit(0);
|
|
3523
3511
|
}
|
|
3524
|
-
|
|
3512
|
+
program.parse();
|