You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,107 +13,7 @@ PipeForge is a lightweight, composable pipeline framework for .NET. It makes ste
13
13
14
14
PipeForge is available on [NuGet.org](https://www.nuget.org/packages/PipeForge/) and can be installed using a NuGet package manager or the .NET CLI.
15
15
16
-
## Usage
17
-
18
-
Pipelines are designed to operate on specific class, referred to as the **context**. Multiple pipeline steps are created in code to operate on that context. Steps are annotated with an attribute indicating the order in which they should be executed. Finally, the pipeline runner is given an instance of the context to run against.
19
-
20
-
The following example uses dependency injection, and is the recommended approach to using PipeForge. For more advanced scenarios, see the full [documentation](https://scottoffen.github.io/pipeforge).
21
-
22
-
> [!NOTE]
23
-
> I'm suffixing my context class with the word `Context`, and my steps with the word `Step` for demonstration purposes only.
24
-
25
-
### Create Your Context
26
-
27
-
```csharp
28
-
publicclassSampleContext
29
-
{
30
-
privatereadonlyList<string> _steps=new();
31
-
32
-
publicvoidAddStep(stringstepName)
33
-
{
34
-
if (string.IsNullOrWhiteSpace(stepName))
35
-
{
36
-
thrownewArgumentException("Step name cannot be null or whitespace.", nameof(stepName));
The extension method will discover and register all steps for the given `T` context, as well as register an instance of `IPipelineRunner<T>` that can be injected into services.
88
-
89
-
```csharp
90
-
services.AddPipelineFor<SampleContext>();
91
-
```
92
-
93
-
### Execute Pipeline
94
-
95
-
Get an instance of `IPipelineRunnere<SampleContext>` from your dependency injection container.
- Check out the project documentation https://scottoffen.github.io/pipeforge.
119
19
@@ -123,6 +23,21 @@ public class SampleService
123
23
124
24
-**Issues created to ask "how to" questions will be closed.**
125
25
26
+
## Use Cases
27
+
28
+
While PipeForge is fundamentally a pipeline framework, it can also serve as the foundation for higher-level workflows. These workflows are built by composing individual pipeline steps that handle branching, retries, fallbacks, and decision logic - making it ideal for orchestrating complex processes like AI chains, data enrichment, or multi-stage validation.
29
+
30
+
|||
31
+
|-|-|
32
+
| Game Loop and Simulation Ticks | Model turn-based or tick-based game logic using structured steps for input handling, state updates, AI, and rule enforcement. Ideal for simulations, server-side logic, or deterministic turn resolution. |
33
+
| Middleware-Style Request Processing | Build lightweight, modular request pipelines similar to ASP.NET middleware, without requiring a full web host. |
34
+
| DevOps and Automation Pipelines | Express deployment checks, file transforms, and system hooks as repeatable, testable steps. |
35
+
| Security and Auditing Pipelines | Enforce policies, redact sensitive data, and log events in a structured, traceable flow. |
36
+
| ETL and Data Processing Pipelines | Break down validation, transformation, and persistence into clean, maintainable processing steps. |
37
+
| LLM and AI Workflows | Orchestrate prompt generation, model calls, fallback handling, and response parsing using composable pipelines. |
38
+
| Business Logic and Domain Orchestration | Replace brittle `if` chains and nested logic with clearly structured rule execution and orchestration flows. |
39
+
40
+
126
41
## Contributing
127
42
128
43
We welcome contributions from the community! In order to ensure the best experience for everyone, before creating an issue or submitting a pull request, please see the [contributing guidelines](CONTRIBUTING.md) and the [code of conduct](CODE_OF_CONDUCT.md). Failure to adhere to these guidelines can result in significant delays in getting your contributions included in the project.
PipeForge provides built-in support for inspecting pipeline structure and behavior at runtime. This is especially useful for observability, testing, documentation, and UI tooling.
7
7
8
-
The `Describe()` method on `IPipelineRunner<T>` is used to inspect and document the pipeline configuration at runtime. It returns a JSON string describing each registered pipeline step.
8
+
## Describe()
9
9
10
-
This method is useful for diagnostics, tooling, and dynamically displaying pipeline behavior in user interfaces or logs - but only if you've taken the time to add the necessary metadata to your step classes.
10
+
The `Describe()`method on `IPipelineRunner<T>` outputs a JSON array representing each registered step. It includes key metadata such as name, order, and short-circuit configuration.
11
11
12
-
## Output Format
12
+
:::warning[Side Effects]
13
13
14
-
The JSON output contains an array of objects, each representing a pipeline step with the following fields:
14
+
This method **instantiates all steps**, triggering constructor injection and service resolution. Use it only when such side effects are acceptable.
15
15
16
-
*`Order`: The zero-based order in which the step appears in the pipeline
17
-
*`Name`: The value of the step's `Name` property
18
-
*`Description`: The step's `Description`, if defined
19
-
*`MayShortCircuit`: A boolean indicating whether the step might short-circuit execution
20
-
*`ShortCircuitCondition`: The value of the step's `ShortCircuitCondition`, if any
|`Order`| Step's position in the execution sequence |
23
+
|`Name`| Value of the step’s `Name` property |
24
+
|`Description`| Value of the step’s `Description`, if provided |
25
+
|`MayShortCircuit`| Indicates if the step may halt pipeline execution |
26
+
|`ShortCircuitCondition`| Explanation of the short-circuit trigger, if applicable |
27
+
28
+
### Example Output
23
29
24
30
```json
25
31
[
@@ -40,26 +46,59 @@ Example output:
40
46
]
41
47
```
42
48
43
-
:::warning Warning
44
-
45
-
The `Order` value in the JSON output represents the execution order of the steps. This value is assigned based on the order in which the steps will be executed, and it may differ from the `Order` specified in each step's `PipelineStep` attribute.
49
+
:::info[A Note About Order]
46
50
47
-
For example, if you have only two steps with `PipelineStep(Order = 3)` and `PipelineStep(Order = 4)`, the JSON output will show `Order` values of `0` and `1`, respectively - reflecting their relative execution sequence, not their original attribute values.
51
+
The `Order` shown in the output reflects the **actual runtime execution sequence**, not the numeric value assigned via the `[PipelineStep]` attribute. For example, two steps with attributes `Order = 3` and `Order = 4` will appear in the output as `Order = 0` and `Order = 1` if they are the only steps registered.
48
52
49
53
:::
50
54
51
-
##Instantiation Behavior
55
+
### Use Cases
52
56
53
-
Calling `Describe()`**will instantiate all steps** in the pipeline by accessing their `Lazy<T>` wrappers. This may result in constructor injection or other side effects associated with instantiating the step class. Use this method only when you are prepared for that overhead.
57
+
* Logging pipeline structure for observability
58
+
* Generating runtime or admin UI documentation
59
+
* Verifying step order and metadata in unit tests
54
60
55
-
## Use Cases
61
+
If you need to inspect step configuration without triggering instantiation, consider capturing step metadata during registration or design time.
56
62
57
-
* Logging pipeline structure for observability
58
-
* Generating runtime documentation or UI
59
-
* Verifying step order and metadata during tests or builds
63
+
## DescribeSchema()
64
+
65
+
The `DescribeSchema()` method returns a [JSON Schema v7](https://json-schema.org/specification.html) document that describes the metadata shape of a pipeline step. This is ideal for tools that visualize or validate pipeline structures.
66
+
67
+
### When to Use
60
68
61
-
If you need to inspect step configuration without triggering instantiation, consider maintaining parallel metadata or restricting usage of `Describe()` to controlled environments.
69
+
* Exposing step definitions through APIs or dashboards
70
+
* Powering UI editors or metadata-driven configuration
* You can use this mechanism to generate timing metrics, debug issues, or visualize step execution.
44
44
* Diagnostic events are low-overhead and safe to leave enabled in production.
45
45
* Combine this with the `Describe()` method for a full picture of pipeline structure and execution behavior.
46
-
47
-
## Conclusion
48
-
49
-
PipeForge diagnostics give you deep visibility into pipeline execution with minimal effort. Whether you're debugging a failing step or building runtime instrumentation, the diagnostics hooks are ready to help.
Copy file name to clipboardExpand all lines: docs/docs/index.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
-
sidebar_position: 1
2
+
sidebar_position: 0
3
3
title: Getting Started
4
4
---
5
5
6
6
# Welcome to PipeForge
7
7
8
-
PipeForge is a lightweight, composable, lazy-instantiation pipeline framework for .NET. It simplifies step-based processing while remaining discoverable and testable. Inspired by middleware pipelines and modern dependency injection patterns, PipeForge gives you structured control over sequential logic flows - without the ceremony.
8
+
PipeForge is a lightweight, composablepipeline framework for .NET that makes step-based workflows easy to build, test, and maintain. With lazy instantiation and modern dependency injection, it gives you structured control over execution flow - without the heavy scaffolding of base classes, rigid lifecycles, or tightly coupled framework logic. Inspired by the simplicity of middleware pipelines, PipeForge favors clear, minimal structure over hidden complexity.
9
9
10
-
Pipelines operate on a specific class known as the **context**. Each pipeline step is a discrete unit of work, written in code and annotated with metadata indicating its order and (optional) filter. These steps are lazily instantiated and executed in sequence by the pipeline runner.
10
+
Each pipeline operates on a specific class called the **context**, which flows through each step in sequence. Steps are discrete units of work, written as regular code and annotated with metadata to define their order and optional filters. They’re lazily instantiated - only created when needed - and executed by the pipeline runner.
11
11
12
-
At any point, the pipeline can **short-circuit**, halting execution - and preventing the instantiation of any remaining steps.
12
+
At any point, a step can **short-circuit** the pipeline, halting further execution and preventing the instantiation of remaining steps.
13
13
14
14
## Sample Context
15
15
@@ -18,7 +18,7 @@ For the purposes of this documentation, the following sample context will be use
18
18
```csharp title="SampleContext.cs"
19
19
publicclassSampleContext
20
20
{
21
-
privatereadonlyList<string> _steps=new();
21
+
publicreadonlyList<string> Steps=new();
22
22
23
23
publicvoidAddStep(stringstepName)
24
24
{
@@ -27,22 +27,22 @@ public class SampleContext
27
27
thrownewArgumentException("Step name cannot be null or whitespace.", nameof(stepName));
28
28
}
29
29
30
-
_steps.Add(stepName);
30
+
Steps.Add(stepName);
31
31
}
32
32
33
-
publicintStepCount=>_steps.Count;
33
+
publicintStepCount=>Steps.Count;
34
34
35
35
publicoverridestringToString()
36
36
{
37
-
returnstring.Join(",", _steps);
37
+
returnstring.Join(",", Steps);
38
38
}
39
39
}
40
40
```
41
41
42
42
This context allows us to:
43
43
- Track pipeline progress via `AddStep()`
44
+
- Evaluate the order and number of step executions
44
45
- Print step execution history using `ToString()`
45
-
- Assert how many steps ran using `StepCount`
46
46
- Simulate errors by passing null or empty step names
0 commit comments