@autoship/react 0.5.1 → 0.6.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.
package/README.md CHANGED
@@ -35,13 +35,14 @@ The CLI will prompt you for credentials. You can provide them in two ways:
35
35
 
36
36
  ```bash
37
37
  # Find this in Supabase Dashboard > Project Settings > Database > Connection string > URI
38
- npx @autoship/react init --database-url "postgresql://postgres.xxx:password@aws-0-region.pooler.supabase.com:6543/postgres"
38
+ npx @autoship/react init --database-url "postgresql://postgres:password@db.xxxx.supabase.co:5432/postgres"
39
39
  ```
40
40
 
41
- **Option B: Supabase URL + Database Password**
41
+ **Option B: Project Ref + Database Password**
42
42
 
43
43
  ```bash
44
- npx @autoship/react init --supabase-url https://xxx.supabase.co --db-password yourpassword
44
+ # Find project ref in Supabase Dashboard > Project Settings > General > Reference ID
45
+ npx @autoship/react init --project-ref abcdefghijklmnop --db-password yourpassword
45
46
  ```
46
47
 
47
48
  **Using environment variables:**
@@ -51,7 +52,7 @@ npx @autoship/react init --supabase-url https://xxx.supabase.co --db-password yo
51
52
  DATABASE_URL="postgresql://..." npx @autoship/react init
52
53
 
53
54
  # Option B
54
- SUPABASE_URL="https://xxx.supabase.co" DB_PASSWORD="yourpassword" npx @autoship/react init
55
+ SUPABASE_PROJECT_REF="abcdefghijklmnop" DB_PASSWORD="yourpassword" npx @autoship/react init
55
56
  ```
56
57
 
57
58
  ### 3. Expose the Autoship Schema in Supabase
@@ -137,6 +138,33 @@ export SUPABASE_SERVICE_KEY="your-service-key"
137
138
  claude "Use the autoship-mcp tools to list pending tasks"
138
139
  ```
139
140
 
141
+ ## AI Prompt
142
+
143
+ Use this prompt with an AI coding assistant (like Claude Code) to automatically set up Autoship in your project:
144
+
145
+ ```
146
+ I want to add Autoship to this project - an autonomous coding agent that lets users submit tasks via React components and implements them via GitHub Actions.
147
+
148
+ Please do the following:
149
+
150
+ 1. Install the package:
151
+ npm install @autoship/react
152
+
153
+ 2. Copy the required files from the Autoship repo (https://github.com/morlinbrot/autoship):
154
+ - Copy `mcp-servers/autoship-mcp/` directory to `mcp-servers/autoship-mcp/` in this project
155
+ - Copy `.github/workflows/claude-agent.yml` to `.github/workflows/claude-agent.yml`
156
+
157
+ 3. Find the main App component (or root layout) and integrate the Autoship components:
158
+ - Import AutoshipProvider and AutoshipButton from '@autoship/react'
159
+ - Wrap the app content with AutoshipProvider
160
+ - Add the AutoshipButton component inside the provider (it renders a floating button)
161
+
162
+ I will take care of:
163
+ - Running `npx @autoship/react init` to set up the database
164
+ - Adding the autoship schema to Supabase's exposed schemas
165
+ - Adding the required GitHub secrets (ANTHROPIC_API_KEY, SUPABASE_URL, SUPABASE_SERVICE_KEY)
166
+ ```
167
+
140
168
  ## Manual Trigger
141
169
 
142
170
  You can manually trigger the agent from the GitHub Actions tab, optionally with a custom prompt:
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAkXA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAcvD"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AA4WA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAcvD"}
package/dist/cli/init.js CHANGED
@@ -35,8 +35,8 @@ function parseArgs(args) {
35
35
  if (arg === "--database-url" && args[i + 1]) {
36
36
  options.databaseUrl = args[++i];
37
37
  }
38
- else if (arg === "--supabase-url" && args[i + 1]) {
39
- options.supabaseUrl = args[++i];
38
+ else if (arg === "--project-ref" && args[i + 1]) {
39
+ options.projectRef = args[++i];
40
40
  }
41
41
  else if (arg === "--db-password" && args[i + 1]) {
42
42
  options.dbPassword = args[++i];
@@ -59,36 +59,38 @@ Usage:
59
59
  npx @autoship/react init [options]
60
60
 
61
61
  Options:
62
- --database-url <url> Full PostgreSQL connection URL (includes password)
63
- --supabase-url <url> Supabase project URL (used to construct DATABASE_URL)
64
- --db-password <pwd> Database password (used with --supabase-url)
65
- -y, --non-interactive Skip confirmation prompts
66
- -h, --help Show this help message
62
+ --database-url <url> Full PostgreSQL connection URL (includes password)
63
+ --project-ref <ref> Supabase project ref (used to construct DATABASE_URL)
64
+ --db-password <pwd> Database password (used with --project-ref)
65
+ -y, --non-interactive Skip confirmation prompts
66
+ -h, --help Show this help message
67
67
 
68
68
  Environment Variables:
69
- DATABASE_URL Full PostgreSQL connection URL (preferred)
70
- SUPABASE_URL Supabase project URL (fallback, requires DB_PASSWORD)
71
- DB_PASSWORD Database password (used with SUPABASE_URL)
69
+ DATABASE_URL Full PostgreSQL connection URL (preferred)
70
+ SUPABASE_PROJECT_REF Supabase project ref (fallback, requires DB_PASSWORD)
71
+ DB_PASSWORD Database password (used with SUPABASE_PROJECT_REF)
72
72
 
73
73
  Connection Methods:
74
- 1. Provide DATABASE_URL directly (recommended):
75
- DATABASE_URL=postgresql://postgres.xxx:[password]@aws-0-region.pooler.supabase.com:6543/postgres
74
+ 1. Provide DATABASE_URL directly:
75
+ Find in Supabase Dashboard > Project Settings > Database > Connection string > URI
76
76
 
77
- 2. Provide SUPABASE_URL + DB_PASSWORD:
78
- The CLI will construct the DATABASE_URL from your Supabase project URL.
77
+ 2. Provide SUPABASE_PROJECT_REF + DB_PASSWORD:
78
+ Find project ref in Supabase Dashboard > Project Settings > General > Reference ID
79
+ Find password in Supabase Dashboard > Project Settings > Database > Database password
79
80
 
80
81
  Examples:
81
82
  # Interactive mode (prompts for credentials)
82
83
  npx @autoship/react init
83
84
 
84
85
  # With full database URL
85
- npx @autoship/react init --database-url "postgresql://postgres.xxx:password@aws-0-region.pooler.supabase.com:6543/postgres"
86
+ npx @autoship/react init --database-url "postgresql://postgres:password@db.xxxx.supabase.co:5432/postgres"
86
87
 
87
- # With Supabase URL + password
88
- npx @autoship/react init --supabase-url https://xxx.supabase.co --db-password mypassword
88
+ # With project ref + password
89
+ npx @autoship/react init --project-ref abcdefghijklmnop --db-password mypassword
89
90
 
90
91
  # Using environment variables
91
92
  DATABASE_URL="postgresql://..." npx @autoship/react init
93
+ SUPABASE_PROJECT_REF="abcdefghijklmnop" DB_PASSWORD="mypassword" npx @autoship/react init
92
94
  `);
93
95
  }
94
96
  function createReadlineInterface() {
@@ -143,28 +145,20 @@ async function promptSecret(rl, question) {
143
145
  });
144
146
  }
145
147
  /**
146
- * Constructs a DATABASE_URL from a Supabase project URL and password.
148
+ * Constructs a DATABASE_URL from a Supabase project ref and password.
147
149
  *
148
- * Supabase URL format: https://[project-ref].supabase.co
149
- * Database URL format: postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres
150
+ * Project ref: The unique identifier for your Supabase project (e.g., "abcdefghijklmnop")
151
+ * Database URL format: postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres
150
152
  *
151
- * Note: We use the transaction pooler (port 6543) for compatibility.
152
- * The region is detected from the Supabase URL or defaults to us-east-1.
153
+ * Note: We use the direct connection (port 5432) instead of the pooler
154
+ * because the pooler requires region-specific endpoints.
153
155
  */
154
- function constructDatabaseUrl(supabaseUrl, password) {
155
- const url = new URL(supabaseUrl);
156
- const hostname = url.hostname; // e.g., "xxx.supabase.co"
157
- const projectRef = hostname.split(".")[0];
156
+ function constructDatabaseUrl(projectRef, password) {
158
157
  if (!projectRef) {
159
- throw new Error("Could not extract project reference from Supabase URL");
158
+ throw new Error("Project ref is required");
160
159
  }
161
- // Supabase uses different regional pooler endpoints
162
- // Default to us-east-1, but this can be adjusted
163
- // The actual region is embedded in the project, but we can't easily detect it
164
- // Users can provide DATABASE_URL directly if they need a specific region
165
- const region = "us-east-1";
166
160
  const encodedPassword = encodeURIComponent(password);
167
- return `postgresql://postgres.${projectRef}:${encodedPassword}@aws-0-${region}.pooler.supabase.com:6543/postgres`;
161
+ return `postgresql://postgres:${encodedPassword}@db.${projectRef}.supabase.co:5432/postgres`;
168
162
  }
169
163
  async function getConnectionUrl(options) {
170
164
  // Priority: CLI args > env vars > interactive prompt
@@ -173,11 +167,11 @@ async function getConnectionUrl(options) {
173
167
  if (databaseUrl) {
174
168
  return databaseUrl;
175
169
  }
176
- // Check for SUPABASE_URL + DB_PASSWORD combination
177
- let supabaseUrl = options.supabaseUrl || process.env.SUPABASE_URL;
170
+ // Check for PROJECT_REF + DB_PASSWORD combination
171
+ let projectRef = options.projectRef || process.env.SUPABASE_PROJECT_REF;
178
172
  let dbPassword = options.dbPassword || process.env.DB_PASSWORD;
179
- if (supabaseUrl && dbPassword) {
180
- return constructDatabaseUrl(supabaseUrl, dbPassword);
173
+ if (projectRef && dbPassword) {
174
+ return constructDatabaseUrl(projectRef, dbPassword);
181
175
  }
182
176
  // Interactive mode
183
177
  const rl = createReadlineInterface();
@@ -186,8 +180,8 @@ async function getConnectionUrl(options) {
186
180
  console.log(" This will create the required tables in your Supabase database.\n");
187
181
  console.log(" You can provide credentials in two ways:");
188
182
  console.log(" 1. Full DATABASE_URL (includes password)");
189
- console.log(" 2. Supabase URL + database password\n");
190
- const choice = await prompt(rl, " Enter (1) for DATABASE_URL or (2) for Supabase URL + password: ");
183
+ console.log(" 2. Supabase project ref + database password\n");
184
+ const choice = await prompt(rl, " Enter (1) for DATABASE_URL or (2) for project ref + password: ");
191
185
  if (choice === "1") {
192
186
  console.log("\n Find your DATABASE_URL in Supabase Dashboard:");
193
187
  console.log(" Project Settings > Database > Connection string > URI\n");
@@ -195,18 +189,20 @@ async function getConnectionUrl(options) {
195
189
  return databaseUrl;
196
190
  }
197
191
  else {
198
- if (!supabaseUrl) {
199
- supabaseUrl = await prompt(rl, "\n Supabase URL (e.g., https://xxx.supabase.co): ");
192
+ if (!projectRef) {
193
+ console.log("\n Find your project ref in Supabase Dashboard:");
194
+ console.log(" Project Settings > General > Reference ID\n");
195
+ projectRef = await prompt(rl, " Project ref: ");
200
196
  }
201
197
  else {
202
- console.log(`\n Supabase URL: ${supabaseUrl}`);
198
+ console.log(`\n Project ref: ${projectRef}`);
203
199
  }
204
200
  if (!dbPassword) {
205
201
  console.log("\n Find your database password in Supabase Dashboard:");
206
202
  console.log(" Project Settings > Database > Database password\n");
207
203
  dbPassword = await promptSecret(rl, " Database password: ");
208
204
  }
209
- return constructDatabaseUrl(supabaseUrl, dbPassword);
205
+ return constructDatabaseUrl(projectRef, dbPassword);
210
206
  }
211
207
  }
212
208
  finally {
package/package.json CHANGED
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "name": "@autoship/react",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
+ "description": "A drop-in autonomous coding agent that records tasks in your app and implements them in a GitHub Action",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/morlinbrot/autoship.git",
8
+ "directory": "packages/react"
9
+ },
10
+ "homepage": "https://github.com/morlinbrot/autoship#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/morlinbrot/autoship/issues"
13
+ },
4
14
  "type": "module",
5
15
  "main": "dist/index.js",
6
16
  "types": "dist/index.d.ts",