feat: initialize AI agent harness

This commit is contained in:
2026-08-06 12:27:34 +09:00
commit 358d83df57
38 changed files with 34045 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
@echo off
setlocal
set "SCRIPT_DIR=%~dp0"
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%agent-harness.ps1" %*
exit /b %ERRORLEVEL%

33
scripts/agent-harness.ps1 Normal file
View File

@@ -0,0 +1,33 @@
[CmdletBinding()]
param(
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $HarnessArguments
)
$ErrorActionPreference = 'Stop'
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$harnessRoot = Split-Path -Parent $scriptRoot
$entryPoint = Join-Path $harnessRoot 'dist\cli.cjs'
if (-not (Test-Path -LiteralPath $entryPoint -PathType Leaf)) {
throw "Harness entry point not found: $entryPoint"
}
$nodeCommand = Get-Command node -ErrorAction SilentlyContinue
if ($null -eq $nodeCommand) {
throw 'Node.js 20 or newer is required.'
}
$nodeVersionText = (& $nodeCommand.Source --version).TrimStart('v')
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$nodeVersion = [Version] $nodeVersionText
if ($nodeVersion.Major -lt 20) {
throw "Node.js 20 or newer is required. Found: $nodeVersionText"
}
& $nodeCommand.Source $entryPoint @HarnessArguments
exit $LASTEXITCODE

33
scripts/build.mjs Normal file
View File

@@ -0,0 +1,33 @@
import { chmod, rm } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { build } from "esbuild";
const harnessRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
await rm(path.join(harnessRoot, "dist"), { recursive: true, force: true });
const common = {
absWorkingDir: harnessRoot,
bundle: true,
platform: "node",
target: "node20",
format: "cjs",
legalComments: "eof",
sourcemap: false,
};
await Promise.all([
build({
...common,
entryPoints: [path.join(harnessRoot, "src", "cli.ts")],
outfile: path.join(harnessRoot, "dist", "cli.cjs"),
banner: { js: "#!/usr/bin/env node" },
}),
build({
...common,
entryPoints: [path.join(harnessRoot, "src", "index.ts")],
outfile: path.join(harnessRoot, "dist", "index.cjs"),
}),
]);
await chmod(path.join(harnessRoot, "dist", "cli.cjs"), 0o755);