Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ run-code [OPTIONS] TOOLCHAIN[@VERSION]
run-code skill
```

- `TOOLCHAIN[@VERSION]`: Select a language and optional version. Supported toolchains are `python`, `node`, `rust`, `go`, and `dotnet`; `csharp` and `cs` are aliases for `dotnet`.
- `TOOLCHAIN[@VERSION]`: Select a language and optional version. Supported toolchains are `python`, `node`, `rust`, `go`, and `dotnet`; `javascript` and `typescript` are aliases for `node`, while `csharp` and `cs` are aliases for `dotnet`.
- `-p, --package SPEC`: Add a temporary dependency. Repeat the option to install multiple packages. Specs follow each ecosystem: Python uses `NAME==VERSION`; Node, Rust, Go, and .NET use `NAME@VERSION`. Rust also supports `NAME[@VERSION][FEATURE,...]`, such as `'tokio@1[full]'`.
- `--commonjs`: Run Node code as CommonJS. The default is ESM with top-level `await` support.
- `--clean`: Delete the generated project after execution. Without this option, the project is retained and its path appears in the displayed command.
Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ run-code [OPTIONS] TOOLCHAIN[@VERSION]
run-code skill
```

- `TOOLCHAIN[@VERSION]`:选择语言及版本。支持 `python`、`node`、`rust`、`go` 和 `dotnet`;`csharp`、`cs` 是 `dotnet` 的别名,版本可以省略。
- `TOOLCHAIN[@VERSION]`:选择语言及版本。支持 `python`、`node`、`rust`、`go` 和 `dotnet`;`javascript`、`typescript` 是 `node` 的别名,`csharp`、`cs` 是 `dotnet` 的别名,版本可以省略。
- `-p, --package SPEC`:添加临时依赖,可重复使用以安装多个包。依赖格式遵循对应生态;Python 版本使用 `NAME==VERSION`,Node、Rust、Go 和 .NET 使用 `NAME@VERSION`。Rust 还支持 `NAME[@VERSION][FEATURE,...]`,例如 `'tokio@1[full]'`。
- `--commonjs`:让 Node 以 CommonJS 方式运行;默认使用支持顶层 `await` 的 ESM。
- `--clean`:运行结束后删除临时项目;不指定时保留项目,默认输出的执行命令中会包含项目路径。
Expand Down
2 changes: 1 addition & 1 deletion skills/run-code-snippet/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CODE
'@ | run-code TOOLCHAIN[@VERSION] [--package SPEC ...] [--commonjs] [--clean] [--quiet]
```

使用 `python`、`node`、`rust`、`go` 或 `dotnet`;`csharp` 和 `cs` 是 `dotnet` 的别名。省略版本时使用内置的最新稳定版本。Python 依赖版本使用 `NAME==VERSION`;Rust 依赖可用 `NAME[@VERSION][FEATURE,...]` 指定 Cargo features;.NET 依赖使用 NuGet 的 `NAME[@VERSION]`。Node 默认以 ESM 统一运行 JavaScript/TypeScript,仅在代码明确依赖 CommonJS 时添加 `--commonjs`。C# 使用 .NET 10+ file-based app。Python 和 Node 未指定 `--package` 时直接执行且不创建项目;指定依赖时才创建隔离项目。需要项目时默认保留;仅在明确只需一次结果时添加 `--clean`,仅需代码本身的输出时添加 `--quiet`。直接调用工具,不自行创建项目或检查运行环境。
使用 `python`、`node`、`rust`、`go` 或 `dotnet`;`javascript` 和 `typescript` 是 `node` 的别名,`csharp` 和 `cs` 是 `dotnet` 的别名。省略版本时使用内置的最新稳定版本。Python 依赖版本使用 `NAME==VERSION`;Rust 依赖可用 `NAME[@VERSION][FEATURE,...]` 指定 Cargo features;.NET 依赖使用 NuGet 的 `NAME[@VERSION]`。Node 默认以 ESM 统一运行 JavaScript/TypeScript,仅在代码明确依赖 CommonJS 时添加 `--commonjs`。C# 使用 .NET 10+ file-based app。Python 和 Node 未指定 `--package` 时直接执行且不创建项目;指定依赖时才创建隔离项目。需要项目时默认保留;仅在明确只需一次结果时添加 `--clean`,仅需代码本身的输出时添加 `--quiet`。直接调用工具,不自行创建项目或检查运行环境。

## Examples

Expand Down
12 changes: 10 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ impl FromStr for ToolchainSpec {
};
let kind = match name {
"python" | "py" => ToolchainKind::Python,
"node" => ToolchainKind::Node,
"node" | "javascript" | "typescript" => ToolchainKind::Node,
"rust" => ToolchainKind::Rust,
"go" => ToolchainKind::Go,
"dotnet" | "csharp" | "cs" => ToolchainKind::Dotnet,
_ => {
return Err(format!(
"unsupported toolchain {name:?}; expected python, node, rust, go, or dotnet"
"unsupported toolchain {name:?}; expected python, node, javascript, typescript, rust, go, or dotnet"
));
}
};
Expand Down Expand Up @@ -215,4 +215,12 @@ mod tests {
"dotnet@10"
);
}

#[test]
fn language_names_alias_to_node() {
for alias in ["javascript", "typescript"] {
let spec = format!("{alias}@20").parse::<ToolchainSpec>().unwrap();
assert_eq!(spec.display(), "node@20");
}
}
}