You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update AGENTS.md with session learnings (#211)
- template-engine.ts as canonical API; dates.ts template fns removed
- headless test workaround (no xvfb)
- d: prefix gotcha in template regex capture group
- git commands: run from cwd, never cd first
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ Run a single test by passing a Mocha grep through `@vscode/test-cli`:
25
25
npm test -- --grep "MatchInput"
26
26
```
27
27
28
+
No display available (no xvfb)? Run `npm run compile-tests` then verify pure logic with `node -e "const {fn} = require('./out/path/to/module'); ..."` — does not need VS Code.
29
+
28
30
`--grep` is the fast TDD loop (~5 s vs 30 s for the full suite). `rm -rf out/` between branch switches — `npm run compile-tests` does not prune stale `.test.js` files, so deleted/renamed tests keep running and show as phantom failures when comparing test counts across branches.
29
31
30
32
Tests live in `src/test/suite/**/*.test.ts`, compile to `out/test/suite/**/*.test.js`, and run inside a real Extension Host against the workspace `test/ws_unittests/`. Mocha TDD UI, 20s default timeout (`.vscode-test.mjs`). `src/test/direct/` contains plain-node debug scripts, not part of the suite.
@@ -54,6 +56,7 @@ Entry: `src/extension.ts` → `Startup(config).run(context)` (in `src/vscode/sta
-`MatchInput` (smart-input resolver) — moved here from the old `src/provider/features/`.
56
58
-`paths.ts` — date-from-URI path utilities (moved here from `src/util/`).
59
+
-`template-engine.ts` — `resolveDate(template, date, locale?)` and `toMomentFormat(template)`. Single `TEMPLATE_VARIABLE_MAP` registry; use these instead of anything from `dates.ts`. Custom `${d:fmt}` capture group includes the `d:` prefix — strip with `.slice(2)` to get the format string.
57
60
-`src/model/` — Plain data types: `Input`, `FileEntry`, `HeaderTemplate`/`InlineTemplate`/`ScopedTemplate`, scope/quickpick types.
58
61
-`src/commands/` — one file per registered command (`journal.today`, `journal.note`, `journal.printDuration`, etc.); each exports a static `create(ctrl)` that returns the `Disposable`.
59
62
-`src/ui/` — VS Code UI providers.
@@ -63,7 +66,7 @@ Entry: `src/extension.ts` → `Startup(config).run(context)` (in `src/vscode/sta
63
66
-`entries/` — `ScanEntries` (directory walker + cache for QuickPick).
64
67
-`sync/` — `SyncNoteLinks`, `SyncDailyLinks`.
65
68
-`LoadNotes` and other higher-level feature helpers.
66
-
-`src/util/` — `Ctrl`, `Logger` (OutputChannel-backed), `dates.ts` (moment-based, slated for removal in Phase 3), `strings.ts`. Note: `paths.ts` moved to `src/journal/paths.ts`.
69
+
-`src/util/` — `Ctrl`, `Logger` (OutputChannel-backed), `dates.ts` (ISO week + locale helpers only; template replacement functions removed in #211), `strings.ts`. Note: `paths.ts` moved to `src/journal/paths.ts`.
67
70
68
71
**Smart-input flow.** User triggers `journal.day` (`Ctrl+Shift+J`) → `Dialogues` shows InputBox → `MatchInput.parseInput()` classifies the text (date expression, weekday, "memo:", "task:", "note ...", week reference) → command dispatches to `Reader`/`Writer`/`Inject`. The default path/file patterns (`${base}/${year}/${month}/${day}` for notes, `${base}/${year}/${month}/${day}.${ext}` for entries) come from `journal.patterns` in `package.json`.
69
72
@@ -79,6 +82,7 @@ Entry: `src/extension.ts` → `Startup(config).run(context)` (in `src/vscode/sta
79
82
- When batch-replacing `this.ctrl.X.method(` patterns, also grep `this\.ctrl\.X[^.]` (no trailing dot) to catch argument positions like `this.ctrl.logger,`. Run `npm run compile-tests` (tsc) not just `npm run compile` (esbuild) to catch type errors in the refactor.
80
83
-`docs/` contains user-facing feature docs (entries, notes, memos, tasks, scopes, settings, codeactions) and `docs/analysis/` holds the analysis that produced `PLAN.md`.
81
84
- Local `develop` often lags `origin/develop` — `git fetch origin develop` and rebase the feature branch before opening a PR. Remote branches created from the issue UI may already exist as empty refs; fetch and rebase rather than force-push.
85
+
- Run all `git` commands from the current working directory using `-C <path>` or absolute paths if needed — never `cd` before a git command.
82
86
- Conventional Commits with scope: `perf(scan-entries):`, `feat(navigation):`, `fix(remote):`, `test(remote):`, `docs:`. Issue ref goes in the commit body (`#187`), not the subject.
0 commit comments