opencode-plugin-search 0.0.1 → 0.0.2
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 +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12331,6 +12331,8 @@ function tool(input) {
|
|
|
12331
12331
|
tool.schema = exports_external;
|
|
12332
12332
|
// src/utils.ts
|
|
12333
12333
|
import { spawn } from "node:child_process";
|
|
12334
|
+
import { existsSync } from "node:fs";
|
|
12335
|
+
import { join } from "node:path";
|
|
12334
12336
|
async function runAstGrep({ args, input, directory }) {
|
|
12335
12337
|
const fullArgs = ["ast-grep", ...args];
|
|
12336
12338
|
const [cmd, ...cmdArgs] = fullArgs;
|
|
@@ -12381,8 +12383,14 @@ ${matchText}`);
|
|
|
12381
12383
|
function getConfigPath(directory) {
|
|
12382
12384
|
if (!directory)
|
|
12383
12385
|
return;
|
|
12384
|
-
const
|
|
12385
|
-
|
|
12386
|
+
const extensions = [".yml", ".yaml"];
|
|
12387
|
+
for (const ext of extensions) {
|
|
12388
|
+
const configPath = join(directory, `sgconfig${ext}`);
|
|
12389
|
+
if (existsSync(configPath)) {
|
|
12390
|
+
return configPath;
|
|
12391
|
+
}
|
|
12392
|
+
}
|
|
12393
|
+
return;
|
|
12386
12394
|
}
|
|
12387
12395
|
async function executeAstGrep(command, args, options) {
|
|
12388
12396
|
const allArgs = [];
|
package/package.json
CHANGED