55 lines
2.2 KiB
Bash
Executable File
55 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Platform check "conventions": the repo still has the shape the platform relies
|
|
# on. Hard failures exit 1 (the check fails); soft findings print a warning and
|
|
# pass. Runs from the repo root. Kept dependency-free (bash + jq).
|
|
set -uo pipefail
|
|
fail=0
|
|
problem() { printf 'FAIL %s\n' "$*"; fail=1; }
|
|
note() { printf 'warn %s\n' "$*"; }
|
|
ok() { printf 'ok %s\n' "$*"; }
|
|
|
|
# 1. Manifest present and shaped (manifest.sh already validated the checks list).
|
|
if [ -f .dealsage/app.json ] && jq -e '.appId | test("^[0-9a-f-]{36}$")' .dealsage/app.json >/dev/null 2>&1; then
|
|
ok ".dealsage/app.json has an appId"
|
|
else
|
|
problem ".dealsage/app.json is missing or has no appId"
|
|
fi
|
|
if jq -e 'keys - ["appId","checks","dependencies"] | length == 0' .dealsage/app.json >/dev/null 2>&1; then
|
|
ok "manifest has only known keys"
|
|
else
|
|
problem "manifest has unknown top-level keys: $(jq -c 'keys - ["appId","checks","dependencies"]' .dealsage/app.json 2>/dev/null)"
|
|
fi
|
|
|
|
# 2. The workflow is the platform stub, so pipeline changes reach this repo.
|
|
wf=.gitea/workflows/publish.yml
|
|
if [ -f "$wf" ]; then
|
|
if grep -qE 'ci-actions/pipeline@' "$wf"; then
|
|
ok "workflow delegates to the platform pipeline"
|
|
else
|
|
note "workflow does not call ci-actions/pipeline; this repo will not receive pipeline updates"
|
|
fi
|
|
else
|
|
problem "$wf is missing"
|
|
fi
|
|
|
|
# 3. Build contract.
|
|
if jq -e '.scripts.build' package.json >/dev/null 2>&1; then ok "package.json has a build script"; else problem "package.json has no build script"; fi
|
|
|
|
# 4. Platform files the shell and the builder depend on.
|
|
for f in src/lib/dealsage.ts src/Root.tsx src/main.tsx; do
|
|
[ -f "$f" ] && ok "$f present" || problem "$f is missing (platform-owned file)"
|
|
done
|
|
|
|
# 5. Guidance for agents. Soft: older apps predate it.
|
|
[ -f AGENTS.md ] && ok "AGENTS.md present" || note "AGENTS.md missing; coding agents get no project guidance"
|
|
if [ -f AGENTS.md ] && ! grep -q 'dealsage:generated:start' AGENTS.md; then
|
|
note "AGENTS.md has no generated block markers; the builder will not preserve hand-written sections"
|
|
fi
|
|
|
|
# 6. Nothing secret committed.
|
|
for f in .env .env.local .env.production; do
|
|
[ -f "$f" ] && problem "$f is committed; the pipeline bakes the Supabase connection from org variables instead"
|
|
done
|
|
|
|
exit $fail
|