Skip to content

fix(typecheck): declare bundled markdown and macro fields - #1562

Merged
kevincodex1 merged 2 commits into
Twigpine:mainfrom
chioarub:codex/typecheck-global-declarations
Jun 10, 2026
Merged

kevincodex1 merged 2 commits into
Twigpine:mainfrom
chioarub:codex/typecheck-global-declarations

Conversation

@chioarub

@chioarub chioarub commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Declare the missing MACRO.FEEDBACK_CHANNEL and MACRO.VERSION_CHANGELOG build-time fields in src/global.d.ts.
  • Add a *.md module declaration for Bun text-loader imports used by bundled skill content.

Why

bun run typecheck currently reports declaration drift in two places:

  • Source files read MACRO.FEEDBACK_CHANNEL and MACRO.VERSION_CHANGELOG, but the ambient MACRO type did not include those fields.
  • src/skills/bundled/claudeApiContent.ts imports Markdown assets as strings, but TypeScript had no ambient declaration for Markdown modules.

This PR keeps the fix to the ambient type surface only and does not change runtime behavior.

Refs #1486

Validation

  • bun run typecheck
    • Before: 1,043 diagnostic lines, including 37 targeted diagnostics for Markdown imports and missing MACRO fields.
    • After: 1,003 diagnostic lines; the 37 targeted diagnostics are gone.
    • The command still reports unrelated existing TypeScript errors outside this PR scope.

Summary by CodeRabbit

  • New Features

    • Add support for importing Markdown content into the project.
  • Chores

    • Update build/type configuration to surface a feedback channel setting and an optional version changelog value.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2134db7e-a993-41b4-b84c-96b1c6187382

📥 Commits

Reviewing files that changed from the base of the PR and between 7081562 and 512e1da.

📒 Files selected for processing (1)
  • scripts/build.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{ts,tsx,js,jsx,py}: Follow the existing code style in the touched files
Keep comments useful and concise

Files:

  • scripts/build.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • scripts/build.ts
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}

⚙️ CodeRabbit configuration file

{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}: Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety. Block on changes that can break Windows/macOS/Linux startup or publish unexpected artifacts.

Files:

  • scripts/build.ts
**

⚙️ CodeRabbit configuration file

**: # Contributing to OpenClaude

Thanks for contributing.

OpenClaude is a fast-moving open-source coding-agent CLI with support for multiple providers, local backends, MCP, and a terminal-first workflow. The best contributions here are focused, well-tested, and easy to review.

Before You Start

  • Search existing issues and discussions before opening a new thread.
  • Check open pull requests for work that overlaps with your contribution. If a PR already exists that addresses the same change, open an issue or discussion first to align on direction — duplicate PRs may be closed without review.
  • Use issues for confirmed bugs and actionable feature work.
  • Use discussions for setup help, ideas, and general community conversation.
  • For larger changes, open an issue first so the scope is clear before implementation.
  • For security reports, follow SECURITY.md.

Pull Requests

Every PR needs a reason. Your PR description must include:

  • what changed and why
  • the user or developer impact
  • the exact checks you ran
  • a linked issue when one exists, using Fixes fix: skip assertMinVersion for third-party providers #123, `Closes `#123, or another clear link
  • screenshots when the PR touches UI, terminal presentation, or the VS Code extension
  • which provider path was tested when the PR changes provider behavior

The PR author is responsible for ensuring their PR is merge-ready. PRs with merge conflicts will not be reviewed or approved until the conflicts are resolved.

Issues are the recommended starting point for anything non-trivial — opening one first helps avoid wasted effort if the change is out of scope or already being worked on. Small fixes, doc corrections, and obvious improvements can stand on their own without a linked issue, as long as the PR description explains the intent.

What Gets Closed Without Review

PRs may be closed without review...

Files:

  • scripts/build.ts
🔇 Additional comments (1)
scripts/build.ts (1)

149-149: LGTM!

Also applies to: 498-498


📝 Walkthrough

Walkthrough

PR extends TypeScript global types in src/global.d.ts by adding FEEDBACK_CHANNEL and optional VERSION_CHANGELOG to the MACRO global and declaring *.md modules; it also injects MACRO.VERSION_CHANGELOG: 'undefined' into Bun build define for both CLI and SDK bundles.

Changes

Global Type Definitions and Build Wiring

Layer / File(s) Summary
Global type definitions and Markdown imports
src/global.d.ts
MACRO global extended with FEEDBACK_CHANNEL: string and VERSION_CHANGELOG: string | undefined. Adds declare module '*.md' exporting default string content.
Build define wiring for VERSION_CHANGELOG
scripts/build.ts
Adds define entry MACRO.VERSION_CHANGELOG: 'undefined' to both the CLI (dist/cli.mjs) and SDK (dist/sdk.mjs) Bun.build configurations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • jatmn
  • kevincodex1
🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: declaring missing MACRO fields and adding markdown module declaration for typecheck purposes.
Description check ✅ Passed The description covers all required sections with clear explanations of what changed, why, and validation results showing the fix resolves the targeted diagnostics.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed PR is pure TypeScript/build declarations with no runtime modifications to skills or other risk areas. While PR objectives mention claudeApiContent.ts, no actual skill logic or behavior is changed.
No Hidden Policy Change ✅ Passed PR adds TypeScript declarations for existing MACRO fields and .md imports without changing product, trust-model, telemetry, network, routing, or permission policies—purely a typecheck cleanup.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 9, 2026

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found an issue that needs to be addressed before this is ready.

Findings

  • [P2] Do not declare VERSION_CHANGELOG until the build provides it
    src/global.d.ts:17
    This PR now tells TypeScript that MACRO.VERSION_CHANGELOG is a valid build-time field, but the OpenClaude build maps in scripts/build.ts still only define the other MACRO.* fields. After running bun run build on this branch, dist/cli.mjs still contains a literal MACRO.VERSION_CHANGELOG, while the other declared macros are inlined. The Ant release-note paths read this field when USER_TYPE === 'ant', so this declaration removes the typecheck signal without actually making the macro exist at runtime. Please either add the corresponding build define entries or leave this field undeclared until the runtime build surface supplies it.

@chioarub
chioarub requested a review from jatmn June 9, 2026 14:30

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I rechecked the previously discussed paths and do not see any remaining actionable issues from my side.

@kevincodex1 LGTM

@kevincodex1
kevincodex1 merged commit 5c239eb into Twigpine:main Jun 10, 2026
3 checks passed
@chioarub
chioarub deleted the codex/typecheck-global-declarations branch June 10, 2026 05:56
deagwon97 pushed a commit to deagwon97/openclaude that referenced this pull request Jun 11, 2026
)

* fix(typecheck): declare bundled markdown and macro fields

* fix(build): define version changelog macro
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.

3 participants