@dev_desh/flux-cap 0.5.0 → 0.6.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.
- package/LICENSE +21 -0
- package/README.md +10 -4
- package/dist/index.js +99 -88
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kaustubh Deshpande
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -42,13 +42,16 @@ flux dump -t "refactor payment processing logic" # Tasks
|
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### 3. Search your brain dumps
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
45
48
|
```bash
|
|
46
49
|
# Search with a query
|
|
47
|
-
flux search
|
|
50
|
+
flux search auth
|
|
48
51
|
|
|
49
52
|
# Search by tags (when implemented in search)
|
|
50
|
-
flux search
|
|
51
|
-
flux search
|
|
53
|
+
flux search ideas
|
|
54
|
+
flux search tasks
|
|
52
55
|
|
|
53
56
|
# List recent dumps (no query)
|
|
54
57
|
flux search
|
|
@@ -94,7 +97,10 @@ flux search
|
|
|
94
97
|
|---------|-------------|---------|
|
|
95
98
|
| `flux init` | Initialize flux-cap with privacy setup | `flux init` |
|
|
96
99
|
| `flux dump <message...>` | Capture a brain dump | `flux dump "fix the bug in auth.ts"` |
|
|
97
|
-
| `flux dump -i <message...>` | Capture
|
|
100
|
+
| `flux dump -i <message...>` | Capture important | `flux dump -i "add keyboard shortcuts"` |
|
|
101
|
+
| `flux dump -d <message...>` | Capture an idea | `flux dump -d "a new cli tool project"` |
|
|
102
|
+
| `flux dump -l <message...>` | Capture a link | `flux dump -l "https://github.com/kaustubh285/flux-cap"` |
|
|
103
|
+
| `flux dump -b <message...>` | Capture a bug | `flux dump -b "tsconfig mismatch"` |
|
|
98
104
|
| `flux dump -n <message...>` | Capture a note | `flux dump -n "meeting notes from standup"` |
|
|
99
105
|
| `flux dump -t <message...>` | Capture a task | `flux dump -t "refactor user authentication"` |
|
|
100
106
|
| `flux dump -m` | Multiline input mode | `flux dump -m` |
|
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.
|
|
20633
|
+
version: "0.6.0",
|
|
20634
20634
|
description: "Git-aware CLI context manager for ADHD developers",
|
|
20635
20635
|
bin: {
|
|
20636
20636
|
flux: "./dist/index.js"
|
|
@@ -20676,7 +20676,8 @@ var package_default = {
|
|
|
20676
20676
|
repository: {
|
|
20677
20677
|
type: "git",
|
|
20678
20678
|
url: "https://github.com/kaustubh285/flux-cap"
|
|
20679
|
-
}
|
|
20679
|
+
},
|
|
20680
|
+
license: "MIT"
|
|
20680
20681
|
};
|
|
20681
20682
|
|
|
20682
20683
|
// src/utils/constants.ts
|
|
@@ -20704,7 +20705,7 @@ var FLUX_DEFAULT_CONFIG = {
|
|
|
20704
20705
|
includeScore: true
|
|
20705
20706
|
}
|
|
20706
20707
|
},
|
|
20707
|
-
tags: ["notes", "ideas", "tasks"]
|
|
20708
|
+
tags: ["notes", "ideas", "tasks", "bugs", "links", "imporatant"]
|
|
20708
20709
|
};
|
|
20709
20710
|
// src/utils/privacy.ts
|
|
20710
20711
|
import { execSync } from "child_process";
|
|
@@ -20835,61 +20836,59 @@ function getMonthString() {
|
|
|
20835
20836
|
function displaySearchResults(results, query) {
|
|
20836
20837
|
if (results.length === 0) {
|
|
20837
20838
|
if (query) {
|
|
20838
|
-
console.log(`
|
|
20839
|
+
console.log(`
|
|
20840
|
+
No brain dumps found matching "${query}"
|
|
20841
|
+
`);
|
|
20839
20842
|
} else {
|
|
20840
|
-
console.log(
|
|
20843
|
+
console.log(`
|
|
20844
|
+
No brain dumps found. Try 'flux dump' to create your first one!
|
|
20845
|
+
`);
|
|
20841
20846
|
}
|
|
20842
20847
|
return;
|
|
20843
20848
|
}
|
|
20844
|
-
const queryText = query ? `
|
|
20849
|
+
const queryText = query ? ` matching "${query}"` : "";
|
|
20845
20850
|
console.log(`
|
|
20846
|
-
Found ${results.length} brain dump${results.length === 1 ? "" : "s"}${queryText}
|
|
20851
|
+
Found ${results.length} brain dump${results.length === 1 ? "" : "s"}${queryText}
|
|
20847
20852
|
`);
|
|
20848
|
-
const terminalWidth = process.stdout.columns ||
|
|
20849
|
-
const
|
|
20853
|
+
const terminalWidth = process.stdout.columns || 100;
|
|
20854
|
+
const indexWidth = results.length.toString().length + 2;
|
|
20855
|
+
const idWidth = 10;
|
|
20856
|
+
const scoreWidth = 8;
|
|
20857
|
+
const timeWidth = 12;
|
|
20858
|
+
const header = `${"#".padEnd(indexWidth)}${"ID".padEnd(idWidth)}${"SCORE".padEnd(scoreWidth)}${"TIME".padEnd(timeWidth)}MESSAGE`;
|
|
20859
|
+
console.log(`\x1B[90m${header}\x1B[0m`);
|
|
20860
|
+
console.log(`\x1B[36m${"─".repeat(Math.min(terminalWidth - 5, header.length))}\x1B[0m`);
|
|
20850
20861
|
results.forEach((result, index) => {
|
|
20851
20862
|
const dump = result.item;
|
|
20852
20863
|
const score = result.score?.toFixed(2) || "0.00";
|
|
20853
20864
|
const shortId = dump.id.substring(0, 8);
|
|
20854
|
-
const
|
|
20855
|
-
const
|
|
20856
|
-
const idStr =
|
|
20857
|
-
const
|
|
20858
|
-
|
|
20859
|
-
const messageIndent = " ".repeat(maxIndexWidth + 1);
|
|
20865
|
+
const timeAgo = getTimeAgo(new Date(dump.timestamp));
|
|
20866
|
+
const indexStr = `${index + 1}.`.padEnd(indexWidth);
|
|
20867
|
+
const idStr = `\x1B[33m#${shortId}\x1B[0m`.padEnd(idWidth + 9);
|
|
20868
|
+
const scoreStr = `\x1B[90m[${score}]\x1B[0m`.padEnd(scoreWidth + 9);
|
|
20869
|
+
const timeStr = `\x1B[90m${timeAgo}\x1B[0m`.padEnd(timeWidth + 9);
|
|
20860
20870
|
const lines = dump.message.split(`
|
|
20861
20871
|
`).map((l) => l.trim()).filter((l) => l.length > 0);
|
|
20862
|
-
const
|
|
20863
|
-
|
|
20864
|
-
|
|
20865
|
-
|
|
20866
|
-
|
|
20867
|
-
|
|
20868
|
-
|
|
20869
|
-
console.log(`${messageIndent}${truncatedLine}`);
|
|
20870
|
-
}
|
|
20872
|
+
const firstLine = lines[0] || "(empty)";
|
|
20873
|
+
console.log(`
|
|
20874
|
+
${indexStr}${idStr}${scoreStr}${timeStr}${firstLine}`);
|
|
20875
|
+
const messageIndent = " ".repeat(indexWidth + idWidth + scoreWidth + timeWidth);
|
|
20876
|
+
if (lines.length > 1) {
|
|
20877
|
+
lines.slice(1).forEach((line) => {
|
|
20878
|
+
console.log(`${messageIndent}${line}`);
|
|
20871
20879
|
});
|
|
20872
|
-
if (lines.length > 3) {
|
|
20873
|
-
console.log(`${messageIndent}... (+${lines.length - 3} more line${lines.length - 3 === 1 ? "" : "s"})`);
|
|
20874
|
-
}
|
|
20875
20880
|
}
|
|
20876
|
-
|
|
20877
|
-
|
|
20878
|
-
|
|
20879
|
-
contextInfo.push("----------------");
|
|
20880
|
-
contextInfo.push(`${timeAgo}`);
|
|
20881
|
-
contextInfo.push("----------------");
|
|
20882
|
-
contextInfo.push(`
|
|
20883
|
-
`);
|
|
20884
|
-
if (dump.branch && dump.branch !== "main") {
|
|
20885
|
-
contextInfo.push(`${dump.branch}${dump.hasUncommittedChanges ? " (uncommitted)" : ""}`);
|
|
20881
|
+
if (dump?.tags?.length) {
|
|
20882
|
+
const tagsLine = `[${dump.tags.join(", ")}]`;
|
|
20883
|
+
console.log(`${messageIndent}\x1B[36m${tagsLine}\x1B[0m`);
|
|
20886
20884
|
}
|
|
20887
|
-
if (
|
|
20888
|
-
|
|
20885
|
+
if (dump.branch && dump.branch !== "main") {
|
|
20886
|
+
const gitInfo = `${dump.branch}${dump.hasUncommittedChanges ? " (uncommitted)" : ""}`;
|
|
20887
|
+
console.log(`${messageIndent}\x1B[33m${gitInfo}\x1B[0m`);
|
|
20889
20888
|
}
|
|
20890
|
-
console.log("");
|
|
20891
20889
|
});
|
|
20892
|
-
console.log(
|
|
20890
|
+
console.log(`
|
|
20891
|
+
\x1B[90m Tip: Use the 8-character ID to reference dumps (e.g., flux edit ${results[0]?.item.id.substring(0, 8)})\x1B[0m
|
|
20893
20892
|
`);
|
|
20894
20893
|
}
|
|
20895
20894
|
function getTimeAgo(date) {
|
|
@@ -23828,33 +23827,43 @@ var inquirer = {
|
|
|
23828
23827
|
var dist_default14 = inquirer;
|
|
23829
23828
|
|
|
23830
23829
|
// src/commands/init.command.ts
|
|
23831
|
-
async function initFluxCommand() {
|
|
23830
|
+
async function initFluxCommand(options) {
|
|
23832
23831
|
console.log("Initializing Flux Capacitor...");
|
|
23833
23832
|
try {
|
|
23834
23833
|
await createIfNotExists(FLUX_FOLDER_PATH, "directory");
|
|
23835
23834
|
await createIfNotExists(FLUX_BRAIN_DUMP_PATH, "directory");
|
|
23836
23835
|
await createIfNotExists(FLUX_SESSION_PATH, "directory");
|
|
23837
23836
|
const config = FLUX_DEFAULT_CONFIG;
|
|
23838
|
-
|
|
23839
|
-
|
|
23840
|
-
|
|
23841
|
-
|
|
23842
|
-
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
|
|
23847
|
-
|
|
23848
|
-
|
|
23849
|
-
|
|
23850
|
-
|
|
23851
|
-
|
|
23852
|
-
|
|
23853
|
-
|
|
23854
|
-
|
|
23855
|
-
|
|
23856
|
-
|
|
23857
|
-
|
|
23837
|
+
let answers;
|
|
23838
|
+
if (options.yes) {
|
|
23839
|
+
console.log("Accepting all default options for initialization...");
|
|
23840
|
+
answers = {
|
|
23841
|
+
includeWorkingDir: true,
|
|
23842
|
+
includeBranch: true,
|
|
23843
|
+
includeUncommitted: true
|
|
23844
|
+
};
|
|
23845
|
+
} else {
|
|
23846
|
+
answers = await dist_default14.prompt([
|
|
23847
|
+
{
|
|
23848
|
+
type: "confirm",
|
|
23849
|
+
name: "includeWorkingDir",
|
|
23850
|
+
message: "Include your current working directory in logs?",
|
|
23851
|
+
default: true
|
|
23852
|
+
},
|
|
23853
|
+
{
|
|
23854
|
+
type: "confirm",
|
|
23855
|
+
name: "includeBranch",
|
|
23856
|
+
message: "Include your git branch name in logs?",
|
|
23857
|
+
default: true
|
|
23858
|
+
},
|
|
23859
|
+
{
|
|
23860
|
+
type: "confirm",
|
|
23861
|
+
name: "includeUncommitted",
|
|
23862
|
+
message: "Include uncommitted git changes in logs?",
|
|
23863
|
+
default: true
|
|
23864
|
+
}
|
|
23865
|
+
]);
|
|
23866
|
+
}
|
|
23858
23867
|
config.privacy.hideWorkingDir = !answers.includeWorkingDir;
|
|
23859
23868
|
config.privacy.hideBranchName = !answers.includeBranch;
|
|
23860
23869
|
config.privacy.hideUncommittedChanges = !answers.includeUncommitted;
|
|
@@ -25277,7 +25286,7 @@ function createFuseInstance(data, config) {
|
|
|
25277
25286
|
return new Fuse(data, {
|
|
25278
25287
|
keys: config.search.searchFields,
|
|
25279
25288
|
includeScore: config.search.fuseOptions?.includeScore || true,
|
|
25280
|
-
threshold: config.search.fuseOptions?.threshold || 0.
|
|
25289
|
+
threshold: config.search.fuseOptions?.threshold || 0.5
|
|
25281
25290
|
});
|
|
25282
25291
|
}
|
|
25283
25292
|
|
|
@@ -25287,40 +25296,42 @@ async function searchBrainDumpCommand(query) {
|
|
|
25287
25296
|
console.log("Searching all brain dumps...");
|
|
25288
25297
|
const fluxPath = await getFluxPath();
|
|
25289
25298
|
const config = await getConfigFile(fluxPath);
|
|
25290
|
-
const
|
|
25299
|
+
const combinedQuery = query.join(" ").trim();
|
|
25291
25300
|
let searchResults = [];
|
|
25292
25301
|
const allFilePaths = await getAllBrainDumpFilePaths(fluxPath);
|
|
25293
|
-
for
|
|
25294
|
-
|
|
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) {
|
|
25306
|
+
const fuse = createFuseInstance(fileData.dumps, config);
|
|
25307
|
+
const results = fuse.search(searchQuery);
|
|
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
|
+
}
|
|
25317
|
+
}
|
|
25295
25318
|
if (searchQuery) {
|
|
25296
|
-
|
|
25297
|
-
const results = fuse.search(searchQuery);
|
|
25298
|
-
searchResults.push(...results);
|
|
25319
|
+
searchResults.sort((a, b) => (a.score || 0) - (b.score || 0));
|
|
25299
25320
|
} else {
|
|
25300
|
-
|
|
25301
|
-
item
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
})
|
|
25305
|
-
searchResults.push(...recentDumps);
|
|
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
|
+
});
|
|
25306
25326
|
}
|
|
25307
25327
|
}
|
|
25308
|
-
|
|
25309
|
-
searchResults.sort((a, b) => (a.score || 0) - (b.score || 0));
|
|
25310
|
-
} else {
|
|
25311
|
-
searchResults.sort((a, b) => {
|
|
25312
|
-
const timeA = new Date(a.item.timestamp).getTime();
|
|
25313
|
-
const timeB = new Date(b.item.timestamp).getTime();
|
|
25314
|
-
return timeB - timeA;
|
|
25315
|
-
});
|
|
25316
|
-
}
|
|
25317
|
-
const resultLimit = config?.search?.resultLimit || (searchQuery ? 10 : 5);
|
|
25328
|
+
const resultLimit = config?.search?.resultLimit || (combinedQuery ? 10 : 5);
|
|
25318
25329
|
const limitedResults = searchResults.slice(0, resultLimit);
|
|
25319
25330
|
if (searchResults.length > limitedResults.length) {
|
|
25320
25331
|
console.log(`
|
|
25321
25332
|
(Showing ${limitedResults.length} of ${searchResults.length} results)`);
|
|
25322
25333
|
}
|
|
25323
|
-
displaySearchResults(limitedResults,
|
|
25334
|
+
displaySearchResults(limitedResults, combinedQuery || undefined);
|
|
25324
25335
|
}
|
|
25325
25336
|
|
|
25326
25337
|
// src/commands/config.command.ts
|
|
@@ -25399,9 +25410,9 @@ Editable keys are: ${editableKeys.join(", ")}`);
|
|
|
25399
25410
|
// src/index.ts
|
|
25400
25411
|
var program2 = new Command;
|
|
25401
25412
|
program2.name(`flux`).description("Git-aware CLI context manager for ADHD developers").version(package_default.version);
|
|
25402
|
-
program2.command("init").description("Initialize flux in the current repository").action(initFluxCommand);
|
|
25413
|
+
program2.command("init").option("-y, --yes", "Accept all default options for initialization").description("Initialize flux in the current repository").action(initFluxCommand);
|
|
25403
25414
|
program2.command("reset").description("Resets flux in the current repository").action(resetFluxCommand);
|
|
25404
|
-
program2.command("dump [message...]").option("-m, --multiline", "Enable multiline input mode").option("-n, --notes", "Jot down a note").option("-i, --ideas", "Jot down an idea").option("-t, --tasks", "Jot down a task").option("-b, --bugs", "Jot down a bug").option("--tag [custom]", "Jot down a custom tagged").description("Add a brain dump with a message. Use --multiline for multi-line input.").action(async (message, options) => {
|
|
25415
|
+
program2.command("dump [message...]").option("-m, --multiline", "Enable multiline input mode").option("-n, --notes", "Jot down a note").option("-i, --important", "Jot down a link").option("-d, --ideas", "Jot down an idea").option("-t, --tasks", "Jot down a task").option("-b, --bugs", "Jot down a bug").option("-l, --links", "Jot down a link").option("--tag [custom]", "Jot down a custom tagged").description("Add a brain dump with a message. Use --multiline for multi-line input.").action(async (message, options) => {
|
|
25405
25416
|
await handleBrainDump(message, options);
|
|
25406
25417
|
});
|
|
25407
25418
|
program2.command("search [query...]").description("Search brain dumps with a query. If no query is provided, lists all brain dumps for the current month.").action((query) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev_desh/flux-cap",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"description": "Git-aware CLI context manager for ADHD developers",
|
|
6
6
|
"bin": {
|
|
7
7
|
"flux": "./dist/index.js"
|
|
@@ -47,5 +47,6 @@
|
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|
|
49
49
|
"url": "https://github.com/kaustubh285/flux-cap"
|
|
50
|
-
}
|
|
50
|
+
},
|
|
51
|
+
"license": "MIT"
|
|
51
52
|
}
|