Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
# Shared secret for GitHub Actions API calls.
CRON_SECRET=
# Reserved for the later AI phase; unused by the foundation.
# Gemini API key used by the story writer and magazine layout builder.
GEMINI_API_KEY=
# Reserved model name for the later writing phase.
# Optional model override for story writing and editor notes.
WRITER_MODEL=
# Reserved model name for the later design phase.
# Optional model override for magazine story placement.
DESIGNER_MODEL=
# Reserved for later workflow dispatch; unused by the foundation.
# Reserved for a future compile workflow; not used by the current app.
GITHUB_DISPATCH_TOKEN=
# App URL used by GitHub Actions; also add as the APP_URL repository secret.
APP_URL=
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
cache: npm
- name: Install dependencies
run: npm ci
- name: Ingest tests
run: npm run test:ingest
- name: Magazine rendering tests
run: npm run test:magazine
- name: Lint
run: npm run lint
- name: Typecheck
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ingest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
call-ingest:
runs-on: ubuntu-latest
steps:
- name: Call the ingest stub
- name: Call the authenticated ingest endpoint
env:
APP_URL: ${{ secrets.APP_URL }}
CRON_SECRET: ${{ secrets.CRON_SECRET }}
Expand All @@ -28,11 +28,13 @@ jobs:
echo "::error title=Configuration::CRON_SECRET is not set."
exit 1
fi
APP_URL="${APP_URL%/}"
http_code=$(curl --silent --show-error \
--output "$RUNNER_TEMP/ingest-response.json" \
--write-out "%{http_code}" \
--request POST \
--header "Authorization: Bearer $CRON_SECRET" \
--max-time 75 \
"$APP_URL/api/cron/ingest")
cat "$RUNNER_TEMP/ingest-response.json"
if [[ ! "$http_code" =~ ^2[0-9][0-9]$ ]]; then
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/latex-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,26 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Generate magazine renderer smoke file
run: WRITE_LATEX_SMOKE=1 node --experimental-strip-types --test tests/magazine-render.test.mjs
- name: Compile the May reference
uses: xu-cheng/latex-action@v4
with:
texlive_version: 2026
root_file: latex/reference/may-2026.tex
work_in_root_file_dir: true
args: -pdf -file-line-error -halt-on-error -interaction=nonstopmode
- name: Compile the generated magazine template with special characters
uses: xu-cheng/latex-action@v4
with:
texlive_version: 2026
root_file: latex/generated-render-smoke.tex
work_in_root_file_dir: true
args: -pdf -file-line-error -halt-on-error -interaction=nonstopmode
- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ pnpm-debug.log*
/coverage/
*.tsbuildinfo
next-env.d.ts
/latex/generated-render-smoke.tex
39 changes: 22 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,66 @@

The newsroom behind **Machine Intelligence**, the magazine of the Department of Artificial Intelligence at NFC IET Multan.

The foundation is in place: a public magazine site, a Supabase-backed editor allowlist, a mobile-friendly editor desk, secure API stubs, and GitHub Actions for CI, scheduled ingest calls, and LaTeX checks. The first issue and editor story cards still use clearly labeled sample data.
The foundation, RSS ingestion, AI story review, and first magazine-draft builder are in place. Approved stories can be arranged into a configurable issue, edited by the newsroom, and rendered as a private LaTeX source file for review.

## Foundation status

- **Public site:** home, issue archive and issue detail, About, How it is made, Privacy, sitemap, robots, Open Graph image, and a custom not-found page.
- **Editor desk:** Supabase email-and-password sign-in for accounts on the editor list; Draft, Stories, Quarantine, Sources, Images, Issues, and admin-only Editors pages.
- **Supabase:** editors, editions, and runs tables; row-level security; public issues and private drafts buckets; vector extension.
- **API:** health endpoint plus authenticated ingest and compile-callback stubs. The stubs only write run records.
- **Editor desk:** Supabase email-and-password sign-in for approved addresses on the editor list; Supabase-backed story review and quarantine; editable issue title, publication masthead, cover and back-cover copy, theme, section names, slot targets, supervisor, editor credits, and editor note.
- **Supabase:** editor, edition, run, source, article, story, and image tables; row-level security; public issues and private drafts buckets; vector extension.
- **Ingest:** authenticated RSS collection, robots-aware article text extraction, URL-hash deduplication, conservative title-based grouping, optional Gemini summaries and scoring, and a numeric claim check against stored source text.
- **Draft builder:** Gemini arranges approved stories within their editor-assigned sections, chooses story order and presentation, and can draft an editor note using structured JSON. Editable section slot targets guide the layout; overflow stories become briefs so no approved story is dropped. The app validates the plan, renders trusted TeX with escaped story text, and stores the source file in the private `drafts` bucket.
- **API:** health endpoint, scheduled RSS ingestion, and an authenticated compile-callback stub.
- **Automation:** CI checks, a three-times-daily GitHub Actions request, and a LaTeX reference compile workflow.
- **Not active yet:** RSS ingestion, Gemini calls, story clustering or scoring, draft rendering, PDF publishing, and publication logic.
- **Not active yet:** embedding-based clustering, PDF compilation, and issue publication/archive workflow. The builder creates a private `.tex` file for review. A human must check the story claims and editor note before publication.

## Stack

Next.js App Router, React, TypeScript, Tailwind CSS, Supabase Auth/Postgres/Storage, GitHub Actions, Vercel, and TeX Live. Gemini is reserved for a later phase.
Next.js App Router, React, TypeScript, Tailwind CSS, Supabase Auth/Postgres/Storage, Google GenAI, GitHub Actions, Vercel, and TeX Live.

## Development

Use Node.js 26.13.1, matching .nvmrc.

~~~bash
```bash
nvm install
nvm use
npm ci
cp .env.example .env.local
npm run dev
~~~
```

The public site can show its sample preview without Supabase credentials. Sign-in, the editor desk, and API stubs need the required values in .env.local. See [the setup guide](docs/SETUP.md).
The public site can show its sample preview without Supabase credentials. Sign-in, the editor desk, and ingestion need the required values in .env.local. See [the setup guide](docs/SETUP.md) and [the ingestion notes](docs/INGEST.md).

~~~bash
```bash
npm run lint
npm run typecheck
npm run build
~~~
```

## Project documents

- [Developer setup](docs/SETUP.md)
- [Build specification](docs/SPEC.md)
- [May 2026 LaTeX design reference](latex/reference/may-2026.tex)
- [RSS source and ingestion notes](docs/INGEST.md)

## Project layout

~~~text
```text
app/ public pages, editor desk, and API routes
app/icon.svg supplied magazine favicon and app icons
components/ shared site, editor, and UI components
config/ magazine identity, sections, and slot counts
content/site.ts public and editor-facing copy
lib/data/ clearly labeled sample issue and story data
lib/ingest/ phase 2 feed collection
lib/ai/ phase 2 model providers
lib/render/ later LaTeX rendering
lib/ingest/ feed collection, story enrichment, and scoring
lib/magazine/ editable template, AI layout planning, and safe TeX rendering
public/brand/ supplied Machine Intelligence logo pack
latex/templates/ source template used by the issue renderer
supabase/migrations/ database schema and access policies
.github/workflows/ CI, ingest request, and LaTeX check
~~~
.github/workflows/ CI, ingest request, and LaTeX reference checks
```

A [Coding Moves](https://codingmoves.com) project.

Expand Down
42 changes: 33 additions & 9 deletions app/(site)/privacy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,46 @@ export default function PrivacyPage() {
title={siteCopy.privacy.title}
description={siteCopy.privacy.intro}
/>
<div className="mt-12 max-w-3xl divide-y divide-line border-y border-line">
<div className="divide-line border-line mt-12 max-w-3xl divide-y border-y">
<section className="py-6">
<h2 className="text-2xl tracking-tight">{siteCopy.privacy.trackingTitle}</h2>
<p className="mt-3 text-sm leading-6 text-muted">{siteCopy.privacy.trackingText}</p>
<h2 className="text-2xl tracking-tight">
{siteCopy.privacy.trackingTitle}
</h2>
<p className="text-muted mt-3 text-sm leading-6">
{siteCopy.privacy.trackingText}
</p>
</section>
<section className="py-6">
<h2 className="text-2xl tracking-tight">{siteCopy.privacy.editorTitle}</h2>
<p className="mt-3 text-sm leading-6 text-muted">{siteCopy.privacy.editorText}</p>
<h2 className="text-2xl tracking-tight">
{siteCopy.privacy.editorTitle}
</h2>
<p className="text-muted mt-3 text-sm leading-6">
{siteCopy.privacy.editorText}
</p>
</section>
<section className="py-6">
<h2 className="text-2xl tracking-tight">{siteCopy.privacy.storageTitle}</h2>
<p className="mt-3 text-sm leading-6 text-muted">{siteCopy.privacy.storageText}</p>
<h2 className="text-2xl tracking-tight">
{siteCopy.privacy.storageTitle}
</h2>
<p className="text-muted mt-3 text-sm leading-6">
{siteCopy.privacy.storageText}
</p>
</section>
<section className="py-6">
<h2 className="text-2xl tracking-tight">{siteCopy.privacy.contactTitle}</h2>
<p className="mt-3 text-sm leading-6 text-muted">{siteCopy.privacy.contactText}</p>
<h2 className="text-2xl tracking-tight">
{siteCopy.privacy.aiTitle}
</h2>
<p className="text-muted mt-3 text-sm leading-6">
{siteCopy.privacy.aiText}
</p>
</section>
<section className="py-6">
<h2 className="text-2xl tracking-tight">
{siteCopy.privacy.contactTitle}
</h2>
<p className="text-muted mt-3 text-sm leading-6">
{siteCopy.privacy.contactText}
</p>
</section>
</div>
</Section>
Expand Down
18 changes: 11 additions & 7 deletions app/api/cron/ingest/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { getCronSecret } from "@/lib/env";
import { recordStubRun } from "@/lib/api/record-stub-run";
import { hasValidCronBearer } from "@/lib/security/cron-auth";
import { runIngest } from "@/lib/ingest/pipeline";

export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export const maxDuration = 60;

export async function POST(request: Request) {
let secret: string;
Expand All @@ -18,16 +19,19 @@ export async function POST(request: Request) {
}

if (!hasValidCronBearer(request.headers.get("authorization"), secret)) {
return Response.json({ ok: false, error: "Unauthorized." }, { status: 401 });
return Response.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}

try {
// TODO(phase-2): fetch feeds, cluster stories, and rebuild the draft.
const runId = await recordStubRun("ingest");
return Response.json({ ok: true, runId, stub: true });
} catch {
const result = await runIngest();
return Response.json(result, { status: result.ok ? 200 : 502 });
} catch (error) {
console.error("The authenticated ingest request failed.", error);
return Response.json(
{ ok: false, error: "Could not record the ingest run." },
{ ok: false, error: "The ingest run could not be completed." },
{ status: 503 },
);
}
Expand Down
Binary file added app/apple-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading