Skip to content
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
356 commits
Select commit Hold shift + click to select a range
4922208
Merge pull request #41 from dsarno/chore/ci-add-desktop-parity
dsarno Aug 21, 2025
5f080e0
CI: gate desktop-parity on Anthropic key; pass anthropic_api_key like…
dsarno Aug 21, 2025
0b423b5
Add quickprobe prompt and CI workflow (mcp-quickprobe.md, unity-mcp-q…
dsarno Aug 21, 2025
204b9fc
strictier tool use to prevent subagent spawning and force mcp tools
dsarno Aug 22, 2025
0c60f43
update workflow filesto reduce likelihood of subagent spawning
dsarno Aug 22, 2025
08911ed
improve permissions for claude agent, fix mcpbridge timeout/token issue
dsarno Aug 22, 2025
33c7aec
increase max turns to 10
dsarno Aug 22, 2025
b7478f0
ci: align NL suite to new permissions schema; prevent subagent drift
dsarno Aug 22, 2025
288f566
ci: NL suite -> mini prompt for e2e; add full NL/T prompt; server: ct…
dsarno Aug 22, 2025
47f3c7b
ci: add checks:write; revert local project hardcodes (manifest, Proje…
dsarno Aug 22, 2025
1be0f60
tools: text-edit routing fixes (anchor_insert via text, CRLF calc); p…
dsarno Aug 22, 2025
70ece54
ci: use absolute UNITY_PROJECT_ROOT; prompts target TestProjects; ser…
dsarno Aug 22, 2025
1f18340
ci: ignore Unity test project's packages-lock.json; remove from repo …
dsarno Aug 22, 2025
9bb0be8
CI: start persistent Unity Editor for MCP (guarded by license) + allo…
dsarno Aug 22, 2025
838eb75
CI: hide license and pass via env to docker; fix invalid ref format
dsarno Aug 22, 2025
5acb539
CI: readiness probe uses handshake on Unity MCP port (deterministic)
dsarno Aug 22, 2025
298e376
CI: fix YAML; use TCP handshake readiness probe (FRAMING=1)
dsarno Aug 22, 2025
3215593
CI: prime Unity license via game-ci; mount ULF into container; extend…
dsarno Aug 22, 2025
7f7505a
CI: use ULF write + mount for Unity licensing; remove serial/email/pa…
dsarno Aug 22, 2025
3905fcf
CI: entitlement activation (UNITY_SERIAL=''); verify host ULF cache; …
dsarno Aug 22, 2025
152b866
CI: write ULF from secret and verify; drop entitlement activation step
dsarno Aug 22, 2025
753c929
CI: detect any licensing path; GameCI prime; status dir env; log+prob…
dsarno Aug 22, 2025
a8c4297
CI: add GameCI license prime; conditional ULF write; one-shot license…
dsarno Aug 22, 2025
0732e92
CI: fix YAML (inline python), add Anthropic key detect via GITHUB_ENV…
dsarno Aug 22, 2025
1478aa7
CI: mount Unity token/ulf/cache dirs into container to share host lic…
dsarno Aug 22, 2025
62da1aa
CI: fix YAML indentation; write ULF on host; activate in container wi…
dsarno Aug 22, 2025
d96ea2e
CI: gate Claude via outputs; mount all Unity license dirs; fix inline…
dsarno Aug 22, 2025
307f489
CI: normalize detect to step outputs; ensure license dirs mounted and…
dsarno Aug 22, 2025
c908f8b
Bridge: honor UNITY_MCP_STATUS_DIR for heartbeat/status file (CI-frie…
dsarno Aug 22, 2025
8a456bd
CI: guard project path for activation/start; align tool allowlist; ru…
dsarno Aug 22, 2025
88545b0
CI: finalize Unity licensing mounts + status dir; mode-detect (ULF/EB…
dsarno Aug 22, 2025
6ab5d12
CI: fix YAML probe (inline python -c) and finalize happy-path Unity l…
dsarno Aug 22, 2025
36ea142
CI: inline python probe; unify Unity image and cache mounts; ready to…
dsarno Aug 22, 2025
ef99621
CI: fix docker run IMAGE placement; ignore cache find perms; keep sam…
dsarno Aug 22, 2025
9b923c3
CI: pass -manualLicenseFile to persistent Editor; keep mounts and sin…
dsarno Aug 23, 2025
e020cbc
CI: mount full GameCI cache to /root in persistent Unity; set HOME=/r…
dsarno Aug 23, 2025
0916ad2
CI: make -manualLicenseFile conditional; keep full /root mount and li…
dsarno Aug 23, 2025
9a37cc7
CI: set HOME=/github/home; mount GameCI cache there; adjust manualLic…
dsarno Aug 23, 2025
2a80d12
CI: EBL sign-in for persistent Unity (email/password/serial); revert …
dsarno Aug 23, 2025
db562c3
CI: run full NL/T suite prompt (nl-unity-suite-full.md) instead of mini
dsarno Aug 23, 2025
daca6cc
NL/T: require unified diffs + explicit verdicts in JUnit; CI: remove …
dsarno Aug 23, 2025
59e3326
NL/T prompt: require CDATA wrapping for JUnit XML fields; guidance fo…
dsarno Aug 23, 2025
9b772f6
CI: remove in-container license check step; keep readiness and full s…
dsarno Aug 23, 2025
7fa2da9
NL/T prompt: add version header, stricter JUnit schema, hashing/norma…
dsarno Aug 23, 2025
cb13713
CI: increase Claude NL/T suite timeout to 30 minutes
dsarno Aug 23, 2025
c629855
CI: pre-create reports dir and result files to avoid tool approval pr…
dsarno Aug 23, 2025
fc57303
CI: skip wait if container not running; skip Editor start if project …
dsarno Aug 23, 2025
33b7ef2
fixies to harden ManageScript
dsarno Aug 23, 2025
7acd551
CI: sanitize NL/T markdown report to avoid NUL/encoding issues
dsarno Aug 23, 2025
cecbb06
revert breaking yyaml changes
dsarno Aug 23, 2025
ef194ac
CI: prime license, robust Unity start/wait, sanitize markdown via her…
dsarno Aug 23, 2025
eeb5889
Merge branch 'CoplayDev:main' into main
dsarno Aug 24, 2025
dbc65a5
Merge branch 'fix/installer-cleanup-v2' into feat/pre-split-edit-fram…
dsarno Aug 25, 2025
9c53d7b
Resolve merge: accept upstream renames/installer (fix/installer-clean…
dsarno Aug 25, 2025
37acd71
Fix Claude Desktop config path and atomic write issues
dsarno Aug 25, 2025
2bf18be
Editor: use macConfigPath on macOS for MCP client config writes (Clau…
dsarno Aug 25, 2025
be38c04
Models: add macConfigPath to McpClient for macOS config path selectio…
dsarno Aug 25, 2025
5b7ab24
Editor: on macOS, prefer macConfigPath in ManualConfigEditorWindow (f…
dsarno Aug 25, 2025
a310091
Fix McpClient: align with upstream/main, prep for framing split
dsarno Aug 26, 2025
a7de7cc
NL suite: shard workflow; tighten bridge readiness; add MCP preflight…
dsarno Aug 26, 2025
20827e0
NL suite: fix shard step indentation; move shard vars to env; remove …
dsarno Aug 26, 2025
d32fbb5
MCP clients: split VSCode Copilot config paths into macConfigPath and…
dsarno Aug 26, 2025
d637c58
Unity bridge: clean stale status; bind host; robust wait probe with I…
dsarno Aug 26, 2025
8837cf9
CI: use MCPForUnity.Editor.MCPForUnityBridge.StartAutoConnect as exec…
dsarno Aug 26, 2025
92b57c0
Action wiring: inline mcpServers in settings for all shards; remove r…
dsarno Aug 26, 2025
84e412d
CI: embed mcpServers in settings for all shards; fix startup sanity s…
dsarno Aug 26, 2025
70ac26d
CI: pin claude-code-base-action to e6f32c8; use claude_args --mcp-con…
dsarno Aug 26, 2025
3b4ff21
CI: unpin claude-code-base-action to @beta (commit ref not found)
dsarno Aug 26, 2025
798db05
CI: align with claude-code-base-action @beta; pass MCP via claude_arg…
dsarno Aug 26, 2025
3ad1caf
Editor: Fix apply_text_edits heuristic when edits shift positions; re…
dsarno Aug 26, 2025
5c62b40
CI: unify MCP wiring across workflows; write .claude/mcp.json; switch…
dsarno Aug 26, 2025
1bda497
CI: collapse NL suite shards into a single run to avoid repeated test…
dsarno Aug 26, 2025
2d9a83f
CI: minimize allowedTools for NL suite to essential Unity MCP + Bash(…
dsarno Aug 26, 2025
87e69f0
CI: mkdir -p reports before run; remove unsupported --timeout-minutes…
dsarno Aug 26, 2025
eb7227f
CI: broaden allowedTools to include find_in_file and mcp__unity__*
dsarno Aug 26, 2025
f851b70
CI: enable use_node_cache and switch NL suite model to claude-3-7-hai…
dsarno Aug 27, 2025
29d781a
CI: disable use_node_cache to avoid setup-node lockfile error
dsarno Aug 27, 2025
7e60640
CI: set NL suite model to claude-3-haiku-20240307
dsarno Aug 27, 2025
bf9ffbd
CI: cap Haiku output with --max-tokens 2048 for NL suite
dsarno Aug 27, 2025
1e1db08
CI: switch to claude-3-7-sonnet-latest and remove unsupported --max-t…
dsarno Aug 27, 2025
ce4c6e6
CI: update allowedTools to Bash(*) and explicit Unity MCP tool list
dsarno Aug 27, 2025
7f86daf
CI: update NL suite workflow (latest tweaks)
dsarno Aug 27, 2025
83931a1
Tests: tighten NL suite prompt for logging, hash discipline, stale re…
dsarno Aug 27, 2025
7758c4f
Add disallowed tools to NL suite workflow
dsarno Aug 27, 2025
8a02055
Merge pull request #43 from dsarno/codex/add-disallow-todo-to-nl-suite
dsarno Aug 27, 2025
1119eea
docs: clarify stale write retry
dsarno Aug 27, 2025
3eadecd
Merge pull request #44 from dsarno/codex/add-stale-write-retry-rule
dsarno Aug 27, 2025
dbdd7a3
Add fallback JUnit report and adjust publisher
dsarno Aug 27, 2025
75bf720
Merge pull request #45 from dsarno/codex/fix-nl-suite-junit-handling-…
dsarno Aug 27, 2025
48334cb
Indent fallback JUnit XML in workflow
dsarno Aug 27, 2025
7922690
Merge pull request #46 from dsarno/codex/fix-yaml-parsing-error-in-wo…
dsarno Aug 27, 2025
cab5e92
fix: correct fallback JUnit report generation
dsarno Aug 27, 2025
265beb9
Merge pull request #47 from dsarno/codex/fix-junit-report-generation-…
dsarno Aug 27, 2025
2b10b1a
Update mcp-quickprobe.md
dsarno Aug 27, 2025
832634b
Update mcp-quickprobe.md
dsarno Aug 27, 2025
8c62912
Update Response.cs
dsarno Aug 27, 2025
b0a8215
Update MCPForUnityBridge.cs
dsarno Aug 27, 2025
c25c2af
fix: correct McpTypes reference
dsarno Aug 27, 2025
da4ce7d
Add directory existence checks for symlink and XDG paths
dsarno Aug 27, 2025
faa403c
fix: only set installation flag after successful server install
dsarno Aug 27, 2025
21bb4e8
Merge pull request #50 from dsarno/codex/fix-editorprefs-key-setting-…
dsarno Aug 27, 2025
81d64b0
Merge pull request #49 from dsarno/codex/add-existence-checks-for-eff…
dsarno Aug 27, 2025
6eb1679
Merge pull request #48 from dsarno/codex/fix-compile-error-in-configj…
dsarno Aug 27, 2025
030edb6
Update resource_tools.py
dsarno Aug 27, 2025
7f17058
fix: respect mac config paths
dsarno Aug 27, 2025
a526567
Use File.Replace for atomic config write
dsarno Aug 27, 2025
086a13d
Remove unused imports in manage_script
dsarno Aug 27, 2025
c496c8a
Merge pull request #52 from dsarno/codex/fix-race-condition-in-file-m…
dsarno Aug 27, 2025
2e8f9fb
Merge pull request #51 from dsarno/codex/fix-macos-config-path-logic
dsarno Aug 27, 2025
6d5bf59
Merge pull request #53 from dsarno/codex/remove-unused-imports-in-man…
dsarno Aug 27, 2025
3e055c8
bump server version
dsarno Aug 27, 2025
295c7c2
Resolve merge with origin/main: keep ours for workflow files
dsarno Aug 27, 2025
0fb2e3b
Tests: update NL suite prompt and workflows; remove deprecated smoke/…
dsarno Aug 27, 2025
baf51ea
Editor: atomic config write via File.Replace fallback; remove redunda…
dsarno Aug 27, 2025
c9c73d8
CI: harden NL suite - idempotent docker, gate on unity_ok, safer port…
dsarno Aug 27, 2025
9b546fd
Editor: make atomic config write restoration safe (flag writeDone; co…
dsarno Aug 27, 2025
26e687f
Merge pull request #54 from dsarno/fix/atomic-config-write
dsarno Aug 27, 2025
ff7e24e
CI: fix fallback JUnit heredoc by using printf lines (no EOF delimite…
dsarno Aug 27, 2025
1da7033
CI: switch NL suite to mini prompt; mini prompt honors / and NL disci…
dsarno Aug 27, 2025
60c6c07
CI: replace claude_args with allowed_tools/model/mcp_config per actio…
dsarno Aug 27, 2025
1fa42a5
CI: expand UNITY_PROJECT_ROOT via in MCP config heredoc
dsarno Aug 27, 2025
6caa598
EditorWindow: add cross-platform fallback for File.Replace; macOS-ins…
dsarno Aug 27, 2025
c72b90a
CI: strengthen JUnit publishing for NL mini suite (normalize, debug l…
dsarno Aug 27, 2025
9d9216e
CI: set job-wide JUNIT_OUT/MD_OUT; normalization uses env; publish re…
dsarno Aug 27, 2025
6122c28
CI: publish a single normalized JUnit (reports/junit-for-actions.xml)…
dsarno Aug 27, 2025
0cfbd7b
CI: align mini prompt report filenames; redact Unity log tail in diag…
dsarno Aug 27, 2025
e13c470
chore: sync workflow and mini prompt; redacted logs; JUnit normalizat…
dsarno Aug 27, 2025
252cc5c
CI: redact sensitive tokens in Stop Unity; docs: CI usage + edit tools
dsarno Aug 27, 2025
0938760
prompts: update nl-unity-suite-full (mini-style setup + reporting dis…
dsarno Aug 27, 2025
2c2a26f
CI: harden NL workflows (timeout_minutes, robust normalization); prom…
dsarno Aug 27, 2025
b252130
prompts: add guarded write pattern (LF hash, stale_file retry) to ful…
dsarno Aug 27, 2025
c35eed9
prompts: enforce continue-on-failure, driver flow, and status handlin…
dsarno Aug 27, 2025
791d6ff
Make test list more explicit in prompt. Get rid of old test prompts f…
dsarno Aug 27, 2025
5704354
prompts: add stale fast-retry (server hash) + in-memory buf guidance
dsarno Aug 27, 2025
41a1012
CI: standardize JUNIT_OUT to reports/junit-nl-suite.xml; fix artifact…
dsarno Aug 27, 2025
960eab0
prompts: reporting discipline — append-only fragments, batch writes, …
dsarno Aug 28, 2025
87a67c4
prompts: stale fast-retry preference, buffer/sha carry, snapshot reve…
dsarno Aug 28, 2025
46ee857
workflows(nl-suite): precreate report skeletons, assemble junit, synt…
dsarno Aug 28, 2025
b8c1bc6
thsis too
dsarno Aug 28, 2025
6071b70
Update README-DEV.md
dsarno Aug 28, 2025
9b7de3c
Update .github/workflows/claude-nl-suite-mini.yml
dsarno Aug 28, 2025
12dd21c
Update .github/workflows/claude-nl-suite.yml
dsarno Aug 28, 2025
b27a6b6
workflows(nl-mini): fix YAML indentation/trailing spaces under with: …
dsarno Aug 28, 2025
1078039
workflows(nl-suite): fix indentation on docker logs redaction line (Y…
dsarno Aug 28, 2025
98e41eb
Add write to allowlist
dsarno Aug 28, 2025
9139cfc
nl-suite: harden reporting discipline (fragment-only writes, forbid a…
dsarno Aug 28, 2025
a26f073
nl-suite: enforce end-of-suite single Write (no bash redirection); wo…
dsarno Aug 28, 2025
995529a
prompts(nl-full): end-of-suite results must be valid XML with single …
dsarno Aug 28, 2025
9f14238
workflows(nl-suite): make Claude step non-fatal; tolerant normalizer …
dsarno Aug 28, 2025
9d2047c
nl-suite: fix stale classname to UnityMCP.NL-T in mini fallback; prom…
dsarno Aug 28, 2025
66c7ca9
nl-suite: fix fallback JUnit classname to UnityMCP.NL-T; prompt: forb…
dsarno Aug 28, 2025
b032f33
prompts(nl-full): after each write re-read raw bytes to refresh pre_s…
dsarno Aug 28, 2025
9c07afc
prompts(nl-full): canonicalize outputs to /; allow small fragment app…
dsarno Aug 28, 2025
a27dd38
prompts(nl-full): finalize markdown formatting for guarded write, exe…
dsarno Aug 28, 2025
e016171
workflows(nl-suite, mini): header/lint fixes and constrained Bash app…
dsarno Aug 28, 2025
5dad550
prompts(nl-full): format Fast Restore, Guarded Write, Execution, Spec…
dsarno Aug 28, 2025
df97ab2
workflows(nl-suite): keep header tidy and append-path alignment with …
dsarno Aug 28, 2025
6a86db3
minor fix
dsarno Aug 28, 2025
e0f8a72
workflows(nl-suite): fix indentation and dispatch; align allowed_tool…
dsarno Aug 28, 2025
72987b7
prompts(nl-full): switch to read_resource for buf/sha; re-read only w…
dsarno Aug 28, 2025
2031fcd
workflows(nl-suite): normalize step removes bootstrap when real testc…
dsarno Aug 28, 2025
b8e461a
workflows(nl-suite): enrich Markdown summary by extracting per-test <…
dsarno Aug 28, 2025
f0b3bba
clarify prompt resilience instructions
dsarno Aug 28, 2025
0b908c1
ci(nl-suite): revert prompt and workflow to known-good e0f8a72 for gr…
dsarno Aug 28, 2025
36ed38d
ci(nl-suite): minimal fixes — no-mkdir guard in prompt; drop bootstra…
dsarno Aug 28, 2025
503b45b
ci(nl-suite): richer JUnit→Markdown report (per-test system-out)
dsarno Aug 28, 2025
74226d7
Small guard to incorret asset read call.
dsarno Aug 28, 2025
01f8408
ci(nl-suite): refine MD builder — unescape XML entities, safe code fe…
dsarno Aug 28, 2025
52facd6
Update UnityMcpBridge/UnityMcpServer~/src/tools/resource_tools.py
dsarno Aug 28, 2025
978abaa
Update UnityMcpBridge/UnityMcpServer~/src/unity_connection.py
dsarno Aug 28, 2025
bc8439b
Update UnityMcpBridge/UnityMcpServer~/src/tools/manage_script_edits.py
dsarno Aug 28, 2025
1045882
Update .github/scripts/mark_skipped.py
dsarno Aug 28, 2025
2e7239e
Update .github/scripts/mark_skipped.py
dsarno Aug 28, 2025
af0c805
Update .github/scripts/mark_skipped.py
dsarno Aug 28, 2025
c52960b
server(manage_script): robust URI handling — percent-decode file://, …
dsarno Aug 28, 2025
69aa4f3
Update .claude/prompts/nl-unity-suite-full.md
dsarno Aug 28, 2025
15dd4c1
tests(framing): reduce handshake poll window, nonblocking peek to avo…
dsarno Aug 28, 2025
8b91d0b
tests(manage_script): add _split_uri tests for unity://path, file:// …
dsarno Aug 28, 2025
7469808
server+tests: fix handshake syntax error; robust file:// URI normaliz…
dsarno Aug 28, 2025
480c66a
bridge(framing): accept zero-length frames (treat as empty keepalive)
dsarno Aug 28, 2025
40ffc8f
tests(logging): use errors='replace' on decode fallback to avoid sile…
dsarno Aug 28, 2025
bd45ddd
resources(list): restrict to Assets/, resolve symlinks, enforce .cs; …
dsarno Aug 29, 2025
bf5255d
Update .claude/prompts/nl-unity-suite-full.md
dsarno Aug 29, 2025
dc22d82
Update UnityMcpBridge/UnityMcpServer~/src/unity_connection.py
dsarno Aug 29, 2025
d5e723a
misc: framing keepalive (zero-length), regex preview consistency, res…
dsarno Aug 29, 2025
ef0301e
docs(tools): richer MCP tool descriptions; tests accept decorator kwa…
dsarno Aug 29, 2025
f264746
Update .claude/prompts/nl-unity-suite-full.md
dsarno Aug 29, 2025
083363d
Update UnityMcpBridge/UnityMcpServer~/src/tools/resource_tools.py
dsarno Aug 29, 2025
16c963c
Update UnityMcpBridge/UnityMcpServer~/src/unity_connection.py
dsarno Aug 29, 2025
b5d5708
net+docs: hard-reject zero-length frames; TCP_NODELAY on connect; Ass…
dsarno Aug 29, 2025
e974b07
prompt(nl-suite): constrain Write destinations under reports/, forbid…
dsarno Aug 29, 2025
2ce29ce
prompt+net: harden Write path rules; use monotonic deadline and plain…
dsarno Aug 29, 2025
cc2704e
unity_connection: restore recv timeout via try/finally; make global c…
dsarno Aug 29, 2025
12eb816
NL/T prompt: pin structured edit ops for T-D/T-E; add schema-error gu…
dsarno Aug 29, 2025
c8cf82e
unity_connection: add FRAMED_MAX; use ValueError for framed length vi…
dsarno Aug 29, 2025
42f9f6d
ManageScript: use UTF8Encoding(without BOM) for atomic writes in Appl…
dsarno Aug 29, 2025
cadce71
NL/T prompt: make helper deletion regex multiline-safe ((?ms) so ^ an…
dsarno Aug 29, 2025
80d2558
ManageScript: emit structured overlap status {status:"overlap"} for o…
dsarno Aug 29, 2025
ed9bbfd
NL/T prompt: clarify fallback vs failure — fallback only for unsuppor…
dsarno Aug 29, 2025
8909682
NL/T prompt: pin deterministic overlap probe (apply_text_edits two ra…
dsarno Aug 29, 2025
4e9e6ee
TB update
dsarno Aug 29, 2025
6696c40
NL/T prompt: harden Output Rules — constrain Bash(printf|echo) to std…
dsarno Aug 29, 2025
effa020
Prompt: enumerate allowed script_apply_edits ops; add manage_editor/r…
dsarno Aug 29, 2025
305360b
Fixes
dsarno Aug 29, 2025
3937ead
ManageScript: add rich overlap diagnostics (conflicts + hint) for bot…
dsarno Aug 29, 2025
3bd60bb
ManageScript: return structured {status:"validation_failed"} diagnost…
dsarno Aug 29, 2025
3f01e7f
ManageScript: echo canonical uri in responses (create/read/update/app…
dsarno Aug 29, 2025
5e1acba
improve clarity of capabilities message
dsarno Aug 29, 2025
34865d6
Framing: allow zero-length frames on both ends (C# bridge, Python ser…
dsarno Aug 29, 2025
2234860
ManageScript: include new sha256 in success payload for apply_text_ed…
dsarno Aug 29, 2025
f4c19e0
remove claudetest dir
dsarno Aug 29, 2025
95eb2a1
manage_script_edits: normalize method-anchored anchor_insert to inser…
dsarno Aug 29, 2025
7696e3d
tighten testing protocol around mkdir
dsarno Aug 29, 2025
ca429f4
manage_script: validate create_script inputs (Assets/.cs/name/no trav…
dsarno Aug 29, 2025
28712e6
Tighten prompt for testing
dsarno Aug 29, 2025
19e39e7
Update .claude/prompts/nl-unity-suite-full.md
dsarno Aug 29, 2025
fa45ea7
Update .claude/prompts/nl-unity-suite-full.md
dsarno Aug 29, 2025
60ac88f
Update UnityMcpBridge/Editor/Tools/ManageScript.cs
dsarno Aug 29, 2025
3572c4c
manage_script_edits: honor ignore_case on anchor_insert and regex_rep…
dsarno Aug 29, 2025
a3790e3
remove extra file
dsarno Aug 29, 2025
8ba5d34
Merge branch 'temp/nl-revert-test' of github.com:dsarno/unity-mcp int…
dsarno Aug 29, 2025
30e0e82
workflow: use python3 for inline scripts and port detection on ubuntu…
dsarno Aug 29, 2025
6f9faec
Tighten prompt + manage_script
dsarno Aug 29, 2025
45623b2
Update UnityMcpBridge/UnityMcpServer~/src/tools/manage_script_edits.py
dsarno Aug 29, 2025
2325926
Update UnityMcpBridge/UnityMcpServer~/src/tools/manage_script_edits.py
dsarno Aug 29, 2025
b434366
Update .claude/prompts/nl-unity-suite-full.md
dsarno Aug 29, 2025
2fb1b96
Update UnityMcpBridge/Editor/Tools/ManageScript.cs
dsarno Aug 29, 2025
bf2b3b3
Update .claude/prompts/nl-unity-suite-full.md
dsarno Aug 29, 2025
42e115c
manage_script: improve file:// UNC handling; preserve POSIX absolute …
dsarno Aug 29, 2025
5f5be64
ManageScript.cs: add TimeSpan timeouts to all Regex uses (IsMatch/Mat…
dsarno Aug 29, 2025
1420640
workflow: ensure reports/ exists in markdown build step to avoid File…
dsarno Aug 29, 2025
e2e26f7
fix brace
dsarno Aug 29, 2025
f242fea
manage_script_edits: expand backrefs for regex_replace in preview->t…
dsarno Aug 29, 2025
81a85cd
anchor_insert: default to position=after, normalize surrounding newli…
dsarno Aug 29, 2025
de8e731
feat(mcp): add get_sha tool; apply_text_edits normalization+overlap p…
dsarno Aug 30, 2025
a86423c
feat(frames): accept zero-length heartbeat frames in client; add hear…
dsarno Aug 30, 2025
81026fa
feat(edits): guard destructive regex_replace with structural prefligh…
dsarno Aug 30, 2025
9726054
feat(frames): bound heartbeat loop with timeout/threshold; align zero…
dsarno Aug 30, 2025
afd1be8
SDK hardening: atomic multi-span text edits; stop forcing sequential …
dsarno Aug 30, 2025
cd07ba1
Router: default applyMode=atomic for multi-span apply_text_edits; add…
dsarno Aug 30, 2025
55d4913
CI prompt: pass options.validate=relaxed for T-B/C; options.applyMode…
dsarno Aug 30, 2025
1281ada
Validation & DX: add validate=syntax (scoped), standardize evidence w…
dsarno Aug 30, 2025
52c004a
Merge branch 'main' into feat/script-editing-framing-tests
dsarno Aug 30, 2025
bbb8618
Update UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs
dsarno Aug 30, 2025
48deedd
NL/T suite-driven edits: LongUnityScriptClaudeTest, bridge helpers, s…
dsarno Aug 30, 2025
a5af8ba
Fix duplicate macConfigPath field in McpClient to resolve CS0102
dsarno Aug 30, 2025
62182bc
Editor threading: run EnsureServerInstalled on main thread; marshal E…
dsarno Aug 30, 2025
b9d4590
Docs(apply_text_edits): strengthen guidance on 1-based positions, ver…
dsarno Aug 30, 2025
cc5b3c4
Docs(script_apply_edits): add safety guidance (anchors, method ops, v…
dsarno Aug 30, 2025
435f155
Framed VerifyBridgePing in editor window; docs hardening for apply_te…
dsarno Aug 30, 2025
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
45 changes: 45 additions & 0 deletions .claude/prompts/nl-unity-claude-tests-mini.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Unity NL Editing Suite — Natural Mode

You are running inside CI for the **unity-mcp** repository. Your task is to demonstrate end‑to‑end **natural‑language code editing** on a representative Unity C# script using whatever capabilities and servers are already available in this session. Work autonomously. Do not ask the user for input. Do NOT spawn subagents, as they will not have access to the mcp server process on the top-level agent.

## Mission
1) **Discover capabilities.** Quietly inspect the tools and any connected servers that are available to you at session start. If the server offers a primer or capabilities resource, read it before acting.
2) **Choose a target file.** Prefer `TestProjects/UnityMCPTests/Assets/Scripts/LongUnityScriptClaudeTest.cs` if it exists; otherwise choose a simple, safe C# script under `TestProjects/UnityMCPTests/Assets/`.
3) **Perform a small set of realistic edits** using minimal, precise changes (not full-file rewrites). Examples of small edits you may choose from (pick 3–6 total):
- Insert a new, small helper method (e.g., a logger or counter) in a sensible location.
- Add a short anchor comment near a key method (e.g., above `Update()`), then add or modify a few lines nearby.
- Append an end‑of‑class utility method (e.g., formatting or clamping helper).
- Make a safe, localized tweak to an existing method body (e.g., add a guard or a simple accumulator).
- Optionally include one idempotency/no‑op check (re‑apply an edit and confirm nothing breaks).
4) **Validate your edits.** Re‑read the modified regions and verify the changes exist, compile‑risk is low, and surrounding structure remains intact.
5) **Report results.** Produce both:
- A JUnit XML at `reports/junit-nl-suite.xml` containing a single suite named `UnityMCP.NL` with one test case per sub‑test you executed (mark pass/fail and include helpful failure text).
- A summary markdown at `reports/junit-nl-suite.md` that explains what you attempted, what succeeded/failed, and any follow‑ups you would try.
6) **Be gentle and reversible.** Prefer targeted, minimal edits; avoid wide refactors or non‑deterministic changes.

## Assumptions & Hints (non‑prescriptive)
- A Unity‑oriented MCP server is expected to be connected. If a server‑provided **primer/capabilities** resource exists, read it first. If no primer is available, infer capabilities from your visible tools in the session.
- In CI/headless mode, when calling `mcp__unity__list_resources` or `mcp__unity__read_resource`, include:
- `ctx: {}`
- `project_root: "TestProjects/UnityMCPTests"` (the server will also accept the absolute path passed via env)
Example: `{ "ctx": {}, "under": "Assets/Scripts", "pattern": "*.cs", "project_root": "TestProjects/UnityMCPTests" }`
- If the preferred file isn’t present, locate a fallback C# file with simple, local methods you can edit safely.
- If a compile command is available in this environment, you may optionally trigger it; if not, rely on structural checks and localized validation.

## Output Requirements (match NL suite conventions)
- JUnit XML at `$JUNIT_OUT` if set, otherwise `reports/junit-nl-suite.xml`.
- Single suite named `UnityMCP.NL`, one `<testcase>` per sub‑test; include `<failure>` on errors.
- Markdown at `$MD_OUT` if set, otherwise `reports/junit-nl-suite.md`.

Constraints (for fast publishing):
- Log allowed tools once as a single line: `AllowedTools: ...`.
- For every edit: Read → Write (with precondition hash) → Re‑read; on `{status:"stale_file"}` retry once after re‑read.
- Keep evidence to ±20–40 lines windows; cap unified diffs to 300 lines and note truncation.
- End `<system-out>` with `VERDICT: PASS` or `VERDICT: FAIL`.

## Guardrails
- No destructive operations. Keep changes minimal and well‑scoped.
- Don’t leak secrets or environment details beyond what’s needed in the reports.
- Work without user interaction; do not prompt for approval mid‑flow.

> If capabilities discovery fails, still produce the two reports that clearly explain why you could not proceed and what evidence you gathered.
234 changes: 234 additions & 0 deletions .claude/prompts/nl-unity-suite-full.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# Unity NL/T Editing Suite — CI Agent Contract

You are running inside CI for the `unity-mcp` repo. Use only the tools allowed by the workflow. Work autonomously; do not prompt the user. Do NOT spawn subagents.

**Print this once, verbatim, early in the run:**
AllowedTools: Write,Bash(printf:*),Bash(echo:*),Bash(scripts/nlt-revert.sh:*),mcp__unity__manage_editor,mcp__unity__list_resources,mcp__unity__read_resource,mcp__unity__apply_text_edits,mcp__unity__script_apply_edits,mcp__unity__validate_script,mcp__unity__find_in_file,mcp__unity__read_console,mcp__unity__get_sha

---

## Mission
1) Pick target file (prefer):
- `unity://path/Assets/Scripts/LongUnityScriptClaudeTest.cs`
2) Execute **all** NL/T tests in order using minimal, precise edits.
3) Validate each edit with `mcp__unity__validate_script(level:"standard")`.
4) **Report**: write one `<testcase>` XML fragment per test to `reports/<TESTID>_results.xml`. Do **not** read or edit `$JUNIT_OUT`.
5) **Restore** the file after each test using the OS‑level helper (fast), not a full‑file text write.

---

## Environment & Paths (CI)
- Always pass: `project_root: "TestProjects/UnityMCPTests"` and `ctx: {}` on list/read/edit/validate.
- **Canonical URIs only**:
- Primary: `unity://path/Assets/...` (never embed `project_root` in the URI)
- Relative (when supported): `Assets/...`
- File paths for the helper script are workspace‑relative:
- `TestProjects/UnityMCPTests/Assets/...`

CI provides:
- `$JUNIT_OUT=reports/junit-nl-suite.xml` (pre‑created; leave alone)
- `$MD_OUT=reports/junit-nl-suite.md` (synthesized from JUnit)
- Helper script: `scripts/nlt-revert.sh` (snapshot/restore)

---

## Tool Mapping
- **Anchors/regex/structured**: `mcp__unity__script_apply_edits`
- Allowed ops: `anchor_insert`, `replace_range`, `regex_replace` (no overlapping ranges within a single call)
- **Precise ranges / atomic batch**: `mcp__unity__apply_text_edits` (non‑overlapping ranges)
- Multi‑span batches are computed from the same fresh read and sent atomically by default.
- Prefer `options.applyMode:"atomic"` when passing options for multiple spans; for single‑span, sequential is fine.
- **Hash-only**: `mcp__unity__get_sha` — returns `{sha256,lengthBytes,lastModifiedUtc}` without file body
- **Validation**: `mcp__unity__validate_script(level:"standard")`
- For edits, you may pass `options.validate`:
- `standard` (default): full‑file delimiter balance checks.
- `relaxed`: scoped checks for interior, non‑structural text edits; do not use for header/signature/brace‑touching changes.
- **Reporting**: `Write` small XML fragments to `reports/*_results.xml`
- **Editor state/flush**: `mcp__unity__manage_editor` (use sparingly; no project mutations)
- **Console readback**: `mcp__unity__read_console` (INFO capture only; do not assert in place of `validate_script`)
- **Snapshot/Restore**: `Bash(scripts/nlt-revert.sh:*)`
- For `script_apply_edits`: use `name` + workspace‑relative `path` only (e.g., `name="LongUnityScriptClaudeTest"`, `path="Assets/Scripts"`). Do not pass `unity://...` URIs as `path`.
- For `apply_text_edits` / `read_resource`: use the URI form only (e.g., `uri="unity://path/Assets/Scripts/LongUnityScriptClaudeTest.cs"`). Do not concatenate `Assets/` with a `unity://...` URI.
- Never call generic Bash like `mkdir`; the revert helper creates needed directories. Use only `scripts/nlt-revert.sh` for snapshot/restore.
- If you believe a directory is missing, you are mistaken: the workflow pre-creates it and the snapshot helper creates it if needed. Do not attempt any Bash other than scripts/nlt-revert.sh:*.

### Structured edit ops (required usage)

# Insert a helper RIGHT BEFORE the final class brace (NL‑3, T‑D)
1) Prefer `script_apply_edits` with a regex capture on the final closing brace:
```json
{"op":"regex_replace",
"pattern":"(?s)(\\r?\\n\\s*\\})\\s*$",
"replacement":"\\n // Tail test A\\n // Tail test B\\n // Tail test C\\1"}

2) If the server returns `unsupported` (op not available) or `missing_field` (op‑specific), FALL BACK to
`apply_text_edits`:
- Find the last `}` in the file (class closing brace) by scanning from end.
- Insert the three comment lines immediately before that index with one non‑overlapping range.

# Insert after GetCurrentTarget (T‑A/T‑E)
- Use `script_apply_edits` with:
```json
{"op":"anchor_insert","afterMethodName":"GetCurrentTarget","text":"private int __TempHelper(int a,int b)=>a+b;\\n"}
```

# Delete the temporary helper (T‑A/T‑E)
- Prefer structured delete:
- Use `script_apply_edits` with `{ "op":"delete_method", "className":"LongUnityScriptClaudeTest", "methodName":"PrintSeries" }` (or `__TempHelper` for T‑A).
- If structured delete is unavailable, fall back to `apply_text_edits` with a single `replace_range` spanning the exact method block (bounds computed from a fresh read); avoid whole‑file regex deletes.

# T‑B (replace method body)
- Use `mcp__unity__apply_text_edits` with a single `replace_range` strictly inside the `HasTarget` braces.
- Compute start/end from a fresh `read_resource` at test start. Do not edit signature or header.
- On `{status:"stale_file"}` retry once with the server-provided hash; if absent, re-read once and retry.
- On `bad_request`: write the testcase with `<failure>…</failure>`, restore, and continue to next test.
- On `missing_field`: FALL BACK per above; if the fallback also returns `unsupported` or `bad_request`, then fail as above.
> Don’t use `mcp__unity__create_script`. Avoid the header/`using` region entirely.

Span formats for `apply_text_edits`:
- Prefer LSP ranges (0‑based): `{ "range": { "start": {"line": L, "character": C}, "end": {…} }, "newText": "…" }`
- Explicit fields are 1‑based: `{ "startLine": L1, "startCol": C1, "endLine": L2, "endCol": C2, "newText": "…" }`
- SDK preflights overlap after normalization; overlapping non‑zero spans → `{status:"overlap"}` with conflicts and no file mutation.
- Optional debug: pass `strict:true` to reject explicit 0‑based fields (else they are normalized and a warning is emitted).
- Apply mode guidance: router defaults to atomic for multi‑span; you can explicitly set `options.applyMode` if needed.

---

## Output Rules (JUnit fragments only)
- For each test, create **one** file: `reports/<TESTID>_results.xml` containing exactly a single `<testcase ...> ... </testcase>`.
Put human-readable lines (PLAN/PROGRESS/evidence) **inside** `<system-out><![CDATA[ ... ]]></system-out>`.
- If content contains `]]>`, split CDATA: replace `]]>` with `]]]]><![CDATA[>`.
- Evidence windows only (±20–40 lines). If showing a unified diff, cap at 100 lines and note truncation.
- **Never** open/patch `$JUNIT_OUT` or `$MD_OUT`; CI merges fragments and synthesizes Markdown.
- Write destinations must match: `^reports/[A-Za-z0-9._-]+_results\.xml$`
- Snapshot files must live under `reports/_snapshots/`
- Reject absolute paths and any path containing `..`
- Reject control characters and line breaks in filenames; enforce UTF‑8
- Cap basename length to ≤64 chars; cap any path segment to ≤100 and total path length to ≤255
- Bash(printf|echo) must write to stdout only. Do not use shell redirection, here‑docs, or `tee` to create/modify files. The only allowed FS mutation is via `scripts/nlt-revert.sh`.

**Example fragment**
```xml
<testcase classname="UnityMCP.NL-T" name="NL-1. Method replace/insert/delete">
<system-out><![CDATA[
PLAN: NL-0,NL-1,NL-2,NL-3,NL-4,T-A,T-B,T-C,T-D,T-E,T-F,T-G,T-H,T-I,T-J (len=15)
PROGRESS: 2/15 completed
pre_sha=<...>
... evidence windows ...
VERDICT: PASS
]]></system-out>
</testcase>

```

Note: Emit the PLAN line only in NL‑0 (do not repeat it for later tests).


### Fast Restore Strategy (OS‑level)

- Snapshot once at NL‑0, then restore after each test via the helper.
- Snapshot (once after confirming the target):
```bash
scripts/nlt-revert.sh snapshot "TestProjects/UnityMCPTests/Assets/Scripts/LongUnityScriptClaudeTest.cs" "reports/_snapshots/LongUnityScriptClaudeTest.cs.baseline"
```
- Log `snapshot_sha=...` printed by the script.
- Restore (after each mutating test):
```bash
scripts/nlt-revert.sh restore "TestProjects/UnityMCPTests/Assets/Scripts/LongUnityScriptClaudeTest.cs" "reports/_snapshots/LongUnityScriptClaudeTest.cs.baseline"
```
- Then `read_resource` to confirm and (optionally) `validate_script(level:"standard")`.
- If the helper fails: fall back once to a guarded full‑file restore using the baseline bytes; then continue.

### Guarded Write Pattern (for edits, not restores)

- Before any mutation: `res = mcp__unity__read_resource(uri)`; `pre_sha = sha256(res.bytes)`.
- Write with `precondition_sha256 = pre_sha` on `apply_text_edits`/`script_apply_edits`.
- To compute `pre_sha` without reading file contents, you may instead call `mcp__unity__get_sha(uri).sha256`.
- On `{status:"stale_file"}`:
- Retry once using the server-provided hash (e.g., `data.current_sha256` or `data.expected_sha256`, per API schema).
- If absent, one re-read then a final retry. No loops.
- After success: immediately re-read via `res2 = mcp__unity__read_resource(uri)` and set `pre_sha = sha256(res2.bytes)` before any further edits in the same test.
- Prefer anchors (`script_apply_edits`) for end-of-class / above-method insertions. Keep edits inside method bodies. Avoid header/using.

**On non‑JSON/transport errors (timeout, EOF, connection closed):**
- Write `reports/<TESTID>_results.xml` with a `<testcase>` that includes a `<failure>` or `<error>` node capturing the error text.
- Run the OS restore via `scripts/nlt-revert.sh restore …`.
- Continue to the next test (do not abort).

**If any write returns `bad_request`, or `unsupported` after a fallback attempt:**
- Write `reports/<TESTID>_results.xml` with a `<testcase>` that includes a `<failure>` node capturing the server error, include evidence, and end with `VERDICT: FAIL`.
- Run `scripts/nlt-revert.sh restore ...` and continue to the next test.
### Execution Order (fixed)

- Run exactly: NL-0, NL-1, NL-2, NL-3, NL-4, T-A, T-B, T-C, T-D, T-E, T-F, T-G, T-H, T-I, T-J (15 total).
- Before NL-1..T-J: Bash(scripts/nlt-revert.sh:restore "<target>" "reports/_snapshots/LongUnityScriptClaudeTest.cs.baseline") IF the baseline exists; skip for NL-0.
- NL-0 must include the PLAN line (len=15).
- After each testcase, include `PROGRESS: <k>/15 completed`.


### Test Specs (concise)

- NL‑0. Sanity reads — Tail ~120; ±40 around `Update()`. Then snapshot via helper.
- NL‑1. Replace/insert/delete — `HasTarget → return currentTarget != null;`; insert `PrintSeries()` after `GetCurrentTarget` logging "1,2,3"; verify; delete `PrintSeries()`; restore.
- NL‑2. Anchor comment — Insert `// Build marker OK` above `public void Update(...)`; restore.
- NL‑3. End‑of‑class — Insert `// Tail test A/B/C` (3 lines) before final brace; restore.
- NL‑4. Compile trigger — Record INFO only.

### T‑A. Anchor insert (text path) — Insert helper after `GetCurrentTarget`; verify; delete via `regex_replace`; restore.
### T‑B. Replace body — Single `replace_range` inside `HasTarget`; restore.
- Options: pass {"validate":"relaxed"} for interior one-line edits.
### T‑C. Header/region preservation — Edit interior of `ApplyBlend`; preserve signature/docs/regions; restore.
- Options: pass {"validate":"relaxed"} for interior one-line edits.
### T‑D. End‑of‑class (anchor) — Insert helper before final brace; remove; restore.
### T‑E. Lifecycle — Insert → update → delete via regex; restore.
### T‑F. Atomic batch — One `mcp__unity__apply_text_edits` call (text ranges only)
- Compute all three edits from the **same fresh read**:
1) Two small interior `replace_range` tweaks.
2) One **end‑of‑class insertion**: find the **index of the final `}`** for the class; create a zero‑width range `[idx, idx)` and set `replacement` to the 3‑line comment block.
- Send all three ranges in **one call**, sorted **descending by start index** to avoid offset drift.
- Expect all‑or‑nothing semantics; on `{status:"overlap"}` or `{status:"bad_request"}`, write the testcase fragment with `<failure>…</failure>`, **restore**, and continue.
- Options: pass {"applyMode":"atomic"} to enforce all‑or‑nothing.
- T‑G. Path normalization — Make the same edit with `unity://path/Assets/...` then `Assets/...`. Without refreshing `precondition_sha256`, the second attempt returns `{stale_file}`; retry with the server-provided hash to confirm both forms resolve to the same file.

### T-H. Validation (standard)
- Restore baseline (helper call above).
- Perform a harmless interior tweak (or none), then MUST call:
mcp__unity__validate_script(level:"standard")
- Write the validator output to system-out; VERDICT: PASS if standard is clean, else include <failure> with the validator message and continue.

### T-I. Failure surfaces (expected)
- Restore baseline.
- (1) OVERLAP:
* Fresh read of file; compute two interior ranges that overlap inside HasTarget.
* Prefer LSP ranges (0‑based) or explicit 1‑based fields; ensure both spans come from the same snapshot.
* Single mcp__unity__apply_text_edits call with both ranges.
* Expect `{status:"overlap"}` (SDK preflight) → record as PASS; else FAIL. Restore.
- (2) STALE_FILE:
* Fresh read → pre_sha.
* Make a tiny legit edit with pre_sha; success.
* Attempt another edit reusing the OLD pre_sha.
* Expect {status:"stale_file"} → record as PASS; else FAIL. Re-read to refresh, restore.

### Per‑test error handling and recovery
- For each test (NL‑0..T‑J), use a try/finally pattern:
- Always write a testcase fragment and perform restore in finally, even when tools return error payloads.
- try: run the test steps; always write `reports/<ID>_results.xml` with PASS/FAIL/ERROR
- finally: run Bash(scripts/nlt-revert.sh:restore …baseline) to restore the target file
- On any transport/JSON/tool exception:
- catch and write a `<testcase>` fragment with an `<error>` node (include the message), then proceed to the next test.
- After NL‑4 completes, proceed directly to T‑A regardless of any earlier validator warnings (do not abort the run).
- (3) USING_GUARD (optional):
* Attempt a 1-line insert above the first 'using'.
* Expect {status:"using_guard"} → record as PASS; else note 'not emitted'. Restore.

### T-J. Idempotency
- Restore baseline.
- Repeat a replace_range twice (second call may be noop). Validate standard after each.
- Insert or ensure a tiny comment, then delete it twice (second delete may be noop).
- Restore and PASS unless an error/structural break occurred.


### Status & Reporting

- Safeguard statuses are non‑fatal; record and continue.
- End each testcase `<system-out>` with `VERDICT: PASS` or `VERDICT: FAIL`.
Loading