sparkecoder 0.1.30 → 0.1.32
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/agent/index.d.ts +2 -2
- package/dist/agent/index.js.map +1 -1
- package/dist/cli.js +86 -16
- package/dist/cli.js.map +1 -1
- package/dist/db/index.d.ts +12 -0
- package/dist/db/index.js +6 -0
- package/dist/db/index.js.map +1 -1
- package/dist/{index-C6EWZ-I9.d.ts → index-CsZVebwZ.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{search-CGYXoS4f.d.ts → search-Bk0sOPXw.d.ts} +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js.map +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/build-manifest.json +2 -2
- package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
- package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.html +1 -1
- package/web/.next/standalone/web/.next/server/app/index.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
- package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
- package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
- /package/web/.next/standalone/web/.next/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_ssgManifest.js +0 -0
- /package/web/.next/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_buildManifest.js +0 -0
- /package/web/.next/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{AWkAhe384Z20h3cIEUXi6 → 4Qd7gbyP-9Akkkk8I1vrs}/_ssgManifest.js +0 -0
package/dist/cli.js
CHANGED
|
@@ -765,6 +765,12 @@ var remoteIndexedChunkQueries = {
|
|
|
765
765
|
upsert(_db, data) {
|
|
766
766
|
return api("/indexed-chunks", { method: "POST", body: data });
|
|
767
767
|
},
|
|
768
|
+
batchUpsert(_db, chunks) {
|
|
769
|
+
return api("/indexed-chunks/batch", {
|
|
770
|
+
method: "POST",
|
|
771
|
+
body: { chunks }
|
|
772
|
+
});
|
|
773
|
+
},
|
|
768
774
|
getById(_db, id) {
|
|
769
775
|
return api(`/indexed-chunks/${id}`).catch(() => void 0);
|
|
770
776
|
},
|
|
@@ -4650,23 +4656,24 @@ async function indexRepository(options) {
|
|
|
4650
4656
|
const embedTime = Date.now() - batchStartTime;
|
|
4651
4657
|
console.log(`[indexer] Batch ${batchNum}: embed completed in ${embedTime}ms - processed: ${result.processedCount}, failed: ${result.failedCount}`);
|
|
4652
4658
|
failedChunks += result.failedCount;
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4659
|
+
const successfulChunks = batch.filter(
|
|
4660
|
+
(chunk) => !result.errors?.find((e) => e.id === chunk.id)
|
|
4661
|
+
);
|
|
4662
|
+
if (successfulChunks.length > 0) {
|
|
4663
|
+
console.log(`[indexer] Batch ${batchNum}: recording ${successfulChunks.length} chunks to DB...`);
|
|
4664
|
+
const dbStartTime = Date.now();
|
|
4665
|
+
await indexedChunkQueries.batchUpsert(db, successfulChunks.map((chunk) => ({
|
|
4666
|
+
id: chunk.id,
|
|
4667
|
+
contentHash: chunk.contentHash,
|
|
4668
|
+
filePath: chunk.metadata.filePath,
|
|
4669
|
+
repoNamespace: namespace,
|
|
4670
|
+
startLine: chunk.metadata.startLine,
|
|
4671
|
+
endLine: chunk.metadata.endLine,
|
|
4672
|
+
language: chunk.metadata.language
|
|
4673
|
+
})));
|
|
4674
|
+
const dbTime = Date.now() - dbStartTime;
|
|
4675
|
+
console.log(`[indexer] Batch ${batchNum}: DB batch upsert completed in ${dbTime}ms`);
|
|
4667
4676
|
}
|
|
4668
|
-
const dbTime = Date.now() - dbStartTime;
|
|
4669
|
-
console.log(`[indexer] Batch ${batchNum}: DB upserts completed in ${dbTime}ms`);
|
|
4670
4677
|
if (result.errors) {
|
|
4671
4678
|
for (const err of result.errors) {
|
|
4672
4679
|
const chunk = batch.find((c) => c.id === err.id);
|
|
@@ -9455,6 +9462,69 @@ Indexing ${chalk.cyan(namespace)}...
|
|
|
9455
9462
|
process.exit(1);
|
|
9456
9463
|
}
|
|
9457
9464
|
});
|
|
9465
|
+
program.command("search").description("Search indexed repository using semantic search").argument("<query>", "Search query").option("-n, --num <count>", "Number of results to show", "5").option("-w, --working-dir <path>", "Working directory (defaults to current directory)").option("-c, --config <path>", "Path to config file").action(async (query, options) => {
|
|
9466
|
+
try {
|
|
9467
|
+
const workingDir = options.workingDir ? resolve10(options.workingDir) : process.cwd();
|
|
9468
|
+
const config = loadConfig(options.config, workingDir);
|
|
9469
|
+
const remoteUrl = config.resolvedRemoteServer.url;
|
|
9470
|
+
if (!remoteUrl) {
|
|
9471
|
+
console.error(chalk.red("Error: Remote server not configured"));
|
|
9472
|
+
process.exit(1);
|
|
9473
|
+
}
|
|
9474
|
+
let authKey3 = config.resolvedRemoteServer.authKey;
|
|
9475
|
+
if (!authKey3) {
|
|
9476
|
+
authKey3 = await ensureRemoteAuthKey(remoteUrl);
|
|
9477
|
+
}
|
|
9478
|
+
if (!authKey3) {
|
|
9479
|
+
console.error(chalk.red("Error: Remote auth key not available"));
|
|
9480
|
+
process.exit(1);
|
|
9481
|
+
}
|
|
9482
|
+
initDatabase({ url: remoteUrl, authKey: authKey3 });
|
|
9483
|
+
const namespace = await getRepoNamespace(workingDir, config.resolvedVectorGateway.namespace);
|
|
9484
|
+
if (!namespace) {
|
|
9485
|
+
console.error(chalk.red("Error: Could not determine repository namespace"));
|
|
9486
|
+
console.log(chalk.dim("Ensure git remote is configured or run sparkecoder index first"));
|
|
9487
|
+
process.exit(1);
|
|
9488
|
+
}
|
|
9489
|
+
const client = getVectorClient();
|
|
9490
|
+
if (!client) {
|
|
9491
|
+
console.error(chalk.red("Error: Vector client not configured"));
|
|
9492
|
+
process.exit(1);
|
|
9493
|
+
}
|
|
9494
|
+
console.log(chalk.dim(`Searching "${query}" in ${namespace}...
|
|
9495
|
+
`));
|
|
9496
|
+
const topK = parseInt(options.num) || 5;
|
|
9497
|
+
const result = await client.search.queryAndWait(query, {
|
|
9498
|
+
namespace,
|
|
9499
|
+
topK
|
|
9500
|
+
});
|
|
9501
|
+
if (result.matches.length === 0) {
|
|
9502
|
+
console.log(chalk.yellow("No results found."));
|
|
9503
|
+
console.log(chalk.dim("Make sure you have indexed the repository with: sparkecoder index"));
|
|
9504
|
+
} else {
|
|
9505
|
+
console.log(chalk.bold(`Top ${result.matches.length} results:
|
|
9506
|
+
`));
|
|
9507
|
+
for (let i = 0; i < result.matches.length; i++) {
|
|
9508
|
+
const match = result.matches[i];
|
|
9509
|
+
const metadata = match.metadata;
|
|
9510
|
+
const filePath = metadata?.filePath || "unknown";
|
|
9511
|
+
const startLine = metadata?.startLine;
|
|
9512
|
+
const endLine = metadata?.endLine;
|
|
9513
|
+
const score = (match.score * 100).toFixed(1);
|
|
9514
|
+
const location = startLine ? `${filePath}:${startLine}-${endLine}` : filePath;
|
|
9515
|
+
console.log(` ${chalk.cyan(`${i + 1}.`)} ${chalk.white(location)} ${chalk.dim(`(${score}%)`)}`);
|
|
9516
|
+
if (metadata?.symbolName) {
|
|
9517
|
+
console.log(` ${chalk.dim("Symbol:")} ${metadata.symbolName}`);
|
|
9518
|
+
}
|
|
9519
|
+
}
|
|
9520
|
+
}
|
|
9521
|
+
await closeVectorClient();
|
|
9522
|
+
console.log();
|
|
9523
|
+
} catch (error) {
|
|
9524
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
9525
|
+
process.exit(1);
|
|
9526
|
+
}
|
|
9527
|
+
});
|
|
9458
9528
|
program.command("api-key").description("Manage API keys for AI providers").argument("[provider]", "Provider name (anthropic, openai, google, xai, ai-gateway)").argument("[key]", "API key to set (if not provided, shows status)").option("-l, --list", "List all API key statuses").action((provider, key, options) => {
|
|
9459
9529
|
try {
|
|
9460
9530
|
ensureAppDataDirectory();
|