← Catalog

@sting8k/pi-srcwalk

A thin Pi tool that runs the srcwalk CLI directly for structural code intelligence

Extension

Install

Install with PiG

pig install npm:@sting8k/pi-srcwalk

Install with Pi

pi install npm:@sting8k/pi-srcwalk
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./extensions/pi-srcwalk/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 2.0.0 (README.md). PiG does not review it.

pi-srcwalk

A thin Pi extension that exposes the srcwalk CLI as one agent tool. Pi sends a command, the extension spawns srcwalk directly without a shell, and the CLI output comes back unchanged.

Features

  • One srcwalk tool for discovery, source reads, callers/callees, dependencies, reviews, and other CLI commands.
  • Raw CLI output with no semantic wrapper or extension-level token cap.
  • Up to six independent commands per call, run with concurrency three and returned in input order.
  • Quote-aware arguments, abort/timeout support, clear exit errors, and no shell execution.
  • No runtime dependencies beyond Pi and the srcwalk CLI.

Installation

Requires Node.js 22.19 or newer and srcwalk on PATH.

npm install -g srcwalk
pi install npm:@sting8k/pi-srcwalk

Reload Pi after installation. For local development, load the checkout directly:

pi -e ./extensions/pi-srcwalk/index.ts

Usage

Ask Pi to inspect the repository as usual. The extension adds a first-class srcwalk tool and tells the agent to prefer it over shell text tools for code navigation.

A typical tool call looks like this:

srcwalk({ args: "context planBatch --scope src" })

Pass the CLI arguments only; a leading srcwalk is accepted but unnecessary. Useful commands include:

Taskargs
Learn the CLIguide
Orient in a repositoryoverview
Understand a symbolcontext planBatch --scope src
Find callerstrace callers planBatch --scope .
Find symbols or textdiscover planBatch --as symbol --scope src
Read exact sourceshow src/batch.ts:22-54
Inspect dependenciesdeps src/batch.ts
Review changesreview --staged

All commands run with Pi's open repository as the working directory. srcwalk bounds its own output with --budget (6000 tokens by default); use a smaller budget for broad requests and --no-budget only when full output is necessary.

Batch Commands

Send independent lookups as an array to avoid multiple tool turns:

srcwalk({
  args: [
    "context planBatch --scope src",
    "trace callers runBatch --scope .",
  ],
})

A batch accepts up to six commands, runs three at a time, and preserves input order. One failed command does not stop the others. Batch results use --- $ srcwalk <command> --- headers.

Arguments and Errors

Arguments are split into an argv array and passed directly to srcwalk; no shell is involved. Single and double quotes group values, backslashes escape characters, and malformed quotes or trailing backslashes are rejected.

Shell operators such as |, >, <, ;, and & are not supported. Use a batch array instead of chaining commands.

Non-zero exits are prefixed with [srcwalk exit N], while preserving stdout and stderr. Commands time out after 45 seconds and preserve partial output on timeout or cancellation. If srcwalk is not on PATH, the tool returns installation instructions.

Migrating from v1

Version 2 replaces semantic_query, semantic_grep, semantic_inspect, semantic_review, and semantic_show with the single srcwalk tool. It also removes the extension's semantic index, ranking, cache, routing, and output formatting layers; use the corresponding CLI commands shown above.

Older versions injected a semantic_* contract into Pi's prompt. Version 2 removes that stale block automatically.

License

MIT