permission

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeNotifier

type ChangeNotifier interface {
	NotifyPermissionChange(projectID string)
}

ChangeNotifier is called after permission updates from the UI to push a SyncPermissionsCommand to connected Agent Managers.

type PermissionSet

type PermissionSet struct {
	ProjectID string    `yaml:"project_id"`
	Allow     []string  `yaml:"allow"`
	Ask       []string  `yaml:"ask"`
	Deny      []string  `yaml:"deny"`
	UpdatedAt time.Time `yaml:"updated_at"`
}

PermissionSet represents project-scoped permission rules for Claude Code tools and Bash command patterns. One PermissionSet per project.

func Merge

func Merge(stored *PermissionSet, localAllow, localAsk, localDeny []string) *PermissionSet

Merge performs a union merge of local permissions into stored permissions. Each category (allow, ask, deny) is independently merged with deduplication.

type Repository

type Repository interface {
	// Get returns the permission set for a project.
	// Returns an empty PermissionSet (not an error) if none exists yet.
	Get(ctx context.Context, projectID string) (*PermissionSet, error)

	// Upsert creates or replaces the permission set for a project.
	Upsert(ctx context.Context, ps *PermissionSet) error
}

Repository provides persistence for project-scoped permission sets.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements the PermissionService RPC handlers.

func NewServer

func NewServer(repo Repository, notifier ChangeNotifier) *Server

NewServer creates a new permission service server.

func (*Server) GetPermissions

GetPermissions returns the permission set for a project.

func (*Server) SyncPermissionsFromDir

SyncPermissionsFromDir reads .claude/settings.json from the given directory and merges its permission rules into the stored set using union strategy.

func (*Server) UpdatePermissions

UpdatePermissions replaces the full permission set for a project.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL