skillreg 1.2.2__tar.gz → 1.2.5__tar.gz
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.
- {skillreg-1.2.2 → skillreg-1.2.5}/PKG-INFO +1 -1
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/App.vue +1 -1
- {skillreg-1.2.2 → skillreg-1.2.5}/pyproject.toml +1 -1
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/__init__.py +1 -1
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/builtin/skillreg-skill/SKILL.md +1 -1
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/cli.py +175 -152
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/hooks.py +2 -2
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/services/sync_manager.py +2 -4
- {skillreg-1.2.2 → skillreg-1.2.5}/.gitignore +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/LICENSE +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/README.md +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/.gitignore +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/index.html +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/package-lock.json +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/package.json +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/playwright.config.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/api/index.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/api/ssh.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/CommandPanel.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/ComponentPlayground.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/DependencyGraph.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/FilePreview.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/FileTree.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/GitLog.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/HookItem.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/HooksView.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/NavItem.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/ProjectManager.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QButton.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QCard.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QCheckbox.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QCheckboxGroup.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QDiffViewer.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QInput.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QLayout.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QModal.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QRadio.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QRadioGroup.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QTabs.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QThemeSwitch.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/QToast.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillCard.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillContextPanel.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillDetailDrawer.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillDetailModal.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillGrid.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillImportModal.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillSyncBadge.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillSyncManager.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SkillSyncStatus.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SshModeBanner.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/StatusBadge.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SubmoduleBadge.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/SubmoduleStatus.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/ThemeSwitch.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/ssh/RemoteSyncView.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/ssh/SshHostCard.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/ssh/SshHostFormModal.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/components/ssh/SshSyncPanel.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useCommands.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useContextPanel.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useData.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useEventBus.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useLayerStack.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useRemoteData.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useServerHealth.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useSkillDetail.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useSshHosts.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useSshMode.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useSyncBridge.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/composables/useToast.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/main.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/router/index.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/styles/global.css +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/styles/variables.css +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/src/views/SshView.vue +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/tests/e2e/dashboard.spec.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/dashboard/vite.config.js +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/builtin/skillreg-skill/references/install.md +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/builtin/skillreg-skill/references/troubleshooting.md +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/config.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/__init__.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/compat.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/files.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/git.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/health.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/import_.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/registry.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/skills.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/submodules.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/sync.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/server/workspace.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/services/__init__.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/services/file_browser.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/services/importer.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/services/self_skill.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/services/skill_registry.py +0 -0
- {skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/services/url_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: skillreg
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
4
4
|
Summary: skillreg — skill registry control plane (CLI + FastAPI backend)
|
|
5
5
|
Project-URL: Homepage, https://github.com/fcraft/skillreg
|
|
6
6
|
Project-URL: Repository, https://github.com/fcraft/skillreg
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
<span class="workspace-meta-label">当前 Workspace</span>
|
|
71
71
|
<code class="workspace-meta-value">{{ workspacePath || '未配置' }}</code>
|
|
72
72
|
</div>
|
|
73
|
-
<QInput v-model="workspaceDraft" label="Workspace 路径" placeholder="例如: ~/
|
|
73
|
+
<QInput v-model="workspaceDraft" label="Workspace 路径" placeholder="例如: ~/skills-workspace" />
|
|
74
74
|
<div v-if="workspaceError" class="workspace-error">{{ workspaceError }}</div>
|
|
75
75
|
</div>
|
|
76
76
|
<template #footer>
|
|
@@ -26,10 +26,35 @@ DEFAULT_HOST = "127.0.0.1"
|
|
|
26
26
|
DEFAULT_PORT = 8787
|
|
27
27
|
DASHBOARD_PID_FILE = Path.home() / ".skillreg" / "dashboard.pid"
|
|
28
28
|
DASHBOARD_LOG_FILE = Path.home() / ".skillreg" / "dashboard.log"
|
|
29
|
-
CONTEXT_SETTINGS = {
|
|
29
|
+
CONTEXT_SETTINGS = {
|
|
30
|
+
"help_option_names": ["-h", "--help"],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ChineseHelpMixin:
|
|
35
|
+
@staticmethod
|
|
36
|
+
def _show_help(ctx: click.Context, _param: click.Parameter, value: bool) -> None:
|
|
37
|
+
if value and not ctx.resilient_parsing:
|
|
38
|
+
click.echo(ctx.get_help(), color=ctx.color)
|
|
39
|
+
ctx.exit()
|
|
40
|
+
|
|
41
|
+
def get_help_option(self, ctx: click.Context) -> click.Option | None:
|
|
42
|
+
help_options = self.get_help_option_names(ctx)
|
|
43
|
+
if not help_options or not self.add_help_option:
|
|
44
|
+
return None
|
|
45
|
+
if self._help_option is None:
|
|
46
|
+
self._help_option = click.Option(
|
|
47
|
+
help_options,
|
|
48
|
+
is_flag=True,
|
|
49
|
+
expose_value=False,
|
|
50
|
+
is_eager=True,
|
|
51
|
+
help="显示帮助信息并退出。",
|
|
52
|
+
callback=self._show_help,
|
|
53
|
+
)
|
|
54
|
+
return self._help_option
|
|
30
55
|
|
|
31
56
|
|
|
32
|
-
class SkillregCommand(click.Command):
|
|
57
|
+
class SkillregCommand(ChineseHelpMixin, click.Command):
|
|
33
58
|
"""Click command that supports both -h and --help."""
|
|
34
59
|
|
|
35
60
|
def __init__(self, *args, **kwargs):
|
|
@@ -37,7 +62,7 @@ class SkillregCommand(click.Command):
|
|
|
37
62
|
super().__init__(*args, **kwargs)
|
|
38
63
|
|
|
39
64
|
|
|
40
|
-
class SkillregGroup(click.Group):
|
|
65
|
+
class SkillregGroup(ChineseHelpMixin, click.Group):
|
|
41
66
|
"""Click group that creates skillreg commands by default."""
|
|
42
67
|
|
|
43
68
|
command_class = SkillregCommand
|
|
@@ -54,89 +79,87 @@ def _format_csv(values: Sequence[str]) -> str:
|
|
|
54
79
|
return ", ".join(values) if values else "(none)"
|
|
55
80
|
|
|
56
81
|
|
|
57
|
-
def _echo_workspace_summary(*, heading: str = "skillreg
|
|
82
|
+
def _echo_workspace_summary(*, heading: str = "skillreg 上下文") -> None:
|
|
58
83
|
"""Print the current workspace context after user-facing commands."""
|
|
59
84
|
cfg = load_config()
|
|
60
85
|
click.echo(heading)
|
|
61
|
-
click.echo(f"
|
|
62
|
-
click.echo(f"
|
|
63
|
-
click.echo(f"
|
|
86
|
+
click.echo(f" 配置文件 : {CONFIG_FILE}")
|
|
87
|
+
click.echo(f" 当前 workspace : {cfg.workspace_path or '(未配置)'}")
|
|
88
|
+
click.echo(f" 同步目标 : {_format_csv(cfg.targets)}")
|
|
64
89
|
|
|
65
90
|
|
|
66
91
|
@click.group(cls=SkillregGroup)
|
|
67
|
-
@click.version_option(version=__version__, package_name="skillreg")
|
|
92
|
+
@click.version_option(version=__version__, package_name="skillreg", help="显示版本信息并退出。")
|
|
68
93
|
def cli() -> None:
|
|
69
|
-
"""skillreg —
|
|
94
|
+
"""skillreg — 本地 AI Agent Skill 管理工具。"""
|
|
70
95
|
|
|
71
96
|
|
|
72
97
|
@cli.command()
|
|
73
98
|
def config() -> None:
|
|
74
|
-
"""
|
|
99
|
+
"""查看 skillreg 配置状态。
|
|
75
100
|
|
|
76
|
-
|
|
77
|
-
on first run.
|
|
101
|
+
首次运行会自动创建默认的 ``~/.skillreg/config.json``。
|
|
78
102
|
"""
|
|
79
103
|
cfg = load_config()
|
|
80
|
-
click.echo("skillreg
|
|
81
|
-
click.echo(f"
|
|
82
|
-
click.echo(f" workspace
|
|
104
|
+
click.echo("skillreg 配置")
|
|
105
|
+
click.echo(f" 配置文件 : {CONFIG_FILE}")
|
|
106
|
+
click.echo(f" workspace : {cfg.workspace_path or '(未配置)'}")
|
|
83
107
|
click.echo(
|
|
84
|
-
f"
|
|
108
|
+
f" 同步目标 : "
|
|
85
109
|
f"{', '.join(cfg.targets) if cfg.targets else '(none)'}"
|
|
86
110
|
)
|
|
87
111
|
click.echo(
|
|
88
|
-
f" agents
|
|
112
|
+
f" agents : "
|
|
89
113
|
f"{', '.join(cfg.agents.keys()) if cfg.agents else '(none)'}"
|
|
90
114
|
)
|
|
91
115
|
|
|
92
116
|
|
|
93
117
|
@cli.group()
|
|
94
118
|
def dashboard() -> None:
|
|
95
|
-
"""
|
|
119
|
+
"""管理 skillreg dashboard。"""
|
|
96
120
|
|
|
97
121
|
|
|
98
122
|
@cli.group()
|
|
99
123
|
def workspace() -> None:
|
|
100
|
-
"""
|
|
124
|
+
"""管理 skillreg workspace。"""
|
|
101
125
|
|
|
102
126
|
|
|
103
127
|
@cli.group()
|
|
104
128
|
def target() -> None:
|
|
105
|
-
"""
|
|
129
|
+
"""管理同步目标。"""
|
|
106
130
|
|
|
107
131
|
|
|
108
132
|
@cli.group()
|
|
109
133
|
def sync() -> None:
|
|
110
|
-
"""
|
|
134
|
+
"""查看并执行 workspace 同步。"""
|
|
111
135
|
|
|
112
136
|
|
|
113
137
|
@cli.group()
|
|
114
138
|
def project() -> None:
|
|
115
|
-
"""
|
|
139
|
+
"""管理项目同步组。"""
|
|
116
140
|
|
|
117
141
|
|
|
118
142
|
@cli.group()
|
|
119
143
|
def submodule() -> None:
|
|
120
|
-
"""
|
|
144
|
+
"""查看 workspace 子模块。"""
|
|
121
145
|
|
|
122
146
|
|
|
123
147
|
@workspace.command("create")
|
|
124
148
|
@click.argument("location", type=click.Path())
|
|
125
149
|
def create_workspace(location: str) -> None:
|
|
126
|
-
"""
|
|
150
|
+
"""在 LOCATION 创建新的 workspace。
|
|
127
151
|
|
|
128
|
-
|
|
129
|
-
writes .gitignore and README, and updates the config pointer.
|
|
152
|
+
会初始化 git 仓库,创建 skills/ 与 repos/ 目录,并更新配置指针。
|
|
130
153
|
"""
|
|
131
154
|
from .services.importer import create_workspace as _create
|
|
132
155
|
|
|
133
156
|
try:
|
|
134
157
|
result = _create(location)
|
|
135
|
-
click.echo(f"✓
|
|
158
|
+
click.echo(f"✓ 已创建 workspace: {result['workspace_path']}")
|
|
136
159
|
click.echo(f" git init : {'✓' if result['has_git'] else '✗'}")
|
|
137
160
|
click.echo(f" skills/ : {'✓' if result['has_skills_dir'] else '✗'}")
|
|
138
161
|
click.echo(f" repos/ : {'✓' if result['has_repos_dir'] else '✗'}")
|
|
139
|
-
_echo_workspace_summary(heading="
|
|
162
|
+
_echo_workspace_summary(heading="创建 workspace 后的 skillreg 上下文")
|
|
140
163
|
except ValueError as e:
|
|
141
164
|
click.echo(f"✗ {e}", err=True)
|
|
142
165
|
raise SystemExit(1)
|
|
@@ -144,148 +167,148 @@ def create_workspace(location: str) -> None:
|
|
|
144
167
|
|
|
145
168
|
@workspace.command("current")
|
|
146
169
|
def current_workspace() -> None:
|
|
147
|
-
"""
|
|
148
|
-
_echo_workspace_summary(heading="skillreg
|
|
170
|
+
"""查看当前 workspace 指针。"""
|
|
171
|
+
_echo_workspace_summary(heading="当前 skillreg workspace")
|
|
149
172
|
|
|
150
173
|
|
|
151
174
|
@workspace.command("switch")
|
|
152
175
|
@click.argument("location", type=click.Path(exists=True, file_okay=False))
|
|
153
176
|
def switch_workspace(location: str) -> None:
|
|
154
|
-
"""
|
|
177
|
+
"""切换到已有 workspace。"""
|
|
155
178
|
path = Path(location).expanduser().resolve()
|
|
156
179
|
if not (path / "skills").is_dir():
|
|
157
|
-
click.echo(f"✗
|
|
180
|
+
click.echo(f"✗ workspace 必须包含 skills/ 目录: {path}", err=True)
|
|
158
181
|
raise SystemExit(1)
|
|
159
182
|
cfg = load_config()
|
|
160
183
|
cfg.workspace_path = str(path)
|
|
161
184
|
save_config(cfg)
|
|
162
|
-
click.echo(f"✓
|
|
163
|
-
_echo_workspace_summary(heading="
|
|
185
|
+
click.echo(f"✓ 已切换 workspace: {path}")
|
|
186
|
+
_echo_workspace_summary(heading="切换 workspace 后的 skillreg 上下文")
|
|
164
187
|
|
|
165
188
|
|
|
166
189
|
@cli.command("register")
|
|
167
190
|
@click.argument("source_path", type=click.Path(exists=True, file_okay=False))
|
|
168
|
-
@click.option("--force", is_flag=True, default=False, help="
|
|
169
|
-
@click.option("--name", "rename_to", help="
|
|
191
|
+
@click.option("--force", is_flag=True, default=False, help="覆盖同名 skill。")
|
|
192
|
+
@click.option("--name", "rename_to", help="使用指定名称注册 skill。")
|
|
170
193
|
def register_skill(source_path: str, force: bool, rename_to: str | None) -> None:
|
|
171
|
-
"""
|
|
194
|
+
"""把本地 skill 目录注册到当前 workspace。"""
|
|
172
195
|
from .services.importer import import_skill
|
|
173
196
|
|
|
174
197
|
try:
|
|
175
198
|
result = import_skill(source_path, rename_to=rename_to, force=force)
|
|
176
199
|
except (FileNotFoundError, ValueError) as e:
|
|
177
|
-
click.echo(f"✗
|
|
178
|
-
_echo_workspace_summary(heading="skillreg
|
|
200
|
+
click.echo(f"✗ 注册失败: {e}", err=True)
|
|
201
|
+
_echo_workspace_summary(heading="注册失败时的 skillreg 上下文")
|
|
179
202
|
raise SystemExit(1)
|
|
180
|
-
click.echo(f"✓
|
|
181
|
-
click.echo(f"
|
|
182
|
-
click.echo(f" skill
|
|
183
|
-
click.echo(f"
|
|
203
|
+
click.echo(f"✓ 已注册 skill: {result['name']}")
|
|
204
|
+
click.echo(f" 来源 : {Path(source_path).expanduser().resolve()}")
|
|
205
|
+
click.echo(f" skill 路径 : {result['skillPath']}")
|
|
206
|
+
click.echo(f" 文件数 : {result['filesCopied']}")
|
|
184
207
|
click.echo(f" commit : {result.get('commit') or '(none)'}")
|
|
185
|
-
_echo_workspace_summary(heading="skillreg
|
|
208
|
+
_echo_workspace_summary(heading="注册后的 skillreg 上下文")
|
|
186
209
|
|
|
187
210
|
|
|
188
211
|
@cli.command("list")
|
|
189
212
|
def list_skills() -> None:
|
|
190
|
-
"""
|
|
213
|
+
"""列出当前 workspace 中的 skills。"""
|
|
191
214
|
from .services.skill_registry import get_all
|
|
192
215
|
|
|
193
216
|
cfg = load_config()
|
|
194
217
|
if not cfg.workspace_path:
|
|
195
|
-
click.echo("✗
|
|
196
|
-
_echo_workspace_summary(heading="skillreg
|
|
218
|
+
click.echo("✗ workspace 未配置", err=True)
|
|
219
|
+
_echo_workspace_summary(heading="列出失败时的 skillreg 上下文")
|
|
197
220
|
raise SystemExit(1)
|
|
198
221
|
workspace_path = Path(cfg.workspace_path).expanduser().resolve()
|
|
199
222
|
try:
|
|
200
223
|
data = get_all(workspace_path)
|
|
201
224
|
except Exception as e:
|
|
202
|
-
click.echo(f"✗
|
|
225
|
+
click.echo(f"✗ 列出失败: {e}", err=True)
|
|
203
226
|
raise SystemExit(1)
|
|
204
227
|
skills = data.get("skills", [])
|
|
205
228
|
if not skills:
|
|
206
229
|
click.echo("(no skills found)")
|
|
207
230
|
else:
|
|
208
|
-
click.echo(f"{'
|
|
231
|
+
click.echo(f"{'名称':<30} {'类型':<10} 路径")
|
|
209
232
|
click.echo("-" * 72)
|
|
210
233
|
for item in skills:
|
|
211
234
|
click.echo(f"{item['name']:<30} {item['type']:<10} {item['path']}")
|
|
212
|
-
click.echo(f"\
|
|
213
|
-
_echo_workspace_summary(heading="skillreg
|
|
235
|
+
click.echo(f"\n总计: {len(skills)} 个 skill")
|
|
236
|
+
_echo_workspace_summary(heading="列出后的 skillreg 上下文")
|
|
214
237
|
|
|
215
238
|
|
|
216
239
|
@cli.command("convert")
|
|
217
240
|
@click.argument("name")
|
|
218
241
|
def convert_skill(name: str) -> None:
|
|
219
|
-
"""
|
|
242
|
+
"""把 skills/NAME 转换为 repos/NAME-cli/skill/NAME。"""
|
|
220
243
|
from .services.importer import convert_skill as _convert
|
|
221
244
|
|
|
222
245
|
try:
|
|
223
246
|
result = _convert(name)
|
|
224
247
|
except (FileNotFoundError, FileExistsError, ValueError) as e:
|
|
225
|
-
click.echo(f"✗
|
|
226
|
-
_echo_workspace_summary(heading="skillreg
|
|
248
|
+
click.echo(f"✗ 转换失败: {e}", err=True)
|
|
249
|
+
_echo_workspace_summary(heading="转换失败时的 skillreg 上下文")
|
|
227
250
|
raise SystemExit(1)
|
|
228
|
-
click.echo(f"✓
|
|
229
|
-
click.echo(f" repo
|
|
230
|
-
click.echo(f" skill
|
|
231
|
-
_echo_workspace_summary(heading="skillreg
|
|
251
|
+
click.echo(f"✓ 已转换 skill: {result['name']}")
|
|
252
|
+
click.echo(f" repo 路径 : {result['repoPath']}")
|
|
253
|
+
click.echo(f" skill 路径 : {result['skillPath']}")
|
|
254
|
+
_echo_workspace_summary(heading="转换后的 skillreg 上下文")
|
|
232
255
|
|
|
233
256
|
|
|
234
257
|
@target.command("list")
|
|
235
258
|
def list_targets() -> None:
|
|
236
|
-
"""
|
|
259
|
+
"""列出已配置的同步目标。"""
|
|
237
260
|
from .services.sync_manager import get_targets
|
|
238
261
|
|
|
239
262
|
targets = get_targets()
|
|
240
263
|
if not targets:
|
|
241
264
|
click.echo("(no targets configured)")
|
|
242
265
|
else:
|
|
243
|
-
click.echo(f"{'
|
|
266
|
+
click.echo(f"{'名称':<20} 路径")
|
|
244
267
|
click.echo("-" * 72)
|
|
245
268
|
for item in targets:
|
|
246
269
|
click.echo(f"{item['name']:<20} {item['path']}")
|
|
247
|
-
_echo_workspace_summary(heading="skillreg
|
|
270
|
+
_echo_workspace_summary(heading="列出同步目标后的 skillreg 上下文")
|
|
248
271
|
|
|
249
272
|
|
|
250
273
|
@target.command("add")
|
|
251
274
|
@click.argument("path", type=click.Path())
|
|
252
|
-
@click.option("--name", help="
|
|
275
|
+
@click.option("--name", help="同步目标的显示名称。")
|
|
253
276
|
def add_target(path: str, name: str | None) -> None:
|
|
254
|
-
"""
|
|
277
|
+
"""添加同步目标 PATH。"""
|
|
255
278
|
from .services.sync_manager import add_target as _add
|
|
256
279
|
|
|
257
280
|
resolved = str(Path(path).expanduser())
|
|
258
281
|
try:
|
|
259
282
|
result = _add(name or _target_display_label(resolved), resolved)
|
|
260
283
|
except ValueError as e:
|
|
261
|
-
click.echo(f"✗
|
|
284
|
+
click.echo(f"✗ 添加同步目标失败: {e}", err=True)
|
|
262
285
|
raise SystemExit(1)
|
|
263
|
-
click.echo(f"✓
|
|
264
|
-
click.echo(f"
|
|
265
|
-
_echo_workspace_summary(heading="skillreg
|
|
286
|
+
click.echo(f"✓ 已添加同步目标: {result['name']}")
|
|
287
|
+
click.echo(f" 路径 : {result['path']}")
|
|
288
|
+
_echo_workspace_summary(heading="添加同步目标后的 skillreg 上下文")
|
|
266
289
|
|
|
267
290
|
|
|
268
291
|
@target.command("remove")
|
|
269
292
|
@click.argument("path")
|
|
270
293
|
def remove_target(path: str) -> None:
|
|
271
|
-
"""
|
|
294
|
+
"""按路径移除同步目标。"""
|
|
272
295
|
from .services.sync_manager import remove_target as _remove
|
|
273
296
|
|
|
274
297
|
resolved = str(Path(path).expanduser())
|
|
275
298
|
try:
|
|
276
299
|
_remove(resolved)
|
|
277
300
|
except ValueError as e:
|
|
278
|
-
click.echo(f"✗
|
|
301
|
+
click.echo(f"✗ 移除同步目标失败: {e}", err=True)
|
|
279
302
|
raise SystemExit(1)
|
|
280
|
-
click.echo(f"✓
|
|
281
|
-
_echo_workspace_summary(heading="skillreg
|
|
303
|
+
click.echo(f"✓ 已移除同步目标: {resolved}")
|
|
304
|
+
_echo_workspace_summary(heading="移除同步目标后的 skillreg 上下文")
|
|
282
305
|
|
|
283
306
|
|
|
284
307
|
@target.command("rename")
|
|
285
308
|
@click.argument("old_path")
|
|
286
309
|
@click.argument("new_path")
|
|
287
310
|
def rename_target(old_path: str, new_path: str) -> None:
|
|
288
|
-
"""
|
|
311
|
+
"""把已有同步目标路径替换为 NEW_PATH。"""
|
|
289
312
|
from .services.sync_manager import rename_target as _rename
|
|
290
313
|
|
|
291
314
|
old_resolved = str(Path(old_path).expanduser())
|
|
@@ -293,19 +316,19 @@ def rename_target(old_path: str, new_path: str) -> None:
|
|
|
293
316
|
try:
|
|
294
317
|
result = _rename(old_resolved, new_resolved)
|
|
295
318
|
except ValueError as e:
|
|
296
|
-
click.echo(f"✗
|
|
319
|
+
click.echo(f"✗ 重命名同步目标失败: {e}", err=True)
|
|
297
320
|
raise SystemExit(1)
|
|
298
|
-
click.echo("✓
|
|
299
|
-
click.echo(f"
|
|
300
|
-
_echo_workspace_summary(heading="skillreg
|
|
321
|
+
click.echo("✓ 已重命名同步目标")
|
|
322
|
+
click.echo(f" 路径 : {result['path']}")
|
|
323
|
+
_echo_workspace_summary(heading="重命名同步目标后的 skillreg 上下文")
|
|
301
324
|
|
|
302
325
|
|
|
303
326
|
@sync.command("status")
|
|
304
|
-
@click.option("--target", "target_path", help="
|
|
305
|
-
@click.option("--skill", "skill_name", help="
|
|
306
|
-
@click.option("--include-projects", is_flag=True, default=False, help="
|
|
327
|
+
@click.option("--target", "target_path", help="只查看一个同步目标。")
|
|
328
|
+
@click.option("--skill", "skill_name", help="只查看一个 skill。")
|
|
329
|
+
@click.option("--include-projects", is_flag=True, default=False, help="包含项目组同步目标。")
|
|
307
330
|
def sync_status(target_path: str | None, skill_name: str | None, include_projects: bool) -> None:
|
|
308
|
-
"""
|
|
331
|
+
"""查看各同步目标中的 skill 同步状态。"""
|
|
309
332
|
from .services.sync_manager import get_sync_status
|
|
310
333
|
|
|
311
334
|
rows = get_sync_status(
|
|
@@ -316,7 +339,7 @@ def sync_status(target_path: str | None, skill_name: str | None, include_project
|
|
|
316
339
|
if not rows:
|
|
317
340
|
click.echo("(no sync status rows)")
|
|
318
341
|
else:
|
|
319
|
-
click.echo(f"{'
|
|
342
|
+
click.echo(f"{'同步目标':<34} {'SKILL':<30} 状态")
|
|
320
343
|
click.echo("-" * 82)
|
|
321
344
|
for row in rows:
|
|
322
345
|
project_name = row.get("_project")
|
|
@@ -324,22 +347,22 @@ def sync_status(target_path: str | None, skill_name: str | None, include_project
|
|
|
324
347
|
if project_name:
|
|
325
348
|
target_label = f"{project_name}:{target_label}"
|
|
326
349
|
click.echo(f"{target_label:<34} {row['name']:<30} {row['status']}")
|
|
327
|
-
click.echo(f"\
|
|
328
|
-
_echo_workspace_summary(heading="skillreg
|
|
350
|
+
click.echo(f"\n总计: {len(rows)} 条状态")
|
|
351
|
+
_echo_workspace_summary(heading="查看同步状态后的 skillreg 上下文")
|
|
329
352
|
|
|
330
353
|
|
|
331
354
|
@sync.command("execute")
|
|
332
|
-
@click.option("--target", "target_path", help="
|
|
333
|
-
@click.option("--project", "project_id", help="
|
|
334
|
-
@click.option("--skill", "skill_names", multiple=True, help="
|
|
335
|
-
@click.option("--dry-run", is_flag=True, default=False, help="
|
|
355
|
+
@click.option("--target", "target_path", help="要同步到的目标目录。")
|
|
356
|
+
@click.option("--project", "project_id", help="要同步的项目组 ID 或名称。")
|
|
357
|
+
@click.option("--skill", "skill_names", multiple=True, help="要同步的 skill 名称,可重复传入。")
|
|
358
|
+
@click.option("--dry-run", is_flag=True, default=False, help="只预览,不复制文件。")
|
|
336
359
|
def sync_execute(
|
|
337
360
|
target_path: str | None,
|
|
338
361
|
project_id: str | None,
|
|
339
362
|
skill_names: tuple[str, ...],
|
|
340
363
|
dry_run: bool,
|
|
341
364
|
) -> None:
|
|
342
|
-
"""
|
|
365
|
+
"""执行同步到目标目录或项目组。"""
|
|
343
366
|
from .services import sync_manager
|
|
344
367
|
|
|
345
368
|
skills = list(skill_names) or None
|
|
@@ -348,69 +371,69 @@ def sync_execute(
|
|
|
348
371
|
if project_id:
|
|
349
372
|
project_entry = sync_manager.get_project(project_id)
|
|
350
373
|
if not project_entry:
|
|
351
|
-
raise ValueError(f"
|
|
374
|
+
raise ValueError(f"项目组不存在: {project_id}")
|
|
352
375
|
for target_item in project_entry.get("targets", []):
|
|
353
376
|
result = sync_manager.execute_sync(
|
|
354
377
|
target_item, dry_run=dry_run, skills=skills,
|
|
355
378
|
)
|
|
356
379
|
results.append({"target": target_item, **result})
|
|
357
|
-
click.echo(f"✓
|
|
380
|
+
click.echo(f"✓ 已同步项目组: {project_entry['name']}")
|
|
358
381
|
else:
|
|
359
382
|
if not target_path:
|
|
360
|
-
raise ValueError("
|
|
383
|
+
raise ValueError("缺少 --target 或 --project")
|
|
361
384
|
result = sync_manager.execute_sync(
|
|
362
385
|
target_path, dry_run=dry_run, skills=skills,
|
|
363
386
|
)
|
|
364
387
|
results.append({"target": target_path, **result})
|
|
365
|
-
click.echo(f"✓
|
|
388
|
+
click.echo(f"✓ 同步{'预览' if dry_run else '完成'}")
|
|
366
389
|
except (FileNotFoundError, ValueError) as e:
|
|
367
|
-
click.echo(f"✗
|
|
368
|
-
_echo_workspace_summary(heading="skillreg
|
|
390
|
+
click.echo(f"✗ 同步失败: {e}", err=True)
|
|
391
|
+
_echo_workspace_summary(heading="同步失败时的 skillreg 上下文")
|
|
369
392
|
raise SystemExit(1)
|
|
370
393
|
|
|
371
394
|
failed = False
|
|
372
395
|
for result in results:
|
|
373
|
-
click.echo(f"
|
|
396
|
+
click.echo(f" 同步目标 : {result['target']}")
|
|
374
397
|
if result.get("stdout"):
|
|
375
398
|
for line in str(result["stdout"]).splitlines():
|
|
376
399
|
click.echo(f" {line}")
|
|
377
400
|
if result.get("stderr"):
|
|
378
401
|
failed = True
|
|
379
402
|
for line in str(result["stderr"]).splitlines():
|
|
380
|
-
click.echo(f"
|
|
403
|
+
click.echo(f" 错误: {line}", err=True)
|
|
381
404
|
if not result.get("success", False):
|
|
382
405
|
failed = True
|
|
383
|
-
_echo_workspace_summary(heading="skillreg
|
|
406
|
+
_echo_workspace_summary(heading="执行同步后的 skillreg 上下文")
|
|
384
407
|
if failed:
|
|
385
408
|
raise SystemExit(1)
|
|
386
409
|
|
|
387
410
|
|
|
388
411
|
@cli.command("diff")
|
|
389
412
|
@click.argument("skill")
|
|
390
|
-
@click.option("--target", "target_path", required=True, help="
|
|
413
|
+
@click.option("--target", "target_path", required=True, help="要比较的目标目录。")
|
|
391
414
|
def diff_skill(skill: str, target_path: str) -> None:
|
|
392
|
-
"""
|
|
415
|
+
"""比较 workspace skill 与目标目录中的副本。"""
|
|
393
416
|
from .services.sync_manager import get_skill_diff
|
|
394
417
|
|
|
395
418
|
try:
|
|
396
419
|
rows = get_skill_diff(skill, target_path)
|
|
397
420
|
except ValueError as e:
|
|
398
|
-
click.echo(f"✗
|
|
421
|
+
click.echo(f"✗ 比较失败: {e}", err=True)
|
|
399
422
|
raise SystemExit(1)
|
|
400
423
|
if not rows:
|
|
401
424
|
click.echo("(no files)")
|
|
402
425
|
else:
|
|
403
|
-
click.echo(f"{'
|
|
426
|
+
click.echo(f"{'状态':<12} 路径")
|
|
404
427
|
click.echo("-" * 72)
|
|
405
428
|
for row in rows:
|
|
406
429
|
click.echo(f"{row['status']:<12} {row['path']}")
|
|
407
|
-
click.echo(f"\
|
|
408
|
-
_echo_workspace_summary(heading="skillreg
|
|
430
|
+
click.echo(f"\n总计: {len(rows)} 个文件")
|
|
431
|
+
_echo_workspace_summary(heading="比较后的 skillreg 上下文")
|
|
409
432
|
|
|
410
433
|
|
|
411
434
|
@project.command("list")
|
|
412
435
|
def list_projects() -> None:
|
|
413
|
-
"""
|
|
436
|
+
"""列出项目同步组。"""
|
|
414
437
|
from .services.sync_manager import list_projects as _list
|
|
415
438
|
|
|
416
439
|
projects = _list()
|
|
@@ -421,37 +444,37 @@ def list_projects() -> None:
|
|
|
421
444
|
click.echo(f"{item['name']} ({item['id']})")
|
|
422
445
|
for target_path in item.get("targets", []):
|
|
423
446
|
click.echo(f" - {target_path}")
|
|
424
|
-
_echo_workspace_summary(heading="skillreg
|
|
447
|
+
_echo_workspace_summary(heading="列出项目组后的 skillreg 上下文")
|
|
425
448
|
|
|
426
449
|
|
|
427
450
|
@project.command("create")
|
|
428
|
-
@click.option("--name", required=True, help="
|
|
429
|
-
@click.option("--target", "targets", multiple=True, required=True, help="
|
|
451
|
+
@click.option("--name", required=True, help="项目组名称。")
|
|
452
|
+
@click.option("--target", "targets", multiple=True, required=True, help="同步目标路径,可重复传入。")
|
|
430
453
|
def create_project(name: str, targets: tuple[str, ...]) -> None:
|
|
431
|
-
"""
|
|
454
|
+
"""创建项目同步组。"""
|
|
432
455
|
from .services.sync_manager import create_project as _create
|
|
433
456
|
|
|
434
457
|
result = _create(name, [str(Path(t).expanduser()) for t in targets])
|
|
435
|
-
click.echo(f"✓
|
|
458
|
+
click.echo(f"✓ 已创建项目组: {result['name']}")
|
|
436
459
|
click.echo(f" id : {result['id']}")
|
|
437
|
-
click.echo(f"
|
|
438
|
-
_echo_workspace_summary(heading="skillreg
|
|
460
|
+
click.echo(f" 同步目标数 : {len(result.get('targets', []))}")
|
|
461
|
+
_echo_workspace_summary(heading="创建项目组后的 skillreg 上下文")
|
|
439
462
|
|
|
440
463
|
|
|
441
464
|
@project.command("info")
|
|
442
465
|
@click.argument("project_id")
|
|
443
466
|
def project_info(project_id: str) -> None:
|
|
444
|
-
"""
|
|
467
|
+
"""查看项目同步组详情。"""
|
|
445
468
|
from .services.sync_manager import get_project
|
|
446
469
|
|
|
447
470
|
result = get_project(project_id)
|
|
448
471
|
if not result:
|
|
449
|
-
click.echo(f"✗
|
|
472
|
+
click.echo(f"✗ 项目组不存在: {project_id}", err=True)
|
|
450
473
|
raise SystemExit(1)
|
|
451
474
|
click.echo(f"name : {result['name']}")
|
|
452
475
|
click.echo(f"id : {result['id']}")
|
|
453
476
|
click.echo(f"created : {result.get('created_at', '(unknown)')}")
|
|
454
|
-
click.echo("
|
|
477
|
+
click.echo("同步目标 :")
|
|
455
478
|
for target_path in result.get("targets", []):
|
|
456
479
|
click.echo(f" - {target_path}")
|
|
457
480
|
|
|
@@ -460,61 +483,61 @@ def project_info(project_id: str) -> None:
|
|
|
460
483
|
@click.argument("project_id")
|
|
461
484
|
@click.argument("path", type=click.Path())
|
|
462
485
|
def project_add_target(project_id: str, path: str) -> None:
|
|
463
|
-
"""
|
|
486
|
+
"""为项目同步组添加目标。"""
|
|
464
487
|
from .services.sync_manager import add_project_target
|
|
465
488
|
|
|
466
489
|
try:
|
|
467
490
|
result = add_project_target(project_id, str(Path(path).expanduser()))
|
|
468
491
|
except ValueError as e:
|
|
469
|
-
click.echo(f"✗
|
|
492
|
+
click.echo(f"✗ 添加项目组目标失败: {e}", err=True)
|
|
470
493
|
raise SystemExit(1)
|
|
471
|
-
click.echo(f"✓
|
|
494
|
+
click.echo(f"✓ 已添加目标到项目组: {result['name']}")
|
|
472
495
|
|
|
473
496
|
|
|
474
497
|
@project.command("remove-target")
|
|
475
498
|
@click.argument("project_id")
|
|
476
499
|
@click.argument("path", type=click.Path())
|
|
477
500
|
def project_remove_target(project_id: str, path: str) -> None:
|
|
478
|
-
"""
|
|
501
|
+
"""从项目同步组移除目标。"""
|
|
479
502
|
from .services.sync_manager import remove_project_target
|
|
480
503
|
|
|
481
504
|
try:
|
|
482
505
|
result = remove_project_target(project_id, str(Path(path).expanduser()))
|
|
483
506
|
except ValueError as e:
|
|
484
|
-
click.echo(f"✗
|
|
507
|
+
click.echo(f"✗ 移除项目组目标失败: {e}", err=True)
|
|
485
508
|
raise SystemExit(1)
|
|
486
|
-
click.echo(f"✓
|
|
509
|
+
click.echo(f"✓ 已从项目组移除目标: {result['name']}")
|
|
487
510
|
|
|
488
511
|
|
|
489
512
|
@project.command("delete")
|
|
490
513
|
@click.argument("project_id")
|
|
491
514
|
def project_delete(project_id: str) -> None:
|
|
492
|
-
"""
|
|
515
|
+
"""删除项目同步组。"""
|
|
493
516
|
from .services.sync_manager import delete_project
|
|
494
517
|
|
|
495
518
|
try:
|
|
496
519
|
delete_project(project_id)
|
|
497
520
|
except ValueError as e:
|
|
498
|
-
click.echo(f"✗
|
|
521
|
+
click.echo(f"✗ 删除项目组失败: {e}", err=True)
|
|
499
522
|
raise SystemExit(1)
|
|
500
|
-
click.echo(f"✓
|
|
523
|
+
click.echo(f"✓ 已删除项目组: {project_id}")
|
|
501
524
|
|
|
502
525
|
|
|
503
526
|
@submodule.command("list")
|
|
504
527
|
def list_submodules() -> None:
|
|
505
|
-
"""
|
|
528
|
+
"""列出 workspace 子模块。"""
|
|
506
529
|
from .services.skill_registry import get_submodule_status, read_submodule_configs
|
|
507
530
|
|
|
508
531
|
cfg = load_config()
|
|
509
532
|
if not cfg.workspace_path:
|
|
510
|
-
click.echo("✗
|
|
533
|
+
click.echo("✗ workspace 未配置", err=True)
|
|
511
534
|
raise SystemExit(1)
|
|
512
535
|
workspace_path = Path(cfg.workspace_path).expanduser().resolve()
|
|
513
536
|
submodules = read_submodule_configs(workspace_path)
|
|
514
537
|
if not submodules:
|
|
515
538
|
click.echo("(no submodules found)")
|
|
516
539
|
else:
|
|
517
|
-
click.echo(f"{'
|
|
540
|
+
click.echo(f"{'路径':<34} {'分支':<14} 状态")
|
|
518
541
|
click.echo("-" * 72)
|
|
519
542
|
for item in submodules:
|
|
520
543
|
status = get_submodule_status(
|
|
@@ -524,20 +547,20 @@ def list_submodules() -> None:
|
|
|
524
547
|
f"{item['path']:<34} {item['branch']:<14} "
|
|
525
548
|
f"{status.get('syncState', 'unknown')}"
|
|
526
549
|
)
|
|
527
|
-
_echo_workspace_summary(heading="skillreg
|
|
550
|
+
_echo_workspace_summary(heading="列出子模块后的 skillreg 上下文")
|
|
528
551
|
|
|
529
552
|
|
|
530
553
|
@dashboard.command("open")
|
|
531
|
-
@click.option("--host", default=DEFAULT_HOST, show_default=True, help="
|
|
532
|
-
@click.option("--port", default=DEFAULT_PORT, show_default=True, type=int, help="
|
|
554
|
+
@click.option("--host", default=DEFAULT_HOST, show_default=True, help="绑定 host。")
|
|
555
|
+
@click.option("--port", default=DEFAULT_PORT, show_default=True, type=int, help="绑定端口。")
|
|
533
556
|
@click.option(
|
|
534
557
|
"--no-browser",
|
|
535
558
|
is_flag=True,
|
|
536
559
|
default=False,
|
|
537
|
-
help="
|
|
560
|
+
help="只启动服务,不打开浏览器。",
|
|
538
561
|
)
|
|
539
562
|
def open_dashboard(host: str, port: int, no_browser: bool) -> None:
|
|
540
|
-
"""
|
|
563
|
+
"""启动 FastAPI 后端并打开 dashboard。"""
|
|
541
564
|
url = f"http://{host}:{port}"
|
|
542
565
|
if not no_browser:
|
|
543
566
|
# Delay browser launch so uvicorn has a moment to bind the socket.
|
|
@@ -545,9 +568,9 @@ def open_dashboard(host: str, port: int, no_browser: bool) -> None:
|
|
|
545
568
|
target=lambda: (time.sleep(1.0), webbrowser.open(url)),
|
|
546
569
|
daemon=True,
|
|
547
570
|
).start()
|
|
548
|
-
click.echo(f"skillreg
|
|
549
|
-
_echo_workspace_summary(heading="
|
|
550
|
-
click.echo("
|
|
571
|
+
click.echo(f"skillreg 后端启动中: {url}")
|
|
572
|
+
_echo_workspace_summary(heading="dashboard 启动时的 skillreg 上下文")
|
|
573
|
+
click.echo(" 按 Ctrl+C 停止。")
|
|
551
574
|
uvicorn.run(
|
|
552
575
|
"skillreg.server:app",
|
|
553
576
|
host=host,
|
|
@@ -557,13 +580,13 @@ def open_dashboard(host: str, port: int, no_browser: bool) -> None:
|
|
|
557
580
|
|
|
558
581
|
|
|
559
582
|
@dashboard.command("start")
|
|
560
|
-
@click.option("--host", default=DEFAULT_HOST, show_default=True, help="
|
|
561
|
-
@click.option("--port", default=DEFAULT_PORT, show_default=True, type=int, help="
|
|
583
|
+
@click.option("--host", default=DEFAULT_HOST, show_default=True, help="绑定 host。")
|
|
584
|
+
@click.option("--port", default=DEFAULT_PORT, show_default=True, type=int, help="绑定端口。")
|
|
562
585
|
def start_dashboard(host: str, port: int) -> None:
|
|
563
|
-
"""
|
|
586
|
+
"""在后台启动 dashboard 后端。"""
|
|
564
587
|
running_pid = _dashboard_running_pid()
|
|
565
588
|
if running_pid:
|
|
566
|
-
click.echo(f"✓ Dashboard
|
|
589
|
+
click.echo(f"✓ Dashboard 已在运行 (PID: {running_pid})")
|
|
567
590
|
click.echo(f" url : http://{host}:{port}")
|
|
568
591
|
return
|
|
569
592
|
|
|
@@ -586,40 +609,40 @@ def start_dashboard(host: str, port: int) -> None:
|
|
|
586
609
|
)
|
|
587
610
|
log.close()
|
|
588
611
|
DASHBOARD_PID_FILE.write_text(str(proc.pid), encoding="utf-8")
|
|
589
|
-
click.echo(f"✓ Dashboard
|
|
612
|
+
click.echo(f"✓ Dashboard 已启动 (PID: {proc.pid})")
|
|
590
613
|
click.echo(f" url : http://{host}:{port}")
|
|
591
|
-
click.echo(f"
|
|
592
|
-
_echo_workspace_summary(heading="
|
|
614
|
+
click.echo(f" 日志 : {DASHBOARD_LOG_FILE}")
|
|
615
|
+
_echo_workspace_summary(heading="dashboard 启动后的 skillreg 上下文")
|
|
593
616
|
|
|
594
617
|
|
|
595
618
|
@dashboard.command("status")
|
|
596
619
|
def status_dashboard() -> None:
|
|
597
|
-
"""
|
|
620
|
+
"""查看 dashboard 后台进程状态。"""
|
|
598
621
|
running_pid = _dashboard_running_pid()
|
|
599
622
|
if running_pid:
|
|
600
|
-
click.echo(f"Dashboard
|
|
601
|
-
click.echo(f"
|
|
602
|
-
click.echo(f"
|
|
623
|
+
click.echo(f"Dashboard 运行中 (PID: {running_pid})")
|
|
624
|
+
click.echo(f" PID 文件 : {DASHBOARD_PID_FILE}")
|
|
625
|
+
click.echo(f" 日志文件 : {DASHBOARD_LOG_FILE}")
|
|
603
626
|
else:
|
|
604
|
-
click.echo("Dashboard
|
|
605
|
-
_echo_workspace_summary(heading="
|
|
627
|
+
click.echo("Dashboard 未运行")
|
|
628
|
+
_echo_workspace_summary(heading="查看 dashboard 状态后的 skillreg 上下文")
|
|
606
629
|
|
|
607
630
|
|
|
608
631
|
@dashboard.command("stop")
|
|
609
632
|
def stop_dashboard() -> None:
|
|
610
|
-
"""
|
|
633
|
+
"""停止后台 dashboard 进程。"""
|
|
611
634
|
running_pid = _dashboard_running_pid()
|
|
612
635
|
if not running_pid:
|
|
613
|
-
click.echo("Dashboard
|
|
636
|
+
click.echo("Dashboard 未运行")
|
|
614
637
|
return
|
|
615
638
|
try:
|
|
616
639
|
os.kill(running_pid, signal.SIGTERM)
|
|
617
640
|
except OSError as e:
|
|
618
|
-
click.echo(f"✗ Dashboard
|
|
641
|
+
click.echo(f"✗ 停止 Dashboard 失败: {e}", err=True)
|
|
619
642
|
raise SystemExit(1)
|
|
620
643
|
DASHBOARD_PID_FILE.unlink(missing_ok=True)
|
|
621
|
-
click.echo(f"✓ Dashboard
|
|
622
|
-
_echo_workspace_summary(heading="
|
|
644
|
+
click.echo(f"✓ Dashboard 已停止 (PID: {running_pid})")
|
|
645
|
+
_echo_workspace_summary(heading="dashboard 停止后的 skillreg 上下文")
|
|
623
646
|
|
|
624
647
|
|
|
625
648
|
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
@@ -25,8 +25,8 @@ class HookActionBody(BaseModel):
|
|
|
25
25
|
def _find_hooks_script() -> Path:
|
|
26
26
|
"""Find the hooks.py script."""
|
|
27
27
|
candidates = [
|
|
28
|
-
Path(__file__).resolve().parents[
|
|
29
|
-
Path.
|
|
28
|
+
Path(__file__).resolve().parents[3] / "infra" / "hooks.py",
|
|
29
|
+
Path.cwd() / "infra" / "hooks.py",
|
|
30
30
|
]
|
|
31
31
|
for p in candidates:
|
|
32
32
|
if p.exists():
|
|
@@ -394,11 +394,9 @@ def get_target_file(skill: str, target: str, rel_path: str) -> dict:
|
|
|
394
394
|
|
|
395
395
|
def _find_sync_script() -> Path:
|
|
396
396
|
"""Find the sync-skills.py script."""
|
|
397
|
-
# Check in agent-hub infra/
|
|
398
397
|
candidates = [
|
|
399
|
-
Path.
|
|
400
|
-
Path
|
|
401
|
-
Path(__file__).resolve().parents[3] / "agent-hub" / "infra" / "sync-skills.py",
|
|
398
|
+
Path(__file__).resolve().parents[3] / "infra" / "sync-skills.py",
|
|
399
|
+
Path.cwd() / "infra" / "sync-skills.py",
|
|
402
400
|
]
|
|
403
401
|
for path in candidates:
|
|
404
402
|
if path.exists():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{skillreg-1.2.2 → skillreg-1.2.5}/src/skillreg/builtin/skillreg-skill/references/troubleshooting.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|