campfire-cli 0.1.0__py3-none-any.whl
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.
- campfire_cli/__init__.py +3 -0
- campfire_cli/alembic/__init__.py +1 -0
- campfire_cli/alembic/env.py +37 -0
- campfire_cli/alembic/script.py.mako +22 -0
- campfire_cli/alembic/versions/001_initial_schema.py +81 -0
- campfire_cli/alembic/versions/002_workspace_project_registry.py +47 -0
- campfire_cli/alembic/versions/003_unified_workspace_state.py +113 -0
- campfire_cli/alembic/versions/004_restructure_workspace_domain.py +23 -0
- campfire_cli/alembic/versions/005_decision_channel.py +71 -0
- campfire_cli/alembic/versions/006_workspace_topology_index.py +61 -0
- campfire_cli/alembic/versions/007_workspace_adoption.py +38 -0
- campfire_cli/alembic/versions/__init__.py +1 -0
- campfire_cli/app/SPEC.md +12 -0
- campfire_cli/app/__init__.py +1 -0
- campfire_cli/app/base/SPEC.md +3 -0
- campfire_cli/app/base/__init__.py +1 -0
- campfire_cli/app/base/cli/base_cli.py +37 -0
- campfire_cli/app/base/repository/base_repository.py +17 -0
- campfire_cli/app/base/schema/base_schema.py +18 -0
- campfire_cli/app/base/service/base_service.py +129 -0
- campfire_cli/app/decision/SPEC.md +16 -0
- campfire_cli/app/decision/__init__.py +1 -0
- campfire_cli/app/decision/cli/decision_cli.py +112 -0
- campfire_cli/app/decision/repository/decision_repository.py +199 -0
- campfire_cli/app/decision/schema/decision_schema.py +56 -0
- campfire_cli/app/decision/service/decision_projection_service.py +151 -0
- campfire_cli/app/decision/service/decision_service.py +124 -0
- campfire_cli/app/document/SPEC.md +51 -0
- campfire_cli/app/document/__init__.py +1 -0
- campfire_cli/app/document/cli/__init__.py +1 -0
- campfire_cli/app/document/cli/document_cli.py +63 -0
- campfire_cli/app/document/cli/profile_cli.py +65 -0
- campfire_cli/app/document/cli/type_cli.py +49 -0
- campfire_cli/app/document/repository/__init__.py +1 -0
- campfire_cli/app/document/repository/document_profile_repository.py +17 -0
- campfire_cli/app/document/repository/document_type_repository.py +17 -0
- campfire_cli/app/document/service/__init__.py +1 -0
- campfire_cli/app/document/service/document_profile_service.py +66 -0
- campfire_cli/app/document/service/document_rule_service.py +316 -0
- campfire_cli/app/document/service/document_scanner.py +38 -0
- campfire_cli/app/document/service/document_service.py +139 -0
- campfire_cli/app/document/service/document_type_service.py +28 -0
- campfire_cli/app/document/service/frontmatter_apply.py +98 -0
- campfire_cli/app/document/service/frontmatter_formatter.py +104 -0
- campfire_cli/app/document/service/frontmatter_plan.py +75 -0
- campfire_cli/app/document/service/profile_registry.py +166 -0
- campfire_cli/app/document/service/type_apply.py +185 -0
- campfire_cli/app/document/service/type_plan.py +80 -0
- campfire_cli/app/maintenance/SPEC.md +22 -0
- campfire_cli/app/maintenance/__init__.py +1 -0
- campfire_cli/app/maintenance/cli/maintenance_cli.py +103 -0
- campfire_cli/app/maintenance/repository/maintenance_repository.py +115 -0
- campfire_cli/app/maintenance/schema/maintenance_schema.py +109 -0
- campfire_cli/app/maintenance/service/archive_service.py +255 -0
- campfire_cli/app/maintenance/service/link_service.py +91 -0
- campfire_cli/app/maintenance/service/maintenance_protocol.py +25 -0
- campfire_cli/app/maintenance/service/maintenance_service.py +461 -0
- campfire_cli/app/maintenance/service/moc_service.py +310 -0
- campfire_cli/app/maintenance/service/plan_service.py +411 -0
- campfire_cli/app/skill/SPEC.md +3 -0
- campfire_cli/app/skill/__init__.py +1 -0
- campfire_cli/app/skill/cli/skill_cli.py +44 -0
- campfire_cli/app/skill/repository/skill_repository.py +33 -0
- campfire_cli/app/skill/schema/skill_schema.py +18 -0
- campfire_cli/app/skill/service/skill_service.py +146 -0
- campfire_cli/app/workspace/SPEC.md +25 -0
- campfire_cli/app/workspace/__init__.py +1 -0
- campfire_cli/app/workspace/cli/__init__.py +1 -0
- campfire_cli/app/workspace/cli/adoption_cli.py +83 -0
- campfire_cli/app/workspace/cli/config_cli.py +30 -0
- campfire_cli/app/workspace/cli/domain_cli.py +101 -0
- campfire_cli/app/workspace/cli/project_cli.py +135 -0
- campfire_cli/app/workspace/cli/restructure_cli.py +133 -0
- campfire_cli/app/workspace/cli/space_cli.py +65 -0
- campfire_cli/app/workspace/cli/workspace_cli.py +145 -0
- campfire_cli/app/workspace/repository/__init__.py +1 -0
- campfire_cli/app/workspace/repository/adoption_repository.py +55 -0
- campfire_cli/app/workspace/repository/manifest_repository.py +38 -0
- campfire_cli/app/workspace/repository/restructure_repository.py +93 -0
- campfire_cli/app/workspace/repository/workspace_repository.py +125 -0
- campfire_cli/app/workspace/schema/__init__.py +1 -0
- campfire_cli/app/workspace/schema/adoption_schema.py +47 -0
- campfire_cli/app/workspace/schema/restructure_schema.py +64 -0
- campfire_cli/app/workspace/schema/workspace_schema.py +225 -0
- campfire_cli/app/workspace/service/__init__.py +1 -0
- campfire_cli/app/workspace/service/adoption_protocol.py +11 -0
- campfire_cli/app/workspace/service/adoption_service.py +364 -0
- campfire_cli/app/workspace/service/config_service.py +189 -0
- campfire_cli/app/workspace/service/domain_restructure_service.py +316 -0
- campfire_cli/app/workspace/service/project_service.py +389 -0
- campfire_cli/app/workspace/service/restructure_protocol.py +19 -0
- campfire_cli/app/workspace/service/restructure_service.py +392 -0
- campfire_cli/app/workspace/service/restructure_verifier.py +83 -0
- campfire_cli/app/workspace/service/structure_service.py +494 -0
- campfire_cli/app/workspace/service/workspace_protocol.py +24 -0
- campfire_cli/app/workspace/service/workspace_service.py +304 -0
- campfire_cli/common/SPEC.md +12 -0
- campfire_cli/common/__init__.py +1 -0
- campfire_cli/common/database/__init__.py +4 -0
- campfire_cli/common/database/migrations.py +18 -0
- campfire_cli/common/database/models.py +215 -0
- campfire_cli/common/database/session.py +30 -0
- campfire_cli/common/documents/__init__.py +1 -0
- campfire_cli/common/documents/document_types.py +119 -0
- campfire_cli/common/documents/frontmatter_schema.py +42 -0
- campfire_cli/common/documents/markdown.py +66 -0
- campfire_cli/common/exceptions/__init__.py +7 -0
- campfire_cli/common/exceptions/base.py +19 -0
- campfire_cli/common/filesystem/__init__.py +6 -0
- campfire_cli/common/filesystem/atomic.py +30 -0
- campfire_cli/common/filesystem/locking.py +55 -0
- campfire_cli/common/governance/__init__.py +13 -0
- campfire_cli/common/governance/issues.py +38 -0
- campfire_cli/common/governance/locking.py +31 -0
- campfire_cli/common/governance/snapshots.py +26 -0
- campfire_cli/common/hashing.py +10 -0
- campfire_cli/common/reports/__init__.py +1 -0
- campfire_cli/common/reports/json_report.py +8 -0
- campfire_cli/common/reports/markdown_report.py +29 -0
- campfire_cli/config/SPEC.md +5 -0
- campfire_cli/config/defaults.py +64 -0
- campfire_cli/config/settings.py +50 -0
- campfire_cli/container.py +130 -0
- campfire_cli/main.py +133 -0
- campfire_cli/resources/__init__.py +1 -0
- campfire_cli/resources/bases/Agent/346/211/247/350/241/214/345/267/245/344/275/234/345/217/260.base +35 -0
- campfire_cli/resources/bases/SPEC.md +3 -0
- campfire_cli/resources/bases//344/273/273/345/212/241/345/267/245/344/275/234/345/217/260.base +49 -0
- campfire_cli/resources/bases//345/206/263/347/255/226/345/267/245/344/275/234/345/217/260.base +40 -0
- campfire_cli/resources/bases//345/276/205/345/275/222/346/241/243/346/226/207/346/241/243.base +28 -0
- campfire_cli/resources/bases//351/241/271/347/233/256/346/226/207/346/241/243.base +35 -0
- campfire_cli/resources/defaults/__init__.py +1 -0
- campfire_cli/resources/defaults/config.yml +458 -0
- campfire_cli/resources/skills/SPEC.md +3 -0
- campfire_cli/resources/skills/campfire-context-bootstrap/SKILL.md +62 -0
- campfire_cli/resources/skills/campfire-context-bootstrap/agents/openai.yaml +3 -0
- campfire_cli/resources/skills/campfire-conversation-router/SKILL.md +53 -0
- campfire_cli/resources/skills/campfire-conversation-router/agents/openai.yaml +3 -0
- campfire_cli/resources/skills/campfire-conversation-router/references/inbox-handoff.md +19 -0
- campfire_cli/resources/skills/campfire-conversation-router/references/learning-intake.md +31 -0
- campfire_cli/resources/skills/campfire-conversation-router/references/task-intake.md +28 -0
- campfire_cli/resources/skills/campfire-document-capture/SKILL.md +109 -0
- campfire_cli/resources/skills/campfire-inbox-triage/SKILL.md +23 -0
- campfire_cli/resources/skills/campfire-weekly-report-writing/SKILL.md +21 -0
- campfire_cli/resources/skills/campfire-weekly-report-writing/agents/openai.yaml +3 -0
- campfire_cli/resources/skills/campfire-workspace-adoption/SKILL.md +42 -0
- campfire_cli/resources/skills/campfire-workspace-maintenance/SKILL.md +74 -0
- campfire_cli/resources/skills/campfire-workspace-maintenance/references//344/273/273/345/212/241/346/255/243/346/226/207/347/273/223/346/236/204.md +23 -0
- campfire_cli/resources/skills/campfire-workspace-restructure/SKILL.md +52 -0
- campfire_cli-0.1.0.dist-info/METADATA +141 -0
- campfire_cli-0.1.0.dist-info/RECORD +154 -0
- campfire_cli-0.1.0.dist-info/WHEEL +4 -0
- campfire_cli-0.1.0.dist-info/entry_points.txt +2 -0
- campfire_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from campfire_cli.app.base.repository.base_repository import BaseRepository
|
|
7
|
+
from campfire_cli.app.base.service.base_service import BaseService
|
|
8
|
+
from campfire_cli.app.decision.repository.decision_repository import SqliteDecisionRepository
|
|
9
|
+
from campfire_cli.app.decision.service.decision_projection_service import (
|
|
10
|
+
DecisionProjectionService,
|
|
11
|
+
)
|
|
12
|
+
from campfire_cli.app.decision.service.decision_service import DecisionService
|
|
13
|
+
from campfire_cli.app.maintenance.repository.maintenance_repository import (
|
|
14
|
+
SqliteMaintenanceRepository,
|
|
15
|
+
)
|
|
16
|
+
from campfire_cli.app.maintenance.service.maintenance_service import MaintenanceService
|
|
17
|
+
from campfire_cli.app.skill.repository.skill_repository import SkillRepository
|
|
18
|
+
from campfire_cli.app.skill.service.skill_service import SkillService
|
|
19
|
+
from campfire_cli.app.workspace.repository.adoption_repository import SqliteAdoptionRepository
|
|
20
|
+
from campfire_cli.app.workspace.repository.restructure_repository import (
|
|
21
|
+
SqliteRestructureRepository,
|
|
22
|
+
)
|
|
23
|
+
from campfire_cli.app.workspace.repository.workspace_repository import SqliteWorkspaceRepository
|
|
24
|
+
from campfire_cli.app.workspace.service.adoption_service import AdoptionService
|
|
25
|
+
from campfire_cli.app.workspace.service.config_service import WorkspaceConfigService
|
|
26
|
+
from campfire_cli.app.workspace.service.domain_restructure_service import (
|
|
27
|
+
DomainRestructureService,
|
|
28
|
+
)
|
|
29
|
+
from campfire_cli.app.workspace.service.restructure_service import RestructureService
|
|
30
|
+
from campfire_cli.app.workspace.service.workspace_service import WorkspaceService
|
|
31
|
+
from campfire_cli.common.database import create_sqlite_engine, open_session, upgrade_database
|
|
32
|
+
from campfire_cli.common.exceptions import ConfigurationError
|
|
33
|
+
from campfire_cli.config.defaults import effective_config
|
|
34
|
+
from campfire_cli.config.settings import WorkspaceSettings, campfire_home
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass
|
|
38
|
+
class AppContainer:
|
|
39
|
+
settings: WorkspaceSettings
|
|
40
|
+
maintenance: MaintenanceService
|
|
41
|
+
restructure: RestructureService
|
|
42
|
+
domain_restructure: DomainRestructureService
|
|
43
|
+
adoption: AdoptionService
|
|
44
|
+
skill: SkillService
|
|
45
|
+
base: BaseService
|
|
46
|
+
decision: DecisionService
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def setup(cls, workspace: Path, make_default: bool = False) -> dict:
|
|
50
|
+
"""Bootstrap one device from the portable Workspace Manifest."""
|
|
51
|
+
governance_root = campfire_home()
|
|
52
|
+
setup_result = WorkspaceService(
|
|
53
|
+
governance_root, SqliteWorkspaceRepository(governance_root)
|
|
54
|
+
).setup(workspace, make_default)
|
|
55
|
+
container = cls.build(setup_result.workspace_id)
|
|
56
|
+
settings = container.settings
|
|
57
|
+
return {
|
|
58
|
+
**setup_result.model_dump(mode="json"),
|
|
59
|
+
"resources": {
|
|
60
|
+
"config": WorkspaceConfigService(settings).check().model_dump(mode="json"),
|
|
61
|
+
"skills": container.skill.sync(dry_run=False).model_dump(mode="json"),
|
|
62
|
+
"bases": container.base.sync(dry_run=False).model_dump(mode="json"),
|
|
63
|
+
},
|
|
64
|
+
"health": container.maintenance.check(summary=True).model_dump(mode="json"),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def build_skill(cls) -> SkillService:
|
|
69
|
+
"""Build the global Skill service without requiring a registered Workspace."""
|
|
70
|
+
home = campfire_home()
|
|
71
|
+
try:
|
|
72
|
+
config = effective_config(home / "config.yml")
|
|
73
|
+
except (OSError, ValueError) as exc:
|
|
74
|
+
raise ConfigurationError(f"无法加载 Campfire config.yml:{exc}") from exc
|
|
75
|
+
settings = WorkspaceSettings(
|
|
76
|
+
workspace_id="",
|
|
77
|
+
vault_root=home,
|
|
78
|
+
state_root=home,
|
|
79
|
+
governance=config["governance"],
|
|
80
|
+
document_types=config["document_types"],
|
|
81
|
+
frontmatter_schema=config["frontmatter_schema"],
|
|
82
|
+
skills=config["skills"],
|
|
83
|
+
bases=config["bases"],
|
|
84
|
+
)
|
|
85
|
+
return SkillService(settings, SkillRepository())
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def build(cls, workspace: str | Path | None) -> AppContainer:
|
|
89
|
+
governance_root = campfire_home()
|
|
90
|
+
resolution = WorkspaceService(
|
|
91
|
+
governance_root, SqliteWorkspaceRepository(governance_root)
|
|
92
|
+
).resolve(str(workspace) if workspace is not None else None, Path.cwd())
|
|
93
|
+
settings = WorkspaceSettings.load(resolution.workspace_id, Path(resolution.workspace))
|
|
94
|
+
database_path = governance_root / "campfire.db"
|
|
95
|
+
upgrade_database(database_path)
|
|
96
|
+
engine = create_sqlite_engine(database_path)
|
|
97
|
+
session = open_session(engine)
|
|
98
|
+
maintenance_repository = SqliteMaintenanceRepository(
|
|
99
|
+
session, resolution.workspace_id, settings.state_root
|
|
100
|
+
)
|
|
101
|
+
maintenance = MaintenanceService(settings, maintenance_repository)
|
|
102
|
+
restructure_repository = SqliteRestructureRepository(
|
|
103
|
+
session, settings.state_root, resolution.workspace_id
|
|
104
|
+
)
|
|
105
|
+
restructure = RestructureService(settings, restructure_repository)
|
|
106
|
+
domain_restructure = DomainRestructureService(
|
|
107
|
+
settings, SqliteWorkspaceRepository(governance_root), maintenance
|
|
108
|
+
)
|
|
109
|
+
adoption = AdoptionService(
|
|
110
|
+
settings,
|
|
111
|
+
SqliteAdoptionRepository(session, resolution.workspace_id),
|
|
112
|
+
SqliteWorkspaceRepository(governance_root),
|
|
113
|
+
maintenance,
|
|
114
|
+
)
|
|
115
|
+
skill = SkillService(settings, SkillRepository())
|
|
116
|
+
base = BaseService(settings, BaseRepository())
|
|
117
|
+
decision = DecisionService(
|
|
118
|
+
SqliteDecisionRepository(session, resolution.workspace_id),
|
|
119
|
+
DecisionProjectionService(settings),
|
|
120
|
+
)
|
|
121
|
+
return cls(
|
|
122
|
+
settings=settings,
|
|
123
|
+
maintenance=maintenance,
|
|
124
|
+
restructure=restructure,
|
|
125
|
+
domain_restructure=domain_restructure,
|
|
126
|
+
adoption=adoption,
|
|
127
|
+
skill=skill,
|
|
128
|
+
base=base,
|
|
129
|
+
decision=decision,
|
|
130
|
+
)
|
campfire_cli/main.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
from contextlib import suppress
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
|
|
11
|
+
from campfire_cli import __version__
|
|
12
|
+
from campfire_cli.app.base.cli.base_cli import base_cli
|
|
13
|
+
from campfire_cli.app.decision.cli.decision_cli import decision_cli
|
|
14
|
+
from campfire_cli.app.document.cli.document_cli import document_cli
|
|
15
|
+
from campfire_cli.app.maintenance.cli.maintenance_cli import maintenance_cli
|
|
16
|
+
from campfire_cli.app.skill.cli.skill_cli import skill_cli
|
|
17
|
+
from campfire_cli.app.skill.service.skill_service import SkillService
|
|
18
|
+
from campfire_cli.app.workspace.cli.adoption_cli import adoption_cli
|
|
19
|
+
from campfire_cli.app.workspace.cli.config_cli import config_cli
|
|
20
|
+
from campfire_cli.app.workspace.cli.domain_cli import domain_cli
|
|
21
|
+
from campfire_cli.app.workspace.cli.project_cli import project_cli
|
|
22
|
+
from campfire_cli.app.workspace.cli.restructure_cli import restructure_cli
|
|
23
|
+
from campfire_cli.app.workspace.cli.space_cli import space_cli
|
|
24
|
+
from campfire_cli.app.workspace.cli.workspace_cli import workspace_cli
|
|
25
|
+
from campfire_cli.common.exceptions import AppError
|
|
26
|
+
from campfire_cli.container import AppContainer
|
|
27
|
+
|
|
28
|
+
# Windows 控制台默认 GBK 代码页会把中文输出编码成 GBK 导致乱码;
|
|
29
|
+
# 统一以 UTF-8 输出(测试环境的替换流没有 reconfigure,直接跳过)。
|
|
30
|
+
for _stream in (sys.stdout, sys.stderr):
|
|
31
|
+
if hasattr(_stream, "reconfigure"):
|
|
32
|
+
with suppress(OSError, ValueError):
|
|
33
|
+
_stream.reconfigure(encoding="utf-8")
|
|
34
|
+
|
|
35
|
+
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class LazyContainer:
|
|
39
|
+
"""Delay Workspace discovery until a command actually requests an application service."""
|
|
40
|
+
|
|
41
|
+
def __init__(self, workspace: str | None) -> None:
|
|
42
|
+
self._workspace = workspace
|
|
43
|
+
self._container: AppContainer | None = None
|
|
44
|
+
self._skill: SkillService | None = None
|
|
45
|
+
|
|
46
|
+
def __getattr__(self, name: str) -> Any:
|
|
47
|
+
# Skill 是全局资源(同步到 ~/.claude/skills 等),不依赖任何已注册
|
|
48
|
+
# Workspace;单独构建,避免首次安装时尚未注册 Workspace 就无法使用。
|
|
49
|
+
if name == "skill":
|
|
50
|
+
if self._skill is None:
|
|
51
|
+
self._skill = AppContainer.build_skill()
|
|
52
|
+
return self._skill
|
|
53
|
+
if self._container is None:
|
|
54
|
+
try:
|
|
55
|
+
self._container = AppContainer.build(self._workspace)
|
|
56
|
+
except AppError as exc:
|
|
57
|
+
typer.echo(
|
|
58
|
+
json.dumps({"status": "error", "message": str(exc)}, ensure_ascii=False),
|
|
59
|
+
err=True,
|
|
60
|
+
)
|
|
61
|
+
raise typer.Exit(exc.exit_code) from exc
|
|
62
|
+
return getattr(self._container, name)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
app = typer.Typer(
|
|
66
|
+
help="人类与 Agent 共用的 Workspace 文档治理 CLI",
|
|
67
|
+
no_args_is_help=True,
|
|
68
|
+
context_settings=CONTEXT_SETTINGS,
|
|
69
|
+
)
|
|
70
|
+
workspace_cli.add_typer(project_cli, name="project")
|
|
71
|
+
workspace_cli.add_typer(space_cli, name="space")
|
|
72
|
+
workspace_cli.add_typer(domain_cli, name="domain")
|
|
73
|
+
workspace_cli.add_typer(config_cli, name="config")
|
|
74
|
+
workspace_cli.add_typer(restructure_cli, name="restructure")
|
|
75
|
+
workspace_cli.add_typer(adoption_cli, name="adopt")
|
|
76
|
+
app.add_typer(workspace_cli, name="workspace")
|
|
77
|
+
app.add_typer(document_cli, name="document")
|
|
78
|
+
app.add_typer(decision_cli, name="decision")
|
|
79
|
+
app.add_typer(maintenance_cli, name="maintenance")
|
|
80
|
+
app.add_typer(skill_cli, name="skill")
|
|
81
|
+
app.add_typer(base_cli, name="base")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@app.callback()
|
|
85
|
+
def main(
|
|
86
|
+
ctx: typer.Context,
|
|
87
|
+
workspace: str | None = typer.Option(None, "--workspace", help="已注册 Workspace 的 id 或路径"),
|
|
88
|
+
) -> None:
|
|
89
|
+
"""初始化目标 Workspace 的应用依赖。"""
|
|
90
|
+
if ctx.invoked_subcommand in {None, "version", "setup", "workspace", "document"}:
|
|
91
|
+
return
|
|
92
|
+
ctx.obj = LazyContainer(workspace)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@app.command("version")
|
|
96
|
+
def version() -> None:
|
|
97
|
+
"""显示 CLI 版本。"""
|
|
98
|
+
typer.echo(__version__)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def render_command_tree(command: Any, name: str, prefix: str = "") -> list[str]:
|
|
102
|
+
lines = [prefix + name]
|
|
103
|
+
if not hasattr(command, "commands"):
|
|
104
|
+
return lines
|
|
105
|
+
children = list(command.commands.items())
|
|
106
|
+
for index, (child_name, child) in enumerate(children):
|
|
107
|
+
last = index == len(children) - 1
|
|
108
|
+
connector = "└── " if last else "├── "
|
|
109
|
+
child_prefix = prefix + (" " if last else "│ ")
|
|
110
|
+
child_lines = render_command_tree(child, child_name, child_prefix)
|
|
111
|
+
child_lines[0] = prefix + connector + child_name
|
|
112
|
+
lines.extend(child_lines)
|
|
113
|
+
return lines
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@app.command("tree")
|
|
117
|
+
def tree(ctx: typer.Context) -> None:
|
|
118
|
+
"""显示完整 CLI 命令树,便于人类和 Agent 渐进式发现能力。"""
|
|
119
|
+
typer.echo("\n".join(render_command_tree(ctx.find_root().command, "campfire")))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@app.command("setup")
|
|
123
|
+
def setup(
|
|
124
|
+
workspace: Path = typer.Option(..., "--workspace", help="要初始化的 Workspace 根目录"),
|
|
125
|
+
make_default: bool = typer.Option(False, "--default", help="设为默认 Workspace"),
|
|
126
|
+
) -> None:
|
|
127
|
+
"""从 .campfire.yaml 配置本机,或为已注册 Workspace 创建首份 Manifest。"""
|
|
128
|
+
try:
|
|
129
|
+
result = AppContainer.setup(workspace, make_default)
|
|
130
|
+
except AppError as exc:
|
|
131
|
+
typer.echo(json.dumps({"status": "error", "message": str(exc)}, ensure_ascii=False))
|
|
132
|
+
raise typer.Exit(exc.exit_code) from exc
|
|
133
|
+
typer.echo(json.dumps(result, ensure_ascii=False, indent=2))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Packaged Campfire resources."""
|
campfire_cli/resources/bases/Agent/346/211/247/350/241/214/345/267/245/344/275/234/345/217/260.base
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
filters:
|
|
2
|
+
and:
|
|
3
|
+
- 'file.ext == "md"'
|
|
4
|
+
- 'type == "task"'
|
|
5
|
+
- 'list(assignee).contains("agent")'
|
|
6
|
+
properties:
|
|
7
|
+
file.name: {displayName: 任务}
|
|
8
|
+
project: {displayName: 项目}
|
|
9
|
+
domain: {displayName: 领域}
|
|
10
|
+
lifecycle: {displayName: 状态}
|
|
11
|
+
priority: {displayName: 优先级}
|
|
12
|
+
assignee: {displayName: 执行者}
|
|
13
|
+
blocked_reason: {displayName: 阻塞原因}
|
|
14
|
+
requires_human: {displayName: 需要确认}
|
|
15
|
+
updated: {displayName: 更新时间}
|
|
16
|
+
views:
|
|
17
|
+
- type: table
|
|
18
|
+
name: Agent全部任务
|
|
19
|
+
order: [file.name, project, lifecycle, priority, assignee, requires_human, updated]
|
|
20
|
+
- type: table
|
|
21
|
+
name: 执行中
|
|
22
|
+
filters: 'lifecycle == "in-progress"'
|
|
23
|
+
order: [file.name, project, priority, assignee, updated]
|
|
24
|
+
- type: table
|
|
25
|
+
name: 当前阻塞
|
|
26
|
+
filters: 'lifecycle == "blocked"'
|
|
27
|
+
order: [file.name, project, priority, assignee, blocked_reason, updated]
|
|
28
|
+
- type: table
|
|
29
|
+
name: 等待验收
|
|
30
|
+
filters: 'lifecycle == "review"'
|
|
31
|
+
order: [file.name, project, priority, assignee, updated]
|
|
32
|
+
- type: table
|
|
33
|
+
name: 最近完成
|
|
34
|
+
filters: 'lifecycle == "completed" && completed >= today() - "30d"'
|
|
35
|
+
order: [file.name, project, assignee, completed, updated]
|
campfire_cli/resources/bases//344/273/273/345/212/241/345/267/245/344/275/234/345/217/260.base
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
filters:
|
|
2
|
+
and:
|
|
3
|
+
- 'file.ext == "md"'
|
|
4
|
+
- 'type == "task"'
|
|
5
|
+
properties:
|
|
6
|
+
file.name: {displayName: 任务}
|
|
7
|
+
project: {displayName: 项目}
|
|
8
|
+
domain: {displayName: 领域}
|
|
9
|
+
task_source: {displayName: 来源}
|
|
10
|
+
lifecycle: {displayName: 状态}
|
|
11
|
+
priority: {displayName: 优先级}
|
|
12
|
+
assignee: {displayName: 执行者}
|
|
13
|
+
requires_human: {displayName: 需要确认}
|
|
14
|
+
blocked_reason: {displayName: 阻塞原因}
|
|
15
|
+
due: {displayName: 截止日期}
|
|
16
|
+
updated: {displayName: 更新时间}
|
|
17
|
+
views:
|
|
18
|
+
- type: table
|
|
19
|
+
name: 全部任务
|
|
20
|
+
order: [file.name, project, lifecycle, domain, task_source, priority, assignee, requires_human, due, updated]
|
|
21
|
+
sort:
|
|
22
|
+
- property: lifecycle
|
|
23
|
+
direction: DESC
|
|
24
|
+
- type: table
|
|
25
|
+
name: 我的待确认
|
|
26
|
+
filters: 'requires_human == true && lifecycle != "completed" && lifecycle != "archived"'
|
|
27
|
+
order: [file.name, project, task_source, lifecycle, priority, blocked_reason, updated]
|
|
28
|
+
- type: table
|
|
29
|
+
name: 上级交办
|
|
30
|
+
filters: 'task_source == "assigned" && lifecycle != "completed" && lifecycle != "archived"'
|
|
31
|
+
groupBy: {property: project, direction: ASC}
|
|
32
|
+
order: [file.name, lifecycle, priority, assignee, due, updated]
|
|
33
|
+
- type: table
|
|
34
|
+
name: 个人任务
|
|
35
|
+
filters: 'task_source == "personal" && lifecycle != "completed" && lifecycle != "archived"'
|
|
36
|
+
groupBy: {property: project, direction: ASC}
|
|
37
|
+
order: [file.name, lifecycle, priority, assignee, due, updated]
|
|
38
|
+
- type: table
|
|
39
|
+
name: 当前阻塞
|
|
40
|
+
filters: 'lifecycle == "blocked"'
|
|
41
|
+
order: [file.name, project, task_source, priority, blocked_reason, updated]
|
|
42
|
+
- type: table
|
|
43
|
+
name: 等待验收
|
|
44
|
+
filters: 'lifecycle == "review"'
|
|
45
|
+
order: [file.name, project, task_source, assignee, updated]
|
|
46
|
+
- type: table
|
|
47
|
+
name: 最近完成
|
|
48
|
+
filters: 'lifecycle == "completed" && completed >= today() - "30d"'
|
|
49
|
+
order: [file.name, project, task_source, completed, updated]
|
campfire_cli/resources/bases//345/206/263/347/255/226/345/267/245/344/275/234/345/217/260.base
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
filters:
|
|
2
|
+
and:
|
|
3
|
+
- 'file.ext == "md"'
|
|
4
|
+
- 'file.path.startsWith("_协作/decisions/")'
|
|
5
|
+
- 'object_type == "decision"'
|
|
6
|
+
properties:
|
|
7
|
+
file.name: {displayName: 决策事项}
|
|
8
|
+
decision_status: {displayName: 状态}
|
|
9
|
+
source_type: {displayName: 来源}
|
|
10
|
+
answered_by: {displayName: 回答者}
|
|
11
|
+
created_at: {displayName: 创建时间}
|
|
12
|
+
updated_at: {displayName: 更新时间}
|
|
13
|
+
answered_at: {displayName: 回答时间}
|
|
14
|
+
closed_at: {displayName: 关闭时间}
|
|
15
|
+
views:
|
|
16
|
+
- type: table
|
|
17
|
+
name: 待我确认
|
|
18
|
+
filters: 'decision_status == "pending"'
|
|
19
|
+
order: [file.name, source_type, decision_status, created_at, updated_at]
|
|
20
|
+
sort:
|
|
21
|
+
- property: updated_at
|
|
22
|
+
direction: DESC
|
|
23
|
+
- type: table
|
|
24
|
+
name: 已回答待消费
|
|
25
|
+
filters: 'decision_status == "answered"'
|
|
26
|
+
order: [file.name, source_type, answered_by, answered_at, updated_at]
|
|
27
|
+
- type: table
|
|
28
|
+
name: 已关闭
|
|
29
|
+
filters: 'decision_status == "closed"'
|
|
30
|
+
order: [file.name, source_type, answered_by, closed_at]
|
|
31
|
+
- type: table
|
|
32
|
+
name: 已取消
|
|
33
|
+
filters: 'decision_status == "cancelled"'
|
|
34
|
+
order: [file.name, source_type, closed_at]
|
|
35
|
+
- type: table
|
|
36
|
+
name: 全部决策
|
|
37
|
+
order: [file.name, decision_status, source_type, answered_by, created_at, answered_at, closed_at]
|
|
38
|
+
sort:
|
|
39
|
+
- property: updated_at
|
|
40
|
+
direction: DESC
|
campfire_cli/resources/bases//345/276/205/345/275/222/346/241/243/346/226/207/346/241/243.base
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
filters:
|
|
2
|
+
and:
|
|
3
|
+
- 'file.ext == "md"'
|
|
4
|
+
- 'archive_requested == true'
|
|
5
|
+
properties:
|
|
6
|
+
file.name: {displayName: 文档}
|
|
7
|
+
project: {displayName: 项目}
|
|
8
|
+
domain: {displayName: 领域}
|
|
9
|
+
type: {displayName: 类型}
|
|
10
|
+
archive_reason: {displayName: 归档原因}
|
|
11
|
+
superseded_by: {displayName: 替代文档}
|
|
12
|
+
updated: {displayName: 更新时间}
|
|
13
|
+
views:
|
|
14
|
+
- type: table
|
|
15
|
+
name: 全部待归档
|
|
16
|
+
order: [file.name, project, domain, type, archive_reason, superseded_by, updated]
|
|
17
|
+
- type: table
|
|
18
|
+
name: 缺少归档原因
|
|
19
|
+
filters: archive_reason.isEmpty()
|
|
20
|
+
order: [file.name, project, domain, type, updated]
|
|
21
|
+
- type: table
|
|
22
|
+
name: 缺少替代文档
|
|
23
|
+
filters: '(archive_reason == "superseded" || archive_reason == "merged") && superseded_by.isEmpty()'
|
|
24
|
+
order: [file.name, project, domain, archive_reason, superseded_by, updated]
|
|
25
|
+
- type: table
|
|
26
|
+
name: 可执行候选
|
|
27
|
+
filters: '!archive_reason.isEmpty() && !((archive_reason == "superseded" || archive_reason == "merged") && superseded_by.isEmpty())'
|
|
28
|
+
order: [file.name, project, domain, type, archive_reason, superseded_by, updated]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
filters:
|
|
2
|
+
and:
|
|
3
|
+
- 'file.ext == "md"'
|
|
4
|
+
- '!project.isEmpty()'
|
|
5
|
+
- '!file.path.contains("/archive/")'
|
|
6
|
+
properties:
|
|
7
|
+
file.name: {displayName: 文档}
|
|
8
|
+
project: {displayName: 项目}
|
|
9
|
+
domain: {displayName: 领域}
|
|
10
|
+
type: {displayName: 类型}
|
|
11
|
+
status: {displayName: 状态}
|
|
12
|
+
lifecycle: {displayName: 生命周期}
|
|
13
|
+
updated: {displayName: 更新时间}
|
|
14
|
+
views:
|
|
15
|
+
- type: table
|
|
16
|
+
name: 全部项目文档
|
|
17
|
+
groupBy: {property: project, direction: ASC}
|
|
18
|
+
order: [file.name, project, domain, type, status, lifecycle, updated]
|
|
19
|
+
- type: table
|
|
20
|
+
name: 当前权威文档
|
|
21
|
+
filters: 'status == "current"'
|
|
22
|
+
groupBy: {property: project, direction: ASC}
|
|
23
|
+
order: [file.name, project, domain, type, lifecycle, updated]
|
|
24
|
+
- type: table
|
|
25
|
+
name: 草稿与提案
|
|
26
|
+
filters: 'status == "draft" || lifecycle == "proposed"'
|
|
27
|
+
order: [file.name, project, domain, type, status, lifecycle, updated]
|
|
28
|
+
- type: table
|
|
29
|
+
name: 进行中计划
|
|
30
|
+
filters: 'type == "plan" && lifecycle != "archived"'
|
|
31
|
+
order: [file.name, project, domain, status, lifecycle, updated]
|
|
32
|
+
- type: table
|
|
33
|
+
name: 未关闭问题
|
|
34
|
+
filters: 'type == "issue" && lifecycle != "archived"'
|
|
35
|
+
order: [file.name, project, domain, status, lifecycle, updated]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Packaged Campfire product defaults."""
|