@ansible-flow/assets 0.0.0-stage → 0.86.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sergei Chistokhin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
- # Temporary Holding Version
1
+ # @ansible-flow/assets
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Ansible Flow Designer files a host passes by path: the Python probe, the run events callback, the JSON schemas and the contract with Ansible Flow Server.
4
+
5
+ Built from [Ansible Flow Designer](https://github.com/ChistokhinSV/ansible-flow-designer) 0.86.0
6
+ and released with it. The folders are found by path: `import { probeDir, schemaDir, contractDir } from '@ansible-flow/assets'`.
7
+
8
+ What is in the package, which entry points are documented and what may change:
9
+ [docs/packages.md](https://github.com/ChistokhinSV/ansible-flow-designer/blob/main/docs/packages.md).
@@ -0,0 +1,40 @@
1
+ # Contract with Ansible Flow Server
2
+
3
+ What a client of [Ansible Flow Server](https://github.com/ChistokhinSV/ansible-flow-server) (the
4
+ VS Code extension's runner target) relies on, as data. The server replays these exchanges against
5
+ its real routes in its tests; a client replays them against a mock server. A change either side
6
+ makes that breaks the other shows in that side's tests.
7
+
8
+ Shipped in `@ansible-flow/assets` (`contractDir`).
9
+
10
+ ## `server-api.json`
11
+
12
+ - `world`: what the server holds before the first exchange: people (`users`), access tokens
13
+ (`tokens`, by name: owner, `readOnly`), one workspace, the owner's grants on it (`grants`), one
14
+ project whose repository is the folder `repo/` committed on `branch`, and its launch
15
+ configurations.
16
+ - `exchanges`, in order. Each has a `request` (`method`, `path`, `token`: a name from
17
+ `tokens`, none for no sign-in; `body`), the `response` it gets (`status`, `body` pattern) and
18
+ `capture`: values of the response body kept by name for later paths and patterns
19
+ (`"0.id"`: the `id` of the first element).
20
+
21
+ A body pattern matches the response body when:
22
+
23
+ | Pattern | Matches |
24
+ | -------------------------------------- | ---------------------------------------------------------------- |
25
+ | an object | an object that has each named key, each matching; others ignored |
26
+ | an array | an array of the same length, element by element |
27
+ | `{ "$items": p }` | an array whose every element matches `p` |
28
+ | `{ "$contains": "t" }` | a string that contains `t` |
29
+ | `"$string"`, `"$number"`, `"$boolean"` | a value of that type |
30
+ | `"$uuid"`, `"$commit"`, `"$time"` | a UUID, a 40-character git commit id, an ISO 8601 time |
31
+ | `"$any"` | anything, also nothing |
32
+ | `"${name}"` | the value captured as `name` |
33
+ | anything else | that value |
34
+
35
+ The `version` at the top changes when a pattern's meaning changes.
36
+
37
+ ## `repo/`
38
+
39
+ The project's files: a flow (`hello`), an inventory, and a flow in a format newer than any server
40
+ reads, which the server must refuse to run.
@@ -0,0 +1,110 @@
1
+ # Hello, Ansible: the smallest useful flow. Copy it with Open Sample Flow…, then Run as Skeleton on localhost.
2
+ schema_version: 2
3
+ flow:
4
+ id: 01M6GPM95NZM7QW2BDFB073CNN
5
+ key: hello
6
+ name: Hello, Ansible
7
+ version: 1
8
+ goal: "The smallest useful flow: reach each host, read a few facts and say hello. Run it as a skeleton on localhost."
9
+ inputs:
10
+ devices:
11
+ type: host_list
12
+ required: true
13
+ targets: true
14
+ nodes:
15
+ - id: 01M6GPM95RHBYFR7H44Z8GD2HB
16
+ key: start
17
+ type: start
18
+ title: Start
19
+ - id: 01M6GPM95RHBYFR7H44Z8GD2HC
20
+ key: done
21
+ type: end
22
+ title: Done
23
+ outcome: success
24
+ - id: 01M6GPM979RJPCDJ0XFF22GBSV
25
+ key: ping
26
+ type: task
27
+ title: Check the host answers
28
+ status: implemented
29
+ intent: "Ping each host: Ansible can reach it and run Python there."
30
+ impl:
31
+ kind: module
32
+ ref: ansible.builtin.ping
33
+ - id: 01M6GPM99KC9TX091MCH61REQV
34
+ key: facts
35
+ type: task
36
+ title: Read a few facts
37
+ status: implemented
38
+ intent: Gather a small set of facts about each host.
39
+ impl:
40
+ kind: module
41
+ ref: ansible.builtin.setup
42
+ params:
43
+ gather_subset:
44
+ - min
45
+ - id: 01M6GPM9B1D563X8PKD5041JHV
46
+ key: say-hello
47
+ type: task
48
+ title: Say hello
49
+ status: implemented
50
+ intent: Print a hello message with the name of each host.
51
+ impl:
52
+ kind: module
53
+ ref: ansible.builtin.debug
54
+ params:
55
+ msg: Hello from {{ inventory_hostname }}
56
+ - id: 01M6GPM9CA039FX7GVNYTH6JEP
57
+ key: stopped
58
+ type: end
59
+ title: Stopped
60
+ outcome: failed
61
+ edges:
62
+ - id: 01M6GPM95RHBYFR7H44Z8GD2HD
63
+ from:
64
+ node: 01M6GPM95RHBYFR7H44Z8GD2HB
65
+ port: ok_hosts
66
+ to:
67
+ node: 01M6GPM979RJPCDJ0XFF22GBSV
68
+ port: in
69
+ - id: 01M6GPM97W4B2AMEW6HFHXRBCG
70
+ from:
71
+ node: 01M6GPM979RJPCDJ0XFF22GBSV
72
+ port: ok_hosts
73
+ to:
74
+ node: 01M6GPM99KC9TX091MCH61REQV
75
+ port: in
76
+ - id: 01M6GPM9A7GQS7FR6FKHTWMKAF
77
+ from:
78
+ node: 01M6GPM99KC9TX091MCH61REQV
79
+ port: ok_hosts
80
+ to:
81
+ node: 01M6GPM9B1D563X8PKD5041JHV
82
+ port: in
83
+ - id: 01M6GPM9BGHTH5YB4114WK24SP
84
+ from:
85
+ node: 01M6GPM9B1D563X8PKD5041JHV
86
+ port: ok_hosts
87
+ to:
88
+ node: 01M6GPM95RHBYFR7H44Z8GD2HC
89
+ port: in
90
+ - id: 01M6GPM9CA039FX7GVNYTH6JEQ
91
+ from:
92
+ node: 01M6GPM979RJPCDJ0XFF22GBSV
93
+ port: failed_hosts
94
+ to:
95
+ node: 01M6GPM9CA039FX7GVNYTH6JEP
96
+ port: in
97
+ - id: 01M6GPM9CXF8DC6THEBZE6R4XM
98
+ from:
99
+ node: 01M6GPM99KC9TX091MCH61REQV
100
+ port: failed_hosts
101
+ to:
102
+ node: 01M6GPM9CA039FX7GVNYTH6JEP
103
+ port: in
104
+ - id: 01M6GPM9DHTDHEPP5YCJ04A8F5
105
+ from:
106
+ node: 01M6GPM9B1D563X8PKD5041JHV
107
+ port: failed_hosts
108
+ to:
109
+ node: 01M6GPM9CA039FX7GVNYTH6JEP
110
+ port: in
@@ -0,0 +1,110 @@
1
+ # Hello, Ansible: the smallest useful flow. Copy it with Open Sample Flow…, then Run as Skeleton on localhost.
2
+ schema_version: 3
3
+ flow:
4
+ id: 01M6GPM95NZM7QW2BDFB073CNP
5
+ key: next-format
6
+ name: A flow from a newer designer
7
+ version: 1
8
+ goal: "The smallest useful flow: reach each host, read a few facts and say hello. Run it as a skeleton on localhost."
9
+ inputs:
10
+ devices:
11
+ type: host_list
12
+ required: true
13
+ targets: true
14
+ nodes:
15
+ - id: 01M6GPM95RHBYFR7H44Z8GD2HB
16
+ key: start
17
+ type: start
18
+ title: Start
19
+ - id: 01M6GPM95RHBYFR7H44Z8GD2HC
20
+ key: done
21
+ type: end
22
+ title: Done
23
+ outcome: success
24
+ - id: 01M6GPM979RJPCDJ0XFF22GBSV
25
+ key: ping
26
+ type: task
27
+ title: Check the host answers
28
+ status: implemented
29
+ intent: "Ping each host: Ansible can reach it and run Python there."
30
+ impl:
31
+ kind: module
32
+ ref: ansible.builtin.ping
33
+ - id: 01M6GPM99KC9TX091MCH61REQV
34
+ key: facts
35
+ type: task
36
+ title: Read a few facts
37
+ status: implemented
38
+ intent: Gather a small set of facts about each host.
39
+ impl:
40
+ kind: module
41
+ ref: ansible.builtin.setup
42
+ params:
43
+ gather_subset:
44
+ - min
45
+ - id: 01M6GPM9B1D563X8PKD5041JHV
46
+ key: say-hello
47
+ type: task
48
+ title: Say hello
49
+ status: implemented
50
+ intent: Print a hello message with the name of each host.
51
+ impl:
52
+ kind: module
53
+ ref: ansible.builtin.debug
54
+ params:
55
+ msg: Hello from {{ inventory_hostname }}
56
+ - id: 01M6GPM9CA039FX7GVNYTH6JEP
57
+ key: stopped
58
+ type: end
59
+ title: Stopped
60
+ outcome: failed
61
+ edges:
62
+ - id: 01M6GPM95RHBYFR7H44Z8GD2HD
63
+ from:
64
+ node: 01M6GPM95RHBYFR7H44Z8GD2HB
65
+ port: ok_hosts
66
+ to:
67
+ node: 01M6GPM979RJPCDJ0XFF22GBSV
68
+ port: in
69
+ - id: 01M6GPM97W4B2AMEW6HFHXRBCG
70
+ from:
71
+ node: 01M6GPM979RJPCDJ0XFF22GBSV
72
+ port: ok_hosts
73
+ to:
74
+ node: 01M6GPM99KC9TX091MCH61REQV
75
+ port: in
76
+ - id: 01M6GPM9A7GQS7FR6FKHTWMKAF
77
+ from:
78
+ node: 01M6GPM99KC9TX091MCH61REQV
79
+ port: ok_hosts
80
+ to:
81
+ node: 01M6GPM9B1D563X8PKD5041JHV
82
+ port: in
83
+ - id: 01M6GPM9BGHTH5YB4114WK24SP
84
+ from:
85
+ node: 01M6GPM9B1D563X8PKD5041JHV
86
+ port: ok_hosts
87
+ to:
88
+ node: 01M6GPM95RHBYFR7H44Z8GD2HC
89
+ port: in
90
+ - id: 01M6GPM9CA039FX7GVNYTH6JEQ
91
+ from:
92
+ node: 01M6GPM979RJPCDJ0XFF22GBSV
93
+ port: failed_hosts
94
+ to:
95
+ node: 01M6GPM9CA039FX7GVNYTH6JEP
96
+ port: in
97
+ - id: 01M6GPM9CXF8DC6THEBZE6R4XM
98
+ from:
99
+ node: 01M6GPM99KC9TX091MCH61REQV
100
+ port: failed_hosts
101
+ to:
102
+ node: 01M6GPM9CA039FX7GVNYTH6JEP
103
+ port: in
104
+ - id: 01M6GPM9DHTDHEPP5YCJ04A8F5
105
+ from:
106
+ node: 01M6GPM9B1D563X8PKD5041JHV
107
+ port: failed_hosts
108
+ to:
109
+ node: 01M6GPM9CA039FX7GVNYTH6JEP
110
+ port: in
@@ -0,0 +1,3 @@
1
+ all:
2
+ hosts:
3
+ fw-edge-01: {}
@@ -0,0 +1,236 @@
1
+ {
2
+ "about": "The exchanges with Ansible Flow Server that a client (the VS Code extension's runner target) relies on. The server replays them against its routes; a client replays them against a mock. See contract/README.md.",
3
+ "version": 1,
4
+ "world": {
5
+ "users": [
6
+ { "login": "dana", "name": "Dana Whitfield", "admin": true },
7
+ { "login": "omar", "name": "Omar Haddad" }
8
+ ],
9
+ "tokens": {
10
+ "dana": { "user": "dana" },
11
+ "omar": { "user": "omar" },
12
+ "omar-read": { "user": "omar", "readOnly": true }
13
+ },
14
+ "workspace": { "key": "net", "name": "Network" },
15
+ "grants": [{ "user": "omar", "level": "operator" }],
16
+ "project": { "key": "edge", "name": "Edge", "branch": "main", "files": "repo" },
17
+ "launchConfigs": [
18
+ {
19
+ "name": "Hello",
20
+ "flowFile": "flows/hello.flow.yaml",
21
+ "inventory": "inventory/hosts.yaml",
22
+ "inputs": { "devices": ["fw-edge-01"] }
23
+ }
24
+ ]
25
+ },
26
+ "exchanges": [
27
+ {
28
+ "name": "what the server is: a client checks it first",
29
+ "request": { "method": "GET", "path": "/api/v1/meta" },
30
+ "response": {
31
+ "status": 200,
32
+ "body": {
33
+ "name": "Ansible Flow Server",
34
+ "version": "$string",
35
+ "api": "v1",
36
+ "instance": "$uuid",
37
+ "designer": {
38
+ "version": "$string",
39
+ "format": "$number",
40
+ "formats": { "$items": "$number" }
41
+ },
42
+ "features": { "$items": "$string" }
43
+ }
44
+ }
45
+ },
46
+ {
47
+ "name": "no token: sign in first",
48
+ "request": { "method": "GET", "path": "/api/v1/workspaces" },
49
+ "response": { "status": 401, "body": { "error": "unauthorized", "message": "$string" } }
50
+ },
51
+ {
52
+ "name": "the workspaces the token's owner may see",
53
+ "request": { "method": "GET", "path": "/api/v1/workspaces", "token": "omar" },
54
+ "response": {
55
+ "status": 200,
56
+ "body": [{ "id": "$uuid", "key": "net", "name": "Network" }]
57
+ }
58
+ },
59
+ {
60
+ "name": "a workspace's projects: where git reaches each, and the commit a run takes",
61
+ "request": { "method": "GET", "path": "/api/v1/workspaces/net/projects", "token": "omar" },
62
+ "response": {
63
+ "status": 200,
64
+ "body": [
65
+ {
66
+ "id": "$uuid",
67
+ "key": "edge",
68
+ "name": "Edge",
69
+ "gitPath": "/git/net/edge.git",
70
+ "gitRef": "main",
71
+ "commit": "$commit"
72
+ }
73
+ ]
74
+ },
75
+ "capture": { "project": "0.id", "commit": "0.commit" }
76
+ },
77
+ {
78
+ "name": "a project's flows; one in a newer format than the server reads cannot run",
79
+ "request": { "method": "GET", "path": "/api/v1/projects/${project}/flows", "token": "omar" },
80
+ "response": {
81
+ "status": 200,
82
+ "body": {
83
+ "commit": "${commit}",
84
+ "flows": [
85
+ { "file": "flows/hello.flow.yaml", "ok": true, "key": "hello", "errors": 0 },
86
+ {
87
+ "file": "flows/next.flow.yaml",
88
+ "ok": false,
89
+ "problem": { "$contains": "Upgrade the server" }
90
+ }
91
+ ]
92
+ }
93
+ }
94
+ },
95
+ {
96
+ "name": "a project's launch configurations",
97
+ "request": {
98
+ "method": "GET",
99
+ "path": "/api/v1/projects/${project}/launch-configs",
100
+ "token": "omar"
101
+ },
102
+ "response": {
103
+ "status": 200,
104
+ "body": [
105
+ {
106
+ "id": "$uuid",
107
+ "name": "Hello",
108
+ "flowFile": "flows/hello.flow.yaml",
109
+ "inventory": "inventory/hosts.yaml",
110
+ "mode": "check"
111
+ }
112
+ ]
113
+ },
114
+ "capture": { "config": "0.id" }
115
+ },
116
+ {
117
+ "name": "what a launch would run",
118
+ "request": {
119
+ "method": "POST",
120
+ "path": "/api/v1/launch-configs/${config}/check",
121
+ "token": "omar",
122
+ "body": { "mode": "check" }
123
+ },
124
+ "response": {
125
+ "status": 200,
126
+ "body": {
127
+ "launch": {
128
+ "commit": "${commit}",
129
+ "flow": { "file": "flows/hello.flow.yaml", "key": "hello", "name": "Hello, Ansible" },
130
+ "mode": "check",
131
+ "targets": ["fw-edge-01"]
132
+ },
133
+ "form": { "fields": { "$items": { "name": "$string" } } }
134
+ }
135
+ }
136
+ },
137
+ {
138
+ "name": "what stands in the way, by field",
139
+ "request": {
140
+ "method": "POST",
141
+ "path": "/api/v1/launch-configs/${config}/check",
142
+ "token": "omar",
143
+ "body": { "inputs": { "devices": "" } }
144
+ },
145
+ "response": {
146
+ "status": 422,
147
+ "body": {
148
+ "error": "$string",
149
+ "message": "$string",
150
+ "problems": [{ "field": "devices", "message": "$string" }]
151
+ }
152
+ }
153
+ },
154
+ {
155
+ "name": "a read-only token launches nothing",
156
+ "request": {
157
+ "method": "POST",
158
+ "path": "/api/v1/launch-configs/${config}/launch",
159
+ "token": "omar-read",
160
+ "body": {}
161
+ },
162
+ "response": { "status": 403, "body": { "error": "read_only_token", "message": "$string" } }
163
+ },
164
+ {
165
+ "name": "launch: the run is queued",
166
+ "request": {
167
+ "method": "POST",
168
+ "path": "/api/v1/launch-configs/${config}/launch",
169
+ "token": "omar",
170
+ "body": { "mode": "check" }
171
+ },
172
+ "response": {
173
+ "status": 201,
174
+ "body": {
175
+ "id": "$uuid",
176
+ "number": 1,
177
+ "project": "${project}",
178
+ "commit": "${commit}",
179
+ "flow": { "file": "flows/hello.flow.yaml", "key": "hello" },
180
+ "mode": "check",
181
+ "state": "queued",
182
+ "requestedBy": { "login": "omar" },
183
+ "createdAt": "$time"
184
+ }
185
+ },
186
+ "capture": { "run": "id" }
187
+ },
188
+ {
189
+ "name": "a run, as it stands",
190
+ "request": { "method": "GET", "path": "/api/v1/runs/${run}", "token": "omar" },
191
+ "response": {
192
+ "status": 200,
193
+ "body": { "id": "${run}", "number": 1, "state": "queued", "attempts": 0 }
194
+ }
195
+ },
196
+ {
197
+ "name": "a run's approvals (none reached yet)",
198
+ "request": { "method": "GET", "path": "/api/v1/runs/${run}/approvals", "token": "omar" },
199
+ "response": { "status": 200, "body": [] }
200
+ },
201
+ {
202
+ "name": "stop a run that has not started: it is cancelled at once",
203
+ "request": { "method": "POST", "path": "/api/v1/runs/${run}/cancel", "token": "omar" },
204
+ "response": {
205
+ "status": 202,
206
+ "body": { "id": "${run}", "state": "cancelled", "cancelledBy": "omar", "endedAt": "$time" }
207
+ }
208
+ },
209
+ {
210
+ "name": "a run that is not there",
211
+ "request": {
212
+ "method": "GET",
213
+ "path": "/api/v1/runs/00000000-0000-4000-8000-000000000000",
214
+ "token": "omar"
215
+ },
216
+ "response": { "status": 404, "body": { "error": "not_found", "message": "$string" } }
217
+ },
218
+ {
219
+ "name": "a launch configuration of a flow in a newer format is refused, at its field",
220
+ "request": {
221
+ "method": "POST",
222
+ "path": "/api/v1/projects/${project}/launch-configs",
223
+ "token": "dana",
224
+ "body": { "name": "Next", "flowFile": "flows/next.flow.yaml" }
225
+ },
226
+ "response": {
227
+ "status": 400,
228
+ "body": {
229
+ "error": "invalid",
230
+ "field": "flowFile",
231
+ "message": { "$contains": "Upgrade the server" }
232
+ }
233
+ }
234
+ }
235
+ ]
236
+ }
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /** The folder `probe/` of this package, as a path. */
2
+ export declare const probeDir: string;
3
+ /** The folder `schema/` of this package, as a path. */
4
+ export declare const schemaDir: string;
5
+ /** The folder `contract/` of this package, as a path. */
6
+ export declare const contractDir: string;
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ export const probeDir = fileURLToPath(new URL('./probe', import.meta.url));
4
+ export const schemaDir = fileURLToPath(new URL('./schema', import.meta.url));
5
+ export const contractDir = fileURLToPath(new URL('./contract', import.meta.url));
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@ansible-flow/assets",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.86.0",
4
+ "description": "Ansible Flow Designer files a host passes by path: the Python probe, the run events callback, the JSON schemas and the contract with Ansible Flow Server.",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/ChistokhinSV/ansible-flow-designer/blob/main/docs/packages.md",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ChistokhinSV/ansible-flow-designer.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/ChistokhinSV/ansible-flow-designer/issues"
13
+ },
14
+ "type": "module",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./index.d.ts",
18
+ "default": "./index.js"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "index.js",
24
+ "index.d.ts",
25
+ "probe",
26
+ "schema",
27
+ "contract"
28
+ ],
29
+ "engines": {
30
+ "node": ">=22.13"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }
@@ -0,0 +1,6 @@
1
+ """Ansible Flow Designer probe: answers Ansible questions with Ansible's own APIs (ADR-0005).
2
+
3
+ Runs inside the target environment (EE container, Remote host, venv). Stdlib only.
4
+ """
5
+
6
+ __version__ = "0.3.1"
@@ -0,0 +1,23 @@
1
+ """Entry point: python -m afd_probe serve --root <repo>."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+
8
+
9
+ def main(argv: list[str] | None = None) -> int:
10
+ parser = argparse.ArgumentParser(prog="afd_probe", description=__doc__)
11
+ sub = parser.add_subparsers(dest="command", required=True)
12
+ serve = sub.add_parser("serve", help="JSON-lines session on stdin/stdout")
13
+ serve.add_argument("--root", required=True, help="repository root as seen by the probe")
14
+ args = parser.parse_args(argv)
15
+ if args.command == "serve":
16
+ from afd_probe.serve import serve as run
17
+
18
+ return run(args.root)
19
+ return 2
20
+
21
+
22
+ if __name__ == "__main__":
23
+ sys.exit(main())