@butterbase/cli 0.3.4 → 0.4.0

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 (70) hide show
  1. package/README.md +407 -407
  2. package/dist/bin/butterbase.js +91 -1
  3. package/dist/bin/butterbase.js.map +1 -1
  4. package/dist/src/commands/clone.d.ts +9 -0
  5. package/dist/src/commands/clone.d.ts.map +1 -0
  6. package/dist/src/commands/clone.js +131 -0
  7. package/dist/src/commands/clone.js.map +1 -0
  8. package/dist/src/commands/init.js +1 -1
  9. package/dist/src/commands/keys.d.ts +1 -0
  10. package/dist/src/commands/keys.d.ts.map +1 -1
  11. package/dist/src/commands/keys.js +1 -1
  12. package/dist/src/commands/keys.js.map +1 -1
  13. package/dist/src/commands/plugin.js +2 -2
  14. package/dist/src/commands/plugin.js.map +1 -1
  15. package/dist/src/commands/repo.d.ts +28 -0
  16. package/dist/src/commands/repo.d.ts.map +1 -0
  17. package/dist/src/commands/repo.js +440 -0
  18. package/dist/src/commands/repo.js.map +1 -0
  19. package/dist/src/commands/substrate.js +1 -1
  20. package/dist/src/commands/substrate.js.map +1 -1
  21. package/dist/src/commands/templates.d.ts +9 -0
  22. package/dist/src/commands/templates.d.ts.map +1 -0
  23. package/dist/src/commands/templates.js +74 -0
  24. package/dist/src/commands/templates.js.map +1 -0
  25. package/dist/src/commands/visibility.d.ts +7 -0
  26. package/dist/src/commands/visibility.d.ts.map +1 -0
  27. package/dist/src/commands/visibility.js +32 -0
  28. package/dist/src/commands/visibility.js.map +1 -0
  29. package/dist/src/lib/api-client.d.ts +5 -1
  30. package/dist/src/lib/api-client.d.ts.map +1 -1
  31. package/dist/src/lib/api-client.js +6 -1
  32. package/dist/src/lib/api-client.js.map +1 -1
  33. package/dist/src/lib/config.d.ts +8 -0
  34. package/dist/src/lib/config.d.ts.map +1 -1
  35. package/dist/src/lib/config.js +21 -0
  36. package/dist/src/lib/config.js.map +1 -1
  37. package/dist/src/lib/repo-api.d.ts +123 -0
  38. package/dist/src/lib/repo-api.d.ts.map +1 -0
  39. package/dist/src/lib/repo-api.js +75 -0
  40. package/dist/src/lib/repo-api.js.map +1 -0
  41. package/dist/src/lib/repo-ignore.d.ts +17 -0
  42. package/dist/src/lib/repo-ignore.d.ts.map +1 -0
  43. package/dist/src/lib/repo-ignore.js +44 -0
  44. package/dist/src/lib/repo-ignore.js.map +1 -0
  45. package/dist/src/lib/repo-manifest.d.ts +12 -0
  46. package/dist/src/lib/repo-manifest.d.ts.map +1 -0
  47. package/dist/src/lib/repo-manifest.js +25 -0
  48. package/dist/src/lib/repo-manifest.js.map +1 -0
  49. package/dist/src/lib/repo-paths.d.ts +14 -0
  50. package/dist/src/lib/repo-paths.d.ts.map +1 -0
  51. package/dist/src/lib/repo-paths.js +41 -0
  52. package/dist/src/lib/repo-paths.js.map +1 -0
  53. package/dist/src/lib/repo-walk.d.ts +14 -0
  54. package/dist/src/lib/repo-walk.d.ts.map +1 -0
  55. package/dist/src/lib/repo-walk.js +36 -0
  56. package/dist/src/lib/repo-walk.js.map +1 -0
  57. package/dist/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +55 -54
  59. package/templates/react-vite/.env.example +2 -2
  60. package/templates/react-vite/.mcp.json +10 -10
  61. package/templates/react-vite/README.md +38 -38
  62. package/templates/react-vite/index.html +13 -13
  63. package/templates/react-vite/package.json +25 -25
  64. package/templates/react-vite/src/App.css +33 -33
  65. package/templates/react-vite/src/App.tsx +77 -77
  66. package/templates/react-vite/src/index.css +8 -8
  67. package/templates/react-vite/src/lib.ts +6 -6
  68. package/templates/react-vite/src/main.tsx +10 -10
  69. package/templates/react-vite/tsconfig.json +21 -21
  70. package/templates/react-vite/vite.config.ts +6 -6
package/package.json CHANGED
@@ -1,54 +1,55 @@
1
- {
2
- "name": "@butterbase/cli",
3
- "version": "0.3.4",
4
- "description": "Command-line tool for Butterbase project scaffolding and backend management",
5
- "license": "Apache-2.0",
6
- "homepage": "https://butterbase.ai",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/NetGPT-Inc/butterbase-oss",
10
- "directory": "packages/cli"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "type": "module",
16
- "bin": {
17
- "butterbase": "dist/bin/butterbase.js"
18
- },
19
- "files": [
20
- "dist",
21
- "templates",
22
- "README.md"
23
- ],
24
- "scripts": {
25
- "build": "tsc -b",
26
- "dev": "tsc -b --watch",
27
- "test": "vitest run"
28
- },
29
- "keywords": [
30
- "butterbase",
31
- "cli",
32
- "backend",
33
- "baas"
34
- ],
35
- "dependencies": {
36
- "@butterbase/sdk": "^2.3.3",
37
- "adm-zip": "^0.5.17",
38
- "chalk": "^5.3.0",
39
- "commander": "^12.0.0",
40
- "dotenv": "^16.4.0",
41
- "fs-extra": "^11.2.0",
42
- "ora": "^8.0.0",
43
- "prompts": "^2.4.2",
44
- "tsx": "^4.0.0"
45
- },
46
- "devDependencies": {
47
- "@types/adm-zip": "^0.5.8",
48
- "@types/fs-extra": "^11.0.4",
49
- "@types/node": "^22.0.0",
50
- "@types/prompts": "^2.4.9",
51
- "typescript": "^5.7.0",
52
- "vitest": "^3.1.1"
53
- }
54
- }
1
+ {
2
+ "name": "@butterbase/cli",
3
+ "version": "0.4.0",
4
+ "description": "Command-line tool for Butterbase project scaffolding and backend management",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://butterbase.ai",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/NetGPT-Inc/butterbase-oss",
10
+ "directory": "packages/cli"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "type": "module",
16
+ "bin": {
17
+ "butterbase": "dist/bin/butterbase.js"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "templates",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsc -b",
26
+ "dev": "tsc -b --watch",
27
+ "test": "vitest run"
28
+ },
29
+ "keywords": [
30
+ "butterbase",
31
+ "cli",
32
+ "backend",
33
+ "baas"
34
+ ],
35
+ "dependencies": {
36
+ "@butterbase/sdk": "^2.4.0",
37
+ "adm-zip": "^0.5.17",
38
+ "chalk": "^5.3.0",
39
+ "commander": "^12.0.0",
40
+ "dotenv": "^16.4.0",
41
+ "fs-extra": "^11.2.0",
42
+ "ignore": "^5.3.0",
43
+ "ora": "^8.0.0",
44
+ "prompts": "^2.4.2",
45
+ "tsx": "^4.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/adm-zip": "^0.5.8",
49
+ "@types/fs-extra": "^11.0.4",
50
+ "@types/node": "^22.0.0",
51
+ "@types/prompts": "^2.4.9",
52
+ "typescript": "^5.7.0",
53
+ "vitest": "^3.1.1"
54
+ }
55
+ }
@@ -1,2 +1,2 @@
1
- VITE_API_URL={{API_URL}}
2
- VITE_APP_ID={{APP_ID}}
1
+ VITE_API_URL={{API_URL}}
2
+ VITE_APP_ID={{APP_ID}}
@@ -1,10 +1,10 @@
1
- {
2
- "mcpServers": {
3
- "butterbase": {
4
- "url": "{{API_URL}}/mcp",
5
- "headers": {
6
- "Authorization": "Bearer ${BUTTERBASE_API_KEY}"
7
- }
8
- }
9
- }
10
- }
1
+ {
2
+ "mcpServers": {
3
+ "butterbase": {
4
+ "url": "{{API_URL}}/mcp",
5
+ "headers": {
6
+ "Authorization": "Bearer ${BUTTERBASE_API_KEY}"
7
+ }
8
+ }
9
+ }
10
+ }
@@ -1,38 +1,38 @@
1
- # {{PROJECT_NAME}}
2
-
3
- A Butterbase-powered React application.
4
-
5
- ## Setup
6
-
7
- 1. Install dependencies:
8
- ```bash
9
- npm install
10
- ```
11
-
12
- 2. Copy `.env.example` to `.env` and configure:
13
- ```bash
14
- cp .env.example .env
15
- ```
16
-
17
- 3. Start development server:
18
- ```bash
19
- npm run dev
20
- ```
21
-
22
- ## Butterbase Configuration
23
-
24
- This project is connected to Butterbase app: `{{APP_ID}}`
25
-
26
- - API URL: `{{API_URL}}` (all endpoints including auth)
27
-
28
- ## Available Scripts
29
-
30
- - `npm run dev` - Start development server
31
- - `npm run build` - Build for production
32
- - `npm run preview` - Preview production build
33
-
34
- ## Learn More
35
-
36
- - [Butterbase Documentation](https://docs.butterbase.com)
37
- - [React Documentation](https://react.dev)
38
- - [Vite Documentation](https://vitejs.dev)
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Butterbase-powered React application.
4
+
5
+ ## Setup
6
+
7
+ 1. Install dependencies:
8
+ ```bash
9
+ npm install
10
+ ```
11
+
12
+ 2. Copy `.env.example` to `.env` and configure:
13
+ ```bash
14
+ cp .env.example .env
15
+ ```
16
+
17
+ 3. Start development server:
18
+ ```bash
19
+ npm run dev
20
+ ```
21
+
22
+ ## Butterbase Configuration
23
+
24
+ This project is connected to Butterbase app: `{{APP_ID}}`
25
+
26
+ - API URL: `{{API_URL}}` (all endpoints including auth)
27
+
28
+ ## Available Scripts
29
+
30
+ - `npm run dev` - Start development server
31
+ - `npm run build` - Build for production
32
+ - `npm run preview` - Preview production build
33
+
34
+ ## Learn More
35
+
36
+ - [Butterbase Documentation](https://docs.butterbase.com)
37
+ - [React Documentation](https://react.dev)
38
+ - [Vite Documentation](https://vitejs.dev)
@@ -1,13 +1,13 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>{{PROJECT_NAME}}</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{PROJECT_NAME}}</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -1,25 +1,25 @@
1
- {
2
- "name": "{{PROJECT_NAME}}",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "vite",
8
- "build": "tsc -b && vite build",
9
- "lint": "eslint .",
10
- "preview": "vite preview"
11
- },
12
- "dependencies": {
13
- "@butterbase/sdk": "^1.3.3",
14
- "react": "^19.2.4",
15
- "react-dom": "^19.2.4",
16
- "react-router-dom": "^7.13.2"
17
- },
18
- "devDependencies": {
19
- "@types/react": "^19.2.14",
20
- "@types/react-dom": "^19.2.3",
21
- "@vitejs/plugin-react": "^6.0.1",
22
- "typescript": "~5.9.3",
23
- "vite": "^8.0.1"
24
- }
25
- }
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc -b && vite build",
9
+ "lint": "eslint .",
10
+ "preview": "vite preview"
11
+ },
12
+ "dependencies": {
13
+ "@butterbase/sdk": "^1.3.3",
14
+ "react": "^19.2.4",
15
+ "react-dom": "^19.2.4",
16
+ "react-router-dom": "^7.13.2"
17
+ },
18
+ "devDependencies": {
19
+ "@types/react": "^19.2.14",
20
+ "@types/react-dom": "^19.2.3",
21
+ "@vitejs/plugin-react": "^6.0.1",
22
+ "typescript": "~5.9.3",
23
+ "vite": "^8.0.1"
24
+ }
25
+ }
@@ -1,33 +1,33 @@
1
- :root {
2
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
- line-height: 1.5;
4
- font-weight: 400;
5
- }
6
-
7
- body {
8
- margin: 0;
9
- display: flex;
10
- place-items: center;
11
- min-width: 320px;
12
- min-height: 100vh;
13
- }
14
-
15
- .App {
16
- max-width: 1280px;
17
- margin: 0 auto;
18
- padding: 2rem;
19
- text-align: center;
20
- }
21
-
22
- input {
23
- margin: 0.5rem;
24
- padding: 0.5rem;
25
- font-size: 1rem;
26
- }
27
-
28
- button {
29
- margin: 0.5rem;
30
- padding: 0.5rem 1rem;
31
- font-size: 1rem;
32
- cursor: pointer;
33
- }
1
+ :root {
2
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+ }
6
+
7
+ body {
8
+ margin: 0;
9
+ display: flex;
10
+ place-items: center;
11
+ min-width: 320px;
12
+ min-height: 100vh;
13
+ }
14
+
15
+ .App {
16
+ max-width: 1280px;
17
+ margin: 0 auto;
18
+ padding: 2rem;
19
+ text-align: center;
20
+ }
21
+
22
+ input {
23
+ margin: 0.5rem;
24
+ padding: 0.5rem;
25
+ font-size: 1rem;
26
+ }
27
+
28
+ button {
29
+ margin: 0.5rem;
30
+ padding: 0.5rem 1rem;
31
+ font-size: 1rem;
32
+ cursor: pointer;
33
+ }
@@ -1,77 +1,77 @@
1
- import { useState, useEffect } from 'react';
2
- import { butterbase } from './lib';
3
- import './App.css';
4
-
5
- function App() {
6
- const [user, setUser] = useState<any>(null);
7
- const [loading, setLoading] = useState(true);
8
-
9
- useEffect(() => {
10
- checkAuth();
11
- }, []);
12
-
13
- async function checkAuth() {
14
- const { data } = await butterbase.auth.getUser();
15
- setUser(data);
16
- setLoading(false);
17
- }
18
-
19
- async function handleSignUp(email: string, password: string) {
20
- const { data, error } = await butterbase.auth.signUp({ email, password });
21
- if (error) {
22
- alert(error.message);
23
- } else {
24
- setUser(data?.user);
25
- }
26
- }
27
-
28
- async function handleSignIn(email: string, password: string) {
29
- const { data, error } = await butterbase.auth.signIn({ email, password });
30
- if (error) {
31
- alert(error.message);
32
- } else {
33
- setUser(data?.user);
34
- }
35
- }
36
-
37
- async function handleSignOut() {
38
- await butterbase.auth.signOut();
39
- setUser(null);
40
- }
41
-
42
- if (loading) {
43
- return <div>Loading...</div>;
44
- }
45
-
46
- if (!user) {
47
- return (
48
- <div className="App">
49
- <h1>Welcome to {{PROJECT_NAME}}</h1>
50
- <p>Powered by Butterbase</p>
51
- <div>
52
- <h2>Sign In</h2>
53
- <form onSubmit={(e) => {
54
- e.preventDefault();
55
- const form = e.target as HTMLFormElement;
56
- const email = (form.elements.namedItem('email') as HTMLInputElement).value;
57
- const password = (form.elements.namedItem('password') as HTMLInputElement).value;
58
- handleSignIn(email, password);
59
- }}>
60
- <input name="email" type="email" placeholder="Email" required />
61
- <input name="password" type="password" placeholder="Password" required />
62
- <button type="submit">Sign In</button>
63
- </form>
64
- </div>
65
- </div>
66
- );
67
- }
68
-
69
- return (
70
- <div className="App">
71
- <h1>Welcome, {user.email}!</h1>
72
- <button onClick={handleSignOut}>Sign Out</button>
73
- </div>
74
- );
75
- }
76
-
77
- export default App;
1
+ import { useState, useEffect } from 'react';
2
+ import { butterbase } from './lib';
3
+ import './App.css';
4
+
5
+ function App() {
6
+ const [user, setUser] = useState<any>(null);
7
+ const [loading, setLoading] = useState(true);
8
+
9
+ useEffect(() => {
10
+ checkAuth();
11
+ }, []);
12
+
13
+ async function checkAuth() {
14
+ const { data } = await butterbase.auth.getUser();
15
+ setUser(data);
16
+ setLoading(false);
17
+ }
18
+
19
+ async function handleSignUp(email: string, password: string) {
20
+ const { data, error } = await butterbase.auth.signUp({ email, password });
21
+ if (error) {
22
+ alert(error.message);
23
+ } else {
24
+ setUser(data?.user);
25
+ }
26
+ }
27
+
28
+ async function handleSignIn(email: string, password: string) {
29
+ const { data, error } = await butterbase.auth.signIn({ email, password });
30
+ if (error) {
31
+ alert(error.message);
32
+ } else {
33
+ setUser(data?.user);
34
+ }
35
+ }
36
+
37
+ async function handleSignOut() {
38
+ await butterbase.auth.signOut();
39
+ setUser(null);
40
+ }
41
+
42
+ if (loading) {
43
+ return <div>Loading...</div>;
44
+ }
45
+
46
+ if (!user) {
47
+ return (
48
+ <div className="App">
49
+ <h1>Welcome to {{PROJECT_NAME}}</h1>
50
+ <p>Powered by Butterbase</p>
51
+ <div>
52
+ <h2>Sign In</h2>
53
+ <form onSubmit={(e) => {
54
+ e.preventDefault();
55
+ const form = e.target as HTMLFormElement;
56
+ const email = (form.elements.namedItem('email') as HTMLInputElement).value;
57
+ const password = (form.elements.namedItem('password') as HTMLInputElement).value;
58
+ handleSignIn(email, password);
59
+ }}>
60
+ <input name="email" type="email" placeholder="Email" required />
61
+ <input name="password" type="password" placeholder="Password" required />
62
+ <button type="submit">Sign In</button>
63
+ </form>
64
+ </div>
65
+ </div>
66
+ );
67
+ }
68
+
69
+ return (
70
+ <div className="App">
71
+ <h1>Welcome, {user.email}!</h1>
72
+ <button onClick={handleSignOut}>Sign Out</button>
73
+ </div>
74
+ );
75
+ }
76
+
77
+ export default App;
@@ -1,8 +1,8 @@
1
- body {
2
- margin: 0;
3
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
- sans-serif;
6
- -webkit-font-smoothing: antialiased;
7
- -moz-osx-font-smoothing: grayscale;
8
- }
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
@@ -1,6 +1,6 @@
1
- import { createClient } from '@butterbase/sdk';
2
-
3
- export const butterbase = createClient({
4
- appId: import.meta.env.VITE_APP_ID,
5
- apiUrl: import.meta.env.VITE_API_URL,
6
- });
1
+ import { createClient } from '@butterbase/sdk';
2
+
3
+ export const butterbase = createClient({
4
+ appId: import.meta.env.VITE_APP_ID,
5
+ apiUrl: import.meta.env.VITE_API_URL,
6
+ });
@@ -1,10 +1,10 @@
1
- import { StrictMode } from 'react';
2
- import { createRoot } from 'react-dom/client';
3
- import App from './App.tsx';
4
- import './index.css';
5
-
6
- createRoot(document.getElementById('root')!).render(
7
- <StrictMode>
8
- <App />
9
- </StrictMode>,
10
- );
1
+ import { StrictMode } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import App from './App.tsx';
4
+ import './index.css';
5
+
6
+ createRoot(document.getElementById('root')!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ );
@@ -1,21 +1,21 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "useDefineForClassFields": true,
5
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
- "module": "ESNext",
7
- "skipLibCheck": true,
8
- "moduleResolution": "bundler",
9
- "allowImportingTsExtensions": true,
10
- "isolatedModules": true,
11
- "moduleDetection": "force",
12
- "noEmit": true,
13
- "jsx": "react-jsx",
14
- "strict": true,
15
- "noUnusedLocals": true,
16
- "noUnusedParameters": true,
17
- "noFallthroughCasesInSwitch": true,
18
- "noUncheckedSideEffectImports": true
19
- },
20
- "include": ["src"]
21
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "isolatedModules": true,
11
+ "moduleDetection": "force",
12
+ "noEmit": true,
13
+ "jsx": "react-jsx",
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "noFallthroughCasesInSwitch": true,
18
+ "noUncheckedSideEffectImports": true
19
+ },
20
+ "include": ["src"]
21
+ }
@@ -1,6 +1,6 @@
1
- import { defineConfig } from 'vite';
2
- import react from '@vitejs/plugin-react';
3
-
4
- export default defineConfig({
5
- plugins: [react()],
6
- });
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ });