Skip to content

Merge main into stg for exchange e2e#37

Closed
ZhimaoL wants to merge 10 commits into
asksurf-ai:stgfrom
ZhimaoL:stg-release-exchange-e2e
Closed

Merge main into stg for exchange e2e#37
ZhimaoL wants to merge 10 commits into
asksurf-ai:stgfrom
ZhimaoL:stg-release-exchange-e2e

Conversation

@ZhimaoL

@ZhimaoL ZhimaoL commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • merge current main into stg so staging CLI includes the configured Surf API base URL sync fix
  • keep stg instant-operation compatibility hooks
  • unblock staging CLI/skill e2e for Hermod exchange endpoints

Verification

  • HOME=/tmp/surf-cli-stg-go-test-home go test ./...
  • go build -o /tmp/surf-stg-merged ./cmd/surf
  • SURF_API_BASE_URL=https://api.stg.ask.surf/gateway/v1 /tmp/surf-stg-merged sync
  • /tmp/surf-stg-merged list-operations -g | rg 'exchange-(coverage|candles)'
  • /tmp/surf-stg-merged exchange-coverage --exchange bithumb --limit 2 --json
  • /tmp/surf-stg-merged exchange-candles --exchange bithumb --pair BTC/KRW --interval 5m --limit 2 --json

akasuv and others added 10 commits April 22, 2026 05:36
Without a cached OpenAPI spec, every API command fails — either with
"unknown command: polymarket-markets" (commands not registered) or
"no cached API spec — run surf sync first" (list-operations).
Agents hit this ~17 times in recent eval runs when they skipped the
initial surf sync step the SKILL.md asks for.

Do the sync ourselves on cache miss, deterministically:
- Before registering API commands, detect cache-miss + API-style argv
- Silently fetch the spec (one stderr line: "No cached API spec, syncing...")
- Proceed with normal command registration and dispatch
- On fetch failure, fall through — existing error paths still produce a
  specific message with context for the user's actual command

Meta commands (auth, sync, version, install, help, etc.) skip the
auto-sync path — they don't need the spec. list-operations DOES need
it and triggers auto-sync.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
install.sh targets ~/.local/bin (see installDir() in cmd/surf/install.go
and install_test.go:11-19), not ~/.surf/bin. The old path was wrong in
both the Install section (L13) and the Local development symlink example
added in asksurf-ai#14 (L83, L88) — following the latter silently shadowed nothing
because ~/.surf/bin didn't exist.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ai#23)

For string params with an OpenAPI enum, the --help column used to show
the first back-quoted word from the description (e.g. `--metric tier`
when the spec had `tier` in Markdown backticks), which agents read as
"default = tier" and skipped the flag.

Root cause: spec descriptions legitimately use Markdown backticks to
emphasize enum values, but pflag's UnquoteUsage interprets the first
back-quoted word as the flag's type placeholder. Two conventions
collide on the same character.

This change:
  - Strips backticks from descriptions in openapi.go so pflag can't
    hoist an enum value into the placeholder column.
  - Adds Param.Enum and a custom pflag Value whose Type() returns
    "{a|b|c}" so the placeholder column shows the full choice list.
  - Falls back to plain "string" when the joined placeholder would
    exceed 40 chars and break column alignment.

Before:
  --metric tier   Ranking metric. Can be tier (...) or `portfolio_count` (...). (required)
After:
  --metric {tier|portfolio_count}   Ranking metric. Can be tier (...) or portfolio_count (...). (required)

Other commands now show clearer enum columns, e.g.
  --interval {5m|1h|1d|7d}
  --order {asc|desc}
  --sort-by {market_cap|change_24h|volume_24h}

Refs docs/issues.md asksurf-ai#3.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`surf market-futures --symbol BTC` no longer works — `market-futures`
became a ranking-style snapshot endpoint that explicitly does not accept
`--symbol`. Swap to `surf market-price --symbol BTC`, which is the
canonical symbol-keyed time-series query and returns real data.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sksurf.ai (asksurf-ai#25)

The Surf docs are served from agents.asksurf.ai (Next.js, surf-landing
repo); docs.asksurf.ai is a stale Mintlify mirror that is no longer the
canonical source. Update the root --help footer URL and the test
assertion that pins it.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…cing (asksurf-ai#28)

Cache.WriteConfig() errors were swallowed, so a failed expiry write made
every subsequent invocation treat the spec cache as missing and re-sync
('No cached API spec, syncing...' on each call). Log the failure reason
to stderr, and include the file path in the cbor cache write error.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* [FIX] sync surf API spec from configured base

* fix(tests): build surf binary with windows extension

* fix(cli): keep surf cache tests hermetic

---------

Co-authored-by: HappySean <zhaoxiang2845@gmail.com>
# Conflicts:
#	cmd/surf/main.go
#	cmd/surf/main_test.go
@ZhimaoL

ZhimaoL commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Closing this PR because it merged origin/main into stg and pulled unrelated historical main/stg drift into the diff. I will replace it with a minimal cherry-pick PR containing only the configured base URL sync fix needed for staging exchange e2e.

@ZhimaoL ZhimaoL closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants