scribase 0.1.0 → 0.3.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/CHANGELOG.md +56 -0
- package/LICENSE +202 -0
- package/README.md +59 -20
- package/dist/cli/add.d.ts +98 -0
- package/dist/cli/add.d.ts.map +1 -0
- package/dist/cli/add.js +348 -0
- package/dist/cli/add.js.map +1 -0
- package/dist/cli/aliases.d.ts +9 -0
- package/dist/cli/aliases.d.ts.map +1 -0
- package/dist/cli/aliases.js +14 -0
- package/dist/cli/aliases.js.map +1 -0
- package/dist/cli/branch.d.ts +73 -0
- package/dist/cli/branch.d.ts.map +1 -0
- package/dist/cli/branch.js +351 -0
- package/dist/cli/branch.js.map +1 -0
- package/dist/cli/capabilities/ota.d.ts +80 -0
- package/dist/cli/capabilities/ota.d.ts.map +1 -0
- package/dist/cli/capabilities/ota.js +299 -0
- package/dist/cli/capabilities/ota.js.map +1 -0
- package/dist/cli/capabilities/railyard/ai.d.ts +14 -0
- package/dist/cli/capabilities/railyard/ai.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/ai.js +33 -0
- package/dist/cli/capabilities/railyard/ai.js.map +1 -0
- package/dist/cli/capabilities/railyard/analytics.d.ts +27 -0
- package/dist/cli/capabilities/railyard/analytics.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/analytics.js +72 -0
- package/dist/cli/capabilities/railyard/analytics.js.map +1 -0
- package/dist/cli/capabilities/railyard/billing.d.ts +14 -0
- package/dist/cli/capabilities/railyard/billing.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/billing.js +39 -0
- package/dist/cli/capabilities/railyard/billing.js.map +1 -0
- package/dist/cli/capabilities/railyard/consent-files.d.ts +16 -0
- package/dist/cli/capabilities/railyard/consent-files.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/consent-files.js +24 -0
- package/dist/cli/capabilities/railyard/consent-files.js.map +1 -0
- package/dist/cli/capabilities/railyard/consent.d.ts +12 -0
- package/dist/cli/capabilities/railyard/consent.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/consent.js +38 -0
- package/dist/cli/capabilities/railyard/consent.js.map +1 -0
- package/dist/cli/capabilities/railyard/deploy.d.ts +16 -0
- package/dist/cli/capabilities/railyard/deploy.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/deploy.js +68 -0
- package/dist/cli/capabilities/railyard/deploy.js.map +1 -0
- package/dist/cli/capabilities/railyard/flags.d.ts +18 -0
- package/dist/cli/capabilities/railyard/flags.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/flags.js +45 -0
- package/dist/cli/capabilities/railyard/flags.js.map +1 -0
- package/dist/cli/capabilities/railyard/index.d.ts +55 -0
- package/dist/cli/capabilities/railyard/index.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/index.js +209 -0
- package/dist/cli/capabilities/railyard/index.js.map +1 -0
- package/dist/cli/capabilities/railyard/uptime.d.ts +18 -0
- package/dist/cli/capabilities/railyard/uptime.d.ts.map +1 -0
- package/dist/cli/capabilities/railyard/uptime.js +47 -0
- package/dist/cli/capabilities/railyard/uptime.js.map +1 -0
- package/dist/cli/connect.d.ts +100 -0
- package/dist/cli/connect.d.ts.map +1 -0
- package/dist/cli/connect.js +338 -0
- package/dist/cli/connect.js.map +1 -0
- package/dist/cli/credentials.d.ts +8 -0
- package/dist/cli/credentials.d.ts.map +1 -1
- package/dist/cli/credentials.js +27 -0
- package/dist/cli/credentials.js.map +1 -1
- package/dist/cli/doctor.d.ts +51 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +265 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/envfile.d.ts +18 -2
- package/dist/cli/envfile.d.ts.map +1 -1
- package/dist/cli/envfile.js +80 -6
- package/dist/cli/envfile.js.map +1 -1
- package/dist/cli/environments.d.ts +46 -0
- package/dist/cli/environments.d.ts.map +1 -0
- package/dist/cli/environments.js +128 -0
- package/dist/cli/environments.js.map +1 -0
- package/dist/cli/framework.d.ts +16 -1
- package/dist/cli/framework.d.ts.map +1 -1
- package/dist/cli/framework.js +95 -2
- package/dist/cli/framework.js.map +1 -1
- package/dist/cli/index.d.ts +4 -3
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +278 -21
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +80 -7
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +250 -27
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/mcp.d.ts +18 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +107 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/migrate.d.ts +70 -0
- package/dist/cli/migrate.d.ts.map +1 -0
- package/dist/cli/migrate.js +254 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/project.d.ts +25 -0
- package/dist/cli/project.d.ts.map +1 -0
- package/dist/cli/project.js +44 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/sql.d.ts +59 -0
- package/dist/cli/sql.d.ts.map +1 -0
- package/dist/cli/sql.js +164 -0
- package/dist/cli/sql.js.map +1 -0
- package/dist/cli/token.d.ts +44 -0
- package/dist/cli/token.d.ts.map +1 -0
- package/dist/cli/token.js +96 -0
- package/dist/cli/token.js.map +1 -0
- package/dist/types.gen.d.ts +11 -1
- package/dist/types.gen.d.ts.map +1 -1
- package/package.json +16 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0 (2026-11-16, not yet published)
|
|
4
|
+
|
|
5
|
+
- The claim line `init` prints, `init --help`, `doctor` and the README now
|
|
6
|
+
match the live sign-up: free for 14 days, no card, and one project stays
|
|
7
|
+
free after that. The old "sign up + card check" wording is gone.
|
|
8
|
+
- `init` prints the UTC time a temporary project is deleted next to its claim
|
|
9
|
+
link (`deleted_at_utc` and `keep` in `--json`).
|
|
10
|
+
- Fixed: an exported `SCRIBASE_ACCESS_TOKEN` no longer overrides the token in
|
|
11
|
+
this folder's env file. `sql`, `migrate`, `add`, `ota`, `env` and `branch`
|
|
12
|
+
act on this folder's project, so the token `init` wrote here wins, then the
|
|
13
|
+
exported one, then `scribase login`. Before, a token exported for another
|
|
14
|
+
project made `npx scribase sql` answer `403 access is denied`. When the two
|
|
15
|
+
differ, one line on stderr says which was used;
|
|
16
|
+
`SCRIBASE_TOKEN_SOURCE=shell|file|login` forces one; `--verbose` (any
|
|
17
|
+
command) always prints the source, never the token. A `401`/`403` now names
|
|
18
|
+
the source of the refused token.
|
|
19
|
+
- New in the npm package: `npx scribase env [list|get]` lists this project's
|
|
20
|
+
environments, and `npx scribase branch [list|create|url|reset|delete]`
|
|
21
|
+
manages database branches (they were only in the full CLI before). Both
|
|
22
|
+
read the project from `.scribase/project.json`, so no ids are typed.
|
|
23
|
+
`branch create|url` write the branch's public URL and publishable key to
|
|
24
|
+
`.scribase/branches/<branch>.env`. `branch reset|delete` ask first (or take
|
|
25
|
+
`--yes`) and refuse `production`.
|
|
26
|
+
- Fixed: `init --temp` no longer fails with `401` when the saved login has
|
|
27
|
+
expired; it creates the temporary project without it.
|
|
28
|
+
|
|
29
|
+
- `npx scribase connect [tool...]` writes the Scribase MCP server into every
|
|
30
|
+
AI coding tool this machine has (Claude Code via `claude mcp add`, Cursor,
|
|
31
|
+
VS Code, Codex, Windsurf, Zed) in one idempotent command. `--dry-run` shows
|
|
32
|
+
what would change; `--tool <id>` (repeatable) configures exactly those
|
|
33
|
+
tools regardless of detection. Never writes a token or secret — every
|
|
34
|
+
client's own MCP OAuth flow runs on first use instead.
|
|
35
|
+
|
|
36
|
+
## 0.2.0 (2026-11-11)
|
|
37
|
+
|
|
38
|
+
- `npx scribase init` is temporary-first: with no sign-in it creates a 72-hour
|
|
39
|
+
temporary project and prints a claim link; `--account`, `--watch` and
|
|
40
|
+
`scribase doctor` are new.
|
|
41
|
+
- `npx scribase init` prints the project URL and, for a temporary project, the
|
|
42
|
+
claim link as soon as the backend is live, before the Vercel push and the
|
|
43
|
+
client-library install.
|
|
44
|
+
- `scribase add <capability>` (analytics, deploy, flags, uptime, ai, billing,
|
|
45
|
+
consent, …) wires one capability into the project and prints proof JSON of
|
|
46
|
+
the first real event.
|
|
47
|
+
- `scribase ota deploy|rollback|status` for over-the-air updates, and
|
|
48
|
+
`scribase migrate` runs the real plan/lint/apply route.
|
|
49
|
+
- `init` detects SvelteKit and scaffolds its `$env/static/public` client; the
|
|
50
|
+
generated plain-Node client auto-loads `.env`.
|
|
51
|
+
- The default region id is `eu-frankfurt` (it names the city, not a hosting
|
|
52
|
+
provider). Projects created with the earlier `oci-eu-frankfurt-1` label keep
|
|
53
|
+
working unchanged.
|
|
54
|
+
- `prepublishOnly` runs `scripts/check-npm-tarball.mjs --gitleaks`: the publish
|
|
55
|
+
stops if the tarball holds an env file, a key file, a file outside the allow
|
|
56
|
+
list, or a secret-looking string.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
# scribase
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Supabase gives you a database and sign-in. Scribase is the whole backend for
|
|
4
|
+
your app: Postgres, Auth, Storage, Realtime, Functions and migrations behind
|
|
5
|
+
one flat price per project, with copy-on-write branching and an agent-native
|
|
6
|
+
CLI/SDK/MCP surface built in from day one.
|
|
7
|
+
|
|
8
|
+
This repo is the `npx scribase` CLI and the typed, fetch-based TypeScript
|
|
9
|
+
client for the [Scribase](https://scribase.com) management `/v1` API, both
|
|
10
|
+
shipped as the single `scribase` npm package. It talks to the same public
|
|
11
|
+
`https://api.scribase.com` endpoint the dashboard and console use — nothing
|
|
12
|
+
in this repo runs a database or a control plane itself.
|
|
5
13
|
|
|
6
14
|
- **Zero runtime dependencies.** A thin, typed wrapper over `fetch`.
|
|
7
15
|
- **Contract-first core.** `src/types.gen.ts` is emitted from
|
|
@@ -20,14 +28,42 @@ with the Fetch and Web Crypto globals.
|
|
|
20
28
|
|
|
21
29
|
## `npx scribase init`
|
|
22
30
|
|
|
23
|
-
The package also ships a `scribase` binary
|
|
24
|
-
|
|
31
|
+
The package also ships a `scribase` binary, made for coding agents (Claude
|
|
32
|
+
Code, Codex, Cursor, Windsurf) and people alike:
|
|
25
33
|
|
|
26
34
|
```bash
|
|
27
|
-
npx scribase init --
|
|
28
|
-
|
|
35
|
+
npx scribase init --json # not signed in: a 72-hour temporary project with a claim link
|
|
36
|
+
# signed in (SCRIBASE_ACCESS_TOKEN or `scribase login`): your account
|
|
37
|
+
npx scribase init --account # not signed in, but use an account (approve in the browser)
|
|
38
|
+
npx scribase init --watch # also wait for the app's first request
|
|
39
|
+
npx scribase sql "create table notes (id bigint generated always as identity primary key, body text)"
|
|
40
|
+
# run SQL on this folder's project, in one transaction
|
|
41
|
+
npx scribase doctor # check env vars, keys and the connection; one fix per problem
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
A new project's database is empty, so init's first next step creates a small
|
|
45
|
+
`notes` table with `npx scribase sql` (row level security on, read-only for
|
|
46
|
+
the public key) and the second queries it with `supabase.from('notes')`.
|
|
47
|
+
`sql` holds back statements that remove data until you add `--confirm`.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
npx scribase env # this project's environments; * marks this folder's
|
|
51
|
+
npx scribase branch create add-comments # a copy-on-write database with its own URL and keys
|
|
52
|
+
npx scribase branch # list branches
|
|
53
|
+
npx scribase branch delete add-comments --yes
|
|
29
54
|
```
|
|
30
55
|
|
|
56
|
+
These commands act on this folder's project, so the token `init` wrote to the
|
|
57
|
+
env file here wins over an exported `SCRIBASE_ACCESS_TOKEN`, and that over
|
|
58
|
+
`scribase login`. If the two differ, one line says which was used
|
|
59
|
+
(`SCRIBASE_TOKEN_SOURCE=shell` uses the exported one); `--verbose` always
|
|
60
|
+
prints the token's source, never the token.
|
|
61
|
+
|
|
62
|
+
Init prints "Live in N s" with the measured time. The claim link carries
|
|
63
|
+
`?ref=<install id>`, a random id stored in `~/.config/scribase/install-id`
|
|
64
|
+
(`SCRIBASE_NO_REF=1` sends none). Claiming is a sign-up: free for 14 days, no card, and one
|
|
65
|
+
project stays free after that. The URL and keys stay the same.
|
|
66
|
+
|
|
31
67
|
It detects Next.js, Expo, Vite or plain Node, creates (or reuses) a project,
|
|
32
68
|
writes the env file with that framework's variable names
|
|
33
69
|
(`NEXT_PUBLIC_SUPABASE_URL`, `EXPO_PUBLIC_SUPABASE_URL`, `VITE_SUPABASE_URL`,
|
|
@@ -46,17 +82,22 @@ turns it off.
|
|
|
46
82
|
|
|
47
83
|
## Install
|
|
48
84
|
|
|
49
|
-
The package is not on the npm registry yet. Depend on it from this repository:
|
|
50
|
-
|
|
51
85
|
```bash
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
# then, in your app
|
|
57
|
-
npm install file:../path/to/scribase/packages/scribase-js
|
|
86
|
+
npm install scribase
|
|
87
|
+
# or
|
|
88
|
+
pnpm add scribase
|
|
58
89
|
```
|
|
59
90
|
|
|
91
|
+
Working on this repository directly? Clone it and build from source instead:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/caelum0x/scribase-cli.git
|
|
95
|
+
cd scribase-cli
|
|
96
|
+
npm install
|
|
97
|
+
npm run build
|
|
98
|
+
npx ./dist/cli/index.js --help # or: npm link, then `scribase --help`
|
|
99
|
+
npm install file:../path/to/scribase-cli # in your app, instead of the npm registry
|
|
100
|
+
```
|
|
60
101
|
|
|
61
102
|
|
|
62
103
|
## Quick start
|
|
@@ -208,12 +249,10 @@ try {
|
|
|
208
249
|
|
|
209
250
|
## Regenerating types
|
|
210
251
|
|
|
211
|
-
`src/types.gen.ts` is generated; never edit it by hand.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
pnpm generate # tsx scripts/generate.ts → reads ../../api/openapi.yaml
|
|
216
|
-
```
|
|
252
|
+
`src/types.gen.ts` is generated; never edit it by hand. `scripts/generate.ts`
|
|
253
|
+
reads the `api/openapi.yaml` contract from Scribase's main (private) repo, so
|
|
254
|
+
regenerating it is a Scribase-team-only step — it is not needed to build,
|
|
255
|
+
test or use this package, since `types.gen.ts` already ships checked in.
|
|
217
256
|
|
|
218
257
|
## License
|
|
219
258
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `npx scribase add <slot>`: turns a capability on for the project this folder
|
|
3
|
+
* is connected to and prints its proof (SP-D1).
|
|
4
|
+
*
|
|
5
|
+
* npx scribase add email send a proof email to your own address
|
|
6
|
+
* npx scribase add email --own use your own mail server (entered in the
|
|
7
|
+
* browser, never here)
|
|
8
|
+
* npx scribase add --list what can be added, Live or Arriving
|
|
9
|
+
*
|
|
10
|
+
* The control plane does the work (`POST .../capabilities/{slot}`) and answers
|
|
11
|
+
* with `{slot, live, proof:{kind,id,at}}`. When a slot needs a credential, the
|
|
12
|
+
* answer is a console link instead: the person enters it there, and this
|
|
13
|
+
* command waits for the proof. No secret is read from or written to the
|
|
14
|
+
* terminal, the chat, or the env file: only public values are written, and a
|
|
15
|
+
* value that looks like a secret is refused by name.
|
|
16
|
+
*/
|
|
17
|
+
export interface AddOptions {
|
|
18
|
+
slot: string | null;
|
|
19
|
+
list: boolean;
|
|
20
|
+
own: boolean;
|
|
21
|
+
resend: boolean;
|
|
22
|
+
json: boolean;
|
|
23
|
+
wait: boolean;
|
|
24
|
+
browser: boolean;
|
|
25
|
+
waitSeconds: number;
|
|
26
|
+
}
|
|
27
|
+
export interface AddIo {
|
|
28
|
+
cwd: string;
|
|
29
|
+
env: Record<string, string | undefined>;
|
|
30
|
+
fetch: typeof fetch;
|
|
31
|
+
readFile: (path: string) => string | null;
|
|
32
|
+
writeFile: (path: string, contents: string) => void;
|
|
33
|
+
credentials: () => {
|
|
34
|
+
apiUrl?: string;
|
|
35
|
+
token?: string;
|
|
36
|
+
};
|
|
37
|
+
sleep: (ms: number) => Promise<void>;
|
|
38
|
+
now: () => number;
|
|
39
|
+
log: (line: string) => void;
|
|
40
|
+
openBrowser: (url: string) => void;
|
|
41
|
+
}
|
|
42
|
+
export interface Proof {
|
|
43
|
+
kind: string;
|
|
44
|
+
id: string;
|
|
45
|
+
at: number;
|
|
46
|
+
detail?: string | null;
|
|
47
|
+
}
|
|
48
|
+
export interface CapabilityState {
|
|
49
|
+
slot: string;
|
|
50
|
+
title: string;
|
|
51
|
+
status: 'live' | 'arriving';
|
|
52
|
+
state: string;
|
|
53
|
+
live: boolean;
|
|
54
|
+
provider: string | null;
|
|
55
|
+
proof: Proof | null;
|
|
56
|
+
proof_label?: string;
|
|
57
|
+
connect_url: string | null;
|
|
58
|
+
next: string | null;
|
|
59
|
+
env?: Record<string, string>;
|
|
60
|
+
sent?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface RegistryEntry {
|
|
63
|
+
slot: string;
|
|
64
|
+
title: string;
|
|
65
|
+
summary: string;
|
|
66
|
+
status: 'live' | 'arriving';
|
|
67
|
+
}
|
|
68
|
+
export type AddResult = {
|
|
69
|
+
ok: true;
|
|
70
|
+
slot: string;
|
|
71
|
+
status: 'live' | 'needs_connect';
|
|
72
|
+
live: boolean;
|
|
73
|
+
provider: string | null;
|
|
74
|
+
proof: Proof | null;
|
|
75
|
+
sent: boolean;
|
|
76
|
+
connect_url?: string;
|
|
77
|
+
env_written: string[];
|
|
78
|
+
env_refused: string[];
|
|
79
|
+
next: string | null;
|
|
80
|
+
} | {
|
|
81
|
+
ok: true;
|
|
82
|
+
status: 'list';
|
|
83
|
+
capabilities: RegistryEntry[];
|
|
84
|
+
};
|
|
85
|
+
/** Parses `add` arguments. */
|
|
86
|
+
export declare function parseAddArgs(argv: string[]): AddOptions;
|
|
87
|
+
/** Runs `add` and returns its result. Never returns or logs a secret. */
|
|
88
|
+
export declare function runAdd(options: AddOptions, io: AddIo): Promise<AddResult>;
|
|
89
|
+
/** The human-readable output of {@link runAdd}. */
|
|
90
|
+
export declare function formatAdd(result: AddResult): string;
|
|
91
|
+
export declare const ADD_HELP = "Usage: npx scribase add <capability> [--own] [--resend] [--json] [--no-wait] [--no-browser] [--wait <seconds>]\n npx scribase add --list [--json]\n\nTurns a capability on for the project this folder is connected to, and prints\nits proof (for email: a real email sent to your own address, with its log id).\nA capability that needs a provider credential (--own for your own mail\nserver) prints a console link: enter the credential there, never here. This\ncommand waits for the proof (up to 10 minutes; --wait to change). Only public\nvalues are written to the env file; secrets are never printed or written.\n";
|
|
92
|
+
/** Entry point for the `add` command; returns the exit code. */
|
|
93
|
+
export declare function addMain(argv: string[], io: AddIo, write: (text: string) => void): Promise<number>;
|
|
94
|
+
/** The real-process IO for `add`. In --json mode stdout carries one JSON document; notes go to stderr. */
|
|
95
|
+
export declare function nodeAddIo(json: boolean): AddIo;
|
|
96
|
+
/** `npx scribase add ...` as the CLI runs it (the one line \`index.ts\` needs). */
|
|
97
|
+
export declare function addCommand(argv: string[]): Promise<number>;
|
|
98
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/cli/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiBH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,OAAO,CA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