@stndrds/cli 1.0.0-alpha.139 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +3 -24
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -336,7 +336,6 @@ import { mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
|
336
336
|
import { homedir } from "os";
|
|
337
337
|
import { dirname, join } from "path";
|
|
338
338
|
var DEFAULT_API_URL = "http://localhost:4100/v1";
|
|
339
|
-
var ENV_PROFILE_NAME = "sandbox";
|
|
340
339
|
function getDefaultApiUrl() {
|
|
341
340
|
return DEFAULT_API_URL;
|
|
342
341
|
}
|
|
@@ -394,39 +393,19 @@ async function removeProfile(name) {
|
|
|
394
393
|
}
|
|
395
394
|
async function listProfiles() {
|
|
396
395
|
const config = await readConfig();
|
|
397
|
-
|
|
396
|
+
return Object.entries(config.profiles).sort(([a], [b]) => a.localeCompare(b)).map(([name, profile]) => ({
|
|
398
397
|
name,
|
|
399
398
|
apiUrl: profile.apiUrl,
|
|
400
399
|
current: config.currentProfile === name
|
|
401
400
|
}));
|
|
402
|
-
const envProfile = getEnvProfile();
|
|
403
|
-
if (envProfile) {
|
|
404
|
-
profiles.push({
|
|
405
|
-
name: ENV_PROFILE_NAME,
|
|
406
|
-
apiUrl: envProfile.apiUrl,
|
|
407
|
-
current: !config.currentProfile,
|
|
408
|
-
source: "env"
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
return profiles;
|
|
412
401
|
}
|
|
413
402
|
async function getActiveProfile() {
|
|
414
403
|
const config = await readConfig();
|
|
415
|
-
if (!config.currentProfile)
|
|
416
|
-
const envProfile = getEnvProfile();
|
|
417
|
-
return envProfile ? { name: ENV_PROFILE_NAME, ...envProfile } : null;
|
|
418
|
-
}
|
|
404
|
+
if (!config.currentProfile) return null;
|
|
419
405
|
const profile = config.profiles[config.currentProfile];
|
|
420
406
|
if (!profile) return null;
|
|
421
407
|
return { name: config.currentProfile, ...profile };
|
|
422
408
|
}
|
|
423
|
-
function getEnvProfile() {
|
|
424
|
-
if (!process.env.STANDARDS_API_KEY) return null;
|
|
425
|
-
return {
|
|
426
|
-
apiUrl: process.env.STANDARDS_API_URL ?? DEFAULT_API_URL,
|
|
427
|
-
apiKey: process.env.STANDARDS_API_KEY
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
409
|
async function resolveCliConfig(options) {
|
|
431
410
|
if (options.apiUrl || options.apiKey) {
|
|
432
411
|
return {
|
|
@@ -528,7 +507,7 @@ function isPublicCommand(actionCommand) {
|
|
|
528
507
|
}
|
|
529
508
|
function createProgram() {
|
|
530
509
|
const program = new Command();
|
|
531
|
-
program.name("standards").description("CLI to interact with Standards API").version("1.0.0-alpha.
|
|
510
|
+
program.name("standards").description("CLI to interact with Standards API").version("1.0.0-alpha.3").option("--format <format>", "output format (json, table, csv)", "json").option("--api-url <url>", "API base URL").option("--api-key <key>", "API key for authentication").option("--instance <name>", "Standards instance profile to use");
|
|
532
511
|
registerRootCommands(program);
|
|
533
512
|
registerRecordsCommand(program);
|
|
534
513
|
registerSchemaCommand(program);
|