granola-toolkit 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.
Files changed (2) hide show
  1. package/dist/cli.js +10 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { mkdir, readFile, rm, stat, writeFile } from "node:fs/promises";
3
2
  import { existsSync } from "node:fs";
3
+ import { mkdir, readFile, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
  import { createHash } from "node:crypto";
@@ -37,7 +37,6 @@ function compareStrings(left, right) {
37
37
  }
38
38
  function firstExistingPath(candidates) {
39
39
  for (const candidate of candidates) if (existsSync(candidate)) return candidate;
40
- return candidates[0];
41
40
  }
42
41
  function granolaSupabaseCandidates() {
43
42
  const home = homedir();
@@ -383,10 +382,13 @@ function parseSimpleToml(contents) {
383
382
  return values;
384
383
  }
385
384
  async function loadTomlConfig(configPath) {
386
- if (configPath) return {
387
- path: configPath,
388
- values: parseSimpleToml(await readUtf8(configPath))
389
- };
385
+ if (configPath) {
386
+ if (!existsSync(configPath)) throw new Error(`config file not found: ${configPath}`);
387
+ return {
388
+ path: configPath,
389
+ values: parseSimpleToml(await readUtf8(configPath))
390
+ };
391
+ }
390
392
  const candidates = [join(process.cwd(), ".granola.toml"), join(homedir(), ".granola.toml")];
391
393
  for (const candidate of candidates) if (existsSync(candidate)) return {
392
394
  path: candidate,
@@ -818,6 +820,7 @@ const notesCommand = {
818
820
  subcommandFlags: commandFlags
819
821
  });
820
822
  if (!config.supabase) throw new Error(`supabase.json not found. Pass --supabase or create .granola.toml. Expected locations include: ${granolaSupabaseCandidates().join(", ")}`);
823
+ if (!existsSync(config.supabase)) throw new Error(`supabase.json not found: ${config.supabase}`);
821
824
  debug(config.debug, "using config", config.configFileUsed ?? "(none)");
822
825
  debug(config.debug, "supabase", config.supabase);
823
826
  debug(config.debug, "timeoutMs", config.notes.timeoutMs);
@@ -1034,6 +1037,7 @@ const transcriptsCommand = {
1034
1037
  subcommandFlags: commandFlags
1035
1038
  });
1036
1039
  if (!config.transcripts.cacheFile) throw new Error(`Granola cache file not found. Pass --cache or create .granola.toml. Expected locations include: ${granolaCacheCandidates().join(", ")}`);
1040
+ if (!existsSync(config.transcripts.cacheFile)) throw new Error(`Granola cache file not found: ${config.transcripts.cacheFile}`);
1037
1041
  debug(config.debug, "using config", config.configFileUsed ?? "(none)");
1038
1042
  debug(config.debug, "cacheFile", config.transcripts.cacheFile);
1039
1043
  debug(config.debug, "output", config.transcripts.output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "granola-toolkit",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "CLI toolkit for exporting and working with Granola notes and transcripts",
5
5
  "keywords": [
6
6
  "cli",