4d-run

📁 e-marchand/skills 📅 8 days ago
1
总安装量
1
周安装量
#47209
全站排名
安装命令
npx skills add https://github.com/e-marchand/skills --skill 4d-run

Agent 安装分布

amp 1
opencode 1
kimi-cli 1
codex 1
claude-code 1

Skill 文档

4D Method Runner

Run 4D project methods using tool4d command-line tool.

Finding tool4d

tool4d is typically installed in one of these locations:

  • VS Code: $HOME/Library/Application Support/Code/User/globalStorage/4d.4d-analyzer/tool4d/
  • Antigravity: $HOME/Library/Application Support/Antigravity/User/globalStorage/4d.4d-analyzer/tool4d/

Within these directories, versions are stored in indexed folders (e.g., 21/100301/). Always use the latest version available.

Discovery Script

# Find tool4d in standard locations, return latest version
find_tool4d() {
    local search_paths=(
        "$HOME/Library/Application Support/Code/User/globalStorage/4d.4d-analyzer/tool4d"
        "$HOME/Library/Application Support/Antigravity/User/globalStorage/4d.4d-analyzer/tool4d/"
    )

    for base_path in "${search_paths[@]}"; do
        if [ -d "$base_path" ]; then
            # Find latest tool4d.app by sorting version folders
            local tool4d_path=$(find "$base_path" -name "tool4d.app" -type d 2>/dev/null | sort -V | tail -1)
            if [ -n "$tool4d_path" ]; then
                echo "$tool4d_path/Contents/MacOS/tool4d"
                return 0
            fi
        fi
    done
    return 1
}

Running a Method

Basic Command

"<tool4d_path>" --project="<project_path>" --startup-method=<method_name> --dataless

Parameters:

  • --project: Full path to the .4DProject file
  • --startup-method: Name of the method to execute (without .4dm extension)
  • --dataless: Run without a data file (recommended for testing)

Example

"/Users/eric/Library/Application Support/Code/User/globalStorage/4d.4d-analyzer/tool4d/21/100301/tool4d.app/Contents/MacOS/tool4d" \
    --project="/path/to/Project/MyProject.4DProject" \
    --startup-method=test_MyFeature \
    --dataless

Output Handling

tool4d output appears on stderr. Common patterns:

  • ALERT calls: tool4d.HDLS ([Call of Forbidden Method] ALERT: <message>)
  • Assertion failures: tool4d.4DRT [-10518] Assert failed: <message>
  • Success: Method completes without error output

Logging from 4D Code

Use LOG EVENT to output messages:

LOG EVENT(Into system standard outputs; "message"; Information message)

Or write to a file:

File("/path/to/debug.txt").setText($debugText)

Workflow

  1. Find tool4d: Search standard locations for latest version
  2. Locate project: Find the .4DProject file in the project directory
  3. Run method: Execute with --dataless flag
  4. Parse output: Check stderr for ALERT messages or errors