@albireo3754/agentlog 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -86,7 +86,7 @@ Use Claude Code normally. Every prompt you type gets logged to your Daily Note.
86
86
  1. You type a prompt in Claude Code
87
87
  2. Claude Code fires the `UserPromptSubmit` hook
88
88
  3. AgentLog reads the prompt from stdin and sanitizes it
89
- 4. Finds your Daily Note: `{vault}/Daily/YYYY-MM-DD-요일.md` (경로 하드코딩, Obsidian Daily Notes 폴더 설정과 다를 수 있음)
89
+ 4. Finds your Daily Note via `obsidian daily:path` (Obsidian CLI 1.12+), fallback: `{vault}/Daily/YYYY-MM-DD-요일.md`
90
90
  5. Finds or creates a `## AgentLog` section
91
91
  6. Finds or creates a `#### project` subsection matching the current working directory
92
92
  7. Inserts a session divider `[[ses_...]]` if the session changed, then appends the entry
@@ -98,7 +98,7 @@ Total overhead: < 50ms per prompt. Fire-and-forget, never blocks Claude Code.
98
98
 
99
99
  ### Obsidian Mode (default)
100
100
 
101
- Entries go to `{vault}/Daily/YYYY-MM-DD-요일.md` under a `## AgentLog` section. Daily Notes 폴더가 `Daily/`가 아닌 경우 `init` vault 경로를 조정하거나, Obsidian Daily Notes 폴더 설정을 `Daily/`로 맞춰야 합니다.
101
+ Daily Note 경로는 `obsidian daily:path` CLI 명령으로 동적 해석 (Obsidian 1.12+). Obsidian이 실행 중이 아니거나 CLI를 사용할 없으면 `{vault}/Daily/YYYY-MM-DD-요일.md`로 fallback.
102
102
 
103
103
  Each working directory gets its own `#### project` subsection. Session changes insert a `[[ses_...]]` wiki-link divider. The `> 🕐` blockquote at the top always shows the latest entry across all projects.
104
104
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albireo3754/agentlog",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Claude Code prompts → Obsidian Daily Note auto-logger",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,7 @@ import {
9
9
  buildProjectHeader,
10
10
  buildProjectMetadata,
11
11
  } from "./schema/daily-note.js";
12
+ import { cliDailyPath } from "./obsidian-cli.js";
12
13
 
13
14
  /** Zero-pads a number to 2 digits. */
14
15
  function pad2(n: number): string {
@@ -23,6 +24,12 @@ export function dailyNotePath(config: AgentLogConfig, date: Date): string {
23
24
  const dd = pad2(date.getDate());
24
25
  return join(config.vault, `${yyyy}-${mm}-${dd}.md`);
25
26
  }
27
+
28
+ // Try Obsidian CLI first (respects user's Daily Notes folder setting)
29
+ const relativePath = cliDailyPath();
30
+ if (relativePath) return join(config.vault, relativePath);
31
+
32
+ // Fallback: hardcoded {vault}/Daily/
26
33
  return join(config.vault, "Daily", dailyNoteFileName(date));
27
34
  }
28
35
 
@@ -58,6 +58,23 @@ export function resolveCliBin(): string | null {
58
58
  return null;
59
59
  }
60
60
 
61
+ /**
62
+ * Get today's Daily Note path via `obsidian daily:path`.
63
+ * Returns the path from Obsidian's Daily Notes settings (relative to vault).
64
+ * Returns null if CLI is unavailable or Obsidian is not running.
65
+ */
66
+ export function cliDailyPath(): string | null {
67
+ const bin = resolveCliBin();
68
+ if (!bin) return null;
69
+ const result = spawnSync(bin, ["daily:path"], { encoding: "utf-8", timeout: 3000 });
70
+ if (result.status !== 0) return null;
71
+ // stdout may contain Electron noise lines (e.g. "Loading updated app package",
72
+ // version warnings). The actual path is always the last non-empty line.
73
+ const lines = result.stdout.trim().split("\n").filter(Boolean);
74
+ const path = (lines.at(-1) ?? "").trim();
75
+ return path || null;
76
+ }
77
+
61
78
  /** Minimum Obsidian version that supports CLI */
62
79
  export const MIN_CLI_VERSION = "1.12.4";
63
80