@cloudy-app/opencode-plugin 0.0.1 → 0.0.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.
Files changed (2) hide show
  1. package/dist/index.js +15 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7,14 +7,27 @@ var env = {
7
7
  return process.env.CLOUDY_ASSISTANT_BASE_PATH || "./base-path";
8
8
  },
9
9
  get CLOUDY_API_BASE_PATH() {
10
- return process.env.CLOUDY_ASSISTANT_BASE_PATH || "http://localhost:3000";
10
+ return process.env.CLOUDY_API_BASE_PATH || "http://localhost:3000";
11
+ },
12
+ get CLOUDY_API_USERNAME() {
13
+ return process.env.CLOUDY_API_USERNAME || "";
14
+ },
15
+ get CLOUDY_API_PASSWORD() {
16
+ return process.env.CLOUDY_API_PASSWORD || "";
11
17
  }
12
18
  };
13
19
 
14
20
  // src/lib/api.ts
21
+ function getAuthHeader() {
22
+ const username = env.CLOUDY_API_USERNAME;
23
+ const password = env.CLOUDY_API_PASSWORD;
24
+ if (!username && !password) return {};
25
+ const credentials = Buffer.from(`${username}:${password}`).toString("base64");
26
+ return { Authorization: `Basic ${credentials}` };
27
+ }
15
28
  async function ideaApi(path2, options) {
16
29
  const res = await fetch(`${env.CLOUDY_API_BASE_PATH}/api/idea${path2}`, {
17
- headers: { "Content-Type": "application/json" },
30
+ headers: { "Content-Type": "application/json", ...getAuthHeader() },
18
31
  ...options
19
32
  });
20
33
  if (!res.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudy-app/opencode-plugin",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "OpenCode plugin for Cloudy — idea management tools and session tracking",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",