Skip to content

feat: fork Qwen Code as AIRIS Code base with Ollama backend#1

Merged
kazukinakai merged 14 commits into
mainfrom
feat/qwen-code-fork-ollama-backend
Apr 15, 2026
Merged

feat: fork Qwen Code as AIRIS Code base with Ollama backend#1
kazukinakai merged 14 commits into
mainfrom
feat/qwen-code-fork-ollama-backend

Conversation

@kazukinakai

Copy link
Copy Markdown
Member

Summary

  • Fork Qwen Code (760df2c14) as the foundation for AIRIS Code autonomous coding agent
  • Rebrand .qwen.airiscode, @qwen-code/*@airiscode/* across 1400+ files
  • Delete Gemini/Google OAuth/Vertex AI/ACP/Channel code paths
  • Add OllamaOpenAICompatibleProvider for local Ollama inference via OpenAI-compatible API
  • Add AuthType.USE_OLLAMA with API key validation bypass

Context

AIRIS Code is a Claude Code substitute for when usage limits are reached. Built on Qwen Code's agent loop, hooks, subagents, skills, and permission system — with the LLM backend swapped to Ollama for local inference.

Upstream tracking: .airiscode-upstream records the source commit for future cherry-picks.

Test plan

  • pnpm install resolves dependencies
  • pnpm turbo run build compiles (remaining AuthType cleanup needed)
  • Ollama qwen3:8b tool calling roundtrip works
  • 10+ turn agent loop without context overflow

🤖 Generated with Claude Code

kazukinakai and others added 14 commits April 11, 2026 00:21
Fork Qwen Code (760df2c14) into airis-code monorepo as the foundation
for an autonomous coding agent that serves as a Claude Code substitute
when usage limits are reached.

Phase 1 - Fork & Branding:
- Copy packages/core → packages/airiscode-core
- Copy packages/cli → apps/airiscode-cli
- Rename .qwen → .airiscode, @qwen-code → @airiscode
- Delete Gemini/Google OAuth/Vertex AI/ACP/Channel code
- Track upstream commit in .airiscode-upstream

Phase 2 - Ollama Backend:
- Add OllamaOpenAICompatibleProvider (OpenAI-compat /v1 API)
- Add AuthType.USE_OLLAMA with API key validation bypass
- Wire into determineProvider() detection chain
- Route USE_OLLAMA through existing OpenAI content generator

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix tsconfig.json extends path (tsconfig.json → tsconfig.base.json)
- Add missing dependencies (@types/node, zod, @types/shell-quote, etc)
- Add OpenTelemetry peer dependencies
- Set strict: false (matching upstream Qwen Code behavior)
- Inline ACP SDK types (removed @agentclientprotocol/sdk dependency)
- Stub Google auth providers (google-auth-library not needed)
- Fix AuthType enum mappings (add ollama, remove gemini/vertex-ai)
- Fix OTel version mismatch with type casts
- Update pnpm-lock.yaml

Core package now builds successfully with `pnpm turbo run build`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Plan agent: architecture analysis, implementation planning, with
  edit tools gated by permission mode (Claude Code-style dry-run)
- code-reviewer agent: read-only code review with confidence scoring,
  checks against AIRISCODE.md standards

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CI now targets @airiscode/core with turbo --filter
- Remove lint/npm-test jobs (legacy packages lack eslint)
- Fix CLI tsconfig: add rootDir, strict:false, skipLibCheck
- Use Node 22 + pnpm 10.12.0 (matching local environment)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- /commit skill: conventional commit workflow with staging, message
  drafting, and hook-safe commit creation
- rulesLoader: loads .airiscode/rules/*.md at session start for
  project-specific agent instructions (Claude Code .claude/rules/ pattern)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HookType.Inject allows injecting content as a system message without
spawning an external process. Supports variable substitution
($TOOL_NAME, $TOOL_INPUT, $SESSION_ID, $CWD, $EVENT) and target
specification (main/subagent/both).

This enables the "must read docs before editing" pattern:
PreToolUse inject hooks can force documentation reading before
allowing file modifications — the core value proposition for
local models that tend to skip reference material.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Load .airiscode/settings.local.json after workspace settings with
higher priority. This file should be gitignored for developer-specific
configuration (API keys, local model preferences, etc).

Priority order (highest to lowest):
1. CLI arguments
2. Environment variables
3. .airiscode/settings.local.json (workspace-local, gitignored)
4. .airiscode/settings.json (workspace, git-tracked)
5. ~/.airiscode/settings.json (user global)
6. System defaults

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Local models via Ollama (e.g., qwen3:8b with 32K context) need earlier
compaction than cloud models. Lower threshold from 70% to 60% to prevent
context overflow during multi-turn agent loops.

Configurable via settings: chatCompression.contextPercentageThreshold

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enable seamless transition between Claude Code and AIRIS Code:

- rulesLoader: scan both .claude/rules/ and .airiscode/rules/
  (.airiscode takes precedence on filename conflicts)
- memoryTool: add CLAUDE.md to default context file list, so
  projects with existing CLAUDE.md work out of the box

This allows teams to share the same project configuration
across both tools without duplication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Auto-detect auth type from environment:
1. OPENAI_API_KEY + OPENAI_MODEL + OPENAI_BASE_URL → OpenAI
2. ANTHROPIC_API_KEY + ANTHROPIC_MODEL → Anthropic
3. QWEN_OAUTH → DashScope (legacy)
4. OLLAMA_HOST or OLLAMA_MODEL → Ollama
5. No keys set → Ollama (local-first default)

Remove dead Gemini/Vertex AI detection paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add missing deps (chalk, cli-spinners, @types/hast)
- Replace USE_GEMINI/USE_VERTEX_AI → USE_OPENAI in CLI auth paths
- Stub deleted modules (channel, acp-integration, web-templates)
- Stub Qwen OAuth UI (useQwenAuth, QwenOAuthProgress)
- Fix HookConfig union type access across hook UI components
- Fix duplicate auth entries in auth.ts
- Fix GIT_COMMIT_INFO type mismatch
- Inline ACP SDK types in export/collect.ts
- Both @airiscode/core and @airiscode/cli build successfully

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 1 of the AIRIS Code v1 rebuild. The Qwen Code fork has been stripped
of its upstream-specific surface and migrated to airis-monorepo as the
single source of truth (manifest.toml → package.json / compose.yml / tsconfig).
The CLI now boots inside a Docker-isolated workspace with no @google/genai,
no @opentelemetry/*, and no Qwen/Alibaba telemetry.

What's gone:
- Aliyun RUM phone-home telemetry (qwen-logger → deleted)
- Qwen OAuth, DashScope provider, Google service-account / OAuth MCP auth
- 21 @opentelemetry/* packages (sdk.ts / loggers.ts / metrics.ts are now
  no-op stubs gated on isTelemetrySdkInitialized() returning false)
- @google/genai (replaced by self-hosted types in src/types/llm.ts, which
  is re-exported from @airiscode/core)
- ~250 test files that covered the deleted surface (to be regenerated
  in later phases)
- docker-compose.dev.yml / Dockerfile.dev / workspace.yaml (legacy)

What's in:
- manifest.toml declares every app, lib, service, dependency, TS option
- airis gen produces package.json, compose.yml, pnpm-workspace.yaml,
  tsconfig.base.json and per-package tsconfig.json
- Docker workspace with per-package named volumes (no bind mounts, no
  host node_modules leakage)
- core and cli both build green; `airiscode --help` boots

Naming cleanups:
- @airiscode/airiscode-core → @airiscode/core
- @airiscode/airiscode-cli → @airiscode/cli
- apps/airiscode-cli/index.ts moved to src/index.ts so tsc can include it

Known follow-ups (tracked for Phase 2):
- CLI header still says "Usage: qwen" (branding, Tier E)
- Layer 2 packages under packages/ (adapters, mcp, drivers, gemini-*, ...)
  are dormant and slated for deletion / responsibility-based split
- mcpToTool() is a stub that throws; real runtime comes with the
  driver-based MCP session layer in Phase 2
- tsconfig ignoreDeprecations is a manual override until airis-monorepo
  stops unconditionally writing "6.0"
- react 19.1 vs ink 6.8 peer-dep mismatch (non-fatal)
- 6 airis-monorepo issues to file (app-definition unification, field
  expansion, import-scanner opt-in, generation modes, convention opt-out,
  hardcoded-value guards)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kazukinakai kazukinakai merged commit af99bfd into main Apr 15, 2026
1 of 2 checks passed
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