#!/usr/bin/env bash # Full-command smoke suite — exercise EVERY inkreach-teable CLI command against a # throwaway sandbox base and assert none of them hit: # 1. phantom routes (HTTP_404 / "Cannot GET|POST|PUT|PATCH|DELETE") # 2. CLI syntax bugs ("unknown option" / "unknown command" / "Missing required") # 3. CLI request-shape (zod "expected X, received Y" validation errors) # Domain-level 4xx (e.g. "Invalid value for field") are NOT failures — the route # exists and the backend answered. # # Usage: # INKREACH_TEABLE_ENDPOINT=http://localhost:3003 INKREACH_TEABLE_TOKEN= \ # bash scripts/smoke-commands.sh # Reads the CLI's own config if env vars are absent. Creates + deletes a base # named "cli-smoke-"; safe to run against production. set -u CLI_DIR="$(cd "$(dirname "$0")/.." && pwd)" CLI="node $CLI_DIR/dist/bin.js" EP="${INKREACH_TEABLE_ENDPOINT:-$(python3 -c "import json;print(json.load(open('$HOME/.inkreach-teable/config.json')).get('endpoint',''))" 2>/dev/null || true)}" TOK="${INKREACH_TEABLE_TOKEN:-$(python3 -c "import json;print(json.load(open('$HOME/.inkreach-teable/config.json')).get('token',''))" 2>/dev/null || true)}" [ -z "$EP" ] || [ -z "$TOK" ] && { echo "need INKREACH_TEABLE_ENDPOINT/TOKEN (or ~/.inkreach-teable/config.json)"; exit 2; } export INKREACH_TEABLE_ENDPOINT="$EP" INKREACH_TEABLE_TOKEN="$TOK" FAILPAT='Cannot (GET|POST|PUT|PATCH|DELETE)|HTTP_404|unknown option|unknown command|Missing required|expected [a-z]+, received' PASS=0; FAIL=0; FAILED_CASES=() smoke() { # smoke