Documentation
¶
Index ¶
- Constants
- func ASTParse(cfg ASTConfig) action.StreamOp[ParsedFile, ParsedFile]
- func ASTParseOperator() action.NamedOperator
- func AnalysisLibrary() action.Library
- func Clipboard(cfg ClipboardConfig) action.StreamOp[fs.FileContent, fs.FileContent]
- func ClipboardOperator() action.NamedOperator
- func DensifyBody(content string) string
- func DensifySnippets(lang string, snippets []string) string
- func DocumentInputAction() action.AnyAction
- func GenerateContextTree(files []ParsedFile, depth int, color, showFiles bool) string
- func GenerateFullProjectTree(root string, files []ParsedFile, depth int, color, showFiles bool) string
- func GitActions() []action.AnyAction
- func GitChangedPathsAction() action.AnyAction
- func GitLSFilesAction() action.AnyAction
- func GitUnifiedDiff(ctx context.Context, root string, filter GitFilter) (string, error)
- func IOLibrary() action.Library
- func JoinRendered(files []fs.FileContent) string
- func JoinRenderedAction() action.AnyAction
- func Library() action.Library
- func MaskSecrets(input string) string
- func MaskSecretsFast(src []byte, dst *bytes.Buffer)
- func OutputActions() []action.AnyAction
- func PackBatchOperator() action.NamedOperator
- func PackStatsInputOperator() action.NamedOperator
- func RenderLibrary() action.Library
- func RenderMarkdown(cfg RenderConfig) action.StreamOp[any, fs.FileContent]
- func RenderMarkdownOperator() action.NamedOperator
- func SaveState(path string, files []ParsedFile) error
- func SaveStateOperator() action.NamedOperator
- func SourceLibrary() action.Library
- func SourceOperator() action.AnyStreamAction
- func StatsCollect(cfg StatsCollectConfig) action.StreamOp[any, any]
- func StatsCollectOperator() action.NamedOperator
- func StatsCollectWithContext(ctx context.Context, cfg StatsCollectConfig) action.StreamOp[any, any]
- func Stdout(_ struct{}) action.StreamOp[fs.FileContent, fs.FileContent]
- func StdoutOperator() action.NamedOperator
- type ASTConfig
- type ClipboardConfig
- type FileState
- type GitChangedPathsRequest
- type GitFilter
- type GitLSFilesRequest
- type Guardrails
- type OutputEnvelope
- type OutputPolicy
- type PackConfig
- type PackStats
- type ParseOptions
- type ParsedFile
- type RenderConfig
- type SaveStateConfig
- type StatEntry
- type StateCache
- type StatsCollectConfig
Constants ¶
const StateFileName = ".nexss.srcpack.state"
StateFileName is the on-disk name of the incremental cache. Written in the workspace root; overwritten on every successful run.
Variables ¶
This section is empty.
Functions ¶
func ASTParse ¶
func ASTParse(cfg ASTConfig) action.StreamOp[ParsedFile, ParsedFile]
func ASTParseOperator ¶
func ASTParseOperator() action.NamedOperator
func AnalysisLibrary ¶
AnalysisLibrary returns the AST extractor and SRCPACK's stats adapters. They operate on the file stream produced by srcpack.source and never write to disk; pack.batch only materializes records for the downstream Flow fold.
func Clipboard ¶
func Clipboard(cfg ClipboardConfig) action.StreamOp[fs.FileContent, fs.FileContent]
Clipboard copies the rendered stream to the system clipboard when enabled, then forwards the original items unchanged.
func ClipboardOperator ¶
func ClipboardOperator() action.NamedOperator
func DensifyBody ¶
func DensifySnippets ¶
func DocumentInputAction ¶
DocumentInputAction exposes typed domain facts. Placeholder names, aliases, defaults and the document bundle's file shape belong to render.nflow.
func GenerateContextTree ¶
func GenerateContextTree(files []ParsedFile, depth int, color, showFiles bool) string
GenerateContextTree is the compatibility string API.
func GenerateFullProjectTree ¶
func GenerateFullProjectTree(root string, files []ParsedFile, depth int, color, showFiles bool) string
func GitActions ¶
GitActions returns the Git actions used by source scans and available to NFlow.
func GitChangedPathsAction ¶
GitChangedPathsAction exposes the changed-path set used by incremental source scans.
func GitLSFilesAction ¶
GitLSFilesAction exposes Git's reusable untracked-file query.
func GitUnifiedDiff ¶
GitUnifiedDiff returns the raw patch for the filter's active mode.
func IOLibrary ¶
IOLibrary returns the write-side operators: state cache, stdout sink, and clipboard.
func JoinRendered ¶
func JoinRendered(files []fs.FileContent) string
JoinRendered concatenates already-rendered content chunks without adding separators. RenderMarkdown owns all framing and newline semantics.
func JoinRenderedAction ¶
JoinRenderedAction turns the []FileContent result of Flow's collect boundary into a plain string, which transports such as tcli can emit as text.
func Library ¶
Library returns every srcpack library in one value. Kept for callers that want the whole surface without enumerating each subsystem.
func MaskSecrets ¶
func MaskSecretsFast ¶
func OutputActions ¶
OutputActions exposes output effects and their data-only rendering adapter.
func PackBatchOperator ¶
func PackBatchOperator() action.NamedOperator
PackBatchOperator exposes the append-only materializer to NFlow.
func PackStatsInputOperator ¶
func PackStatsInputOperator() action.NamedOperator
PackStatsInputOperator prepares ParsedFile facts for the NFlow-owned stats fold without moving source selection, parsing, or rendering out of SRCPACK.
func RenderLibrary ¶
RenderLibrary exposes the domain adapter for the document NFlow bundle. srcpack.render remains a compatibility operator for external/legacy flows.
func RenderMarkdown ¶
func RenderMarkdown(cfg RenderConfig) action.StreamOp[any, fs.FileContent]
func RenderMarkdownOperator ¶
func RenderMarkdownOperator() action.NamedOperator
func SaveState ¶
func SaveState(path string, files []ParsedFile) error
SaveState writes the current set of files as the new state cache. Omitted files are skipped; a nil cache target path is a no-op.
func SaveStateOperator ¶
func SaveStateOperator() action.NamedOperator
func SourceLibrary ¶
SourceLibrary returns the stream source that scans a workspace.
func SourceOperator ¶
func SourceOperator() action.AnyStreamAction
func StatsCollect ¶
func StatsCollect(cfg StatsCollectConfig) action.StreamOp[any, any]
func StatsCollectOperator ¶
func StatsCollectOperator() action.NamedOperator
func StatsCollectWithContext ¶
StatsCollectWithContext observes cancellation for callers that have an action context.
func Stdout ¶
func Stdout(_ struct{}) action.StreamOp[fs.FileContent, fs.FileContent]
func StdoutOperator ¶
func StdoutOperator() action.NamedOperator
Types ¶
type ASTConfig ¶
type ASTConfig struct {
OnlySig bool `json:"only_sig" cli:"only-sig"`
Dense bool `json:"dense" cli:"dense"`
Comments bool `json:"comments" cli:"comments"`
Mask bool `json:"mask" cli:"mask"`
MaxLines int `json:"max_lines" cli:"max-lines"`
MaxLinesHead int `json:"max_lines_head"`
MaxLinesTail int `json:"max_lines_tail"`
ExportedOnly bool `json:"exported_only"`
TrimIndent bool `json:"trim_indent"`
TrimBlankLines bool `json:"trim_blank_lines"`
}
type ClipboardConfig ¶
func (*ClipboardConfig) UnmarshalJSON ¶
func (cfg *ClipboardConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts Flow v0.10 modifier values, which arrive as strings, as well as boolean values from direct Go callers.
type FileState ¶
type FileState struct {
Hash string `json:"hash"`
ModTime time.Time `json:"mod_time"`
Size int64 `json:"size"`
}
FileState is one file's last-seen hash and metadata. Keyed by RelPath in StateCache so the cache is portable across machines.
type GitChangedPathsRequest ¶
GitChangedPathsRequest selects changed paths using a Git change filter.
type GitFilter ¶
type GitFilter struct {
Since string `json:"since"`
Modified bool `json:"modified"`
Staged bool `json:"staged"`
}
GitFilter selects which Git change sets to include. Since takes precedence over Modified; Staged is additive to either selection.
type GitLSFilesRequest ¶
type GitLSFilesRequest struct {
Root string `json:"root"`
}
GitLSFilesRequest asks Git for untracked, non-ignored working-tree paths.
type Guardrails ¶
type Guardrails struct {
MaxFileSize int64
MaxFilesScan int64
// contains filtered or unexported fields
}
Guardrails enforces per-scan safety limits. A non-positive limit is treated as "use the default" rather than "unlimited" — an unbounded scan is never the caller's intent.
func NewGuardrails ¶
func NewGuardrails(maxFileSize, maxFilesScan int64) *Guardrails
NewGuardrails returns a Guardrails with defaults applied for any non-positive limit.
type OutputEnvelope ¶
type OutputEnvelope struct {
Policy OutputPolicy `json:"policy"`
Content string `json:"content"`
Status string `json:"status,omitempty"`
RenderedItems int `json:"rendered_items"`
ReportPrefix string `json:"report_prefix,omitempty"`
ReportSuffix string `json:"report_suffix,omitempty"`
}
OutputEnvelope carries the content and policy through output actions.
type OutputPolicy ¶
type OutputPolicy struct {
Mode string `json:"mode"`
SaveState bool `json:"save_state"`
Path string `json:"path"`
Copy bool `json:"copy"`
Quiet bool `json:"quiet"`
JSON bool `json:"json"`
TrailingNewline bool `json:"trailing_newline"`
StartedAt int64 `json:"started_at"`
}
OutputPolicy describes the already-resolved output behavior. Actions execute the selected operation; they do not choose which operations are appropriate.
type PackConfig ¶
type PackConfig struct {
Targets []string `json:"targets" cli:"targets,target,t"`
Files []string `json:"files" cli:"files,file,f"`
TargetProfiles map[string]string `json:"target_profiles"`
TargetExcludes map[string]string `json:"target_excludes"`
TargetPrompts map[string]string `json:"target_prompts"`
// Remote materialization keeps filesystem roots separate from stable labels.
TargetRoots map[string]string `json:"target_roots,omitempty"`
TargetLabels map[string]string `json:"target_labels,omitempty"`
Ext string `json:"ext" cli:"ext"`
Tests bool `json:"tests" cli:"tests"`
NoTests bool `json:"no_tests" cli:"no-tests"`
NoGenerated bool `json:"no_generated" cli:"no-generated"`
NoDeps bool `json:"no_deps" cli:"no-deps"`
NoExamples bool `json:"no_examples" cli:"no-examples"`
Examples []string `json:"examples"`
Comments bool `json:"comments" cli:"comments"`
OnlySig bool `json:"only_sig" cli:"only-sig"`
Dense bool `json:"dense" cli:"dense"`
Mask bool `json:"mask" cli:"mask"`
MaxLines int `json:"max_lines" cli:"max-lines"`
MaxLinesHead int `json:"max_lines_head"`
MaxLinesTail int `json:"max_lines_tail"`
TrimBlankLines bool `json:"trim_blank_lines" cli:"trim-blank-lines"`
TrimIndent bool `json:"trim_indent" cli:"trim-indent"`
ExportedOnly bool `json:"exported_only" cli:"exported-only"`
Exclude string `json:"exclude" cli:"exclude,x"`
Prompt string `json:"prompt" cli:"prompt"`
Editor string `json:"editor" cli:"editor,e"`
Output string `json:"output" cli:"o,output"`
Copy bool `json:"copy" cli:"copy,c"`
NoCopy bool `json:"no_copy" cli:"no-copy"`
TreeOnly bool `json:"tree_only" cli:"tree-only"`
FullTree bool `json:"full_tree" cli:"full-tree"`
Depth int `json:"depth" cli:"depth,L"`
Changed bool `json:"changed" cli:"changed,m"`
Since string `json:"since" cli:"since"`
Modified bool `json:"modified"`
Staged bool `json:"staged"`
DiffOnly bool `json:"diff_only"`
DiffContent string `json:"diff_content"`
Quiet bool `json:"quiet" cli:"quiet,q"`
Color string `json:"color" cli:"color"`
CostROI bool `json:"cost"`
DirPrefix bool `json:"dir_prefix"`
NoHeader bool `json:"no_header"`
NoPrompt bool `json:"no_prompt"`
NoStart bool `json:"no_start"`
NoEnd bool `json:"no_end"`
MaxFileSize int64 `json:"max_file_size"`
MaxFilesScan int64 `json:"max_files_scan"`
DenseOverride *bool `json:"dense_override"`
OnlySigOverride *bool `json:"only_sig_override"`
CommentsOverride *bool `json:"comments_override"`
NoTestsOverride *bool `json:"no_tests_override"`
}
type PackStats ¶
type PackStats struct {
FileCount int
FuncCount int
PackedBytes int64
RawBytes int64
EstimatedTokens int64
}
PackStats is the shared aggregate contract for terminal summaries and rendered-document placeholders. AggregatePackStats remains the Go reference for NFlow-fold parity and the fallback used by legacy stream callers.
func AggregatePackStats ¶
func AggregatePackStats(files []ParsedFile) PackStats
AggregatePackStats computes the totals for files that contribute content to a pack. Omitted files and empty signature-only results are intentionally excluded, matching both the terminal summary and document header behavior.
func (PackStats) SavedPercent ¶
SavedPercent returns the fraction of raw input bytes removed by packing. Zero-sized input reports 0, preserving the existing summary semantics.
type ParseOptions ¶
type ParsedFile ¶
type RenderConfig ¶
type RenderConfig struct {
Editor string `json:"editor"`
Prompt string `json:"prompt"`
Start string `json:"start"`
End string `json:"end"`
FileStart string `json:"file_start"`
FileEnd string `json:"file_end"`
ProfileName string `json:"profile_name"`
Targets string `json:"targets"`
Dirs string `json:"dirs"`
OutputFile string `json:"output_file"`
PromptName string `json:"prompt_name"`
GitCommit string `json:"git_commit"`
GitTag string `json:"git_tag"`
GitBranch string `json:"git_branch"`
CurrentDate string `json:"current_date"`
Directory string `json:"directory"`
DiffContent string `json:"diff_content"`
NoHeader bool `json:"no_header"`
NoPrompt bool `json:"no_prompt"`
NoStart bool `json:"no_start"`
NoEnd bool `json:"no_end"`
Tree bool `json:"tree"`
FullTree bool `json:"full_tree"`
TreeFiles bool `json:"tree_files"`
TreeDepth string `json:"tree_depth"`
}
RenderConfig controls srcpack.render. Fields with no JSON tag left in the struct are intentionally absent: this operator receives its values from CLI modifiers, and modifier values are strings. Bool fields use bare modifiers (:no_header); string fields use :k="v".
type SaveStateConfig ¶
type SaveStateConfig struct {
Enabled *bool `json:"enabled"`
}
func (*SaveStateConfig) UnmarshalJSON ¶
func (cfg *SaveStateConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts Flow modifier boolean strings as well as JSON booleans.
type StateCache ¶
type StateCache struct {
LastRun time.Time `json:"last_run"`
Files map[string]FileState `json:"files"`
}
StateCache is the on-disk form of the incremental cache.
func LoadState ¶
func LoadState(path string) *StateCache
LoadState reads the cache from path. A missing or unreadable file returns (nil, nil) — the cache is best-effort, never authoritative. A corrupt file is also treated as absent.
type StatsCollectConfig ¶
type StatsCollectConfig struct {
TreeOnly bool `json:"tree_only" cli:"tree-only"`
CommandLine string `json:"command_line"`
FullTree bool `json:"full_tree" cli:"full-tree"`
TreeFiles bool `json:"tree_files" cli:"tree-files"`
Depth string `json:"depth" cli:"depth"`
Quiet bool `json:"quiet" cli:"quiet"`
Color string `json:"color" cli:"color"`
Profile string `json:"profile" cli:"profile"`
Targets string `json:"targets" cli:"targets"`
Prompt string `json:"prompt" cli:"prompt"`
Editor string `json:"editor" cli:"editor"`
Directory string `json:"directory" cli:"directory"`
Output string `json:"output" cli:"output"`
Clipboard string `json:"clipboard" cli:"clipboard"`
StartedAt string `json:"started_at" cli:"started-at"`
ShowCost bool `json:"cost" cli:"cost"`
Pricing []map[string]any `json:"pricing"`
}
Source Files
¶
- astparse_op.go
- astparse_op_dense.go
- astparse_op_mask.go
- clipboard_op.go
- constants.go
- document_input.go
- expand.go
- git_actions.go
- guardrails.go
- join_op.go
- library.go
- operator_types.go
- output_actions.go
- pack_batch.go
- pack_stats.go
- pack_stats_envelope.go
- pack_stats_fold.go
- pack_stats_input.go
- render_op.go
- savestate_op.go
- source_filter.go
- source_op.go
- source_repo.go
- state.go
- stats_op.go
- stdout_op.go
- tree.go