uaibuilder 0.1.1 → 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 +54 -0
  2. package/package.json +11 -3
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) {
@@ -101,6 +140,15 @@ function setup(flags) {
101
140
  // Ensure mcpServers exists
102
141
  if (!config.mcpServers) config.mcpServers = {};
103
142
 
143
+ // Don't overwrite existing stdio config (dev setup)
144
+ const existing = config.mcpServers.uaibuilder;
145
+ if (existing?.command) {
146
+ console.log(`\n UaiBuilder is already configured as a local (stdio) MCP server.`);
147
+ console.log(` This is a dev setup — skipping to avoid overwriting.\n`);
148
+ console.log(` To force HTTP setup, run with --force\n`);
149
+ if (!flags.force) return;
150
+ }
151
+
104
152
  // Add/update UaiBuilder entry
105
153
  config.mcpServers.uaibuilder = buildMcpEntry(token);
106
154
 
@@ -116,11 +164,17 @@ function setup(flags) {
116
164
 
117
165
  writeConfig(configPath, config);
118
166
 
167
+ // Install skill file for Claude Code
168
+ if (provider === 'claude') {
169
+ installSkill();
170
+ }
171
+
119
172
  console.log(`
120
173
  UaiBuilder configured for ${provider}!
121
174
 
122
175
  Config: ${configPath}
123
176
  Server: uaibuilder (MCP HTTP)
177
+ ${provider === 'claude' ? 'Skill: .claude/skills/uaibuilder.md (installed)' : ''}
124
178
 
125
179
  Next steps:
126
180
  ${provider === 'claude' ? ' 1. Restart Claude Code (close and reopen)' : ' 1. Restart your editor'}
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "uaibuilder",
3
- "version": "0.1.1",
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"
7
7
  },
8
- "files": ["index.mjs"],
8
+ "files": [
9
+ "index.mjs"
10
+ ],
9
11
  "type": "module",
10
12
  "license": "MIT",
11
- "keywords": ["uaibuilder", "mcp", "ai", "paas", "cloudflare"],
13
+ "keywords": [
14
+ "uaibuilder",
15
+ "mcp",
16
+ "ai",
17
+ "paas",
18
+ "cloudflare"
19
+ ],
12
20
  "repository": {
13
21
  "type": "git",
14
22
  "url": "https://github.com/UaiBuilder/uaibuilder.git"