@cloudy-app/opencode-plugin 0.0.2 → 0.0.4

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 +14 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8,13 +8,26 @@ var env = {
8
8
  },
9
9
  get CLOUDY_API_BASE_PATH() {
10
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) {
@@ -168,9 +181,6 @@ var IdeaPlugin = async ({
168
181
  }
169
182
  if (input.tool === "edit") {
170
183
  const filePath = output.args.filePath;
171
- if (isIdeaIndexMd(filePath)) {
172
- throw new Error("Cannot modify index.md in idea directory");
173
- }
174
184
  if (isFileIdeaFile(filePath)) {
175
185
  const ideaPath = extractIdeaPath(filePath);
176
186
  await touchIdea(ideaPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudy-app/opencode-plugin",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "OpenCode plugin for Cloudy — idea management tools and session tracking",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",