uaibuilder 0.1.2 → 0.1.3

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 (2) hide show
  1. package/index.mjs +45 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -64,6 +64,45 @@ function buildMcpEntry(token) {
64
64
  };
65
65
  }
66
66
 
67
+ // ─── Skill file for Claude Code ───────────────────────
68
+
69
+ const SKILL_CONTENT = `# UaiBuilder MCP — Skill Guide
70
+
71
+ You have access to the UaiBuilder MCP. It lets you create full-stack apps with auth, database, API, and deploy them live — all through MCP tool calls.
72
+
73
+ ## Quick flow
74
+ \`\`\`
75
+ 1. Call uai_capabilities FIRST — read the full guide
76
+ 2. db_createTable (for each table — id/created_at/updated_at are auto-added, do NOT include them)
77
+ 3. api_createEndpoint (register, login, refresh + your routes)
78
+ 4. files_write("index.html", "...") — include setupAutoRefresh() for auth apps
79
+ 5. deploy_publish() — returns health check result
80
+ 6. test_request() — verify each endpoint works
81
+ \`\`\`
82
+
83
+ ## Key rules
84
+ - **handler is INLINE CODE** — do NOT wrap in arrow function
85
+ - **Variables available**: db, request, corsHeaders, context, jwtSecret
86
+ - **Dynamic routes**: use :param in path, access via context.params.paramName
87
+ - **Auth**: set auth:true, then use user.id (from JWT). NEVER trust body userId
88
+ - **JWT**: signJwt(payload, jwtSecret) — 2 day expiry. NEVER use btoa()
89
+ - **Passwords**: hashPassword(password) / verifyPassword(password, hash) — PBKDF2
90
+ - **ALWAYS validate inputs**: required fields, email format, password 8+ chars
91
+ - **ALWAYS create /api/auth/refresh** alongside register/login
92
+
93
+ ## After deploy
94
+ - deploy_publish returns health check — if ok:false, check handler code for syntax errors
95
+ - Use test_request to verify each endpoint
96
+ - Use group_overview for full dashboard
97
+ `;
98
+
99
+ function installSkill() {
100
+ const skillDir = join(process.cwd(), '.claude', 'skills');
101
+ const skillPath = join(skillDir, 'uaibuilder.md');
102
+ if (!existsSync(skillDir)) mkdirSync(skillDir, { recursive: true });
103
+ writeFileSync(skillPath, SKILL_CONTENT);
104
+ }
105
+
67
106
  // ─── Read/Write config safely ─────────────────────────
68
107
 
69
108
  function readConfig(path) {
@@ -125,11 +164,17 @@ function setup(flags) {
125
164
 
126
165
  writeConfig(configPath, config);
127
166
 
167
+ // Install skill file for Claude Code
168
+ if (provider === 'claude') {
169
+ installSkill();
170
+ }
171
+
128
172
  console.log(`
129
173
  UaiBuilder configured for ${provider}!
130
174
 
131
175
  Config: ${configPath}
132
176
  Server: uaibuilder (MCP HTTP)
177
+ ${provider === 'claude' ? 'Skill: .claude/skills/uaibuilder.md (installed)' : ''}
133
178
 
134
179
  Next steps:
135
180
  ${provider === 'claude' ? ' 1. Restart Claude Code (close and reopen)' : ' 1. Restart your editor'}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uaibuilder",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "UaiBuilder CLI — connect any AI to your apps via MCP",
5
5
  "bin": {
6
6
  "uaibuilder": "index.mjs"