Powered by AppSignal & Oban Pro

Lesson 01 Livebook: Founder Bootstrap

livebooks/01_founder_bootstrap.livemd

Lesson 01 Livebook: Founder Bootstrap

This notebook keeps lesson 1 focused on the pure Jido contract.

Mix.install([
  {:founder_bootstrap, path: "../01_founder_bootstrap"}
])

Walk The Founder Through One Decision

alias JidoClass.FounderAgent
alias JidoClass.Actions.{AddIdea, GreenlightIdea, PlanMilestone}

founder = FounderAgent.new()

{founder, []} =
  FounderAgent.cmd(
    founder,
    {AddIdea,
     %{
       name: "Dungeon Postal",
       genre: "management sim",
       hook: "Deliver mail in a cursed dungeon"
     }}
  )

{founder, []} =
  FounderAgent.cmd(
    founder,
    {AddIdea,
     %{
       name: "Orbit Cafe",
       genre: "cozy sim",
       hook: "Run a coffee shop on a drifting station"
     }}
  )

{founder, []} = FounderAgent.cmd(founder, {GreenlightIdea, %{name: "Orbit Cafe"}})
{founder, []} = FounderAgent.cmd(founder, {PlanMilestone, %{milestone: "build a playable prototype"}})

founder.state

Inspect The Failure Surface

{unchanged_founder, directives} =
  FounderAgent.cmd(FounderAgent.new(), {GreenlightIdea, %{name: "Missing Project"}})

%{
  active_idea: unchanged_founder.state.active_idea,
  directives: directives
}

Both success and failure stay explicit in cmd/2.