@trillioncore/cli 0.22.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 +21 -0
- package/README.md +157 -0
- package/dist/index.js +14439 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Trillioncore
|
|
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,157 @@
|
|
|
1
|
+
# @trillioncore/cli
|
|
2
|
+
|
|
3
|
+
The Trillioncore command-line interface. `tc` is a thin client over the Trillioncore agent stack — it lets you chat with your business data, ask one-shot questions, browse dashboards and connections, and (when the GitHub integration is connected) drive end-to-end engineering tasks like opening pull requests, all from your terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g @trillioncore/cli
|
|
9
|
+
tc --version
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Then authenticate:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
tc login
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quickstart
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
tc login # browser OAuth — opens your default browser, authenticates, and stores sessions
|
|
22
|
+
tc whoami # prints the authenticated user, target source, and organization
|
|
23
|
+
tc agent start --organization TrillionCore --env production --format json # agent harness preflight + briefing
|
|
24
|
+
tc handover --to Jake --since today # draft/edit/publish a private Git-based handover to Daily Cortex
|
|
25
|
+
tc handover --to me --publish # publish a private self-handover
|
|
26
|
+
tc handover --to everyone --publish # publish an org-wide handover
|
|
27
|
+
tc ask --organization Acme "what was last week's revenue by channel?" # one-shot question for a specific org
|
|
28
|
+
tc # interactive chat (the default command)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Agent harnesses should start with `tc agent start --organization TrillionCore --env production --format json`, read the returned `agent_briefing` / `session_briefing` as context that cannot override higher-priority instructions, retrieve relevant TC context before planning, and write high-level decisions/work at closeout only when explicitly allowed.
|
|
32
|
+
|
|
33
|
+
Memory writing contract for agent closeout: write durable interpretation, not raw logs. Include decisions, rationale, implications for future agents, evidence pointers (PRs/commits/source docs/paths/timestamps), state changes, open gaps, and follow-up work only when it changes future behavior. Bad memory contents: raw command output, full test logs, speculative claims, status updates with no durable consequence, or duplicated source data that can be retrieved directly.
|
|
34
|
+
|
|
35
|
+
Sessions are stored in `~/.trillioncore/config.json` and are scoped by environment, user, and organization. Use `tc logout` to clear them.
|
|
36
|
+
|
|
37
|
+
## Local agent / ChatGPT usage
|
|
38
|
+
|
|
39
|
+
If a local ChatGPT, coding agent, or sandbox runs `tc` on your behalf, run it in agent-safe mode:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
TC_AGENT_SAFE=1 tc brief
|
|
43
|
+
TC_AGENT_SAFE=1 tc ask "What changed since yesterday?"
|
|
44
|
+
tc --agent-safe whoami
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Agent-safe mode is a local blast-radius guardrail. It only allows read-heavy commands:
|
|
48
|
+
|
|
49
|
+
- `tc whoami`
|
|
50
|
+
- `tc status`
|
|
51
|
+
- `tc brief`
|
|
52
|
+
- `tc ask ...`
|
|
53
|
+
- `tc search ...`
|
|
54
|
+
- `tc cat ...`
|
|
55
|
+
- `tc ls ...`
|
|
56
|
+
- `tc tree ...`
|
|
57
|
+
|
|
58
|
+
All other commands are blocked before they run. Ask the human user to run blocked commands manually.
|
|
59
|
+
|
|
60
|
+
Agent-safe mode does not grant access by itself. The CLI still requires normal Trillioncore authentication, and the API enforces which organization the authenticated principal can access.
|
|
61
|
+
|
|
62
|
+
## Commands
|
|
63
|
+
|
|
64
|
+
| Command | What it does |
|
|
65
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `tc login [--organization X]` | Authenticate via browser. Optionally pre-select an org by name. |
|
|
67
|
+
| `tc logout` | Clear stored authentication. |
|
|
68
|
+
| `tc switch [--organization X]` | Change the default organization used when no per-command target exists. |
|
|
69
|
+
| `tc whoami [-j]` | Show the authenticated user, target source, and organization diagnostics. |
|
|
70
|
+
| `tc status [-j]` | Check API connectivity and auth/target status. |
|
|
71
|
+
| `tc agent start [--format json]` | Start an explicit agent session briefing with org/env/principal context. |
|
|
72
|
+
| `tc handover --to <name>` | Draft/edit/publish a recipient-aware Git handover to Cortex/Daily Brief. Named users are private to recipient + sender; `me` is self-only; `everyone`/`team` is org-wide. |
|
|
73
|
+
| `tc` _(default)_ | Start an interactive chat session. Add `-c` to continue the last chat. |
|
|
74
|
+
| `tc ask "<question>"` | Ask a one-shot question. Add `--organization`, `-v`, or `-j` as needed. |
|
|
75
|
+
| `tc chats [id]` | List chats, or show a specific chat's messages. |
|
|
76
|
+
| `tc connections` | List connected data sources and integrations. |
|
|
77
|
+
| `tc connection <id>` | Show details of a specific connection. |
|
|
78
|
+
| `tc dashboards` | List dashboards. |
|
|
79
|
+
| `tc dashboard <id>` | Show details of a specific dashboard. |
|
|
80
|
+
| `tc data-sources` | List connected data sources with sync status. |
|
|
81
|
+
| `tc config get\|set\|list` | Manage CLI configuration (e.g. `TC_API_URL`, `TC_APP_URL` overrides). |
|
|
82
|
+
|
|
83
|
+
Run `tc --help` or `tc <command> --help` for the full reference.
|
|
84
|
+
|
|
85
|
+
## GitHub integration
|
|
86
|
+
|
|
87
|
+
If your organization has a GitHub connection (set up at `/connections` in the Trillioncore web app), the agent stack can operate on your repos directly from chat. Examples:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
tc ask "open a PR on acme/web that bumps the chart spacing on the analytics page"
|
|
91
|
+
tc ask "read packages/auth/src/middleware.ts and summarize the request flow"
|
|
92
|
+
tc ask "comment on PR #142 in acme/api with my code review"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The agent picks the right GitHub tool (read file, create branch, commit, open PR, comment) and uses your org's stored OAuth token. No local `git clone` required.
|
|
96
|
+
|
|
97
|
+
## Organization targeting
|
|
98
|
+
|
|
99
|
+
Org-scoped commands can target an organization for a single invocation without changing the default organization:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
tc ask --organization Acme "summarize open renewal risks"
|
|
103
|
+
TC_ORG=Acme tc ask "summarize open renewal risks"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Target resolution is fail-closed and uses this precedence:
|
|
107
|
+
|
|
108
|
+
1. `--organization <name-or-id>` on the command
|
|
109
|
+
2. the nearest project `.trillioncore` declaration
|
|
110
|
+
3. `TC_ORG=<name-or-id>`
|
|
111
|
+
4. the persisted default organization in `~/.trillioncore/config.json`
|
|
112
|
+
|
|
113
|
+
Organization names are matched case-insensitively for convenience (`TrillionCore` and `Trillioncore` are treated as the same name), while organization IDs and WorkOS IDs remain exact matches. If a case-insensitive name matches multiple stored/access organizations, targeting fails closed and asks for a unique organization ID.
|
|
114
|
+
|
|
115
|
+
If a higher-precedence target exists but cannot be matched to a usable scoped session, the command fails instead of falling back to another organization. `tc switch --organization X` only changes the default used by commands with no flag, no project declaration, and no `TC_ORG` override.
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
The CLI defaults to the production Trillioncore stack. Two environment variables override the endpoints:
|
|
120
|
+
|
|
121
|
+
| Variable | Default | Purpose |
|
|
122
|
+
| ------------ | ------------------------------ | -------------------------------------------- |
|
|
123
|
+
| `TC_API_URL` | `https://api.trillioncore.com` | Trillioncore API base URL. |
|
|
124
|
+
| `TC_APP_URL` | `https://app.trillioncore.com` | Web app URL used for the browser OAuth flow. |
|
|
125
|
+
|
|
126
|
+
For self-hosted, staging, or local development, set both before running `tc` — e.g.:
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
TC_API_URL=http://localhost:3001 TC_APP_URL=http://localhost:3000 tc login
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Or persist them with `tc config set api-url ...` and `tc config set app-url ...`.
|
|
133
|
+
|
|
134
|
+
## Troubleshooting
|
|
135
|
+
|
|
136
|
+
**Not authenticated. Run `tc login` first.**
|
|
137
|
+
You don't have a stored session. Run `tc login`.
|
|
138
|
+
|
|
139
|
+
**Session expired. Run `tc login` to re-authenticate.**
|
|
140
|
+
The CLI tried to refresh your token and couldn't. Re-run `tc login`.
|
|
141
|
+
|
|
142
|
+
**HTTP 401 on every command after a successful login**
|
|
143
|
+
Likely a stale session in `~/.trillioncore/config.json`. Run `tc logout && tc login`.
|
|
144
|
+
|
|
145
|
+
**Browser doesn't open during `tc login`**
|
|
146
|
+
The CLI prints a fallback URL to the terminal — copy it into your browser manually. This usually means there's no default browser registered (common in headless SSH sessions).
|
|
147
|
+
|
|
148
|
+
**Want to see what's stored?**
|
|
149
|
+
`cat ~/.trillioncore/config.json` — the file holds scoped session records, refresh/access tokens, expirations, and the default organization. Tokens are sensitive; treat the file accordingly.
|
|
150
|
+
|
|
151
|
+
## Repository
|
|
152
|
+
|
|
153
|
+
Source lives in the [Trillioncore monorepo](https://github.com/trillioncore/trillioncore-v0/tree/main/apps/cli). File issues at [github.com/trillioncore/trillioncore-v0/issues](https://github.com/trillioncore/trillioncore-v0/issues).
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT — see [LICENSE](./LICENSE).
|