@namewta/skills-hub 0.1.30 → 0.1.32

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.
Files changed (72) hide show
  1. package/README.md +6 -5
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/cli.mjs +9 -2
  4. package/install.mjs +18 -6
  5. package/package.json +1 -1
  6. package/scripts/persistence/changes.md +5 -4
  7. package/scripts/persistence/dev.md +2 -2
  8. package/scripts/persistence/home.md +4 -3
  9. package/skills/dev/dev-architecture/SKILL.md +1 -1
  10. package/skills/dev/dev-archive/SKILL.md +1 -1
  11. package/skills/dev/dev-archive/references/change-closure.md +2 -2
  12. package/skills/dev/dev-debug/SKILL.md +1 -1
  13. package/skills/dev/dev-handoff/SKILL.md +1 -1
  14. package/skills/dev/dev-handoff/assets/handoff.md +1 -1
  15. package/skills/dev/dev-handoff/references/handoff-method.md +2 -0
  16. package/skills/dev/dev-help/references/guide-setup.md +33 -1
  17. package/skills/dev/dev-intake/SKILL.md +2 -0
  18. package/skills/dev/dev-intake/assets/brief.md +2 -0
  19. package/skills/dev/dev-issue/SKILL.md +2 -2
  20. package/skills/dev/dev-issue/references/github-operations.md +5 -3
  21. package/skills/dev/dev-issue-fix/SKILL.md +2 -2
  22. package/skills/dev/dev-issue-fix/assets/fix-prompt.md +2 -0
  23. package/skills/dev/dev-issue-fix/references/fix-method.md +4 -2
  24. package/skills/dev/dev-issue-fix/references/verify-existing-fix.md +1 -1
  25. package/skills/dev/dev-issue-setup/SKILL.md +2 -2
  26. package/skills/dev/dev-issue-setup/assets/collection-prompt.md +2 -2
  27. package/skills/dev/dev-issue-setup/assets/configuration.yaml +3 -2
  28. package/skills/dev/dev-issue-setup/assets/source-report.md +36 -0
  29. package/skills/dev/dev-issue-setup/references/method-index.md +1 -0
  30. package/skills/dev/dev-issue-setup/references/setup-method.md +4 -2
  31. package/skills/dev/dev-issue-setup/references/source-adapter.md +18 -1
  32. package/skills/dev/dev-issue-triage/SKILL.md +2 -2
  33. package/skills/dev/dev-issue-triage/assets/triage-prompt.md +2 -0
  34. package/skills/dev/dev-issue-triage/references/triage-method.md +5 -1
  35. package/skills/dev/dev-plan/references/plan-template.md +3 -1
  36. package/skills/dev/dev-review/SKILL.md +1 -1
  37. package/skills/dev/dev-setup/SKILL.md +23 -10
  38. package/skills/dev/dev-setup/agents/openai.yaml +2 -2
  39. package/skills/dev/dev-setup/assets/environment.md +54 -19
  40. package/skills/dev/dev-setup/references/host-resources.md +170 -41
  41. package/skills/dev/dev-verify/SKILL.md +1 -1
  42. package/skills/dev/dev-verify/references/evidence-storage.md +3 -3
  43. package/skills/dev/dev-verify/references/verification-maintenance.md +1 -1
  44. package/skills/dev/dev-workflow/SKILL.md +1 -1
  45. package/skills/dev/dev-workflow/references/decision-trail.md +1 -1
  46. package/skills/dev/dev-workflow/references/execution-support.md +3 -1
  47. package/skills/dev/dev-workflow/references/execution.md +1 -1
  48. package/skills/dev/dev-workflow/references/operating-method.md +1 -1
  49. package/skills/home/home-doctor/references/diagnosis.md +3 -2
  50. package/skills/home/home-doctor/scripts/doctor.mjs +7 -3
  51. package/skills/home/home-route/SKILL.md +2 -2
  52. package/skills/home/home-route/references/routing.md +11 -5
  53. package/skills/home/home-route/scripts/route.mjs +80 -21
  54. package/skills/home/home-setup/SKILL.md +10 -9
  55. package/skills/home/home-setup/assets/dispatch.md +8 -0
  56. package/skills/home/home-setup/assets/home-navigation.md +9 -3
  57. package/skills/home/home-setup/assets/preferences.md +14 -3
  58. package/skills/home/home-setup/assets/repos.schema.json +244 -16
  59. package/skills/home/home-setup/assets/team.md +13 -6
  60. package/skills/home/home-setup/references/configuration.md +9 -8
  61. package/skills/home/home-setup/references/dispatch.md +19 -0
  62. package/skills/home/home-setup/references/registry.md +39 -19
  63. package/skills/home/home-setup/scripts/registry.mjs +57 -20
  64. package/skills/home/home-tasks/SKILL.md +15 -0
  65. package/skills/home/home-tasks/references/records.md +57 -0
  66. package/skills/home/home-tasks/scripts/storage.mjs +85 -0
  67. package/skills/home/home-tasks/scripts/tasks.mjs +376 -0
  68. package/skills/home/home-workflow/SKILL.md +4 -3
  69. package/skills/home/home-workflow/assets/coordination.md +4 -4
  70. package/skills/home/home-workflow/assets/project-brief.md +3 -1
  71. package/skills/home/home-workflow/references/coordination.md +6 -6
  72. package/skills/home/home-workflow/references/delegation.md +9 -3
@@ -77,20 +77,44 @@ function readJson(filename, optional = false) {
77
77
  export function readRegistry(homeRoot) {
78
78
  homeRoot = homePath(homeRoot);
79
79
  const value = readJson(path.join(homeRoot, '.agents/home/repos.json'));
80
- if (value?.formatVersion !== 1 || !Array.isArray(value.repos)) fail('REGISTRY_VERSION', '只读取 formatVersion: 1 的 repos 数组;未知版本不猜测迁移。');
80
+ if (![1, 2].includes(value?.formatVersion) || !Array.isArray(value.repos)) fail('REGISTRY_VERSION', '只读取 formatVersion: 1 或 2 的 repos 数组;未知版本不猜测迁移。');
81
81
  const ids = new Set();
82
82
  for (const repo of value.repos) {
83
- if (!repo || !/^[a-z0-9][a-z0-9-]*$/u.test(repo.id || '') || ids.has(repo.id) || !text(repo.localPath) || typeof repo.remote !== 'string') {
84
- fail('INVALID_REGISTRY', '登记必须含唯一 id、localPath 与 remote;请由 home-setup 校验完整 schema。');
83
+ if (!repo || !/^[a-z0-9][a-z0-9-]*$/u.test(repo.id || '') || ids.has(repo.id) || !text(repo.localPath)) {
84
+ fail('INVALID_REGISTRY', '登记必须含唯一 id、localPath 与明确 Git 身份;请由 home-setup 校验完整 schema。');
85
85
  }
86
86
  if (repo.aliases !== undefined && (!Array.isArray(repo.aliases) || repo.aliases.some(alias => !text(alias)))) fail('INVALID_REGISTRY', `仓库 ${repo.id} 的 aliases 无效。`);
87
87
  if (repo.groups !== undefined && (!Array.isArray(repo.groups) || repo.groups.some(group => !text(group)))) fail('INVALID_REGISTRY', `仓库 ${repo.id} 的 groups 无效。`);
88
- if (repo.remote) normalizeRemote(repo.remote);
88
+ if (value.formatVersion === 1) {
89
+ if (typeof repo.remote !== 'string' || Object.hasOwn(repo, 'remotes') || Object.hasOwn(repo, 'primaryRemote')) fail('INVALID_REGISTRY', 'v1 使用原单 remote;迁移后以 v2 保存,不能混用两份身份。');
90
+ if (repo.remote) normalizeRemote(repo.remote);
91
+ } else {
92
+ if (!/^(\.\/|\.\.\/)/u.test(repo.localPath) || repo.localPath.includes('\\') || Object.hasOwn(repo, 'remote')) fail('INVALID_REGISTRY', 'v2 使用 remotes 与显式 Home 相对 localPath;不能混入旧 remote。');
93
+ validateRemotes(repo);
94
+ }
89
95
  ids.add(repo.id);
90
96
  }
91
97
  return value;
92
98
  }
93
99
 
100
+ function validateRemotes(repo) {
101
+ if (!Array.isArray(repo.remotes)) fail('INVALID_REGISTRY', 'v2 remotes 必须是数组。');
102
+ const names = new Set();
103
+ for (const remote of repo.remotes) {
104
+ if (!remote || !text(remote.name) || /\s/u.test(remote.name) || names.has(remote.name) || Object.keys(remote).some(key => !['name', 'urls', 'pushUrls'].includes(key))) fail('INVALID_REGISTRY', 'remote 名称无效、重复或含未知字段。');
105
+ names.add(remote.name);
106
+ for (const key of ['urls', 'pushUrls']) {
107
+ if (!Array.isArray(remote[key])) fail('INVALID_REGISTRY', `remote ${key} 必须是 URL 数组。`);
108
+ for (const url of remote[key]) {
109
+ if (typeof url !== 'string' || /\s/u.test(url)) fail('INVALID_REMOTE', '登记 URL 不得为空或包含空白。');
110
+ normalizeRemote(url);
111
+ }
112
+ }
113
+ if (!remote.urls.length && !remote.pushUrls.length) fail('INVALID_REGISTRY', 'remote 没有 URL,先由 home-setup 核实配置。');
114
+ }
115
+ if (!repo.remotes.length ? repo.primaryRemote !== null : !text(repo.primaryRemote) || !repo.remotes.some(remote => remote.name === repo.primaryRemote && remote.urls.length)) fail('INVALID_PRIMARY_REMOTE', '必须选定含 fetch URL 的 primaryRemote;本地独有仓库写 null。');
116
+ }
117
+
94
118
  export function readLocalPaths(homeRoot, registry) {
95
119
  homeRoot = homePath(homeRoot);
96
120
  const value = readJson(path.join(homeRoot, '.agents/home/local.json'), true);
@@ -112,7 +136,7 @@ export function selectRepos(registry, query, { group = false } = {}) {
112
136
  return exact ? [exact] : registry.repos.filter(repo => (repo.aliases || []).includes(query));
113
137
  }
114
138
 
115
- function git(cwd, args, { optional = false } = {}) {
139
+ function git(cwd, args, { optional = false, raw = false } = {}) {
116
140
  const env = { ...process.env, GIT_TERMINAL_PROMPT: '0', GIT_OPTIONAL_LOCKS: '0' };
117
141
  for (const key of ['GIT_DIR', 'GIT_COMMON_DIR', 'GIT_WORK_TREE', 'GIT_INDEX_FILE', 'GIT_PREFIX', 'GIT_OBJECT_DIRECTORY', 'GIT_ALTERNATE_OBJECT_DIRECTORIES', 'GIT_CONFIG', 'GIT_CONFIG_COUNT', 'GIT_CONFIG_PARAMETERS']) delete env[key];
118
142
  const result = spawnSync('git', ['-c', 'core.fsmonitor=false', '-C', cwd, ...args], { env, encoding: 'utf8', timeout: 15_000, maxBuffer: 4 * 1024 * 1024, windowsHide: true });
@@ -120,7 +144,7 @@ function git(cwd, args, { optional = false } = {}) {
120
144
  if (optional && !result.error) return null;
121
145
  fail('GIT_CHECK_FAILED', `Git 只读核查失败:${args[0]}(${result.error?.code || result.status});未执行 fetch、切分支或写入。`);
122
146
  }
123
- return result.stdout.trim();
147
+ return raw ? result.stdout : result.stdout.trim();
124
148
  }
125
149
 
126
150
  export function inspectCheckout(inputPath) {
@@ -133,16 +157,28 @@ export function inspectCheckout(inputPath) {
133
157
  const actualCheckout = fs.realpathSync.native(git(realPath, ['rev-parse', '--show-toplevel']));
134
158
  const gitDir = fs.realpathSync.native(git(actualCheckout, ['rev-parse', '--absolute-git-dir']));
135
159
  const commonDir = fs.realpathSync.native(git(actualCheckout, ['rev-parse', '--path-format=absolute', '--git-common-dir']));
136
- const remoteLines = git(actualCheckout, ['config', '--get-regexp', '^remote\\..*\\.url$'], { optional: true });
137
- const remotes = [];
138
- for (const line of (remoteLines || '').split('\n').filter(Boolean)) {
139
- const match = line.match(/^remote\.(.+)\.url\s+(.+)$/u);
140
- if (!match) continue;
141
- let identity;
142
- try { identity = normalizeRemote(match[2]); }
160
+ const remoteNames = git(actualCheckout, ['remote']).split('\n').filter(Boolean);
161
+ const remoteEntries = new Map(remoteNames.map(name => [name, { name, urls: [], pushUrls: [] }]));
162
+ const remoteLines = git(actualCheckout, ['config', '--null', '--get-regexp', '^remote\\..*\\.(url|pushurl)$'], { optional: true, raw: true });
163
+ for (const line of (remoteLines || '').split('\0').filter(Boolean)) {
164
+ const match = line.match(/^remote\.(.+)\.(url|pushurl)\n([\s\S]*)$/u);
165
+ if (!match || !remoteEntries.has(match[1])) fail('INVALID_REMOTE', 'Git remote 配置无法完整解析;未忽略未知记录。');
166
+ const remote = remoteEntries.get(match[1]);
167
+ const key = match[2] === 'url' ? 'urls' : 'pushUrls';
168
+ // Empty values clear inherited multi-value URL settings in Git.
169
+ if (!match[3]) { remote[key] = []; continue; }
170
+ try { if (/\s/u.test(match[3])) fail('INVALID_REMOTE', 'URL 包含空白。'); normalizeRemote(match[3]); }
143
171
  catch (error) { fail(error.code || 'INVALID_REMOTE', `目标 remote ${match[1]} 的 URL 不适合保存;先由项目 owner 移除内嵌认证信息或修复格式。`); }
144
- remotes.push({ name: match[1], ...identity });
172
+ remote[key].push(match[3]);
145
173
  }
174
+ const remotes = [...remoteEntries.values()];
175
+ const effectiveFetchUrls = remotes.filter(remote => remote.urls.length).map(remote => {
176
+ const url = git(actualCheckout, ['remote', 'get-url', '--', remote.name], { raw: true }).replace(/\r?\n$/u, '');
177
+ try { if (/\s/u.test(url)) fail('INVALID_REMOTE', 'URL 包含空白。'); normalizeRemote(url); }
178
+ catch (error) { fail(error.code || 'INVALID_REMOTE', `目标 remote ${remote.name} 经 Git URL 重写后的 fetch 地址不适合输出;先由项目 owner 修复,不保存认证信息。`); }
179
+ return { name: remote.name, url };
180
+ });
181
+ const suggestedPrimaryRemote = remotes.find(remote => remote.name === 'origin' && remote.urls.length)?.name || (remotes.length === 1 && remotes[0].urls.length ? remotes[0].name : null);
146
182
  const head = git(actualCheckout, ['rev-parse', '--verify', 'HEAD'], { optional: true });
147
183
  const branch = git(actualCheckout, ['symbolic-ref', '--quiet', '--short', 'HEAD'], { optional: true });
148
184
  const dirty = Boolean(git(actualCheckout, ['status', '--porcelain=v1', '--untracked-files=normal']));
@@ -151,7 +187,7 @@ export function inspectCheckout(inputPath) {
151
187
  isLinkedWorktree: gitDir !== commonDir,
152
188
  requestedPathIsGitRoot: realPath === actualCheckout,
153
189
  followsPathAlias: requestedPath !== realPath,
154
- head, branch, dirty, remotes,
190
+ head, branch, dirty, remotes, effectiveFetchUrls, suggestedPrimaryRemote,
155
191
  entries: {
156
192
  agentsFile: exists(path.join(actualCheckout, 'AGENTS.md')),
157
193
  agentsDirectory: exists(path.join(actualCheckout, '.agents')),
@@ -182,10 +218,20 @@ export function routeRepo(homeRoot, repo, { localPaths = {}, checkout, reference
182
218
  const registeredPath = path.resolve(homeRoot, localPaths[repo.id] || repo.localPath);
183
219
  const chosenPath = checkout ? path.resolve(homeRoot, checkout) : registeredPath;
184
220
  const actual = inspectCheckout(chosenPath);
185
- const expected = repo.remote ? normalizeRemote(repo.remote) : null;
221
+ const multiRemote = Object.hasOwn(repo, 'remotes');
222
+ if (multiRemote) validateRemotes(repo);
223
+ else if (typeof repo.remote !== 'string') fail('INVALID_REGISTRY', '旧登记缺少 remote;由 home-setup 核实。');
224
+ const primary = multiRemote ? repo.remotes.find(remote => remote.name === repo.primaryRemote) : null;
225
+ const expected = primary ? normalizeRemote(primary.urls[0]) : repo.remote ? normalizeRemote(repo.remote) : null;
186
226
  let identityEvidence;
187
227
  if (expected) {
188
- identityEvidence = matchIdentity(actual.remotes, expected, repo.id);
228
+ if (multiRemote) {
229
+ const observed = actual.remotes.find(remote => remote.name === repo.primaryRemote);
230
+ const effective = actual.effectiveFetchUrls.find(remote => remote.name === repo.primaryRemote);
231
+ const observedIdentity = observed?.urls.length && effective ? normalizeRemote(effective.url) : null;
232
+ if (!observedIdentity || observedIdentity.kind !== expected.kind || observedIdentity.identity !== expected.identity) fail('IDENTITY_CONFLICT', `仓库 ${repo.id} 的主 remote ${repo.primaryRemote} 缺失,或首个 fetch URL 经 Git 重写后的实际身份与登记不同;其他 remote 或 push URL 命中不能替代。`);
233
+ identityEvidence = { type: 'remote', expected, actual: observedIdentity, selection: 'primary-remote', primaryRemote: repo.primaryRemote, fetchUrlIndex: 0, matchedRemoteNames: [repo.primaryRemote] };
234
+ } else identityEvidence = matchIdentity(actual.remotes, expected, repo.id, actual.effectiveFetchUrls);
189
235
  } else {
190
236
  if (actual.remotes.length) fail('IDENTITY_CONFLICT', `仓库 ${repo.id} 登记为本地独有,但实际配置了 remote;先由 home-setup 核实登记。`);
191
237
  if (checkout && path.resolve(chosenPath) !== path.resolve(registeredPath)) {
@@ -194,10 +240,11 @@ export function routeRepo(homeRoot, repo, { localPaths = {}, checkout, reference
194
240
  }
195
241
  identityEvidence = { type: 'local-only', commonDir: actual.commonDir };
196
242
  }
243
+ const remoteDrift = multiRemote ? compareRemotes(repo.remotes, actual.remotes) : [];
197
244
  const result = {
198
245
  status: 'resolved', repoId: repo.id, purpose: repo.purpose || '', intent: repo.intent,
199
246
  homeRoot, registeredPath, pathSource: checkout ? 'explicit-checkout' : localPaths[repo.id] ? 'local-path-override' : 'registry',
200
- identityEvidence, ...actual,
247
+ identityEvidence, ...actual, remoteDrift, registryMatches: multiRemote ? !remoteDrift.length : null, registryCoverage: multiRemote ? 'all-configured-remotes' : 'legacy-primary-only',
201
248
  contextRead: false,
202
249
  next: '由进入实际 checkout 的项目 Agent 读取 AGENTS.md、有关 .agents 资料和所需 SKILL;本结果只核对位置与入口。',
203
250
  };
@@ -205,11 +252,23 @@ export function routeRepo(homeRoot, repo, { localPaths = {}, checkout, reference
205
252
  return result;
206
253
  }
207
254
 
208
- function matchIdentity(remotes, expected, repoId = '待接入项目') {
255
+ function compareRemotes(registered, actual) {
256
+ const before = new Map(registered.map(remote => [remote.name, remote]));
257
+ const after = new Map(actual.map(remote => [remote.name, remote]));
258
+ return [...new Set([...before.keys(), ...after.keys()])].sort().flatMap(name => {
259
+ const saved = before.get(name), observed = after.get(name);
260
+ if (!saved || !observed) return [{ name, change: saved ? 'removed' : 'added', registered: saved || null, actual: observed || null }];
261
+ const fields = ['urls', 'pushUrls'].filter(key => JSON.stringify(saved[key]) !== JSON.stringify(observed[key]));
262
+ return fields.length ? [{ name, change: 'changed', fields, registered: saved, actual: observed }] : [];
263
+ });
264
+ }
265
+
266
+ function matchIdentity(remotes, expected, repoId = '待接入项目', effectiveFetchUrls = []) {
209
267
  // An parent URL does not change the identity of a fork's origin.
210
268
  const origin = remotes.filter(remote => remote.name === 'origin');
211
269
  const selected = origin.length ? origin : remotes;
212
- if (!selected.length || selected.some(remote => remote.identity !== expected.identity || remote.kind !== expected.kind)) {
270
+ const effective = new Map(effectiveFetchUrls.map(remote => [remote.name, remote.url]));
271
+ if (!selected.length || selected.some(remote => !remote.urls.length || !effective.has(remote.name) || [...remote.urls, effective.get(remote.name)].some(url => { const identity = normalizeRemote(url); return identity.identity !== expected.identity || identity.kind !== expected.kind; }))) {
213
272
  fail('IDENTITY_CONFLICT', `仓库 ${repoId} 的 origin(无 origin 时为全部已配置 remote)与登记身份不一致或存在歧义;parent 命中不能代替 fork 身份核查。`);
214
273
  }
215
274
  return { type: 'remote', expected, selection: origin.length ? 'origin' : 'unambiguous-remotes', matchedRemoteNames: selected.map(remote => remote.name) };
@@ -239,7 +298,7 @@ export function main(argv = process.argv.slice(2)) {
239
298
  const result = inspectCheckout(options.inspect);
240
299
  if (options['expected-remote'] !== undefined) {
241
300
  const expected = normalizeRemote(options['expected-remote']);
242
- result.identityEvidence = matchIdentity(result.remotes, expected);
301
+ result.identityEvidence = matchIdentity(result.remotes, expected, '待接入项目', result.effectiveFetchUrls);
243
302
  }
244
303
  console.log(JSON.stringify({ status: 'inspected', ...result, contextRead: false }, null, 2));
245
304
  return 0;
@@ -1,18 +1,19 @@
1
1
  ---
2
2
  name: home-setup
3
- description: 建立或接入用户的 Home Repo、原地登记项目、维护项目地图,以及按明确请求保存个人背景、运行偏好、命名协作配置和有关环境事实。用于“建立 Home”“接入这个项目”“以后按这套工具协作”“修改 Home 默认”;只查询现有概况或位置时直接使用 home-knowledge 或 home-route,不因安装技能创建配置或启动任务。
3
+ description: 初始化个人 Home Repo 的默认派遣方式和 Home team,原地登记项目、维护项目地图,以及保存用户背景、运行偏好和有关环境事实。用于“建立 Home”“接入这个项目”“以后用这套方式派遣”“记住项目使用哪个模型”“修改 Home 默认”;安装或普通查询不初始化。
4
4
  ---
5
5
 
6
6
  # 接入 Home 与用户配置
7
7
 
8
- 交付可回读的仓库登记、项目地图和用户实际要求的配置。用户选定的 Home Repo、skills-hub 源码仓和目标项目分别有自己的职责;Home 不等于操作系统用户目录。保留已有权威资料和当前授权,不为相同设置新建第二份真源。
8
+ 交付可回读的仓库登记和用户实际要求的配置。项目地图按需查看,明确要求导出时才保存。用户选定的 Home Repo、skills-hub 源码仓和目标项目分别有自己的职责;Home 不等于操作系统用户目录。保留已有权威资料和当前授权,不为相同设置新建第二份真源。
9
9
 
10
10
  ## 先选择本次分支
11
11
 
12
12
  | 任务 | 必读方法 | 产物 |
13
13
  | --- | --- | --- |
14
- | 建立 Home、登记/移址/解除登记、生成地图 | [登记与入口](references/registry.md) | repos.json、可重建 repos.md、必要薄导航 |
15
- | 保存用户背景、偏好、默认或命名协作配置 | [用户配置](references/configuration.md) | 用户明确需要的 context 文档或现有 owner |
14
+ | 显式初始化 Home 或补初始化派遣 | [派遣与团队初始化](references/dispatch.md),有项目时读[登记与入口](references/registry.md) | 默认派遣方式、默认 Home team、适用的登记与导航 |
15
+ | 登记/移址/解除登记、查看或导出地图 | [登记与入口](references/registry.md) | repos.json、按需地图、必要薄导航 |
16
+ | 保存用户背景、偏好、派遣方式或团队 | [用户配置](references/configuration.md),涉及派遣时读[派遣与团队初始化](references/dispatch.md) | context 文档或现有 owner |
16
17
  | 验证本次所需工具或执行位置 | [环境事实](references/environment.md) | 有来源、时间、边界的能力观察 |
17
18
 
18
19
  普通查询已有足够资料时直接继续,不要求完成全套初始化。只编辑配置时不探测全部账号、不启动任务;同一请求含执行工作时,完成保存后把选用配置交回 `home-workflow`。
@@ -20,13 +21,13 @@ description: 建立或接入用户的 Home Repo、原地登记项目、维护项
20
21
  ## 执行方法
21
22
 
22
23
  1. 确认用户指定的 Home 根、已有 `AGENTS.md`、`.agents/home/` 及同类资料真实位置。先复用既有要求,只有缺项确实阻止当前行动时询问具体项。
23
- 2. 登记项目时按准确名称调用 `home-route`,核实既有 clone、实际 checkout 与 Git 身份。项目内部知识仍由进入项目的 Agent 读取;不移动仓库、不重新 clone、不切分支。
24
- 3. 根据本次范围维护登记、profile、preferences 或一个明确命名的协作配置。没有要求设置默认,就保持未设置;不预建 default-team。
24
+ 2. 登记项目时按准确名称调用 `home-route`,核实既有 clone、实际 checkout 与全部 remote。新登记采用 v2,保存名称、完整 URL 列表和明确的主 remote,路径写成 Home 根相对的 `./` 或 `../` 形式。旧 v1 继续读取,改写前按现场核查结果迁移。项目内部知识仍由进入项目的 Agent 读取;不移动仓库、不重新 clone、不切分支。
25
+ 3. 按本次范围维护登记或 context。显式初始化时确定一个默认派遣方式和一个默认 Home team,分别保留有效旧选择,缺少选择时按派遣与团队初始化方法补齐。普通登记、配置编辑和安装更新沿用原默认。
25
26
  4. 将用户的配置意图、现场能力观察和本次实际运行证据分开。CLI、模型、推理设置和派遣技能不设固定候选枚举;未知值不传入工具。
26
- 5. 按授权合并根薄导航,保留用户正文;用包内工具校验并生成地图。回读实际文件,核对所改字段、路径、入链和作用范围。
27
+ 5. 按授权合并根薄导航,直接引用登记真源并保留用户正文。用包内工具校验、保存,再回读所改字段、路径和作用范围。没有 `repos.md` 是正常状态;地图由当前登记按需生成,显式导出时才写文件。
27
28
  6. 报告保存内容、仍未知事项和实际做过的能力检查。保存配置不等于工具已切换、任务已送达或模型已生效。
28
29
 
29
- 配置选择顺序为:本次适用的明确要求 → 本次明确选用的命名配置 → 用户明确设置的 Home 默认 → 未指定项使用所选工具自身的实际默认。Home 默认只约束 Home 发出的直接任务;项目再派遣按当地规则,除非用户明确指定全链范围。
30
+ 先确定派遣方式,再选择 Home team,最后应用 repo ID 对应的执行者配置与本次覆盖。Home 默认只约束 Home 发出的直接任务,项目再派遣按当地规则,除非用户明确指定全链范围。
30
31
 
31
32
  ## 工具与模板
32
33
 
@@ -39,7 +40,7 @@ node <本技能目录>/scripts/registry.mjs validate --input "<候选登记.json
39
40
 
40
41
  使用 [repos schema](assets/repos.schema.json)、[本机覆盖 schema](assets/local.schema.json) 校对输入;只有路径可以进入 `local.json`。秘密保留已有安全位置的引用,不写入登记或配置。
41
42
 
42
- 按真实内容选择 [profile](assets/profile.md)、[preferences](assets/preferences.md)、[命名协作配置](assets/team.md)、[环境记录](assets/environment.md) 和 [根导航片段](assets/home-navigation.md)。模板不要求全部栏目有值,不在安装时批量生成。已有等价文档原地维护并引用。
43
+ 按真实内容选择 [profile](assets/profile.md)、[preferences](assets/preferences.md)、[派遣方式](assets/dispatch.md)、[Home team](assets/team.md)、[环境记录](assets/environment.md) 和 [根导航片段](assets/home-navigation.md)。模板不要求全部栏目有值,不在安装时批量生成。已有等价文档原地维护并引用。
43
44
 
44
45
  ## 完成条件
45
46
 
@@ -0,0 +1,8 @@
1
+ # <命名派遣方式>
2
+
3
+ - 类型 — 当前宿主原生,或用户选用的现有技能、CLI 或工具入口。
4
+ - 用途与适用范围 — 可接受的环境、交互或接管要求,以及核对来源。
5
+ - 工作目录 — 该入口如何为项目负责人绑定实际 checkout 或确认每条项目操作的工作目录。
6
+ - 投递与回执 — 引用入口实际提供的身份、消息或文件方式,以及如何核实送达、接续和结果。
7
+
8
+ 保留实际需要的字段。当前宿主原生方式只保存解析规则,使用时确认本会话实际入口和支持的参数。模型、CLI 和推理覆盖由 Home team 或本次要求选择。凭据引用既有安全位置。
@@ -1,7 +1,13 @@
1
+ # 根导航片段
2
+
3
+ 将下面代码块的正文合并到 Home 根 `AGENTS.md`,保留用户原有内容。链接以 Home 根为基准,已有资料位置不同时改用其真实相对路径。
4
+
5
+ ```md
1
6
  ## Home 工作入口
2
7
 
3
- 先按任务读取 `.agents/home/AGENTS.md` 与 `.agents/home/repos.md`;登记真源为 `.agents/home/repos.json`。实际位置和 checkout 通过 `home-route` 解析。
8
+ 先按任务读取 [Home 导航](.agents/home/AGENTS.md)与[项目登记](.agents/home/repos.json)。实际位置和 checkout 通过 `home-route` 解析;可读项目地图通过 `home-setup` 按需查看,无需预先保存 `repos.md`。
4
9
 
5
- Home 保存各项目基本定位、项目管理与跨项目知识。项目内部知识、文档、SKILL、源码和运行证据由进入该项目的 Agent 读取与维护。当前主题查 `home-knowledge`,有日期的过往事件查 `home-history`,配置变更用 `home-setup`,复合任务用 `home-workflow`。
10
+ Home 保存各项目基本定位、项目管理与跨项目知识。项目内部资料由进入该项目的 Agent 读取与维护。现行知识查 `home-knowledge`,过去事件查 `home-history`,直接任务和项目占用查 `home-tasks`,配置由 `home-setup` 保存,项目派遣和验收由 `home-workflow` 协调。
6
11
 
7
- 按用户本次要求、明确选用的协作配置或已设置的 Home 默认选择工具和派遣方法。各项目再次派遣时遵守当地有效规则与记录方法;图中可见关系不授予越级控制权。
12
+ 显式初始化时分别设置默认派遣方式和默认 Home team。执行时按本次选择、方式与 team 关联及 Home 默认核对实际入口。各项目再次派遣时遵守当地有效规则与记录方法。
13
+ ```
@@ -1,15 +1,26 @@
1
1
  # Home 运行偏好
2
2
 
3
- 只保留用户明确采用的条目;现有等价 owner 用指针引用,不双写。
3
+ 保留用户明确采用的条目,以及显式初始化所确定的默认选择。现有等价 owner 用指针引用。
4
4
 
5
5
  | 设置 | 用户选择或权威引用 | 作用范围 | 来源与确认时间 |
6
6
  | --- | --- | --- | --- |
7
7
 
8
8
  可选内容包括语言/时区、用户指定的 Home 默认配置、允许整理的历史来源、任务末回顾和资料保留偏好。没有要求的项省略;一次临时选择不自动永久化。
9
9
 
10
- ## 默认选择
10
+ ## 默认派遣方式
11
11
 
12
- 若用户明确要求某配置作为 Home 默认,在此记录其真实路径与范围。命名配置保存具体角色和工具,本页不复制。当前明确要求优先;默认只约束 Home 发出的直接任务。
12
+ 初始化后保留一条指向实际派遣方式文档的相对链接,只约束 Home 发出的直接任务。
13
+
14
+ ## 默认 Home team
15
+
16
+ 初始化后保留一条指向实际 team 文档的相对链接。team 文件保存执行者配置。
17
+
18
+ ## 按派遣方式选 team
19
+
20
+ 用户明确指定关联时使用实际相对链接,每种派遣方式一行。没有关联时可省略本节。
21
+
22
+ | 派遣方式 | 默认 Home team | 来源与确认时间 |
23
+ | --- | --- | --- |
13
24
 
14
25
  ## 更正与遗忘
15
26
 
@@ -1,27 +1,255 @@
1
1
  {
2
- "title": "Home 仓库登记 v1",
2
+ "title": "Home 仓库登记 v2(保留 v1 读取兼容)",
3
3
  "type": "object",
4
4
  "additionalProperties": false,
5
- "required": ["formatVersion", "repos"],
5
+ "required": [
6
+ "formatVersion",
7
+ "repos"
8
+ ],
6
9
  "properties": {
7
- "formatVersion": { "const": 1 },
10
+ "formatVersion": {
11
+ "enum": [
12
+ 1,
13
+ 2
14
+ ]
15
+ },
8
16
  "repos": {
9
- "type": "array",
10
- "items": {
11
- "type": "object",
12
- "additionalProperties": false,
13
- "required": ["id", "purpose", "remote", "localPath", "intent"],
17
+ "type": "array"
18
+ }
19
+ },
20
+ "allOf": [
21
+ {
22
+ "if": {
23
+ "properties": {
24
+ "formatVersion": {
25
+ "const": 1
26
+ }
27
+ }
28
+ },
29
+ "then": {
14
30
  "properties": {
15
- "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
16
- "purpose": { "type": "string", "minLength": 1, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" },
17
- "aliases": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
18
- "groups": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
19
- "remote": { "type": "string", "description": "保留 host 和仓库路径的无秘密 Git 身份;以 origin 核对,无 origin 时须全部 remote 身份一致。本地独有仓库为空。" },
20
- "localPath": { "type": "string", "minLength": 1 },
21
- "intent": { "enum": ["work", "reference"] },
22
- "backgroundRef": { "type": "string", "minLength": 1, "description": "Home 内相对路径;不接受父目录跳转或绝对路径。" }
31
+ "repos": {
32
+ "items": {
33
+ "$ref": "#/$defs/legacyRepo"
34
+ }
35
+ }
36
+ }
37
+ },
38
+ "else": {
39
+ "properties": {
40
+ "repos": {
41
+ "items": {
42
+ "$ref": "#/$defs/repo"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ ],
49
+ "$defs": {
50
+ "legacyRepo": {
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "required": [
54
+ "id",
55
+ "purpose",
56
+ "remote",
57
+ "localPath",
58
+ "intent"
59
+ ],
60
+ "properties": {
61
+ "id": {
62
+ "type": "string",
63
+ "pattern": "^[a-z0-9][a-z0-9-]*$"
64
+ },
65
+ "purpose": {
66
+ "type": "string",
67
+ "minLength": 1,
68
+ "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
69
+ },
70
+ "aliases": {
71
+ "type": "array",
72
+ "uniqueItems": true,
73
+ "items": {
74
+ "type": "string",
75
+ "minLength": 1
76
+ }
77
+ },
78
+ "groups": {
79
+ "type": "array",
80
+ "uniqueItems": true,
81
+ "items": {
82
+ "type": "string",
83
+ "minLength": 1
84
+ }
85
+ },
86
+ "localPath": {
87
+ "type": "string",
88
+ "minLength": 1
89
+ },
90
+ "intent": {
91
+ "enum": [
92
+ "work",
93
+ "reference"
94
+ ]
95
+ },
96
+ "backgroundRef": {
97
+ "type": "string",
98
+ "minLength": 1,
99
+ "description": "Home 内相对路径;不接受父目录跳转或绝对路径。"
100
+ },
101
+ "remote": {
102
+ "type": "string",
103
+ "description": "旧单 remote 主身份,仅继续读取;修改登记前实际核查名称并迁移 v2。"
23
104
  }
24
105
  }
106
+ },
107
+ "remote": {
108
+ "type": "object",
109
+ "additionalProperties": false,
110
+ "required": [
111
+ "name",
112
+ "urls",
113
+ "pushUrls"
114
+ ],
115
+ "properties": {
116
+ "name": {
117
+ "type": "string",
118
+ "minLength": 1,
119
+ "pattern": "^\\S+$",
120
+ "description": "实际 Git remote 名称;同一登记内不得重复。"
121
+ },
122
+ "urls": {
123
+ "type": "array",
124
+ "items": {
125
+ "type": "string",
126
+ "minLength": 1,
127
+ "pattern": "^[^\\u0000-\\u0020\\u007f]+$",
128
+ "description": "无认证秘密的原始 Git URL;URL 数组保留配置顺序。"
129
+ },
130
+ "description": "全部 remote.<name>.url,按 Git 顺序保存;首 URL 为 fetch 身份。"
131
+ },
132
+ "pushUrls": {
133
+ "type": "array",
134
+ "items": {
135
+ "type": "string",
136
+ "minLength": 1,
137
+ "pattern": "^[^\\u0000-\\u0020\\u007f]+$",
138
+ "description": "无认证秘密的原始 Git URL;URL 数组保留配置顺序。"
139
+ },
140
+ "description": "全部显式 remote.<name>.pushurl;没有配置则为空,不复制隐式回退值。"
141
+ }
142
+ },
143
+ "anyOf": [
144
+ {
145
+ "properties": {
146
+ "urls": {
147
+ "minItems": 1
148
+ }
149
+ }
150
+ },
151
+ {
152
+ "properties": {
153
+ "pushUrls": {
154
+ "minItems": 1
155
+ }
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ "repo": {
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "required": [
164
+ "id",
165
+ "purpose",
166
+ "remotes",
167
+ "primaryRemote",
168
+ "localPath",
169
+ "intent"
170
+ ],
171
+ "properties": {
172
+ "id": {
173
+ "type": "string",
174
+ "pattern": "^[a-z0-9][a-z0-9-]*$"
175
+ },
176
+ "purpose": {
177
+ "type": "string",
178
+ "minLength": 1,
179
+ "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
180
+ },
181
+ "aliases": {
182
+ "type": "array",
183
+ "uniqueItems": true,
184
+ "items": {
185
+ "type": "string",
186
+ "minLength": 1
187
+ }
188
+ },
189
+ "groups": {
190
+ "type": "array",
191
+ "uniqueItems": true,
192
+ "items": {
193
+ "type": "string",
194
+ "minLength": 1
195
+ }
196
+ },
197
+ "localPath": {
198
+ "type": "string",
199
+ "pattern": "^(?:\\./|\\.\\./)[^\\\\\\u0000-\\u001f\\u007f]*$",
200
+ "description": "以 Home 根为基准的规范相对路径,例如 ./project-a 或 ../repos/project-a;绝对路径只进入 local.json。"
201
+ },
202
+ "intent": {
203
+ "enum": [
204
+ "work",
205
+ "reference"
206
+ ]
207
+ },
208
+ "backgroundRef": {
209
+ "type": "string",
210
+ "minLength": 1,
211
+ "description": "Home 内相对路径;不接受父目录跳转或绝对路径。"
212
+ },
213
+ "remotes": {
214
+ "type": "array",
215
+ "items": {
216
+ "$ref": "#/$defs/remote"
217
+ }
218
+ },
219
+ "primaryRemote": {
220
+ "type": [
221
+ "string",
222
+ "null"
223
+ ],
224
+ "description": "明确选择有 urls[0] 的 remote 名称;工具校验引用存在。本地独有仓库为 null。"
225
+ }
226
+ },
227
+ "allOf": [
228
+ {
229
+ "if": {
230
+ "properties": {
231
+ "remotes": {
232
+ "maxItems": 0
233
+ }
234
+ }
235
+ },
236
+ "then": {
237
+ "properties": {
238
+ "primaryRemote": {
239
+ "const": null
240
+ }
241
+ }
242
+ },
243
+ "else": {
244
+ "properties": {
245
+ "primaryRemote": {
246
+ "type": "string",
247
+ "minLength": 1
248
+ }
249
+ }
250
+ }
251
+ }
252
+ ]
25
253
  }
26
254
  }
27
255
  }
@@ -2,20 +2,27 @@
2
2
 
3
3
  用途、适用项目/任务与来源时间:
4
4
 
5
- 用户明确给定的工具、派遣要求、成本预算与作用范围:
5
+ 用户明确给定的执行 CLI、成本预算与作用范围:
6
6
 
7
- 本文件供明确选用;只有 preferences 的 owner 记录用户指定的默认指针时才作为 Home 默认。保存不启动 Agent、不改变宿主设置、不自动覆盖项目子级配置。
7
+ 本 team 用于 Home 直接派出的项目负责人。可由本次指令、派遣方式关联或 Home 默认选用。初始化的最小 team 包含一个项目负责人角色,未指定的 CLI、模型、推理覆盖留空。
8
8
 
9
9
  ## 实际需要的角色
10
10
 
11
- | 角色与交付物 | 用户选择的 CLI/能力入口 | 模型与推理意图 | 总数量 | 理由、能力依据与未知项 |
12
- | --- | --- | --- | --- | --- |
11
+ | 角色与交付物 | CLI | 模型 | 推理强度 | 总数量 | 理由、能力依据与未知项 |
12
+ | --- | --- | --- | --- | --- | --- |
13
13
 
14
14
  只填需要的角色。未指定值保留未设置;数量不是并发额度,文本继承意图不直接传成工具参数。
15
15
 
16
- ## 派遣和协作约定
16
+ ## 项目执行者覆盖
17
+
18
+ | repo ID | CLI | 模型 | 推理强度 | 来源与范围 |
19
+ | --- | --- | --- | --- | --- |
20
+
21
+ 只覆盖有值的字段,每个准确 repo ID 一行。派遣方式由独立配置选定。进入项目后的执行和再派遣遵守当地规则。
22
+
23
+ ## 协作约定
17
24
 
18
- 准确技能名、交互/后台/接管要求、触发条件、交还产物与绑定版本的复核要求:
25
+ 项目交还产物与绑定版本的复核要求:
19
26
 
20
27
  现有规格、验收、资源和本层派遣记录的权威引用:
21
28