create-cogitato 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +12 -2
- package/bin/create-cogitato.js +4 -0
- package/dist/create.d.ts +26 -0
- package/dist/create.js +90 -0
- package/dist/create.js.map +1 -0
- package/package.json +38 -3
- package/template/.claude/settings.json +16 -0
- package/template/.env.example +2 -0
- package/template/CLAUDE.md +34 -0
- package/template/README.md +19 -0
- package/template/_gitignore +3 -0
- package/template/design/contract/components/banner.json +22 -0
- package/template/design/contract/components/button.json +27 -0
- package/template/design/contract/components/card.json +18 -0
- package/template/design/contract/components/input.json +27 -0
- package/template/design/contract/components/stack.json +16 -0
- package/template/design/contract/components/text.json +19 -0
- package/template/design/contract/contract.json +12 -0
- package/template/design/contract/decisions.json +41 -0
- package/template/design/contract/gaps.json +16 -0
- package/template/design/contract/rules.md +19 -0
- package/template/design/contract/tokens.json +126 -0
- package/template/design/flows.json +121 -0
- package/template/index.html +12 -0
- package/template/netlify.toml +28 -0
- package/template/package.json +30 -0
- package/template/pnpm-workspace.yaml +2 -0
- package/template/src/components/Page.module.css +5 -0
- package/template/src/components/Page.tsx +30 -0
- package/template/src/flows.ts +18 -0
- package/template/src/kit/Banner.module.css +48 -0
- package/template/src/kit/Banner.tsx +40 -0
- package/template/src/kit/Button.module.css +86 -0
- package/template/src/kit/Button.tsx +43 -0
- package/template/src/kit/Card.module.css +22 -0
- package/template/src/kit/Card.tsx +18 -0
- package/template/src/kit/Input.module.css +43 -0
- package/template/src/kit/Input.tsx +52 -0
- package/template/src/kit/Stack.tsx +30 -0
- package/template/src/kit/Text.module.css +32 -0
- package/template/src/kit/Text.tsx +19 -0
- package/template/src/main.tsx +11 -0
- package/template/src/mocks/cart.ts +43 -0
- package/template/src/screens/cart/screen.tsx +67 -0
- package/template/src/screens/checkout/confirmation/screen.tsx +34 -0
- package/template/src/screens/checkout/payment/screen.tsx +77 -0
- package/template/src/screens/checkout/shipping/screen.tsx +60 -0
- package/template/src/styles/global.css +12 -0
- package/template/tsconfig.json +17 -0
- package/template/vite.config.ts +7 -0
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,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# create-cogitato
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Start a new [Cogitato](https://github.com/JaffeJoseph/cogitato) prototype:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm create cogitato@latest my-prototype
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
It copies the prototype template into `my-prototype/`, pinned to this release of the `@cogitato/*` packages, then installs it (if pnpm is available) and starts its git history. Then open the folder in Claude Code and describe your first screen.
|
|
10
|
+
|
|
11
|
+
Options (after `--` with npm): `--no-install`, `--no-git`.
|
|
12
|
+
|
|
13
|
+
The template starts with the Acme Shop example design system in `design/contract/`. Replace it with your team's contract and kit components when you're ready.
|
package/dist/create.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const TEMPLATE_DIR: string;
|
|
2
|
+
export interface CreateOptions {
|
|
3
|
+
/** Folder to create. */
|
|
4
|
+
target: string;
|
|
5
|
+
/** Run `pnpm install` when pnpm is available. Default true. */
|
|
6
|
+
install?: boolean;
|
|
7
|
+
/** Start git history with a first commit. Default true. */
|
|
8
|
+
git?: boolean;
|
|
9
|
+
log?: (message: string) => void;
|
|
10
|
+
/** For tests. */
|
|
11
|
+
templateDir?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CreateResult {
|
|
14
|
+
dir: string;
|
|
15
|
+
name: string;
|
|
16
|
+
installed: boolean;
|
|
17
|
+
git: "committed" | "initialized" | "skipped";
|
|
18
|
+
}
|
|
19
|
+
export declare class CreateError extends Error {
|
|
20
|
+
name: string;
|
|
21
|
+
}
|
|
22
|
+
/** A package name from the folder name: "My Checkout" -> "my-checkout". */
|
|
23
|
+
export declare function packageName(folder: string): string;
|
|
24
|
+
export declare function createPrototype(opts: CreateOptions): CreateResult;
|
|
25
|
+
/** CLI entry. Returns the exit code. */
|
|
26
|
+
export declare function main(argv: string[]): Promise<number>;
|
package/dist/create.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { cpSync, existsSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
// `npm create cogitato@latest my-prototype`: a new prototype from the bundled template, pinned to
|
|
6
|
+
// this release. Messages are for designers as much as developers: plain words, no jargon.
|
|
7
|
+
export const TEMPLATE_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "template");
|
|
8
|
+
export class CreateError extends Error {
|
|
9
|
+
name = "CreateError";
|
|
10
|
+
}
|
|
11
|
+
/** A package name from the folder name: "My Checkout" -> "my-checkout". */
|
|
12
|
+
export function packageName(folder) {
|
|
13
|
+
return basename(folder).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "") || "my-prototype";
|
|
14
|
+
}
|
|
15
|
+
// pnpm is a .cmd shim on Windows, so it needs a shell there; git is a real executable and must not
|
|
16
|
+
// get one, or arguments with spaces (the commit message) are split up.
|
|
17
|
+
const needsShell = (cmd) => process.platform === "win32" && cmd !== "git";
|
|
18
|
+
const has = (cmd) => spawnSync(cmd, ["--version"], { stdio: "ignore", shell: needsShell(cmd) }).status === 0;
|
|
19
|
+
const run = (cmd, args, cwd) => spawnSync(cmd, args, { cwd, stdio: "inherit", shell: needsShell(cmd) }).status === 0;
|
|
20
|
+
export function createPrototype(opts) {
|
|
21
|
+
const log = opts.log ?? (() => { });
|
|
22
|
+
const template = opts.templateDir ?? TEMPLATE_DIR;
|
|
23
|
+
if (!existsSync(template))
|
|
24
|
+
throw new CreateError("This copy of create-cogitato has no template in it. Reinstall it, or report the problem.");
|
|
25
|
+
const dir = resolve(opts.target);
|
|
26
|
+
if (existsSync(dir) && readdirSync(dir).length) {
|
|
27
|
+
throw new CreateError(`The folder "${opts.target}" already has files in it. Pick a new folder name.`);
|
|
28
|
+
}
|
|
29
|
+
cpSync(template, dir, { recursive: true });
|
|
30
|
+
if (existsSync(join(dir, "_gitignore")))
|
|
31
|
+
renameSync(join(dir, "_gitignore"), join(dir, ".gitignore"));
|
|
32
|
+
const name = packageName(dir);
|
|
33
|
+
const pkgPath = join(dir, "package.json");
|
|
34
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
35
|
+
writeFileSync(pkgPath, JSON.stringify({ ...pkg, name }, null, 2) + "\n");
|
|
36
|
+
log(`Created the prototype in ${dir}.`);
|
|
37
|
+
let installed = false;
|
|
38
|
+
if (opts.install !== false) {
|
|
39
|
+
if (has("pnpm")) {
|
|
40
|
+
log("Installing its parts (this takes a minute)...");
|
|
41
|
+
installed = run("pnpm", ["install"], dir);
|
|
42
|
+
if (!installed)
|
|
43
|
+
log("Installing didn't finish. Open the folder in Claude Code and ask it to set up this computer.");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
log("pnpm isn't installed, so the prototype's parts weren't installed yet. Claude can do it: open the folder and ask it to set up this computer.");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
let git = "skipped";
|
|
50
|
+
if (opts.git !== false && has("git")) {
|
|
51
|
+
if (run("git", ["init", "-q"], dir)) {
|
|
52
|
+
git = "initialized";
|
|
53
|
+
if (run("git", ["add", "-A"], dir) && run("git", ["commit", "-q", "-m", "Start the prototype from Cogitato"], dir))
|
|
54
|
+
git = "committed";
|
|
55
|
+
// Usually git doesn't know your name and email yet. Saving a version later sorts it out.
|
|
56
|
+
else
|
|
57
|
+
log("Git history is started, but the first save didn't happen. That's fine: open the folder in Claude Code and ask it to set up this computer.");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return { dir, name, installed, git };
|
|
61
|
+
}
|
|
62
|
+
const USAGE = `Start a new Cogitato prototype.
|
|
63
|
+
|
|
64
|
+
npm create cogitato@latest <folder> [-- --no-install] [--no-git]
|
|
65
|
+
|
|
66
|
+
Then open the folder in Claude Code and describe your first screen.`;
|
|
67
|
+
/** CLI entry. Returns the exit code. */
|
|
68
|
+
export async function main(argv) {
|
|
69
|
+
const flags = new Set(argv.filter((a) => a.startsWith("--")));
|
|
70
|
+
const [target] = argv.filter((a) => !a.startsWith("--"));
|
|
71
|
+
if (flags.has("--help") || !target) {
|
|
72
|
+
console.log(USAGE);
|
|
73
|
+
return target ? 0 : 1;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const r = createPrototype({ target, install: !flags.has("--no-install"), git: !flags.has("--no-git"), log: console.log });
|
|
77
|
+
console.log([
|
|
78
|
+
"",
|
|
79
|
+
`Your prototype "${r.name}" is ready.`,
|
|
80
|
+
`Next: open ${r.dir} in Claude Code, and describe the first screen you want, like "add a sign-up screen".`,
|
|
81
|
+
"It starts with the Acme Shop example design system; swap in your own in design/contract/.",
|
|
82
|
+
].join("\n"));
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
console.error(e instanceof Error ? e.message : String(e));
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"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|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cogitato",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Start a new Cogitato prototype: `npm create cogitato@latest my-prototype`",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/JaffeJoseph/cogitato.git",
|
|
9
|
+
"directory": "packages/create-cogitato"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/JaffeJoseph/cogitato/tree/main/packages/create-cogitato#readme",
|
|
12
|
+
"bugs": "https://github.com/JaffeJoseph/cogitato/issues",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "./dist/create.js",
|
|
18
|
+
"types": "./dist/create.d.ts",
|
|
19
|
+
"bin": {
|
|
20
|
+
"create-cogitato": "./bin/create-cogitato.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"bin",
|
|
24
|
+
"dist",
|
|
25
|
+
"template"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^22.10.0",
|
|
29
|
+
"typescript": "^5.7.2",
|
|
30
|
+
"vitest": "^3.0.0"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"provenance": true
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.build.json && node scripts/bundle-template.mjs",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
+
"test": "vitest run"
|
|
40
|
+
}
|
|
6
41
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"extraKnownMarketplaces": {
|
|
4
|
+
"cogitato": {
|
|
5
|
+
"source": {
|
|
6
|
+
"source": "github",
|
|
7
|
+
"repo": "JaffeJoseph/cogitato",
|
|
8
|
+
"sparsePaths": [".claude-plugin", "plugin"]
|
|
9
|
+
},
|
|
10
|
+
"autoUpdate": true
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"enabledPlugins": {
|
|
14
|
+
"cogitato@cogitato": true
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Prototype: notes for Claude Code
|
|
2
|
+
|
|
3
|
+
This is a Cogitato prototype. The person working here is usually a designer, not a developer:
|
|
4
|
+
explain things in plain language, and never ask them to run commands.
|
|
5
|
+
|
|
6
|
+
## The design contract is the rulebook
|
|
7
|
+
- `design/contract/` defines what this prototype may use: tokens (`tokens.json`), components (`components/*.json`), and do's and don'ts (`rules.md`). Read `rules.md` first.
|
|
8
|
+
- Only use components from `@/kit/...` that have a manifest in `design/contract/components/`.
|
|
9
|
+
- Only use token CSS variables for colors, font sizes, spacing and radii: `var(--kit-color-brand-600)`, `var(--kit-space-4)`. The variable name is `--kit-` plus the token path with dots turned into dashes.
|
|
10
|
+
- If something the design needs isn't in the kit, don't improvise. Say so, and record it in `design/contract/gaps.json`.
|
|
11
|
+
|
|
12
|
+
## How screens work
|
|
13
|
+
- One folder per screen under `src/screens/`, with a `screen.tsx` that default-exports `defineScreen({ id, route, title, fixtures, component })`.
|
|
14
|
+
- Write `id`, `route`, `title`, the fixture names and fixture titles as plain text. Cogitato reads them without running the code.
|
|
15
|
+
- Every screen has a `default` fixture. Other fixtures are its states ("card-declined"); `?fixture=<name>` opens one.
|
|
16
|
+
- Read state data with `useFixture()`. Move between states with `useGoToState()("screen.id.state")`.
|
|
17
|
+
- Every interactive element (and every kit component with an `on...` prop) needs `data-kit-id="{screen id}.{element name}"`, e.g. `checkout.payment.submit`. Keep ids stable: comments are pinned to them.
|
|
18
|
+
- `src/flows.ts` lists how states connect. Add an edge when you add a way to move between states.
|
|
19
|
+
|
|
20
|
+
## Cogitato tools
|
|
21
|
+
With the Cogitato plugin on, prefer its tools over reading or hand-editing files:
|
|
22
|
+
- The kit MCP tools `list_components`, `get_component` and `get_tokens` describe the contract.
|
|
23
|
+
- `create_screen` and `add_state` scaffold screens and states.
|
|
24
|
+
- `log_gap` records what's missing.
|
|
25
|
+
- `validate` checks your work, and `canvas_link` gives the link to show: the state's frame on the canvas (`/__canvas`), among the rest of the flow.
|
|
26
|
+
- `set_status` marks states as in review, approved or handed off on the canvas.
|
|
27
|
+
- The skills `new-screen`, `add-state`, `save-version` and `setup-machine` walk through the common requests.
|
|
28
|
+
- Every edit under `src/` is checked automatically, and problems come back right away. Fix them in the same turn.
|
|
29
|
+
- **When asked for something off the kit** ("just make it red"), don't hardcode it. Explain briefly, offer the nearest token or component, and log a gap if the design really needs something new.
|
|
30
|
+
|
|
31
|
+
## Checking work
|
|
32
|
+
- `pnpm kit validate` checks everything; fix every problem it reports before finishing.
|
|
33
|
+
- `design/flows.json` (the canvas reads it) is generated from the screens and `src/flows.ts`. With the Cogitato plugin on, it updates itself after every edit; otherwise run `pnpm kit export-flows`. Never edit it by hand, and commit it.
|
|
34
|
+
- `pnpm dev` runs the prototype; `/__kit` shows the design kit.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Your prototype
|
|
2
|
+
|
|
3
|
+
A coded prototype made with [Cogitato](https://github.com/JaffeJoseph/cogitato): real screens and states, built from plain-language requests in Claude Code and kept to your team's design system.
|
|
4
|
+
|
|
5
|
+
## Working on it
|
|
6
|
+
- Open this folder in Claude Code and describe what you want: "add a review screen before payment", "show what happens when the card is expired". If anything's missing on this computer, Claude offers to set it up.
|
|
7
|
+
- **See every screen:** the canvas at http://localhost:5173/__canvas shows each state as a frame, laid out as your flows. The design kit is at `/__kit`.
|
|
8
|
+
- **Save a version:** ask Claude to "save a version". Your work goes on your own design branch.
|
|
9
|
+
|
|
10
|
+
## The design system
|
|
11
|
+
`design/contract/` is the rulebook: tokens, components and do's and don'ts. This prototype starts with **Acme Shop**, an example design system, so there's something to build with right away.
|
|
12
|
+
|
|
13
|
+
To use your team's own design system, replace `design/contract/` and the matching components in `src/kit/`. Then run `pnpm kit validate` to check the result. (Generating a contract from your existing code, Figma or brand docs is coming.)
|
|
14
|
+
|
|
15
|
+
## For developers
|
|
16
|
+
- `pnpm dev`: the prototype, with the canvas and kit pages.
|
|
17
|
+
- `pnpm kit validate`: checks code and contract against the design system.
|
|
18
|
+
- `pnpm build`: a production build in `dist/`, with snapshots for the canvas (needs `npx playwright install chromium` once).
|
|
19
|
+
- `netlify.toml` deploys a preview per branch, with its canvas at `/__canvas`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@cogitato/contract/schema/component.schema.json",
|
|
3
|
+
"name": "Banner",
|
|
4
|
+
"description": "Inline message about the state of a page or form.",
|
|
5
|
+
"source": "figma",
|
|
6
|
+
"confidence": "medium",
|
|
7
|
+
"import": "@/kit/Banner",
|
|
8
|
+
"props": {
|
|
9
|
+
"tone": { "type": "enum", "values": ["info", "success", "warning", "danger"], "default": "info" },
|
|
10
|
+
"title": { "type": "string" },
|
|
11
|
+
"children": { "type": "node", "required": true },
|
|
12
|
+
"onDismiss": { "type": "event", "description": "Shows a close button when set." }
|
|
13
|
+
},
|
|
14
|
+
"states": ["default"],
|
|
15
|
+
"rules": [
|
|
16
|
+
"Place at the top of the content it refers to.",
|
|
17
|
+
"Danger banners say what to do next, not just what went wrong."
|
|
18
|
+
],
|
|
19
|
+
"mapping": {
|
|
20
|
+
"figma": { "componentKey": "c3d8f1a07e25", "nodeId": "1204:388" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@cogitato/contract/schema/component.schema.json",
|
|
3
|
+
"name": "Button",
|
|
4
|
+
"description": "Triggers an action. Use primary for the main action on a view.",
|
|
5
|
+
"source": "production",
|
|
6
|
+
"confidence": "high",
|
|
7
|
+
"import": "@/kit/Button",
|
|
8
|
+
"props": {
|
|
9
|
+
"variant": { "type": "enum", "values": ["primary", "secondary", "ghost", "danger"], "default": "primary" },
|
|
10
|
+
"size": { "type": "enum", "values": ["sm", "md", "lg"], "default": "md" },
|
|
11
|
+
"disabled": { "type": "boolean", "default": false },
|
|
12
|
+
"loading": { "type": "boolean", "default": false, "description": "Shows a spinner and blocks presses." },
|
|
13
|
+
"fullWidth": { "type": "boolean", "default": false },
|
|
14
|
+
"children": { "type": "node", "required": true, "description": "Button label." },
|
|
15
|
+
"onPress": { "type": "event" }
|
|
16
|
+
},
|
|
17
|
+
"states": ["default", "hover", "focus", "disabled", "loading"],
|
|
18
|
+
"rules": [
|
|
19
|
+
"One primary button per view.",
|
|
20
|
+
"Labels are verbs: \"Pay now\", not \"OK\".",
|
|
21
|
+
"Use danger only for destructive actions."
|
|
22
|
+
],
|
|
23
|
+
"mapping": {
|
|
24
|
+
"production": { "path": "src/ui/Button.tsx", "export": "Button" },
|
|
25
|
+
"figma": { "componentKey": "a1f0c3e9b2d4" }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@cogitato/contract/schema/component.schema.json",
|
|
3
|
+
"name": "Card",
|
|
4
|
+
"description": "Groups related content on a surface.",
|
|
5
|
+
"source": "production",
|
|
6
|
+
"confidence": "medium",
|
|
7
|
+
"import": "@/kit/Card",
|
|
8
|
+
"props": {
|
|
9
|
+
"padding": { "type": "enum", "values": ["sm", "md", "lg"], "default": "md" },
|
|
10
|
+
"elevation": { "type": "enum", "values": ["flat", "raised"], "default": "flat" },
|
|
11
|
+
"children": { "type": "node", "required": true }
|
|
12
|
+
},
|
|
13
|
+
"states": ["default"],
|
|
14
|
+
"rules": ["Don't nest cards."],
|
|
15
|
+
"mapping": {
|
|
16
|
+
"production": { "path": "src/ui/Card.tsx", "export": "Card" }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@cogitato/contract/schema/component.schema.json",
|
|
3
|
+
"name": "Input",
|
|
4
|
+
"description": "Single-line text field with a label, hint and error message.",
|
|
5
|
+
"source": "production",
|
|
6
|
+
"confidence": "high",
|
|
7
|
+
"import": "@/kit/Input",
|
|
8
|
+
"props": {
|
|
9
|
+
"label": { "type": "string", "required": true },
|
|
10
|
+
"type": { "type": "enum", "values": ["text", "email", "password", "number", "tel"], "default": "text" },
|
|
11
|
+
"value": { "type": "string" },
|
|
12
|
+
"placeholder": { "type": "string" },
|
|
13
|
+
"hint": { "type": "string", "description": "Help text shown under the field." },
|
|
14
|
+
"error": { "type": "string", "description": "Error text. Setting it shows the error state." },
|
|
15
|
+
"disabled": { "type": "boolean", "default": false },
|
|
16
|
+
"onChange": { "type": "event" }
|
|
17
|
+
},
|
|
18
|
+
"states": ["default", "focus", "filled", "error", "disabled"],
|
|
19
|
+
"rules": [
|
|
20
|
+
"Always set a label, even if it is visually hidden.",
|
|
21
|
+
"Error messages say how to fix the problem."
|
|
22
|
+
],
|
|
23
|
+
"mapping": {
|
|
24
|
+
"production": { "path": "src/ui/forms/TextInput.tsx", "export": "TextInput" },
|
|
25
|
+
"figma": { "componentKey": "b7e2d9a14c60" }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@cogitato/contract/schema/component.schema.json",
|
|
3
|
+
"name": "Stack",
|
|
4
|
+
"description": "Lays out children in a row or column with token spacing. Use instead of custom margins.",
|
|
5
|
+
"source": "generated",
|
|
6
|
+
"confidence": "low",
|
|
7
|
+
"import": "@/kit/Stack",
|
|
8
|
+
"props": {
|
|
9
|
+
"direction": { "type": "enum", "values": ["row", "column"], "default": "column" },
|
|
10
|
+
"gap": { "type": "enum", "values": ["0", "1", "2", "3", "4", "6", "8"], "default": "4", "description": "Step on the space scale." },
|
|
11
|
+
"align": { "type": "enum", "values": ["start", "center", "end", "stretch"], "default": "stretch" },
|
|
12
|
+
"children": { "type": "node", "required": true }
|
|
13
|
+
},
|
|
14
|
+
"states": ["default"],
|
|
15
|
+
"rules": ["Use gap for spacing between items; don't add margins to children."]
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@cogitato/contract/schema/component.schema.json",
|
|
3
|
+
"name": "Text",
|
|
4
|
+
"description": "All text. Picks typography and color from tokens.",
|
|
5
|
+
"source": "production",
|
|
6
|
+
"confidence": "high",
|
|
7
|
+
"import": "@/kit/Text",
|
|
8
|
+
"props": {
|
|
9
|
+
"variant": { "type": "enum", "values": ["body", "label", "heading"], "default": "body" },
|
|
10
|
+
"tone": { "type": "enum", "values": ["default", "muted", "danger", "inverse"], "default": "default" },
|
|
11
|
+
"as": { "type": "enum", "values": ["p", "span", "h1", "h2", "h3", "label"], "default": "p" },
|
|
12
|
+
"children": { "type": "node", "required": true }
|
|
13
|
+
},
|
|
14
|
+
"states": ["default"],
|
|
15
|
+
"rules": ["One h1 per screen."],
|
|
16
|
+
"mapping": {
|
|
17
|
+
"production": { "path": "src/ui/Text.tsx", "export": "Text" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/@cogitato/contract/schema/contract.schema.json",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"name": "Acme Shop",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"description": "Reference contract for an invented e-commerce product. Hand-written to exercise every Cogitato format before intake exists.",
|
|
7
|
+
"sources": [
|
|
8
|
+
{ "kind": "manual", "ref": "Hand-written reference contract (ADR 003)" },
|
|
9
|
+
{ "kind": "code", "ref": "acme/shop-web: src/ui", "importedAt": "2026-11-01T00:00:00Z" },
|
|
10
|
+
{ "kind": "figma", "ref": "Acme Shop Library", "importedAt": "2026-11-01T00:00:00Z" }
|
|
11
|
+
]
|
|
12
|
+
}
|