Documentation
¶
Index ¶
- Constants
- func EnforceBlockedExit(status string, code int) int
- type ApplyArgs
- type BenchArgs
- type BenchMetricPayload
- type BenchPayload
- type BenchResult
- type ChangeEdit
- type ChangesPayload
- type ChangesResult
- type CheckArgs
- type ContextPackArgs
- type DepEdge
- type DepsArgs
- type DepsPayload
- type DepsResult
- type DiffArgs
- type GetArgs
- type ImpactArgs
- type ImpactFileHit
- type ImpactPayload
- type ImpactResult
- type IndexArgs
- type InspectArgs
- type PatchArgs
- type PatchResult
- type QueryArgs
- type RefsPayload
- type RefsPayloadIssue
- type RefsPayloadReference
- type RefsResult
- type RepositionArgs
- type RestorePayload
- type RestoreResult
- type SafetyFinding
- type SafetyPayload
- type ScanArgs
- type Service
- func (s *Service) Apply(namespace, path string, view core.View, jsonOut bool, args ApplyArgs) (PatchResult, int)
- func (s *Service) Bench(namespace, path string, view core.View, jsonOut bool, args BenchArgs) (BenchResult, int)
- func (s *Service) Changes(namespace, path string, view core.View, jsonOut bool) (ChangesResult, int)
- func (s *Service) Check(namespace, path string, view core.View, jsonOut bool, args CheckArgs) (core.Result, int)
- func (s *Service) ContextPack(namespace, path string, view core.View, jsonOut bool, args ContextPackArgs) (core.Result, int)
- func (s *Service) Deps(namespace, path string, view core.View, jsonOut bool, args DepsArgs) (DepsResult, int)
- func (s *Service) Diff(namespace, path string, view core.View, jsonOut bool, args DiffArgs) (PatchResult, int)
- func (s *Service) Get(namespace, path string, view core.View, jsonOut bool, args GetArgs) (core.Result, int)
- func (s *Service) Impact(namespace, path string, view core.View, jsonOut bool, args ImpactArgs) (ImpactResult, int)
- func (s *Service) Index(namespace, path string, view core.View, jsonOut bool, args IndexArgs) (core.Result, int)
- func (s *Service) Inspect(namespace, path string, view core.View, jsonOut bool, args InspectArgs) (core.Result, int)
- func (s *Service) MetaGUID(path string, project string, jsonOut bool) (core.Result, int)
- func (s *Service) Patch(namespace, path string, view core.View, jsonOut bool, args PatchArgs) (PatchResult, int)
- func (s *Service) Query(namespace, path string, view core.View, jsonOut bool, args QueryArgs) (core.Result, int)
- func (s *Service) Refs(namespace, path string, view core.View, jsonOut bool) (RefsResult, int)
- func (s *Service) Reposition(namespace, path string, view core.View, jsonOut bool, args RepositionArgs) (SetResult, int)
- func (s *Service) Restore(namespace, path string, view core.View, jsonOut bool) (RestoreResult, int)
- func (s *Service) Scan(namespace, path string, view core.View, jsonOut bool, args ScanArgs) (core.Result, int)
- func (s *Service) Set(namespace, path string, view core.View, jsonOut bool, args SetArgs) (SetResult, int)
- func (s *Service) Suggest(namespace, path string, view core.View, jsonOut bool, args SuggestArgs) (SuggestResult, int)
- func (s *Service) Summarize(namespace, path string, view core.View, jsonOut bool) (core.Result, int)
- func (s *Service) Validate(namespace, path string, view core.View, jsonOut bool) (ValidateResult, int)
- type SetArgs
- type SetResult
- type SuggestAnchorPayload
- type SuggestArgs
- type SuggestCandidatePayload
- type SuggestPayload
- type SuggestResult
- type ValidateFinding
- type ValidatePayload
- type ValidateResult
Constants ¶
const ( ExitOK = 0 ExitError = 1 ExitUsage = 2 ExitBlocked = 3 )
Process exit codes for the unity-ctx CLI. This is the single source of truth for the exit-code contract that agents and scripts rely on to tell outcomes apart:
0 OK / advisory (also WARN, UNKNOWN, NEED_PREFAB_GUID, DRY_RUN) — the request was answered; for a mutation the write either happened or was a no-op/dry-run. 1 ERROR — the command failed. Includes post-write graph corruption (final_check), where the file was already modified and may need restore. 2 usage / invocation error — bad flags, arguments, or output encoding. 3 BLOCKED — a safety check refused the mutation BEFORE any write; the file is untouched. Kept distinct from ERROR so an agent can never mistake a refusal for success (the original "BLOCKED -> exit 0" contract bug).
Variables ¶
This section is empty.
Functions ¶
func EnforceBlockedExit ¶ added in v0.8.0
EnforceBlockedExit guarantees that a BLOCKED result maps to ExitBlocked at the CLI boundary. It is a defense-in-depth backstop: even if a mutation path forgets to return ExitBlocked at its source, a BLOCKED status can never leak exit 0 (which an agent would read as success). Every other status passes through unchanged so existing OK/WARN/ERROR/usage codes are untouched.
Types ¶
type BenchMetricPayload ¶
type BenchPayload ¶
type BenchPayload struct {
RawBytes int `json:"raw_bytes"`
RawTokens int `json:"raw_tokens"`
Summarize BenchMetricPayload `json:"summarize"`
ContextPack *BenchMetricPayload `json:"context_pack,omitempty"`
}
type BenchResult ¶
type BenchResult struct {
core.Result
Bench *BenchPayload `json:"bench,omitempty"`
}
type ChangeEdit ¶
type ChangesPayload ¶
type ChangesPayload struct {
Backup string `json:"backup"`
Added int `json:"added"`
Removed int `json:"removed"`
Changed int `json:"changed"`
Edits []ChangeEdit `json:"edits"`
}
type ChangesResult ¶
type ChangesResult struct {
core.Result
Changes *ChangesPayload `json:"changes,omitempty"`
}
type ContextPackArgs ¶
type DepsPayload ¶
type DepsResult ¶
type DepsResult struct {
core.Result
Deps *DepsPayload `json:"deps,omitempty"`
}
type ImpactArgs ¶
type ImpactFileHit ¶
type ImpactPayload ¶
type ImpactPayload struct {
Status string `json:"status"`
PrefabPath string `json:"prefab_path"`
PrefabGUID string `json:"prefab_guid"`
SceneHits []ImpactFileHit `json:"scene_hits"`
PrefabHits []ImpactFileHit `json:"prefab_hits"`
DepthLimitHit bool `json:"depth_limit_hit"`
MaxNestedDepth int `json:"max_nested_depth"`
}
type ImpactResult ¶
type ImpactResult struct {
core.Result
Impact *ImpactPayload `json:"impact,omitempty"`
}
type InspectArgs ¶
type PatchResult ¶
type PatchResult struct {
SchemaVersion int `json:"schema_version,omitempty"`
core.Result
PatchPlan *scenepatch.PlacePrefabPlan `json:"patch_plan,omitempty"`
Ops []scenepatch.Op `json:"ops,omitempty"`
Safety *SafetyPayload `json:"safety,omitempty"`
}
type RefsPayload ¶
type RefsPayload struct {
References []RefsPayloadReference `json:"references"`
Warnings int `json:"warnings"`
Issues []RefsPayloadIssue `json:"issues"`
}
type RefsPayloadIssue ¶
type RefsPayloadReference ¶
type RefsResult ¶
type RefsResult struct {
core.Result
Refs *RefsPayload `json:"refs,omitempty"`
}
type RepositionArgs ¶ added in v0.8.0
type RestorePayload ¶
type RestoreResult ¶
type RestoreResult struct {
core.Result
Restore *RestorePayload `json:"restore,omitempty"`
}
type SafetyFinding ¶
type SafetyPayload ¶
type SafetyPayload struct {
PreCheck string `json:"pre_check,omitempty"`
TempCheck string `json:"temp_check,omitempty"`
FinalCheck string `json:"final_check,omitempty"`
Findings []SafetyFinding `json:"findings,omitempty"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewWithScanRunner ¶
func (*Service) Changes ¶
func (s *Service) Changes(namespace, path string, view core.View, jsonOut bool) (ChangesResult, int)
Changes reports the structural difference between a file and its sibling <file>.bak — i.e. what the last committed write changed — by matching blocks on fileID. Read-only; pairs with restore for inspecting/recovering an edit.
func (*Service) ContextPack ¶
func (*Service) Deps ¶
func (s *Service) Deps(namespace, path string, view core.View, jsonOut bool, args DepsArgs) (DepsResult, int)
Deps reports the external asset dependencies of a file: the GUIDs it references (via the safety kernel) resolved to asset paths within --project. Text by default, --json for a structured payload, --out writes a Graphviz DOT graph. Read-only.
func (*Service) Impact ¶
func (s *Service) Impact(namespace, path string, view core.View, jsonOut bool, args ImpactArgs) (ImpactResult, int)
func (*Service) MetaGUID ¶
MetaGUID resolves the GUID of an asset from its sibling .meta file. It never guesses: a missing .meta or guid entry yields NEED_PREFAB_GUID (exit 0) so callers can ask the user instead of proceeding.
func (*Service) Refs ¶
Refs surfaces the safety kernel's PPtr/GUID reference evidence so agents can trace what a file points at without reading raw YAML.
func (*Service) Reposition ¶ added in v0.8.0
func (s *Service) Reposition(namespace, path string, view core.View, jsonOut bool, args RepositionArgs) (SetResult, int)
Reposition sets a scene Transform's m_LocalPosition to args.Position. It is a structural-edit-free, topology-invariant mutation: only three numeric axis tokens of one inline mapping change. It reuses the dry-run-first, --write, .bak, and three-phase (pre/temp/final) graph-check contract that set/apply already establish, including the deliberate no-auto-revert final_check policy.
func (*Service) Restore ¶
func (s *Service) Restore(namespace, path string, view core.View, jsonOut bool) (RestoreResult, int)
Restore overwrites a file with its sibling <file>.bak, recovering the pre-write state left by the last committed mutation. It reports the integrity status of the restored content so an agent knows what state it recovered to.
func (*Service) Suggest ¶
func (s *Service) Suggest(namespace, path string, view core.View, jsonOut bool, args SuggestArgs) (SuggestResult, int)
func (*Service) Validate ¶
func (s *Service) Validate(namespace, path string, view core.View, jsonOut bool) (ValidateResult, int)
Validate runs the unity-fileid-graph integrity check over a file and reports the result without mutating anything. It is the read-only form of the check that gates every write path, so agents can confirm a file is structurally sound before editing it. OK/WARN exit 0; ERROR (broken graph) exits 1.
type SetResult ¶
type SetResult struct {
core.Result
Impact *ImpactPayload `json:"impact,omitempty"`
Safety *SafetyPayload `json:"safety,omitempty"`
}
type SuggestAnchorPayload ¶
type SuggestArgs ¶
type SuggestCandidatePayload ¶
type SuggestPayload ¶
type SuggestPayload struct {
Status string `json:"status"`
Manifest string `json:"manifest"`
PrefabPath string `json:"prefab"`
Near SuggestAnchorPayload `json:"anchor"`
Align string `json:"align"`
Count int `json:"count"`
Candidates []SuggestCandidatePayload `json:"candidates"`
}
type SuggestResult ¶
type SuggestResult struct {
core.Result
Suggest *SuggestPayload `json:"suggest,omitempty"`
}
type ValidateFinding ¶
type ValidatePayload ¶
type ValidateResult ¶
type ValidateResult struct {
core.Result
Validate *ValidatePayload `json:"validate,omitempty"`
}