create-modoock-app 1.0.0 → 2.0.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/README.md +68 -0
- package/dist/cli.js +112 -43
- package/package.json +22 -21
- 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 +16 -5
- 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
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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,21 +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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "create-modoock-app",
|
|
3
|
+
"version": "2.0.0",
|
|
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.
|
package/template/AGENTS.md
CHANGED
|
@@ -13,7 +13,7 @@ This file is the canonical router. Product constraints live in `knowledge-base/`
|
|
|
13
13
|
| On demand | `description` matches the need | that `path`, then its `open:` |
|
|
14
14
|
| After coding | verification | `knowledge-base/validation/` for the change type |
|
|
15
15
|
|
|
16
|
-
Do not load the whole knowledge-base. `
|
|
16
|
+
Do not load the whole knowledge-base. Cursor hook denies writes under `app/` and `components/` until the UI pack (table above) is `Read` this conversation.
|
|
17
17
|
|
|
18
18
|
`.cursor/rules/honey.mdc` is required every turn for every agent (one file, do not copy, do not split). If it is already in context, do not re-open it. If it is not, open it once.
|
|
19
19
|
|
|
@@ -23,7 +23,6 @@ Do not load the whole knowledge-base. `load: ui` is an agent hint in `catalog.ya
|
|
|
23
23
|
knowledge-base/
|
|
24
24
|
├── rules/ # constraints (global, architecture, ui, accessibility, …)
|
|
25
25
|
├── patterns/ # how this repo solves a class of problem
|
|
26
|
-
├── examples/ # good/ and bad/
|
|
27
26
|
├── design-system/ # tokens + component constraints
|
|
28
27
|
├── validation/ # how to detect a violation
|
|
29
28
|
└── metadata/ # catalog.yaml — the need → path index
|
|
@@ -40,24 +39,26 @@ If no file covers the need, follow **New rules**. Missing `.mdc` for an existing
|
|
|
40
39
|
- Inspect the existing code. Reproduce a failure before fixing it. Change one thing at a time, then verify.
|
|
41
40
|
- Open the catalog paths that match the task and apply those files. Nothing else.
|
|
42
41
|
- Reuse and page composition: `knowledge-base/design-system/components.mdc`. Public APIs: `components/*/index.ts`.
|
|
43
|
-
-
|
|
44
|
-
- If a decision is not covered by the request or an existing rule, stop that part and ask. Do not assume preferences.
|
|
42
|
+
- Apply **Mandatory human validation**. Do not invent rules or unspecified behavior.
|
|
45
43
|
|
|
46
44
|
## Mandatory human validation
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
Do not invent. Code only what the prompt and existing rules already specify.
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
48
|
+
If you would generate a missing part, interpret an unclear idea, pick among options, or assume a preference — stop that part, ask the developer, wait. There is no checklist of cases. Anything the request did not decide is a question, including things the developer did not think to mention.
|
|
49
|
+
|
|
50
|
+
- Do not fill the gap with a "reasonable default" to finish the implementation.
|
|
51
|
+
- An existing pattern, a similar page, or "the usual way" does not authorize inventing the unspecified parts.
|
|
52
|
+
- Honey (fewer words, fewer lines) does not override this. Asking is cheaper than generating the wrong thing.
|
|
53
|
+
- Covered parts may proceed in the same turn. Uncovered parts stay paused until the developer answers.
|
|
54
|
+
- Yes / a chosen option: implement that part. No: leave it out.
|
|
55
|
+
- Do not replace a question with a weaker workaround (for example keeping a reusable UI piece in the page file so you do not have to ask).
|
|
56
|
+
|
|
57
|
+
When the question is a new reusable component in `components/ui/`, `components/layout/` or `components/shared/`, use this block (then wait):
|
|
54
58
|
- **What:** ComponentName
|
|
55
59
|
- **Where:** `components/ui` | `components/layout` | `components/shared`
|
|
56
60
|
- **Why:** existing `index.ts` exports that do not fit
|
|
57
61
|
- **Reuse:** one sentence (which other page would copy this JSX)
|
|
58
|
-
- Do not replace the question with a weaker workaround (for example keeping a reusable UI piece in the page file so you do not have to ask).
|
|
59
|
-
- After yes: implement in the same turn (create the component in `components/`, export it, wire the page). After no: stop that part.
|
|
60
|
-
- Distinguish what is requested, what the rules cover, and what is a new decision. Do not extend the scope. Suspend the uncovered part until the developer confirms.
|
|
61
62
|
|
|
62
63
|
## New rules
|
|
63
64
|
|