create-modoock-app 1.0.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -237
- package/dist/cli.js +112 -43
- package/package.json +22 -22
- package/template/.cursor/hooks/gate-ui-pack.mjs +108 -0
- package/template/.cursor/hooks.json +18 -0
- package/template/.cursor/rules/honey.mdc +11 -3
- package/template/AGENTS.md +13 -12
- package/template/README.md +225 -175
- package/template/app/(local)/components/page.tsx +3 -3
- package/template/app/(local)/design-system/page.tsx +2 -2
- package/template/components/layout/app-layout.tsx +17 -6
- package/template/components/layout/header.tsx +19 -1
- package/template/components/layout/side-nav.tsx +103 -30
- package/template/postcss.config.mjs +7 -7
- package/template/public/identity/full_logo_black.svg +26 -26
- package/template/public/identity/full_logo_color.svg +37 -37
- package/template/public/identity/full_logo_white.svg +33 -33
- package/template/public/identity/logo_icon_black.svg +5 -5
- package/template/public/identity/logo_icon_color.svg +12 -12
- package/template/public/identity/logo_icon_white.svg +12 -12
- package/template/components/ui/action-stack.tsx +0 -42
- package/template/components/ui/badge.tsx +0 -43
- package/template/components/ui/button.tsx +0 -104
- package/template/components/ui/icon.tsx +0 -78
- package/template/components/ui/index.ts +0 -28
- package/template/components/ui/input.tsx +0 -376
- package/template/components/ui/loader.tsx +0 -78
- package/template/components/ui/metric-bar.tsx +0 -49
- package/template/components/ui/modal.tsx +0 -177
- package/template/components/ui/select.tsx +0 -458
- package/template/components/ui/stepper.tsx +0 -96
- package/template/components/ui/tab.tsx +0 -85
- package/template/components/ui/user-table.tsx +0 -806
- package/template/knowledge-base/design-system/components/action-stack.mdc +0 -17
- package/template/knowledge-base/design-system/components/badges.mdc +0 -16
- package/template/knowledge-base/design-system/components/buttons.mdc +0 -21
- package/template/knowledge-base/design-system/components/detail-header.mdc +0 -17
- package/template/knowledge-base/design-system/components/dropdowns.mdc +0 -12
- package/template/knowledge-base/design-system/components/info-list.mdc +0 -17
- package/template/knowledge-base/design-system/components/inputs.mdc +0 -23
- package/template/knowledge-base/design-system/components/menu.mdc +0 -20
- package/template/knowledge-base/design-system/components/modals.mdc +0 -24
- package/template/knowledge-base/design-system/components/selects.mdc +0 -39
- package/template/knowledge-base/design-system/components/stepper.mdc +0 -18
- package/template/knowledge-base/design-system/components/tables.mdc +0 -59
- package/template/knowledge-base/design-system/components/tabs.mdc +0 -17
- package/template/knowledge-base/design-system/components.mdc +0 -91
- package/template/knowledge-base/design-system/tokens.mdc +0 -24
- package/template/knowledge-base/examples/bad/README.md +0 -8
- package/template/knowledge-base/examples/good/README.md +0 -13
- package/template/knowledge-base/metadata/catalog.yaml +0 -245
- package/template/knowledge-base/patterns/components/reuse-existing.mdc +0 -26
- package/template/knowledge-base/patterns/data-fetching/local-data.mdc +0 -20
- package/template/knowledge-base/patterns/layouts/app-shell.mdc +0 -20
- package/template/knowledge-base/patterns/pages/data-table-page.mdc +0 -31
- package/template/knowledge-base/patterns/pages/workflow-page.mdc +0 -27
- package/template/knowledge-base/rules/accessibility/responsive.mdc +0 -31
- package/template/knowledge-base/rules/architecture/layout.mdc +0 -52
- package/template/knowledge-base/rules/architecture/single-screen.mdc +0 -62
- package/template/knowledge-base/rules/code-quality/jsx.mdc +0 -19
- package/template/knowledge-base/rules/global/naming.mdc +0 -12
- package/template/knowledge-base/rules/global/technology.mdc +0 -19
- package/template/knowledge-base/rules/global/ui-copy.mdc +0 -20
- package/template/knowledge-base/rules/performance/client.mdc +0 -20
- package/template/knowledge-base/rules/ui/information-density.mdc +0 -36
- package/template/knowledge-base/rules/ui/interaction.mdc +0 -47
- package/template/knowledge-base/rules/ui/simple-ui.mdc +0 -58
- package/template/knowledge-base/validation/accessibility.mdc +0 -13
- package/template/knowledge-base/validation/architecture.mdc +0 -10
- package/template/knowledge-base/validation/ast-grep/do-what-brooooooklyn-said.yml +0 -15
- package/template/knowledge-base/validation/ast-grep/no-nested-links.yml +0 -12
- package/template/knowledge-base/validation/ast-grep/rewrite-svg-attribute.yml +0 -19
- package/template/knowledge-base/validation/code-quality.mdc +0 -18
- package/template/knowledge-base/validation/performance.mdc +0 -11
- package/template/knowledge-base/validation/ui.mdc +0 -26
package/README.md
CHANGED
|
@@ -1,237 +1,68 @@
|
|
|
1
|
-
# create-modoock-app
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
npm
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
A dedicated design system containing:
|
|
71
|
-
|
|
72
|
-
- Typography
|
|
73
|
-
- Spacing
|
|
74
|
-
- Colors
|
|
75
|
-
- Border radius
|
|
76
|
-
- Components
|
|
77
|
-
- UI patterns
|
|
78
|
-
- Design tokens
|
|
79
|
-
- Usage guidelines
|
|
80
|
-
|
|
81
|
-
### Development Rules
|
|
82
|
-
|
|
83
|
-
The boilerplate includes predefined development rules to help maintain consistent code and UI quality.
|
|
84
|
-
|
|
85
|
-
These cover areas such as:
|
|
86
|
-
|
|
87
|
-
- Architecture
|
|
88
|
-
- Naming conventions
|
|
89
|
-
- Accessibility
|
|
90
|
-
- Responsive design
|
|
91
|
-
- Performance
|
|
92
|
-
- Code quality
|
|
93
|
-
- UI consistency
|
|
94
|
-
- Component reuse
|
|
95
|
-
- Interaction patterns
|
|
96
|
-
|
|
97
|
-
### AI Development Support
|
|
98
|
-
|
|
99
|
-
The project includes configuration and documentation for AI-assisted development.
|
|
100
|
-
|
|
101
|
-
This includes:
|
|
102
|
-
|
|
103
|
-
- Cursor rules
|
|
104
|
-
- AI agents
|
|
105
|
-
- Development guidelines
|
|
106
|
-
- Component documentation
|
|
107
|
-
- Project knowledge base
|
|
108
|
-
- Reusable implementation patterns
|
|
109
|
-
|
|
110
|
-
The goal is to make AI-assisted development follow the same architecture and design standards as the project.
|
|
111
|
-
|
|
112
|
-
## Project Structure
|
|
113
|
-
|
|
114
|
-
After running the CLI, your project will contain the complete boilerplate structure:
|
|
115
|
-
|
|
116
|
-
```text
|
|
117
|
-
my-project/
|
|
118
|
-
├── app/
|
|
119
|
-
├── components/
|
|
120
|
-
│ ├── layout/
|
|
121
|
-
│ ├── shared/
|
|
122
|
-
│ └── ui/
|
|
123
|
-
├── hooks/
|
|
124
|
-
├── knowledge-base/
|
|
125
|
-
├── lib/
|
|
126
|
-
├── providers/
|
|
127
|
-
├── public/
|
|
128
|
-
├── types/
|
|
129
|
-
├── utils/
|
|
130
|
-
├── .cursor/
|
|
131
|
-
├── AGENTS.md
|
|
132
|
-
├── CLAUDE.md
|
|
133
|
-
├── eslint.config.mjs
|
|
134
|
-
├── next.config.ts
|
|
135
|
-
├── package.json
|
|
136
|
-
├── postcss.config.mjs
|
|
137
|
-
├── tsconfig.json
|
|
138
|
-
└── ...
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Technologies
|
|
142
|
-
|
|
143
|
-
The boilerplate is built with:
|
|
144
|
-
|
|
145
|
-
- **Next.js**
|
|
146
|
-
- **React**
|
|
147
|
-
- **TypeScript**
|
|
148
|
-
- **Tailwind CSS**
|
|
149
|
-
- **Lucide React**
|
|
150
|
-
- **ESLint**
|
|
151
|
-
|
|
152
|
-
## Automatic Installation
|
|
153
|
-
|
|
154
|
-
You don't need to manually install the boilerplate dependencies.
|
|
155
|
-
|
|
156
|
-
Running:
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
npx create-modoock-app my-project
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
will create the project and install its dependencies automatically.
|
|
163
|
-
|
|
164
|
-
After that, simply run:
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
cd my-project
|
|
168
|
-
npm run dev
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Project Name
|
|
172
|
-
|
|
173
|
-
The project name is provided directly when running the CLI:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
npx create-modoock-app my-project
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
The generated `package.json` will automatically use:
|
|
180
|
-
|
|
181
|
-
```json
|
|
182
|
-
{
|
|
183
|
-
"name": "my-project"
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
You can therefore use any valid npm project name.
|
|
188
|
-
|
|
189
|
-
## Available Scripts
|
|
190
|
-
|
|
191
|
-
Inside your generated project, you can use:
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
npm run dev
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Starts the development server.
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
npm run build
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Creates a production build.
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
npm run start
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Starts the production server.
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
npm run lint
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
Runs ESLint.
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
npm run typecheck
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Checks TypeScript types without generating files.
|
|
222
|
-
|
|
223
|
-
## Updating create-modoock-app
|
|
224
|
-
|
|
225
|
-
The boilerplate is continuously maintained and updated with improvements, bug fixes, new components, and new development rules.
|
|
226
|
-
|
|
227
|
-
To use the latest published version when creating a new project:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
npx create-modoock-app@latest my-project
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
Existing projects are independent after creation, so updates to the boilerplate do not automatically modify previously generated projects.
|
|
234
|
-
|
|
235
|
-
## License
|
|
236
|
-
|
|
237
|
-
MIT
|
|
1
|
+
# create-modoock-app
|
|
2
|
+
|
|
3
|
+
Official Modooock project starter and boilerplate generator.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Create a new Modooock project:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx create-modoock-app my-project
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd my-project
|
|
17
|
+
npm run dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What It Includes
|
|
21
|
+
|
|
22
|
+
The generator creates a ready-to-develop Modooock project containing:
|
|
23
|
+
|
|
24
|
+
- Modooock project foundation
|
|
25
|
+
- Modooock UI components as local source files
|
|
26
|
+
- Modooock Knowledge Base as an npm dependency
|
|
27
|
+
- Required project dependencies and configuration
|
|
28
|
+
|
|
29
|
+
## Component Architecture
|
|
30
|
+
|
|
31
|
+
Modooock UI components are copied into the generated project:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
components/
|
|
35
|
+
└── ui/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The generated project owns these source files and can modify them directly.
|
|
39
|
+
|
|
40
|
+
The `@modoock/components` package is used as the upstream source during project creation and is not installed as a dependency in the generated project.
|
|
41
|
+
|
|
42
|
+
## Knowledge Base
|
|
43
|
+
|
|
44
|
+
The Modooock Knowledge Base is installed as an npm dependency:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
node_modules/
|
|
48
|
+
└── @modoock/
|
|
49
|
+
└── knowledge-base/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Development
|
|
53
|
+
|
|
54
|
+
Build the generator:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm run build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The compiled CLI is generated in:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
dist/
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT
|
package/dist/cli.js
CHANGED
|
@@ -4,49 +4,118 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const COMPONENTS_PACKAGE = "@modoock/components";
|
|
11
|
+
const COMPONENTS_VERSION = "1.0.0";
|
|
12
|
+
function copyDirectory(source, destination) {
|
|
13
|
+
node_fs_1.default.mkdirSync(destination, { recursive: true });
|
|
14
|
+
for (const entry of node_fs_1.default.readdirSync(source, { withFileTypes: true })) {
|
|
15
|
+
const sourcePath = node_path_1.default.join(source, entry.name);
|
|
16
|
+
const destinationPath = node_path_1.default.join(destination, entry.name);
|
|
17
|
+
if (entry.isDirectory()) {
|
|
18
|
+
copyDirectory(sourcePath, destinationPath);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
node_fs_1.default.copyFileSync(sourcePath, destinationPath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
function getComponentsSource(packageRoot) {
|
|
26
|
+
const temporaryDirectory = node_path_1.default.join(packageRoot, ".modoock-components-temp");
|
|
27
|
+
node_fs_1.default.rmSync(temporaryDirectory, {
|
|
28
|
+
recursive: true,
|
|
29
|
+
force: true,
|
|
30
|
+
});
|
|
31
|
+
node_fs_1.default.mkdirSync(temporaryDirectory, {
|
|
32
|
+
recursive: true,
|
|
33
|
+
});
|
|
34
|
+
console.log(`Getting ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}...`);
|
|
35
|
+
(0, node_child_process_1.execSync)(`npm pack ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION} --pack-destination "${temporaryDirectory}"`, {
|
|
36
|
+
cwd: packageRoot,
|
|
37
|
+
stdio: "inherit",
|
|
38
|
+
});
|
|
39
|
+
const tarball = node_fs_1.default
|
|
40
|
+
.readdirSync(temporaryDirectory)
|
|
41
|
+
.find((file) => file.endsWith(".tgz"));
|
|
42
|
+
if (!tarball) {
|
|
43
|
+
throw new Error("Could not find the components package archive.");
|
|
44
|
+
}
|
|
45
|
+
const extractDirectory = node_path_1.default.join(temporaryDirectory, "package");
|
|
46
|
+
node_fs_1.default.mkdirSync(extractDirectory, {
|
|
47
|
+
recursive: true,
|
|
48
|
+
});
|
|
49
|
+
(0, node_child_process_1.execSync)(`tar -xzf "${node_path_1.default.join(temporaryDirectory, tarball)}" -C "${temporaryDirectory}"`, {
|
|
50
|
+
stdio: "inherit",
|
|
51
|
+
});
|
|
52
|
+
const uiSource = node_path_1.default.join(extractDirectory, "components", "ui");
|
|
53
|
+
if (!node_fs_1.default.existsSync(uiSource)) {
|
|
54
|
+
throw new Error(`Could not find components/ui in ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}.`);
|
|
55
|
+
}
|
|
56
|
+
return uiSource;
|
|
32
57
|
}
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
function main() {
|
|
59
|
+
const projectName = process.argv[2];
|
|
60
|
+
if (!projectName) {
|
|
61
|
+
console.error("Usage: npx create-modoock-app <project-name>");
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
const targetDirectory = node_path_1.default.resolve(process.cwd(), projectName);
|
|
65
|
+
if (node_fs_1.default.existsSync(targetDirectory)) {
|
|
66
|
+
console.error(`Error: Directory "${projectName}" already exists.`);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const packageRoot = node_path_1.default.resolve(__dirname, "..");
|
|
70
|
+
const templateDirectory = node_path_1.default.join(packageRoot, "template");
|
|
71
|
+
console.log(`Creating Modooock project: ${node_path_1.default.basename(targetDirectory)}`);
|
|
72
|
+
// Copy the project foundation.
|
|
73
|
+
copyDirectory(templateDirectory, targetDirectory);
|
|
74
|
+
// Get the official UI source package.
|
|
75
|
+
let uiSource;
|
|
76
|
+
try {
|
|
77
|
+
uiSource = getComponentsSource(packageRoot);
|
|
78
|
+
const uiDestination = node_path_1.default.join(targetDirectory, "components", "ui");
|
|
79
|
+
// Copy UI components into the generated project.
|
|
80
|
+
copyDirectory(uiSource, uiDestination);
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
// Remove the temporary downloaded package.
|
|
84
|
+
node_fs_1.default.rmSync(node_path_1.default.join(packageRoot, ".modoock-components-temp"), {
|
|
85
|
+
recursive: true,
|
|
86
|
+
force: true,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// Update the generated project's package.json.
|
|
90
|
+
const projectPackageJsonPath = node_path_1.default.join(targetDirectory, "package.json");
|
|
91
|
+
const projectPackageJson = JSON.parse(node_fs_1.default.readFileSync(projectPackageJsonPath, "utf8"));
|
|
92
|
+
// Set the generated project's name.
|
|
93
|
+
projectPackageJson.name =
|
|
94
|
+
node_path_1.default.basename(targetDirectory);
|
|
95
|
+
// Install the Knowledge Base as an npm dependency.
|
|
96
|
+
projectPackageJson.dependencies = {
|
|
97
|
+
...(projectPackageJson.dependencies ?? {}),
|
|
98
|
+
"@modoock/knowledge-base": "1.0.0",
|
|
99
|
+
};
|
|
100
|
+
// Components are copied into components/ui/,
|
|
101
|
+
// so they must not remain an npm dependency.
|
|
102
|
+
if (projectPackageJson.dependencies["@modoock/components"]) {
|
|
103
|
+
delete projectPackageJson.dependencies["@modoock/components"];
|
|
104
|
+
}
|
|
105
|
+
node_fs_1.default.writeFileSync(projectPackageJsonPath, JSON.stringify(projectPackageJson, null, 2) + "\n");
|
|
106
|
+
// Install generated project dependencies.
|
|
107
|
+
console.log("Installing dependencies...");
|
|
108
|
+
(0, node_child_process_1.execSync)("npm install", {
|
|
109
|
+
cwd: targetDirectory,
|
|
110
|
+
stdio: "inherit",
|
|
111
|
+
});
|
|
112
|
+
console.log("");
|
|
113
|
+
console.log("Done!");
|
|
114
|
+
console.log("");
|
|
115
|
+
console.log(`Project created at: ${targetDirectory}`);
|
|
116
|
+
console.log("");
|
|
117
|
+
console.log("Next steps:");
|
|
118
|
+
console.log(` cd ${projectName}`);
|
|
119
|
+
console.log(" npm run dev");
|
|
42
120
|
}
|
|
43
|
-
|
|
44
|
-
console.log("\nInstalling dependencies...\n");
|
|
45
|
-
(0, child_process_1.execSync)("npm ci", {
|
|
46
|
-
cwd: projectPath,
|
|
47
|
-
stdio: "inherit",
|
|
48
|
-
});
|
|
49
|
-
console.log(`\n✓ ${projectName} created successfully!`);
|
|
50
|
-
console.log(`\nNext steps:`);
|
|
51
|
-
console.log(` cd ${projectName}`);
|
|
52
|
-
console.log(` npm run dev\n`);
|
|
121
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-modoock-app",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/cli.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"create-modoock-app": "dist/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"template",
|
|
12
|
-
"README.md"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@types/node": "^
|
|
19
|
-
"typescript": "^5
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT"
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "create-modoock-app",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Official Modoock project starter and boilerplate generator.",
|
|
5
|
+
"main": "dist/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-modoock-app": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"template",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^20",
|
|
19
|
+
"typescript": "^5"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT"
|
|
22
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
const CATALOG = "knowledge-base/metadata/catalog.yaml";
|
|
7
|
+
const allow = { permission: "allow" };
|
|
8
|
+
const emit = (o) => process.stdout.write(JSON.stringify(o));
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
const raw = process.stdin.isTTY ? "{}" : fs.readFileSync(0, "utf8");
|
|
12
|
+
const p = JSON.parse(raw.trim() || "{}");
|
|
13
|
+
const event = String(p.hook_event_name || "").toLowerCase();
|
|
14
|
+
const root = p.workspace_roots?.[0] || process.cwd();
|
|
15
|
+
const cid = p.conversation_id || p.session_id;
|
|
16
|
+
const stampFile = cid
|
|
17
|
+
? path.join(
|
|
18
|
+
os.tmpdir(),
|
|
19
|
+
"modoock-ui-pack",
|
|
20
|
+
`${String(cid).replace(/[^a-zA-Z0-9._-]/g, "_")}.json`,
|
|
21
|
+
)
|
|
22
|
+
: "";
|
|
23
|
+
|
|
24
|
+
const rel = (file) => {
|
|
25
|
+
if (!file) return "";
|
|
26
|
+
const r = path.relative(root, path.resolve(root, String(file)));
|
|
27
|
+
if (!r || r.startsWith("..") || path.isAbsolute(r)) return "";
|
|
28
|
+
return r.split(path.sep).join("/");
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let input = p.tool_input;
|
|
32
|
+
if (typeof input === "string") {
|
|
33
|
+
try {
|
|
34
|
+
input = JSON.parse(input);
|
|
35
|
+
} catch {
|
|
36
|
+
input = {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (!input || typeof input !== "object") input = {};
|
|
40
|
+
const fileRel = rel(input.path || input.file_path || input.filePath);
|
|
41
|
+
|
|
42
|
+
const loadStamp = () => {
|
|
43
|
+
try {
|
|
44
|
+
return new Set(JSON.parse(fs.readFileSync(stampFile, "utf8")).read);
|
|
45
|
+
} catch {
|
|
46
|
+
return new Set();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (event === "precompact") {
|
|
51
|
+
if (stampFile) fs.rmSync(stampFile, { force: true });
|
|
52
|
+
emit({});
|
|
53
|
+
} else if (event === "posttooluse") {
|
|
54
|
+
if (fileRel && input.limit == null && !(input.offset > 1) && stampFile) {
|
|
55
|
+
const s = loadStamp();
|
|
56
|
+
s.add(fileRel);
|
|
57
|
+
fs.mkdirSync(path.dirname(stampFile), { recursive: true });
|
|
58
|
+
fs.writeFileSync(stampFile, JSON.stringify({ read: [...s] }));
|
|
59
|
+
fs.appendFileSync(
|
|
60
|
+
stampFile.replace(/\.json$/, ".jsonl"),
|
|
61
|
+
`${JSON.stringify({ t: new Date().toISOString(), cid, path: fileRel })}\n`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
emit({});
|
|
65
|
+
} else {
|
|
66
|
+
const ui =
|
|
67
|
+
fileRel === "app" ||
|
|
68
|
+
fileRel === "components" ||
|
|
69
|
+
fileRel.startsWith("app/") ||
|
|
70
|
+
fileRel.startsWith("components/");
|
|
71
|
+
if (!fileRel || !ui || !cid) {
|
|
72
|
+
emit(allow);
|
|
73
|
+
} else {
|
|
74
|
+
const need = [];
|
|
75
|
+
const cat = path.join(root, CATALOG);
|
|
76
|
+
if (fs.existsSync(cat)) {
|
|
77
|
+
need.push(CATALOG);
|
|
78
|
+
let cur;
|
|
79
|
+
for (const line of fs.readFileSync(cat, "utf8").split(/\r?\n/)) {
|
|
80
|
+
const t = line.trim();
|
|
81
|
+
if (!t || t.startsWith("#")) continue;
|
|
82
|
+
const m = t.match(/^(?:-\s+)?path:\s+(.+)$/);
|
|
83
|
+
if (m) cur = m[1].trim().replace(/^['"]|['"]$/g, "");
|
|
84
|
+
else if (/^load:\s*ui\s*$/.test(t) && cur && fs.existsSync(path.join(root, cur)))
|
|
85
|
+
need.push(cur);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const dir = path.join(root, "components");
|
|
89
|
+
if (fs.existsSync(dir)) {
|
|
90
|
+
for (const d of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
91
|
+
const ip = `components/${d.name}/index.ts`;
|
|
92
|
+
if (d.isDirectory() && fs.existsSync(path.join(root, ip))) need.push(ip);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const missing = [...new Set(need)].filter((x) => !loadStamp().has(x));
|
|
96
|
+
emit(
|
|
97
|
+
missing.length
|
|
98
|
+
? {
|
|
99
|
+
permission: "deny",
|
|
100
|
+
agent_message: `Read then retry:\n${missing.map((x) => `- ${x}`).join("\n")}`,
|
|
101
|
+
}
|
|
102
|
+
: allow,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} catch {
|
|
107
|
+
emit(allow);
|
|
108
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"preToolUse": [
|
|
5
|
+
{
|
|
6
|
+
"command": "node .cursor/hooks/gate-ui-pack.mjs",
|
|
7
|
+
"matcher": "Write|StrReplace|Delete|Edit"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"postToolUse": [
|
|
11
|
+
{
|
|
12
|
+
"command": "node .cursor/hooks/gate-ui-pack.mjs",
|
|
13
|
+
"matcher": "Read"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"preCompact": [{ "command": "node .cursor/hooks/gate-ui-pack.mjs" }]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -39,6 +39,10 @@ naming the main edge case (e.g. "raises `KeyError` on a missing key — use `.ge
|
|
|
39
39
|
a tradeoff, a correctness argument, or a learner who needs the explanation. Keep
|
|
40
40
|
Lever 1, ease Lever 2. Brevity that forces a follow-up round-trip costs more than it saved.
|
|
41
41
|
|
|
42
|
+
**Do not invent to stay terse.** An unspecified part, an unclear idea, or a choice
|
|
43
|
+
the prompt did not make is a question (AGENTS.md), not a Honey default. "Implement"
|
|
44
|
+
is not license to fill gaps.
|
|
45
|
+
|
|
42
46
|
## Lever 1 — minimum code that needs to exist
|
|
43
47
|
|
|
44
48
|
Understand the problem *before* you climb — read the task and the code it touches,
|
|
@@ -60,8 +64,8 @@ Then walk the ladder; stop at the first rung that works:
|
|
|
60
64
|
7. **Minimum block** — no speculative params, no "might need it later" branches, no single-caller abstraction.
|
|
61
65
|
|
|
62
66
|
A Design System primitive (generic UI a second page would copy) is not a
|
|
63
|
-
single-caller abstraction. Ask per AGENTS.md
|
|
64
|
-
|
|
67
|
+
single-caller abstraction. Ask per AGENTS.md; if yes, put it in `components/`.
|
|
68
|
+
Keeping it page-local to skip the question is waste, not Honey.
|
|
65
69
|
|
|
66
70
|
Prefer editing what exists over adding; a new function/file/class/layer must earn
|
|
67
71
|
its place. Speculative generality is the costliest agent habit — code for imagined
|
|
@@ -98,6 +102,8 @@ Never simplify away:
|
|
|
98
102
|
trims *structure* (no dead markup, no unused framework), never how it looks.
|
|
99
103
|
- **Anything the user explicitly asked for.**
|
|
100
104
|
- **The ask for a Design System primitive** — do not skip it to write less code.
|
|
105
|
+
- **Unspecified parts, unclear ideas, choices, preferences** — do not generate
|
|
106
|
+
them to finish the ticket. Ask (AGENTS.md).
|
|
101
107
|
|
|
102
108
|
Leave one runnable check (test/assert/invocation) behind for non-trivial logic.
|
|
103
109
|
"Lazy" = no wasted code, not no proof it works.
|
|
@@ -108,7 +114,9 @@ Fewest words that stay clear. Cut the scaffolding:
|
|
|
108
114
|
|
|
109
115
|
- **Drop wind-up/wind-down** — no "Great question!", no "hope this helps!", no
|
|
110
116
|
restating the prompt, no announcing what you're about to do.
|
|
111
|
-
- **Drop hedging** — "use X", not "you might possibly consider perhaps X"
|
|
117
|
+
- **Drop hedging** — "use X", not "you might possibly consider perhaps X", when
|
|
118
|
+
X is already in the prompt or the repo. A choice the prompt did not make is
|
|
119
|
+
not hedging: ask (AGENTS.md) and wait. Do not pick a default to stay terse.
|
|
112
120
|
- **Fragments and lists** over paragraphs when they carry the same info faster.
|
|
113
121
|
- **Don't narrate readable code** — explain the *why* and the non-obvious, skip the *what*.
|
|
114
122
|
- **Answer first**; context only if load-bearing.
|