@cubocicloide/stack-frappe 2.0.4

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.
Files changed (122) hide show
  1. package/LICENSE +33 -0
  2. package/README.md +37 -0
  3. package/dist/commands/lint/checks/APP/001.d.ts +13 -0
  4. package/dist/commands/lint/checks/APP/001.js +73 -0
  5. package/dist/commands/lint/checks/APP/001.js.map +1 -0
  6. package/dist/commands/lint/checks/APP/002.d.ts +12 -0
  7. package/dist/commands/lint/checks/APP/002.js +94 -0
  8. package/dist/commands/lint/checks/APP/002.js.map +1 -0
  9. package/dist/commands/lint/checks/APP/003.d.ts +12 -0
  10. package/dist/commands/lint/checks/APP/003.js +94 -0
  11. package/dist/commands/lint/checks/APP/003.js.map +1 -0
  12. package/dist/commands/lint/checks/APP/004.d.ts +12 -0
  13. package/dist/commands/lint/checks/APP/004.js +117 -0
  14. package/dist/commands/lint/checks/APP/004.js.map +1 -0
  15. package/dist/commands/lint/checks/DT/001.d.ts +11 -0
  16. package/dist/commands/lint/checks/DT/001.js +57 -0
  17. package/dist/commands/lint/checks/DT/001.js.map +1 -0
  18. package/dist/commands/lint/checks/DT/002.d.ts +12 -0
  19. package/dist/commands/lint/checks/DT/002.js +74 -0
  20. package/dist/commands/lint/checks/DT/002.js.map +1 -0
  21. package/dist/commands/lint/checks/DT/003.d.ts +13 -0
  22. package/dist/commands/lint/checks/DT/003.js +96 -0
  23. package/dist/commands/lint/checks/DT/003.js.map +1 -0
  24. package/dist/commands/lint/checks/DT/004.d.ts +12 -0
  25. package/dist/commands/lint/checks/DT/004.js +101 -0
  26. package/dist/commands/lint/checks/DT/004.js.map +1 -0
  27. package/dist/commands/lint/checks/PY/001.d.ts +12 -0
  28. package/dist/commands/lint/checks/PY/001.js +87 -0
  29. package/dist/commands/lint/checks/PY/001.js.map +1 -0
  30. package/dist/commands/lint/checks/PY/002.d.ts +12 -0
  31. package/dist/commands/lint/checks/PY/002.js +80 -0
  32. package/dist/commands/lint/checks/PY/002.js.map +1 -0
  33. package/dist/commands/lint/checks/PY/003.d.ts +11 -0
  34. package/dist/commands/lint/checks/PY/003.js +56 -0
  35. package/dist/commands/lint/checks/PY/003.js.map +1 -0
  36. package/dist/index.d.ts +5 -0
  37. package/dist/index.js +1987 -0
  38. package/dist/index.js.map +1 -0
  39. package/dude.stack.json +12 -0
  40. package/package.json +41 -0
  41. package/templates/aws-ecs/_dockerignore +11 -0
  42. package/templates/aws-ecs/docker/Dockerfile.prod.hbs +80 -0
  43. package/templates/aws-ecs/docker/nginx-entrypoint.sh +17 -0
  44. package/templates/aws-ecs/docker/nginx-template.conf +95 -0
  45. package/templates/aws-ecs/docs/docs/deploy.md.hbs +53 -0
  46. package/templates/aws-ecs/iac/README.md.hbs +113 -0
  47. package/templates/aws-ecs/iac/_gitignore +14 -0
  48. package/templates/aws-ecs/iac/runner/Dockerfile +35 -0
  49. package/templates/aws-ecs/iac/terraform/bootstrap/main.tf.hbs +93 -0
  50. package/templates/aws-ecs/iac/terraform/bootstrap/outputs.tf +14 -0
  51. package/templates/aws-ecs/iac/terraform/bootstrap/variables.tf.hbs +17 -0
  52. package/templates/aws-ecs/iac/terraform/environments/dev/backend.hcl.hbs +12 -0
  53. package/templates/aws-ecs/iac/terraform/environments/dev/terraform.tfvars.hbs +32 -0
  54. package/templates/aws-ecs/iac/terraform/main.tf.hbs +1205 -0
  55. package/templates/aws-ecs/iac/terraform/outputs.tf.hbs +103 -0
  56. package/templates/aws-ecs/iac/terraform/providers.tf +19 -0
  57. package/templates/aws-ecs/iac/terraform/variables.tf.hbs +139 -0
  58. package/templates/aws-ecs/iac/terraform/versions.tf +19 -0
  59. package/templates/base/.claude/rules/APP/001.md +26 -0
  60. package/templates/base/.claude/rules/APP/002.md +26 -0
  61. package/templates/base/.claude/rules/APP/003.md +25 -0
  62. package/templates/base/.claude/rules/APP/004.md +27 -0
  63. package/templates/base/.claude/rules/DT/001.md +25 -0
  64. package/templates/base/.claude/rules/DT/002.md +25 -0
  65. package/templates/base/.claude/rules/DT/003.md +24 -0
  66. package/templates/base/.claude/rules/DT/004.md +22 -0
  67. package/templates/base/.claude/rules/PY/001.md +30 -0
  68. package/templates/base/.claude/rules/PY/002.md +31 -0
  69. package/templates/base/.claude/rules/PY/003.md +29 -0
  70. package/templates/base/.claude/settings.json +42 -0
  71. package/templates/base/.claude/skills/create-doctype/SKILL.md +99 -0
  72. package/templates/base/.dude/commands/README.md +85 -0
  73. package/templates/base/.dude/commands/hello.ts +34 -0
  74. package/templates/base/.dude/lint/checks/PRJ/001.ts +26 -0
  75. package/templates/base/.dude/lint/checks/README.md +69 -0
  76. package/templates/base/.vscode/tasks.json +44 -0
  77. package/templates/base/CLAUDE.md.hbs +49 -0
  78. package/templates/base/README.md.hbs +68 -0
  79. package/templates/base/_env.example.hbs +5 -0
  80. package/templates/base/_env.hbs +12 -0
  81. package/templates/base/_gitignore +26 -0
  82. package/templates/base/_npmrc +2 -0
  83. package/templates/base/apps/README.md +24 -0
  84. package/templates/base/apps/ticketing/README.md +43 -0
  85. package/templates/base/apps/ticketing/pyproject.toml +34 -0
  86. package/templates/base/apps/ticketing/ticketing/__init__.py +1 -0
  87. package/templates/base/apps/ticketing/ticketing/api.py +35 -0
  88. package/templates/base/apps/ticketing/ticketing/events/__init__.py +0 -0
  89. package/templates/base/apps/ticketing/ticketing/events/hd_ticket.py +32 -0
  90. package/templates/base/apps/ticketing/ticketing/fixtures/workflow.json +55 -0
  91. package/templates/base/apps/ticketing/ticketing/fixtures/workflow_action_master.json +12 -0
  92. package/templates/base/apps/ticketing/ticketing/fixtures/workflow_state.json +20 -0
  93. package/templates/base/apps/ticketing/ticketing/hooks.py +54 -0
  94. package/templates/base/apps/ticketing/ticketing/modules.txt +1 -0
  95. package/templates/base/apps/ticketing/ticketing/patches/__init__.py +0 -0
  96. package/templates/base/apps/ticketing/ticketing/patches/v1_0/__init__.py +0 -0
  97. package/templates/base/apps/ticketing/ticketing/patches/v1_0/set_default_branding.py +26 -0
  98. package/templates/base/apps/ticketing/ticketing/patches.txt +5 -0
  99. package/templates/base/apps/ticketing/ticketing/public/images/favicon.png +0 -0
  100. package/templates/base/apps/ticketing/ticketing/public/images/logo.png +0 -0
  101. package/templates/base/apps/ticketing/ticketing/tasks.py +99 -0
  102. package/templates/base/apps/ticketing/ticketing/templates/__init__.py +0 -0
  103. package/templates/base/apps/ticketing/ticketing/templates/pages/__init__.py +0 -0
  104. package/templates/base/apps/ticketing/ticketing/templates/pages/ticket_stats.html +30 -0
  105. package/templates/base/apps/ticketing/ticketing/templates/pages/ticket_stats.py +14 -0
  106. package/templates/base/apps/ticketing/ticketing/ticketing/__init__.py +0 -0
  107. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/__init__.py +0 -0
  108. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/__init__.py +0 -0
  109. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/test_ticket_escalation_rule.py +32 -0
  110. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/ticket_escalation_rule.js +23 -0
  111. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/ticket_escalation_rule.json +99 -0
  112. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/ticket_escalation_rule.py +18 -0
  113. package/templates/base/docker/init.sh +114 -0
  114. package/templates/base/docker-compose.yml.hbs +62 -0
  115. package/templates/base/docs/docs/api.md +21 -0
  116. package/templates/base/docs/docs/dude.md.hbs +220 -0
  117. package/templates/base/docs/docs/extending.md +238 -0
  118. package/templates/base/docs/docs/frappe.md.hbs +223 -0
  119. package/templates/base/docs/docs/index.md.hbs +101 -0
  120. package/templates/base/docs/docs/mkdocs.md +235 -0
  121. package/templates/base/docs/mkdocs.yml.hbs +54 -0
  122. package/templates/base/package.json.hbs +11 -0
package/LICENSE ADDED
@@ -0,0 +1,33 @@
1
+ Copyright © Cubocicloide. All rights reserved.
2
+
3
+ SOURCE-AVAILABLE, PROPRIETARY LICENSE
4
+
5
+ This source code is made publicly viewable for transparency, evaluation, and
6
+ reference purposes only. It is NOT open-source software.
7
+
8
+ 1. Grant. You are permitted to view and read this source code, and to clone the
9
+ repository, solely to evaluate the software and to understand how it works.
10
+
11
+ 2. Restrictions. Except as expressly permitted above, you may NOT, without the
12
+ prior written permission of Cubocicloide:
13
+ a. use the software, in whole or in part, for any purpose (including any
14
+ personal, internal, commercial, or production use);
15
+ b. copy, reproduce, or redistribute the software or any derivative of it;
16
+ c. modify, adapt, translate, or create derivative works based on it;
17
+ d. sublicense, sell, rent, lease, or otherwise commercially exploit it;
18
+ e. remove or alter this notice or any copyright, trademark, or attribution
19
+ notices contained in the software.
20
+
21
+ 3. No trademark rights. This license does not grant any rights to use the
22
+ "Cubocicloide" name, logos, or other trademarks.
23
+
24
+ 4. No warranty. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
27
+
28
+ 5. Limitation of liability. IN NO EVENT SHALL CUBOCICLOIDE BE LIABLE FOR ANY
29
+ CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR
30
+ OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE
31
+ OR OTHER DEALINGS IN THE SOFTWARE.
32
+
33
+ To request permissions beyond the scope of this license, contact Cubocicloide.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @cubocicloide/stack-frappe
2
+
3
+ Stack plugin that teaches the [`dude`](https://github.com/cubocicloide/dude) CLI
4
+ how to scaffold, run and lint a **Frappe Framework** project shipped as a
5
+ minimal-but-functional **ticketing system** (Frappe + [Frappe Helpdesk](https://github.com/frappe/helpdesk)).
6
+
7
+ The scaffold is designed as a *learning-by-example* starting point: it ships a
8
+ custom Frappe app (`apps/ticketing`) that demonstrates every core Frappe
9
+ building block — DocTypes (models), controllers, form scripts (views), portal
10
+ pages, whitelisted API methods, scheduled tasks, document-event hooks,
11
+ workflows and fixtures — so developers can copy the patterns to build their
12
+ own apps.
13
+
14
+ ## What you get
15
+
16
+ - **Local dev environment** — Docker Compose with MariaDB, two Redis instances
17
+ and a `frappe/bench` container that provisions the bench + site on first boot
18
+ and installs Frappe Helpdesk and the custom `ticketing` app.
19
+ - **Custom app example** (`apps/ticketing`) — mounted into the bench in
20
+ editable mode, so code changes reload live.
21
+ - **Commands** — `dude up/down/logs/shell`, `dude bench …` (raw bench
22
+ passthrough), `dude site migrate/console/backup/clear-cache/mariadb`,
23
+ `dude app new/install`, `dude test`, `dude format`, `dude lint`, `dude docs`,
24
+ and (optionally) `dude iac …` for AWS ECS Fargate deployment via Terraform.
25
+ - **Lint rules** — Frappe best-practice structural checks over `apps/`
26
+ (app layout, hooks integrity, DocType conventions, Python safety), each with
27
+ a matching prose rule in the generated project's `.claude/rules/`.
28
+
29
+ ## Usage
30
+
31
+ ```bash
32
+ dude init my-helpdesk --stack frappe
33
+ cd my-helpdesk
34
+ dude up
35
+ ```
36
+
37
+ See the generated project's `README.md` and `docs/` for the full guide.
@@ -0,0 +1,13 @@
1
+ import { RawDiagnostic } from '@cubocicloide/dude';
2
+
3
+ /**
4
+ * APP001 — App layout integrity.
5
+ *
6
+ * Every apps/<app>/ with a pyproject.toml must contain the python package
7
+ * apps/<app>/<app>/ with hooks.py, modules.txt, patches.txt and __init__.py.
8
+ * Directories under apps/ that are not valid apps but contain python files
9
+ * get a warning: bench provisioning will ignore them.
10
+ */
11
+ declare function check(root: string): RawDiagnostic[];
12
+
13
+ export { check as default };
@@ -0,0 +1,73 @@
1
+ // src/commands/lint/checks/APP/001.ts
2
+ import { existsSync, readdirSync } from "fs";
3
+ import path from "pathe";
4
+ var REQUIRED_FILES = ["hooks.py", "modules.txt", "patches.txt", "__init__.py"];
5
+ function containsPython(dir) {
6
+ let entries;
7
+ try {
8
+ entries = readdirSync(dir, { withFileTypes: true });
9
+ } catch {
10
+ return false;
11
+ }
12
+ for (const e of entries) {
13
+ if (e.isFile() && e.name.endsWith(".py")) return true;
14
+ if (e.isDirectory() && !e.name.startsWith(".") && containsPython(path.join(dir, e.name))) {
15
+ return true;
16
+ }
17
+ }
18
+ return false;
19
+ }
20
+ function check(root) {
21
+ const appsDir = path.join(root, "apps");
22
+ let entries;
23
+ try {
24
+ entries = readdirSync(appsDir, { withFileTypes: true });
25
+ } catch {
26
+ return [];
27
+ }
28
+ const diagnostics = [];
29
+ for (const entry of entries) {
30
+ if (!entry.isDirectory()) continue;
31
+ const app = entry.name;
32
+ const appDir = path.join(appsDir, app);
33
+ if (!existsSync(path.join(appDir, "pyproject.toml"))) {
34
+ if (containsPython(appDir)) {
35
+ diagnostics.push({
36
+ file: `apps/${app}`,
37
+ line: 1,
38
+ col: 1,
39
+ severity: "warning",
40
+ message: `apps/${app}/ contains Python files but no pyproject.toml \u2014 it is not a valid Frappe app and will be ignored by the bench provisioning`
41
+ });
42
+ }
43
+ continue;
44
+ }
45
+ const pkgDir = path.join(appDir, app);
46
+ if (!existsSync(pkgDir)) {
47
+ diagnostics.push({
48
+ file: `apps/${app}/pyproject.toml`,
49
+ line: 1,
50
+ col: 1,
51
+ severity: "error",
52
+ message: `Python package apps/${app}/${app}/ is missing \u2014 a Frappe app needs a package named after the app (bench cannot install it otherwise)`
53
+ });
54
+ continue;
55
+ }
56
+ for (const required of REQUIRED_FILES) {
57
+ if (!existsSync(path.join(pkgDir, required))) {
58
+ diagnostics.push({
59
+ file: `apps/${app}/${app}/${required}`,
60
+ line: 1,
61
+ col: 1,
62
+ severity: "error",
63
+ message: `apps/${app}/${app}/${required} is missing \u2014 required by the Frappe app contract (bench install/migrate reads it)`
64
+ });
65
+ }
66
+ }
67
+ }
68
+ return diagnostics;
69
+ }
70
+ export {
71
+ check as default
72
+ };
73
+ //# sourceMappingURL=001.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/commands/lint/checks/APP/001.ts"],"sourcesContent":["import { existsSync, readdirSync } from 'node:fs'\nimport path from 'pathe'\nimport type { RawDiagnostic } from '@cubocicloide/dude'\n\n/** Files every Frappe app python package must ship. */\nconst REQUIRED_FILES = ['hooks.py', 'modules.txt', 'patches.txt', '__init__.py']\n\n/** Does this directory (recursively) contain any .py file? */\nfunction containsPython(dir: string): boolean {\n let entries\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return false\n }\n for (const e of entries) {\n if (e.isFile() && e.name.endsWith('.py')) return true\n if (e.isDirectory() && !e.name.startsWith('.') && containsPython(path.join(dir, e.name))) {\n return true\n }\n }\n return false\n}\n\n/**\n * APP001 — App layout integrity.\n *\n * Every apps/<app>/ with a pyproject.toml must contain the python package\n * apps/<app>/<app>/ with hooks.py, modules.txt, patches.txt and __init__.py.\n * Directories under apps/ that are not valid apps but contain python files\n * get a warning: bench provisioning will ignore them.\n */\nexport default function check(root: string): RawDiagnostic[] {\n const appsDir = path.join(root, 'apps')\n let entries\n try {\n entries = readdirSync(appsDir, { withFileTypes: true })\n } catch {\n return []\n }\n\n const diagnostics: RawDiagnostic[] = []\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue // README.md etc. at apps/ root\n const app = entry.name\n const appDir = path.join(appsDir, app)\n\n if (!existsSync(path.join(appDir, 'pyproject.toml'))) {\n if (containsPython(appDir)) {\n diagnostics.push({\n file: `apps/${app}`,\n line: 1,\n col: 1,\n severity: 'warning',\n message: `apps/${app}/ contains Python files but no pyproject.toml — it is not a valid Frappe app and will be ignored by the bench provisioning`,\n })\n }\n continue\n }\n\n const pkgDir = path.join(appDir, app)\n if (!existsSync(pkgDir)) {\n diagnostics.push({\n file: `apps/${app}/pyproject.toml`,\n line: 1,\n col: 1,\n severity: 'error',\n message: `Python package apps/${app}/${app}/ is missing — a Frappe app needs a package named after the app (bench cannot install it otherwise)`,\n })\n continue\n }\n\n for (const required of REQUIRED_FILES) {\n if (!existsSync(path.join(pkgDir, required))) {\n diagnostics.push({\n file: `apps/${app}/${app}/${required}`,\n line: 1,\n col: 1,\n severity: 'error',\n message: `apps/${app}/${app}/${required} is missing — required by the Frappe app contract (bench install/migrate reads it)`,\n })\n }\n }\n }\n\n return diagnostics\n}\n"],"mappings":";AAAA,SAAS,YAAY,mBAAmB;AACxC,OAAO,UAAU;AAIjB,IAAM,iBAAiB,CAAC,YAAY,eAAe,eAAe,aAAa;AAG/E,SAAS,eAAe,KAAsB;AAC5C,MAAI;AACJ,MAAI;AACF,cAAU,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC;AAAA,EACpD,QAAQ;AACN,WAAO;AAAA,EACT;AACA,aAAW,KAAK,SAAS;AACvB,QAAI,EAAE,OAAO,KAAK,EAAE,KAAK,SAAS,KAAK,EAAG,QAAO;AACjD,QAAI,EAAE,YAAY,KAAK,CAAC,EAAE,KAAK,WAAW,GAAG,KAAK,eAAe,KAAK,KAAK,KAAK,EAAE,IAAI,CAAC,GAAG;AACxF,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUe,SAAR,MAAuB,MAA+B;AAC3D,QAAM,UAAU,KAAK,KAAK,MAAM,MAAM;AACtC,MAAI;AACJ,MAAI;AACF,cAAU,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC;AAAA,EACxD,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,cAA+B,CAAC;AAEtC,aAAW,SAAS,SAAS;AAC3B,QAAI,CAAC,MAAM,YAAY,EAAG;AAC1B,UAAM,MAAM,MAAM;AAClB,UAAM,SAAS,KAAK,KAAK,SAAS,GAAG;AAErC,QAAI,CAAC,WAAW,KAAK,KAAK,QAAQ,gBAAgB,CAAC,GAAG;AACpD,UAAI,eAAe,MAAM,GAAG;AAC1B,oBAAY,KAAK;AAAA,UACf,MAAM,QAAQ,GAAG;AAAA,UACjB,MAAM;AAAA,UACN,KAAK;AAAA,UACL,UAAU;AAAA,UACV,SAAS,QAAQ,GAAG;AAAA,QACtB,CAAC;AAAA,MACH;AACA;AAAA,IACF;AAEA,UAAM,SAAS,KAAK,KAAK,QAAQ,GAAG;AACpC,QAAI,CAAC,WAAW,MAAM,GAAG;AACvB,kBAAY,KAAK;AAAA,QACf,MAAM,QAAQ,GAAG;AAAA,QACjB,MAAM;AAAA,QACN,KAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS,uBAAuB,GAAG,IAAI,GAAG;AAAA,MAC5C,CAAC;AACD;AAAA,IACF;AAEA,eAAW,YAAY,gBAAgB;AACrC,UAAI,CAAC,WAAW,KAAK,KAAK,QAAQ,QAAQ,CAAC,GAAG;AAC5C,oBAAY,KAAK;AAAA,UACf,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,QAAQ;AAAA,UACpC,MAAM;AAAA,UACN,KAAK;AAAA,UACL,UAAU;AAAA,UACV,SAAS,QAAQ,GAAG,IAAI,GAAG,IAAI,QAAQ;AAAA,QACzC,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,12 @@
1
+ import { RawDiagnostic } from '@cubocicloide/dude';
2
+
3
+ /**
4
+ * APP002 — scheduler_events handlers resolve.
5
+ *
6
+ * The scheduler resolves dotted paths at runtime: a typo does not fail at
7
+ * install time, the job just never runs. Verify every handler declared in
8
+ * hooks.py scheduler_events exists on disk.
9
+ */
10
+ declare function check(root: string): RawDiagnostic[];
11
+
12
+ export { check as default };
@@ -0,0 +1,94 @@
1
+ // src/commands/lint/checks/APP/002.ts
2
+ import { existsSync, readdirSync, readFileSync } from "fs";
3
+ import path from "pathe";
4
+ function listApps(root) {
5
+ const appsDir = path.join(root, "apps");
6
+ try {
7
+ return readdirSync(appsDir, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, "pyproject.toml"))).map((e) => e.name);
8
+ } catch {
9
+ return [];
10
+ }
11
+ }
12
+ function extractBraceBlock(lines, name) {
13
+ const re = new RegExp(`^\\s*${name}\\s*=\\s*\\{`);
14
+ const start = lines.findIndex((l) => re.test(l));
15
+ if (start === -1) return null;
16
+ const block = [];
17
+ let depth = 0;
18
+ for (let i = start; i < lines.length; i++) {
19
+ const text = lines[i];
20
+ block.push({ text, line: i + 1 });
21
+ for (const ch of text) {
22
+ if (ch === "{") depth++;
23
+ else if (ch === "}") depth--;
24
+ }
25
+ if (depth <= 0) break;
26
+ }
27
+ return block;
28
+ }
29
+ var HANDLER_RE = /^[a-z_][\w.]*\.\w+$/;
30
+ function checkDottedHandlers(root, app, blockName) {
31
+ const hooksRel = `apps/${app}/${app}/hooks.py`;
32
+ let content;
33
+ try {
34
+ content = readFileSync(path.join(root, hooksRel), "utf8");
35
+ } catch {
36
+ return [];
37
+ }
38
+ const block = extractBraceBlock(content.split("\n"), blockName);
39
+ if (!block) return [];
40
+ const diagnostics = [];
41
+ for (const { text, line } of block) {
42
+ for (const m of text.matchAll(/["']([^"']+)["']/g)) {
43
+ const dotted = m[1];
44
+ if (!HANDLER_RE.test(dotted) || !dotted.startsWith(`${app}.`)) continue;
45
+ const segments = dotted.split(".");
46
+ const func = segments[segments.length - 1];
47
+ const modRel = segments.slice(0, -1).join("/");
48
+ const col = (m.index ?? 0) + 1;
49
+ const candidates = [
50
+ `apps/${app}/${modRel}.py`,
51
+ `apps/${app}/${modRel}/__init__.py`
52
+ ].filter((rel) => existsSync(path.join(root, rel)));
53
+ if (candidates.length === 0) {
54
+ diagnostics.push({
55
+ file: hooksRel,
56
+ line,
57
+ col,
58
+ severity: "error",
59
+ message: `${blockName} handler "${dotted}" does not resolve: apps/${app}/${modRel}.py not found`
60
+ });
61
+ continue;
62
+ }
63
+ const defRe = new RegExp(`^[ \\t]*(?:async[ \\t]+)?def[ \\t]+${func}[ \\t]*\\(`, "m");
64
+ const defined = candidates.some((rel) => {
65
+ try {
66
+ return defRe.test(readFileSync(path.join(root, rel), "utf8"));
67
+ } catch {
68
+ return false;
69
+ }
70
+ });
71
+ if (!defined) {
72
+ diagnostics.push({
73
+ file: hooksRel,
74
+ line,
75
+ col,
76
+ severity: "error",
77
+ message: `${blockName} handler "${dotted}" does not resolve: no "def ${func}(" in ${candidates.join(" or ")}`
78
+ });
79
+ }
80
+ }
81
+ }
82
+ return diagnostics;
83
+ }
84
+ function check(root) {
85
+ const diagnostics = [];
86
+ for (const app of listApps(root)) {
87
+ diagnostics.push(...checkDottedHandlers(root, app, "scheduler_events"));
88
+ }
89
+ return diagnostics;
90
+ }
91
+ export {
92
+ check as default
93
+ };
94
+ //# sourceMappingURL=002.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/commands/lint/checks/APP/002.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync } from 'node:fs'\nimport path from 'pathe'\nimport type { RawDiagnostic } from '@cubocicloide/dude'\n\n/** Apps under apps/ that have a pyproject.toml (valid bench apps). */\nfunction listApps(root: string): string[] {\n const appsDir = path.join(root, 'apps')\n try {\n return readdirSync(appsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, 'pyproject.toml')))\n .map((e) => e.name)\n } catch {\n return []\n }\n}\n\n/**\n * Extract a top-level `<name> = {...}` block from hooks.py via brace\n * balancing (the file is tab-indented — no whitespace assumptions).\n * Returns the block's lines with their 1-based line numbers.\n */\nfunction extractBraceBlock(\n lines: string[],\n name: string,\n): Array<{ text: string; line: number }> | null {\n const re = new RegExp(`^\\\\s*${name}\\\\s*=\\\\s*\\\\{`)\n const start = lines.findIndex((l) => re.test(l))\n if (start === -1) return null\n\n const block: Array<{ text: string; line: number }> = []\n let depth = 0\n for (let i = start; i < lines.length; i++) {\n const text = lines[i]!\n block.push({ text, line: i + 1 })\n for (const ch of text) {\n if (ch === '{') depth++\n else if (ch === '}') depth--\n }\n if (depth <= 0) break\n }\n return block\n}\n\n/** A dotted path is a handler when it starts with \"<app>.\" and looks like a.b.func. */\nconst HANDLER_RE = /^[a-z_][\\w.]*\\.\\w+$/\n\n/**\n * Verify every \"<app>.a.b.func\" string inside the given hooks.py block\n * resolves to a real `def func(` (or `async def`) on disk.\n */\nfunction checkDottedHandlers(root: string, app: string, blockName: string): RawDiagnostic[] {\n const hooksRel = `apps/${app}/${app}/hooks.py`\n let content: string\n try {\n content = readFileSync(path.join(root, hooksRel), 'utf8')\n } catch {\n return []\n }\n\n const block = extractBraceBlock(content.split('\\n'), blockName)\n if (!block) return []\n\n const diagnostics: RawDiagnostic[] = []\n for (const { text, line } of block) {\n for (const m of text.matchAll(/[\"']([^\"']+)[\"']/g)) {\n const dotted = m[1]!\n if (!HANDLER_RE.test(dotted) || !dotted.startsWith(`${app}.`)) continue\n\n const segments = dotted.split('.')\n const func = segments[segments.length - 1]!\n const modRel = segments.slice(0, -1).join('/')\n const col = (m.index ?? 0) + 1\n\n const candidates = [\n `apps/${app}/${modRel}.py`,\n `apps/${app}/${modRel}/__init__.py`,\n ].filter((rel) => existsSync(path.join(root, rel)))\n\n if (candidates.length === 0) {\n diagnostics.push({\n file: hooksRel,\n line,\n col,\n severity: 'error',\n message: `${blockName} handler \"${dotted}\" does not resolve: apps/${app}/${modRel}.py not found`,\n })\n continue\n }\n\n const defRe = new RegExp(`^[ \\\\t]*(?:async[ \\\\t]+)?def[ \\\\t]+${func}[ \\\\t]*\\\\(`, 'm')\n const defined = candidates.some((rel) => {\n try {\n return defRe.test(readFileSync(path.join(root, rel), 'utf8'))\n } catch {\n return false\n }\n })\n if (!defined) {\n diagnostics.push({\n file: hooksRel,\n line,\n col,\n severity: 'error',\n message: `${blockName} handler \"${dotted}\" does not resolve: no \"def ${func}(\" in ${candidates.join(' or ')}`,\n })\n }\n }\n }\n return diagnostics\n}\n\n/**\n * APP002 — scheduler_events handlers resolve.\n *\n * The scheduler resolves dotted paths at runtime: a typo does not fail at\n * install time, the job just never runs. Verify every handler declared in\n * hooks.py scheduler_events exists on disk.\n */\nexport default function check(root: string): RawDiagnostic[] {\n const diagnostics: RawDiagnostic[] = []\n for (const app of listApps(root)) {\n diagnostics.push(...checkDottedHandlers(root, app, 'scheduler_events'))\n }\n return diagnostics\n}\n"],"mappings":";AAAA,SAAS,YAAY,aAAa,oBAAoB;AACtD,OAAO,UAAU;AAIjB,SAAS,SAAS,MAAwB;AACxC,QAAM,UAAU,KAAK,KAAK,MAAM,MAAM;AACtC,MAAI;AACF,WAAO,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC,EAChD,OAAO,CAAC,MAAM,EAAE,YAAY,KAAK,WAAW,KAAK,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC,CAAC,EACzF,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,EACtB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAOA,SAAS,kBACP,OACA,MAC8C;AAC9C,QAAM,KAAK,IAAI,OAAO,QAAQ,IAAI,cAAc;AAChD,QAAM,QAAQ,MAAM,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AAC/C,MAAI,UAAU,GAAI,QAAO;AAEzB,QAAM,QAA+C,CAAC;AACtD,MAAI,QAAQ;AACZ,WAAS,IAAI,OAAO,IAAI,MAAM,QAAQ,KAAK;AACzC,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,KAAK,EAAE,MAAM,MAAM,IAAI,EAAE,CAAC;AAChC,eAAW,MAAM,MAAM;AACrB,UAAI,OAAO,IAAK;AAAA,eACP,OAAO,IAAK;AAAA,IACvB;AACA,QAAI,SAAS,EAAG;AAAA,EAClB;AACA,SAAO;AACT;AAGA,IAAM,aAAa;AAMnB,SAAS,oBAAoB,MAAc,KAAa,WAAoC;AAC1F,QAAM,WAAW,QAAQ,GAAG,IAAI,GAAG;AACnC,MAAI;AACJ,MAAI;AACF,cAAU,aAAa,KAAK,KAAK,MAAM,QAAQ,GAAG,MAAM;AAAA,EAC1D,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;A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,SAAS,GAAG,SAAS,aAAa,MAAM,+BAA+B,IAAI,SAAS,WAAW,KAAK,MAAM,CAAC;AAAA,QAC7G,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AASe,SAAR,MAAuB,MAA+B;AAC3D,QAAM,cAA+B,CAAC;AACtC,aAAW,OAAO,SAAS,IAAI,GAAG;AAChC,gBAAY,KAAK,GAAG,oBAAoB,MAAM,KAAK,kBAAkB,CAAC;AAAA,EACxE;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,12 @@
1
+ import { RawDiagnostic } from '@cubocicloide/dude';
2
+
3
+ /**
4
+ * APP003 — doc_events handlers resolve.
5
+ *
6
+ * Document-event handlers are resolved by dotted path at runtime: a typo does
7
+ * not fail at install time, the hook silently never fires. Verify every
8
+ * handler declared in hooks.py doc_events exists on disk.
9
+ */
10
+ declare function check(root: string): RawDiagnostic[];
11
+
12
+ export { check as default };
@@ -0,0 +1,94 @@
1
+ // src/commands/lint/checks/APP/003.ts
2
+ import { existsSync, readdirSync, readFileSync } from "fs";
3
+ import path from "pathe";
4
+ function listApps(root) {
5
+ const appsDir = path.join(root, "apps");
6
+ try {
7
+ return readdirSync(appsDir, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, "pyproject.toml"))).map((e) => e.name);
8
+ } catch {
9
+ return [];
10
+ }
11
+ }
12
+ function extractBraceBlock(lines, name) {
13
+ const re = new RegExp(`^\\s*${name}\\s*=\\s*\\{`);
14
+ const start = lines.findIndex((l) => re.test(l));
15
+ if (start === -1) return null;
16
+ const block = [];
17
+ let depth = 0;
18
+ for (let i = start; i < lines.length; i++) {
19
+ const text = lines[i];
20
+ block.push({ text, line: i + 1 });
21
+ for (const ch of text) {
22
+ if (ch === "{") depth++;
23
+ else if (ch === "}") depth--;
24
+ }
25
+ if (depth <= 0) break;
26
+ }
27
+ return block;
28
+ }
29
+ var HANDLER_RE = /^[a-z_][\w.]*\.\w+$/;
30
+ function checkDottedHandlers(root, app, blockName) {
31
+ const hooksRel = `apps/${app}/${app}/hooks.py`;
32
+ let content;
33
+ try {
34
+ content = readFileSync(path.join(root, hooksRel), "utf8");
35
+ } catch {
36
+ return [];
37
+ }
38
+ const block = extractBraceBlock(content.split("\n"), blockName);
39
+ if (!block) return [];
40
+ const diagnostics = [];
41
+ for (const { text, line } of block) {
42
+ for (const m of text.matchAll(/["']([^"']+)["']/g)) {
43
+ const dotted = m[1];
44
+ if (!HANDLER_RE.test(dotted) || !dotted.startsWith(`${app}.`)) continue;
45
+ const segments = dotted.split(".");
46
+ const func = segments[segments.length - 1];
47
+ const modRel = segments.slice(0, -1).join("/");
48
+ const col = (m.index ?? 0) + 1;
49
+ const candidates = [
50
+ `apps/${app}/${modRel}.py`,
51
+ `apps/${app}/${modRel}/__init__.py`
52
+ ].filter((rel) => existsSync(path.join(root, rel)));
53
+ if (candidates.length === 0) {
54
+ diagnostics.push({
55
+ file: hooksRel,
56
+ line,
57
+ col,
58
+ severity: "error",
59
+ message: `${blockName} handler "${dotted}" does not resolve: apps/${app}/${modRel}.py not found`
60
+ });
61
+ continue;
62
+ }
63
+ const defRe = new RegExp(`^[ \\t]*(?:async[ \\t]+)?def[ \\t]+${func}[ \\t]*\\(`, "m");
64
+ const defined = candidates.some((rel) => {
65
+ try {
66
+ return defRe.test(readFileSync(path.join(root, rel), "utf8"));
67
+ } catch {
68
+ return false;
69
+ }
70
+ });
71
+ if (!defined) {
72
+ diagnostics.push({
73
+ file: hooksRel,
74
+ line,
75
+ col,
76
+ severity: "error",
77
+ message: `${blockName} handler "${dotted}" does not resolve: no "def ${func}(" in ${candidates.join(" or ")}`
78
+ });
79
+ }
80
+ }
81
+ }
82
+ return diagnostics;
83
+ }
84
+ function check(root) {
85
+ const diagnostics = [];
86
+ for (const app of listApps(root)) {
87
+ diagnostics.push(...checkDottedHandlers(root, app, "doc_events"));
88
+ }
89
+ return diagnostics;
90
+ }
91
+ export {
92
+ check as default
93
+ };
94
+ //# sourceMappingURL=003.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/commands/lint/checks/APP/003.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync } from 'node:fs'\nimport path from 'pathe'\nimport type { RawDiagnostic } from '@cubocicloide/dude'\n\n/** Apps under apps/ that have a pyproject.toml (valid bench apps). */\nfunction listApps(root: string): string[] {\n const appsDir = path.join(root, 'apps')\n try {\n return readdirSync(appsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, 'pyproject.toml')))\n .map((e) => e.name)\n } catch {\n return []\n }\n}\n\n/**\n * Extract a top-level `<name> = {...}` block from hooks.py via brace\n * balancing (the file is tab-indented — no whitespace assumptions).\n * Returns the block's lines with their 1-based line numbers.\n */\nfunction extractBraceBlock(\n lines: string[],\n name: string,\n): Array<{ text: string; line: number }> | null {\n const re = new RegExp(`^\\\\s*${name}\\\\s*=\\\\s*\\\\{`)\n const start = lines.findIndex((l) => re.test(l))\n if (start === -1) return null\n\n const block: Array<{ text: string; line: number }> = []\n let depth = 0\n for (let i = start; i < lines.length; i++) {\n const text = lines[i]!\n block.push({ text, line: i + 1 })\n for (const ch of text) {\n if (ch === '{') depth++\n else if (ch === '}') depth--\n }\n if (depth <= 0) break\n }\n return block\n}\n\n/** A dotted path is a handler when it starts with \"<app>.\" and looks like a.b.func. */\nconst HANDLER_RE = /^[a-z_][\\w.]*\\.\\w+$/\n\n/**\n * Verify every \"<app>.a.b.func\" string inside the given hooks.py block\n * resolves to a real `def func(` (or `async def`) on disk.\n */\nfunction checkDottedHandlers(root: string, app: string, blockName: string): RawDiagnostic[] {\n const hooksRel = `apps/${app}/${app}/hooks.py`\n let content: string\n try {\n content = readFileSync(path.join(root, hooksRel), 'utf8')\n } catch {\n return []\n }\n\n const block = extractBraceBlock(content.split('\\n'), blockName)\n if (!block) return []\n\n const diagnostics: RawDiagnostic[] = []\n for (const { text, line } of block) {\n for (const m of text.matchAll(/[\"']([^\"']+)[\"']/g)) {\n const dotted = m[1]!\n if (!HANDLER_RE.test(dotted) || !dotted.startsWith(`${app}.`)) continue\n\n const segments = dotted.split('.')\n const func = segments[segments.length - 1]!\n const modRel = segments.slice(0, -1).join('/')\n const col = (m.index ?? 0) + 1\n\n const candidates = [\n `apps/${app}/${modRel}.py`,\n `apps/${app}/${modRel}/__init__.py`,\n ].filter((rel) => existsSync(path.join(root, rel)))\n\n if (candidates.length === 0) {\n diagnostics.push({\n file: hooksRel,\n line,\n col,\n severity: 'error',\n message: `${blockName} handler \"${dotted}\" does not resolve: apps/${app}/${modRel}.py not found`,\n })\n continue\n }\n\n const defRe = new RegExp(`^[ \\\\t]*(?:async[ \\\\t]+)?def[ \\\\t]+${func}[ \\\\t]*\\\\(`, 'm')\n const defined = candidates.some((rel) => {\n try {\n return defRe.test(readFileSync(path.join(root, rel), 'utf8'))\n } catch {\n return false\n }\n })\n if (!defined) {\n diagnostics.push({\n file: hooksRel,\n line,\n col,\n severity: 'error',\n message: `${blockName} handler \"${dotted}\" does not resolve: no \"def ${func}(\" in ${candidates.join(' or ')}`,\n })\n }\n }\n }\n return diagnostics\n}\n\n/**\n * APP003 — doc_events handlers resolve.\n *\n * Document-event handlers are resolved by dotted path at runtime: a typo does\n * not fail at install time, the hook silently never fires. Verify every\n * handler declared in hooks.py doc_events exists on disk.\n */\nexport default function check(root: string): RawDiagnostic[] {\n const diagnostics: RawDiagnostic[] = []\n for (const app of listApps(root)) {\n diagnostics.push(...checkDottedHandlers(root, app, 'doc_events'))\n }\n return diagnostics\n}\n"],"mappings":";AAAA,SAAS,YAAY,aAAa,oBAAoB;AACtD,OAAO,UAAU;AAIjB,SAAS,SAAS,MAAwB;AACxC,QAAM,UAAU,KAAK,KAAK,MAAM,MAAM;AACtC,MAAI;AACF,WAAO,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC,EAChD,OAAO,CAAC,MAAM,EAAE,YAAY,KAAK,WAAW,KAAK,KAAK,SAAS,EAAE,MAA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APP004 — Fixtures parity.
5
+ *
6
+ * Every DocType declared in hooks.py `fixtures` must have its exported
7
+ * apps/<app>/<app>/fixtures/<scrub(dt)>.json on disk, and every JSON file in
8
+ * the fixtures directory must be declared in hooks.py.
9
+ */
10
+ declare function check(root: string): RawDiagnostic[];
11
+
12
+ export { check as default };
@@ -0,0 +1,117 @@
1
+ // src/commands/lint/checks/APP/004.ts
2
+ import { existsSync, readdirSync, readFileSync } from "fs";
3
+ import path from "pathe";
4
+ function scrub(name) {
5
+ return name.toLowerCase().replace(/ /g, "_");
6
+ }
7
+ function listApps(root) {
8
+ const appsDir = path.join(root, "apps");
9
+ try {
10
+ return readdirSync(appsDir, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, "pyproject.toml"))).map((e) => e.name);
11
+ } catch {
12
+ return [];
13
+ }
14
+ }
15
+ function extractFixturesBlock(lines) {
16
+ const start = lines.findIndex((l) => /^\s*fixtures\s*=\s*\[/.test(l));
17
+ if (start === -1) return null;
18
+ const block = [];
19
+ let depth = 0;
20
+ for (let i = start; i < lines.length; i++) {
21
+ const text = lines[i];
22
+ block.push({ text, line: i + 1 });
23
+ for (const ch of text) {
24
+ if (ch === "[") depth++;
25
+ else if (ch === "]") depth--;
26
+ }
27
+ if (depth <= 0) break;
28
+ }
29
+ return block;
30
+ }
31
+ function declaredFixtures(block) {
32
+ const declared = /* @__PURE__ */ new Map();
33
+ const add = (dt, line) => {
34
+ if (!declared.has(scrub(dt))) declared.set(scrub(dt), { dt, line });
35
+ };
36
+ let square = 0;
37
+ let curly = 0;
38
+ let quote = null;
39
+ let current = "";
40
+ for (const { text, line } of block) {
41
+ for (let i = 0; i < text.length; i++) {
42
+ const ch = text[i];
43
+ if (quote) {
44
+ if (ch === "\\") {
45
+ current += ch + (text[i + 1] ?? "");
46
+ i++;
47
+ } else if (ch === quote) {
48
+ if (square === 1 && curly === 0) add(current, line);
49
+ quote = null;
50
+ } else {
51
+ current += ch;
52
+ }
53
+ continue;
54
+ }
55
+ if (ch === "#") break;
56
+ if (ch === '"' || ch === "'") {
57
+ quote = ch;
58
+ current = "";
59
+ } else if (ch === "[") square++;
60
+ else if (ch === "]") square--;
61
+ else if (ch === "{") curly++;
62
+ else if (ch === "}") curly--;
63
+ }
64
+ for (const m of text.matchAll(/["']dt["']\s*:\s*["']([^"']+)["']/g)) {
65
+ add(m[1], line);
66
+ }
67
+ }
68
+ return declared;
69
+ }
70
+ function check(root) {
71
+ const diagnostics = [];
72
+ for (const app of listApps(root)) {
73
+ const hooksRel = `apps/${app}/${app}/hooks.py`;
74
+ const fixturesDir = path.join(root, "apps", app, app, "fixtures");
75
+ let hooks = "";
76
+ try {
77
+ hooks = readFileSync(path.join(root, hooksRel), "utf8");
78
+ } catch {
79
+ continue;
80
+ }
81
+ const block = extractFixturesBlock(hooks.split("\n"));
82
+ let jsonFiles = [];
83
+ try {
84
+ jsonFiles = readdirSync(fixturesDir).filter((f) => f.endsWith(".json"));
85
+ } catch {
86
+ }
87
+ if (!block && jsonFiles.length === 0) continue;
88
+ const declared = block ? declaredFixtures(block) : /* @__PURE__ */ new Map();
89
+ for (const [scrubbed, { dt, line }] of declared) {
90
+ if (!jsonFiles.includes(`${scrubbed}.json`)) {
91
+ diagnostics.push({
92
+ file: hooksRel,
93
+ line,
94
+ col: 1,
95
+ severity: "error",
96
+ message: `Fixture "${dt}" is declared in hooks.py but apps/${app}/${app}/fixtures/${scrubbed}.json does not exist \u2014 run \`bench export-fixtures\` (or remove the declaration)`
97
+ });
98
+ }
99
+ }
100
+ for (const file of jsonFiles) {
101
+ if (!declared.has(file.replace(/\.json$/, ""))) {
102
+ diagnostics.push({
103
+ file: `apps/${app}/${app}/fixtures/${file}`,
104
+ line: 1,
105
+ col: 1,
106
+ severity: "error",
107
+ message: `fixtures/${file} is not declared in the \`fixtures\` list of hooks.py \u2014 undeclared fixture files are never imported by \`bench migrate\``
108
+ });
109
+ }
110
+ }
111
+ }
112
+ return diagnostics;
113
+ }
114
+ export {
115
+ check as default
116
+ };
117
+ //# sourceMappingURL=004.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/commands/lint/checks/APP/004.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync } from 'node:fs'\nimport path from 'pathe'\nimport type { RawDiagnostic } from '@cubocicloide/dude'\n\n/** Frappe's scrub(): lowercase, spaces → underscores. */\nfunction scrub(name: string): string {\n return name.toLowerCase().replace(/ /g, '_')\n}\n\n/** Apps under apps/ that have a pyproject.toml (valid bench apps). */\nfunction listApps(root: string): string[] {\n const appsDir = path.join(root, 'apps')\n try {\n return readdirSync(appsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, 'pyproject.toml')))\n .map((e) => e.name)\n } catch {\n return []\n }\n}\n\n/**\n * Extract a top-level `fixtures = [...]` block via bracket balancing\n * (the file is tab-indented — no whitespace assumptions).\n */\nfunction extractFixturesBlock(lines: string[]): Array<{ text: string; line: number }> | null {\n const start = lines.findIndex((l) => /^\\s*fixtures\\s*=\\s*\\[/.test(l))\n if (start === -1) return null\n\n const block: Array<{ text: string; line: number }> = []\n let depth = 0\n for (let i = start; i < lines.length; i++) {\n const text = lines[i]!\n block.push({ text, line: i + 1 })\n for (const ch of text) {\n if (ch === '[') depth++\n else if (ch === ']') depth--\n }\n if (depth <= 0) break\n }\n return block\n}\n\n/**\n * Collect the DocTypes declared in the fixtures block.\n * Handles both dict entries ({\"dt\": \"Workflow\", ...}) and plain string\n * entries (\"Workflow\"): a quoted string sitting directly in the list\n * (square depth 1, curly depth 0) is a plain fixture name.\n */\nfunction declaredFixtures(block: Array<{ text: string; line: number }>): Map<string, { dt: string; line: number }> {\n const declared = new Map<string, { dt: string; line: number }>()\n const add = (dt: string, line: number) => {\n if (!declared.has(scrub(dt))) declared.set(scrub(dt), { dt, line })\n }\n\n let square = 0\n let curly = 0\n let quote: string | null = null\n let current = ''\n for (const { text, line } of block) {\n for (let i = 0; i < text.length; i++) {\n const ch = text[i]!\n if (quote) {\n if (ch === '\\\\') {\n current += ch + (text[i + 1] ?? '')\n i++\n } else if (ch === quote) {\n if (square === 1 && curly === 0) add(current, line) // plain string entry\n quote = null\n } else {\n current += ch\n }\n continue\n }\n if (ch === '#') break // python comment — ignore rest of line\n if (ch === '\"' || ch === \"'\") {\n quote = ch\n current = ''\n } else if (ch === '[') square++\n else if (ch === ']') square--\n else if (ch === '{') curly++\n else if (ch === '}') curly--\n }\n // dict entries: {\"dt\": \"Workflow State\", ...}\n for (const m of text.matchAll(/[\"']dt[\"']\\s*:\\s*[\"']([^\"']+)[\"']/g)) {\n add(m[1]!, line)\n }\n }\n return declared\n}\n\n/**\n * APP004 — Fixtures parity.\n *\n * Every DocType declared in hooks.py `fixtures` must have its exported\n * apps/<app>/<app>/fixtures/<scrub(dt)>.json on disk, and every JSON file in\n * the fixtures directory must be declared in hooks.py.\n */\nexport default function check(root: string): RawDiagnostic[] {\n const diagnostics: RawDiagnostic[] = []\n\n for (const app of listApps(root)) {\n const hooksRel = `apps/${app}/${app}/hooks.py`\n const fixturesDir = path.join(root, 'apps', app, app, 'fixtures')\n\n let hooks = ''\n try {\n hooks = readFileSync(path.join(root, hooksRel), 'utf8')\n } catch {\n continue // APP001 reports the missing hooks.py\n }\n\n const block = extractFixturesBlock(hooks.split('\\n'))\n\n let jsonFiles: string[] = []\n try {\n jsonFiles = readdirSync(fixturesDir).filter((f) => f.endsWith('.json'))\n } catch {\n // no fixtures directory\n }\n\n if (!block && jsonFiles.length === 0) continue\n\n const declared = block ? declaredFixtures(block) : new Map<string, { dt: string; line: number }>()\n\n // declared in hooks.py → file must exist\n for (const [scrubbed, { dt, line }] of declared) {\n if (!jsonFiles.includes(`${scrubbed}.json`)) {\n diagnostics.push({\n file: hooksRel,\n line,\n col: 1,\n severity: 'error',\n message: `Fixture \"${dt}\" is declared in hooks.py but apps/${app}/${app}/fixtures/${scrubbed}.json does not exist — run \\`bench export-fixtures\\` (or remove the declaration)`,\n })\n }\n }\n\n // file on disk → must be declared in hooks.py\n for (const file of jsonFiles) {\n if (!declared.has(file.replace(/\\.json$/, ''))) {\n diagnostics.push({\n file: `apps/${app}/${app}/fixtures/${file}`,\n line: 1,\n col: 1,\n severity: 'error',\n message: `fixtures/${file} is not declared in the \\`fixtures\\` list of hooks.py — undeclared fixture files are never imported by \\`bench migrate\\``,\n })\n }\n }\n }\n\n return diagnostics\n}\n"],"mappings":";AAAA,SAAS,YAAY,aAAa,oBAAoB;AACtD,OAAO,UAAU;AAIjB,SAAS,MAAM,MAAsB;AACnC,SAAO,KAAK,YAAY,EAAE,QAAQ,MAAM,GAAG;AAC7C;AAGA,SAAS,SAAS,MAAwB;AACxC,QAAM,UAAU,KAAK,KAAK,MAAM,MAAM;AACtC,MAAI;AACF,WAAO,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC,EAChD,OAAO,CAAC,MAAM,EAAE,YAAY,KAAK,WAAW,KAAK,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC,CAAC,EACzF,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,EACtB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAMA,SAAS,qBAAqB,OAA+D;AAC3F,QAAM,QAAQ,MAAM,UAAU,CAAC,MAAM,wBAAwB,KAAK,CAAC,CAAC;AACpE,MAAI,UAAU,GAAI,QAAO;AAEzB,QAAM,QAA+C,CAAC;AACtD,MAAI,QAAQ;AACZ,WAAS,IAAI,OAAO,IAAI,MAAM,QAAQ,KAAK;AACzC,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,KAAK,EAAE,MAAM,MAAM,IAAI,EAAE,CAAC;AAChC,eAAW,MAAM,MAAM;AACrB,UAAI,OAAO,IAAK;AAAA,eACP,OAAO,IAAK;AAAA,IACvB;AACA,QAAI,SAAS,EAAG;AAAA,EAClB;AACA,SAAO;AACT;AAQA,SAAS,iBAAiB,OAAyF;AACjH,QAAM,WAAW,oBAAI,IAA0C;AAC/D,QAAM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AAQ,qBAAqB,MAAM,MAAM,IAAI,CAAC;AAEpD,QAAI,YAAsB,CAAC;AAC3B,QAAI;AACF,kBAAY,YAAY,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,CAAC;AAAA,IACxE,QAAQ;AAAA,IAER;AAEA,QAAI,CAAC,SAAS,UAAU,WAAW,EAAG;AAEtC,UAAM,WAAW,QAAQ,iBAAiB,KAAK,IAAI,oBAAI,IAA0C;AAGjG,eAAW,CAAC,UAAU,EAAE,IAAI,KAAK,CAAC,KAAK,UAAU;AAC/C,UAAI,CAAC,UAAU,SAAS,GAAG,QAAQ,OAAO,GAAG;AAC3C,oBAAY,KAAK;AAAA,UACf,MAAM;AAAA,UACN;AAAA,UACA,KAAK;AAAA,UACL,UAAU;AAAA,UACV,SAAS,YAAY,EAAE,sCAAsC,GAAG,IAAI,GAAG,aAAa,QAAQ;AAAA,QAC9F,CAAC;AAAA,MACH;AAAA,IACF;AAGA,eAAW,QAAQ,WAAW;AAC5B,UAAI,CAAC,SAAS,IAAI,KAAK,QAAQ,WAAW,EAAE,CAAC,GAAG;AAC9C,oBAAY,KAAK;AAAA,UACf,MAAM,QAAQ,GAAG,IAAI,GAAG,aAAa,IAAI;AAAA,UACzC,MAAM;AAAA,UACN,KAAK;AAAA,UACL,UAAU;AAAA,UACV,SAAS,YAAY,IAAI;AAAA,QAC3B,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { RawDiagnostic } from '@cubocicloide/dude';
2
+
3
+ /**
4
+ * DT001 — DocType bundle completeness.
5
+ *
6
+ * Every doctype directory must contain the schema (<d>.json), the controller
7
+ * (<d>.py) and __init__.py. The .js form script is optional.
8
+ */
9
+ declare function check(root: string): RawDiagnostic[];
10
+
11
+ export { check as default };
@@ -0,0 +1,57 @@
1
+ // src/commands/lint/checks/DT/001.ts
2
+ import { existsSync, readdirSync } from "fs";
3
+ import path from "pathe";
4
+ function listApps(root) {
5
+ const appsDir = path.join(root, "apps");
6
+ try {
7
+ return readdirSync(appsDir, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, "pyproject.toml"))).map((e) => e.name);
8
+ } catch {
9
+ return [];
10
+ }
11
+ }
12
+ function listDoctypeDirs(root) {
13
+ const out = [];
14
+ for (const app of listApps(root)) {
15
+ const pkg = path.join(root, "apps", app, app);
16
+ let moduleDirs = [];
17
+ try {
18
+ moduleDirs = readdirSync(pkg, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync(path.join(pkg, e.name, "doctype"))).map((e) => e.name);
19
+ } catch {
20
+ continue;
21
+ }
22
+ for (const mod of moduleDirs) {
23
+ let names = [];
24
+ try {
25
+ names = readdirSync(path.join(pkg, mod, "doctype"), { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith(".") && e.name !== "__pycache__").map((e) => e.name);
26
+ } catch {
27
+ continue;
28
+ }
29
+ for (const name of names) {
30
+ out.push({ app, module: mod, name, rel: `apps/${app}/${app}/${mod}/doctype/${name}` });
31
+ }
32
+ }
33
+ }
34
+ return out;
35
+ }
36
+ function check(root) {
37
+ const diagnostics = [];
38
+ for (const dt of listDoctypeDirs(root)) {
39
+ const required = [`${dt.name}.json`, `${dt.name}.py`, "__init__.py"];
40
+ for (const file of required) {
41
+ if (!existsSync(path.join(root, dt.rel, file))) {
42
+ diagnostics.push({
43
+ file: `${dt.rel}/${file}`,
44
+ line: 1,
45
+ col: 1,
46
+ severity: "error",
47
+ message: `DocType bundle "${dt.name}" is missing ${file} \u2014 Frappe expects schema JSON, controller and __init__.py side by side in the doctype directory`
48
+ });
49
+ }
50
+ }
51
+ }
52
+ return diagnostics;
53
+ }
54
+ export {
55
+ check as default
56
+ };
57
+ //# sourceMappingURL=001.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/commands/lint/checks/DT/001.ts"],"sourcesContent":["import { existsSync, readdirSync } from 'node:fs'\nimport path from 'pathe'\nimport type { RawDiagnostic } from '@cubocicloide/dude'\n\n/** Apps under apps/ that have a pyproject.toml (valid bench apps). */\nfunction listApps(root: string): string[] {\n const appsDir = path.join(root, 'apps')\n try {\n return readdirSync(appsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory() && existsSync(path.join(appsDir, e.name, 'pyproject.toml')))\n .map((e) => e.name)\n } catch {\n return []\n }\n}\n\ninterface DoctypeDir {\n app: string\n module: string // module directory name, e.g. \"ticketing\"\n name: string // doctype directory name, e.g. \"ticket_escalation_rule\"\n rel: string // repo-relative doctype directory\n}\n\n/** Every apps/<app>/<app>/<module>/doctype/<d>/ directory. */\nfunction listDoctypeDirs(root: string): DoctypeDir[] {\n const out: DoctypeDir[] = []\n for (const app of listApps(root)) {\n const pkg = path.join(root, 'apps', app, app)\n let moduleDirs: string[] = []\n try {\n moduleDirs = readdirSync(pkg, { withFileTypes: true })\n .filter((e) => e.isDirectory() && existsSync(path.join(pkg, e.name, 'doctype')))\n .map((e) => e.name)\n } catch {\n continue\n }\n for (const mod of moduleDirs) {\n let names: string[] = []\n try {\n names = readdirSync(path.join(pkg, mod, 'doctype'), { withFileTypes: true })\n .filter((e) => e.isDirectory() && !e.name.startsWith('.') && e.name !== '__pycache__')\n .map((e) => e.name)\n } catch {\n continue\n }\n for (const name of names) {\n out.push({ app, module: mod, name, rel: `apps/${app}/${app}/${mod}/doctype/${name}` })\n }\n }\n }\n return out\n}\n\n/**\n * DT001 — DocType bundle completeness.\n *\n * Every doctype directory must contain the schema (<d>.json), the controller\n * (<d>.py) and __init__.py. The .js form script is optional.\n */\nexport default function check(root: string): RawDiagnostic[] {\n const diagnostics: RawDiagnostic[] = []\n\n for (const dt of listDoctypeDirs(root)) {\n const required = [`${dt.name}.json`, `${dt.name}.py`, '__init__.py']\n for (const file of required) {\n if (!existsSync(path.join(root, dt.rel, file))) {\n diagnostics.push({\n file: `${dt.rel}/${file}`,\n line: 1,\n col: 1,\n severity: 'error',\n message: `DocType bundle \"${dt.name}\" is missing ${file} — Frappe expects schema JSON, controller and __init__.py side by side in the doctype directory`,\n })\n }\n }\n }\n\n return diagnostics\n}\n"],"mappings":";AAAA,SAAS,YAAY,mBAAmB;AACxC,OAAO,UAAU;AAIjB,SAAS,SAAS,MAAwB;AACxC,QAAM,UAAU,KAAK,KAAK,MAAM,MAAM;AACtC,MAAI;AACF,WAAO,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC,EAChD,OAAO,CAAC,MAAM,EAAE,YAAY,KAAK,WAAW,KAAK,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC,CAAC,EACzF,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,EACtB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAUA,SAAS,gBAAgB,MAA4B;AACnD,QAAM,MAAoB,CAAC;AAC3B,aAAW,OAAO,SAAS,IAAI,GAAG;AAChC,UAAM,MAAM,KAAK,KAAK,MAAM,QAAQ,KAAK,GAAG;AAC5C,QAAI,aAAuB,CAAC;AAC5B,QAAI;AACF,mBAAa,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC,EAClD,OAAO,CAAC,MAAM,EAAE,YAAY,KAAK,WAAW,KAAK,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC,CAAC,EAC9E,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,IACtB,QAAQ;AACN;AAAA,IACF;AACA,eAAW,OAAO,YAAY;AAC5B,UAAI,QAAkB,CAAC;AACvB,UAAI;AACF,gBAAQ,YAAY,KAAK,KAAK,KAAK,KAAK,SAAS,GAAG,EAAE,eAAe,KAAK,CAAC,EACxE,OAAO,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,EAAE,KAAK,WAAW,GAAG,KAAK,EAAE,SAAS,aAAa,EACpF,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,MACtB,QAAQ;AACN;AAAA,MACF;AACA,iBAAW,QAAQ,OAAO;AACxB,YAAI,KAAK,EAAE,KAAK,QAA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