loopshouse 0.1.1 → 0.2.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 (4) hide show
  1. package/README.md +72 -132
  2. package/SKILL.md +110 -125
  3. package/dist/loops.js +39607 -45569
  4. package/package.json +19 -10
package/README.md CHANGED
@@ -1,161 +1,101 @@
1
1
  # loopshouse
2
2
 
3
- CLI and MCP server for [Loops House](https://loops.house)manage hackathon projects, brainstorm with AI, and submit from your terminal or AI agent.
3
+ The Loops House CLI authenticate, browse hackathons, ideate with AI, query
4
+ sponsor knowledge graphs, and submit projects from your terminal or an AI
5
+ agent. Built with [incur](https://github.com/nichochar/incur), so the same
6
+ definitions power a **CLI**, an **MCP server**, and an **agent skill**.
4
7
 
5
- ## Quick Start
8
+ ## Install
6
9
 
7
- ```bash
8
- # Run directly (no install)
9
- npx loopshouse auth login
10
+ One command sets everything up for a hackathon — installs the CLI globally,
11
+ writes the event's agent skill into your coding agents (Claude Code +
12
+ the `.agents` standard), and signs you in:
10
13
 
11
- # Or install globally
12
- npm i -g loopshouse
13
- loops auth login
14
+ ```sh
15
+ npx loopshouse add <hackathon-slug>
14
16
  ```
15
17
 
16
- ## Authentication
17
-
18
- The CLI uses browser-based OAuth (Google or GitHub) via Supabase PKCE. Tokens are stored at `~/.loops/credentials.json` and auto-refresh on use.
19
-
20
- ```bash
21
- # Log in (opens browser)
22
- loops auth login
23
- loops auth login --provider github
18
+ Re-run it any time to refresh the skill with the event's latest sponsors and
19
+ deadlines. Or install manually:
24
20
 
25
- # Check status
26
- loops auth status
27
-
28
- # Log out
29
- loops auth logout
21
+ ```sh
22
+ npm i -g loopshouse
23
+ # or run from this repo:
24
+ bun run bin/loops.ts --help
30
25
  ```
31
26
 
32
- ## Commands
33
-
34
- ### Projects
27
+ ## Quick start
35
28
 
36
- ```bash
37
- # List your projects
38
- loops project list
39
-
40
- # Create a project
41
- loops project create --name "My DeFi App" --description "On-chain analytics tool"
42
-
43
- # Create with full details
44
- loops project create \
45
- --name "My App" \
46
- --description "Description" \
47
- --githubUrl https://github.com/user/repo \
48
- --techStack "React,Solidity,IPFS" \
49
- --category DeFi
50
-
51
- # Update a project
52
- loops project update --id <project-id> --name "New Name" --techStack "React,Rust"
29
+ ```sh
30
+ loops auth login --provider github # or --provider google, or --email you@x.com
31
+ loops hackathon ideate --hackathonSlug <slug> -m "give me a project idea"
32
+ loops hackathon ideate --hackathonSlug <slug> -m "go deeper on idea 2" # session continues automatically
33
+ loops knowledge query --hackathonSlug <slug> -s <sponsor> -q "how do I use the sponsor's SDK?"
34
+ loops project create --hackathonSlug <slug> --name "My Project" --repoUrl https://github.com/me/proj
35
+ loops project get --hackathonSlug <slug>
36
+ loops credits --hackathonSlug <slug>
53
37
  ```
54
38
 
55
- ### Hackathons
56
-
57
- ```bash
58
- # List hackathons accepting submissions
59
- loops hackathon list
39
+ The CLI is deliberately scoped to one hackathon at a time (no cross-hackathon
40
+ listings); ideator conversations persist per hackathon in `~/.loops/sessions/`.
60
41
 
61
- # List all hackathons (including past)
62
- loops hackathon list --all
63
-
64
- # AI-powered ideation for a hackathon
65
- loops hackathon ideate -h <hackathon-id> -m "I want to build something with AI and blockchain"
66
-
67
- # Ideate with your project context
68
- loops hackathon ideate -h <hackathon-id> -p <project-id> -m "How does my project fit?"
69
-
70
- # Submit to a hackathon
71
- loops hackathon submit -h <hackathon-id> -p <project-id>
72
- ```
42
+ > **Tip:** every hackathon's playground has a "Use the skill" tab with the
43
+ > exact `npx loopshouse add` command. Append a sponsor slug
44
+ > (`npx loopshouse add <slug> <sponsorSlug>`) to install a skill focused on
45
+ > that sponsor's bounties, docs, and judging criteria instead.
73
46
 
74
- ## MCP Server (AI Agent Integration)
75
-
76
- Use the Loops CLI as an MCP tool server in Claude Code, Cursor, Windsurf, or any MCP-compatible agent.
47
+ ## Commands
77
48
 
78
- ### Claude Code
49
+ | Group | Commands |
50
+ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
51
+ | root | `add <slug> [sponsorSlug]` (interactive setup: CLI install/update, skill into agents, auth) |
52
+ | `auth` | `login`, `verify`, `status`, `logout` |
53
+ | `hackathon` | `ideate` (1 credit/turn; stateful session, `--withProject`, `--new`), `session` (show/`--clear`), `submit` |
54
+ | `project` | `get` (your one project for a hackathon), `create`, `update` (PATCH — only passed fields change; no project id, yours is resolved) |
55
+ | `knowledge` | `query` (1 credit/query — graph-RAG evidence from a sponsor's docs) |
56
+ | `artifact` | `list`, `save`, `update`, `remove` (ideation scratchpad) |
57
+ | root | `credits` (remaining agent credits), `evaluate` (per-sponsor evaluator prompt; your project auto-included) |
79
58
 
80
- ```bash
81
- # Auto-configure
82
- loops mcp add
59
+ ## Authentication
83
60
 
84
- # Or manually add to .mcp.json in your project root:
85
- ```
61
+ Auth uses Supabase Auth against the Loops platform. Three flows:
86
62
 
87
- ```json
88
- {
89
- "mcpServers": {
90
- "loops": {
91
- "command": "npx",
92
- "args": ["loopshouse", "--mcp"]
93
- }
94
- }
95
- }
96
- ```
63
+ | Flow | Command |
64
+ | ------------ | --------------------------------------------------------------------------------------------- |
65
+ | GitHub OAuth | `loops auth login --provider github` |
66
+ | Google OAuth | `loops auth login --provider google` |
67
+ | Email OTP | `loops auth login --email you@x.com` then `loops auth verify --email you@x.com --code 123456` |
97
68
 
98
- ### Cursor / Windsurf
69
+ OAuth runs a localhost callback server (default port `54321`, `--port` to
70
+ change), opens your browser, and exchanges the PKCE code for a session.
71
+ Tokens are stored at `~/.loops/credentials.json` (mode `0600`) and refreshed
72
+ automatically on each command.
99
73
 
100
- Add to your MCP settings:
74
+ ## Agent surfaces
101
75
 
102
- ```json
103
- {
104
- "mcpServers": {
105
- "loops": {
106
- "command": "npx",
107
- "args": ["loopshouse", "--mcp"]
108
- }
109
- }
110
- }
76
+ ```sh
77
+ loops --mcp # start as an MCP stdio server
78
+ loops mcp add # register the MCP server with your agent
79
+ loops skills add # generate + install skill files
80
+ loops --llms # print the machine-readable command manifest
111
81
  ```
112
82
 
113
- ### Available MCP Tools
114
-
115
- | Tool | Description |
116
- |------|-------------|
117
- | `auth_login` | Authenticate via browser OAuth |
118
- | `auth_status` | Check authentication status |
119
- | `auth_logout` | Clear stored credentials |
120
- | `project_list` | List your projects |
121
- | `project_create` | Create a new project |
122
- | `project_update` | Update project details |
123
- | `hackathon_list` | Browse open hackathons |
124
- | `hackathon_ideate` | AI brainstorming for a hackathon |
125
- | `hackathon_submit` | Submit a project to a hackathon |
126
-
127
- ### Example Agent Usage
128
-
129
- Once configured, your AI agent can:
83
+ ## Configuration
130
84
 
131
- > "List my Loops House projects"
132
- > "Submit my project to the Shanghai hackathon"
133
- > "Help me brainstorm ideas for the upcoming hackathon"
85
+ | Env var | Default | Purpose |
86
+ | ------------------------- | ----------------------------------- | -------------------- |
87
+ | `LOOPS_PLATFORM_URL` | `https://loops-platform.vercel.app` | Platform API origin |
88
+ | `LOOPS_SUPABASE_URL` | (baked) | Supabase project URL |
89
+ | `LOOPS_SUPABASE_ANON_KEY` | (baked) | Supabase anon key |
134
90
 
135
- The agent calls the MCP tools automatically no manual CLI commands needed.
91
+ Point these at `http://localhost:3000` + your local Supabase to develop against
92
+ a local stack.
136
93
 
137
- ## Environment Variables
94
+ ## Develop
138
95
 
139
- | Variable | Default | Description |
140
- |----------|---------|-------------|
141
- | `LOOPS_PLATFORM_URL` | `https://loops.house` | Override the platform API URL (for local dev) |
142
-
143
- ## Development
144
-
145
- ```bash
146
- # Clone and install
147
- cd skill && bun install
148
-
149
- # Run in dev mode
150
- bun run dev -- auth status
151
-
152
- # Build for npm
153
- bun run build
154
-
155
- # Test compiled output
156
- node dist/loops.js --help
96
+ ```sh
97
+ bun install
98
+ bun run bin/loops.ts <args> # run from source
99
+ bun run build # bundle to dist/loops.js
100
+ bun run typecheck # tsc --noEmit
157
101
  ```
158
-
159
- ## License
160
-
161
- MIT
package/SKILL.md CHANGED
@@ -1,158 +1,143 @@
1
1
  ---
2
2
  name: loops-cli
3
- description: Loops House CLI for managing hackathon projects, browsing hackathons, AI-powered ideation, and submission — from the terminal or as an AI agent tool. Use when building projects for hackathons, submitting to hackathons, ideating project ideas, or managing Loops House projects programmatically. Triggers on "loops", "hackathon", "submit project", "ideate", "Loops House".
3
+ description: >-
4
+ Loops House CLI for hackathon builders. Use to authenticate (GitHub, Google,
5
+ or email one-time code), browse hackathons, brainstorm project ideas with the
6
+ AI mentor, query sponsor knowledge graphs (graph-RAG), manage ideation
7
+ artifacts, create/update/submit projects, evaluate a project against a
8
+ sponsor, and check agent credits. Triggers on "loops", "loops house",
9
+ "hackathon submit", "ideate a project", "sponsor knowledge graph".
10
+ requires_bin: loops
4
11
  ---
5
12
 
6
13
  # Loops House CLI
7
14
 
8
- Manage the full hackathon builder lifecycle from terminal or AI agent.
15
+ `loops` is a typed CLI (built with [incur](https://github.com/nichochar/incur)) that
16
+ doubles as an MCP server and an agent skill. One binary, three surfaces:
9
17
 
10
- ## Prerequisites
18
+ - **CLI** — `loops <group> <command>`
19
+ - **MCP** — `loops --mcp` (stdio) or `loops mcp add` to register with your agent
20
+ - **Skill** — this file; regenerate with `loops skills add`
11
21
 
12
- ```bash
13
- # No install needed use npx:
14
- npx loopshouse auth login
22
+ All data commands talk to the Loops platform over HTTPS using a Supabase access
23
+ token stored at `~/.loops/credentials.json`. Auth is required before any data
24
+ command.
15
25
 
16
- # Or install globally:
17
- npm i -g loopshouse
18
- loops auth login
26
+ > **Per-hackathon skill**: `npx loopshouse add <hackathonSlug>` (the
27
+ > playground's "Use the skill" tab gives you the exact command) installs a
28
+ > templated skill with the event's data and every sponsor's knowledge-graph
29
+ > command already filled in, into Claude Code and `.agents`-standard agents.
30
+ > Prefer that when working on one specific hackathon; re-run it to refresh.
19
31
 
20
- # For local dev, override the platform URL:
21
- export LOOPS_PLATFORM_URL="http://localhost:3000"
22
- ```
32
+ ## Authenticate first
23
33
 
24
- ## Authentication
34
+ ALWAYS check `loops auth status` before starting work or a new session — never
35
+ assume a stored session exists.
25
36
 
26
- ```bash
27
- loops auth login # Browser OAuth (Google/GitHub) saves to ~/.loops/credentials.json
28
- loops auth status # Check current session
29
- loops auth logout # Clear stored credentials
37
+ ```sh
38
+ loops auth status # who am I? run this FIRST
39
+ loops auth login --provider github # browser OAuth (also: --provider google)
40
+ loops auth login --email you@example.com # email one-time code…
41
+ loops auth verify --email you@example.com --code 123456 # …then verify it
42
+ loops auth logout # clear credentials
30
43
  ```
31
44
 
32
- All commands below require authentication.
45
+ - Browser OAuth opens a tab and captures the callback on `localhost:54321`
46
+ (override with `--port`). In headless/agent contexts the auth URL is printed
47
+ so a human can open it.
48
+ - Email OTP: `auth login --email` sends a code. In an interactive terminal it
49
+ prompts for the code inline; in agent/pipe contexts it returns a CTA to run
50
+ `auth verify --email <e> --code <code>`.
33
51
 
34
- ## Core Workflow
52
+ ## Credits
35
53
 
36
- ### 1. Browse open hackathons
54
+ Agent usage is metered per (user, hackathon): **1 credit = one ideator turn or
55
+ one knowledge-graph query**. Everything else (project/artifact CRUD, the
56
+ evaluator prompt) is free.
37
57
 
38
- ```bash
39
- loops hackathon list # Shows building + upcoming hackathons only
40
- loops hackathon list --all # Include judging/completed/finalized
58
+ ```sh
59
+ loops credits --hackathonSlug <hackathonSlug> # { used, cap, remaining }
41
60
  ```
42
61
 
43
- Output includes: id, name, theme, phase, problem_statements, dates.
44
-
45
- ### 2. Create or update a project
46
-
47
- ```bash
48
- # Create (minimal)
49
- loops project create --name "My DApp" --description "On-chain analytics"
50
-
51
- # Create (full)
52
- loops project create \
53
- --name "My DApp" \
54
- --description "On-chain analytics dashboard" \
55
- --tagline "Real-time DeFi insights" \
56
- --category "DeFi" \
57
- --githubUrl https://github.com/user/repo \
58
- --youtubeUrl https://youtube.com/watch?v=demo \
59
- --websiteUrl https://mydapp.xyz \
60
- --logoUrl https://mydapp.xyz/logo.png \
61
- --techStack "React,Solidity,The Graph,IPFS" \
62
- --keyFeatures "On-chain analytics,Real-time alerts,Portfolio tracking" \
63
- --screenshotUrls "https://i.imgur.com/a.png,https://i.imgur.com/b.png" \
64
- --additionalLinks '[{"label":"Docs","url":"https://docs.mydapp.xyz"}]' \
65
- --socialLinks '[{"label":"Twitter","url":"https://twitter.com/mydapp"}]'
66
-
67
- # Update
68
- loops project update --id <project-id> --description "Updated desc" --techStack "React,Rust,WASM"
69
-
70
- # List your projects
71
- loops project list
72
- ```
62
+ On a `credits_exhausted` error, stop and tell the user — don't retry.
63
+
64
+ ## Ideation (stateful sessions)
73
65
 
74
- **Create/Update fields:**
75
-
76
- | Flag | Description | Format |
77
- |------|-------------|--------|
78
- | `--name` | Project name | string |
79
- | `--description` | Full description | string |
80
- | `--tagline` | Short tagline | string |
81
- | `--category` | Category (DeFi, NFT, DAO, etc.) | string |
82
- | `--githubUrl` | GitHub repo URL | URL |
83
- | `--youtubeUrl` | YouTube demo URL | URL |
84
- | `--websiteUrl` | Project website | URL |
85
- | `--logoUrl` | Logo image URL | URL |
86
- | `--techStack` | Tech stack | comma-separated |
87
- | `--keyFeatures` | Key features | comma-separated |
88
- | `--screenshotUrls` | Screenshot URLs | comma-separated |
89
- | `--additionalLinks` | Extra links | JSON `[{label,url}]` |
90
- | `--socialLinks` | Social links | JSON `[{label,url}]` |
91
- | `--teamId` | Team ID (create only) | UUID |
92
- | `--hackathonId` | Hackathon ID (create only) | UUID |
93
-
94
- ### 3. Ideate with AI mentor
95
-
96
- Brainstorm project ideas for a specific hackathon. The AI mentor knows the hackathon's problem statements, theme, and sponsor tracks. Pass `--projectId` to include your project details for contextual feedback on alignment and progress.
97
-
98
- ```bash
99
- # General ideation
100
- loops hackathon ideate \
101
- --hackathonId <hackathon-id> \
102
- --message "I want to build something with AI and blockchain"
103
-
104
- # Ideation with project context (recommended)
105
- loops hackathon ideate \
106
- --hackathonId <hackathon-id> \
107
- --projectId <project-id> \
108
- --message "How does my project align with this hackathon?"
66
+ Ideator conversations are stored locally per hackathon
67
+ (`~/.loops/sessions/<slug>.json`) and continue automatically — each `ideate`
68
+ call just sends one more message in that hackathon's session.
69
+
70
+ ```sh
71
+ loops hackathon ideate --hackathonSlug <slug> -m "idea using sponsor X" # AI mentor (1 credit/turn)
72
+ loops hackathon ideate --hackathonSlug <slug> -m "go deeper on idea 2" # continues the same conversation
73
+ loops hackathon ideate --hackathonSlug <slug> --withProject -m "how do I better target bounty Y?"
74
+ loops hackathon ideate --hackathonSlug <slug> --new -m "fresh start" # discard the session first
75
+ loops hackathon session --hackathonSlug <slug> # show the stored conversation
76
+ loops hackathon session --hackathonSlug <slug> --clear # delete it
77
+ loops hackathon submit --hackathonSlug <slug> --name "My Project" --repoUrl <url>
109
78
  ```
110
79
 
111
- For multi-turn conversations, pass prior history as JSON:
80
+ - `--withProject` inlines your project record so the mentor gives
81
+ project-aware feedback. No id needed — you have at most one project per
82
+ hackathon (team membership counts), so the platform resolves yours.
83
+
84
+ ## Sponsor knowledge graphs (graph-RAG)
85
+
86
+ Each sponsor has a knowledge graph built from their docs, SDKs, and bounty
87
+ materials. A query returns a **cited evidence block** (entities, relationships,
88
+ chunks, sources) — you compose the answer yourself from it. 1 credit per query.
112
89
 
113
- ```bash
114
- loops hackathon ideate \
115
- --hackathonId <id> \
116
- --projectId <project-id> \
117
- --message "What about a decentralized identity solution?" \
118
- --history '[{"role":"user","content":"I want to build with AI"},{"role":"assistant","content":"Great! Consider..."}]'
90
+ ```sh
91
+ loops knowledge query --hackathonSlug <slug> -s <sponsorSlug> -q "How do I authenticate with the SDK?"
92
+ loops knowledge query --hackathonSlug <slug> -s <sponsorSlug> -q "…" --mode local # entity-centric
119
93
  ```
120
94
 
121
- ### 4. Submit to hackathon
95
+ ## Your project (a project is the submission)
122
96
 
123
- ```bash
124
- loops hackathon submit \
125
- --hackathonId <hackathon-id> \
126
- --projectId <project-id>
97
+ Everything is scoped to ONE hackathon — you have at most one project per
98
+ hackathon (team membership counts), there is no cross-hackathon listing, and
99
+ no command needs a project id: the platform resolves yours from the session.
100
+
101
+ ```sh
102
+ loops project get --hackathonSlug <slug> # your project (exists=false if none)
103
+ loops project create --hackathonSlug <slug> --name "My Project" --bountyIds id1 --bountyIds id2
104
+ loops project update --hackathonSlug <slug> --tagline "New tagline"
127
105
  ```
128
106
 
129
- Phase-gated: only works during the `building` phase (between start_date and submission_deadline). Team ID is auto-resolved from the project.
107
+ **Update is a PATCH** only the fields you pass change; omitted fields
108
+ (including bounty picks and custom answers) keep their current values.
109
+
110
+ ## Ideation artifacts (scratchpad)
111
+
112
+ Persist ideas/problems/tech-stack notes per hackathon; they appear in the web
113
+ playground too. Kinds: `idea`, `problem`, `tech-stack`, `note`.
130
114
 
131
- ## MCP Mode
115
+ ```sh
116
+ loops artifact list --hackathonSlug <slug>
117
+ loops artifact save --hackathonSlug <slug> --name "Title" --kind idea --body "Markdown…"
118
+ loops artifact update --hackathonSlug <slug> --id <artifactId> --body "Updated…"
119
+ loops artifact remove --hackathonSlug <slug> --id <artifactId>
120
+ ```
121
+
122
+ ## Evaluate a project against a sponsor
132
123
 
133
- Register as an MCP server for AI agent integration:
124
+ Fetches a self-contained evaluator prompt (free): the sponsor's judging
125
+ criteria, bounties, and hackathon context plus step-by-step instructions.
126
+ Your project record is included automatically when you have one.
127
+ **Execute the returned prompt yourself inside the project repo** — it assumes
128
+ code access and produces alignment feedback (strengths, gaps, where to focus),
129
+ never scores.
134
130
 
135
- ```bash
136
- loops mcp add
137
- loops --mcp # Start as MCP stdio server
131
+ ```sh
132
+ loops evaluate --hackathonSlug <slug> -s <sponsorSlug>
138
133
  ```
139
134
 
140
- ## Aliases
141
-
142
- | Long flag | Short |
143
- |-----------|-------|
144
- | `--name` | `-n` |
145
- | `--description` | `-d` |
146
- | `--githubUrl` | `-g` |
147
- | `--hackathonId` | `-h` |
148
- | `--projectId` | `-p` |
149
- | `--message` | `-m` |
150
- | `--teamId` | `-t` |
151
- | `--id` (update) | `-i` |
152
-
153
- ## Architecture
154
-
155
- - **Auth**: Supabase PKCE OAuth flow, tokens stored at `~/.loops/credentials.json`, auto-refreshed on use
156
- - **Data commands** (list, create, update, submit): Direct Supabase client queries with user RLS context
157
- - **AI commands** (ideate): Call platform API route (`/api/builder-agents/project-ideator`) with Bearer token auth, optionally including project snapshot for contextual feedback
158
- - **Framework**: Built with [incur](https://github.com/nichochar/incur) — typed CLI + MCP + skill generation
135
+ ## Notes for agents
136
+
137
+ - Every command returns a structured envelope; pass `--json` for machine output.
138
+ - Success outputs often end with a suggested next command (CTA) — prefer
139
+ following it over guessing the next step.
140
+ - On `NOT_AUTHENTICATED`, run `loops auth login` (or `--email`) before retrying.
141
+ - `loops --llms` prints the full machine-readable command manifest.
142
+ - Configure the target stack with env vars: `LOOPS_PLATFORM_URL`,
143
+ `LOOPS_SUPABASE_URL`, `LOOPS_SUPABASE_ANON_KEY`.