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
74 lines
2.8 KiB
JavaScript
74 lines
2.8 KiB
JavaScript
"use strict";
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.configPath = exports.resolveConfig = exports.writeConfigFile = exports.readConfigFile = exports.DEFAULT_ENDPOINT = void 0;
|
|
/**
|
|
* Config storage for inkreach CLI.
|
|
*
|
|
* Stores endpoint + token at ~/.inkreach/config.json, with environment variable
|
|
* overrides INKREACH_ENDPOINT / INKREACH_TOKEN. The --endpoint / --token / --base-id
|
|
* global flags take the highest precedence (handled by resolveOptions()).
|
|
*/
|
|
const fs = __importStar(require("node:fs"));
|
|
const path = __importStar(require("node:path"));
|
|
const os = __importStar(require("node:os"));
|
|
const CONFIG_DIR = path.join(os.homedir(), '.inkreach');
|
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
exports.DEFAULT_ENDPOINT = 'http://localhost:3000';
|
|
function readConfigFile() {
|
|
try {
|
|
const raw = fs.readFileSync(CONFIG_FILE, 'utf8');
|
|
return JSON.parse(raw);
|
|
}
|
|
catch {
|
|
return {};
|
|
}
|
|
}
|
|
exports.readConfigFile = readConfigFile;
|
|
function writeConfigFile(cfg) {
|
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
}
|
|
const merged = { ...readConfigFile(), ...cfg };
|
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(merged, null, 2) + '\n', { mode: 0o600 });
|
|
}
|
|
exports.writeConfigFile = writeConfigFile;
|
|
function resolveConfig(overrides) {
|
|
const file = readConfigFile();
|
|
return {
|
|
endpoint: overrides?.endpoint ||
|
|
process.env.INKREACH_ENDPOINT ||
|
|
file.endpoint ||
|
|
exports.DEFAULT_ENDPOINT,
|
|
token: overrides?.token || process.env.INKREACH_TOKEN || file.token || '',
|
|
baseId: overrides?.baseId || process.env.INKREACH_BASE_ID || file.baseId,
|
|
};
|
|
}
|
|
exports.resolveConfig = resolveConfig;
|
|
function configPath() {
|
|
return CONFIG_FILE;
|
|
}
|
|
exports.configPath = configPath;
|