@titan-design/brain 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/cli.js +14 -16
  2. package/package.json +2 -3
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
+ import { createRequire } from "module";
4
5
  import { Command as Command11 } from "@commander-js/extra-typings";
5
6
 
6
7
  // src/commands/init.ts
@@ -849,12 +850,12 @@ var initCommand = new Command("init").description("Initialize a new brain worksp
849
850
  // src/commands/index-cmd.ts
850
851
  import { Command as Command2 } from "@commander-js/extra-typings";
851
852
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
852
- import { basename, join as join3, relative } from "path";
853
+ import { basename, join as join4, relative } from "path";
853
854
 
854
855
  // src/services/file-scanner.ts
855
856
  import { createHash } from "crypto";
856
- import { readFile, stat } from "fs/promises";
857
- import { glob } from "glob";
857
+ import { readFile, stat, readdir } from "fs/promises";
858
+ import { join as join3 } from "path";
858
859
  function hashContent(content) {
859
860
  return createHash("sha256").update(content).digest("hex");
860
861
  }
@@ -865,11 +866,8 @@ async function scanForChanges(rootDir, knownFiles) {
865
866
  deleted: [],
866
867
  unchanged: 0
867
868
  };
868
- const files = await glob("**/*.md", {
869
- cwd: rootDir,
870
- absolute: true,
871
- ignore: ["**/node_modules/**", "**/.git/**"]
872
- });
869
+ const entries = await readdir(rootDir, { recursive: true });
870
+ const files = entries.filter((e) => e.endsWith(".md") && !e.includes("node_modules") && !e.includes(".git")).map((e) => join3(rootDir, e));
873
871
  const seen = /* @__PURE__ */ new Set();
874
872
  for (const filePath of files) {
875
873
  seen.add(filePath);
@@ -1205,7 +1203,7 @@ function generateIndex(db, notesDir) {
1205
1203
  }
1206
1204
  lines2.push("");
1207
1205
  }
1208
- writeFileSync3(join3(notesDir, "_index.md"), lines2.join("\n"), "utf-8");
1206
+ writeFileSync3(join4(notesDir, "_index.md"), lines2.join("\n"), "utf-8");
1209
1207
  }
1210
1208
 
1211
1209
  // src/commands/search.ts
@@ -1557,7 +1555,7 @@ function formatMap(map) {
1557
1555
  // src/commands/add.ts
1558
1556
  import { Command as Command5 } from "@commander-js/extra-typings";
1559
1557
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3, existsSync as existsSync3 } from "fs";
1560
- import { join as join4, dirname, resolve } from "path";
1558
+ import { join as join5, dirname, resolve } from "path";
1561
1559
  function slugify(text) {
1562
1560
  return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
1563
1561
  }
@@ -1591,7 +1589,7 @@ function resolveOutputPath(notesDir, tier, type, id) {
1591
1589
  const yyyy = String(now.getFullYear());
1592
1590
  const mm = String(now.getMonth() + 1).padStart(2, "0");
1593
1591
  const dd = String(now.getDate()).padStart(2, "0");
1594
- return join4(notesDir, "logs", yyyy, mm, `${yyyy}-${mm}-${dd}-${id}.md`);
1592
+ return join5(notesDir, "logs", yyyy, mm, `${yyyy}-${mm}-${dd}-${id}.md`);
1595
1593
  }
1596
1594
  const TYPE_DIRS = {
1597
1595
  note: "notes",
@@ -1603,7 +1601,7 @@ function resolveOutputPath(notesDir, tier, type, id) {
1603
1601
  guide: "notes"
1604
1602
  };
1605
1603
  const typeDir = TYPE_DIRS[type];
1606
- return join4(notesDir, typeDir, `${id}.md`);
1604
+ return join5(notesDir, typeDir, `${id}.md`);
1607
1605
  }
1608
1606
  var addCommand = new Command5("add").description("Create a new note from file or stdin").argument("[file]", "Input file path").option("--title <title>", "Note title").option("--type <type>", "Note type (note, decision, pattern, research, meeting, session-log, guide)").option("--tier <tier>", "Note tier (slow, fast)").option("--tags <tags>", "Comma-separated tags").action(async (file, opts) => {
1609
1607
  const VALID_TYPES2 = ["note", "decision", "pattern", "research", "meeting", "session-log", "guide"];
@@ -1964,7 +1962,7 @@ var templateCommand = new Command8("template").description("Output a frontmatter
1964
1962
  // src/commands/archive.ts
1965
1963
  import { Command as Command9 } from "@commander-js/extra-typings";
1966
1964
  import { renameSync, mkdirSync as mkdirSync4, existsSync as existsSync4 } from "fs";
1967
- import { join as join5, basename as basename2 } from "path";
1965
+ import { join as join6, basename as basename2 } from "path";
1968
1966
  var archiveCommand = new Command9("archive").description("Move expired fast-tier notes to archive").option("--dry-run", "List files that would be archived without moving them").action((opts) => {
1969
1967
  const config = loadConfig();
1970
1968
  const db = new BrainDB(config.dbPath);
@@ -1983,9 +1981,9 @@ var archiveCommand = new Command9("archive").description("Move expired fast-tier
1983
1981
  for (const note of expired) {
1984
1982
  const expiresDate = new Date(note.expires);
1985
1983
  const yyyy = String(expiresDate.getFullYear());
1986
- const archiveDir = join5(config.notesDir, "archive", yyyy);
1984
+ const archiveDir = join6(config.notesDir, "archive", yyyy);
1987
1985
  const filename = basename2(note.filePath);
1988
- const archivePath = join5(archiveDir, filename);
1986
+ const archivePath = join6(archiveDir, filename);
1989
1987
  if (opts.dryRun) {
1990
1988
  console.log(`Would archive: ${note.filePath} \u2192 ${archivePath}`);
1991
1989
  continue;
@@ -2096,7 +2094,7 @@ var setSubcommand = new Command10("set").description("Set a config value").argum
2096
2094
  var configCommand = new Command10("config").description("Get or set configuration values").addCommand(getSubcommand).addCommand(setSubcommand);
2097
2095
 
2098
2096
  // src/cli.ts
2099
- var program = new Command11().name("brain").description("Developer second brain with hybrid RAG search").version("0.1.0").option("--config-dir <path>", "override config directory").option("--db-path <path>", "override database path");
2097
+ var program = new Command11().name("brain").description("Developer second brain with hybrid RAG search").version(createRequire(import.meta.url)("../package.json").version).option("--config-dir <path>", "override config directory").option("--db-path <path>", "override database path");
2100
2098
  program.addCommand(initCommand);
2101
2099
  program.addCommand(indexCommand);
2102
2100
  program.addCommand(searchCommand);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@titan-design/brain",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Developer second brain with hybrid RAG search",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/titan-design/brain.git"
9
+ "url": "git+https://github.com/HJewkes/brain.git"
10
10
  },
11
11
  "files": [
12
12
  "dist",
@@ -33,7 +33,6 @@
33
33
  "sqlite-vec": "^0.1.6",
34
34
  "ollama": "^0.5.14",
35
35
  "gray-matter": "^4.0.3",
36
- "glob": "^11.0.1",
37
36
  "env-paths": "^3.0.0"
38
37
  },
39
38
  "optionalDependencies": {