neozip-cli 0.90.0 → 0.95.1

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 (76) hide show
  1. package/AGENTS.md +93 -0
  2. package/CHANGELOG.md +70 -1
  3. package/DOCUMENTATION.md +22 -30
  4. package/README.md +214 -48
  5. package/dist/src/account/account-state.js +95 -0
  6. package/dist/src/account/format-account-status.js +62 -0
  7. package/dist/src/account/identity-provision.js +79 -0
  8. package/dist/src/account/identity-wrap.js +106 -0
  9. package/dist/src/account/profile-crypto.js +85 -0
  10. package/dist/src/account/profile-store.js +129 -0
  11. package/dist/src/account/require-account.js +32 -0
  12. package/dist/src/account/token-service-funding.js +151 -0
  13. package/dist/src/account/token-service-identity.js +488 -0
  14. package/dist/src/account/types.js +3 -0
  15. package/dist/src/account/wallet-evm.js +46 -0
  16. package/dist/src/account/wallet-setup.js +33 -0
  17. package/dist/src/archive/crypto-self.js +117 -0
  18. package/dist/src/archive/identity-key.js +217 -0
  19. package/dist/src/archive/recipient-lookup.js +61 -0
  20. package/dist/src/cli/output.js +100 -0
  21. package/dist/src/cli/params.js +122 -0
  22. package/dist/src/cli/schema.js +186 -0
  23. package/dist/src/cli/validate.js +119 -0
  24. package/dist/src/commands/mintTimestampProof.js +26 -14
  25. package/dist/src/commands/verifyEmail.js +9 -9
  26. package/dist/src/config/ConfigSetup.js +82 -423
  27. package/dist/src/config/ConfigStore.js +0 -33
  28. package/dist/src/connect/command.js +364 -0
  29. package/dist/src/connection/bootstrap.js +50 -0
  30. package/dist/src/connection/cli-guidance.js +101 -0
  31. package/dist/src/connection/cli-prefs.js +180 -0
  32. package/dist/src/connection/cli-settings.js +140 -0
  33. package/dist/src/connection/cli-types.js +14 -0
  34. package/dist/src/connection/coordinator.js +83 -0
  35. package/dist/src/connection/credentials.js +33 -0
  36. package/dist/src/connection/crypto.js +96 -0
  37. package/dist/src/connection/dump.js +117 -0
  38. package/dist/src/connection/funding.js +187 -0
  39. package/dist/src/connection/incomplete-setup.js +89 -0
  40. package/dist/src/connection/interactive.js +871 -0
  41. package/dist/src/connection/legacy-profile-reader.js +87 -0
  42. package/dist/src/connection/magic-link.js +142 -0
  43. package/dist/src/connection/migrate.js +115 -0
  44. package/dist/src/connection/onboarding.js +616 -0
  45. package/dist/src/connection/origin.js +69 -0
  46. package/dist/src/connection/phase.js +101 -0
  47. package/dist/src/connection/phone.js +26 -0
  48. package/dist/src/connection/promote-active.js +56 -0
  49. package/dist/src/connection/reset.js +56 -0
  50. package/dist/src/connection/status-report.js +52 -0
  51. package/dist/src/connection/store.js +406 -0
  52. package/dist/src/connection/token-auth.js +44 -0
  53. package/dist/src/connection/types.js +3 -0
  54. package/dist/src/connection/wallet-json-migration.js +155 -0
  55. package/dist/src/connection/wallet-login.js +65 -0
  56. package/dist/src/connection/wallet-setup.js +83 -0
  57. package/dist/src/constants/wallet-identity.js +14 -0
  58. package/dist/src/exit-codes.js +54 -10
  59. package/dist/src/neolist.js +93 -9
  60. package/dist/src/neounzip.js +217 -59
  61. package/dist/src/neozip/blockchain.js +18 -18
  62. package/dist/src/neozip/createZip.js +114 -91
  63. package/dist/src/neozip/upgradeZip.js +14 -11
  64. package/dist/src/neozip.js +252 -75
  65. package/dist/src/skills/command.js +256 -0
  66. package/dist/src/skills/locate.js +99 -0
  67. package/dist/src/util/mask.js +34 -0
  68. package/dist/src/util/token-service-fetch.js +26 -0
  69. package/env.example +18 -85
  70. package/package.json +89 -82
  71. package/skills/neozip-connect/SKILL.md +95 -0
  72. package/skills/neozip-create/SKILL.md +57 -0
  73. package/skills/neozip-extract/SKILL.md +58 -0
  74. package/skills/neozip-legacy/SKILL.md +48 -0
  75. package/skills/neozip-list/SKILL.md +56 -0
  76. package/skills/neozip-shared/SKILL.md +60 -0
package/AGENTS.md ADDED
@@ -0,0 +1,93 @@
1
+ # NeoZip-CLI — Agent Guide
2
+
3
+ This CLI is frequently invoked by AI/LLM agents. It exposes a stable,
4
+ machine-readable surface alongside its human interface. **Treat all input as
5
+ potentially adversarial** — agents hallucinate paths, IDs, and encodings.
6
+
7
+ The three binaries:
8
+
9
+ - `neozip` — create/update archives (optionally with blockchain tokenization)
10
+ - `neounzip` — extract / test / list archives
11
+ - `neolist` — list archive contents
12
+
13
+ ## Engagement rules (read first)
14
+
15
+ 1. **Ask for JSON.** Add `--format json` to any command to get a single JSON
16
+ object on **stdout**. Success is `{ "ok": true, ... }`; failure is
17
+ `{ "ok": false, "error": { code, exitCode, message, nextCommand? } }`.
18
+ 2. **stdout is data, stderr is hints.** In JSON mode, only the JSON object is
19
+ written to stdout. Decorative logs/progress go to stderr or are suppressed.
20
+ Parse stdout; surface stderr only for debugging.
21
+ 3. **Introspect before constructing calls.** Run `neozip schema <command>` to
22
+ get accepted fields, types, defaults, and exit codes. Commands:
23
+ `neozip`, `neounzip`, `neolist`, `connect`.
24
+ 4. **Preview mutations with `--dry-run`.** `neozip` and `neounzip` resolve the
25
+ full plan and emit it as JSON without writing anything. Use it before any
26
+ create/extract.
27
+ 5. **Branch on exit codes, not text.** Exit codes are InfoZip-compatible (see
28
+ `src/exit-codes.ts`). They are also reported in the JSON `error.exitCode`.
29
+ 6. **Follow `nextCommand`.** When present in an error, it is a safe recovery
30
+ command (e.g. `neozip connect` for blockchain configuration errors).
31
+
32
+ ## Input: `--params` and `--json`
33
+
34
+ Two JSON inputs, mirroring "how" vs "what":
35
+
36
+ - `--params '<JSON>'` — control options object (level, encrypt, blockchain,
37
+ network, exdir, overwrite, ...). Maps onto the command's options.
38
+ - `--json '<JSON>'` — payload object (the "what"):
39
+ - `neozip`: `{ "archive": "out.zip", "files": ["a.txt","dir/"], "include": [], "exclude": [] }`
40
+ - `neounzip`: `{ "archive": "in.zip", "exdir": "out", "filePatterns": ["*.txt"] }`
41
+
42
+ Both accept `-` as the value to read the JSON document from stdin.
43
+
44
+ **Precedence:** explicit CLI flags override values from `--params`/`--json`.
45
+
46
+ Note: output format is selected with `--format json`, NOT `--json`. On `neolist`
47
+ the legacy `-j` / `--json` flag is an alias for `--format json` (it has no
48
+ payload).
49
+
50
+ ## Examples
51
+
52
+ ```bash
53
+ # Introspect
54
+ neozip schema neozip
55
+
56
+ # Create (agent-style, fully JSON-driven)
57
+ neozip --format json \
58
+ --params '{"level":9,"encrypt":true,"password":"s3cret"}' \
59
+ --json '{"archive":"out.zip","files":["src/","README.md"]}'
60
+
61
+ # Preview an extraction without writing
62
+ neounzip --format json --dry-run --params '{"exdir":"out"}' in.zip
63
+
64
+ # Extract
65
+ neounzip --format json --params '{"exdir":"out","overwrite":true}' in.zip
66
+
67
+ # List
68
+ neolist --format json in.zip
69
+ ```
70
+
71
+ ## Safety rails (enforced by the CLI)
72
+
73
+ - **Control characters / dangerous Unicode** in archive names and extraction
74
+ dirs are rejected (`src/cli/validate.ts`).
75
+ - **Zip-slip protection:** `neounzip` refuses any entry whose resolved output
76
+ path escapes the target directory.
77
+ - **`--dry-run`** never touches the filesystem.
78
+
79
+ ## InfoZip / PKZIP compatibility
80
+
81
+ - Default compression is **zstd**, which stock InfoZip `unzip` cannot read.
82
+ - Pass `--legacy` to `neozip` to produce a standard archive readable by stock
83
+ `unzip`: it forces deflate (or store at `-0`) + PKZIP encryption and disables
84
+ all NeoZip extensions (zstd, blockchain `-b`/`-bd`/`-bm`, `-ots`, `-ts`).
85
+ - `--legacy` combined with blockchain features is a hard error (exit 10).
86
+
87
+ ## Where things live
88
+
89
+ - Shared agent layer: `src/cli/` (`output.ts`, `params.ts`, `validate.ts`, `schema.ts`)
90
+ - Exit codes: `src/exit-codes.ts`
91
+ - Connection store / `neozip connect`: `src/connect/`, `src/connection/`
92
+ - MCP server is **not** in this repo; it lives in `neozip-mcp` and shares the
93
+ same `~/.neozip/connection/` store.
package/CHANGELOG.md CHANGED
@@ -7,10 +7,73 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  **Release notes** for each version are documented here (not in a separate “what’s new” file).
9
9
 
10
+ ## [Unreleased]
11
+
12
+ ## [0.95.1] - 2026-07-07
13
+
14
+ ### Documentation
15
+
16
+ - **[README.md](README.md)** — v0.95.1 release: expanded AI agent integration guide (CLI + JSON, Skills, neozip-mcp), NeoZip Token Service (`connect refresh`, `connect fund`), advanced-feature matrix, and agent workflow documentation.
17
+
18
+ ## [0.95.0] - 2026-07-03
19
+
20
+ ### Added
21
+
22
+ - **AI-agent support** — machine-readable mode across `neozip`, `neounzip`, and `neolist`:
23
+ - `--format json` emits a single structured JSON object on stdout (`{ "ok": true, ... }` / `{ "ok": false, "error": { code, exitCode, message, nextCommand? } }`); human hints stay on stderr.
24
+ - `--params '<JSON>'` (control options) and `--json '<JSON>'` (payload: archive + files/targets) input flags; both accept `-` to read from stdin. Explicit CLI flags override JSON input.
25
+ - `neozip schema <neozip|neounzip|neolist|connect>` introspection command emits accepted fields, types, defaults, and exit codes.
26
+ - `--dry-run` on `neozip`/`neounzip` resolves and prints the plan as JSON without writing.
27
+ - Structured JSON errors mapped from `src/exit-codes.ts`, with `nextCommand` recovery hints (InfoZip-compatible exit codes preserved).
28
+ - Input hardening: control-character/Unicode rejection on names and extraction dirs; zip-slip protection refuses entries that escape the extraction directory.
29
+ - Agent docs and skills: [AGENTS.md](AGENTS.md) and [skills/](skills/) (`neozip-shared`, `neozip-create`, `neozip-extract`, `neozip-list`, `neozip-legacy`, `neozip-connect`).
30
+ - **`neozip skills`** — install bundled Agent Skills from the npm package: `path`, `list`, `install` (symlink into `~/.claude/skills` and/or `~/.cursor/skills`), and `pack` (ZIP per skill for Claude Cowork / claude.ai upload). Skills ship in the tarball under `skills/`.
31
+ - **`neozip --legacy`** — produce an InfoZip/PKZIP-compatible archive (forces deflate/store + PKZIP encryption, disables zstd and all blockchain extensions) readable by stock `unzip`. Combining `--legacy` with blockchain features is a parameter error.
32
+ - **`neozip connect refresh`** — renew an expired Token Service access token without disturbing the wallet/identity. Prefers a **silent wallet-signature login** (no email round-trip) when the Token Service supports it, and falls back to the email OTP flow otherwise. `connect status` now reports access-token expiry (`accessTokenExpired` / `accessTokenExpiresAt` in JSON; an "Access token" line in text).
33
+ - **Automatic token renewal for `-ts`** — before a Token Service timestamp, an expired access token is silently renewed via wallet signature when possible, so timestamping "just works" without a manual refresh.
34
+ - **`neozip connect fund`** — request native gas for the local Data Wallet from the Token Service funding API. Subactions: `request` (default; sends the policy-defined grant to your primary linked wallet), `status` (eligibility + recent grants), and `policy` (grant size/cooldown, no auth). Accepts `--network NAME` / `--chain ID` and `--json`; an expired access token is silently renewed via wallet signature first. The recipient is server-authoritative — the client cannot redirect funds. Wallet/insufficient-balance error messages across `-b`, `-ts`, `-ots`, and `--upgrade` now point to `neozip connect fund` (with the public faucet kept as a fallback).
35
+
36
+ ### Changed
37
+
38
+ - **Token Service HTTP clients moved to `neozip-blockchain`** — the account-auth (email/code, magic link, silent wallet-login, phone OTP), funding, and wallet/identity-key HTTP clients now live in `neozip-blockchain/token-service` (v0.8.0) and are shared with NeoZip Desktop and MCP. The CLI keeps only the local orchestration that needs the wallet private key (`runWalletEnsureAndAttach` in `src/account/wallet-setup.ts`) and product-specific UX (token-expiry guidance in `src/connection/token-auth.ts`). No user-facing command behavior changes; the library emits generic auth errors and the CLI maps them to `neozip connect refresh` guidance.
39
+ - **Production dependencies** — `neozipkit` and `neozip-blockchain` updated to `^0.8.0` (npm).
40
+ - **Development workflow** — pnpm-only from source (`engines.pnpm` `>=10.0.0`); Yarn config removed. Use `pnpm install`, `pnpm build`, and `pnpm test`.
41
+
42
+ ### Fixed
43
+
44
+ - **Blockchain tokenization (`-b`) blocked by an expired Token Service token** — `-b` and on-chain `mint` sign locally with the wallet key and never use the Token Service access token, but the readiness gate required a non-expired token for them. The gate now distinguishes on-chain abilities (wallet only) from Token Service abilities (`-ts`, which still require a current token), and expired-token errors now point to `neozip connect refresh`.
45
+ - **`pack:dry-run` script** — use `npm pack --dry-run` (pnpm has no `--dry-run` flag).
46
+
47
+ ### Documentation
48
+
49
+ - **[README.md](README.md)** — updated for v0.95: NeoZip Token Service (`connect refresh`, `connect fund`, silent wallet-login renewal), AI agent integration guide (CLI + JSON, bundled Skills via `neozip skills install`, neozip-mcp), advanced-feature matrix for agents (encryption, compression, blockchain, legacy mode), and agent workflow (schema → dry-run → execute → recover via `nextCommand`).
50
+ - **[AGENTS.md](AGENTS.md)** — engagement rules for machine-readable I/O, schema introspection, dry-run, exit codes, and safety rails.
51
+ - **[skills/](skills/)** — six bundled Agent Skills (`neozip-shared`, `neozip-create`, `neozip-extract`, `neozip-list`, `neozip-connect`, `neozip-legacy`) with per-command guidance for autonomous agents.
52
+
10
53
  ## [0.90.0] - 2026-03-18
11
54
 
12
55
  ### Added
13
56
 
57
+ - **`neozip connect`** — Token Service account setup subcommand (status, register, verify, wallet, finish, migrate). Shares `~/.neozip/connection/` with NeoZip Desktop and MCP (`neozip-connect` from neozip-mcp).
58
+ - **Connection store bootstrap** — non-blocking startup read of active connection; gated operations (`-ts`, mint) require connect readiness with actionable guidance.
59
+
60
+ ### Changed
61
+
62
+ - **Unified wallet** — all blockchain operations (`-b`, `-ts`, mint) use the connection store wallet (`secrets.enc`); `wallet.json` retired. `neozip init` is an alias for `neozip connect`. On-chain prefs (`defaultNetwork`, RPC, gas) live on `public.json`.
63
+ - **Token Service configuration** — URL, verified email, and access token are read **only** from the connection store (`~/.neozip/connection/`), not from `wallet.json`, env vars, or CLI flags.
64
+ - **Package manager** — development workflow uses pnpm (`packageManager: pnpm@10.12.1`); use `pnpm install` and `pnpm build` from source.
65
+
66
+ ### Removed
67
+
68
+ - **`~/.neozip/wallet.json`** — migrate via `neozip connect migrate`; archived as `wallet.json.migrated`.
69
+ - **`NEOZIP_WALLET_PASSKEY`** as user-facing configuration (connection store only; `-w` remains for one-off overrides).
70
+
71
+ - **`neozip verify-email`** command and `npm run verify-email` script — use `neozip connect` instead.
72
+ - **`--timestamp-email`** flag and `wallet.json` `tokenService.timestampEmail` — configure via `neozip connect`.
73
+ - **`TOKEN_SERVICE_URL`**, **`NEOZIP_TIMESTAMP_EMAIL`** runtime env vars for Token Service operations.
74
+
75
+ ### Added (encryption)
76
+
14
77
  - **Full AES-256 encryption support** — create, list, and extract password-protected archives with WinZip-compatible AES-256 (default) or legacy PKZIP encryption.
15
78
 
16
79
  #### Creating encrypted archives
@@ -62,6 +125,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
62
125
 
63
126
  See [README.md](README.md) and [DOCUMENTATION.md](DOCUMENTATION.md) for more examples.
64
127
 
128
+ ### Changed
129
+
130
+ - **Dependencies**: `neozipkit` and `neozip-blockchain` updated to **^0.7.2** (latest).
131
+ - **Token service API**: imports migrated from `neozip-blockchain/zipstamp-server` to `neozip-blockchain/token-service`; `getZipStampServerUrl()` replaced by `getTokenServiceUrl()`. Configure the server with `TOKEN_SERVICE_URL` (see `env.example`).
132
+ - **ZipStamp → Token Service rename**: all user-facing "Zipstamp" terminology replaced with "Token Service"; `wallet.json` key `zipstamp.timestampEmail` removed in favor of `tokenService.timestampEmail`; CLI flags `--zipstamp-auto-upgrade` / `--zipstamp-skip-upgrade` replaced with `--token-service-auto-upgrade` / `--token-service-skip-upgrade`.
133
+
65
134
  ---
66
135
 
67
136
  ## [0.80.0] - 2026-03-04
@@ -79,7 +148,7 @@ See [README.md](README.md) and [DOCUMENTATION.md](DOCUMENTATION.md) for more exa
79
148
 
80
149
  ### Fixed
81
150
 
82
- - `neozip config` / `neozip init` no longer fail with "Cannot find module './config/ConfigSetup.js'" when run via `yarn neozip-config` or ts-node
151
+ - `neozip config` / `neozip init` no longer fail with "Cannot find module './config/ConfigSetup.js'" when run via `pnpm neozip-config` or ts-node
83
152
 
84
153
  ---
85
154
 
package/DOCUMENTATION.md CHANGED
@@ -119,16 +119,16 @@ neolist --help # Show listing help
119
119
  - Cryptographic proof of archive existence
120
120
  - Timestamp verification
121
121
 
122
- - **Zipstamp**
123
- - Ethereum blockchain timestamping via Zipstamp server
122
+ - **Token Service**
123
+ - Ethereum blockchain timestamping via NeoZip Token Service
124
+ - Account setup via `neozip connect` (shared store at `~/.neozip/connection/`)
124
125
  - Pending timestamps (TS-SUBMIT.NZIP) can be upgraded to confirmed (TIMESTAMP.NZIP)
125
126
  - Use `neozip upgrade <archive> [output] [--wait]` to upgrade pending timestamps
126
127
 
127
128
  - **Wallet Integration**
128
- - Interactive wallet setup wizard (`neozip init`)
129
- - Configuration management (`neozip config`)
130
- - Environment variable support
131
- - Secure wallet key storage
129
+ - Token Service account and wallet via `neozip connect` (alias: `neozip init`)
130
+ - Connection dashboard (`neozip config`) and `neozip connect settings` for on-chain prefs
131
+ - Wallet key in encrypted `secrets.enc` under `~/.neozip/connection/`
132
132
 
133
133
  ### Advanced Features
134
134
 
@@ -142,44 +142,36 @@ neolist --help # Show listing help
142
142
 
143
143
  ## 🔧 Configuration
144
144
 
145
- ### Wallet Setup
146
-
147
- For blockchain features, configure your wallet:
145
+ ### Account, wallet, and on-chain preferences
148
146
 
149
147
  ```bash
150
- # Interactive setup wizard
151
- neozip init
152
-
153
- # View or modify configuration
154
- neozip config
148
+ neozip connect # Setup (alias: neozip init)
149
+ neozip connect status
150
+ neozip connect settings # default network, RPC, gas
151
+ neozip config # dashboard
152
+ neozip connect migrate # legacy wallet.json → connection store
155
153
 
156
- # Upgrade pending Zipstamp timestamp to confirmed
154
+ # Upgrade pending Token Service timestamp
157
155
  neozip upgrade archive.nzip [output.nzip] [--wait]
158
156
  ```
159
157
 
160
- Configuration is stored in `~/.neozip/wallet.json` and supports:
161
- - Wallet private key
162
- - Network selection (testnet/mainnet)
163
- - Custom RPC endpoints
164
- - Gas settings
165
- - Debug options
158
+ Store: `~/.neozip/connection/` (see [dev_doc/CONNECTION_CLI_PREFS.md](dev_doc/CONNECTION_CLI_PREFS.md)).
166
159
 
167
- ### Environment Variables
160
+ ### Environment Variables (optional session overrides)
168
161
 
169
- You can also configure via environment variables (see [env.example](env.example)):
170
- - `NEOZIP_WALLET_PASSKEY` - Wallet private key
171
- - `NEOZIP_NETWORK` - Blockchain network
172
- - `NEOZIP_BASE_SEPOLIA_RPC_URL` - Custom RPC endpoints
173
- - `NEOZIP_VERBOSE` - Enable verbose logging
174
- - `NEOZIP_DEBUG` - Enable debug mode
162
+ See [env.example](env.example):
163
+ - `NEOZIP_NETWORK` override default network for this process
164
+ - `NEOZIP_BASE_SEPOLIA_RPC_URL` override RPC for this process
165
+ - `NEOZIP_CONNECTION_DIR`, `NEOZIP_UNLOCK_PASSPHRASE` connection store
166
+ - `NEOZIP_VERBOSE`, `NEOZIP_DEBUG`, `NEOZIP_GAS_MULTIPLIER`, `NEOZIP_MAX_GAS_PRICE`
175
167
 
176
168
  ## 📚 Reading Order
177
169
 
178
170
  1. **Start with** [README.md](README.md) for installation and basic usage
179
171
  2. **Read** [WHY_NEOZIP.md](WHY_NEOZIP.md) to understand the project vision
180
172
  3. **Review** [CHANGELOG.md](CHANGELOG.md) for version history and known issues
181
- 4. **Configure** wallet using `neozip init` for blockchain features
182
- 5. **Reference** [env.example](env.example) for environment variable configuration
173
+ 4. **Configure** via `neozip connect` for blockchain features
174
+ 5. **Reference** [env.example](env.example) for optional environment overrides
183
175
 
184
176
  ## 🔗 Related Links
185
177
 
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## Release Notice
10
10
 
11
- **Current version: v0.90.0.** This release adds full AES-256 encryption support. See [CHANGELOG.md](CHANGELOG.md) for details.
11
+ **Current version: v0.95.1.** This release adds first-class **AI agent** support (JSON I/O, schema introspection, bundled Skills with `neozip skills install`), deep **NeoZip Token Service** integration (silent token refresh, wallet funding), and `--legacy` InfoZip compatibility. See [CHANGELOG.md](CHANGELOG.md) for details.
12
12
 
13
13
  - **API Stability**: Command-line interface is becoming more stable but may still change
14
14
  - **Testing**: Please test thoroughly and report any issues
@@ -18,8 +18,10 @@
18
18
 
19
19
  NeoZip CLI is a modern, full-featured ZIP utility that provides:
20
20
 
21
- - **Standard ZIP Compatibility**: ~99% compatible with InfoZip utilities
21
+ - **Standard ZIP Compatibility**: ~99% compatible with InfoZip utilities (`--legacy` for stock `unzip`)
22
22
  - **Blockchain Integration**: Tokenize archives and verify integrity on-chain
23
+ - **NeoZip Token Service**: Email-verified timestamps, wallet-linked identity, and testnet gas grants
24
+ - **AI Agent Ready**: Machine-readable JSON I/O, schema introspection, dry-run, and bundled [Skills](skills/)
23
25
  - **Advanced Compression**: Zstd, Deflate, and Store compression methods
24
26
  - **Encryption Support**: AES-256 (default) and PKZIP encryption
25
27
  - **Cross-Platform**: Works on macOS, Linux, and Windows
@@ -48,10 +50,11 @@ NeoZip CLI is a modern, full-featured ZIP utility that provides:
48
50
  - Auto-detection of encryption method during extraction
49
51
 
50
52
  ### Blockchain Features
51
- - **Tokenization**: Create on-chain tokens for archives
52
- - **OpenTimestamp**: Bitcoin blockchain timestamping
53
- - **Zipstamp**: Ethereum blockchain timestamping (Zipstamp server)
54
- - **Integrity Verification**: Verify archive integrity on-chain
53
+ - **Tokenization (`-b`)**: Create on-chain tokens for archives (signs locally with the Data Wallet)
54
+ - **OpenTimestamp (`-ots`)**: Bitcoin blockchain timestamping
55
+ - **Token Service (`-ts`)**: Ethereum timestamping via the NeoZip Token Service (requires a verified account)
56
+ - **Integrity Verification**: Verify archive integrity on-chain during extract (`neounzip --pre-verify`)
57
+ - **Wallet funding**: Request testnet gas grants via `neozip connect fund`
55
58
  - **Network Support**: Base Sepolia, Base Mainnet, Arbitrum, and more
56
59
 
57
60
  ### Advanced Features
@@ -69,7 +72,8 @@ NeoZip CLI is a modern, full-featured ZIP utility that provides:
69
72
  ### Prerequisites
70
73
 
71
74
  - Node.js 16.0.0 or higher
72
- - npm or yarn package manager
75
+ - [pnpm](https://pnpm.io/) 10+ (required for development from source)
76
+ - npm (optional — for global install of the published package only)
73
77
 
74
78
  ### Install from npm
75
79
 
@@ -164,11 +168,11 @@ neozip -b tokenized.nzip file.txt
164
168
  # Tokenize with OpenTimestamp proof (Bitcoin)
165
169
  neozip -ots timestamped.nzip file.txt
166
170
 
167
- # Create Zipstamp timestamp (Ethereum)
168
- neozip -ts zipstamp.nzip file.txt
171
+ # Create Token Service timestamp (Ethereum)
172
+ neozip -ts timestamped.nzip file.txt
169
173
 
170
- # Upgrade pending Zipstamp timestamp to confirmed
171
- neozip upgrade zipstamp.nzip [output.nzip] [--wait]
174
+ # Upgrade pending Token Service timestamp to confirmed
175
+ neozip upgrade timestamped.nzip [output.nzip] [--wait]
172
176
 
173
177
  # Extract and verify blockchain integrity
174
178
  neounzip tokenized.nzip tests/extracted/
@@ -196,17 +200,16 @@ neozip [options] <archive> [files...]
196
200
  - `--pkzip` - Use legacy PKZIP encryption (weak, for compatibility only)
197
201
  - `-b, --blockchain` - Enable blockchain tokenization
198
202
  - `-ots, --opentimestamp` - Enable OpenTimestamp proof (Bitcoin)
199
- - `-ts, --timestamp` - Enable Zipstamp timestamp (Ethereum)
200
- - `--timestamp-email <email>` - Email for Zipstamp server (some servers require verified email)
203
+ - `-ts, --timestamp` - Enable Token Service timestamp (Ethereum; requires `neozip connect`)
201
204
  - `-T, --test-integrity` - Test archive after creation
202
205
  - `-v, --verbose` - Enable verbose output
203
206
  - `-q, --quiet` - Suppress output
204
207
 
205
208
  **Configuration Commands:**
206
209
  ```bash
207
- neozip init # Interactive wallet setup wizard
208
- neozip config # Show current configuration
209
- neozip upgrade <archive> [output] [--wait] # Upgrade pending Zipstamp timestamp to confirmed
210
+ neozip connect # Token Service account + wallet setup (alias: neozip init)
211
+ neozip config # Connection dashboard (status, prefs, migrate)
212
+ neozip upgrade <archive> [output] [--wait] # Upgrade pending Token Service timestamp to confirmed
210
213
  ```
211
214
 
212
215
  **Examples:**
@@ -301,41 +304,58 @@ neolist -1 archive.nzip
301
304
 
302
305
  ## Configuration
303
306
 
304
- ### Wallet Setup (for Blockchain Features)
307
+ ### Account and wallet setup
305
308
 
306
- To use blockchain features, you need to configure a wallet:
309
+ All wallet identity and Token Service credentials live in the shared connection store (`~/.neozip/connection/`). Use the same profile as NeoZip Desktop and the [neozip-mcp](https://github.com/NeoWareInc/neozip-mcp) server.
307
310
 
308
311
  ```bash
309
- # Interactive setup wizard
310
- neozip init
312
+ neozip connect # Interactive setup (alias: neozip init)
313
+ neozip connect status # Show connection phase and credentials
314
+ neozip connect settings # Default network, RPC overrides, gas prefs
315
+ neozip connect migrate # Import legacy wallet.json / MCP profiles
316
+ neozip config # Connection dashboard (status, prefs, migrate)
311
317
  ```
312
318
 
313
- This will guide you through:
314
- 1. Creating or importing a wallet
315
- 2. Selecting a blockchain network
316
- 3. Saving configuration to `~/.neozip/wallet.json`
319
+ On-chain preferences (`defaultNetwork`, custom RPC URLs, gas) are stored in each connection's `public.json`.
317
320
 
318
- ### Environment Variables
321
+ ### NeoZip Token Service
319
322
 
320
- You can also configure via environment variables:
323
+ The Token Service provides email-verified identity, Ethereum timestamps (`-ts`), and optional testnet gas grants. Configuration is read **only** from the connection store — not from env vars or CLI flags.
324
+
325
+ **Setup (interactive or scripted):**
326
+
327
+ ```bash
328
+ neozip connect register --email you@example.com --json
329
+ neozip connect verify --email you@example.com --code 123456 --json
330
+ neozip connect wallet create --ack-backup --json
331
+ neozip connect finish --json
332
+ ```
333
+
334
+ **Token refresh** — access tokens expire. Renewal prefers a **silent wallet-signature login** (no email round-trip); falls back to email OTP on older deployments:
321
335
 
322
336
  ```bash
323
- export NEOZIP_WALLET_PASSKEY="your-wallet-key"
324
- export NEOZIP_NETWORK="base-sepolia" # or base-mainnet, arbitrum-sepolia, etc.
325
- export ZIPSTAMP_SERVER_URL="https://zipstamp-dev.neozip.io" # Zipstamp server (optional)
326
- export NEOZIP_TIMESTAMP_EMAIL="your@email.com" # Email for Zipstamp (some servers require verified email)
337
+ neozip connect refresh --json # silent wallet login (preferred)
338
+ neozip connect refresh --email you@example.com --json # send OTP code
339
+ neozip connect refresh --email you@example.com --code 123456 --json
327
340
  ```
328
341
 
329
- ### Configuration File
342
+ `-ts` auto-renews an expired token before failing, so timestamping usually needs no manual step. `-b` tokenization and `mint` sign on-chain with the local wallet key and do **not** require a current access token.
330
343
 
331
- Configuration is stored in `~/.neozip/wallet.json`:
344
+ **Wallet funding** on-chain operations need native gas. The Token Service can send a small fixed grant to your primary linked wallet (recipient is server-authoritative):
332
345
 
333
- ```json
334
- {
335
- "walletKey": "0x...",
336
- "network": "base-sepolia",
337
- "rpcUrl": "https://..."
338
- }
346
+ ```bash
347
+ neozip connect fund policy --json # grant size + cooldown (no auth)
348
+ neozip connect fund status --json # eligibility and recent grants
349
+ neozip connect fund --json # request a grant (default action)
350
+ neozip connect fund --network base-sepolia --json
351
+ ```
352
+
353
+ Optional overrides:
354
+
355
+ ```bash
356
+ export NEOZIP_CONNECTION_DIR="/path/to/connection" # Store path override
357
+ export NEOZIP_UNLOCK_PASSPHRASE="..." # Decrypt secrets.enc non-interactively
358
+ export NEOZIP_NETWORK="base-sepolia" # Override default network for this session
339
359
  ```
340
360
 
341
361
  ## Advanced Examples
@@ -398,14 +418,17 @@ neounzip -P "secure-password" secret.nzip decrypted/
398
418
  ### Blockchain Features
399
419
 
400
420
  ```bash
401
- # Tokenize archive
421
+ # Tokenize archive (on-chain mint; needs gas — run neozip connect fund if low)
402
422
  neozip -b tokenized.nzip important-file.txt
403
423
 
404
- # Tokenize with OpenTimestamp
424
+ # Token Service timestamp (needs verified account + current access token)
425
+ neozip -ts timestamped.nzip document.pdf
426
+
427
+ # OpenTimestamp (Bitcoin)
405
428
  neozip -ots timestamped.nzip document.pdf
406
429
 
407
- # Extract and verify
408
- neounzip tokenized.nzip verified/
430
+ # Extract and verify on-chain integrity
431
+ neounzip --pre-verify tokenized.nzip verified/
409
432
  ```
410
433
 
411
434
  ### Advanced Operations
@@ -427,6 +450,137 @@ neozip -X archive.nzip ./files/
427
450
  neozip -y archive.nzip ./symlinks/
428
451
  ```
429
452
 
453
+ ## For AI agents
454
+
455
+ NeoZip is designed for autonomous AI/LLM agents. Every command exposes a stable,
456
+ machine-readable surface alongside its human interface. Agents can integrate via
457
+ three paths:
458
+
459
+ | Path | When to use |
460
+ |------|-------------|
461
+ | **CLI + JSON** | Direct shell invocation from any agent runtime |
462
+ | **Bundled Skills** | Cursor, Claude Code, or other skill-aware hosts — load from [skills/](skills/) |
463
+ | **neozip-mcp** | MCP-native agents — same `~/.neozip/connection/` store, tool-based API |
464
+
465
+ Start with [AGENTS.md](AGENTS.md) for engagement rules, then load the relevant
466
+ skill for each task.
467
+
468
+ ### Agent workflow
469
+
470
+ 1. **Introspect** — `neozip schema <neozip|neounzip|neolist|connect>` returns accepted fields, types, defaults, and exit codes.
471
+ 2. **Preview** — add `--dry-run` to `neozip`/`neounzip` to resolve the full plan as JSON without writing.
472
+ 3. **Execute** — run with `--format json`; parse stdout only (stderr is hints).
473
+ 4. **Recover** — on failure, check `error.exitCode` and run `error.nextCommand` when present.
474
+
475
+ ```bash
476
+ neozip schema neozip
477
+ neozip --format json --dry-run \
478
+ --params '{"level":9,"encrypt":true,"password":"s3cret"}' \
479
+ --json '{"archive":"out.zip","files":["src/","README.md"]}'
480
+ neozip --format json \
481
+ --params '{"level":9,"encrypt":true,"password":"s3cret"}' \
482
+ --json '{"archive":"out.zip","files":["src/","README.md"]}'
483
+ ```
484
+
485
+ ### Install Agent Skills
486
+
487
+ Six bundled skills ship inside the npm package. Install them into Claude Code or
488
+ Cursor after `npm install -g neozip-cli`:
489
+
490
+ | Skill | Covers |
491
+ |-------|--------|
492
+ | [neozip-shared](skills/neozip-shared/SKILL.md) | JSON output, `--params`/`--json`, schema, dry-run, exit codes |
493
+ | [neozip-create](skills/neozip-create/SKILL.md) | Archive creation: compression, encryption, blockchain flags |
494
+ | [neozip-extract](skills/neozip-extract/SKILL.md) | Extract, test, verify; zip-slip protection; `--pre-verify` |
495
+ | [neozip-list](skills/neozip-list/SKILL.md) | List archive contents as JSON |
496
+ | [neozip-connect](skills/neozip-connect/SKILL.md) | Token Service setup, refresh, funding |
497
+ | [neozip-legacy](skills/neozip-legacy/SKILL.md) | InfoZip/PKZIP-compatible archives (`--legacy`) |
498
+
499
+ ```bash
500
+ # Symlink bundled skills into ~/.claude/skills and ~/.cursor/skills
501
+ neozip skills install
502
+
503
+ # Claude Code only
504
+ neozip skills install --target claude
505
+
506
+ # Show where skills live in your install
507
+ neozip skills path
508
+ neozip skills list
509
+
510
+ # ZIP files for Claude Cowork / claude.ai upload (Customize > Skills)
511
+ neozip skills pack --output-dir ./neozip-skills-zips
512
+ ```
513
+
514
+ Alternative (skills registry):
515
+
516
+ ```bash
517
+ npx skills add https://github.com/NeoWareInc/neozip-cli
518
+ npx skills add https://github.com/NeoWareInc/neozip-cli/tree/main/skills/neozip-create
519
+ ```
520
+
521
+ ### JSON I/O conventions
522
+
523
+ - **Output:** `--format json` writes a single object to stdout:
524
+ - Success: `{ "ok": true, ... }`
525
+ - Failure: `{ "ok": false, "error": { "code", "exitCode", "message", "nextCommand"? } }`
526
+ - **Input:** `--params '<JSON>'` (control options) and `--json '<JSON>'` (payload: archive + files/targets). Either accepts `-` to read from stdin. Explicit CLI flags override JSON input.
527
+ - **Exit codes:** InfoZip-compatible; echoed in `error.exitCode`. Branch on codes, not message text.
528
+
529
+ ### Advanced features for agents
530
+
531
+ | Feature | Agent params / flags | Prerequisites |
532
+ |---------|---------------------|---------------|
533
+ | AES-256 encryption | `"encrypt": true`, `"password": "…"` | None |
534
+ | PKZIP encryption | `"encryptionMethod": "pkzip"` | None |
535
+ | Zstd compression (default) | `"compression": "zstd"`, `"level": 0–9` | None |
536
+ | InfoZip compatibility | `"legacy": true` | Disables blockchain extensions |
537
+ | On-chain tokenization | `"blockchain": true` | `neozip connect` + gas (`connect fund`) |
538
+ | Token Service timestamp | `"blockchainTokenService": true` | Verified account + access token |
539
+ | OpenTimestamp | `"blockchainOts": true` | None |
540
+ | Pre-verify on extract | `"preVerify": true` | Archive must be tokenized |
541
+ | Network selection | `"network": "base-sepolia"` | Connection `defaultNetwork` or override |
542
+
543
+ **Blockchain from JSON:**
544
+
545
+ ```bash
546
+ # Tokenize with Token Service timestamp
547
+ neozip --format json \
548
+ --params '{"blockchain":true,"blockchainTokenService":true,"network":"base-sepolia"}' \
549
+ --json '{"archive":"tokenized.nzip","files":["contract.pdf"]}'
550
+
551
+ # Extract with on-chain integrity check
552
+ neounzip --format json \
553
+ --params '{"exdir":"out","preVerify":true}' \
554
+ --json '{"archive":"tokenized.nzip"}'
555
+ ```
556
+
557
+ **Token Service from an agent** — use explicit `connect` subcommands (not the interactive wizard):
558
+
559
+ ```bash
560
+ neozip connect status --json
561
+ neozip connect refresh --json # silent wallet-signature renewal
562
+ neozip connect fund status --json # check gas eligibility
563
+ neozip connect fund --json # request testnet gas
564
+ ```
565
+
566
+ On config errors, archive commands return `error.nextCommand: "neozip connect"` so the agent can run setup and retry.
567
+
568
+ ### Safety rails
569
+
570
+ - Archive names and extraction dirs are validated for control characters and dangerous Unicode.
571
+ - `neounzip` refuses zip-slip (entries whose resolved path escapes the target directory).
572
+ - `--dry-run` never touches the filesystem.
573
+ - Treat all agent-supplied paths and IDs as potentially adversarial.
574
+
575
+ ### InfoZip / PKZIP compatibility
576
+
577
+ Default compression is **zstd**, which stock InfoZip `unzip` cannot read. For consumers that need standard ZIP, pass `--legacy` (forces deflate/store + PKZIP encryption, disables zstd and all NeoZip extensions). Combining `--legacy` with blockchain features is a hard error (exit 10). See [neozip-legacy](skills/neozip-legacy/SKILL.md).
578
+
579
+ ```bash
580
+ neozip --format json --params '{"legacy":true,"level":9}' \
581
+ --json '{"archive":"compat.zip","files":["src/"]}'
582
+ ```
583
+
430
584
  ## Requirements
431
585
 
432
586
  - **Node.js**: 16.0.0 or higher
@@ -438,6 +592,8 @@ neozip -y archive.nzip ./symlinks/
438
592
  The following documentation is included with this package:
439
593
 
440
594
  - **[README.md](README.md)** - This file, containing installation, usage, and examples
595
+ - **[AGENTS.md](AGENTS.md)** - AI agent engagement rules (JSON I/O, schema, dry-run, exit codes)
596
+ - **[skills/](skills/)** - Bundled agent Skills for create, extract, list, connect, and legacy mode
441
597
  - **[WHY_NEOZIP.md](WHY_NEOZIP.md)** - Introduction to NeoZip and its blockchain integration
442
598
  - **[CHANGELOG.md](CHANGELOG.md)** - Version history and release notes
443
599
  - **[DOCUMENTATION.md](DOCUMENTATION.md)** - Complete documentation index and reference
@@ -479,11 +635,11 @@ neozip new-archive.nzip original-files/
479
635
 
480
636
  **Blockchain errors:**
481
637
  ```bash
482
- # Check wallet configuration
483
- neozip config
638
+ # Check connection status
639
+ neozip connect status
484
640
 
485
- # Reconfigure wallet
486
- neozip init
641
+ # Re-run setup
642
+ neozip connect
487
643
  ```
488
644
 
489
645
  **Encryption errors:**
@@ -503,6 +659,16 @@ We welcome feedback and contributions:
503
659
  2. **Suggest Features**: Share your ideas and use cases
504
660
  3. **Test and Provide Feedback**: Help us improve by testing and reporting your experience
505
661
 
662
+ ### Development setup
663
+
664
+ Requires [pnpm](https://pnpm.io/) (`packageManager: pnpm@10.12.1`):
665
+
666
+ ```bash
667
+ pnpm install
668
+ pnpm build
669
+ pnpm test
670
+ ```
671
+
506
672
  **Important**: Please test thoroughly and report issues. See [CHANGELOG.md](CHANGELOG.md) for version history.
507
673
 
508
674
  ## License
@@ -523,6 +689,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
523
689
 
524
690
  ---
525
691
 
526
- **Version**: 0.90.0
692
+ **Version**: 0.95.1
527
693
  **Status**: Release (see [CHANGELOG.md](CHANGELOG.md) for latest changes)
528
- **Last Updated**: March 18, 2026
694
+ **Last Updated**: July 7, 2026