@elevasis/sdk 1.44.3 → 1.45.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 (246) hide show
  1. package/dist/cli.cjs +991 -650
  2. package/dist/index.d.ts +1045 -509
  3. package/dist/index.js +738 -688
  4. package/dist/node/index.d.ts +105 -97
  5. package/dist/test-utils/index.d.ts +42 -28
  6. package/dist/test-utils/index.js +514 -783
  7. package/dist/worker/index.d.ts +12112 -0
  8. package/dist/worker/index.js +121 -182
  9. package/package.json +6 -9
  10. package/reference/_navigation.md +151 -21
  11. package/reference/_reference-manifest.json +186 -4
  12. package/reference/claude-config.md +8 -0
  13. package/reference/core/index.mdx +3 -3
  14. package/reference/examples/organization-model.ts +117 -111
  15. package/reference/index.mdx +4 -4
  16. package/reference/rules/active-change-index.md +40 -54
  17. package/reference/rules/agent-runtime.md +81 -0
  18. package/reference/rules/agent-start-here.md +71 -163
  19. package/reference/rules/deployment.md +33 -10
  20. package/reference/rules/error-handling.md +26 -0
  21. package/reference/rules/execution.md +13 -0
  22. package/reference/rules/frontend.md +10 -3
  23. package/reference/rules/observability.md +9 -1
  24. package/reference/rules/operations.md +26 -17
  25. package/reference/rules/organization-model.md +74 -88
  26. package/reference/rules/organization-os.md +71 -88
  27. package/reference/rules/package-taxonomy.md +11 -2
  28. package/reference/rules/platform.md +13 -7
  29. package/reference/rules/shared-types.md +15 -0
  30. package/reference/rules/task-tracking.md +30 -5
  31. package/reference/rules/ui.md +145 -3
  32. package/reference/rules/vibe-intents.md +271 -0
  33. package/reference/rules/vibe.md +17 -243
  34. package/reference/scaffold/core/organization-graph.mdx +111 -97
  35. package/reference/scaffold/core/organization-model.mdx +234 -214
  36. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  37. package/reference/scaffold/operations/scaffold-maintenance.md +19 -18
  38. package/reference/scaffold/operations/workflow-recipes.md +71 -19
  39. package/reference/scaffold/recipes/add-a-feature.md +156 -146
  40. package/reference/scaffold/recipes/add-a-resource.md +123 -117
  41. package/reference/scaffold/recipes/customize-crm-actions.md +25 -10
  42. package/reference/scaffold/recipes/customize-knowledge-browser.md +52 -117
  43. package/reference/scaffold/recipes/customize-organization-model.md +161 -149
  44. package/reference/scaffold/recipes/extend-a-base-entity.md +156 -140
  45. package/reference/scaffold/recipes/extend-crm.md +16 -11
  46. package/reference/scaffold/recipes/extend-lead-gen.md +25 -7
  47. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +160 -118
  48. package/reference/scaffold/recipes/index.md +2 -2
  49. package/reference/scaffold/recipes/query-the-knowledge-graph.md +23 -23
  50. package/reference/scaffold/reference/contracts.md +12 -1
  51. package/reference/scaffold/reference/glossary.md +3 -3
  52. package/reference/scaffold/reference/system-interface-capabilities.md +5 -4
  53. package/reference/scaffold/ui/composition-extensibility.mdx +271 -232
  54. package/reference/scaffold/ui/feature-flags-and-gating.md +14 -6
  55. package/reference/scaffold/ui/feature-shell.mdx +279 -62
  56. package/reference/scaffold/ui/recipes.md +229 -197
  57. package/reference/sdk/cli-management.mdx +77 -29
  58. package/reference/sdk/concepts.mdx +2 -0
  59. package/reference/sdk/define-builders.mdx +76 -0
  60. package/reference/sdk/deployment/command-center.mdx +6 -2
  61. package/reference/sdk/deployment/execution-reference.mdx +64 -186
  62. package/reference/sdk/deployment/index.mdx +2 -0
  63. package/reference/sdk/exports.mdx +4 -4
  64. package/reference/sdk/framework/agent.mdx +49 -119
  65. package/reference/sdk/framework/index.mdx +46 -65
  66. package/reference/sdk/framework/project-structure.mdx +150 -205
  67. package/reference/sdk/framework/tutorial-system.mdx +2 -2
  68. package/reference/sdk/human-in-the-loop.mdx +152 -0
  69. package/reference/sdk/index.mdx +6 -7
  70. package/reference/sdk/platform-tools/index.mdx +12 -0
  71. package/reference/sdk/platform-tools/type-safety.mdx +4 -0
  72. package/reference/sdk/project-deployment-spec.mdx +131 -0
  73. package/reference/sdk/resources/index.mdx +21 -7
  74. package/reference/sdk/resources/patterns.mdx +54 -24
  75. package/reference/sdk/resources/types.mdx +7 -4
  76. package/reference/sdk/templates/data-enrichment.mdx +7 -3
  77. package/reference/sdk/templates/email-sender.mdx +139 -135
  78. package/reference/sdk/templates/lead-scorer.mdx +5 -1
  79. package/reference/sdk/templates/pdf-generator.mdx +155 -151
  80. package/reference/sdk/templates/recurring-job.mdx +195 -189
  81. package/reference/sdk/templates/text-classifier.mdx +4 -0
  82. package/reference/sdk/templates/web-scraper.mdx +139 -135
  83. package/reference/spine/spine-primer.md +135 -96
  84. package/reference/ui/index.mdx +14 -7
  85. package/dist/types/worker/adapters/anymailfinder.d.ts +0 -14
  86. package/dist/types/worker/adapters/apify.d.ts +0 -14
  87. package/dist/types/worker/adapters/approval.d.ts +0 -23
  88. package/dist/types/worker/adapters/attio.d.ts +0 -22
  89. package/dist/types/worker/adapters/clickup.d.ts +0 -22
  90. package/dist/types/worker/adapters/create-adapter.d.ts +0 -41
  91. package/dist/types/worker/adapters/crm.d.ts +0 -20
  92. package/dist/types/worker/adapters/dropbox.d.ts +0 -14
  93. package/dist/types/worker/adapters/email.d.ts +0 -25
  94. package/dist/types/worker/adapters/execution.d.ts +0 -22
  95. package/dist/types/worker/adapters/gmail.d.ts +0 -14
  96. package/dist/types/worker/adapters/google-sheets.d.ts +0 -14
  97. package/dist/types/worker/adapters/index.d.ts +0 -33
  98. package/dist/types/worker/adapters/instantly.d.ts +0 -14
  99. package/dist/types/worker/adapters/lead.d.ts +0 -28
  100. package/dist/types/worker/adapters/list.d.ts +0 -9
  101. package/dist/types/worker/adapters/llm.d.ts +0 -45
  102. package/dist/types/worker/adapters/millionverifier.d.ts +0 -14
  103. package/dist/types/worker/adapters/notification.d.ts +0 -28
  104. package/dist/types/worker/adapters/pdf.d.ts +0 -22
  105. package/dist/types/worker/adapters/projects.d.ts +0 -20
  106. package/dist/types/worker/adapters/resend.d.ts +0 -14
  107. package/dist/types/worker/adapters/scheduler.d.ts +0 -25
  108. package/dist/types/worker/adapters/signature-api.d.ts +0 -14
  109. package/dist/types/worker/adapters/storage.d.ts +0 -33
  110. package/dist/types/worker/adapters/stripe.d.ts +0 -14
  111. package/dist/types/worker/adapters/tomba.d.ts +0 -14
  112. package/dist/types/worker/index.d.ts +0 -60
  113. package/dist/types/worker/platform.d.ts +0 -90
  114. package/dist/types/worker/utils.d.ts +0 -9
  115. package/reference/claude-config/Overview.md +0 -230
  116. package/reference/claude-config/hooks/post-edit-validate.mjs +0 -98
  117. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +0 -187
  118. package/reference/claude-config/hooks/tool-failure-recovery.mjs +0 -73
  119. package/reference/claude-config/registries/graph-skills.json +0 -4
  120. package/reference/claude-config/registries/knowledge-flags.json +0 -154
  121. package/reference/claude-config/registries/skill-coverage.json +0 -20
  122. package/reference/claude-config/rules/active-change-index.md +0 -22
  123. package/reference/claude-config/rules/agent-start-here.md +0 -22
  124. package/reference/claude-config/rules/deployment.md +0 -22
  125. package/reference/claude-config/rules/error-handling.md +0 -22
  126. package/reference/claude-config/rules/execution.md +0 -22
  127. package/reference/claude-config/rules/frontend.md +0 -22
  128. package/reference/claude-config/rules/observability.md +0 -22
  129. package/reference/claude-config/rules/operations.md +0 -22
  130. package/reference/claude-config/rules/organization-model.md +0 -22
  131. package/reference/claude-config/rules/organization-os.md +0 -22
  132. package/reference/claude-config/rules/package-taxonomy.md +0 -22
  133. package/reference/claude-config/rules/platform.md +0 -22
  134. package/reference/claude-config/rules/shared-types.md +0 -22
  135. package/reference/claude-config/rules/task-tracking.md +0 -22
  136. package/reference/claude-config/rules/topbar-actions.md +0 -70
  137. package/reference/claude-config/rules/ui.md +0 -22
  138. package/reference/claude-config/rules/vibe.md +0 -22
  139. package/reference/claude-config/scripts/statusline-command.js +0 -18
  140. package/reference/claude-config/settings.json +0 -30
  141. package/reference/claude-config/skills/client/SKILL.md +0 -201
  142. package/reference/claude-config/skills/deploy/SKILL.md +0 -159
  143. package/reference/claude-config/skills/dsp/SKILL.md +0 -66
  144. package/reference/claude-config/skills/elevasis/SKILL.md +0 -251
  145. package/reference/claude-config/skills/explore/SKILL.md +0 -78
  146. package/reference/claude-config/skills/git-sync/SKILL.md +0 -166
  147. package/reference/claude-config/skills/om/SKILL.md +0 -475
  148. package/reference/claude-config/skills/om/operations/build.md +0 -237
  149. package/reference/claude-config/skills/om/operations/codify-level-a.md +0 -109
  150. package/reference/claude-config/skills/om/operations/codify-level-b.md +0 -159
  151. package/reference/claude-config/skills/om/operations/customers.md +0 -114
  152. package/reference/claude-config/skills/om/operations/features.md +0 -88
  153. package/reference/claude-config/skills/om/operations/goals.md +0 -123
  154. package/reference/claude-config/skills/om/operations/identity.md +0 -97
  155. package/reference/claude-config/skills/om/operations/labels.md +0 -110
  156. package/reference/claude-config/skills/om/operations/offerings.md +0 -114
  157. package/reference/claude-config/skills/om/operations/roles.md +0 -104
  158. package/reference/claude-config/skills/om/operations/scaffold.md +0 -163
  159. package/reference/claude-config/skills/om/operations/techStack.md +0 -38
  160. package/reference/claude-config/skills/project/SKILL.md +0 -1114
  161. package/reference/claude-config/skills/run-ui/SKILL.md +0 -73
  162. package/reference/claude-config/skills/save/SKILL.md +0 -183
  163. package/reference/claude-config/skills/setup/SKILL.md +0 -290
  164. package/reference/claude-config/skills/status/SKILL.md +0 -59
  165. package/reference/claude-config/skills/submit-request/SKILL.md +0 -180
  166. package/reference/claude-config/skills/sync/SKILL.md +0 -47
  167. package/reference/claude-config/skills/tutorial/SKILL.md +0 -259
  168. package/reference/claude-config/skills/tutorial/progress-template.md +0 -74
  169. package/reference/claude-config/skills/tutorial/technical.md +0 -1303
  170. package/reference/claude-config/skills/tutorial/vibe-coder.md +0 -890
  171. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +0 -27
  172. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +0 -30
  173. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +0 -73
  174. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +0 -86
  175. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +0 -55
  176. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +0 -97
  177. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +0 -112
  178. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +0 -93
  179. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +0 -58
  180. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +0 -56
  181. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +0 -71
  182. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +0 -83
  183. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +0 -59
  184. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +0 -42
  185. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +0 -60
  186. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +0 -37
  187. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +0 -34
  188. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +0 -38
  189. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +0 -32
  190. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +0 -33
  191. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +0 -69
  192. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +0 -30
  193. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +0 -45
  194. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +0 -52
  195. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +0 -33
  196. package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +0 -32
  197. package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +0 -43
  198. package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +0 -40
  199. package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +0 -61
  200. package/reference/claude-config/sync-notes/2026-05-23-branding-names-to-identity.md +0 -49
  201. package/reference/claude-config/sync-notes/2026-05-23-lead-gen-manage-access.md +0 -31
  202. package/reference/claude-config/sync-notes/2026-05-23-om-deployment-drift-detection.md +0 -42
  203. package/reference/claude-config/sync-notes/2026-05-23-om-full-model-deploy-contract.md +0 -33
  204. package/reference/claude-config/sync-notes/2026-05-23-ui-sdk-package-fixes.md +0 -37
  205. package/reference/claude-config/sync-notes/2026-05-24-platform-invite-router-core-baseline.md +0 -28
  206. package/reference/claude-config/sync-notes/2026-05-24-system-interface-readiness.md +0 -43
  207. package/reference/claude-config/sync-notes/2026-05-25-invitation-login-loader.md +0 -26
  208. package/reference/claude-config/sync-notes/2026-05-25-om-topbar-requests.md +0 -33
  209. package/reference/claude-config/sync-notes/2026-05-25-system-interface-profile-registry-and-substrate.md +0 -35
  210. package/reference/claude-config/sync-notes/2026-05-25-tenant-om-scaffold-cli.md +0 -49
  211. package/reference/claude-config/sync-notes/2026-05-25-vibe-operate-intent.md +0 -47
  212. package/reference/claude-config/sync-notes/2026-05-28-om-snapshot-sdk-workflow-config.md +0 -33
  213. package/reference/claude-config/sync-notes/2026-05-30-client-source-and-om-profiles.md +0 -39
  214. package/reference/claude-config/sync-notes/2026-06-02-knowledge-nested-group-routing.md +0 -27
  215. package/reference/claude-config/sync-notes/2026-06-02-nest-projects-under-platform.md +0 -45
  216. package/reference/claude-config/sync-notes/2026-06-03-skill-autogen-and-client-skill.md +0 -34
  217. package/reference/claude-config/sync-notes/2026-06-04-scaffold-registry-lane-severity.md +0 -34
  218. package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +0 -29
  219. package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +0 -86
  220. package/reference/claude-config/sync-notes/2026-06-06-om-build-systems-scaffold.md +0 -47
  221. package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +0 -50
  222. package/reference/claude-config/sync-notes/2026-06-08-knowledge-base-page-not-found-fix.md +0 -76
  223. package/reference/claude-config/sync-notes/2026-06-09-agent-sessions-public-agent-chat-route.md +0 -75
  224. package/reference/claude-config/sync-notes/2026-06-09-sdk-cli-load-org-model-resolution.md +0 -42
  225. package/reference/claude-config/sync-notes/2026-06-12-agent-grants-visualizer-operations.md +0 -30
  226. package/reference/claude-config/sync-notes/2026-06-14-session-ux-and-project-cli-json.md +0 -33
  227. package/reference/claude-config/sync-notes/2026-06-14-shared-session-conversation-view.md +0 -26
  228. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +0 -46
  229. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +0 -34
  230. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +0 -52
  231. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +0 -47
  232. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +0 -75
  233. package/reference/claude-config/sync-notes/2026-07-23-agent-session-memory.md +0 -49
  234. package/reference/claude-config/sync-notes/2026-07-23-workos-org-marker.md +0 -50
  235. package/reference/claude-config/sync-notes/2026-07-24-claude-5-models-and-session-surface-fixes.md +0 -116
  236. package/reference/claude-config/sync-notes/2026-07-27-agent-strict-output-and-turn-drift.md +0 -73
  237. package/reference/claude-config/sync-notes/2026-07-28-agent-reply-is-its-own-field.md +0 -84
  238. package/reference/claude-config/sync-notes/2026-07-30-login-screen-and-member-provisioning-state.md +0 -114
  239. package/reference/claude-config/sync-notes/2026-08-02-auth-guard-defaults-and-truncation-fix.md +0 -122
  240. package/reference/claude-config/sync-notes/2026-08-03-agent-prose-escape-normalization.md +0 -88
  241. package/reference/claude-config/sync-notes/2026-08-03-cli-gateway-errors-and-request-timeout.md +0 -120
  242. package/reference/claude-config/sync-notes/README.md +0 -43
  243. package/reference/sdk/framework/interaction-guidance.mdx +0 -182
  244. package/reference/sdk/framework/memory.mdx +0 -326
  245. package/reference/sdk/framework/resource-documentation.mdx +0 -90
  246. package/reference/sdk/roadmap.mdx +0 -164
@@ -1,90 +0,0 @@
1
- /**
2
- * Platform Tool Proxy (Worker Side)
3
- *
4
- * Provides platform.call() for external developers to invoke platform tools
5
- * from within worker threads. Communicates with the parent process via
6
- * postMessage() -- the parent dispatches to the real service layer.
7
- */
8
- /** Token usage metadata returned for tool calls with cost accounting. */
9
- interface TokenUsage {
10
- inputTokens: number;
11
- outputTokens: number;
12
- cost?: number;
13
- model?: string;
14
- }
15
- /** Inbound tool-result from parent */
16
- export interface ToolCallResponse {
17
- type: 'tool-result';
18
- id: string;
19
- result?: unknown;
20
- error?: string;
21
- code?: string;
22
- usage?: TokenUsage;
23
- }
24
- /** Inbound credential-result from parent */
25
- export interface CredentialResultMessage {
26
- type: 'credential-result';
27
- id: string;
28
- provider?: string;
29
- credentials?: Record<string, string>;
30
- error?: string;
31
- code?: string;
32
- }
33
- /** Resolved credential returned by platform.getCredential() */
34
- export interface PlatformCredential {
35
- provider: string;
36
- credentials: Record<string, string>;
37
- }
38
- export declare class PlatformToolError extends Error {
39
- /** ToolingErrorType code from the platform */
40
- readonly code: string;
41
- /** Whether the error is retryable */
42
- readonly retryable: boolean;
43
- constructor(message: string,
44
- /** ToolingErrorType code from the platform */
45
- code: string,
46
- /** Whether the error is retryable */
47
- retryable: boolean);
48
- }
49
- /**
50
- * Handle a tool-result message from the parent process.
51
- * Called from the parentPort.on('message') handler in index.ts.
52
- */
53
- export declare function handleToolResult(msg: ToolCallResponse): void;
54
- /**
55
- * Handle a credential-result message from the parent process.
56
- * Called from the parentPort.on('message') handler in index.ts.
57
- */
58
- export declare function handleCredentialResult(msg: CredentialResultMessage): void;
59
- export declare const platform: {
60
- /**
61
- * Call a platform tool from the worker thread.
62
- *
63
- * @param options.tool - Tool name (e.g., 'gmail', 'storage', 'attio')
64
- * @param options.method - Method name (e.g., 'sendEmail', 'upload')
65
- * @param options.params - Method parameters
66
- * @param options.credential - Credential name (required for integration tools)
67
- * @returns Promise resolving to the tool result
68
- * @throws PlatformToolError on failure (with code and retryable fields)
69
- */
70
- call(options: {
71
- tool: string;
72
- method: string;
73
- params?: unknown;
74
- credential?: string;
75
- }): Promise<unknown>;
76
- /**
77
- * Request raw credential access from the platform.
78
- *
79
- * This is an explicit opt-in that causes the credential's secret values
80
- * to enter worker memory. Use only when you need to initialise a
81
- * third-party SDK (e.g. `new Stripe(key)`). Prefer `platform.call()`
82
- * with the `http` tool for server-side credential injection.
83
- *
84
- * @param name - Credential name as configured in the command center
85
- * @returns Promise resolving to { provider, credentials }
86
- * @throws PlatformToolError on failure (credential not found, raw access denied, etc.)
87
- */
88
- getCredential(name: string): Promise<PlatformCredential>;
89
- };
90
- export {};
@@ -1,9 +0,0 @@
1
- export type PlatformToolErrorClassification = 'timeout' | 'rate_limit' | 'other';
2
- export interface ClassifyPlatformToolErrorOptions {
3
- timeoutMessages?: readonly string[];
4
- rateLimitCodes?: readonly string[];
5
- rateLimitMessageCodes?: readonly string[];
6
- rateLimitMessageIncludes?: readonly string[];
7
- }
8
- export declare function generateHmacToken(secret: string, data: string): string;
9
- export declare function classifyPlatformToolError(err: unknown, options?: ClassifyPlatformToolErrorOptions): PlatformToolErrorClassification;
@@ -1,230 +0,0 @@
1
- # Claude Code Configuration Overview
2
-
3
- Start here when working with the Claude agent scaffold for this project.
4
- This file is a routing map for the skill and rule inventories. For live CLI capability, run `elevasis-sdk cli`.
5
-
6
- ---
7
-
8
- ## What Lives Here
9
-
10
- | Surface | Purpose | Source of truth |
11
- | ------- | ----------------------------- | -------------------------------------------------------- |
12
- | Skills | Slash-command entry points | `.claude/skills/*/SKILL.md` |
13
- | Rules | Path-scoped operating context | `operations/node_modules/@elevasis/sdk/reference/rules/` |
14
- | Hooks | Claude lifecycle automation | `.claude/hooks/*.mjs`, `.claude/settings.json` |
15
- | CLI | Live command + domain surface | `elevasis-sdk cli` (authoritative, run it) |
16
-
17
- For CLI capability, run `elevasis-sdk cli` — it is the authoritative surface for what commands
18
- and domains are available.
19
-
20
- **This file is template-owned and replaced by sync.** It holds guidance that is true for every
21
- project built from this template: structure, stack, commands, and the skill surface. Project-specific
22
- facts (identity, client context, user preferences) live in `CLAUDE.md`, which sync never overwrites.
23
- Tenant-specific operational quirks live in `OPERATIONS.md`. Do not copy content between them — each
24
- fact should exist in exactly one of the three, owned by whoever can correct it.
25
-
26
- ---
27
-
28
- ## Operating Model
29
-
30
- This project is skill-first with an always-on ambient vibe layer:
31
-
32
- 1. Read `operations/node_modules/@elevasis/sdk/reference/rules/agent-start-here.md` — it owns session
33
- bootstrap and task-class routing. Then read `CLAUDE.md` for this project's identity and preferences,
34
- and `OPERATIONS.md` for tenant-specific quirks that override generic guidance.
35
- 2. Every natural-language message is silently classified into an intent (Capture, Query, Describe,
36
- Transition, Navigate, Codify, Toggle, Operate) before the agent responds — no slash command needed.
37
- The classifier and intent definitions live in the bundled `vibe.md` rule.
38
- 3. For explicit work, match intent to a skill in `.claude/skills/{name}/SKILL.md`.
39
- 4. Load the relevant bundled rule from `operations/node_modules/@elevasis/sdk/reference/rules/` for the area
40
- being changed (the local `.claude/rules/*.md` files are thin pointers to these).
41
- 5. Use `elevasis-sdk cli` for the live command/domain surface — do not answer "what can I do" from memory.
42
-
43
- ---
44
-
45
- ## Project Structure
46
-
47
- ```
48
- ├── ui/ # React frontend app
49
- ├── operations/ # Platform workflows + agents
50
- ├── core/ # Cross-runtime organization model, types, Zod schemas, constants
51
- ├── .claude/ # Claude Code config (this file, skills, hooks)
52
- ├── pnpm-workspace.yaml # Workspace definition
53
- └── .env # Environment variables
54
- ```
55
-
56
- | Resource | Path |
57
- | -------------------- | ------------------------------- |
58
- | Source — Routes | `ui/src/routes/` |
59
- | Source — Features | `ui/src/features/` |
60
- | Source — Lib | `ui/src/lib/` |
61
- | Source — Assets | `ui/src/assets/` |
62
- | Platform — Workflows | `operations/src/` |
63
- | Platform — Config | `operations/elevasis.config.ts` |
64
- | Core Types | `core/` |
65
-
66
- **Standalone repo** — this project is NOT part of the Elevasis monorepo pnpm workspace. Git, gh, and
67
- CLI commands work directly here (the monorepo boundary hook does not apply).
68
-
69
- - Use `pnpm` exclusively — never `npm`
70
- - Path aliases: `@/*` maps to `ui/src/*`, `@core/*` maps to `core/*`
71
- - Frontend and platform code are separate runtimes — share only types via `core/`
72
- - Release-train migration guidance lands in `.claude/sync-notes/`; run `/git-sync` to pull and surface
73
- new notes before doing any manual reconciliation
74
-
75
- ---
76
-
77
- ## Stack
78
-
79
- > **Package surface:** this project consumes `@elevasis/{sdk,ui,core}` from npm. The monorepo's
80
- > workspace-internal `@repo/elevasis-{core,operations}` packages are NOT installable here. See the
81
- > bundled `package-taxonomy.md` rule.
82
-
83
- ### Frontend (`ui/`)
84
-
85
- | Layer | Tech |
86
- | ------------ | ----------------------------------- |
87
- | UI | React 19 + Mantine 8.2.7 |
88
- | Build | Vite 8 |
89
- | Language | TypeScript 5.9 (strict) |
90
- | Routing | TanStack Router (file-based) |
91
- | Server State | TanStack React Query |
92
- | Client State | Zustand + Immer |
93
- | Charts | Recharts via @mantine/charts |
94
- | Graph Viz | @xyflow/react (ReactFlow) |
95
- | Icons | @tabler/icons-react |
96
- | Testing | Vitest |
97
- | Auth | @elevasis/ui + AuthKit (WorkOS) |
98
- | API Access | `@elevasis/ui/api` (`useApiClient`) |
99
-
100
- ### Platform (`operations/`)
101
-
102
- | Layer | Tech |
103
- | -------- | ------------------------------------------------- |
104
- | SDK | @elevasis/sdk (workflows, agents, typed adapters) |
105
- | Language | TypeScript (strict, Node target) |
106
- | Schemas | Zod |
107
- | Deploy | Elevasis Platform — see bundled `deployment.md` |
108
-
109
- ### Core (`core/`)
110
-
111
- Types and constants shared between frontend and platform workflows. Runtime-agnostic only — no
112
- React, no Node APIs, no SDK worker imports.
113
-
114
- ---
115
-
116
- ## Commands
117
-
118
- | Command | Purpose |
119
- | -------------------------------- | ------------------------------------------------------------- |
120
- | `pnpm -C ui dev` | Dev server (port 4300, `strictPort` — fails fast if occupied) |
121
- | `pnpm -C ui build` | Type-check + production build |
122
- | `pnpm -C ui test` | Run frontend tests |
123
- | `pnpm -C ui lint` | Type-check only (no emit) |
124
- | `pnpm -C operations check` | Validate SDK resource definitions |
125
- | `pnpm -C operations deploy` | Deploy resources — **targets production by default** |
126
- | `pnpm -C operations deploy:prod` | Deploy resources to production (explicit `--prod`) |
127
-
128
- > **Deploy targets are safety-critical and the resolution order has exceptions.** The authoritative
129
- > rule is the bundled `deployment.md`, which ships with the CLI version this project actually runs.
130
- > Read it before deploying — and check `OPERATIONS.md`, which records whether this specific tenant
131
- > has a working dev target at all.
132
-
133
- ---
134
-
135
- ## Skills
136
-
137
- **Location:** `.claude/skills/`
138
-
139
- Skills are the slash-command surface. Each skill is `.claude/skills/{name}/SKILL.md`:
140
-
141
- <!-- @generated:start:sync-overview-skills -->
142
- - **client** -- Client portfolio management -- list, resolve, inspect, and maintain client records and their lineage to companies, contacts, and source deals -- via the elevasis-sdk client:* CLI.
143
- - **deploy** -- Test, build, fix issues, then commit and push
144
- - **dsp** -- Dispatch subagents in parallel for implementation tasks
145
- - **elevasis** -- Elevasis platform operations -- check, deploy, execute, inspect, and debug SDK resources
146
- - **explore** -- Codebase exploration anchored to project documentation
147
- - **git-sync** -- Pull latest changes, surface new sync notes, install when needed, and run baseline verification without auto-reconciling template drift
148
- - **om** -- TRIGGER this skill when any of the following apply: - The user references organization-model entities by name or concept: identity, customers, offerings, roles, goals, techStack, systems, actions, labels, knowledge nodes, governance edges, mounts, playbook, outreach cadence, or any domain in the org model. - The user asks to read, list, find, show, query, navigate, describe, codify, add, edit, update, toggle, enable, or disable any organization-model domain or knowledge node. - The user asks "what governs X?", "what does X control?", "system governs", "what is our identity set to?", "what's our timezone?", "show me all reference docs", "list my roles", "where does outreach-cadence apply?", or similar. - An agent is editing files matching: core/config/organization-model.ts, core/config/organization-model/**, or core/config/knowledge/**. SKIP this skill when the task is purely UI layout, workflow authoring, or infrastructure work with no reference to org-model or knowledge-graph entities.
149
- - **project** -- Portfolio- and project-level work management -- orientation, intent routing, active projects, milestones, tasks, notes, and resume context -- via the elevasis-sdk project:* CLI.
150
- - **run-ui** -- Start the project's Vite UI dev server on port 4300 in the background, surfacing the URL once it's ready. Detects port conflicts and asks before killing the holder.
151
- - **save** -- Auto-manage project documentation and persist task resume context from conversation
152
- - **setup** -- First-time project setup — detect and replace template placeholders, install dependencies, verify build, then hand off to /om for org-model configuration
153
- - **status** -- Quick project health check
154
- - **submit-request** -- Submit a structured request report to the Elevasis platform via CLI — enforces pre-analysis before posting
155
- - **sync** -- Fresh reinstall and cache reset after local dependency or cache drift
156
- - **tutorial** -- Persona-aware onboarding tutorial that forks into a vibe-coder track (zero technical vocabulary, agent does all the work) or a technical track (full SDK depth, code-first). On first invocation, asks one gate question to determine the user's track and persists the choice to .claude/memory/profile.md. Subsequent invocations skip the question and display the track menu with current progress markers. Supports /tutorial switch (flip track) and /tutorial status (display-only).
157
- <!-- @generated:end:sync-overview-skills -->
158
-
159
- ---
160
-
161
- ## Rules
162
-
163
- **Location:** `operations/node_modules/@elevasis/sdk/reference/rules/` (bundled with `@elevasis/sdk`)
164
-
165
- Path-scoped operating context loaded for substantial work in their areas. The project's local
166
- `.claude/rules/*.md` files are thin compatibility pointers; the authoritative content ships with
167
- the SDK and is listed here:
168
-
169
- <!-- @generated:start:sync-overview-rules -->
170
- - `operations/node_modules/@elevasis/sdk/reference/rules/active-change-index.md` -- Bridge between stable scaffold docs and higher-volatility in-progress architecture work that may override assumptions for agents working in the template
171
- - `operations/node_modules/@elevasis/sdk/reference/rules/agent-start-here.md` -- Canonical first-read for agents entering the template scaffold -- project continuity, task-class routing, and boundary resolution
172
- - `operations/node_modules/@elevasis/sdk/reference/rules/deployment.md` -- Deployment workflow -- check-first, dev vs prod, version bumping, common errors
173
- - `operations/node_modules/@elevasis/sdk/reference/rules/error-handling.md` -- Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry
174
- - `operations/node_modules/@elevasis/sdk/reference/rules/execution.md` -- Execution model -- timeouts, memory, concurrency, org isolation, runtime constraints
175
- - `operations/node_modules/@elevasis/sdk/reference/rules/frontend.md` -- Frontend conventions -- React, routing, state, styling, testing, pages
176
- - `operations/node_modules/@elevasis/sdk/reference/rules/observability.md` -- Observability -- context.logger API, execution inspection, step-level context
177
- - `operations/node_modules/@elevasis/sdk/reference/rules/operations.md` -- Platform workflows, agents, resource definitions, and deployment for the operations/ surface
178
- - `operations/node_modules/@elevasis/sdk/reference/rules/organization-model.md` -- Edits to the canonical organization model go through /om
179
- - `operations/node_modules/@elevasis/sdk/reference/rules/organization-os.md` -- Organization OS orientation -- the semantic contract layer relating Systems, Actions, ontology, resources, policies, roles, goals, and knowledge; consumed via published @elevasis/core / @elevasis/sdk
180
- - `operations/node_modules/@elevasis/sdk/reference/rules/package-taxonomy.md` -- Package taxonomy (consumer view) -- external projects consume the published @elevasis/* surface only; workspace-internal @repo/elevasis-* packages are not installable here
181
- - `operations/node_modules/@elevasis/sdk/reference/rules/platform.md` -- Platform conventions -- SDK workflows, agents, deployment, resource registry
182
- - `operations/node_modules/@elevasis/sdk/reference/rules/shared-types.md` -- Core type boundary -- what belongs in core/types, import rules, schema conventions
183
- - `operations/node_modules/@elevasis/sdk/reference/rules/task-tracking.md` -- In-progress task conventions -- doc format, status values, auto-save behavior
184
- - `operations/node_modules/@elevasis/sdk/reference/rules/ui.md` -- UI shell, route structure, auth flow, API access, and template customization points for the ui/ surface
185
- - `operations/node_modules/@elevasis/sdk/reference/rules/vibe.md` -- Ambient intent classifier -- routes natural-language input to intent buckets without a slash command; Codify and Toggle delegate to /om, Operate delegates to /elevasis
186
- <!-- @generated:end:sync-overview-rules -->
187
-
188
- ---
189
-
190
- ## Skill Boundaries
191
-
192
- Use the owning skill instead of guessing from the name alone:
193
-
194
- | Need | Route |
195
- | -------------------------------------------------------- | ----------------- |
196
- | SDK operations (check, deploy, exec, inspect, debug) | `/elevasis` |
197
- | Project and task lifecycle | `/project` |
198
- | Client portfolio (list, resolve, inspect, maintain) | `/client` |
199
- | Organization Model read, codify, or governance | `/om` |
200
- | First-time project setup (placeholder replacement, deps) | `/setup` |
201
- | Guided onboarding walkthrough | `/tutorial` |
202
- | Conversation fanout (notes, task save, blockers) | `/save` |
203
- | Parallel agent dispatch | `/dsp` |
204
- | Test, build, commit, push | `/deploy` |
205
- | Codebase exploration | `/explore` |
206
- | Pull latest, surface sync notes, baseline verify | `/git-sync` |
207
- | Project health check | `/status` |
208
- | Submit a request to the Elevasis team | `/submit-request` |
209
- | Fresh reinstall / cache reset | `/sync` |
210
- | Start the Vite dev server on port 4300 | `/run-ui` |
211
-
212
- ---
213
-
214
- ## Scaffold Maintenance
215
-
216
- This file is maintained upstream in the Elevasis monorepo template
217
- (`external/_template/.claude/Overview.md`) and delivered to this project via template
218
- sync (`/git-sync`). **The whole file is replace-managed** -- not just the generated blocks.
219
- Any local edit here is overwritten on the next sync, so corrections belong upstream, where
220
- every project receives them.
221
-
222
- The blocks marked `<!-- @generated:start:... -->` / `<!-- @generated:end -->` are additionally
223
- machine-written by `pnpm gen:overview` in the monorepo; do not hand-edit them even upstream.
224
-
225
- There is no monorepo command to run from inside this project; refreshes happen upstream and
226
- arrive through the normal sync flow.
227
-
228
- **If you were about to add project-specific detail to this file, stop** -- it will be lost.
229
- Project identity and preferences go in `CLAUDE.md`; tenant operational quirks go in
230
- `OPERATIONS.md`. Both are project-owned and never overwritten.
@@ -1,98 +0,0 @@
1
- #!/usr/bin/env node
2
- // post-edit-validate.mjs
3
- // PostToolUse hook — auto-formats with prettier, type-checks .ts/.tsx files.
4
- // Fires after Edit|Write|MultiEdit succeeds.
5
-
6
- import { existsSync, readFileSync } from 'node:fs'
7
- import { resolve, normalize, extname, join, dirname, relative } from 'node:path'
8
- import { execSync } from 'node:child_process'
9
-
10
- const ROOT = process.env.CLAUDE_PROJECT_DIR ?? process.cwd()
11
-
12
- // Extensions prettier should format
13
- const PRETTIER_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.json', '.css', '.md'])
14
-
15
- // Extensions that trigger type-checking
16
- const TS_EXTENSIONS = new Set(['.ts', '.tsx'])
17
-
18
- function findNearestTsconfig(startDir) {
19
- let dir = startDir
20
- const root = normalize(ROOT)
21
- while (dir.length >= root.length) {
22
- const candidate = join(dir, 'tsconfig.json')
23
- if (existsSync(candidate)) return candidate
24
- const parent = dirname(dir)
25
- if (parent === dir) break
26
- dir = parent
27
- }
28
- return null
29
- }
30
-
31
- try {
32
- const chunks = []
33
- for await (const chunk of process.stdin) chunks.push(chunk)
34
- const input = JSON.parse(Buffer.concat(chunks).toString())
35
-
36
- const filePath = input.tool_input?.file_path
37
- if (!filePath) process.exit(0)
38
-
39
- const ext = extname(filePath).toLowerCase()
40
- const absPath = normalize(resolve(filePath))
41
- if (!existsSync(absPath)) process.exit(0)
42
-
43
- const results = []
44
-
45
- // 1. Prettier (skip silently if not installed yet, e.g. before first pnpm install)
46
- if (PRETTIER_EXTENSIONS.has(ext)) {
47
- try {
48
- execSync('pnpm exec prettier --version', { cwd: ROOT, stdio: 'pipe', timeout: 5_000 })
49
- try {
50
- execSync('pnpm exec prettier --write "' + absPath + '"', {
51
- cwd: ROOT,
52
- stdio: ['pipe', 'pipe', 'pipe'],
53
- timeout: 10_000
54
- })
55
- } catch (err) {
56
- const stderr = err.stderr?.toString().trim() || ''
57
- if (stderr && !/ignored/i.test(stderr)) {
58
- results.push('Prettier error: ' + stderr.slice(0, 300))
59
- }
60
- }
61
- } catch {
62
- // prettier not installed yet -- skip silently
63
- }
64
- }
65
-
66
- // 2. Type-check for .ts/.tsx
67
- if (TS_EXTENSIONS.has(ext)) {
68
- const tsconfig = findNearestTsconfig(dirname(absPath))
69
- if (tsconfig) {
70
- try {
71
- execSync('pnpm exec tsc --noEmit -p "' + tsconfig + '"', {
72
- cwd: ROOT,
73
- stdio: ['pipe', 'pipe', 'pipe'],
74
- timeout: 30_000,
75
- env: { ...process.env, NODE_OPTIONS: '--max-old-space-size=4096' }
76
- })
77
- } catch (err) {
78
- if (err.killed) process.exit(0) // Don't block on timeout
79
- const stdout = err.stdout?.toString() || ''
80
- if (stdout.includes('error TS')) {
81
- const errorLines = stdout
82
- .split('\n')
83
- .filter((l) => l.includes('error TS'))
84
- .slice(0, 10)
85
- results.push('Type errors after editing ' + filePath + ':\n' + errorLines.join('\n'))
86
- }
87
- }
88
- }
89
- }
90
-
91
- // Output errors to Claude's context (silence = success)
92
- if (results.length > 0) {
93
- process.stderr.write(results.join('\n\n'))
94
- process.exit(2) // Exit 2 = send stderr as feedback to Claude
95
- }
96
- } catch {}
97
-
98
- process.exit(0)
@@ -1,187 +0,0 @@
1
- #!/usr/bin/env node
2
- // scaffold-registry-reminder.mjs
3
- // PostToolUse hook — reads the compiled scaffold registry and emits advisory
4
- // reminders when an edited file matches a registry source pattern.
5
- //
6
- // Template twin of the monorepo hook. Gracefully no-ops when the compiled
7
- // registry is absent (e.g. before SDK delivers scaffold-registry.compiled.json
8
- // to external projects — Step 7/SDK milestone).
9
- //
10
- // Exit 0 always (advisory hook — never blocks).
11
-
12
- import { readFileSync, writeFileSync, mkdirSync, appendFileSync } from 'node:fs'
13
- import { join, normalize, relative } from 'node:path'
14
-
15
- const ROOT = process.env.CLAUDE_PROJECT_DIR ?? process.cwd()
16
- const LOG_DIR = join(ROOT, '.claude', 'logs')
17
- const LOG_FILE = join(LOG_DIR, 'scaffold-registry-reminder.log')
18
- const STATE_FILE = join(LOG_DIR, 'scaffold-registry-reminder.state.json')
19
- const REGISTRY_FILE = join(ROOT, '.claude', 'registries', 'scaffold-registry.compiled.json')
20
-
21
- const DEFAULT_COOLDOWN_MS = 300_000 // 5 minutes
22
-
23
- const GENERATED_DIR_SEGMENTS = ['_generated', '_gen']
24
- const GENERATED_CONTENT_MARKER = '@generated'
25
-
26
- function log(msg) {
27
- try {
28
- mkdirSync(LOG_DIR, { recursive: true })
29
- appendFileSync(LOG_FILE, `[${new Date().toISOString()}] ${msg}\n`)
30
- } catch {}
31
- }
32
-
33
- function pathMatchesPattern(filePath, pattern) {
34
- const normalizedFile = filePath.replace(/\\/g, '/')
35
- const normalizedPattern = pattern.replace(/\\/g, '/')
36
-
37
- if (normalizedFile === normalizedPattern) return true
38
-
39
- if (normalizedPattern.endsWith('/**') || normalizedPattern.endsWith('/*')) {
40
- const prefix = normalizedPattern.slice(0, normalizedPattern.lastIndexOf('/*'))
41
- return normalizedFile.startsWith(prefix + '/')
42
- }
43
-
44
- if (normalizedPattern.includes('*')) {
45
- const escaped = normalizedPattern.replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '[^/]*')
46
- return new RegExp(`^${escaped}$`).test(normalizedFile)
47
- }
48
-
49
- return normalizedFile.startsWith(normalizedPattern + '/')
50
- }
51
-
52
- function loadState() {
53
- try {
54
- return JSON.parse(readFileSync(STATE_FILE, 'utf-8'))
55
- } catch {
56
- return {}
57
- }
58
- }
59
-
60
- function saveState(state) {
61
- try {
62
- mkdirSync(LOG_DIR, { recursive: true })
63
- writeFileSync(STATE_FILE, JSON.stringify(state, null, 2) + '\n', 'utf-8')
64
- } catch {}
65
- }
66
-
67
- function throttleKey(entryId, filePath) {
68
- return `${entryId}:${filePath}`
69
- }
70
-
71
- function isCoolingDown(state, key, cooldownMs) {
72
- const last = state[key]
73
- if (!last) return false
74
- return Date.now() - last < cooldownMs
75
- }
76
-
77
- function formatDependentLine(dep) {
78
- const regen = dep.regen === 'manual' ? 'manual check' : dep.regen
79
- const hint = dep.hint ? ` [${dep.hint}]` : ''
80
- return ` - ${dep.path} -> ${regen}${hint}`
81
- }
82
-
83
- function emitReminder(entry, relFilePath) {
84
- const lines = [
85
- `\uD83D\uDD14 Scaffold reminder -- ${entry.id} (${relFilePath})`,
86
- ` Downstream scaffolds that may need updating:`
87
- ]
88
- for (const dep of entry.dependents) {
89
- lines.push(formatDependentLine(dep))
90
- }
91
- lines.push(
92
- ` If this is a scaffold-sensitive pattern not in the registry, also add an entry to .claude/registries/scaffold-registry.yml.`
93
- )
94
- return lines.join('\n')
95
- }
96
-
97
- function emitMissingEntryHint(relFilePath) {
98
- return [
99
- `\uD83D\uDD14 Scaffold reminder -- unregistered generated path (${relFilePath})`,
100
- ` This path looks scaffold-generated but has no registry entry.`,
101
- ` If it is scaffold-sensitive, add a new entry to .claude/registries/scaffold-registry.yml`,
102
- ` so the reminder hook and /work handoff can track it.`
103
- ].join('\n')
104
- }
105
-
106
- function looksLikeGeneratedPath(filePath) {
107
- const normalizedFile = filePath.replace(/\\/g, '/')
108
- const segments = normalizedFile.split('/')
109
- return segments.some((seg) => GENERATED_DIR_SEGMENTS.includes(seg))
110
- }
111
-
112
- function looksLikeGeneratedContent(absFilePath) {
113
- try {
114
- const content = readFileSync(absFilePath, 'utf-8').slice(0, 500)
115
- return content.includes(GENERATED_CONTENT_MARKER)
116
- } catch {
117
- return false
118
- }
119
- }
120
-
121
- try {
122
- const chunks = []
123
- for await (const chunk of process.stdin) chunks.push(chunk)
124
- const input = JSON.parse(Buffer.concat(chunks).toString())
125
-
126
- const rawFilePath = input.tool_input?.file_path
127
- if (!rawFilePath) process.exit(0)
128
-
129
- const absFilePath = normalize(rawFilePath)
130
- const relFilePath = relative(ROOT, absFilePath).replace(/\\/g, '/')
131
-
132
- // Graceful no-op when registry is absent (pre-SDK-delivery state)
133
- let registry
134
- try {
135
- const raw = readFileSync(REGISTRY_FILE, 'utf-8')
136
- registry = JSON.parse(raw)
137
- } catch {
138
- log(`SKIP — registry not found (pre-SDK-delivery)`)
139
- process.exit(0)
140
- }
141
-
142
- const entries = registry?.entries ?? []
143
-
144
- const matched = entries.filter((entry) =>
145
- (entry.sources ?? []).some((pattern) => pathMatchesPattern(relFilePath, pattern))
146
- )
147
-
148
- const state = loadState()
149
- const now = Date.now()
150
- const messages = []
151
-
152
- if (matched.length > 0) {
153
- for (const entry of matched) {
154
- const key = throttleKey(entry.id, relFilePath)
155
- if (isCoolingDown(state, key, DEFAULT_COOLDOWN_MS)) {
156
- log(`THROTTLED — ${entry.id} for ${relFilePath}`)
157
- continue
158
- }
159
- messages.push(emitReminder(entry, relFilePath))
160
- state[key] = now
161
- log(`EMITTED — ${entry.id} for ${relFilePath}`)
162
- }
163
- } else {
164
- const isGenerated = looksLikeGeneratedPath(relFilePath) || looksLikeGeneratedContent(absFilePath)
165
-
166
- if (isGenerated) {
167
- const key = throttleKey('__missing__', relFilePath)
168
- if (!isCoolingDown(state, key, DEFAULT_COOLDOWN_MS)) {
169
- messages.push(emitMissingEntryHint(relFilePath))
170
- state[key] = now
171
- log(`EMITTED missing-entry hint for ${relFilePath}`)
172
- } else {
173
- log(`THROTTLED missing-entry hint for ${relFilePath}`)
174
- }
175
- }
176
- }
177
-
178
- if (messages.length > 0) {
179
- saveState(state)
180
- process.stderr.write(messages.join('\n\n') + '\n')
181
- process.exit(2)
182
- }
183
- } catch (err) {
184
- log(`ERROR: ${err.message}`)
185
- }
186
-
187
- process.exit(0)