feat: add inkreach CLI + inkreach-teable-ops skill

A self-built CLI and companion agent skill for operating a deployed
inkreach-teable instance — configuring tables, fields, records, views, and
the project's OWN automation engine.

Why not the official 'teable' CLI:
  inkreach-teable's automation is self-built with a different contract:
  - conditions (not filter), fieldIds (not watchFieldIds)
  - recordCondition (not recordMatchesConditions)
  - webhook route /api/webhook/{baseId}/{wfId} (not the /base//workflow/ form)
  - scheduledTime backend honors only timing.type + timing.interval
  The official CLI targets the upstream contract and 404s/misconfigures here.
  Table/field/record/view APIs ARE upstream-compatible, but automation is not.

inkreach CLI (packages/inkreach-cli/):
  - Node.js + commander, zero extra runtime deps
  - Uses node:http (NOT fetch — Node 24 fetch drops Authorization header)
  - Commands: auth (login/status/token), base/table/field/record/view,
    workflow (list/get/create/update/delete/activate/deactivate/test),
    trigger set (8 types, builds correct config keys), action add/update/delete
    (6 types), secret, runs (list/get/rerun), fire (button-click/webhook), sql
  - --json mode for agent parsing; GET->modify->PUT whole-graph for node edits
  - Verified end-to-end: create workflow -> set webhook trigger -> add script
    action -> activate -> fire webhook -> runs list (succeeded)

inkreach-teable-ops skill (.agents/skills/inkreach-teable-ops/):
  - SKILL.md entry: module map, routing rules, 11 key constraints (the real
    contract keys), execution rules, error recovery
  - guides/: cli-reference, automation-guide, tables-fields, instance-access,
    development (build/restart, known gotchas)
  - api-reference/: trigger-types (8 triggers, exact config), action-types
    (6 actions, sandbox globals), field-types (21 types incl. Button)
  - metadata.json + install.sh
This commit is contained in:
yeuimu
2026-08-05 02:04:39 +08:00
commit 5fa843df05
24 changed files with 4380 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env node
/**
* inkreach — CLI for operating inkreach-teable.
*
* Entry point. Sets up the global commander program and mounts command groups.
*/
import { Command } from 'commander';
import { version } from '../package.json';
import { authCommand } from './commands/auth';
import { workflowCommand, triggerCommand, actionCommand } from './commands/workflow';
import { baseResourceCommands } from './commands/resources';
import { secretCommand, runsCommand, fireCommand, sqlCommand } from './commands/extras';
const program = new Command();
program
.name('inkreach')
.description(
'Operate inkreach-teable: tables, fields, records, views, and the self-built automation engine (8 triggers + 6 actions).\n' +
'Use --json for machine-readable output (agent parsing).'
)
.version(`inkreach ${version}`, '-v, --version');
// Global options (highest precedence over config file + env).
program
.option('--endpoint <url>', 'Backend URL (default http://localhost:3000)')
.option('--token <token>', 'Personal Access Token')
.option('--base-id <id>', 'Default base id')
.option('--json', 'Output raw JSON for agent parsing')
.option('--debug', 'Print requests/responses to stderr (verbose)');
// Command groups
program.addCommand(authCommand());
for (const c of baseResourceCommands()) program.addCommand(c);
program.addCommand(workflowCommand());
program.addCommand(triggerCommand());
program.addCommand(actionCommand());
program.addCommand(secretCommand());
program.addCommand(runsCommand());
program.addCommand(fireCommand());
program.addCommand(sqlCommand());
program.parseAsync(process.argv).catch((err) => {
process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
process.exit(1);
});