opencode-context 1.0.3 → 1.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.
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -31
- package/dist/install.js +6 -4
- package/dist/plugin.js +1 -1
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA4M1C,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8346,7 +8346,6 @@ async function searchFiles(options) {
|
|
|
8346
8346
|
}
|
|
8347
8347
|
|
|
8348
8348
|
// src/index.ts
|
|
8349
|
-
var program2 = new Command;
|
|
8350
8349
|
function formatScore(score) {
|
|
8351
8350
|
if (score >= 80)
|
|
8352
8351
|
return import_picocolors3.default.green(score.toString().padStart(3));
|
|
@@ -8456,36 +8455,43 @@ async function interactiveMode() {
|
|
|
8456
8455
|
process.exit(1);
|
|
8457
8456
|
}
|
|
8458
8457
|
}
|
|
8459
|
-
|
|
8460
|
-
program2
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8458
|
+
function runCLI() {
|
|
8459
|
+
const program2 = new Command;
|
|
8460
|
+
program2.name("opencode-context").description("Smart file finder for codebases - semantic search with confidence scoring").version("1.0.3");
|
|
8461
|
+
program2.option("-q, --query <query>", "Search query").option("-n, --max-files <number>", "Maximum number of results", "5").option("--min-score <score>", "Minimum relevance score (0-100)", "15").option("-p, --path <path>", "Root path to search from", process.cwd()).option("--include-tests", "Include test files", false).option("--include-configs", "Include configuration files", false).option("--include-docs", "Include documentation files", false).option("--no-content", "Skip content search (faster)").option("--max-size <bytes>", "Maximum file size to read", "1048576").option("-j, --json", "Output as JSON", false).option("-d, --detailed", "Show detailed match reasons", false).option("-i, --interactive", "Interactive mode", false).action(async (options) => {
|
|
8462
|
+
try {
|
|
8463
|
+
if (options.interactive || !options.query) {
|
|
8464
|
+
await interactiveMode();
|
|
8465
|
+
return;
|
|
8466
|
+
}
|
|
8467
|
+
const searchOptions = {
|
|
8468
|
+
query: options.query,
|
|
8469
|
+
maxFiles: parseInt(options.maxFiles, 10),
|
|
8470
|
+
minScore: parseInt(options.minScore, 10),
|
|
8471
|
+
rootPath: options.path,
|
|
8472
|
+
includeTests: options.includeTests,
|
|
8473
|
+
includeConfigs: options.includeConfigs,
|
|
8474
|
+
includeDocs: options.includeDocs,
|
|
8475
|
+
searchContent: options.content !== false,
|
|
8476
|
+
maxFileSize: parseInt(options.maxSize, 10)
|
|
8477
|
+
};
|
|
8478
|
+
const result = await searchFiles(searchOptions);
|
|
8479
|
+
if (options.json) {
|
|
8480
|
+
console.log(JSON.stringify(result, null, 2));
|
|
8481
|
+
} else {
|
|
8482
|
+
formatResults(result, options.detailed);
|
|
8483
|
+
}
|
|
8484
|
+
} catch (error) {
|
|
8485
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
8486
|
+
console.error(import_picocolors3.default.red(`Error: ${message}`));
|
|
8487
|
+
process.exit(1);
|
|
8482
8488
|
}
|
|
8483
|
-
}
|
|
8484
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
8485
|
-
console.error(import_picocolors3.default.red(`Error: ${message}`));
|
|
8486
|
-
process.exit(1);
|
|
8487
|
-
}
|
|
8488
|
-
});
|
|
8489
|
-
if (__require.main == __require.module) {
|
|
8489
|
+
});
|
|
8490
8490
|
program2.parse();
|
|
8491
8491
|
}
|
|
8492
|
+
if (__require.main == __require.module) {
|
|
8493
|
+
runCLI();
|
|
8494
|
+
}
|
|
8495
|
+
export {
|
|
8496
|
+
searchFiles
|
|
8497
|
+
};
|
package/dist/install.js
CHANGED
|
@@ -26,7 +26,7 @@ async function writeConfig(config) {
|
|
|
26
26
|
`);
|
|
27
27
|
}
|
|
28
28
|
async function install() {
|
|
29
|
-
console.log(`Installing
|
|
29
|
+
console.log(`Installing opencode-context plugin...
|
|
30
30
|
`);
|
|
31
31
|
await ensureConfigDir();
|
|
32
32
|
const config = await readConfig();
|
|
@@ -35,10 +35,10 @@ async function install() {
|
|
|
35
35
|
}
|
|
36
36
|
const pluginName = "opencode-context@latest";
|
|
37
37
|
if (config.plugin.includes(pluginName)) {
|
|
38
|
-
console.log("\u2713
|
|
38
|
+
console.log("\u2713 opencode-context already in plugins");
|
|
39
39
|
} else {
|
|
40
40
|
config.plugin.push(pluginName);
|
|
41
|
-
console.log("\u2713 Added
|
|
41
|
+
console.log("\u2713 Added opencode-context@latest to plugins");
|
|
42
42
|
}
|
|
43
43
|
await writeConfig(config);
|
|
44
44
|
console.log(`
|
|
@@ -50,4 +50,6 @@ To use:`);
|
|
|
50
50
|
console.log(` 3. The agent will use find_files tool
|
|
51
51
|
`);
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
if (__require.main == __require.module) {
|
|
54
|
+
install().catch(console.error);
|
|
55
|
+
}
|
package/dist/plugin.js
CHANGED
|
@@ -18092,7 +18092,7 @@ async function searchFiles(options) {
|
|
|
18092
18092
|
}
|
|
18093
18093
|
|
|
18094
18094
|
// src/plugin.ts
|
|
18095
|
-
var OpenContextPlugin = async (
|
|
18095
|
+
var OpenContextPlugin = async () => {
|
|
18096
18096
|
return {
|
|
18097
18097
|
tool: {
|
|
18098
18098
|
find_files: tool({
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-context",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Smart file finder for codebases - semantic search with confidence scoring. Also available as an OpenCode plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"opencode-context": "dist/index.js"
|
|
10
|
-
"opencode-context-install": "dist/install.js"
|
|
9
|
+
"opencode-context": "dist/index.js"
|
|
11
10
|
},
|
|
12
11
|
"files": [
|
|
13
12
|
"dist/",
|