lakebed 0.0.1 → 0.0.2
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 +1 -1
- package/package.json +1 -1
- package/src/anonymous.js +1 -1
- package/src/cli.js +61 -5
package/README.md
CHANGED
package/package.json
CHANGED
package/src/anonymous.js
CHANGED
|
@@ -484,7 +484,7 @@ function compileServerToIr(app, schema) {
|
|
|
484
484
|
return { diagnostics, mutations, queries };
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
-
export async function createAnonymousArtifact({ app, clientOut, sourceStore, version = "0.0.
|
|
487
|
+
export async function createAnonymousArtifact({ app, clientOut, sourceStore, version = "0.0.2" }) {
|
|
488
488
|
const sourceFiles = await readSourceFiles(sourceStore);
|
|
489
489
|
const diagnostics = forbiddenSourceDiagnostics(sourceFiles);
|
|
490
490
|
const { diagnostics: schemaDiagnostics, schema } = serializeSchema(app.schema);
|
package/src/cli.js
CHANGED
|
@@ -21,6 +21,7 @@ const root = process.cwd();
|
|
|
21
21
|
const packageDir = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
22
22
|
const packageNodeModules = resolve(packageDir, "node_modules");
|
|
23
23
|
const sourceNamespace = "lakebed-source";
|
|
24
|
+
const defaultDeployApiUrl = "https://api.lakebed.app";
|
|
24
25
|
|
|
25
26
|
function usage() {
|
|
26
27
|
console.log(`lakebed
|
|
@@ -649,10 +650,7 @@ async function buildCommand(args) {
|
|
|
649
650
|
}
|
|
650
651
|
|
|
651
652
|
function deployApiUrl(args) {
|
|
652
|
-
return String(readArg(args, "--api", process.env.LAKEBED_DEPLOY_API ?? process.env.SPAN_DEPLOY_API ??
|
|
653
|
-
/\/+$/g,
|
|
654
|
-
""
|
|
655
|
-
);
|
|
653
|
+
return String(readArg(args, "--api", process.env.LAKEBED_DEPLOY_API ?? process.env.SPAN_DEPLOY_API ?? defaultDeployApiUrl)).replace(/\/+$/g, "");
|
|
656
654
|
}
|
|
657
655
|
|
|
658
656
|
async function readResponseJson(response) {
|
|
@@ -672,7 +670,7 @@ async function deployCommand(args) {
|
|
|
672
670
|
body: JSON.stringify({
|
|
673
671
|
artifact: envelope.artifact,
|
|
674
672
|
clientBundle: envelope.clientBundle,
|
|
675
|
-
clientVersion: "0.0.
|
|
673
|
+
clientVersion: "0.0.2",
|
|
676
674
|
requestedTtlSeconds: ttl
|
|
677
675
|
}),
|
|
678
676
|
headers: {
|
|
@@ -813,9 +811,67 @@ async function dbCommand(args) {
|
|
|
813
811
|
usage();
|
|
814
812
|
}
|
|
815
813
|
|
|
814
|
+
function agentInstructionsTemplate() {
|
|
815
|
+
return `# Lakebed App Instructions
|
|
816
|
+
|
|
817
|
+
This is a Lakebed capsule. Build the app inside this directory using the Lakebed v0 contract.
|
|
818
|
+
|
|
819
|
+
## File Layout
|
|
820
|
+
|
|
821
|
+
- \`server/index.ts\`: schema, queries, and mutations.
|
|
822
|
+
- \`client/index.tsx\`: Preact UI entrypoint.
|
|
823
|
+
- \`shared/\`: pure TypeScript shared by client and server.
|
|
824
|
+
|
|
825
|
+
## Commands
|
|
826
|
+
|
|
827
|
+
Run locally:
|
|
828
|
+
|
|
829
|
+
\`\`\`sh
|
|
830
|
+
lakebed dev .
|
|
831
|
+
\`\`\`
|
|
832
|
+
|
|
833
|
+
Deploy:
|
|
834
|
+
|
|
835
|
+
\`\`\`sh
|
|
836
|
+
lakebed deploy .
|
|
837
|
+
\`\`\`
|
|
838
|
+
|
|
839
|
+
Inspect local state while \`lakebed dev\` is running:
|
|
840
|
+
|
|
841
|
+
\`\`\`sh
|
|
842
|
+
lakebed db list --port 3000
|
|
843
|
+
lakebed db dump --port 3000
|
|
844
|
+
lakebed logs --port 3000
|
|
845
|
+
\`\`\`
|
|
846
|
+
|
|
847
|
+
## Rules
|
|
848
|
+
|
|
849
|
+
- Use \`lakebed/server\` only from \`server/index.ts\`.
|
|
850
|
+
- Use \`lakebed/client\` only from \`client/index.tsx\`.
|
|
851
|
+
- Do not import npm packages from app code.
|
|
852
|
+
- Do not use Node built-ins in app code.
|
|
853
|
+
- Use Tailwind classes directly in JSX.
|
|
854
|
+
- Do not add a CSS, PostCSS, or Tailwind build pipeline.
|
|
855
|
+
- Use guest auth through \`ctx.auth\` on the server and \`useAuth()\` on the client.
|
|
856
|
+
- Keep \`shared/\` free of DOM, Node, env, and Lakebed runtime imports.
|
|
857
|
+
|
|
858
|
+
## Current Limits
|
|
859
|
+
|
|
860
|
+
- One server entry.
|
|
861
|
+
- One client entry.
|
|
862
|
+
- Guest auth only.
|
|
863
|
+
- No file storage.
|
|
864
|
+
- No outbound fetch in anonymous deploys.
|
|
865
|
+
- Local state resets when \`lakebed dev\` restarts.
|
|
866
|
+
`;
|
|
867
|
+
}
|
|
868
|
+
|
|
816
869
|
function todoTemplate(name) {
|
|
817
870
|
const title = basename(name);
|
|
871
|
+
const agentInstructions = agentInstructionsTemplate();
|
|
818
872
|
return {
|
|
873
|
+
"AGENTS.md": agentInstructions,
|
|
874
|
+
"CLAUDE.md": agentInstructions,
|
|
819
875
|
"server/index.ts": `import { boolean, capsule, mutation, query, string, table } from "lakebed/server";
|
|
820
876
|
import { cleanTodoText } from "../shared/todo";
|
|
821
877
|
|