@corva/create-app 0.0.0-2576df8

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 (204) hide show
  1. package/README.md +218 -0
  2. package/bin/cca.js +5 -0
  3. package/bin/create-corva-app.cjs +25 -0
  4. package/common/node/.env +15 -0
  5. package/common/node/.env.sample +26 -0
  6. package/common/node/gitignore +130 -0
  7. package/common/package.json +3 -0
  8. package/common/python/.env +5 -0
  9. package/common/python/.env.sample +7 -0
  10. package/common/python/Makefile +15 -0
  11. package/common/python/gitignore +161 -0
  12. package/common/python/requirements.txt +2 -0
  13. package/lib/commands/attach.js +28 -0
  14. package/lib/commands/create.js +463 -0
  15. package/lib/commands/release.js +58 -0
  16. package/lib/commands/rerun.js +34 -0
  17. package/lib/commands/zip.js +39 -0
  18. package/lib/constants/cache.js +5 -0
  19. package/lib/constants/cli.js +35 -0
  20. package/lib/constants/manifest.js +263 -0
  21. package/lib/constants/messages.js +15 -0
  22. package/lib/constants/package.js +288 -0
  23. package/lib/flow.js +53 -0
  24. package/lib/flows/attach.js +8 -0
  25. package/lib/flows/lib/api.js +385 -0
  26. package/lib/flows/lib/create-zip-archive.js +83 -0
  27. package/lib/flows/lib/json.js +30 -0
  28. package/lib/flows/lib/manifest.js +81 -0
  29. package/lib/flows/lib/notification.js +142 -0
  30. package/lib/flows/lib/step-error.js +10 -0
  31. package/lib/flows/lib/waitForMs.js +3 -0
  32. package/lib/flows/prepare.js +6 -0
  33. package/lib/flows/release.js +26 -0
  34. package/lib/flows/rerun.js +8 -0
  35. package/lib/flows/steps/attach/add-app-to-stream.js +23 -0
  36. package/lib/flows/steps/attach/get-all-live-assets.js +135 -0
  37. package/lib/flows/steps/attach/index.js +5 -0
  38. package/lib/flows/steps/attach/prepare-data.js +19 -0
  39. package/lib/flows/steps/prepare-load-app-files.js +12 -0
  40. package/lib/flows/steps/release/add-label.js +10 -0
  41. package/lib/flows/steps/release/add-notes.js +10 -0
  42. package/lib/flows/steps/release/get-config.js +41 -0
  43. package/lib/flows/steps/release/prepare-data.js +12 -0
  44. package/lib/flows/steps/release/publish.js +11 -0
  45. package/lib/flows/steps/release/remove-failed-upload.js +21 -0
  46. package/lib/flows/steps/release/upload-zip-to-corva.js +136 -0
  47. package/lib/flows/steps/release/wait-for-build.js +36 -0
  48. package/lib/flows/steps/rerun/create-task.js +77 -0
  49. package/lib/flows/steps/rerun/ensure-that-app-in-stream.js +68 -0
  50. package/lib/flows/steps/rerun/get-app-version.js +111 -0
  51. package/lib/flows/steps/rerun/prepare-data.js +162 -0
  52. package/lib/flows/steps/rerun/prepare-well-and-stream-data.js +188 -0
  53. package/lib/flows/steps/rerun/rerun.js +13 -0
  54. package/lib/flows/steps/zip-cleanup.js +17 -0
  55. package/lib/flows/steps/zip-create-archive.js +15 -0
  56. package/lib/flows/steps/zip-file-list-resolve.js +266 -0
  57. package/lib/flows/steps/zip-prepare.js +20 -0
  58. package/lib/flows/steps/zip.js +6 -0
  59. package/lib/flows/zip-simple.js +6 -0
  60. package/lib/flows/zip.js +7 -0
  61. package/lib/helpers/cli-version.js +150 -0
  62. package/lib/helpers/commands.js +13 -0
  63. package/lib/helpers/logger.js +35 -0
  64. package/lib/helpers/manifest.js +82 -0
  65. package/lib/helpers/resolve-app-runtime.js +132 -0
  66. package/lib/helpers/utils.js +97 -0
  67. package/lib/helpers/versioning.js +94 -0
  68. package/lib/main.js +64 -0
  69. package/lib/options/api-key.js +6 -0
  70. package/lib/options/app-key.js +6 -0
  71. package/lib/options/app-version.js +3 -0
  72. package/lib/options/bump-version.js +19 -0
  73. package/lib/options/cache.js +11 -0
  74. package/lib/options/env.js +3 -0
  75. package/lib/options/original-cwd.js +3 -0
  76. package/lib/options/silent.js +3 -0
  77. package/package.json +1 -0
  78. package/template_extensions/corva/.commitlintrc.json +6 -0
  79. package/template_extensions/corva/.eslintrc +32 -0
  80. package/template_extensions/corva/.github/pull_request_template.md +14 -0
  81. package/template_extensions/corva/.github/workflows/code-checks.yml +15 -0
  82. package/template_extensions/corva/.github/workflows/develop.yml +19 -0
  83. package/template_extensions/corva/.github/workflows/feat-fix-delete.yml +14 -0
  84. package/template_extensions/corva/.github/workflows/feat-fix.yml +23 -0
  85. package/template_extensions/corva/.github/workflows/release-fix-X.X.X.yml +16 -0
  86. package/template_extensions/corva/.github/workflows/validate-pr-title.yml +19 -0
  87. package/template_extensions/corva/.husky/commit-msg +5 -0
  88. package/template_extensions/corva/.husky/pre-commit +4 -0
  89. package/template_extensions/corva/.release-please-manifest.json +3 -0
  90. package/template_extensions/corva/release-please-config.json +10 -0
  91. package/templates/scheduler_data-time/javascript/README.md +19 -0
  92. package/templates/scheduler_data-time/javascript/__tests__/processor.spec.js +15 -0
  93. package/templates/scheduler_data-time/javascript/index.js +15 -0
  94. package/templates/scheduler_data-time/python/README.md +31 -0
  95. package/templates/scheduler_data-time/python/lambda_function.py +7 -0
  96. package/templates/scheduler_data-time/python/test/__init__.py +0 -0
  97. package/templates/scheduler_data-time/python/test/app_test.py +10 -0
  98. package/templates/scheduler_data-time/typescript/README.md +25 -0
  99. package/templates/scheduler_data-time/typescript/__tests__/processor.spec.ts +15 -0
  100. package/templates/scheduler_data-time/typescript/index.ts +8 -0
  101. package/templates/scheduler_depth/javascript/README.md +19 -0
  102. package/templates/scheduler_depth/javascript/__tests__/processor.spec.js +17 -0
  103. package/templates/scheduler_depth/javascript/index.js +15 -0
  104. package/templates/scheduler_depth/python/README.md +31 -0
  105. package/templates/scheduler_depth/python/lambda_function.py +7 -0
  106. package/templates/scheduler_depth/python/test/__init__.py +0 -0
  107. package/templates/scheduler_depth/python/test/app_test.py +10 -0
  108. package/templates/scheduler_depth/typescript/README.md +25 -0
  109. package/templates/scheduler_depth/typescript/__tests__/processor.spec.ts +17 -0
  110. package/templates/scheduler_depth/typescript/index.ts +8 -0
  111. package/templates/scheduler_natural-time/javascript/README.md +19 -0
  112. package/templates/scheduler_natural-time/javascript/__tests__/processor.spec.js +15 -0
  113. package/templates/scheduler_natural-time/javascript/index.js +15 -0
  114. package/templates/scheduler_natural-time/python/README.md +31 -0
  115. package/templates/scheduler_natural-time/python/lambda_function.py +7 -0
  116. package/templates/scheduler_natural-time/python/test/__init__.py +0 -0
  117. package/templates/scheduler_natural-time/python/test/app_test.py +10 -0
  118. package/templates/scheduler_natural-time/typescript/README.md +25 -0
  119. package/templates/scheduler_natural-time/typescript/__tests__/processor.spec.ts +15 -0
  120. package/templates/scheduler_natural-time/typescript/index.ts +8 -0
  121. package/templates/stream_depth/javascript/README.md +19 -0
  122. package/templates/stream_depth/javascript/__tests__/processor.spec.js +20 -0
  123. package/templates/stream_depth/javascript/index.js +14 -0
  124. package/templates/stream_depth/python/README.md +31 -0
  125. package/templates/stream_depth/python/lambda_function.py +7 -0
  126. package/templates/stream_depth/python/test/__init__.py +0 -0
  127. package/templates/stream_depth/python/test/app_test.py +16 -0
  128. package/templates/stream_depth/typescript/README.md +25 -0
  129. package/templates/stream_depth/typescript/__tests__/processor.spec.ts +20 -0
  130. package/templates/stream_depth/typescript/index.ts +8 -0
  131. package/templates/stream_time/javascript/README.md +19 -0
  132. package/templates/stream_time/javascript/__tests__/processor.spec.js +14 -0
  133. package/templates/stream_time/javascript/index.js +14 -0
  134. package/templates/stream_time/python/README.md +31 -0
  135. package/templates/stream_time/python/lambda_function.py +7 -0
  136. package/templates/stream_time/python/test/__init__.py +0 -0
  137. package/templates/stream_time/python/test/app_test.py +16 -0
  138. package/templates/stream_time/typescript/README.md +25 -0
  139. package/templates/stream_time/typescript/__tests__/processor.spec.ts +14 -0
  140. package/templates/stream_time/typescript/index.ts +8 -0
  141. package/templates/task/javascript/README.md +19 -0
  142. package/templates/task/javascript/__tests__/processor.spec.js +16 -0
  143. package/templates/task/javascript/index.js +15 -0
  144. package/templates/task/python/README.md +31 -0
  145. package/templates/task/python/lambda_function.py +7 -0
  146. package/templates/task/python/test/__init__.py +0 -0
  147. package/templates/task/python/test/app_test.py +8 -0
  148. package/templates/task/typescript/README.md +25 -0
  149. package/templates/task/typescript/__tests__/processor.spec.ts +16 -0
  150. package/templates/task/typescript/index.ts +8 -0
  151. package/templates/ui/javascript/.codex/config.toml +3 -0
  152. package/templates/ui/javascript/.cursor/mcp.json +8 -0
  153. package/templates/ui/javascript/.eslintrc +11 -0
  154. package/templates/ui/javascript/.mcp.json +8 -0
  155. package/templates/ui/javascript/.prettierrc +1 -0
  156. package/templates/ui/javascript/AGENTS.md +304 -0
  157. package/templates/ui/javascript/CLAUDE.md +1 -0
  158. package/templates/ui/javascript/README.md +31 -0
  159. package/templates/ui/javascript/config/jest/babelTransform.js +16 -0
  160. package/templates/ui/javascript/config/jest/cssTransform.js +16 -0
  161. package/templates/ui/javascript/config/jest/fileTransform.js +48 -0
  162. package/templates/ui/javascript/config/jest/globalSetup.js +5 -0
  163. package/templates/ui/javascript/config/jest/setupTests.js +30 -0
  164. package/templates/ui/javascript/config-overrides.js +10 -0
  165. package/templates/ui/javascript/gitignore +27 -0
  166. package/templates/ui/javascript/src/App.completion.js +52 -0
  167. package/templates/ui/javascript/src/App.drilling.js +49 -0
  168. package/templates/ui/javascript/src/App.scss +17 -0
  169. package/templates/ui/javascript/src/AppSettings.js +28 -0
  170. package/templates/ui/javascript/src/__tests__/App.test.js +26 -0
  171. package/templates/ui/javascript/src/__tests__/AppSettings.test.js +28 -0
  172. package/templates/ui/javascript/src/__tests__/TestsExample.test.js +37 -0
  173. package/templates/ui/javascript/src/assets/logo.svg +7 -0
  174. package/templates/ui/javascript/src/constants.js +3 -0
  175. package/templates/ui/javascript/src/index.js +8 -0
  176. package/templates/ui/typescript/.codex/config.toml +3 -0
  177. package/templates/ui/typescript/.cursor/mcp.json +8 -0
  178. package/templates/ui/typescript/.eslintrc +28 -0
  179. package/templates/ui/typescript/.mcp.json +8 -0
  180. package/templates/ui/typescript/.prettierrc +1 -0
  181. package/templates/ui/typescript/AGENTS.md +344 -0
  182. package/templates/ui/typescript/CLAUDE.md +1 -0
  183. package/templates/ui/typescript/README.md +31 -0
  184. package/templates/ui/typescript/config/jest/babelTransform.js +16 -0
  185. package/templates/ui/typescript/config/jest/cssTransform.js +16 -0
  186. package/templates/ui/typescript/config/jest/fileTransform.js +48 -0
  187. package/templates/ui/typescript/config/jest/globalSetup.js +5 -0
  188. package/templates/ui/typescript/config/jest/setupTests.js +30 -0
  189. package/templates/ui/typescript/config-overrides.js +10 -0
  190. package/templates/ui/typescript/gitignore +27 -0
  191. package/templates/ui/typescript/src/App.completion.tsx +52 -0
  192. package/templates/ui/typescript/src/App.drilling.tsx +49 -0
  193. package/templates/ui/typescript/src/App.scss +17 -0
  194. package/templates/ui/typescript/src/AppSettings.tsx +28 -0
  195. package/templates/ui/typescript/src/__mocks__/mockData.ts +22 -0
  196. package/templates/ui/typescript/src/__tests__/App.test.tsx +27 -0
  197. package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +28 -0
  198. package/templates/ui/typescript/src/__tests__/TestsExample.test.tsx +37 -0
  199. package/templates/ui/typescript/src/assets/logo.svg +7 -0
  200. package/templates/ui/typescript/src/constants.ts +3 -0
  201. package/templates/ui/typescript/src/custom.d.ts +19 -0
  202. package/templates/ui/typescript/src/index.js +8 -0
  203. package/templates/ui/typescript/src/types.ts +3 -0
  204. package/templates/ui/typescript/tsconfig.json +7 -0
@@ -0,0 +1,19 @@
1
+ # Dev Center Node.js Real-Time Stream Data App
2
+
3
+ ## Getting started
4
+
5
+ ### 1. Install Dependencies
6
+
7
+ ```
8
+ npm install
9
+ ```
10
+
11
+ ### 2. Run Tests
12
+
13
+ ```
14
+ npm test
15
+ ```
16
+
17
+ ### 3. Deploy
18
+
19
+ Run `npm run bundle` to create a zip package that can be uploaded to Dev Center
@@ -0,0 +1,14 @@
1
+ const { StreamTimeEvent, StreamTimeRecord } = require('@corva/node-sdk');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
+
4
+ const { processor } = require('..');
5
+
6
+ test('processes event', async () => {
7
+ const event = new StreamTimeEvent({
8
+ company_id: 1,
9
+ asset_id: 1234,
10
+ records: [new StreamTimeRecord({ data: { bit_depth: 4980, hole_depth: 5000 }, timestamp: 1620905165 })],
11
+ });
12
+
13
+ expect(await app_runner(processor, event)).toBeUndefined();
14
+ });
@@ -0,0 +1,14 @@
1
+ const { Corva } = require('@corva/node-sdk');
2
+
3
+ /**
4
+ * @param {import('@corva/node-sdk').StreamTimeEvent} event
5
+ * @param {import('@corva/node-sdk').StatefulContext} context
6
+ */
7
+ const processor = async (event, context) => {
8
+ // Insert your logic here
9
+ context.logger.info('Hello, World!');
10
+ };
11
+
12
+ exports.processor = processor;
13
+
14
+ exports.handler = new Corva().stream(processor);
@@ -0,0 +1,31 @@
1
+ # Dev Center Python Real-Time Stream Data App
2
+
3
+ ## Getting started
4
+
5
+ [Python SDK Documentation](https://corva-ai.github.io/python-sdk)
6
+
7
+ ### 1. Install
8
+
9
+ You need to have `make` installed:
10
+
11
+ - Windows: [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install)
12
+ - OS X: [Command Line Tools for Xcode](https://developer.apple.com/download/more/)
13
+ - Linux: refer to your distro-specific docs
14
+
15
+ To install dependencies run:
16
+
17
+ ```sh
18
+ make
19
+ ```
20
+
21
+ ### 2. Run Tests
22
+
23
+ ```sh
24
+ make test
25
+ ```
26
+
27
+ ### 3. Create app zip
28
+
29
+ ```sh
30
+ make bundle
31
+ ```
@@ -0,0 +1,7 @@
1
+ from corva import Api, Cache, Logger, StreamTimeEvent, stream
2
+
3
+
4
+ @stream
5
+ def lambda_handler(event: StreamTimeEvent, api: Api, cache: Cache):
6
+ """Insert your logic here"""
7
+ Logger.info('Hello, World!')
File without changes
@@ -0,0 +1,16 @@
1
+ from corva import StreamTimeEvent, StreamTimeRecord
2
+ from lambda_function import lambda_handler
3
+
4
+
5
+ def test_app(app_runner):
6
+ event = StreamTimeEvent(
7
+ company_id=1,
8
+ asset_id=1234,
9
+ records=[
10
+ StreamTimeRecord(
11
+ data={'bit_depth': 4980, 'hole_depth': 5000}, timestamp=1620905165
12
+ )
13
+ ],
14
+ )
15
+
16
+ app_runner(lambda_handler, event=event)
@@ -0,0 +1,25 @@
1
+ # Dev Center Node.js TypeScript Real-Time Stream Data App
2
+
3
+ ## Getting started
4
+
5
+ ### 1. Install Dependencies
6
+
7
+ ```
8
+ npm install
9
+ ```
10
+
11
+ ### 2. Run Tests
12
+
13
+ ```
14
+ npm test
15
+ ```
16
+
17
+ ### 3. Build
18
+
19
+ ```
20
+ npm run build
21
+ ```
22
+
23
+ ### 4. Deploy
24
+
25
+ Run `npm run bundle` to create a zip package that can be uploaded to Dev Center
@@ -0,0 +1,14 @@
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
+ import { StreamTimeEvent, StreamTimeRecord } from '@corva/node-sdk';
3
+
4
+ import { processor } from '..';
5
+
6
+ test('processes event', async () => {
7
+ const event = new StreamTimeEvent({
8
+ company_id: 1,
9
+ asset_id: 1234,
10
+ records: [new StreamTimeRecord({ data: { bit_depth: 4980, hole_depth: 5000 }, timestamp: 1620905165 })],
11
+ });
12
+
13
+ expect(await app_runner(processor, event)).toBeUndefined();
14
+ });
@@ -0,0 +1,8 @@
1
+ import { Corva, StatefulContext, StreamTimeEvent } from '@corva/node-sdk';
2
+
3
+ export const processor = async (event: StreamTimeEvent, context: StatefulContext) => {
4
+ // Insert your logic here
5
+ context.logger.info('Hello, World!');
6
+ };
7
+
8
+ export const handler = new Corva().stream(processor);
@@ -0,0 +1,19 @@
1
+ # Dev Center Node.js Task Data App
2
+
3
+ ## Getting started
4
+
5
+ ### 1. Install Dependencies
6
+
7
+ ```
8
+ npm install
9
+ ```
10
+
11
+ ### 2. Run Tests
12
+
13
+ ```
14
+ npm test
15
+ ```
16
+
17
+ ### 3. Deploy
18
+
19
+ Run `npm run bundle` to create a zip package that can be uploaded to Dev Center
@@ -0,0 +1,16 @@
1
+ const { TaskEvent } = require('@corva/node-sdk');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
+
4
+ const { processor } = require('..');
5
+
6
+ test('processes event', async () => {
7
+ const event = new TaskEvent({
8
+ company_id: 1,
9
+ asset_id: 1234,
10
+ properties: {
11
+ foo: 'bar',
12
+ },
13
+ });
14
+
15
+ expect(await app_runner(processor, event)).toBeUndefined();
16
+ });
@@ -0,0 +1,15 @@
1
+ const { Corva } = require('@corva/node-sdk');
2
+
3
+ /**
4
+ *
5
+ * @param {import('@corva/node-sdk').TaskEvent} event
6
+ * @param {import('@corva/node-sdk').StatelessContext} context
7
+ */
8
+ const processor = async (event, context) => {
9
+ // Insert your logic here
10
+ context.logger.info('Hello, World!');
11
+ };
12
+
13
+ exports.processor = processor;
14
+
15
+ exports.handler = new Corva().task(processor);
@@ -0,0 +1,31 @@
1
+ # Dev Center Python Task Data App
2
+
3
+ ## Getting started
4
+
5
+ [Python SDK Documentation](https://corva-ai.github.io/python-sdk)
6
+
7
+ ### 1. Install
8
+
9
+ You need to have `make` installed:
10
+
11
+ - Windows: [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install)
12
+ - OS X: [Command Line Tools for Xcode](https://developer.apple.com/download/more/)
13
+ - Linux: refer to your distro-specific docs
14
+
15
+ To install dependencies run:
16
+
17
+ ```sh
18
+ make
19
+ ```
20
+
21
+ ### 2. Run Tests
22
+
23
+ ```sh
24
+ make test
25
+ ```
26
+
27
+ ### 3. Create app zip
28
+
29
+ ```sh
30
+ make bundle
31
+ ```
@@ -0,0 +1,7 @@
1
+ from corva import Api, Logger, TaskEvent, task
2
+
3
+
4
+ @task
5
+ def lambda_handler(event: TaskEvent, api: Api):
6
+ """Insert your logic here"""
7
+ Logger.info('Hello, World!')
File without changes
@@ -0,0 +1,8 @@
1
+ from corva import TaskEvent
2
+ from lambda_function import lambda_handler
3
+
4
+
5
+ def test_app(app_runner):
6
+ event = TaskEvent(company_id=1, asset_id=1234, properties={'foo': "bar"})
7
+
8
+ app_runner(lambda_handler, event=event)
@@ -0,0 +1,25 @@
1
+ # Dev Center Node.js Task Data App
2
+
3
+ ## Getting started
4
+
5
+ ### 1. Install Dependencies
6
+
7
+ ```
8
+ npm install
9
+ ```
10
+
11
+ ### 2. Run Tests
12
+
13
+ ```
14
+ npm test
15
+ ```
16
+
17
+ ### 3. Build
18
+
19
+ ```
20
+ npm run build
21
+ ```
22
+
23
+ ### 4. Deploy
24
+
25
+ Run `npm run bundle` to create a zip package that can be uploaded to Dev Center
@@ -0,0 +1,16 @@
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
+ import { TaskEvent } from '@corva/node-sdk';
3
+
4
+ import { processor } from '..';
5
+
6
+ test('processes event', async () => {
7
+ const event = new TaskEvent({
8
+ company_id: 1,
9
+ asset_id: 1234,
10
+ properties: {
11
+ foo: 'bar',
12
+ },
13
+ });
14
+
15
+ expect(await app_runner(processor, event)).toBeUndefined();
16
+ });
@@ -0,0 +1,8 @@
1
+ import { Corva, StatelessContext, TaskEvent } from '@corva/node-sdk';
2
+
3
+ export const processor = async (event: TaskEvent, context: StatelessContext) => {
4
+ // Insert your logic here
5
+ context.logger.info('Hello, World!');
6
+ };
7
+
8
+ export const handler = new Corva().task(processor);
@@ -0,0 +1,3 @@
1
+ [mcp_servers.corva-ui]
2
+ command = "npx"
3
+ args = ["-p", "@corva/ui", "corva-ui-mcp"]
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "corva-ui": {
4
+ "command": "npx",
5
+ "args": ["-p", "@corva/ui", "corva-ui-mcp"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "root": true,
3
+ "extends": "@corva/eslint-config-browser",
4
+ "parserOptions": {
5
+ "requireConfigFile": false,
6
+ "babelOptions": {
7
+ "presets": ["@babel/preset-react"],
8
+ "plugins": ["@babel/plugin-proposal-class-properties"]
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "corva-ui": {
4
+ "command": "npx",
5
+ "args": ["-p", "@corva/ui", "corva-ui-mcp"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ "@corva/eslint-config-browser/prettier"
@@ -0,0 +1,304 @@
1
+ # AGENTS.md
2
+
3
+ Corva.AI platform UI app — a React dashboard widget scaffolded by `create-corva-app`.
4
+ Deployed to the Corva platform via `yarn release`.
5
+
6
+ ## Critical Rules
7
+
8
+ These constraints are enforced by the platform. Violating them breaks the build or runtime.
9
+
10
+ 1. **Root export** — `src/index.js` MUST default-export `{ component: App, settings: AppSettings }`. The component may also be a `ParentApp` wrapper (e.g., `{ component: ParentApp, settings: AppSettings }`) that wraps `App` with Context.Providers and prop initialization. This is the platform loader contract.
11
+ 2. **UI components** — Use only `@corva/ui` components. Import from `@corva/ui/componentsV2`; fall back to `@corva/ui/components` only when a V2 version doesn't exist yet. `@material-ui/core` v4 is available as the underlying library.
12
+ 3. **HTTP clients** — Use `corvaDataAPI` / `corvaAPI` from `@corva/ui/clients` for all network requests.
13
+ 4. **Do not rename or delete** `App.js`, `AppSettings.js`, or `index.js` — they are platform entry points.
14
+
15
+ ## Project Structure
16
+
17
+ ```
18
+ src/
19
+ App.js — Main app component (default export required)
20
+ AppSettings.js — Settings panel component (default export required)
21
+ index.js — Root export: { component, settings }
22
+ constants.js — Default settings values
23
+ App.scss — Component styles
24
+ __tests__/ — Jest test files
25
+ __mocks__/ — Mock data (mockAppProps.js, mockAppSettingsProps.js)
26
+ assets/ — Static assets (SVGs, images)
27
+ config/jest/ — Jest setup (setupTests, transforms)
28
+ config-overrides.js — Webpack 5 customization
29
+ manifest.json — Corva platform app metadata (generated at scaffold time)
30
+ ```
31
+
32
+ ## Key Patterns
33
+
34
+ ### Component Structure
35
+
36
+ - Use JSDoc `@param` / `@returns` annotations for prop documentation.
37
+ - Use `useAppCommons()` from `@corva/ui/effects` for app context (`appKey`).
38
+
39
+ ### Styling
40
+
41
+ The preferred way to write styles is SCSS (`.scss` files).
42
+
43
+ Every `.scss` file must import the shared utilities:
44
+
45
+ ```scss
46
+ @import '@corva/ui/styles/common';
47
+ ```
48
+
49
+ This provides all functions, variables, and mixins below.
50
+
51
+ For custom shared variables or mixins specific to the project, create a `src/styles/` directory (e.g. `_variables.scss`, `_common.scss`) and import them alongside the `@corva/ui` import.
52
+
53
+ **`spacing($top, $right?, $bottom?, $left?)`** — 8px base unit:
54
+
55
+ ```scss
56
+ padding: spacing(2); // 16px
57
+ margin: spacing(1, 0); // 8px 0
58
+ gap: spacing(0.5); // 4px
59
+ padding: spacing(2, 1, 2, 1); // 16px 8px 16px 8px
60
+ ```
61
+
62
+ **`colorAlpha($color, $opacity)`** — transparency:
63
+
64
+ ```scss
65
+ background: colorAlpha($palette_t1, 0.08); // white at 8% opacity
66
+ border: 1px solid colorAlpha($palette_t1, 0.12);
67
+ ```
68
+
69
+ **`transition($properties...)`** — standard `cubic-bezier(0.4, 0, 0.2, 1) 0.15s`:
70
+
71
+ ```scss
72
+ transition: transition(opacity);
73
+ transition: transition(color, background-color);
74
+ ```
75
+
76
+ **Full example:**
77
+
78
+ ```scss
79
+ @import '@corva/ui/styles/common';
80
+
81
+ .container {
82
+ padding: spacing(2);
83
+ background: $palette_b5;
84
+ color: $palette_t1;
85
+ transition: transition(opacity, background-color);
86
+
87
+ &:hover {
88
+ background: colorAlpha($palette_t1, 0.08);
89
+ }
90
+ }
91
+
92
+ .label {
93
+ color: $palette_t7;
94
+ font-size: 12px;
95
+ }
96
+ ```
97
+
98
+ **Import in component:**
99
+
100
+ ```javascript
101
+ import styles from './App.scss';
102
+ // Use: <div className={styles.container}>
103
+ ```
104
+
105
+ **Colors & Theming:**
106
+
107
+ NEVER hardcode color values (hex, rgb, hsl). Always use `@corva/ui` theme colors:
108
+
109
+ - In SCSS: use SCSS variables from `@corva/ui/styles/common` like `$palette_t1`, `$palette_b5`, `$palette_t7`
110
+ - Use `colorAlpha($color, $opacity)` for transparency instead of raw `rgba()`
111
+ - Run MCP tool `get_theme_docs` (section: "variables") to see all available theme variables
112
+ - Run MCP tool `get_theme_docs` (section: "palette") to see available palette colors with hex values
113
+
114
+ **Rules:**
115
+
116
+ - No inline `style={{...}}` unless absolutely necessary for dynamic values
117
+ - Use `classnames` for conditional/composed classes, never manual string joins
118
+ - No global selectors (tag selectors like `div`, `span`) — use `:global()` only when absolutely necessary
119
+ - No `!important`
120
+ - Use a descriptive camelCase class as the root selector (e.g. `.toolbar`, `.chartPanel`) instead of generic `.root`
121
+
122
+ ### State Management (Zustand)
123
+
124
+ The Corva platform can render multiple instances of the same app simultaneously. If a Zustand store is created at module level (singleton), all instances share the same state. To avoid this, always create store instances inside a React Context provider.
125
+
126
+ **Store factory + context** — create a factory function and a context to hold the store instance:
127
+
128
+ ```javascript
129
+ // store/createAppStore.js
130
+ import { createContext } from 'react';
131
+ import { create } from 'zustand';
132
+
133
+ export const createAppStore = (initProps = {}) => {
134
+ return create((set, get) => ({
135
+ // Compose sub-stores
136
+ ...createSettingsStore(initProps.settings)(set, get),
137
+ ...createDataStore()(set, get),
138
+ }));
139
+ };
140
+
141
+ export const StoreContext = createContext(null);
142
+ ```
143
+
144
+ **Provider** — create the store once per app mount and pass it via context:
145
+
146
+ ```javascript
147
+ // StoreProvider.js
148
+ import { useState } from 'react';
149
+
150
+ import { StoreContext, createAppStore } from './store/createAppStore';
151
+
152
+ export const StoreProvider = ({ children, savedSettings }) => {
153
+ const [appStore] = useState(() => createAppStore(savedSettings));
154
+
155
+ return <StoreContext.Provider value={appStore}>{children}</StoreContext.Provider>;
156
+ };
157
+ ```
158
+
159
+ **Consumer hooks** — read from context, never from a global store:
160
+
161
+ ```javascript
162
+ // hooks/useAppStore.js
163
+ import { useContext } from 'react';
164
+ import { useStore } from 'zustand';
165
+ import { useStoreWithEqualityFn } from 'zustand/traditional';
166
+
167
+ import { StoreContext } from '../store/createAppStore';
168
+
169
+ /** Read a single top-level key from the store. */
170
+ export const useAppStore = key => {
171
+ const store = useContext(StoreContext);
172
+ if (!store) throw new Error('useAppStore must be used within StoreProvider');
173
+ return useStore(store, state => state[key]);
174
+ };
175
+
176
+ /** Subscribe to a derived value with optional custom equality. */
177
+ export const useAppStoreSelector = (selector, equalityFn) => {
178
+ const store = useContext(StoreContext);
179
+ if (!store) throw new Error('useAppStoreSelector must be used within StoreProvider');
180
+ return useStoreWithEqualityFn(store, selector, equalityFn);
181
+ };
182
+ ```
183
+
184
+ **Usage in components:**
185
+
186
+ ```javascript
187
+ const isLegendVisible = useAppStore('isLegendVisible');
188
+ const selectedChannels = useAppStoreSelector(state => state.selectedChannels);
189
+ ```
190
+
191
+ **Wire it up in `ParentApp`** (see full example with `QueryClientProvider` in the Data Fetching section below).
192
+
193
+ General rules:
194
+
195
+ - Name stores `use[Name]Store` (e.g., `useWellDataStore`)
196
+ - Use selectors: `const value = useAppStore('value')`
197
+ - Keep business logic in store actions
198
+
199
+ ### Data Fetching (React Query v4)
200
+
201
+ Same as Zustand: the platform runs multiple app instances, so each must have its own `QueryClient`. Never create a `QueryClient` at module level — use a hook with `useState` to create it once per mount.
202
+
203
+ **`useQueryClient` hook** — creates an isolated `QueryClient` per app instance:
204
+
205
+ ```javascript
206
+ // hooks/useQueryClient.js
207
+ import { useState } from 'react';
208
+ import { QueryCache, QueryClient } from '@tanstack/react-query';
209
+ import { showErrorNotification } from '@corva/ui/utils';
210
+
211
+ export const useQueryClient = () => {
212
+ const [queryClient] = useState(
213
+ new QueryClient({
214
+ queryCache: new QueryCache({
215
+ onError: error => {
216
+ if (error?.message) {
217
+ showErrorNotification(`Something went wrong: ${error.message}`);
218
+ }
219
+ },
220
+ }),
221
+ defaultOptions: {
222
+ queries: {
223
+ refetchOnWindowFocus: false,
224
+ refetchOnReconnect: false,
225
+ },
226
+ },
227
+ })
228
+ );
229
+
230
+ return queryClient;
231
+ };
232
+ ```
233
+
234
+ **Wire it up in `ParentApp`** — wrap the app tree with `QueryClientProvider`:
235
+
236
+ ```javascript
237
+ import { QueryClientProvider } from '@tanstack/react-query';
238
+
239
+ const ParentApp = () => {
240
+ const { appSettings, onSettingsChange } = useAppCommons();
241
+ const queryClient = useQueryClient();
242
+
243
+ return (
244
+ <QueryClientProvider client={queryClient}>
245
+ <StoreProvider savedSettings={appSettings?.savedSettings}>
246
+ <App />
247
+ </StoreProvider>
248
+ </QueryClientProvider>
249
+ );
250
+ };
251
+
252
+ export default { component: ParentApp, settings: AppSettings };
253
+ ```
254
+
255
+ General rules:
256
+
257
+ - Encapsulate queries in custom hooks (e.g., `useWellData`)
258
+ - Use typed query keys (array format)
259
+ - Always handle `isLoading` and `isError` states
260
+
261
+ ## Naming Conventions
262
+
263
+ - Boolean variables: prefix with `is`, `has`, or `should`
264
+ - Non-empty array checks: `!!array.length` (not `array.length > 0`)
265
+
266
+ ## Testing
267
+
268
+ - **Framework:** Jest + React Testing Library
269
+ - **Wrapper:** Use `AppTestWrapper` from `@corva/ui/testing` to wrap components
270
+ - **Mocking:** Mock network requests (jest mocks or msw), never call real APIs
271
+ - **Timezone:** UTC is enforced (`process.env.TZ = 'UTC'`)
272
+ - **Mocked globals:** `ResizeObserver`, `MutationObserver` (in `setupTests.js`)
273
+
274
+ ## Commands
275
+
276
+ ```
277
+ yarn start Dev server at http://app.local.corva.ai:8080/
278
+ yarn build Production bundle
279
+ yarn test Run tests
280
+ yarn lint ESLint check
281
+ yarn zip Create deployment ZIP
282
+ yarn release Release to Corva platform
283
+ ```
284
+
285
+ ## @corva/ui Documentation
286
+
287
+ Local documentation for `@corva/ui` is bundled at `node_modules/@corva/ui/docs/`.
288
+ Before implementing any UI component, data fetch, or API call, read the relevant doc file:
289
+
290
+ - **V2 Components:** `node_modules/@corva/ui/docs/01-components-v2/` — Props, examples, usage
291
+ - **V1 Components:** `node_modules/@corva/ui/docs/02-components-v1/` — Legacy components reference
292
+ - **Hooks:** `node_modules/@corva/ui/docs/03-hooks/` — Parameters, return types, examples
293
+ - **API Clients:** `node_modules/@corva/ui/docs/04-clients/` — corvaAPI, corvaDataAPI endpoints
294
+ - **Theme:** `node_modules/@corva/ui/docs/05-theme/` — Color palette, CSS variables
295
+ - **Utilities:** `node_modules/@corva/ui/docs/06-utilities/` — Helper functions
296
+ - **Constants:** `node_modules/@corva/ui/docs/07-constants/` — Platform constants
297
+
298
+ Start with `node_modules/@corva/ui/docs/README.md` for the full index.
299
+ Do NOT guess `@corva/ui` APIs — read the local docs first.
300
+
301
+ ## MCP Server (Interactive Fallback)
302
+
303
+ The `corva-ui` MCP server is pre-configured (`.mcp.json`, `.cursor/mcp.json`, `.codex/config.toml`).
304
+ Use it for interactive queries when the local docs are insufficient or you need to search across components.
@@ -0,0 +1 @@
1
+ @AGENTS.md