feat(cli): cowork proxy fix + rich report header meta strip#402
Conversation
- Use undici EnvHttpProxyAgent in Cowork instead of globalThis.fetch; createClient is now async to await the undici import - Add createCoworkFetch export; externalize undici in tsup config - convertFormData helper ensures undici.fetch receives undici.FormData - sendViaUndiciProxy falls back to EnvHttpProxyAgent if ProxyAgent fails - Report header: SOURCE · ANALYZED · AUDIENCE · CITATIONS · PAGES meta strip with dc-meta BEM classes (replaces single .meta paragraph) - Brand logo SVG in footer (square caps, crispEdges per BRANDING.md) - Cowork notice banner in both plain and report shells - Table anti-grid: no fill, heavier separators, blue hover row - Link color #3B82F6 → #0284C7; bg #FDFBF7 → #F8FAFC Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…readability, tests - Narrow sendViaUndiciProxy outer catch to import-only so real network errors (DNS, TLS, proxy-auth) propagate instead of silently retrying with globalThis.fetch - Add console.error warning when ProxyAgent falls back to EnvHttpProxyAgent - Add justification comment on `as unknown as BodyInit` cast in convertFormData - Extract formatSourceUrl() helper from nested IIFE in buildMetaStrip - Add tests: sourceUrl link rendering, https-only filter, citationCount in meta strip, cowork notice banner present/absent Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
✅ Playwright Test ReportStatus: Tests passed 📊 Download Report & Snapshots (see Artifacts section) What's in the Visual SnapshotsThe gallery includes visual snapshots for:
Run ID: 23900267378 |
Code ReviewOverall this is a solid PR — the proxy fix rationale is well-explained, the meta strip is clean, and the new tests are a meaningful addition. A few issues worth addressing before merge: Bug / Correctness
Either the regex should be Orphaned JSDoc commentIn /**
* Build the header meta strip: SOURCE · ANALYZED · AUDIENCE · CITATIONS · PAGES.
* Only renders items that have data. Date always renders (defaults to today).
*/
/** Strip scheme from a URL for display: "https://example.com/doc" → "example.com/doc". */
function formatSourceUrl(url: string): string {Only the second
|
…work CSS class, proxy error logging, test coverage Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary
undici.EnvHttpProxyAgentvia a newcreateCoworkFetch()helper. In Cowork,globalThis.fetchdoes NOT auto-route throughHTTP_PROXY/HTTPS_PROXY; undici'sEnvHttpProxyAgent+undici.fetch(the only fetch that respectsdispatcher) is required.createClientis nowasyncto accommodate the dynamic undici import.<p class="meta">source label with a structureddc-metastrip showing SOURCE (clickable link if https URL), ANALYZED date (always shown), AUDIENCE (non-default only), CITATIONS count, and optional PAGES count.IS_COWORKis true, bothplainShellandreportShellrender a blue info banner explaining that full page views require opening the file in a local browser.crispEdges, zinc-900 brackets, blue-700 spark).undiciexternalized intsup.config.ts— prevents bundling a Node runtime package.convertFormData) extracted as a shared helper used by bothsendViaUndiciProxyandcreateCoworkFetch.Test plan
bun testpasses (new tests cover sourceUrl link rendering, citationCount, cowork banner presence/absence, sourceUrl fallback to label for non-https)dc prepare <url>in a Cowork session — verify requests succeed through proxydc prepare <url>outside Cowork — verify normal CONNECT tunnel still used<a>tag for https URLs, plain text for labels without URLIS_COWORK=true, absent otherwiseundiciis absent from bundled output (grep -r "undici" lib/)