https://github.com/perry-mitchell/fruition
Track execution paths and outcomes to form an explanation for understanding what happened
https://github.com/perry-mitchell/fruition
Last synced: 13 days ago
JSON representation
Track execution paths and outcomes to form an explanation for understanding what happened
- Host: GitHub
- URL: https://github.com/perry-mitchell/fruition
- Owner: perry-mitchell
- License: mit
- Created: 2023-06-09T08:00:01.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-02T06:05:29.000Z (over 2 years ago)
- Last Synced: 2025-11-13T00:03:46.946Z (8 months ago)
- Language: TypeScript
- Size: 270 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Fruition
> Track execution paths and outcomes to form an explanation for understanding what happened
## About
Fruition is a simple harness to record steps of execution by making "notes" (Nodes), which some of these being able to mark _branching_ or _measurements_. It outputs a handy string description so application flow debugging can be improved.
NodeJS v16 and up is supported. Types are provided.
## Usage
To get started, import the `Fruition` class:
```typescript
import { Fruition } from "fruition";
function someFlow(): [number, Fruition] {
const fruition = new Fruition("some-flow");
//
fruition.mark("db lookups");
//
if (true) {
fruition.branch("dev mode", {
dev: true,
code: 123
});
}
// Done
return [1, fruition];
}
// Later
const [result, trace] = someFlow();
console.log(trace.toString());
```
Flow can be improved by adding the `Realisation` class:
```typescript
import { Fruition, Realisation } from "fruition";
function someFlow(): Realisation {
const fruition = new Fruition("some-flow");
//
return new Realisation(1, fruition);
}
// Later
const realisation = someFlow();
console.log(trace.explain());
realisation.result // 1
realisation.trace // Fruition
```
_TBC_