Skip to content

Commit 003420d

Browse files
v1924: Let New App continue without a Builds token (samebase/samebase#1476)
Samebase-Source-Repository: samebase/samebase Samebase-Source-Commit: ca1a09beb0b21f2c92bdd2f9a46308a8c4da1c4e Samebase-Source-Path: packages/plugin
1 parent 9d9a1b6 commit 003420d

5 files changed

Lines changed: 47 additions & 12 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "samebase-plugin",
3-
"version": "0.2.21",
3+
"version": "0.2.22",
44
"private": true,
55
"license": "Apache-2.0",
66
"type": "module",

plugins/samebase/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "samebase",
33
"displayName": "Samebase",
44
"description": "Build and ship web apps with Samebase through a GitHub repository, Convex backend, and Cloudflare Workers delivery.",
5-
"version": "0.2.21",
5+
"version": "0.2.22",
66
"author": {
77
"name": "Samebase"
88
},

plugins/samebase/.codex-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "samebase",
3-
"version": "0.2.21",
3+
"version": "0.2.22",
44
"description": "Build and ship web apps with Samebase through a GitHub repository, Convex backend, and Cloudflare Workers delivery.",
55
"author": {
66
"name": "Samebase",

plugins/samebase/skills/samebase/SKILL.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,43 @@ actions. Each action reports missing authentication itself.
4040
- For a new app, use only this closed flow:
4141
1. Read the app inventory.
4242
2. Call `cloudflare_listWorkersBuildTokens` for the selected organization.
43-
3. If the result includes an available `lastUsedBuildTokenUuid`, use that UUID without asking. If
44-
not, use the only listed token, ask the user to choose by name and UUID when several tokens are
45-
listed, or stop and tell the user to complete Workers Builds token setup when none are listed.
46-
4. Create the app with the selected token UUID.
43+
3. If that current token list is confirmed empty, use explicit null. Otherwise, use an available
44+
`lastUsedBuildTokenUuid` without asking, use the only listed token, or ask the user to choose
45+
by name and UUID when several tokens are listed.
46+
4. Create the app with the required `cloudflareBuildTokenUuid` set to the selected exact UUID or
47+
explicit null.
4748
5. Read only the inventory until source setup is `ready` or `failed`.
4849
6. If source setup is ready, separately read only the inventory until provider setup is `ready` or
4950
`failed`. Authentication-status, browser-handoff, and Cloudflare account-list reads are not
5051
part of this flow. The complete sequence contains only inventory, the Workers Builds token
5152
list, create, and inventory polls. Call create directly after the token list. Do not list
5253
Cloudflare accounts first. Create has no `accountId` and uses the connected Cloudflare
5354
provider.
55+
7. When the token was null, the managed run creates the GitHub repository and Convex project but
56+
no Cloudflare Worker. A ready provider setup means only that this requested managed work
57+
finished. Confirm that the exact planned Convex project is attached and `cloudflareWorkers` is
58+
empty. Report that Cloudflare setup is pending and give the user
59+
[samebase.com/docs/cloudflare-setup](https://samebase.com/docs/cloudflare-setup). Do not call
60+
the app fully ready, attach a temporary Worker, or retry the completed managed run.
61+
8. The user completes Cloudflare's standard repository setup to create the first account token,
62+
then deletes the temporary Worker. After the user completes those steps and asks to finish the
63+
app, list the current tokens again and call `vault_cloudflare_createWorker` with one exact
64+
UUID. Reread inventory, then call `vault_cloudflare_rotateConvexDeployKeysForWorkersBuilds`
65+
with the new Worker and the attached Convex project.
66+
- For manual Cloudflare Worker creation or Workers Builds configuration, first call
67+
`cloudflare_listWorkersBuildTokens`. Pass only an exact UUID from the current non-empty list. If
68+
the list is empty, stop the write and use current inventory to select the next action:
69+
- For the tokenless managed app with its exact planned Convex project and no attached Worker, use
70+
[samebase.com/docs/cloudflare-setup](https://samebase.com/docs/cloudflare-setup). After setup,
71+
list tokens again, call `vault_cloudflare_createWorker` with one current exact UUID, reread
72+
inventory, then call `vault_cloudflare_rotateConvexDeployKeysForWorkersBuilds`.
73+
- When a Worker is already attached, keep it. After token setup, list tokens again and call
74+
`vault_cloudflare_configureWorkersBuildsForGitHub` for that attachment. Do not create another
75+
Worker.
76+
- For another manual vault, complete token setup, list tokens again, and continue only with the
77+
action that matches the request and current inventory. Worker creation does not install Convex
78+
deploy keys.
79+
- Never pass null to a manual Worker or Builds action.
5480

5581
After you select the route, use live tool descriptions only for the exact tool name and arguments.
5682
Match an inventory `nextAction` to its action contract at

scripts/check.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ const managedInventoryIndex = samebaseSkill.indexOf("Read the app inventory.");
158158
const managedTokenListIndex = samebaseSkill.indexOf(
159159
"Call `cloudflare_listWorkersBuildTokens` for the selected organization.",
160160
);
161-
const managedCreateIndex = samebaseSkill.indexOf("Create the app with the selected token UUID.");
161+
const managedCreateIndex = samebaseSkill.indexOf(
162+
"Create the app with the required `cloudflareBuildTokenUuid`",
163+
);
162164
const managedSourcePollIndex = samebaseSkill.indexOf(
163165
"Read only the inventory until source setup is `ready` or `failed`.",
164166
);
@@ -172,11 +174,18 @@ check(
172174
),
173175
"The Samebase skill must keep managed app creation on its closed tool sequence.",
174176
);
177+
const tokenlessNullIndex = samebaseSkill.indexOf("confirmed empty, use explicit null");
178+
const tokenlessGuideIndex = samebaseSkill.indexOf("samebase.com/docs/cloudflare-setup");
179+
const tokenlessCreateWorkerIndex = samebaseSkill.indexOf("`vault_cloudflare_createWorker`");
180+
const tokenlessDeployKeysIndex = samebaseSkill.indexOf(
181+
"`vault_cloudflare_rotateConvexDeployKeysForWorkersBuilds`",
182+
);
175183
check(
176-
samebaseSkill.includes(
177-
"If the result includes an available `lastUsedBuildTokenUuid`, use that UUID without asking. If not, use the only listed token, ask the user to choose by name and UUID when several tokens are listed, or stop and tell the user to complete Workers Builds token setup when none are listed.",
178-
),
179-
"The Samebase skill must use the last-used Workers Builds token before its explicit fallbacks.",
184+
tokenlessNullIndex > managedTokenListIndex &&
185+
tokenlessGuideIndex > tokenlessNullIndex &&
186+
tokenlessCreateWorkerIndex > tokenlessGuideIndex &&
187+
tokenlessDeployKeysIndex > tokenlessCreateWorkerIndex,
188+
"The Samebase skill must send null for a confirmed empty token list, report the guide, then use the existing Worker and deploy-key actions.",
180189
);
181190
const openSamebaseIndex = samebaseSkill.indexOf(
182191
"Treat `open @samebase` as an exact command and an explicit choice of the in-app Browser.",

0 commit comments

Comments
 (0)