Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds first-class support for the Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying quickadd with
|
| Latest commit: |
1ca1085
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a52ff9c8.quickadd.pages.dev |
| Branch Preview URL: | https://1121-feature-request-allow-c.quickadd.pages.dev |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/engine/CaptureChoiceEngine.ts (1)
472-474:⚠️ Potential issue | 🟠 MajorStrip non‑
.mdextensions when deriving the capture title.
With.base/.canvastargets now preserved,fileBasenamekeeps the extension and leaks it into{{TITLE}}and front‑matter variables. Please strip all known extensions here.🔧 Suggested fix
- const fileBasename = filePath.split("/").pop()?.replace(/\.md$/, "") || ""; + const fileBasename = + filePath + .split("/") + .pop() + ?.replace(/\.(md|canvas|base)$/i, "") || "";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/engine/CaptureChoiceEngine.ts` around lines 472 - 474, The current extraction for fileBasename (in CaptureChoiceEngine where filePath is split and then passed to this.formatter.setTitle) only strips ".md" and therefore leaves other known extensions like ".base" and ".canvas" in the title; update the derivation to remove all known capture-related extensions by replacing trailing extensions (e.g. .md, .base, .canvas — case insensitive) from the popped filename before calling this.formatter.setTitle so {{TITLE}} and front‑matter variables never include those extensions.
🧹 Nitpick comments (3)
src/utils/pathUtils.ts (1)
3-6: Function name is now misleading.
basenameWithoutMdOrCanvasalso strips.base; consider renaming (e.g.,basenameWithoutKnownExtension) or adding a brief comment to avoid confusion.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/utils/pathUtils.ts` around lines 3 - 6, The function basenameWithoutMdOrCanvas incorrectly implies it only removes .md and .canvas while it also strips .base; either rename the function (e.g., basenameWithoutKnownExtension) and update all call sites to the new name, or add a concise JSDoc comment above basenameWithoutMdOrCanvas explaining that it removes .md, .canvas, and .base extensions; ensure you update any tests or imports referencing basenameWithoutMdOrCanvas to match the chosen change and keep the implementation in basenameWithoutMdOrCanvas (or the new name) unchanged.src/engine/canvas-integration.test.ts (1)
6-8: Consider importing regex constants fromsrc/constants.tsrather than redefining them locally.The test file defines
MARKDOWN_REGEX,CANVAS_REGEX, andBASE_REGEXinline in severaldescribeblocks. If the canonical constants insrc/constants.tsare ever changed (e.g., a flag added), these tests won't catch the divergence and could give false assurance.♻️ Example for the first describe block
+import { + MARKDOWN_FILE_EXTENSION_REGEX, + CANVAS_FILE_EXTENSION_REGEX, + BASE_FILE_EXTENSION_REGEX, +} from '../constants'; describe('Canvas Template Integration', () => { describe('Regex patterns for canvas support', () => { - const MARKDOWN_REGEX = new RegExp(/\.md$/); - const CANVAS_REGEX = new RegExp(/\.canvas$/); - const BASE_REGEX = new RegExp(/\.base$/); + const MARKDOWN_REGEX = MARKDOWN_FILE_EXTENSION_REGEX; + const CANVAS_REGEX = CANVAS_FILE_EXTENSION_REGEX; + const BASE_REGEX = BASE_FILE_EXTENSION_REGEX;Also applies to: 40-41, 78-80, 130-132
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/engine/canvas-integration.test.ts` around lines 6 - 8, Replace the local regex redefinitions in the test with the canonical exported regex constants by importing MARKDOWN_REGEX, CANVAS_REGEX, and BASE_REGEX from the project's constants module and use those imports in each describe block (instead of redeclaring new RegExp instances); update the top of canvas-integration.test.ts to import the exported constants and remove the inline new RegExp(...) declarations so tests always reference the single source of truth.src/engine/TemplateEngine.ts (1)
517-518:basenameWithoutMdOrCanvasname is now stale — consider renaming in a follow-up.
pathUtils.tswas updated in this PR to also strip.base(via/\.(md|canvas|base)$/i), but the function is still calledbasenameWithoutMdOrCanvas. A name likebasenameWithoutKnownExtensionwould more accurately reflect its current behavior.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/engine/TemplateEngine.ts` around lines 517 - 518, The callsite in TemplateEngine.ts still uses the outdated function name basenameWithoutMdOrCanvas; rename the utility to a clearer name (e.g., basenameWithoutKnownExtension) and update this usage and any other imports/usages accordingly: change references to basenameWithoutMdOrCanvas -> basenameWithoutKnownExtension, update the import in TemplateEngine.ts and the exported function name in pathUtils.ts (or wherever it's defined), and run a project-wide search to update all occurrences so the runtime and types remain consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/engine/CaptureChoiceEngine.ts`:
- Around line 472-474: The current extraction for fileBasename (in
CaptureChoiceEngine where filePath is split and then passed to
this.formatter.setTitle) only strips ".md" and therefore leaves other known
extensions like ".base" and ".canvas" in the title; update the derivation to
remove all known capture-related extensions by replacing trailing extensions
(e.g. .md, .base, .canvas — case insensitive) from the popped filename before
calling this.formatter.setTitle so {{TITLE}} and front‑matter variables never
include those extensions.
---
Nitpick comments:
In `@src/engine/canvas-integration.test.ts`:
- Around line 6-8: Replace the local regex redefinitions in the test with the
canonical exported regex constants by importing MARKDOWN_REGEX, CANVAS_REGEX,
and BASE_REGEX from the project's constants module and use those imports in each
describe block (instead of redeclaring new RegExp instances); update the top of
canvas-integration.test.ts to import the exported constants and remove the
inline new RegExp(...) declarations so tests always reference the single source
of truth.
In `@src/engine/TemplateEngine.ts`:
- Around line 517-518: The callsite in TemplateEngine.ts still uses the outdated
function name basenameWithoutMdOrCanvas; rename the utility to a clearer name
(e.g., basenameWithoutKnownExtension) and update this usage and any other
imports/usages accordingly: change references to basenameWithoutMdOrCanvas ->
basenameWithoutKnownExtension, update the import in TemplateEngine.ts and the
exported function name in pathUtils.ts (or wherever it's defined), and run a
project-wide search to update all occurrences so the runtime and types remain
consistent.
In `@src/utils/pathUtils.ts`:
- Around line 3-6: The function basenameWithoutMdOrCanvas incorrectly implies it
only removes .md and .canvas while it also strips .base; either rename the
function (e.g., basenameWithoutKnownExtension) and update all call sites to the
new name, or add a concise JSDoc comment above basenameWithoutMdOrCanvas
explaining that it removes .md, .canvas, and .base extensions; ensure you update
any tests or imports referencing basenameWithoutMdOrCanvas to match the chosen
change and keep the implementation in basenameWithoutMdOrCanvas (or the new
name) unchanged.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
docs/docs/Choices/CaptureChoice.mddocs/docs/Choices/TemplateChoice.mdsrc/constants.tssrc/engine/CaptureChoiceEngine.selection.test.tssrc/engine/CaptureChoiceEngine.tssrc/engine/TemplateChoiceEngine.notice.test.tssrc/engine/TemplateChoiceEngine.tssrc/engine/TemplateEngine.tssrc/engine/canvas-integration.test.tssrc/engine/templateEngine-increment-canvas.test.tssrc/engine/templateEngine-title.test.tssrc/preflight/RequirementCollector.test.tssrc/preflight/runOnePagePreflight.selection.test.tssrc/preflight/runOnePagePreflight.tssrc/utils/pathUtils.ts
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/engine/CaptureChoiceEngine.ts (2)
473-475:basenameWithoutMdOrCanvasnow also strips.base— name is stale.The helper in
src/utils/pathUtils.ts(line 4) uses/\.(md|canvas|base)$/i, so the function name no longer reflects its behavior. Consider renaming to something likebasenameWithoutExtensionorfileBasenameto avoid confusion as more extensions are added.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/engine/CaptureChoiceEngine.ts` around lines 473 - 475, The helper function basenameWithoutMdOrCanvas now strips .base as well, so rename the function to a more accurate name (e.g., basenameWithoutExtension or fileBasename) and update all usages: rename the function declaration in the util module (basenameWithoutMdOrCanvas -> basenameWithoutExtension), update the import and call in CaptureChoiceEngine (the fileBasename assignment that calls basenameWithoutMdOrCanvas), and adjust any other references/tests to the new identifier to keep names consistent with behavior.
318-324: Extract a shared helper for the triple-regex extension check.The same three-regex test appears in both
resolveCaptureTarget(Lines 318-322) andnormalizeCaptureFilePath(Lines 565-568). A small predicate keeps them in sync and makes it trivial to add future extensions.Also note: the regex constants are case-sensitive (
/\.base$/) whilebasenameWithoutMdOrCanvasinsrc/utils/pathUtils.tsuses a case-insensitive pattern (/\.(md|canvas|base)$/i). Consider aligning the casing behavior.♻️ Suggested helper
+private hasKnownFileExtension(path: string): boolean { + return ( + MARKDOWN_FILE_EXTENSION_REGEX.test(path) || + CANVAS_FILE_EXTENSION_REGEX.test(path) || + BASE_FILE_EXTENSION_REGEX.test(path) + ); +}Then in both call sites:
- if ( - MARKDOWN_FILE_EXTENSION_REGEX.test(normalizedCaptureTo) || - CANVAS_FILE_EXTENSION_REGEX.test(normalizedCaptureTo) || - BASE_FILE_EXTENSION_REGEX.test(normalizedCaptureTo) - ) { + if (this.hasKnownFileExtension(normalizedCaptureTo)) {- if ( - MARKDOWN_FILE_EXTENSION_REGEX.test(normalizedPath) || - CANVAS_FILE_EXTENSION_REGEX.test(normalizedPath) || - BASE_FILE_EXTENSION_REGEX.test(normalizedPath) - ) { + if (this.hasKnownFileExtension(normalizedPath)) {Also applies to: 563-574
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/engine/CaptureChoiceEngine.ts` around lines 318 - 324, Extract a shared predicate (e.g., isMdCanvasOrBaseExtension) that encapsulates the triple-regex test currently duplicated in resolveCaptureTarget and normalizeCaptureFilePath; have the helper accept the normalized path and return boolean by testing against MARKDOWN_FILE_EXTENSION_REGEX, CANVAS_FILE_EXTENSION_REGEX and BASE_FILE_EXTENSION_REGEX in one place. Replace the inline tests in resolveCaptureTarget and normalizeCaptureFilePath with calls to this predicate, and update the regex constants or the helper to use case-insensitive matching (or to lower-case the input) so behavior aligns with basenameWithoutMdOrCanvas in src/utils/pathUtils.ts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/engine/CaptureChoiceEngine.ts`:
- Around line 473-475: The helper function basenameWithoutMdOrCanvas now strips
.base as well, so rename the function to a more accurate name (e.g.,
basenameWithoutExtension or fileBasename) and update all usages: rename the
function declaration in the util module (basenameWithoutMdOrCanvas ->
basenameWithoutExtension), update the import and call in CaptureChoiceEngine
(the fileBasename assignment that calls basenameWithoutMdOrCanvas), and adjust
any other references/tests to the new identifier to keep names consistent with
behavior.
- Around line 318-324: Extract a shared predicate (e.g.,
isMdCanvasOrBaseExtension) that encapsulates the triple-regex test currently
duplicated in resolveCaptureTarget and normalizeCaptureFilePath; have the helper
accept the normalized path and return boolean by testing against
MARKDOWN_FILE_EXTENSION_REGEX, CANVAS_FILE_EXTENSION_REGEX and
BASE_FILE_EXTENSION_REGEX in one place. Replace the inline tests in
resolveCaptureTarget and normalizeCaptureFilePath with calls to this predicate,
and update the regex constants or the helper to use case-insensitive matching
(or to lower-case the input) so behavior aligns with basenameWithoutMdOrCanvas
in src/utils/pathUtils.ts.
Summary
.basetemplate support for Template choices (creation, overwrite, increment, and path normalization).md/.canvas).basewith a clear abort message directing users to Template choices.base.basetemplate into the active markdown fileIssue
Testing
bun run testbun run build-with-lint.basetemplate creates.baseoutputcaptureTo: *.baseis blocked withMacroAbortErrorand guidance message{{TEMPLATE:...base}}inserts resolved.basecontent into an active.mdnoteobsidian vault=dev dev:errorsreported no errorsSummary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests