Conversation
Review Summary by QodoAdd memo field for internal use only
WalkthroughsDescription• Add memo field to CustomInfo interface for internal use • Exclude memo from frontend output in data generation • Filter custom info to only include tags and review fields • Update YAML schema to support memo field in configuration Diagramflowchart LR
A["CustomInfo Interface"] -->|"add memo field"| B["Updated Type Definition"]
C["custom_info.yaml"] -->|"include memo data"| D["YAML Configuration"]
E["mergeBibliography Function"] -->|"filter memo out"| F["Frontend Output"]
B --> E
D --> E
File Changes1. web/src/lib/types.ts
|
📝 WalkthroughWalkthroughAdds internal-only Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 kotetsu with
|
| Latest commit: |
357778e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://713254f3.kotetsu.pages.dev |
| Branch Preview URL: | https://issue-22-memo-field.kotetsu.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@web/scripts/generate-data.ts`:
- Around line 68-80: The current mapping in entries.map uses
customInfo.get(entry.id) and returns customInfo: info ? { tags: info.tags,
review: info.review } : undefined, which yields an empty {} when info only
contains memo; change the logic to build a small result object (e.g., start
empty, conditionally assign tags and review from info) and only assign
customInfo when that result has at least one key (e.g.,
Object.keys(result).length > 0), otherwise leave customInfo undefined; update
the block around customInfo creation inside the entries.map callback (where
customInfo: info ? ... is currently set) to implement this conditional assembly.
🧹 Nitpick comments (1)
web/src/lib/types.ts (1)
19-23:CustomInfoincludesmemobut it's stripped before frontend output.The
memofield is defined here as optional, yetgenerate-data.tsintentionally excludes it from the emitted JSON. This means the frontendCustomInfotype advertises a property that will never be present at runtime. Consider either removingmemofrom this interface (keeping it only onCustomInfoYaml) or introducing a separate backend-only type to avoid misleading consumers.
Code Review by Qodo
✅ 1.
|
| return entries.map((entry) => { | ||
| const info = customInfo.get(entry.id); | ||
| return { | ||
| ...entry, | ||
| customInfo: info | ||
| ? { | ||
| tags: info.tags, | ||
| review: info.review | ||
| // memo is intentionally excluded from frontend output | ||
| } | ||
| : undefined | ||
| }; |
There was a problem hiding this comment.
1. Memo silently discarded 🐞 Bug ✓ Correctness
• memo is added to YAML and shared types, but the YAML parser never reads/validates it, so the
value is silently dropped (cannot be used even internally).
• Because the generator emits customInfo when a Map entry exists (even if tags/review are
undefined), an entry that only has memo will serialize to customInfo: {} and still trip the UI’s
{#if item.customInfo} block, rendering an empty “Custom Info” section.
• This becomes more likely now that memo is an encouraged field in the YAML.
Agent Prompt
## Issue description
The PR introduces a `memo` field in `contents/custom_info.yaml` and adds it to shared TS interfaces, but the YAML parsing logic never reads `memo`, so it is silently discarded. Additionally, the build script may still emit an empty-but-truthy `customInfo` object (e.g., when an entry has only `memo`), which triggers an empty “Custom Info” section in the UI.
## Issue Context
- `memo` is intended to be internal-only, not shown on the frontend.
- Today, `parseCustomInfo()` only validates/returns `tags` and `review`.
- The frontend renders a section whenever `item.customInfo` is truthy.
## Fix Focus Areas
- web/src/lib/parsers/yaml.ts[48-62]
- web/scripts/generate-data.ts[63-80]
- web/src/routes/+page.svelte[262-287]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/routes/+page.svelte (1)
284-289:⚠️ Potential issue | 🟠 MajorReview display doesn't handle array form.
The search logic (lines 62-64) correctly normalizes
reviewwhen it's an array, but the display here renders{item.customInfo.review}directly. Whenreviewis astring[], Svelte will call.toString(), producing comma-separated text instead of properly formatted paragraphs.Proposed fix
{`#if` item.customInfo.review} <blockquote class="border-l-2 border-amber-500/50 pl-4 text-slate-300 leading-relaxed italic" > - {item.customInfo.review} + {Array.isArray(item.customInfo.review) + ? item.customInfo.review.join('\n') + : item.customInfo.review} </blockquote> {/if}Alternatively, render each array element as a separate
<p>for better readability.
🤖 Fix all issues with AI agents
In `@contents/custom_info.yaml`:
- Line 19: The line ending with a trailing full-width space (the string ending
"...この生成の循環は身体のおかげで回っている。 ") should have the trailing U+3000 removed; locate
that exact sentence in contents/custom_info.yaml and delete the final full-width
space so the line ends with "この生成の循環は身体のおかげで回っている。" without the extra
whitespace.
In `@contents/references.bib`:
- Line 21: Fix the typo in the BibTeX entry by renaming the field key "aurhor"
to the correct "author" so parsers recognize the author data; locate the entry
containing aurhor={森田,真生} and change it to author={森田,真生}.
In `@web/src/lib/parsers/yaml.ts`:
- Around line 71-76: The code stores parsed fields in result.set(entryId, {...})
but incorrectly narrows review to string | undefined; update the type assertion
so review is typed as string | string[] | undefined (matching the earlier
validation that allows string | string[] | undefined) to avoid dropping the
array variant—adjust the review cast where result.set is called (and similarly
verify tags/memo/readDate assertions) so TypeScript preserves the possible
string[] type.
🧹 Nitpick comments (1)
docs/adr/0006-automatic-hugo-blog-content-generation.md (1)
1-437: Thorough ADR with good alternatives analysis.Minor note: the Next.js reference link (line 427) points to Pages Router
getStaticPropsdocumentation, which is the legacy pattern. The App Router usesgenerateStaticParamsand server components instead. Consider updating if targeting modern Next.js.
| review: | ||
| - 進化電子工学の研究で、離れ小島的に残った論理ブロックの話が印象に残った。引用の文脈とは異なるが、現実世界には予め論理では想定しきれない複雑性がいくらでもあることがわかる。 | ||
| - 心を作ろうとしたチューリングと、心になって難問を解いた岡の対比に、西洋と東洋の感性の違いを思った。 | ||
| - 「生成」というキーワードが、2026年に読むと改めて意識される。自分が作ったものを眺めると、それに対して改善したい点が見つかる。これも生成の一種だろう。この生成の循環は身体のおかげで回っている。 |
There was a problem hiding this comment.
Trailing full-width space (U+3000) at end of line.
This line ends with a Japanese full-width space character ( ). This is likely unintentional and could appear in rendered output.
🤖 Prompt for AI Agents
In `@contents/custom_info.yaml` at line 19, The line ending with a trailing
full-width space (the string ending "...この生成の循環は身体のおかげで回っている。 ") should have the
trailing U+3000 removed; locate that exact sentence in contents/custom_info.yaml
and delete the final full-width space so the line ends with
"この生成の循環は身体のおかげで回っている。" without the extra whitespace.
contents/references.bib
Outdated
| } | ||
| @book{morita-2015-suugakusuru-karada, | ||
| title={数学する身体}, | ||
| aurhor={森田,真生}, |
There was a problem hiding this comment.
Typo: aurhor should be author.
This will cause BibTeX parsers to silently skip the author field, resulting in missing author data for this entry.
Proposed fix
- aurhor={森田,真生},
+ author={森田,真生},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| aurhor={森田,真生}, | |
| author={森田,真生}, |
🤖 Prompt for AI Agents
In `@contents/references.bib` at line 21, Fix the typo in the BibTeX entry by
renaming the field key "aurhor" to the correct "author" so parsers recognize the
author data; locate the entry containing aurhor={森田,真生} and change it to
author={森田,真生}.
| result.set(entryId, { | ||
| tags: tags as string[] | undefined, | ||
| review: review as string | undefined | ||
| review: review as string | undefined, | ||
| memo: memo as string[] | undefined, | ||
| readDate: readDate as string | undefined | ||
| }); |
There was a problem hiding this comment.
Incorrect type assertion for review — drops string[] variant.
The validation (lines 56-59) correctly accepts string | string[] | undefined, but the assertion on line 73 casts to string | undefined, silently discarding the array case at the type level. At runtime the array is still there, but TypeScript won't flag incorrect usage downstream.
Proposed fix
result.set(entryId, {
tags: tags as string[] | undefined,
- review: review as string | undefined,
+ review: review as string | string[] | undefined,
memo: memo as string[] | undefined,
readDate: readDate as string | undefined
});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| result.set(entryId, { | |
| tags: tags as string[] | undefined, | |
| review: review as string | undefined | |
| review: review as string | undefined, | |
| memo: memo as string[] | undefined, | |
| readDate: readDate as string | undefined | |
| }); | |
| result.set(entryId, { | |
| tags: tags as string[] | undefined, | |
| review: review as string | string[] | undefined, | |
| memo: memo as string[] | undefined, | |
| readDate: readDate as string | undefined | |
| }); |
🤖 Prompt for AI Agents
In `@web/src/lib/parsers/yaml.ts` around lines 71 - 76, The code stores parsed
fields in result.set(entryId, {...}) but incorrectly narrows review to string |
undefined; update the type assertion so review is typed as string | string[] |
undefined (matching the earlier validation that allows string | string[] |
undefined) to avoid dropping the array variant—adjust the review cast where
result.set is called (and similarly verify tags/memo/readDate assertions) so
TypeScript preserves the possible string[] type.
eebe419 to
357778e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/adr/0006-automatic-hugo-blog-content-generation.md`:
- Around line 122-128: Replace deprecated getJSON usage in the Hugo template
with resources.GetRemote and transform.Unmarshal: construct the URL (using
.Site.Params.siteId), call resources.GetRemote inside try to capture errors,
check .Err and call errorf if present, then pass .Value through
transform.Unmarshal to obtain the JSON array and iterate over it (the original
range over . should become a range over the unmarshaled data). Update the
examples at the shown template blocks (the getJSON call and subsequent range) to
this pattern, ensuring to reference resources.GetRemote, try, .Err, .Value and
transform.Unmarshal.
🧹 Nitpick comments (1)
docs/adr/0006-automatic-hugo-blog-content-generation.md (1)
1-1: Filename doesn't match the ADR title.The file is named
0006-automatic-hugo-blog-content-generation.mdbut the ADR title is "Multi-Site Bibliography Content Distribution". Since the decision moved away from a Hugo-specific approach to a generic API integration, consider renaming the file to match (e.g.,0006-multi-site-bibliography-content-distribution.md).
| ```hugo | ||
| {{- with getJSON (printf "https://kotetsu.rindrics.com/api/bibliography?siteId=%s" .Site.Params.siteId) }} | ||
| {{- range . }} | ||
| Create post from {{ .title }}... | ||
| {{- end }} | ||
| {{- end }} | ||
| ``` |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Hugo getJSON deprecated v0.123.0 resources.GetRemote
💡 Result:
In Hugo v0.123.0, the template function data.GetJSON (alias getJSON) was deprecated. The docs recommend replacing it with transform.Unmarshal used with a global/page resource or a remote resource. (gohugo.io)
Replace getJSON (remote URL) with resources.GetRemote + transform.Unmarshal
{{ $url := "https://example.org/books.json" }}
{{ $data := dict }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else with .Value }}
{{ $data = . | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ end }}
If the server sends an incorrect Content-Type, unmarshal the body explicitly:
{{ $data = .Content | transform.Unmarshal }}
``` ([gohugo.io](https://gohugo.io/functions/resources/getremote/?utm_source=openai))
## Replace `getJSON` (local file) with `resources.Get` + `transform.Unmarshal`
Put JSON under `assets/` (or a directory mounted to `assets/`), then:
```go-html-template
{{ $path := "data/books.json" }}
{{ with resources.Get $path }}
{{ $data := . | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get global resource %q" $path }}
{{ end }}
``` ([gohugo.io](https://gohugo.io/functions/resources/get/?utm_source=openai))
(If you’re seeing deprecation logs, note Hugo only prints these warnings under verbose/info logging in many setups.) ([discourse.gohugo.io](https://discourse.gohugo.io/t/deprecation-warning-for-unused-data-getjson/50745?utm_source=openai))
Citations:
- 1: https://gohugo.io/functions/data/getjson/?utm_source=openai
- 2: https://gohugo.io/functions/resources/getremote/?utm_source=openai
- 3: https://gohugo.io/functions/resources/get/?utm_source=openai
- 4: https://discourse.gohugo.io/t/deprecation-warning-for-unused-data-getjson/50745?utm_source=openai
---
🏁 Script executed:
```shell
# Check the file to see if there's content at line 243
wc -l docs/adr/0006-automatic-hugo-blog-content-generation.md
Repository: Rindrics/kotetsu
Length of output: 119
🏁 Script executed:
# Check the specific lines mentioned in the review
sed -n '120,130p' docs/adr/0006-automatic-hugo-blog-content-generation.md
echo "---"
sed -n '240,250p' docs/adr/0006-automatic-hugo-blog-content-generation.mdRepository: Rindrics/kotetsu
Length of output: 549
Update deprecated getJSON to resources.GetRemote + transform.Unmarshal.
Hugo deprecated getJSON starting in v0.123.0. The examples at lines 122–128 and line 240 should use resources.GetRemote with transform.Unmarshal and proper error handling instead:
Recommended pattern for remote JSON
{{ $url := "https://kotetsu.rindrics.com/api/bibliography?siteId=" | printf "%s%s" .Site.Params.siteId }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else with .Value }}
{{ $data := . | transform.Unmarshal }}
{{- range $data }}
Create post from {{ .title }}...
{{- end }}
{{ end }}
{{ end }}
🤖 Prompt for AI Agents
In `@docs/adr/0006-automatic-hugo-blog-content-generation.md` around lines 122 -
128, Replace deprecated getJSON usage in the Hugo template with
resources.GetRemote and transform.Unmarshal: construct the URL (using
.Site.Params.siteId), call resources.GetRemote inside try to capture errors,
check .Err and call errorf if present, then pass .Value through
transform.Unmarshal to obtain the JSON array and iterate over it (the original
range over . should become a range over the unmarshaled data). Update the
examples at the shown template blocks (the getJSON call and subsequent range) to
this pattern, ensuring to reference resources.GetRemote, try, .Err, .Value and
transform.Unmarshal.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores