Skip to content

fix(bundled-defaults): auto-generate import list, emit inline strings#1263

Merged
Wirasm merged 3 commits intodevfrom
fix-bundled-defaults-drift
Apr 16, 2026
Merged

fix(bundled-defaults): auto-generate import list, emit inline strings#1263
Wirasm merged 3 commits intodevfrom
fix-bundled-defaults-drift

Conversation

@Wirasm
Copy link
Copy Markdown
Collaborator

@Wirasm Wirasm commented Apr 16, 2026

Summary

  • Problem: bundled-defaults.ts is a hand-maintained import list. It had drifted by 15 commands + 7 workflows, so 22 on-disk defaults were silently missing from compiled binary distributions.
  • Why it matters: archon-plan-to-pr and other bundled workflows reference commands (archon-plan-setup, archon-confirm-plan, archon-finalize-pr, etc.) that shipped as dangling pointers in the binary. Also: the with { type: 'text' } import attributes are Bun-specific and block loading @archon/workflows from Node (SDK blocker updated code to use locally hosted llama LLM, nomic-embed-text model. #2).
  • What changed: New generator script walks .archon/{commands,workflows}/defaults/ and emits bundled-defaults.generated.ts with inline string literals. bundled-defaults.ts becomes a thin facade keeping isBinaryBuild(). CI verifies the generated file is up to date via bun run check:bundled, which is wired into bun run validate. The build script regenerates before compile.
  • What did not change (scope boundary): Runtime discovery logic, override precedence, BUNDLED_IS_BINARY flip mechanism, opt-out config. Zero behavior change for existing users — just: the bundle now contains all 56 defaults instead of 34.

Label Snapshot

  • Risk: `risk: low`
  • Size: `size: M`
  • Scope: `workflows`, `ci`, `dependencies`
  • Module: `workflows:bundled-defaults`

Change Metadata

  • Change type: `bug` (drift that shipped in binaries) + `refactor` (generator + facade)
  • Primary scope: `workflows`

Linked Issue

  • None (discovered via audit of `.claude/PRPs/reports/bundled-workflows-and-commands-report.md`)

Validation Evidence

```
bun run check:bundled ✔ 36 commands, 20 workflows
bun run type-check ✔ all 10 packages
bun run lint ✔
bun run format:check ✔
bun --filter @archon/workflows test ✔ all green (162 tests)
bun run cli workflow list ✔ loads 20 bundled workflows at runtime
```

Pre-existing failures on `dev` unrelated to this PR: 3 × `connection > getDatabaseType` in `@archon/core` (verified by checkout + rerun of `dev`).

Security Impact

  • New permissions/capabilities? `No`
  • New external network calls? `No`
  • Secrets/tokens handling changed? `No`
  • File system access scope changed? `No` — generator reads the same default files as before; only the emit format differs.

Compatibility / Migration

  • Backward compatible? `Yes` — no runtime behavior change.
  • Config/env changes? `No`
  • Database migration needed? `No`

Human Verification

  • Verified scenarios:
    • `bun run cli workflow list` loads all 20 bundled workflows + repo-level additions (source build path, `isBinaryBuild() === false` branch)
    • Regenerate-idempotency: running `bun run generate:bundled` then `bun run check:bundled` passes
    • Drift-detection: hand-deleted an entry from `bundled-defaults.generated.ts` — `check:bundled` exits with code 2 and instructs to regenerate
  • Edge cases checked:
    • Generator fails loud on invalid kebab-case filenames and empty files
    • `.archon/` prettier-ignored (no format noise on content changes)
    • Generated file is eslint-ignored (no type-info parser errors)
  • What was not verified: Actual binary compile (`bun run build:binaries` takes ~5min × 4 targets; trusted the source-mode smoke test since both paths import the same module).

Side Effects / Blast Radius

  • Affected subsystems: Only `@archon/workflows/defaults/bundled-defaults.{ts,generated.ts,test.ts}` and build tooling (`package.json`, `scripts/`, eslint/prettier ignores).
  • Potential unintended effects: If a dev adds a default but forgets to regenerate, `check:bundled` in `bun run validate` fails locally before CI — that's the intended guardrail.
  • Guardrails: The new `bundle completeness` test derives its expected set from `.archon/{commands,workflows}/defaults/` via `readdirSync`, so the assertion stays truthful even if both records and source change.

Rollback Plan

  • Fast rollback: `git revert ` — single-commit change.
  • Feature flags: None needed.
  • Observable failure symptoms: `check:bundled` or the `bundle completeness` test would fail loudly; no silent degradation.

Risks and Mitigations

  • Risk: Generated file is ~87KB and will show up as diff noise when default `.md`/`.yaml` contents change.
    • Mitigation: Intentional — content-level diffs in PRs now surface which defaults changed, which is more informative than "one import line moved."
  • Risk: Someone edits `bundled-defaults.generated.ts` by hand.
    • Mitigation: File header says AUTO-GENERATED; `check:bundled` catches any drift on the next validate run.

Summary by CodeRabbit

  • Chores

    • Regenerate bundled defaults automatically during builds and add CLI commands to generate/check them
    • Add a pre-PR/CI bundled-defaults check and broaden project type-check/lint scope to include scripts
    • Have format/lint ignore generated files
  • Tests

    • Validate bundled defaults against on-disk sources for filename and content consistency
  • Documentation

    • Document generate/check steps and update PR validation guidance
  • Workflows

    • Update Codex model configuration used by E2E smoke tests

Root-cause fix for bundle drift (15 commands + 7 workflows previously
missing from binary distributions) and a prerequisite for packaging
@archon/workflows as a Node-loadable SDK.

The hand-maintained `bundled-defaults.ts` import list is replaced by
`scripts/generate-bundled-defaults.ts`, which walks
`.archon/{commands,workflows}/defaults/` and emits a generated source
file with inline string literals. `bundled-defaults.ts` becomes a thin
facade that re-exports the generated records and keeps the
`isBinaryBuild()` helper.

Inline strings (via JSON.stringify) replace Bun's
`import X from '...' with { type: 'text' }` attributes. The binary build
still embeds the data at compile time, but the module now loads under
Node too — removing SDK blocker #2.

- Generator: `scripts/generate-bundled-defaults.ts` (+ `--check` mode for CI)
- `package.json`: `generate:bundled`, `check:bundled`; wired into `validate`
- `build-binaries.sh`: regenerates defaults before compile
- Test: `bundle completeness` now derives expected set from on-disk files
- All 56 defaults (36 commands + 20 workflows) now in the bundle
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 271f9cb5-914e-4565-8931-ed179bf11b95

📥 Commits

Reviewing files that changed from the base of the PR and between ce0a205 and 99afe2d.

📒 Files selected for processing (2)
  • .archon/workflows/e2e-codex-smoke.yaml
  • .archon/workflows/e2e-mixed-providers.yaml

📝 Walkthrough

Walkthrough

A generator was added to produce a compiled bundle of command and workflow defaults from .archon disk files. CI, build scripts, tests, and config were updated to run or ignore the generated output; the bundle is emitted to packages/workflows/src/defaults/bundled-defaults.generated.ts and consumed by the codebase.

Changes

Cohort / File(s) Summary
Ignore & Lint Config
\.prettierignore, eslint.config.mjs
Added **/*.generated.ts to Prettier/Eslint ignore lists; expanded ESLint files to include scripts/**/*.ts.
Package scripts & CI
package.json, .github/workflows/test.yml
Added generate:bundled and check:bundled (Bun); validate now runs check:bundled; CI test job runs check:bundled after install.
Generator & TS config
scripts/generate-bundled-defaults.ts, scripts/tsconfig.json
New Bun script that renders bundled-defaults.generated.ts from .archon files with validations and --check mode; added scripts/tsconfig.json to type-check scripts.
Build integration
scripts/build-binaries.sh
Calls the generator as a pre-build step so compiled binaries include current defaults.
Bundled module & tests
packages/workflows/src/defaults/bundled-defaults.ts, packages/workflows/src/defaults/bundled-defaults.test.ts
bundled-defaults.ts now re-exports from generated file; tests updated to discover on-disk defaults and assert keys and exact contents match the generated bundle.
Docs / Contributing
CLAUDE.md, CONTRIBUTING.md
Documentation and contribution notes updated to add check:bundled to validation and instruct running generate:bundled when editing defaults.
Minor config / ignores
.prettierignore, eslint.config.mjs
Added **/*.generated.ts to ignore lists to avoid formatting/linting generated outputs.

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant CI as CI
    participant Gen as Generator (scripts/generate-bundled-defaults.ts)
    participant FS as File System (.archon/…)
    participant Build as Build Script (scripts/build-binaries.sh)
    participant Tests as Test Suite

    Dev->>Gen: bun run generate:bundled (or bun run check:bundled)
    Gen->>FS: read .archon/commands/defaults/*.md and .archon/workflows/defaults/*.{yaml,yml}
    FS-->>Gen: file listings & contents
    Gen->>Gen: validate filenames, non-empty, no collisions
    Gen->>Gen: render bundled-defaults.generated.ts
    Gen-->>Dev: write file (or exit 2 if --check stale)

    CI->>Gen: bun run check:bundled (during validate)
    Gen->>FS: read & compare generated file
    Gen-->>CI: exit 0 (up-to-date) or non-zero (fail)

    Build->>Gen: run generator (pre-build)
    Gen-->>Build: provide updated generated bundle
    Build->>Build: compile binaries using generated bundle

    Tests->>FS: discover on-disk defaults
    Tests-->>Tests: assert BUNDLED_* keys and contents match on-disk files
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

Poem

🐇 I nibble defaults from disk and hum,

I stitch them into code, one-by-one.
Generated bundles snug and neat,
CI peeks in to check the feat.
Hop on — the binaries now run!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main changes: auto-generating bundled-defaults from source files and emitting inline strings instead of hand-maintained imports.
Description check ✅ Passed The description comprehensively covers all required template sections: Summary with Problem/Why/What Changed/Scope, Label Snapshot, Change Metadata, Linked Issues, Validation Evidence with test results, Security Impact assessment, Compatibility/Migration, Human Verification, Side Effects, Rollback Plan, and Risks/Mitigations.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-bundled-defaults-drift

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/generate-bundled-defaults.ts (1)

36-39: Prefer a shared interface for file entries instead of repeated inline object shapes.

This will reduce repetition and keep the signatures easier to maintain.

♻️ Suggested refactor
+interface BundledFileEntry {
+  name: string;
+  content: string;
+}
+
 async function collectFiles(
   dir: string,
   extensions: readonly string[]
-): Promise<Array<{ name: string; content: string }>> {
+): Promise<BundledFileEntry[]> {
   const entries = await readdir(dir);
   const matched = entries.filter(entry => extensions.some(ext => entry.endsWith(ext))).sort();
 
-  const files: Array<{ name: string; content: string }> = [];
+  const files: BundledFileEntry[] = [];
@@
 function renderRecord(
   comment: string,
   typeAlias: string,
   exportName: string,
-  files: Array<{ name: string; content: string }>
+  files: BundledFileEntry[]
 ): string {
@@
 function renderFile(
-  commands: Array<{ name: string; content: string }>,
-  workflows: Array<{ name: string; content: string }>
+  commands: BundledFileEntry[],
+  workflows: BundledFileEntry[]
 ): string {

As per coding guidelines, "TypeScript: Use interface for defining object shapes in TypeScript".

Also applies to: 43-43, 67-67, 81-82

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/generate-bundled-defaults.ts` around lines 36 - 39, Introduce a
shared TypeScript interface (e.g., FileEntry { name: string; content: string })
and replace all inline object types like Array<{ name: string; content: string
}> in functions such as collectFiles and the other spots flagged (the other
functions that return/handle { name, content } entries) with this interface;
update function return types, parameter types, and any local variable
annotations to use FileEntry to avoid repeated inline shapes and keep signatures
consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/generate-bundled-defaults.ts`:
- Around line 47-59: The collectFiles function currently normalizes filenames
(const name = entry.slice(0, -ext.length)) and then pushes into the files array,
which allows collisions like foo.yaml vs foo.yml to silently overwrite; add a
duplicate-name guard before files.push: check whether files already contains an
item with the same name (using the normalized name variable) and if so throw a
clear Error mentioning the duplicate entry and directory (including both
conflicting filenames if available), and apply the same guard in the other
identical spot around the second files.push to prevent silent overwrites.

---

Nitpick comments:
In `@scripts/generate-bundled-defaults.ts`:
- Around line 36-39: Introduce a shared TypeScript interface (e.g., FileEntry {
name: string; content: string }) and replace all inline object types like
Array<{ name: string; content: string }> in functions such as collectFiles and
the other spots flagged (the other functions that return/handle { name, content
} entries) with this interface; update function return types, parameter types,
and any local variable annotations to use FileEntry to avoid repeated inline
shapes and keep signatures consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 57cfcccb-a945-4271-a9cd-5565fd28bf24

📥 Commits

Reviewing files that changed from the base of the PR and between d535c83 and 11272cf.

📒 Files selected for processing (8)
  • .prettierignore
  • eslint.config.mjs
  • package.json
  • packages/workflows/src/defaults/bundled-defaults.generated.ts
  • packages/workflows/src/defaults/bundled-defaults.test.ts
  • packages/workflows/src/defaults/bundled-defaults.ts
  • scripts/build-binaries.sh
  • scripts/generate-bundled-defaults.ts

Comment thread scripts/generate-bundled-defaults.ts
@Wirasm
Copy link
Copy Markdown
Collaborator Author

Wirasm commented Apr 16, 2026

PR Review Summary (multi-agent)

Reviewed by: code-reviewer, docs-impact, pr-test-analyzer, comment-analyzer, silent-failure-hunter, code-simplifier.

Critical Issues (0)

None. Core approach is sound (generator + committed generated file + drift-detection).

Important Issues (4)

Agent Issue Location
code-reviewer collectFiles does not detect name collisions between .yaml and .yml variants of the same workflow — second entry silently overwrites first in the generated object literal. No-op today, but a realistic footgun. Add a Set-based dedup guard that throws. scripts/generate-bundled-defaults.ts:40-59
code-reviewer scripts/** is excluded from both ESLint (eslint.config.mjs:20) and type-check (no tsconfig covers scripts/). The generator is the one non-trivial TS file with no static guarantees. Consider scripts/tsconfig.json + removing the eslint ignore. eslint.config.mjs:20
comment-analyzer Generator header claims CI uses git diff --exit-code on the output (lines 12-13). It does not — drift is caught by bun run check:bundled (in-process string compare). Misleading for anyone chasing the real mechanism. scripts/generate-bundled-defaults.ts:12-13
comment-analyzer Dead cross-reference to .claude/rules/dx-quirks.md — that path does not exist in the repo. loader.test.ts pointer on the same line is still valid; drop the dead half. packages/workflows/src/defaults/bundled-defaults.ts:38

Suggestions (8)

Agent Suggestion Location
pr-test-analyzer check:bundled runs in bun run validate but not in .github/workflows/test.yml. Add a one-line CI step before Run tests to match the generator header claim and catch content-corruption drift (not just key-set drift). .github/workflows/test.yml
pr-test-analyzer Completeness tests assert key sets but not content fidelity. Optional: add a round-trip readFileSync == bundled[name] assertion for defense against generator content bugs. packages/workflows/src/defaults/bundled-defaults.test.ts:41-51
silent-failure-hunter Missing defaults directory surfaces as raw Node ENOENT with no remediation hint — add an early access() check with actionable message ("run from repo root"). scripts/generate-bundled-defaults.ts:124-127
silent-failure-hunter Top-level .catch(err => console.error(err)) prints full stack traces even for intentional throw new Error(...) cases (empty file, invalid name). Use err instanceof Error ? err.message : String(err) + type err: unknown. scripts/generate-bundled-defaults.ts:158-161
code-simplifier collectFiles: the if (!ext) continue guard after matched.filter(...) is dead — matched already guarantees ext exists. Collapse into one loop and remove the intermediate array. scripts/generate-bundled-defaults.ts:40-46
code-simplifier listNames test helper is a two-call-site extraction — by Rule of Three, inline it. Also lets the workflows case use .replace(/\.ya?ml$/, '') and drop the non-null assertion. packages/workflows/src/defaults/bundled-defaults.test.ts:13-21
code-simplifier Redundant toBeDefined() + typeof === 'string' assertions — the Record<string, string> type plus length > 50 already cover this. Drop the first two. packages/workflows/src/defaults/bundled-defaults.test.ts:56-59, 79-82
comment-analyzer /* eslint-disable */ in the generated file is redundant — eslint.config.mjs:20 already ignores **/*.generated.ts globally. packages/workflows/src/defaults/bundled-defaults.generated.ts:16

Documentation Issues (2)

File Issue Fix
CLAUDE.md:153 States bun run validate runs "four" checks; PR now prepends check:bundled, making it five. Update the sentence and step count.
CONTRIBUTING.md:19-26 Four-command breakdown presented as equivalent to bun run validate; no longer true. Either add check:bundled to the list or remove the breakdown.

Plus: add a bullet under the Defaults section of CLAUDE.md telling contributors to run bun run generate:bundled after adding/changing a default (otherwise bun run validate will fail on them with no prior hint). Docs site (packages/docs-web/) and README.md do not need changes — they describe user-facing behavior, not the build-time import mechanism.

Strengths

  • Drift detection is genuinely effective: the completeness tests would have caught the original 22-missing-defaults bug (21 vs 36, set equality fails immediately).
  • Every generator failure path exits non-zero; --check mode uses distinct exit code 2; build-binaries.sh inherits set -euo pipefail so generator failure aborts the binary build.
  • Two-file split (facade + generated) is well-sized — facade is exactly as thin as it needs to be while preserving the spyOn-able isBinaryBuild() indirection.
  • import.meta.dir-based path resolution in the test makes it CWD-independent (works from any worktree).
  • JSON.stringify for inline emission handles escaping for all edge cases correctly.
  • The spot-check comment at bundled-defaults.ts:35-37 (spyOn rationale) is a model example of the kind of non-obvious-WHY comment worth keeping.

Verdict

NEEDS FIXES — no blocking defects, but two of the important issues (the .yaml/.yml collision guard and the two misleading/dead comment references) are cheap fixes that would cleanly close out the PR. The CI gap (check:bundled not in test.yml) is worth closing in the same PR given the header claims CI runs it.

Recommended Actions

  1. Add name-collision guard to collectFiles + fix the two comment issues (.claude/rules/dx-quirks.md dead ref, git diff --exit-code mischaracterization).
  2. Wire bun run check:bundled into .github/workflows/test.yml.
  3. Update CLAUDE.md:153 and CONTRIBUTING.md:19-26 to reflect the new validate step, and add a contributor-facing bullet about bun run generate:bundled.
  4. Consider the simplifications (dead continue guard, inlining listNames, trimming redundant assertions) — low-effort, incremental clarity wins.

Wirasm added 2 commits April 16, 2026 22:13
Review: #1263 (comment)

Generator:
- Guard against .yaml/.yml name collisions (previously silent overwrite)
- Add early access() check with actionable error when run from wrong cwd
- Type top-level catch as unknown; print only message for Error instances
- Drop redundant /* eslint-disable */ emission (global ignore covers it)
- Fix misleading CI-mechanism claim in header comment
- Collapse dead `if (!ext) continue` guard into a single typed pass

Scripts get real type-checking + linting:
- New scripts/tsconfig.json extending root config
- type-check now includes scripts/ via `tsc --noEmit -p scripts/tsconfig.json`
- Drop `scripts/**` from eslint ignores; add to projectService file scope

Tests:
- Inline listNames helper (Rule of Three)
- Drop redundant toBeDefined/typeof assertions; the Record<string, string>
  type plus length > 50 already cover them
- Add content-fidelity round-trip assertion (defense against generator
  content bugs, not just key-set drift)

Facade comment: drop dead reference to .claude/rules/dx-quirks.md.

CI: wire `bun run check:bundled` into .github/workflows/test.yml so the
header's CI-verification claim is truthful.

Docs: CLAUDE.md step count four→five; add contributor bullet about
`bun run generate:bundled` in the Defaults section and CONTRIBUTING.md.
gpt-5.1-codex-mini is deprecated and unavailable on ChatGPT-account Codex
auth. Plain gpt-5.2 works. Verified end-to-end:

- e2e-codex-smoke: structured output returns {category:'math'}
- e2e-mixed-providers: claude+codex both return expected tokens
@Wirasm Wirasm merged commit 86e4c8d into dev Apr 16, 2026
2 of 4 checks passed
@Wirasm Wirasm deleted the fix-bundled-defaults-drift branch April 16, 2026 19:27
ztech-gthb pushed a commit to ztech-gthb/Archon that referenced this pull request Apr 18, 2026
…coleam00#1263)

* fix(bundled-defaults): auto-generate import list, emit inline strings

Root-cause fix for bundle drift (15 commands + 7 workflows previously
missing from binary distributions) and a prerequisite for packaging
@archon/workflows as a Node-loadable SDK.

The hand-maintained `bundled-defaults.ts` import list is replaced by
`scripts/generate-bundled-defaults.ts`, which walks
`.archon/{commands,workflows}/defaults/` and emits a generated source
file with inline string literals. `bundled-defaults.ts` becomes a thin
facade that re-exports the generated records and keeps the
`isBinaryBuild()` helper.

Inline strings (via JSON.stringify) replace Bun's
`import X from '...' with { type: 'text' }` attributes. The binary build
still embeds the data at compile time, but the module now loads under
Node too — removing SDK blocker coleam00#2.

- Generator: `scripts/generate-bundled-defaults.ts` (+ `--check` mode for CI)
- `package.json`: `generate:bundled`, `check:bundled`; wired into `validate`
- `build-binaries.sh`: regenerates defaults before compile
- Test: `bundle completeness` now derives expected set from on-disk files
- All 56 defaults (36 commands + 20 workflows) now in the bundle

* fix(bundled-defaults): address PR review feedback

Review: coleam00#1263 (comment)

Generator:
- Guard against .yaml/.yml name collisions (previously silent overwrite)
- Add early access() check with actionable error when run from wrong cwd
- Type top-level catch as unknown; print only message for Error instances
- Drop redundant /* eslint-disable */ emission (global ignore covers it)
- Fix misleading CI-mechanism claim in header comment
- Collapse dead `if (!ext) continue` guard into a single typed pass

Scripts get real type-checking + linting:
- New scripts/tsconfig.json extending root config
- type-check now includes scripts/ via `tsc --noEmit -p scripts/tsconfig.json`
- Drop `scripts/**` from eslint ignores; add to projectService file scope

Tests:
- Inline listNames helper (Rule of Three)
- Drop redundant toBeDefined/typeof assertions; the Record<string, string>
  type plus length > 50 already cover them
- Add content-fidelity round-trip assertion (defense against generator
  content bugs, not just key-set drift)

Facade comment: drop dead reference to .claude/rules/dx-quirks.md.

CI: wire `bun run check:bundled` into .github/workflows/test.yml so the
header's CI-verification claim is truthful.

Docs: CLAUDE.md step count four→five; add contributor bullet about
`bun run generate:bundled` in the Defaults section and CONTRIBUTING.md.

* chore(e2e): bump Codex model to gpt-5.2

gpt-5.1-codex-mini is deprecated and unavailable on ChatGPT-account Codex
auth. Plain gpt-5.2 works. Verified end-to-end:

- e2e-codex-smoke: structured output returns {category:'math'}
- e2e-mixed-providers: claude+codex both return expected tokens
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…coleam00#1263)

* fix(bundled-defaults): auto-generate import list, emit inline strings

Root-cause fix for bundle drift (15 commands + 7 workflows previously
missing from binary distributions) and a prerequisite for packaging
@archon/workflows as a Node-loadable SDK.

The hand-maintained `bundled-defaults.ts` import list is replaced by
`scripts/generate-bundled-defaults.ts`, which walks
`.archon/{commands,workflows}/defaults/` and emits a generated source
file with inline string literals. `bundled-defaults.ts` becomes a thin
facade that re-exports the generated records and keeps the
`isBinaryBuild()` helper.

Inline strings (via JSON.stringify) replace Bun's
`import X from '...' with { type: 'text' }` attributes. The binary build
still embeds the data at compile time, but the module now loads under
Node too — removing SDK blocker #2.

- Generator: `scripts/generate-bundled-defaults.ts` (+ `--check` mode for CI)
- `package.json`: `generate:bundled`, `check:bundled`; wired into `validate`
- `build-binaries.sh`: regenerates defaults before compile
- Test: `bundle completeness` now derives expected set from on-disk files
- All 56 defaults (36 commands + 20 workflows) now in the bundle

* fix(bundled-defaults): address PR review feedback

Review: coleam00#1263 (comment)

Generator:
- Guard against .yaml/.yml name collisions (previously silent overwrite)
- Add early access() check with actionable error when run from wrong cwd
- Type top-level catch as unknown; print only message for Error instances
- Drop redundant /* eslint-disable */ emission (global ignore covers it)
- Fix misleading CI-mechanism claim in header comment
- Collapse dead `if (!ext) continue` guard into a single typed pass

Scripts get real type-checking + linting:
- New scripts/tsconfig.json extending root config
- type-check now includes scripts/ via `tsc --noEmit -p scripts/tsconfig.json`
- Drop `scripts/**` from eslint ignores; add to projectService file scope

Tests:
- Inline listNames helper (Rule of Three)
- Drop redundant toBeDefined/typeof assertions; the Record<string, string>
  type plus length > 50 already cover them
- Add content-fidelity round-trip assertion (defense against generator
  content bugs, not just key-set drift)

Facade comment: drop dead reference to .claude/rules/dx-quirks.md.

CI: wire `bun run check:bundled` into .github/workflows/test.yml so the
header's CI-verification claim is truthful.

Docs: CLAUDE.md step count four→five; add contributor bullet about
`bun run generate:bundled` in the Defaults section and CONTRIBUTING.md.

* chore(e2e): bump Codex model to gpt-5.2

gpt-5.1-codex-mini is deprecated and unavailable on ChatGPT-account Codex
auth. Plain gpt-5.2 works. Verified end-to-end:

- e2e-codex-smoke: structured output returns {category:'math'}
- e2e-mixed-providers: claude+codex both return expected tokens
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.

1 participant