@orangecollective/oc 0.1.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.
Files changed (3) hide show
  1. package/README.md +103 -0
  2. package/dist/oc.js +1416 -0
  3. package/package.json +64 -0
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # `oc`
2
+
3
+ The OC-IDE research agent in your terminal: the same `yc-research-agent`, the same
4
+ models, the same `@`-mention context, and the same batch activity digest the web
5
+ app greets you with.
6
+
7
+ ## Install
8
+
9
+ Needs **Node 22 or newer** (Ink's floor — check with `node -v`).
10
+
11
+ ```bash
12
+ npm i -g @orangecollective/oc
13
+ oc login # opens your browser to authorize this machine
14
+ oc
15
+ ```
16
+
17
+ Upgrade with the same command. `oc --version` prints what you have.
18
+
19
+ You need an Orange Collective account that belongs to at least one team — `oc`
20
+ exits with "Your account isn't on a team yet" otherwise. Run it in a real
21
+ terminal: Ink needs a TTY, so it can't be piped.
22
+
23
+ If the install fails with `EACCES`, your npm prefix is root-owned. Fix the
24
+ prefix rather than reaching for sudo, which leaves root-owned files that break
25
+ later installs:
26
+
27
+ ```bash
28
+ npm config set prefix ~/.npm-global # then add ~/.npm-global/bin to PATH
29
+ ```
30
+
31
+ ### From source
32
+
33
+ For working on the CLI itself:
34
+
35
+ ```bash
36
+ git clone git@github.com:davecyen/oc-ide.git
37
+ cd oc-ide/cli
38
+ npm run setup # install + build + link `oc` to this checkout
39
+ ```
40
+
41
+ ## Use
42
+
43
+ ```bash
44
+ oc login # authorize this machine in your browser
45
+ oc # greeting + digest, then chat
46
+ oc logout
47
+
48
+ oc --host http://localhost:3000 login # target a dev server (or set OC_HOST)
49
+ ```
50
+
51
+ In the chat:
52
+
53
+ | | |
54
+ |---|---|
55
+ | `@name` | attach a company, founder, batch or skill |
56
+ | `/` | open the command list (tab to complete) |
57
+ | `/model [name]` | switch model (no argument lists them) |
58
+ | `/web` | toggle web search |
59
+ | `/team [slug]` · `/batch [W26]` | change scope |
60
+ | `/digest [-r]` | re-run the digest (`-r` regenerates it server-side) |
61
+ | `/new` · `/clear` · `/quit` | |
62
+ | `?` | shortcuts (on an empty prompt) |
63
+ | `↑ ↓` | history, or move through a list |
64
+ | `esc` | interrupt · close a list · drop context |
65
+ | `ctrl-c` ×2 | exit |
66
+
67
+ Config lives in `~/.oc/` — `credentials.json` (session) and `state.json` (model,
68
+ team, batch, thread), both `0600`. Set `OC_CONFIG_DIR` to relocate them.
69
+
70
+ ## Development
71
+
72
+ ```bash
73
+ npm run dev # tsx, no build step
74
+ npm run typecheck
75
+ npm run build # esbuild → dist/oc.js
76
+ ```
77
+
78
+ Notes for anyone editing this:
79
+
80
+ - **All key handling lives in one `useInput` in `src/ui/App.tsx`.** Editing and the
81
+ pickers are interleaved, and two competing handlers race on the same keypress.
82
+ Ctrl-C is handled there too, which is why `oc.tsx` renders with
83
+ `exitOnCtrlC: false`.
84
+ - Colour comes from `src/ui/theme.ts` — one orange ramp, used for the wordmark
85
+ gradient and as the single accent. Don't introduce raw ANSI colour names.
86
+ - `Logo.tsx` rows are exactly 43 columns each and drop to a two-row wordmark
87
+ under 45 columns.
88
+ - Pass `onError` to `readUIMessageStream` — it defaults to swallowing upstream
89
+ errors, which makes a bad provider key look like a hung CLI.
90
+ - Finished output goes into Ink's `<Static>`, which is what keeps terminal
91
+ scrollback and piping working. Only the in-flight turn re-renders.
92
+ - Streaming re-renders are throttled (`FLUSH_INTERVAL_MS`) and the in-progress
93
+ answer renders as raw text; markdown is parsed once, when the turn completes. A
94
+ half-written code fence renders as garbage otherwise.
95
+ - This package is **not** an npm workspace of the app, and the app's `tsconfig` /
96
+ eslint config exclude it. It carries its own React and Ink; hoisting those into
97
+ the app's `node_modules` would affect the Next build.
98
+ - `build.mjs` resolves the app's `@/` alias so a small allowlist of **pure**
99
+ modules can be shared (the digest wire format). Never import anything that
100
+ touches `next/headers`, a Supabase server client, or React components.
101
+ - Server-side pieces this depends on: `lib/supabase/request.ts` (bearer auth),
102
+ `app/api/cli/*`, `app/auth/cli/[port]/[code]/page.tsx`, `lib/cli-auth.ts`. See
103
+ the `oc` CLI section in the repo's `CLAUDE.md`.