feat: add run.sh for human-present x402 scenario#244
feat: add run.sh for human-present x402 scenario#244chopmob-cloud wants to merge 4 commits intogoogle-agentic-commerce:mainfrom
Conversation
The human-present/x402 scenario directory was the only scenario in v0.2 missing a run.sh. The README worked around this by pointing users at cards/run.sh --payment-method x402, but the dedicated script makes the scenario consistent with all other scenario directories. Update the README execution command to point at the new script.
There was a problem hiding this comment.
Code Review
This pull request introduces a new shell script to automate the execution of the x402 human-present example and updates the README to point to this new script. I have provided a suggestion to improve the robustness of the log directory cleanup process. The suggestion regarding the AGENTS_DIR path was removed as it did not include a specific code change.
| # Clear old logs. | ||
| echo "Clearing the logs directory..." | ||
| if [ -d "$LOG_DIR" ]; then | ||
| rm -f "$LOG_DIR"/* |
There was a problem hiding this comment.
Using rm -f "$LOG_DIR"/* can be problematic if the directory is empty, as the glob pattern * might not expand (depending on shell settings), leading to an attempt to delete a literal file named *. A more robust way to clear the directory is to remove and recreate it, or use find to delete its contents.
| rm -f "$LOG_DIR"/* | |
| rm -rf "$LOG_DIR" && mkdir -p "$LOG_DIR" |
Replacing `rm -f "$LOG_DIR"/*` with `rm -rf "$LOG_DIR" && mkdir -p "$LOG_DIR"` avoids a glob-expansion failure when the directory is empty (some shells pass a literal `*` to rm if no files match). Addresses Gemini code-review feedback on PR google-agentic-commerce#244.
|
Thanks for the review @gemini-code-assist — applied in the latest commit. Replaced |
|
Thanks for the update, @chopmob-cloud. That change to |
Summary
The
code/samples/python/scenarios/a2a/human-present/x402/directory was theonly scenario in v0.2 missing a
run.sh. Every other scenario directory hasone:
The README worked around this by pointing users at
cards/run.sh --payment-method x402, which is confusing — a reader in thex402 directory should not have to navigate to a sibling directory to run
the scenario.
Changes
run.sh(new): mirrorshuman-present/cards/run.shexactly, withPAYMENT_METHOD="x402"hardcoded and the--payment-methodarg-parsingblock removed (not needed for a single-purpose script).
README.md(1 line): updates the "Execution" command fromcards/run.sh --payment-method x402tox402/run.sh.