opencode-codebase-index 0.2.2 → 0.2.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.
- package/dist/index.cjs +16 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/native/codebase-index-native.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -659,6 +659,7 @@ __export(index_exports, {
|
|
|
659
659
|
module.exports = __toCommonJS(index_exports);
|
|
660
660
|
var import_fs5 = require("fs");
|
|
661
661
|
var path7 = __toESM(require("path"), 1);
|
|
662
|
+
var os3 = __toESM(require("os"), 1);
|
|
662
663
|
|
|
663
664
|
// src/config/schema.ts
|
|
664
665
|
var DEFAULT_INCLUDE = [
|
|
@@ -5582,15 +5583,26 @@ function formatStatus(status) {
|
|
|
5582
5583
|
}
|
|
5583
5584
|
|
|
5584
5585
|
// src/index.ts
|
|
5585
|
-
function
|
|
5586
|
-
const configPath = path7.join(projectRoot, ".opencode", "codebase-index.json");
|
|
5586
|
+
function loadJsonFile(filePath) {
|
|
5587
5587
|
try {
|
|
5588
|
-
if ((0, import_fs5.existsSync)(
|
|
5589
|
-
const content = (0, import_fs5.readFileSync)(
|
|
5588
|
+
if ((0, import_fs5.existsSync)(filePath)) {
|
|
5589
|
+
const content = (0, import_fs5.readFileSync)(filePath, "utf-8");
|
|
5590
5590
|
return JSON.parse(content);
|
|
5591
5591
|
}
|
|
5592
5592
|
} catch {
|
|
5593
5593
|
}
|
|
5594
|
+
return null;
|
|
5595
|
+
}
|
|
5596
|
+
function loadPluginConfig(projectRoot) {
|
|
5597
|
+
const projectConfig = loadJsonFile(path7.join(projectRoot, ".opencode", "codebase-index.json"));
|
|
5598
|
+
if (projectConfig) {
|
|
5599
|
+
return projectConfig;
|
|
5600
|
+
}
|
|
5601
|
+
const globalConfigPath = path7.join(os3.homedir(), ".config", "opencode", "codebase-index.json");
|
|
5602
|
+
const globalConfig = loadJsonFile(globalConfigPath);
|
|
5603
|
+
if (globalConfig) {
|
|
5604
|
+
return globalConfig;
|
|
5605
|
+
}
|
|
5594
5606
|
return {};
|
|
5595
5607
|
}
|
|
5596
5608
|
var plugin = async ({ directory }) => {
|