opencode-agora 0.2.2

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +309 -0
  3. package/dist/api.d.ts +69 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +109 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/cli/app.d.ts +22 -0
  8. package/dist/cli/app.d.ts.map +1 -0
  9. package/dist/cli/app.js +1111 -0
  10. package/dist/cli/app.js.map +1 -0
  11. package/dist/cli.d.ts +3 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +10 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/config-files.d.ts +27 -0
  16. package/dist/config-files.d.ts.map +1 -0
  17. package/dist/config-files.js +78 -0
  18. package/dist/config-files.js.map +1 -0
  19. package/dist/config.d.ts +24 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +73 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/data.d.ts +8 -0
  24. package/dist/data.d.ts.map +1 -0
  25. package/dist/data.js +1123 -0
  26. package/dist/data.js.map +1 -0
  27. package/dist/format.d.ts +40 -0
  28. package/dist/format.d.ts.map +1 -0
  29. package/dist/format.js +127 -0
  30. package/dist/format.js.map +1 -0
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +430 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/init.d.ts +22 -0
  36. package/dist/init.d.ts.map +1 -0
  37. package/dist/init.js +199 -0
  38. package/dist/init.js.map +1 -0
  39. package/dist/live.d.ts +100 -0
  40. package/dist/live.d.ts.map +1 -0
  41. package/dist/live.js +443 -0
  42. package/dist/live.js.map +1 -0
  43. package/dist/logger.d.ts +20 -0
  44. package/dist/logger.d.ts.map +1 -0
  45. package/dist/logger.js +59 -0
  46. package/dist/logger.js.map +1 -0
  47. package/dist/marketplace.d.ts +51 -0
  48. package/dist/marketplace.d.ts.map +1 -0
  49. package/dist/marketplace.js +219 -0
  50. package/dist/marketplace.js.map +1 -0
  51. package/dist/state.d.ts +46 -0
  52. package/dist/state.d.ts.map +1 -0
  53. package/dist/state.js +169 -0
  54. package/dist/state.js.map +1 -0
  55. package/dist/types.d.ts +70 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +2 -0
  58. package/dist/types.js.map +1 -0
  59. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 IrgenSlj
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,309 @@
1
+ # Agora — Instant OpenCode Setup & Marketplace
2
+
3
+ <p align="center">
4
+ <strong>One command from zero to a perfectly configured OpenCode environment.</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ Project scanner, MCP marketplace, workflow manager, and community hub — all in one CLI.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/opencode-agora"><img src="https://img.shields.io/npm/v/opencode-agora" alt="npm"></a>
13
+ <a href="https://github.com/IrgenSlj/agora/issues"><img src="https://img.shields.io/github/issues/IrgenSlj/agora" alt="issues"></a>
14
+ <a href="https://github.com/IrgenSlj/agora/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/opencode-agora" alt="license"></a>
15
+ <a href="https://github.com/IrgenSlj/agora/actions"><img src="https://img.shields.io/github/actions/workflow/status/IrgenSlj/agora/ci.yml?branch=main" alt="CI"></a>
16
+ </p>
17
+
18
+ ---
19
+
20
+ ## Demo
21
+
22
+ _A terminal recording is in the works — see ROADMAP.md._
23
+
24
+ ## What is Agora?
25
+
26
+ Agora is a **zero-config OpenCode setup tool** and terminal marketplace. Run `npx opencode-agora init` in any project and it automatically scans your stack, generates the perfect `opencode.json`, installs MCP servers, and registers the plugin.
27
+
28
+ It also bundles **36+ MCP servers**, **10 production workflows**, **6 tutorials**, and a full community discussion system — all usable offline.
29
+
30
+ ## Features
31
+
32
+ ### `agora init` — One-Command Setup
33
+ - Scans your project for `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, `Gemfile`, `Dockerfile`, and more
34
+ - Detects frameworks (React, Next.js, Django, Rails, Spring, Vue)
35
+ - Generates the optimal `opencode.json` with stack-matched MCP servers
36
+ - Automatically installs npm packages and registers the `opencode-agora` plugin
37
+ - Ready in seconds — run once, done
38
+
39
+ ### `agora use` — Apply Workflows as Skills
40
+ - Browse 10+ production-tested workflows (TDD, security audit, API design, refactoring, etc.)
41
+ - `agora use wf-tdd-cycle` creates an OpenCode skill file and registers it
42
+ - No manual copy-pasting — one command and the workflow is live
43
+
44
+ ### Rich Offline Marketplace
45
+ - **36+ MCP servers** across 12 categories (filesystem, databases, cloud, browser automation, monitoring, etc.)
46
+ - All official `@modelcontextprotocol/*` servers plus top community servers
47
+ - Fully functional offline — no backend required
48
+ - Search, browse, trending — all work with bundled data
49
+
50
+ ### Config-Aware Installs
51
+ - `agora install mcp-github --write` installs the npm package **and** writes to config
52
+ - Detects OpenCode config path automatically
53
+ - Merge MCP servers into existing config
54
+ - Inspect config health with `agora config doctor`
55
+
56
+ ### Community
57
+ - Discussion threads on tools and patterns
58
+ - Trending prompts and workflows
59
+ - Browse and create discussions from the terminal
60
+
61
+ ### OpenCode Plugin
62
+ - Search, browse, install-preview, review, profile, discussion, and tutorial tools from inside OpenCode
63
+ - Uses the same marketplace core as the CLI
64
+
65
+ ### Local Hub
66
+ - Optional browser console for browsing the marketplace
67
+ - Runs locally with `bun run hub:dev`
68
+
69
+ ### Learn
70
+ - 6 interactive tutorials on MCP, OpenCode agents, security auditing, and more
71
+
72
+ ## Quick Start
73
+
74
+ The fastest way to get started — works in any project directory:
75
+
76
+ ```bash
77
+ # One command: scan project, set up OpenCode, install MCP servers, register plugin
78
+ npx opencode-agora init
79
+ ```
80
+
81
+ For a persistent command:
82
+
83
+ ```bash
84
+ npm install -g opencode-agora
85
+ agora init
86
+ ```
87
+
88
+ ### Install from source
89
+
90
+ Until the package is published to npm, or if you prefer to run from source:
91
+
92
+ ```bash
93
+ git clone https://github.com/IrgenSlj/agora.git && cd agora && bun install && bun run build && bun link
94
+ ```
95
+
96
+ The package exposes two binary names:
97
+
98
+ ```bash
99
+ agora --help
100
+ opencode-agora --help
101
+ ```
102
+
103
+ ## Live mode / hosted backend
104
+
105
+ > **Note:** Browse, search, and all read-only commands work fully offline using bundled data — no backend required. Features that write data (publish, reviews, discussions, auth login) and the `--api` flag require a live backend. A hosted instance is not yet deployed. Until then, self-host via the `backend/` directory and set `AGORA_API_URL` to your instance URL before using `--api` or any write commands.
106
+
107
+ ## Usage
108
+
109
+ ### Setup
110
+
111
+ ```bash
112
+ # Scan project and generate optimal OpenCode config
113
+ agora init
114
+ agora init --dry-run # Preview without writing
115
+
116
+ # Apply a workflow as an OpenCode skill
117
+ agora use wf-tdd-cycle
118
+ agora use wf-security-audit
119
+ ```
120
+
121
+ ### Marketplace
122
+
123
+ ```bash
124
+ # Search and browse
125
+ agora search filesystem
126
+ agora search database --category mcp
127
+ AGORA_API_URL=https://agora.example.com agora search github --api
128
+ agora browse mcp-postgres
129
+ agora trending
130
+
131
+ # Install MCP servers
132
+ agora install mcp-github # preview only
133
+ agora install mcp-github --write # install npm package + write config
134
+
135
+ # Save/bookmark items
136
+ agora save wf-security-audit
137
+ agora saved
138
+ agora remove wf-security-audit
139
+ ```
140
+
141
+ ### Workflows
142
+
143
+ ```bash
144
+ agora workflows
145
+ agora workflows security
146
+ ```
147
+
148
+ ### Community & Auth
149
+
150
+ ```bash
151
+ agora discussions mcp --category question
152
+ agora discuss --title "MCP question" --content "How are you composing servers?" --category question
153
+ agora auth login --token $AGORA_TOKEN --api-url https://agora.example.com
154
+ agora auth status
155
+ agora publish package --name @you/server --description "MCP server" --npm @you/server
156
+ agora publish workflow --name "Security Audit" --description "Audit workflow" --prompt-file ./prompt.md
157
+ agora review mcp-github --rating 5 --content "Works well"
158
+ agora reviews mcp-github --api
159
+ agora profile alice
160
+ ```
161
+
162
+ ### Diagnostics
163
+
164
+ ```bash
165
+ agora config doctor
166
+ agora config doctor --json
167
+ ```
168
+
169
+ `agora install <id>` is preview-only by default. Add `--write` to install the npm package and update config. Pass `--config ./opencode.json` for an explicit target.
170
+
171
+ Saved items and optional auth credentials are stored in `~/.config/agora/state.json` by default. Use `AGORA_HOME=/path/to/agora` or `--data-dir /path/to/agora` to override.
172
+
173
+ The CLI uses bundled offline marketplace data (36+ MCP servers, 10 workflows) by default. Add `--api`, `--live`, `AGORA_USE_API=true`, or `AGORA_API_URL` to use the live backend. Falls back to offline data if the API is unavailable.
174
+
175
+ ### OpenCode Plugin Commands
176
+
177
+ Once registered (via `agora init` or manually), use inside OpenCode:
178
+
179
+ | Command | Description |
180
+ |---|---|
181
+ | `/agora search <query> [category]` | Search marketplace |
182
+ | `/agora browse_category <category>` | Browse by category |
183
+ | `/agora browse <id>` | View package details |
184
+ | `/agora trending [type]` | See trending |
185
+ | `/agora install <id> [--write]` | Install to config |
186
+ | `/agora review [action] [...]` | Reviews/ratings |
187
+ | `/agora discussions [action] [...]` | Community |
188
+ | `/agora profile [action] [--username]` | User profiles |
189
+ | `/agora tutorial [id] [step]` | Interactive tutorials |
190
+ | `/agora info` | Help |
191
+
192
+ **Categories:** mcp, prompt, workflow, skill `|` **Data sources:** offline (default), `--api`
193
+
194
+ ### Registering the plugin manually
195
+
196
+ If you did not run `agora init`, register the plugin by hand:
197
+
198
+ 1. Install the package globally:
199
+ ```bash
200
+ npm install -g opencode-agora
201
+ ```
202
+ 2. Add `"opencode-agora"` to the `plugins` array in `~/.config/opencode/opencode.json` (or your project-local `opencode.json`):
203
+ ```json
204
+ {
205
+ "plugins": ["opencode-agora"]
206
+ }
207
+ ```
208
+
209
+ ## Development
210
+
211
+ ```bash
212
+ # Typecheck
213
+ bun run typecheck
214
+
215
+ # Build package output
216
+ bun run build
217
+
218
+ # Run tests
219
+ bun test
220
+
221
+ # Try the CLI from source
222
+ bun src/cli.ts search filesystem
223
+
224
+ # Install locally to OpenCode
225
+ bun run dev
226
+
227
+ # Run the optional local Hub
228
+ bun run hub:dev
229
+ ```
230
+
231
+ ## Project Structure
232
+
233
+ ```
234
+ agora/
235
+ ├── src/ # CLI, plugin, and shared marketplace core
236
+ ├── backend/ # Cloudflare Workers API
237
+ ├── hub/ # Optional local web Hub
238
+ ├── test/ # Tests
239
+ ├── dist/ # Built output
240
+ └── README.md
241
+ ```
242
+
243
+ ## Architecture
244
+
245
+ ```
246
+ agora/
247
+ ├── src/
248
+ │ ├── cli.ts # CLI entrypoint
249
+ │ ├── cli/app.ts # CLI command parser and handlers
250
+ │ ├── init.ts # Project scanner + init plan generator
251
+ │ ├── live.ts # Live API source with offline fallback
252
+ │ ├── marketplace.ts # Shared search, browse, trending, install-plan core
253
+ │ ├── config-files.ts # OpenCode config detection, doctor, and write helpers
254
+ │ ├── state.ts # Local Agora saved-item state
255
+ │ ├── index.ts # OpenCode plugin
256
+ │ ├── api.ts # API client with fallback
257
+ │ ├── format.ts # Output formatting
258
+ │ ├── config.ts # MCP config generation
259
+ │ ├── data.ts # 36+ MCP servers, 10 workflows, 6 tutorials
260
+ │ └── types.ts # TypeScript types
261
+
262
+ ├── backend/ # Cloudflare Workers API
263
+ │ ├── src/index.ts # Hono server + routes
264
+ │ ├── schema.sql # D1 database schema
265
+ │ └── services/ # npm + GitHub API clients
266
+
267
+ ├── hub/ # Local Hub app
268
+
269
+ ├── test/ # Unit and CLI tests
270
+ └── dist/ # Built output
271
+ ```
272
+
273
+ ## Project Status
274
+
275
+ | Component | Status | Notes |
276
+ |-----------|--------|-------|
277
+ | `agora init` | ✅ **New** | Project scanning, config generation, auto-install, plugin registration |
278
+ | `agora use` | ✅ **New** | Apply workflows as OpenCode skills in one command |
279
+ | `agora install --write` | ✅ **Improved** | Now auto-installs npm packages |
280
+ | CLI | Ready | 20 commands: `init`, `use`, `search`, `browse`, `trending`, `workflows`, `tutorials`, `tutorial`, `discussions`, `discuss`, `install`, `save`, `saved`, `remove`, `auth`, `publish`, `review`, `reviews`, `profile`, `config doctor` |
281
+ | Offline data | ✅ **Expanded** | 36 MCP servers, 10 workflows, 7 discussions, 6 tutorials |
282
+ | Live API mode | Ready | Opt-in via `--api`, `AGORA_API_URL`; falls back offline |
283
+ | Shared core | Ready | CLI and plugin share marketplace logic |
284
+ | Local state | Ready | Saved items and auth tokens under `~/.config/agora` |
285
+ | Plugin (offline) | Ready | Works with bundled data |
286
+ | Backend | 🚧 Not deployed — self-host required (see backend/) | Cloudflare Workers + D1 ready for deployment |
287
+ | Local Hub | Ready | Static web app served by Bun |
288
+ | CI | Ready | Typecheck + tests on push/PR |
289
+ | Publish CI | ✅ **New** | Auto-publish to npm on release |
290
+
291
+ ## Testing
292
+
293
+ ```bash
294
+ bun test
295
+ ```
296
+
297
+ ## Roadmap
298
+
299
+ See [ROADMAP.md](./ROADMAP.md) for upcoming work and ways to contribute.
300
+
301
+ ## License
302
+
303
+ MIT
304
+
305
+ ---
306
+
307
+ <p align="center">
308
+ Built for the developer community
309
+ </p>
package/dist/api.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ export interface Package {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ author: string;
6
+ version: string;
7
+ category: string;
8
+ tags: string[];
9
+ stars: number;
10
+ installs: number;
11
+ repository?: string;
12
+ npm_package?: string;
13
+ created_at: string;
14
+ }
15
+ export interface Workflow {
16
+ id: string;
17
+ name: string;
18
+ description: string;
19
+ author: string;
20
+ prompt: string;
21
+ model?: string;
22
+ tags: string[];
23
+ stars: number;
24
+ forks: number;
25
+ created_at: string;
26
+ }
27
+ export interface Discussion {
28
+ id: string;
29
+ title: string;
30
+ content: string;
31
+ author: string;
32
+ category: string;
33
+ stars: number;
34
+ reply_count: number;
35
+ created_at: string;
36
+ }
37
+ export interface User {
38
+ id: string;
39
+ username: string;
40
+ display_name?: string;
41
+ bio?: string;
42
+ avatar_url?: string;
43
+ package_count?: number;
44
+ workflow_count?: number;
45
+ discussion_count?: number;
46
+ created_at?: string;
47
+ }
48
+ export declare function searchPackages(query: string, category?: string): Promise<Package[]>;
49
+ export declare function getPackage(id: string): Promise<Package | null>;
50
+ export declare function searchWorkflows(query: string): Promise<Workflow[]>;
51
+ export declare function getWorkflow(id: string): Promise<Workflow | null>;
52
+ export declare function getTrending(_type?: 'packages' | 'workflows' | 'all'): Promise<unknown>;
53
+ export declare function getDiscussions(category?: string): Promise<Discussion[]>;
54
+ export declare function createDiscussion(data: {
55
+ title: string;
56
+ content: string;
57
+ category: string;
58
+ author?: string;
59
+ }, token?: string): Promise<{
60
+ id: string;
61
+ } | null>;
62
+ export declare function getUser(username: string): Promise<User | null>;
63
+ export declare function searchNpmPackages(query: string): Promise<{
64
+ npm: any[];
65
+ mcp: any[];
66
+ }>;
67
+ export declare function getMcpPackage(name: string): Promise<any | null>;
68
+ export declare function getGitHubRepo(owner: string, repo: string): Promise<any | null>;
69
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,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AO,CAAC;IAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAAC,GAAG,EAAE,GAAG,EAAE,CAAA;CAAE,CAAC,CAM1F;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAMrE;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAMpF"}
package/dist/api.js ADDED
@@ -0,0 +1,109 @@
1
+ const API_BASE = process.env.AGORA_API_URL || '';
2
+ export async function searchPackages(query, category) {
3
+ if (!API_BASE)
4
+ return [];
5
+ const params = new URLSearchParams({ q: query });
6
+ if (category)
7
+ params.set('category', category);
8
+ const res = await fetch(`${API_BASE}/api/packages?${params}`);
9
+ if (!res.ok)
10
+ return [];
11
+ const data = await res.json();
12
+ return data.packages || [];
13
+ }
14
+ export async function getPackage(id) {
15
+ if (!API_BASE)
16
+ return null;
17
+ const res = await fetch(`${API_BASE}/api/packages/${id}`);
18
+ if (!res.ok)
19
+ return null;
20
+ const data = await res.json();
21
+ return data.package || null;
22
+ }
23
+ export async function searchWorkflows(query) {
24
+ if (!API_BASE)
25
+ return [];
26
+ const res = await fetch(`${API_BASE}/api/workflows?q=${encodeURIComponent(query)}`);
27
+ if (!res.ok)
28
+ return [];
29
+ const data = await res.json();
30
+ return data.workflows || [];
31
+ }
32
+ export async function getWorkflow(id) {
33
+ if (!API_BASE)
34
+ return null;
35
+ const res = await fetch(`${API_BASE}/api/workflows/${id}`);
36
+ if (!res.ok)
37
+ return null;
38
+ const data = await res.json();
39
+ return data.workflow || null;
40
+ }
41
+ export async function getTrending(_type = 'all') {
42
+ if (!API_BASE)
43
+ return { packages: [], workflows: [] };
44
+ const res = await fetch(`${API_BASE}/api/trending`);
45
+ if (!res.ok)
46
+ return { packages: [], workflows: [] };
47
+ return res.json();
48
+ }
49
+ export async function getDiscussions(category) {
50
+ if (!API_BASE)
51
+ return [];
52
+ const params = category ? `?category=${category}` : '';
53
+ const res = await fetch(`${API_BASE}/api/discussions${params}`);
54
+ if (!res.ok)
55
+ return [];
56
+ const data = await res.json();
57
+ return data.discussions || [];
58
+ }
59
+ export async function createDiscussion(data, token) {
60
+ if (!API_BASE) {
61
+ throw new Error('AGORA_API_URL is not set. The hosted backend is not yet deployed — set AGORA_API_URL to your self-hosted backend (see backend/) to use --api mode.');
62
+ }
63
+ const headers = new Headers({ 'Content-Type': 'application/json' });
64
+ if (token)
65
+ headers.set('Authorization', `Bearer ${token}`);
66
+ const res = await fetch(`${API_BASE}/api/discussions`, {
67
+ method: 'POST',
68
+ headers,
69
+ body: JSON.stringify(data)
70
+ });
71
+ if (!res.ok)
72
+ return null;
73
+ const payload = await res.json();
74
+ return payload.discussion || payload;
75
+ }
76
+ export async function getUser(username) {
77
+ if (!API_BASE)
78
+ return null;
79
+ const res = await fetch(`${API_BASE}/api/users/${username}`);
80
+ if (!res.ok)
81
+ return null;
82
+ const data = await res.json();
83
+ return data.user || null;
84
+ }
85
+ export async function searchNpmPackages(query) {
86
+ if (!API_BASE)
87
+ return { npm: [], mcp: [] };
88
+ const res = await fetch(`${API_BASE}/api/aggregate/packages?q=${encodeURIComponent(query)}`);
89
+ if (!res.ok)
90
+ return { npm: [], mcp: [] };
91
+ return res.json();
92
+ }
93
+ export async function getMcpPackage(name) {
94
+ if (!API_BASE)
95
+ return null;
96
+ const res = await fetch(`${API_BASE}/api/aggregate/mcp/${name}`);
97
+ if (!res.ok)
98
+ return null;
99
+ return res.json();
100
+ }
101
+ export async function getGitHubRepo(owner, repo) {
102
+ if (!API_BASE)
103
+ return null;
104
+ const res = await fetch(`${API_BASE}/api/aggregate/github/${owner}/${repo}`);
105
+ if (!res.ok)
106
+ return null;
107
+ return res.json();
108
+ }
109
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"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AAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAAa;IACnD,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC3C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,6BAA6B,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7F,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAEzC,OAAO,GAAG,CAAC,IAAI,EAAyC,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY;IAC9C,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,sBAAsB,IAAI,EAAE,CAAC,CAAC;IACjE,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IAEzB,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAa,EAAE,IAAY;IAC7D,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,yBAAyB,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IAEzB,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type MarketplaceItem } from '../marketplace.js';
2
+ import { type FetchLike } from '../live.js';
3
+ type OutputStream = {
4
+ write(chunk: string): unknown;
5
+ };
6
+ export interface CliIo {
7
+ stdout: OutputStream;
8
+ stderr: OutputStream;
9
+ env?: Record<string, string | undefined>;
10
+ cwd?: string;
11
+ fetcher?: FetchLike;
12
+ }
13
+ export interface ParsedArgs {
14
+ command?: string;
15
+ args: string[];
16
+ flags: Record<string, string | boolean>;
17
+ }
18
+ export declare function runCli(argv: string[], io: CliIo): Promise<number>;
19
+ export declare function parseArgs(argv: string[]): ParsedArgs;
20
+ export declare function listKnownItems(): MarketplaceItem[];
21
+ export {};
22
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/cli/app.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAeL,KAAK,SAAS,EAGf,MAAM,YAAY,CAAC;AAkBpB,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CACzC;AAID,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAmEvE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA8CpD;AAumCD,wBAAgB,cAAc,IAAI,eAAe,EAAE,CAElD"}