cognite-create 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/.cursor/rules/core-cdf-apis.mdc +2 -2
- package/templates/.cursor/rules/datamodelling.mdc +2 -2
- package/templates/tsconfig.app.json +34 -0
- package/templates/tsconfig.node.json +30 -0
- package/templates/.cursor/rules/development.mdc +0 -90
- package/templates/.cursor/rules/requirements-gathering.mdc +0 -24
- package/templates/tsconfig.json +0 -12
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"moduleDetection": "force",
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
|
|
19
|
+
/* Path mapping */
|
|
20
|
+
"baseUrl": ".",
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./src/*"]
|
|
23
|
+
},
|
|
24
|
+
/* Linting */
|
|
25
|
+
"strict": true,
|
|
26
|
+
"noUnusedLocals": true,
|
|
27
|
+
"noUnusedParameters": true,
|
|
28
|
+
"erasableSyntaxOnly": true,
|
|
29
|
+
"noFallthroughCasesInSwitch": true,
|
|
30
|
+
"noUncheckedSideEffectImports": true
|
|
31
|
+
},
|
|
32
|
+
"include": ["src"],
|
|
33
|
+
"exclude": ["node_modules"]
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true,
|
|
24
|
+
"paths": {
|
|
25
|
+
"@/*": ["./src/*"]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"include": ["vite.config.ts"],
|
|
29
|
+
"exclude": ["node_modules"]
|
|
30
|
+
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
alwaysApply: true
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# AGENTS.md - Developer & AI Assistant Onboarding Guide
|
|
6
|
-
|
|
7
|
-
Important rules:
|
|
8
|
-
|
|
9
|
-
- Always use the design system provided. cdf-design-system-alpha.
|
|
10
|
-
- Check often for typescript errors, and resolve them as they come. Especially after big changes.
|
|
11
|
-
- When making types for schemas that are represented in data modelling, fetch the details of that view first from CDF.
|
|
12
|
-
- Always use the design system provided. cdf-design-system-alpha.
|
|
13
|
-
|
|
14
|
-
## 1. Project Overview
|
|
15
|
-
|
|
16
|
-
This application is a React-based web application. You will build a react application to the spec that the user provides. You will also help define that spec according to the details in this document. You are provided with some boiler plate. Do not touch the `/src/infrastructure` folder, only use its components when needed.
|
|
17
|
-
|
|
18
|
-
## 2. Core Technologies
|
|
19
|
-
|
|
20
|
-
- **Language:** TypeScript
|
|
21
|
-
- **Framework:** React 17 with Vite.
|
|
22
|
-
- **State Management:** React context
|
|
23
|
-
- **Styling:** Tailwind + Cognite Design System (cdf-design-system-alpha)[node_modules/cdf-design-system-alpha/AI_USAGE_GUIDE.md]
|
|
24
|
-
- **Data Fetching:** React Query + Cognite SDK (@cognite/sdk)
|
|
25
|
-
- **Testing:** Vitest & Playwright
|
|
26
|
-
- **Package Manager:** npm
|
|
27
|
-
- **Authentication:** Use provided components
|
|
28
|
-
- **Other tools:**: Storybook
|
|
29
|
-
|
|
30
|
-
## 3. Development Environment Setup
|
|
31
|
-
|
|
32
|
-
1. **Prerequisites:** Ensure you have Node.js v22+ and Yarn installed
|
|
33
|
-
2. **Install dependencies:** `npm install`
|
|
34
|
-
3. **Environment setup:**
|
|
35
|
-
- Ensure `cdf.yml` has been populated by the user
|
|
36
|
-
4. **Start development server:** `npm start`
|
|
37
|
-
- Runs on `http://localhost:5000` by default
|
|
38
|
-
- Uses hot reloading for development
|
|
39
|
-
|
|
40
|
-
## 4. Coding Style & Design Principles
|
|
41
|
-
|
|
42
|
-
### Architecture Patterns
|
|
43
|
-
|
|
44
|
-
- **Component Structure:** Functional components with hooks, organized by feature in `/components`
|
|
45
|
-
- **Custom Hooks:** Extensive use of custom hooks for business logic (`/hooks`)
|
|
46
|
-
- **Service Layer:** Cognite SDK integration through centralized client (`/services`)
|
|
47
|
-
|
|
48
|
-
### Code Style Guidelines
|
|
49
|
-
|
|
50
|
-
- **Import Organization:** Avoid barrel imports
|
|
51
|
-
- **File Organization:** Co-locate related files (component + types + styles)
|
|
52
|
-
- **State Management:** Prefer React Context for global state, local state for component-specific data
|
|
53
|
-
- **Error Handling:** Use React Error Boundaries and proper error states
|
|
54
|
-
|
|
55
|
-
### Key Conventions
|
|
56
|
-
|
|
57
|
-
- **Exports:** Avoid default exports
|
|
58
|
-
- **Async Operations:** Use react-query
|
|
59
|
-
- **Styling:** Tailwind CSS with Cognites design system
|
|
60
|
-
- **Testing:** Test files co-located with components using `.test.tsx` extension
|
|
61
|
-
|
|
62
|
-
## 5. Styling
|
|
63
|
-
|
|
64
|
-
When asked to style, never use inline styles. Always use as much as possible the design system provided through `cdf-design-system-alpha`. Use tailwindcss actively. See here for more details. (cdf-design-system-alpha)[node_modules/cdf-design-system-alpha/AI_USAGE_GUIDE.md]
|
|
65
|
-
|
|
66
|
-
## 6. Anything Else to Know?
|
|
67
|
-
|
|
68
|
-
### Project Structure Highlights
|
|
69
|
-
|
|
70
|
-
- **`/src/components`**: Feature-based component organization
|
|
71
|
-
- **`/src/pages`**: Top-level page components and routing
|
|
72
|
-
- **`/src/hooks`**: Reusable custom hooks for business logic
|
|
73
|
-
- **`/src/services`**: Services connecting to external data and systems
|
|
74
|
-
- **`/src/config`**: Environment and application configuration
|
|
75
|
-
- **`/src/infrastructure`**: DO NOT EDIT THIS FOLDER. It contains important infrastructure. Use its components as stated
|
|
76
|
-
|
|
77
|
-
### Important Notes
|
|
78
|
-
|
|
79
|
-
- **Cognite Integration:** Heavy integration with Cognite Data Fusion APIs for industrial data
|
|
80
|
-
- **Design system:** Exclusively use components from cdf-design-system-alpha, unless the component does not exist in the library. (cdf-design-system-alpha)[node_modules/cdf-design-system-alpha/AI_USAGE_GUIDE.md] contains an AI usage guide.
|
|
81
|
-
|
|
82
|
-
### Infrastructure
|
|
83
|
-
|
|
84
|
-
The `/src/infrastructure` folder contains important react components used to enable the application to be run not only in a standalone environment, but also within Cognite Fusion - another web application. It handles the authentication for you, among other things, and will provide you an SDK to connect to CDF.
|
|
85
|
-
|
|
86
|
-
- `useCDF` will give you an SDK.
|
|
87
|
-
|
|
88
|
-
### Development Tips
|
|
89
|
-
|
|
90
|
-
- The app connects to Cognite's industrial data platform, so some features require proper API access
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: When asked to develop a set of requirements for an application.
|
|
3
|
-
alwaysApply: false
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
USE THE TEMPLATE PROVIDED VIA docs/TEMPLATE_REQUIREMENTS.MD.
|
|
7
|
-
|
|
8
|
-
Generate a comprehensive requirements document for a new application. The application will be a web-based dashboard and reporting tool for monitoring industrial asset performance. The core data model is based on CDF (Cognite Data Fusion). The requirements document should include the following sections:
|
|
9
|
-
|
|
10
|
-
Introduction: A high-level overview of the application's purpose and its target users.
|
|
11
|
-
|
|
12
|
-
Functional Requirements: A detailed list of what the application must do, including data visualization, reporting, user authentication, and interaction with CDF. Specify how data will be retrieved (e.g., using Cognite's APIs for time series. DO NOT USE ASSETS. Only use Data modelling), transformed, and presented.
|
|
13
|
-
|
|
14
|
-
Non-Functional Requirements: Cover aspects like performance (e.g., dashboard load times), security (e.g., user roles and permissions mapped to CDF's security model), scalability, and usability.
|
|
15
|
-
|
|
16
|
-
Data Model & Integration: Describe how the application's data model maps directly to the CDF data model. This section is crucial and must detail the specific CDF core data models and how they will be used to structure the application's data. Include details on how the application will use CDF's asset hierarchy to navigate and filter data. Define new view structures when needed
|
|
17
|
-
|
|
18
|
-
User Stories: Create a set of user stories that encapsulate the key features from the functional requirements, written from the perspective of a typical user (e.g., a plant manager or a maintenance engineer).
|
|
19
|
-
|
|
20
|
-
Technology Stack: Always use what is defined in the development.mdc rule.
|
|
21
|
-
|
|
22
|
-
Ensure the document is structured with clear headings and a professional tone. The output should be a detailed, well-organized document that can serve as a blueprint for the development team.
|
|
23
|
-
|
|
24
|
-
USE THE TEMPLATE PROVIDED VIA docs/TEMPLATE_REQUIREMENTS.MD.
|