Nexss Flow 🌀 ready
srcpack turns selected source code into one focused, AI-ready context. It can combine local folders, files, and public GitHub source in a single command, with a different detail profile for each selection. Use it to map a project, prepare a code review, or give an AI a clean slice of code without copying files by hand. It reads source; it does not rewrite it.
Tagged releases include prebuilt archives and installers. If a tag does not have release assets yet, use the Go install fallback below.
Linux or macOS:
curl -fsSL https://github.com/nexssp/srcpack/releases/latest/download/install.sh | shWindows PowerShell:
irm https://github.com/nexssp/srcpack/releases/latest/download/install.ps1 | iexThe installers verify the downloaded archive against the release's SHA-256 checksum file, install without administrator privileges, and support a pinned version and custom install directory. The checksum detects download corruption; it is not a publisher signature.
The binary installers install the srcpack CLI, not agent-specific instructions. If your AI agent supports Agent Skills, use either option:
- Run
srcpack skill(if supported by your installed CLI) to get links matching that CLI version. - View the current skill on GitHub or download the raw
SKILL.mddirectly. These URLs followmain; use the command when you need a version-matched skill and your CLI supports it.
Add the downloaded SKILL.md according to your AI agent's instructions. The skill is optional and separate from the CLI.
If you prefer to install from source, or a release does not offer a prebuilt installer for your platform, use Go 1.27.4 or newer, as required by this release's go.mod:
go install github.com/nexssp/srcpack/cmd/srcpack@latestMake sure srcpack is on your PATH, then run it from any project you want to inspect. No config file or srcpack init is needed:
cd /path/to/your/project
srcpack ".#arch"
srcpack cookbooksrcpack ".#arch" creates a quick architecture map and copies the complete rendered package to the clipboard by default when no destination is set. Use --no-copy or --stdout to print it to stdout, or -o FILE to save it. Previews are off by default and can be requested with --preview when copying. --stdout cannot be combined with -o FILE.
srcpack cookbook prints practical, copy-and-paste examples for selectors, line slices, Git changes, saved views, and configuration in a colorized terminal layout. Use srcpack cookbook --md to print the cookbook as pure Markdown without terminal styling or banners.
Each quoted selector contributes to the same context package. Local paths are relative to your current working directory: ./bundles/pack is inside it, while ../flow/compiler is in its parent directory. In this example, run from a local srcpack checkout with a Flow checkout alongside it; replace either local path with folders from your own workspace.
srcpack \
"./bundles/pack#impl" \
"../flow/compiler#api" \
"github:nexssp/flow//compiler?ref=v0.70.0#arch" \
"github:nexssp/kernel//action?ref=v0.37.0#api" \
-o combined-context.mdThat single command combines two local folders and two selected folders from public GitHub repositories. Each selector gets its own profile, so you can keep the context broad for one part and detailed for another. srcpack works with any public GitHub repository; the examples here use Nexss repos because they’re easy to try together.
A selector has this form:
<local-path-or-github-source>[~exclude-patterns][#profile][@prompt]
Quote each selector in your shell. Paths can be directories, files, comma-separated local paths, or supported file line ranges. Remote selectors use github:OWNER/REPO, optionally followed by a selected path and a ref:
github:OWNER/REPO[//PATH][?ref=REF]
An explicit ?ref= always takes precedence. When omitted, srcpack uses only matching, unambiguous version evidence from the current project: Go module release tags; JavaScript/TypeScript Git dependencies pinned by package-lock.json (or, without a lockfile, an explicit commit or refs/tags/... in package.json); Rust Git dependency commits from locked, offline Cargo metadata; PHP Git source commits in composer.lock; and exact versioned NFlow @require declarations when their Go module/tag mapping is unambiguous. It does not turn registry package versions, semver ranges, Composer dist archives, moving branches, or @nflow_version into Git refs. Unavailable or malformed metadata contributes no pin; if there is no other reliable matching pin, or matching evidence conflicts or cannot be resolved safely, srcpack uses the repository’s default revision. The lookups do not install/update dependencies or edit manifests or lockfiles; Go uses go list -m -json -mod=readonly, and Cargo uses cargo metadata --locked --offline. pack --json includes a remote_sources array with resolution strategy, ecosystem/package details, resolved ref, and fetched commit; Go and NFlow entries also include module path/version. Non-quiet human-readable runs report the same provenance on stderr. Remote source is fetched temporarily for the command; no separate clone is needed. Git must be installed, and remote repositories must be public. Private-repository credentials are not forwarded. Run srcpack cookbook for examples and limitations.
GitHub source selection defaults to auto: without an explicit ?ref=, srcpack uses a nearby checkout only when its Git origin matches the github:OWNER/REPO selector, otherwise it fetches the repository. --source-mode remote always fetches; --source-mode local requires one unambiguous matching checkout and never falls back. You can also set source_mode: auto, local, or remote in nexss.srcpack.yml; the CLI flag overrides that setting. In auto, an explicit ?ref= always goes to GitHub; local rejects explicit refs. Provenance distinguishes the requested mode from the source actually used and, for local content, reports the checkout path, commit, branch, and clean/dirty status (plus the number of changed paths within the selected source).
Directory selectors include files from that folder recursively, while the summary tree shows the selected folder as one top-level entry at the default depth. Increase --tree-depth to show additional levels under every selected folder, or append /... to expand just one folder recursively in the summary. This changes only the tree display, not which files are packed; Windows paths can use \... as the suffix.
srcpack "../flow#source" "../../nexss_ecosystem/kernel#arch" "../../nexss_ecosystem/transport#arch"
srcpack "../../nexss_ecosystem/kernel/...#arch" "../flow#source"Profiles control how much source goes into the package. These descriptions match the built-in definitions:
| Profile | What it includes | Good for |
|---|---|---|
arch |
Exported declarations and signatures; no bodies or comments. | Mapping a project’s public structure. |
api |
Exported declarations and signatures with comments; no bodies. | Reviewing public interfaces and API docs. |
impl |
Implementation bodies, with comments stripped by default. | Inspecting a focused implementation. |
source |
Selected source with bodies and comments; tests are omitted. | Reading implementation details. |
with-tests |
Source and tests, including comments. | Understanding behavior alongside implementation. |
compact |
Trimmed exported signatures, without bodies or comments. | Keeping structural context small. |
dense |
Exported signatures in compressed, signature-oriented output; no bodies or comments. | Very compact structural context. |
Signature extraction is supported for these languages and file extensions:
| Language | Extensions |
|---|---|
| Go | .go |
| JavaScript | .js, .jsx, .mjs, .cjs |
| TypeScript | .ts, .tsx |
| Python | .py |
| Rust | .rs |
| PHP | .php |
| Svelte | .svelte |
| Vue | .vue |
| Zig | .zig |
The JavaScript signature extractor recognizes ECMAScript export declarations; CommonJS module.exports and exports.* patterns may not produce signatures. If a signature profile reports that no JavaScript signatures were emitted, use #source to include full file bodies. Signature extraction is parser-specific; the table describes languages with supported signature extraction, not every source language that can be packed as text.
Directory scans using source, impl, or with-tests include recognized source-code extensions by default; documentation and configuration files are excluded. Use an explicit file selector or --ext to include another extension. Generated and dependency files, along with example directories, are also skipped by default. source means full selected non-test source, not every file in a repository. Use srcpack list to see built-in profiles and srcpack info NAME to inspect one. A selector’s #profile can be mixed with other profiles in the same command; -p/--profile supplies a default for the whole run.
Use --include-config when a code map needs build, tooling, or CI context. It adds curated config and manifest files as raw text, with detected secret-like values masked; .env variants and common credential/private-key files remain excluded, even when explicitly selected. This option does not add documentation files. Secret masking is enabled by default; --mask/--mask-secrets keep it on, while --no-mask disables it. Masking is best-effort, not a guarantee that arbitrary secrets will be detected. A genuinely sliced file includes its inclusive 1-based source range in the path header, such as ## internal/auth/service.go:80-140; whole files keep the clean ## internal/auth/service.go header, and one-line slices use :N. The range is available as ${SOURCE_RANGE} in custom file_start templates. Structured source records retain complete line_spans, symbol_spans, and commit-pinned source_url provenance; ${SOURCE_URL} is available to custom templates that need a clickable citation. Coordinates are per-file, never positions in the concatenated pack. GitHub links keep their required #Lx-Ly anchor syntax. Go signature profiles also include original declaration spans in symbols.
Each pack selection is limited to 512 included files and, by default, about 1.1 million estimated source tokens. --max-tokens can raise the token estimate limit; the file-count limit is fixed. These guardrails limit selected input but are not a hard process-memory ceiling, so keep very large selections narrow.
Run these from a local srcpack checkout. Replace local folders with the ones in your workspace. Commands 1–20 work without nexss.srcpack.yml.
| # | Command | Use it to… |
|---|---|---|
| 1 | srcpack ".#arch" |
Map the current project. |
| 2 | srcpack ".#api" |
See public signatures with comments. |
| 3 | srcpack "bundles/pack#impl" |
Inspect srcpack’s pack implementation. |
| 4 | srcpack "nflows#source" |
Read the NFlow pipelines in full. |
| 5 | srcpack "bundles/pack#with-tests" |
Include pack tests with its source. |
| 6 | srcpack "README.md#source" "go.mod#source" |
Package specific files together. |
| 7 | srcpack "bundles/pack,nflows#arch" |
Map multiple directories at once. |
| 8 | srcpack "bundles/pack#arch" "nflows#source" |
Mix detail levels in one result. |
| 9 | srcpack "bundles/pack~*_test.go#impl" |
Exclude matching test files. |
| 10 | srcpack "bundles/pack#impl" --prompt "Review input validation and errors." |
Add a one-off prompt to the rendered context. |
| 11 | srcpack tree "bundles/pack" |
Inspect the selected directory tree. |
| 12 | srcpack tree "bundles/pack" --tree-files |
Show file names in the tree. |
| 13 | srcpack ".#arch" --modified |
Include changed and untracked local files. |
| 14 | srcpack ".#arch" --staged |
Include staged local changes. |
| 15 | srcpack ".#arch" --since HEAD~3 |
Select local changes since a Git ref. |
| 16 | srcpack ".#impl" --modified --diff-only |
Add the local diff to changed source. |
| 17 | srcpack "nflows#source" -o nflows-context.md |
Save the result to a file. |
| 18 | srcpack "bundles/pack#arch" --stdout |
Print the full rendered result to stdout. |
| 19 | srcpack pack "bundles/pack#arch" --plan |
Preview selectors and destination before scanning. |
| 20 | srcpack "./bundles/pack#impl" "../flow/compiler#api" "github:nexssp/flow//compiler?ref=v0.70.0#arch" "github:nexssp/kernel//action?ref=v0.37.0#api" -o combined-context.md |
Combine current, parent, and remote project code. |
These cover common one-off tasks: understand a project, inspect an API, focus on one implementation, include tests, filter changed files, compare local and remote code, and choose where the context goes.
Once a one-off selector is useful, save it as a named view. This writes config so you can reuse the selection later; it’s optional.
srcpack "./bundles/pack#impl" "../flow/compiler#api" --save-view flow-review
srcpack flow-review
srcpack view list
srcpack view show flow-reviewRun srcpack init when you want reusable workspace configuration such as named targets, prompts, editors, or profiles. srcpack doctor checks that configuration. Run srcpack --help for the command reference, srcpack cookbook for practical workflows, or read the selector cheat sheet and cookbook source.
