jekyll-theme-zer0 1.17.1 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50907837fd27d28fa1bea1cf163d7e2d71a4a848266c861656b8d8ebdb2e3d78
4
- data.tar.gz: e3853573f9cca38ec51ce145a8279aedf221035afac88cf9cfc77d220dee23e5
3
+ metadata.gz: 75211dc29d6baba87f5cc1264e9b3f47ecbff99d02cbe875f9b2290472c3bd09
4
+ data.tar.gz: 3fb6eb26ee2507c079ebc1f1c91db92687706a14607cba9685b95ff20ad0ffa8
5
5
  SHA512:
6
- metadata.gz: b1dcd28c12fd2c48e14463bf4e7db63ed3c024262ca3bc04ba98a9ce8b3b53affef695846681fee898584184a58790a86361e00940d89a0ecbe76e0dddb54496
7
- data.tar.gz: e28d9a6a97edefc45d7b772e363a1826b3a96e00de15e58e90be84cae1c7fa2ad23a24198769ea4f13cdbeac138cbf4f02fd75356d8066e8cb5c69ae9b40558a
6
+ metadata.gz: f7b6b73449bbc1efbea5243b4fc65e3b470b7c260c6e853f1729559d2a8402d0f3070e684cf3d9277d1ccee2b077022c32142c9de8a2b922825415d2cde46534
7
+ data.tar.gz: 012f8d69f7c6305f7d9901292ba57ae2d0884f9ffb162e10836efb739cf17546b709de109d86b05fdfa6929f89c1e84398f6e4a61bb6c7552a7e574de7f9d627
data/CHANGELOG.md CHANGED
@@ -5,6 +5,57 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.18.1] - 2026-06-14
9
+
10
+ ### Changed
11
+ - Version bump: patch release
12
+
13
+ ### Commits in this release
14
+ - ae76a61f fix(content-review): correct code-fence detection (closing fences + {% raw %}) (#155)
15
+ - f00fb654 docs(seo): strengthen SEO docs index metadata + fix agent-tier workflow (#154)
16
+
17
+ ### Fixed
18
+ - **content-review: closing code fences no longer counted as "missing language"**.
19
+ `scripts/content-review.rb` flagged every bare ```` ``` ```` line, including the
20
+ *closing* fence of a properly tagged block, which double-counted and could tank
21
+ a file's score (e.g. `pages/_about/features/jekyll.md` scored 0/100 almost
22
+ entirely from this false positive). The check now tracks fence open/close state
23
+ and only validates opening fences.
24
+ - **content-review: ignore Liquid `{% raw %}` blocks** in the quality and style
25
+ checks. Code fences, headings, images, and terminology inside `{% raw %}…
26
+ {% endraw %}` are literal display examples, not page structure, and were being
27
+ counted as real findings.
28
+
29
+ ## [1.18.0] - 2026-06-13
30
+
31
+ ### Changed
32
+ - Version bump: minor release
33
+
34
+ ### Commits in this release
35
+ - e7c8e33c feat(content-review): AI content reviewer framework with Claude Code agent (#153)
36
+ - c78433f1 fix(content): render mermaid on 12 pages, restore Obsidian graph, migration tests (T-019) (#150)
37
+
38
+ ### Added
39
+ - **AI content reviewer framework**: a two-tier reviewer that runs on every PR
40
+ touching `pages/**/*.md` and integrates with Claude Code agents to ensure SEO
41
+ is met and content is consistent, polished, and styled to the collection's
42
+ guidelines.
43
+ - **Deterministic tier** — `scripts/content-review.rb` (Ruby, stdlib-only, no
44
+ API key, works on fork PRs) scores each file 0–100 for front matter, SEO
45
+ (title/description length, keywords), structure (headings, code-fence
46
+ languages, image alt text, bare URLs), and terminology. Thresholds are
47
+ derived **per collection** (posts as articles, docs under the documentation
48
+ guidelines, notes/notebooks as short-form, etc.).
49
+ - **Claude Code agent tier** — `.claude/agents/content-reviewer.md` reviews
50
+ tone, clarity, consistency, accessibility, and technical accuracy, loading
51
+ each file's governing instruction files (baseline + collection-specific).
52
+ - **Automation** — `.github/workflows/ai-content-review.yml` posts the
53
+ deterministic summary as a sticky PR comment (always) and runs the Claude
54
+ Code agent when `ANTHROPIC_API_KEY` is configured.
55
+ - **Config & guidance** — `.github/config/content_review.yml` (per-collection
56
+ thresholds + assigned skills/prompts), `.github/instructions/content-review.instructions.md`,
57
+ the `/content-review` prompt + Cursor command, and the `content-review` skill.
58
+
8
59
  ## [1.17.1] - 2026-06-13
9
60
 
10
61
  ### Changed
@@ -14,6 +65,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
65
  - f2657b68 fix(a11y): resolve all navbar & site WCAG 2.1 AA violations (T-007) (#149)
15
66
  - 30d836cb fix(admin): sync config-page copy with live _config.yml and redact the Raw tab (T-018) (#148)
16
67
 
68
+ ### Added
69
+ - **Mermaid diagrams now render on 12 more pages**: pages with ```mermaid``` code fences but no `mermaid: true` front-matter flag (about, several feature/dev docs, all four quickstart guides) were showing raw code instead of diagrams — the flag gates the renderer include. Added the flag; verified all 34 diagrams across the site parse with valid Mermaid syntax and render to SVG in a browser
70
+ - **Obsidian graph view restored**: the `/docs/obsidian/graph/` page (roadmap v1.4 force-directed knowledge graph) had been deleted as a "stub" but its `full-graph.html` include, `obsidian-graph.js`, the docs index link, and 5 inbound wiki-links all still referenced it — a 404 to a shipped feature. Restored the page (it renders 161 nodes / 269 edges from the live wiki-index with zero console errors)
71
+ - **Migration & theme-version coverage (T-019)**: `scripts/test/lib/test_migrate.sh` (14 assertions for Jekyll-site detection, theme-connection classification, and version-gap logic) and `ThemeVersionGeneratorTest` in `test/test_plugins.rb` — the two largest remaining zero-coverage subsystems from the T-005 baseline
72
+
17
73
  ### Fixed
18
74
  - **Navbar & site accessibility (T-007)**: resolved all WCAG 2.1 AA violations that kept three axe-core audits frozen — dropped the redundant ARIA `menubar`/`menuitem` roles from the nav (the nav landmark already provides semantics; menubars require menuitem children the search/settings buttons weren't), added an `aria-label` to the site-subtitle home link, kept the admin/footer separator a list item, gave the theme-preview disabled tab a `role="tab"` and an icon-only button an `aria-label`, made code blocks a single keyboard-focusable scroll region, and underlined prose links so they're distinguishable without color. The three `test.fixme` blocks in `test/visual/accessibility.spec.js` are now live `test()` calls — verified 0 violations across the homepage, FAQ, and all 8 admin pages (23/23 a11y, 223/223 smoke tier)
19
75
 
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  title: zer0-mistakes
3
3
  sub-title: AI-Native Jekyll Theme
4
4
  description: AI-native Jekyll theme for GitHub Pages — Docker-first development, AI-powered installation, multi-agent integration (Copilot, Codex, Cursor, Claude), AI preview-image generation, and AIEO content optimization with Bootstrap 5.3.
5
- version: 1.17.1
5
+ version: 1.18.1
6
6
  layout: landing
7
7
  tags:
8
8
  - jekyll
@@ -20,7 +20,7 @@ categories:
20
20
  - bootstrap
21
21
  - ai-tooling
22
22
  created: 2024-02-10T23:51:11.480Z
23
- lastmod: 2026-06-13T04:17:52.000Z
23
+ lastmod: 2026-06-14T14:41:09.000Z
24
24
  draft: false
25
25
  permalink: /
26
26
  slug: zer0
@@ -911,7 +911,7 @@ git push origin feature/awesome-feature
911
911
 
912
912
  | Metric | Value |
913
913
  |--------|-------|
914
- | **Current Version** | 1.17.1 ([RubyGems](https://rubygems.org/gems/jekyll-theme-zer0), [CHANGELOG](/CHANGELOG)) |
914
+ | **Current Version** | 1.18.1 ([RubyGems](https://rubygems.org/gems/jekyll-theme-zer0), [CHANGELOG](/CHANGELOG)) |
915
915
  | **Documented Features** | 43 ([Feature Registry](https://github.com/bamr87/zer0-mistakes/blob/main/_data/features.yml)) |
916
916
  | **Setup Time** | 2-5 minutes ([install.sh benchmarks](https://github.com/bamr87/zer0-mistakes/blob/main/install.sh)) |
917
917
  | **Documentation Pages** | 70+ ([browse docs](https://zer0-mistakes.com/pages/)) |
@@ -966,6 +966,6 @@ And these AI partners that make zer0-mistakes truly AI-native:
966
966
 
967
967
  **Built with ❤️ — and a little help from our AI partners — for the Jekyll community**
968
968
 
969
- **v1.17.1** • [Changelog](CHANGELOG.md) • [License](LICENSE) • [Contributing](CONTRIBUTING.md) • [AI Agent Guide](AGENTS.md)
969
+ **v1.18.1** • [Changelog](CHANGELOG.md) • [License](LICENSE) • [Contributing](CONTRIBUTING.md) • [AI Agent Guide](AGENTS.md)
970
970
 
971
971
 
data/_data/backlog.yml CHANGED
@@ -56,7 +56,7 @@
56
56
  meta:
57
57
  title: "zer0-mistakes Backlog"
58
58
  updated: 2026-06-12
59
- next_id: 21
59
+ next_id: 22
60
60
 
61
61
  tasks:
62
62
  # --- Housekeeping (seeded so the loop has work on day one) ------------------
@@ -504,7 +504,7 @@ tasks:
504
504
 
505
505
  - id: T-019
506
506
  title: "Unit tests for migrate.sh and theme_version.rb (coverage rank #1)"
507
- status: open
507
+ status: done
508
508
  priority: P2
509
509
  area: tests
510
510
  risk: standard
@@ -516,13 +516,18 @@ tasks:
516
516
  detection, theme connection, admin-page install/verify, version-gap
517
517
  detection) plus _plugins/theme_version.rb (88 lines) as the largest
518
518
  remaining zero-coverage surface (353 lines).
519
+ Done 2026-06-13: scripts/test/lib/test_migrate.sh (14 assertions:
520
+ detect_jekyll_site, validate_theme_connection classification for
521
+ remote/gem/local, detect_version_gap min-version logic) and
522
+ ThemeVersionGeneratorTest in test_plugins.rb (remote/unknown-gem/none
523
+ branches, gem scan stubbed for determinism).
519
524
  acceptance:
520
525
  - "scripts/test/lib/test_migrate.sh exercises detect_jekyll_site, validate_theme_connection, and detect_version_gap against fixture directories."
521
526
  - "test/test_plugins.rb (or a sibling spec) covers theme_version.rb's version resolution."
522
527
  - "./scripts/bin/test stays green with the new specs included."
523
528
  links: { issue: null, pr: null, roadmap: "1.14" }
524
529
  created: 2026-06-12
525
- updated: 2026-06-12
530
+ updated: 2026-06-13
526
531
 
527
532
  - id: T-020
528
533
  title: "CI coverage for installer interactive wizard and upgrade path (coverage rank #2)"
@@ -545,3 +550,26 @@ tasks:
545
550
  links: { issue: null, pr: null, roadmap: "1.14" }
546
551
  created: 2026-06-12
547
552
  updated: 2026-06-12
553
+
554
+ - id: T-021
555
+ title: "Vendor cytoscape.js so the Obsidian graph works without a CDN"
556
+ status: open
557
+ priority: P3
558
+ area: feat
559
+ risk: standard
560
+ effort: S
561
+ source: audit
562
+ summary: >-
563
+ The Obsidian full-graph page (_includes/obsidian/full-graph.html) loads
564
+ cytoscape.js from cdn.jsdelivr.net — the only runtime CDN dependency left
565
+ in the theme, contradicting the vendored-assets principle (Bootstrap,
566
+ Icons, Mermaid are all under assets/vendor/). It also makes the graph
567
+ fail under strict CSP or offline. Vendor cytoscape@3.30.0 under
568
+ assets/vendor/ and reference it locally, matching the Mermaid pattern.
569
+ acceptance:
570
+ - "cytoscape.min.js committed under assets/vendor/ and referenced via a local path."
571
+ - "full-graph.html no longer references cdn.jsdelivr.net."
572
+ - "The graph page renders nodes/edges with the vendored file (no network)."
573
+ links: { issue: null, pr: null, roadmap: null }
574
+ created: 2026-06-13
575
+ updated: 2026-06-13
@@ -0,0 +1,470 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # =============================================================================
5
+ # content-review.rb
6
+ # =============================================================================
7
+ #
8
+ # Deterministic (no-API) tier of the AI content reviewer framework.
9
+ #
10
+ # Scores Jekyll content files for SEO and content quality using the thresholds
11
+ # in .github/config/content_review.yml and the required-field schema in
12
+ # .github/config/frontmatter_schema.yml. Designed to run anywhere — locally,
13
+ # in CI, and on fork PRs without secrets — so contributors get fast, mechanical
14
+ # feedback before (and independently of) the Claude Code agent tier.
15
+ #
16
+ # Usage:
17
+ # ruby scripts/content-review.rb --changed --base origin/main # diff vs base
18
+ # ruby scripts/content-review.rb --files "a.md b.md" # explicit files
19
+ # ruby scripts/content-review.rb --files a.md --json out.json --summary out.md
20
+ # ruby scripts/content-review.rb --changed --strict # non-zero on fail
21
+ #
22
+ # Options:
23
+ # --files LIST Space/newline-separated markdown files to review
24
+ # --changed Review files changed vs --base (git diff)
25
+ # --base REF Base git ref for --changed (default: origin/main)
26
+ # --config PATH content_review.yml (default: .github/config/content_review.yml)
27
+ # --schema PATH frontmatter_schema.yml (default: .github/config/frontmatter_schema.yml)
28
+ # --json PATH Write machine-readable JSON results
29
+ # --summary PATH Write a Markdown summary (suitable for a PR comment)
30
+ # --strict Exit non-zero if any file scores below the fail threshold
31
+ # --quiet Suppress the human-readable stdout table
32
+ # --help Show this help
33
+ #
34
+ # Exit codes:
35
+ # 0 clean (or warn mode)
36
+ # 1 one or more files below fail threshold (only when --strict)
37
+ # 2 invalid arguments / no files
38
+ # 3 config or parse error
39
+ #
40
+ # No gem dependencies beyond the Ruby stdlib.
41
+ # =============================================================================
42
+
43
+ require 'yaml'
44
+ require 'json'
45
+ require 'optparse'
46
+ require 'date'
47
+
48
+ # Content is UTF-8; force it so checks don't trip on emoji/accents under a
49
+ # US-ASCII locale (common on minimal CI runners).
50
+ Encoding.default_external = Encoding::UTF_8
51
+ Encoding.default_internal = Encoding::UTF_8
52
+
53
+ ROOT = File.expand_path('..', __dir__)
54
+
55
+ # --- Severity helpers --------------------------------------------------------
56
+ SEVERITIES = %w[error warning info].freeze
57
+
58
+ Issue = Struct.new(:severity, :category, :message)
59
+
60
+ # --- Options -----------------------------------------------------------------
61
+ options = {
62
+ files: nil,
63
+ changed: false,
64
+ base: ENV['CONTENT_REVIEW_BASE'] || 'origin/main',
65
+ config: File.join(ROOT, '.github', 'config', 'content_review.yml'),
66
+ schema: File.join(ROOT, '.github', 'config', 'frontmatter_schema.yml'),
67
+ json: nil,
68
+ summary: nil,
69
+ strict: false,
70
+ quiet: false
71
+ }
72
+
73
+ parser = OptionParser.new do |o|
74
+ o.banner = 'Usage: ruby scripts/content-review.rb [options]'
75
+ o.on('--files LIST', 'Files to review (space/newline separated)') { |v| options[:files] = v }
76
+ o.on('--changed', 'Review files changed vs --base') { options[:changed] = true }
77
+ o.on('--base REF', 'Base git ref for --changed') { |v| options[:base] = v }
78
+ o.on('--config PATH', 'content_review.yml path') { |v| options[:config] = v }
79
+ o.on('--schema PATH', 'frontmatter_schema.yml path') { |v| options[:schema] = v }
80
+ o.on('--json PATH', 'Write JSON results') { |v| options[:json] = v }
81
+ o.on('--summary PATH', 'Write Markdown summary') { |v| options[:summary] = v }
82
+ o.on('--strict', 'Exit non-zero on failing files') { options[:strict] = true }
83
+ o.on('--quiet', 'Suppress stdout table') { options[:quiet] = true }
84
+ o.on('-h', '--help', 'Show help') { puts o; exit 0 }
85
+ end
86
+
87
+ begin
88
+ parser.parse!(ARGV)
89
+ rescue OptionParser::ParseError => e
90
+ warn "Error: #{e.message}"
91
+ warn parser
92
+ exit 2
93
+ end
94
+
95
+ # --- Load configuration ------------------------------------------------------
96
+ def load_yaml(path)
97
+ YAML.safe_load(File.read(path), permitted_classes: [Date, Time], aliases: true) || {}
98
+ rescue StandardError => e
99
+ warn "Failed to read #{path}: #{e.message}"
100
+ exit 3
101
+ end
102
+
103
+ unless File.exist?(options[:config])
104
+ warn "Config not found: #{options[:config]}"
105
+ exit 3
106
+ end
107
+
108
+ CONFIG = load_yaml(options[:config])
109
+ SCHEMA = File.exist?(options[:schema]) ? load_yaml(options[:schema]) : {}
110
+
111
+ # Backward-compatible: v2 uses `defaults:`, but fall back to top-level keys.
112
+ DEFAULTS = CONFIG['defaults'] || CONFIG
113
+ COLLECTION_CFG = CONFIG['collections'] || {}
114
+ DEFAULT_FAIL_UNDER = ((DEFAULTS['scoring'] || {})['fail_under'] || 70).to_i
115
+
116
+ # Recursively merge `override` onto `base` (override wins; hashes merge deep).
117
+ def deep_merge(base, override)
118
+ return base if override.nil?
119
+ return override unless base.is_a?(Hash) && override.is_a?(Hash)
120
+
121
+ merged = base.dup
122
+ override.each do |k, v|
123
+ merged[k] = merged.key?(k) ? deep_merge(merged[k], v) : v
124
+ end
125
+ merged
126
+ end
127
+
128
+ # Effective rules for a collection = deep-merge(defaults, collections[name]).
129
+ # `collections.*` in frontmatter_schema.yml may differ from content_review.yml;
130
+ # here we only merge the review config, not the schema.
131
+ def effective_config(collection)
132
+ base = DEFAULTS
133
+ override = collection ? (COLLECTION_CFG[collection] || {}) : {}
134
+ deep_merge(base, override)
135
+ end
136
+
137
+ # --- Resolve the list of files ----------------------------------------------
138
+ def git_changed_files(base)
139
+ merge_base = `git merge-base #{base} HEAD 2>/dev/null`.strip
140
+ ref = merge_base.empty? ? base : merge_base
141
+ out = `git diff --name-only --diff-filter=ACMR #{ref} HEAD 2>/dev/null`
142
+ out.split("\n").map(&:strip).reject(&:empty?)
143
+ end
144
+
145
+ def excluded?(path, config)
146
+ patterns = (config['scope'] || {})['exclude'] || []
147
+ patterns.any? { |g| File.fnmatch(g, path, File::FNM_PATHNAME | File::FNM_EXTGLOB) }
148
+ end
149
+
150
+ def included?(path, config)
151
+ patterns = (config['scope'] || {})['include'] || []
152
+ patterns.any? { |g| File.fnmatch(g, path, File::FNM_PATHNAME | File::FNM_EXTGLOB) }
153
+ end
154
+
155
+ raw_files =
156
+ if options[:files]
157
+ options[:files].split(/[\s\n]+/).map(&:strip).reject(&:empty?)
158
+ elsif options[:changed]
159
+ git_changed_files(options[:base])
160
+ else
161
+ warn 'Nothing to review: pass --files or --changed.'
162
+ exit 2
163
+ end
164
+
165
+ files = raw_files
166
+ .select { |f| f.end_with?('.md') }
167
+ .select { |f| included?(f, CONFIG) && !excluded?(f, CONFIG) }
168
+ .select { |f| File.exist?(File.join(ROOT, f)) || File.exist?(f) }
169
+ .uniq
170
+
171
+ if files.empty?
172
+ puts 'No in-scope content files to review.'
173
+ # Still emit empty artifacts so downstream steps don't choke.
174
+ File.write(options[:json], JSON.pretty_generate({ 'files' => [], 'average_score' => nil })) if options[:json]
175
+ File.write(options[:summary], "## 📝 Content Review\n\nNo in-scope content files changed.\n") if options[:summary]
176
+ exit 0
177
+ end
178
+
179
+ # --- Front matter + body parsing --------------------------------------------
180
+ def split_front_matter(text)
181
+ if text =~ /\A---\s*\n(.*?)\n---\s*\n?(.*)\z/m
182
+ [Regexp.last_match(1), Regexp.last_match(2)]
183
+ else
184
+ [nil, text]
185
+ end
186
+ end
187
+
188
+ def parse_front_matter(yaml_text)
189
+ return {} if yaml_text.nil? || yaml_text.strip.empty?
190
+
191
+ YAML.safe_load(yaml_text, permitted_classes: [Date, Time], aliases: true) || {}
192
+ rescue StandardError
193
+ nil # signals a parse error
194
+ end
195
+
196
+ # Remove fenced code blocks so prose checks don't trip on code.
197
+ def strip_code_fences(body)
198
+ body.gsub(/^```.*?^```/m, '').gsub(/`[^`]*`/, '')
199
+ end
200
+
201
+ # Remove Liquid {% raw %}...{% endraw %} regions. Content inside them is a
202
+ # literal display example (often showing ``` fences or {{ }} tags), not real
203
+ # page structure, so it must not be counted by the quality/style checks.
204
+ def strip_liquid_raw(body)
205
+ body.gsub(/\{%-?\s*raw\s*-?%\}.*?\{%-?\s*endraw\s*-?%\}/m, '')
206
+ end
207
+
208
+ # --- Collection detection ----------------------------------------------------
209
+ def detect_collection(path, schema)
210
+ collections = schema['collections'] || {}
211
+ # Match specific collections before the generic top-level `pages` pattern.
212
+ ordered = collections.sort_by { |name, _| name == 'pages' ? 1 : 0 }
213
+ ordered.each do |name, spec|
214
+ pattern = spec['path_pattern']
215
+ next unless pattern
216
+
217
+ return name if File.fnmatch(pattern, path, File::FNM_PATHNAME | File::FNM_EXTGLOB)
218
+ end
219
+ nil
220
+ end
221
+
222
+ # --- Individual checks -------------------------------------------------------
223
+ def check_frontmatter(fm, collection, schema)
224
+ issues = []
225
+ return [Issue.new('error', 'frontmatter', 'No front matter block found')] if fm.nil?
226
+ return [Issue.new('error', 'frontmatter', 'Front matter is not valid YAML')] if fm == :parse_error
227
+
228
+ spec = (schema['collections'] || {})[collection]
229
+ required = spec ? (spec['required'] || []) : []
230
+ required.each do |field|
231
+ val = fm[field]
232
+ if val.nil? || (val.respond_to?(:empty?) && val.empty?)
233
+ issues << Issue.new('error', 'frontmatter', "Missing required field: `#{field}`")
234
+ end
235
+ end
236
+
237
+ # categories/tags should be lists, not bare strings.
238
+ %w[categories tags].each do |field|
239
+ next unless fm.key?(field)
240
+
241
+ issues << Issue.new('warning', 'frontmatter', "`#{field}` should be a YAML list, not a bare string") if fm[field].is_a?(String)
242
+ end
243
+ issues
244
+ end
245
+
246
+ def check_seo(fm, seo)
247
+ issues = []
248
+ return issues if fm.nil? || fm == :parse_error
249
+
250
+ title = fm['title'].to_s
251
+ unless title.empty?
252
+ t = (seo['title'] || {})
253
+ min = (t['min_length'] || 30).to_i
254
+ max = (t['max_length'] || 60).to_i
255
+ if title.length < min
256
+ issues << Issue.new('warning', 'seo', "Title is #{title.length} chars (aim for #{min}–#{max})")
257
+ elsif title.length > max
258
+ issues << Issue.new('warning', 'seo', "Title is #{title.length} chars — over #{max}, will truncate in search results")
259
+ end
260
+ end
261
+
262
+ desc = fm['description'].to_s
263
+ d = (seo['description'] || {})
264
+ dmin = (d['min_length'] || 120).to_i
265
+ dmax = (d['max_length'] || 160).to_i
266
+ if desc.empty?
267
+ issues << Issue.new('warning', 'seo', 'No meta description — add a 120–160 char `description`')
268
+ elsif desc.length < dmin
269
+ issues << Issue.new('warning', 'seo', "Description is #{desc.length} chars (aim for #{dmin}–#{dmax})")
270
+ elsif desc.length > dmax
271
+ issues << Issue.new('warning', 'seo', "Description is #{desc.length} chars — over #{dmax}, will truncate")
272
+ end
273
+
274
+ kw = (seo['keywords'] || {})
275
+ if kw['recommended']
276
+ keywords = fm['keywords']
277
+ if keywords.nil?
278
+ issues << Issue.new('info', 'seo', 'No `keywords` — a 3–10 item list aids AI-engine optimization (AIEO)')
279
+ elsif keywords.is_a?(Array)
280
+ kmin = (kw['min'] || 3).to_i
281
+ kmax = (kw['max'] || 10).to_i
282
+ issues << Issue.new('info', 'seo', "Only #{keywords.length} keyword(s) — aim for #{kmin}–#{kmax}") if keywords.length < kmin
283
+ issues << Issue.new('info', 'seo', "#{keywords.length} keywords — trim to #{kmax} most relevant") if keywords.length > kmax
284
+ end
285
+ end
286
+
287
+ if seo['require_preview_image']
288
+ has_image = %w[preview image og_image].any? { |k| !fm[k].to_s.empty? }
289
+ issues << Issue.new('info', 'seo', 'No preview/social image set') unless has_image
290
+ end
291
+ issues
292
+ end
293
+
294
+ def check_quality(body, quality)
295
+ issues = []
296
+ # Liquid {% raw %} examples are display-only — exclude them from every check.
297
+ body = strip_liquid_raw(body)
298
+ prose = strip_code_fences(body)
299
+ words = prose.split(/\s+/).reject(&:empty?)
300
+ wc = words.length
301
+
302
+ min_wc = (quality['min_word_count'] || 100).to_i
303
+ max_wc = (quality['max_word_count'] || 3500).to_i
304
+ if wc < min_wc
305
+ issues << Issue.new('warning', 'quality', "Only ~#{wc} words — below the #{min_wc}-word minimum (reads as a stub)")
306
+ elsif wc > max_wc
307
+ issues << Issue.new('info', 'quality', "~#{wc} words — over #{max_wc}; consider splitting into multiple pages")
308
+ end
309
+
310
+ # Heading structure (ignore headings inside code fences).
311
+ headings = body.gsub(/^```.*?^```/m, '').scan(/^(#{'#'}{1,6})\s+\S/).map { |m| m[0].length }
312
+ h2_plus = headings.count { |lvl| lvl >= 2 }
313
+ min_h2 = (quality['min_h2_headings'] || 1).to_i
314
+ issues << Issue.new('info', 'quality', "Fewer than #{min_h2} H2 heading(s) — add sections for scannability") if h2_plus < min_h2
315
+
316
+ max_skip = (quality['max_heading_skip'] || 1).to_i
317
+ headings.each_cons(2) do |a, b|
318
+ if b - a > max_skip
319
+ issues << Issue.new('warning', 'quality', "Heading level jumps from H#{a} to H#{b} — don't skip levels")
320
+ break
321
+ end
322
+ end
323
+
324
+ # Code fences must declare a language.
325
+ if quality['require_code_fence_language']
326
+ # Only opening fences need a language; toggle state so the matching closing
327
+ # fence (a bare ```) is not counted.
328
+ in_fence = false
329
+ body.each_line do |line|
330
+ next unless line =~ /^\s*```(.*)$/
331
+
332
+ if in_fence
333
+ in_fence = false # closing fence — no language required
334
+ else
335
+ in_fence = true
336
+ issues << Issue.new('info', 'quality', 'Code fence without a language (use ```bash, ```ruby, …)') if Regexp.last_match(1).strip.empty?
337
+ end
338
+ end
339
+ end
340
+
341
+ # Images must have alt text.
342
+ if quality['require_image_alt_text']
343
+ body.scan(/!\[(.*?)\]\(([^)]*)\)/).each do |alt, src|
344
+ issues << Issue.new('warning', 'accessibility', "Image missing alt text: `#{src}`") if alt.strip.empty?
345
+ end
346
+ end
347
+
348
+ # Bare URLs.
349
+ if quality['flag_bare_urls']
350
+ bare = strip_code_fences(body).scan(%r{(?<![("<\]])\bhttps?://[^\s)>\]]+}).reject { |u| u.include?('](') }
351
+ issues << Issue.new('info', 'quality', "#{bare.length} bare URL(s) — wrap as [text](url)") unless bare.empty?
352
+ end
353
+ issues
354
+ end
355
+
356
+ def check_style(body, style)
357
+ issues = []
358
+ prose = strip_code_fences(strip_liquid_raw(body))
359
+ (style['terminology'] || {}).each do |wrong, right|
360
+ next if wrong.to_s.empty?
361
+
362
+ if prose.match?(/\b#{Regexp.escape(wrong)}\b/)
363
+ issues << Issue.new('info', 'style', "Use \"#{right}\" instead of \"#{wrong}\"")
364
+ end
365
+ end
366
+ issues
367
+ end
368
+
369
+ # --- Scoring -----------------------------------------------------------------
370
+ def score_for(issues, weights)
371
+ penalty = issues.sum { |i| (weights[i.severity] || 0).to_i }
372
+ [100 - penalty, 0].max
373
+ end
374
+
375
+ def verdict(score, scoring)
376
+ th = scoring['thresholds'] || {}
377
+ return '🟢 excellent' if score >= (th['excellent'] || 90).to_i
378
+ return '🟡 acceptable' if score >= (th['acceptable'] || 70).to_i
379
+
380
+ '🔴 needs work'
381
+ end
382
+
383
+ # --- Run ---------------------------------------------------------------------
384
+ results = []
385
+
386
+ files.each do |rel|
387
+ abs = File.exist?(rel) ? rel : File.join(ROOT, rel)
388
+ text = File.read(abs, encoding: 'UTF-8')
389
+ fm_text, body = split_front_matter(text)
390
+ fm = parse_front_matter(fm_text)
391
+ fm = :parse_error if fm.nil? && !fm_text.nil?
392
+
393
+ collection = detect_collection(rel, SCHEMA)
394
+ eff = effective_config(collection)
395
+ weights = (eff['scoring'] || {})['weights'] || { 'error' => 15, 'warning' => 5, 'info' => 1 }
396
+ fail_under = ((eff['scoring'] || {})['fail_under'] || DEFAULT_FAIL_UNDER).to_i
397
+
398
+ issues = []
399
+ issues.concat(check_frontmatter(fm == :parse_error ? :parse_error : fm, collection, SCHEMA))
400
+ issues.concat(check_seo(fm, eff['seo'] || {}))
401
+ issues.concat(check_quality(body, eff['quality'] || {}))
402
+ issues.concat(check_style(body, eff['style'] || {}))
403
+
404
+ score = score_for(issues, weights)
405
+ results << {
406
+ 'file' => rel,
407
+ 'collection' => collection,
408
+ 'score' => score,
409
+ 'fail_under' => fail_under,
410
+ 'verdict' => verdict(score, eff['scoring'] || {}),
411
+ 'instructions' => eff['instructions'] || [],
412
+ 'issues' => issues.map { |i| { 'severity' => i.severity, 'category' => i.category, 'message' => i.message } }
413
+ }
414
+ end
415
+
416
+ avg = results.empty? ? nil : (results.sum { |r| r['score'] } / results.length.to_f).round(1)
417
+ failing = results.select { |r| r['score'] < r['fail_under'] }
418
+
419
+ # --- Markdown summary --------------------------------------------------------
420
+ def render_summary(results, avg, fail_under)
421
+ lines = []
422
+ lines << '## 📝 AI Content Review — deterministic checks'
423
+ lines << ''
424
+ lines << "Reviewed **#{results.length}** file(s) · average score **#{avg}/100** · pass threshold **#{fail_under}** (per-collection)."
425
+ lines << ''
426
+ lines << '| File | Collection | Score | Verdict |'
427
+ lines << '| --- | --- | ---: | --- |'
428
+ results.sort_by { |r| r['score'] }.each do |r|
429
+ lines << "| `#{r['file']}` | #{r['collection'] || '—'} | #{r['score']}/#{r['fail_under']} | #{r['verdict']} |"
430
+ end
431
+ lines << ''
432
+
433
+ emoji = { 'error' => '❌', 'warning' => '⚠️', 'info' => 'ℹ️' }
434
+ results.each do |r|
435
+ next if r['issues'].empty?
436
+
437
+ lines << "<details><summary><code>#{r['file']}</code> — #{r['issues'].length} item(s), score #{r['score']}</summary>"
438
+ lines << ''
439
+ r['issues'].sort_by { |i| SEVERITIES.index(i['severity']) || 9 }.each do |i|
440
+ lines << "- #{emoji[i['severity']] || '•'} **#{i['category']}** — #{i['message']}"
441
+ end
442
+ lines << ''
443
+ lines << '</details>'
444
+ lines << ''
445
+ end
446
+
447
+ lines << '---'
448
+ lines << '_Deterministic tier (frontmatter + SEO + structure). The Claude Code'
449
+ lines << 'content-reviewer agent covers tone, clarity, and accuracy separately._'
450
+ lines.join("\n") + "\n"
451
+ end
452
+
453
+ summary_md = render_summary(results, avg, DEFAULT_FAIL_UNDER)
454
+
455
+ # --- Outputs -----------------------------------------------------------------
456
+ File.write(options[:json], JSON.pretty_generate({ 'files' => results, 'average_score' => avg, 'default_fail_under' => DEFAULT_FAIL_UNDER })) if options[:json]
457
+ File.write(options[:summary], summary_md) if options[:summary]
458
+
459
+ unless options[:quiet]
460
+ results.sort_by { |r| r['score'] }.each do |r|
461
+ puts "#{r['verdict'].ljust(14)} #{r['score'].to_s.rjust(3)} #{r['file']}"
462
+ r['issues'].each { |i| puts " [#{i['severity']}] #{i['category']}: #{i['message']}" }
463
+ end
464
+ puts ''
465
+ puts "Average: #{avg}/100 (#{results.length} file(s), default threshold #{DEFAULT_FAIL_UNDER})"
466
+ puts "Failing: #{failing.map { |r| r['file'] }.join(', ')}" unless failing.empty?
467
+ end
468
+
469
+ exit 1 if options[:strict] && !failing.empty?
470
+ exit 0
@@ -128,6 +128,7 @@ main() {
128
128
  source "$TEST_DIR/test_gem.sh"
129
129
  source "$TEST_DIR/test_analyze_commits.sh"
130
130
  source "$TEST_DIR/test_locale_independence.sh"
131
+ source "$TEST_DIR/test_migrate.sh"
131
132
 
132
133
  # Summary
133
134
  echo -e "\n${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
@@ -0,0 +1,88 @@
1
+ #!/bin/bash
2
+
3
+ # Unit tests for migrate.sh library (T-019)
4
+ #
5
+ # Drives the pure-logic migration helpers against throwaway fixture
6
+ # directories: site detection, theme-connection classification, and
7
+ # version-gap detection. The template-rendering functions
8
+ # (install_admin_pages / verify_admin_pages) need the full template
9
+ # pipeline and are exercised by the installer e2e suites; these unit
10
+ # tests focus on the detection logic that has had zero coverage.
11
+
12
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13
+ LIB_DIR="$(cd "$SCRIPT_DIR/../../lib" && pwd)"
14
+
15
+ export DRY_RUN=true
16
+ export INTERACTIVE=false
17
+ export VERBOSE=false
18
+
19
+ source "$LIB_DIR/common.sh"
20
+ source "$LIB_DIR/migrate.sh"
21
+
22
+ set +e
23
+
24
+ print_suite_header "migrate.sh"
25
+
26
+ _mktmp() { mktemp -d "${TMPDIR:-/tmp}/migrate-test-XXXXXX"; }
27
+
28
+ # --- detect_jekyll_site ---------------------------------------------------
29
+ echo "Testing detect_jekyll_site..."
30
+
31
+ d=$(_mktmp)
32
+ assert_false "detect_jekyll_site '$d'" "No _config.yml → not a Jekyll site"
33
+
34
+ touch "$d/_config.yml"
35
+ assert_false "detect_jekyll_site '$d'" "_config.yml alone is not enough"
36
+
37
+ touch "$d/Gemfile"
38
+ assert_true "detect_jekyll_site '$d'" "_config.yml + Gemfile → Jekyll site"
39
+ rm -rf "$d"
40
+
41
+ d=$(_mktmp); touch "$d/_config.yml"; mkdir -p "$d/_layouts"
42
+ assert_true "detect_jekyll_site '$d'" "_config.yml + _layouts/ → Jekyll site"
43
+ rm -rf "$d"
44
+
45
+ # --- validate_theme_connection -------------------------------------------
46
+ echo "Testing validate_theme_connection..."
47
+
48
+ d=$(_mktmp)
49
+ printf 'remote_theme: "bamr87/zer0-mistakes"\n' > "$d/_config.yml"
50
+ assert_true "validate_theme_connection '$d'" "remote_theme detected"
51
+ validate_theme_connection "$d" >/dev/null 2>&1
52
+ assert_equals "remote" "$THEME_CONNECTION_TYPE" "remote connection type set"
53
+ rm -rf "$d"
54
+
55
+ d=$(_mktmp)
56
+ printf 'theme: jekyll-theme-zer0\n' > "$d/_config.yml"
57
+ assert_true "validate_theme_connection '$d'" "gem theme detected"
58
+ validate_theme_connection "$d" >/dev/null 2>&1
59
+ assert_equals "gem" "$THEME_CONNECTION_TYPE" "gem connection type set"
60
+ rm -rf "$d"
61
+
62
+ d=$(_mktmp)
63
+ printf 'title: My Site\n' > "$d/_config.yml"
64
+ printf 'gem "jekyll-theme-zer0", path: "../theme"\n' > "$d/Gemfile"
65
+ assert_true "validate_theme_connection '$d'" "local path gem detected"
66
+ validate_theme_connection "$d" >/dev/null 2>&1
67
+ assert_equals "local" "$THEME_CONNECTION_TYPE" "local connection type set"
68
+ rm -rf "$d"
69
+
70
+ d=$(_mktmp)
71
+ printf 'title: Unrelated Site\n' > "$d/_config.yml"
72
+ assert_false "validate_theme_connection '$d'" "no theme connection → 1"
73
+ rm -rf "$d"
74
+
75
+ # --- detect_version_gap ---------------------------------------------------
76
+ echo "Testing detect_version_gap..."
77
+
78
+ d=$(_mktmp)
79
+ assert_true "detect_version_gap '$d'" "no Gemfile.lock → pass (cannot check)"
80
+
81
+ printf ' jekyll-theme-zer0 (1.14.0)\n' > "$d/Gemfile.lock"
82
+ assert_true "detect_version_gap '$d'" "modern version >= min → pass"
83
+
84
+ printf ' jekyll-theme-zer0 (0.22.5)\n' > "$d/Gemfile.lock"
85
+ assert_false "detect_version_gap '$d'" "version below 0.22.10 min → gap detected"
86
+ rm -rf "$d"
87
+
88
+ echo -e "\n${GREEN}migrate.sh tests complete${NC}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-zer0
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.1
4
+ version: 1.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amr Abdel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-13 00:00:00.000000000 Z
11
+ date: 2026-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -374,6 +374,7 @@ files:
374
374
  - scripts/bin/test
375
375
  - scripts/bin/validate
376
376
  - scripts/build
377
+ - scripts/content-review.rb
377
378
  - scripts/convert-notebooks.sh
378
379
  - scripts/docker-publish
379
380
  - scripts/docs/check-freshness.sh
@@ -490,6 +491,7 @@ files:
490
491
  - scripts/test/lib/test_gem.sh
491
492
  - scripts/test/lib/test_git.sh
492
493
  - scripts/test/lib/test_locale_independence.sh
494
+ - scripts/test/lib/test_migrate.sh
493
495
  - scripts/test/lib/test_validation.sh
494
496
  - scripts/test/lib/test_version.sh
495
497
  - scripts/test/theme/validate