maybeai-sheet-cli 0.1.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.1.0/.claude/settings.local.json +9 -0
- maybeai_sheet_cli-0.1.0/.gitignore +25 -0
- maybeai_sheet_cli-0.1.0/PKG-INFO +163 -0
- maybeai_sheet_cli-0.1.0/README.md +139 -0
- maybeai_sheet_cli-0.1.0/cli-packaging-plan.md +252 -0
- maybeai_sheet_cli-0.1.0/cli-plan.md +381 -0
- maybeai_sheet_cli-0.1.0/pyproject.toml +41 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/__init__.py +5 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/cli.py +117 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/client.py +78 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/__init__.py +1 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/raw.py +35 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/sheet.py +440 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/commands/workbook.py +109 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/config.py +21 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/errors.py +26 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/formatters.py +103 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/models/__init__.py +1 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/models/sheet.py +61 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/models/workbook.py +14 -0
- maybeai_sheet_cli-0.1.0/src/maybeai_sheet/resolver.py +96 -0
- maybeai_sheet_cli-0.1.0/tests/test_cli.py +157 -0
- maybeai_sheet_cli-0.1.0/tests/test_resolver.py +45 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# python generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# venv
|
|
10
|
+
.venv/
|
|
11
|
+
|
|
12
|
+
.env
|
|
13
|
+
.envrc
|
|
14
|
+
.pre-commit-config.yaml
|
|
15
|
+
.idea
|
|
16
|
+
*.log
|
|
17
|
+
.DS_Store
|
|
18
|
+
benches/data/
|
|
19
|
+
.cursor
|
|
20
|
+
ig/
|
|
21
|
+
.cursorrules
|
|
22
|
+
temp
|
|
23
|
+
.clauderc.json
|
|
24
|
+
docs_requirement
|
|
25
|
+
artifacts/
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maybeai-sheet-cli
|
|
3
|
+
Version: 0.1.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 so humans, CI jobs, and agents can perform common workbook operations without dynamically generating curl or Python glue.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install maybeai-sheet-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Requirements
|
|
38
|
+
|
|
39
|
+
- Python 3.10+
|
|
40
|
+
- `MAYBEAI_API_TOKEN`
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
Set your token:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
export MAYBEAI_API_TOKEN="YOUR_TOKEN"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
List worksheets in a workbook:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
maybeai-sheet sheet worksheets --doc-id 6a3b3ec9b225d9fe7982ff36
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Read a worksheet:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
maybeai-sheet sheet read --doc-id 6a3b3ec9b225d9fe7982ff36 --worksheet-name "利润分析"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Read headers from a specific worksheet gid:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
maybeai-sheet sheet headers --doc-id 6a3b3ec9b225d9fe7982ff36 --gid 3
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Create a workbook:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
maybeai-sheet workbook create --title "Board Pack"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Append rows and read back:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
maybeai-sheet sheet append \
|
|
78
|
+
--doc-id 6a3b3ec9b225d9fe7982ff36 \
|
|
79
|
+
--gid 3 \
|
|
80
|
+
--rows rows.json \
|
|
81
|
+
--verify
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Command Groups
|
|
85
|
+
|
|
86
|
+
- `workbook`
|
|
87
|
+
- `create`
|
|
88
|
+
- `create-from-file`
|
|
89
|
+
- `sheet`
|
|
90
|
+
- `read`
|
|
91
|
+
- `read-range`
|
|
92
|
+
- `headers`
|
|
93
|
+
- `worksheets`
|
|
94
|
+
- `formulas`
|
|
95
|
+
- `write-range`
|
|
96
|
+
- `append`
|
|
97
|
+
- `upsert`
|
|
98
|
+
- `create-worksheet`
|
|
99
|
+
- `raw`
|
|
100
|
+
- `post`
|
|
101
|
+
|
|
102
|
+
## Output
|
|
103
|
+
|
|
104
|
+
The CLI defaults to JSON output and returns a stable envelope containing:
|
|
105
|
+
|
|
106
|
+
- `success`
|
|
107
|
+
- `endpoint`
|
|
108
|
+
- `target`
|
|
109
|
+
- `result`
|
|
110
|
+
- optional `verify`
|
|
111
|
+
|
|
112
|
+
Alternative output modes:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
maybeai-sheet sheet worksheets --doc-id <DOC_ID> --output table
|
|
116
|
+
maybeai-sheet sheet worksheets --doc-id <DOC_ID> --output yaml
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
Create a virtual environment and install editable dependencies:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python3 -m venv .venv
|
|
125
|
+
. .venv/bin/activate
|
|
126
|
+
pip install -U pip
|
|
127
|
+
pip install -e .
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Run tests:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
python -m unittest discover -s tests -v
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Build distributions:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install build twine
|
|
140
|
+
python -m build
|
|
141
|
+
twine check dist/*
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Repository Split
|
|
145
|
+
|
|
146
|
+
This repository owns the software artifact:
|
|
147
|
+
|
|
148
|
+
- `src/`
|
|
149
|
+
- `tests/`
|
|
150
|
+
- `pyproject.toml`
|
|
151
|
+
- packaging and release concerns
|
|
152
|
+
|
|
153
|
+
Skill assets were intentionally split out into the sibling repository directory:
|
|
154
|
+
|
|
155
|
+
- `../maybeai-sheet-cli-skill`
|
|
156
|
+
|
|
157
|
+
That skill repo owns:
|
|
158
|
+
|
|
159
|
+
- `SKILL.md`
|
|
160
|
+
- `agents/`
|
|
161
|
+
- `references/`
|
|
162
|
+
- `scripts/`
|
|
163
|
+
- agent-facing workflow documentation
|
|
@@ -0,0 +1,139 @@
|
|
|
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 so humans, CI jobs, and agents can perform common workbook operations without dynamically generating curl or Python glue.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install maybeai-sheet-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Python 3.10+
|
|
16
|
+
- `MAYBEAI_API_TOKEN`
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
Set your token:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
export MAYBEAI_API_TOKEN="YOUR_TOKEN"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
List worksheets in a workbook:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
maybeai-sheet sheet worksheets --doc-id 6a3b3ec9b225d9fe7982ff36
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Read a worksheet:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
maybeai-sheet sheet read --doc-id 6a3b3ec9b225d9fe7982ff36 --worksheet-name "利润分析"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Read headers from a specific worksheet gid:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
maybeai-sheet sheet headers --doc-id 6a3b3ec9b225d9fe7982ff36 --gid 3
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Create a workbook:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
maybeai-sheet workbook create --title "Board Pack"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Append rows and read back:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
maybeai-sheet sheet append \
|
|
54
|
+
--doc-id 6a3b3ec9b225d9fe7982ff36 \
|
|
55
|
+
--gid 3 \
|
|
56
|
+
--rows rows.json \
|
|
57
|
+
--verify
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Command Groups
|
|
61
|
+
|
|
62
|
+
- `workbook`
|
|
63
|
+
- `create`
|
|
64
|
+
- `create-from-file`
|
|
65
|
+
- `sheet`
|
|
66
|
+
- `read`
|
|
67
|
+
- `read-range`
|
|
68
|
+
- `headers`
|
|
69
|
+
- `worksheets`
|
|
70
|
+
- `formulas`
|
|
71
|
+
- `write-range`
|
|
72
|
+
- `append`
|
|
73
|
+
- `upsert`
|
|
74
|
+
- `create-worksheet`
|
|
75
|
+
- `raw`
|
|
76
|
+
- `post`
|
|
77
|
+
|
|
78
|
+
## Output
|
|
79
|
+
|
|
80
|
+
The CLI defaults to JSON output and returns a stable envelope containing:
|
|
81
|
+
|
|
82
|
+
- `success`
|
|
83
|
+
- `endpoint`
|
|
84
|
+
- `target`
|
|
85
|
+
- `result`
|
|
86
|
+
- optional `verify`
|
|
87
|
+
|
|
88
|
+
Alternative output modes:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
maybeai-sheet sheet worksheets --doc-id <DOC_ID> --output table
|
|
92
|
+
maybeai-sheet sheet worksheets --doc-id <DOC_ID> --output yaml
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
Create a virtual environment and install editable dependencies:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
python3 -m venv .venv
|
|
101
|
+
. .venv/bin/activate
|
|
102
|
+
pip install -U pip
|
|
103
|
+
pip install -e .
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Run tests:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python -m unittest discover -s tests -v
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Build distributions:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install build twine
|
|
116
|
+
python -m build
|
|
117
|
+
twine check dist/*
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Repository Split
|
|
121
|
+
|
|
122
|
+
This repository owns the software artifact:
|
|
123
|
+
|
|
124
|
+
- `src/`
|
|
125
|
+
- `tests/`
|
|
126
|
+
- `pyproject.toml`
|
|
127
|
+
- packaging and release concerns
|
|
128
|
+
|
|
129
|
+
Skill assets were intentionally split out into the sibling repository directory:
|
|
130
|
+
|
|
131
|
+
- `../maybeai-sheet-cli-skill`
|
|
132
|
+
|
|
133
|
+
That skill repo owns:
|
|
134
|
+
|
|
135
|
+
- `SKILL.md`
|
|
136
|
+
- `agents/`
|
|
137
|
+
- `references/`
|
|
138
|
+
- `scripts/`
|
|
139
|
+
- agent-facing workflow documentation
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# MaybeAI Sheet CLI Plan
|
|
2
|
+
|
|
3
|
+
## Recommendation
|
|
4
|
+
|
|
5
|
+
Yes, a CLI is worth adding for the highest-frequency operations, especially:
|
|
6
|
+
|
|
7
|
+
- `read_sheet`
|
|
8
|
+
- `read_headers`
|
|
9
|
+
- `list_worksheets`
|
|
10
|
+
- `append_rows`
|
|
11
|
+
- `update_data_keep_headers`
|
|
12
|
+
- `update_range_by_lookup`
|
|
13
|
+
- `write_new_worksheet`
|
|
14
|
+
- `workbook_profile`
|
|
15
|
+
- `export`
|
|
16
|
+
|
|
17
|
+
It is **not** a good replacement for the entire API surface. The repo already shows a large endpoint set, so the right design is:
|
|
18
|
+
|
|
19
|
+
1. First-class commands for the common workflows
|
|
20
|
+
2. Stable shared flags for auth, workbook, and worksheet targeting
|
|
21
|
+
3. A generic `api` or `raw` command for less-used endpoints
|
|
22
|
+
|
|
23
|
+
That keeps the CLI small enough to publish and maintain.
|
|
24
|
+
|
|
25
|
+
## Why a CLI Helps
|
|
26
|
+
|
|
27
|
+
For common sheet work, the current `curl` scripts have three recurring costs:
|
|
28
|
+
|
|
29
|
+
- repeated auth and base URL boilerplate
|
|
30
|
+
- repeated `uri` and `gid` handling
|
|
31
|
+
- repeated JSON escaping for structured payloads
|
|
32
|
+
|
|
33
|
+
A CLI improves:
|
|
34
|
+
|
|
35
|
+
- usability for humans
|
|
36
|
+
- repeatability in scripts and CI
|
|
37
|
+
- discoverability through `--help`
|
|
38
|
+
- safer worksheet targeting through shared options
|
|
39
|
+
|
|
40
|
+
## Product Scope
|
|
41
|
+
|
|
42
|
+
Package name candidates:
|
|
43
|
+
|
|
44
|
+
- `maybeai-sheet`
|
|
45
|
+
- `maybeai-sheets`
|
|
46
|
+
- `maybe-sheet`
|
|
47
|
+
|
|
48
|
+
Recommended executable:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
maybeai-sheet
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Recommended Python baseline:
|
|
55
|
+
|
|
56
|
+
- Python `>=3.10`
|
|
57
|
+
|
|
58
|
+
Recommended implementation:
|
|
59
|
+
|
|
60
|
+
- `typer` for CLI
|
|
61
|
+
- `httpx` for HTTP client
|
|
62
|
+
- `pydantic` for payload validation
|
|
63
|
+
- `rich` for readable table / JSON output
|
|
64
|
+
|
|
65
|
+
## CLI Shape
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
maybeai-sheet [global options] <resource> <command> [command options]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Global options:
|
|
72
|
+
|
|
73
|
+
- `--token` or env `MAYBEAI_API_TOKEN`
|
|
74
|
+
- `--base-url` default `https://play-be.omnimcp.ai`
|
|
75
|
+
- `--doc-id`
|
|
76
|
+
- `--uri`
|
|
77
|
+
- `--gid`
|
|
78
|
+
- `--worksheet-name`
|
|
79
|
+
- `--output json|table|yaml`
|
|
80
|
+
- `--verbose`
|
|
81
|
+
|
|
82
|
+
Resolution rules:
|
|
83
|
+
|
|
84
|
+
1. If `--uri` is provided, use it
|
|
85
|
+
2. Else if `--doc-id` is provided, build `https://www.maybe.ai/docs/spreadsheets/d/<doc_id>`
|
|
86
|
+
3. If `--gid` is provided, append `?gid=<gid>` where required
|
|
87
|
+
4. Prefer `--worksheet-name` for commands that support it
|
|
88
|
+
|
|
89
|
+
## Proposed Commands
|
|
90
|
+
|
|
91
|
+
### Read path
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
maybeai-sheet sheet read --doc-id <id> --worksheet-name Sheet1
|
|
95
|
+
maybeai-sheet sheet read --doc-id <id> --worksheet-name Sheet1 --range A1:C20
|
|
96
|
+
maybeai-sheet sheet headers --doc-id <id> --gid 0
|
|
97
|
+
maybeai-sheet sheet worksheets --doc-id <id>
|
|
98
|
+
maybeai-sheet sheet profile --doc-id <id> --force-refresh
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Write path
|
|
102
|
+
|
|
103
|
+
```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
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### File path
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
maybeai-sheet file upload ./report.xlsx
|
|
115
|
+
maybeai-sheet file export --doc-id <id> --out final.xlsx
|
|
116
|
+
maybeai-sheet file search "q2 forecast"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Escape hatch
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
maybeai-sheet raw post /api/v1/excel/read_sheet --body body.json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The `raw` command prevents CLI growth from tracking every niche endpoint.
|
|
126
|
+
|
|
127
|
+
## Command Mapping
|
|
128
|
+
|
|
129
|
+
| CLI command | API endpoint |
|
|
130
|
+
|---|---|
|
|
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` |
|
|
139
|
+
| `sheet profile` | `POST /api/v1/excel/workbook_profile` |
|
|
140
|
+
| `file upload` | `POST /api/v1/excel/upload` |
|
|
141
|
+
| `file export` | `GET /api/v1/excel/export/{document_id}` |
|
|
142
|
+
|
|
143
|
+
## UX Rules
|
|
144
|
+
|
|
145
|
+
The CLI should encode the operational rules already documented in this repo:
|
|
146
|
+
|
|
147
|
+
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
|
|
152
|
+
|
|
153
|
+
Example:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
maybeai-sheet sheet replace \
|
|
157
|
+
--doc-id $DOC_ID \
|
|
158
|
+
--worksheet-name Sales \
|
|
159
|
+
--data sales.json \
|
|
160
|
+
--verify
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Suggested Package Layout
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
src/maybeai_sheet/
|
|
167
|
+
__init__.py
|
|
168
|
+
cli.py
|
|
169
|
+
config.py
|
|
170
|
+
client.py
|
|
171
|
+
models.py
|
|
172
|
+
formatters.py
|
|
173
|
+
commands/
|
|
174
|
+
file.py
|
|
175
|
+
sheet.py
|
|
176
|
+
raw.py
|
|
177
|
+
tests/
|
|
178
|
+
pyproject.toml
|
|
179
|
+
README.md
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## `pyproject.toml` Direction
|
|
183
|
+
|
|
184
|
+
Use a console script entry point:
|
|
185
|
+
|
|
186
|
+
```toml
|
|
187
|
+
[project]
|
|
188
|
+
name = "maybeai-sheet"
|
|
189
|
+
version = "0.1.0"
|
|
190
|
+
description = "CLI for common MaybeAI spreadsheet operations"
|
|
191
|
+
requires-python = ">=3.10"
|
|
192
|
+
dependencies = ["typer", "httpx", "pydantic", "rich"]
|
|
193
|
+
|
|
194
|
+
[project.scripts]
|
|
195
|
+
maybeai-sheet = "maybeai_sheet.cli:app"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Build backend:
|
|
199
|
+
|
|
200
|
+
- `hatchling` or `setuptools`
|
|
201
|
+
|
|
202
|
+
Recommended:
|
|
203
|
+
|
|
204
|
+
- `hatchling`
|
|
205
|
+
|
|
206
|
+
## Publish-to-PyPI Plan
|
|
207
|
+
|
|
208
|
+
### Phase 1
|
|
209
|
+
|
|
210
|
+
Build a thin MVP around the most-used read/write flows:
|
|
211
|
+
|
|
212
|
+
- `sheet read`
|
|
213
|
+
- `sheet headers`
|
|
214
|
+
- `sheet worksheets`
|
|
215
|
+
- `sheet append`
|
|
216
|
+
- `sheet replace`
|
|
217
|
+
- `sheet upsert`
|
|
218
|
+
- `file upload`
|
|
219
|
+
- `file export`
|
|
220
|
+
|
|
221
|
+
### Phase 2
|
|
222
|
+
|
|
223
|
+
Add operator-safety and better UX:
|
|
224
|
+
|
|
225
|
+
- `--verify`
|
|
226
|
+
- `--output table`
|
|
227
|
+
- better error messages for auth and wrong-sheet targeting
|
|
228
|
+
- `sheet profile`
|
|
229
|
+
|
|
230
|
+
### Phase 3
|
|
231
|
+
|
|
232
|
+
Publish:
|
|
233
|
+
|
|
234
|
+
1. reserve package name on PyPI
|
|
235
|
+
2. add `pyproject.toml`
|
|
236
|
+
3. add README with install and auth setup
|
|
237
|
+
4. add tests for request construction
|
|
238
|
+
5. build with `python -m build`
|
|
239
|
+
6. publish with `twine upload dist/*` or trusted publishing
|
|
240
|
+
|
|
241
|
+
## What Not To Do
|
|
242
|
+
|
|
243
|
+
- Do not create one CLI command per endpoint on day one
|
|
244
|
+
- Do not force users to hand-build JSON strings for common commands
|
|
245
|
+
- Do not hide worksheet targeting semantics
|
|
246
|
+
- Do not publish before adding at least smoke tests for the common commands
|
|
247
|
+
|
|
248
|
+
## Bottom Line
|
|
249
|
+
|
|
250
|
+
Yes, a pip-published CLI is a good fit here, but only if it is opinionated around the top workflows and does not try to mirror the full backend surface.
|
|
251
|
+
|
|
252
|
+
The first command to optimize is `read_sheet`, followed by the table-safe write commands.
|