Documentation
¶
Overview ¶
Package tsuzuri coordinates Markdown tasks through Git claims and assignments. Claims do not grant execution permission or fence running workers.
Index ¶
- Constants
- func JSON(result Result) ([]byte, error)
- type AcceptRequest
- type AcceptanceResult
- type AreaOverlap
- type AssignmentMetadata
- type AssignmentObservation
- type ClaimMetadata
- type ClaimObservation
- type ClaimRequest
- type ClaimResult
- type Client
- func (c *Client) Accept(ctx context.Context, request AcceptRequest, options ...OperationOptions) (AcceptanceResult, Source, error)
- func (c *Client) Author(ctx context.Context, command, id, requestID string, input []byte, ...) (Result, error)
- func (c *Client) Claim(ctx context.Context, request ClaimRequest, options ...OperationOptions) (ClaimResult, Source, error)
- func (c *Client) Coordinate(ctx context.Context, request Coordination, options ...OperationOptions) (Result, error)
- func (c *Client) Next(ctx context.Context, project string, options ...OperationOptions) ([]TaskView, Source, error)
- func (c *Client) Query(ctx context.Context, q Query, options ...OperationOptions) (Result, error)
- func (c *Client) Show(ctx context.Context, id string, options ...OperationOptions) (Inspection, Source, error)
- type Config
- type Coordination
- type CoordinationSource
- type CreateProjectInput
- type CreateTaskInput
- type Error
- type HandoffResult
- type Inspection
- type LocalClaimObservation
- type Materialization
- type OperationOptions
- type OrphanAssignmentDetails
- type OverviewAssignment
- type OverviewClaim
- type OverviewIssue
- type OverviewTask
- type Project
- type Query
- type ReleaseResult
- type Result
- type Source
- type Task
- type TaskID
- type TaskRevision
- type TaskView
- type TransitionTaskInput
- type WorkerID
Examples ¶
Constants ¶
const Version = "0.1.0-rc.7"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AcceptRequest ¶
AcceptRequest selects the incoming or recovering worker and workspace mode.
type AcceptanceResult ¶
type AcceptanceResult struct {
CoordinationSource
TaskID string `json:"taskId"`
ClaimID string `json:"claimId"`
Assignment *AssignmentMetadata `json:"assignment"`
RemoteRef string `json:"remoteRef"`
CreatedLocalReceipt bool `json:"createdLocalReceipt"`
UpdatedLocalAssignmentReceipt bool `json:"updatedLocalAssignmentReceipt"`
ClaimedTask *TaskRevision `json:"claimedTask"`
ClaimObjectID string `json:"claimObjectId"`
Materialization *Materialization `json:"materialization"`
}
AcceptanceResult records the reconciled assignment and local receipt effects.
type AreaOverlap ¶
type AreaOverlap struct {
TaskID string `json:"taskId"`
Owner *string `json:"owner"`
Areas []string `json:"areas"`
Incomplete bool `json:"incomplete"`
Error *string `json:"error"`
}
AreaOverlap reports shared areas with other claimed tasks; it is advisory.
type AssignmentMetadata ¶
type AssignmentMetadata struct {
Version int `json:"version"`
RepositoryID string `json:"repositoryId"`
TaskID string `json:"taskId"`
ClaimID string `json:"claimId"`
AssignmentID string `json:"assignmentId"`
State string `json:"state"`
Worker *string `json:"worker"`
PreviousObjectID string `json:"previousObjectId"`
UpdatedAt string `json:"updatedAt"`
ObjectID string `json:"objectId"`
}
AssignmentMetadata identifies a worker generation and its previous assignment.
type AssignmentObservation ¶
type ClaimMetadata ¶
type ClaimMetadata struct {
Version int `json:"version"`
RepositoryID string `json:"repositoryId"`
TaskID string `json:"taskId"`
ClaimID string `json:"claimId"`
Owner string `json:"owner"`
BaseObjectID string `json:"baseObjectId"`
ClaimedAt string `json:"claimedAt"`
AnchorObjectID string `json:"anchorObjectId"`
}
ClaimMetadata binds a claim to its repository, task, owner and original base.
type ClaimObservation ¶
type ClaimObservation struct {
TaskID string `json:"taskId"`
RefName string `json:"refName"`
ObjectID string `json:"objectId"`
Status string `json:"status"`
Valid bool `json:"valid"`
Metadata *ClaimMetadata `json:"metadata"`
ClaimedTask *TaskRevision `json:"claimedTask"`
Assignment *AssignmentObservation `json:"assignment"`
Drift []string `json:"drift"`
Error *string `json:"error"`
}
ClaimObservation is validated evidence about a claim, not execution authority.
type ClaimRequest ¶
type ClaimRequest struct {
Task TaskID
Worker WorkerID
Owner, ExpectedDigest, Worktree string
NoWorktree bool
}
ClaimRequest selects an original task revision and an explicit worker. NoWorktree leaves implementation workspace management to the caller.
type ClaimResult ¶
type ClaimResult struct {
Metadata ClaimMetadata `json:"metadata"`
RemoteRef string `json:"remoteRef"`
SnapshotID string `json:"snapshotId"`
Overlaps []AreaOverlap `json:"overlaps"`
Assignment *AssignmentMetadata `json:"assignment"`
ClaimedTask TaskRevision `json:"claimedTask"`
Materialization *Materialization `json:"materialization"`
}
ClaimResult binds ownership, original task revision and optional workspace.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client selects a repository. Each operation obtains its own context and snapshot. Concurrent callers must still coordinate clone-local authoring/worktree operations.
func (*Client) Accept ¶
func (c *Client) Accept(ctx context.Context, request AcceptRequest, options ...OperationOptions) (AcceptanceResult, Source, error)
Accept reconciles the current assignment and recovers clone-local receipts. It is not an execution fence: callers must reverify ownership after return.
func (*Client) Author ¶
func (c *Client) Author(ctx context.Context, command, id, requestID string, input []byte, options ...OperationOptions) (Result, error)
Author applies JSON record changes. Receipts and transition locks are clone-local Git refs; canonical task completion still requires integration.
func (*Client) Claim ¶
func (c *Client) Claim(ctx context.Context, request ClaimRequest, options ...OperationOptions) (ClaimResult, Source, error)
Claim uses the same engine as the standalone CLI, including receipt recovery.
func (*Client) Coordinate ¶
func (c *Client) Coordinate(ctx context.Context, request Coordination, options ...OperationOptions) (Result, error)
Coordinate executes an explicit ownership command and returns its result envelope.
func (*Client) Next ¶
func (c *Client) Next(ctx context.Context, project string, options ...OperationOptions) ([]TaskView, Source, error)
Next discovers ready work on a fresh canonical snapshot. Readiness grants no execution permission. An empty project selects every project.
func (*Client) Query ¶
Query returns a schema-1 envelope for the requested inspection.
Example ¶
package main
import (
"context"
"fmt"
"time"
tsuzuri "github.com/utsuri-foundry/tsuzuri"
)
func main() {
client, err := tsuzuri.Open(".")
if err != nil {
panic(err)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
// Capability discovery works before a task store is configured.
result, err := client.Query(ctx, tsuzuri.Query{Command: "compatibility"})
if err != nil {
panic(err)
}
fmt.Println(result.Command, result.Schema, result.OK)
}
Output: compatibility 1 true
func (*Client) Show ¶
func (c *Client) Show(ctx context.Context, id string, options ...OperationOptions) (Inspection, Source, error)
Show inspects a task and its current ownership on a fresh canonical snapshot.
type Config ¶
type Config struct {
Schema int `toml:"schema"`
RepositoryID string `toml:"repository_id"`
TaskRoot string `toml:"task_root"`
BaseBranch string `toml:"base_branch"`
ClaimNamespace string `toml:"claim_namespace"`
WorktreeRoot string `toml:"worktree_root"`
WorktreeTemplate string `toml:"worktree_template"`
Areas []string `toml:"areas"`
Risks []string `toml:"risks"`
}
Config is the schema-1 repository configuration stored in .tsuzuri.toml.
type Coordination ¶
type Coordination struct {
Command, ID, Owner, Worker, Worktree, ExpectedDigest, To, Checkpoint string
NoWorktree bool
}
Coordination describes one explicit ownership operation. It never grants authority to execute work; callers must retain their own authorization checks.
type CoordinationSource ¶
type CoordinationSource struct {
RepositoryID string `json:"repositoryId"`
BaseObjectID string `json:"baseObjectId"`
ConfigurationObjectID *string `json:"configurationObjectId"`
SnapshotID string `json:"snapshotId"`
ObservedClaimObjectIDs []string `json:"observedClaimObjectIds"`
ObservedAssignmentObjectIDs []string `json:"observedAssignmentObjectIds"`
}
CoordinationSource identifies observed refs using the schema-1 wire format.
type CreateProjectInput ¶
type CreateProjectInput struct {
ID string `json:"id"`
Title string `json:"title"`
State string `json:"state"`
Goal string `json:"goal"`
FinishLine string `json:"finishLine"`
Extensions map[string]any `json:"extensions"`
}
CreateProjectInput is the JSON body accepted by create-project.
type CreateTaskInput ¶
type CreateTaskInput struct {
ID string `json:"id"`
Project string `json:"project"`
Title string `json:"title"`
Kind string `json:"kind"`
State string `json:"state"`
Priority string `json:"priority"`
BlockedBy []string `json:"blockedBy"`
Areas []string `json:"areas"`
Risks []string `json:"risks"`
Created string `json:"created"`
BlockedReason *string `json:"blockedReason"`
Outcome *string `json:"outcome"`
Acceptance *string `json:"acceptance"`
Resolution *string `json:"resolution"`
AdditionalSections map[string]string `json:"additionalSections"`
Extensions map[string]any `json:"extensions"`
}
CreateTaskInput is the JSON body accepted by create-task.
type Error ¶
type Error struct {
Kind string `json:"kind"`
Code string `json:"code"`
Message string `json:"message"`
ExitCode int `json:"exitCode"`
Details any `json:"details"`
// contains filtered or unexported fields
}
Error is a classified failure with recovery details and an optional cause.
type HandoffResult ¶
type HandoffResult struct {
CoordinationSource
TaskID string `json:"taskId"`
ClaimID string `json:"claimId"`
Assignment *AssignmentMetadata `json:"assignment"`
RemoteRef string `json:"remoteRef"`
RemovedLocalReceipt bool `json:"removedLocalReceipt"`
RemovedLocalAssignmentReceipt bool `json:"removedLocalAssignmentReceipt"`
}
HandoffResult identifies the published assignment and removed local receipts.
type Inspection ¶
type Inspection struct {
TaskView
Markdown string `json:"markdown"`
Claim *ClaimObservation `json:"claim"`
ClaimedMarkdown *string `json:"claimedMarkdown"`
}
Inspection includes current task text and the original claimed revision.
type LocalClaimObservation ¶
type LocalClaimObservation struct {
TaskID string `json:"taskId"`
ReceiptObjectID *string `json:"receiptObjectId"`
AssignmentReceiptObjectID *string `json:"assignmentReceiptObjectId"`
BranchObjectID *string `json:"branchObjectId"`
WorktreePath *string `json:"worktreePath"`
WorktreeHead *string `json:"worktreeHead"`
WorktreeClean *bool `json:"worktreeClean"`
Issues []string `json:"issues"`
}
type Materialization ¶
type Materialization struct {
TaskID string `json:"taskId"`
Branch string `json:"branch"`
WorktreePath string `json:"worktreePath"`
AnchorObjectID string `json:"anchorObjectId"`
Resumed bool `json:"resumed"`
}
Materialization identifies a local implementation branch and worktree.
type OperationOptions ¶
type OperationOptions struct {
GitExecutable string
Environment []string
ExpectedRemoteURL string
ExpectedRepositoryID string
ExpectedClaimNamespace string
}
OperationOptions supplies trusted policy for one call without changing process globals. Environment replaces the child environment; nil inherits the process environment. An explicit environment requires an absolute GitExecutable. Keep the slice unchanged until return. Pass credentials through Git config environment variables, never command arguments; see docs/integration.md for supervisor setup. Nonempty Expected fields must match: mismatches return *Error with Kind/Code "validation" and ExitCode 3; malformed options return "usage" (exit 2).
type OrphanAssignmentDetails ¶
type OrphanAssignmentDetails struct {
Issue string `json:"issue"`
RepositoryID string `json:"repositoryId"`
TaskID string `json:"taskId"`
BaseObjectID string `json:"baseObjectId"`
SnapshotID string `json:"snapshotId"`
ClaimRef string `json:"claimRef"`
ClaimObjectID *string `json:"claimObjectId"`
AssignmentRef string `json:"assignmentRef"`
AssignmentObjectID string `json:"assignmentObjectId"`
SafeAction string `json:"safeAction"`
}
OrphanAssignmentDetails describes observed evidence, not repair authority. A surviving assignment cannot establish the missing implementation tip.
type OverviewAssignment ¶
type OverviewClaim ¶
type OverviewClaim struct {
Status string `json:"status"`
Owner *string `json:"owner"`
ClaimedAt *string `json:"claimedAt"`
Assignment *OverviewAssignment `json:"assignment"`
RefName string `json:"refName"`
ObjectID string `json:"objectId"`
Drift []string `json:"drift"`
Error *string `json:"error"`
}
type OverviewIssue ¶
type OverviewIssue struct {
TaskID string `json:"taskId"`
OverviewClaim
}
type OverviewTask ¶
type OverviewTask struct {
ID string `json:"id"`
Title string `json:"title"`
Project string `json:"project"`
Kind string `json:"kind"`
CanonicalState string `json:"canonicalState"`
Priority string `json:"priority"`
Created string `json:"created"`
ProjectAvailability string `json:"projectAvailability"`
DependencyStatus string `json:"dependencyStatus"`
UnfinishedDependencies []string `json:"unfinishedDependencies"`
CancelledDependencies []string `json:"cancelledDependencies"`
BlockedReason *string `json:"blockedReason"`
Claim *OverviewClaim `json:"claim"`
}
type Project ¶
type Project struct {
Schema int `json:"schema" toml:"schema"`
ID string `json:"id" toml:"id"`
Title string `json:"title" toml:"title"`
State string `json:"state" toml:"state"`
Goal string `json:"goal" toml:"-"`
FinishLine string `json:"finishLine" toml:"-"`
Path string `json:"path" toml:"-"`
Extensions map[string]any `json:"-" toml:"extensions"`
}
type ReleaseResult ¶
type ReleaseResult struct {
TaskID string `json:"taskId"`
RemoteRef string `json:"remoteRef"`
AnchorObjectID string `json:"anchorObjectId"`
RemovedWorktree *string `json:"removedWorktree"`
RemovedLocalBranch bool `json:"removedLocalBranch"`
RemovedReceipt bool `json:"removedReceipt"`
RemovedAssignmentReceipt bool `json:"removedAssignmentReceipt"`
RemoteAlreadyAbsent bool `json:"remoteAlreadyAbsent"`
RemovedRemoteAssignment bool `json:"removedRemoteAssignment"`
}
ReleaseResult records conditional release of an unused claim and local cleanup.
type Result ¶
type Result struct {
Schema int `json:"schema"`
OK bool `json:"ok"`
Command string `json:"command"`
Source *Source `json:"source"`
Data any `json:"data"`
Human string `json:"-"`
}
Result is the schema-1 automation envelope. Human output is a rendering only.
type Source ¶
type Source struct {
Kind string `json:"kind"`
RepositoryID string `json:"repositoryId"`
BaseObjectID *string `json:"baseObjectId"`
ConfigurationObjectID *string `json:"configurationObjectId"`
SnapshotID *string `json:"snapshotId"`
ObservedClaimObjectIDs []string `json:"observedClaimObjectIds"`
ObservedAssignmentObjectIDs []string `json:"observedAssignmentObjectIds"`
RefreshResult *string `json:"refreshResult"`
}
Source identifies the repository revision and refs used for an observation.
type Task ¶
type Task struct {
Schema int `json:"schema" toml:"schema"`
ID string `json:"id" toml:"id"`
Project string `json:"project" toml:"project"`
Title string `json:"title" toml:"title"`
Kind string `json:"kind" toml:"kind"`
State string `json:"state" toml:"state"`
Priority string `json:"priority" toml:"priority"`
BlockedBy []string `json:"blockedBy" toml:"blocked_by"`
Areas []string `json:"areas" toml:"areas"`
Risks []string `json:"risks" toml:"risks"`
Created string `json:"created" toml:"-"`
CreatedDate toml.LocalDate `json:"-" toml:"created"`
BlockedReason *string `json:"blockedReason" toml:"blocked_reason"`
Path string `json:"path" toml:"-"`
Extensions map[string]any `json:"-" toml:"extensions"`
}
Task is a parsed task record; its state is canonical only on the base branch.
type TaskRevision ¶
type TaskRevision struct {
BaseObjectID string `json:"baseObjectId"`
Path string `json:"path"`
RecordDigest string `json:"recordDigest"`
}
TaskRevision identifies the exact task blob at the claim's original base.
type TaskView ¶
type TaskView struct {
Task
ProjectAvailability string `json:"projectAvailability"`
DependencyStatus string `json:"dependencyStatus"`
ClaimStatus string `json:"claimStatus"`
Owner *string `json:"owner"`
Worker *string `json:"worker"`
AssignmentStatus string `json:"assignmentStatus"`
CanonicallyClaimable bool `json:"canonicallyClaimable"`
RecordDigest string `json:"recordDigest"`
}
type TransitionTaskInput ¶
type TransitionTaskInput struct {
ExpectedState string `json:"expectedState"`
ExpectedDigest string `json:"expectedDigest"`
State string `json:"state"`
BlockedReason *string `json:"blockedReason"`
Resolution *string `json:"resolution"`
}
TransitionTaskInput guards a task transition with its expected state and digest.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
check-architecture
command
check-architecture validates this repository's explicit source ownership.
|
check-architecture validates this repository's explicit source ownership. |
|
tsuzuri
command
|