codebee 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +392 -0
- package/app/__init__.py +0 -0
- package/app/core/__init__.py +0 -0
- package/app/core/attachments.py +322 -0
- package/app/core/automation.py +585 -0
- package/app/core/bookmeta.py +296 -0
- package/app/core/capability.py +130 -0
- package/app/core/catalog.py +319 -0
- package/app/core/compaction.py +186 -0
- package/app/core/diagnostics.py +115 -0
- package/app/core/env_scrub.py +84 -0
- package/app/core/error_codes.py +65 -0
- package/app/core/flows.py +328 -0
- package/app/core/gitmod.py +949 -0
- package/app/core/goal_service.py +159 -0
- package/app/core/health.py +294 -0
- package/app/core/history.py +32 -0
- package/app/core/jobs.py +424 -0
- package/app/core/manager.py +1415 -0
- package/app/core/market.py +299 -0
- package/app/core/market_remote.py +896 -0
- package/app/core/mocks.py +64 -0
- package/app/core/modelhub.py +2750 -0
- package/app/core/paths.py +60 -0
- package/app/core/pipeline.py +2161 -0
- package/app/core/planner.py +493 -0
- package/app/core/registry.py +105 -0
- package/app/core/remote.py +303 -0
- package/app/core/repeat_guard.py +124 -0
- package/app/core/router.py +120 -0
- package/app/core/runner.py +856 -0
- package/app/core/selfupdate.py +170 -0
- package/app/core/session_log.py +162 -0
- package/app/core/sessions.py +312 -0
- package/app/core/settings.py +85 -0
- package/app/core/settings_schema.py +250 -0
- package/app/core/skillpacks/fanqie-novel.md +80 -0
- package/app/core/skillpacks/market/character-bible.md +66 -0
- package/app/core/skillpacks/market/code-risk-checklist.md +58 -0
- package/app/core/skillpacks/market/git-workflow.md +57 -0
- package/app/core/skillpacks/market/release-notes.md +72 -0
- package/app/core/skillpacks/market/weekly-report.md +71 -0
- package/app/core/skillpacks/market/worldview-consistency.md +70 -0
- package/app/core/skillpacks/qimao-signing.md +105 -0
- package/app/core/skills.py +649 -0
- package/app/core/step_runner.py +61 -0
- package/app/core/store.py +1321 -0
- package/app/core/token_meter.py +130 -0
- package/app/core/usage.py +450 -0
- package/app/main.py +1448 -0
- package/app/ui/app.js +8021 -0
- package/app/ui/i18n.js +1709 -0
- package/app/ui/icons/brand-horizontal.png +0 -0
- package/app/ui/icons/brand-square.png +0 -0
- package/app/ui/icons/icon-192.png +0 -0
- package/app/ui/icons/icon-512.png +0 -0
- package/app/ui/icons/logo-horizontal.png +0 -0
- package/app/ui/icons/logo-mark.png +0 -0
- package/app/ui/index.html +864 -0
- package/app/ui/manifest.json +16 -0
- package/app/ui/qrcode.js +2297 -0
- package/app/ui/style.css +2733 -0
- package/bin/tutti.js +121 -0
- package/package.json +39 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""路径与目录约定。
|
|
3
|
+
|
|
4
|
+
数据目录选择顺序:
|
|
5
|
+
1. TUTTI_DATA 环境变量(测试/多实例时整体指到别处,必须在任何模块使用前设置);
|
|
6
|
+
2. 仓库内 data/ 且已有内容——开发仓库与老安装平滑沿用,升级不动数据;
|
|
7
|
+
3. 用户目录:Windows %APPDATA%\\Tutti,macOS/Linux ~/.tutti。
|
|
8
|
+
npm/pip 全局安装的包目录会在 `npm update -g` 时被整体替换,
|
|
9
|
+
数据绝不能落在包内,故全新安装一律走用户目录。
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
ROOT = Path(__file__).resolve().parents[2] # 仓库根 / npm 包根
|
|
18
|
+
APP_DIR = ROOT / "app"
|
|
19
|
+
UI_DIR = APP_DIR / "ui"
|
|
20
|
+
|
|
21
|
+
# 仓库 data/ 出现其中任意一项即视为「在用」;ensure_dirs 建出的空目录不算
|
|
22
|
+
_DATA_SENTINELS = ("catalog.json", "models.json", "orchestration.json", "tasks", "runs")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _user_data_dir(platform=None, environ=None, home=None) -> Path:
|
|
26
|
+
"""全局安装场景的用户数据目录(不创建,仅计算)。home 供测试注入。"""
|
|
27
|
+
platform = platform or sys.platform
|
|
28
|
+
env = os.environ if environ is None else environ
|
|
29
|
+
home = Path(home) if home else Path.home()
|
|
30
|
+
if platform == "win32":
|
|
31
|
+
appdata = env.get("APPDATA")
|
|
32
|
+
if appdata:
|
|
33
|
+
return Path(appdata) / "Tutti"
|
|
34
|
+
return home / "AppData" / "Roaming" / "Tutti"
|
|
35
|
+
return home / ".tutti"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def default_data_dir(repo=None, environ=None) -> Path:
|
|
39
|
+
env = (os.environ if environ is None else environ).get("TUTTI_DATA")
|
|
40
|
+
if env:
|
|
41
|
+
return Path(env)
|
|
42
|
+
repo_data = Path(repo or ROOT) / "data"
|
|
43
|
+
if any((repo_data / n).exists() for n in _DATA_SENTINELS):
|
|
44
|
+
return repo_data
|
|
45
|
+
return _user_data_dir(environ=environ)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
DATA_DIR = default_data_dir()
|
|
49
|
+
TASKS_DIR = DATA_DIR / "tasks"
|
|
50
|
+
RUNS_DIR = DATA_DIR / "runs"
|
|
51
|
+
USAGE_DIR = DATA_DIR / "usage"
|
|
52
|
+
CATALOG_FILE = DATA_DIR / "catalog.json"
|
|
53
|
+
ENABLED_FILE = DATA_DIR / "orchestration.json"
|
|
54
|
+
|
|
55
|
+
LOG_TAIL_CHARS = 4000 # API 返回日志时的截断长度
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def ensure_dirs():
|
|
59
|
+
for p in (DATA_DIR, TASKS_DIR, RUNS_DIR):
|
|
60
|
+
p.mkdir(parents=True, exist_ok=True)
|