@teable/create-app 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +31 -2
- package/bin/create-teable-app.js +103 -0
- package/dist/template/AGENTS.md +284 -0
- package/dist/template/CLAUDE.md +1 -0
- package/dist/template/components.json +27 -0
- package/dist/template/drizzle/0000_init.sql +6 -0
- package/dist/template/drizzle/meta/0000_snapshot.json +55 -0
- package/dist/template/drizzle/meta/_journal.json +13 -0
- package/dist/template/drizzle/migrations.js +10 -0
- package/dist/template/drizzle.config.ts +8 -0
- package/dist/template/gitignore +8 -0
- package/dist/template/index.html +12 -0
- package/dist/template/package.json +45 -0
- package/dist/template/src/components/ui/alert.tsx +72 -0
- package/dist/template/src/components/ui/button.tsx +52 -0
- package/dist/template/src/components/ui/input.tsx +18 -0
- package/dist/template/src/server/index.ts +28 -0
- package/dist/template/src/server/schema.ts +13 -0
- package/dist/template/src/server/tsconfig.json +10 -0
- package/dist/template/src/web/app.ts +35 -0
- package/dist/template/src/web/main.tsx +49 -0
- package/dist/template/src/web/notes.test.tsx +45 -0
- package/dist/template/src/web/notes.tsx +63 -0
- package/dist/template/src/web/styles.css +146 -0
- package/dist/template/teable.json +1 -0
- package/dist/template/test/env.d.ts +10 -0
- package/dist/template/test/notes.test.ts +29 -0
- package/dist/template/test/worker.ts +5 -0
- package/dist/template/tsconfig.base.json +19 -0
- package/dist/template/tsconfig.json +13 -0
- package/dist/template/vite.config.ts +43 -0
- package/dist/template/wrangler.test.jsonc +7 -0
- package/package.json +22 -4
- package/skill/teable-next-app/SKILL.md +88 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Test-only Worker: runs the app as a plain Durable Object.
|
|
2
|
+
{
|
|
3
|
+
"name": "teable-app-test",
|
|
4
|
+
"main": "test/worker.ts",
|
|
5
|
+
"durable_objects": { "bindings": [{ "name": "APP", "class_name": "App" }] },
|
|
6
|
+
"migrations": [{ "tag": "v1", "new_sqlite_classes": ["App"] }]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teable/create-app",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Start a Teable app: a blank app, the instructions agents read in it, and the teable-next-app Agent Skill",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/teableio/teable-next.git",
|
|
9
|
+
"directory": "packages/create-app"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"bin": {
|
|
13
|
+
"create-teable-app": "./bin/create-teable-app.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"bin",
|
|
17
|
+
"dist/template",
|
|
18
|
+
"skill"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"provenance": true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: teable-next-app
|
|
3
|
+
description: Build, change, test and publish a Teable app (teable-next) — a Drizzle schema plus read, write and task methods that Teable runs with its own SQLite database and turns into an HTTP API and MCP tools, with React pages. Use when the user wants an app, tool or internal system built on Teable (a tracker, CRM, approval flow, inventory, booking, dashboard with its own data and rules), or wants one changed, fixed or published, or the working directory holds an app repository (teable.json, @teable/app in package.json). Not for editing records, fields or views of a classic Teable base.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Teable apps (teable-next)
|
|
7
|
+
|
|
8
|
+
A Teable app is a repository: a Drizzle schema (`src/server/schema.ts`), read,
|
|
9
|
+
write and task methods (`src/server/index.ts`, with `@teable/app`), migrations
|
|
10
|
+
(`drizzle/`), pages (`src/web/`) and tests. Teable runs it on Cloudflare, one
|
|
11
|
+
Durable Object with its own SQLite database per app, and makes an HTTP API
|
|
12
|
+
and MCP tools from its methods. You build it in a shell, like any project,
|
|
13
|
+
and publish it with the `teable` CLI.
|
|
14
|
+
|
|
15
|
+
## When to use it
|
|
16
|
+
|
|
17
|
+
- The user wants software with its own data and rules: records that move
|
|
18
|
+
through states, checks that refuse bad input, work that runs later or on a
|
|
19
|
+
schedule, calls to other services, pages, an API.
|
|
20
|
+
- The working directory, or one the user names, holds an app: `teable.json`
|
|
21
|
+
at its root, `@teable/app` in `package.json`, an `AGENTS.md`.
|
|
22
|
+
- Not for reading or editing a classic Teable base (tables, fields, views,
|
|
23
|
+
records): that is the `teable` CLI's base commands, not an app.
|
|
24
|
+
|
|
25
|
+
## Start
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
teable app init --name "<app name>" # a new app: creates it on Teable, checks out its repository
|
|
29
|
+
teable app clone --app-id <appId> # an app that exists: checks out its repository
|
|
30
|
+
teable app pull # in a checkout you have: bring it up to date first
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Without the `teable` CLI (Claude Code on someone's own machine, say),
|
|
34
|
+
`npx @teable/create-app <dir> --app-id <appId>` (or `bunx`) writes the same
|
|
35
|
+
blank app; leave out `--app-id` to try one locally, and `git init` it. Then
|
|
36
|
+
`bun install`, and read the app's `AGENTS.md` before changing anything: it is
|
|
37
|
+
the app's own instructions, current for the SDK the app uses.
|
|
38
|
+
|
|
39
|
+
## The loop
|
|
40
|
+
|
|
41
|
+
1. Edit: schema, methods, migrations, pages, tests.
|
|
42
|
+
2. `bun run check`: typecheck, tests (methods in workerd against a real
|
|
43
|
+
database, pages in jsdom), migration checks.
|
|
44
|
+
3. `bun run build`: `dist/server.js`, which publishing uploads.
|
|
45
|
+
4. `teable app push -m "<what changed>"`: commit and save the source to
|
|
46
|
+
Teable as a new version.
|
|
47
|
+
5. `teable app publish`: Teable runs the new version's migrations on a copy
|
|
48
|
+
of the live data, then on the live data, and makes it live only if both
|
|
49
|
+
work. Publish as soon as the checks pass; do not wait to be asked. It
|
|
50
|
+
takes the `creator` or `owner` role in the app's space. Then tell the user
|
|
51
|
+
what changed.
|
|
52
|
+
|
|
53
|
+
`teable app versions` lists published versions, with who published each and
|
|
54
|
+
from which commit. `teable app rollback --version <n>` deploys an earlier
|
|
55
|
+
version's code again, as the next version; it is refused past a migration
|
|
56
|
+
(roll forward instead), and it leaves the repository as it is, so fix or
|
|
57
|
+
revert the code before the next publish. There is no local server: tests are
|
|
58
|
+
the loop, publishing shows the running app.
|
|
59
|
+
|
|
60
|
+
## The rules
|
|
61
|
+
|
|
62
|
+
Each is explained, with why, in the app's `AGENTS.md` ("The rules, and why"):
|
|
63
|
+
|
|
64
|
+
1. Data is touched only through the app's methods.
|
|
65
|
+
2. Read and write handlers are synchronous; anything that waits (`fetch`, AI,
|
|
66
|
+
email, payments) is a task, retried until it succeeds.
|
|
67
|
+
3. Rules SQLite can enforce live in SQLite: NOT NULL, CHECK, UNIQUE, foreign
|
|
68
|
+
keys, triggers. Methods hold the rest.
|
|
69
|
+
4. Migrations are append-only: once published, never edit or delete one; add
|
|
70
|
+
a new one with `bun run db:generate`.
|
|
71
|
+
5. Capabilities are declared: the app gets no network (`http`) and no files
|
|
72
|
+
(`files`) unless `createApp` lists them.
|
|
73
|
+
|
|
74
|
+
## Where to look in the app's AGENTS.md
|
|
75
|
+
|
|
76
|
+
| To | Section |
|
|
77
|
+
| ----------------------------------------------------- | ------------------------ |
|
|
78
|
+
| Find your way around the repository | Layout |
|
|
79
|
+
| Know the rules and why they hold | The rules, and why |
|
|
80
|
+
| Run checks, build, push, publish, roll back | Commands |
|
|
81
|
+
| Add a table and its migration | How to: Add a table |
|
|
82
|
+
| Add a read or a write, its access and its errors | How to: Add a read... |
|
|
83
|
+
| Add a page | How to: Add a page |
|
|
84
|
+
| Run work later, on a schedule, or against a service | How to: Add a task... |
|
|
85
|
+
| Store files, call other services | How to: Use a capability |
|
|
86
|
+
| Write tests | How to: Test |
|
|
87
|
+
| Understand an error from a check, a test or a publish | When something fails |
|
|
88
|
+
| Know what publishing does | Publishing |
|