Function bodies 677 total
_Options class · dart · L154-L194 (41 LOC).agents/skills/release/scripts/package_release.dart
class _Options {
bool help = false;
_ReleaseMode mode = _ReleaseMode.dmg;
bool buildMacosApp = true;
bool skipArchive = false;
bool useProjectSigningSettings = false;
bool skipSign = false;
bool skipNotarize = false;
bool stripRestrictedEntitlements = false;
bool keepRestrictedEntitlements = false;
bool legacyAllowRestrictedEntitlements = false;
bool allowProvisioningUpdates = false;
bool testFlightInternalOnly = false;
String? buildName;
String? buildNumber;
String? appPath;
String? appName;
String? outputDir;
String? stagingDir;
String? dmgName;
String? volumeName;
String? identity;
String? teamId;
String? notaryProfile;
String? entitlementsPath;
String? resolvedEntitlementsPath;
String? provisioningProfilePath;
String? workspacePath;
String? scheme;
String? configuration;
String? archivePath;
String? exportPath;
String? exportOptionsPlistPath;
_SigningStyle signingStyle = _SigningStyle.automatic;
_ExportDestination?_VersionInfo class · dart · L196-L201 (6 LOC).agents/skills/release/scripts/package_release.dart
class _VersionInfo {
const _VersionInfo({required this.buildName, this.buildNumber});
final String buildName;
final String? buildNumber;
}SyncResult class · python · L23-L27 (5 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
class SyncResult:
created: int = 0
skipped: int = 0
replaced: int = 0
conflicts: int = 0parse_args function · python · L30-L49 (20 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Sync third-party AI aliases to .agents/ and AGENTS.md.",
)
parser.add_argument(
"--repo",
default=".",
help="Repository root. Defaults to the current directory.",
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Print planned changes without modifying files.",
)
parser.add_argument(
"--force",
action="store_true",
help="Replace conflicting files, directories, or wrong symlinks.",
)
return parser.parse_args()ensure_directory function · python · L56-L59 (4 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
def ensure_directory(path: Path, dry_run: bool) -> None:
if dry_run or path.exists():
return
path.mkdir(parents=True, exist_ok=True)remove_path function · python · L62-L68 (7 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
def remove_path(path: Path, dry_run: bool) -> None:
if dry_run:
return
if path.is_symlink() or path.is_file():
path.unlink()
return
shutil.rmtree(path)sync_symlink function · python · L71-L112 (42 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
def sync_symlink(
link_path: Path,
target_path: Path,
result: SyncResult,
dry_run: bool,
force: bool,
) -> None:
desired_target = relative_target(link_path, target_path)
if link_path.is_symlink():
current_target = os.readlink(link_path)
if current_target == desired_target:
print(f"skip {link_path} -> {current_target}")
result.skipped += 1
return
if not force:
print(f"conflict {link_path} -> {current_target} (want {desired_target})")
result.conflicts += 1
return
print(f"replace {link_path} -> {desired_target}")
remove_path(link_path, dry_run)
if not dry_run:
link_path.symlink_to(desired_target)
result.replaced += 1
return
if link_path.exists():
if not force:
print(f"conflict {link_path} exists and is not a symlink")
result.conflicts += 1
return
print(f"Open data scored by Repobility · https://repobility.com
sync_alias_directories function · python · L115-L149 (35 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
def sync_alias_directories(
repo_root: Path,
agents_root: Path,
result: SyncResult,
dry_run: bool,
force: bool,
) -> None:
canonical_sections = [path for path in agents_root.iterdir() if path.is_dir()]
for alias_dir_name in DEFAULT_ALIAS_DIRS:
alias_root = repo_root / alias_dir_name
ensure_directory(alias_root, dry_run)
for section in canonical_sections:
alias_section = alias_root / section.name
if alias_section.exists() and not alias_section.is_dir():
if not force:
print(f"conflict {alias_section} exists and is not a directory")
result.conflicts += 1
continue
print(f"replace {alias_section} as directory")
remove_path(alias_section, dry_run)
ensure_directory(alias_section, dry_run)
for child in sorted(section.iterdir()):
if not child.is_dir():
sync_alias_files function · python · L152-L168 (17 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
def sync_alias_files(
repo_root: Path,
agents_md: Path,
result: SyncResult,
dry_run: bool,
force: bool,
) -> None:
for alias_file in DEFAULT_ALIAS_FILES:
link_path = repo_root / alias_file
ensure_directory(link_path.parent, dry_run)
sync_symlink(
link_path=link_path,
target_path=agents_md,
result=result,
dry_run=dry_run,
force=force,
)main function · python · L171-L207 (37 LOC).agents/skills/sync-agent-aliases/scripts/sync_agent_aliases.py
def main() -> int:
args = parse_args()
repo_root = Path(args.repo).resolve()
agents_root = repo_root / ".agents"
agents_md = repo_root / "AGENTS.md"
if not agents_root.is_dir():
print(f"error: missing canonical directory {agents_root}", file=sys.stderr)
return 1
if not agents_md.is_file():
print(f"error: missing canonical file {agents_md}", file=sys.stderr)
return 1
result = SyncResult()
sync_alias_directories(
repo_root=repo_root,
agents_root=agents_root,
result=result,
dry_run=args.dry_run,
force=args.force,
)
sync_alias_files(
repo_root=repo_root,
agents_md=agents_md,
result=result,
dry_run=args.dry_run,
force=args.force,
)
print(
"summary"
f" created={result.created}"
f" replaced={result.replaced}"
f" skipped={result.skipped}"
f" conflicts={result.conflicts}"
)
return 2 if rCounterViewModel class · dart · L5-L11 (7 LOC).agents/skills/view_model/examples/counter_example.dart
class CounterViewModel with ViewModel {
int count = 0;
void increment() {
update(() => count++);
}
}CounterWidget class · dart · L19-L24 (6 LOC).agents/skills/view_model/examples/counter_example.dart
class CounterWidget extends StatefulWidget {
const CounterWidget({super.key});
@override
State<CounterWidget> createState() => _CounterWidgetState();
}AuthService class · dart · L3-L8 (6 LOC).agents/skills/view_model/examples/sharing_example.dart
class AuthService with ViewModel {
bool isLoggedIn = false;
void login() => update(() => isLoggedIn = true);
void logout() => update(() => isLoggedIn = false);
}ProfileViewModel class · dart · L16-L23 (8 LOC).agents/skills/view_model/examples/sharing_example.dart
class ProfileViewModel with ViewModel {
// Dependency injection via viewModelBinding
// It automatically binds ProfileViewModel's lifecycle to AuthService if needed,
// but here authSpec is aliveForever.
late final auth = viewModelBinding.read(authSpec);
String get status => auth.isLoggedIn ? 'Online' : 'Offline';
}AppInitializer class · dart · L30-L35 (6 LOC).agents/skills/view_model/examples/sharing_example.dart
class AppInitializer with ViewModelBinding {
void checkStatus() {
final auth = viewModelBinding.read(authSpec);
print('Initial login status: ${auth.isLoggedIn}');
}
}Citation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
UserState class · dart · L3-L14 (12 LOC).agents/skills/view_model/examples/state_view_model_example.dart
class UserState {
final String name;
final int age;
const UserState({this.name = 'Guest', this.age = 0});
UserState copyWith({String? name, int? age}) {
return UserState(
name: name ?? this.name,
age: age ?? this.age,
);
}
}UserViewModel class · dart · L16-L22 (7 LOC).agents/skills/view_model/examples/state_view_model_example.dart
class UserViewModel extends StateViewModel<UserState> {
UserViewModel() : super(state: const UserState());
void updateName(String newName) {
setState(state.copyWith(name: newName));
}
}AnalyticsTracker class · dart · L29-L40 (12 LOC).agents/skills/view_model/examples/state_view_model_example.dart
class AnalyticsTracker with ViewModelBinding {
void init() {
// Selective listening: only fires when 'name' changes
viewModelBinding.listenStateSelect(
userSpec,
selector: (state) => state.name,
onChanged: (prev, curr) {
print('User name changed from $prev to $curr');
},
);
}
}RunnerTests class · swift · L5-L12 (8 LOC)ios/RunnerTests/RunnerTests.swift
class RunnerTests: XCTestCase {
func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}
}_SDelegate class · dart · L1608-L1622 (15 LOC)lib/l10n/app_localizations.dart
class _SDelegate extends LocalizationsDelegate<S> {
const _SDelegate();
@override
Future<S> load(Locale locale) {
return SynchronousFuture<S>(lookupS(locale));
}
@override
bool isSupported(Locale locale) =>
<String>['en', 'zh'].contains(locale.languageCode);
@override
bool shouldReload(_SDelegate old) => false;
}AppKvRepository class · dart · L5-L83 (79 LOC)lib/module/app_kv/app_kv_repository.dart
class AppKvRepository {
AppKvRepository._(this._db);
static final AppKvRepository instance = AppKvRepository._(AppKvDatabase());
final AppKvDatabase _db;
bool _closed = false;
Future<void> close() async {
if (_closed) {
return;
}
_closed = true;
await _db.close();
}
Future<String?> getString(String key) async {
final row = await (_db.select(
_db.appKvEntries,
)..where((entry) => entry.key.equals(key))).getSingleOrNull();
return row?.value;
}
Future<bool?> getBool(String key) async {
final raw = await getString(key);
if (raw == null) {
return null;
}
if (raw == '1' || raw == 'true') {
return true;
}
if (raw == '0' || raw == 'false') {
return false;
}
return null;
}
Future<int?> getInt(String key) async {
final raw = await getString(key);
if (raw == null) {
return null;
}
return int.tryParse(raw);
}
Future<void> setString(String key, String valuAppKvEntries class · dart · L10-L19 (10 LOC)lib/module/app_kv/data/app_kv_database.dart
class AppKvEntries extends Table {
TextColumn get key => text()();
TextColumn get value => text().nullable()();
IntColumn get updatedAtMs => integer()();
@override
Set<Column<Object>>? get primaryKey => {key};
}AppKvDatabase class · dart · L22-L33 (12 LOC)lib/module/app_kv/data/app_kv_database.dart
class AppKvDatabase extends _$AppKvDatabase {
AppKvDatabase._(super.executor);
static final AppKvDatabase _sharedInstance = AppKvDatabase._(
_openConnection(),
);
factory AppKvDatabase() => _sharedInstance;
@override
int get schemaVersion => 1;
}Repobility — the code-quality scanner for AI-generated software · https://repobility.com
AppKvEntry class · dart · L110-L195 (86 LOC)lib/module/app_kv/data/app_kv_database.g.dart
class AppKvEntry extends DataClass implements Insertable<AppKvEntry> {
final String key;
final String? value;
final int updatedAtMs;
const AppKvEntry({required this.key, this.value, required this.updatedAtMs});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['key'] = Variable<String>(key);
if (!nullToAbsent || value != null) {
map['value'] = Variable<String>(value);
}
map['updated_at_ms'] = Variable<int>(updatedAtMs);
return map;
}
AppKvEntriesCompanion toCompanion(bool nullToAbsent) {
return AppKvEntriesCompanion(
key: Value(key),
value: value == null && nullToAbsent
? const Value.absent()
: Value(value),
updatedAtMs: Value(updatedAtMs),
);
}
factory AppKvEntry.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return AppKvEntry(
key:AppKvEntriesCompanion class · dart · L197-L271 (75 LOC)lib/module/app_kv/data/app_kv_database.g.dart
class AppKvEntriesCompanion extends UpdateCompanion<AppKvEntry> {
final Value<String> key;
final Value<String?> value;
final Value<int> updatedAtMs;
final Value<int> rowid;
const AppKvEntriesCompanion({
this.key = const Value.absent(),
this.value = const Value.absent(),
this.updatedAtMs = const Value.absent(),
this.rowid = const Value.absent(),
});
AppKvEntriesCompanion.insert({
required String key,
this.value = const Value.absent(),
required int updatedAtMs,
this.rowid = const Value.absent(),
}) : key = Value(key),
updatedAtMs = Value(updatedAtMs);
static Insertable<AppKvEntry> custom({
Expression<String>? key,
Expression<String>? value,
Expression<int>? updatedAtMs,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (key != null) 'key': key,
if (value != null) 'value': value,
if (updatedAtMs != null) 'updated_at_ms': updatedAtMs,
if (rowid != null) 'rowid': rowid,
});
_ class · dart · L273-L282 (10 LOC)lib/module/app_kv/data/app_kv_database.g.dart
abstract class _$AppKvDatabase extends GeneratedDatabase {
_$AppKvDatabase(QueryExecutor e) : super(e);
$AppKvDatabaseManager get managers => $AppKvDatabaseManager(this);
late final $AppKvEntriesTable appKvEntries = $AppKvEntriesTable(this);
@override
Iterable<TableInfo<Table, Object?>> get allTables =>
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [appKvEntries];
}SmartCard class · dart · L16-L67 (52 LOC)lib/module/card/card_entity.dart
class SmartCard {
const SmartCard({
required this.id,
required this.type,
required this.title,
required this.content,
required this.createdAt,
required this.updatedAt,
this.lastUsedAt,
this.usageCount = 0,
this.isSensitive = false,
this.fields = const <String, String>{},
});
final String id;
final SmartCardType type;
final String title;
final String content;
final Map<String, String> fields;
final int usageCount;
final DateTime createdAt;
final DateTime updatedAt;
final DateTime? lastUsedAt;
final bool isSensitive;
SmartCard copyWith({
String? id,
SmartCardType? type,
String? title,
String? content,
Map<String, String>? fields,
int? usageCount,
DateTime? createdAt,
DateTime? updatedAt,
DateTime? lastUsedAt,
bool resetLastUsedAt = false,
bool? isSensitive,
}) {
return SmartCard(
id: id ?? this.id,
type: type ?? this.type,
title: title ?? this.title,
FilteredApp class · dart · L14-L38 (25 LOC)lib/module/clipboard/app_filter_service.dart
class FilteredApp {
const FilteredApp({
required this.bundleId,
required this.name,
this.iconPath,
});
final String bundleId;
final String name;
final String? iconPath;
Map<String, Object?> toJson() => <String, Object?>{
'bundleId': bundleId,
'name': name,
'iconPath': iconPath,
};
factory FilteredApp.fromJson(Map<String, Object?> json) {
return FilteredApp(
bundleId: json['bundleId'] as String? ?? '',
name: json['name'] as String? ?? '',
iconPath: json['iconPath'] as String?,
);
}
}AppFilterConfig class · dart · L41-L89 (49 LOC)lib/module/clipboard/app_filter_service.dart
class AppFilterConfig {
const AppFilterConfig({
this.mode = AppFilterMode.disabled,
this.apps = const <FilteredApp>[],
});
final AppFilterMode mode;
final List<FilteredApp> apps;
AppFilterConfig copyWith({
AppFilterMode? mode,
List<FilteredApp>? apps,
}) {
return AppFilterConfig(
mode: mode ?? this.mode,
apps: apps ?? this.apps,
);
}
String encode() {
return jsonEncode(<String, Object?>{
'mode': mode.name,
'apps': apps.map((a) => a.toJson()).toList(),
});
}
factory AppFilterConfig.decode(String? raw) {
if (raw == null || raw.isEmpty) {
return const AppFilterConfig();
}
try {
final json = jsonDecode(raw) as Map<String, Object?>;
final modeName = json['mode'] as String? ?? 'disabled';
final mode = AppFilterMode.values.firstWhere(
(m) => m.name == modeName,
orElse: () => AppFilterMode.disabled,
);
final rawApps = json['apps'] as List<Object?>? ?? AppFilterService class · dart · L92-L178 (87 LOC)lib/module/clipboard/app_filter_service.dart
class AppFilterService with ViewModel {
static const String _configKey = 'quickvault.clipboard.filter.config.v1';
AppLogService get _appLogService => viewModelBinding.read(appLogServiceSpec);
AppFilterConfig _config = const AppFilterConfig();
bool _loaded = false;
AppFilterConfig get config => _config;
@override
void onCreate(InstanceArg arg) {
super.onCreate(arg);
unawaited(_ensureLoaded());
}
Future<void> _ensureLoaded() async {
if (_loaded) return;
try {
final raw = await AppKvRepository.instance.getString(_configKey);
_config = AppFilterConfig.decode(raw);
} catch (_) {
_config = const AppFilterConfig();
}
_loaded = true;
}
/// 判断是否应该采集该应用的剪贴板内容。
Future<bool> shouldCapture(String? bundleId) async {
await _ensureLoaded();
if (_config.mode == AppFilterMode.disabled) {
return true;
}
if (bundleId == null || bundleId.isEmpty) {
// 无法识别来源时默认放行。
return true;
}
final inLisClipboardContent class · dart · L8-L33 (26 LOC)lib/module/clipboard/clipboard_gateway.dart
class ClipboardContent {
const ClipboardContent({
this.text,
this.fileUrls,
this.imagePath,
required this.changeCount,
});
/// 纯文本内容。
final String? text;
/// 文件 URL 列表(Finder 复制文件时填充)。
final List<String>? fileUrls;
/// 全尺寸图片保存路径(app support quickvault_images/ 下,≤5MB)。
final String? imagePath;
/// NSPasteboard.general.changeCount,用于去重。
final int changeCount;
bool get hasImage =>
imagePath != null && imagePath!.isNotEmpty;
bool get hasFiles =>
fileUrls != null && fileUrls!.isNotEmpty;
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
ClipboardGateway class · dart · L35-L39 (5 LOC)lib/module/clipboard/clipboard_gateway.dart
abstract class ClipboardGateway {
Future<String?> readText();
Future<void> writeText(String text);
}SystemClipboardGateway class · dart · L41-L125 (85 LOC)lib/module/clipboard/clipboard_gateway.dart
class SystemClipboardGateway with ViewModel implements ClipboardGateway {
SystemClipboardGateway();
static final pigeon.ClipboardHostApi _hostApi = pigeon.ClipboardHostApi();
static bool get _isNativeDesktop => isNativeBridgePlatform;
@override
Future<String?> readText() async {
if (_isNativeDesktop) {
try {
final text = await _hostApi.readText();
final normalized = text?.trim();
if (normalized != null && normalized.isNotEmpty) {
return normalized;
}
} catch (_) {
// 回退到 Flutter 标准剪贴板。
}
}
try {
final data = await Clipboard.getData(Clipboard.kTextPlain);
final text = data?.text?.trim();
if (text == null || text.isEmpty) {
return null;
}
return text;
} catch (_) {
return null;
}
}
/// 读取剪贴板完整内容(文本 + 文件路径 + 图片)。
/// 仅在 macOS 上可用;其他平台返回 null。
/// 调用方应自行 try-catch 并记录错误。
Future<ClipboardContent?> readContent() async {
if (!_isNativClipboardSourceApp class · dart · L6-L12 (7 LOC)lib/module/clipboard/source_app_gateway.dart
class ClipboardSourceApp {
const ClipboardSourceApp({required this.name, this.bundleId, this.iconPath});
final String name;
final String? bundleId;
final String? iconPath;
}SourceAppGateway class · dart · L14-L16 (3 LOC)lib/module/clipboard/source_app_gateway.dart
abstract class SourceAppGateway {
Future<ClipboardSourceApp?> readCurrentSourceApp();
}MacosSourceAppGateway class · dart · L18-L44 (27 LOC)lib/module/clipboard/source_app_gateway.dart
class MacosSourceAppGateway with ViewModel implements SourceAppGateway {
MacosSourceAppGateway();
static final pigeon.SourceAppHostApi _hostApi = pigeon.SourceAppHostApi();
static bool get isSupported => isNativeBridgePlatform;
@override
Future<ClipboardSourceApp?> readCurrentSourceApp() async {
if (!isSupported) {
return null;
}
try {
final msg = await _hostApi.getFrontmostApp();
if (msg == null) {
return null;
}
return ClipboardSourceApp(
name: msg.name,
bundleId: msg.bundleId,
iconPath: msg.iconPath,
);
} catch (_) {
return null;
}
}
}HistoryItems class · dart · L10-L64 (55 LOC)lib/module/history/data/history_database.dart
class HistoryItems extends Table {
IntColumn get localId => integer().autoIncrement()();
TextColumn get itemId => text()();
TextColumn get contentText => text().named('text')();
TextColumn get textHash => text()();
TextColumn get title => text()();
TextColumn get type => text()();
RealColumn get confidence => real().withDefault(const Constant(0.0))();
TextColumn get codeLanguage => text().nullable()();
BoolColumn get pinned => boolean().withDefault(const Constant(false))();
BoolColumn get isSensitive => boolean().withDefault(const Constant(false))();
TextColumn get groupId => text().nullable()();
TextColumn get sourceAppName => text().nullable()();
TextColumn get sourceAppBundleId => text().nullable()();
TextColumn get sourceAppIconPath => text().nullable()();
BlobColumn get sourceAppIconPng => blob().nullable()();
BlobColumn get thumbnailPng => blob().nullable()();
TextColumn get fileMimeType => text().nullable()();
TextColumn get fHistoryGroups class · dart · L66-L86 (21 LOC)lib/module/history/data/history_database.dart
class HistoryGroups extends Table {
TextColumn get id => text()();
TextColumn get name => text()();
IntColumn get sortOrder => integer().withDefault(const Constant(0))();
IntColumn get colorTag => integer().nullable()();
IntColumn get createdAtMs => integer()();
IntColumn get updatedAtMs => integer()();
@override
Set<Column<Object>>? get primaryKey => {id};
@override
List<String> get customConstraints => const <String>[
'UNIQUE(name COLLATE NOCASE)',
];
}HistorySyncOutbox class · dart · L88-L100 (13 LOC)lib/module/history/data/history_database.dart
class HistorySyncOutbox extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get action => text()();
TextColumn get entityType => text()();
TextColumn get entityId => text()();
TextColumn get payload => text().nullable()();
IntColumn get createdAtMs => integer()();
}Open data scored by Repobility · https://repobility.com
AppHistoryDatabase class · dart · L103-L228 (126 LOC)lib/module/history/data/history_database.dart
class AppHistoryDatabase extends _$AppHistoryDatabase {
AppHistoryDatabase._(super.executor);
static final AppHistoryDatabase _sharedInstance = AppHistoryDatabase._(
_openConnection(),
);
factory AppHistoryDatabase() => _sharedInstance;
AppHistoryDatabase.connect(super.executor);
@override
int get schemaVersion => 7;
@override
MigrationStrategy get migration => MigrationStrategy(
onCreate: (Migrator m) async {
await m.createAll();
await _createPerformanceIndexes();
await _createFtsObjects();
},
onUpgrade: (Migrator m, int from, int to) async {
if (from < 2) {
await customStatement(
'ALTER TABLE history_groups '
'ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0',
);
await customStatement(
'ALTER TABLE history_groups ADD COLUMN color_tag INTEGER',
);
}
if (from < 3) {
await customStatement(
'ALTER TABLE history_items ADD COLUMN file_miHistoryItemsCompanion class · dart · L1130-L1440 (311 LOC)lib/module/history/data/history_database.g.dart
class HistoryItemsCompanion extends UpdateCompanion<HistoryItem> {
final Value<int> localId;
final Value<String> itemId;
final Value<String> contentText;
final Value<String> textHash;
final Value<String> title;
final Value<String> type;
final Value<double> confidence;
final Value<String?> codeLanguage;
final Value<bool> pinned;
final Value<bool> isSensitive;
final Value<String?> groupId;
final Value<String?> sourceAppName;
final Value<String?> sourceAppBundleId;
final Value<String?> sourceAppIconPath;
final Value<Uint8List?> sourceAppIconPng;
final Value<Uint8List?> thumbnailPng;
final Value<String?> fileMimeType;
final Value<String?> fileExtension;
final Value<int?> fileSizeBytes;
final Value<String?> sourceFilePath;
final Value<int> usageCount;
final Value<int> createdAtMs;
final Value<int> updatedAtMs;
final Value<int?> lastUsedAtMs;
final Value<int?> deletedAtMs;
const HistoryItemsCompanion({
this.localId = const Value.absent(HistoryGroup class · dart · L1621-L1746 (126 LOC)lib/module/history/data/history_database.g.dart
class HistoryGroup extends DataClass implements Insertable<HistoryGroup> {
final String id;
final String name;
final int sortOrder;
final int? colorTag;
final int createdAtMs;
final int updatedAtMs;
const HistoryGroup({
required this.id,
required this.name,
required this.sortOrder,
this.colorTag,
required this.createdAtMs,
required this.updatedAtMs,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['name'] = Variable<String>(name);
map['sort_order'] = Variable<int>(sortOrder);
if (!nullToAbsent || colorTag != null) {
map['color_tag'] = Variable<int>(colorTag);
}
map['created_at_ms'] = Variable<int>(createdAtMs);
map['updated_at_ms'] = Variable<int>(updatedAtMs);
return map;
}
HistoryGroupsCompanion toCompanion(bool nullToAbsent) {
return HistoryGroupsCompanion(
id: Value(id),
name: Value(nHistoryGroupsCompanion class · dart · L1748-L1857 (110 LOC)lib/module/history/data/history_database.g.dart
class HistoryGroupsCompanion extends UpdateCompanion<HistoryGroup> {
final Value<String> id;
final Value<String> name;
final Value<int> sortOrder;
final Value<int?> colorTag;
final Value<int> createdAtMs;
final Value<int> updatedAtMs;
final Value<int> rowid;
const HistoryGroupsCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.sortOrder = const Value.absent(),
this.colorTag = const Value.absent(),
this.createdAtMs = const Value.absent(),
this.updatedAtMs = const Value.absent(),
this.rowid = const Value.absent(),
});
HistoryGroupsCompanion.insert({
required String id,
required String name,
this.sortOrder = const Value.absent(),
this.colorTag = const Value.absent(),
required int createdAtMs,
required int updatedAtMs,
this.rowid = const Value.absent(),
}) : id = Value(id),
name = Value(name),
createdAtMs = Value(createdAtMs),
updatedAtMs = Value(updatedAtMs);
_ class · dart · L2267-L2283 (17 LOC)lib/module/history/data/history_database.g.dart
abstract class _$AppHistoryDatabase extends GeneratedDatabase {
_$AppHistoryDatabase(QueryExecutor e) : super(e);
$AppHistoryDatabaseManager get managers => $AppHistoryDatabaseManager(this);
late final $HistoryItemsTable historyItems = $HistoryItemsTable(this);
late final $HistoryGroupsTable historyGroups = $HistoryGroupsTable(this);
late final $HistorySyncOutboxTable historySyncOutbox =
$HistorySyncOutboxTable(this);
@override
Iterable<TableInfo<Table, Object?>> get allTables =>
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [
historyItems,
historyGroups,
historySyncOutbox,
];
}HistoryPageCursor class · dart · L14-L24 (11 LOC)lib/module/history/data/history_repository.dart
class HistoryPageCursor {
const HistoryPageCursor({
required this.pinned,
required this.createdAtMs,
required this.localId,
});
final int pinned;
final int createdAtMs;
final int localId;
}HistoryPage class · dart · L28-L45 (18 LOC)lib/module/history/data/history_repository.dart
class HistoryPage {
const HistoryPage({
required this.items,
required this.hasMore,
required this.totalCount,
this.firstCursor,
this.lastCursor,
});
final List<ClipboardItem> items;
final HistoryPageCursor? firstCursor;
final HistoryPageCursor? lastCursor;
final bool hasMore;
final int totalCount;
/// 兼容旧的单向分页调用方,默认继续指向“更旧一页”的尾游标。
HistoryPageCursor? get nextCursor => lastCursor;
}ClipboardItem class · dart · L9-L151 (143 LOC)lib/module/history/history_models.dart
class ClipboardItem {
const ClipboardItem({
required this.id,
required this.title,
required this.text,
required this.type,
required this.confidence,
required this.createdAt,
required this.updatedAt,
this.codeLanguage,
this.lastUsedAt,
this.usageCount = 0,
this.pinned = false,
this.isSensitive = false,
this.groupId,
this.sourceAppName,
this.sourceAppBundleId,
this.sourceAppIconPath,
this.sourceAppIconPng,
this.thumbnailPng,
this.deletedAt,
this.fileMimeType,
this.fileExtension,
this.fileSizeBytes,
});
final String id;
final String title;
final String text;
final SmartCardType type;
final double confidence;
final String? codeLanguage;
final DateTime createdAt;
final DateTime updatedAt;
final DateTime? lastUsedAt;
final int usageCount;
final bool pinned;
final bool isSensitive;
final String? groupId;
final String? sourceAppName;
final String? sourceAppBundleId;
finaCitation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
ClipboardGroup class · dart · L153-L193 (41 LOC)lib/module/history/history_models.dart
class ClipboardGroup {
const ClipboardGroup({
required this.id,
required this.name,
required this.createdAt,
required this.updatedAt,
this.sortOrder = 0,
this.colorTag,
});
final String id;
final String name;
final DateTime createdAt;
final DateTime updatedAt;
/// 自定义排序序号,值越小越靠前。
final int sortOrder;
/// 颜色标记索引(0-6),null 表示无标记。
/// 0=红, 1=橙, 2=黄, 3=绿, 4=蓝, 5=紫, 6=灰。
final int? colorTag;
ClipboardGroup copyWith({
String? id,
String? name,
DateTime? createdAt,
DateTime? updatedAt,
int? sortOrder,
int? colorTag,
bool clearColorTag = false,
}) {
return ClipboardGroup(
id: id ?? this.id,
name: name ?? this.name,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
sortOrder: sortOrder ?? this.sortOrder,
colorTag: clearColorTag ? null : (colorTag ?? this.colorTag),
);
}
}ClipboardPayload class · dart · L195-L205 (11 LOC)lib/module/history/history_models.dart
class ClipboardPayload {
const ClipboardPayload({required this.items, required this.groups});
final List<ClipboardItem> items;
final List<ClipboardGroup> groups;
static const ClipboardPayload empty = ClipboardPayload(
items: <ClipboardItem>[],
groups: <ClipboardGroup>[],
);
}SqlDbRepoState class · dart · L8-L70 (63 LOC)lib/module/history/sql_db_repo.dart
class SqlDbRepoState {
const SqlDbRepoState({
required this.items,
required this.groups,
required this.query,
required this.selectedGroupId,
required this.totalCount,
required this.hasMore,
required this.loading,
required this.loadingMore,
required this.errorMessage,
});
final List<ClipboardItem> items;
final List<ClipboardGroup> groups;
final String query;
final String? selectedGroupId;
final int totalCount;
final bool hasMore;
final bool loading;
final bool loadingMore;
final String? errorMessage;
SqlDbRepoState copyWith({
List<ClipboardItem>? items,
List<ClipboardGroup>? groups,
String? query,
String? selectedGroupId,
bool clearSelectedGroupId = false,
int? totalCount,
bool? hasMore,
bool? loading,
bool? loadingMore,
String? errorMessage,
bool clearError = false,
}) {
return SqlDbRepoState(
items: items ?? this.items,
groups: groups ?? this.groups,
query:page 1 / 14next ›