agent-first-data 0.22.0__tar.gz → 0.24.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.
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/PKG-INFO +2 -2
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/README.md +1 -1
- agent_first_data-0.24.0/agent_first_data/assets/cli-help-v1.schema.json +225 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data/cli.py +6 -4
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data.egg-info/PKG-INFO +2 -2
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data.egg-info/SOURCES.txt +1 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/pyproject.toml +1 -1
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/tests/test_cli.py +18 -3
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data/__init__.py +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data/assets/protocol-v1.schema.json +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data/assets/registry.json +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data/format.py +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data.egg-info/dependency_links.txt +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data.egg-info/top_level.txt +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/setup.cfg +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/tests/test_format.py +0 -0
- {agent_first_data-0.22.0 → agent_first_data-0.24.0}/tests/test_no_stderr_policy.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-first-data
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.24.0
|
|
4
4
|
Summary: A naming convention that lets AI agents understand your data without being told what it means, plus a CLI and library for reading and safely editing structured JSON, TOML, YAML, dotenv, and INI documents.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Repository, https://github.com/agentfirstkit/agent-first-data
|
|
@@ -37,7 +37,7 @@ Useful names use Python casing: `render` (the single value x format x options ->
|
|
|
37
37
|
- YAML keeps original keys and values (structure-preserving, like JSON), sorting keys by UTF-16 code unit order and quoting/escaping unsafe keys and string scalars. Plain strips formatting suffixes, formats values, sorts the same way, and renders nested objects/arrays as canonical JSON.
|
|
38
38
|
- Logging records use `kind:"log"` with a nested `log` payload and a separate `level` field, so error-level logs are not terminal protocol errors.
|
|
39
39
|
- `build_cli_error(message, hint?)` returns a strict-ready CLI error with `error.retryable:false` and `trace:{}`.
|
|
40
|
-
- Use `cli_handle_version_or_continue()` before argument parsing so `--version
|
|
40
|
+
- Use `cli_handle_version_or_continue()` before argument parsing so `--version` always answers with a structured protocol-v1 `kind:"result"` version event. Explicit `--output`/`--json` wins; pass the command's normal output as `default_format` (JSON when omitted), plus its value-taking global flag names.
|
|
41
41
|
|
|
42
42
|
## Reference
|
|
43
43
|
|
|
@@ -28,7 +28,7 @@ Useful names use Python casing: `render` (the single value x format x options ->
|
|
|
28
28
|
- YAML keeps original keys and values (structure-preserving, like JSON), sorting keys by UTF-16 code unit order and quoting/escaping unsafe keys and string scalars. Plain strips formatting suffixes, formats values, sorts the same way, and renders nested objects/arrays as canonical JSON.
|
|
29
29
|
- Logging records use `kind:"log"` with a nested `log` payload and a separate `level` field, so error-level logs are not terminal protocol errors.
|
|
30
30
|
- `build_cli_error(message, hint?)` returns a strict-ready CLI error with `error.retryable:false` and `trace:{}`.
|
|
31
|
-
- Use `cli_handle_version_or_continue()` before argument parsing so `--version
|
|
31
|
+
- Use `cli_handle_version_or_continue()` before argument parsing so `--version` always answers with a structured protocol-v1 `kind:"result"` version event. Explicit `--output`/`--json` wins; pass the command's normal output as `default_format` (JSON when omitted), plus its value-taking global flag names.
|
|
32
32
|
|
|
33
33
|
## Reference
|
|
34
34
|
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agentfirstkit.org/schemas/agent-first-data/cli-help-v1.schema.json",
|
|
4
|
+
"title": "AFDATA CLI help v1 event",
|
|
5
|
+
"description": "Compact, progressively disclosed CLI help carried by an AFDATA result event.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"kind",
|
|
9
|
+
"result",
|
|
10
|
+
"trace"
|
|
11
|
+
],
|
|
12
|
+
"additionalProperties": false,
|
|
13
|
+
"properties": {
|
|
14
|
+
"kind": {
|
|
15
|
+
"const": "result"
|
|
16
|
+
},
|
|
17
|
+
"result": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"required": [
|
|
20
|
+
"code",
|
|
21
|
+
"help"
|
|
22
|
+
],
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"properties": {
|
|
25
|
+
"code": {
|
|
26
|
+
"const": "help"
|
|
27
|
+
},
|
|
28
|
+
"help": {
|
|
29
|
+
"$ref": "#/$defs/help"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"trace": {
|
|
34
|
+
"type": "object"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"$defs": {
|
|
38
|
+
"argument": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"required": [
|
|
41
|
+
"name"
|
|
42
|
+
],
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"properties": {
|
|
45
|
+
"name": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"minLength": 1
|
|
48
|
+
},
|
|
49
|
+
"short": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"pattern": "^-[^-]$"
|
|
52
|
+
},
|
|
53
|
+
"help": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"minLength": 1
|
|
56
|
+
},
|
|
57
|
+
"required": {
|
|
58
|
+
"const": true
|
|
59
|
+
},
|
|
60
|
+
"global": {
|
|
61
|
+
"const": true
|
|
62
|
+
},
|
|
63
|
+
"repeatable": {
|
|
64
|
+
"const": true
|
|
65
|
+
},
|
|
66
|
+
"value": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"minLength": 1
|
|
69
|
+
},
|
|
70
|
+
"values": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"minItems": 1,
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"minLength": 1
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"default": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"defaults": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"minItems": 1,
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"allOf": [
|
|
90
|
+
{
|
|
91
|
+
"if": {
|
|
92
|
+
"properties": {
|
|
93
|
+
"name": {
|
|
94
|
+
"pattern": "^-"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"else": {
|
|
99
|
+
"not": {
|
|
100
|
+
"anyOf": [
|
|
101
|
+
{
|
|
102
|
+
"required": [
|
|
103
|
+
"value"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"required": [
|
|
108
|
+
"values"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"not": {
|
|
117
|
+
"required": [
|
|
118
|
+
"value",
|
|
119
|
+
"values"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"not": {
|
|
125
|
+
"required": [
|
|
126
|
+
"default",
|
|
127
|
+
"defaults"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"command": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"required": [
|
|
136
|
+
"name"
|
|
137
|
+
],
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"properties": {
|
|
140
|
+
"name": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"minLength": 1
|
|
143
|
+
},
|
|
144
|
+
"about": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"minLength": 1
|
|
147
|
+
},
|
|
148
|
+
"usage": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"minLength": 1
|
|
151
|
+
},
|
|
152
|
+
"arguments": {
|
|
153
|
+
"type": "array",
|
|
154
|
+
"minItems": 1,
|
|
155
|
+
"items": {
|
|
156
|
+
"$ref": "#/$defs/argument"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"subcommands": {
|
|
160
|
+
"type": "array",
|
|
161
|
+
"minItems": 1,
|
|
162
|
+
"items": {
|
|
163
|
+
"$ref": "#/$defs/command"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"help": {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"required": [
|
|
171
|
+
"scope",
|
|
172
|
+
"command_path",
|
|
173
|
+
"name"
|
|
174
|
+
],
|
|
175
|
+
"additionalProperties": false,
|
|
176
|
+
"properties": {
|
|
177
|
+
"scope": {
|
|
178
|
+
"enum": [
|
|
179
|
+
"one_level",
|
|
180
|
+
"recursive"
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
"command_path": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"minLength": 1
|
|
186
|
+
},
|
|
187
|
+
"inherited_arguments_from": {
|
|
188
|
+
"type": "array",
|
|
189
|
+
"minItems": 1,
|
|
190
|
+
"uniqueItems": true,
|
|
191
|
+
"items": {
|
|
192
|
+
"type": "string",
|
|
193
|
+
"minLength": 1
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"name": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"minLength": 1
|
|
199
|
+
},
|
|
200
|
+
"about": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"minLength": 1
|
|
203
|
+
},
|
|
204
|
+
"usage": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"minLength": 1
|
|
207
|
+
},
|
|
208
|
+
"arguments": {
|
|
209
|
+
"type": "array",
|
|
210
|
+
"minItems": 1,
|
|
211
|
+
"items": {
|
|
212
|
+
"$ref": "#/$defs/argument"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"subcommands": {
|
|
216
|
+
"type": "array",
|
|
217
|
+
"minItems": 1,
|
|
218
|
+
"items": {
|
|
219
|
+
"$ref": "#/$defs/command"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -451,6 +451,8 @@ def cli_handle_version_or_continue(
|
|
|
451
451
|
display_name: str | None,
|
|
452
452
|
version: str,
|
|
453
453
|
build: str | None,
|
|
454
|
+
*,
|
|
455
|
+
default_format: OutputFormat = OutputFormat.JSON,
|
|
454
456
|
) -> str | None:
|
|
455
457
|
"""Render version output if --version/-V is present; otherwise return None.
|
|
456
458
|
|
|
@@ -461,8 +463,8 @@ def cli_handle_version_or_continue(
|
|
|
461
463
|
|
|
462
464
|
The one blessed behavior: ``--version``/``-V`` always answers with a
|
|
463
465
|
protocol-v1 ``kind:"result"`` version event (see :func:`build_cli_version`) —
|
|
464
|
-
|
|
465
|
-
|
|
466
|
+
An explicit ``--json`` / ``--output <json|yaml|plain>`` wins; otherwise
|
|
467
|
+
``default_format`` should be the command's normal output default.
|
|
466
468
|
|
|
467
469
|
Only a top-level version request is recognized: scanning stops at the first
|
|
468
470
|
positional argument (the subcommand), so ``tool sub --version <value>``
|
|
@@ -490,7 +492,7 @@ def cli_handle_version_or_continue(
|
|
|
490
492
|
break
|
|
491
493
|
|
|
492
494
|
flag_name, inline_value = _split_flag(arg)
|
|
493
|
-
if arg
|
|
495
|
+
if arg == "--version":
|
|
494
496
|
version_requested = True
|
|
495
497
|
i += 1
|
|
496
498
|
continue
|
|
@@ -560,7 +562,7 @@ def cli_handle_version_or_continue(
|
|
|
560
562
|
display_name,
|
|
561
563
|
version,
|
|
562
564
|
build,
|
|
563
|
-
output_format if output_format is not None else
|
|
565
|
+
output_format if output_format is not None else default_format,
|
|
564
566
|
)
|
|
565
567
|
|
|
566
568
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-first-data
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.24.0
|
|
4
4
|
Summary: A naming convention that lets AI agents understand your data without being told what it means, plus a CLI and library for reading and safely editing structured JSON, TOML, YAML, dotenv, and INI documents.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Repository, https://github.com/agentfirstkit/agent-first-data
|
|
@@ -37,7 +37,7 @@ Useful names use Python casing: `render` (the single value x format x options ->
|
|
|
37
37
|
- YAML keeps original keys and values (structure-preserving, like JSON), sorting keys by UTF-16 code unit order and quoting/escaping unsafe keys and string scalars. Plain strips formatting suffixes, formats values, sorts the same way, and renders nested objects/arrays as canonical JSON.
|
|
38
38
|
- Logging records use `kind:"log"` with a nested `log` payload and a separate `level` field, so error-level logs are not terminal protocol errors.
|
|
39
39
|
- `build_cli_error(message, hint?)` returns a strict-ready CLI error with `error.retryable:false` and `trace:{}`.
|
|
40
|
-
- Use `cli_handle_version_or_continue()` before argument parsing so `--version
|
|
40
|
+
- Use `cli_handle_version_or_continue()` before argument parsing so `--version` always answers with a structured protocol-v1 `kind:"result"` version event. Explicit `--output`/`--json` wins; pass the command's normal output as `default_format` (JSON when omitted), plus its value-taking global flag names.
|
|
41
41
|
|
|
42
42
|
## Reference
|
|
43
43
|
|
|
@@ -7,6 +7,7 @@ agent_first_data.egg-info/PKG-INFO
|
|
|
7
7
|
agent_first_data.egg-info/SOURCES.txt
|
|
8
8
|
agent_first_data.egg-info/dependency_links.txt
|
|
9
9
|
agent_first_data.egg-info/top_level.txt
|
|
10
|
+
agent_first_data/assets/cli-help-v1.schema.json
|
|
10
11
|
agent_first_data/assets/protocol-v1.schema.json
|
|
11
12
|
agent_first_data/assets/registry.json
|
|
12
13
|
tests/test_cli.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agent-first-data"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.24.0"
|
|
4
4
|
description = "A naming convention that lets AI agents understand your data without being told what it means, plus a CLI and library for reading and safely editing structured JSON, TOML, YAML, dotenv, and INI documents."
|
|
5
5
|
license = "MIT"
|
|
6
6
|
readme = "README.md"
|
|
@@ -520,9 +520,9 @@ def test_cli_render_version_renders_json():
|
|
|
520
520
|
assert '"version":"1.2.3"' in out
|
|
521
521
|
|
|
522
522
|
|
|
523
|
-
def
|
|
524
|
-
#
|
|
525
|
-
#
|
|
523
|
+
def test_cli_handle_version_bare_inherits_json_default():
|
|
524
|
+
# `--version` answers with a protocol-v1 event and follows the command's
|
|
525
|
+
# declared output default.
|
|
526
526
|
out = cli_handle_version_or_continue(
|
|
527
527
|
["--version"],
|
|
528
528
|
VERSION_VALUE_FLAGS,
|
|
@@ -542,6 +542,21 @@ def test_cli_handle_version_bare_defaults_to_json():
|
|
|
542
542
|
assert parsed["trace"] == {}
|
|
543
543
|
|
|
544
544
|
|
|
545
|
+
def test_cli_handle_version_bare_inherits_plain_default():
|
|
546
|
+
out = cli_handle_version_or_continue(
|
|
547
|
+
["--version"],
|
|
548
|
+
VERSION_VALUE_FLAGS,
|
|
549
|
+
"agent-cli",
|
|
550
|
+
None,
|
|
551
|
+
"1.2.3",
|
|
552
|
+
None,
|
|
553
|
+
default_format=OutputFormat.PLAIN,
|
|
554
|
+
)
|
|
555
|
+
assert out is not None
|
|
556
|
+
assert "result.code=version" in out
|
|
557
|
+
assert "result.version=1.2.3" in out
|
|
558
|
+
|
|
559
|
+
|
|
545
560
|
def test_cli_handle_version_honors_explicit_plain_output():
|
|
546
561
|
out = cli_handle_version_or_continue(
|
|
547
562
|
["--version", "--output", "plain"],
|
|
File without changes
|
{agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data/assets/protocol-v1.schema.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agent_first_data-0.22.0 → agent_first_data-0.24.0}/agent_first_data.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|