Repository navigation
Conversation
Three fixes: 1. Navigation mode (Alt+s / header click) would flash and immediately exit because a PaneUpdate with stale focus arrived before focus_plugin_pane took effect. Added nav_enter_guard to skip the first PaneUpdate auto-exit after entering nav mode. 2. Attend (Alt+a) silently dropped the keybind when received by a non-zero plugin instance. Now non-zero instances forward via broadcast to plugin 0, matching how Navigate already works. 3. Simplified auto-save to a single "auto" snapshot that gets overwritten each time (no rotation, no numbering). Removed snapshot type field and TYPE column from list output. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- 013 FR-003: Cursor uses amber tint background, not triangle prefix - 013 FR-019: Both navigate and attend forward via broadcast (keybind registration goes to last-loaded instance, not necessarily plugin 0) - 013 FR-022: First PaneUpdate after entering nav mode is skipped (stale focus before focus_plugin_pane takes effect) - 015 FR-006: Restore resolves git root for working directory - 015 FR-008: Single "auto" snapshot overwritten each time, no rotation - 015 FR-011: Simplified retention (auto always overwritten) Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Remove ToolUse activity variant and its ⚙ icon to reduce visual noise from rapid status changes. Init now displays as ○ (same as Idle) instead of ◆ since the distinction adds no value. Drop PreToolUse and PostToolUse from hook registration (9 hooks to 7), reducing hook invocations during normal Claude operation. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
prefix_len was 2 but the rendered prefix is " ● " (space + indicator + space) which is 3 display characters. Names were allowed 1 char too many, causing the last character to be clipped by the pane boundary without ".." being appended. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…name cursor Keybindings: - Re-register keybinds from active-tab instance on every TabUpdate, recovering from dead plugin IDs when tabs are closed - Any instance handles attend/navigate directly (no unreliable forwarding) Cross-instance sync: - File-based metadata sync via /cache/session-meta.json for rename and pause state (pipe_message_to_plugin broadcast unreliable in Zellij 0.43) - Shared attend round-robin state via /cache/attend-state.json Attend algorithm: - Split tier 3: Done/AgentDone (need review) before Idle/Init (already seen) - Persist last_attended_pane_id to shared file across instances Sidebar fixes: - Rename cursor: window visible text around cursor for overlong names, show cursor on last char when name fills available width - Dead session cleanup uses raw PaneManifest (stable pane IDs) instead of derived pane_to_tab map (avoids false removal on tab close) - Git branch re-detection on timer (picks up branch switches) Snapshot restore: - Send pending overrides (display name, paused) via cc-deck:restore-meta pipe before creating tabs, matched by working directory when sessions start Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
012-sidebar-plugin: - Remove ToolUse sub-states and Exited from Activity enum - Add AgentDone state, note Init displays identically to Idle - Update hook registration list to match actual 7 registered events - Add evolution notes: file-based sync, keybind re-registration, pane manifest cleanup, git branch re-detection 013-keyboard-navigation: - Update attend priority: Done/AgentDone (tier 3) before Idle/Init (tier 4) - Clarify Notification hooks are informational only (tier 2 unreachable) - Add evolution notes: shared round-robin state via /cache/ 015-session-save-restore: - Add evolution notes: pending overrides for restore metadata Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
17: Base image definition (Fedora-based, dev tools, Zellij + CC) 18: Build manifest and scaffold (cc-deck-build.yaml schema, CLI commands) 19: AI-driven build commands (.claude/commands/ for extract, plugin, mcp) 20: Deploy integration (compose + k8s targets, MCP sidecars on localhost) Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Without PreToolUse, sessions stayed stuck on the ⚠ indicator after a permission request was answered. No hook fired to transition from Waiting(Permission) back to Working until Stop. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Spec, plan, research, data model, tasks, and review summary for the cc-deck base container image. Fedora-based with 30+ dev tools, Node.js, Python/uv, zsh/starship shell, multi-arch (amd64+arm64). Deliberately excludes Zellij, Claude Code, and cc-deck (added during user image build). Updated brainstorm 17 and 18 with decisions from brainstorming session. 23 tasks across 7 phases. MVP: working local image (9 tasks). Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Containerfile + scripts + config for a Fedora-based developer toolbox: - 27 tools: git, gh, glab, ripgrep, fd, fzf, jq, yq, bat, lsd, delta, zoxide, starship, helix, vim, nano, curl, wget, htop, nc, dig, ssh, make, node 22.x, python 3.13, uv, npm - Non-root coder user (UID 1000) with passwordless sudo - zsh shell with starship prompt, zoxide, fzf, bat/lsd/delta aliases - npm global prefix at ~/.local/lib/npm (no root needed) - Image size: ~1 GB (under 1.5 GB target) Does NOT include Zellij, Claude Code, or cc-deck (added during user image build for version consistency). Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- FR-002: Changed "LTS" to "current stable from OS package manager" (Fedora 41 ships 22.x which is Current, not LTS) - FR-002: Added npm as explicit requirement (separate Fedora package) - FR-011: Added "UID 1000" to coder user requirement - SC-003: Replaced out-of-scope user image build time with base image pull time metric Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
43 checks: all tools present, user setup (coder/UID 1000/zsh/sudo), XDG dirs, npm prefix + global install, shell config (starship/delta), and image size under 1.5 GB. Usage: ./base-image/test.sh [image-name] Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Triggers:
- Push to main with base-image/ changes: rebuild + push :latest
- Release published: rebuild + push :latest and :vX.Y.Z
- Manual workflow_dispatch: rebuild + push :latest
Multi-arch (amd64 + arm64) via Docker Buildx + QEMU.
Publishes to ghcr.io/{owner}/cc-deck-base.
Runs test.sh verification after push.
Trivy vulnerability scan (informational, non-blocking).
Assisted-By: 🤖 Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Assisted-By: 🤖 Claude Code
Spec, plan, tasks, implementation, CI pipeline, and test script for the cc-deck base container image. 27 tools, multi-arch (amd64+arm64), zsh with starship, 1 GB image size, 43-check test suite. Assisted-By: 🤖 Claude Code
Phase 4: Built and verified both amd64 and arm64, created multi-arch manifest Phase 5: Verified starship, aliases (ls→lsd, cat→bat), fzf, zoxide, npm Phase 6: CI workflow already committed, T020 deferred to CI dispatch Phase 7: Image size 1034 MB (under limit), README updated with testing/CI docs All 23 tasks complete. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- CI workflow now generates fedora-NN tag (extracted from Containerfile ARG) - test.sh detects podman or docker at runtime (CI uses docker) Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ates Assisted-By: 🤖 Claude Code
Combined brainstorm docs 18 (manifest/scaffold) and 19 (AI commands). 6 user stories, 23 FRs covering: - Manifest schema (cc-deck-build.yaml) with tools, sources, plugins, MCP - CLI commands: build init, build, push, verify, diff - AI commands: extract, plugin, mcp, containerfile, publish - cc-deck self-embedding for version consistency 31 tasks across 9 phases. MVP: init + extract + containerfile (14 tasks). Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Assisted-By: 🤖 Claude Code
Assisted-By: 🤖 Claude Code
Both 017-base-image and 018-build-manifest now include: Executive Summary, Review Recipe, Technical Decisions, Critical References, Reviewer Checklist, Scope Boundaries, Risk Areas, and PR Contents. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Phase 1 (Setup): manifest.go (YAML struct), runtime.go (podman/docker detection) Phase 2 (Foundational): 5 Claude Code commands (extract, plugin, mcp, containerfile, publish), 2 helper scripts, manifest template, go:embed Phase 3 (US1 MVP): build init command scaffolds directory with manifest, commands, scripts, and gitignore. Overwrite protection with --force flag. Verified: go build succeeds, build init creates valid directory structure, manifest passes YAML validation, overwrite protection works. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Never run go build directly. The Go project directory cc-deck/ collides with the binary output name. Running go build -o cc-deck inside cc-deck/ overwrites the directory with a binary, destroying all source files. Constitution v1.2.0 Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Beads trait removed from SDD (task state tracked in tasks.md checkboxes). Updated speckit command overlays and settings. Deleted specs/constitution.md (moved to .specify/memory/ earlier). Assisted-By: 🤖 Claude Code
podman, docker, buildah, skopeo are host build tools, not image dependencies. Silently excluded from discovered tools to prevent them from being added to the manifest. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Restructure build pipeline under `cc-deck image` parent command with AI-driven build and push via Claude Code commands: CLI commands: - `cc-deck image init` scaffolds build directory with manifest + commands - `cc-deck image verify` smoke-tests a built container image - `cc-deck image diff` compares manifest against Containerfile AI commands (embedded, extracted at init): - /cc-deck.build generates Containerfile from manifest and builds the image with self-correction loop (up to 3 retries on failure) - /cc-deck.push pushes the built image to a registry - /cc-deck.extract analyzes repos for tool dependencies - /cc-deck.plugin and /cc-deck.mcp manage plugins and MCP servers Additional changes: - Add REGISTRY build parameter (default: quay.io/rhuss) propagated via ldflags to DefaultBaseImage and manifest template - Add base-image and base-image-push Makefile targets - Add --install-zellij flag to plugin install for container builds - Remove cc-deck.containerfile.md (folded into cc-deck.build) - Remove cc-deck.publish.md (replaced by cc-deck.build + cc-deck.push) Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Container builds and image pushes can easily exceed the default 2-minute Bash tool timeout. Instruct the AI to use 600000ms timeout. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Both the AI build command and the Makefile base-image target now build for linux/arm64 and linux/amd64 by default. Override with user input (AI command) or PLATFORMS variable (Makefile). Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The Containerfile template now creates a .zshrc for the coder user, preventing the interactive zsh-newuser-install dialog on first start. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
FindProjectConfig now chains two strategies: 1. Check at git root (fast, existing behavior) 2. Walk up directory tree for .cc-deck/environment.yaml (workspace) This allows .cc-deck/ to live above multiple git repos, so related projects can share a single environment and container image. env create now accepts an explicit name in non-git directories, scaffolding .cc-deck/environment.yaml at cwd as workspace root. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The dot prefix hides the directory in file listings, making it harder to verify that cross-compiled binaries are in place before building. A plain build-context/ is more discoverable and still gitignored. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The timer handler spawned a git rev-parse process for every session
every 10 seconds with no guard against in-flight duplicates. When git
commands were slow or sessions numerous, file descriptors accumulated
until Zellij could no longer create WASI contexts ("Too many open
files, os error 24").
Three changes fix this:
- Track in-flight git commands per pane_id (HashSet) and skip if one
is already pending. Clear the entry when RunCommandResult arrives.
- Throttle timer-driven git polling to 60s (was every 10s tick). The
primary detection path is event-driven on cwd changes; the timer
poll is only a fallback for in-place git checkout.
- Skip paused sessions entirely since they cannot change branches.
Assisted-By: 🤖 Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Update README with workspace detection description and mark spec 026 as Implemented. Mark T037/T038 (docs) and T010 (sidebar refresh validation) as done. Final tally: 012 (45/45), 025-compose (35/35), 025-refresh (11/11), 026-project-config (40/40), 027-cli (29/29). Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Combine /cc-deck.extract (repo tool analysis) and /cc-deck.settings (host config discovery) into a single /cc-deck.capture command. The workflow simplifies from 4 steps to 3: /cc-deck.capture - discover tools and settings for the image /cc-deck.build - generate Containerfile and build /cc-deck.push - push to registry Update all references in CLI help, manifest template, and Antora docs. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…-minimal - Rename manifest from cc-deck-build.yaml to cc-deck-image.yaml - Default cc-deck image init to .cc-deck/image/ (no args needed) - Download cc-deck Linux binaries from GitHub Releases instead of requiring make cross-cli (falls back for dev builds) - Switch base image from fedora to fedora-minimal (smaller, same repos) - Use microdnf instead of dnf throughout (fedora-minimal default) - Add shadow-utils to install-tools.sh (needed for useradd) - Add manual test walkthrough at docs/walkthroughs/018-build-image.md Assisted-By: 🤖 Claude Code
Three CI fixes:
1. Container image build (Nightly Images): add `tar` to microdnf
packages in install-tools.sh. The switch to fedora-minimal dropped
`tar`, which is needed to extract the starship release tarball.
2. Integration tests workflow: skip gracefully when internal/integration/
directory does not exist yet (spec 016 not implemented).
3. Env integration tests (4 failures):
- Isolate DefinitionStore via CC_DECK_DEFINITIONS_FILE to prevent
system definitions leaking into tests
- Use t.Chdir() to prevent project-local .cc-deck/ discovery
- Fix TestEnvStubCommandsReturnError: create env before testing
stub commands, expect correct "not supported" error messages
- Fix TestEnvCreateDefaultTypeIsLocal: unmarshal JSON list output
into generic map (list uses envListEntry, not EnvironmentRecord)
- Fix TestEnvCreateUnsupportedType: container type is now supported,
test against k8s-sandbox instead
Also includes Zellij plugin fix: run deferred remove_dead_sessions()
from the Timer handler after the startup grace period expires, so stale
sessions from a previous Zellij session are cleaned up.
Assisted-By: 🤖 Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Tests that call runEnvCreate for local environments need zellij on PATH. Add ensureZellijStub() that creates a no-op zellij binary when the real one is not available (CI runners). Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
A developer toolbox image benefits from the full Fedora base. The minimal edition required manually adding basics (tar, shadow-utils, less, procps-ng) and limited package management to microdnf. With 40+ packages installed on top, the base size savings were negligible. Changes: - Containerfile: fedora-minimal -> fedora - install-tools.sh: microdnf -> dnf, removed packages included in base (tar, shadow-utils, less, procps-ng, tree, unzip, ca-certificates) - Updated build command, README, and docs to reference dnf Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ebase Move 13 completed/superseded specs to specs/attic/ (002, 012-017, 023-027). Update 5 active specs (018-022) to Evolved status with inline annotations reflecting actual naming (cc-deck-image.yaml, /cc-deck.capture), descoped features (Flatpak, plugin/mcp commands), and deferred items (K8s policies, ecosystem auto-detection, runtime domain modification). Assisted-By: 🤖 Claude Code
- hook.go: add 3-second timeout for zellij pipe to prevent hangs, suppress stderr output on pipe failure - .gitignore: add .cc-deck/ (project-local env config) - Remove cc-deck/internal/cmd/.cc-deck/ test artifact Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Fix compose smoke tests expecting files at .cc-deck/ instead of .cc-deck/run/ (TestComposeSmokeFullLifecycle, TestComposeSmokeNamedVolume, TestComposeSmokeNetworkFiltering) - Truncate long error output in image verify to avoid stack trace floods - Fix stale /cc-deck.containerfile references in image diff command - Update 018 tasks: mark T024 descoped, T027 verified Assisted-By: 🤖 Claude Code
When git repo detection renames a session, other plugin instances (on different tabs) still have the old name and can overwrite it via sync broadcast. Fix by updating last_event_ts on git-based renames so they win the merge conflict. Also removes temporary hook debug logging. Assisted-By: 🤖 Claude Code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Three fixes for session lifecycle issues: 1. hook.go: Stop event was cleaning the pane_id cache before SessionEnd could use it. Since Claude Code strips $ZELLIJ_PANE_ID from hook subprocesses, SessionEnd relies on the cached mapping. Now only SessionEnd cleans the cache. 2. main.rs: When a new Claude Code instance starts in a pane that already has a tracked session (different session_id), reset manually_renamed, display_name, and working_dir so CWD change detection triggers git repo detection and auto-naming for the new project. 3. state.rs: remove_dead_sessions now also removes sessions whose panes have exited (command panes where the process finished), not just panes that no longer exist in the manifest. Assisted-By: 🤖 Claude Code
After creating a new backup, prune older ones beyond the limit. Backups sort chronologically by their timestamp suffix, so lexicographic sorting picks the right ones to keep. Assisted-By: 🤖 Claude Code
Batch broadcast+save behind a 1s debounce timer instead of syncing on every hook event. Combine broadcast and save into a single JSON serialization pass. Cache session-meta.json content hash to skip redundant parsing. Suppress re-renders from PaneUpdate and ModeUpdate when nothing visible changed. Throttle keybinding re-registration to tab closures only. Pre-compute filtered sessions once per navigation key event instead of per match arm. Assisted-By: 🤖 Claude Code
…licker - Shift+Alt+S/A: reverse-direction variants of Alt+S/A (navigate up, attend previous). Auto-derived from configured keys, no extra config. - Paused sessions now skip all hook event processing (activity, CWD, git detection). Next event after unpause restores state naturally. - Suppress AgentDone transition when session is Working to prevent brief green checkmark flicker from SubagentStop events. Assisted-By: 🤖 Claude Code
- Release profile: LTO fat, opt-level=z, strip, panic=abort for smallest WASM - dev-opt profile: opt-level=1 for fast iteration with acceptable wasmi perf - Makefile uses dev-opt for dev/reload targets - GoReleaser and CI run wasm-opt -Oz when available Assisted-By: 🤖 Claude Code
- Help overlay as SidebarMode::Help(Box) wrapper instead of bool flag - sync_now() extracted for immediate user-action sync - Session restore: readiness probe replaces fixed sleep, multi-session per-directory override support (FIFO) - Layouts: sidebar visible on main tab in all variants - keybindings_registered field for deferred registration Assisted-By: 🤖 Claude Code
Configurable via KDL: `perf true`, `perf_interval 30`. Records event counts, total/max duration per label, dumps to /cache/perf.csv. Instruments pipe(), render(), and handle_event() when enabled. Assisted-By: 🤖 Claude Code
Design exploration for scaling beyond 10+ tabs by splitting the plugin into a background controller (single instance, owns all state) and thin sidebar renderers (one per tab, display-only). Assisted-By: 🤖 Claude Code
Brainstorm 031 designs a full-screen control plane TUI for managing cc-deck environments across local, podman, and Kubernetes backends. Key concepts: client-daemon architecture, bubbletea suspend/resume for attach, HTTP status endpoints for remote session monitoring, on-demand AI status reports, and OS-level attention notifications. Supersedes the simpler 024-tui-environment-manager brainstorm. Also adds .coderabbit.yaml with assertive review profile, Go/Rust path-specific review instructions, and all security scanners enabled. Assisted-By: 🤖 Claude Code
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Collaborator
Author
|
Closing: premature PR creation, wrong base branch. Will recreate properly after ship workflow completes. |
rhuss
added a commit
that referenced
this pull request
May 18, 2026
MessagePlugin (broadcast) replaces MessagePluginId (targeted) for keybinding registration, same root cause as the CLI pipe and voice relay workarounds. Now 10 items to revert when upstream fix lands. Assisted-By: 🤖 Claude Code
rhuss
added a commit
that referenced
this pull request
May 20, 2026
- Restore Zellij tmux comparison for orientation (#12) - Deduplicate workspace type table (overview links to detail) (#3) - Deduplicate network filtering (overview cross-references detail) (#2) - Fix cc-deck-image.yaml to build.yaml filename (#4) - Add Docker note to demo image section (#5) - Fix cc-deck attach to cc-deck ws attach consistency (#6) - Tighten build command section, remove YAML credential block (#7) - Fix duplicate spec ID 025 (#1) - Fix arrow format in keybinding comment (#10) - Fix contraction consistency (#11) - Add workspace type table to detailed section (#3) Assisted-By: 🤖 Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.coderabbit.yamlwith assertive review profile, Go/Rust path instructions, and all security scanners enabledKey Design Decisions in Brainstorm 031
Test plan
🤖 Generated with Claude Code