Skip to content

relix source and relix connection: add, ls, edit, rm, test from flags #57

Closed

Description

@david-Darkcollective

Commands to declare data without hand-writing catalog files. The two nouns mirror the language's two declarations: a source is a relation, a connection is what several sources share (a database, an authenticated API). Both take add | ls | edit | rm | test. Views and defs get no command: they are Relix code, and an editor is the tool for code.

This issue is flags only. Interactive prompts, which need the engine to describe each source kind's options, come later and are not part of it.

relix source add Orders csv ./data/orders.csv --header --infer-schema
relix connection add warehouse database --url='${WAREHOUSE_URL}' \
    --user='${WAREHOUSE_USER}' --password='${WAREHOUSE_PASSWORD}'
relix source add Stock warehouse --table=STOCK --infer-schema
relix source ls                 # rows: name, kind, location, file
relix source test               # rows: name, status, problem
relix source edit Orders --editor
relix source rm Orders

add takes NAME KIND|CONNECTION [LOCATION], every other option of the declaration as a flag. A missing required value is a usage error (exit 2) naming the flag. A name an outer level already declares is allowed (§5.2, an overlay) but warned about, naming the file it shadows. --infer-schema reads a sample and writes a schema { … }. Secrets are written as ${…} placeholders, never values, and never accepted on the command line.

Where declarations go. Each add writes one declaration to its own file, catalog/00-source-<name>.relix or catalog/00-connection-<name>.relix, printed through ScriptFormatter so it reads like hand-written code. One declaration per file is what makes rm and edit safe. A name declared in a hand-written file beside other declarations is reported, not touched: rm and edit exit 2 with the file and line (catalog where's answer), and edit suggests --editor, which opens $EDITOR at that line.

rm refuses (exit 2) when another declaration reads the name, listing them, unless --force. It removes only the nearest level's declaration and says when a farther one now shows through.

test reads one row from each named source (all by default) under the active profile and reports per source: driver or connector installed, every placeholder resolves, location reachable, declared schema matches what was read. Output is rows; exit 0 when all pass, 5 (environment) otherwise. connection test opens and closes each connection.

Writes follow the trust rule in the profiles issue.

Done when

Every verb of both commands works from flags against CSV, JSON and a JDBC connection, round-trips through ls/test, refuses the cases above with exit 2, and leaves a trusted project trusted.

Activity

  1. added this to the 1.0.0 milestone on Oct 14, 2026
  2. github-actions commented on Oct 16, 2026

    @github-actions

    Done in #61, merged to develop (e6fcaa8).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliThe relix command itselfenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions