API Referenz¶
Tauri Commands API für die Kommunikation zwischen Frontend und Backend.
Übersicht¶
Die API folgt dem Command-Pattern. Jeder Command ist eine asynchrone Rust-Funktion, die vom Frontend via invoke() aufgerufen wird.
// Frontend (TypeScript)
import { invoke } from '@tauri-apps/api/core';
const result = await invoke('list_items', { projectId: 'abc-123' });
Project Commands¶
Datei: src-tauri/src/commands/project.rs
create_project¶
Erstellt neues Projekt mit optionalem Template.
interface CreateProjectRequest {
name: string;
rootPath: string;
templateId?: string;
gitConfig?: GitConfig;
}
const project = await invoke<Project>('create_project', {
name: 'My Project',
rootPath: '/path/to/project',
templateId: 'default',
});
open_project¶
Öffnet existierendes Projekt, initialisiert DB und File Watcher.
list_recent_projects¶
Listet kürzlich geöffnete Projekte.
delete_project¶
Löscht Projekt aus der globalen DB (Dateien bleiben erhalten).
get_current_project¶
Holt aktuell geöffnetes Projekt.
rebuild_database¶
Importiert Backlog.md neu in die DB.
Item Commands¶
Datei: src-tauri/src/commands/items.rs
create_item¶
Erstellt neues Item.
interface CreateItemRequest {
projectId: string;
itemType: 'F' | 'T' | 'B' | 'C';
title: string;
status: string;
priority: string;
phase?: string;
area?: string;
description?: string;
technicalNotes?: string;
}
const item = await invoke<BacklogItem>('create_item', { request });
get_item¶
Holt einzelnes Item.
list_items¶
Holt alle Items eines Projekts.
update_item¶
Aktualisiert Item-Felder.
interface UpdateItemRequest {
title?: string;
status?: string;
priority?: string;
phase?: string;
area?: string;
description?: string;
technicalNotes?: string;
}
const item = await invoke<BacklogItem>('update_item', {
projectId: 'abc-123',
itemId: 'F-0001',
request: { status: 'Erledigt', phase: 'Done' },
});
delete_item¶
Löscht Item.
update_acceptance_criteria¶
Aktualisiert Akzeptanzkriterien eines Items.
await invoke('update_acceptance_criteria', {
projectId: 'abc-123',
itemId: 'F-0001',
criteria: [
{ text: 'Criterion 1', isDone: true },
{ text: 'Criterion 2', isDone: false },
],
});
save_backlog¶
Schreibt alle Items zurück nach Backlog.md.
claude_edit_backlog¶
Spezial-Command für Claude Code Edits.
Dependency Commands¶
Datei: src-tauri/src/commands/dependencies.rs
add_dependency¶
Fügt Dependency hinzu.
await invoke('add_dependency', {
projectId: 'abc-123',
fromItemId: 'F-0001',
toItemId: 'T-0002',
note: 'Optional note',
});
remove_dependency¶
Entfernt Dependency.
await invoke('remove_dependency', {
projectId: 'abc-123',
fromItemId: 'F-0001',
toItemId: 'T-0002',
});
get_dependencies¶
Holt Dependencies eines Items.
const deps = await invoke<Array<{ item_id: string; note: string | null }>>(
'get_dependencies',
{ projectId: 'abc-123', itemId: 'F-0001' }
);
check_circular_dependencies¶
Prüft auf Zyklen im Dependency-Graph.
const cycles = await invoke<string[] | null>('check_circular_dependencies', {
projectId: 'abc-123',
});
// null = keine Zyklen, sonst Liste der Items im Zyklus
Backup Commands¶
Datei: src-tauri/src/commands/backup.rs
list_backups¶
Listet alle Backups eines Projekts.
interface BackupInfo {
filename: string;
timestamp: string; // ISO 8601
sizeBytes: number;
itemCount: number;
isWeekly: boolean;
isMonthly: boolean;
}
const backups = await invoke<BackupInfo[]>('list_backups', {
projectId: 'abc-123',
});
restore_backup¶
Stellt Backup wieder her.
const message = await invoke<string>('restore_backup', {
projectId: 'abc-123',
backupFilename: 'backlog-2026-02-04_15-30-00.md',
});
validate_backup¶
Validiert Backup-Datei.
interface ValidationResult {
isValid: boolean;
errors: string[];
warnings: string[];
}
const result = await invoke<ValidationResult>('validate_backup', {
projectId: 'abc-123',
backupFilename: 'backlog-2026-02-04_15-30-00.md',
});
delete_backup¶
Löscht Backup-Datei.
const message = await invoke<string>('delete_backup', {
projectId: 'abc-123',
backupFilename: 'backlog-2026-02-04_15-30-00.md',
});
get_backup_config / set_backup_config¶
Backup-Konfiguration lesen/setzen.
interface BackupConfig {
maxCount: number; // 1-50, default: 10
maxAgeDays: number; // 1-365, default: 7
keepWeekly: boolean; // default: false
keepMonthly: boolean; // default: false
}
const config = await invoke<BackupConfig>('get_backup_config', {
projectId: 'abc-123',
});
await invoke('set_backup_config', {
projectId: 'abc-123',
config: { maxCount: 20, maxAgeDays: 14, keepWeekly: true, keepMonthly: false },
});
Backlog Utilities¶
Datei: src-tauri/src/commands/backlog.rs
get_timestamp¶
Holt aktuellen Timestamp in verschiedenen Formaten.
// Formate: 'backlog' (default), 'iso', 'unix', 'full'
const timestamp = await invoke<string>('get_timestamp', {
format: 'backlog', // -> "2026-02-04 15:30"
});
| Format | Beispiel |
|---|---|
backlog |
2026-02-04 15:30 |
iso |
2026-02-04T15:30:00+01:00 |
unix |
1770228600 |
full |
2026-02-04 15:30:00 |
safe_backlog_edit¶
Sicheres Bearbeiten von Backlog.md mit Backup und Validierung.
interface SafeEditResult {
success: boolean;
hash: string;
itemCount: number;
message: string;
}
// Mode: Write (komplett ersetzen)
const result = await invoke<SafeEditResult>('safe_backlog_edit', {
projectPath: '/path/to/project',
mode: { mode: 'Write' },
content: '# Backlog...',
});
// Mode: InsertBefore
const result = await invoke<SafeEditResult>('safe_backlog_edit', {
projectPath: '/path/to/project',
mode: { mode: 'InsertBefore', marker: '## Technical Tasks' },
content: '### [F-0050] New Feature\n...',
});
// Mode: InsertAfter
const result = await invoke<SafeEditResult>('safe_backlog_edit', {
projectPath: '/path/to/project',
mode: { mode: 'InsertAfter', marker: '### [F-0049]' },
content: '### [F-0050] New Feature\n...',
});
check_consistency ¶
Prüft Konsistenz aller Backlog-Items.
interface ConsistencyIssue {
itemId: string;
field: string;
issueType: 'invalid_value' | 'missing_field' | 'logic_mismatch';
message: string;
severity: 'error' | 'warning';
}
interface ConsistencyCheckResult {
isConsistent: boolean;
itemCount: number;
errorCount: number;
warningCount: number;
issues: ConsistencyIssue[];
}
const result = await invoke<ConsistencyCheckResult>('check_consistency', {
projectId: 'abc-123',
});
Prüfungen:
| Feld | Gültige Werte |
|---|---|
| Status | Offen, In Arbeit, Blockiert, Erledigt |
| Priorität | Hoch, Mittel, Niedrig |
| Phase | Idee, Analyse, Umsetzung, Test, Done, - |
| Bereich | funktional, technisch, design, sonstiges, - |
| Typ | F, T, B, C |
Logikprüfungen:
- Status=Erledigt → Phase sollte Done sein (Warning)
- Phase=Done → Status sollte Erledigt sein (Warning)
Git Commands¶
Datei: src-tauri/src/commands/git.rs
init_git_repo¶
Initialisiert Git-Repository.
interface GitInitResult {
success: boolean;
message: string;
initialCommitCreated: boolean;
pushed: boolean;
}
const result = await invoke<GitInitResult>('init_git_repo', {
projectPath: '/path/to/project',
remoteUrl: 'https://github.com/user/repo.git',
branch: 'main',
});
get_git_status¶
Holt Git-Status.
interface GitStatus {
isRepo: boolean;
branch?: string;
remoteUrl?: string;
hasUncommittedChanges: boolean;
hasUnpushedCommits: boolean;
}
const status = await invoke<GitStatus>('get_git_status', {
projectPath: '/path/to/project',
});
git_commit_and_push¶
Commit und Push.
interface GitPushResult {
success: boolean;
message: string;
}
const result = await invoke<GitPushResult>('git_commit_and_push', {
projectPath: '/path/to/project',
message: 'Update backlog',
});
store_git_token / delete_git_token / has_git_token¶
Token-Management (OS Keyring).
await invoke('store_git_token', {
remoteUrl: 'https://github.com',
token: 'ghp_xxx...',
});
await invoke('delete_git_token', { remoteUrl: 'https://github.com' });
const hasToken = await invoke<boolean>('has_git_token', {
remoteUrl: 'https://github.com',
});
get_git_config / set_git_config¶
Git-Konfiguration pro Projekt.
interface GitConfig {
enabled: boolean;
remoteUrl?: string;
branch: string;
autoCommit: boolean;
autoPush: boolean;
}
const config = await invoke<GitConfig>('get_git_config', {
projectId: 'abc-123',
});
await invoke('set_git_config', {
projectId: 'abc-123',
config: { enabled: true, branch: 'dev', autoCommit: true, autoPush: false },
});
System Commands¶
Datei: src-tauri/src/commands/system_check.rs
run_system_check¶
Prüft System-Abhängigkeiten.
interface DependencyStatus {
available: boolean;
version: string | null;
message: string | null;
}
interface SystemCheckResult {
git: DependencyStatus;
claudeCode: DependencyStatus;
}
const result = await invoke<SystemCheckResult>('run_system_check');
File Watcher Commands¶
Datei: src-tauri/src/commands/file_watcher.rs
check_conflict¶
Prüft auf Konflikt zwischen App und Datei.
get_current_file_hash¶
Holt aktuellen Hash der Backlog.md.
Datenstrukturen¶
BacklogItem¶
interface BacklogItem {
id: {
itemType: 'F' | 'T' | 'B' | 'C';
number: number;
};
title: string;
status: string;
priority: string;
phase: string | null;
area: string | null;
description: string | null;
technicalNotes: string | null;
acceptanceCriteria: Array<{ text: string; isDone: boolean }>;
dependencies: Array<{ itemId: string; note: string | null }>;
erstellt: string | null;
bearbeitungsstart: string | null;
geschlossen: string | null;
extraFields: Record<string, string>;
}
Project¶
interface Project {
id: string;
name: string;
rootPath: string;
backlogFile: string;
createdAt: string;
updatedAt: string;
lastOpenedAt: string;
}
Events¶
backlog-file-changed¶
Emitted bei externer Änderung der Backlog.md.
import { listen } from '@tauri-apps/api/event';
const unlisten = await listen('backlog-file-changed', (event) => {
console.log('File changed:', event.payload);
});
CLI Binary (ccs)¶
Dieselben Rust-Funktionen sind auch über die CLI verfügbar:
# Timestamp
ccs timestamp --format backlog
# Backlog validieren
ccs backlog validate --project .
# Git Status
ccs git status --project .
# Backup erstellen
ccs backup create --project .
Siehe Scripts für weitere CLI-Optionen.
Siehe auch¶
- Architektur: Datenfluss
- Scripts - CLI-Tools
- Claude Code Regeln
Letzte Aktualisierung: 2026-02-04