Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
Release v0.46.2
Louis Choquelb2508e7ef281
diff --git a/.badges/tests.json b/.badges/tests.jsonindex 1f308307a..c08c8d152 100644--- a/.badges/tests.json+++ b/.badges/tests.json@@ -1,7 +1,7 @@{"schemaVersion": 1,"label": "tests",- "message": "10502",+ "message": "10517","color": "blue","cacheSeconds": 300}\ No newline at end of filediff --git a/.drift/acks/cli-docs.toml b/.drift/acks/cli-docs.tomlindex c2889fe0e..7e9568718 100644--- a/.drift/acks/cli-docs.toml+++ b/.drift/acks/cli-docs.toml@@ -1,8 +1,8 @@contract = "cli-docs"-digest = "sha256:ef75f1a9eff0100feb5e38e6e522fd22e4363680c3bd9487734f38bd6acb7c39"-reviewed_by = "Louis Choquel"-reviewed_at = "2026-08-17T19:54:27Z"-rationale = "Reviewed docs/tools/cli/ and the agent-CLI contract doc against a docstring-only correction in migrate_cmd.py. No surface moved - no flag, format, stream, structured field or exit code - so nothing in either target went stale by omission. Checked them for the specific claim the correction removes: the module docstring had said the transaction refuses where the rehearsal and the write pass disagree, which conflated two windows of very different widths. The agent CLI cannot be affected at all, since it is single-pass (dry_run = not yes) and has no confirmation window to edit a file during, and its contract doc makes no two-pass claim. migrate.md is likewise not falsified: it documents the backup and the atomic replace, both accurate, and never promises that the previewed report is what gets applied. What migrate.md could gain is a new sentence telling the user the files are re-read after they answer, and that is deliberately held rather than written now: whether the rehearsal should bind the write is an open design question recorded in wip/migrator-pr-1117-review-followups.md, and documenting behavior that may change is how a doc goes stale on purpose."+digest = "sha256:530a92f6f7fc70d71971da1903871a8504ee180563edca29af83118ba74f6cfe"+reviewed_by = "Claude (Opus 5 (1M context))"+reviewed_at = "2026-08-18T12:29:11Z"+rationale = "init_config now writes a .pipelex/.gitignore, so pipelex init has a new user-visible artifact. Found one stale target and fixed it: the What Gets Initialized list in docs/tools/cli/init.md is a set claim about what the command creates, and it rots by omission - the new file appears nowhere in it - so I added the entry rather than leaving the list quietly incomplete. Also extended the backup section of docs/tools/cli/migrate.md, since migrate ensures the same file for a directory that predates it. Re-derived the reach and the guard from the code rather than from any docstring: both pipelex init and pipelex-agent init call init_config, and both migrate commands call migrate_config_directories, so the write is on every path; each call site guards it with 'if not dry_run', and agent_migrate_cmd passes dry_run = not yes while the bare command's first pass is dry_run=True, which is what keeps the agent-CLI contract's claim that migrate writes only with --yes true. No flag, format, stream, structured field, verdict or exit code moved, so pipelex/cli/agent_cli/CLAUDE.md needed no edit - I checked its migrate report contract line and its migrate command-table row specifically."[trigger_files]"pipelex/cli/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"@@ -92,7 +92,7 @@ rationale = "Reviewed docs/tools/cli/ and the agent-CLI contract doc against a d"pipelex/cli/commands/init/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/init/backends.py" = "blob:1618d4f7f16c6d5a814680b17185501fade9f3fd""pipelex/cli/commands/init/command.py" = "blob:21c700c66b9c608e14e6bb373c40d37c241ea509"-"pipelex/cli/commands/init/config_files.py" = "blob:6e926eb3beb3c12a38d25f34c10e7b5ab6a7a99a"+"pipelex/cli/commands/init/config_files.py" = "blob:c13be6b8d2a8b211ce9ef0f4889ee131ffc3d2d8""pipelex/cli/commands/init/credentials.py" = "blob:7475c3082b8ee7530a76a52a8ab8bf18a7e21209""pipelex/cli/commands/init/ide_extension.py" = "blob:b1ff7341253a56a8cbccfccce7b14d9053cd5b16""pipelex/cli/commands/init/routing.py" = "blob:e8206196776ae43c12804ac74f770e72a681e1b6"diff --git a/.test_durations b/.test_durationsindex 242d76401..13bd8d5cd 100644--- a/.test_durations+++ b/.test_durations@@ -6259,6 +6259,21 @@"tests/unit/pipelex/migration/test_backend_directory_walk.py::TestAFreshMachinesBackendDirectory::test_a_dry_run_over_it_finds_every_file_and_reports_them_all_clean": 1.5752,"tests/unit/pipelex/migration/test_backend_directory_walk.py::TestAFreshMachinesBackendDirectory::test_a_misspelled_setting_in_one_of_them_is_named_by_the_walk": 1.703,"tests/unit/pipelex/migration/test_backend_directory_walk.py::TestAFreshMachinesBackendDirectory::test_every_backend_definition_is_claimed_and_the_documentation_beside_them_is_not": 0.774,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestARealRunEnsuresIt::test_a_dry_run_init_writes_it_no_more_than_it_writes_anything_else": 1.1726,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestARealRunEnsuresIt::test_a_dry_run_writes_nothing": 1.1758,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestARealRunEnsuresIt::test_every_walked_directory_gets_one": 1.203,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestARealRunEnsuresIt::test_initializing_a_config_directory_writes_it": 1.1641,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestARealRunEnsuresIt::test_migrating_a_directory_leaves_the_rule_behind": 1.2049,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestBackupIgnorePattern::test_a_rescue_copy_stays_visible": 1.1969,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestBackupIgnorePattern::test_it_does_not_hide_a_real_configuration_file": 1.1945,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestBackupIgnorePattern::test_it_leaves_a_copy_the_user_named_themselves_alone": 1.2,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestBackupIgnorePattern::test_it_matches_a_name_the_backup_module_actually_writes": 1.1902,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestBackupIgnorePattern::test_it_matches_every_file_a_real_walk_can_back_up": 1.1946,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestEnsureConfigDirGitignore::test_a_directory_that_does_not_exist_is_left_alone": 1.216,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestEnsureConfigDirGitignore::test_it_never_touches_a_gitignore_that_is_already_there": 1.1966,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestEnsureConfigDirGitignore::test_it_writes_the_file_when_the_directory_has_none": 1.1907,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestEnsureConfigDirGitignore::test_running_it_twice_is_running_it_once": 1.1856,+ "tests/unit/pipelex/migration/test_config_dir_gitignore.py::TestEnsureConfigDirGitignore::test_the_file_it_writes_actually_ignores_a_backup": 1.1807,"tests/unit/pipelex/migration/test_coverage_gate.py::TestEntryAccounting::test_a_correct_rename_entry_is_green": 0.0028,"tests/unit/pipelex/migration/test_coverage_gate.py::TestEntryAccounting::test_a_delete_table_aimed_at_a_key_is_dead": 0.0029,"tests/unit/pipelex/migration/test_coverage_gate.py::TestEntryAccounting::test_a_misspelled_destination_is_caught": 0.0023,diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 012418d2e..7de24ef40 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,11 @@# Changelog+## [v0.46.2] - 2026-08-18++### Fixed++- **Migration backups no longer dirty your repository:** `pipelex migrate` copies every file it rewrites to `<file>.bak.<timestamp>` beside the original, and inside a project's `.pipelex/` those copies showed up as untracked files in `git status` — a dozen of them after a single run. Pipelex now keeps a `.gitignore` inside the configuration directory itself, ignoring exactly the timestamped copies it makes; it is written by `pipelex init` and by any real `pipelex migrate`, so a machine whose `.pipelex/` predates this gets the rule from the run that would otherwise have made the mess. An existing `.gitignore` there is never modified, and a `.rescue.` copy is deliberately left visible because it is the one the report asks you to go and collect.+## [v0.46.1] - 2026-08-18### Changeddiff --git a/docs/migration-ledger.md b/docs/migration-ledger.mdindex eed3a198f..2f4d442ca 100644--- a/docs/migration-ledger.md+++ b/docs/migration-ledger.md@@ -673,6 +673,10 @@ Always back up, before writing. Exactly one backup per file — a successful runThe name is the source file's whole name, extension included, followed by `.bak.` and a compact UTC stamp: `pipelex.toml` backs up to `pipelex.toml.bak.20260815T120000Z`. Extension-included so a backup never shadows a real `.toml`, and separator-free so no filesystem objects to it. Pruning matches that whole shape, stamp included — a copy the user made by hand under a name that merely starts the same way (`pipelex.toml.bak.notes`) is theirs, and is never touched.+**A backup does not belong in the user's `git status`, and pipelex writes the rule that keeps it out.** A project's `.pipelex/` is normally inside a git repository, so one run would otherwise put a dozen untracked `.bak.<stamp>` files in front of the user and leave them to work out which are ours. Pipelex therefore keeps a `.gitignore` *inside* the configuration directory, carrying one rule — `*.bak.[0-9]*Z`, built from the same infix and stamp shape the namer uses, so renaming either cannot leave a rule that matches nothing. In-directory rather than in the repository root because the walk is `~/.pipelex/` and the project `.pipelex/` and nothing else: every backup a migration can write inside a repository is already under a directory pipelex owns, which makes a local file a complete answer that needs no idea where the root is and never edits a file the user maintains for their whole project.++The file is written by `pipelex init`, and by any real (non-`--dry-run`) `pipelex migrate` — the second so that a machine whose `.pipelex/` predates this gets the rule from the very run that would otherwise dirty it. It is **create-if-absent and nothing more**: once a `.gitignore` is there it is a file in the user's repository, possibly theirs, possibly ours with a line taken out on purpose, and re-asserting a rule into it every run would be a tool arguing with its user. Two omissions are deliberate. A `.rescue.` copy is **not** ignored — it exists only because a write could not be vouched for and the report tells the user to go and get it, so turning up in `git status` is that reminder working. Neither is a copy the user named themselves: pruning already refuses to touch a `pipelex.toml.bak.notes` on the grounds that it is theirs, and hiding it from their own `git status` would be the same mistake pointed the other way.+The order of the three steps is itself a guarantee. The backup is written **first**, so there is never a moment with a rewritten file and no copy of the original; the older backups are pruned **last**, so there is never a moment with no backup at all; and a write that fails before touching the file takes its own fresh backup with it, so a failed run leaves the directory exactly as it found it. Nothing that happens after the file is written can un-write it in the report: an older backup that will not prune, or a temp file the transaction could not remove, is a warning on a migrated file, never a blocked one.Three further rules make that safety net worth the name.diff --git a/docs/tools/cli/init.md b/docs/tools/cli/init.mdindex 3b32c1941..699f723d0 100644--- a/docs/tools/cli/init.md+++ b/docs/tools/cli/init.md@@ -65,6 +65,7 @@ This command creates or resets a Pipelex config directory with:- `backends/` - Individual backend configuration files- `deck/` - AI model aliases and presets- **telemetry.toml** - Telemetry and observability settings+- **.gitignore** - Keeps Pipelex's own transient copies out of your `git status` — the timestamped `.bak` files [`pipelex migrate`](migrate.md) leaves beside each file it rewrites. Commit it so your teammates get the same. It is written only when the directory has no `.gitignore`; one already there is never modified.!!! warning "Init writes a fresh file — it does not update one"Every `init` target replaces the file with the template, so whatever was in it is gone. If a configuration file has simply fallen behind the current schema, [`pipelex migrate`](migrate.md) is the command: it rewrites the file in place and keeps every setting — your PostHog key, your Langfuse credentials, your exporters. `pipelex doctor` tells you which of the two you have.diff --git a/docs/tools/cli/migrate.md b/docs/tools/cli/migrate.mdindex 206787c2d..b9a7fb2cd 100644--- a/docs/tools/cli/migrate.md+++ b/docs/tools/cli/migrate.md@@ -32,6 +32,8 @@ Within a file it repairs, it only ever undoes a change *we* made. A key you addeEvery file it changes is copied first, beside itself, as `<file>.bak.<UTC timestamp>` — with the original file's permissions, not your umask. The copy is on disk before the file is replaced, and the replacement is atomic: there is never a moment when your configuration is half-written.+Those copies are ours, not part of your project, so the command keeps them out of your way: it writes a `.gitignore` inside the configuration directory itself, ignoring exactly the timestamped copies it makes. You will see the `.gitignore` — commit it, and your teammates get the same quiet. If you already have one there, it is left alone. A `<file>.rescue.<timestamp>` copy is deliberately *not* ignored: one of those only exists because a write could not be vouched for, and seeing it is how you find out.+Running it twice is the same as running it once. Nothing is skipped on the basis of a version record, because there is no version record; every run replays the whole history and leaves alone whatever is already current. A file that is already up to date comes back byte for byte identical.## When it cannot do the whole jobdiff --git a/pipelex/cli/commands/init/config_files.py b/pipelex/cli/commands/init/config_files.pyindex 6e926eb3b..c13be6b8d 100644--- a/pipelex/cli/commands/init/config_files.py+++ b/pipelex/cli/commands/init/config_files.py@@ -5,6 +5,7 @@ from pathlib import Pathfrom pipelex.cli.exceptions import PipelexCLIErrorfrom pipelex.kit.paths import GIT_IGNORED_CONFIG_FILES, get_kit_configs_dir+from pipelex.migration.gitignore import ensure_config_dir_gitignorefrom pipelex.system.configuration.config_loader import config_managerfrom pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME@@ -33,6 +34,11 @@ def init_config(*, reset: bool = False, dry_run: bool = False, target_dir: Pathtarget_config_dir.mkdir(parents=True, exist_ok=True)+ if not dry_run:+ # Before anything is copied in, so the directory is never briefly a source of untracked+ # noise. `pipelex migrate` ensures the same rule for a directory that predates it.+ ensure_config_dir_gitignore(directory=target_config_dir)+try:copied_files: list[str] = []existing_files: list[str] = []diff --git a/pipelex/migration/gitignore.py b/pipelex/migration/gitignore.pynew file mode 100644index 000000000..f4e03cb19--- /dev/null+++ b/pipelex/migration/gitignore.py@@ -0,0 +1,95 @@+"""The `.gitignore` pipelex keeps inside the configuration directory it owns.++A migration copies every file before it rewrites it, and that copy lands beside the original —+inside `.pipelex/`, which in a real project is inside a git repository. Without a rule, one+`pipelex migrate` puts a dozen untracked `.bak.<stamp>` files into the user's `git status`, and+the user is left to work out which of them are ours and write the pattern themselves. Each of+them writes a slightly different one, or forgets, and a tool that dirties a repository every time+it runs stops getting run.++**Why the rule lives here and not in the user's root `.gitignore`.** The walk is the global+`~/.pipelex/` and the project `.pipelex/`, and nothing else (see `run.py`), so every backup a+migration can ever write inside a repository is under a directory pipelex already owns. That makes+a `.gitignore` *in* that directory a complete answer — it needs no knowledge of where the+repository root is, survives the directory being moved or vendored, and never reaches into a file+the user maintains for their whole project.++**The pattern is derived from the namer, not retyped.** `BACKUP_INFIX` is what+`backup_path_for` actually writes; spelling `*.bak.…` again here would let a rename of the infix+leave a rule that silently matches nothing.++Two omissions are deliberate:++- **A `.rescue.` copy is not ignored.** It exists only because a write ended in a state the+ transaction could not describe, and the report tells the user to go and get it. Turning up in+ `git status` is that reminder working; hiding it would bury the one file that needs a human.+- **A copy the user named themselves — `pipelex.toml.bak.notes` — is not ignored.** Pruning+ already refuses to touch one of those, on the grounds that it is the user's file and not ours;+ hiding it from their own `git status` would be the same mistake in the other direction.++See `docs/migration-ledger.md` → "Backups".+"""++import os+from pathlib import Path++from pipelex.migration.backup import BACKUP_INFIX++CONFIG_DIR_GITIGNORE_NAME = ".gitignore"+"""What the file is called inside `~/.pipelex/` or a project's `.pipelex/`."""++BACKUP_IGNORE_PATTERN = f"*{BACKUP_INFIX}[0-9]*Z"+"""The one rule the file carries: any name ending in the infix, a digit-led run, and the UTC `Z`.++The digit and the trailing `Z` are what `BACKUP_STAMP_FORMAT` renders and what a name the user+chose does not, which is how `pipelex.toml.bak.notes` stays visible.+"""++_GITIGNORE_CONTENT = f"""\+# Written by pipelex when it set this directory up. Yours from here on — pipelex reads this file+# never, and rewrites it never. Delete a line and it stays deleted.+#+# The timestamped copy `pipelex migrate` takes of every file before it rewrites it. It is our own+# transient artifact; the durable history of these files is your commits.+#+# A `<file>.rescue.<stamp>` copy is deliberately NOT listed. One of those exists only because a+# write could not be vouched for, and seeing it in `git status` is how you find out.+{BACKUP_IGNORE_PATTERN}+"""+++def ensure_config_dir_gitignore(*, directory: Path) -> bool:+ """Put the file in a configuration directory that has none, and report whether this call did.++ Create-if-absent, and nothing else. Once a `.gitignore` is there it is a file in the user's+ repository — possibly one they wrote, possibly ours with a line taken out on purpose — and+ re-asserting our rule into it every run would be a tool arguing with its user. So an existing+ file is left byte for byte alone, which also makes this idempotent for free.++ The create is exclusive rather than an `exists()` test followed by a write, for the same reason+ `backup._reserve_name` is: between the check and the write another run can place the file, and+ the write would silently take it away.++ A directory that is not there is not created. A migration walk skips a configuration directory+ that does not exist, and ensuring a rule inside one must not be the thing that conjures it.+ """+ if not directory.is_dir():+ return False+ path = directory / CONFIG_DIR_GITIGNORE_NAME+ try:+ descriptor = os.open(path, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o666)+ except FileExistsError:+ return False+ except OSError:+ # A read-only or otherwise unwritable configuration directory is the user's business, and+ # a missing convenience rule is never a reason to fail the migration that was asked for.+ return False+ try:+ with os.fdopen(descriptor, "w", encoding="utf-8") as handle:+ handle.write(_GITIGNORE_CONTENT)+ handle.flush()+ os.fsync(handle.fileno())+ except OSError:+ path.unlink(missing_ok=True)+ return False+ return Truediff --git a/pipelex/migration/run.py b/pipelex/migration/run.pyindex fc4ea9ac7..0e8b4356a 100644--- a/pipelex/migration/run.py+++ b/pipelex/migration/run.py@@ -32,6 +32,7 @@ See `docs/migration-ledger.md` → "Surfaces" and "Applying".from pathlib import Path+from pipelex.migration.gitignore import ensure_config_dir_gitignorefrom pipelex.migration.ledger import packaged_migration_dirfrom pipelex.migration.plan import MigrationReportfrom pipelex.migration.runner import migrate_directories@@ -57,7 +58,17 @@ def migrate_config_directories(*, config_dirs: list[Path], dry_run: bool) -> MigThe registry and the ledger directory are the package's own, which is what makes this thereal run rather than a gate's rehearsal over synthetic models.++ A real run is also where each walked directory gets the `.gitignore` that keeps the backups+ it is about to write out of the user's `git status` — here rather than in `migrate_directories`+ on purpose, because that function is replayed by the gates over documents that are never+ written anywhere, and a filesystem side effect there would follow them. A user who already had+ a `.pipelex/` before this shipped therefore gets the rule from the very run that would+ otherwise dirty their repository, and not only from a fresh `init`."""+ if not dry_run:+ for directory in config_dirs:+ ensure_config_dir_gitignore(directory=directory)return migrate_directories(registry=build_config_surface_registry(),migration_dir=packaged_migration_dir(),diff --git a/pyproject.toml b/pyproject.tomlindex 7c973199a..c764884cd 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,6 +1,6 @@[project]name = "pipelex"-version = "0.46.1"+version = "0.46.2"description = "Execute composable AI methods declared in the MTHDS open standard"authors = [{ name = "Evotis S.A.S.", email = "[email protected]" }]maintainers = [{ name = "Pipelex staff", email = "[email protected]" }]diff --git a/tests/unit/pipelex/migration/test_config_dir_gitignore.py b/tests/unit/pipelex/migration/test_config_dir_gitignore.pynew file mode 100644index 000000000..b8c983d60--- /dev/null+++ b/tests/unit/pipelex/migration/test_config_dir_gitignore.py@@ -0,0 +1,140 @@+"""Unit tests for the `.gitignore` pipelex keeps inside the configuration directory it owns.++The rule under test is narrow on purpose: a backup is pipelex's own transient copy and has no+business in a user's `git status`, while a `.rescue.` copy exists precisely because a write could+not be vouched for — turning up in `git status` is how the user finds out it is there.+"""++from datetime import UTC, datetime+from fnmatch import fnmatch+from pathlib import Path++from pipelex.cli.commands.init.config_files import init_config+from pipelex.migration.backup import backup_path_for, rescue_path_for+from pipelex.migration.gitignore import (+ BACKUP_IGNORE_PATTERN,+ CONFIG_DIR_GITIGNORE_NAME,+ ensure_config_dir_gitignore,+)+from pipelex.migration.run import migrate_config_directories++MOMENT = datetime(2026, 8, 18, 12, 14, 41, tzinfo=UTC)+++class TestBackupIgnorePattern:+ def test_it_matches_a_name_the_backup_module_actually_writes(self, tmp_path: Path) -> None:+ """Derived from the real namer, so renaming the infix or restamping cannot orphan the rule."""+ backup = backup_path_for(path=tmp_path / "pipelex_override.toml", moment=MOMENT)++ assert fnmatch(backup.name, BACKUP_IGNORE_PATTERN)++ def test_it_matches_every_file_a_real_walk_can_back_up(self, tmp_path: Path) -> None:+ """The walk claims files by (directory, name), so the pattern must not lean on a stem."""+ for name in ("pipelex.toml", "pipelex_override.toml", "telemetry.toml", "anthropic.toml"):+ backup = backup_path_for(path=tmp_path / name, moment=MOMENT)+ assert fnmatch(backup.name, BACKUP_IGNORE_PATTERN), name++ def test_it_leaves_a_copy_the_user_named_themselves_alone(self) -> None:+ """`existing_backups_of` refuses to prune one of these; the ignore rule must not hide it."""+ assert not fnmatch("pipelex.toml.bak.notes", BACKUP_IGNORE_PATTERN)++ def test_a_rescue_copy_stays_visible(self, tmp_path: Path) -> None:+ """It is the one file the report tells the user to go and get — hiding it defeats the point."""+ rescue = rescue_path_for(path=tmp_path / "pipelex.toml", moment=MOMENT)++ assert not fnmatch(rescue.name, BACKUP_IGNORE_PATTERN)++ def test_it_does_not_hide_a_real_configuration_file(self) -> None:+ for name in ("pipelex.toml", "backends.toml", ".env"):+ assert not fnmatch(name, BACKUP_IGNORE_PATTERN), name+++class TestEnsureConfigDirGitignore:+ def test_it_writes_the_file_when_the_directory_has_none(self, tmp_path: Path) -> None:+ was_written = ensure_config_dir_gitignore(directory=tmp_path)++ assert was_written is True+ assert (tmp_path / CONFIG_DIR_GITIGNORE_NAME).read_text().splitlines()[-1] == BACKUP_IGNORE_PATTERN++ def test_the_file_it_writes_actually_ignores_a_backup(self, tmp_path: Path) -> None:+ """The end the whole change exists for, asserted against git itself rather than by eye."""+ ensure_config_dir_gitignore(directory=tmp_path)+ written = (tmp_path / CONFIG_DIR_GITIGNORE_NAME).read_text()++ assert any(fnmatch("pipelex_override.toml.bak.20260818T121441Z", line) for line in written.splitlines() if line and not line.startswith("#"))++ def test_it_never_touches_a_gitignore_that_is_already_there(self, tmp_path: Path) -> None:+ """Once the file exists it is a file in the user's repo, and theirs to maintain."""+ theirs = tmp_path / CONFIG_DIR_GITIGNORE_NAME+ theirs.write_text("# mine\nstorage/\n")++ was_written = ensure_config_dir_gitignore(directory=tmp_path)++ assert was_written is False+ assert theirs.read_text() == "# mine\nstorage/\n"++ def test_running_it_twice_is_running_it_once(self, tmp_path: Path) -> None:+ ensure_config_dir_gitignore(directory=tmp_path)+ first = (tmp_path / CONFIG_DIR_GITIGNORE_NAME).read_text()++ was_written = ensure_config_dir_gitignore(directory=tmp_path)++ assert was_written is False+ assert (tmp_path / CONFIG_DIR_GITIGNORE_NAME).read_text() == first++ def test_a_directory_that_does_not_exist_is_left_alone(self, tmp_path: Path) -> None:+ """A walk skips a directory that is not there; ensuring one must not conjure it."""+ absent = tmp_path / "not_a_config_dir"++ was_written = ensure_config_dir_gitignore(directory=absent)++ assert was_written is False+ assert not absent.exists()+++class TestARealRunEnsuresIt:+ """The wiring, asserted where it matters: a user who already has a `.pipelex/` gets the rule+ from the very run that would otherwise dirty their repository, not only from a fresh `init`.+ """++ def test_migrating_a_directory_leaves_the_rule_behind(self, tmp_path: Path) -> None:+ config_dir = tmp_path / ".pipelex"+ config_dir.mkdir()++ migrate_config_directories(config_dirs=[config_dir], dry_run=False)++ assert (config_dir / CONFIG_DIR_GITIGNORE_NAME).is_file()++ def test_a_dry_run_writes_nothing(self, tmp_path: Path) -> None:+ """`--dry-run` promises the disk is untouched, and a convenience file is still a write."""+ config_dir = tmp_path / ".pipelex"+ config_dir.mkdir()++ migrate_config_directories(config_dirs=[config_dir], dry_run=True)++ assert not (config_dir / CONFIG_DIR_GITIGNORE_NAME).exists()++ def test_every_walked_directory_gets_one(self, tmp_path: Path) -> None:+ global_dir = tmp_path / "home" / ".pipelex"+ project_dir = tmp_path / "project" / ".pipelex"+ for directory in (global_dir, project_dir):+ directory.mkdir(parents=True)++ migrate_config_directories(config_dirs=[global_dir, project_dir], dry_run=False)++ assert (global_dir / CONFIG_DIR_GITIGNORE_NAME).is_file()+ assert (project_dir / CONFIG_DIR_GITIGNORE_NAME).is_file()++ def test_initializing_a_config_directory_writes_it(self, tmp_path: Path) -> None:+ target = tmp_path / ".pipelex"++ init_config(reset=False, target_dir=target)++ assert (target / CONFIG_DIR_GITIGNORE_NAME).is_file()++ def test_a_dry_run_init_writes_it_no_more_than_it_writes_anything_else(self, tmp_path: Path) -> None:+ target = tmp_path / ".pipelex"++ init_config(reset=False, dry_run=True, target_dir=target)++ assert not (target / CONFIG_DIR_GITIGNORE_NAME).exists()diff --git a/uv.lock b/uv.lockindex f7d25d463..521d1b5be 100644--- a/uv.lock+++ b/uv.lock@@ -3303,7 +3303,7 @@ wheels = [[[package]]name = "pipelex"-version = "0.46.1"+version = "0.46.2"source = { editable = "." }dependencies = [{ name = "aiofiles" },diff --git a/wip/drift-contracts/dogfood-log.md b/wip/drift-contracts/dogfood-log.mdindex 6a42939bd..66eab8970 100644--- a/wip/drift-contracts/dogfood-log.md+++ b/wip/drift-contracts/dogfood-log.md@@ -113,3 +113,6 @@ The surviving finding is real and small: the table under "What a programmatic ca- **2026-08-17 · cli-docs · clean-pass** — Same merge. The trigger diff is PR #1115's `would_write` tri-state in `agent_output.py` and `error_handlers.py` plus the doctor's remaining Rich escaping, and both review targets arrived **rewritten in the same change** — which is the interesting case, because reading a freshly-updated doc against the change that updated it is exactly the two-documents-agreeing trap. So every claim was re-derived from the code instead: the field set `agent-cli.md` enumerates for the migration object is exactly what `MigrationErrorBlock` declares under `extra="forbid"`, its "present when and only when the scan found something" holds because the builder returns `None` on an empty or failed scan, and `would_write` is `any(plan.did_change)`. Both enumerated finding sets came from the enums rather than the table. The one claim worth the trouble was `migrate.md`'s quantified *nothing will ever suggest deleting an out-of-date file and starting over* — a set claim that could only have rotted by omission, and it survives, because the new false branch points at the dry run while the start-over line stayed on the no-block path where the file is wrong rather than old.Verdict signal: this contract now has a run of clean-passes, but the mechanism differs each time and the last two were not free — a doc that arrives pre-updated still needs its claims checked against the code, and that is not something a derived check could do.++- **2026-08-18 · cli-docs · real-catch** — Triggered by `init_config` gaining a call to `ensure_config_dir_gitignore`, the fix for `pipelex migrate` dropping untracked `.bak.<stamp>` files into a user's `git status`. The catch is the plainest kind and the kind grep cannot find: `docs/tools/cli/init.md`'s **What Gets Initialized** list is a set claim about what the command creates, and a new artifact falsifies it by *absence* — searching the target for `.gitignore` returns nothing, which reads identically to "not mentioned because not relevant". Only reading the page for its quantified claims surfaces it. Worth recording that the contract also earned its keep on a claim that turned out **fine**: `agent_cli/CLAUDE.md` states that `migrate` writes only with `--yes`, and a new write on the migrate path is exactly what would falsify that — re-derived from the code (`agent_migrate_cmd` passes `dry_run = not yes`; the bare command's first pass is `dry_run=True`; both call sites guard the new write with `if not dry_run`) rather than from the guard's own docstring, which is the artifact-not-prose rule applied to a claim I had written myself minutes earlier and was therefore the least trustworthy prose in the repo.+ Verdict signal: this breaks `cli-docs`'s run of clean-passes, and it does so on the cheapest possible trigger — a single new call in one CLI module. The contract opened on the right thing and pointed at the right page. No narrowing to propose.diff --git a/wip/init-yes-non-interactive-mode.md b/wip/init-yes-non-interactive-mode.mdnew file mode 100644index 000000000..45c1a73ce--- /dev/null+++ b/wip/init-yes-non-interactive-mode.md@@ -0,0 +1,41 @@+# `pipelex init` has no non-interactive mode, and it costs downstream repos their config hygiene++**Status:** Follow-up TODO, raised from the cocode v0.10.0 release (2026-08-18). Not a regression — `init` has never had the flag. Bounded, and `pipelex migrate` already ships the exact shape the fix needs.++## The gap++As of pipelex 0.46.1, `pipelex init --help` offers the `focus` argument (`all|agreement|config|credentials|inference|routing|telemetry`) and exactly two options: `--local / -l` and `--help`. There is no `--yes`, no `--skip-confirmation`, no non-interactive path of any kind.++Its sibling on the same CLI already has one. `pipelex migrate --help` offers `--dry-run` ("Report what would change and write nothing") and `--yes / -y` ("Apply without the interactive confirmation"). The vocabulary, the precedent and the user expectation all exist already; `init` simply never got it.++## Why this matters beyond ergonomics++A CI runner cannot call `pipelex init`. So any repo whose test suite boots Pipelex has to get a `.pipelex/` config into place some other way, and with no non-interactive init the only remaining way is to commit one into the repo.++cocode hit this concretely and the workaround is still load-bearing there. On 2026-06-05, inside its `release/v0.7.0` branch:++- 08:55 `1dd8831` — de-vendored `.pipelex/` entirely, on the stated reasoning "uses your global config unless you create a specific config"+- 08:56 `8ab1904` — added `.pipelex/` to `.gitignore`, the correct companion to that decision+- 12:52 `6c6c689` — "re-vendored config for CI": the files came back, forced past the ignore rule with `git add -f`, because CI has neither a global `~/.pipelex/` nor an init step+- 13:05 — squash-merged as `6b9b072`, which is why the merged history shows only a confusing net result rather than this sequence++As of 2026-08-18 cocode still force-tracks its `.pipelex/` directory past its own `.gitignore`, so that ignore line has been contradicting reality ever since. The practical cost is that every pipelex config-schema change lands in a cocode release diff as a wall of vendored TOML: the 0.46 config-root reshape plus the `prompting_target` removal dragged cocode's whole vendored backend directory into its v0.10.0 release. Note that `--disable-inference` does not sidestep any of this — it swaps in mock inference, it does not skip initialization.++## What the fix looks like++Give `init` the same treatment `migrate` already has, or at minimum `--yes`:++- `pipelex init --yes --local` writes a project `.pipelex/` with every prompt taking its default and no TTY required.+- CI runs that as a step ahead of its test target, and the downstream repo deletes its vendored config and keeps the honest `.gitignore` line it wrote in the first place.++Auto-detecting a non-TTY or `CI=true` environment is the obvious alternative, but an explicit flag is the safer contract: an `init` that silently writes files because it could not find a terminal is a worse surprise than one that refuses.++Recorded when this was last examined, against an earlier pipelex — **re-verify against 0.46.x before scoping**: `init_cmd` already accepted a `skip_confirmation` argument, and every init prompt already carried a usable `default=`. That is what made this look like wiring rather than a redesign.++## Downstream unblock++Once this ships and cocode re-pins to it:++- add `pipelex init --yes --local` to cocode's `tests-check.yml`, ahead of `make gha-tests`+- `git rm -r --cached .pipelex/` in cocode and let the existing ignore rule finally mean what it says+- cocode's `tests/conftest.py` boots Pipelex and needs config present; the specifics of that gate live in cocode's repo, not here