@the-magic-tower/fixhive-opencode-plugin 0.1.9 → 0.1.11
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.
- package/dist/index.js +33 -26
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
1
|
+
// src/plugin/index.ts
|
|
2
|
+
import { tool as tool2 } from "@opencode-ai/plugin";
|
|
3
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
7
5
|
|
|
8
6
|
// src/core/privacy-filter.ts
|
|
9
7
|
var DEFAULT_FILTER_RULES = [
|
|
@@ -1119,7 +1117,16 @@ var CloudClient = class {
|
|
|
1119
1117
|
similarityThreshold;
|
|
1120
1118
|
constructor(config) {
|
|
1121
1119
|
this.supabase = createClient(config.supabaseUrl, config.supabaseAnonKey);
|
|
1122
|
-
|
|
1120
|
+
if (config.openaiApiKey) {
|
|
1121
|
+
try {
|
|
1122
|
+
this.embedding = new EmbeddingService(config.openaiApiKey);
|
|
1123
|
+
} catch (err) {
|
|
1124
|
+
console.warn("[FixHive] Failed to initialize embedding service:", err);
|
|
1125
|
+
this.embedding = null;
|
|
1126
|
+
}
|
|
1127
|
+
} else {
|
|
1128
|
+
this.embedding = null;
|
|
1129
|
+
}
|
|
1123
1130
|
this.contributorId = config.contributorId || generateContributorId();
|
|
1124
1131
|
this.similarityThreshold = config.similarityThreshold || 0.7;
|
|
1125
1132
|
}
|
|
@@ -1611,13 +1618,18 @@ var FixHivePlugin = async (ctx) => {
|
|
|
1611
1618
|
const localStore = new LocalStore(ctx.directory);
|
|
1612
1619
|
let cloudClient = null;
|
|
1613
1620
|
if (config.supabaseUrl && config.supabaseAnonKey) {
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
+
try {
|
|
1622
|
+
cloudClient = new CloudClient({
|
|
1623
|
+
supabaseUrl: config.supabaseUrl,
|
|
1624
|
+
supabaseAnonKey: config.supabaseAnonKey,
|
|
1625
|
+
openaiApiKey: config.openaiApiKey,
|
|
1626
|
+
contributorId: config.contributorId,
|
|
1627
|
+
similarityThreshold: config.similarityThreshold
|
|
1628
|
+
});
|
|
1629
|
+
} catch (err) {
|
|
1630
|
+
console.error("[FixHive] Failed to initialize cloud client:", err);
|
|
1631
|
+
console.error("[FixHive] Falling back to offline mode");
|
|
1632
|
+
}
|
|
1621
1633
|
}
|
|
1622
1634
|
const pluginContext = {
|
|
1623
1635
|
sessionId: "",
|
|
@@ -1700,7 +1712,6 @@ Use \`fixhive_mark_resolved\` when errors are fixed to contribute solutions.
|
|
|
1700
1712
|
};
|
|
1701
1713
|
};
|
|
1702
1714
|
function createOfflineTools(localStore, _privacyFilter, context) {
|
|
1703
|
-
const { tool: tool2 } = __require("@opencode-ai/plugin");
|
|
1704
1715
|
return {
|
|
1705
1716
|
fixhive_list: tool2({
|
|
1706
1717
|
description: "List errors detected in the current session.",
|
|
@@ -1761,8 +1772,6 @@ function loadConfig() {
|
|
|
1761
1772
|
};
|
|
1762
1773
|
}
|
|
1763
1774
|
function detectLanguage(directory) {
|
|
1764
|
-
const fs = __require("fs");
|
|
1765
|
-
const path = __require("path");
|
|
1766
1775
|
const indicators = [
|
|
1767
1776
|
["package.json", "typescript"],
|
|
1768
1777
|
["tsconfig.json", "typescript"],
|
|
@@ -1776,19 +1785,17 @@ function detectLanguage(directory) {
|
|
|
1776
1785
|
["composer.json", "php"]
|
|
1777
1786
|
];
|
|
1778
1787
|
for (const [file, lang] of indicators) {
|
|
1779
|
-
if (
|
|
1788
|
+
if (existsSync2(join(directory, file))) {
|
|
1780
1789
|
return lang;
|
|
1781
1790
|
}
|
|
1782
1791
|
}
|
|
1783
1792
|
return void 0;
|
|
1784
1793
|
}
|
|
1785
1794
|
function detectFramework(directory) {
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1788
|
-
const pkgPath = path.join(directory, "package.json");
|
|
1789
|
-
if (fs.existsSync(pkgPath)) {
|
|
1795
|
+
const pkgPath = join(directory, "package.json");
|
|
1796
|
+
if (existsSync2(pkgPath)) {
|
|
1790
1797
|
try {
|
|
1791
|
-
const pkg = JSON.parse(
|
|
1798
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
1792
1799
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
1793
1800
|
if (deps["next"]) return "nextjs";
|
|
1794
1801
|
if (deps["react"]) return "react";
|
|
@@ -1800,10 +1807,10 @@ function detectFramework(directory) {
|
|
|
1800
1807
|
} catch {
|
|
1801
1808
|
}
|
|
1802
1809
|
}
|
|
1803
|
-
const reqPath =
|
|
1804
|
-
if (
|
|
1810
|
+
const reqPath = join(directory, "requirements.txt");
|
|
1811
|
+
if (existsSync2(reqPath)) {
|
|
1805
1812
|
try {
|
|
1806
|
-
const content =
|
|
1813
|
+
const content = readFileSync(reqPath, "utf-8");
|
|
1807
1814
|
if (content.includes("django")) return "django";
|
|
1808
1815
|
if (content.includes("flask")) return "flask";
|
|
1809
1816
|
if (content.includes("fastapi")) return "fastapi";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-magic-tower/fixhive-opencode-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Community-based error knowledge sharing for OpenCode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsup src/index.ts --format esm --dts --clean --external @supabase/supabase-js --external better-sqlite3 --external openai --external uuid",
|
|
18
|
+
"build": "tsup src/index.ts --format esm --dts --clean --target esnext --external @supabase/supabase-js --external better-sqlite3 --external openai --external uuid --external @opencode-ai/plugin --external zod",
|
|
19
19
|
"build:dts": "tsup src/index.ts --format esm --dts --clean",
|
|
20
20
|
"dev": "tsup src/index.ts --format esm --watch",
|
|
21
21
|
"typecheck": "tsc --noEmit",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@supabase/supabase-js": "^2.45.0",
|
|
48
48
|
"better-sqlite3": "^12.5.0",
|
|
49
|
-
"openai": "^
|
|
49
|
+
"openai": "^6.16.0",
|
|
50
50
|
"uuid": "^13.0.0",
|
|
51
51
|
"zod": "^3.25.76"
|
|
52
52
|
},
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"@types/uuid": "^10.0.0",
|
|
58
58
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
59
59
|
"@typescript-eslint/parser": "^8.0.0",
|
|
60
|
-
"@vitest/coverage-v8": "^
|
|
60
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
61
61
|
"eslint": "^9.0.0",
|
|
62
62
|
"tsup": "^8.2.0",
|
|
63
63
|
"typescript": "^5.5.0",
|
|
64
|
-
"vitest": "^
|
|
64
|
+
"vitest": "^4.0.16"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=20.0.0"
|