@profullstack/waitlist 0.15.0 → 0.15.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/README.md CHANGED
@@ -141,7 +141,7 @@ Every page showcases all plugins by default. Pick per site in `sites.json`:
141
141
  | `promo` | "More from the network": sister properties from the live `@profullstack/cross-promo` catalog, tagged `utm_medium=waitlist`. `"promoAudience": "developers"` (or a list) overrides the audience picked from the hierarchy |
142
142
  | `community` | A header bar with Search and a branded **Community** button to the name's own tsbb board (`https://bbs.<name>.pit.world`, sign in with pit.world / CoinPay OAuth 2.1, or `tsbb login <board> --with coinpay`). Linked only once the board answers over HTTPS, so new names gain it as their certificate lands. Writes `brand.json` (look, colours, light/dark, closest tsbb skin) that pit.world's board seed uses to match the site |
143
143
  | `advisor` | An **Advisor** page (`advisor/`) that answers questions about the site's own topic from what the build holds: the pitch, the FAQ, the resources and the text search results. The visitor signs in with their own c0mpute account (OAuth 2.1 + PKCE, scope `inference`, through CoinPay or a passkey) and the page calls c0mpute's chat API with that key, billed to them: no server and no key on the site. Also writes `advisor/dataset.jsonl` (the same notes as a `c0mpute train lora` dataset), `context.json` and `prompt.txt`, and prints the CLI commands to ask or train from a terminal. Skipped when the build holds fewer than 3 documents. Settings: `advisor: { clientId, model }` (the page registers its own OAuth client on first sign-in when no `clientId` is given). Asking from the browser needs c0mpute to allow cross-origin calls to `/v1/chat/completions` (profullstack/c0mpute#718) |
144
- | `builder` | A **Build** page (`builder/`) so the people waiting can help build the app: start or clone its repo on c0mpute git (public repos are kept by the network and free to clone), design the schema on dbml.db and create a live Postgres with `c0mpute db create`, prototype features with feature.agent (linked with `?ref=<host>`), and take ideas to the name's board. Plain HTML, no script, no server. Settings: `builder: { repo: "c0mpute://<owner key>/<repo>", schema: "https://..." }`; without `repo` the page shows how to start one |
144
+ | `builder` | A **Build** page (`builder/`) so the people waiting can help build the app: start or clone its repo on c0mpute git (public repos are kept by the network and free to clone), open the site's schema in dbml.db (a static `builder/schema.dbml`, from `builder.dbml` in sites.json or a starter, linked with the editor's own `?code=` share format, so there is no database service to run) and create a live Postgres with `c0mpute db create`, prototype features with feature.agent (linked with `?ref=<host>`), and take ideas to the name's board. Plain HTML, no script, no server. Settings: `builder: { repo: "c0mpute://<owner key>/<repo>", dbml: "Table ... { }", schema: "https://..." }` (`schema` overrides the dbml.db link); without `repo` the page shows how to start one |
145
145
  | (search, resources) | Every search item and resource carries pit.world's result tools from `https://pit.world/widgets.js`: vote, Summarize, Listen and Share. They work without an account; on a pit.world host, "Sign in with CoinPay" (OAuth 2.1 + PKCE through pit.world) raises the limits. From a terminal the same account is `pit login` |
146
146
  | `affiliate` | Referrals (0.9). Every signup gets a personal link `https://<site>/?ref=<code>`, shown right after joining by `<pf-referral-share>` ("You are #X of Y, N people referred.", copy button, plain X/Bluesky/LinkedIn/email links) and in the confirmation email with a signed status page. A visitor who arrives with `?ref=` keeps a 30-day first-party, first-touch cookie `wl_ref`; their signup credits the referrer once they confirm. Each confirmed referral moves the referrer up `bumpPlaces`. A "Move up the list" section bakes `<pf-referral-leaderboard>` (handles or masked emails only). With `buyaday` on, a door sold to a referred visitor credits the referrer too (holi.days `ref=<code>.<site>`), and since 0.13 the page states the paid terms: the referrer earns `commissionPct` of what that visitor pays and the visitor gets `discountPct` off. See below |
147
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/waitlist",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Email waitlist for any launch page: a <waitlist-form> web component, a live signup chart, and a static-site builder on @profullstack/css + @profullstack/charts.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/build.js CHANGED
@@ -5,7 +5,7 @@
5
5
  import { mkdir, writeFile, copyFile, readFile, readdir } from 'node:fs/promises';
6
6
  import { pluginSet, keywordsFor, runPlugins, baseSlot, affiliateConfig } from './plugins.js';
7
7
  import { ADVISOR_PATH, advisorCardHtml, advisorContextJson, advisorCorpus, advisorConfig, advisorDataset, advisorMeta, advisorPageHtml } from './advisor.js';
8
- import { BUILDER_PATH, builderCardHtml, builderConfig, builderMeta, builderPageHtml } from './builder.js';
8
+ import { BUILDER_PATH, builderCardHtml, builderConfig, builderMeta, builderPageHtml, builderSchema } from './builder.js';
9
9
  import { boardLive, boardUrl, brandJson, navHtml } from './community.js';
10
10
  import {
11
11
  TABS, SORTS, tabPath, searchPageHtml, searchPageMeta, searchJson, searchLlms, manifestJson,
@@ -375,6 +375,8 @@ async function writeBuilder(s, out, { footers, slot, ver }) {
375
375
  chrome: ({ head, body, spec }) => withAssetVersion(shellHtml(spec, { head, main: `${body}\n<section class="card stack" aria-label="Waitlist"><h2>Get ${esc(s.title)} when it opens</h2>${slot.hero.join('\n')}</section>`, footers, slot: pageSlot }), ver),
376
376
  });
377
377
  await writeFile(join(dir, 'index.html'), html);
378
+ // The schema is a static file on the site: nothing to run, and dbml.db opens it from the link.
379
+ await writeFile(join(dir, 'schema.dbml'), builderSchema(s));
378
380
  return { url: builderMeta(s).url, lastmod: s.updated, changefreq: 'weekly' };
379
381
  }
380
382
 
package/src/builder.js CHANGED
@@ -10,12 +10,80 @@
10
10
  //
11
11
  // Sign-in is the visitor's own c0mpute account (CoinPay or a passkey), in the
12
12
  // CLI (`c0mpute login`) and on the Advisor page. This page has no server.
13
+ import { deflateRawSync } from 'node:zlib';
13
14
  import { esc, headTags, clip } from './seo.js';
14
15
 
15
16
  export const BUILDER_PATH = 'builder/';
16
17
  export const FEATURE_AGENT = 'https://feature.agent.pit.world';
17
18
  export const DBML_DB = 'https://dbml.db.pit.world';
18
19
  export const C0MPUTE = 'https://c0mpute.com';
20
+ /** dbml.db refuses to share a project whose encoded form is longer than this. */
21
+ export const DBML_SHARE_MAX = 15000;
22
+ const DBML_MAX_CHARS = 60_000;
23
+
24
+ /**
25
+ * A starting schema for a name with none of its own: members who post and
26
+ * comment. It is a starting point to edit, not a claim about the product.
27
+ * Valid DBML, 100 on dbml.db's review (indexes on every foreign key).
28
+ */
29
+ export function starterDbml(s) {
30
+ const slug = repoSlug(s.name);
31
+ return `Project ${slug.replace(/-/g, '_')} {
32
+ database_type: 'PostgreSQL'
33
+ Note: 'Starting schema for ${String(s.title).replace(/[\\']/g, '')}. Edit it in dbml.db, then create the database with: c0mpute db create ${slug}'
34
+ }
35
+
36
+ Table members {
37
+ id uuid [pk]
38
+ handle text [not null, unique]
39
+ email text [not null, unique]
40
+ created_at timestamptz [not null, default: \`now()\`]
41
+ }
42
+
43
+ Table posts {
44
+ id uuid [pk]
45
+ member_id uuid [not null, ref: > members.id]
46
+ title text [not null]
47
+ body text [not null]
48
+ created_at timestamptz [not null, default: \`now()\`]
49
+
50
+ indexes {
51
+ member_id
52
+ created_at
53
+ }
54
+ }
55
+
56
+ Table comments {
57
+ id uuid [pk]
58
+ post_id uuid [not null, ref: > posts.id]
59
+ member_id uuid [not null, ref: > members.id]
60
+ body text [not null]
61
+ created_at timestamptz [not null, default: \`now()\`]
62
+
63
+ indexes {
64
+ post_id
65
+ member_id
66
+ }
67
+ }
68
+ `;
69
+ }
70
+
71
+ /** The site's schema: `builder.dbml` from sites.json when given, else the starter. */
72
+ export function builderSchema(s) {
73
+ const own = typeof s.builder?.dbml === 'string' ? s.builder.dbml.trim() : '';
74
+ return own ? `${own.slice(0, DBML_MAX_CHARS)}\n` : starterDbml(s);
75
+ }
76
+
77
+ /**
78
+ * A link that opens a schema in the dbml.db editor: the project (one file)
79
+ * deflated and base64url-encoded into ?code=, the format the editor's own
80
+ * Share button writes. Null when the schema is too big for a link; the page
81
+ * then links the editor and the raw file instead.
82
+ */
83
+ export function dbmlEditorUrl(dbml) {
84
+ const code = deflateRawSync(Buffer.from(JSON.stringify({ files: { '/main.dbml': dbml }, folders: [] }))).toString('base64url');
85
+ return code.length > DBML_SHARE_MAX ? null : `${DBML_DB}/playground/?code=${code}`;
86
+ }
19
87
 
20
88
  /** A repo name c0mpute git accepts: 1-59 of a-z, 0-9 and '-'. */
21
89
  export function repoSlug(name) {
@@ -24,8 +92,9 @@ export function repoSlug(name) {
24
92
 
25
93
  /**
26
94
  * `builder` in sites.json:
27
- * "builder": { "repo": "c0mpute://<64 hex owner key>/<repo>", "schema": "https://dbml.db.pit.world/..." }
28
- * Both optional. Without `repo` the page shows how to start one; a value that
95
+ * "builder": { "repo": "c0mpute://<64 hex owner key>/<repo>", "dbml": "Table ... { }", "schema": "https://..." }
96
+ * All optional. `dbml` is the schema itself (the site publishes it as builder/schema.dbml
97
+ * and links it open in dbml.db); `schema` overrides that link with one of your own. Without `repo` the page shows how to start one; a value that
29
98
  * is not a c0mpute repo URL is ignored rather than printed into a command.
30
99
  */
31
100
  export function builderConfig(raw, name) {
@@ -40,6 +109,7 @@ export function builderConfig(raw, name) {
40
109
  slug: repoSlug(name),
41
110
  repo: m ? { url: m[0], owner: m[1], name: m[2], https: `https://gateway.c0mpute.com/git/${m[1]}/${m[2]}.git` } : null,
42
111
  schema,
112
+ dbml: typeof r.dbml === 'string' && r.dbml.trim() ? r.dbml : null,
43
113
  };
44
114
  }
45
115
 
@@ -95,9 +165,10 @@ export function builderPageHtml(s, { chrome, rebase }) {
95
165
  <p class="muted">Repos are signed by your key and kept in three copies. Private repos are end-to-end encrypted.</p>
96
166
  </section>
97
167
  <section class="card stack" aria-labelledby="build-data"><h2 id="build-data">2. Data</h2>
98
- <p>Design the schema in DBML, review it, then turn it into a live Postgres on the network.</p>
99
- <p><a class="button" href="${esc(b.schema || DBML_DB)}" rel="noopener">${b.schema ? `Open the ${esc(s.title)} schema` : 'Open dbml.db'}</a></p>
168
+ <p>${b.dbml ? `The ${esc(s.title)} schema` : `A starting schema for ${esc(s.title)}`} is a plain <a href="${esc(m.url)}schema.dbml">schema.dbml</a> file on this site. Open it in dbml.db to edit, review and diagram it, then turn it into a live Postgres on the network.</p>
169
+ <p><a class="button" href="${esc(b.schema || dbmlEditorUrl(builderSchema(s)) || `${DBML_DB}/playground/`)}" rel="noopener">Open the schema in dbml.db</a></p>
100
170
  ${pre(cmd.data)}
171
+ <p class="muted">For agents: dbml.db speaks MCP at <code>${DBML_DB}/mcp</code>.</p>
101
172
  </section>
102
173
  <section class="card stack" aria-labelledby="build-features"><h2 id="build-features">3. Features</h2>
103
174
  <p><a href="${FEATURE_AGENT}/?ref=${ref}" rel="noopener">feature.agent</a> builds a feature for any site from a description and runs it in your browser. Use it to prototype what ${esc(s.title)} should do, on the sites you already use.</p>