createConnectorCli (src/cli.ts)

sync-engine · packages/protocol/src/cli.ts · typescript · Apache-2.0
cli, tag:knn-classified

Builds a CLI for data connectors, providing spec, check, setup, teardown, discover, and read commands.

// Source: https://github.com/stripe/sync-engine | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { readFileSync } from 'node:fs'
import { defineCommand, runMain } from 'citty'
import type { CommandDef } from 'citty'
import type { Source, Destination, DestinationInput } from './protocol.js'
import { parseNdjsonChunks, writeLine } from './ndjson.js'

// MARK: - Config parsing

/**
 * Parse a value as inline JSON or read it as a file path.
 * If the string starts with `{` or `[`, parse as JSON inline.
 * Otherwise, treat as a file path and read + parse.
 */
function parseJsonOrFile(value: string): Record<string, unknown> {
  const trimmed = value.trim()
  if (trimmed.startsWit

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key