Standard production layout: the OKR app (was nested under AINative_OKR_CASAN5/) is now
the repository root. No more wrapper directory.
- Promote AINative_OKR_CASAN5/* -> repo root (backend/ frontend/ packages/ apps/
.specify/ docs/ infra/ nginx/ scripts/ + configs). Merge tool dirs: .gitea (kept the
active deploy ci.yml, added harness-ci.yml + runbooks), .claude (agents/commands +
launch.json), .github moved up.
- Remove redundant: 00_SUBMISSION_PACKAGE, scattered root notes (FPT_CASAN_Full.md,
tu-tuong-casan.md, casan-tu-sinh..., casan_harness_assessment.md, source-review...,
README_CASAN5_REFINED.md), casan-next-plans/ and optimize-docs/ (competition/planning
artifacts — roadmap + design history preserved in git log / commit messages).
- Update all references to the old layout:
- .gitea/workflows/{ci,harness-ci}.yml, .github/workflows/{ci,deploy}.yml:
working-directory .; drop AINative_OKR_CASAN5/ prefix; .specify/{tests,scripts}
-> packages/casan-harness/... (.specify/logs state kept)
- .claude/launch.json, .gitea/*-runbook.md: path prefixes
- CLAUDE.md, README.md: docs/input -> apps/okr/domain/input
- policy-bundle.yaml: 8 policy paths -> packages/casan-harness/...; manifest re-signed
- secrets-scan.sh: fixture excludes -> new package/domain paths.
Full gate from the new root: PASS=64 FAIL=0 SKIP=3.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
100 lines
3.5 KiB
Bash
Executable File
100 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -uo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/../scripts/bash/casan-paths.sh"
|
|
PROJECT_ROOT="$CASAN_APP_ROOT"
|
|
WORK="$(mktemp -d)"
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
PASS=0; FAIL=0
|
|
pass(){ echo "PASS: $1"; PASS=$((PASS+1)); }
|
|
fail(){ echo "FAIL: $1"; FAIL=$((FAIL+1)); }
|
|
|
|
mkdir -p "$WORK/scripts" "$WORK/.specify/scripts/bash" "$WORK/docs/input"
|
|
cp "$PROJECT_ROOT/scripts/casan-step.mjs" "$WORK/scripts/casan-step.mjs"
|
|
|
|
cat > "$WORK/docs/input/okr-requirement.md" <<'EOF'
|
|
# OKR Requirement
|
|
- FR-01 Login
|
|
- FR-02 Create Objective
|
|
- FR-03 Create Key Result
|
|
- FR-04 Update Progress
|
|
- FR-05 Dashboard
|
|
- SCR-00 Login
|
|
- SCR-01 Dashboard
|
|
- SCR-02 Detail
|
|
- SCR-03 Create Objective
|
|
- SCR-04 Key Result Detail
|
|
EOF
|
|
cat > "$WORK/docs/technical_architecture.md" <<'EOF'
|
|
# Architecture
|
|
Frontend uses API client. Backend uses NestJS and Prisma.
|
|
EOF
|
|
|
|
cat > "$WORK/.specify/scripts/bash/model-router.sh" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
prompt_file="$1"
|
|
out_json="$2"
|
|
if grep -q "Business Design" "$prompt_file"; then
|
|
cat > "$out_json" <<'JSON'
|
|
{"text":"# Model Generated BD\n\n## Screen Layout\n- SCR-00 Login\n- SCR-01 Dashboard\n- SCR-02 Detail\n- SCR-03 Create Objective\n- SCR-04 Key Result Detail\n\n## API Boundary\nFrontend calls backend through src/lib/api.ts.\n","input_tokens":21,"output_tokens":34,"total_tokens":55}
|
|
JSON
|
|
else
|
|
cat > "$out_json" <<'JSON'
|
|
{"text":"# Model Generated SRS\n\n## Functional Requirements\n- FR-01 Login\n- FR-02 Create Objective\n- FR-03 Create Key Result\n- FR-04 Update Progress\n- FR-05 Dashboard\n\n## Non Functional Requirements\nAuthentication required.\n","input_tokens":20,"output_tokens":30,"total_tokens":50}
|
|
JSON
|
|
fi
|
|
EOF
|
|
chmod +x "$WORK/.specify/scripts/bash/model-router.sh"
|
|
|
|
cat > "$WORK/.specify/scripts/bash/artifact-scan.sh" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
exit 0
|
|
EOF
|
|
chmod +x "$WORK/.specify/scripts/bash/artifact-scan.sh"
|
|
|
|
(
|
|
cd "$WORK" || exit 1
|
|
CASAN_OUTPUT="$WORK/out-template.md" node scripts/casan-step.mjs 01-srs 1 >/dev/null
|
|
)
|
|
if grep -q "FR-05 Dashboard" "$WORK/docs/output/ipa-docs/srs/srs-mod01-okr-management.md" \
|
|
&& grep -q "source=template" "$WORK/docs/output/output_logs/001-okr-web-app/reports/01-srs-report.md"; then
|
|
pass "source-gen default mode keeps deterministic template"
|
|
else
|
|
fail "default template generation changed"
|
|
fi
|
|
|
|
(
|
|
cd "$WORK" || exit 1
|
|
CASAN_GEN_MODE=model CASAN_OUTPUT="$WORK/out-model.md" node scripts/casan-step.mjs 02-bd 1 >/dev/null
|
|
)
|
|
if grep -q "Model Generated BD" "$WORK/docs/output/ipa-docs/bd/bd-mod01-okr-management.md" \
|
|
&& grep -q "source=model" "$WORK/docs/output/output_logs/001-okr-web-app/reports/02-bd-report.md"; then
|
|
pass "source-gen model mode accepts scanned valid model output"
|
|
else
|
|
fail "model generated BD was not accepted"
|
|
fi
|
|
|
|
cat > "$WORK/.specify/scripts/bash/artifact-scan.sh" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
exit 2
|
|
EOF
|
|
chmod +x "$WORK/.specify/scripts/bash/artifact-scan.sh"
|
|
|
|
(
|
|
cd "$WORK" || exit 1
|
|
CASAN_GEN_MODE=model CASAN_OUTPUT="$WORK/out-fallback.md" node scripts/casan-step.mjs 01-srs 1 >/dev/null
|
|
)
|
|
if grep -q "Functional requirements extracted" "$WORK/docs/output/ipa-docs/srs/srs-mod01-okr-management.md" \
|
|
&& grep -q "source=template-fallback" "$WORK/docs/output/output_logs/001-okr-web-app/reports/01-srs-report.md"; then
|
|
pass "source-gen falls back to template when H4 artifact scan blocks model output"
|
|
else
|
|
fail "source-gen did not fallback after artifact scan block"
|
|
fi
|
|
|
|
echo ""
|
|
echo "===== SOURCEGEN TESTS: PASS=$PASS FAIL=$FAIL ====="
|
|
[[ "$FAIL" -eq 0 ]] || exit 1
|