Skip to main content
Jinaga.Tool package icon

Jinaga.Tool

v1.1.6Latest Stable
Any Framework

Manage Jinaga replicators. Deploy authorization and distribution rules.

Published
Aug 29, 2026
1mo ago
Total Downloads
2.0K
2,008

Install

dotnet add package Jinaga.Tool --version 1.1.6

No framework information available.

README

Jinaga command line tool

Manage Jinaga replicators. Deploy authorization, distribution, and purge rules.

Installation

Install the global tool via dotnet.

dotnet tool install -g Jinaga.Tool

Usage

Run the tool during continuous deployment to deploy authorization, distribution, and purge rules.

dotnet jinaga deploy authorization <assembly> <endpoint> <secret>
dotnet jinaga deploy distribution <assembly> <endpoint> <secret>
dotnet jinaga deploy purge <assembly> <endpoint> <secret>

You can find the endpoint and secret in the Jinaga replicator portal.

This tool is to be used with a Jinaga application. Install the Jinaga NuGet package and create a model. For example:

[FactType("Blog.Site")]
public record Site(User creator, string identifier) { }

[FactType("Blog.GuestBlogger")]
public record GuestBlogger(Site site, User guest) { }

[FactType("Blog.Content")]
public record Content(Site site, string path) { }

Create a public static class called JinagaConfig. This will typically be the class that creates the JinagaClient. For example:

public static class JinagaConfig
{
  public static JinagaClient j = JinagaClient.Create(opt =>
  {
    var settings = new Settings();
    settings.Verify();
    opt.HttpEndpoint = new Uri(settings.ReplicatorUrl);
  });
}

Add your authorization, distribution, and purge rules to this class. Use the AuthorizationRules class to build and describe your rules. For example:

  public static string Authorization() => AuthorizationRules.Describe(Authorization);

  private static AuthorizationRules Authorization(AuthorizationRules r) => r
    // Anyone can create a user
    .Any<User>()
    // A site can only be created by its creator
    .Type<Site>(site => site.creator)
    // A guest blogger can only be created by the site's creator
    .Type<GuestBlogger>(guestBlogger => guestBlogger.site.creator)
    // A content item can be created by the site's creator
    .Type<Content>(content => content.site.creator)
    // A content item can also be created by a guest blogger
    .Type<Content>((content, facts) =>
      from guestBlogger in facts.OfType<GuestBlogger>()
      where guestBlogger.site == content.site
      from user in facts.OfType<User>()
      where user == guestBlogger.guest
      select user
    )
    ;

Use the DistributionRules class to build and describe your rules. For example:

  public static string Distribution() => DistributionRules.Describe(Distribution);

  private static DistributionRules Distribution(DistributionRules r) => r
    // Everyone can see published posts
    .Share(Given<Site>.Match((site, facts) =>
      from content in facts.OfType<Content>()
      where content.site == site &&
        facts.Any<Publish>(publish => publish.content == content)
      select content
    ))
    .WithEveryone()
    // The creator can see all posts
    .Share(Given<Site>.Match((site, facts) =>
      from content in facts.OfType<Content>()
      where content.site == site
      select content
    ))
    .With(site => site.creator)
    ;

Use the PurgeConditions class to build and describe your rules. For example:

  public static string Purge() => PurgeConditions.Describe(Purge);

  private static PurgeConditions Purge(PurgeConditions r) => r
    // Purge posts that have been deleted
    .Purge<Post>().WhenExists<PostDelete>(delete => delete.post)
    ;

Run the tool to deploy the rules to the replicator. The replicator will then enforce the rules.

You can also print the rules to the console for verification.

dotnet jinaga print authorization <assembly>
dotnet jinaga print distribution <assembly>
dotnet jinaga print policy <assembly>

Build and Test

dotnet build .\Jinaga.Tool -c Release
dotnet pack .\Jinaga.Tool -c Release
dotnet tool install --global --add-source .\Jinaga.Tool\bin\Release Jinaga.Tool
dotnet build ./Jinaga.Tool -c Release
dotnet pack ./Jinaga.Tool -c Release
sudo dotnet tool install --global --add-source ./Jinaga.Tool/bin/Release Jinaga.Tool

After testing, uninstall the tool

dotnet tool uninstall --global Jinaga.Tool
sudo dotnet tool uninstall --global Jinaga.Tool

Changes from Previous Version

No structural changes between v1.1.4 and v1.1.6.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.