maybeai-sheet-cli 0.1.0__tar.gz → 0.2.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.
- maybeai_sheet_cli-0.2.0/CLAUDE.md +46 -0
- maybeai_sheet_cli-0.2.0/PKG-INFO +149 -0
- maybeai_sheet_cli-0.2.0/README.md +125 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/cli-packaging-plan.md +50 -23
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/cli-plan.md +17 -9
- maybeai_sheet_cli-0.2.0/docs/verification-matrix-fallback.md +35 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/pyproject.toml +1 -1
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/__init__.py +1 -1
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/cli.py +26 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/commands/raw.py +10 -1
- maybeai_sheet_cli-0.2.0/src/maybeai_sheet/commands/sheet.py +869 -0
- maybeai_sheet_cli-0.2.0/src/maybeai_sheet/commands/workbook.py +223 -0
- maybeai_sheet_cli-0.2.0/src/maybeai_sheet/config.py +66 -0
- maybeai_sheet_cli-0.2.0/src/maybeai_sheet/formatters.py +297 -0
- maybeai_sheet_cli-0.2.0/src/maybeai_sheet/models/sheet.py +130 -0
- maybeai_sheet_cli-0.2.0/src/maybeai_sheet/options.py +46 -0
- maybeai_sheet_cli-0.2.0/src/maybeai_sheet/update.py +112 -0
- maybeai_sheet_cli-0.2.0/tests/test_cli.py +543 -0
- maybeai_sheet_cli-0.2.0/tests/test_formatters.py +76 -0
- maybeai_sheet_cli-0.2.0/tests/test_update.py +108 -0
- maybeai_sheet_cli-0.2.0/uv.lock +415 -0
- maybeai_sheet_cli-0.1.0/PKG-INFO +0 -163
- maybeai_sheet_cli-0.1.0/README.md +0 -139
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/sheet.py +0 -440
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/workbook.py +0 -109
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/config.py +0 -21
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/formatters.py +0 -103
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/models/sheet.py +0 -61
- maybeai_sheet_cli-0.1.0/tests/test_cli.py +0 -157
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/.claude/settings.local.json +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/.gitignore +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/client.py +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/commands/__init__.py +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/errors.py +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/models/__init__.py +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/models/workbook.py +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.0}/src/maybeai_sheet/resolver.py +0 -0
- {maybeai_sheet_cli-0.1.0 → maybeai_sheet_cli-0.2.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,149 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maybeai-sheet-cli
|
|
3
|
+
Version: 0.2.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
|
+
```bash
|
|
34
|
+
pip install maybeai-sheet-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Upgrade to the latest release:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
maybeai-sheet update
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Install a specific version:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
maybeai-sheet update --version 0.2.0
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
- Python 3.10+
|
|
52
|
+
- `MAYBEAI_API_TOKEN`
|
|
53
|
+
|
|
54
|
+
## Configure
|
|
55
|
+
|
|
56
|
+
Set your API token:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
export MAYBEAI_API_TOKEN="YOUR_TOKEN"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Optional global flags:
|
|
63
|
+
|
|
64
|
+
- `--base-url` to point at a different MaybeAI API host
|
|
65
|
+
- `--output json|table|yaml`
|
|
66
|
+
- `--timeout <seconds>`
|
|
67
|
+
- `--verbose`
|
|
68
|
+
|
|
69
|
+
## Quick Start
|
|
70
|
+
|
|
71
|
+
Read a workbook:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
maybeai-sheet sheet read --doc-id abc123
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
List worksheets:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
maybeai-sheet sheet worksheets --doc-id abc123
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Read headers from a worksheet:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
maybeai-sheet sheet headers --doc-id abc123 --gid 3
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Create a workbook:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
maybeai-sheet workbook create --title "Board Pack"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Append rows and verify:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
maybeai-sheet sheet append --doc-id abc123 --gid 3 --rows rows.json --verify
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Commands
|
|
102
|
+
|
|
103
|
+
- `update`
|
|
104
|
+
- `workbook create`
|
|
105
|
+
- `workbook create-from-file`
|
|
106
|
+
- `workbook manifest`
|
|
107
|
+
- `workbook capabilities`
|
|
108
|
+
- `sheet read`
|
|
109
|
+
- `sheet read-range`
|
|
110
|
+
- `sheet read-many`
|
|
111
|
+
- `sheet named-range`
|
|
112
|
+
- `sheet headers`
|
|
113
|
+
- `sheet worksheets`
|
|
114
|
+
- `sheet formulas`
|
|
115
|
+
- `sheet write-range`
|
|
116
|
+
- `sheet clear-range`
|
|
117
|
+
- `sheet append`
|
|
118
|
+
- `sheet formula-set`
|
|
119
|
+
- `sheet formula-batch-set`
|
|
120
|
+
- `sheet recalculate`
|
|
121
|
+
- `sheet upsert`
|
|
122
|
+
- `sheet create-worksheet`
|
|
123
|
+
- `raw post`
|
|
124
|
+
|
|
125
|
+
## Input Rules
|
|
126
|
+
|
|
127
|
+
- Use `--doc-id`, `--url`, or `--uri` to identify a workbook.
|
|
128
|
+
- Use `--worksheet-name` when the endpoint supports it.
|
|
129
|
+
- Use `--gid` for gid-specific sheet targeting.
|
|
130
|
+
- File inputs like `--rows`, `--values`, `--targets`, and `--operations` must be JSON.
|
|
131
|
+
|
|
132
|
+
## Output
|
|
133
|
+
|
|
134
|
+
Default output is JSON. `table` is optimized for sheet-like payloads; `yaml` is also supported.
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
python3 -m venv .venv
|
|
140
|
+
. .venv/bin/activate
|
|
141
|
+
pip install -U pip
|
|
142
|
+
pip install -e .
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Run tests:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
python -m unittest discover -s tests -v
|
|
149
|
+
```
|
|
@@ -0,0 +1,125 @@
|
|
|
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
|
+
```bash
|
|
10
|
+
pip install maybeai-sheet-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Upgrade to the latest release:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
maybeai-sheet update
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Install a specific version:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
maybeai-sheet update --version 0.2.0
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- Python 3.10+
|
|
28
|
+
- `MAYBEAI_API_TOKEN`
|
|
29
|
+
|
|
30
|
+
## Configure
|
|
31
|
+
|
|
32
|
+
Set your API token:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
export MAYBEAI_API_TOKEN="YOUR_TOKEN"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Optional global flags:
|
|
39
|
+
|
|
40
|
+
- `--base-url` to point at a different MaybeAI API host
|
|
41
|
+
- `--output json|table|yaml`
|
|
42
|
+
- `--timeout <seconds>`
|
|
43
|
+
- `--verbose`
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
Read a workbook:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
maybeai-sheet sheet read --doc-id abc123
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
List worksheets:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
maybeai-sheet sheet worksheets --doc-id abc123
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Read headers from a worksheet:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
maybeai-sheet sheet headers --doc-id abc123 --gid 3
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Create a workbook:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
maybeai-sheet workbook create --title "Board Pack"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Append rows and verify:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
maybeai-sheet sheet append --doc-id abc123 --gid 3 --rows rows.json --verify
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Commands
|
|
78
|
+
|
|
79
|
+
- `update`
|
|
80
|
+
- `workbook create`
|
|
81
|
+
- `workbook create-from-file`
|
|
82
|
+
- `workbook manifest`
|
|
83
|
+
- `workbook capabilities`
|
|
84
|
+
- `sheet read`
|
|
85
|
+
- `sheet read-range`
|
|
86
|
+
- `sheet read-many`
|
|
87
|
+
- `sheet named-range`
|
|
88
|
+
- `sheet headers`
|
|
89
|
+
- `sheet worksheets`
|
|
90
|
+
- `sheet formulas`
|
|
91
|
+
- `sheet write-range`
|
|
92
|
+
- `sheet clear-range`
|
|
93
|
+
- `sheet append`
|
|
94
|
+
- `sheet formula-set`
|
|
95
|
+
- `sheet formula-batch-set`
|
|
96
|
+
- `sheet recalculate`
|
|
97
|
+
- `sheet upsert`
|
|
98
|
+
- `sheet create-worksheet`
|
|
99
|
+
- `raw post`
|
|
100
|
+
|
|
101
|
+
## Input Rules
|
|
102
|
+
|
|
103
|
+
- Use `--doc-id`, `--url`, or `--uri` to identify a workbook.
|
|
104
|
+
- Use `--worksheet-name` when the endpoint supports it.
|
|
105
|
+
- Use `--gid` for gid-specific sheet targeting.
|
|
106
|
+
- File inputs like `--rows`, `--values`, `--targets`, and `--operations` must be JSON.
|
|
107
|
+
|
|
108
|
+
## Output
|
|
109
|
+
|
|
110
|
+
Default output is JSON. `table` is optimized for sheet-like payloads; `yaml` is also supported.
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
python3 -m venv .venv
|
|
116
|
+
. .venv/bin/activate
|
|
117
|
+
pip install -U pip
|
|
118
|
+
pip install -e .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Run tests:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python -m unittest discover -s tests -v
|
|
125
|
+
```
|
|
@@ -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 --
|
|
105
|
-
maybeai-sheet sheet
|
|
106
|
-
maybeai-sheet sheet
|
|
107
|
-
maybeai-sheet sheet
|
|
108
|
-
maybeai-sheet sheet
|
|
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/
|
|
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
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `sheet
|
|
134
|
-
| `sheet
|
|
135
|
-
| `sheet
|
|
136
|
-
| `sheet
|
|
137
|
-
| `sheet
|
|
138
|
-
| `sheet
|
|
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
|
|
149
|
-
3. Prefer `--
|
|
150
|
-
4.
|
|
151
|
-
5. Support `--
|
|
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
|
|
176
|
+
maybeai-sheet sheet upsert \
|
|
157
177
|
--doc-id $DOC_ID \
|
|
158
|
-
--
|
|
159
|
-
--
|
|
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
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `sheet
|
|
213
|
-
| `sheet
|
|
214
|
-
| `sheet
|
|
215
|
-
| `sheet
|
|
216
|
-
| `sheet
|
|
217
|
-
| `sheet
|
|
218
|
-
| `sheet
|
|
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/finclaw-excel-api-v3-wrapper-plan.md`
|
|
@@ -10,6 +10,7 @@ from .commands.sheet import app as sheet_app
|
|
|
10
10
|
from .commands.workbook import app as workbook_app
|
|
11
11
|
from .config import CLIContext
|
|
12
12
|
from .formatters import handle_cli_error
|
|
13
|
+
from .update import run_update
|
|
13
14
|
|
|
14
15
|
app = typer.Typer(
|
|
15
16
|
help="CLI for common MaybeAI spreadsheet operations.",
|
|
@@ -108,6 +109,31 @@ def main(
|
|
|
108
109
|
handle_cli_error(error)
|
|
109
110
|
|
|
110
111
|
|
|
112
|
+
@app.command("update")
|
|
113
|
+
def update_cli(
|
|
114
|
+
version: Optional[str] = typer.Option(
|
|
115
|
+
None,
|
|
116
|
+
"--version",
|
|
117
|
+
help="Install a specific PyPI version instead of the latest release.",
|
|
118
|
+
),
|
|
119
|
+
check: bool = typer.Option(
|
|
120
|
+
False,
|
|
121
|
+
"--check",
|
|
122
|
+
help="Compare the installed version with PyPI and exit without installing.",
|
|
123
|
+
),
|
|
124
|
+
dry_run: bool = typer.Option(
|
|
125
|
+
False,
|
|
126
|
+
"--dry-run",
|
|
127
|
+
help="Print the pip command that would run.",
|
|
128
|
+
),
|
|
129
|
+
) -> None:
|
|
130
|
+
"""Update maybeai-sheet-cli from PyPI."""
|
|
131
|
+
try:
|
|
132
|
+
run_update(target_version=version, check_only=check, dry_run=dry_run)
|
|
133
|
+
except Exception as error: # pragma: no cover - CLI boundary
|
|
134
|
+
handle_cli_error(error)
|
|
135
|
+
|
|
136
|
+
|
|
111
137
|
app.add_typer(workbook_app, name="workbook")
|
|
112
138
|
app.add_typer(sheet_app, name="sheet")
|
|
113
139
|
app.add_typer(raw_app, name="raw")
|
|
@@ -8,6 +8,7 @@ import typer
|
|
|
8
8
|
from ..client import MaybeAIClient
|
|
9
9
|
from ..config import CLIContext
|
|
10
10
|
from ..formatters import build_command_output, handle_cli_error, load_json_file, render_output
|
|
11
|
+
from ..options import output_option, resolve_command_state, timeout_option, verbose_option
|
|
11
12
|
|
|
12
13
|
app = typer.Typer(help="Low-level API escape hatch.", no_args_is_help=True)
|
|
13
14
|
|
|
@@ -24,9 +25,17 @@ def post(
|
|
|
24
25
|
resolve_path=True,
|
|
25
26
|
help="Optional JSON request body.",
|
|
26
27
|
),
|
|
28
|
+
output: Optional[str] = output_option(),
|
|
29
|
+
verbose: Optional[bool] = verbose_option(),
|
|
30
|
+
timeout: Optional[float] = timeout_option(),
|
|
27
31
|
) -> None:
|
|
28
32
|
try:
|
|
29
|
-
state: CLIContext =
|
|
33
|
+
state: CLIContext = resolve_command_state(
|
|
34
|
+
ctx,
|
|
35
|
+
output=output,
|
|
36
|
+
verbose=verbose,
|
|
37
|
+
timeout=timeout,
|
|
38
|
+
)
|
|
30
39
|
client = MaybeAIClient(state)
|
|
31
40
|
payload = load_json_file(body) if body else {}
|
|
32
41
|
response = client.post_json(path, payload)
|