@@ -11,7 +11,8 @@ skillx/
1111│ │ ├── components/ # React UI components (14 files)
1212│ │ ├── lib/
1313│ │ │ ├── db/ # Drizzle ORM schema + database helpers
14- │ │ │ ├── auth/ # Better Auth config + session helpers
14+ │ │ │ ├── auth/ # Better Auth config + session helpers + authenticate-request
15+ │ │ │ ├── github/ # GitHub API utilities + validate-repo-ownership
1516│ │ │ ├── search/ # Hybrid search orchestration (5 modules)
1617│ │ │ ├── vectorize/ # Embedding indexing (3 modules)
1718│ │ │ └── cache/ # KV caching utilities
@@ -70,6 +71,7 @@ skillx/
7071| ` api.skill-install.ts ` | API | ? | Track skill install (fire-and-forget) |
7172| ` api.usage-report.ts ` | API | 99 | Log skill execution outcomes |
7273| ` api.user-api-keys.ts ` | API | 133 | Create/list/revoke API keys |
74+ | ` api.skill-register.ts ` | API | ? | Register/publish skills from GitHub repos (auth required) |
7375| ` api.admin.seed.ts ` | API | 121 | Load demo seed data |
7476| ` $.tsx ` | Catch-all | 23 | 404 page |
7577
@@ -140,12 +142,22 @@ skillx/
140142| ` auth-client.ts ` | React client for sessions (getSession, signIn, signOut) |
141143| ` session-helpers.ts ` | ` getSession(request, env) ` , ` requireAuth() ` — request-level auth |
142144| ` api-key-utils.ts ` | Hash/verify API keys (SHA-256), generate prefixes |
145+ | ` authenticate-request.ts ` | Unified auth: tries API key first, fallbacks to session; returns ` { userId, method } ` |
143146
144147** Flow:**
1451481 . User clicks "Sign in with GitHub"
1461492 . Better Auth → GitHub OAuth → session cookie (7d expiry)
1471503 . Routes check: ` const session = await getSession(request, env) `
1481514 . Protected routes: ` await requireAuth(session) ` → 401 if missing
152+ 5 . For dual-auth endpoints (CLI + Web): ` const auth = await authenticateRequest(request, env) ` → try API key, fallback to session
153+
154+ ### GitHub Integration (apps/web/app/lib/github)
155+
156+ | Module | Purpose |
157+ | ------------------------------| ---------|
158+ | ` validate-repo-ownership.ts ` | Verify user has write access to GitHub repo (used by skill registration) |
159+
160+ ** Used by:** Register API to validate author owns the GitHub repository before publishing skills.
149161
150162### Vectorization (apps/web/app/lib/vectorize)
151163
@@ -169,6 +181,7 @@ skillx/
169181| ` index.ts ` | - | Commander.js CLI entry + command registration |
170182| ` commands/search.ts ` | 86 | ` skillx search "..." ` → API call → table output |
171183| ` commands/use.ts ` | 78 | ` skillx use skill1 skill2 ` → fetch SKILL.md, POST install, echo to stdout |
184+ | ` commands/publish.ts ` | 183 | ` skillx publish [owner/repo] ` → register/publish skills from GitHub |
172185| ` commands/report.ts ` | 90 | ` skillx report ` → POST usage metrics to API |
173186| ` commands/config.ts ` | 91 | ` skillx config set/get KEY VALUE ` → local store |
174187| ` lib/api-client.ts ` | 35 | HTTP client with API key auth |
@@ -179,7 +192,10 @@ skillx/
179192npm install -g skillx-sh
180193skillx search " data processing"
181194skillx use skillx-search skillx-email
182- skillx config set SKILLX_API_KEY sk_...
195+ skillx publish owner/repo # Auto-detect or explicit owner/repo
196+ skillx publish owner/repo --path path/to/skill --scan
197+ skillx publish --dry-run
198+ skillx config set api-key sk_...
183199skillx report --outcome success --duration 1234
184200```
185201
0 commit comments