diff --git a/package.json b/package.json index 366f9d0..10783b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@inkreach/inkreach-teable", - "version": "0.1.5", + "version": "0.1.6", "description": "CLI (command: inkreach-teable) for operating inkreach-teable: tables, fields, records, views, and the self-built automation engine (8 triggers + 7 actions).", "license": "MIT", "type": "commonjs", diff --git a/scripts/smoke-commands.sh b/scripts/smoke-commands.sh new file mode 100755 index 0000000..7f0bc64 --- /dev/null +++ b/scripts/smoke-commands.sh @@ -0,0 +1,181 @@ +#!/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