Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AIPentest CyberStrikeAI update Apply

From Leeroopedia
Knowledge Sources
Domains Deployment, Updates
Last Updated 2026-10-19 04:10 GMT

Overview

Concrete tool for applying an in-place update with atomic binary swap and content preservation provided by the internal/update package.

Description

Apply acquires an install lock, refuses if a rollback is pending, recovers any incomplete adoption, checks the snapshot (refuses on blocking local source changes or check errors), fast-forwards the git tree, rebuilds the binary, keeps the previous binary at cyberstrike-ai.prev, restores operator-owned content (config.yaml, data/, venv/, tools/, roles/, skills/, agents/) over the update, copies overwritten local files to a backup dir, and atomically swaps the binary. A Step callback reports progress per phase. Result reports from/to commits, files touched, kept content, binary path, prev binary, and duration.

Usage

  • Self-update step 2 (apply): called via -update flag.

Code Reference

Source Location

  • Repository: CyberStrikeAI
  • File: internal/update/apply.go
  • Lines: Step L139-143, Result L147-170, Apply L186-228+

Signature

type Step struct {
    Phase, Message string
    At             string
}

type Result struct {
    FromCommit, ToCommit string
    Commits, FilesTouched int
    KeptContent, Overwritten []string
    Adopted        bool
    BinaryPath     string
    BinaryBuilt    bool
    PrevBinary     string
    BackupDir       string
    NeedsRestart    bool
    Duration        string
}

func Apply(ctx context.Context, opts Options, onStep func(Step)) (*Result, error)

Import

import "cyberstrike-ai/internal/update"

I/O Contract

Inputs

Name Type Required Description
ctx context.Context Yes Cancellation
opts Options Yes Root + Repo
onStep func(Step) No Progress callback

Outputs

Name Type Description
returns *Result, error Update summary or refusal error

Usage Examples

Apply an Update

res, err := update.Apply(ctx, opts, func(s update.Step) {
    fmt.Printf("[%s] %s\n", s.Phase, s.Message)
})
if err != nil { log.Fatal(err) }
fmt.Printf("Updated %s -> %s, kept: %v\n", res.FromCommit, res.ToCommit, res.KeptContent)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment