@fairmint/captable-ai 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fairmint, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # @fairmint/captable-ai
2
+
3
+ Agent-native command-line interface for [Captable AI](https://captable.ai). Manage
4
+ companies, upload documents, run OCF (Open Cap Format) extraction, review and edit
5
+ extracted objects, and commit cap tables — all from your terminal or an AI agent.
6
+
7
+ Built for both humans and AI agents: every command supports `--json` for structured,
8
+ parseable output, uses a stable exit-code taxonomy, and rejects unknown flags with
9
+ helpful errors.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install -g @fairmint/captable-ai
15
+ ```
16
+
17
+ This exposes two binaries: `captable-ai` and the short alias `cai`. Requires Node.js >= 20.
18
+
19
+ ## Authentication
20
+
21
+ ```bash
22
+ captable-ai login
23
+ ```
24
+
25
+ Opens your browser to authenticate. After approving, click "Finish in browser" or paste
26
+ the login code back into the terminal. Credentials are stored in `~/.captable-ai/`. Use
27
+ `captable-ai logout` to clear them and `captable-ai auth status` to inspect the session.
28
+
29
+ ## Quickstart
30
+
31
+ ```bash
32
+ captable-ai login
33
+ captable-ai company use "Acme Inc" # if you have more than one
34
+ captable-ai documents upload ./docs/*.pdf
35
+ captable-ai documents trigger-extraction # once all docs are CLASSIFIED
36
+ captable-ai documents list # poll until PROCESSED
37
+ captable-ai commit --dry-run # preview
38
+ captable-ai commit --all # commit all drafts (or --objects id1,id2)
39
+ captable-ai summary
40
+ ```
41
+
42
+ ## Uploading documents — the optimal flow
43
+
44
+ CaptableAI builds your cap table by reading your legal documents. The pipeline is
45
+ automated, but a few habits make extraction faster and more accurate:
46
+
47
+ 1. **Upload everything first.** Add all of your cap table documents up front, in one
48
+ batch where possible — incorporation docs, SAFEs, stock and option agreements, board
49
+ consents. Supported: PDF, DOCX, XLSX, DOC, and images, up to 50 MB per file via the CLI.
50
+ `captable-ai documents upload ./docs/*.pdf`
51
+ 2. **Wait for classification.** Each document is OCR'd and classified (type + effective
52
+ date). Don't trigger extraction until every document shows `CLASSIFIED`.
53
+ `captable-ai documents list`
54
+ 3. **Check the classification dates.** The effective date set during classification
55
+ determines processing order. Fix a wrong date before triggering extraction:
56
+ `captable-ai documents classification-update`
57
+ 4. **Trigger extraction once.** Extraction does **not** start automatically for CLI
58
+ uploads — run it a single time after all documents are classified.
59
+ `captable-ai documents trigger-extraction`
60
+ 5. **Let the FIFO queue run.** Documents are extracted one at a time, in ascending order
61
+ of their classification date (earliest first), so later events build on earlier ones.
62
+ Expect a few minutes per document.
63
+ 6. **Validation runs automatically.** Once the last document finishes extraction, a
64
+ company-wide validator runs across all objects to repair cross-document issues — no
65
+ action needed.
66
+ 7. **Review, then commit.** When all documents reach `PROCESSED`, review and commit.
67
+ `captable-ai objects list --status draft` → `captable-ai commit --dry-run` → `captable-ai commit --all`
68
+ (commit requires `--all` or `--objects id1,id2,...`).
69
+
70
+ **Be patient — and when to retry:**
71
+
72
+ - Extraction and validation are asynchronous. Poll `captable-ai documents list` (or
73
+ `captable-ai documents processing-status`) rather than re-triggering — duplicate
74
+ triggers just slow things down.
75
+ - Per-document extraction and the validator are only considered stuck after roughly **15
76
+ minutes** of no progress. Wait out that window before assuming a problem.
77
+ - Retry commands are a last resort, used only after the wait window: `documents reprocess`
78
+ (a `FAILED` doc), `documents cancel-extraction` / `documents restart-extraction` (a
79
+ genuinely stuck doc), or `retrigger-validation` (a stalled validator).
80
+
81
+ ## Commands
82
+
83
+ | Command | Description |
84
+ |---------|-------------|
85
+ | `login` / `logout` | Authenticate / clear stored credentials |
86
+ | `auth status` | Show the current session |
87
+ | `company list\|use\|current\|create\|delete` | Manage and select the active company |
88
+ | `documents upload\|list\|download\|delete` | Manage source documents |
89
+ | `documents trigger-extraction\|cancel-extraction\|restart-extraction\|reprocess` | Control the OCF extraction pipeline |
90
+ | `documents processing-status\|classification-types\|classification-update` | Inspect document status / classification |
91
+ | `objects list\|get\|update\|patch\|revert\|versions\|delete` | Work with extracted OCF objects |
92
+ | `schemas list\|get` | Browse the OCF object-type registry |
93
+ | `commit` | Commit drafts to the cap table — `--all` or `--objects id1,id2` (`--dry-run` to preview) |
94
+ | `summary` | Full cap table snapshot |
95
+ | `export` / `register` | Export the cap table (Excel) / shareholder register |
96
+ | `pro-forma run` | Model financing, convertible, warrant, and option-pool scenarios |
97
+ | `retrigger-validation` | Re-queue a stalled validator |
98
+ | `jobs list\|get\|prune` | Track async operations |
99
+ | `profile save\|use\|list\|get\|delete` | Named configuration profiles |
100
+ | `logs` | View agent/extraction logs |
101
+ | `feedback` | Report CLI friction to the maintainers |
102
+ | `commands` | Machine-readable list of all commands and flags |
103
+
104
+ Run `captable-ai <command> --help` for full usage, or `captable-ai commands --json` for the
105
+ authoritative machine-readable list.
106
+
107
+ ## Structured output
108
+
109
+ Pass `--json` to any command for machine-readable output. Data goes to stdout, errors go
110
+ to stderr, and the process exits with a typed code:
111
+
112
+ | Code | Meaning |
113
+ |------|---------|
114
+ | 0 | Success |
115
+ | 2 | Usage error (bad/unknown flag, missing argument) |
116
+ | 3 | Auth required / session expired |
117
+ | 4 | Not found |
118
+ | 5 | Conflict (version conflict, nothing to commit) |
119
+ | 6 | Validation error |
120
+ | 7 | Server error (5xx) |
121
+ | 8 | Network error |
122
+
123
+ ## Environment variables
124
+
125
+ | Variable | Purpose |
126
+ |----------|---------|
127
+ | `CAPTABLE_AI_STAGE` / `STAGE` | Target environment: `production` (default), `staging`, `dev`, `local` |
128
+ | `CAPTABLE_AI_API_URL` | Override the API base URL |
129
+ | `CAPTABLE_AI_AUTH_URL` | Override the login page URL |
130
+ | `CAPTABLE_AI_PORTAL_ID` | Override the active company for a single invocation |
131
+ | `CAPTABLE_AI_FEEDBACK_URL` | Endpoint for `feedback send` |
132
+
133
+ ## License
134
+
135
+ MIT © Fairmint, Inc.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node