unblocked-web/double-agent

proposal to make it possible to allow possibility to use double-agent's runner as a library

GlenDC opened this issue · 2 comments

The bigger idea behind this proposal is to allow one to test their stack without having to fork the code somehow. The first proposal to make this happen was #55 which was also implemented in PR #56. This PR already allows one to write a runner implementation and get everything else for free. The only issue however is still to be able to run one has to modify the code locally or fork it somehow, in order to inject their implementation into the scripts.

Problem statement

It is currently impossible to run the runners with a custom stack (runner) implementation without having to modify this repository locally or a fork of it.

Proposal

The proposal can be summarised as follows:

  • move the business logic from the runner scripts into the library, allowing one to configure options and inject implementations where the need is there for it;
  • move the implementations to a separate root workspace module, one module per implementation (this ensures that the dependencies required for this runner are not also required to download for other runners);
  • finally a new root module can be introduced which contains the scripts we have today, and they would make use of the new lib code and runner implementations in order to achieve the same these scripts do today. External projects that make use of double agent to test their stack wouldn't use these scripts, but would use everything else. This is okay, as the scripts wouldn't do much at this point except to glue it all together like it does today, but than without the actual logic definitions built into it;

In my fork branch https://github.com/glendc/double-agent/tree/future you can see the current version I'm using for my own library. It is an evolution of #56 and goes a lot further.

Changes in a nutshell:

There might be some more differences, you can find the full active diff at: master...GlenDC:future (which does include code already introduced in my multi-runner proposal (#56)).

These changes allow me to reuse the runner logic, while only needing to worry about the stacks I implement, as I can ignore the @double-agent/stacks one.

For my purposes it even allows to do all steps in 1 script, very easily and having all data in one local folder rather than linked to something like the actual runner lib.

It shouldn't change any of your use cases, so I do not see a disadvantage for your use case, while allowing many other use cases and potential users.

If you like it I propose that we first get around in getting #56 approved & merged, and than I can see to make another PR which focusses on adding my proposal to your codebase.