From c1a40147d83e950d461c5b722beb7ed7f0d2232f Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Tue, 20 May 2025 21:09:14 +0200 Subject: [PATCH 1/3] feat: Add Temporal Project Structure Rule documentation - Introduced a new markdown file defining the directory and documentation structure for Temporal-based workflows and workers. - Outlined project structure, shared utilities, documentation requirements, best practices, and enforcement rules for creating new Temporal workers. This addition enhances clarity and consistency in project organization for Temporal workflows. --- .cursor/rules/temporal-project-structure.mdc | 75 ++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .cursor/rules/temporal-project-structure.mdc diff --git a/.cursor/rules/temporal-project-structure.mdc b/.cursor/rules/temporal-project-structure.mdc new file mode 100644 index 0000000..9439528 --- /dev/null +++ b/.cursor/rules/temporal-project-structure.mdc @@ -0,0 +1,75 @@ +--- +description: +globs: ["workers/**/*", "docs/user-guide/temporal/**/*"] +alwaysApply: false +--- +# Temporal Project Structure Rule + +## Purpose +Defines the required directory and documentation structure for Temporal-based workflows and workers in this repository. + +## Project Structure + +The project follows a modular structure with workers as independent packages: + +``` +. +├── workers/ # Root directory for all Temporal workers +│ ├── main/ # Main worker package +│ │ ├── src/ # Source code +│ │ │ ├── activities/ # Activity implementations +│ │ │ ├── workflows/ # Workflow definitions +│ │ │ ├── index.ts # Worker entry point +│ │ │ └── types.ts # Worker-specific types +│ │ ├── package.json # Worker dependencies +│ │ ├── tsconfig.json # TypeScript configuration +│ │ └── README.md # Worker documentation +│ └── [other-workers]/ # Additional worker packages +├── workers-shared/ # Shared utilities, types, and configuration for all workers +├── docs/ # Project documentation +│ └── user-guide/ # User guides and documentation +├── docker-compose.yml # Docker compose configuration +└── Dockerfile.temporal # Base Temporal worker Dockerfile +``` + +All Temporal workers must be placed under `workers//` and include: + +- `workflows/` — workflow definitions for this worker +- `activities/` — activity implementations for this worker +- `index.ts` — worker entry point (registers workflows/activities, sets task queue) +- `types.ts` — (optional) worker-specific types +- `README.md` — brief usage and development instructions + +### Shared Utilities + +Shared utilities, types, and configuration that are used by multiple workers should be placed in the `workers-shared/` directory at the project root. This directory is intended for code that is not specific to a single worker but is reused across multiple workers to avoid duplication and promote consistency. + +- `workers-shared/` — shared modules, types, and configuration for all workers + - Utilities and helpers + - Common type definitions + - Shared configuration files + +## Documentation + +Each worker must have a dedicated documentation file at: +`docs/user-guide/temporal/workers/.md` + +Documentation must include: + +- Purpose and responsibilities of the worker +- List and description of workflows and activities +- Required environment variables +- Integration points (e.g., databases, APIs) +- Best practices and troubleshooting + +## Best Practices + +- Keep workflow and activity logic modular and well-tested. +- Use clear, descriptive names for workflows, activities, and task queues. +- Update documentation with every significant change to workflows or activities. +- New workers must not duplicate logic already present in shared modules. +- Place all shared code in `workers-shared/` to maximize reuse and maintainability. + +## Enforcement + +- PRs introducing new Temporal workers or workflows **must** follow this structure and update documentation accordingly. From 5b3e42e42cfee78c933358f1c5adea68012a923a Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Tue, 20 May 2025 21:23:04 +0200 Subject: [PATCH 2/3] fix: Update description in Temporal Project Structure Rule documentation - Revised the description to clearly define and enforce standardized directory structure and documentation requirements for Temporal-based workflows and workers. - This change enhances clarity and understanding of the project's organization and documentation standards. --- .cursor/rules/temporal-project-structure.mdc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cursor/rules/temporal-project-structure.mdc b/.cursor/rules/temporal-project-structure.mdc index 9439528..8ab737e 100644 --- a/.cursor/rules/temporal-project-structure.mdc +++ b/.cursor/rules/temporal-project-structure.mdc @@ -1,5 +1,5 @@ --- -description: +description: "Defines and enforces standardized directory structure and documentation requirements for Temporal-based workflows and workers" globs: ["workers/**/*", "docs/user-guide/temporal/**/*"] alwaysApply: false --- From 78cd124354e17e499791544162db367c47426720 Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Wed, 21 May 2025 13:39:42 +0200 Subject: [PATCH 3/3] refactor: Rename 'workers-shared' directory to 'common' in Temporal Project Structure documentation - Updated references in the documentation to reflect the new directory name 'common' for shared utilities, types, and configuration. --- .cursor/rules/temporal-project-structure.mdc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cursor/rules/temporal-project-structure.mdc b/.cursor/rules/temporal-project-structure.mdc index 8ab737e..e1398ed 100644 --- a/.cursor/rules/temporal-project-structure.mdc +++ b/.cursor/rules/temporal-project-structure.mdc @@ -25,8 +25,8 @@ The project follows a modular structure with workers as independent packages: │ │ ├── tsconfig.json # TypeScript configuration │ │ └── README.md # Worker documentation │ └── [other-workers]/ # Additional worker packages -├── workers-shared/ # Shared utilities, types, and configuration for all workers -├── docs/ # Project documentation +├── common/ # Shared utilities, types, and configuration for all workers +├── docs/ # Project documentation │ └── user-guide/ # User guides and documentation ├── docker-compose.yml # Docker compose configuration └── Dockerfile.temporal # Base Temporal worker Dockerfile