graphify

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package graphify provides a small, testable process adapter for the Graphify CLI. It deliberately never invokes a shell: every argument is passed directly to os/exec so URLs, paths, and user-supplied metadata cannot be interpreted as shell syntax.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddOptions

type AddOptions = ingest.AddOptions

AddOptions controls one URL ingestion.

type AddResult

type AddResult = ingest.AddResult

AddResult identifies the artifact Graphify created.

type Client

type Client struct {
	Runner Runner
	Binary string
	Env    []string
}

Client invokes one Graphify binary through a Runner.

func New

func New(r Runner) *Client

func (*Client) Add

func (c *Client) Add(ctx context.Context, opts AddOptions) (AddResult, error)

Add downloads one public HTTP(S) source into TargetDir.

func (*Client) Extract

func (c *Client) Extract(ctx context.Context, opts ExtractOptions) (GraphStats, Result, error)

Extract runs Graphify and validates the resulting graph.

func (*Client) ExtractCommand

func (c *Client) ExtractCommand(opts ExtractOptions) (Command, string, error)

ExtractCommand builds a direct, shell-free extraction command. It never adds --allow-partial; preserving the last complete graph is the safe default.

func (*Client) Preflight

func (c *Client) Preflight(ctx context.Context) (string, error)

Preflight verifies that Graphify is on PATH and responds to --version.

type Command

type Command struct {
	Name string
	Args []string
	Dir  string
	Env  []string
	// Timeout is an optional whole-process deadline. A caller context with an
	// earlier deadline still wins.
	Timeout time.Duration
}

Command is one direct process invocation.

type ExtractOptions

type ExtractOptions = ingest.ExtractOptions

ExtractOptions controls a headless Graphify extraction.

type GraphStats

type GraphStats = ingest.GraphStats

GraphStats is the minimal machine-readable health view of graph.json.

func Validate

func Validate(path string) (GraphStats, error)

Validate ensures graph.json exists, is valid JSON, and contains node and edge arrays. Both "edges" and NetworkX's "links" representation are accepted.

type OSRunner

type OSRunner struct{}

OSRunner executes commands on the host without a shell.

func (OSRunner) LookPath

func (OSRunner) LookPath(name string) (string, error)

func (OSRunner) Run

func (OSRunner) Run(ctx context.Context, command Command) Result

type Result

type Result = ingest.Result

Result captures a completed process invocation.

type Runner

type Runner interface {
	LookPath(name string) (string, error)
	Run(ctx context.Context, command Command) Result
}

Runner makes process execution replaceable in unit tests.

Jump to

Keyboard shortcuts

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