@calmo/task-runner 4.0.4 → 4.2.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.
- package/.github/workflows/codeql.yml +1 -1
- package/.github/workflows/release-please.yml +2 -2
- package/.jules/nexus.md +10 -0
- package/.release-please-manifest.json +1 -1
- package/AGENTS.md +3 -0
- package/CHANGELOG.md +46 -0
- package/CODE_OF_CONDUCT.md +131 -0
- package/CONTRIBUTING.md +89 -0
- package/README.md +34 -0
- package/conductor/code_styleguides/general.md +23 -0
- package/conductor/code_styleguides/javascript.md +51 -0
- package/conductor/code_styleguides/typescript.md +43 -0
- package/conductor/product-guidelines.md +14 -0
- package/conductor/product.md +16 -0
- package/conductor/setup_state.json +1 -0
- package/conductor/tech-stack.md +19 -0
- package/conductor/workflow.md +334 -0
- package/dist/EventBus.js +16 -16
- package/dist/EventBus.js.map +1 -1
- package/dist/PluginManager.d.ts +22 -0
- package/dist/PluginManager.js +39 -0
- package/dist/PluginManager.js.map +1 -0
- package/dist/TaskGraphValidator.d.ts +1 -1
- package/dist/TaskGraphValidator.js +16 -21
- package/dist/TaskGraphValidator.js.map +1 -1
- package/dist/TaskResult.d.ts +9 -0
- package/dist/TaskRunner.d.ts +8 -1
- package/dist/TaskRunner.js +64 -41
- package/dist/TaskRunner.js.map +1 -1
- package/dist/TaskStateManager.d.ts +22 -6
- package/dist/TaskStateManager.js +105 -45
- package/dist/TaskStateManager.js.map +1 -1
- package/dist/WorkflowExecutor.js +36 -20
- package/dist/WorkflowExecutor.js.map +1 -1
- package/dist/contracts/Plugin.d.ts +30 -0
- package/dist/contracts/Plugin.js +2 -0
- package/dist/contracts/Plugin.js.map +1 -0
- package/dist/strategies/DryRunExecutionStrategy.d.ts +1 -1
- package/dist/strategies/DryRunExecutionStrategy.js +2 -4
- package/dist/strategies/DryRunExecutionStrategy.js.map +1 -1
- package/dist/utils/PriorityQueue.d.ts +13 -0
- package/dist/utils/PriorityQueue.js +82 -0
- package/dist/utils/PriorityQueue.js.map +1 -0
- package/openspec/changes/add-middleware-support/proposal.md +19 -0
- package/openspec/changes/add-middleware-support/specs/task-runner/spec.md +34 -0
- package/openspec/changes/add-middleware-support/tasks.md +9 -0
- package/openspec/changes/add-resource-concurrency/proposal.md +18 -0
- package/openspec/changes/add-resource-concurrency/specs/task-runner/spec.md +25 -0
- package/openspec/changes/add-resource-concurrency/tasks.md +10 -0
- package/openspec/changes/allow-plugin-hooks/design.md +51 -0
- package/openspec/changes/allow-plugin-hooks/proposal.md +12 -0
- package/openspec/changes/allow-plugin-hooks/specs/post-task/spec.md +21 -0
- package/openspec/changes/allow-plugin-hooks/specs/pre-task/spec.md +32 -0
- package/openspec/changes/allow-plugin-hooks/tasks.md +7 -0
- package/openspec/changes/{feat-task-metrics → archive/2026-01-22-feat-task-metrics}/proposal.md +1 -1
- package/openspec/changes/archive/2026-01-22-feat-task-metrics/tasks.md +6 -0
- package/openspec/changes/archive/2026-02-15-implement-plugin-system/design.md +45 -0
- package/openspec/changes/archive/2026-02-15-implement-plugin-system/proposal.md +13 -0
- package/openspec/changes/archive/2026-02-15-implement-plugin-system/specs/plugin-context/spec.md +17 -0
- package/openspec/changes/archive/2026-02-15-implement-plugin-system/specs/plugin-loading/spec.md +27 -0
- package/openspec/changes/archive/2026-02-15-implement-plugin-system/tasks.md +7 -0
- package/openspec/changes/feat-completion-dependencies/proposal.md +58 -0
- package/openspec/changes/feat-completion-dependencies/tasks.md +46 -0
- package/openspec/changes/feat-conditional-retries/proposal.md +18 -0
- package/openspec/changes/feat-conditional-retries/specs/task-runner/spec.md +23 -0
- package/openspec/changes/feat-conditional-retries/tasks.md +37 -0
- package/openspec/changes/feat-state-persistence/specs/task-runner/spec.md +47 -0
- package/openspec/changes/feat-task-loop/proposal.md +22 -0
- package/openspec/changes/feat-task-loop/specs/task-runner/spec.md +34 -0
- package/openspec/changes/feat-task-loop/tasks.md +8 -0
- package/openspec/specs/plugin-context/spec.md +19 -0
- package/openspec/specs/plugin-loading/spec.md +29 -0
- package/openspec/specs/release-pr/spec.md +31 -0
- package/openspec/specs/task-runner/spec.md +12 -0
- package/package.json +1 -1
- package/src/EventBus.ts +7 -8
- package/src/PluginManager.ts +41 -0
- package/src/TaskGraphValidator.ts +22 -24
- package/src/TaskResult.ts +9 -0
- package/src/TaskRunner.ts +78 -46
- package/src/TaskStateManager.ts +118 -46
- package/src/WorkflowExecutor.ts +45 -22
- package/src/contracts/Plugin.ts +32 -0
- package/src/strategies/DryRunExecutionStrategy.ts +2 -3
- package/src/utils/PriorityQueue.ts +101 -0
- package/openspec/changes/feat-task-metrics/tasks.md +0 -6
- /package/openspec/changes/{adopt-release-pr → archive/2026-01-22-adopt-release-pr}/design.md +0 -0
- /package/openspec/changes/{adopt-release-pr → archive/2026-01-22-adopt-release-pr}/proposal.md +0 -0
- /package/openspec/changes/{adopt-release-pr → archive/2026-01-22-adopt-release-pr}/specs/release-pr/spec.md +0 -0
- /package/openspec/changes/{adopt-release-pr → archive/2026-01-22-adopt-release-pr}/tasks.md +0 -0
- /package/openspec/changes/{feat-task-metrics → archive/2026-01-22-feat-task-metrics}/specs/001-generic-task-runner/spec.md +0 -0
|
@@ -57,7 +57,7 @@ jobs:
|
|
|
57
57
|
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
|
58
58
|
steps:
|
|
59
59
|
- name: Checkout repository
|
|
60
|
-
uses: actions/checkout@
|
|
60
|
+
uses: actions/checkout@v6
|
|
61
61
|
|
|
62
62
|
# Add any setup steps before running the `github/codeql-action/init` action.
|
|
63
63
|
# This includes steps like installing compilers or runtimes (`actions/setup-node`
|
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
21
21
|
target-branch: main
|
|
22
22
|
|
|
23
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@v6
|
|
24
24
|
if: ${{ steps.release.outputs.release_created }}
|
|
25
25
|
|
|
26
26
|
- name: Setup pnpm
|
|
@@ -29,7 +29,7 @@ jobs:
|
|
|
29
29
|
version: 10.28.0
|
|
30
30
|
if: ${{ steps.release.outputs.release_created }}
|
|
31
31
|
|
|
32
|
-
- uses: actions/setup-node@
|
|
32
|
+
- uses: actions/setup-node@v6
|
|
33
33
|
with:
|
|
34
34
|
node-version: "lts/*"
|
|
35
35
|
registry-url: "https://registry.npmjs.org"
|
package/.jules/nexus.md
CHANGED
|
@@ -14,3 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
**Insight:** Users' optimization efforts are blind without granular metrics. Users often don't know *which* task is slow, only that the workflow is slow.
|
|
16
16
|
**Action:** Always include telemetry requirements (like start/end times and duration) in execution engine specs to enable data-driven optimization.
|
|
17
|
+
|
|
18
|
+
## 2026-01-20 - The "All or Nothing" Retry Trap
|
|
19
|
+
|
|
20
|
+
**Insight:** Blindly retrying failing tasks is a "Product Anti-pattern". Retrying a `SyntaxError` or invalid user input 3 times (with exponential backoff!) is annoying and wasteful.
|
|
21
|
+
**Action:** We must distinguish between "Transient" (network, resource lock) and "Permanent" (logic, validation) failures. Exposing a `shouldRetry` predicate gives the user control without complicating the core runner logic.
|
|
22
|
+
|
|
23
|
+
## 2026-01-24 - The Cleanup Paradox
|
|
24
|
+
|
|
25
|
+
**Insight:** "Continue On Error" is often misused for Cleanup logic. Users mark critical tasks as "Optional" just to ensure subsequent cleanup tasks run, which incorrectly allows *other* dependents to run too. True "Teardown" requires the *dependent* to assert its resilience, not the *dependency* to declare its weakness.
|
|
26
|
+
**Action:** Invert the control. Instead of the failing task saying "I don't matter" (`continueOnError`), the cleanup task should say "I run anyway" (`runCondition: 'always'`). This preserves the criticality of the workflow while ensuring resource hygiene.
|
package/AGENTS.md
CHANGED
|
@@ -25,6 +25,9 @@ Keep this managed block so 'openspec update' can refresh the instructions.
|
|
|
25
25
|
- Its forbidden to have coverage drop below 100%, thats non negotiable.
|
|
26
26
|
- **Strict Null Safety:** Do not use `??` or optional chaining `?.` when you can guarantee existence via prior validation. Use non-null assertions `!` only when the invariant is locally provable or enforced by a validator.
|
|
27
27
|
- **Dead Code Elimination:** Avoid `v8 ignore` comments. If code is unreachable, restructure the logic to prove it is unreachable to the compiler, or remove the branch if the invariant is guaranteed.
|
|
28
|
+
- **Signal Combination:** Prefer `AbortSignal.any()` over manual event listeners when combining multiple `AbortSignal`s to simplify logic and avoid memory leaks.
|
|
29
|
+
- **Map Lookups:** Avoid double lookups in Maps (e.g., `has()` followed by `get()`). Check the result of `get()` against `undefined` to perform the check in a single operation.
|
|
30
|
+
- **String Replacement:** Always favor `String.prototype.replaceAll` over `String.prototype.replace` with global regex for clarity.
|
|
28
31
|
|
|
29
32
|
## Operational Protocols
|
|
30
33
|
|
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,52 @@
|
|
|
18
18
|
* refactor: Refactor TaskRunner to reduce cognitive complexity (#89) ([95c67d9](https://github.com/thalesraymond/task-runner/commit/95c67d9)), closes [#89](https://github.com/thalesraymond/task-runner/issues/89)
|
|
19
19
|
* Refactor TaskGraphValidator to address SonarCloud issues (#88) ([77c1538](https://github.com/thalesraymond/task-runner/commit/77c1538)), closes [#88](https://github.com/thalesraymond/task-runner/issues/88)
|
|
20
20
|
|
|
21
|
+
## [4.2.0](https://github.com/thalesraymond/task-runner/compare/task-runner-v4.1.0...task-runner-v4.2.0) (2026-02-15)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* 🎸 mvp for plugin system ([7d85610](https://github.com/thalesraymond/task-runner/commit/7d856103651416826bdf6b440d9aa613ab2ac997))
|
|
27
|
+
* add middleware support proposal ([#123](https://github.com/thalesraymond/task-runner/issues/123)) ([e93c2f1](https://github.com/thalesraymond/task-runner/commit/e93c2f1bd34764dbb084ff9645836ec20fdef026))
|
|
28
|
+
* **spec:** add task loop proposal ([#157](https://github.com/thalesraymond/task-runner/issues/157)) ([a89a846](https://github.com/thalesraymond/task-runner/commit/a89a8462cd7ff2a54625805e30ee0c14eae95fa2))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* 🛰️ Sonar Specialist: Fix issues in `src/TaskRunner.ts` ([#128](https://github.com/thalesraymond/task-runner/issues/128)) ([fd87799](https://github.com/thalesraymond/task-runner/commit/fd877993497539728b6c7ba55d1a34ea7e1d7737))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Performance Improvements
|
|
37
|
+
|
|
38
|
+
* ⚡ Optimize Mermaid graph generation performance ([#155](https://github.com/thalesraymond/task-runner/issues/155)) ([18d3e93](https://github.com/thalesraymond/task-runner/commit/18d3e934631907a2c41ceb2c60942d3ec50b9dc5))
|
|
39
|
+
* ⚡ Optimize WorkflowExecutor loop performance ([#153](https://github.com/thalesraymond/task-runner/issues/153)) ([c0457f0](https://github.com/thalesraymond/task-runner/commit/c0457f00f9a1315f7b23829fec08d3bceba37a14))
|
|
40
|
+
* optimize cascadeFailure to O(N) using index pointer ([#135](https://github.com/thalesraymond/task-runner/issues/135)) ([1ecd7b8](https://github.com/thalesraymond/task-runner/commit/1ecd7b8fe1c72ebc7f97aaaa6bc9aeacdb830ae2))
|
|
41
|
+
* optimize EventBus scheduling with queueMicrotask ([#154](https://github.com/thalesraymond/task-runner/issues/154)) ([4d74788](https://github.com/thalesraymond/task-runner/commit/4d74788aa689da0f296986dc15fe8a4fd080bbc7))
|
|
42
|
+
* optimize Mermaid graph generation by removing redundant ID loop ([#158](https://github.com/thalesraymond/task-runner/issues/158)) ([940bdc5](https://github.com/thalesraymond/task-runner/commit/940bdc5c377a0b54567f73e968202f8c7e5c5020))
|
|
43
|
+
* optimize mermaid graph generation deduplication ([#150](https://github.com/thalesraymond/task-runner/issues/150)) ([ff5db6d](https://github.com/thalesraymond/task-runner/commit/ff5db6d7a8ac22c414f260d04e13e06ec894b30c))
|
|
44
|
+
* optimize TaskStateManager initialization to avoid double map lookups ([#132](https://github.com/thalesraymond/task-runner/issues/132)) ([02c516c](https://github.com/thalesraymond/task-runner/commit/02c516cc030b27b4c3bb143107e25c91503b0dd8))
|
|
45
|
+
* remove redundant processLoop call in WorkflowExecutor ([#151](https://github.com/thalesraymond/task-runner/issues/151)) ([8286223](https://github.com/thalesraymond/task-runner/commit/8286223c6e28f5a60414a554b877792f73e1b147))
|
|
46
|
+
* **validator:** optimize graph validation (3x speedup) ([#127](https://github.com/thalesraymond/task-runner/issues/127)) ([66f97e7](https://github.com/thalesraymond/task-runner/commit/66f97e7bc3999d38b78640e29cd47b086532a97a))
|
|
47
|
+
|
|
48
|
+
## [4.1.0](https://github.com/thalesraymond/task-runner/compare/task-runner-v4.0.4...task-runner-v4.1.0) (2026-01-24)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
* 🎸 Add task name to sucess message on dry run ([5b9fcd0](https://github.com/thalesraymond/task-runner/commit/5b9fcd0ddd61172687e464cf6a3b5fb65df20cdf))
|
|
54
|
+
* 🎸 metrics per task ([#103](https://github.com/thalesraymond/task-runner/issues/103)) ([c824c56](https://github.com/thalesraymond/task-runner/commit/c824c56dce6d958de8946e1fb9af598bd7e10e5e))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* 🐛 getMermaidGraph ID collision for similar task names ([#100](https://github.com/thalesraymond/task-runner/issues/100)) ([0d3af0d](https://github.com/thalesraymond/task-runner/commit/0d3af0d1663346d31c4d05bfd0eb498456221b2f))
|
|
60
|
+
* 🛰️ Sonar Specialist: Refactor signal combination in TaskRunner ([#107](https://github.com/thalesraymond/task-runner/issues/107)) ([9c383cc](https://github.com/thalesraymond/task-runner/commit/9c383cc7a6657133136945cec01ccc50d30f752d))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Performance Improvements
|
|
64
|
+
|
|
65
|
+
* optimize Mermaid graph ID generation ([#112](https://github.com/thalesraymond/task-runner/issues/112)) ([59e78b1](https://github.com/thalesraymond/task-runner/commit/59e78b1b975e89120d27d827127fbd813a399e36))
|
|
66
|
+
|
|
21
67
|
## [4.0.4](https://github.com/thalesraymond/task-runner/compare/task-runner-v4.0.3...task-runner-v4.0.4) (2026-01-22)
|
|
22
68
|
|
|
23
69
|
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement by contacting the project maintainers.
|
|
63
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
64
|
+
|
|
65
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
66
|
+
reporter of any incident.
|
|
67
|
+
|
|
68
|
+
## Enforcement Guidelines
|
|
69
|
+
|
|
70
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
71
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
72
|
+
|
|
73
|
+
### 1. Correction
|
|
74
|
+
|
|
75
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
76
|
+
unprofessional or unwelcome in the community.
|
|
77
|
+
|
|
78
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
79
|
+
clarity around the nature of the violation and an explanation of why the
|
|
80
|
+
behavior was inappropriate. A public apology may be requested.
|
|
81
|
+
|
|
82
|
+
### 2. Warning
|
|
83
|
+
|
|
84
|
+
**Community Impact**: A violation through a single incident or series of
|
|
85
|
+
actions.
|
|
86
|
+
|
|
87
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
88
|
+
interaction with the people involved, including unsolicited interaction with
|
|
89
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
90
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
91
|
+
like social media. Violating these terms may lead to a temporary or
|
|
92
|
+
permanent ban.
|
|
93
|
+
|
|
94
|
+
### 3. Temporary Ban
|
|
95
|
+
|
|
96
|
+
**Community Impact**: A serious violation of community standards, including
|
|
97
|
+
sustained inappropriate behavior.
|
|
98
|
+
|
|
99
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
100
|
+
communication with the community for a specified period of time. No public or
|
|
101
|
+
private interaction with the people involved, including unsolicited interaction
|
|
102
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
103
|
+
Violating these terms may lead to a permanent ban.
|
|
104
|
+
|
|
105
|
+
### 4. Permanent Ban
|
|
106
|
+
|
|
107
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
108
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
109
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
110
|
+
|
|
111
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
112
|
+
the community.
|
|
113
|
+
|
|
114
|
+
## Attribution
|
|
115
|
+
|
|
116
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
117
|
+
version 2.1, available at
|
|
118
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
119
|
+
|
|
120
|
+
Community Impact Guidelines were inspired by
|
|
121
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
122
|
+
|
|
123
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
124
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
|
125
|
+
at [https://www.contributor-covenant.org/translations][translations].
|
|
126
|
+
|
|
127
|
+
[homepage]: https://www.contributor-covenant.org
|
|
128
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
129
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
130
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
131
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Contributing to task-runner
|
|
2
|
+
|
|
3
|
+
First off, thanks for taking the time to contribute!
|
|
4
|
+
|
|
5
|
+
The following is a set of guidelines for contributing to `@calmo/task-runner`. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
|
6
|
+
|
|
7
|
+
## Code of Conduct
|
|
8
|
+
|
|
9
|
+
This project and everyone participating in it is governed by the [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
1. **Fork the repository** on GitHub.
|
|
14
|
+
2. **Clone your fork** locally.
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/your-username/task-runner.git
|
|
17
|
+
cd task-runner
|
|
18
|
+
```
|
|
19
|
+
3. **Install dependencies** using `pnpm`.
|
|
20
|
+
```bash
|
|
21
|
+
pnpm install
|
|
22
|
+
```
|
|
23
|
+
*Note: This project uses `pnpm` for package management. Please do not use `npm` or `yarn`.*
|
|
24
|
+
|
|
25
|
+
## Development Workflow
|
|
26
|
+
|
|
27
|
+
1. **Create a branch** for your feature or fix.
|
|
28
|
+
```bash
|
|
29
|
+
git checkout -b feature/my-new-feature
|
|
30
|
+
```
|
|
31
|
+
2. **Make your changes**.
|
|
32
|
+
3. **Run checks** locally to ensure your changes are valid.
|
|
33
|
+
|
|
34
|
+
### Scripts & Commands
|
|
35
|
+
|
|
36
|
+
The project uses several `pnpm` scripts to maintain code quality:
|
|
37
|
+
|
|
38
|
+
* **Build**: Compile the project.
|
|
39
|
+
```bash
|
|
40
|
+
pnpm build
|
|
41
|
+
```
|
|
42
|
+
* **Test**: Run tests with coverage.
|
|
43
|
+
```bash
|
|
44
|
+
pnpm test
|
|
45
|
+
```
|
|
46
|
+
**Important**: We enforce **100% code coverage**. If your changes lower the coverage, the CI will fail.
|
|
47
|
+
* **Lint**: Check for linting errors.
|
|
48
|
+
```bash
|
|
49
|
+
pnpm lint
|
|
50
|
+
```
|
|
51
|
+
* **Format**: Format the code using Prettier.
|
|
52
|
+
```bash
|
|
53
|
+
pnpm format
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Coding Standards
|
|
57
|
+
|
|
58
|
+
Please strictly adhere to the following rules:
|
|
59
|
+
|
|
60
|
+
* **No `any`**: The use of `any` type is strictly forbidden. Use `unknown` or proper types.
|
|
61
|
+
* **Strict Null Safety**: Do not use `??` or optional chaining `?.` when you can guarantee existence via prior validation. Use non-null assertions `!` only when the invariant is locally provable or enforced by a validator.
|
|
62
|
+
* **Dead Code Elimination**: Avoid `v8 ignore` comments. Logic should be structured to prove unreachability.
|
|
63
|
+
* **Atomic Commits**: For complex features, commit after completing distinct tasks. Ensure `pnpm build`, `pnpm lint`, and `pnpm test` pass before each commit.
|
|
64
|
+
|
|
65
|
+
For more detailed agent-specific instructions (which are also good for humans), refer to `AGENTS.md`.
|
|
66
|
+
|
|
67
|
+
## Commit Messages
|
|
68
|
+
|
|
69
|
+
We follow the **Conventional Commits** specification.
|
|
70
|
+
|
|
71
|
+
You can use the built-in helper to format your commit messages:
|
|
72
|
+
```bash
|
|
73
|
+
pnpm commit
|
|
74
|
+
```
|
|
75
|
+
Or format them manually:
|
|
76
|
+
* `feat(scope): add new feature`
|
|
77
|
+
* `fix(scope): fix bug`
|
|
78
|
+
* `docs: update documentation`
|
|
79
|
+
* `test: add tests`
|
|
80
|
+
* `refactor: refactor code`
|
|
81
|
+
|
|
82
|
+
## Submitting a Pull Request
|
|
83
|
+
|
|
84
|
+
1. Push your changes to your fork.
|
|
85
|
+
2. Open a Pull Request against the `main` branch.
|
|
86
|
+
3. Ensure the PR description clearly describes the problem and solution.
|
|
87
|
+
4. Make sure all CI checks pass.
|
|
88
|
+
|
|
89
|
+
Thank you for your contributions!
|
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ Try the [Showcase App](https://task-runner-mu.vercel.app/) to see the runner in
|
|
|
21
21
|
- **Event System**: Subscribe to lifecycle events for logging or monitoring.
|
|
22
22
|
- **Runtime Validation**: Automatically detects circular dependencies and missing dependencies.
|
|
23
23
|
- **Conditional Execution**: Skip tasks dynamically based on context state.
|
|
24
|
+
- **Plugin System**: Extend functionality with custom logic and event listeners.
|
|
24
25
|
|
|
25
26
|
## Usage Example
|
|
26
27
|
|
|
@@ -139,6 +140,39 @@ console.log(graph);
|
|
|
139
140
|
// Output: graph TD; A-->B; ...
|
|
140
141
|
```
|
|
141
142
|
|
|
143
|
+
## Plugin System
|
|
144
|
+
|
|
145
|
+
You can extend the `TaskRunner` with plugins to inject custom logic or listen to events without modifying the core.
|
|
146
|
+
|
|
147
|
+
### Creating a Plugin
|
|
148
|
+
|
|
149
|
+
A plugin is an object with a `name`, `version`, and an `install` method.
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { Plugin, PluginContext } from "@calmo/task-runner";
|
|
153
|
+
|
|
154
|
+
const MyLoggerPlugin: Plugin<MyContext> = {
|
|
155
|
+
name: "my-logger-plugin",
|
|
156
|
+
version: "1.0.0",
|
|
157
|
+
install: (context: PluginContext<MyContext>) => {
|
|
158
|
+
context.events.on("taskStart", ({ step }) => {
|
|
159
|
+
console.log(`[Plugin] Starting task: ${step.name}`);
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Using a Plugin
|
|
166
|
+
|
|
167
|
+
Register the plugin using the `use()` method on the `TaskRunner` instance.
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
const runner = new TaskRunner(context);
|
|
171
|
+
runner.use(MyLoggerPlugin);
|
|
172
|
+
|
|
173
|
+
await runner.execute(steps);
|
|
174
|
+
```
|
|
175
|
+
|
|
142
176
|
## Skip Propagation
|
|
143
177
|
|
|
144
178
|
If a task fails or is skipped, the `TaskRunner` automatically marks all subsequent tasks that depend on it as `skipped`. This ensures that your pipeline doesn't attempt to run steps with missing prerequisites.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# General Code Style Principles
|
|
2
|
+
|
|
3
|
+
This document outlines general coding principles that apply across all languages and frameworks used in this project.
|
|
4
|
+
|
|
5
|
+
## Readability
|
|
6
|
+
- Code should be easy to read and understand by humans.
|
|
7
|
+
- Avoid overly clever or obscure constructs.
|
|
8
|
+
|
|
9
|
+
## Consistency
|
|
10
|
+
- Follow existing patterns in the codebase.
|
|
11
|
+
- Maintain consistent formatting, naming, and structure.
|
|
12
|
+
|
|
13
|
+
## Simplicity
|
|
14
|
+
- Prefer simple solutions over complex ones.
|
|
15
|
+
- Break down complex problems into smaller, manageable parts.
|
|
16
|
+
|
|
17
|
+
## Maintainability
|
|
18
|
+
- Write code that is easy to modify and extend.
|
|
19
|
+
- Minimize dependencies and coupling.
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
- Document *why* something is done, not just *what*.
|
|
23
|
+
- Keep documentation up-to-date with code changes.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Google JavaScript Style Guide Summary
|
|
2
|
+
|
|
3
|
+
This document summarizes key rules and best practices from the Google JavaScript Style Guide.
|
|
4
|
+
|
|
5
|
+
## 1. Source File Basics
|
|
6
|
+
- **File Naming:** All lowercase, with underscores (`_`) or dashes (`-`). Extension must be `.js`.
|
|
7
|
+
- **File Encoding:** UTF-8.
|
|
8
|
+
- **Whitespace:** Use only ASCII horizontal spaces (0x20). Tabs are forbidden for indentation.
|
|
9
|
+
|
|
10
|
+
## 2. Source File Structure
|
|
11
|
+
- New files should be ES modules (`import`/`export`).
|
|
12
|
+
- **Exports:** Use named exports (`export {MyClass};`). **Do not use default exports.**
|
|
13
|
+
- **Imports:** Do not use line-wrapped imports. The `.js` extension in import paths is mandatory.
|
|
14
|
+
|
|
15
|
+
## 3. Formatting
|
|
16
|
+
- **Braces:** Required for all control structures (`if`, `for`, `while`, etc.), even single-line blocks. Use K&R style ("Egyptian brackets").
|
|
17
|
+
- **Indentation:** +2 spaces for each new block.
|
|
18
|
+
- **Semicolons:** Every statement must be terminated with a semicolon.
|
|
19
|
+
- **Column Limit:** 80 characters.
|
|
20
|
+
- **Line-wrapping:** Indent continuation lines at least +4 spaces.
|
|
21
|
+
- **Whitespace:** Use single blank lines between methods. No trailing whitespace.
|
|
22
|
+
|
|
23
|
+
## 4. Language Features
|
|
24
|
+
- **Variable Declarations:** Use `const` by default, `let` if reassignment is needed. **`var` is forbidden.**
|
|
25
|
+
- **Array Literals:** Use trailing commas. Do not use the `Array` constructor.
|
|
26
|
+
- **Object Literals:** Use trailing commas and shorthand properties. Do not use the `Object` constructor.
|
|
27
|
+
- **Classes:** Do not use JavaScript getter/setter properties (`get name()`). Provide ordinary methods instead.
|
|
28
|
+
- **Functions:** Prefer arrow functions for nested functions to preserve `this` context.
|
|
29
|
+
- **String Literals:** Use single quotes (`'`). Use template literals (`` ` ``) for multi-line strings or complex interpolation.
|
|
30
|
+
- **Control Structures:** Prefer `for-of` loops. `for-in` loops should only be used on dict-style objects.
|
|
31
|
+
- **`this`:** Only use `this` in class constructors, methods, or in arrow functions defined within them.
|
|
32
|
+
- **Equality Checks:** Always use identity operators (`===` / `!==`).
|
|
33
|
+
|
|
34
|
+
## 5. Disallowed Features
|
|
35
|
+
- `with` keyword.
|
|
36
|
+
- `eval()` or `Function(...string)`.
|
|
37
|
+
- Automatic Semicolon Insertion.
|
|
38
|
+
- Modifying builtin objects (`Array.prototype.foo = ...`).
|
|
39
|
+
|
|
40
|
+
## 6. Naming
|
|
41
|
+
- **Classes:** `UpperCamelCase`.
|
|
42
|
+
- **Methods & Functions:** `lowerCamelCase`.
|
|
43
|
+
- **Constants:** `CONSTANT_CASE` (all uppercase with underscores).
|
|
44
|
+
- **Non-constant Fields & Variables:** `lowerCamelCase`.
|
|
45
|
+
|
|
46
|
+
## 7. JSDoc
|
|
47
|
+
- JSDoc is used on all classes, fields, and methods.
|
|
48
|
+
- Use `@param`, `@return`, `@override`, `@deprecated`.
|
|
49
|
+
- Type annotations are enclosed in braces (e.g., `/** @param {string} userName */`).
|
|
50
|
+
|
|
51
|
+
*Source: [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)*
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Google TypeScript Style Guide Summary
|
|
2
|
+
|
|
3
|
+
This document summarizes key rules and best practices from the Google TypeScript Style Guide, which is enforced by the `gts` tool.
|
|
4
|
+
|
|
5
|
+
## 1. Language Features
|
|
6
|
+
- **Variable Declarations:** Always use `const` or `let`. **`var` is forbidden.** Use `const` by default.
|
|
7
|
+
- **Modules:** Use ES6 modules (`import`/`export`). **Do not use `namespace`.**
|
|
8
|
+
- **Exports:** Use named exports (`export {MyClass};`). **Do not use default exports.**
|
|
9
|
+
- **Classes:**
|
|
10
|
+
- **Do not use `#private` fields.** Use TypeScript's `private` visibility modifier.
|
|
11
|
+
- Mark properties never reassigned outside the constructor with `readonly`.
|
|
12
|
+
- **Never use the `public` modifier** (it's the default). Restrict visibility with `private` or `protected` where possible.
|
|
13
|
+
- **Functions:** Prefer function declarations for named functions. Use arrow functions for anonymous functions/callbacks.
|
|
14
|
+
- **String Literals:** Use single quotes (`'`). Use template literals (`` ` ``) for interpolation and multi-line strings.
|
|
15
|
+
- **Equality Checks:** Always use triple equals (`===`) and not equals (`!==`).
|
|
16
|
+
- **Type Assertions:** **Avoid type assertions (`x as SomeType`) and non-nullability assertions (`y!`)**. If you must use them, provide a clear justification.
|
|
17
|
+
|
|
18
|
+
## 2. Disallowed Features
|
|
19
|
+
- **`any` Type:** **Avoid `any`**. Prefer `unknown` or a more specific type.
|
|
20
|
+
- **Wrapper Objects:** Do not instantiate `String`, `Boolean`, or `Number` wrapper classes.
|
|
21
|
+
- **Automatic Semicolon Insertion (ASI):** Do not rely on it. **Explicitly end all statements with a semicolon.**
|
|
22
|
+
- **`const enum`:** Do not use `const enum`. Use plain `enum` instead.
|
|
23
|
+
- **`eval()` and `Function(...string)`:** Forbidden.
|
|
24
|
+
|
|
25
|
+
## 3. Naming
|
|
26
|
+
- **`UpperCamelCase`:** For classes, interfaces, types, enums, and decorators.
|
|
27
|
+
- **`lowerCamelCase`:** For variables, parameters, functions, methods, and properties.
|
|
28
|
+
- **`CONSTANT_CASE`:** For global constant values, including enum values.
|
|
29
|
+
- **`_` Prefix/Suffix:** **Do not use `_` as a prefix or suffix** for identifiers, including for private properties.
|
|
30
|
+
|
|
31
|
+
## 4. Type System
|
|
32
|
+
- **Type Inference:** Rely on type inference for simple, obvious types. Be explicit for complex types.
|
|
33
|
+
- **`undefined` and `null`:** Both are supported. Be consistent within your project.
|
|
34
|
+
- **Optional vs. `|undefined`:** Prefer optional parameters and fields (`?`) over adding `|undefined` to the type.
|
|
35
|
+
- **`Array<T>` Type:** Use `T[]` for simple types. Use `Array<T>` for more complex union types (e.g., `Array<string | number>`).
|
|
36
|
+
- **`{}` Type:** **Do not use `{}`**. Prefer `unknown`, `Record<string, unknown>`, or `object`.
|
|
37
|
+
|
|
38
|
+
## 5. Comments and Documentation
|
|
39
|
+
- **JSDoc:** Use `/** JSDoc */` for documentation, `//` for implementation comments.
|
|
40
|
+
- **Redundancy:** **Do not declare types in `@param` or `@return` blocks** (e.g., `/** @param {string} user */`). This is redundant in TypeScript.
|
|
41
|
+
- **Add Information:** Comments must add information, not just restate the code.
|
|
42
|
+
|
|
43
|
+
*Source: [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html)*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Product Guidelines
|
|
2
|
+
|
|
3
|
+
## Documentation Style
|
|
4
|
+
- Tone: Professional, technical, and friendly.
|
|
5
|
+
- Style: Clear, concise, and focused on accuracy, while remaining approachable with instructional examples.
|
|
6
|
+
- Examples: Focused, bite-sized code snippets illustrating specific features for quick comprehension.
|
|
7
|
+
|
|
8
|
+
## Brand Messaging & Visual Identity
|
|
9
|
+
- Core Value: Stability and Reliability.
|
|
10
|
+
- Focus: Emphasize robust testing, production-readiness, and the "engine-like" nature of the orchestrator.
|
|
11
|
+
|
|
12
|
+
## Quality Standards
|
|
13
|
+
- Clarity over brevity in technical explanations.
|
|
14
|
+
- Prioritize accuracy and reliability in all user-facing communications.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Initial Concept
|
|
2
|
+
A lightweight, type-safe, and domain-agnostic task orchestration engine. It resolves a Directed Acyclic Graph (DAG) of steps, executes independent tasks in parallel, and manages a shared context across the pipeline.
|
|
3
|
+
|
|
4
|
+
## Target Users
|
|
5
|
+
- Developers building complex CI/CD pipelines.
|
|
6
|
+
- Engineers creating automated data processing workflows.
|
|
7
|
+
|
|
8
|
+
## Goals
|
|
9
|
+
- Provide a simple and intuitive API for defining and running task graphs.
|
|
10
|
+
|
|
11
|
+
## Key Features
|
|
12
|
+
- Enhanced observability and logging for complex task graphs.
|
|
13
|
+
- Support for persistent state to allow resuming long-running workflows.
|
|
14
|
+
|
|
15
|
+
## Complexity & Architecture
|
|
16
|
+
- Provide a hybrid approach with optional plugins for advanced features like persistence.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"last_successful_step": "2.5_workflow"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Technology Stack
|
|
2
|
+
|
|
3
|
+
## Core
|
|
4
|
+
- **Programming Language:** TypeScript
|
|
5
|
+
- **Runtime:** Node.js
|
|
6
|
+
|
|
7
|
+
## Development Tools
|
|
8
|
+
- **Package Manager:** pnpm
|
|
9
|
+
- **Build Tool:** tsc (TypeScript Compiler)
|
|
10
|
+
|
|
11
|
+
## Quality Assurance
|
|
12
|
+
- **Test Framework:** Vitest
|
|
13
|
+
- **Code Coverage:** @vitest/coverage-v8
|
|
14
|
+
- **Linting:** ESLint (typescript-eslint)
|
|
15
|
+
- **Formatting:** Prettier
|
|
16
|
+
|
|
17
|
+
## Infrastructure & Release
|
|
18
|
+
- **Release Management:** release-please
|
|
19
|
+
- **Static Analysis:** SonarCloud
|