cfgit 0.1.3__tar.gz → 0.2.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.1.3 → cfgit-0.2.0}/PKG-INFO +44 -5
- {cfgit-0.1.3 → cfgit-0.2.0}/README.md +43 -4
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/USAGE.md +66 -6
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/pyproject.toml +2 -2
- {cfgit-0.1.3 → cfgit-0.2.0}/pyproject.toml +1 -1
- {cfgit-0.1.3 → cfgit-0.2.0}/skills/cfgit/SKILL.md +12 -1
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/cli/main.py +220 -17
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/core/config.py +12 -1
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/core/engine.py +110 -1
- cfgit-0.2.0/src/cfg/core/remedy.py +278 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/interfaces/actions.py +192 -14
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/mcp/server.py +43 -3
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/ui/server.py +29 -2
- cfgit-0.2.0/tests/test_awareness.py +57 -0
- cfgit-0.2.0/tests/test_commit_dry_run.py +59 -0
- cfgit-0.2.0/tests/test_config_discovery.py +74 -0
- cfgit-0.2.0/tests/test_output_mode.py +31 -0
- cfgit-0.2.0/tests/test_remedy.py +113 -0
- cfgit-0.2.0/tests/test_set_fields.py +109 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_ui_server.py +10 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/.github/workflows/ci.yml +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/.github/workflows/publish.yml +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/.gitignore +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/CONTRIBUTING.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/CREDITS.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/LICENSE +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/NOTICE +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/SECURITY.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/ADAPTERS.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/AGENTS.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/BRANCHING_PLAN.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/CONFIGURATION.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/IDENTITY_AND_ATTRIBUTION.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/PUBLISHING.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/README.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/SPEC.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/SPEC_CORE.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/screenshots/01-diff.png +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/screenshots/02-impact.png +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/docs/screenshots/03-scoped-impact.png +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/examples/.cfg.toml +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/examples/cfgit-support-demo.toml +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/examples/seed_support_demo.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/README.md +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/overview.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/providers/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/providers/base.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/providers/claude.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/providers/factory.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/providers/gemini.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/plugins/cfg_impact/cfg_impact/providers/openai_provider.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/adapters/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/adapters/base.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/adapters/mongo.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/adapters/postgres.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/approval/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/approval/base.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/cli/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/core/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/core/authz.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/core/diff.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/core/hashing.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/core/identity.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/interfaces/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/mcp/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/src/cfg/ui/__init__.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_adapter_contract_live.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_authz.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_config.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_console_script.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_core_purity.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_engine_safety.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_hashing.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_identity.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_impact_boundary.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_mcp_identity.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_mongo_history.py +0 -0
- {cfgit-0.1.3 → cfgit-0.2.0}/tests/test_postgres_history.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cfgit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.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
|
|
@@ -436,7 +436,10 @@ cfg status
|
|
|
436
436
|
`cfg doctor` is read-only. Run it before the first import for a new database or
|
|
437
437
|
`.cfg.toml`; it reports secret-deny matches, large fields, and live-rule/key
|
|
438
438
|
issues in one pass, with paste-ready `secret_fields` and `ignore_fields`
|
|
439
|
-
suggestions.
|
|
439
|
+
suggestions. `cfg doctor --status` prints a "where am I" header: the resolved config
|
|
440
|
+
file, env, target database, identity mode and whether it is verified, store reachability,
|
|
441
|
+
and how many records are tracked or drifted — plus a warning if a `needs_approval`
|
|
442
|
+
environment is still in `open` identity mode (writes would succeed unaudited).
|
|
440
443
|
|
|
441
444
|
Check drift:
|
|
442
445
|
|
|
@@ -445,10 +448,24 @@ cfg status
|
|
|
445
448
|
cfg diff agent_configs:agent_planner =HEAD =live
|
|
446
449
|
```
|
|
447
450
|
|
|
448
|
-
|
|
451
|
+
Edit a few fields in place (the fast path — no temp file). `cfg set` fetches the live
|
|
452
|
+
document and commits the change through the same drift-guarded path as `cfg commit`, so
|
|
453
|
+
it refuses on out-of-band drift rather than clobbering it:
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
cfg set modelgarden_models:openai/gpt-4o-mini enabled=true retry.max=3 -m "enable + retry"
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Values are JSON-coerced (`enabled=true` → bool, `n=5` → int, `tags=["a","b"]` → list);
|
|
460
|
+
prefix with `str:` to force a string (`version=str:1.0`). Use `cfg edit <record>` to hand-edit
|
|
461
|
+
the whole document in `$EDITOR`.
|
|
462
|
+
|
|
463
|
+
Commit a full JSON document (add `--dry-run` to preview the field-level delta and exit
|
|
464
|
+
without writing):
|
|
449
465
|
|
|
450
466
|
```bash
|
|
451
467
|
cfg commit agent_configs:agent_planner --from planner.json -m "tune planner routing"
|
|
468
|
+
cfg commit agent_configs:agent_planner --from planner.json --dry-run
|
|
452
469
|
```
|
|
453
470
|
|
|
454
471
|
Commit multiple records as one batch intent:
|
|
@@ -538,12 +555,16 @@ Common commands:
|
|
|
538
555
|
```bash
|
|
539
556
|
cfg init
|
|
540
557
|
cfg doctor [record]
|
|
558
|
+
cfg doctor --status
|
|
541
559
|
cfg import --all -m "initial import"
|
|
542
560
|
cfg status [record]
|
|
543
561
|
cfg diff <record> [from] [to]
|
|
544
562
|
cfg impact <record> [from] [to]
|
|
545
563
|
cfg commit <record> --from <file.json> -m "message"
|
|
564
|
+
cfg commit <record> --from <file.json> --dry-run
|
|
546
565
|
cfg commit --bulk-from <batch.json> -m "message"
|
|
566
|
+
cfg set <record> field=value nested.field=value -m "message"
|
|
567
|
+
cfg edit <record> -m "message"
|
|
547
568
|
cfg branch list
|
|
548
569
|
cfg branch create <name> --from main
|
|
549
570
|
cfg branch delete <name>
|
|
@@ -570,7 +591,17 @@ cfg whoami
|
|
|
570
591
|
cfg ui
|
|
571
592
|
```
|
|
572
593
|
|
|
573
|
-
Every command supports `--json` for scripts and agents.
|
|
594
|
+
Every command supports `--json` for scripts and agents. By default output is human-readable
|
|
595
|
+
when stdout is a terminal and JSON when piped or redirected; set `CFG_OUTPUT=json|human|auto`
|
|
596
|
+
to control this, and `--json` always forces JSON.
|
|
597
|
+
|
|
598
|
+
Every refusal and terminal outcome also carries a `next` block — a plain-language reason plus
|
|
599
|
+
the exact next command(s) to run. On the CLI it prints to stderr; over `--json`/MCP it is a
|
|
600
|
+
structured `next` field so agents can act on `next.commands` directly.
|
|
601
|
+
|
|
602
|
+
Environment defaults: `CFG_ENV` (default env), `CFG_CONFIG` (config file path), and
|
|
603
|
+
`CFG_AUTHOR` (author) let you set a session once instead of repeating flags. cfgit also
|
|
604
|
+
discovers `.cfg.toml` by walking up from the current directory.
|
|
574
605
|
|
|
575
606
|
Refs:
|
|
576
607
|
|
|
@@ -646,10 +677,17 @@ The MCP server exposes the same operations with a uniform envelope:
|
|
|
646
677
|
"status": "ok",
|
|
647
678
|
"code": 0,
|
|
648
679
|
"message": "",
|
|
649
|
-
"data": {}
|
|
680
|
+
"data": {},
|
|
681
|
+
"state": null,
|
|
682
|
+
"next": null
|
|
650
683
|
}
|
|
651
684
|
```
|
|
652
685
|
|
|
686
|
+
`state` echoes the outcome's terminal state (for example `changed_outside_cfgit`), and `next`
|
|
687
|
+
carries a self-teaching remedy — `{why, remedy, commands, docs}` — when the outcome needs one
|
|
688
|
+
(a refusal, drift, a blocked batch, an identity/permission failure). Agents should branch on
|
|
689
|
+
`state` and follow `next.commands`; both are `null` on a clean success.
|
|
690
|
+
|
|
653
691
|
Tools include:
|
|
654
692
|
|
|
655
693
|
- `cfg_status`
|
|
@@ -658,6 +696,7 @@ Tools include:
|
|
|
658
696
|
- `cfg_impact`
|
|
659
697
|
- `cfg_commit`
|
|
660
698
|
- `cfg_bulk_commit`
|
|
699
|
+
- `cfg_set`
|
|
661
700
|
- `cfg_branch_list`
|
|
662
701
|
- `cfg_branch_create`
|
|
663
702
|
- `cfg_branch_delete`
|
|
@@ -203,7 +203,10 @@ cfg status
|
|
|
203
203
|
`cfg doctor` is read-only. Run it before the first import for a new database or
|
|
204
204
|
`.cfg.toml`; it reports secret-deny matches, large fields, and live-rule/key
|
|
205
205
|
issues in one pass, with paste-ready `secret_fields` and `ignore_fields`
|
|
206
|
-
suggestions.
|
|
206
|
+
suggestions. `cfg doctor --status` prints a "where am I" header: the resolved config
|
|
207
|
+
file, env, target database, identity mode and whether it is verified, store reachability,
|
|
208
|
+
and how many records are tracked or drifted — plus a warning if a `needs_approval`
|
|
209
|
+
environment is still in `open` identity mode (writes would succeed unaudited).
|
|
207
210
|
|
|
208
211
|
Check drift:
|
|
209
212
|
|
|
@@ -212,10 +215,24 @@ cfg status
|
|
|
212
215
|
cfg diff agent_configs:agent_planner =HEAD =live
|
|
213
216
|
```
|
|
214
217
|
|
|
215
|
-
|
|
218
|
+
Edit a few fields in place (the fast path — no temp file). `cfg set` fetches the live
|
|
219
|
+
document and commits the change through the same drift-guarded path as `cfg commit`, so
|
|
220
|
+
it refuses on out-of-band drift rather than clobbering it:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
cfg set modelgarden_models:openai/gpt-4o-mini enabled=true retry.max=3 -m "enable + retry"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Values are JSON-coerced (`enabled=true` → bool, `n=5` → int, `tags=["a","b"]` → list);
|
|
227
|
+
prefix with `str:` to force a string (`version=str:1.0`). Use `cfg edit <record>` to hand-edit
|
|
228
|
+
the whole document in `$EDITOR`.
|
|
229
|
+
|
|
230
|
+
Commit a full JSON document (add `--dry-run` to preview the field-level delta and exit
|
|
231
|
+
without writing):
|
|
216
232
|
|
|
217
233
|
```bash
|
|
218
234
|
cfg commit agent_configs:agent_planner --from planner.json -m "tune planner routing"
|
|
235
|
+
cfg commit agent_configs:agent_planner --from planner.json --dry-run
|
|
219
236
|
```
|
|
220
237
|
|
|
221
238
|
Commit multiple records as one batch intent:
|
|
@@ -305,12 +322,16 @@ Common commands:
|
|
|
305
322
|
```bash
|
|
306
323
|
cfg init
|
|
307
324
|
cfg doctor [record]
|
|
325
|
+
cfg doctor --status
|
|
308
326
|
cfg import --all -m "initial import"
|
|
309
327
|
cfg status [record]
|
|
310
328
|
cfg diff <record> [from] [to]
|
|
311
329
|
cfg impact <record> [from] [to]
|
|
312
330
|
cfg commit <record> --from <file.json> -m "message"
|
|
331
|
+
cfg commit <record> --from <file.json> --dry-run
|
|
313
332
|
cfg commit --bulk-from <batch.json> -m "message"
|
|
333
|
+
cfg set <record> field=value nested.field=value -m "message"
|
|
334
|
+
cfg edit <record> -m "message"
|
|
314
335
|
cfg branch list
|
|
315
336
|
cfg branch create <name> --from main
|
|
316
337
|
cfg branch delete <name>
|
|
@@ -337,7 +358,17 @@ cfg whoami
|
|
|
337
358
|
cfg ui
|
|
338
359
|
```
|
|
339
360
|
|
|
340
|
-
Every command supports `--json` for scripts and agents.
|
|
361
|
+
Every command supports `--json` for scripts and agents. By default output is human-readable
|
|
362
|
+
when stdout is a terminal and JSON when piped or redirected; set `CFG_OUTPUT=json|human|auto`
|
|
363
|
+
to control this, and `--json` always forces JSON.
|
|
364
|
+
|
|
365
|
+
Every refusal and terminal outcome also carries a `next` block — a plain-language reason plus
|
|
366
|
+
the exact next command(s) to run. On the CLI it prints to stderr; over `--json`/MCP it is a
|
|
367
|
+
structured `next` field so agents can act on `next.commands` directly.
|
|
368
|
+
|
|
369
|
+
Environment defaults: `CFG_ENV` (default env), `CFG_CONFIG` (config file path), and
|
|
370
|
+
`CFG_AUTHOR` (author) let you set a session once instead of repeating flags. cfgit also
|
|
371
|
+
discovers `.cfg.toml` by walking up from the current directory.
|
|
341
372
|
|
|
342
373
|
Refs:
|
|
343
374
|
|
|
@@ -413,10 +444,17 @@ The MCP server exposes the same operations with a uniform envelope:
|
|
|
413
444
|
"status": "ok",
|
|
414
445
|
"code": 0,
|
|
415
446
|
"message": "",
|
|
416
|
-
"data": {}
|
|
447
|
+
"data": {},
|
|
448
|
+
"state": null,
|
|
449
|
+
"next": null
|
|
417
450
|
}
|
|
418
451
|
```
|
|
419
452
|
|
|
453
|
+
`state` echoes the outcome's terminal state (for example `changed_outside_cfgit`), and `next`
|
|
454
|
+
carries a self-teaching remedy — `{why, remedy, commands, docs}` — when the outcome needs one
|
|
455
|
+
(a refusal, drift, a blocked batch, an identity/permission failure). Agents should branch on
|
|
456
|
+
`state` and follow `next.commands`; both are `null` on a clean success.
|
|
457
|
+
|
|
420
458
|
Tools include:
|
|
421
459
|
|
|
422
460
|
- `cfg_status`
|
|
@@ -425,6 +463,7 @@ Tools include:
|
|
|
425
463
|
- `cfg_impact`
|
|
426
464
|
- `cfg_commit`
|
|
427
465
|
- `cfg_bulk_commit`
|
|
466
|
+
- `cfg_set`
|
|
428
467
|
- `cfg_branch_list`
|
|
429
468
|
- `cfg_branch_create`
|
|
430
469
|
- `cfg_branch_delete`
|
|
@@ -125,6 +125,48 @@ secret-shaped fields and values from `[secrets]`. Fields in `secret_fields` are
|
|
|
125
125
|
stripped before history. Use `--allow-secret` only for intentional fixtures or
|
|
126
126
|
false positives; cfgit records that override in history metadata.
|
|
127
127
|
|
|
128
|
+
## Preview a commit
|
|
129
|
+
|
|
130
|
+
Add `--dry-run` to a single-record commit to see the exact field-level delta versus the live
|
|
131
|
+
record and exit without writing. It returns `would_commit` with the changes, or the same
|
|
132
|
+
`changed_outside_cfgit` / `noop` a real commit would, and still runs the secret policy so a
|
|
133
|
+
blocked secret surfaces before you write:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cfg commit agent_configs:agent_planner --from planner.json --dry-run
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Fast field edits (set / edit)
|
|
140
|
+
|
|
141
|
+
For a few scalar fields you do not need a full document or a temp file. `cfg set` fetches the
|
|
142
|
+
live document, applies your changes, and commits through the same path as `cfg commit` — so it
|
|
143
|
+
still refuses on out-of-band drift instead of clobbering it (it is not a raw write):
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
cfg set modelgarden_models:openai/gpt-4o-mini enabled=true retry.max=3 -m "enable + retry"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Paths are dotted, with list indices as `tags[0]`. Values are JSON-coerced — `enabled=true`
|
|
150
|
+
becomes a boolean, `n=5` an integer, `tags=["a","b"]` a list — and a `str:` prefix forces a
|
|
151
|
+
string (`version=str:1.0`). Add `--dry-run` to preview. To hand-edit the whole document in your
|
|
152
|
+
`$EDITOR` instead, use `cfg edit <record> -m "message"`.
|
|
153
|
+
|
|
154
|
+
## Situational awareness
|
|
155
|
+
|
|
156
|
+
`cfg doctor --status` prints a one-look header of where you are pointed: resolved config file,
|
|
157
|
+
env, target database, identity mode and whether it is verified, store reachability, and the
|
|
158
|
+
number of tracked and drifted records. If a `needs_approval` environment is still in `open`
|
|
159
|
+
identity mode — so writes would succeed unaudited — it prints a warning with the fix. That same
|
|
160
|
+
warning also prints on any mutating command against such an environment; suppress it in scripts
|
|
161
|
+
with `CFG_WARN_OPEN_MODE=0`.
|
|
162
|
+
|
|
163
|
+
## Guidance on every outcome
|
|
164
|
+
|
|
165
|
+
Every refusal and terminal outcome carries a `next` block: a plain-language reason plus the
|
|
166
|
+
exact next command(s) to run (for drift, that is `cfg diff` then `cfg adopt`). On the CLI it
|
|
167
|
+
prints to stderr; over `--json` and MCP it is a structured `next` field, so agents can follow
|
|
168
|
+
`next.commands` without guessing.
|
|
169
|
+
|
|
128
170
|
## Branches and PRs
|
|
129
171
|
|
|
130
172
|
Branching is opt-in:
|
|
@@ -274,14 +316,32 @@ shows recent activity across all configured records: current live drift plus the
|
|
|
274
316
|
latest cfgit history entries. Selecting one of those entries opens that record's
|
|
275
317
|
normal history and diff view.
|
|
276
318
|
|
|
277
|
-
##
|
|
319
|
+
## Output mode
|
|
320
|
+
|
|
321
|
+
By default output is human-readable when stdout is a terminal and JSON when piped or
|
|
322
|
+
redirected, so interactive use reads well while pipelines stay parseable. Control it with
|
|
323
|
+
`CFG_OUTPUT`:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
cfg status # human on a TTY, JSON when piped
|
|
327
|
+
cfg --json status # always JSON
|
|
328
|
+
CFG_OUTPUT=json cfg status # always JSON
|
|
329
|
+
CFG_OUTPUT=human cfg status # always human
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
`--json` and `CFG_OUTPUT=json` always force JSON. Agents and scripts should branch on `status`
|
|
333
|
+
and `state`, not on human-readable text.
|
|
334
|
+
|
|
335
|
+
## Session defaults
|
|
278
336
|
|
|
279
|
-
|
|
337
|
+
To avoid repeating flags, set environment defaults once:
|
|
280
338
|
|
|
281
339
|
```bash
|
|
282
|
-
|
|
283
|
-
cfg
|
|
340
|
+
export CFG_ENV=prod # default for --env
|
|
341
|
+
export CFG_CONFIG=./cfgit/aistudio.cfg.toml # default for --config-file
|
|
342
|
+
export CFG_AUTHOR=you@example.com # default author (open identity mode)
|
|
284
343
|
```
|
|
285
344
|
|
|
286
|
-
|
|
287
|
-
|
|
345
|
+
cfgit also discovers `.cfg.toml` by walking up from the current directory, so you can run it
|
|
346
|
+
from a subdirectory without `--config-file`. Global flags (`--config-file`, `--env`, `--author`,
|
|
347
|
+
`--branch`, `--json`) go before the subcommand: `cfg --env prod status`.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cfgit-impact"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "Optional cfgit plugin for deterministic system-impact summaries and opt-in LLM narration of database record diffs"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
license = "Apache-2.0"
|
|
8
8
|
authors = [{ name = "Mohammad Ausaf" }]
|
|
9
9
|
dependencies = [
|
|
10
|
-
"cfgit>=0.
|
|
10
|
+
"cfgit>=0.2.0,<0.3.0",
|
|
11
11
|
"httpx>=0.27",
|
|
12
12
|
]
|
|
13
13
|
|
|
@@ -39,8 +39,19 @@ Use cfgit as the safety layer around a live datastore. The app still reads and w
|
|
|
39
39
|
- If history lookup reports an env mismatch, re-run against the stamped env before making changes.
|
|
40
40
|
|
|
41
41
|
3. Mutate through cfgit.
|
|
42
|
-
-
|
|
42
|
+
- For a few scalar fields, prefer the fast path — no temp file needed:
|
|
43
|
+
`cfg set <record> field=value other.nested=value -m "<message>" --json`.
|
|
44
|
+
Values are JSON-coerced (`enabled=true`, `n=5`, `tags=["a","b"]`); prefix with `str:` to
|
|
45
|
+
force a string (`version=str:1.0`). `cfg set` fetches the LIVE doc and routes through the
|
|
46
|
+
same commit path, so it refuses on drift exactly like `commit` (it is not a raw write).
|
|
47
|
+
Add `--dry-run` to preview the field-level delta without writing.
|
|
48
|
+
- For a hand edit of the whole doc, `cfg edit <record> -m "<message>"` opens it in $EDITOR.
|
|
49
|
+
- For a large or scripted change, write the full target document to a temp JSON file.
|
|
43
50
|
- Run `cfg commit <record> --from <file> -m "<message>" --json`.
|
|
51
|
+
- Preview any commit before writing with `cfg commit <record> --from <file> --dry-run --json`
|
|
52
|
+
(returns `would_commit` with the delta, or `changed_outside_cfgit`/`noop`; writes nothing).
|
|
53
|
+
- Every outcome now carries a top-level `next` block (why + remedy + copy-paste `commands`);
|
|
54
|
+
on a refusal, follow `next.commands` rather than guessing.
|
|
44
55
|
- For a coupled multi-record change, write a batch JSON file and run `cfg commit --bulk-from <file> -m "<message>" --json`. The batch file can be `[{"record":"collection:id","doc":{...}}]` or `{"collection:id": {...}}`.
|
|
45
56
|
- For a draft branch, use `cfg --branch <branch> commit <record> --from <file> -m "<message>" --json` or `cfg --branch <branch> commit --bulk-from <file> -m "<message>" --json`. This writes cfgit refs only; runtime is unchanged.
|
|
46
57
|
- If commit returns `changed_outside_cfgit`, stop and inspect drift.
|