@kuckit/cli 0.2.0 → 1.0.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/dist/bin.js +44 -2
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -224,6 +224,44 @@ async function doctor(options) {
|
|
|
224
224
|
status: "pass",
|
|
225
225
|
message: "SDK packages installed"
|
|
226
226
|
});
|
|
227
|
+
const serverModulesPath = join(cwd, "apps", "server", "src", "config", "modules.ts");
|
|
228
|
+
const clientModulesPath = join(cwd, "apps", "web", "src", "modules.client.ts");
|
|
229
|
+
if (existsSync(serverModulesPath) && existsSync(clientModulesPath)) {
|
|
230
|
+
const serverContent = readFileSync(serverModulesPath, "utf-8");
|
|
231
|
+
const clientContent = readFileSync(clientModulesPath, "utf-8");
|
|
232
|
+
const serverModulePattern = /from\s+['"]@[^'"]+\/([^'"]+)-module['"]/g;
|
|
233
|
+
const clientModulePattern = /from\s+['"]@[^'"]+\/([^'"]+)-module\/client['"]/g;
|
|
234
|
+
const serverModules = /* @__PURE__ */ new Set();
|
|
235
|
+
const clientModules = /* @__PURE__ */ new Set();
|
|
236
|
+
let match;
|
|
237
|
+
while ((match = serverModulePattern.exec(serverContent)) !== null) {
|
|
238
|
+
const lineStart = serverContent.lastIndexOf("\n", match.index) + 1;
|
|
239
|
+
if (!serverContent.slice(lineStart, match.index).includes("//")) serverModules.add(match[1]);
|
|
240
|
+
}
|
|
241
|
+
while ((match = clientModulePattern.exec(clientContent)) !== null) {
|
|
242
|
+
const lineStart = clientContent.lastIndexOf("\n", match.index) + 1;
|
|
243
|
+
if (!clientContent.slice(lineStart, match.index).includes("//")) clientModules.add(match[1]);
|
|
244
|
+
}
|
|
245
|
+
const clientOnly = [...clientModules].filter((m) => !serverModules.has(m));
|
|
246
|
+
const serverOnly = [...serverModules].filter((m) => !clientModules.has(m));
|
|
247
|
+
if (clientOnly.length > 0) checks.push({
|
|
248
|
+
name: "module-sync",
|
|
249
|
+
status: "fail",
|
|
250
|
+
message: `Client modules without matching server modules (will cause 404 errors)`,
|
|
251
|
+
details: clientOnly.map((m) => ` - ${m}-module: registered in client but not server`)
|
|
252
|
+
});
|
|
253
|
+
else if (serverOnly.length > 0) checks.push({
|
|
254
|
+
name: "module-sync",
|
|
255
|
+
status: "warn",
|
|
256
|
+
message: `Server modules without matching client modules`,
|
|
257
|
+
details: serverOnly.map((m) => ` - ${m}-module: registered in server but not client`)
|
|
258
|
+
});
|
|
259
|
+
else if (serverModules.size > 0 || clientModules.size > 0) checks.push({
|
|
260
|
+
name: "module-sync",
|
|
261
|
+
status: "pass",
|
|
262
|
+
message: "Server and client modules are in sync"
|
|
263
|
+
});
|
|
264
|
+
}
|
|
227
265
|
const report = {
|
|
228
266
|
success: checks.every((c) => c.status !== "fail"),
|
|
229
267
|
checks,
|
|
@@ -519,7 +557,7 @@ async function dbStudio(options) {
|
|
|
519
557
|
|
|
520
558
|
//#endregion
|
|
521
559
|
//#region src/lib/credentials.ts
|
|
522
|
-
const DEFAULT_SERVER_URL = "
|
|
560
|
+
const DEFAULT_SERVER_URL = "https://dev-app-nyh7i73bea-uc.a.run.app/";
|
|
523
561
|
const CONFIG_DIR = join(homedir(), ".kuckit");
|
|
524
562
|
const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
525
563
|
function loadConfig$8() {
|
|
@@ -644,10 +682,12 @@ async function authLogin(options) {
|
|
|
644
682
|
...config,
|
|
645
683
|
cliToken: pollResult.token,
|
|
646
684
|
tokenExpiresAt: expiresAt,
|
|
685
|
+
permissions: pollResult.permissions,
|
|
647
686
|
serverUrl
|
|
648
687
|
});
|
|
649
688
|
console.log("✓ Successfully authenticated!");
|
|
650
689
|
console.log(` Token expires: ${formatExpiryDate(expiresAt)}`);
|
|
690
|
+
if (pollResult.permissions && pollResult.permissions.length > 0) console.log(` Permissions: ${pollResult.permissions.join(", ")}`);
|
|
651
691
|
console.log("");
|
|
652
692
|
return;
|
|
653
693
|
}
|
|
@@ -690,7 +730,8 @@ async function authWhoami(options) {
|
|
|
690
730
|
userId: config.userId,
|
|
691
731
|
userName: config.userName,
|
|
692
732
|
serverUrl: config.serverUrl,
|
|
693
|
-
tokenExpiresAt: config.tokenExpiresAt
|
|
733
|
+
tokenExpiresAt: config.tokenExpiresAt,
|
|
734
|
+
permissions: config.permissions
|
|
694
735
|
}));
|
|
695
736
|
else {
|
|
696
737
|
console.log("\nAuthenticated");
|
|
@@ -698,6 +739,7 @@ async function authWhoami(options) {
|
|
|
698
739
|
if (config.userId) console.log(` ID: ${config.userId}`);
|
|
699
740
|
if (config.serverUrl) console.log(` Server: ${config.serverUrl}`);
|
|
700
741
|
if (config.tokenExpiresAt) console.log(` Token expires: ${formatExpiryDate(config.tokenExpiresAt)}`);
|
|
742
|
+
if (config.permissions && config.permissions.length > 0) console.log(` Permissions: ${config.permissions.join(", ")}`);
|
|
701
743
|
console.log("");
|
|
702
744
|
}
|
|
703
745
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kuckit/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CLI tools for Kuckit SDK module development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsdown",
|
|
42
|
-
"prepublishOnly": "npm run build && node ../../scripts/check-no-workspace-protocol.cjs"
|
|
42
|
+
"prepublishOnly": "npm run build && node ../../scripts/resolve-workspace-protocols.cjs && node ../../scripts/check-no-workspace-protocol.cjs"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@inquirer/prompts": "^7.2.1",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"tsdown": "catalog:"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@kuckit/sdk": ">=
|
|
56
|
+
"@kuckit/sdk": ">=1.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@kuckit/sdk": {
|