learn-secrets-sdk 1.6.7 → 1.6.8

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.
Files changed (2) hide show
  1. package/dist/cli/index.mjs +29 -6
  2. package/package.json +1 -1
@@ -1009,15 +1009,38 @@ import fs4 from "fs";
1009
1009
  async function configCommand(options) {
1010
1010
  const configFile = "secrets-config.json";
1011
1011
  if (!fs4.existsSync(configFile)) {
1012
- console.error("Run learn-secrets init first to generate config.");
1013
- return;
1012
+ console.error("Error: Configuration file not found.");
1013
+ console.error('Run "learn-secrets login" first to create config.');
1014
+ process.exit(1);
1014
1015
  }
1015
1016
  const config = JSON.parse(fs4.readFileSync(configFile, "utf8"));
1017
+ if (!options.project && !options.origins) {
1018
+ console.log("\nCurrent configuration:");
1019
+ console.log(` Project ID: ${config.project || "(not set)"}`);
1020
+ console.log(` Origins: ${config.origins?.length > 0 ? config.origins.join(", ") : "(not set)"}`);
1021
+ console.log(`
1022
+ Config file: ${configFile}`);
1023
+ console.log("\nTo update:");
1024
+ console.log(" learn-secrets config --project <appid>");
1025
+ console.log(" learn-secrets config --origins domain1.com,domain2.com");
1026
+ return;
1027
+ }
1028
+ let updated = false;
1029
+ if (options.project) {
1030
+ config.project = options.project;
1031
+ console.log(`Updated project ID: ${options.project}`);
1032
+ updated = true;
1033
+ }
1016
1034
  if (options.origins) {
1017
- config.origins = options.origins.split(",").map((o) => o.trim());
1018
- console.log("Updated origins:", config.origins);
1035
+ config.origins = options.origins.split(",").map((o) => o.trim()).filter(Boolean);
1036
+ console.log(`Updated origins: ${config.origins.join(", ")}`);
1037
+ updated = true;
1038
+ }
1039
+ if (updated) {
1040
+ fs4.writeFileSync(configFile, JSON.stringify(config, null, 2));
1041
+ console.log(`
1042
+ Configuration saved to: ${configFile}`);
1019
1043
  }
1020
- fs4.writeFileSync(configFile, JSON.stringify(config, null, 2));
1021
1044
  }
1022
1045
 
1023
1046
  // src/cli/commands/deploy.ts
@@ -1044,7 +1067,7 @@ program.command("login").description("Authenticate with Learn Secrets via browse
1044
1067
  program.command("init").description("Initialize secrets for a new site").requiredOption("-o, --origins <domains>", "Comma-separated list of allowed origins (e.g., mysite.com,localhost)").option("-p, --project <appid>", "Project app ID (auto-detected from login if not specified)").option("-e, --env <file>", "Path to .env file (default: .env)", ".env").option("--base-url <url>", "Custom base URL for API").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
1045
1068
  await initCommand(options);
1046
1069
  });
1047
- program.command("config").description("Configure allowed origins").option("--origins <origins>", "Comma separated origins").action(async (options) => {
1070
+ program.command("config").description("View or update project configuration").option("-p, --project <appid>", "Change project ID").option("--origins <origins>", "Comma separated origins").action(async (options) => {
1048
1071
  await configCommand(options);
1049
1072
  });
1050
1073
  program.command("deploy").description("Deploy secrets config live").action(async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "learn-secrets-sdk",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "Secure API proxy SDK for static sites with domain-scoped tokens",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",