Skip to content

feat: implement phases 1-3 (config, content, data, cascade, permalink, collection, template, output, assets)#3

Merged
zeroedin merged 13 commits into
mainfrom
feature/phases-1-3-implementation
Apr 12, 2026
Merged

feat: implement phases 1-3 (config, content, data, cascade, permalink, collection, template, output, assets)#3
zeroedin merged 13 commits into
mainfrom
feature/phases-1-3-implementation

Conversation

@zeroedin

Copy link
Copy Markdown
Owner

Summary

  • Phase 1 (Config & Content): YAML/TOML/JSON config loading, front matter parsing, Goldmark markdown rendering with template tag preservation, lifecycle filtering (draft/publishDate/expiryDate), page bundle discovery
  • Phase 2 (Data & Cascade): Data file loading (YAML/JSON/CSV), 5-level data cascade with deep merge and array replacement semantics
  • Phase 3 (Permalink, Collection, Template, Output, Assets): Permalink token resolution with section-based lookup, collection building with date-based sorting, taxonomy system with slug collision detection, template context/filters/shortcodes/layout resolution, file output with pretty URLs/sitemap/feeds/formats, asset copying with hook processing

Test results

Package Status
config ✅ pass
content ✅ pass
data ✅ pass
cascade ✅ pass
permalink ✅ pass
collection ✅ pass
template ⚠️ 108/120 pass (12 fail: GoEngine stub, liquid includes/compat — phases 4A/4B)
output ✅ pass
assets ✅ pass
cache ✅ pass
pagination ✅ pass
validation ✅ pass

Remaining failures are in unimplemented phases (4-7): liquid engine rewrite, Go template engine, static, pipeline, plugin, fetch, i18n, server, ssr, cmd, integration.

Test plan

  • go test ./internal/config/... — all pass
  • go test ./internal/content/... — all pass
  • go test ./internal/data/... — all pass
  • go test ./internal/cascade/... — all pass
  • go test ./internal/permalink/... — all pass
  • go test ./internal/collection/... — all pass
  • go test ./internal/output/... — all pass
  • go test ./internal/assets/... — all pass
  • go vet ./... — clean

🤖 Generated with Claude Code

zeroedin and others added 13 commits April 11, 2026 23:28
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add goldmark for Markdown rendering, Notifuse/liquidgo for Liquid
templates, and ginkgo/gomega for BDD testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parse site configuration from alloy.yaml, alloy.toml, or alloy.json
with auto-detection. Supports nested key access via GetString, GetBool,
GetMap, and section permalink config extraction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… lifecycle filtering

- YAML/TOML/JSON front matter parsing with delimiter detection
- Goldmark markdown rendering with tables, task lists, footnotes, typographer
- Template tag preservation through markdown via placeholder substitution
- Draft/publishDate/expiryDate lifecycle filtering with dev mode awareness
- Page bundle discovery with co-located asset detection
- .txt file support (graceful fallback without front matter delimiters)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Load data files from the _data directory with support for YAML, JSON,
and CSV formats. Files are keyed by filename without extension.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Build cascade context with Global > Directory > FrontMatter > Computed >
PluginData priority. Deep merge with array replacement semantics and
pointer sharing between levels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve permalink patterns with :year, :month, :day, :slug, :section,
:filename, :title tokens. Support front matter overrides, section-specific
patterns, and file path defaults with pretty URLs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Build collections from date-based permalink sections with draft exclusion
- Sort by date descending with dateless-after-dated ordering
- Arbitrary front matter field sorting with numeric-aware comparison
- Freeze/thaw collections to prevent modification
- Taxonomy term grouping, page generation, and context building
- Duplicate slug detection with prefix collision awareness

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…layout resolution

- Template context assembly with site/page/collection data
- 40+ Liquid-compatible filters (date, string, array, math, URL)
- Shortcode system with inline and block shortcode regex expansion
- Filesystem-aware layout resolution with priority fallback chain
- Circular layout detection via parent reference scanning
- Cascade-aware layout resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Pretty URL output path computation (/about/ -> about/index.html)
- Output directory cleaning and conditional writes
- XML sitemap generation with per-page exclusion support
- Feed template discovery by filesystem layout convention
- Output format resolution with format-specific layout lookup
- Alias output path writing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verbatim asset copy from source to output directory. ProcessAssets
walks files through a hook function for transformation. ResolveURL
joins paths with the site base URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- In-memory content cache with invalidation
- Pagination calculation with page count and offset logic
- URL conflict detection across pages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zeroedin
zeroedin merged commit 7357119 into main Apr 12, 2026
zeroedin added a commit that referenced this pull request Apr 25, 2026
Reviewer items:
- Use MarkdownOptions.Hooks field instead of separate function (#1)
- Tests use []byte(input) matching RenderMarkdown signature (#2)
- Heading ID uses slugify: "My Section" → "my-section" (#3)
- Protocol-relative URLs intentionally not external for v1 (#4)
- Render hooks follow engine choice (Liquid vs Go templates) (#5)
- Add blockquote and table tests (#6)

Copilot items:
- Clarify Alloy registers renderers, not goldmark auto-detecting
- Add template tag escaping note for custom hook output structures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Apr 25, 2026
Reviewer items:
- Third duplicate heading test (overview, overview-1, overview-2) (#3)
- Pipeline test: page.toc accessible in layout templates (#4)
- Config path: content.markdown.toc instead of content.toc

Copilot items:
- Config path consistency with existing content.markdown.goldmark.*

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Jul 24, 2026
P1 #1: Fix duplicate step 19 in PLAN.md pipeline stages — renumber
steps 20-25 after inserting onFormatRendered at step 19. Update hook
table step numbers (onAssetProcess 22+, onBuildComplete 25).

P1 #2: Add content mutation write-back assertion to single non-HTML
page test — verifies page.SetRenderedBody path is wired, not just
FormatBodies.

P2 #3: Fix test count 12 → 14 in IMPLEMENTATION.md (was 13, now 14
with new test).

P2 #4: Add test for HTML in non-first position of outputs array
(outputs: ["json", "html"]) — catches page.Outputs[0] == "html"
implementations.

P2 #5: Add second plugin to read-only fields test that verifies
frontMatter immutability end-to-end — throws if first plugin's
frontMatter mutation was applied back.

P3 #6: Add BuildIncremental parity note for onFormatRendered in both
PLAN.md and IMPLEMENTATION.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Jul 24, 2026
- Fix test count 8→9 in IMPLEMENTATION.md (#1)
- Pick single outbound approach: GetOwnPropertyNames + property walk (#2)
- Use extractGoMap helper in first test instead of inline logic (#3)
- Inline toOrderedMap into extractGoMap (#4)
- Extract buildBenchHTML helper to deduplicate benchmark HTML construction (#5)
- Add path assertion to HookTransformPayload test (#11)
- Add toc outbound verification to HookTransformPayload result (#12)
- Add url, path, frontMatter assertions to identity return test (#13)
- Fix 800KB benchmark: reduce to 4300 iterations for ~800KB actual size (#14)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Jul 25, 2026
- P1 #6: Updated summary table (Phase 5: ~129, cumulative downstream)
- P2 #1: Added multi-byte character table entry (CJK, emoji) —
  validates X-Body-Length is byte count not rune count
- P2 #7: Added \r\n suffix to X-Body-Length assertion to prevent
  decimal-prefix false match (50 matching 500)
- P3 #2: Use parsed headers map from parseSplitFrame, assert
  header value matches actual raw body byte count
- P3 #3: Added empty split field test — falls back to single-header
- P3 #4: Added dual-key map priority test — html over content
- P3 #5: Added caller map immutability guard test

12 total tests (was 8). Test counts updated in IMPLEMENTATION.md
(section header, node.go description, impl guidance, summary table).
PLAN.md updated with empty-field fallback, dual-key priority, and
map immutability constraints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Jul 25, 2026
P2 #1: Hoist setupQuickJSWithHook to outer Describe scope, remove
duplicate setupQuickJSWithHookFor1186. Both #1180 and #1186 sections
now share the same helper.

P2 #2: Extract checkGlobalIsFunction closure — three existence tests
are now one-liners calling the shared helper.

P2 #3: Add *qjs.Value lifetime note to IMPLEMENTATION.md — stored
function references must be Free()d in Close() before context teardown.

P2 #4: Add lazy FM test for HookFormatRenderedPayload (onFormatRendered)
to verify setPayloadFrontMatter is wired consistently across all three
payload types.

P2 #9 (addendum): Fix null sentinel collision in __installLazyFM and
__installLazyTOC JS snippets — use unique sentinel object instead of
null so page.frontMatter = null sticks. Add corresponding test.

P3 #5: Add configurable: true test for lazy frontMatter property.

P3 #6: Add lazy TOC setter test for parity with frontMatter setter.

P3 #7: Add no-globals disambiguation test — verifies invokeHookFastPath
uses ctx.Invoke (no __callInput/__callHookName globals) vs ctx.Eval.

Test count: 9 → 14 (7 RED, 7 GREEN).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Jul 25, 2026
- P1 #1: Fix hook chain misrouting onContentTransformed payloads — check
  for toc key alongside html to disambiguate payloadTransform vs
  payloadRendered, preventing silent TOC data loss in multi-hook chains
- P1 #2: Log marshal errors in lazy __resolveFM/__resolveTOC callbacks
  instead of silently returning empty object/undefined
- P2 #3: Use NewFloat64 for int values in callHookMapPayload to avoid
  int32 narrowing truncation on timestamps and large counts
- P2 #4: Wire up SetRenderedHTML at 3 hook apply-back call sites in
  hooks.go (onContentTransformed html/string, onPageRendered html)
- P2 #5: Log warning on marshal failure in callHookMapPayload default
  case instead of silent continue
- P2 #6: Document thread-safety assumption on convertedFrontMatter
  in-place mutation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Jul 25, 2026
- Clear pendingFM/pendingTOC after invokeHookFastPath returns (P1 #1,
  IMPLEMENTATION.md step 6)
- Add log.Printf warning on marshal error paths in __resolveFM/__resolveTOC
  callbacks (P2 #2)
- Type pendingTOC as []content.TOCEntry instead of interface{} (P2 #3)
- Add enumerable: true to all lazy getter descriptors so frontMatter/toc
  remain visible to Object.keys, spread, and JSON.stringify

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeroedin added a commit that referenced this pull request Jul 25, 2026
P1 #1: Update stale test count at IMPLEMENTATION.md:760 from "5 spec
tests" to "6 spec tests", append "SetRenderedBody-after-SetRenderedHTML
cache invalidation" to enumerated list.

P2 #2: Align issue tag at IMPLEMENTATION.md:759 — changed
"(issue #1185)" to "(issues #1185, #1189)" since #1185 introduced
the method and #1189 added the cache invalidation test.

P3 #3: Trim verbose block comment to one-line separator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant