@go-labs-sg/gosh 0.4.0 → 0.4.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
@@ -14753,6 +14753,22 @@ var assertBunRuntime = (runtime = globalThis.Bun) => {
14753
14753
  };
14754
14754
 
14755
14755
  // ../../cli-auth/src/client/credential-store.ts
14756
+ class CliCredentialStoreUnavailableError extends Error {
14757
+ code = "CLI_CREDENTIAL_STORE_UNAVAILABLE";
14758
+ constructor(product, options) {
14759
+ super(`Secure credential storage is unavailable for the ${product} CLI. Bun.secrets requires the operating system credential store, including Secret Service on Linux. Browser authentication cannot continue without a supported secure store.`, options);
14760
+ this.name = "CliCredentialStoreUnavailableError";
14761
+ }
14762
+ }
14763
+ var useSecrets = async (product, operation) => {
14764
+ try {
14765
+ return await operation();
14766
+ } catch (cause) {
14767
+ if (cause instanceof CliCredentialStoreUnavailableError)
14768
+ throw cause;
14769
+ throw new CliCredentialStoreUnavailableError(product, { cause });
14770
+ }
14771
+ };
14756
14772
  var defaultSecrets = () => {
14757
14773
  assertBunRuntime();
14758
14774
  return Bun.secrets;
@@ -14765,10 +14781,10 @@ var createBunCredentialStore = ({
14765
14781
  const service = `go-labs-cli:${product}`;
14766
14782
  return {
14767
14783
  delete: async () => {
14768
- await secrets.delete({ name: account, service });
14784
+ await useSecrets(product, () => secrets.delete({ name: account, service }));
14769
14785
  },
14770
14786
  get: async () => {
14771
- const value = await secrets.get({ name: account, service });
14787
+ const value = await useSecrets(product, () => secrets.get({ name: account, service }));
14772
14788
  if (value === null)
14773
14789
  return null;
14774
14790
  try {
@@ -14779,11 +14795,11 @@ var createBunCredentialStore = ({
14779
14795
  },
14780
14796
  set: async (credentials) => {
14781
14797
  const parsed = storedCliCredentialsSchema.parse(credentials);
14782
- await secrets.set({
14798
+ await useSecrets(product, () => secrets.set({
14783
14799
  name: account,
14784
14800
  service,
14785
14801
  value: JSON.stringify(parsed)
14786
- });
14802
+ }));
14787
14803
  }
14788
14804
  };
14789
14805
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/gosh",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "GOSH CLI for organizers and AI agents — manage organizations, events, teams, stations, missions, templates, and live operations through the GOSH API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",