@dev_desh/flux-cap 0.6.0 → 0.7.0

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20630,7 +20630,7 @@ import fs2 from "fs";
20630
20630
  var package_default = {
20631
20631
  name: "@dev_desh/flux-cap",
20632
20632
  type: "module",
20633
- version: "0.6.0",
20633
+ version: "0.7.0",
20634
20634
  description: "Git-aware CLI context manager for ADHD developers",
20635
20635
  bin: {
20636
20636
  flux: "./dist/index.js"
@@ -25299,32 +25299,35 @@ async function searchBrainDumpCommand(query) {
25299
25299
  const combinedQuery = query.join(" ").trim();
25300
25300
  let searchResults = [];
25301
25301
  const allFilePaths = await getAllBrainDumpFilePaths(fluxPath);
25302
- for (const searchQuery of query) {
25303
- for await (const filePath of allFilePaths) {
25304
- const fileData = JSON.parse(fs3.readFileSync(filePath, "utf8"));
25305
- if (searchQuery) {
25302
+ if (combinedQuery) {
25303
+ for (const searchQuery of query) {
25304
+ for await (const filePath of allFilePaths) {
25305
+ const fileData = JSON.parse(fs3.readFileSync(filePath, "utf8"));
25306
25306
  const fuse = createFuseInstance(fileData.dumps, config);
25307
25307
  const results = fuse.search(searchQuery);
25308
25308
  searchResults.push(...results);
25309
- } else {
25310
- const recentDumps = fileData.dumps.filter((dump) => dump && dump.message && dump.message.trim() !== "").map((dump) => ({
25311
- item: dump,
25312
- score: 0,
25313
- timestamp: new Date(dump.timestamp).getTime()
25314
- }));
25315
- searchResults.push(...recentDumps);
25316
25309
  }
25317
25310
  }
25318
- if (searchQuery) {
25319
- searchResults.sort((a, b) => (a.score || 0) - (b.score || 0));
25320
- } else {
25321
- searchResults.sort((a, b) => {
25322
- const timeA = new Date(a.item.timestamp).getTime();
25323
- const timeB = new Date(b.item.timestamp).getTime();
25324
- return timeB - timeA;
25325
- });
25311
+ } else {
25312
+ for await (const filePath of allFilePaths) {
25313
+ const fileData = JSON.parse(fs3.readFileSync(filePath, "utf8"));
25314
+ const recentDumps = fileData.dumps.filter((dump) => dump && dump.message && dump.message.trim() !== "").map((dump) => ({
25315
+ item: dump,
25316
+ score: 0,
25317
+ timestamp: new Date(dump.timestamp).getTime()
25318
+ }));
25319
+ searchResults.push(...recentDumps);
25326
25320
  }
25327
25321
  }
25322
+ if (combinedQuery) {
25323
+ searchResults.sort((a, b) => (a.score || 0) - (b.score || 0));
25324
+ } else {
25325
+ searchResults.sort((a, b) => {
25326
+ const timeA = new Date(a.item.timestamp).getTime();
25327
+ const timeB = new Date(b.item.timestamp).getTime();
25328
+ return timeB - timeA;
25329
+ });
25330
+ }
25328
25331
  const resultLimit = config?.search?.resultLimit || (combinedQuery ? 10 : 5);
25329
25332
  const limitedResults = searchResults.slice(0, resultLimit);
25330
25333
  if (searchResults.length > limitedResults.length) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dev_desh/flux-cap",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "description": "Git-aware CLI context manager for ADHD developers",
6
6
  "bin": {
7
7
  "flux": "./dist/index.js"