foldkit-plus 0.2.1 → 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/dist/auth/server.d.mts +1 -0
- package/dist/auth/server.mjs +2 -0
- package/dist/auth.d.mts +1 -0
- package/dist/auth.mjs +2 -0
- package/dist/setup.d.mts.map +1 -1
- package/dist/setup.mjs +10 -0
- package/dist/setup.mjs.map +1 -1
- package/package.json +48 -33
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "foldkit-auth/server";
|
package/dist/auth.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "foldkit-auth";
|
package/dist/auth.mjs
ADDED
package/dist/setup.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.mts","names":[],"sources":["../src/setup.ts"],"mappings":";;YAOY;;iBAGK;WACN;;WAEA,UAAU,SAAS;;;iBAIb;WACN;WACA;WACA;;iBAGM;WACN,SAAS,OAAO,OAAO;WACvB,SAAS;WACT,UAAU;;;qBAOR,MAAM;WACR;WACA,SAAS;WACT;;;;;;
|
|
1
|
+
{"version":3,"file":"setup.d.mts","names":[],"sources":["../src/setup.ts"],"mappings":";;YAOY;;iBAGK;WACN;;WAEA,UAAU,SAAS;;;iBAIb;WACN;WACA;WACA;;iBAGM;WACN,SAAS,OAAO,OAAO;WACvB,SAAS;WACT,UAAU;;;qBAOR,MAAM;WACR;WACA,SAAS;WACT;;;;;;qBAuGE,UAAU;WACZ;WACA,WAAW;WACX;;;qBAqCE,aAAU,SAAa,SAAO,UAAY;qBAuB1C,eAAU,SAAA,SAAA,YAAoC"}
|
package/dist/setup.mjs
CHANGED
|
@@ -57,6 +57,11 @@ const jobs = [
|
|
|
57
57
|
imports: ["guard"],
|
|
58
58
|
guide: "guard"
|
|
59
59
|
},
|
|
60
|
+
{
|
|
61
|
+
job: "Who is signed in: a Yielded Auth session as the principal",
|
|
62
|
+
imports: ["auth"],
|
|
63
|
+
guide: "auth"
|
|
64
|
+
},
|
|
60
65
|
{
|
|
61
66
|
job: "A slice of the Model kept in the URL or in storage",
|
|
62
67
|
imports: ["mirror"],
|
|
@@ -140,6 +145,11 @@ const adapters = [
|
|
|
140
145
|
libraries: ["@agent-native/core"],
|
|
141
146
|
when: "agents through Agent Native"
|
|
142
147
|
},
|
|
148
|
+
{
|
|
149
|
+
name: "foldkit-auth",
|
|
150
|
+
libraries: ["@yielded/auth"],
|
|
151
|
+
when: "sign-in and sessions with Yielded Auth"
|
|
152
|
+
},
|
|
143
153
|
{
|
|
144
154
|
name: "foldkit-cms-drizzle",
|
|
145
155
|
libraries: ["drizzle-orm"],
|
package/dist/setup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.mjs","names":[],"sources":["../src/setup.ts"],"sourcesContent":["/**\n * What `npx foldkit-plus setup` prints: instructions a coding agent can follow\n * in order, for the project it is run in. Pure: the CLI reads the project and\n * this package's manifest and passes them in, so a test can give any project.\n */\nimport { Option } from 'effect'\n\nexport type Manager = 'pnpm' | 'npm' | 'yarn' | 'bun'\n\n/** What the project's `package.json` says about the libraries Foldkit Plus needs. */\nexport interface Project {\n readonly name: string\n /** Each named library's version range, from any dependency field. */\n readonly versions: Readonly<Record<string, string>>\n}\n\n/** The versions this release is built and tested against, from its own manifest. */\nexport interface Versions {\n readonly plus: string\n readonly effect: string\n readonly foldkit: string\n}\n\nexport interface SetupInput {\n readonly project: Option.Option<Project>\n readonly manager: Manager\n readonly versions: Versions\n}\n\nconst SITE = 'https://foldkit-plus.pages.dev'\nconst REPOSITORY = 'https://github.com/doeixd/foldkit-plus'\n\n/** What each job needs, where to import it from, and where it is explained. */\nexport const jobs: ReadonlyArray<{\n readonly job: string\n readonly imports: ReadonlyArray<string>\n readonly guide: string\n}> = [\n {\n job: 'Name what a feature may read and which Messages it may send',\n imports: ['surface', 'metadata'],\n guide: 'surface',\n },\n {\n job: 'A reusable Submodel placed several times, every part wired',\n imports: ['bundle', 'bundle-surface'],\n guide: 'bundle',\n },\n {\n job: 'Restyle or extend views from outside, through typed slots',\n imports: ['mixins', 'mixins-surface', 'mixins-ui'],\n guide: 'mixins',\n },\n {\n job: 'Media queries, timers, sockets, clipboard, undo history',\n imports: ['primitives'],\n guide: 'primitives',\n },\n {\n job: 'Declare the domain once: entities, relations, queries',\n imports: ['entity'],\n guide: 'entity',\n },\n {\n job: 'Server-owned data in the Model: queries, mutations, live updates',\n imports: ['remote', 'remote-server', 'remote-drizzle'],\n guide: 'remote',\n },\n {\n job: 'Edits that survive offline and converge across devices',\n imports: ['sync', 'durable'],\n guide: 'sync',\n },\n { job: 'Who may do what, enforced on every seam', imports: ['guard'], guide: 'guard' },\n {\n job: 'A slice of the Model kept in the URL or in storage',\n imports: ['mirror'],\n guide: 'mirror',\n },\n {\n job: 'Forms: drafts, validation, a decoded value',\n imports: ['form', 'mixins-form'],\n guide: 'form',\n },\n {\n job: 'Edit, create and list screens over Remote',\n imports: ['crud', 'mixins-crud'],\n guide: 'crud',\n },\n {\n job: 'An interactive data grid over rows you own',\n imports: ['data-grid', 'mixins-data-grid'],\n guide: 'data-grid',\n },\n {\n job: 'Drafts, revisions and publishing for content',\n imports: ['cms', 'cms-drizzle'],\n guide: 'cms',\n },\n {\n job: 'Pages as data, and a builder that edits them',\n imports: ['composition', 'builder', 'mixins-builder'],\n guide: 'composition',\n },\n {\n job: 'Rich text: the document, its editor, Markdown and code',\n imports: [\n 'richtext',\n 'richtext-dom',\n 'mixins-richtext',\n 'richtext-markdown',\n 'richtext-code',\n 'richtext-code-shiki',\n ],\n guide: 'richtext',\n },\n { job: 'Server rendering that hands the Model over', imports: ['ssr'], guide: 'ssr' },\n { job: 'Route topology as data: nodes, typed targets, titles', imports: ['site'], guide: 'site' },\n {\n job: 'What an AI agent may see and do, over MCP, WebMCP, A2A or Agent Native',\n imports: ['agent', 'agent-mcp', 'agent-webmcp', 'agent-a2a', 'agent-native'],\n guide: 'agent',\n },\n {\n job: 'React components in a Foldkit view, or Foldkit inside React',\n imports: ['react', 'react-codegen'],\n guide: 'react',\n },\n]\n\n/**\n * The packages `foldkit-plus` does not install, since each needs a library of\n * its own, and that library. `test/setup.test.ts` holds this to the manifest.\n */\nexport const adapters: ReadonlyArray<{\n readonly name: string\n readonly libraries: ReadonlyArray<string>\n readonly when: string\n}> = [\n {\n name: 'foldkit-agent-native',\n libraries: ['@agent-native/core'],\n when: 'agents through Agent Native',\n },\n { name: 'foldkit-cms-drizzle', libraries: ['drizzle-orm'], when: \"the CMS's server on Drizzle\" },\n {\n name: 'foldkit-mixins-ui',\n libraries: ['@foldkit/ui'],\n when: 'styling `@foldkit/ui` components through slots',\n },\n { name: 'foldkit-react', libraries: ['react', 'react-dom'], when: 'React interop' },\n {\n name: 'foldkit-react-codegen',\n libraries: ['typescript'],\n when: 'compiling Foldkit views to React TSX (a dev dependency)',\n },\n {\n name: 'foldkit-remote-drizzle',\n libraries: ['drizzle-orm'],\n when: 'answering Remote reads with Drizzle',\n },\n {\n name: 'foldkit-richtext-code-shiki',\n libraries: ['shiki'],\n when: 'highlighting code blocks with Shiki',\n },\n]\n\n/** The command that adds `packages` with `manager`. */\nexport const addCommand = (manager: Manager, packages: ReadonlyArray<string>): string =>\n `${manager} ${manager === 'npm' ? 'install' : 'add'} ${packages.join(' ')}`\n\n/** The major version a range asks for: `^4.0.0`, `~4.1`, `4.0.0-beta.1` all ask for 4. */\nconst majorOf = (range: string): Option.Option<number> =>\n Option.fromNullishOr(/(\\d+)/.exec(range)?.[1]).pipe(Option.map(Number))\n\n/** What the project has of a library against what this release needs, as a line to act on. */\nconst finding = (project: Project, library: string, wanted: string): string =>\n Option.match(Option.fromNullishOr(project.versions[library]), {\n onNone: () => `- \\`${library}\\` is not installed: step 2 adds \\`${library}@${wanted}\\`.`,\n onSome: range => {\n // Foldkit is 0.x, where a minor version breaks; Effect is past 1.\n const matches =\n library === 'foldkit'\n ? range.replace(/^[\\^~=v]*/, '').startsWith(wanted.split('.').slice(0, 2).join('.'))\n : Option.getOrUndefined(majorOf(range)) === Option.getOrUndefined(majorOf(wanted))\n return matches\n ? `- \\`${library}\\` ${range}: fits.`\n : `- \\`${library}\\` is ${range}, and Foldkit Plus needs ${wanted}: step 2 moves it to ${wanted}. Check the application builds after.`\n },\n })\n\nexport const setupGuide = ({ project, manager, versions }: SetupInput): string => {\n const install = addCommand(manager, [\n `effect@${versions.effect}`,\n `foldkit@${versions.foldkit}`,\n `@effect/platform-browser@${versions.effect}`,\n 'foldkit-plus',\n ])\n const check = Option.match(project, {\n onNone: () => [\n 'There is no `package.json` here. Create the Foldkit application first (https://foldkit.dev shows how), then run `npx foldkit-plus setup` again in its folder.',\n ],\n onSome: found => [\n `This is \\`${found.name}\\`, installed with ${manager}.`,\n '',\n finding(found, 'effect', versions.effect),\n finding(found, 'foldkit', versions.foldkit),\n ],\n })\n return [\n `# Foldkit Plus ${versions.plus}: setup`,\n '',\n 'Instructions for a coding agent, in order. Each step says what to run and why. Tell the user what you did at the end.',\n '',\n '## What these are',\n '',\n '- **Effect** (https://effect.website): TypeScript for typed effects, errors, schemas and streams. Foldkit Plus targets Effect 4.',\n '- **Foldkit** (https://foldkit.dev): an application is one state machine on Effect, a Schema-typed `Model`, a `Message` union and one pure `update`; I/O runs in Commands and Subscriptions.',\n '- **Foldkit Plus**: packages that extend a Foldkit application to agents, servers, other devices, the URL and design systems without a second place to keep state. An agent sends only Messages `update` already handles; server data lives in the Model; replicas replay the same Messages; the URL mirrors a slice of the Model.',\n '',\n '## 1. Check the project',\n '',\n ...check,\n '',\n '## 2. Install',\n '',\n '```bash',\n install,\n '```',\n '',\n '`foldkit-plus` brings every package except the adapters below, each of which needs a library of its own. Add one only when the application needs it:',\n '',\n ...adapters.map(\n each => `- ${each.when}: \\`${addCommand(manager, [each.name, ...each.libraries])}\\``,\n ),\n '',\n '## 3. Add the agent skill',\n '',\n '```bash',\n 'npx skills add doeixd/foldkit-plus --skill foldkit-plus',\n '```',\n '',\n 'It teaches you which package owns which kind of state, when to reach for each, and a working example of each. Read its `SKILL.md` before writing code with Foldkit Plus, and the reference for the package at hand before changing it.',\n '',\n '## 4. Import',\n '',\n 'The namespaces most applications use come from the root:',\n '',\n '```ts',\n \"import { Surface, Projection, Remote, Sync, Mirror, Agent, Style } from 'foldkit-plus'\",\n '```',\n '',\n 'Everything else is a subpath named for its package, for example `foldkit-plus/remote-server` on the server, `foldkit-plus/sync/journal`, `foldkit-plus/mixins/theme`. Pick a package by who owns the data:',\n '',\n '| Job | Import from | Guide |',\n '| --- | --- | --- |',\n ...jobs.map(\n each =>\n `| ${each.job} | ${each.imports.map(name => `\\`foldkit-plus/${name}\\``).join(', ')} | ${SITE}/${each.guide} |`,\n ),\n '',\n '## 5. Rules every package keeps',\n '',\n '- One owner per datum: never keep a fact in the Model and again in a cache, a URL store or a second reducer.',\n '- Behaviour goes through Messages and `update`; agents, replicas and Behaviors never change the Model directly.',\n '- Rendering performs no I/O: fetching, syncing and mirroring run in Commands and Subscriptions.',\n '- Absence is an Effect `Option`, not `null`, except at a JSON, database or DOM boundary.',\n '',\n '## More',\n '',\n `- Guides and API: ${SITE}`,\n `- Demos: ${SITE}/demos`,\n `- Source and changelog: ${REPOSITORY}`,\n '',\n ].join('\\n')\n}\n"],"mappings":";;;;;;;AA6BA,MAAM,OAAO;AACb,MAAM,aAAa;;AAGnB,MAAa,OAIR;CACH;EACE,KAAK;EACL,SAAS,CAAC,WAAW,UAAU;EAC/B,OAAO;CACT;CACA;EACE,KAAK;EACL,SAAS,CAAC,UAAU,gBAAgB;EACpC,OAAO;CACT;CACA;EACE,KAAK;EACL,SAAS;GAAC;GAAU;GAAkB;EAAW;EACjD,OAAO;CACT;CACA;EACE,KAAK;EACL,SAAS,CAAC,YAAY;EACtB,OAAO;CACT;CACA;EACE,KAAK;EACL,SAAS,CAAC,QAAQ;EAClB,OAAO;CACT;CACA;EACE,KAAK;EACL,SAAS;GAAC;GAAU;GAAiB;E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;EACA;EACA;EACA;EACA,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG,SAAS,KACV,SAAQ,KAAK,KAAK,KAAK,MAAM,WAAW,SAAS,CAAC,KAAK,MAAM,GAAG,KAAK,SAAS,CAAC,EAAE,GACnF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG,KAAK,KACN,SACE,KAAK,KAAK,IAAI,KAAK,KAAK,QAAQ,KAAI,SAAQ,kBAAkB,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,KAAK,KAAK,GAAG,KAAK,MAAM,GAC/G;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB,YAAY,KAAK;EACjB,2BAA2B;EAC3B;CACF,CAAC,CAAC,KAAK,IAAI;AACb"}
|
|
1
|
+
{"version":3,"file":"setup.mjs","names":[],"sources":["../src/setup.ts"],"sourcesContent":["/**\n * What `npx foldkit-plus setup` prints: instructions a coding agent can follow\n * in order, for the project it is run in. Pure: the CLI reads the project and\n * this package's manifest and passes them in, so a test can give any project.\n */\nimport { Option } from 'effect'\n\nexport type Manager = 'pnpm' | 'npm' | 'yarn' | 'bun'\n\n/** What the project's `package.json` says about the libraries Foldkit Plus needs. */\nexport interface Project {\n readonly name: string\n /** Each named library's version range, from any dependency field. */\n readonly versions: Readonly<Record<string, string>>\n}\n\n/** The versions this release is built and tested against, from its own manifest. */\nexport interface Versions {\n readonly plus: string\n readonly effect: string\n readonly foldkit: string\n}\n\nexport interface SetupInput {\n readonly project: Option.Option<Project>\n readonly manager: Manager\n readonly versions: Versions\n}\n\nconst SITE = 'https://foldkit-plus.pages.dev'\nconst REPOSITORY = 'https://github.com/doeixd/foldkit-plus'\n\n/** What each job needs, where to import it from, and where it is explained. */\nexport const jobs: ReadonlyArray<{\n readonly job: string\n readonly imports: ReadonlyArray<string>\n readonly guide: string\n}> = [\n {\n job: 'Name what a feature may read and which Messages it may send',\n imports: ['surface', 'metadata'],\n guide: 'surface',\n },\n {\n job: 'A reusable Submodel placed several times, every part wired',\n imports: ['bundle', 'bundle-surface'],\n guide: 'bundle',\n },\n {\n job: 'Restyle or extend views from outside, through typed slots',\n imports: ['mixins', 'mixins-surface', 'mixins-ui'],\n guide: 'mixins',\n },\n {\n job: 'Media queries, timers, sockets, clipboard, undo history',\n imports: ['primitives'],\n guide: 'primitives',\n },\n {\n job: 'Declare the domain once: entities, relations, queries',\n imports: ['entity'],\n guide: 'entity',\n },\n {\n job: 'Server-owned data in the Model: queries, mutations, live updates',\n imports: ['remote', 'remote-server', 'remote-drizzle'],\n guide: 'remote',\n },\n {\n job: 'Edits that survive offline and converge across devices',\n imports: ['sync', 'durable'],\n guide: 'sync',\n },\n { job: 'Who may do what, enforced on every seam', imports: ['guard'], guide: 'guard' },\n {\n job: 'Who is signed in: a Yielded Auth session as the principal',\n imports: ['auth'],\n guide: 'auth',\n },\n {\n job: 'A slice of the Model kept in the URL or in storage',\n imports: ['mirror'],\n guide: 'mirror',\n },\n {\n job: 'Forms: drafts, validation, a decoded value',\n imports: ['form', 'mixins-form'],\n guide: 'form',\n },\n {\n job: 'Edit, create and list screens over Remote',\n imports: ['crud', 'mixins-crud'],\n guide: 'crud',\n },\n {\n job: 'An interactive data grid over rows you own',\n imports: ['data-grid', 'mixins-data-grid'],\n guide: 'data-grid',\n },\n {\n job: 'Drafts, revisions and publishing for content',\n imports: ['cms', 'cms-drizzle'],\n guide: 'cms',\n },\n {\n job: 'Pages as data, and a builder that edits them',\n imports: ['composition', 'builder', 'mixins-builder'],\n guide: 'composition',\n },\n {\n job: 'Rich text: the document, its editor, Markdown and code',\n imports: [\n 'richtext',\n 'richtext-dom',\n 'mixins-richtext',\n 'richtext-markdown',\n 'richtext-code',\n 'richtext-code-shiki',\n ],\n guide: 'richtext',\n },\n { job: 'Server rendering that hands the Model over', imports: ['ssr'], guide: 'ssr' },\n { job: 'Route topology as data: nodes, typed targets, titles', imports: ['site'], guide: 'site' },\n {\n job: 'What an AI agent may see and do, over MCP, WebMCP, A2A or Agent Native',\n imports: ['agent', 'agent-mcp', 'agent-webmcp', 'agent-a2a', 'agent-native'],\n guide: 'agent',\n },\n {\n job: 'React components in a Foldkit view, or Foldkit inside React',\n imports: ['react', 'react-codegen'],\n guide: 'react',\n },\n]\n\n/**\n * The packages `foldkit-plus` does not install, since each needs a library of\n * its own, and that library. `test/setup.test.ts` holds this to the manifest.\n */\nexport const adapters: ReadonlyArray<{\n readonly name: string\n readonly libraries: ReadonlyArray<string>\n readonly when: string\n}> = [\n {\n name: 'foldkit-agent-native',\n libraries: ['@agent-native/core'],\n when: 'agents through Agent Native',\n },\n {\n name: 'foldkit-auth',\n libraries: ['@yielded/auth'],\n when: 'sign-in and sessions with Yielded Auth',\n },\n { name: 'foldkit-cms-drizzle', libraries: ['drizzle-orm'], when: \"the CMS's server on Drizzle\" },\n {\n name: 'foldkit-mixins-ui',\n libraries: ['@foldkit/ui'],\n when: 'styling `@foldkit/ui` components through slots',\n },\n { name: 'foldkit-react', libraries: ['react', 'react-dom'], when: 'React interop' },\n {\n name: 'foldkit-react-codegen',\n libraries: ['typescript'],\n when: 'compiling Foldkit views to React TSX (a dev dependency)',\n },\n {\n name: 'foldkit-remote-drizzle',\n libraries: ['drizzle-orm'],\n when: 'answering Remote reads with Drizzle',\n },\n {\n name: 'foldkit-richtext-code-shiki',\n libraries: ['shiki'],\n when: 'highlighting code blocks with Shiki',\n },\n]\n\n/** The command that adds `packages` with `manager`. */\nexport const addCommand = (manager: Manager, packages: ReadonlyArray<string>): string =>\n `${manager} ${manager === 'npm' ? 'install' : 'add'} ${packages.join(' ')}`\n\n/** The major version a range asks for: `^4.0.0`, `~4.1`, `4.0.0-beta.1` all ask for 4. */\nconst majorOf = (range: string): Option.Option<number> =>\n Option.fromNullishOr(/(\\d+)/.exec(range)?.[1]).pipe(Option.map(Number))\n\n/** What the project has of a library against what this release needs, as a line to act on. */\nconst finding = (project: Project, library: string, wanted: string): string =>\n Option.match(Option.fromNullishOr(project.versions[library]), {\n onNone: () => `- \\`${library}\\` is not installed: step 2 adds \\`${library}@${wanted}\\`.`,\n onSome: range => {\n // Foldkit is 0.x, where a minor version breaks; Effect is past 1.\n const matches =\n library === 'foldkit'\n ? range.replace(/^[\\^~=v]*/, '').startsWith(wanted.split('.').slice(0, 2).join('.'))\n : Option.getOrUndefined(majorOf(range)) === Option.getOrUndefined(majorOf(wanted))\n return matches\n ? `- \\`${library}\\` ${range}: fits.`\n : `- \\`${library}\\` is ${range}, and Foldkit Plus needs ${wanted}: step 2 moves it to ${wanted}. Check the application builds after.`\n },\n })\n\nexport const setupGuide = ({ project, manager, versions }: SetupInput): string => {\n const install = addCommand(manager, [\n `effect@${versions.effect}`,\n `foldkit@${versions.foldkit}`,\n `@effect/platform-browser@${versions.effect}`,\n 'foldkit-plus',\n ])\n const check = Option.match(project, {\n onNone: () => [\n 'There is no `package.json` here. Create the Foldkit application first (https://foldkit.dev shows how), then run `npx foldkit-plus setup` again in its folder.',\n ],\n onSome: found => [\n `This is \\`${found.name}\\`, installed with ${manager}.`,\n '',\n finding(found, 'effect', versions.effect),\n finding(found, 'foldkit', versions.foldkit),\n ],\n })\n return [\n `# Foldkit Plus ${versions.plus}: setup`,\n '',\n 'Instructions for a coding agent, in order. Each step says what to run and why. Tell the user what you did at the end.',\n '',\n '## What these are',\n '',\n '- **Effect** (https://effect.website): TypeScript for typed effects, errors, schemas and streams. Foldkit Plus targets Effect 4.',\n '- **Foldkit** (https://foldkit.dev): an application is one state machine on Effect, a Schema-typed `Model`, a `Message` union and one pure `update`; I/O runs in Commands and Subscriptions.',\n '- **Foldkit Plus**: packages that extend a Foldkit application to agents, servers, other devices, the URL and design systems without a second place to keep state. An agent sends only Messages `update` already handles; server data lives in the Model; replicas replay the same Messages; the URL mirrors a slice of the Model.',\n '',\n '## 1. Check the project',\n '',\n ...check,\n '',\n '## 2. Install',\n '',\n '```bash',\n install,\n '```',\n '',\n '`foldkit-plus` brings every package except the adapters below, each of which needs a library of its own. Add one only when the application needs it:',\n '',\n ...adapters.map(\n each => `- ${each.when}: \\`${addCommand(manager, [each.name, ...each.libraries])}\\``,\n ),\n '',\n '## 3. Add the agent skill',\n '',\n '```bash',\n 'npx skills add doeixd/foldkit-plus --skill foldkit-plus',\n '```',\n '',\n 'It teaches you which package owns which kind of state, when to reach for each, and a working example of each. Read its `SKILL.md` before writing code with Foldkit Plus, and the reference for the package at hand before changing it.',\n '',\n '## 4. Import',\n '',\n 'The namespaces most applications use come from the root:',\n '',\n '```ts',\n \"import { Surface, Projection, Remote, Sync, Mirror, Agent, Style } from 'foldkit-plus'\",\n '```',\n '',\n 'Everything else is a subpath named for its package, for example `foldkit-plus/remote-server` on the server, `foldkit-plus/sync/journal`, `foldkit-plus/mixins/theme`. Pick a package by who owns the data:',\n '',\n '| Job | Import from | Guide |',\n '| --- | --- | --- |',\n ...jobs.map(\n each =>\n `| ${each.job} | ${each.imports.map(name => `\\`foldkit-plus/${name}\\``).join(', ')} | ${SITE}/${each.guide} |`,\n ),\n '',\n '## 5. Rules every package keeps',\n '',\n '- One owner per datum: never keep a fact in the Model and again in a cache, a URL store or a second reducer.',\n '- Behaviour goes through Messages and `update`; agents, replicas and Behaviors never change the Model directly.',\n '- Rendering performs no I/O: fetching, syncing and mirroring run in Commands and Subscriptions.',\n '- Absence is an Effect `Option`, not `null`, except at a JSON, database or DOM boundary.',\n '',\n '## More',\n '',\n `- Guides and API: ${SITE}`,\n `- Demos: ${SITE}/demos`,\n `- Source and changelog: ${REPOSITORY}`,\n '',\n ].join('\\n')\n}\n"],"mappings":";;;;;;;AA6BA,MAAM,OAAO;AACb,MAAM,aAAa;;AAGnB,MAAa,OAIR;CACH;EACE,KAAK;EACL,SAAS,CAAC,WAAW,UAAU;EAC/B,OAAO;CACT;CACA;EACE,KAAK;EACL,SAAS,CAAC,UAA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AAS;EAClC,UAAU,SAAS;EACnB,WAAW,SAAS;EACpB,4BAA4B,SAAS;EACrC;CACF,CAAC;CACD,MAAM,QAAQ,OAAO,MAAM,SAAS;EAClC,cAAc,CACZ,+JACF;EACA,SAAQ,UAAS;GACf,aAAa,MAAM,KAAK,qBAAqB,QAAQ;GACrD;GACA,QAAQ,OAAO,UAAU,SAAS,MAAM;GACxC,QAAQ,OAAO,WAAW,SAAS,OAAO;EAC5C;CACF,CAAC;CACD,OAAO;EACL,kBAAkB,SAAS,KAAK;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG,SAAS,KACV,SAAQ,KAAK,KAAK,KAAK,MAAM,WAAW,SAAS,CAAC,KAAK,MAAM,GAAG,KAAK,SAAS,CAAC,EAAE,GACnF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG,KAAK,KACN,SACE,KAAK,KAAK,IAAI,KAAK,KAAK,QAAQ,KAAI,SAAQ,kBAAkB,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,KAAK,KAAK,GAAG,KAAK,MAAM,GAC/G;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB,YAAY,KAAK;EACjB,2BAA2B;EAC3B;CACF,CAAC,CAAC,KAAK,IAAI;AACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-plus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Every Foldkit Plus package in one install, and `npx foldkit-plus setup`, which tells a coding agent how to start.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -58,6 +58,16 @@
|
|
|
58
58
|
"types": "./dist/agent-webmcp.d.mts",
|
|
59
59
|
"import": "./dist/agent-webmcp.mjs"
|
|
60
60
|
},
|
|
61
|
+
"./auth": {
|
|
62
|
+
"foldkit-plus:source": "./src/auth.ts",
|
|
63
|
+
"types": "./dist/auth.d.mts",
|
|
64
|
+
"import": "./dist/auth.mjs"
|
|
65
|
+
},
|
|
66
|
+
"./auth/server": {
|
|
67
|
+
"foldkit-plus:source": "./src/auth/server.ts",
|
|
68
|
+
"types": "./dist/auth/server.d.mts",
|
|
69
|
+
"import": "./dist/auth/server.mjs"
|
|
70
|
+
},
|
|
61
71
|
"./builder": {
|
|
62
72
|
"foldkit-plus:source": "./src/builder.ts",
|
|
63
73
|
"types": "./dist/builder.d.mts",
|
|
@@ -497,55 +507,59 @@
|
|
|
497
507
|
"dependencies": {
|
|
498
508
|
"foldkit-agent": "0.8.1",
|
|
499
509
|
"foldkit-agent-a2a": "0.6.1",
|
|
500
|
-
"foldkit-
|
|
501
|
-
"foldkit-
|
|
502
|
-
"foldkit-agent-mcp": "0.6.1",
|
|
510
|
+
"foldkit-builder": "0.3.2",
|
|
511
|
+
"foldkit-agent-mcp": "0.7.0",
|
|
503
512
|
"foldkit-bundle": "0.8.0",
|
|
504
513
|
"foldkit-bundle-surface": "0.4.1",
|
|
505
|
-
"foldkit-
|
|
506
|
-
"foldkit-
|
|
514
|
+
"foldkit-agent-webmcp": "0.7.1",
|
|
515
|
+
"foldkit-cms": "0.7.2",
|
|
516
|
+
"foldkit-composition": "0.3.2",
|
|
517
|
+
"foldkit-data-grid": "0.2.2",
|
|
518
|
+
"foldkit-crud": "0.8.2",
|
|
507
519
|
"foldkit-durable": "0.9.0",
|
|
508
|
-
"foldkit-composition": "0.3.1",
|
|
509
520
|
"foldkit-entity": "0.10.0",
|
|
510
|
-
"foldkit-form": "0.6.0",
|
|
511
521
|
"foldkit-metadata": "0.1.0",
|
|
512
|
-
"foldkit-data-grid": "0.2.1",
|
|
513
|
-
"foldkit-guard": "0.2.1",
|
|
514
|
-
"foldkit-mixins": "0.11.0",
|
|
515
|
-
"foldkit-mixins-builder": "0.3.1",
|
|
516
|
-
"foldkit-mixins-crud": "0.7.1",
|
|
517
522
|
"foldkit-mirror": "0.6.1",
|
|
518
|
-
"foldkit-
|
|
523
|
+
"foldkit-form": "0.6.0",
|
|
524
|
+
"foldkit-mixins": "0.11.0",
|
|
525
|
+
"foldkit-mixins-data-grid": "0.2.2",
|
|
519
526
|
"foldkit-mixins-form": "0.6.1",
|
|
520
|
-
"foldkit-mixins-richtext": "0.3.
|
|
527
|
+
"foldkit-mixins-richtext": "0.3.2",
|
|
528
|
+
"foldkit-mixins-crud": "0.7.2",
|
|
521
529
|
"foldkit-mixins-surface": "0.6.1",
|
|
522
|
-
"foldkit-primitives": "0.10.
|
|
523
|
-
"foldkit-remote
|
|
524
|
-
"foldkit-remote": "0.
|
|
525
|
-
"foldkit-
|
|
526
|
-
"foldkit-richtext-dom": "0.4.1",
|
|
527
|
-
"foldkit-site": "0.3.1",
|
|
530
|
+
"foldkit-primitives": "0.10.2",
|
|
531
|
+
"foldkit-remote": "0.18.0",
|
|
532
|
+
"foldkit-remote-server": "0.14.0",
|
|
533
|
+
"foldkit-mixins-builder": "0.3.2",
|
|
528
534
|
"foldkit-richtext": "0.3.0",
|
|
535
|
+
"foldkit-richtext-code": "0.2.0",
|
|
529
536
|
"foldkit-richtext-markdown": "0.2.1",
|
|
530
|
-
"foldkit-
|
|
537
|
+
"foldkit-richtext-dom": "0.4.1",
|
|
538
|
+
"foldkit-ssr": "0.7.0",
|
|
531
539
|
"foldkit-surface": "0.10.0",
|
|
532
|
-
"foldkit-
|
|
540
|
+
"foldkit-guard": "0.3.0",
|
|
541
|
+
"foldkit-site": "0.4.0",
|
|
542
|
+
"foldkit-sync": "0.12.0"
|
|
533
543
|
},
|
|
534
544
|
"peerDependencies": {
|
|
535
545
|
"effect": "^4.0.0",
|
|
536
546
|
"foldkit": "^0.168.0",
|
|
537
547
|
"foldkit-agent-native": "^0.6.1",
|
|
538
|
-
"foldkit-
|
|
539
|
-
"foldkit-react-codegen": "^0.3.0",
|
|
540
|
-
"foldkit-cms-drizzle": "^0.6.4",
|
|
548
|
+
"foldkit-auth": "^0.1.0",
|
|
541
549
|
"foldkit-react": "^0.4.0",
|
|
542
|
-
"foldkit-
|
|
543
|
-
"foldkit-
|
|
550
|
+
"foldkit-react-codegen": "^0.3.0",
|
|
551
|
+
"foldkit-cms-drizzle": "^0.6.5",
|
|
552
|
+
"foldkit-mixins-ui": "^0.10.0",
|
|
553
|
+
"foldkit-richtext-code-shiki": "^0.2.0",
|
|
554
|
+
"foldkit-remote-drizzle": "^0.12.2"
|
|
544
555
|
},
|
|
545
556
|
"peerDependenciesMeta": {
|
|
546
557
|
"foldkit-agent-native": {
|
|
547
558
|
"optional": true
|
|
548
559
|
},
|
|
560
|
+
"foldkit-auth": {
|
|
561
|
+
"optional": true
|
|
562
|
+
},
|
|
549
563
|
"foldkit-cms-drizzle": {
|
|
550
564
|
"optional": true
|
|
551
565
|
},
|
|
@@ -571,13 +585,14 @@
|
|
|
571
585
|
"tsdown": "^0.23.1",
|
|
572
586
|
"tsx": "^4.23.15",
|
|
573
587
|
"typescript": "7.0.2",
|
|
574
|
-
"foldkit-
|
|
575
|
-
"foldkit-cms-drizzle": "0.6.4",
|
|
588
|
+
"foldkit-cms-drizzle": "0.6.5",
|
|
576
589
|
"foldkit-mixins-ui": "0.10.0",
|
|
590
|
+
"foldkit-agent-native": "0.6.1",
|
|
591
|
+
"foldkit-auth": "0.1.0",
|
|
577
592
|
"foldkit-react": "0.4.0",
|
|
578
|
-
"foldkit-
|
|
579
|
-
"foldkit-
|
|
580
|
-
"foldkit-
|
|
593
|
+
"foldkit-react-codegen": "0.3.0",
|
|
594
|
+
"foldkit-remote-drizzle": "0.12.2",
|
|
595
|
+
"foldkit-richtext-code-shiki": "0.2.0"
|
|
581
596
|
},
|
|
582
597
|
"setup": {
|
|
583
598
|
"foldkit": "0.168.0",
|