@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 +2 -2
- package/package.json +1 -1
- package/src/note-writer.ts +7 -0
- package/src/obsidian-cli.ts +17 -0
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`
|
|
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
|
-
|
|
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
package/src/note-writer.ts
CHANGED
|
@@ -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
|
|
package/src/obsidian-cli.ts
CHANGED
|
@@ -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
|
|