vladstudio-pi-skim

内容来源:README.md(说明文档) · 原始地址 · 查看安装指南

原始内容

@vladstudio/pi-skim

Pi extension adding a skim tool: structural overview of JS/JSX/TS/TSX/Swift files — exports, signatures, hooks, behavior — via ast-grep, without reading full source.

Use instead of read when exploring code or understanding a file's purpose. Pass multiple paths to batch.

What it extracts

  • JS/TS: imports, exports (default/named/const/type/interface), private functions, React hooks (useX), behavior (component, 'use client'/'use server', fetch, async, useEffect, redirect, router.push, storage).
  • Swift: imports, exports (public/open/package), types (class/protocol/typealias/extension), members (functions/init/subscript/properties), behavior (await/async/throws/Task, SwiftUI, Combine).

Supported extensions

.js .jsx .mjs .cjs .ts .tsx .mts .cts .swift

Install

pi install npm:@vladstudio/pi-skim

Example

extensions/skim/index.ts

imports:
  {SgNode} from "@ast-grep/napi"
  {js, parse, registerDynamicLanguage, ts, tsx} from "@ast-grep/napi"
  swift from "@ast-grep/lang-swift"

exports:
  default: skimExtension(pi)
  skimExtension(pi)

behavior:
  React component (returns JSX)

License

MIT