sim 2.0.0-preview.16.1 → 2.0.0-preview.17.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.
Files changed (2) hide show
  1. package/dist/index.js +20 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8939,6 +8939,10 @@ var V2_OPERATIONS = {
8939
8939
  kind: "string",
8940
8940
  required: true,
8941
8941
  describe: "Write-only secret value. It is never returned."
8942
+ },
8943
+ description: {
8944
+ kind: "string",
8945
+ describe: "What the secret is for, shown to teammates. Workspace scope only — sending it for a personal secret is rejected. Omit it to leave an existing description untouched; send null or an empty string to clear one."
8942
8946
  }
8943
8947
  }
8944
8948
  },
@@ -9996,7 +10000,8 @@ var CLI_CONTRACT = {
9996
10000
  { header: "name" },
9997
10001
  { header: "scope" },
9998
10002
  { header: "role" },
9999
- { header: "updated", path: "updatedAt", format: "timestamp" }
10003
+ { header: "updated", path: "updatedAt", format: "timestamp" },
10004
+ { header: "description" }
10000
10005
  ]
10001
10006
  },
10002
10007
  getWorkspace: {
@@ -11834,7 +11839,8 @@ var SECRET_RESULT = {
11834
11839
  { header: "name" },
11835
11840
  { header: "scope" },
11836
11841
  { header: "role" },
11837
- { header: "updated", path: "updatedAt", format: "timestamp" }
11842
+ { header: "updated", path: "updatedAt", format: "timestamp" },
11843
+ { header: "description" }
11838
11844
  ]
11839
11845
  };
11840
11846
  function validateSecretValue(value) {
@@ -11845,7 +11851,16 @@ function validateSecretValue(value) {
11845
11851
  }
11846
11852
  return value;
11847
11853
  }
11854
+ function validateDescriptionScope(description, scope) {
11855
+ if (description === undefined)
11856
+ return;
11857
+ if (scope === "personal") {
11858
+ throw new SimApiError("--description is only supported for a workspace secret.", 0);
11859
+ }
11860
+ return description;
11861
+ }
11848
11862
  async function setSecret(name, options, command) {
11863
+ const description = validateDescriptionScope(options.description, options.scope);
11849
11864
  const value = validateSecretValue(options.value ?? await promptSecret());
11850
11865
  const { client, profile } = clientFrom(command);
11851
11866
  const operation = V2_OPERATIONS.setSecret;
@@ -11854,7 +11869,8 @@ async function setSecret(name, options, command) {
11854
11869
  body: {
11855
11870
  workspaceId: client.requireWorkspace(),
11856
11871
  scope: options.scope,
11857
- value
11872
+ value,
11873
+ description
11858
11874
  }
11859
11875
  });
11860
11876
  renderResult("setSecret", profile.output, response.data, SECRET_RESULT);
@@ -11863,7 +11879,7 @@ function attachSecretCommands(program2) {
11863
11879
  const secrets = program2.commands.find((command) => command.name() === "secrets");
11864
11880
  if (!secrets)
11865
11881
  throw new Error("The generated secrets command group is missing");
11866
- secrets.command("set").argument("<name>", "Secret name, as referenced in workflows").description("Create or replace a named secret").addOption(new Option("--scope <scope>", "Secret ownership scope").choices([...SECRET_SCOPES]).makeOptionMandatory()).option("--value <value>", "Secret value; visible to shell history when supplied directly").action((name, options, command) => setSecret(name, options, command));
11882
+ secrets.command("set").argument("<name>", "Secret name, as referenced in workflows").description("Create or replace a named secret").addOption(new Option("--scope <scope>", "Secret ownership scope").choices([...SECRET_SCOPES]).makeOptionMandatory()).option("--value <value>", "Secret value; visible to shell history when supplied directly").option("--description <description>", "What the secret is for, shown to teammates; workspace scope only. Omit to leave an existing description unchanged").action((name, options, command) => setSecret(name, options, command));
11867
11883
  }
11868
11884
 
11869
11885
  // src/runtime/renamed.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.0.0-preview.16.1",
3
+ "version": "2.0.0-preview.17.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {