Skip to content

Commit ede4267

Browse files
feat(usc,ecfr): emit alt-granularity outputs in incremental updates
Wire update-usc.sh and update-ecfr.sh to re-emit title/chapter (and part, for eCFR) outputs alongside the section convert, and rsync them to the VPS. Reuses the already-computed changed-title list so only touched titles are regenerated on incremental runs.
1 parent b1416f3 commit ede4267

2 files changed

Lines changed: 47 additions & 6 deletions

File tree

scripts/update-ecfr.sh

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
# Steps:
1313
# 1. Detect changed titles via eCFR API metadata
1414
# 2. Download changed title XML from eCFR API
15-
# 3. Convert changed titles to Markdown (writeFileIfChanged preserves mtimes)
15+
# 3. Convert changed titles to Markdown at all granularities (section, title, chapter, part)
1616
# 4. Generate highlights for changed sections (mtime-based, skippable)
1717
# 5. Regenerate eCFR nav JSON
1818
# 6. Regenerate sitemaps
1919
# 7. Save checkpoint
20-
# 8. Rsync content + nav + sitemaps to VPS
20+
# 8. Rsync content (all granularities) + nav + sitemaps to VPS
2121
# 9. Incremental search index on VPS
2222
#
2323
# Requires:
@@ -157,9 +157,18 @@ if [ "$DEPLOY_ONLY" = false ]; then
157157
$CLI download-ecfr $TITLE_ARG
158158
echo ""
159159

160-
# Step 3: Convert
160+
# Step 3: Convert at every granularity. Section is the default output; title,
161+
# chapter, and part re-emit the same parsed AST at higher levels for the
162+
# Astro app's browsable landing pages. writeFileIfChanged preserves mtimes.
161163
echo "--- Step 3/7: Converting eCFR titles ($TITLE_ARG)"
164+
echo " section granularity"
162165
$CLI convert-ecfr $TITLE_ARG $CURRENCY_ARG
166+
echo " title granularity"
167+
$CLI convert-ecfr $TITLE_ARG $CURRENCY_ARG -g title -o ./output-title
168+
echo " chapter granularity"
169+
$CLI convert-ecfr $TITLE_ARG $CURRENCY_ARG -g chapter -o ./output-chapter
170+
echo " part granularity"
171+
$CLI convert-ecfr $TITLE_ARG $CURRENCY_ARG -g part -o ./output-part
163172
echo ""
164173

165174
# Step 4: Highlights (optional)
@@ -208,6 +217,21 @@ if [ -d "output/ecfr" ]; then
208217
rsync -avz --checksum output/ecfr/ "${VPS_HOST}:${CONTENT_DEST}/ecfr/sections/"
209218
fi
210219

220+
if [ -d "output-title/ecfr" ]; then
221+
echo " eCFR titles"
222+
rsync -avz output-title/ecfr/ "${VPS_HOST}:${CONTENT_DEST}/ecfr/titles/"
223+
fi
224+
225+
if [ -d "output-chapter/ecfr" ]; then
226+
echo " eCFR chapters"
227+
rsync -avz output-chapter/ecfr/ "${VPS_HOST}:${CONTENT_DEST}/ecfr/chapters/"
228+
fi
229+
230+
if [ -d "output-part/ecfr" ]; then
231+
echo " eCFR parts"
232+
rsync -avz output-part/ecfr/ "${VPS_HOST}:${CONTENT_DEST}/ecfr/parts/"
233+
fi
234+
211235
if [ -d "apps/astro/public/nav" ]; then
212236
echo " Nav JSON"
213237
rsync -avz --delete apps/astro/public/nav/ "${VPS_HOST}:${NAV_DEST}/"

scripts/update-usc.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
# Steps:
1212
# 1. Check latest OLRC release point against stored checkpoint
1313
# 2. Download all USC titles (bulk zip)
14-
# 3. Convert all titles to Markdown (writeFileIfChanged preserves mtimes)
14+
# 3. Convert all titles to Markdown at every granularity (section, title, chapter)
1515
# 4. Generate highlights for changed sections (mtime-based, skippable)
1616
# 5. Regenerate USC nav JSON
1717
# 6. Regenerate sitemaps
1818
# 7. Save new release point
19-
# 8. Rsync content + nav + sitemaps to VPS
19+
# 8. Rsync content (all granularities) + nav + sitemaps to VPS
2020
# 9. Incremental search index on VPS
2121
#
2222
# Requires:
@@ -140,9 +140,16 @@ if [ "$DEPLOY_ONLY" = false ]; then
140140
$CLI download-usc --all
141141
echo ""
142142

143-
# Step 3: Convert
143+
# Step 3: Convert at every granularity. Section is the default output; title
144+
# and chapter re-emit the same parsed AST at higher levels for the Astro
145+
# app's browsable landing pages. writeFileIfChanged preserves mtimes.
144146
echo "--- Step 3/7: Converting USC titles"
147+
echo " section granularity"
145148
$CLI convert-usc --all
149+
echo " title granularity"
150+
$CLI convert-usc --all -g title -o ./output-title
151+
echo " chapter granularity"
152+
$CLI convert-usc --all -g chapter -o ./output-chapter
146153
echo ""
147154

148155
# Step 4: Highlights (optional)
@@ -193,6 +200,16 @@ if [ -d "output/usc" ]; then
193200
rsync -avz --checksum output/usc/ "${VPS_HOST}:${CONTENT_DEST}/usc/sections/"
194201
fi
195202

203+
if [ -d "output-title/usc" ]; then
204+
echo " USC titles"
205+
rsync -avz output-title/usc/ "${VPS_HOST}:${CONTENT_DEST}/usc/titles/"
206+
fi
207+
208+
if [ -d "output-chapter/usc" ]; then
209+
echo " USC chapters"
210+
rsync -avz output-chapter/usc/ "${VPS_HOST}:${CONTENT_DEST}/usc/chapters/"
211+
fi
212+
196213
if [ -d "apps/astro/public/nav" ]; then
197214
echo " Nav JSON"
198215
rsync -avz --delete apps/astro/public/nav/ "${VPS_HOST}:${NAV_DEST}/"

0 commit comments

Comments
 (0)