feat(core): organisations and targets shared by every module, -c org:context, module link #3

Merged
crapougnax merged 4 commits from feat/contexts into develop 2026-11-07 07:36:10 +00:00
Member

One tycho manages several targets; the list belongs to the core, not to each module.

Content

  • tycho context list|add <dir>|use <name>|current|remove <name>: a target is registered under metadata.name of its target.yaml, with its engine (spec.engine: kubernetes or podman). Stored in ~/.config/tycho/targets.json (0600; TYCHO_CONFIG_DIR overrides).
  • Every module command accepts --target <name> (else TYCHO_TARGET, else the current target; never a guess). The core removes the flag and hands the target to the module: ctx.target, ctx.targetError, and TYCHO_TARGET_NAME|PATH|ENGINE in its env. An explicitly requested unknown target fails in the core.
  • tycho module link <dir>: runs a module from a local working copy (symlink, lock entry link:<path>), with the same contract checks as a published module. Used to test modules before they are published.
  • RFC-001: amendment Cibles multiples; README EN/FR: Targets, Module development, new variables.

Checks

  • bun test: 18 tests (7 new: registration, resolution order, refusals, flag extraction, link, target hand-over to a module).
  • tsc --noEmit OK.
  • End to end with the compiled core and @tycho/orchestration linked from tycho/modules#1: contexts, --target, TYCHO_TARGET, podman target refused by orchestration, unknown target refused.

Pairs with tycho/modules#1 (the module uses ctx.target).

🤖 Generated with Claude Code

One `tycho` manages several targets; the list belongs to the core, not to each module. ## Content - `tycho context list|add <dir>|use <name>|current|remove <name>`: a target is registered under `metadata.name` of its `target.yaml`, with its engine (`spec.engine`: kubernetes or podman). Stored in `~/.config/tycho/targets.json` (0600; `TYCHO_CONFIG_DIR` overrides). - Every module command accepts `--target <name>` (else `TYCHO_TARGET`, else the current target; never a guess). The core removes the flag and hands the target to the module: `ctx.target`, `ctx.targetError`, and `TYCHO_TARGET_NAME|PATH|ENGINE` in its env. An explicitly requested unknown target fails in the core. - `tycho module link <dir>`: runs a module from a local working copy (symlink, lock entry `link:<path>`), with the same contract checks as a published module. Used to test modules before they are published. - RFC-001: amendment *Cibles multiples*; README EN/FR: Targets, Module development, new variables. ## Checks - `bun test`: 18 tests (7 new: registration, resolution order, refusals, flag extraction, link, target hand-over to a module). - `tsc --noEmit` OK. - End to end with the compiled core and `@tycho/orchestration` linked from tycho/modules#1: contexts, `--target`, `TYCHO_TARGET`, podman target refused by orchestration, unknown target refused. Pairs with tycho/modules#1 (the module uses `ctx.target`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- tycho context list|add|use|current|remove: one tycho manages several
  targets; a target is registered under the name of its target.yaml, with
  its engine (kubernetes or podman);
- every module command accepts --target <name> (else TYCHO_TARGET, else the
  current target, never a guess); the core removes the flag and hands the
  target to the module (ctx.target, ctx.targetError, TYCHO_TARGET_* env);
- tycho module link <dir>: run a module from a local working copy, with the
  same contract checks as a published one;
- RFC-001: amendment "Cibles multiples".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An organisation groups the targets of one instance (a customer, a company);
single-organisation users stay on "default".
- tycho org list|use|current; tycho context list [--all] | add | use |
  current | remove accept name or org/name, and --org;
- a target's organisation comes from metadata.organization of its
  target.yaml, else --org, else the current one; its id org/name is unique
  on the workstation (two organisations may each have a "production");
- module commands accept --org and --target (else TYCHO_ORG, TYCHO_TARGET,
  else the current organisation and target); modules receive org and id,
  also as TYCHO_TARGET_ORG and TYCHO_TARGET_ID;
- targets.json format 2; README EN/FR and RFC-001 amendment updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-bot changed title from feat(core): targets shared by every module, and module link to feat(core): organisations and targets shared by every module, -c org:context, module link 2026-11-06 20:38:00 +00:00
- target references accept org:name besides name and org/name;
- before the command: -c <org>:<context> (or -c <context>), -o <org>;
  after it, -c and -o stay with the module (git uses them), only the long
  options are read: --context (alias of --target) and --org;
- a selection given twice with different values is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- before each module command, the organisation and context are printed on
  stderr; -q, TYCHO_BANNER=0 or tycho config set banner off hide them;
- tycho config list | set banner on|off (~/.config/tycho/config.json);
- ctx.confirm(action) for modules: names the target, true only on an
  explicit yes; without a terminal no, unless TYCHO_ASSUME_YES=1;
- module remove and context remove ask for confirmation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crapougnax merged commit b5bcef934e into develop 2026-11-07 07:36:10 +00:00
crapougnax deleted branch feat/contexts 2026-11-07 07:36:10 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
tycho/tycho!3
No description provided.