maybeai-sheet-cli 0.1.0__tar.gz → 0.3.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.
Files changed (40) hide show
  1. maybeai_sheet_cli-0.3.0/CLAUDE.md +46 -0
  2. maybeai_sheet_cli-0.3.0/PKG-INFO +194 -0
  3. maybeai_sheet_cli-0.3.0/README.md +170 -0
  4. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/cli-packaging-plan.md +50 -23
  5. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/cli-plan.md +17 -9
  6. maybeai_sheet_cli-0.3.0/docs/verification-matrix-fallback.md +35 -0
  7. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/pyproject.toml +1 -1
  8. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/__init__.py +1 -1
  9. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/cli.py +28 -0
  10. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/client.py +10 -1
  11. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/commands/raw.py +10 -1
  12. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/commands/share.py +344 -0
  13. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/commands/sheet.py +869 -0
  14. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/commands/workbook.py +249 -0
  15. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/config.py +66 -0
  16. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/formatters.py +297 -0
  17. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/models/share.py +47 -0
  18. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/models/sheet.py +130 -0
  19. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/options.py +46 -0
  20. maybeai_sheet_cli-0.3.0/src/maybeai_sheet/update.py +112 -0
  21. maybeai_sheet_cli-0.3.0/tests/test_cli.py +770 -0
  22. maybeai_sheet_cli-0.3.0/tests/test_formatters.py +76 -0
  23. maybeai_sheet_cli-0.3.0/tests/test_update.py +108 -0
  24. maybeai_sheet_cli-0.3.0/uv.lock +415 -0
  25. maybeai_sheet_cli-0.1.0/PKG-INFO +0 -163
  26. maybeai_sheet_cli-0.1.0/README.md +0 -139
  27. maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/sheet.py +0 -440
  28. maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/workbook.py +0 -109
  29. maybeai_sheet_cli-0.1.0/src/maybeai_sheet/config.py +0 -21
  30. maybeai_sheet_cli-0.1.0/src/maybeai_sheet/formatters.py +0 -103
  31. maybeai_sheet_cli-0.1.0/src/maybeai_sheet/models/sheet.py +0 -61
  32. maybeai_sheet_cli-0.1.0/tests/test_cli.py +0 -157
  33. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/.claude/settings.local.json +0 -0
  34. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/.gitignore +0 -0
  35. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/commands/__init__.py +0 -0
  36. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/errors.py +0 -0
  37. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/models/__init__.py +0 -0
  38. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/models/workbook.py +0 -0
  39. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/src/maybeai_sheet/resolver.py +0 -0
  40. {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.3.0}/tests/test_resolver.py +0 -0
@@ -0,0 +1,46 @@
1
+ # CLAUDE.md
2
+
3
+ ## Repo Purpose
4
+
5
+ This repository contains the `maybeai-sheet` Python CLI for MaybeAI spreadsheet APIs.
6
+
7
+ ## Working Rules
8
+
9
+ - Keep docs and CLI behavior aligned with the actual code.
10
+ - Prefer small, targeted changes.
11
+ - Do not rename commands or flags unless the implementation changes too.
12
+ - Preserve JSON as the default output format.
13
+
14
+ ## Project Map
15
+
16
+ - `src/maybeai_sheet/cli.py` - top-level Typer app and global options
17
+ - `src/maybeai_sheet/update.py` - PyPI self-update helpers
18
+ - `src/maybeai_sheet/commands/` - `workbook`, `sheet`, and `raw` command groups
19
+ - `src/maybeai_sheet/client.py` - HTTP client and request helpers
20
+ - `src/maybeai_sheet/resolver.py` - document and worksheet target resolution
21
+ - `src/maybeai_sheet/formatters.py` - JSON, YAML, and table rendering
22
+ - `tests/` - CLI, resolver, and formatter tests
23
+
24
+ ## Common Commands
25
+
26
+ ```bash
27
+ python -m unittest discover -s tests -v
28
+ ```
29
+
30
+ ```bash
31
+ python -m maybeai_sheet.cli --help
32
+ ```
33
+
34
+ ## Implementation Notes
35
+
36
+ - Token source order is `--token` then `MAYBEAI_API_TOKEN`.
37
+ - The default API base URL is `https://play-be.omnimcp.ai`.
38
+ - `--doc-id` is converted to a MaybeAI workbook URL when needed.
39
+ - `sheet headers` and formula reads rely on gid-aware URI resolution.
40
+ - `--verify` on write/append/upsert commands reads the sheet back after the write.
41
+
42
+ ## Editing Guidance
43
+
44
+ - Update README examples when adding or changing commands.
45
+ - Keep request/response examples consistent with the tests.
46
+ - If behavior changes, add or update tests in `tests/` before finishing.
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: maybeai-sheet-cli
3
+ Version: 0.3.0
4
+ Summary: CLI for common MaybeAI spreadsheet operations
5
+ Project-URL: Homepage, https://github.com/OmniMCP-AI/maybeai-sheet-cli
6
+ Project-URL: Repository, https://github.com/OmniMCP-AI/maybeai-sheet-cli
7
+ Project-URL: Issues, https://github.com/OmniMCP-AI/maybeai-sheet-cli/issues
8
+ Author: OmniMCP-AI
9
+ License: Proprietary
10
+ Keywords: cli,excel,maybeai,spreadsheet
11
+ Classifier: Environment :: Console
12
+ Classifier: License :: Other/Proprietary License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: httpx<1,>=0.27
19
+ Requires-Dist: pydantic<3,>=2.7
20
+ Requires-Dist: pyyaml<7,>=6
21
+ Requires-Dist: rich<14,>=13.7
22
+ Requires-Dist: typer<1,>=0.12
23
+ Description-Content-Type: text/markdown
24
+
25
+ # maybeai-sheet-cli
26
+
27
+ CLI for MaybeAI spreadsheet operations.
28
+
29
+ `maybeai-sheet` wraps the MaybeAI spreadsheet HTTP APIs behind a stable command-line interface for humans, CI jobs, and agents.
30
+
31
+ ## Install
32
+
33
+ On Debian/Ubuntu and other **PEP 668** systems, do **not** use bare `pip install` on system Python. Use **pipx** (recommended for CLIs):
34
+
35
+ ```bash
36
+ sudo apt install -y pipx python3-venv
37
+ pipx ensurepath
38
+ # re-login or: source ~/.bashrc
39
+
40
+ pipx install maybeai-sheet-cli
41
+ maybeai-sheet --version
42
+ ```
43
+
44
+ For local venvs or macOS/dev machines, plain pip is fine:
45
+
46
+ ```bash
47
+ pip install maybeai-sheet-cli
48
+ ```
49
+
50
+ Upgrade to the latest release:
51
+
52
+ ```bash
53
+ maybeai-sheet update # when installed via pip or pipx
54
+ pipx upgrade maybeai-sheet-cli # alternative on pipx installs
55
+ ```
56
+
57
+ Install a specific version:
58
+
59
+ ```bash
60
+ maybeai-sheet update --version 0.3.0
61
+ pipx install maybeai-sheet-cli==0.3.0 --force # pipx reinstall pin
62
+ ```
63
+
64
+ Uninstall:
65
+
66
+ ```bash
67
+ pipx uninstall maybeai-sheet-cli
68
+ # not: pip uninstall -U (-U is invalid for uninstall)
69
+ ```
70
+
71
+ ## Requirements
72
+
73
+ - Python 3.10+
74
+ - `MAYBEAI_API_TOKEN`
75
+
76
+ ## Configure
77
+
78
+ Set your API token:
79
+
80
+ ```bash
81
+ export MAYBEAI_API_TOKEN="YOUR_TOKEN"
82
+ ```
83
+
84
+ Optional global flags:
85
+
86
+ - `--base-url` to point at a different MaybeAI API host
87
+ - `--output json|table|yaml`
88
+ - `--timeout <seconds>`
89
+ - `--verbose`
90
+
91
+ ## Quick Start
92
+
93
+ Read a workbook:
94
+
95
+ ```bash
96
+ maybeai-sheet sheet read --doc-id abc123
97
+ ```
98
+
99
+ List worksheets:
100
+
101
+ ```bash
102
+ maybeai-sheet sheet worksheets --doc-id abc123
103
+ ```
104
+
105
+ Read headers from a worksheet:
106
+
107
+ ```bash
108
+ maybeai-sheet sheet headers --doc-id abc123 --gid 3
109
+ ```
110
+
111
+ Create a workbook:
112
+
113
+ ```bash
114
+ maybeai-sheet workbook create --title "Board Pack"
115
+ ```
116
+
117
+ Upload a workbook-style `.xlsx` through the default Excelize path:
118
+
119
+ ```bash
120
+ maybeai-sheet workbook create-from-file ./report.xlsx
121
+ ```
122
+
123
+ Import a large table-like `.xlsx` into SheetTable/PG:
124
+
125
+ ```bash
126
+ maybeai-sheet workbook create-from-file ./large-table.xlsx --engine postgres
127
+ ```
128
+
129
+ Append rows and verify:
130
+
131
+ ```bash
132
+ maybeai-sheet sheet append --doc-id abc123 --gid 3 --rows rows.json --verify
133
+ ```
134
+
135
+ Make a workbook public for viewers:
136
+
137
+ ```bash
138
+ maybeai-sheet share visibility --doc-id abc123 --visibility public --public-permission viewer
139
+ ```
140
+
141
+ ## Commands
142
+
143
+ - `update`
144
+ - `workbook create`
145
+ - `workbook create-from-file`
146
+ - `workbook manifest`
147
+ - `workbook capabilities`
148
+ - `share visibility`
149
+ - `share grant`
150
+ - `share permission`
151
+ - `share remove`
152
+ - `share list`
153
+ - `sheet read`
154
+ - `sheet read-range`
155
+ - `sheet read-many`
156
+ - `sheet named-range`
157
+ - `sheet headers`
158
+ - `sheet worksheets`
159
+ - `sheet formulas`
160
+ - `sheet write-range`
161
+ - `sheet clear-range`
162
+ - `sheet append`
163
+ - `sheet formula-set`
164
+ - `sheet formula-batch-set`
165
+ - `sheet recalculate`
166
+ - `sheet upsert`
167
+ - `sheet create-worksheet`
168
+ - `raw post`
169
+
170
+ ## Input Rules
171
+
172
+ - Use `--doc-id`, `--url`, or `--uri` to identify a workbook.
173
+ - Use `--worksheet-name` when the endpoint supports it.
174
+ - Use `--gid` for gid-specific sheet targeting.
175
+ - File inputs like `--rows`, `--values`, `--targets`, and `--operations` must be JSON.
176
+
177
+ ## Output
178
+
179
+ Default output is JSON. `table` is optimized for sheet-like payloads; `yaml` is also supported.
180
+
181
+ ## Development
182
+
183
+ ```bash
184
+ python3 -m venv .venv
185
+ . .venv/bin/activate
186
+ pip install -U pip
187
+ pip install -e .
188
+ ```
189
+
190
+ Run tests:
191
+
192
+ ```bash
193
+ python -m unittest discover -s tests -v
194
+ ```
@@ -0,0 +1,170 @@
1
+ # maybeai-sheet-cli
2
+
3
+ CLI for MaybeAI spreadsheet operations.
4
+
5
+ `maybeai-sheet` wraps the MaybeAI spreadsheet HTTP APIs behind a stable command-line interface for humans, CI jobs, and agents.
6
+
7
+ ## Install
8
+
9
+ On Debian/Ubuntu and other **PEP 668** systems, do **not** use bare `pip install` on system Python. Use **pipx** (recommended for CLIs):
10
+
11
+ ```bash
12
+ sudo apt install -y pipx python3-venv
13
+ pipx ensurepath
14
+ # re-login or: source ~/.bashrc
15
+
16
+ pipx install maybeai-sheet-cli
17
+ maybeai-sheet --version
18
+ ```
19
+
20
+ For local venvs or macOS/dev machines, plain pip is fine:
21
+
22
+ ```bash
23
+ pip install maybeai-sheet-cli
24
+ ```
25
+
26
+ Upgrade to the latest release:
27
+
28
+ ```bash
29
+ maybeai-sheet update # when installed via pip or pipx
30
+ pipx upgrade maybeai-sheet-cli # alternative on pipx installs
31
+ ```
32
+
33
+ Install a specific version:
34
+
35
+ ```bash
36
+ maybeai-sheet update --version 0.3.0
37
+ pipx install maybeai-sheet-cli==0.3.0 --force # pipx reinstall pin
38
+ ```
39
+
40
+ Uninstall:
41
+
42
+ ```bash
43
+ pipx uninstall maybeai-sheet-cli
44
+ # not: pip uninstall -U (-U is invalid for uninstall)
45
+ ```
46
+
47
+ ## Requirements
48
+
49
+ - Python 3.10+
50
+ - `MAYBEAI_API_TOKEN`
51
+
52
+ ## Configure
53
+
54
+ Set your API token:
55
+
56
+ ```bash
57
+ export MAYBEAI_API_TOKEN="YOUR_TOKEN"
58
+ ```
59
+
60
+ Optional global flags:
61
+
62
+ - `--base-url` to point at a different MaybeAI API host
63
+ - `--output json|table|yaml`
64
+ - `--timeout <seconds>`
65
+ - `--verbose`
66
+
67
+ ## Quick Start
68
+
69
+ Read a workbook:
70
+
71
+ ```bash
72
+ maybeai-sheet sheet read --doc-id abc123
73
+ ```
74
+
75
+ List worksheets:
76
+
77
+ ```bash
78
+ maybeai-sheet sheet worksheets --doc-id abc123
79
+ ```
80
+
81
+ Read headers from a worksheet:
82
+
83
+ ```bash
84
+ maybeai-sheet sheet headers --doc-id abc123 --gid 3
85
+ ```
86
+
87
+ Create a workbook:
88
+
89
+ ```bash
90
+ maybeai-sheet workbook create --title "Board Pack"
91
+ ```
92
+
93
+ Upload a workbook-style `.xlsx` through the default Excelize path:
94
+
95
+ ```bash
96
+ maybeai-sheet workbook create-from-file ./report.xlsx
97
+ ```
98
+
99
+ Import a large table-like `.xlsx` into SheetTable/PG:
100
+
101
+ ```bash
102
+ maybeai-sheet workbook create-from-file ./large-table.xlsx --engine postgres
103
+ ```
104
+
105
+ Append rows and verify:
106
+
107
+ ```bash
108
+ maybeai-sheet sheet append --doc-id abc123 --gid 3 --rows rows.json --verify
109
+ ```
110
+
111
+ Make a workbook public for viewers:
112
+
113
+ ```bash
114
+ maybeai-sheet share visibility --doc-id abc123 --visibility public --public-permission viewer
115
+ ```
116
+
117
+ ## Commands
118
+
119
+ - `update`
120
+ - `workbook create`
121
+ - `workbook create-from-file`
122
+ - `workbook manifest`
123
+ - `workbook capabilities`
124
+ - `share visibility`
125
+ - `share grant`
126
+ - `share permission`
127
+ - `share remove`
128
+ - `share list`
129
+ - `sheet read`
130
+ - `sheet read-range`
131
+ - `sheet read-many`
132
+ - `sheet named-range`
133
+ - `sheet headers`
134
+ - `sheet worksheets`
135
+ - `sheet formulas`
136
+ - `sheet write-range`
137
+ - `sheet clear-range`
138
+ - `sheet append`
139
+ - `sheet formula-set`
140
+ - `sheet formula-batch-set`
141
+ - `sheet recalculate`
142
+ - `sheet upsert`
143
+ - `sheet create-worksheet`
144
+ - `raw post`
145
+
146
+ ## Input Rules
147
+
148
+ - Use `--doc-id`, `--url`, or `--uri` to identify a workbook.
149
+ - Use `--worksheet-name` when the endpoint supports it.
150
+ - Use `--gid` for gid-specific sheet targeting.
151
+ - File inputs like `--rows`, `--values`, `--targets`, and `--operations` must be JSON.
152
+
153
+ ## Output
154
+
155
+ Default output is JSON. `table` is optimized for sheet-like payloads; `yaml` is also supported.
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ python3 -m venv .venv
161
+ . .venv/bin/activate
162
+ pip install -U pip
163
+ pip install -e .
164
+ ```
165
+
166
+ Run tests:
167
+
168
+ ```bash
169
+ python -m unittest discover -s tests -v
170
+ ```
@@ -4,13 +4,18 @@
4
4
 
5
5
  Yes, a CLI is worth adding for the highest-frequency operations, especially:
6
6
 
7
+ - `workbook_manifest`
7
8
  - `read_sheet`
8
9
  - `read_headers`
9
10
  - `list_worksheets`
10
11
  - `append_rows`
11
- - `update_data_keep_headers`
12
12
  - `update_range_by_lookup`
13
+ - `update_range`
14
+ - `clear_range`
13
15
  - `write_new_worksheet`
16
+ - `formula_set`
17
+ - `formula_batch_set`
18
+ - `recalculate_formulas`
14
19
  - `workbook_profile`
15
20
  - `export`
16
21
 
@@ -93,6 +98,8 @@ Resolution rules:
93
98
  ```bash
94
99
  maybeai-sheet sheet read --doc-id <id> --worksheet-name Sheet1
95
100
  maybeai-sheet sheet read --doc-id <id> --worksheet-name Sheet1 --range A1:C20
101
+ maybeai-sheet sheet read-many --doc-id <id> --targets targets.json
102
+ maybeai-sheet sheet named-range --doc-id <id> --name RevenueBlock
96
103
  maybeai-sheet sheet headers --doc-id <id> --gid 0
97
104
  maybeai-sheet sheet worksheets --doc-id <id>
98
105
  maybeai-sheet sheet profile --doc-id <id> --force-refresh
@@ -101,11 +108,14 @@ maybeai-sheet sheet profile --doc-id <id> --force-refresh
101
108
  ### Write path
102
109
 
103
110
  ```bash
104
- maybeai-sheet sheet append --doc-id <id> --gid 0 --data rows.json
105
- maybeai-sheet sheet replace --doc-id <id> --worksheet-name Sales --data rows.json
106
- maybeai-sheet sheet upsert --doc-id <id> --gid 0 --on OrderID --data rows.json
107
- maybeai-sheet sheet update-range --doc-id <id> --worksheet-name Sheet1 --range A1:C3 --values values.json
108
- maybeai-sheet sheet new-worksheet --doc-id <id> --worksheet-name Summary --values values.json
111
+ maybeai-sheet sheet append --doc-id <id> --gid 0 --rows rows.json
112
+ maybeai-sheet sheet upsert --doc-id <id> --gid 0 --key OrderID --rows rows.json
113
+ maybeai-sheet sheet write-range --doc-id <id> --worksheet-name Sheet1 --range A1:C3 --values values.json
114
+ maybeai-sheet sheet clear-range --doc-id <id> --worksheet-name Sheet1 --range A1:C3
115
+ maybeai-sheet sheet create-worksheet --doc-id <id> --name Summary --values values.json
116
+ maybeai-sheet sheet formula-set --doc-id <id> --worksheet-name Sheet1 --cell E2 --formula '=SUM(B2:D2)'
117
+ maybeai-sheet sheet formula-batch-set --doc-id <id> --operations ops.json --recalculate-mode worksheet
118
+ maybeai-sheet sheet recalculate --doc-id <id> --worksheet-name Sheet1
109
119
  ```
110
120
 
111
121
  ### File path
@@ -119,7 +129,7 @@ maybeai-sheet file search "q2 forecast"
119
129
  ### Escape hatch
120
130
 
121
131
  ```bash
122
- maybeai-sheet raw post /api/v1/excel/read_sheet --body body.json
132
+ maybeai-sheet raw post /api/v3/excel/range/read --body body.json
123
133
  ```
124
134
 
125
135
  The `raw` command prevents CLI growth from tracking every niche endpoint.
@@ -128,14 +138,23 @@ The `raw` command prevents CLI growth from tracking every niche endpoint.
128
138
 
129
139
  | CLI command | API endpoint |
130
140
  |---|---|
131
- | `sheet read` | `POST /api/v1/excel/read_sheet` |
132
- | `sheet headers` | `POST /api/v1/excel/read_headers` |
133
- | `sheet worksheets` | `POST /api/v1/excel/list_worksheets` |
134
- | `sheet append` | `POST /api/v1/excel/append_rows` |
135
- | `sheet replace` | `POST /api/v1/excel/update_data_keep_headers` |
136
- | `sheet upsert` | `POST /api/v1/excel/update_range_by_lookup` |
137
- | `sheet update-range` | `POST /api/v1/excel/update_range` |
138
- | `sheet new-worksheet` | `POST /api/v1/excel/write_new_worksheet` |
141
+ | `workbook manifest` | `POST /api/v3/excel/workbook/manifest` |
142
+ | `workbook capabilities` | `POST /api/v3/excel/workbook/capabilities` |
143
+ | `sheet read` | `POST /api/v3/excel/range/read` |
144
+ | `sheet read-range` | `POST /api/v3/excel/range/read` |
145
+ | `sheet read-many` | `POST /api/v3/excel/range/read_many` |
146
+ | `sheet named-range` | `POST /api/v3/excel/named_range/read` |
147
+ | `sheet headers` | `POST /api/v3/excel/table/headers` |
148
+ | `sheet worksheets` | `POST /api/v3/excel/worksheet/list` |
149
+ | `sheet formulas` | `POST /api/v3/excel/formula/read` |
150
+ | `sheet append` | `POST /api/v3/excel/table/append_rows` |
151
+ | `sheet upsert` | `POST /api/v3/excel/table/upsert_rows` |
152
+ | `sheet write-range` | `POST /api/v3/excel/range/write` |
153
+ | `sheet clear-range` | `POST /api/v3/excel/range/clear` |
154
+ | `sheet create-worksheet` | `POST /api/v3/excel/worksheet/create` |
155
+ | `sheet formula-set` | `POST /api/v3/excel/formula/set` |
156
+ | `sheet formula-batch-set` | `POST /api/v3/excel/formula/batch_set` |
157
+ | `sheet recalculate` | `POST /api/v3/excel/formula/recalculate` |
139
158
  | `sheet profile` | `POST /api/v1/excel/workbook_profile` |
140
159
  | `file upload` | `POST /api/v1/excel/upload` |
141
160
  | `file export` | `GET /api/v1/excel/export/{document_id}` |
@@ -145,18 +164,20 @@ The `raw` command prevents CLI growth from tracking every niche endpoint.
145
164
  The CLI should encode the operational rules already documented in this repo:
146
165
 
147
166
  1. Warn when neither `--worksheet-name` nor `--gid` is provided for worksheet-sensitive commands
148
- 2. Prefer `--worksheet-name` for `read_sheet`, `update_range`, and `update_data_keep_headers`
149
- 3. Prefer `--gid` for `read_headers`, `append_rows`, and `update_range_by_lookup`
150
- 4. Support `--verify` on write commands to automatically read back after write
151
- 5. Support `--dry-run` where payload generation can be previewed safely
167
+ 2. Prefer `workbook manifest` before read/write commands when the target worksheet is not already known
168
+ 3. Prefer `--worksheet-name` for `sheet read`, `sheet write-range`, and `sheet formula-set`
169
+ 4. Prefer `--gid` for `sheet headers`, `sheet append`, and `sheet upsert`
170
+ 5. Support `--verify` on write commands to automatically read back after write
171
+ 6. Support `--dry-run` where payload generation can be previewed safely
152
172
 
153
173
  Example:
154
174
 
155
175
  ```bash
156
- maybeai-sheet sheet replace \
176
+ maybeai-sheet sheet upsert \
157
177
  --doc-id $DOC_ID \
158
- --worksheet-name Sales \
159
- --data sales.json \
178
+ --gid 0 \
179
+ --key OrderID \
180
+ --rows sales.json \
160
181
  --verify
161
182
  ```
162
183
 
@@ -209,12 +230,18 @@ Recommended:
209
230
 
210
231
  Build a thin MVP around the most-used read/write flows:
211
232
 
233
+ - `workbook manifest`
212
234
  - `sheet read`
213
235
  - `sheet headers`
214
236
  - `sheet worksheets`
215
237
  - `sheet append`
216
- - `sheet replace`
217
238
  - `sheet upsert`
239
+ - `sheet write-range`
240
+ - `sheet clear-range`
241
+ - `sheet create-worksheet`
242
+ - `sheet formula-set`
243
+ - `sheet formula-batch-set`
244
+ - `sheet recalculate`
218
245
  - `file upload`
219
246
  - `file export`
220
247
 
@@ -106,6 +106,9 @@ maybeai-sheet sheet read --url "$URL"
106
106
  maybeai-sheet sheet read-range --doc-id "$DOC_ID" --gid 3 --range A1:G20
107
107
  maybeai-sheet sheet headers --doc-id "$DOC_ID" --worksheet-name "利润分析"
108
108
  maybeai-sheet sheet append --doc-id "$DOC_ID" --gid 2 --rows rows.json
109
+ maybeai-sheet sheet clear-range --doc-id "$DOC_ID" --worksheet-name Summary --range D1:F10
110
+ maybeai-sheet sheet formula-set --doc-id "$DOC_ID" --worksheet-name Model --cell E2 --formula "=SUM(B2:D2)"
111
+ maybeai-sheet sheet recalculate --doc-id "$DOC_ID" --worksheet-name Model
109
112
  ```
110
113
 
111
114
  ## Global Flags
@@ -207,15 +210,20 @@ The CLI should wrap the existing API rather than invent a new backend contract.
207
210
  | CLI command | Preferred API endpoint |
208
211
  |---|---|
209
212
  | `workbook create` | workbook creation endpoint or current upload/create API equivalent |
210
- | `sheet read` | `POST /api/v1/excel/read_sheet` |
211
- | `sheet read-range` | `POST /api/v1/excel/read_sheet` with bounded range if supported, otherwise CLI-side slice from `read_sheet` only as a fallback |
212
- | `sheet headers` | `POST /api/v1/excel/read_headers` |
213
- | `sheet worksheets` | `POST /api/v1/excel/list_worksheets` |
214
- | `sheet write-range` | `POST /api/v1/excel/update_range` |
215
- | `sheet append` | `POST /api/v1/excel/append_rows` |
216
- | `sheet upsert` | `POST /api/v1/excel/update_range_by_lookup` |
217
- | `sheet create-worksheet` | `POST /api/v1/excel/write_new_worksheet` or worksheet creation endpoint if more exact |
218
- | `sheet formulas` | formula read endpoint if available, otherwise existing formula inspection path |
213
+ | `workbook manifest` | `POST /api/v3/excel/workbook/manifest` |
214
+ | `workbook capabilities` | `POST /api/v3/excel/workbook/capabilities` |
215
+ | `sheet read` | `POST /api/v3/excel/range/read` |
216
+ | `sheet read-range` | `POST /api/v3/excel/range/read` |
217
+ | `sheet headers` | `POST /api/v3/excel/table/headers` |
218
+ | `sheet worksheets` | `POST /api/v3/excel/worksheet/list` |
219
+ | `sheet write-range` | `POST /api/v3/excel/range/write` |
220
+ | `sheet clear-range` | `POST /api/v3/excel/range/clear` |
221
+ | `sheet append` | `POST /api/v3/excel/table/append_rows` |
222
+ | `sheet upsert` | `POST /api/v3/excel/table/upsert_rows` |
223
+ | `sheet create-worksheet` | `POST /api/v3/excel/worksheet/create` |
224
+ | `sheet formulas` | `POST /api/v3/excel/formula/read` |
225
+ | `sheet formula-set` | `POST /api/v3/excel/formula/set` |
226
+ | `sheet recalculate` | `POST /api/v3/excel/formula/recalculate` |
219
227
 
220
228
  Two endpoint checks are required before implementation starts:
221
229
 
@@ -0,0 +1,35 @@
1
+ # Verification matrix: v3 → v1 CLI fallback
2
+
3
+ Hermes Phase A/B compared MCP vs CLI-first vs curl on tasks t1–t4.
4
+ This document scopes what the **CLI fallback layer** covers so results are not
5
+ misread as “full v3 wrapper complete.”
6
+
7
+ ## Covered commands (404 → v1)
8
+
9
+ | Task | CLI command | v3 primary | v1 fallback |
10
+ |------|-------------|------------|-------------|
11
+ | t1 list worksheets | `sheet worksheets` | `/api/v3/excel/worksheet/list` | `/api/v1/excel/list_worksheets` |
12
+ | t2 read rows | `sheet read` | `/api/v3/excel/range/read` | `/api/v1/excel/read_sheet` |
13
+ | t3 append + verify | `sheet append --verify` | `/api/v3/excel/table/append_rows` | `/api/v1/excel/append_rows` |
14
+ | t3 readback | (verify step) | `/api/v3/excel/range/read` | `/api/v1/excel/read_sheet` |
15
+ | t4 create worksheet | `sheet create-worksheet` | `/api/v3/excel/worksheet/create` | `/api/v1/excel/write_new_worksheet` |
16
+
17
+ Implementation: `_post_with_fallback()` in `src/maybeai_sheet/commands/sheet.py`.
18
+ Fallback triggers only on HTTP **404** from the v3 endpoint.
19
+
20
+ ## Tests
21
+
22
+ ```bash
23
+ python tests/test_cli.py
24
+ ```
25
+
26
+ Includes `test_sheet_worksheets_falls_back_to_v1_on_404`, `test_sheet_read_falls_back_to_v1_on_404`,
27
+ `test_sheet_append_falls_back_to_v1_on_404_and_verify_read_fallback`,
28
+ `test_sheet_create_worksheet_falls_back_to_v1_on_404`.
29
+
30
+ ## Not covered by this layer
31
+
32
+ - **curl skill** — no automatic fallback; agent assembles raw HTTP
33
+ - **MCP tools** — separate path; do not use CLI fallback
34
+ - **Non-404 failures** — payload mismatch, auth, 5xx are not retried on v1
35
+ - **Full v3 wrapper plan** — see `docs/maybeai_sheet/roadmap-excel-api-v3-wrapper.md`
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "maybeai-sheet-cli"
7
- version = "0.1.0"
7
+ version = "0.3.0"
8
8
  description = "CLI for common MaybeAI spreadsheet operations"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.1.0"
5
+ __version__ = "0.3.0"
@@ -6,10 +6,12 @@ from typing import Optional
6
6
  import typer
7
7
 
8
8
  from .commands.raw import app as raw_app
9
+ from .commands.share import app as share_app
9
10
  from .commands.sheet import app as sheet_app
10
11
  from .commands.workbook import app as workbook_app
11
12
  from .config import CLIContext
12
13
  from .formatters import handle_cli_error
14
+ from .update import run_update
13
15
 
14
16
  app = typer.Typer(
15
17
  help="CLI for common MaybeAI spreadsheet operations.",
@@ -108,8 +110,34 @@ def main(
108
110
  handle_cli_error(error)
109
111
 
110
112
 
113
+ @app.command("update")
114
+ def update_cli(
115
+ version: Optional[str] = typer.Option(
116
+ None,
117
+ "--version",
118
+ help="Install a specific PyPI version instead of the latest release.",
119
+ ),
120
+ check: bool = typer.Option(
121
+ False,
122
+ "--check",
123
+ help="Compare the installed version with PyPI and exit without installing.",
124
+ ),
125
+ dry_run: bool = typer.Option(
126
+ False,
127
+ "--dry-run",
128
+ help="Print the pip command that would run.",
129
+ ),
130
+ ) -> None:
131
+ """Update maybeai-sheet-cli from PyPI."""
132
+ try:
133
+ run_update(target_version=version, check_only=check, dry_run=dry_run)
134
+ except Exception as error: # pragma: no cover - CLI boundary
135
+ handle_cli_error(error)
136
+
137
+
111
138
  app.add_typer(workbook_app, name="workbook")
112
139
  app.add_typer(sheet_app, name="sheet")
140
+ app.add_typer(share_app, name="share")
113
141
  app.add_typer(raw_app, name="raw")
114
142
 
115
143