From e584b7ebbed902baed90ab67912a7972b8e29072 Mon Sep 17 00:00:00 2001 From: yeuimu <2197651308@qq.com> Date: Wed, 30 Sep 2026 03:59:39 +0000 Subject: [PATCH] =?UTF-8?q?feat(cli):=20=E5=8F=82=E6=95=B0=E5=88=AB?= =?UTF-8?q?=E5=90=8D=E6=94=B6=E5=B0=BE=20+=20=E5=85=A8=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=86=92=E7=83=9F=E5=A5=97=E4=BB=B6=20(0.1.6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - field list/get、view list、preset list 接受 --table-id(位置参数之外) - record get/list 接受 --take/--skip 别名(= --page-size/--page 的原始偏移) - scripts/smoke-commands.sh: 全命令冒烟套件,一次性验证所有 CLI 命令 无幻影路由/无 CLI 语法错/无 CLI 请求形状错(80/80 通过,含 8 种触发器、 preset/secret/subscription/plugin 只读命令) - 轨迹依据: iteration-4 中 agent 猜 --table-id/--take 被拒,别名后归零 --- package.json | 2 +- scripts/smoke-commands.sh | 181 ++++++++++++++++++ .../inkreach-teable/guides/cli-reference.md | 4 +- src/commands/resources.ts | 48 +++-- 4 files changed, 219 insertions(+), 16 deletions(-) create mode 100755 scripts/smoke-commands.sh 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