Skip to content

Commit 2ef4d71

Browse files
committed
Refactor PDF generation script
1 parent 1b71651 commit 2ef4d71

4 files changed

Lines changed: 19 additions & 10 deletions

File tree

‎.clinerules‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ There is no stop button to break out of a hung loop.
2727
possible, pass `--yes` / `-y` (e.g. `npx --yes <pkg>`).
2828
- **`gh`**: use `--no-pager` where supported and avoid interactive subcommands.
2929

30+
### Git is read-only for the agent
31+
32+
NEVER run state-changing git commands: `git commit`, `git add`, `git push`,
33+
`git stash`, `git checkout`, `git switch`, `git restore`, `git reset`,
34+
`git rebase`, `git merge`, `git cherry-pick`, `git tag`, etc. The user handles
35+
all git mutations themselves — do not commit work, even when a task mirrors a
36+
previously committed step. Read-only inspection is fine, always with
37+
`--no-pager` per the rules above (`git status`, `git --no-pager log`,
38+
`git --no-pager diff`, `git --no-pager show`, `git --no-pager blame`).
39+
3040
### General rules for `execute_command`
3141

3242
- Every command must be **non-interactive** and **self-terminating**.

‎.github/workflows/search.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
run: |
6767
COLLECTIONS=""
6868
if [ "${{ steps.scope.outputs.crawl_articles }}" = "true" ]; then
69-
COLLECTIONS="$COLLECTIONS --collection articles --collection deep-dive"
69+
COLLECTIONS="$COLLECTIONS --collection articles"
7070
fi
7171
if [ "${{ steps.scope.outputs.crawl_services }}" = "true" ]; then
7272
COLLECTIONS="$COLLECTIONS --collection services"

‎scripts/generate-pdfs/index.mjs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* Generate PDFs from /print/ pages using Puppeteer.
55
*
66
* Usage:
7-
* - node scripts/generate-pdfs.mjs <slug> # single article
8-
* - node scripts/generate-pdfs.mjs # all deep dive articles
7+
* - node scripts/generate-pdfs/index.mjs <slug> # single article
8+
* - node scripts/generate-pdfs/index.mjs # all articles
99
* - OR npm run pdf:generate
1010
*
1111
* Requires a running server (dev or preview) at localhost:4321.
@@ -60,7 +60,7 @@ const LAYOUT_SETTLE_DELAY_MS = 500
6060
const collectAllSlugs = () => {
6161
if (!existsSync(ARTICLES_DIR)) return []
6262
return readdirSync(ARTICLES_DIR, { withFileTypes: true })
63-
.filter(e => e.isDirectory() && existsSync(join(ARTICLES_DIR, e.name, 'pdf.mdx')))
63+
.filter(e => e.isDirectory() && existsSync(join(ARTICLES_DIR, e.name, 'index.mdx')))
6464
.map(e => e.name)
6565
.sort()
6666
}
@@ -279,18 +279,18 @@ if (!(await checkServer())) {
279279
}
280280

281281
if (slugFilter) {
282-
const pdfMdx = join(ARTICLES_DIR, slugFilter, 'pdf.mdx')
283-
if (!existsSync(pdfMdx)) {
284-
console.error(`ERROR: No pdf.mdx found for "${slugFilter}"`)
285-
console.error(`Expected: ${pdfMdx}`)
282+
const indexMdx = join(ARTICLES_DIR, slugFilter, 'index.mdx')
283+
if (!existsSync(indexMdx)) {
284+
console.error(`ERROR: No index.mdx found for "${slugFilter}"`)
285+
console.error(`Expected: ${indexMdx}`)
286286
process.exit(1)
287287
}
288288
}
289289

290290
const slugs = slugFilter ? [slugFilter] : collectAllSlugs()
291291

292292
if (slugs.length === 0) {
293-
console.error('ERROR: No deep dive articles with pdf.mdx found.')
293+
console.error('ERROR: No articles with index.mdx found.')
294294
process.exit(1)
295295
}
296296

‎scripts/search-index.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class CollectionConfig:
4545
# Collections to index
4646
COLLECTIONS: Final[list[CollectionConfig]] = [
4747
CollectionConfig(name="articles", url_prefix="/articles", source_dir="articles", glob_pattern="**/index.mdx"),
48-
CollectionConfig(name="deep-dive", url_prefix="/deep-dive", source_dir="articles", glob_pattern="**/pdf.mdx"),
4948
CollectionConfig(name="case-studies", url_prefix="/case-studies", source_dir="case-studies", glob_pattern="**/index.mdx"),
5049
CollectionConfig(name="services", url_prefix="/services", source_dir="services", glob_pattern="**/index.md"),
5150
]

0 commit comments

Comments
 (0)