agent-first-data 0.2.2 → 0.2.4

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.
Files changed (2) hide show
  1. package/README.md +52 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,6 +10,43 @@ The field name is the schema. Agents read `latency_ms` and know milliseconds, `a
10
10
  npm install agent-first-data
11
11
  ```
12
12
 
13
+ ## Quick Example
14
+
15
+ A backup tool invoked from the CLI — flags, env vars, and config all use the same suffixes:
16
+
17
+ ```bash
18
+ API_KEY_SECRET=sk-1234 cloudback --timeout-s 30 --max-file-size-bytes 10737418240 /data/backup.tar.gz
19
+ ```
20
+
21
+ The tool reads env vars, flags, and config — all with AFD suffixes — and emits a startup message:
22
+
23
+ ```typescript
24
+ import { buildJsonStartup, outputJson, outputYaml, outputPlain } from "agent-first-data";
25
+
26
+ const startup = buildJsonStartup(
27
+ { timeout_s: 30, max_file_size_bytes: 10737418240 },
28
+ { input_path: "/data/backup.tar.gz" },
29
+ { API_KEY_SECRET: process.env.API_KEY_SECRET ?? null },
30
+ );
31
+ ```
32
+
33
+ Three output formats, same data:
34
+
35
+ ```
36
+ JSON: {"code":"startup","args":{"input_path":"/data/backup.tar.gz"},"config":{"max_file_size_bytes":10737418240,"timeout_s":30},"env":{"API_KEY_SECRET":"***"}}
37
+ YAML: code: "startup"
38
+ args:
39
+ input_path: "/data/backup.tar.gz"
40
+ config:
41
+ max_file_size: "10.0GB"
42
+ timeout: "30s"
43
+ env:
44
+ API_KEY: "***"
45
+ Plain: args.input_path=/data/backup.tar.gz code=startup config.max_file_size=10.0GB config.timeout=30s env.API_KEY=***
46
+ ```
47
+
48
+ `--timeout-s` → `timeout_s` → `timeout: 30s`. `API_KEY_SECRET` → `API_KEY: "***"`. The suffix is the schema.
49
+
13
50
  ## API Reference
14
51
 
15
52
  Total: **9 public APIs** + **AFD logging** (4 protocol builders + 3 output functions + 1 internal + 1 utility)
@@ -378,6 +415,21 @@ All formats automatically redact `_secret` fields.
378
415
  - **Currency**: `_msats`, `_sats`, `_btc`, `_usd_cents`, `_eur_cents`, `_jpy`, `_{code}_cents`
379
416
  - **Other**: `_percent`, `_secret` (auto-redacted in all formats)
380
417
 
418
+ ## Repository
419
+
420
+ This package is part of the [agent-first-data](https://github.com/cmnspore/agent-first-data) repository, which also contains:
421
+
422
+ - **`spec/`** — Full AFD specification with suffix definitions, protocol format rules, and cross-language test fixtures
423
+ - **`skills/`** — Claude Code skill for AI agents working with AFD conventions
424
+
425
+ To run tests, clone the full repository (tests use shared cross-language fixtures from `spec/fixtures/`):
426
+
427
+ ```bash
428
+ git clone https://github.com/cmnspore/agent-first-data
429
+ cd agent-first-data/typescript
430
+ npm test
431
+ ```
432
+
381
433
  ## License
382
434
 
383
435
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-first-data",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Agent-First Data (AFD) — suffix-driven output formatting and protocol templates for AI agents",
5
5
  "license": "MIT",
6
6
  "repository": {