Linux port: first run, packaging, single instance, privacy and wiring
CI / test (push) Has been cancelled

First run and backend
- The companion opens without Ollama or a model (OFFLINE / SETUP REQUIRED),
  opens Settings > Language model and picks the model up once downloaded.
- Model, provider and GPU changes apply without restarting (Ollama is
  restarted when launch settings change); no silent fallback from API mode.
- Fatal startup errors are shown in a window; the fallback avatar loads
  again; the shipped Capri artwork is used when nothing was imported.

Packaging and tooling
- packaging/arch/PKGBUILD, capri.desktop (KWin ScreenShot2 key), icons,
  artwork under /usr/share/capri/assets, Gitea Actions CI.
- xtask: `icons` and `release-check` (no private data or credentials).

Runtime
- One instance per data folder (flock + control socket): second launch
  shows the window; capri stop / restart / toggle / status (JSON, starts
  nothing) / doctor / setup / diagnostics export / purge.
- A foreign program on the Ollama port is refused; an Ollama left behind
  by Capri is replaced.

Privacy and security
- No raw Ollama log on disk; API keys are never saved in plaintext (old
  ones move to the keyring); refused credential notes are stored as
  [Credentials omitted]; launched apps get an allow-listed environment.

Fixes
- Stop/Escape silence the voice; saved voice effects apply to replies;
  settings_control glitch settings apply; distinct KWin cursor scripts;
  KDE window capture authorized for source builds; Linux wording.
- Voice pack references zipped with Windows separators are found.

Wired features
- Initiatives, request router, resource monitor, "clip that", questions
  about a snapshot, sleep mode, tap reactions, stopwatch, attachments,
  Internet mode button, voice-synced subtitles, wake visuals, dictation
  draft, tray switches, Spotify seek/shuffle/repeat; computer-control
  planner and classifier follow model switches and API mode.
- Approval cards: one shown, 8 queued, deduplicated, cancelled on stop,
  failure, lock or pause; one Application access switch.

Desktop
- Compositor detection (no black overlay on i3 without picom), i3lock
  detection, unsupported desktops reported at startup, screenshot-only
  control without AT-SPI, fontconfig fallbacks, translatable feature
  pages with French translations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nocodeandClaude Opus 5.5 committed 2026-11-12 20:15:49 +01:00
1 parent a2abf01280
commit 844435f21f
73 files changed
+4834 -517

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
[package]
name = "xtask"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
publish = false
description = "Capri maintenance tasks: icon export and release hygiene checks"
[dependencies]
anyhow.workspace = true
image.workspace = true
regex.workspace = true
+131
View File
@@ -0,0 +1,131 @@
//! Maintenance tasks, run with `cargo xtask <task>`:
//! - `icons [OUT]`: hicolor PNG icons from `assets/default/icon-source.png` (default `target/icons`).
//! - `release-check`: tracked files contain no private data folders and no credential-like strings
//! (Capri 1.0.4 `tools/release/source-export.mjs` and `source-release.test.mjs`).
use std::path::{Path, PathBuf};
use std::process::Command;
use anyhow::{bail, Context, Result};
use regex::Regex;
/// Sizes installed under `/usr/share/icons/hicolor/<n>x<n>/apps/capri.png`.
const ICON_SIZES: [u32; 7] = [16, 32, 48, 64, 128, 256, 512];
fn root() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR")).parent().expect("workspace root").to_path_buf()
}
fn icons(out: &Path) -> Result<()> {
// Capri's application icon when the artwork is present, else the neutral symbol.
let source = ["assets/default/icon-source.png", "assets/default/avatar.png"].iter().map(|p| root().join(p)).find(|p| p.is_file()).context("no icon source")?;
let image = image::open(&source).with_context(|| format!("cannot read {}", source.display()))?;
if image.width() != image.height() {
bail!("{} must be square", source.display());
}
for size in ICON_SIZES {
let dir = out.join(format!("hicolor/{size}x{size}/apps"));
std::fs::create_dir_all(&dir)?;
image.resize_exact(size, size, image::imageops::FilterType::Lanczos3).save(dir.join("capri.png"))?;
}
println!("icons written to {}", out.display());
Ok(())
}
/// Paths that must never be published (owner data, runtimes, local overrides, environment files).
fn forbidden_path(path: &str) -> bool {
let first = path.split('/').next().unwrap_or_default();
let name = path.rsplit('/').next().unwrap_or_default();
matches!(first, "data" | "logs" | ".runtime" | "node_modules" | "target")
|| path.split('/').any(|part| part == "node_modules")
|| name.ends_with(".local.json")
|| name.starts_with(".env")
}
/// Credential shapes of the providers Capri talks to. Lengths follow real keys, so the short
/// fixtures used by unit tests (`sk-12345678`, `hf_tokentoken…`) are not reported.
fn secret_patterns() -> Vec<(&'static str, Regex)> {
[
("GitHub token", r"\bgh[pousr]_[A-Za-z0-9]{36,}\b"),
("GitHub fine-grained token", r"\bgithub_pat_[A-Za-z0-9_]{60,}\b"),
("GitHub email token link", r"email_token=[A-Za-z0-9]"),
("Hugging Face token", r"\bhf_[A-Za-z0-9]{34,}\b"),
("OpenRouter key", r"\bsk-or-v1-[0-9a-f]{64}\b"),
("OpenAI key", r"\bsk-(?:proj-|svcacct-|admin-)?[A-Za-z0-9_-]{40,}\b"),
("AWS access key", r"\b(?:AKIA|ASIA)[0-9A-Z]{16}\b"),
("Google API key", r"\bAIza[0-9A-Za-z_-]{35}\b"),
("private key", r"-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----"),
]
.into_iter()
.map(|(name, pattern)| (name, Regex::new(pattern).expect("valid pattern")))
.collect()
}
fn release_check() -> Result<()> {
let root = root();
let output = Command::new("git").arg("-C").arg(&root).args(["ls-files", "-z"]).output().context("git ls-files")?;
if !output.status.success() {
bail!("git ls-files failed");
}
let files: Vec<String> = output.stdout.split(|b| *b == 0).filter(|p| !p.is_empty()).map(|p| String::from_utf8_lossy(p).into_owned()).collect();
let patterns = secret_patterns();
let mut problems = Vec::new();
for file in &files {
if forbidden_path(file) {
problems.push(format!("{file}: private or generated path is tracked"));
continue;
}
let Ok(bytes) = std::fs::read(root.join(file)) else { continue };
let Ok(text) = std::str::from_utf8(&bytes) else { continue }; // binary assets
let lines: Vec<&str> = text.lines().collect();
for (line_no, line) in lines.iter().enumerate() {
// A reviewed fixture is marked on the line itself or on the line above.
let allowed = |l: &str| l.contains("release-check: allow");
if allowed(line) || (line_no > 0 && allowed(lines[line_no - 1])) {
continue;
}
for (name, pattern) in &patterns {
if pattern.is_match(line) {
problems.push(format!("{file}:{}: looks like a {name}", line_no + 1));
}
}
}
}
if problems.is_empty() {
println!("release-check: {} tracked files, nothing private found", files.len());
return Ok(());
}
for problem in &problems {
eprintln!("{problem}");
}
bail!("release-check found {} problem(s)", problems.len())
}
fn main() -> Result<()> {
let mut args = std::env::args().skip(1);
match args.next().as_deref() {
Some("icons") => icons(&args.next().map_or_else(|| root().join("target/icons"), PathBuf::from)),
Some("release-check") => release_check(),
_ => {
eprintln!("usage: cargo xtask icons [OUT] | cargo xtask release-check");
std::process::exit(2);
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn private_paths_and_secret_shapes() {
assert!(forbidden_path("data/agent.db") && forbidden_path("config/core.local.json") && forbidden_path(".env.production"));
assert!(forbidden_path("web/node_modules/x/index.js") && !forbidden_path("assets/capri/sprites/v1/a.png"));
assert!(!forbidden_path("crates/capri-core/src/paths.rs") && !forbidden_path("assets/default/avatar.png"));
let hit = |s: &str| secret_patterns().iter().any(|(_, p)| p.is_match(s));
assert!(hit(&format!("ghp_{}", "a".repeat(36))) && hit(&format!("hf_{}", "B".repeat(34))) && hit(&format!("sk-or-v1-{}", "0".repeat(64))));
assert!(hit("AKIAABCDEFGHIJKLMNOP") && hit(&format!("AIza{}", "x".repeat(35))));
// Unit-test fixtures stay allowed.
assert!(!hit("sk-12345678") && !hit("sk-test-123456") && !hit("hf_tokentokentokentoken1") && !hit("AIzaSyExample_key-123"));
}
}