cfgit 0.4.6__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cfgit-0.4.6 → cfgit-0.5.0}/.gitignore +1 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/PKG-INFO +36 -11
- {cfgit-0.4.6 → cfgit-0.5.0}/README.md +31 -9
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/CONFIGURATION.md +83 -4
- cfgit-0.5.0/docs/HISTORY_CONTRACT.md +91 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/IDENTITY_AND_ATTRIBUTION.md +32 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/README.md +1 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/USAGE.md +135 -3
- {cfgit-0.4.6 → cfgit-0.5.0}/examples/seed_support_demo.py +314 -2
- cfgit-0.5.0/plugins/cfg_impact/cfg_impact/code_refs.py +58 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/overview.py +43 -3
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/pyproject.toml +2 -2
- {cfgit-0.4.6 → cfgit-0.5.0}/pyproject.toml +3 -2
- {cfgit-0.4.6 → cfgit-0.5.0}/skills/cfgit/SKILL.md +32 -3
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/__init__.py +9 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/adapters/base.py +2 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/adapters/mongo.py +38 -3
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/adapters/postgres.py +35 -10
- cfgit-0.5.0/src/cfg/api.py +81 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/cli/main.py +136 -12
- cfgit-0.5.0/src/cfg/core/codec.py +161 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/config.py +58 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/diff.py +9 -2
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/engine.py +582 -23
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/hashing.py +49 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/remedy.py +22 -0
- cfgit-0.5.0/src/cfg/core/validation.py +109 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/interfaces/actions.py +373 -39
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/mcp/server.py +128 -6
- cfgit-0.5.0/src/cfg/notify.py +66 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/ui/server.py +26 -11
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_engine_safety.py +23 -3
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_export_import.py +1 -1
- cfgit-0.5.0/tests/test_history_contract.py +92 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_mcp_identity.py +1 -1
- cfgit-0.5.0/tests/test_notify_and_code_refs.py +159 -0
- cfgit-0.5.0/tests/test_preserve_ignored.py +152 -0
- cfgit-0.5.0/tests/test_promote.py +143 -0
- cfgit-0.5.0/tests/test_races_live.py +359 -0
- cfgit-0.5.0/tests/test_record_lifecycle.py +161 -0
- cfgit-0.5.0/tests/test_record_lifecycle_live.py +98 -0
- cfgit-0.5.0/tests/test_review_fixes.py +297 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_set_fields.py +90 -1
- cfgit-0.5.0/tests/test_type_safety.py +214 -0
- cfgit-0.5.0/tests/test_type_safety_live.py +161 -0
- cfgit-0.5.0/tests/test_validation.py +171 -0
- cfgit-0.4.6/docs/screenshots/01-diff.png +0 -0
- cfgit-0.4.6/docs/screenshots/02-impact.png +0 -0
- cfgit-0.4.6/docs/screenshots/03-scoped-impact.png +0 -0
- cfgit-0.4.6/docs/screenshots/04-branches.png +0 -0
- cfgit-0.4.6/docs/screenshots/05-pull-request.png +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/.github/workflows/ci.yml +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/.github/workflows/publish.yml +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/CONTRIBUTING.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/CREDITS.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/LICENSE +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/NOTICE +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/SECURITY.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/ADAPTERS.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/AGENTS.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/BRANCHING_PLAN.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/PUBLISHING.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/SPEC.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/docs/SPEC_CORE.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/examples/.cfg.toml +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/examples/cfgit-support-demo.toml +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/README.md +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/providers/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/providers/base.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/providers/claude.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/providers/factory.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/providers/gemini.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/plugins/cfg_impact/cfg_impact/providers/openai_provider.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/adapters/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/approval/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/approval/base.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/cli/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/authz.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/core/identity.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/interfaces/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/mcp/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/ui/__init__.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/src/cfg/update.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_adapter_contract_live.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_authz.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_awareness.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_commit_dry_run.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_config.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_config_discovery.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_console_script.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_core_purity.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_hashing.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_identity.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_impact_boundary.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_mongo_history.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_output_mode.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_postgres_history.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_remedy.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_ui_server.py +0 -0
- {cfgit-0.4.6 → cfgit-0.5.0}/tests/test_update_check.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: cfgit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Git-style history, diff, drift detection, and rollback for live database records without migrating or owning your datastore
|
|
5
5
|
Project-URL: Homepage, https://github.com/AusafMo/cfgit
|
|
6
6
|
Project-URL: Repository, https://github.com/AusafMo/cfgit
|
|
@@ -218,6 +218,7 @@ Requires-Dist: click>=8.1; extra == 'cli'
|
|
|
218
218
|
Requires-Dist: rich>=13.0; extra == 'cli'
|
|
219
219
|
Provides-Extra: dev
|
|
220
220
|
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
221
|
+
Requires-Dist: jsonschema>=4.18; extra == 'dev'
|
|
221
222
|
Requires-Dist: mypy; extra == 'dev'
|
|
222
223
|
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
223
224
|
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
@@ -229,6 +230,8 @@ Provides-Extra: mongo
|
|
|
229
230
|
Requires-Dist: pymongo>=4.6; extra == 'mongo'
|
|
230
231
|
Provides-Extra: postgres
|
|
231
232
|
Requires-Dist: psycopg[binary]>=3.2; extra == 'postgres'
|
|
233
|
+
Provides-Extra: validate
|
|
234
|
+
Requires-Dist: jsonschema>=4.18; extra == 'validate'
|
|
232
235
|
Description-Content-Type: text/markdown
|
|
233
236
|
|
|
234
237
|
# cfgit
|
|
@@ -243,9 +246,9 @@ same database. Your scripts and admin tools can still write it. cfgit sits besid
|
|
|
243
246
|
the store, records what changed, and refuses to clobber changes it did not record.
|
|
244
247
|
|
|
245
248
|
<p align="center">
|
|
246
|
-
<img src="
|
|
247
|
-
<img src="
|
|
248
|
-
<img src="
|
|
249
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-diff.png" alt="Production-shaped support agent drift with collection stats, branch workflow controls, history, and line-aligned diff" width="32%" />
|
|
250
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-impact.png" alt="High-risk system-impact panel for a refund-resolution agent change with provider-backed LLM narration" width="32%" />
|
|
251
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-scoped-impact.png" alt="Scoped impact analysis with selected policy, eval, and rollout records plus provider-backed narration" width="32%" />
|
|
249
252
|
</p>
|
|
250
253
|
|
|
251
254
|
<p align="center">
|
|
@@ -253,8 +256,8 @@ the store, records what changed, and refuses to clobber changes it did not recor
|
|
|
253
256
|
</p>
|
|
254
257
|
|
|
255
258
|
<p align="center">
|
|
256
|
-
<img src="
|
|
257
|
-
<img src="
|
|
259
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-branches.png" alt="Branches workspace with a default runtime branch, a draft branch, and a branch with an open cfgit PR, plus a compare-branches selector" width="48%" />
|
|
260
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-pull-request.png" alt="Open cfgit pull request reviewing a policy-rule change on a draft branch with a line-aligned diff and merge action" width="48%" />
|
|
258
261
|
</p>
|
|
259
262
|
|
|
260
263
|
<p align="center">
|
|
@@ -466,7 +469,9 @@ cfg set modelgarden_models:openai/gpt-4o-mini enabled=true retry.max=3 -m "enabl
|
|
|
466
469
|
```
|
|
467
470
|
|
|
468
471
|
Values are JSON-coerced (`enabled=true` → bool, `n=5` → int, `tags=["a","b"]` → list);
|
|
469
|
-
prefix with `str:` to force a string (`version=str:1.0`).
|
|
472
|
+
prefix with `str:` to force a string (`version=str:1.0`). Edit one element of a list without
|
|
473
|
+
copying the whole list: `orgs+=abc123` appends it if absent (creating the array if the field is
|
|
474
|
+
missing) and `orgs-=abc123` removes every occurrence. Use `cfg edit <record>` to hand-edit
|
|
470
475
|
the whole document in `$EDITOR`.
|
|
471
476
|
|
|
472
477
|
Commit a full JSON document (add `--dry-run` to preview the field-level delta and exit
|
|
@@ -535,10 +540,23 @@ all runtime records, canonical history/head updates, and PR closure commit
|
|
|
535
540
|
together or roll back together.
|
|
536
541
|
|
|
537
542
|
`commit`, `import`, and `adopt` scan the would-be-stored document for secret-like
|
|
538
|
-
field names and values from `[secrets]
|
|
543
|
+
field names and values from `[secrets]` (name rules apply to string values only, so
|
|
544
|
+
`max_tokens = 4096` is not a secret). Fields listed in `secret_fields` are
|
|
539
545
|
stripped before history. Use `--allow-secret` only for intentional fixtures or
|
|
540
546
|
known false positives; cfgit records the override in history metadata.
|
|
541
547
|
|
|
548
|
+
A collection can declare `validate = { schema = "flags.json" }` (JSON Schema) or
|
|
549
|
+
`validate = { python = "module:fn" }`; every write path refuses a document that fails it, and
|
|
550
|
+
`cfg doctor` reports live documents that already do. See
|
|
551
|
+
[CONFIGURATION.md](docs/CONFIGURATION.md#validation).
|
|
552
|
+
|
|
553
|
+
Plain JSON has no dates, so documents that travel as files use MongoDB Extended JSON:
|
|
554
|
+
`cfg export` and `cfg edit` write datetimes as `{"$date": "..."}` (and decimals / ObjectIds as
|
|
555
|
+
`$numberDecimal` / `$oid`), and every write path decodes those wrappers at any depth. A write
|
|
556
|
+
that would replace a live datetime, decimal or ObjectId with a different type, typically an ISO
|
|
557
|
+
string, is refused, because the hash treats both as equal and the diff would hide it. Use
|
|
558
|
+
`--allow-type-change` only when that is the intent; it is recorded in history metadata.
|
|
559
|
+
|
|
542
560
|
Adopt an out-of-band database write:
|
|
543
561
|
|
|
544
562
|
```bash
|
|
@@ -613,8 +631,12 @@ cfg commit <record> --from <file.json> -m "message"
|
|
|
613
631
|
cfg commit <record> --from <file.json> --dry-run
|
|
614
632
|
cfg commit --bulk-from <batch.json> -m "message"
|
|
615
633
|
cfg commit --bulk-from <batch.json> --dry-run
|
|
616
|
-
cfg set <record> field=value nested.field=value -m "message"
|
|
634
|
+
cfg set <record> field=value nested.field=value list+=item list-=item -m "message"
|
|
617
635
|
cfg edit <record> -m "message"
|
|
636
|
+
cfg add <record> --from <file.json> -m "message"
|
|
637
|
+
cfg rm <record> -m "message" [--dry-run] [--force]
|
|
638
|
+
cfg promote <record> --from dev --to prod [--ref @seq] -m "message" [--dry-run]
|
|
639
|
+
cfg promote --tag <tag> --from dev --to prod -m "message"
|
|
618
640
|
cfg branch list
|
|
619
641
|
cfg branch create <name> --from main
|
|
620
642
|
cfg branch delete <name>
|
|
@@ -628,7 +650,7 @@ cfg pr list
|
|
|
628
650
|
cfg pr show <id>
|
|
629
651
|
cfg pr close <id>
|
|
630
652
|
cfg pr merge <id>
|
|
631
|
-
cfg log <record>
|
|
653
|
+
cfg log <record> [-n N] [--since 30d]
|
|
632
654
|
cfg show <record> <ref>
|
|
633
655
|
cfg adopt <record> -m "message"
|
|
634
656
|
cfg adopt --all -m "message"
|
|
@@ -754,6 +776,9 @@ Tools include:
|
|
|
754
776
|
- `cfg_commit`
|
|
755
777
|
- `cfg_bulk_commit`
|
|
756
778
|
- `cfg_set`
|
|
779
|
+
- `cfg_add`
|
|
780
|
+
- `cfg_rm`
|
|
781
|
+
- `cfg_promote`
|
|
757
782
|
- `cfg_export`
|
|
758
783
|
- `cfg_import`
|
|
759
784
|
- `cfg_branch_list`
|
|
@@ -10,9 +10,9 @@ same database. Your scripts and admin tools can still write it. cfgit sits besid
|
|
|
10
10
|
the store, records what changed, and refuses to clobber changes it did not record.
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<img src="
|
|
14
|
-
<img src="
|
|
15
|
-
<img src="
|
|
13
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-diff.png" alt="Production-shaped support agent drift with collection stats, branch workflow controls, history, and line-aligned diff" width="32%" />
|
|
14
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-impact.png" alt="High-risk system-impact panel for a refund-resolution agent change with provider-backed LLM narration" width="32%" />
|
|
15
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-scoped-impact.png" alt="Scoped impact analysis with selected policy, eval, and rollout records plus provider-backed narration" width="32%" />
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
@@ -20,8 +20,8 @@ the store, records what changed, and refuses to clobber changes it did not recor
|
|
|
20
20
|
</p>
|
|
21
21
|
|
|
22
22
|
<p align="center">
|
|
23
|
-
<img src="
|
|
24
|
-
<img src="
|
|
23
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-branches.png" alt="Branches workspace with a default runtime branch, a draft branch, and a branch with an open cfgit PR, plus a compare-branches selector" width="48%" />
|
|
24
|
+
<img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20260802/cfgit-pull-request.png" alt="Open cfgit pull request reviewing a policy-rule change on a draft branch with a line-aligned diff and merge action" width="48%" />
|
|
25
25
|
</p>
|
|
26
26
|
|
|
27
27
|
<p align="center">
|
|
@@ -233,7 +233,9 @@ cfg set modelgarden_models:openai/gpt-4o-mini enabled=true retry.max=3 -m "enabl
|
|
|
233
233
|
```
|
|
234
234
|
|
|
235
235
|
Values are JSON-coerced (`enabled=true` → bool, `n=5` → int, `tags=["a","b"]` → list);
|
|
236
|
-
prefix with `str:` to force a string (`version=str:1.0`).
|
|
236
|
+
prefix with `str:` to force a string (`version=str:1.0`). Edit one element of a list without
|
|
237
|
+
copying the whole list: `orgs+=abc123` appends it if absent (creating the array if the field is
|
|
238
|
+
missing) and `orgs-=abc123` removes every occurrence. Use `cfg edit <record>` to hand-edit
|
|
237
239
|
the whole document in `$EDITOR`.
|
|
238
240
|
|
|
239
241
|
Commit a full JSON document (add `--dry-run` to preview the field-level delta and exit
|
|
@@ -302,10 +304,23 @@ all runtime records, canonical history/head updates, and PR closure commit
|
|
|
302
304
|
together or roll back together.
|
|
303
305
|
|
|
304
306
|
`commit`, `import`, and `adopt` scan the would-be-stored document for secret-like
|
|
305
|
-
field names and values from `[secrets]
|
|
307
|
+
field names and values from `[secrets]` (name rules apply to string values only, so
|
|
308
|
+
`max_tokens = 4096` is not a secret). Fields listed in `secret_fields` are
|
|
306
309
|
stripped before history. Use `--allow-secret` only for intentional fixtures or
|
|
307
310
|
known false positives; cfgit records the override in history metadata.
|
|
308
311
|
|
|
312
|
+
A collection can declare `validate = { schema = "flags.json" }` (JSON Schema) or
|
|
313
|
+
`validate = { python = "module:fn" }`; every write path refuses a document that fails it, and
|
|
314
|
+
`cfg doctor` reports live documents that already do. See
|
|
315
|
+
[CONFIGURATION.md](docs/CONFIGURATION.md#validation).
|
|
316
|
+
|
|
317
|
+
Plain JSON has no dates, so documents that travel as files use MongoDB Extended JSON:
|
|
318
|
+
`cfg export` and `cfg edit` write datetimes as `{"$date": "..."}` (and decimals / ObjectIds as
|
|
319
|
+
`$numberDecimal` / `$oid`), and every write path decodes those wrappers at any depth. A write
|
|
320
|
+
that would replace a live datetime, decimal or ObjectId with a different type, typically an ISO
|
|
321
|
+
string, is refused, because the hash treats both as equal and the diff would hide it. Use
|
|
322
|
+
`--allow-type-change` only when that is the intent; it is recorded in history metadata.
|
|
323
|
+
|
|
309
324
|
Adopt an out-of-band database write:
|
|
310
325
|
|
|
311
326
|
```bash
|
|
@@ -380,8 +395,12 @@ cfg commit <record> --from <file.json> -m "message"
|
|
|
380
395
|
cfg commit <record> --from <file.json> --dry-run
|
|
381
396
|
cfg commit --bulk-from <batch.json> -m "message"
|
|
382
397
|
cfg commit --bulk-from <batch.json> --dry-run
|
|
383
|
-
cfg set <record> field=value nested.field=value -m "message"
|
|
398
|
+
cfg set <record> field=value nested.field=value list+=item list-=item -m "message"
|
|
384
399
|
cfg edit <record> -m "message"
|
|
400
|
+
cfg add <record> --from <file.json> -m "message"
|
|
401
|
+
cfg rm <record> -m "message" [--dry-run] [--force]
|
|
402
|
+
cfg promote <record> --from dev --to prod [--ref @seq] -m "message" [--dry-run]
|
|
403
|
+
cfg promote --tag <tag> --from dev --to prod -m "message"
|
|
385
404
|
cfg branch list
|
|
386
405
|
cfg branch create <name> --from main
|
|
387
406
|
cfg branch delete <name>
|
|
@@ -395,7 +414,7 @@ cfg pr list
|
|
|
395
414
|
cfg pr show <id>
|
|
396
415
|
cfg pr close <id>
|
|
397
416
|
cfg pr merge <id>
|
|
398
|
-
cfg log <record>
|
|
417
|
+
cfg log <record> [-n N] [--since 30d]
|
|
399
418
|
cfg show <record> <ref>
|
|
400
419
|
cfg adopt <record> -m "message"
|
|
401
420
|
cfg adopt --all -m "message"
|
|
@@ -521,6 +540,9 @@ Tools include:
|
|
|
521
540
|
- `cfg_commit`
|
|
522
541
|
- `cfg_bulk_commit`
|
|
523
542
|
- `cfg_set`
|
|
543
|
+
- `cfg_add`
|
|
544
|
+
- `cfg_rm`
|
|
545
|
+
- `cfg_promote`
|
|
524
546
|
- `cfg_export`
|
|
525
547
|
- `cfg_import`
|
|
526
548
|
- `cfg_branch_list`
|
|
@@ -78,10 +78,62 @@ Fields:
|
|
|
78
78
|
- `name`: live collection or table name.
|
|
79
79
|
- `id_field`: stable id field for the record.
|
|
80
80
|
- `live_when`: selector for the live record when multiple rows or docs share an id.
|
|
81
|
-
- `ignore_fields`: top-level fields
|
|
82
|
-
- `ignore_patterns`: top-level glob patterns
|
|
83
|
-
- `ignore_paths`:
|
|
81
|
+
- `ignore_fields`: top-level fields cfgit does not version.
|
|
82
|
+
- `ignore_patterns`: top-level glob patterns cfgit does not version.
|
|
83
|
+
- `ignore_paths`: dotted nested paths cfgit does not version (e.g. `meta.migrated_at`).
|
|
84
|
+
|
|
85
|
+
Ignored content is left out of hashes, diffs, dry-runs and history comparisons, and cfgit
|
|
86
|
+
never changes it: on every write (commit, bulk, import, restore, promote, merge) the live value
|
|
87
|
+
is kept, a value sent in the payload is dropped, and an ignored field missing from the payload
|
|
88
|
+
is not deleted. Use these for fields your application owns (timestamps, backups, migration
|
|
89
|
+
markers).
|
|
84
90
|
- `secret_fields`: dotted paths stripped from stored history.
|
|
91
|
+
- `validate`: optional write-time validator, see below.
|
|
92
|
+
- `promote_ignore`: dotted paths `cfg promote` never copies between envs (endpoints, keys,
|
|
93
|
+
env-local ids); the target keeps its own values.
|
|
94
|
+
- `code_refs`: where application code reads records of this collection by id, for
|
|
95
|
+
`cfg impact` and `cfg rm` (needs cfgit-impact):
|
|
96
|
+
|
|
97
|
+
```toml
|
|
98
|
+
code_refs = { roots = ["app"], pattern = '''feature_flags\.(?:is_on|mode)\(\s*["']{id}["']''', globs = ["*.py"] }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`roots` are relative to the config file; `pattern` is a regex where `{id}` is replaced by the
|
|
102
|
+
escaped record id (default: the id in quotes); `globs` optionally limits file names.
|
|
103
|
+
`cfg impact` lists `code_references` (`file:line`) and says when no code reads the record;
|
|
104
|
+
`cfg rm` refuses while code still references the id, unless `--force`.
|
|
105
|
+
|
|
106
|
+
### Validation
|
|
107
|
+
|
|
108
|
+
A collection can reject bad documents before they are written:
|
|
109
|
+
|
|
110
|
+
```toml
|
|
111
|
+
[[collection]]
|
|
112
|
+
name = "feature_flags"
|
|
113
|
+
id_field = "name"
|
|
114
|
+
validate = { schema = "schemas/feature_flags.json" } # JSON Schema, path relative to this file
|
|
115
|
+
# or
|
|
116
|
+
validate = { python = "flag_rules:validate" } # fn(doc) -> list[str] of problems
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- It runs on every write path before anything is written: `commit`, `--bulk-from`, `set`,
|
|
120
|
+
`edit`, `add`, `import --from`, `restore` (single record and system-wide), branch commits and
|
|
121
|
+
`pr merge`. Any problem refuses the write with `ValidationFailed` and the list of problems;
|
|
122
|
+
`commit --bulk-from --dry-run` reports each failing row as `validation_failed`.
|
|
123
|
+
- JSON Schema needs `pip install 'cfgit[validate]'` (jsonschema). It sees the doc's JSON view:
|
|
124
|
+
datetimes as ISO strings (so `"format": "date-time"` works), decimals and ObjectIds as strings.
|
|
125
|
+
`format` keywords are checked.
|
|
126
|
+
- A Python validator gets the doc exactly as it will be written and returns a list of problem
|
|
127
|
+
strings (empty or `None` means valid). The config file's folder is on the import path, so a
|
|
128
|
+
module can sit next to `.cfg.toml`. A validator that raises counts as a failure.
|
|
129
|
+
- Restores validate the version with live `secret_fields` values put back, because that is what
|
|
130
|
+
the adapter writes.
|
|
131
|
+
- Commits validate the doc with live `secret_fields` values put back too (what is actually stored).
|
|
132
|
+
- A validator that cannot load (missing schema file, jsonschema not installed, import error)
|
|
133
|
+
refuses writes with that reason; `--no-validate` still works, and `cfg doctor` reports it.
|
|
134
|
+
- `--no-validate` (CLI) / `no_validate` (MCP) writes anyway for an emergency and records
|
|
135
|
+
`validation_skipped`, the author, the reason and the problems in history metadata.
|
|
136
|
+
- `cfg doctor` lists live documents that fail their validator under `validation_failures`.
|
|
85
137
|
|
|
86
138
|
## Environments
|
|
87
139
|
|
|
@@ -102,6 +154,33 @@ Fields:
|
|
|
102
154
|
|
|
103
155
|
When `uri` is `env:DEV_MONGODB_URI`, cfgit reads that environment variable.
|
|
104
156
|
|
|
157
|
+
### Notifications
|
|
158
|
+
|
|
159
|
+
```toml
|
|
160
|
+
[env.prod.notify]
|
|
161
|
+
webhook = "env:CFGIT_PROD_WEBHOOK" # generic JSON POST
|
|
162
|
+
slack_webhook = "env:CFGIT_PROD_SLACK" # Slack incoming webhook (formatted text)
|
|
163
|
+
collections = ["feature_flags", "prompts"] # optional filter; default every collection
|
|
164
|
+
include_values = false # default: field paths only, never values
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
After every successful runtime write in that env (`commit`, `set`, `edit`, `--bulk-from`,
|
|
168
|
+
`import --from`, `add`, `rm`, `restore`, `promote`, `pr merge`) cfgit posts one event per
|
|
169
|
+
operation:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{"env": "prod", "op": "commit", "author": "ops@example.com", "message": "ship 50%",
|
|
173
|
+
"at": "2026-11-28T10:12:03+00:00", "count": 1,
|
|
174
|
+
"records": [{"record": "feature_flags:new_router", "collection": "feature_flags",
|
|
175
|
+
"record_id": "new_router", "seq": 3, "oid": "0d84...", "changed_paths": ["percent"]}]}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`op` is `commit`, `add`, `delete`, `restore`, `merge` or `promote`. With `include_values = true` each record
|
|
179
|
+
also carries `changes` (before/after; `secret_fields` and ignored fields are never included).
|
|
180
|
+
A bulk operation sends one event listing every record it changed. Delivery is best effort: a
|
|
181
|
+
failure or timeout (5s) is reported on stderr and never fails or rolls back the write. URLs may
|
|
182
|
+
be literal or `env:VAR`; an unset variable skips that target with a warning.
|
|
183
|
+
|
|
105
184
|
## Permissions
|
|
106
185
|
|
|
107
186
|
cfgit is open by default:
|
|
@@ -125,7 +204,7 @@ Roles:
|
|
|
125
204
|
|
|
126
205
|
- `writers`: can commit, adopt, tag, and restore individual records.
|
|
127
206
|
- `admins`: can do writer actions plus configured `admin_actions`.
|
|
128
|
-
- `admin_actions`: actions that require admin role, such as `restore_system`.
|
|
207
|
+
- `admin_actions`: actions that require admin role, such as `restore_system` or `rm`.
|
|
129
208
|
|
|
130
209
|
Patterns use shell-style matching.
|
|
131
210
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# History read contract
|
|
2
|
+
|
|
3
|
+
Tools built on cfgit (reports, dashboards, "who changed this and when") should read history
|
|
4
|
+
through this contract, not through the `history_collection` / `heads_collection` tables. Those
|
|
5
|
+
are cfgit's internal storage and their shape can change between versions; this contract does
|
|
6
|
+
not, within a `schema_version`. New fields may be added; removing or changing a field means a
|
|
7
|
+
new `schema_version`.
|
|
8
|
+
|
|
9
|
+
## Python
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
import cfg
|
|
13
|
+
|
|
14
|
+
h = cfg.history(
|
|
15
|
+
"feature_flags:new_router",
|
|
16
|
+
config_file="~/.config/cfgit/aistudio.cfg.toml", # or engine=<an open Engine>
|
|
17
|
+
env="prod",
|
|
18
|
+
limit=20, # optional, newest first
|
|
19
|
+
since="30d", # optional: datetime, ISO date/time, or relative 7d / 12h
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
s = cfg.heads("feature_flags", config_file="...", env="prod") # collection optional
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`cfg.history(...)`:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"schema_version": 1,
|
|
30
|
+
"env": "prod",
|
|
31
|
+
"record": "feature_flags:new_router",
|
|
32
|
+
"entries": [
|
|
33
|
+
{
|
|
34
|
+
"seq": 3,
|
|
35
|
+
"oid": "0d84b0b1...",
|
|
36
|
+
"parent_oid": "2ed7e94c...",
|
|
37
|
+
"op": "commit",
|
|
38
|
+
"author": "ops@example.com",
|
|
39
|
+
"identity": {"author": "ops@example.com", "verified": true, "...": "..."},
|
|
40
|
+
"recorded_at": "2026-11-28T10:12:03.120000+00:00",
|
|
41
|
+
"message": "enable for abc123",
|
|
42
|
+
"tags": ["release-x"],
|
|
43
|
+
"changes": [
|
|
44
|
+
{"path": "orgs", "op": "change", "before": ["a"], "after": ["a", "abc123"]}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- `entries` are newest first.
|
|
52
|
+
- `op` is one of `import`, `commit`, `merge`, `restore`, `adopt`, `add`, `delete`.
|
|
53
|
+
- `changes` is the field-level diff against the previous version. `op` is `add`, `remove`
|
|
54
|
+
or `change`; nested fields use dotted paths. A change of type only adds
|
|
55
|
+
`"type_change": "datetime -> str"`. Fields in the collection's `ignore_*` settings are left out.
|
|
56
|
+
The first version, and the first version after a delete, diff against an empty doc (all
|
|
57
|
+
`add`); a `delete` entry shows every field as `remove`.
|
|
58
|
+
- `secret_fields` never appear: they are stripped before history is written.
|
|
59
|
+
- Datetimes are ISO-8601 strings with an explicit UTC offset (`+00:00`) on every backend.
|
|
60
|
+
|
|
61
|
+
`cfg.heads(...)`:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"schema_version": 1,
|
|
66
|
+
"env": "prod",
|
|
67
|
+
"records": [
|
|
68
|
+
{
|
|
69
|
+
"collection": "feature_flags",
|
|
70
|
+
"record_id": "new_router",
|
|
71
|
+
"state": "clean",
|
|
72
|
+
"seq": 3,
|
|
73
|
+
"oid": "0d84b0b1...",
|
|
74
|
+
"last_changed_at": "2026-11-28T10:12:03.120000+00:00"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`state` is one of `clean`, `changed_outside_cfgit`, `new` (live but untracked), `missing` (history
|
|
81
|
+
but no live doc, removed outside cfgit), `deleted` (removed with `cfg rm`), `not_found`.
|
|
82
|
+
`last_changed_at` is when the current version took effect, so "how long has this record been
|
|
83
|
+
in its current state" is `now - last_changed_at`.
|
|
84
|
+
|
|
85
|
+
## CLI and MCP
|
|
86
|
+
|
|
87
|
+
`cfg log <record> --json [-n N] [--since 30d|2026-11-01|<ISO datetime>]` and the `cfg_log` MCP
|
|
88
|
+
tool return the same entries (as a list), with the internal row fields alongside. Only the
|
|
89
|
+
fields listed above are part of the contract.
|
|
90
|
+
|
|
91
|
+
`cfg status --json` rows include `last_changed_at`.
|
|
@@ -95,6 +95,38 @@ Use memorable tokens only when the config containing hashes is private enough
|
|
|
95
95
|
for your risk level. If hashes are public, short or guessable phrases can be
|
|
96
96
|
attacked offline. Prefer longer private phrases for production.
|
|
97
97
|
|
|
98
|
+
### How it works, and what it does (and doesn't) protect
|
|
99
|
+
|
|
100
|
+
A common question: if `CFGIT_IDENTITY_TOKEN` lives only in the user's local
|
|
101
|
+
environment and is never stored centrally, what is it actually protecting?
|
|
102
|
+
|
|
103
|
+
It works like a password checked against a stored hash — but with no auth server
|
|
104
|
+
and no session:
|
|
105
|
+
|
|
106
|
+
- **Setup, once.** The user picks a private string. You hash it locally
|
|
107
|
+
(`cfg identity-hash`) and put **only the hash** in `.cfg.toml`. The raw string
|
|
108
|
+
is never written into cfgit — not in the config, not in history, not in logs.
|
|
109
|
+
- **At runtime.** The user exports the raw string as `CFGIT_IDENTITY_TOKEN`.
|
|
110
|
+
- **On every command.** cfgit hashes the env-var value right then and compares it
|
|
111
|
+
to the configured hashes. A match verifies the author; a mismatch is rejected.
|
|
112
|
+
There is no login step and no session — it re-verifies per command, statelessly.
|
|
113
|
+
|
|
114
|
+
So it is deliberately decentralized: the **hash** is shared (in the config), the
|
|
115
|
+
**raw token** stays local, and cfgit never has to hold a secret or phone home to a
|
|
116
|
+
server. Anyone can read Alice's hash; that does not let them act as Alice.
|
|
117
|
+
|
|
118
|
+
What this buys you, and what it doesn't:
|
|
119
|
+
|
|
120
|
+
- It is **attribution / accountability**, not a hard security boundary. It proves
|
|
121
|
+
"this caller knows Alice's token," which makes cfgit's history trail hard to
|
|
122
|
+
spoof casually. It does **not** stop someone who steals Alice's raw token from
|
|
123
|
+
her environment, and public hashes over short phrases can be brute-forced
|
|
124
|
+
offline (hence: long, private phrases for production).
|
|
125
|
+
- For a real security boundary, prefer **`db_principal`** identity (below): the
|
|
126
|
+
database itself authenticates the connection, and cfgit maps that verified DB
|
|
127
|
+
user to an author — no shared secret to leak. Combine with `enforced` mode and
|
|
128
|
+
locked-down DB write credentials so cfgit/CI is the only writer.
|
|
129
|
+
|
|
98
130
|
## Database Principal Identity
|
|
99
131
|
|
|
100
132
|
`db_principal` uses the authenticated database connection identity:
|
|
@@ -7,6 +7,7 @@ Start with the user-facing guides:
|
|
|
7
7
|
- [Identity & Attribution](IDENTITY_AND_ATTRIBUTION.md): open, authenticated, and enforced identity modes.
|
|
8
8
|
- [Adapters](ADAPTERS.md): Mongo and Postgres storage details.
|
|
9
9
|
- [Agents](AGENTS.md): MCP, skill, and impact plugin usage.
|
|
10
|
+
- [History contract](HISTORY_CONTRACT.md): the stable way for tools to read history (`cfg.history`, `cfg.heads`, `cfg log --json`).
|
|
10
11
|
|
|
11
12
|
Technical references:
|
|
12
13
|
|
|
@@ -153,9 +153,41 @@ cfg diff agent_configs:agent_planner =HEAD =live
|
|
|
153
153
|
Then adopt or resolve manually.
|
|
154
154
|
|
|
155
155
|
`commit`, `import`, and `adopt` also scan the would-be-stored document for
|
|
156
|
-
secret-shaped fields and values from `[secrets]`.
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
secret-shaped fields and values from `[secrets]`. Field-name rules apply to string
|
|
157
|
+
values only (a numeric `pixels_per_token` is not a secret); value rules always apply.
|
|
158
|
+
Fields in `secret_fields` are stripped before history. Use `--allow-secret` only for
|
|
159
|
+
intentional fixtures or false positives; cfgit records that override in history metadata.
|
|
160
|
+
|
|
161
|
+
### Dates and other typed values
|
|
162
|
+
|
|
163
|
+
JSON has no datetime, decimal or ObjectId, so cfgit uses MongoDB Extended JSON wherever a
|
|
164
|
+
document leaves as a file and comes back:
|
|
165
|
+
|
|
166
|
+
- `cfg export` (artifact `version: 2`) and the `cfg edit` temp file write
|
|
167
|
+
`{"$date": "2026-11-19T08:30:00.123000Z"}`, `{"$numberDecimal": "1.50"}`, `{"$oid": "..."}`.
|
|
168
|
+
- Every write path (`commit`, `--bulk-from`, `import --from`, `set`, `edit`, MCP) decodes those
|
|
169
|
+
wrappers at any depth (`$date` also accepts epoch millis and `{"$numberLong": ...}`). Plain ISO
|
|
170
|
+
strings are never guessed into dates.
|
|
171
|
+
- Binary and UUID values travel as `{"$binary": {"base64": ..., "subType": ...}}` / `{"$uuid": ...}`.
|
|
172
|
+
On Postgres (jsonb cannot hold them) these two wrappers are stored as-is.
|
|
173
|
+
- Because wrappers are decoded, a document that *stores* a literal `{"$date": ...}` object as
|
|
174
|
+
data (e.g. jsonb migrated with mongoexport) has it turned into a date on full-document writes
|
|
175
|
+
(`commit --from`, `edit`, `import --from`). `cfg set` leaves the rest of the doc untouched.
|
|
176
|
+
- A write that would replace a live datetime/decimal/ObjectId/binary/UUID with another type (for
|
|
177
|
+
example an ISO string produced by `json.dumps(..., default=str)`) is refused with
|
|
178
|
+
`TypeChangeBlocked`, listing every path. Hashes render both forms identically, so without the
|
|
179
|
+
guard the change would be invisible in `diff` and `--dry-run`. `--allow-type-change` overrides
|
|
180
|
+
it and is recorded in history metadata (`allow_type_change`, `type_changes`). Setting such a
|
|
181
|
+
field to `null` is allowed (that change is visible in the hash and the diff).
|
|
182
|
+
- `diff` and `--dry-run` mark type-only changes, e.g. `change meta.at (datetime -> str)`.
|
|
183
|
+
- `commit --bulk-from --dry-run` reports every blocked row as `type_change_blocked` instead of
|
|
184
|
+
stopping at the first.
|
|
185
|
+
|
|
186
|
+
Export files written by this version (`version: 2`) need cfgit 0.5 or later to import; older
|
|
187
|
+
versions would write the `{"$date": ...}` wrappers literally. Export files from 0.4.7 and earlier
|
|
188
|
+
(`version: 1`) hold dates as plain strings; importing one
|
|
189
|
+
over records that hold real datetimes is refused by the guard. Convert those fields to
|
|
190
|
+
`{"$date": ...}` first, or re-export with the current version.
|
|
159
191
|
|
|
160
192
|
## Preview a commit
|
|
161
193
|
|
|
@@ -183,6 +215,95 @@ becomes a boolean, `n=5` an integer, `tags=["a","b"]` a list — and a `str:` pr
|
|
|
183
215
|
string (`version=str:1.0`). Add `--dry-run` to preview. To hand-edit the whole document in your
|
|
184
216
|
`$EDITOR` instead, use `cfg edit <record> -m "message"`.
|
|
185
217
|
|
|
218
|
+
### List edits
|
|
219
|
+
|
|
220
|
+
To add or remove one element of an array (an allowlist, tags) without retyping the list:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
cfg set feature_flags:new_router orgs+=abc123 -m "enable for abc123" # append if absent
|
|
224
|
+
cfg set feature_flags:new_router orgs-=abc123 -m "disable for abc123" # remove every occurrence
|
|
225
|
+
cfg set feature_flags:new_router tags+=a tags+=b -m "two tags" # several in one commit
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
- The field must be an array; `+=` creates it if the field is missing, `-=` on a missing field
|
|
229
|
+
does nothing.
|
|
230
|
+
- Values are coerced like `=`: `ids-=5` removes the number 5, `ids-=str:5` the string "5".
|
|
231
|
+
- `--dry-run` shows the resulting list.
|
|
232
|
+
- The list is computed from the live document at write time. If the record changes between the
|
|
233
|
+
read and the write (another `cfg set` on the same list, say), the commit refuses with
|
|
234
|
+
`stale_base` instead of dropping the other change; rerun the same command. `cfg edit` and
|
|
235
|
+
`cfg promote` get the same protection.
|
|
236
|
+
- Matching is type-strict: `flags-=1` does not remove `true`, and Extended JSON values work
|
|
237
|
+
(`owners-={"$oid": "..."}`).
|
|
238
|
+
- MCP / actions: `{"orgs+=": "abc123"}` or `[{"field": "orgs", "op": "append", "value": "abc123"}]`
|
|
239
|
+
(`op` is `set`, `append` or `remove`).
|
|
240
|
+
- For a full-document read-modify-write over MCP, pass the oid you read (`cfg_show` with ref
|
|
241
|
+
`=live`) as `expected_live_oid` to `cfg_commit`; it refuses with `stale_base` if live moved.
|
|
242
|
+
- If `cfg edit` is refused because the record changed while your editor was open, your edited
|
|
243
|
+
document is saved to a temp file (`your_edit_saved_to`) so you can re-apply it.
|
|
244
|
+
|
|
245
|
+
## Create and delete records
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
cfg add feature_flags:new_router --from flag.json -m "new flag" # insert + version 1
|
|
249
|
+
cfg add feature_flags:new_router --from flag.json --dry-run # validate, write nothing
|
|
250
|
+
cfg rm feature_flags:old_router -m "flag fully rolled out" --dry-run # who references it?
|
|
251
|
+
cfg rm feature_flags:old_router -m "flag fully rolled out"
|
|
252
|
+
cfg restore feature_flags:old_router @3 -m "undo rm" # bring it back
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`cfg add` inserts the live doc and records its first version (`op: add`) in one transaction, so
|
|
256
|
+
a failed write never leaves an untracked live row. It refuses if a live doc with that id exists.
|
|
257
|
+
The id field and any `live_when` values are filled in for you; on Mongo, a new `_id` is assigned
|
|
258
|
+
up front when `_id` is not ignored, so the record is `clean` right after the add. The secret scan
|
|
259
|
+
runs as on `commit`.
|
|
260
|
+
|
|
261
|
+
`cfg rm` deletes the live doc and records a tombstone version (`op: delete`) that carries the
|
|
262
|
+
last doc, in one transaction. It refuses on drift like `commit`, and, when the cfgit-impact plugin
|
|
263
|
+
is installed, it first scans other records for mentions of the id and refuses with
|
|
264
|
+
`blocked_by_references` (listing them) unless you pass `--force`. A removed record shows as
|
|
265
|
+
`deleted` in `status` and the UI; `cfg restore <record> @<seq>` re-inserts that version, and
|
|
266
|
+
`cfg add` can create it again with history continuing from the tombstone.
|
|
267
|
+
|
|
268
|
+
Restoring a single record *to* a tombstone (`cfg restore <record> @<delete seq>`) is refused:
|
|
269
|
+
a tombstone has no content to restore; use `cfg rm` to delete. `diff` treats a tombstone as an
|
|
270
|
+
empty document. System-wide `restore --tag/--as-of` never resurrects or deletes on a tombstone: a record that
|
|
271
|
+
was deleted at the target point is reported (`unchanged` or `deleted_at_target`) and left alone.
|
|
272
|
+
|
|
273
|
+
Both are permission-checked as the actions `add` and `rm`, so a stricter env can make deletes
|
|
274
|
+
admin-only with `admin_actions = ["rm"]`. The reference check matches the id as a whole token
|
|
275
|
+
(`router` does not match `new_router`). Bulk forms are not supported yet.
|
|
276
|
+
|
|
277
|
+
## Promote between environments
|
|
278
|
+
|
|
279
|
+
Move a record from one env to another without hand-copying JSON:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
cfg promote feature_flags:new_router --from dev --to prod --dry-run # diff vs prod + impact
|
|
283
|
+
cfg promote feature_flags:new_router --from dev --to prod -m "ship 50%"
|
|
284
|
+
cfg promote feature_flags:new_router --from dev --to prod --ref @7 -m "ship v7" # a specific version
|
|
285
|
+
cfg promote --tag release-x --from dev --to prod -m "release x" # every tagged record
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
- The source version is the live doc by default, or `--ref @<seq>` / `tag:<name>` / an oid.
|
|
289
|
+
- It is written through the **target's** normal `commit` path (or `add` when the record does
|
|
290
|
+
not exist there yet): the target env's identity, permissions, validator, type guard and drift
|
|
291
|
+
guard all apply, and the history entry is authored by you in the target env.
|
|
292
|
+
- The target's history records provenance: `meta.promoted_from = {env, ref, seq, oid}`.
|
|
293
|
+
- Env-local values stay put: the collection's `ignore_*` fields, `secret_fields` and
|
|
294
|
+
`promote_ignore` paths keep the target's values (and are left out when creating).
|
|
295
|
+
- `--tag` preflights every tagged record (drift, validation, type guard) and writes nothing if
|
|
296
|
+
any would be refused. Records deleted in the source are reported as `deleted_in_source`, never
|
|
297
|
+
deleted in the target.
|
|
298
|
+
- `--dry-run` shows the field-level diff against the target, plus the records in the target that
|
|
299
|
+
reference the id (when cfgit-impact is installed).
|
|
300
|
+
- A storage `_id` is never copied: the target keeps its own (a new record gets a fresh one).
|
|
301
|
+
- Permission action `promote` is checked in the target env on top of `commit`/`add`, so
|
|
302
|
+
`admin_actions = ["promote"]` restricts promotion specifically.
|
|
303
|
+
- If the target record is written by someone else while the promote runs, it refuses with
|
|
304
|
+
`stale_base` instead of reverting that write; `--tag` stops at that record and reports
|
|
305
|
+
`partial` with what landed.
|
|
306
|
+
|
|
186
307
|
## Situational awareness
|
|
187
308
|
|
|
188
309
|
`cfg doctor --status` prints a one-look header of where you are pointed: resolved config file,
|
|
@@ -270,11 +391,17 @@ new HEAD.
|
|
|
270
391
|
|
|
271
392
|
```bash
|
|
272
393
|
cfg log agent_configs:agent_planner
|
|
394
|
+
cfg log agent_configs:agent_planner --since 30d -n 50 # each entry lists the fields that changed
|
|
273
395
|
cfg show agent_configs:agent_planner HEAD
|
|
274
396
|
cfg show agent_configs:agent_planner @2
|
|
275
397
|
cfg show agent_configs:agent_planner tag:june7-good
|
|
276
398
|
```
|
|
277
399
|
|
|
400
|
+
Each `log` entry carries `changes`, the field-level diff against the previous version. Tools
|
|
401
|
+
that report on history should use the documented contract in
|
|
402
|
+
[HISTORY_CONTRACT.md](HISTORY_CONTRACT.md) (`cfg.history` / `cfg.heads` in Python) instead of
|
|
403
|
+
reading cfgit's history tables directly.
|
|
404
|
+
|
|
278
405
|
## Tags
|
|
279
406
|
|
|
280
407
|
Tag the current HEAD of every configured record:
|
|
@@ -331,6 +458,11 @@ cfg impact agent_configs:agent_planner \
|
|
|
331
458
|
--llm --json
|
|
332
459
|
```
|
|
333
460
|
|
|
461
|
+
If the collection sets `code_refs` (see CONFIGURATION.md), the report also includes
|
|
462
|
+
`code_references`: each `file:line` in your application code that reads this record's id, or
|
|
463
|
+
an explicit "no code reference found", which is how a stale-record check finds rows nothing
|
|
464
|
+
reads any more.
|
|
465
|
+
|
|
334
466
|
The LLM provider layer lives in `plugins/cfg_impact`. `--llm` is blocked unless
|
|
335
467
|
the record is allowlisted in `[connections].share_with_ai`. Providers are selected
|
|
336
468
|
with `[connections].ai_provider` or `--provider`; the plugin supports `claude`,
|