Commit Graph

2 Commits

Author SHA1 Message Date
Paolo Mottadelli 1ab6833f1e fix(stardust): make migrate output genuinely zip-and-deploy portable (#133)
* fix(stardust): make migrate output genuinely zip-and-deploy portable

The 0.7.0 contract claimed "self-contained, zip-and-deploy" but
emitted root-absolute paths (/assets/..., /beers/) plus
directory-only nav links. Those work on a webserver at the host
root only — they 404 on file:// and at any subpath. This PR
delivers what the claim promised:

- Output path is URL-literal: /beers/ -> beers/index.html,
  /about-us/history.html -> about-us/history.html. No more
  synthesizing /about/index.html from a slug.
- Page map (state.json.migrate.pageMap[]) built once per run;
  per-page rendering and internal-link rewriting both consume it.
- Reference shape is depth-aware relative: prefix is ./ for
  depth-0 pages, ../ * depth otherwise. Works on file://, at
  host root, and at any subpath without rewriting.
- Phase 3 broadens the self-containment check into a full
  portability audit: refuses absolute internal refs, refuses
  directory-only nav, runs the new pageMap + file:// fixtures.
- New fixtures: file-protocol-audit.mjs (Playwright file://
  round-trip) and pagemap-audit.mjs (static pageMap consistency).
- asset-bundling.md and migrate-output-format.md aligned to the
  new depth-aware-relative shape; state.json contract gains
  pageMap[].

Plugin bumped 0.7.0 -> 0.7.1.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* review: fix four flagged correctness issues

- Directory-only-nav regex now catches `./beers/` (the cited example).
  Old pattern required a-z as first char; `./beers/` starts with `.`
  and would have slipped through. New pattern accepts ./, ../, /, or a
  bare segment, and excludes scheme-bearing URLs (no false positive
  on https://google.com/).
- Add a second grep for absolute url() references inside inline style
  attrs and <style> blocks (and CSS files); the original href/src grep
  missed these.
- SKILL.md Outputs row no longer claims the sidecar lives at
  <source-url-path>/_meta.json (nonsense for .html-leaf pages).
  Replaced with a row that points at the canonical sidecar rule.
- migration-procedure.md § Page map now explicitly says same-origin
  absolute URLs are stripped to their path portion before pageMap
  lookup (per content-preservation.md § Internal link rewriting),
  closing the loophole that would let <a href="https://origin/foo/">
  pass through verbatim.

Regex patterns verified against a test fixture before commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* review: update migrate-self-contained-bundle eval to 0.7.1 contract

The eval was pinned to 0.7.0's root-relative /assets/<subpath>
shape. This PR's contract change to depth-aware relative paths
would have made the eval fail against correct 0.7.1 output.

- detection_src_href criterion now asserts <prefix>assets/<subpath>
  (not /assets/<subpath>).
- Renamed prefix_resolution_root_relative -> prefix_normalises_authoring;
  description flipped from "reference is left as-is" to "authoring
  is normalised to the depth-aware emit form".
- Added 4 new criteria: depth_aware_paths (6pts),
  pagemap_constructed (6pts), internal_links_via_pagemap (5pts),
  portability_audit_passes (13pts).
- Setup uses real source URLs that exercise the URL-literal rule:
  /, /beers/, /about/history.html (preserve .html leaf),
  /docs/api/ (depth-2 nested).
- Prototype HTML now carries internal nav in three authoring styles
  (root-absolute, same-origin absolute, directory-only) plus a
  broken-link case, exercising the page map rewrite.
- Run 1 expected behavior rewritten to expect depth-aware emission
  ('./assets/...'), pageMap built before render, broken-link
  flagging, and the 6-step portability audit passing.
- Run 4 (cross-page dedup) updated so the second page emits its
  shared asset with its own '../' prefix while the underlying file
  on disk is a single copy.
- Weights re-balanced to sum to 100; portability_audit_passes gets
  the largest weight (13pts) since it backs the contract claim.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 03:29:23 -07:00
Paolo Mottadelli 27dd06341c feat(stardust): migrate produces self-contained zip-and-deploy bundle (#132)
* feat(stardust): migrate produces self-contained zip-and-deploy bundle

Bundles every referenced asset into stardust/migrated/assets/ and
rewrites HTML/CSS references to root-relative /assets/<subpath> so
the migrated tree is fully self-contained. Adds asset-bundling
reference (six detection shapes, nine edge cases), output-format
contract with state.json.migrate block (selfContained: true),
--clean and --pin-timestamp flags, and an eval covering the six
acceptance criteria.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* review: fix count, --clean correctness, document asset-missing rename

- Bump totalAssetsBundled 6 → 7 in eval task.md (matched bundledAssets[] length).
- --clean now implies --force so the bundledAssets Set is the complete
  union across every page; idempotent-skipped pages' assets are no
  longer at risk of being deleted as stale. Updated SKILL.md flag
  description, asset-bundling.md § Stale asset cleanup, the
  Idempotent-skip interaction note, and the eval's run-3 expected
  behaviour + criterion.
- Document the contentDeviations / migrationDecisions kind rename
  from "media-missing" to "asset-missing" in
  migrate-output-format.md § Backwards compatibility — consumers
  should accept either string until they migrate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(stardust): bump plugin version 0.6.0 → 0.7.0

Self-contained zip-and-deploy bundle is a minor-version addition:
new --clean and --pin-timestamp flags, new state.json migrate
block (forward-compat), new asset-bundling reference contract,
provenance kind rename (media-missing → asset-missing).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(stardust): bump palette library version v0.6.0 → v0.7.0

Keep the palette library version aligned with the plugin version.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 12:32:30 -07:00