# @valkyrie-language/vcc

> Valkyrie Compiler Collect shared host runner for assembled Legion and Asgard CLIs.

Latest version **0.0.2** (published 2026-09-24) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install @valkyrie-language/vcc
pnpm add @valkyrie-language/vcc
yarn add @valkyrie-language/vcc
bun add @valkyrie-language/vcc
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2026-09-24 |
| First published | 2026-09-23 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 30.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Maintainers | oovm |
| Keywords | valkyrie, vcc, compiler, legion, asgard, host-runner |

## Links

- npm: https://www.npmjs.com/package/@valkyrie-language/vcc
- Repository: https://github.com/valkyrie-language/valkyrie.rs
- Homepage: https://github.com/valkyrie-language/valkyrie.rs/tree/main/projects/packages/vcc#readme
- Issues: https://github.com/valkyrie-language/valkyrie.rs/issues
- npm.io page: https://npm.io/package/@valkyrie-language/vcc

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2026-09-24
- 0.0.0 (seed) — 2026-09-23
- 0.0.1 — 2026-09-24

## README

# @valkyrie-language/vcc

Shared **Valkyrie Compiler Collect (VCC) host runner** for assembled Node.js CLIs.

This package is a small library used by [`@valkyrie-language/legion`](../legion) and [
`@valkyrie-language/asgard`](../asgard). It resolves platform-specific native artifacts and WebAssembly collect entries,
then dispatches CLI execution (native first, Wasm fallback).

## Install

```bash
npm install @valkyrie-language/vcc
```

Most applications should install a CLI package instead:

```bash
npm install @valkyrie-language/legion
# or
npm install @valkyrie-language/asgard
```

## Requirements

- **Node.js** 20 or newer

## Usage

```js
import {createHostRunner, NATIVE_PACKAGES} from "@valkyrie-language/vcc";

const host = createHostRunner({
    wasmCollect: "@valkyrie-language/vcc-unknown-wasm32",
    wasmEntry: "legion.mjs",
});

// Programmatic entry (same routing as the `legion` bin)
host.runCli(process.argv.slice(2));

// Inspect routing
host.locateNativeCollect(); // path to vcc.<platform>.node or null
host.resolveWasmMjs();      // absolute path to legion.mjs in the wasm collect
```

### Benchmark (`@valkyrie-language/vcc/benchmark`)

对比参考实现（TypeScript 等同算法）与 `legion bench -t node`（V 编译为 Wasm + Wasm 运行）：

```js
import {benchmarkSync, createBenchmarkRunner, WASM_NODE_BENCH_TARGET} from "@valkyrie-language/vcc/benchmark";

const runner = createBenchmarkRunner({
    valkyrieRsRoot: "E:/victory 胜利女神/valkyrie.rs",
});

// TS 侧：benchmarkSync 包裹参考函数
const reference = benchmarkSync(() => solveInTypeScript(), {iterations: 2000});

// V 侧：legion bench -t node → compileMs + runtimeMs（Wasm 入口执行 [benchmark]）
const legion = runner.benchProject("./projects/problems/two-sum/solvers/valkyrie/two_sum", {
    runs: 3,
    target: WASM_NODE_BENCH_TARGET,
});
const comparison = runner.compareReference(reference.medianMs, legion);
```

| Export | Description |
|--------|-------------|
| `median` / `benchmarkSync` | 参考实现 median 毫秒采样 |
| `parseLegionBenchTable` / `aggregateLegionBenchRows` | 解析 `legion bench` stdout |
| `createBenchmarkRunner` | native / wasm Legion 路由 + `benchProject` + `compareReference` |
| `runBenchmarkEntry` / `runBenchmarkSuite` | catalog 批量对比（参考实现 + Legion） |

批量跑题集（如 leetcode / project-euler）：

```js
import {createBenchmarkRunner, runBenchmarkSuite} from "@valkyrie-language/vcc/benchmark";

const runner = createBenchmarkRunner({valkyrieRsRoot: process.env.VALKYRIE_RS_ROOT});
const report = runBenchmarkSuite(runner, catalog.map((p) => ({
    id: p.id,
    title: p.title,
    projectDir: p.path,
    measureReference: () => benchPython(p),
})), {runs: 3, target: "node"});
```

### Exports

| Export                           | Description                                                    |
|----------------------------------|----------------------------------------------------------------|
| `NATIVE_PACKAGES`                | Optional native collect package names (Windows, Linux, macOS). |
| `locateNativeCollect(packages?)` | Find an installed platform `.node` addon, or `null`.                |
| `resolveWasmMjs(collect, entry)` | Resolve the Wasm host script path inside a collect package.    |
| `createHostRunner(config)`       | Bind wasm collect settings and return `runCli` helpers.        |

## Related packages

| Package                     | Role                                                |
|-----------------------------|-----------------------------------------------------|
| `@valkyrie-language/legion` | Valkyrie compiler & workspace CLI                   |
| `@valkyrie-language/asgard` | Cross-platform GUI app framework CLI                |
| `@valkyrie-language/vcc-*`  | Platform collect packages (native / Wasm artifacts) |

## License

[MPL-2.0](https://www.mozilla.org/MPL/2.0/)

## Links

- [Repository](https://github.com/valkyrie-language/valkyrie.rs/tree/main/projects/packages/vcc)
- [Issues](https://github.com/valkyrie-language/valkyrie.rs/issues)

---
_Source: https://npm.io/package/@valkyrie-language/vcc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
