@uniformdev/cli 20.42.1 → 20.42.2-alpha.7
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.mjs +228 -206
- package/package.json +12 -13
package/dist/index.mjs
CHANGED
|
@@ -35,7 +35,7 @@ import { writeFileSync } from "fs";
|
|
|
35
35
|
import { join as join3 } from "path";
|
|
36
36
|
|
|
37
37
|
// src/auth/getBearerToken.ts
|
|
38
|
-
import
|
|
38
|
+
import { confirm, password } from "@inquirer/prompts";
|
|
39
39
|
import jwt from "jsonwebtoken";
|
|
40
40
|
import open from "open";
|
|
41
41
|
|
|
@@ -44,24 +44,17 @@ var makeUrl = (baseUrl, path8) => [baseUrl.trim().replace(/\/+$/, ""), path8.tri
|
|
|
44
44
|
|
|
45
45
|
// src/auth/getBearerToken.ts
|
|
46
46
|
async function getBearerToken(baseUrl) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
name: "canOpen",
|
|
51
|
-
message: "Can we open a browser window to get a Uniform auth token?"
|
|
52
|
-
}
|
|
53
|
-
]);
|
|
47
|
+
const canOpen = await confirm({
|
|
48
|
+
message: "Can we open a browser window to get a Uniform auth token?"
|
|
49
|
+
});
|
|
54
50
|
if (canOpen) {
|
|
55
|
-
open(makeUrl(baseUrl, "/cli-login"));
|
|
51
|
+
await open(makeUrl(baseUrl, "/cli-login"));
|
|
56
52
|
}
|
|
57
|
-
const tokenAnswer = await
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
]);
|
|
64
|
-
const authToken = tokenAnswer.authToken.trim();
|
|
53
|
+
const tokenAnswer = await password({
|
|
54
|
+
message: "Paste your Uniform auth token",
|
|
55
|
+
mask: true
|
|
56
|
+
});
|
|
57
|
+
const authToken = tokenAnswer.trim();
|
|
65
58
|
if (!authToken) {
|
|
66
59
|
throw new Error("No auth token provided.");
|
|
67
60
|
}
|
|
@@ -274,6 +267,55 @@ var createClient = (baseUrl, authToken) => {
|
|
|
274
267
|
};
|
|
275
268
|
};
|
|
276
269
|
|
|
270
|
+
// src/environments.ts
|
|
271
|
+
import { select } from "@inquirer/prompts";
|
|
272
|
+
var ENVIRONMENT_HOSTS = {
|
|
273
|
+
usa: {
|
|
274
|
+
api: "https://uniform.app",
|
|
275
|
+
global: "https://uniform.global",
|
|
276
|
+
ai: "https://ai.uniform.global"
|
|
277
|
+
},
|
|
278
|
+
eu: {
|
|
279
|
+
api: "https://eu.uniform.app",
|
|
280
|
+
global: "https://eu.uniform.global",
|
|
281
|
+
ai: "https://ai.eu.uniform.global"
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
async function selectEnvironment(explicitParams) {
|
|
285
|
+
let needToPrompt = false;
|
|
286
|
+
if (!explicitParams.api && !explicitParams.global && !explicitParams.ai) {
|
|
287
|
+
needToPrompt = true;
|
|
288
|
+
}
|
|
289
|
+
let environment = "usa";
|
|
290
|
+
if (needToPrompt) {
|
|
291
|
+
environment = await select({
|
|
292
|
+
message: "Choose your data residency region",
|
|
293
|
+
choices: [
|
|
294
|
+
{
|
|
295
|
+
name: "USA (uniform.app)",
|
|
296
|
+
value: "usa"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "EU (eu.uniform.app)",
|
|
300
|
+
value: "eu"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
default: "usa"
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
const result = { ...ENVIRONMENT_HOSTS[environment] };
|
|
307
|
+
if (explicitParams.api !== void 0) {
|
|
308
|
+
result.api = explicitParams.api;
|
|
309
|
+
}
|
|
310
|
+
if (explicitParams.global !== void 0) {
|
|
311
|
+
result.global = explicitParams.global;
|
|
312
|
+
}
|
|
313
|
+
if (explicitParams.ai !== void 0) {
|
|
314
|
+
result.ai = explicitParams.ai;
|
|
315
|
+
}
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
|
|
277
319
|
// src/fs.ts
|
|
278
320
|
import { promises as fs } from "fs";
|
|
279
321
|
async function readJSON(path8) {
|
|
@@ -313,8 +355,8 @@ async function fileExists(filePath) {
|
|
|
313
355
|
}
|
|
314
356
|
|
|
315
357
|
// src/projects/getOrCreateProject.ts
|
|
358
|
+
import { input, select as select2 } from "@inquirer/prompts";
|
|
316
359
|
import fs2, { existsSync, mkdirSync } from "fs";
|
|
317
|
-
import inquirer2 from "inquirer";
|
|
318
360
|
import path from "path";
|
|
319
361
|
import slugify from "slugify";
|
|
320
362
|
var newProjectId = "$new";
|
|
@@ -372,22 +414,17 @@ async function getNewProjectName({
|
|
|
372
414
|
}) {
|
|
373
415
|
let projectName = explicitName;
|
|
374
416
|
if (!projectName) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
return true;
|
|
384
|
-
} catch (e) {
|
|
385
|
-
return e.message;
|
|
386
|
-
}
|
|
417
|
+
projectName = await input({
|
|
418
|
+
message: "What's your project name?",
|
|
419
|
+
validate(value) {
|
|
420
|
+
try {
|
|
421
|
+
validateProjectName(value, checkTargetDir, explicitTargetDir);
|
|
422
|
+
return true;
|
|
423
|
+
} catch (e) {
|
|
424
|
+
return e.message;
|
|
387
425
|
}
|
|
388
426
|
}
|
|
389
|
-
|
|
390
|
-
projectName = answer.name;
|
|
427
|
+
});
|
|
391
428
|
}
|
|
392
429
|
projectName = projectName.trim();
|
|
393
430
|
const targetDir = validateProjectName(projectName, checkTargetDir, explicitTargetDir);
|
|
@@ -415,17 +452,13 @@ async function chooseExistingProject({
|
|
|
415
452
|
value: t.id
|
|
416
453
|
}));
|
|
417
454
|
const choices = createNew ? [{ name: "Create new project...", value: newProjectId }].concat(projects) : projects;
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
message: "Choose a project",
|
|
423
|
-
choices
|
|
424
|
-
}
|
|
425
|
-
]);
|
|
455
|
+
const projectId = await select2({
|
|
456
|
+
message: "Choose a project",
|
|
457
|
+
choices
|
|
458
|
+
});
|
|
426
459
|
return {
|
|
427
|
-
projectId
|
|
428
|
-
projectName: projects.find((p) => p.value ===
|
|
460
|
+
projectId,
|
|
461
|
+
projectName: projects.find((p) => p.value === projectId)?.name
|
|
429
462
|
};
|
|
430
463
|
}
|
|
431
464
|
function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
@@ -995,21 +1028,17 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
995
1028
|
}
|
|
996
1029
|
|
|
997
1030
|
// src/teams/chooseTeam.ts
|
|
998
|
-
import
|
|
1031
|
+
import { select as select3 } from "@inquirer/prompts";
|
|
999
1032
|
async function chooseTeam(user, prompt, telemetry) {
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
name:
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
}
|
|
1010
|
-
]);
|
|
1011
|
-
telemetry.send("team picked", { teamId: result.teamId });
|
|
1012
|
-
return result;
|
|
1033
|
+
const teamId = await select3({
|
|
1034
|
+
message: prompt,
|
|
1035
|
+
choices: user.teams.map((team) => ({
|
|
1036
|
+
name: team.team.name,
|
|
1037
|
+
value: team.team.id
|
|
1038
|
+
}))
|
|
1039
|
+
});
|
|
1040
|
+
telemetry.send("team picked", { teamId });
|
|
1041
|
+
return { teamId };
|
|
1013
1042
|
}
|
|
1014
1043
|
|
|
1015
1044
|
// src/auth/user-info.ts
|
|
@@ -1142,13 +1171,13 @@ var package_default = {
|
|
|
1142
1171
|
graphql: "16.9.0",
|
|
1143
1172
|
"graphql-request": "6.1.0",
|
|
1144
1173
|
"image-size": "^1.2.1",
|
|
1145
|
-
inquirer: "
|
|
1146
|
-
"isomorphic-git": "1.
|
|
1174
|
+
"@inquirer/prompts": "^7.10.1",
|
|
1175
|
+
"isomorphic-git": "1.35.0",
|
|
1147
1176
|
"js-yaml": "^4.1.0",
|
|
1148
1177
|
jsonwebtoken: "9.0.2",
|
|
1149
1178
|
mitt: "^3.0.1",
|
|
1150
1179
|
"normalize-newline": "^4.1.0",
|
|
1151
|
-
open: "10.
|
|
1180
|
+
open: "10.2.0",
|
|
1152
1181
|
ora: "8.0.1",
|
|
1153
1182
|
"p-queue": "7.3.4",
|
|
1154
1183
|
"posthog-node": "4.11.3",
|
|
@@ -1162,7 +1191,6 @@ var package_default = {
|
|
|
1162
1191
|
},
|
|
1163
1192
|
devDependencies: {
|
|
1164
1193
|
"@types/diff": "5.0.9",
|
|
1165
|
-
"@types/inquirer": "9.0.7",
|
|
1166
1194
|
"@types/js-yaml": "4.0.9",
|
|
1167
1195
|
"@types/jsonwebtoken": "9.0.5",
|
|
1168
1196
|
"@types/node": "24.3.1",
|
|
@@ -1227,7 +1255,7 @@ var Telemetry = class {
|
|
|
1227
1255
|
};
|
|
1228
1256
|
|
|
1229
1257
|
// src/commands/ai/lib/agentUtils.ts
|
|
1230
|
-
import
|
|
1258
|
+
import { select as select4 } from "@inquirer/prompts";
|
|
1231
1259
|
import * as path2 from "path";
|
|
1232
1260
|
async function selectAgent(agentOption, options = {}) {
|
|
1233
1261
|
const { allowInteractive = true } = options;
|
|
@@ -1237,19 +1265,15 @@ async function selectAgent(agentOption, options = {}) {
|
|
|
1237
1265
|
if (!allowInteractive) {
|
|
1238
1266
|
throw new Error("Agent type must be specified when running in non-interactive mode. Use --agent flag.");
|
|
1239
1267
|
}
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
name: "
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
{ name: "Other AI assistant", value: "other" }
|
|
1250
|
-
]
|
|
1251
|
-
}
|
|
1252
|
-
]);
|
|
1268
|
+
const agentType = await select4({
|
|
1269
|
+
message: "Which AI development assistant are you using?",
|
|
1270
|
+
choices: [
|
|
1271
|
+
{ name: "Cursor", value: "cursor" },
|
|
1272
|
+
{ name: "Claude Desktop", value: "claude" },
|
|
1273
|
+
{ name: "GitHub Copilot (VS Code)", value: "copilot" },
|
|
1274
|
+
{ name: "Other AI assistant", value: "other" }
|
|
1275
|
+
]
|
|
1276
|
+
});
|
|
1253
1277
|
return agentType;
|
|
1254
1278
|
}
|
|
1255
1279
|
function getRulesDirectory(agentType, customDir) {
|
|
@@ -1380,9 +1404,6 @@ function getExistingServers(config2) {
|
|
|
1380
1404
|
}
|
|
1381
1405
|
|
|
1382
1406
|
// src/commands/ai/commands/mcp/install.ts
|
|
1383
|
-
var stableApiHost = "https://uniform.app";
|
|
1384
|
-
var apiHostDefault = process.env.UNIFORM_CLI_BASE_URL || stableApiHost;
|
|
1385
|
-
var aiApiHostDefault = process.env.UNIFORM_AI_API_HOST || "https://ai.uniform.global";
|
|
1386
1407
|
var InstallMcpCommand = {
|
|
1387
1408
|
command: "install",
|
|
1388
1409
|
describe: "Install Uniform MCP server configuration (use --team, --project, and --apiKey for non-interactive mode)",
|
|
@@ -1405,16 +1426,13 @@ var InstallMcpCommand = {
|
|
|
1405
1426
|
describe: "Team ID to use (skips team selection)",
|
|
1406
1427
|
type: "string"
|
|
1407
1428
|
}).option("apiHost", {
|
|
1408
|
-
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or
|
|
1409
|
-
default: apiHostDefault,
|
|
1410
|
-
demandOption: true,
|
|
1429
|
+
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or https://uniform.app. Supports dotenv.`,
|
|
1411
1430
|
type: "string"
|
|
1412
1431
|
}).option("apiKey", {
|
|
1413
1432
|
describe: "Uniform API key with write access rights (skips API key generation)",
|
|
1414
1433
|
type: "string"
|
|
1415
1434
|
}).option("aiApiHost", {
|
|
1416
1435
|
describe: "Uniform AI API host. Defaults to UNIFORM_AI_API_HOST env or https://ai.uniform.global",
|
|
1417
|
-
default: aiApiHostDefault,
|
|
1418
1436
|
type: "string"
|
|
1419
1437
|
})
|
|
1420
1438
|
),
|
|
@@ -1425,6 +1443,13 @@ var InstallMcpCommand = {
|
|
|
1425
1443
|
try {
|
|
1426
1444
|
console.log(blue("\n\u{1F680} Welcome to Uniform MCP Server Installer\n"));
|
|
1427
1445
|
const isNonInteractive = project && apiKey;
|
|
1446
|
+
const apiHostWithEnv = apiHost || process.env.UNIFORM_CLI_BASE_URL;
|
|
1447
|
+
const aiApiHostWithEnv = aiApiHost || process.env.UNIFORM_AI_API_HOST;
|
|
1448
|
+
const resolvedApiHosts = await selectEnvironment({
|
|
1449
|
+
api: apiHostWithEnv,
|
|
1450
|
+
ai: aiApiHostWithEnv
|
|
1451
|
+
});
|
|
1452
|
+
telemetry.send("environment selected", { apiHost: resolvedApiHosts.api });
|
|
1428
1453
|
let teamId;
|
|
1429
1454
|
let projectId;
|
|
1430
1455
|
let projectName;
|
|
@@ -1438,13 +1463,13 @@ var InstallMcpCommand = {
|
|
|
1438
1463
|
writeApiKey = apiKey;
|
|
1439
1464
|
} else {
|
|
1440
1465
|
console.log(yellow3("Running in interactive mode team and project arguments are ignored"));
|
|
1441
|
-
const auth = await getBearerToken(
|
|
1466
|
+
const auth = await getBearerToken(resolvedApiHosts.api);
|
|
1442
1467
|
const { authToken } = auth;
|
|
1443
|
-
const uniformClient = createClient(
|
|
1468
|
+
const uniformClient = createClient(resolvedApiHosts.api, authToken);
|
|
1444
1469
|
let done2 = await spin("Fetching user information...");
|
|
1445
1470
|
user = await fetchUserAndEnsureFirstTeamExists({
|
|
1446
1471
|
auth,
|
|
1447
|
-
baseUrl:
|
|
1472
|
+
baseUrl: resolvedApiHosts.api,
|
|
1448
1473
|
spin,
|
|
1449
1474
|
telemetry
|
|
1450
1475
|
});
|
|
@@ -1509,7 +1534,12 @@ Selected agent: ${agentType}`));
|
|
|
1509
1534
|
done = await spin("Reading existing MCP configuration...");
|
|
1510
1535
|
const existingConfig = readOrCreateMcpConfig(mcpConfigPath, agentType);
|
|
1511
1536
|
await done();
|
|
1512
|
-
const uniformServer = createUniformMcpServerConfig(
|
|
1537
|
+
const uniformServer = createUniformMcpServerConfig(
|
|
1538
|
+
writeApiKey,
|
|
1539
|
+
projectId,
|
|
1540
|
+
resolvedApiHosts.ai,
|
|
1541
|
+
resolvedApiHosts.api
|
|
1542
|
+
);
|
|
1513
1543
|
const mergedConfig = mergeMcpConfig(existingConfig, uniformServer, agentType);
|
|
1514
1544
|
done = await spin("Updating MCP configuration...");
|
|
1515
1545
|
writeFileSync(mcpConfigPath, JSON.stringify(mergedConfig, null, 2));
|
|
@@ -1591,9 +1621,9 @@ import yargs2 from "yargs";
|
|
|
1591
1621
|
import { blue as blue3, green as green4, red as red4 } from "colorette";
|
|
1592
1622
|
|
|
1593
1623
|
// src/commands/ai/lib/rulesInstaller.ts
|
|
1624
|
+
import { checkbox, confirm as confirm2, select as select5, Separator } from "@inquirer/prompts";
|
|
1594
1625
|
import { blue as blue2, bold, cyan, gray as gray2, green as green3, yellow as yellow4 } from "colorette";
|
|
1595
1626
|
import { promises as fs6 } from "fs";
|
|
1596
|
-
import inquirer5 from "inquirer";
|
|
1597
1627
|
import * as path4 from "path";
|
|
1598
1628
|
|
|
1599
1629
|
// src/commands/ai/lib/frameworkDetection.ts
|
|
@@ -1825,25 +1855,20 @@ async function installRules(options = {}, spin) {
|
|
|
1825
1855
|
const agentType = await selectAgent(options.agent);
|
|
1826
1856
|
let installLocation;
|
|
1827
1857
|
if (agentType === "copilot") {
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
],
|
|
1843
|
-
default: "workspace"
|
|
1844
|
-
}
|
|
1845
|
-
]);
|
|
1846
|
-
installLocation = location;
|
|
1858
|
+
installLocation = await select5({
|
|
1859
|
+
message: "Where would you like to install the instructions?",
|
|
1860
|
+
choices: [
|
|
1861
|
+
{
|
|
1862
|
+
name: "Workspace (.github/instructions) - Available only in this workspace",
|
|
1863
|
+
value: "workspace"
|
|
1864
|
+
},
|
|
1865
|
+
{
|
|
1866
|
+
name: "User profile - Available across all workspaces (requires VS Code profile setup)",
|
|
1867
|
+
value: "user"
|
|
1868
|
+
}
|
|
1869
|
+
],
|
|
1870
|
+
default: "workspace"
|
|
1871
|
+
});
|
|
1847
1872
|
}
|
|
1848
1873
|
const selectedRules = await selectRules(availableRules, frameworkDetection);
|
|
1849
1874
|
if (selectedRules.length === 0) {
|
|
@@ -1892,14 +1917,10 @@ async function selectRules(availableRules, frameworkDetection) {
|
|
|
1892
1917
|
});
|
|
1893
1918
|
console.log("");
|
|
1894
1919
|
}
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
message: "Install all essential rules? (Recommended)",
|
|
1900
|
-
default: true
|
|
1901
|
-
}
|
|
1902
|
-
]);
|
|
1920
|
+
const installEssential = await confirm2({
|
|
1921
|
+
message: "Install all essential rules? (Recommended)",
|
|
1922
|
+
default: true
|
|
1923
|
+
});
|
|
1903
1924
|
const suggestedFrameworkRules = [];
|
|
1904
1925
|
if (frameworkDetection?.suggestedRules && frameworkDetection.suggestedRules.length > 0) {
|
|
1905
1926
|
console.log(cyan(`\u{1F527} Framework-Specific Rules for ${getFrameworkDescription(frameworkDetection)}:`));
|
|
@@ -1912,14 +1933,10 @@ async function selectRules(availableRules, frameworkDetection) {
|
|
|
1912
1933
|
});
|
|
1913
1934
|
if (suggestedFrameworkRules.length > 0) {
|
|
1914
1935
|
console.log("");
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
message: "Install recommended framework-specific rules? (Highly recommended)",
|
|
1920
|
-
default: true
|
|
1921
|
-
}
|
|
1922
|
-
]);
|
|
1936
|
+
const installFramework = await confirm2({
|
|
1937
|
+
message: "Install recommended framework-specific rules? (Highly recommended)",
|
|
1938
|
+
default: true
|
|
1939
|
+
});
|
|
1923
1940
|
if (installFramework) {
|
|
1924
1941
|
console.log(green3(`\u2705 Added ${suggestedFrameworkRules.length} framework-specific rule(s)
|
|
1925
1942
|
`));
|
|
@@ -1940,29 +1957,25 @@ async function selectRules(availableRules, frameworkDetection) {
|
|
|
1940
1957
|
(category) => groupedRules[category].filter((rule) => !alreadySelectedNames.includes(rule.name))
|
|
1941
1958
|
);
|
|
1942
1959
|
if (availableAdditionalRules.length > 0) {
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
];
|
|
1963
|
-
})
|
|
1964
|
-
}
|
|
1965
|
-
]);
|
|
1960
|
+
const additionalRules = await checkbox({
|
|
1961
|
+
message: "Select additional rules to install:",
|
|
1962
|
+
choices: otherCategories.flatMap((category) => {
|
|
1963
|
+
const categoryRules = groupedRules[category].filter(
|
|
1964
|
+
(rule) => !alreadySelectedNames.includes(rule.name)
|
|
1965
|
+
);
|
|
1966
|
+
if (categoryRules.length === 0) {
|
|
1967
|
+
return [];
|
|
1968
|
+
}
|
|
1969
|
+
return [
|
|
1970
|
+
new Separator(cyan(`--- ${getCategoryDisplayName(category)} ---`)),
|
|
1971
|
+
...categoryRules.map((rule) => ({
|
|
1972
|
+
name: `${rule.displayName} - ${gray2(rule.description)}`,
|
|
1973
|
+
value: rule,
|
|
1974
|
+
short: rule.displayName
|
|
1975
|
+
}))
|
|
1976
|
+
];
|
|
1977
|
+
})
|
|
1978
|
+
});
|
|
1966
1979
|
selectedRules.push(...additionalRules);
|
|
1967
1980
|
}
|
|
1968
1981
|
}
|
|
@@ -10436,7 +10449,7 @@ var IntegrationCommand = {
|
|
|
10436
10449
|
};
|
|
10437
10450
|
|
|
10438
10451
|
// src/commands/new/commands/new.ts
|
|
10439
|
-
import
|
|
10452
|
+
import { select as select6 } from "@inquirer/prompts";
|
|
10440
10453
|
|
|
10441
10454
|
// src/npm.ts
|
|
10442
10455
|
import execa from "execa";
|
|
@@ -10516,12 +10529,10 @@ async function newHandler({
|
|
|
10516
10529
|
spin,
|
|
10517
10530
|
projectName,
|
|
10518
10531
|
apiHost,
|
|
10532
|
+
edgeApiHost,
|
|
10519
10533
|
outputPath,
|
|
10520
10534
|
telemetry
|
|
10521
10535
|
}) {
|
|
10522
|
-
console.info(
|
|
10523
|
-
`Welcome to Uniform New! Let's create ${projectName ? `"${projectName}"` : "a new project"}... \u2764\uFE0F`
|
|
10524
|
-
);
|
|
10525
10536
|
const auth = await getBearerToken(apiHost);
|
|
10526
10537
|
const { authToken } = auth;
|
|
10527
10538
|
const uniformClient = createClient(apiHost, authToken);
|
|
@@ -10531,23 +10542,19 @@ async function newHandler({
|
|
|
10531
10542
|
`Hey ${user.name}! Choose a Uniform team for your new project`,
|
|
10532
10543
|
telemetry
|
|
10533
10544
|
);
|
|
10534
|
-
const
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
}
|
|
10548
|
-
]
|
|
10549
|
-
}
|
|
10550
|
-
]);
|
|
10545
|
+
const frontendFramework = await select6({
|
|
10546
|
+
message: "Choose your preferred framework",
|
|
10547
|
+
choices: [
|
|
10548
|
+
{
|
|
10549
|
+
name: "Next.JS",
|
|
10550
|
+
value: "next"
|
|
10551
|
+
},
|
|
10552
|
+
{
|
|
10553
|
+
name: "Nuxt.JS",
|
|
10554
|
+
value: "nuxt"
|
|
10555
|
+
}
|
|
10556
|
+
]
|
|
10557
|
+
});
|
|
10551
10558
|
telemetry.send("framework picked", { frontendFramework });
|
|
10552
10559
|
const starters = {
|
|
10553
10560
|
next: {
|
|
@@ -10583,16 +10590,11 @@ async function newHandler({
|
|
|
10583
10590
|
}
|
|
10584
10591
|
};
|
|
10585
10592
|
let githubBranch = void 0;
|
|
10586
|
-
const {
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
name: "starter",
|
|
10592
|
-
message: `Choose one of the Uniform starters (for ${frontendFramework === "next" ? "Next.JS" : "Nuxt.JS"})`,
|
|
10593
|
-
choices: Object.values(starters[frontendFramework])
|
|
10594
|
-
}
|
|
10595
|
-
]);
|
|
10593
|
+
const starter = await select6({
|
|
10594
|
+
message: `Choose one of the Uniform starters (for ${frontendFramework === "next" ? "Next.JS" : "Nuxt.JS"})`,
|
|
10595
|
+
choices: Object.values(starters[frontendFramework])
|
|
10596
|
+
});
|
|
10597
|
+
const { githubUri, serverUrl, previewPath, installEnv } = starter;
|
|
10596
10598
|
if (process.env.UNIFORM_ALTERNATIVE_STARTER_BRANCH) {
|
|
10597
10599
|
console.log(
|
|
10598
10600
|
`Using alternative starter branch for repo ${githubUri}: "${process.env.UNIFORM_ALTERNATIVE_STARTER_BRANCH}"`
|
|
@@ -10622,10 +10624,12 @@ async function newHandler({
|
|
|
10622
10624
|
["UNIFORM_CLI_API_KEY", writeApiKey],
|
|
10623
10625
|
...installEnv
|
|
10624
10626
|
].concat(
|
|
10625
|
-
apiHost !==
|
|
10627
|
+
apiHost !== ENVIRONMENT_HOSTS.usa.api ? [
|
|
10626
10628
|
["UNIFORM_CLI_BASE_URL", apiHost],
|
|
10627
10629
|
["UNIFORM_API_HOST", apiHost]
|
|
10628
10630
|
] : []
|
|
10631
|
+
).concat(
|
|
10632
|
+
edgeApiHost !== ENVIRONMENT_HOSTS.usa.global ? [["UNIFORM_CLI_BASE_EDGE_URL", edgeApiHost]] : []
|
|
10629
10633
|
).map(([name, value]) => `${name}='${value}'`).join("\n") + "\n";
|
|
10630
10634
|
await done();
|
|
10631
10635
|
const cloneStartTimestamp = Date.now();
|
|
@@ -10670,8 +10674,8 @@ npm run dev
|
|
|
10670
10674
|
}
|
|
10671
10675
|
|
|
10672
10676
|
// src/commands/new/commands/new-mesh-integration.ts
|
|
10677
|
+
import { input as input2 } from "@inquirer/prompts";
|
|
10673
10678
|
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
|
|
10674
|
-
import inquirer7 from "inquirer";
|
|
10675
10679
|
import path7 from "path";
|
|
10676
10680
|
import slugify2 from "slugify";
|
|
10677
10681
|
async function newMeshIntegrationHandler({
|
|
@@ -10690,32 +10694,33 @@ async function newMeshIntegrationHandler({
|
|
|
10690
10694
|
`Hey ${user.name}! Choose a Uniform team to register your integration`,
|
|
10691
10695
|
telemetry
|
|
10692
10696
|
);
|
|
10693
|
-
const
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
return true;
|
|
10702
|
-
} catch (e) {
|
|
10703
|
-
return e.message;
|
|
10704
|
-
}
|
|
10697
|
+
const name = await input2({
|
|
10698
|
+
message: "Please name your integration",
|
|
10699
|
+
validate(value) {
|
|
10700
|
+
try {
|
|
10701
|
+
validateIntegrationName(value, outputPath);
|
|
10702
|
+
return true;
|
|
10703
|
+
} catch (e) {
|
|
10704
|
+
return e.message;
|
|
10705
10705
|
}
|
|
10706
10706
|
}
|
|
10707
|
-
|
|
10708
|
-
const
|
|
10709
|
-
const { targetDir, typeSlug } = validateIntegrationName(answer.name, outputPath);
|
|
10707
|
+
});
|
|
10708
|
+
const { targetDir, typeSlug } = validateIntegrationName(name, outputPath);
|
|
10710
10709
|
const githubBranch = process.env.UNIFORM_ALTERNATIVE_MESH_INTEGRATION_BRANCH;
|
|
10711
10710
|
if (githubBranch) {
|
|
10712
10711
|
console.log(`Using alternative mesh integration branch: "${githubBranch}"`);
|
|
10713
10712
|
}
|
|
10713
|
+
const envVars = [["UNIFORM_CLI_TEAM_ID", teamId]];
|
|
10714
|
+
if (apiHost !== ENVIRONMENT_HOSTS.usa.api) {
|
|
10715
|
+
envVars.push(["UNIFORM_CLI_BASE_URL", apiHost]);
|
|
10716
|
+
}
|
|
10717
|
+
const dotEnvFile = envVars.length > 0 ? envVars.map(([name2, value]) => `${name2}='${value}'`).join("\n") + "\n" : void 0;
|
|
10714
10718
|
const { runNpmInstall } = await cloneStarter({
|
|
10715
10719
|
githubPath: `uniformdev/examples/mesh/mesh-integration`,
|
|
10716
10720
|
spin,
|
|
10717
10721
|
targetDir,
|
|
10718
|
-
githubBranch
|
|
10722
|
+
githubBranch,
|
|
10723
|
+
dotEnvFile
|
|
10719
10724
|
});
|
|
10720
10725
|
let done = await spin("Registering integration to team...");
|
|
10721
10726
|
const pathToManifest = path7.resolve(targetDir, "mesh-manifest.json");
|
|
@@ -10786,8 +10791,6 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
|
|
|
10786
10791
|
}
|
|
10787
10792
|
|
|
10788
10793
|
// src/commands/new/index.ts
|
|
10789
|
-
var stableApiHost2 = "https://uniform.app";
|
|
10790
|
-
var apiHostDefault2 = process.env.UNIFORM_CLI_BASE_URL || stableApiHost2;
|
|
10791
10794
|
var disableTelemetryDefault = !["", "0", "false", "no"].includes(
|
|
10792
10795
|
process.env.UNIFORM_CLI_DISABLE_TELEMETRY || ""
|
|
10793
10796
|
);
|
|
@@ -10798,9 +10801,10 @@ var NewCmd = {
|
|
|
10798
10801
|
describe: "Name of a project",
|
|
10799
10802
|
type: "string"
|
|
10800
10803
|
}).option("apiHost", {
|
|
10801
|
-
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
+
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or https://uniform.app. Supports dotenv.`,
|
|
10805
|
+
type: "string"
|
|
10806
|
+
}).option("edgeApiHost", {
|
|
10807
|
+
describe: `Uniform edge API host. Defaults to UNIFORM_CLI_BASE_EDGE_URL env or https://uniform.global. Supports dotenv.`,
|
|
10804
10808
|
type: "string"
|
|
10805
10809
|
}).option("outputPath", {
|
|
10806
10810
|
alias: "o",
|
|
@@ -10814,11 +10818,26 @@ var NewCmd = {
|
|
|
10814
10818
|
})
|
|
10815
10819
|
),
|
|
10816
10820
|
describe: "Start a new Uniform project",
|
|
10817
|
-
handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
|
|
10821
|
+
handler: async function({ name, apiHost, edgeApiHost, outputPath, disableTelemetry }) {
|
|
10818
10822
|
const { stopAllSpinners, spin } = makeSpinner();
|
|
10819
|
-
const telemetry = new Telemetry("cli new", disableTelemetry
|
|
10823
|
+
const telemetry = new Telemetry("cli new", disableTelemetry);
|
|
10820
10824
|
try {
|
|
10821
|
-
|
|
10825
|
+
const apiHostWithEnv = apiHost || process.env.UNIFORM_CLI_BASE_URL;
|
|
10826
|
+
const edgeApiHostWithEnv = edgeApiHost || process.env.UNIFORM_CLI_BASE_EDGE_URL;
|
|
10827
|
+
const resolvedApiHosts = await selectEnvironment({
|
|
10828
|
+
api: apiHostWithEnv,
|
|
10829
|
+
global: edgeApiHostWithEnv
|
|
10830
|
+
});
|
|
10831
|
+
telemetry.send("environment selected", { apiHost: resolvedApiHosts.api });
|
|
10832
|
+
console.info(`Welcome to Uniform New! Let's create ${name ? `"${name}"` : "a new project"}... \u2764\uFE0F`);
|
|
10833
|
+
await newHandler({
|
|
10834
|
+
spin,
|
|
10835
|
+
projectName: name,
|
|
10836
|
+
apiHost: resolvedApiHosts.api,
|
|
10837
|
+
edgeApiHost: resolvedApiHosts.global,
|
|
10838
|
+
outputPath,
|
|
10839
|
+
telemetry
|
|
10840
|
+
});
|
|
10822
10841
|
stopAllSpinners();
|
|
10823
10842
|
process.exit(0);
|
|
10824
10843
|
} catch (err) {
|
|
@@ -10835,9 +10854,7 @@ var NewMeshCmd = {
|
|
|
10835
10854
|
command: "new-integration",
|
|
10836
10855
|
builder: (y) => withConfiguration(
|
|
10837
10856
|
y.option("apiHost", {
|
|
10838
|
-
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or
|
|
10839
|
-
default: apiHostDefault2,
|
|
10840
|
-
demandOption: true,
|
|
10857
|
+
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or https://uniform.app. Supports dotenv.`,
|
|
10841
10858
|
type: "string"
|
|
10842
10859
|
}).option("outputPath", {
|
|
10843
10860
|
alias: "o",
|
|
@@ -10853,9 +10870,14 @@ var NewMeshCmd = {
|
|
|
10853
10870
|
describe: "Start a new Uniform project",
|
|
10854
10871
|
handler: async function({ apiHost, outputPath, disableTelemetry }) {
|
|
10855
10872
|
const { stopAllSpinners, spin } = makeSpinner();
|
|
10856
|
-
const telemetry = new Telemetry("cli new mesh", disableTelemetry
|
|
10873
|
+
const telemetry = new Telemetry("cli new mesh", disableTelemetry);
|
|
10857
10874
|
try {
|
|
10858
|
-
|
|
10875
|
+
const apiHostWithEnv = apiHost || process.env.UNIFORM_CLI_BASE_URL;
|
|
10876
|
+
const resolvedApiHosts = await selectEnvironment({
|
|
10877
|
+
api: apiHostWithEnv
|
|
10878
|
+
});
|
|
10879
|
+
telemetry.send("environment selected", { apiHost: resolvedApiHosts.api });
|
|
10880
|
+
await newMeshIntegrationHandler({ spin, apiHost: resolvedApiHosts.api, outputPath, telemetry });
|
|
10859
10881
|
stopAllSpinners();
|
|
10860
10882
|
process.exit(0);
|
|
10861
10883
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "20.42.
|
|
3
|
+
"version": "20.42.2-alpha.7+7c73a42006",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -26,14 +26,15 @@
|
|
|
26
26
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\""
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@inquirer/prompts": "^7.10.1",
|
|
29
30
|
"@thi.ng/mime": "^2.2.23",
|
|
30
|
-
"@uniformdev/assets": "20.42.
|
|
31
|
-
"@uniformdev/canvas": "20.42.
|
|
32
|
-
"@uniformdev/context": "20.42.
|
|
33
|
-
"@uniformdev/files": "20.42.
|
|
34
|
-
"@uniformdev/project-map": "20.42.
|
|
35
|
-
"@uniformdev/redirect": "20.42.
|
|
36
|
-
"@uniformdev/richtext": "20.42.
|
|
31
|
+
"@uniformdev/assets": "20.42.2-alpha.7+7c73a42006",
|
|
32
|
+
"@uniformdev/canvas": "20.42.2-alpha.7+7c73a42006",
|
|
33
|
+
"@uniformdev/context": "20.42.2-alpha.7+7c73a42006",
|
|
34
|
+
"@uniformdev/files": "20.42.2-alpha.7+7c73a42006",
|
|
35
|
+
"@uniformdev/project-map": "20.42.2-alpha.7+7c73a42006",
|
|
36
|
+
"@uniformdev/redirect": "20.42.2-alpha.7+7c73a42006",
|
|
37
|
+
"@uniformdev/richtext": "20.42.2-alpha.7+7c73a42006",
|
|
37
38
|
"call-bind": "^1.0.2",
|
|
38
39
|
"colorette": "2.0.20",
|
|
39
40
|
"cosmiconfig": "9.0.0",
|
|
@@ -47,13 +48,12 @@
|
|
|
47
48
|
"graphql": "16.9.0",
|
|
48
49
|
"graphql-request": "6.1.0",
|
|
49
50
|
"image-size": "^1.2.1",
|
|
50
|
-
"
|
|
51
|
-
"isomorphic-git": "1.33.1",
|
|
51
|
+
"isomorphic-git": "1.35.0",
|
|
52
52
|
"js-yaml": "^4.1.0",
|
|
53
53
|
"jsonwebtoken": "9.0.2",
|
|
54
54
|
"mitt": "^3.0.1",
|
|
55
55
|
"normalize-newline": "^4.1.0",
|
|
56
|
-
"open": "10.
|
|
56
|
+
"open": "10.2.0",
|
|
57
57
|
"ora": "8.0.1",
|
|
58
58
|
"p-queue": "7.3.4",
|
|
59
59
|
"posthog-node": "4.11.3",
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/diff": "5.0.9",
|
|
70
|
-
"@types/inquirer": "9.0.7",
|
|
71
70
|
"@types/js-yaml": "4.0.9",
|
|
72
71
|
"@types/jsonwebtoken": "9.0.5",
|
|
73
72
|
"@types/node": "24.3.1",
|
|
@@ -82,5 +81,5 @@
|
|
|
82
81
|
"publishConfig": {
|
|
83
82
|
"access": "public"
|
|
84
83
|
},
|
|
85
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "7c73a420066036df69f25a0f423d56613f5ee0af"
|
|
86
85
|
}
|