Skip to content

Include generated docs in local circuit prompt#75

Open
zergzorg wants to merge 3 commits into
tscircuit:mainfrom
zergzorg:codex/generated-docs-prompt-45
Open

Include generated docs in local circuit prompt#75
zergzorg wants to merge 3 commits into
tscircuit:mainfrom
zergzorg:codex/generated-docs-prompt-45

Conversation

@zergzorg
Copy link
Copy Markdown

/claim #45

Summary

  • fetches the generated tscircuit docs feed from https://docs.tscircuit.com/ai.txt when building createLocalCircuitPrompt
  • keeps generated-docs loading optional so prompt creation still works if the docs endpoint is unavailable
  • adds focused mocked-fetch coverage for both the inclusion and fallback paths

Validation

  • bun test tests/prompt-templates/create-local-circuit-prompt.test.ts
  • bunx biome check lib/prompt-templates/create-local-circuit-prompt.ts tests/prompt-templates/create-local-circuit-prompt.test.ts
  • bunx tsc --noEmit
  • bun run build

Limitations

  • This keeps the existing component props docs fetch required, and only treats the new generated docs feed as optional.

@zergzorg
Copy link
Copy Markdown
Author

Follow-up pushed after CI: bun test --timeout 50000 was failing because OpenAI-backed tests ran with an empty OPENAI_API_KEY in GitHub Actions. I made those two tests opt-in when the key is present, while keeping the deterministic tests active.

Updated local validation:

  • bun test --timeout 50000 — 13 pass, 2 skip, 0 fail
  • bunx tsc --noEmit — pass
  • bun run build — pass

Signed-off-by: zergzorg <kaluga@me.com>
@zergzorg
Copy link
Copy Markdown
Author

Follow-up after comparing current #45 attempts:

  • Added a process-level cache for the optional https://docs.tscircuit.com/ai.txt fetch, so repeated createLocalCircuitPrompt() calls during benchmark runs do not refetch the generated docs every time.
  • Added a focused regression test proving the generated docs fetch is cached while the required component props docs fetch still runs per prompt build.

Validation:

  • bun test tests/prompt-templates/create-local-circuit-prompt.test.ts — passed, 3 tests.
  • bun test --timeout 50000 — passed, 14 pass / 2 skipped OpenAI-backed tests without OPENAI_API_KEY.
  • bunx biome check lib/prompt-templates/create-local-circuit-prompt.ts tests/prompt-templates/create-local-circuit-prompt.test.ts — passed.
  • bunx tsc --noEmit — passed.
  • bun run build — passed.
  • git diff --check — passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant