deepcell-cli 0.6.1__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 (109) hide show
  1. deepcell_cli-0.6.1/PKG-INFO +264 -0
  2. deepcell_cli-0.6.1/README.md +232 -0
  3. deepcell_cli-0.6.1/pyproject.toml +75 -0
  4. deepcell_cli-0.6.1/setup.cfg +4 -0
  5. deepcell_cli-0.6.1/src/deepcell_cli/__init__.py +12 -0
  6. deepcell_cli-0.6.1/src/deepcell_cli/__main__.py +5 -0
  7. deepcell_cli-0.6.1/src/deepcell_cli/_findings.py +84 -0
  8. deepcell_cli-0.6.1/src/deepcell_cli/capabilities.py +560 -0
  9. deepcell_cli-0.6.1/src/deepcell_cli/capability-contract.json +15622 -0
  10. deepcell_cli-0.6.1/src/deepcell_cli/client.py +503 -0
  11. deepcell_cli-0.6.1/src/deepcell_cli/commands/__init__.py +1 -0
  12. deepcell_cli-0.6.1/src/deepcell_cli/commands/_batch_input.py +29 -0
  13. deepcell_cli-0.6.1/src/deepcell_cli/commands/_datatypes.py +56 -0
  14. deepcell_cli-0.6.1/src/deepcell_cli/commands/_negative_args.py +133 -0
  15. deepcell_cli-0.6.1/src/deepcell_cli/commands/_swapped_args.py +153 -0
  16. deepcell_cli-0.6.1/src/deepcell_cli/commands/_version_display.py +40 -0
  17. deepcell_cli-0.6.1/src/deepcell_cli/commands/_write_opts.py +139 -0
  18. deepcell_cli-0.6.1/src/deepcell_cli/commands/account.py +123 -0
  19. deepcell_cli-0.6.1/src/deepcell_cli/commands/auth.py +610 -0
  20. deepcell_cli-0.6.1/src/deepcell_cli/commands/changes.py +307 -0
  21. deepcell_cli-0.6.1/src/deepcell_cli/commands/deck.py +594 -0
  22. deepcell_cli-0.6.1/src/deepcell_cli/commands/defs.py +3890 -0
  23. deepcell_cli-0.6.1/src/deepcell_cli/commands/describe.py +902 -0
  24. deepcell_cli-0.6.1/src/deepcell_cli/commands/doc.py +529 -0
  25. deepcell_cli-0.6.1/src/deepcell_cli/commands/doctor.py +257 -0
  26. deepcell_cli-0.6.1/src/deepcell_cli/commands/download.py +36 -0
  27. deepcell_cli-0.6.1/src/deepcell_cli/commands/edit.py +384 -0
  28. deepcell_cli-0.6.1/src/deepcell_cli/commands/example.py +161 -0
  29. deepcell_cli-0.6.1/src/deepcell_cli/commands/export.py +81 -0
  30. deepcell_cli-0.6.1/src/deepcell_cli/commands/export_docx.py +57 -0
  31. deepcell_cli-0.6.1/src/deepcell_cli/commands/export_pdf.py +66 -0
  32. deepcell_cli-0.6.1/src/deepcell_cli/commands/export_pptx.py +45 -0
  33. deepcell_cli-0.6.1/src/deepcell_cli/commands/files.py +386 -0
  34. deepcell_cli-0.6.1/src/deepcell_cli/commands/grep.py +90 -0
  35. deepcell_cli-0.6.1/src/deepcell_cli/commands/guide.py +431 -0
  36. deepcell_cli-0.6.1/src/deepcell_cli/commands/help_cmd.py +348 -0
  37. deepcell_cli-0.6.1/src/deepcell_cli/commands/impact.py +382 -0
  38. deepcell_cli-0.6.1/src/deepcell_cli/commands/import_cmd.py +208 -0
  39. deepcell_cli-0.6.1/src/deepcell_cli/commands/ingest.py +110 -0
  40. deepcell_cli-0.6.1/src/deepcell_cli/commands/merge.py +399 -0
  41. deepcell_cli-0.6.1/src/deepcell_cli/commands/query.py +718 -0
  42. deepcell_cli-0.6.1/src/deepcell_cli/commands/reasoning.py +2981 -0
  43. deepcell_cli-0.6.1/src/deepcell_cli/commands/ref.py +279 -0
  44. deepcell_cli-0.6.1/src/deepcell_cli/commands/replace.py +326 -0
  45. deepcell_cli-0.6.1/src/deepcell_cli/commands/rules.py +206 -0
  46. deepcell_cli-0.6.1/src/deepcell_cli/commands/share.py +186 -0
  47. deepcell_cli-0.6.1/src/deepcell_cli/commands/sync.py +804 -0
  48. deepcell_cli-0.6.1/src/deepcell_cli/commands/upgrade.py +185 -0
  49. deepcell_cli-0.6.1/src/deepcell_cli/commands/variant.py +353 -0
  50. deepcell_cli-0.6.1/src/deepcell_cli/commands/version.py +445 -0
  51. deepcell_cli-0.6.1/src/deepcell_cli/commands/viewer.py +54 -0
  52. deepcell_cli-0.6.1/src/deepcell_cli/commands/workspace.py +101 -0
  53. deepcell_cli-0.6.1/src/deepcell_cli/config.py +352 -0
  54. deepcell_cli-0.6.1/src/deepcell_cli/context.py +187 -0
  55. deepcell_cli-0.6.1/src/deepcell_cli/errors.py +141 -0
  56. deepcell_cli-0.6.1/src/deepcell_cli/logging_setup.py +161 -0
  57. deepcell_cli-0.6.1/src/deepcell_cli/main.py +518 -0
  58. deepcell_cli-0.6.1/src/deepcell_cli/mcp_server.py +906 -0
  59. deepcell_cli-0.6.1/src/deepcell_cli/oauth_provider.py +580 -0
  60. deepcell_cli-0.6.1/src/deepcell_cli/output.py +503 -0
  61. deepcell_cli-0.6.1/src/deepcell_cli/revision.py +164 -0
  62. deepcell_cli-0.6.1/src/deepcell_cli/stages.py +223 -0
  63. deepcell_cli-0.6.1/src/deepcell_cli/surface.py +628 -0
  64. deepcell_cli-0.6.1/src/deepcell_cli/sync_state.py +120 -0
  65. deepcell_cli-0.6.1/src/deepcell_cli/upgrade_check.py +399 -0
  66. deepcell_cli-0.6.1/src/deepcell_cli/xml_replace.py +89 -0
  67. deepcell_cli-0.6.1/src/deepcell_cli.egg-info/PKG-INFO +264 -0
  68. deepcell_cli-0.6.1/src/deepcell_cli.egg-info/SOURCES.txt +107 -0
  69. deepcell_cli-0.6.1/src/deepcell_cli.egg-info/dependency_links.txt +1 -0
  70. deepcell_cli-0.6.1/src/deepcell_cli.egg-info/entry_points.txt +3 -0
  71. deepcell_cli-0.6.1/src/deepcell_cli.egg-info/requires.txt +11 -0
  72. deepcell_cli-0.6.1/src/deepcell_cli.egg-info/top_level.txt +1 -0
  73. deepcell_cli-0.6.1/tests/test_anon.py +574 -0
  74. deepcell_cli-0.6.1/tests/test_claim_strength.py +123 -0
  75. deepcell_cli-0.6.1/tests/test_client.py +230 -0
  76. deepcell_cli-0.6.1/tests/test_client_surface_header.py +227 -0
  77. deepcell_cli-0.6.1/tests/test_config.py +299 -0
  78. deepcell_cli-0.6.1/tests/test_conflict_reason.py +107 -0
  79. deepcell_cli-0.6.1/tests/test_deck_help_contract.py +48 -0
  80. deepcell_cli-0.6.1/tests/test_deck_op_shape.py +344 -0
  81. deepcell_cli-0.6.1/tests/test_docs_catalog.py +66 -0
  82. deepcell_cli-0.6.1/tests/test_doctor.py +374 -0
  83. deepcell_cli-0.6.1/tests/test_download.py +60 -0
  84. deepcell_cli-0.6.1/tests/test_findings_provenance.py +40 -0
  85. deepcell_cli-0.6.1/tests/test_guide_eval_a4_a7.py +148 -0
  86. deepcell_cli-0.6.1/tests/test_guide_flag_drift.py +210 -0
  87. deepcell_cli-0.6.1/tests/test_help_flag_drift.py +203 -0
  88. deepcell_cli-0.6.1/tests/test_impact_commands.py +330 -0
  89. deepcell_cli-0.6.1/tests/test_ingest_command.py +112 -0
  90. deepcell_cli-0.6.1/tests/test_logging_setup.py +167 -0
  91. deepcell_cli-0.6.1/tests/test_mcp_auth.py +1239 -0
  92. deepcell_cli-0.6.1/tests/test_mcp_server.py +783 -0
  93. deepcell_cli-0.6.1/tests/test_op_reachability.py +312 -0
  94. deepcell_cli-0.6.1/tests/test_openapi_route_parity.py +240 -0
  95. deepcell_cli-0.6.1/tests/test_output_export_notes.py +90 -0
  96. deepcell_cli-0.6.1/tests/test_output_keeps_the_answer.py +115 -0
  97. deepcell_cli-0.6.1/tests/test_reasoning_commands.py +1478 -0
  98. deepcell_cli-0.6.1/tests/test_reasoning_diff_command.py +132 -0
  99. deepcell_cli-0.6.1/tests/test_ref_flag_drift.py +120 -0
  100. deepcell_cli-0.6.1/tests/test_round6_signal_regressions.py +70 -0
  101. deepcell_cli-0.6.1/tests/test_search_reach.py +140 -0
  102. deepcell_cli-0.6.1/tests/test_shed_retry.py +206 -0
  103. deepcell_cli-0.6.1/tests/test_stages.py +381 -0
  104. deepcell_cli-0.6.1/tests/test_surface_examples.py +125 -0
  105. deepcell_cli-0.6.1/tests/test_surface_walker.py +104 -0
  106. deepcell_cli-0.6.1/tests/test_upgrade_check.py +684 -0
  107. deepcell_cli-0.6.1/tests/test_version_parity.py +50 -0
  108. deepcell_cli-0.6.1/tests/test_write_message_rule.py +253 -0
  109. deepcell_cli-0.6.1/tests/test_xml_replace.py +66 -0
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepcell-cli
3
+ Version: 0.6.1
4
+ Summary: Build and revise .deepcell documents from a terminal — the reasoning, the calculations, the document and the deck, with the links between them
5
+ Author-email: DeepCell <hello@deepcell.net>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://deepcell.net
8
+ Project-URL: Documentation, https://deepcell.net/product/cli
9
+ Keywords: deepcell,cli,financial-modeling,business-intelligence
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: click>=8.1
23
+ Requires-Dist: httpx>=0.28
24
+ Requires-Dist: rich>=13.0
25
+ Requires-Dist: mcp<2,>=1.26
26
+ Requires-Dist: pyjwt>=2.8
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: respx>=0.22; extra == "dev"
30
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
31
+ Requires-Dist: jsonschema>=4.20; extra == "dev"
32
+
33
+ # DeepCell CLI
34
+
35
+ Command-line interface for **DeepCell** — a versionable `.deepcell` document that records the reasoning, the calculations, the document and the deck **together with the links between them**, so when an assumption changes you can see which conclusions still hold. AI agents read and write the format natively; this CLI is the primary tool for doing so from a terminal, script, or agent harness.
36
+
37
+ ```bash
38
+ # macOS / Linux
39
+ curl -LsSf https://beta.deepcell.net/install.sh | sh
40
+ ```
41
+
42
+ ```powershell
43
+ # Windows (PowerShell)
44
+ irm https://beta.deepcell.net/install.ps1 | iex
45
+ ```
46
+
47
+ ```bash
48
+ deepcell --help
49
+ deepcell-mcp --help # MCP server (also included)
50
+ ```
51
+
52
+ The installer picks uv or pip — whichever the machine has, fetching uv first if
53
+ it has neither — finds where the console script actually landed, and adds that
54
+ directory to your shell profiles so `deepcell` still resolves in the next
55
+ shell. It handles the two cases a bare `pip install` does not: a stock Debian or
56
+ Ubuntu image, which ships no pip, no `ensurepip` and no `venv` module, and a
57
+ PEP 668 interpreter that refuses to install into itself. Running it twice is
58
+ safe, and it verifies before reporting success.
59
+
60
+ Prefer to install by hand? `deepcell-cli` is on PyPI:
61
+
62
+ ```bash
63
+ uv tool install deepcell-cli
64
+ uv tool update-shell
65
+ ```
66
+
67
+ or `pip install deepcell-cli`.
68
+
69
+ `deepcell: command not found` after installing by hand means the console script
70
+ landed in a directory that is off `PATH` — not that the install failed. Re-run
71
+ the installer above, which fixes exactly that; or use `python3 -m deepcell_cli`
72
+ (`python -m` on Windows), which is the same CLI with no `PATH` involved.
73
+
74
+ ## Designed for agents
75
+
76
+ The CLI is built to be driven programmatically:
77
+
78
+ - **Machine-readable output.** Every command accepts `-f json` (also `table`, `plain`; default `plain`). Structured data goes to **stdout**, status/error messages to **stderr**, and failures exit non-zero — pipes and `jq` work cleanly:
79
+
80
+ ```bash
81
+ deepcell query model.deepcell Revenue FY2025E projected -f json | jq .value
82
+ ```
83
+
84
+ - **Headless auth.** `deepcell register` creates an account without a browser; `DEEPCELL_ACCESS_TOKEN` injects a token for CI; `DEEPCELL_CONFIG` points at an alternate config file for session-scoped isolation.
85
+ - **Non-interactive flags.** Destructive commands accept `-y`; `--project SLUG` targets a project per-invocation without mutating global state.
86
+ - **Built-in workflow guidance.** `deepcell guide` lists the topics by workflow stage — `orient/start`, `generate/calcs`, `revise/scenarios`, `verify/lint`, `present/decks`, and the rest. Read one with `deepcell guide <topic>`, find one with `deepcell guide --search <text>`, and add the older flat topics with `deepcell guide --all`. When unsure how to model something, consult a guide topic before improvising.
87
+
88
+ ## Quick start
89
+
90
+ ```bash
91
+ # 1. Authenticate — browser flow, or headless:
92
+ deepcell login
93
+ # deepcell register # terminal-only account creation (CI/agents)
94
+
95
+ # 2. Create and activate a project
96
+ deepcell project create "My Project"
97
+ deepcell project use my-project
98
+
99
+ # 3. Work with files
100
+ deepcell ls # list files
101
+ deepcell describe model.deepcell # inspect schema
102
+ deepcell query model.deepcell Revenue FY2025E projected # query one value
103
+ deepcell query model.deepcell --sheet income_statement # render a sheet
104
+ deepcell edit model.deepcell Revenue_Growth FY2025E 0.12 # edit an assumption
105
+ deepcell to-excel model.deepcell -o report.xlsx # export to Excel
106
+ ```
107
+
108
+ ## Value addressing
109
+
110
+ Every value is addressed by up to **five** dimensions:
111
+
112
+ | Dimension | Role | Examples | If omitted |
113
+ |-----------|------|----------|------------|
114
+ | Item | what | `Revenue`, `COGS`, `WACC` | required |
115
+ | Context | time period | `FY2025E`, `Q1_2024` | all contexts |
116
+ | Status | actual vs. projected | `actual`, `projected` | all statuses |
117
+ | Scenario (`--scenario`) | what-if branch | `bull`, `downside` | default scenario |
118
+ | Custom dimensions (`--custom-dimensions`) | any extra axis | `geography:na;segment:cloud` | base cell |
119
+
120
+ ```bash
121
+ deepcell query model.deepcell Revenue FY2025E projected
122
+ deepcell query model.deepcell Revenue FY2025E --scenario bull
123
+ deepcell query model.deepcell Revenue FY2025E --custom-dimensions "geography:na"
124
+ deepcell cell-meta model.deepcell Revenue FY2025E # formula, dependencies, provenance
125
+ ```
126
+
127
+ The custom-dimension grammar is `dim:member`, semicolon-separated. Omitting a flag targets the **base cell**, never an error.
128
+
129
+ ## Editing: pick the right tool
130
+
131
+ | You want to change… | Use | Why |
132
+ |---------------------|-----|-----|
133
+ | A hardcoded input (assumption, historical) | `deepcell edit FILE ITEM CTX VALUE` | literal Values |
134
+ | A formula, item, period, scenario, sheet, format | `deepcell defs <op>` | structural, validated, atomic |
135
+ | A computed cell → hardcoded override | `deepcell edit … --force` | flags the override explicitly |
136
+ | A hardcoded cell → back to computed | `deepcell edit FILE ITEM CTX --clear` | lets the CalcDef re-govern it |
137
+ | Raw XML (last resort) | `deepcell replace FILE OLD NEW` | string replacement with lint |
138
+
139
+ Derived metrics belong in a **CalculationDefinition**, not hardcoded values — the engine recomputes every CalcDef on read (`deepcell guide generate/calcs`).
140
+
141
+ ```bash
142
+ # Batch value edits (JSON array via file, inline, or stdin)
143
+ deepcell edit model.deepcell --batch changes.json
144
+ echo '[{"itemRef":"Revenue","contextRef":"FY2025E","newValue":"1500000","statusRef":"projected"}]' \
145
+ | deepcell edit model.deepcell --batch -
146
+
147
+ # Structural edits
148
+ deepcell defs add-item model.deepcell --name Gross_Profit --label "Gross Profit"
149
+ deepcell defs add-calc model.deepcell --item Gross_Profit \
150
+ --formula "Revenue - COGS" --status projected --dry-run # pre-flight, then re-run without --dry-run
151
+ deepcell defs add-scenario model.deepcell --name Bull
152
+ deepcell defs apply model.deepcell --ops ops.json # many ops, atomically
153
+ ```
154
+
155
+ `deepcell defs --help` lists the full op set: `add-* / update-* / delete-* / rename-* / reorder-*` for items, calcs, contexts/periods, scenarios, statuses, formats and rules, presentation blocks, and sensitivity tables, plus `header` for document metadata.
156
+
157
+ ## Command reference
158
+
159
+ | Group | Commands |
160
+ |-------|----------|
161
+ | Auth | `login`, `register`, `logout`, `whoami`, `verify-email`, `account` |
162
+ | Projects | `project list / use / create / info` |
163
+ | Files | `ls`, `cat`, `write`, `rm`, `download` |
164
+ | Inspection | `describe`, `query`, `cell-meta`, `relationships`, `grep`, `doctor` |
165
+ | Editing | `edit`, `defs`, `replace`, `variant checkout / create / diff / merge / list` |
166
+ | Document surface | `doc` — outline, blocks, body, links, lint |
167
+ | Deck surface | `deck` — slides, ordering, binding, branding |
168
+ | Change review | `changes list / diff / revert`, `impact` |
169
+ | Version control | `log`, `diff`, `restore` |
170
+ | Sync | `clone`, `status`, `pull`, `push`, `commit`, `merge` |
171
+ | Import / export | `import`, `ingest`, `to-excel`, `to-docx`, `to-pptx`, `to-pdf` |
172
+ | Reasoning | `reasoning`, `reasoning-diff`, `claim`, `assumption` |
173
+ | Delivery | `viewer`, `share create / list / revoke` |
174
+ | Knowledge | `help`, `guide`, `rules`, `ref`, `example` |
175
+
176
+ Run `deepcell <command> --help` for detailed usage — the help text includes worked examples for every mode.
177
+
178
+ ## Reasoning
179
+
180
+ `.deepcell` files carry a typed reasoning graph — **Claims**, **Assumptions**, **Evidence**, connected by **Argument** edges — so a model explains *why* its numbers are what they are:
181
+
182
+ ```bash
183
+ deepcell reasoning add-claim model.deepcell --id rev-thesis --kind thesis \
184
+ --label "Revenue doubles by FY27" --item-refs Revenue
185
+ deepcell reasoning graph model.deepcell # render as Mermaid
186
+ deepcell reasoning impact model.deepcell rev-thesis # what depends on this claim?
187
+ deepcell reasoning lint model.deepcell # structural checks
188
+ deepcell claim model.deepcell # inspect claims
189
+ deepcell assumption model.deepcell # inspect assumptions
190
+ ```
191
+
192
+ See `deepcell guide revise/reasoning` and `deepcell guide verify/review`.
193
+
194
+ ## Variants, history, and merge
195
+
196
+ ```bash
197
+ deepcell variant create "Best Case" # parallel assumption set, no file copies
198
+ deepcell variant checkout best-case
199
+ deepcell variant diff best-case # vs main
200
+ deepcell variant merge best-case
201
+
202
+ deepcell log # like git log
203
+ deepcell diff abc123 def456 # compare two revisions
204
+ deepcell restore abc123 # like git checkout
205
+
206
+ deepcell merge resolve model.deepcell # semantic 3-way merge of sync conflicts
207
+ deepcell merge resolve model.deepcell --ours # keep local values (--theirs: remote)
208
+ ```
209
+
210
+ ## Sync (local ↔ cloud)
211
+
212
+ ```bash
213
+ deepcell clone my-project # download to ./my-project/
214
+ cd my-project
215
+ # ... edit files locally ...
216
+ deepcell status # A/M/D vs last sync
217
+ deepcell push -m "Updated assumptions" # upload
218
+ deepcell pull # fetch cloud changes
219
+ ```
220
+
221
+ A `.deepcell/` metadata directory tracks the project link and sync state. `push` refuses to clobber cloud changes — it asks you to `pull` first. See `deepcell guide revise/history`.
222
+
223
+ ## Import & export
224
+
225
+ ```bash
226
+ deepcell import revenue.xlsx --items items.json --contexts contexts.json \
227
+ --aggregations aggregations.json --keep-raw
228
+ deepcell to-excel model.deepcell -o report.xlsx --formulas # live Excel formulas
229
+ deepcell to-docx model.deepcell -o memo.docx # the document, as Word
230
+ deepcell to-pptx model.deepcell -o deck.pptx # HTML deck → editable PowerPoint
231
+ deepcell to-pdf model.deepcell -o memo.pdf # the document, as PDF
232
+ deepcell ingest cn ... # A-share (cninfo) filings
233
+ ```
234
+
235
+ `--aggregations` maps and combines source rows into target coordinates (`SUM`, `AVERAGE`, `MIN`, `MAX`, `COUNT`); `--keep-raw` retains originals alongside. See `deepcell guide excel-import` and `deepcell guide schema-matching`.
236
+
237
+ ## MCP server
238
+
239
+ The package ships `deepcell-mcp`, exposing the whole CLI to MCP clients (Claude Code, Claude.ai, and others) as a single `deepcell(command)` tool:
240
+
241
+ ```bash
242
+ deepcell-mcp # stdio transport (local)
243
+ deepcell-mcp --http # streamable-http on 127.0.0.1:8080
244
+ ```
245
+
246
+ Interactive and sync commands (`login`, `clone`, `push`, …) are blocked inside MCP; authenticate with an API key or OAuth instead.
247
+
248
+ ## Environment variables
249
+
250
+ | Variable | Purpose | Default |
251
+ |----------|---------|---------|
252
+ | `DEEPCELL_API_URL` | API endpoint | `https://beta.deepcell.net/api/jingwei` |
253
+ | `DEEPCELL_PROJECT` | Override active project | _(none)_ |
254
+ | `DEEPCELL_ACCESS_TOKEN` | Auth token for CI/headless use | _(none)_ |
255
+ | `DEEPCELL_CONFIG` | Alternate `config.json` path (session-scoped) | `~/.deepcell/config.json` |
256
+ | `DEEPCELL_NO_ANON` | Opt out of the anonymous first-use session | _(unset)_ |
257
+ | `DEEPCELL_NO_UPGRADE_CHECK` | Silence the upgrade-available notice for this process | _(unset)_ |
258
+
259
+ Precedence: per-invocation flags (`--project`) > environment > `~/.deepcell/config.json`. Credentials live in `~/.deepcell/credentials.json` (`0600`); token refresh is automatic.
260
+
261
+ ## License
262
+
263
+ MIT. The CLI is developed in a private repository, so there is no public source
264
+ link to follow from here — the licence is what ships in the package metadata.
@@ -0,0 +1,232 @@
1
+ # DeepCell CLI
2
+
3
+ Command-line interface for **DeepCell** — a versionable `.deepcell` document that records the reasoning, the calculations, the document and the deck **together with the links between them**, so when an assumption changes you can see which conclusions still hold. AI agents read and write the format natively; this CLI is the primary tool for doing so from a terminal, script, or agent harness.
4
+
5
+ ```bash
6
+ # macOS / Linux
7
+ curl -LsSf https://beta.deepcell.net/install.sh | sh
8
+ ```
9
+
10
+ ```powershell
11
+ # Windows (PowerShell)
12
+ irm https://beta.deepcell.net/install.ps1 | iex
13
+ ```
14
+
15
+ ```bash
16
+ deepcell --help
17
+ deepcell-mcp --help # MCP server (also included)
18
+ ```
19
+
20
+ The installer picks uv or pip — whichever the machine has, fetching uv first if
21
+ it has neither — finds where the console script actually landed, and adds that
22
+ directory to your shell profiles so `deepcell` still resolves in the next
23
+ shell. It handles the two cases a bare `pip install` does not: a stock Debian or
24
+ Ubuntu image, which ships no pip, no `ensurepip` and no `venv` module, and a
25
+ PEP 668 interpreter that refuses to install into itself. Running it twice is
26
+ safe, and it verifies before reporting success.
27
+
28
+ Prefer to install by hand? `deepcell-cli` is on PyPI:
29
+
30
+ ```bash
31
+ uv tool install deepcell-cli
32
+ uv tool update-shell
33
+ ```
34
+
35
+ or `pip install deepcell-cli`.
36
+
37
+ `deepcell: command not found` after installing by hand means the console script
38
+ landed in a directory that is off `PATH` — not that the install failed. Re-run
39
+ the installer above, which fixes exactly that; or use `python3 -m deepcell_cli`
40
+ (`python -m` on Windows), which is the same CLI with no `PATH` involved.
41
+
42
+ ## Designed for agents
43
+
44
+ The CLI is built to be driven programmatically:
45
+
46
+ - **Machine-readable output.** Every command accepts `-f json` (also `table`, `plain`; default `plain`). Structured data goes to **stdout**, status/error messages to **stderr**, and failures exit non-zero — pipes and `jq` work cleanly:
47
+
48
+ ```bash
49
+ deepcell query model.deepcell Revenue FY2025E projected -f json | jq .value
50
+ ```
51
+
52
+ - **Headless auth.** `deepcell register` creates an account without a browser; `DEEPCELL_ACCESS_TOKEN` injects a token for CI; `DEEPCELL_CONFIG` points at an alternate config file for session-scoped isolation.
53
+ - **Non-interactive flags.** Destructive commands accept `-y`; `--project SLUG` targets a project per-invocation without mutating global state.
54
+ - **Built-in workflow guidance.** `deepcell guide` lists the topics by workflow stage — `orient/start`, `generate/calcs`, `revise/scenarios`, `verify/lint`, `present/decks`, and the rest. Read one with `deepcell guide <topic>`, find one with `deepcell guide --search <text>`, and add the older flat topics with `deepcell guide --all`. When unsure how to model something, consult a guide topic before improvising.
55
+
56
+ ## Quick start
57
+
58
+ ```bash
59
+ # 1. Authenticate — browser flow, or headless:
60
+ deepcell login
61
+ # deepcell register # terminal-only account creation (CI/agents)
62
+
63
+ # 2. Create and activate a project
64
+ deepcell project create "My Project"
65
+ deepcell project use my-project
66
+
67
+ # 3. Work with files
68
+ deepcell ls # list files
69
+ deepcell describe model.deepcell # inspect schema
70
+ deepcell query model.deepcell Revenue FY2025E projected # query one value
71
+ deepcell query model.deepcell --sheet income_statement # render a sheet
72
+ deepcell edit model.deepcell Revenue_Growth FY2025E 0.12 # edit an assumption
73
+ deepcell to-excel model.deepcell -o report.xlsx # export to Excel
74
+ ```
75
+
76
+ ## Value addressing
77
+
78
+ Every value is addressed by up to **five** dimensions:
79
+
80
+ | Dimension | Role | Examples | If omitted |
81
+ |-----------|------|----------|------------|
82
+ | Item | what | `Revenue`, `COGS`, `WACC` | required |
83
+ | Context | time period | `FY2025E`, `Q1_2024` | all contexts |
84
+ | Status | actual vs. projected | `actual`, `projected` | all statuses |
85
+ | Scenario (`--scenario`) | what-if branch | `bull`, `downside` | default scenario |
86
+ | Custom dimensions (`--custom-dimensions`) | any extra axis | `geography:na;segment:cloud` | base cell |
87
+
88
+ ```bash
89
+ deepcell query model.deepcell Revenue FY2025E projected
90
+ deepcell query model.deepcell Revenue FY2025E --scenario bull
91
+ deepcell query model.deepcell Revenue FY2025E --custom-dimensions "geography:na"
92
+ deepcell cell-meta model.deepcell Revenue FY2025E # formula, dependencies, provenance
93
+ ```
94
+
95
+ The custom-dimension grammar is `dim:member`, semicolon-separated. Omitting a flag targets the **base cell**, never an error.
96
+
97
+ ## Editing: pick the right tool
98
+
99
+ | You want to change… | Use | Why |
100
+ |---------------------|-----|-----|
101
+ | A hardcoded input (assumption, historical) | `deepcell edit FILE ITEM CTX VALUE` | literal Values |
102
+ | A formula, item, period, scenario, sheet, format | `deepcell defs <op>` | structural, validated, atomic |
103
+ | A computed cell → hardcoded override | `deepcell edit … --force` | flags the override explicitly |
104
+ | A hardcoded cell → back to computed | `deepcell edit FILE ITEM CTX --clear` | lets the CalcDef re-govern it |
105
+ | Raw XML (last resort) | `deepcell replace FILE OLD NEW` | string replacement with lint |
106
+
107
+ Derived metrics belong in a **CalculationDefinition**, not hardcoded values — the engine recomputes every CalcDef on read (`deepcell guide generate/calcs`).
108
+
109
+ ```bash
110
+ # Batch value edits (JSON array via file, inline, or stdin)
111
+ deepcell edit model.deepcell --batch changes.json
112
+ echo '[{"itemRef":"Revenue","contextRef":"FY2025E","newValue":"1500000","statusRef":"projected"}]' \
113
+ | deepcell edit model.deepcell --batch -
114
+
115
+ # Structural edits
116
+ deepcell defs add-item model.deepcell --name Gross_Profit --label "Gross Profit"
117
+ deepcell defs add-calc model.deepcell --item Gross_Profit \
118
+ --formula "Revenue - COGS" --status projected --dry-run # pre-flight, then re-run without --dry-run
119
+ deepcell defs add-scenario model.deepcell --name Bull
120
+ deepcell defs apply model.deepcell --ops ops.json # many ops, atomically
121
+ ```
122
+
123
+ `deepcell defs --help` lists the full op set: `add-* / update-* / delete-* / rename-* / reorder-*` for items, calcs, contexts/periods, scenarios, statuses, formats and rules, presentation blocks, and sensitivity tables, plus `header` for document metadata.
124
+
125
+ ## Command reference
126
+
127
+ | Group | Commands |
128
+ |-------|----------|
129
+ | Auth | `login`, `register`, `logout`, `whoami`, `verify-email`, `account` |
130
+ | Projects | `project list / use / create / info` |
131
+ | Files | `ls`, `cat`, `write`, `rm`, `download` |
132
+ | Inspection | `describe`, `query`, `cell-meta`, `relationships`, `grep`, `doctor` |
133
+ | Editing | `edit`, `defs`, `replace`, `variant checkout / create / diff / merge / list` |
134
+ | Document surface | `doc` — outline, blocks, body, links, lint |
135
+ | Deck surface | `deck` — slides, ordering, binding, branding |
136
+ | Change review | `changes list / diff / revert`, `impact` |
137
+ | Version control | `log`, `diff`, `restore` |
138
+ | Sync | `clone`, `status`, `pull`, `push`, `commit`, `merge` |
139
+ | Import / export | `import`, `ingest`, `to-excel`, `to-docx`, `to-pptx`, `to-pdf` |
140
+ | Reasoning | `reasoning`, `reasoning-diff`, `claim`, `assumption` |
141
+ | Delivery | `viewer`, `share create / list / revoke` |
142
+ | Knowledge | `help`, `guide`, `rules`, `ref`, `example` |
143
+
144
+ Run `deepcell <command> --help` for detailed usage — the help text includes worked examples for every mode.
145
+
146
+ ## Reasoning
147
+
148
+ `.deepcell` files carry a typed reasoning graph — **Claims**, **Assumptions**, **Evidence**, connected by **Argument** edges — so a model explains *why* its numbers are what they are:
149
+
150
+ ```bash
151
+ deepcell reasoning add-claim model.deepcell --id rev-thesis --kind thesis \
152
+ --label "Revenue doubles by FY27" --item-refs Revenue
153
+ deepcell reasoning graph model.deepcell # render as Mermaid
154
+ deepcell reasoning impact model.deepcell rev-thesis # what depends on this claim?
155
+ deepcell reasoning lint model.deepcell # structural checks
156
+ deepcell claim model.deepcell # inspect claims
157
+ deepcell assumption model.deepcell # inspect assumptions
158
+ ```
159
+
160
+ See `deepcell guide revise/reasoning` and `deepcell guide verify/review`.
161
+
162
+ ## Variants, history, and merge
163
+
164
+ ```bash
165
+ deepcell variant create "Best Case" # parallel assumption set, no file copies
166
+ deepcell variant checkout best-case
167
+ deepcell variant diff best-case # vs main
168
+ deepcell variant merge best-case
169
+
170
+ deepcell log # like git log
171
+ deepcell diff abc123 def456 # compare two revisions
172
+ deepcell restore abc123 # like git checkout
173
+
174
+ deepcell merge resolve model.deepcell # semantic 3-way merge of sync conflicts
175
+ deepcell merge resolve model.deepcell --ours # keep local values (--theirs: remote)
176
+ ```
177
+
178
+ ## Sync (local ↔ cloud)
179
+
180
+ ```bash
181
+ deepcell clone my-project # download to ./my-project/
182
+ cd my-project
183
+ # ... edit files locally ...
184
+ deepcell status # A/M/D vs last sync
185
+ deepcell push -m "Updated assumptions" # upload
186
+ deepcell pull # fetch cloud changes
187
+ ```
188
+
189
+ A `.deepcell/` metadata directory tracks the project link and sync state. `push` refuses to clobber cloud changes — it asks you to `pull` first. See `deepcell guide revise/history`.
190
+
191
+ ## Import & export
192
+
193
+ ```bash
194
+ deepcell import revenue.xlsx --items items.json --contexts contexts.json \
195
+ --aggregations aggregations.json --keep-raw
196
+ deepcell to-excel model.deepcell -o report.xlsx --formulas # live Excel formulas
197
+ deepcell to-docx model.deepcell -o memo.docx # the document, as Word
198
+ deepcell to-pptx model.deepcell -o deck.pptx # HTML deck → editable PowerPoint
199
+ deepcell to-pdf model.deepcell -o memo.pdf # the document, as PDF
200
+ deepcell ingest cn ... # A-share (cninfo) filings
201
+ ```
202
+
203
+ `--aggregations` maps and combines source rows into target coordinates (`SUM`, `AVERAGE`, `MIN`, `MAX`, `COUNT`); `--keep-raw` retains originals alongside. See `deepcell guide excel-import` and `deepcell guide schema-matching`.
204
+
205
+ ## MCP server
206
+
207
+ The package ships `deepcell-mcp`, exposing the whole CLI to MCP clients (Claude Code, Claude.ai, and others) as a single `deepcell(command)` tool:
208
+
209
+ ```bash
210
+ deepcell-mcp # stdio transport (local)
211
+ deepcell-mcp --http # streamable-http on 127.0.0.1:8080
212
+ ```
213
+
214
+ Interactive and sync commands (`login`, `clone`, `push`, …) are blocked inside MCP; authenticate with an API key or OAuth instead.
215
+
216
+ ## Environment variables
217
+
218
+ | Variable | Purpose | Default |
219
+ |----------|---------|---------|
220
+ | `DEEPCELL_API_URL` | API endpoint | `https://beta.deepcell.net/api/jingwei` |
221
+ | `DEEPCELL_PROJECT` | Override active project | _(none)_ |
222
+ | `DEEPCELL_ACCESS_TOKEN` | Auth token for CI/headless use | _(none)_ |
223
+ | `DEEPCELL_CONFIG` | Alternate `config.json` path (session-scoped) | `~/.deepcell/config.json` |
224
+ | `DEEPCELL_NO_ANON` | Opt out of the anonymous first-use session | _(unset)_ |
225
+ | `DEEPCELL_NO_UPGRADE_CHECK` | Silence the upgrade-available notice for this process | _(unset)_ |
226
+
227
+ Precedence: per-invocation flags (`--project`) > environment > `~/.deepcell/config.json`. Credentials live in `~/.deepcell/credentials.json` (`0600`); token refresh is automatic.
228
+
229
+ ## License
230
+
231
+ MIT. The CLI is developed in a private repository, so there is no public source
232
+ link to follow from here — the licence is what ships in the package metadata.
@@ -0,0 +1,75 @@
1
+ [project]
2
+ name = "deepcell-cli"
3
+ version = "0.6.1"
4
+ description = "Build and revise .deepcell documents from a terminal — the reasoning, the calculations, the document and the deck, with the links between them"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.10"
8
+ authors = [{ name = "DeepCell", email = "hello@deepcell.net" }]
9
+ keywords = ["deepcell", "cli", "financial-modeling", "business-intelligence"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Environment :: Console",
13
+ # Two audiences on purpose. Finance is the deepest pack, but it is
14
+ # deliberately the minority of the example library (tests/test_packs.py
15
+ # fails if the core path stops carrying at least three non-finance
16
+ # examples), and the CLI's own pitch is that it is driven by agents.
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Financial and Insurance Industry",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Office/Business :: Financial",
25
+ ]
26
+ # mcp is pinned below 2.0: the v2 SDK (released 2026-07-28, alongside the
27
+ # 2026-07-28 spec) renamed FastMCP to MCPServer and moved it to
28
+ # mcp.server.mcpserver, with no shim at the old path. An unbounded `mcp>=1.0`
29
+ # resolved to 2.0.0 on the next image build and crash-looped deepcell-mcp on
30
+ # `from mcp.server.fastmcp import FastMCP`. Lifting this ceiling means porting
31
+ # mcp_server.py and oauth_provider.py to the v2 API — not a resolver's call.
32
+ dependencies = ["click>=8.1", "httpx>=0.28", "rich>=13.0", "mcp>=1.26,<2", "pyjwt>=2.8"]
33
+
34
+ [project.optional-dependencies]
35
+ dev = ["pytest>=7.0", "respx>=0.22", "pytest-asyncio>=0.23", "jsonschema>=4.20"]
36
+
37
+ [project.scripts]
38
+ deepcell = "deepcell_cli.main:cli"
39
+ deepcell-mcp = "deepcell_cli.mcp_server:main"
40
+
41
+ # These become the sidebar links on the PyPI project page. There is
42
+ # deliberately no Repository or Issues entry: the CLI is developed in a private
43
+ # repository, and a link to one nobody can open is worse than no link.
44
+ #
45
+ # deepcell.net is the canonical host the site is moving to shortly; it does not
46
+ # resolve yet, so these two links go live when the domain does. That is a
47
+ # deliberate trade for not stamping the outgoing beta host into the metadata of
48
+ # a release that cannot be re-uploaded. The installer URLs are NOT part of it —
49
+ # they stay on beta.deepcell.net, because a curl that 404s is a broken install
50
+ # today rather than a link that is briefly grey.
51
+ [project.urls]
52
+ Homepage = "https://deepcell.net"
53
+ Documentation = "https://deepcell.net/product/cli"
54
+
55
+ [build-system]
56
+ requires = ["setuptools>=73.0.0", "wheel"]
57
+ build-backend = "setuptools.build_meta"
58
+
59
+ [tool.setuptools.packages.find]
60
+ where = ["src"]
61
+
62
+ [tool.setuptools.package-data]
63
+ deepcell_cli = ["capability-contract.json"]
64
+
65
+ [dependency-groups]
66
+ dev = [
67
+ "openpyxl>=3.1.5",
68
+ "pytest>=9.0.2",
69
+ "pytest-asyncio>=0.23",
70
+ "respx>=0.22.0",
71
+ ]
72
+
73
+ [tool.pytest.ini_options]
74
+ asyncio_mode = "strict"
75
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,12 @@
1
+ """DeepCell CLI — command-line interface for the DeepCell platform.
2
+
3
+ ``__version__`` is the *runtime* version — what `--version` prints, what the
4
+ client header sends, and what the upgrade check compares against PyPI. The
5
+ packaging version in ``cli/pyproject.toml`` is a second copy that must say the
6
+ same thing, and a third is stamped into ``docs/cli-surface.json`` by
7
+ ``scripts/gen_cli_surface.py``. All three are pinned together by
8
+ ``cli/tests/test_version_parity.py`` — bumping one alone ships a build that
9
+ reports a version it is not, and skipping the regen lands a red build.
10
+ """
11
+
12
+ __version__ = "0.6.1"
@@ -0,0 +1,5 @@
1
+ """Allow running as ``python -m deepcell_cli``."""
2
+
3
+ from deepcell_cli.main import cli
4
+
5
+ cli()