Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f75be4309
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
main.go
Outdated
| filename := fmt.Sprintf("%s-%s.md", currentTime.Format("2006-01-02"), templateName) | ||
| path := filepath.Join(mustGetwd(), filename) | ||
| if err := os.WriteFile(path, []byte(rendered), 0o600); err != nil { | ||
| return err |
There was a problem hiding this comment.
Avoid overwriting existing notes on same day
The filename is always YYYY-MM-DD-<template>.md and os.WriteFile truncates existing files, so running jot new --template meeting (or any template) more than once in the same day silently overwrites the previous note. This can cause user data loss for templates intended to be used multiple times per day. Consider checking for an existing file and erroring, or add a uniqueness suffix (time or counter).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Switched template note creation to exclusive file creation and emit a clear error when a note already exists to prevent overwrites. main.goL171-L205
- Added a test ensuring
jot newrefuses to overwrite an existing note and preserves its contents. main_test.goL160-L198
Testing
- ✅
go test ./...
There was a problem hiding this comment.
@codex a users can have more than one meeting in a day so they might need to record each meeting notes in different templates etc, we need to add an option that allows the user to create a new jot with a template and they specify the name of the template for example jot new --template meeting -n "Team Sync-Up"
There was a problem hiding this comment.
Summary
- Added
-n/--namesupport forjot newto create slugged, named template notes and validated note names before file creation. main.goL160-L217 main.goL383-L404 - Added tests for named note creation and slugification behavior. main_test.goL200-L240
- Documented the new named-template usage in the README. README.mdL191-L216
Testing
- ✅
go test ./...
…mplates-with-rendering Add named template notes via -n/--name
… mamba/github-mention-add-note-templates-with-rendering
…mplates-with-rendering Include template notes in jot list output
Motivation
Description
jot new --template <name>to render a template and write a dated markdown file in the current directory andjot templatesto list available templates by name; implementation added inmain.go(jotNew,jotTemplates).daily,meeting,rfc), custom template discovery under the config templates dir (falling back to~/.jot/templates), template loading helpers (templateDir,loadTemplates,loadCustomTemplates,builtinTemplates) and rendering (renderTemplate), plus repository name detection (repoName).{{date}},{{time}},{{datetime}},{{repo}}) and custom template path inREADME.md.main_test.go.Testing
go test ./...and all tests passed.renderTemplateoutput, which succeeded.Codex Task