@polymorphism-tech/morph-spec 9.4.0 → 9.5.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.
Files changed (85) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +2 -2
  3. package/claude-plugin.json +1 -1
  4. package/docs/CHEATSHEET.md +1 -1
  5. package/docs/QUICKSTART.md +1 -1
  6. package/framework/MORPH.md +23 -33
  7. package/framework/agents.json +6 -7
  8. package/framework/docs/CLI.md +3 -3
  9. package/framework/hooks/README.md +2 -2
  10. package/framework/hooks/claude-code/__pycache__/statusline.cpython-313.pyc +0 -0
  11. package/framework/hooks/claude-code/core/comment-guard.js +1 -0
  12. package/framework/hooks/claude-code/core/denylist.json +63 -1
  13. package/framework/hooks/claude-code/core/enforce-phase-writes.js +0 -8
  14. package/framework/hooks/claude-code/core/gate-guard.js +0 -8
  15. package/framework/hooks/claude-code/core/loop-detect.js +0 -3
  16. package/framework/hooks/claude-code/core/pre-bash-denylist.js +2 -1
  17. package/framework/hooks/claude-code/core/protect-spec-files.js +0 -7
  18. package/framework/hooks/claude-code/core/validate-completion.js +0 -4
  19. package/framework/hooks/claude-code/core/worktree-context.js +0 -2
  20. package/framework/hooks/claude-code/statusline.py +3 -44
  21. package/framework/hooks/shared/build-check.js +12 -19
  22. package/framework/hooks/shared/comment-rules.js +11 -1
  23. package/framework/hooks/shared/hook-response.js +0 -4
  24. package/framework/hooks/shared/payload-utils.js +1 -35
  25. package/framework/hooks/shared/phase-utils.js +0 -12
  26. package/framework/hooks/shared/slice-progress.js +0 -2
  27. package/framework/hooks/shared/state-reader.js +0 -19
  28. package/framework/hooks/shared/telemetry-logger.js +1 -1
  29. package/framework/rules/frontend-standards.md +1 -2
  30. package/framework/rules/nextjs-standards.md +9 -8
  31. package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
  32. package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
  33. package/framework/skills/core/morph-apply/SKILL.md +1 -1
  34. package/framework/skills/core/morph-hotfix/SKILL.md +1 -1
  35. package/framework/skills/core/morph-machine/SKILL.md +2 -2
  36. package/framework/skills/core/morph-media/SKILL.md +1 -1
  37. package/framework/skills/core/morph-plan/SKILL.md +1 -1
  38. package/framework/skills/core/morph-review/SKILL.md +1 -1
  39. package/framework/skills/core/morph-standards/SKILL.md +1 -1
  40. package/framework/skills/core/morph-uiux/SKILL.md +1 -1
  41. package/framework/standards/STANDARDS.json +32 -29
  42. package/framework/standards/STANDARDS.meta.json +13 -15
  43. package/framework/standards/architecture/code-comments.md +1 -1
  44. package/framework/standards/frontend/admin-app/data-table.md +1 -3
  45. package/framework/standards/frontend/admin-app/page-structure.md +8 -4
  46. package/framework/standards/frontend/nextjs/app-router.md +3 -4
  47. package/framework/standards/frontend/nextjs/components.md +2 -15
  48. package/framework/standards/frontend/nextjs/data-fetching.md +2 -3
  49. package/framework/standards/frontend/nextjs/lint.md +141 -0
  50. package/framework/standards/frontend/nextjs/motion-patterns.md +2 -7
  51. package/framework/standards/frontend/nextjs/naming-conventions.md +1 -2
  52. package/framework/standards/frontend/nextjs/nextjs-patterns.md +5 -7
  53. package/framework/standards/frontend/nextjs/project-structure.md +3 -2
  54. package/framework/standards/frontend/nextjs/state-management.md +6 -7
  55. package/framework/templates/README.md +4 -4
  56. package/framework/templates/REGISTRY.json +21 -309
  57. package/framework/templates/frontend/nextjs/feature-form.tsx.hbs +54 -56
  58. package/package.json +3 -2
  59. package/src/core/paths/output-schema.js +0 -9
  60. package/src/core/state/feature-identity.js +0 -2
  61. package/src/core/state/state-manager.js +1 -169
  62. package/src/core/templates/template-renderer.js +0 -23
  63. package/src/dashboard/app/lib/format.js +0 -7
  64. package/src/dashboard/app/lib/phases.js +0 -7
  65. package/src/dashboard/scanner/activity-scanner.js +0 -4
  66. package/src/lib/ai/ai-project-scan.js +1 -6
  67. package/src/lib/graph/graphify-runtime.js +0 -1
  68. package/src/lib/mutation/snapshot.js +1 -5
  69. package/src/lib/risk-detector.js +0 -5
  70. package/src/lib/stack/stack-profile.js +0 -4
  71. package/src/lib/stack/stack-scan.js +15 -4
  72. package/src/lib/tasks/eval-node.js +1 -7
  73. package/src/lib/validators/validation-runner.js +0 -43
  74. package/src/lib/validators/verify-runner.js +18 -2
  75. package/src/utils/agents-installer.js +12 -19
  76. package/src/utils/claude-settings-manager.js +0 -28
  77. package/src/utils/file-copier.js +0 -53
  78. package/framework/hooks/shared/activity-logger.js +0 -131
  79. package/framework/standards/frontend/design-system/naming.md +0 -68
  80. package/src/commands/validation/index.js +0 -2
  81. package/src/lib/validators/code-budget/index.js +0 -2
  82. package/src/lib/validators/contracts/index.js +0 -1
  83. package/src/lib/validators/nextjs/index.js +0 -1
  84. package/src/lib/validators/packages/index.js +0 -1
  85. package/src/lib/validators/reuse/index.js +0 -2
@@ -14,10 +14,11 @@ Feature-based architecture with a shared core. Features are self-contained; shar
14
14
  ## Core Rules
15
15
 
16
16
  - ALWAYS use feature-based folders: `features/{feature-name}/`
17
- - ALWAYS keep `app/` for routing only — import from `features/`, not the other way
17
+ - ALWAYS keep `app/` for routing only — the screen's logic lives in `features/`
18
18
  - NEVER import from one feature into another — extract to `components/` or `lib/` if shared
19
19
  - ALWAYS use `src/` directory (configured in `tsconfig.json` with `@/` alias)
20
20
  - NEVER put business logic in `components/` — it is presentation only
21
+ - Deep imports into a feature from outside it, `components/` → `features/`, `features/` → `app/` and shared `hooks/` → the API client are lint errors (`frontend-nextjs-lint`)
21
22
 
22
23
  ## Canonical Folder Tree
23
24
 
@@ -82,7 +83,7 @@ export { useCreateUser } from './hooks/use-create-user';
82
83
  export type { User, CreateUserInput } from './types/user.types';
83
84
  ```
84
85
 
85
- Import from the index, not deep paths:
86
+ Outside the feature, import from the index:
86
87
  ```ts
87
88
  // GOOD
88
89
  import { UserList, useUsers } from '@/features/users';
@@ -16,7 +16,7 @@ Server state (API data) lives in TanStack Query. UI state lives in React. No glo
16
16
  - ALWAYS use TanStack Query for anything that comes from the .NET API
17
17
  - ALWAYS use `useState` for local UI state (modal open, form step)
18
18
  - ALWAYS keep a list's page, sort and filters, and a page's active tab, in the URL (`searchParams`) — never in `useState`: a refresh or a shared link must reopen the same view (`admin-app/data-table.md`, `admin-app/page-structure.md`)
19
- - NEVER install Zustand or Redux without first exhausting Server Components + TanStack Query
19
+ - `zustand`, `redux` and `@reduxjs/toolkit` are lint errors (`frontend-nextjs-lint`); the only way past it is the exception below
20
20
  - NEVER use React Context for server state — Context does not cache or deduplicate
21
21
  - ALWAYS derive state from server data rather than syncing it to local state
22
22
 
@@ -30,9 +30,9 @@ Is this local UI state (open/closed, selected, current step)?
30
30
  YES → useState in the component that needs it
31
31
 
32
32
  Does multiple components need this UI state?
33
- YES — is it parent-child? → prop drilling (2-3 levels is fine)
33
+ YES — is it parent-child? → props
34
34
  YES — is it truly global? → React Context (theme, auth user, locale)
35
- YES — complex with many actions? → Consider Zustand (last resort)
35
+ YES — complex with many actions? → global store (exception below)
36
36
  ```
37
37
 
38
38
  ## Server State (TanStack Query)
@@ -55,9 +55,10 @@ function UserList() {
55
55
  }
56
56
  ```
57
57
 
58
- ## When Zustand Is Justified
58
+ ## When a Global Store Is Justified
59
59
 
60
- Only add Zustand if ALL of these are true:
60
+ The lint blocks the import. Lift it only if ALL of these are true, with one
61
+ `// eslint-disable-next-line no-restricted-imports -- <reason>` in the single store file:
61
62
  1. State is needed in 5+ unrelated components
62
63
  2. State has complex update logic (not just toggle/set)
63
64
  3. Context causes measurable re-render performance issues
@@ -67,10 +68,8 @@ Only add Zustand if ALL of these are true:
67
68
 
68
69
  | Wrong | Right | Why |
69
70
  |-------|-------|-----|
70
- | `useEffect` + `useState` for API data | TanStack Query | Stale data, no cache, double-render |
71
71
  | Global store for user list | `useUsers()` | TanStack Query handles sync/cache |
72
72
  | Context for everything | useState + prop drilling first | Context causes all consumers to re-render |
73
- | Zustand by default | Start with useState | YAGNI — most state is local |
74
73
 
75
74
  ---
76
75
 
@@ -8,8 +8,8 @@
8
8
  nextjs) rather than by stack. A template for a .NET slice serves every stack with a .NET
9
9
  backend, so a new stack reuses what exists instead of copying it.
10
10
 
11
- `REGISTRY.json` is the source of truth: it maps each template `id` to its `path`, category,
12
- technology and applicable stacks. Nothing resolves a template by hardcoded path — code goes
11
+ `REGISTRY.json` is the source of truth: it maps each template `id` to its `kind`, `path` and
12
+ `category` (the shape per kind is in its `kinds` block). Nothing resolves a template by hardcoded path — code goes
13
13
  through the registry, and this README never repeats a path the registry already owns.
14
14
 
15
15
  ---
@@ -109,8 +109,8 @@ updates** — only override when the packaged template genuinely does not fit.
109
109
  1. Create the file under the right technology directory:
110
110
  `framework/templates/code/{technology}/...` (Handlebars syntax, `.hbs` when the extension
111
111
  would otherwise confuse tooling).
112
- 2. Register it in `REGISTRY.json` with a unique `id`, its `path`, `category`, `technology`
113
- and applicable stacks.
112
+ 2. Register it in `REGISTRY.json` with a unique `id`, its `kind`, `path` and `category`, plus
113
+ the fields its kind requires (`kinds` block; `scripts/validate-framework.js` checks them).
114
114
  3. If a generator should emit it, add the `id` to the relevant list in
115
115
  `src/lib/generators/scaffold-generator.js`.
116
116