Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

statechart: a relative TLA2TOOLS or JAVA path fails, because TLC runs in the snapshot folder

未关闭 适合新手
#973 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
tooling

调研方向

阅读 pstack/skills/statechart/scripts/tlc-tools.mjs 和 pstack/skills/statechart/scripts/statechart.mjs,重点了解 findTlc 如何解析 TLA2TOOLS 和 JAVA,以及 tlc() 如何设置其工作目录。使用 issue 中的相对路径和绝对路径重现问题。当从调用方目录接受的路径在 snapshot 文件夹中也能正常工作,且 from-spec 可以运行 TLC 时,即为完成。

由索引模型根据 Issue 内容生成。

描述

What happens

findTlc in pstack/skills/statechart/scripts/tlc-tools.mjs checks that TLA2TOOLS and JAVA exist from the caller's working directory, then returns them as given. tlc() in statechart.mjs starts java with cwd set to the folder of the spec's snapshot copy under $TMPDIR/statechart-inputs-*/. Java resolves a relative -cp against that folder, so it cannot find the jar, and from-spec exits with cannot run TLC. A relative JAVA with a slash, such as ./jdk/bin/java, starts from the same folder.

Reproduce

Tested at 9e88dad on macOS with Node 25.8.0. The stand-in java prints the folder it runs in and whether it can see the -cp jar.

mkdir repro && cd repro && mkdir tools && touch tools/tla2tools.jar
cat > fake-java <<'EOF'
#!/bin/sh
cp=""; prev=""; for a in "$@"; do [ "$prev" = "-cp" ] && cp="$a"; prev="$a"; done
echo "java runs in: $PWD" >&2
if [ -e "$cp" ]; then echo "jar $cp: found" >&2; else echo "jar $cp: not found" >&2; fi
exit 1
EOF
chmod +x fake-java
printf -- '---- MODULE Spec ----\nEXTENDS Naturals\nVARIABLE x\nInit == x = 0\nNext == x'"'"' = x\n====\n' > Spec.tla
printf 'INIT Init\nNEXT Next\n' > Spec.cfg
S=/path/to/pstack/skills/statechart/scripts/statechart.mjs
export JAVA=$PWD/fake-java
TLA2TOOLS=tools/tla2tools.jar node $S from-spec Spec.tla   # writes Spec.map.mjs
TLA2TOOLS=tools/tla2tools.jar node $S from-spec Spec.tla
TLA2TOOLS=$PWD/tools/tla2tools.jar node $S from-spec Spec.tla

With the relative path:

cannot run TLC with .../fake-java -cp tools/tla2tools.jar: java exited 1:
  java runs in: $TMPDIR/statechart-inputs-B8EIpr/<absolute path of repro>
  jar tools/tla2tools.jar: not found

With the absolute path, java runs in the same snapshot folder and prints jar <absolute path>: found.

Expected

A TLA2TOOLS or JAVA path that exists from the caller's directory, which findTlc already checks, also works when TLC runs.

主要语言
TypeScript
星标
13.9k
派生
1.4k
平均合并
7 小时 5 分钟
30 天内合并 PR
150

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cursor/plugins 的其他 Issue

查看 cursor/plugins 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。