@usecontextlayer/cli 0.16.1 → 0.17.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.
- package/README.md +4 -4
- package/dist/auth-BL9AxZGb.mjs +1214 -0
- package/dist/auth-BL9AxZGb.mjs.map +1 -0
- package/dist/auth.d.mts +17 -2
- package/dist/auth.d.mts.map +1 -1
- package/dist/auth.mjs +1 -2
- package/dist/cli.mjs +153 -195
- package/dist/cli.mjs.map +1 -1
- package/dist/database-codegen-C5TEhR5_.mjs +24 -0
- package/dist/database-codegen-C5TEhR5_.mjs.map +1 -0
- package/dist/database-dialect-BLWWgYGo.mjs +56 -0
- package/dist/database-dialect-BLWWgYGo.mjs.map +1 -0
- package/dist/database.d.mts +35 -0
- package/dist/database.d.mts.map +1 -0
- package/dist/database.mjs +32 -0
- package/dist/database.mjs.map +1 -0
- package/dist/databases-SvX3IgqC.mjs +23 -0
- package/dist/databases-SvX3IgqC.mjs.map +1 -0
- package/dist/env-C_tllJ4u.mjs +98 -0
- package/dist/env-C_tllJ4u.mjs.map +1 -0
- package/dist/local-databases-ChvVgJH6.mjs +1 -0
- package/dist/local-databases-DVI3ngFq.mjs +53 -0
- package/dist/local-databases-DVI3ngFq.mjs.map +1 -0
- package/dist/{resources-B-EYHG1j.mjs → resources-BhJbHzU0.mjs} +24 -175
- package/dist/resources-BhJbHzU0.mjs.map +1 -0
- package/dist/{auth-DOsE8GwJ.mjs → schemas-D9UReYiT.mjs} +37 -1212
- package/dist/schemas-D9UReYiT.mjs.map +1 -0
- package/dist/schemas-DeaNWrS-.d.mts +2213 -0
- package/dist/schemas-DeaNWrS-.d.mts.map +1 -0
- package/dist/template.tar.gz +0 -0
- package/dist/vite.d.mts +5 -4330
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +16 -67
- package/dist/vite.mjs.map +1 -1
- package/package.json +12 -7
- package/dist/auth-DOsE8GwJ.mjs.map +0 -1
- package/dist/resources-B-EYHG1j.mjs.map +0 -1
- package/dist/rolldown-runtime-EAsCxrDo.mjs +0 -14
- package/dist/template/AGENTS.md +0 -13
- package/dist/template/README.md +0 -46
- package/dist/template/app/root.tsx +0 -66
- package/dist/template/app/routes/home.tsx +0 -25
- package/dist/template/databases/updates/drizzle.config.ts +0 -8
- package/dist/template/databases/updates/migrations/0000_create_updates.sql +0 -6
- package/dist/template/databases/updates/migrations/meta/0000_snapshot.json +0 -14
- package/dist/template/databases/updates/migrations/meta/_journal.json +0 -13
- package/dist/template/databases/updates/migrations/migrations.js +0 -10
- package/dist/template/databases/updates/schema.ts +0 -8
- package/dist/template/public/slate.json +0 -4
- package/dist/template/vite.config.ts +0 -9
- package/dist/template/workers/app.ts +0 -8
- package/dist/template/workers/local-resources/index.ts +0 -6
- package/dist/template/workers/local-resources/wrangler.jsonc +0 -19
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
4
|
-
var __exportAll = (all, no_symbols) => {
|
|
5
|
-
let target = {};
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { __exportAll as n, __commonJSMin as t };
|
package/dist/template/AGENTS.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# ContextLayer slate
|
|
2
|
-
|
|
3
|
-
Follow ContextLayer's [domain model and resource invariants](https://github.com/usecontextlayer/contextlayer/blob/main/ARCHITECTURE.md#domain-model). Put the app's declaration in `public/slate.json`, agent declarations in `agents/<name>/slate.json`, and MCP declarations in `mcp/<name>/slate.json`. Declare each resource in every consumer that needs it. All declarations share one namespace: matching database slugs select the same database, and repeated declarations must agree on owner/viewer mode. Connections and secrets follow the same namespace rule. MCP declaration resource collections must currently be empty because MCP resource execution is not implemented.
|
|
4
|
-
|
|
5
|
-
## Databases and migrations
|
|
6
|
-
|
|
7
|
-
Keep persistent slate data in declared SQLite databases and treat agent filesystem files as scratch data. Keep each database's Drizzle configuration, query schema, and migration history under `databases/<slug>`. The `updates` directory is an example; declare it where needed or create the corresponding directory for another database.
|
|
8
|
-
|
|
9
|
-
Write SQL migrations explicitly, following the [README workflow](README.md#store-slate-data). Separate statements with Drizzle's `--> statement-breakpoint` marker. Commit the SQL and generated metadata together. Never generate migrations from schema changes, run `drizzle-kit push`, or change deployed schemas ad hoc. Update `schema.ts` for typed queries alongside the SQL; the schema does not create tables.
|
|
10
|
-
|
|
11
|
-
Preserve platform's [database ownership and provisioning boundary](https://github.com/usecontextlayer/contextlayer/blob/main/ARCHITECTURE.md#slate-databases-and-authored-migrations). Authored code names declared slugs; leave physical instances and credentials to ContextLayer.
|
|
12
|
-
|
|
13
|
-
Use `databasesContext` from `@usecontextlayer/sdk` in loaders and actions, and `database_query` in agents. Import the query schema through the checkout's `@/databases` alias. The [SDK guide](https://www.npmjs.com/package/@usecontextlayer/sdk) documents the Drizzle and direct SQL APIs.
|
package/dist/template/README.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Your ContextLayer slate
|
|
2
|
-
|
|
3
|
-
This slate contains an interactive React Router app, uses ContextLayer for connected services, and is deployed through its Git remote.
|
|
4
|
-
|
|
5
|
-
See ContextLayer's [domain model](https://github.com/usecontextlayer/contextlayer/blob/main/ARCHITECTURE.md#domain-model) for declarations, resources, Owners, and assignments.
|
|
6
|
-
|
|
7
|
-
## Develop locally
|
|
8
|
-
|
|
9
|
-
From the checkout root, run:
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
pnpm dev
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Open the local URL printed by the development server. Edit `app/routes/home.tsx` to build your first page. Use `pnpm typecheck` and `pnpm build` for the checkout's normal TypeScript and production-build commands.
|
|
16
|
-
|
|
17
|
-
## Use connected services
|
|
18
|
-
|
|
19
|
-
Declare the connections your app needs in `public/slate.json`. Connect an account to ContextLayer in your browser, then assign the connected account to one of your app's declared connections. An already connected account can go directly to assignment. Command help supplies the supported operations:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npx @usecontextlayer/cli connections --help
|
|
23
|
-
npx @usecontextlayer/cli connection --help
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
The installed SDK guide at `node_modules/@usecontextlayer/sdk/README.md` gives the complete Gmail sequence: copy its route and declaration, connect a Gmail account when needed, assign it to `work-email`, and start development. Local assignments are saved in ignored `.contextlayer/connections.json`. Restart `pnpm dev` after changing declarations or local assignments.
|
|
27
|
-
|
|
28
|
-
## Store slate data
|
|
29
|
-
|
|
30
|
-
Declare database slugs in `public/slate.json` or `agents/<name>/slate.json`, following the [resource invariants](https://github.com/usecontextlayer/contextlayer/blob/main/ARCHITECTURE.md#resource-configuration-and-execution--principles). Local development persists SQLite state in ignored `.contextlayer/databases`.
|
|
31
|
-
|
|
32
|
-
Keep each database’s Drizzle configuration, query schema and migrations under `databases/<slug>`. Run `pnpm db:migration --config databases/<slug>/drizzle.config.ts --name <change>`, then write the blank SQL migration explicitly and update the query schema. Commit the SQL and native journal together. The query schema supplies types and does not generate the deployed database schema. The installed SDK guide documents `databasesContext` and the native Drizzle query client.
|
|
33
|
-
|
|
34
|
-
Restart local development after adding a migration. Push committed migrations to `main` for hosted provisioning; see [database ownership and provisioning](https://github.com/usecontextlayer/contextlayer/blob/main/ARCHITECTURE.md#slate-databases-and-authored-migrations) for its lifecycle. Use `database_query` for persistent agent data.
|
|
35
|
-
|
|
36
|
-
## Deploy
|
|
37
|
-
|
|
38
|
-
Commit your changes and push the generated `main` branch:
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
git add .
|
|
42
|
-
git commit
|
|
43
|
-
git push -u origin main
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
ContextLayer builds and deploys the slate through its native Git remote. Your dashboard and hosted URL were printed by initialization. The hosted URL becomes usable after deployment succeeds. The slate starts private; sign in with your ContextLayer account to open it. Configure hosted assignments in the header of the [chrome](https://github.com/usecontextlayer/contextlayer/blob/main/ARCHITECTURE.md#slate-chrome).
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { connectionRequiredSchema } from "@usecontextlayer/sdk"
|
|
2
|
-
import { isRouteErrorResponse, Outlet } from "react-router"
|
|
3
|
-
import type { Route } from "./+types/root"
|
|
4
|
-
import "~/app.css"
|
|
5
|
-
|
|
6
|
-
export { Layout } from "@usecontextlayer/sdk/react"
|
|
7
|
-
|
|
8
|
-
export default function App() {
|
|
9
|
-
return <Outlet />
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
13
|
-
if (isRouteErrorResponse(error) && error.status === 409) {
|
|
14
|
-
const unassignedConnection = connectionRequiredSchema.safeParse(error.data)
|
|
15
|
-
if (unassignedConnection.success) {
|
|
16
|
-
return (
|
|
17
|
-
<main className="container mx-auto p-4 pt-16">
|
|
18
|
-
<h1 className="text-2xl font-semibold">Assign an account to continue</h1>
|
|
19
|
-
{import.meta.env.DEV ? (
|
|
20
|
-
<>
|
|
21
|
-
<p className="mt-3">
|
|
22
|
-
From the checkout root, assign a connected account, then restart{" "}
|
|
23
|
-
<code>pnpm dev</code>:
|
|
24
|
-
</p>
|
|
25
|
-
<pre className="mt-4 overflow-x-auto">
|
|
26
|
-
<code>{`npx @usecontextlayer/cli connection local assign ${unassignedConnection.data.slug}`}</code>
|
|
27
|
-
</pre>
|
|
28
|
-
</>
|
|
29
|
-
) : (
|
|
30
|
-
<p className="mt-3">
|
|
31
|
-
Open the connections menu in the ContextLayer header above and assign a
|
|
32
|
-
connected account, then refresh this page.
|
|
33
|
-
</p>
|
|
34
|
-
)}
|
|
35
|
-
</main>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let message = "Oops!"
|
|
41
|
-
let details = "An unexpected error occurred."
|
|
42
|
-
let stack: string | undefined
|
|
43
|
-
|
|
44
|
-
if (isRouteErrorResponse(error)) {
|
|
45
|
-
message = error.status === 404 ? "404" : "Error"
|
|
46
|
-
details =
|
|
47
|
-
error.status === 404
|
|
48
|
-
? "The requested page could not be found."
|
|
49
|
-
: error.statusText || details
|
|
50
|
-
} else if (import.meta.env.DEV && error instanceof Error) {
|
|
51
|
-
details = error.message
|
|
52
|
-
stack = error.stack
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<main className="container mx-auto p-4 pt-16">
|
|
57
|
-
<h1>{message}</h1>
|
|
58
|
-
<p>{details}</p>
|
|
59
|
-
{stack && (
|
|
60
|
-
<pre className="w-full overflow-x-auto p-4">
|
|
61
|
-
<code>{stack}</code>
|
|
62
|
-
</pre>
|
|
63
|
-
)}
|
|
64
|
-
</main>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function meta() {
|
|
2
|
-
return [{ title: "Your ContextLayer slate" }]
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export default function Home() {
|
|
6
|
-
return (
|
|
7
|
-
<main className="mx-auto max-w-2xl space-y-6 px-4 py-16">
|
|
8
|
-
<h1 className="text-2xl font-semibold">Your ContextLayer slate is ready</h1>
|
|
9
|
-
<p>
|
|
10
|
-
Edit <code>app/routes/home.tsx</code> to build your first page.
|
|
11
|
-
</p>
|
|
12
|
-
<p>
|
|
13
|
-
To read from a connected service, declare a connection in{" "}
|
|
14
|
-
<code>public/slate.json</code>, assign a connected account through the CLI, and
|
|
15
|
-
call its tools from a route loader. Follow the Gmail example in the SDK guide to
|
|
16
|
-
get started.
|
|
17
|
-
</p>
|
|
18
|
-
<p>
|
|
19
|
-
Your checkout's <code>README.md</code> explains development, connections, and
|
|
20
|
-
deployment. The SDK guide is in{" "}
|
|
21
|
-
<code>node_modules/@usecontextlayer/sdk/README.md</code>.
|
|
22
|
-
</p>
|
|
23
|
-
</main>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_meta": {
|
|
3
|
-
"columns": {},
|
|
4
|
-
"schemas": {},
|
|
5
|
-
"tables": {}
|
|
6
|
-
},
|
|
7
|
-
"dialect": "sqlite",
|
|
8
|
-
"enums": {},
|
|
9
|
-
"id": "54e1d4df-48db-4b80-9190-11f5dbd99d64",
|
|
10
|
-
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
11
|
-
"tables": {},
|
|
12
|
-
"version": "6",
|
|
13
|
-
"views": {}
|
|
14
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core"
|
|
2
|
-
|
|
3
|
-
export const updates = sqliteTable("updates", {
|
|
4
|
-
body: text("body").notNull(),
|
|
5
|
-
createdAt: integer("created_at").notNull(),
|
|
6
|
-
id: text("id").primaryKey(),
|
|
7
|
-
kind: text("kind").notNull(),
|
|
8
|
-
})
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { reactRouter } from "@react-router/dev/vite"
|
|
2
|
-
import tailwindcss from "@tailwindcss/vite"
|
|
3
|
-
import { contextlayer } from "@usecontextlayer/sdk/vite"
|
|
4
|
-
import { defineConfig } from "vite"
|
|
5
|
-
|
|
6
|
-
export default defineConfig((env) => ({
|
|
7
|
-
plugins: [contextlayer(env), tailwindcss(), reactRouter()],
|
|
8
|
-
resolve: { tsconfigPaths: true },
|
|
9
|
-
}))
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createSlateWorker, type McpToolModule } from "@usecontextlayer/sdk/worker"
|
|
2
|
-
|
|
3
|
-
export default createSlateWorker({
|
|
4
|
-
build: () => import("virtual:react-router/server-build"),
|
|
5
|
-
development: import.meta.env.DEV,
|
|
6
|
-
mcp: import.meta.glob<McpToolModule>("/mcp/*/index.ts", { eager: true }),
|
|
7
|
-
mode: import.meta.env.MODE,
|
|
8
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compatibility_date": "2026-09-26",
|
|
3
|
-
"durable_objects": {
|
|
4
|
-
"bindings": [
|
|
5
|
-
{
|
|
6
|
-
"class_name": "SlateDatabase",
|
|
7
|
-
"name": "DATABASE_STORAGE"
|
|
8
|
-
}
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"main": "index.ts",
|
|
12
|
-
"migrations": [
|
|
13
|
-
{
|
|
14
|
-
"new_sqlite_classes": ["SlateDatabase"],
|
|
15
|
-
"tag": "v1"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"name": "ctx-local-resources"
|
|
19
|
-
}
|