Files
inkreach-teable-cli/src/bin.ts
T
yeuimu 0891bda134 feat(cli): add inkreach-teable plugin commands
plugin list: list registered plugins (id/name/status/runtimeType)
plugin register: register by URL (--name --url --positions)
plugin config list: list base configs (pluginId/tableId/enabled/form/write)
plugin config enable/disable: enable/disable per table or base-wide

Added 5 client methods: getPlugins, registerPlugin, listPluginConfigs,
upsertPluginConfig for CRUD.
2026-08-06 09:03:04 +08:00

49 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
/**
* inkreach-teable — 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 { pluginCommand } from './commands/plugin';
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-teable')
.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-teable ${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());
program.addCommand(pluginCommand());
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);
});