文件最后提交记录最后更新时间
2 天前
2 天前
2 天前
2 天前
2 天前
2 天前
2 天前
2 天前
1 天前
2 天前
README.md

AutoShip for Visual Studio Code

English | 中文 | 日本語

A thin VS Code extension that wires the autoship CLI into the editor: live diagnostics through the AutoShip language server, on-save hooks, and a command palette for the most common operations (clean, verify, commit, run hook, open config, restart server).

The extension does not reimplement any AutoShip logic — it launches the existing autoship CLI as the LSP server (autoship lsp) and as subprocesses in the integrated terminal. Upgrade AutoShip, and the extension picks up the new behaviour automatically.


English

Features

  • Live diagnostics — the AutoShip language server publishes verify diagnostics as you edit and on save.
  • On-save hooks[hooks] on_save entries (clean / verify / custom commands) are run by the LSP server on textDocument/didSave, with debounce and glob filtering identical to the CLI.
  • Command paletteAutoShip: Clean, AutoShip: Verify (current file), AutoShip: Commit, AutoShip: Run On-Save Hook, AutoShip: Show Status, AutoShip: Open Config, AutoShip: Restart Language Server.
  • Status bar — a single item reflects the language client state (starting / running / stopped); click to restart.
  • Config editorAutoShip: Open Config opens .autoship.toml (or .autoship.team.toml) in the workspace, or offers to scaffold one via autoship init.
  • uv workspace aware — when the workspace has a pyproject.toml mentioning autoship and uv is on PATH, the extension automatically invokes uv run autoship so it works inside the repo's own uv workspace without a global install.

Requirements

  • VS Code 1.80 or newer.
  • The autoship CLI on PATH, or a uv workspace with autoship as a member, or an explicit path set in autoship.cliPath.

Installation

From source (development)

cd editors/vscode
npm install
npm run compile
# Press F5 in VS Code to launch an Extension Development Host with the extension loaded.

Packaged .vsix

cd editors/vscode
npm install
npm run compile
npx vsce package    # produces autoship-0.1.0.vsix
code --install-extension autoship-0.1.0.vsix

Configuration

Open Settings → Extensions → AutoShip or edit settings.json directly:

Setting Default Description
autoship.cliPath "" Path to the autoship executable. Leave empty to use autoship from PATH (or uv run autoship if a uv project is detected).
autoship.useUv false Invoke uv run autoship instead of bare autoship. Auto-detected when a pyproject.toml with the autoship workspace is present.
autoship.enableLSP true Start the AutoShip language server for diagnostics and on-save hooks.
autoship.enableStatusBar true Show a status bar item with the current AutoShip server status.
autoship.trace.server "off" Trace the LSP communication with the AutoShip language server (off / messages / verbose).

Commands

Command Description
AutoShip: Clean Run autoship clean --yes in the integrated terminal.
AutoShip: Verify Run autoship verify against the active Python file.
AutoShip: Commit Run autoship commit (interactive) in the integrated terminal.
AutoShip: Run On-Save Hook Run autoship hooks run --file <active file>.
AutoShip: Show Status Show the current language server state.
AutoShip: Open Config Open (or create) .autoship.toml in the workspace.
AutoShip: Restart Language Server Stop and restart the AutoShip language server.

How it works

┌──────────────┐  stdio (JSON-RPC 2.0)   ┌──────────────────┐
│  VS Code     │  ─────────────────────▶  │  autoship lsp    │
│  extension   │                          │  (LSP server)    │
│  (LSP client)│  ◀─────────────────────  │                  │
└──────────────┘   publishDiagnostics     └──────────────────┘
        │                                          │
        │ subprocess (terminal)                    │ subprocess
        ▼                                          ▼
┌──────────────────┐                    ┌──────────────────┐
│  autoship clean  │                    │  autoship verify │
│  / verify /      │                    │  (per didSave)   │
│  commit / hooks  │                    └──────────────────┘
└──────────────────┘

The extension is intentionally thin: every diagnostic, every hook, every clean rule comes from the CLI. The extension only adds the editor glue.

Troubleshooting

  • Diagnostics never appear: ensure autoship lsp starts on its own (autoship lsp then send Content-Length-framed JSON-RPC). Check autoship.trace.server for protocol errors.
  • AutoShip: Verify does nothing: the command requires an active Python editor; open one and retry.
  • uv run autoship not found: install uv (pip install uv) or set autoship.useUv to false and put autoship on PATH.

License

MIT, same as the AutoShip CLI.


中文

功能

  • 实时诊断 —— AutoShip 语言服务器在编辑和保存时发布 verify 诊断。
  • 保存钩子 —— LSP 服务器在 textDocument/didSave 时执行 [hooks] on_save 条目(clean / verify / 自定义命令),防抖与 glob 过滤与 CLI 完全一致。
  • 命令面板 —— AutoShip: CleanAutoShip: Verify(当前文件)、AutoShip: CommitAutoShip: Run On-Save HookAutoShip: Show StatusAutoShip: Open ConfigAutoShip: Restart Language Server
  • 状态栏 —— 单一项目反映语言客户端状态(启动中 / 运行中 / 已停止),点击重启。
  • 配置编辑器 —— AutoShip: Open Config 打开工作区中的 .autoship.toml(或 .autoship.team.toml),或通过 autoship init 创建。
  • 感知 uv workspace —— 当工作区中的 pyproject.toml 引用 autoship 且 uvPATH 上时,扩展自动切换为 uv run autoship,无需全局安装即可在本仓库的 uv workspace 内运行。

安装(从源码开发)

cd editors/vscode
npm install
npm run compile
# 在 VS Code 中按 F5 启动扩展开发宿主。

配置

打开 设置 → 扩展 → AutoShip,或直接编辑 settings.json

设置 默认值 说明
autoship.cliPath "" autoship 可执行文件路径。留空则使用 PATH 上的 autoship(或检测到 uv 工程时使用 uv run autoship)。
autoship.useUv false 调用 uv run autoship 而非裸 autoship。检测到 autoship 的 uv workspace 时自动启用。
autoship.enableLSP true 启动 AutoShip 语言服务器以获取诊断与保存钩子。
autoship.enableStatusBar true 显示反映服务器状态的状态栏项。
autoship.trace.server "off" 跟踪与语言服务器的 LSP 通信(off / messages / verbose)。

工作原理

扩展非常薄:所有诊断、所有钩子、所有 clean 规则都来自 CLI,扩展只负责编辑器侧的胶水代码。语言服务器通过 autoship lsp 启动并经 stdio 走 JSON-RPC 2.0;clean / verify / commit / hooks run 在集成终端中以子进程方式运行,保留交互能力(如 commit 的编辑器)。

许可证

MIT,与 AutoShip CLI 一致。


日本語

機能

  • リアルタイム診断 —— AutoShip 言語サーバーが編集時および保存時に verify 診断を公開します。
  • 保存フック —— LSP サーバーが textDocument/didSave[hooks] on_save エントリ(clean / verify / カスタムコマンド)を実行します。デバウンスと glob フィルタは CLI と完全に同一です。
  • コマンドパレット —— AutoShip: CleanAutoShip: Verify(現在のファイル)、AutoShip: CommitAutoShip: Run On-Save HookAutoShip: Show StatusAutoShip: Open ConfigAutoShip: Restart Language Server
  • ステータスバー —— 言語クライアントの状態(起動中 / 実行中 / 停止済み)を反映する単一項目。クリックで再起動。
  • 設定エディタ —— AutoShip: Open Config がワークスペース内の .autoship.toml(または .autoship.team.toml)を開きます。存在しない場合は autoship init で作成を提案します。
  • uv ワークスペース対応 —— ワークスペースの pyproject.toml が autoship を参照し uvPATH にある場合、拡張は自動的に uv run autoship を使用します。グローバルインストールなしでリポジトリの uv ワークスペース内で動作します。

インストール(ソースから開発)

cd editors/vscode
npm install
npm run compile
# VS Code で F5 を押すと拡張開発ホストが起動します。

設定

設定 → 拡張 → AutoShip を開くか、settings.json を直接編集してください:

設定 デフォルト 説明
autoship.cliPath "" autoship 実行ファイルのパス。空欄なら PATHautoship(uv プロジェクト検出時は uv run autoship)を使用。
autoship.useUv false autoship の代わりに uv run autoship を呼び出します。autoship の uv ワークスペースを検出すると自動で有効化されます。
autoship.enableLSP true 診断と保存フックのための AutoShip 言語サーバーを起動します。
autoship.enableStatusBar true サーバー状態を示すステータスバー項目を表示します。
autoship.trace.server "off" 言語サーバーとの LSP 通信をトレースします(off / messages / verbose)。

ライセンス

MIT(AutoShip CLI と同一)。