Commit graph

13 commits

Author SHA1 Message Date
Cole Medin
75427c7cdd fix(ci): normalize line endings in bundled-defaults generator
On Windows, `git checkout` converts source files to CRLF via the
`* text=auto` policy. The generator inlined raw file content as JSON
strings, so the Windows regeneration produced `\r\n` escapes while the
committed artifact (written on Linux) used `\n`. `bun run check:bundled`
then flagged the file as stale and failed the Windows CI job.

Fix by normalizing CRLF → LF both when reading source defaults and when
comparing against the existing generated file. No-op on Linux.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-16 17:55:24 -05:00
Rasmus Widing
86e4c8d605
fix(bundled-defaults): auto-generate import list, emit inline strings (#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: https://github.com/coleam00/Archon/pull/1263#issuecomment-4262719090

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
2026-04-16 21:27:51 +02:00
Rasmus Widing
eff8b0dc60 fix: sync all workspace versions from root and automate in release skill 2026-04-10 15:31:43 +03:00
Rivo Link
53cabd44fd
fix: PowerShell Add-ToUserPath corrupts PATH when single entry exists (#1000) 2026-04-09 19:43:52 +03:00
Rasmus Widing
9adc54afdd
fix(release): wire release workflow to scripts/build-binaries.sh (#986) (#987)
* Investigate issue #986: release workflow bypasses build-binaries.sh

* fix(release): wire release workflow to scripts/build-binaries.sh (#986)

The release workflow called `bun build --compile` inline, bypassing the
build-time-constants rewrite in scripts/build-binaries.sh. Released binaries
shipped with BUNDLED_IS_BINARY=false, causing `archon version` to crash with
"package.json not found (bad installation?)" on v0.2.13 and v0.3.0.

Changes:
- Refactor scripts/build-binaries.sh to support single-target mode via
  TARGET/OUTFILE env vars; preserve multi-target local-dev mode unchanged.
  Always --minify; skip --bytecode for Windows targets.
- Update .github/workflows/release.yml to call the script with the matrix
  target/outfile, stripping the 'v' prefix and shortening the SHA.
- Add a post-build smoke test on bun-linux-x64 that asserts the binary
  reports "Build: binary" and the tag version (would have caught both
  broken releases).
- Document local CI-equivalent build invocation in the test-release skill.

Fixes #986

* chore: archive investigation for issue #986

* skill(release): document Homebrew formula SHA sync and verification

The release skill previously stopped at tag creation and GitHub release
creation. Formula updates were happening manually outside the skill and
consistently drifting — v0.3.0's homebrew/archon.rb had the correct
version string but SHAs from v0.2.13, because whoever updated it did so
before the release workflow had built the v0.3.0 binaries.

Add three new steps to close the gap:

- Step 10: wait for release workflow, fetch checksums.txt, update
  homebrew/archon.rb atomically with new version AND new SHAs in a
  single commit. The formula is regenerated from a template rather
  than edited in place, eliminating the risk of partial updates.
- Step 11: sync the rewritten formula to coleam00/homebrew-archon
  tap repo (the file users actually install from). Fails loudly if
  push access is missing instead of silently skipping.
- Step 12: run /test-release brew and /test-release curl-mac to
  verify the install path actually works end-to-end before announcing
  the release. A release that installs but crashes is worse than no
  release at all.

Also:
- Add a prominent warning at the top about the chicken-and-egg
  relationship between version and SHAs (they must move atomically,
  and SHAs can only be known after binaries exist).
- Add three new rules to "Important Rules":
  * never update version without also updating SHAs
  * never skip the tap sync (main repo formula is just a template)
  * never announce a release that failed /test-release

Related to #986 (release workflow bypasses build-binaries.sh) — both
bugs block the next working release; fixing only one leaves the
install path broken.

* fix(release): address review feedback on smoke test and restore trap

- release.yml: use inputs.version on workflow_dispatch so the build step
  doesn't embed the branch name as the binary version
- release.yml: compare smoke-test version against the stripped semver
  instead of the raw ref, so the check doesn't rely on the CLI re-adding
  a 'v' prefix
- release.yml: fail fast if the binary crashes on first invocation
  instead of falling through to the 'wrong build type' branch
- release.yml: add a second smoke step that runs 'workflow list' in a
  temp repo to catch the class of bug where bundled defaults fail to
  embed in the binary
- build-binaries.sh: drop '2>/dev/null' on the EXIT trap so restore
  failures surface in the log with a clear WARNING
- test-release skill: fix the single-target verification path
2026-04-08 15:02:09 +03:00
Rasmus Widing
e77899446e
fix(build): use build-time constants for binary detection and pretty stream logger (#982)
* fix(build): use build-time constants for binary detection and pretty stream logger

Replaces runtime detection of compiled binaries (env sniffing via
import.meta.dir / process.execPath) with a build-time BUNDLED_IS_BINARY
constant in @archon/paths/bundled-build.ts, rewritten by
scripts/build-binaries.sh and restored on EXIT via a trap.

Also rewrites @archon/paths/logger.ts to use pino-pretty as a destination
stream instead of a worker-thread transport. The formatter now runs on
the main thread, eliminating the require.resolve('pino-pretty') lookup
that crashes inside Bun's /\$bunfs/ virtual filesystem in compiled
binaries. The same code path runs in dev and binaries — no environment
detection in the logger at all.

isBinaryBuild() in @archon/workflows is kept as a one-line wrapper
around BUNDLED_IS_BINARY so existing spyOn-based test mocking in
loader.test.ts continues to work without modification.

Closes #960
Closes #961
Closes #979
Supersedes #962
Supersedes #963

Co-Authored-By: leex279 <leex279@users.noreply.github.com>

* style(workflows): hoist BUNDLED_IS_BINARY import to top of file

* fix(build,logger): harden pretty init and trap restore

- logger: wrap pino-pretty init in try/catch and fall back to JSON so a
  broken TTY or missing peer can't crash module load.
- build-binaries.sh: drop '2>/dev/null || true' from the EXIT trap so a
  failed bundled-build.ts restore is visible instead of silently leaving
  the dev tree with BUNDLED_IS_BINARY=true.
- bundled-defaults: unmark isBinaryBuild() @deprecated and document why
  the wrapper is the intentional test seam (mock.module pollution in Bun).

---------

Co-authored-by: leex279 <leex279@users.noreply.github.com>
2026-04-08 12:02:56 +03:00
DIY Smart Code
dddff8701c
feat(cli): embed git commit hash in version output (#1035)
* feat(cli): embed git commit hash in version output

- Add BUNDLED_GIT_COMMIT constant to bundled-version.ts for binary builds
- Read commit at runtime via git rev-parse (dev) or from bundled constant (binary)
- Display Git commit: line in archon version output; falls back to "unknown"
- Update build-binaries.sh to capture and embed short SHA at compile time
- Update version tests to assert new Git commit: output line

* fix: use @archon/git execFileAsync and add error logging in version command

- Replace local child_process/promisify wrapper with execFileAsync from @archon/git
  (fixes CLAUDE.md violation; enables test mockability via spyOn)
- Add 5s timeout to git rev-parse subprocess call to prevent indefinite hang
- Log debug trace in catch block with comment explaining intentional fallback
- Import createLogger from @archon/paths for structured logging
- Update version.test.ts to spy on @archon/git execFileAsync for deterministic SHA
- Add test case covering the git-unavailable fallback path (returns 'unknown')
- Tighten git commit assertion to match exact value instead of label presence only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Archon <archon@dynamous.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 10:05:28 +03:00
Rasmus Widing
4e5b343630 fix: address review findings for open-source migration PR
- Fix deploy-docs.yml: add missing upload-pages-artifact step, pin npm@11
- Remove stray website/--path binary and website/.astro/ build artifacts
- Add website/.gitignore for .astro/, dist/, node_modules/
- Fix release.yml: bump Bun to 1.3.11, exclude --bytecode for Windows cross-compile
- Bump test.yml Bun version to 1.3.11
- Add Write-Warn to install.ps1 architecture registry fallback
- Fix stale docs references: cloud-deployment.md paths (/opt/archon), getting-started.md
  skill copy path, archon-architecture.md project name, SSH key comment
- Remove dead links from quick-start.md, trim empty sidebar sections in astro config
- Add test comment explaining isBinaryBuild() true path coverage limitation
2026-04-06 10:04:51 +03:00
Cole Medin
ae346c2a67 feat: prepare for open-source migration to coleam00/Archon
- Replace all dynamous-community/remote-coding-agent references with coleam00/Archon
- Replace all ghcr.io/dynamous-community/remote-coding-agent with ghcr.io/coleam00/archon
- Change license from proprietary Dynamous to MIT
- Fix cd directory name in docs (remote-coding-agent → Archon)
- Remove hardcoded local paths from skills and docs
- Add Windows x64 binary to release pipeline (cross-compiled from Linux)
- Add --minify --bytecode flags to binary compilation
- Create PowerShell install script (scripts/install.ps1)
- Fix isBinaryBuild() detection for Bun 1.3.5+ (use import.meta.dir virtual FS check)
- Scaffold Astro Starlight docs site at website/ (Astro 6 + Starlight 0.38)
- Add deploy-docs.yml workflow for GitHub Pages
- Update test.yml branch triggers (develop → dev)
- Add install section with curl/PowerShell/Homebrew/Docker to README
- Add badges and archon.diy docs link to README
- Create SECURITY.md with vulnerability disclosure policy
- Update CONTRIBUTING.md for public audience
- Add website/ and eslint ignores for Astro-generated files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 10:47:22 -05:00
Rasmus Widing
0e57b2f788 fix: Update all repo URLs from raswonders to dynamous-community 2026-01-22 00:20:27 +02:00
Rasmus Widing
68e7db0466
feat: Phase 5 - CLI binary distribution (#325)
* docs: Add Phase 5 CLI binary distribution plan

- Create detailed implementation plan for binary distribution
- Add Phase 5.0: Bundle defaults for binary (depends on #322)
- Add Phase 5.1-5.7: Build scripts, GitHub Actions, curl install,
  Homebrew formula, Windows docs, version command, release guide
- Update research doc with Phase 6 (auto-update command)
- Renumber dashboard to Phase 7, workflow builder to Phase 8
- Mark Phases 1-4 as complete in research doc

* feat: Phase 5 - CLI binary distribution

Implement standalone binary distribution for Archon CLI:

- Bundle default commands and workflows into binaries at compile time
- Add build scripts for cross-platform compilation (macOS/Linux, ARM64/x64)
- Create GitHub Actions release workflow triggered on version tags
- Add curl install script with checksum verification
- Create Homebrew formula for macOS/Linux installation
- Update version command to show platform, build type, and database info
- Add developer release guide documentation
- Update README with CLI installation instructions

Binary compilation uses Bun's --compile flag to create standalone
executables that include the Bun runtime and all dependencies.
Default workflows and commands are imported as text at compile time
and embedded directly into the binary.

* fix: Pin Dockerfile to Bun 1.3.4 to match lockfile version

The Docker build was failing because oven/bun:1-slim resolved to 1.3.6
while the lockfile was created with 1.3.4, causing --frozen-lockfile to fail.

* docs: Clarify binary vs source builds for default commands/workflows

* fix: Address PR review issues for CLI binary distribution

Security fixes:
- install.sh: Require SKIP_CHECKSUM=true to bypass checksum verification
  instead of silently skipping (addresses security vulnerability)
- install.sh: Show actual error output when version check fails instead
  of falsely reporting success

Validation improvements:
- checksums.sh: Validate all 4 expected binaries exist before generating
  checksums to prevent releasing incomplete builds
- build-binaries.sh: Verify binary exists and has reasonable size (>1MB)
  after each build step
- update-homebrew.sh: Validate extracted checksums are non-empty and
  look like valid SHA256 hashes (64 hex chars)
- update-homebrew.sh: Fix sed patterns to use URL context for updating
  checksums on subsequent runs

Bug fixes:
- homebrew/archon.rb: Fix test to expect exit code 0 (success) instead
  of 1 for `archon version`
- loader.ts: Log error when bundled workflow fails to parse (indicates
  build-time corruption)

Test coverage:
- Add bundled-defaults.test.ts for isBinaryBuild() and content validation
- Add connection.test.ts for getDatabaseType() function
- Add binary build bundled workflow tests to loader.test.ts
- Add binary build bundled command tests to executor.test.ts

All 959 tests pass.
2026-01-21 23:51:51 +02:00
Rasmus Widing
2ff7975230 Switch to Bun native YAML and auto-create default config
- Replace yaml npm package with Bun.YAML.parse()
- Auto-create ~/.archon/config.yaml on first run with documented defaults
- Update validation script to check for config file existence
2025-12-17 21:56:12 +02:00
Rasmus Widing
3026a6445d
Add Archon distribution config and directory structure (#101)
* Add Archon distribution config and directory structure

- Create centralized path resolution in src/utils/archon-paths.ts
- Add YAML configuration system (src/config/) with layered loading
- Update Dockerfile and docker-compose for /.archon/ directory
- Add GHCR publish workflow for multi-arch Docker builds
- Create deploy/ directory with end-user docker-compose
- Add /init command to create .archon structure in repos
- Add docs/configuration.md reference guide
- Update README with Quick Start section
- Add bun run validate script
- Update tests for new path defaults (~/.archon/)

Directory structure:
- Local: ~/.archon/{workspaces,worktrees,config.yaml}
- Docker: /.archon/{workspaces,worktrees}
- Repo: .archon/{commands,workflows,config.yaml}

Legacy WORKSPACE_PATH and WORKTREE_BASE env vars still supported.

* Complete Archon distribution config implementation

- Wire up config system in src/index.ts (Task 3.5)
- Remove legacy WORKSPACE_PATH and WORKTREE_BASE support
- Add logConfig() function to config-loader.ts
- Update docker-compose.yml to use ARCHON_DOCKER env var
- Remove legacy env vars from .env.example
- Update all documentation to reference ARCHON_HOME
- Create scripts/validate-setup.sh for setup validation
- Add setup:check script to package.json
- Create docs/getting-started.md guide
- Create docs/archon-architecture.md technical docs
- Update tests to use ARCHON_HOME instead of legacy vars
- Fix validate.md command template for new paths

All plan phases now complete:
- Phase 1: Archon Directory Structure
- Phase 2: Docker Distribution
- Phase 3: YAML Configuration System
- Phase 4: Developer Experience
- Phase 5: Documentation
2025-12-17 21:45:41 +02:00