Arthur-Ficial/apfel
62.9
Adequate · 14 November 2026
19.3k
lines of production code
Swift
primary language
5
measurements over time
What this system is
Features
Add apfel(1) man page documenting CLI modes and options
Added the apfel(1) manual page, which documents the command-line interface's three modes (Unix tool, interactive chat, HTTP server) and key options including --schema for structured JSON output, --messages for one-shot multi-turn conversations, --code for code-only responses, and --count-tokens for token budgeting.
man · high confidence
Added example scripts demonstrating ApfelCore usage
New Swift example files have been added to the Examples directory to demonstrate how to use the newly exposed ApfelCore library. These include ContextStrategies for configuring context windows, ErrorHandling for managing API errors, MCPProtocol for protocol requests, OpenAITypes for constructing chat completion requests, and ToolCalling for defining and handling tools.
Examples · high confidence
Initial release of apfel v1.12.0 with project documentation and configuration
This entry marks the initial release of the apfel project at version 1.12.0. It introduces the core project configuration files, including \.gitattributes\ for consistent text and binary file handling, \.spi.yml\ to configure the Swift Package Index builder for the \ApfelCore\ documentation target, and \.version\ to establish the version baseline. The release also includes \AGENTS.md\ pointing to \CLAUDE.md\, which serves as the central project instruction file, and a new \CHANGELOG.md\ to track future changes.
(repo-wide) · high confidence
Introduce ApfelCore library with core error handling, validation, and context management
The Sources/Core directory now contains the foundational ApfelCore library, introducing a structured error system (ApfelError) that classifies model failures into typed cases with specific HTTP status codes and OpenAI-compatible error codes. It adds a ChatRequestValidator to enforce strict input validation, rejecting unsupported parameters (like logprobs or stop sequences), unknown roles, and image content with clear 400/404 responses. Context management is improved via ContextWindow and ContextStrategy, distinguishing between assumed and measured context sizes to handle model warm-up states accurately. Additional utilities include CodeCropper for extracting fenced code blocks, BufferedLineReader for robust MCP subprocess I/O, and DemoInstaller for bundling CLI demos.
Sources/Core · high confidence
Introduce internal benchmarking suite and persistent chat history
Added a new \apfel benchmark\ command that runs performance tests on core operations (text extraction, context trimming, schema conversion, etc.) and outputs a JSON or plain-text report. Additionally, chat mode now supports opt-in persistent history via the \APFEL\_HISTFILE\ environment variable, saving and loading command history across sessions using libedit.
Sources · high confidence
New MCP Calculator server and HTTP test server
Added a new Model Context Protocol (MCP) calculator server in \mcp/calculator/\ that exposes seven math tools (add, subtract, multiply, divide, sqrt, power, round\_number) via stdio transport, allowing Apple's on-device LLM to perform precise calculations. The server includes logic to coerce string arguments to numbers and rejects non-numeric inputs as tool errors. Additionally, an HTTP-based test server (\mcp/http-test-server/\) was added to support integration testing over Streamable HTTP transport, along with round-trip test scripts to verify end-to-end tool calling.
mcp · high confidence
New release automation and distribution maintenance scripts
The project introduces a suite of new shell scripts to manage the release lifecycle and downstream distribution channels. \publish-release.sh\ handles local release qualification, including running integration tests, signing the binary with a Developer ID, and notarizing it before publishing to GitHub. \publish-nixpkgs-bump.sh\ and \nixpkgs-bump-cron.sh\ automate version updates for the Nix package manager, including a launchd agent (\com.arthurficial.apfel-nixpkgs-bump.plist\) for periodic checks and alerting on failures. Additional scripts support distribution health (\dist-watch.sh\), changelog enforcement (\check-changelog.sh\), and documentation generation (\generate-examples.sh\, \generate-demos.sh\).
scripts · high confidence
New shell-script demos for Apple Intelligence
The \demo/\ directory now includes a suite of shell scripts that use the \apfel\ CLI to leverage Apple Intelligence for common developer tasks. Users can generate shell commands (\cmd\), create complex pipe chains (\oneliner\), identify directory contents (\wtd\), explain code or errors (\explain\), get naming suggestions (\naming\), identify processes using ports (\port\), summarize git history (\gitsum\), and narrate system state with humor (\mac-narrator\). These scripts support options to copy output to the clipboard or execute commands with confirmation, and are designed to work within the on-device context window on macOS 26+.
demo · high confidence
Shell completion scripts for bash, zsh, and fish
The CLI now includes generated shell completion scripts for bash, zsh, and fish, enabling tab-completion for commands and flags. These scripts cover the full set of available options, including the new \--schema\, \--messages\, and \--code\ flags, as well as the \completions\ subcommand used to regenerate them. Also in this area: 3 commits (0 fixes) modifying completions.
completions · medium confidence · unverified
Behavioural changes
Refactored CLI argument parsing into a testable, modular structure
The CLI argument parsing logic has been extracted from the main executable into a dedicated \ApfelCLI\ target, introducing a pure, testable \CLIArguments\ value type that separates parsing from side effects. This refactor centralizes error messaging via \CLIErrors\ templates, standardizes exit codes in \ExitCodes\, and introduces new capabilities including shell completions (\Completions.swift\), persistent chat history with secure file permissions (\ChatHistory.swift\), and improved color output handling (\ColorPolicy.swift\).
Sources/CLI · high confidence
Fixes
Fix server crash on semaphore timeout and add concurrency primitives
The server no longer crashes with a SIGABRT when an AsyncSemaphore wait times out; the timeout now throws a SemaphoreTimeoutError instead. This fix, along with new concurrency primitives (AsyncSemaphore, StreamCleanup, StreamTaskBox, TraceBuffer) moved into the Core/Concurrency module, ensures stable handling of concurrent operations and streaming cleanup.
Sources/Core/Concurrency · high confidence
Fix terminal state corruption on Ctrl-C during chat input
The chat input mechanism now correctly restores the terminal to its original cooked mode when the user presses Ctrl-C, preventing the terminal from remaining in a broken raw/no-echo state after the process exits. This is achieved by capturing terminal settings before line editing begins and installing a signal-safe handler that resets the TTY and exits with code 130, ensuring a clean shell prompt is returned to the user.
Sources/CReadline · high confidence
Refactor chat core into pure, testable modules for streaming, limits, and tool resolution
The chat core logic has been extracted into dedicated, pure Swift modules (BodyLimits, FinishReasonResolver, StreamOutcome, StreamRetryPolicy, ToolResolution) to improve reliability and testability. Key user-facing improvements include: streamed output is now printed exactly once even during network retries, preventing duplicate text; the system now handles closed output pipes gracefully (exiting with status 141 instead of crashing); and token counting for refusals is corrected to avoid double-counting. Additionally, the arbitrary 1024-token default for max\_tokens has been removed, allowing the model to utilize the full 4096-token context window, with overflow handled gracefully via finish\_reason: "length". Also in this area: 8 commits (3 fixes) modifying Sources; 12 commits (7 fixes) fixing Sources; macOS 27 image input, runtime token usage, and MCP schema validation.
Sources/Core/Chat · medium confidence · unverified
Test coverage
Added comprehensive test coverage for ApfelCore public API and error handling; Expanded integration test suite for CLI, MCP, and server behaviors.
Dependencies
Swift Package updated to tools version 6.3 with new library and dependency structure
The project's Package.swift has been upgraded to Swift tools version 6.3 and restructured to expose the \ApfelCore\ logic as a public library product, alongside the main \apfel\ executable. This change introduces dependencies on Hummingbird (v2.0.0+), the Swift DocC Plugin (v1.4.6+), and the \lesbar\ library (v0.3.0) for on-device file extraction, while adding a \CReadline\ system library target. The resolved dependency pins reflect these updates, notably setting Hummingbird to version 2.26.0 and the DocC Plugin to 1.5.0 in the main package, and establishing a new integration test fixture (\apfelcore-consumer\) to verify consumption of the newly exposed \ApfelCore\ library.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 61 → 63 (+2.3)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 74 → 67 (-6.5)
- Architecture 90 → 97 (+6.7)
- Maturity 68 → 68 (-0.1)
- Readiness 47 → 54 (+7.1)
- Security 78 → 67 (-11.1)
- Performance 78 → 100 (+21.7)
Resolved (33)
- ContextManager.historyEntry (cognitive 18) (Sources/ContextManager.swift)
- ContextManager.prepareEntries (cognitive 16) (Sources/ContextManager.swift)
- Duplicated block (11 lines × 2) (Sources/Handlers.swift)
- Duplicated block (12–15 lines × 2) (Sources/Handlers.swift)
- Duplicated block (13–19 lines × 2) (Sources/Handlers.swift)
- Duplicated block (18 lines × 2) (Sources/Core/ApfelError.swift)
- Duplicated block (30 lines × 2) (Sources/Handlers.swift)
- Duplicated block (32–34 lines × 2) (Sources/Handlers.swift)
- Duplicated block (5 lines × 2) (Sources/Core/MCPToolRegistry.swift)
- Duplicated block (6 lines × 2) (Sources/Handlers.swift)
- Duplicated block (8 lines × 2) (Sources/CLI/Completions.swift)
- Duplicated block (8 lines × 3) (Sources/Handlers.swift)
- Duplicated block (8–11 lines × 3) (Sources/Handlers.swift)
- Duplicated block (9 lines × 3) (Sources/Handlers.swift)
- Duplicated block (9–11 lines × 2) (Sources/CLI.swift)
- Duplicated block (9–19 lines × 2) (Sources/Handlers.swift)
- FunctionTooLong: CLI.swift.printUsage (Sources/CLI.swift)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- …and 13 more
New (84)
- BatchRecordParser.parse (cognitive 21) (Sources/CLI/Batch.swift)
- BatchRecordParser.parse (cyclomatic 19) (Sources/CLI/Batch.swift)
- BatchRunner.swift.generateBatchRecord (cognitive 22) (Sources/BatchRunner.swift)
- BatchRunner.swift.runBatch (cognitive 23) (Sources/BatchRunner.swift)
- BatchRunner.swift.runBatch (cyclomatic 17) (Sources/BatchRunner.swift)
- CLI.swift.emitOneShotResult (cognitive 17) (Sources/CLI.swift)
- ContextManager.historyEntry (cognitive 18) (Sources/Engine/ContextManager.swift)
- Duplicated block (10 lines × 2) (Sources/Handlers.swift)
- Duplicated block (11 lines × 2) (Sources/CLI.swift)
- Duplicated block (12–13 lines × 2) (Sources/InputTokensHandler.swift)
- Duplicated block (12–15 lines × 2) (Sources/Handlers.swift)
- Duplicated block (12–19 lines × 3) (Sources/Handlers.swift)
- Duplicated block (5 lines × 2) (Sources/Core/SchemaParser.swift)
- Duplicated block (5 lines × 2) (Sources/Handlers.swift)
- Duplicated block (5 lines × 2) (Sources/Server.swift)
- Duplicated block (5 lines × 2) (Sources/Server.swift)
- Duplicated block (64 lines × 2) (Sources/Handlers.swift)
- Duplicated block (7 lines × 2) (Sources/Handlers.swift)
- Duplicated block (7 lines × 2) (Sources/Handlers.swift)
- Duplicated block (7 lines × 2) (Sources/Server.swift)
- …and 64 more
Changes since last survey
- 32 commits — 17 feature/other, 15 fixes
By area
- (root) — 13 commits
- Tests/apfelTests — 5 commits
- Sources/Engine — 4 commits
- Sources/CLI — 3 commits
- Sources/Core — 2 commits
- Tests/integration — 2 commits
- .github/FUNDING.yml — 1 commit
- .github/workflows — 1 commit
- docs/apfel-vs-fm.md — 1 commit
Notable commits
- fix: fix(build): pin the SDK stamp so brew-core builds get macOS 27 behaviour (#521) (#540)
- fix: fix(build): require the macOS 27 SDK; CI on xcode-27 + macOS 26 launch check (#520) (#535)
- fix: fix(cli): mention the JSON envelope in the unknown-finish note only for -o json (#564) (#566)
- fix: fix(cli): suggest --permissive when -f guardrail fires (#505) (#539)
- fix: fix(context): oversized one-shot prompts exit 4 on every OS; fallback estimate prices chat framing (#544) (#549)
- fix: fix(core): detect function-fenced tool calls, retry decodingFailure (#544) (#546)
- fix: fix(retry): classify retries through the typed macOS 27 classifier (#522) (#536)
- fix: fix(schema): generate properties in the declared order, server and CLI (#560) (#561)
- fix: fix(server): cancel abandoned non-streaming requests and release their permit (#542) (#547)
- fix: fix(streaming): compute deltas in Unicode scalars, not Characters (#543) (#545)
- fix: fix(test): prove the isError path ran; accept the model's reply, refusals included (#562) (#563)
- fix: fix(token-counter): count macOS 27 reasoning entries; no fixed window in Sources/ (#513) (#537)
- fix: fix(tools): describe tools to the model as a plain-language list (#555) (#556)
- fix: fix(usage): refusals after a repair round bill the earlier round on macOS 27 (#516) (#538)
- fix: test(code): per-prompt line caps and fixed seeds in the --code one-liner battery (#552) (#553)
- change: Add GitHub Sponsors button
- change: build(deps): Hummingbird 2.26.0 -> 2.27.1 (#548)
- change: ci: run unit tests and model-free suites on macOS 26 too (#510 item 7, #205) (#559)
- change: docs(apfel-vs-fm): source builds need the SDK 27, bare apfel starts chat, Swift library row
- change: docs(changelog): drop the superseded #544 bullet left by the rebase
- …and 12 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
Arthur-Ficial/apfel was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit a925bbbdebe91c7a6c0eeacacb5ed2b74402d274 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.