agents-inc 0.175.0 → 0.177.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +2 -2
  3. package/dist/chunk-2FE4AJNC.js +164 -0
  4. package/dist/chunk-2FE4AJNC.js.map +1 -0
  5. package/dist/{chunk-U46LYYRA.js → chunk-4SIBDIIO.js} +49 -13
  6. package/dist/chunk-4SIBDIIO.js.map +1 -0
  7. package/dist/chunk-5ZK4IND4.js +30 -0
  8. package/dist/chunk-5ZK4IND4.js.map +1 -0
  9. package/dist/{chunk-GNMRXXRY.js → chunk-77SHXTDD.js} +137 -56
  10. package/dist/chunk-77SHXTDD.js.map +1 -0
  11. package/dist/{chunk-EHEBN4NB.js → chunk-7OJ2SS4E.js} +10 -86
  12. package/dist/chunk-7OJ2SS4E.js.map +1 -0
  13. package/dist/{chunk-6HJVH27C.js → chunk-7WN6TUZP.js} +7 -8
  14. package/dist/chunk-7WN6TUZP.js.map +1 -0
  15. package/dist/chunk-AVKX3IXF.js +117 -0
  16. package/dist/chunk-AVKX3IXF.js.map +1 -0
  17. package/dist/{chunk-YM3VEDAP.js → chunk-D2PC7NIR.js} +2042 -1875
  18. package/dist/chunk-D2PC7NIR.js.map +1 -0
  19. package/dist/{chunk-37QFHJUW.js → chunk-E6W3PYGF.js} +909 -80
  20. package/dist/chunk-E6W3PYGF.js.map +1 -0
  21. package/dist/chunk-H33ZAEKH.js +147 -0
  22. package/dist/chunk-H33ZAEKH.js.map +1 -0
  23. package/dist/{chunk-MFCZARV2.js → chunk-JEFVFZAR.js} +50 -152
  24. package/dist/chunk-JEFVFZAR.js.map +1 -0
  25. package/dist/{chunk-TG3SPPZY.js → chunk-KKGJH46C.js} +3 -21
  26. package/dist/chunk-KKGJH46C.js.map +1 -0
  27. package/dist/chunk-OIQKRXHH.js +142 -0
  28. package/dist/chunk-OIQKRXHH.js.map +1 -0
  29. package/dist/{chunk-SNXEYAFP.js → chunk-TNN72UL6.js} +294 -247
  30. package/dist/chunk-TNN72UL6.js.map +1 -0
  31. package/dist/{chunk-Q4NWATGH.js → chunk-V3WJMNBF.js} +98 -23
  32. package/dist/chunk-V3WJMNBF.js.map +1 -0
  33. package/dist/chunk-VFD2XYM7.js +14 -0
  34. package/dist/chunk-VFD2XYM7.js.map +1 -0
  35. package/dist/{chunk-XYBHH3M5.js → chunk-WH7JXGDA.js} +2 -2
  36. package/dist/{chunk-DQB3E2SX.js → chunk-XSR4WRXJ.js} +3 -3
  37. package/dist/{chunk-EGC7PNDI.js → chunk-Y5VMB73R.js} +302 -119
  38. package/dist/chunk-Y5VMB73R.js.map +1 -0
  39. package/dist/chunk-ZIBWVTLN.js +18 -0
  40. package/dist/chunk-ZIBWVTLN.js.map +1 -0
  41. package/dist/commands/build/marketplace.js +6 -9
  42. package/dist/commands/build/marketplace.js.map +1 -1
  43. package/dist/commands/build/plugins.js +10 -38
  44. package/dist/commands/build/plugins.js.map +1 -1
  45. package/dist/commands/compile.js +64 -81
  46. package/dist/commands/compile.js.map +1 -1
  47. package/dist/commands/doctor.js +266 -153
  48. package/dist/commands/doctor.js.map +1 -1
  49. package/dist/commands/edit.js +84 -158
  50. package/dist/commands/edit.js.map +1 -1
  51. package/dist/commands/eject.js +66 -52
  52. package/dist/commands/eject.js.map +1 -1
  53. package/dist/commands/init.js +19 -16
  54. package/dist/commands/list.js +13 -13
  55. package/dist/commands/list.js.map +1 -1
  56. package/dist/commands/new/marketplace.js +5 -4
  57. package/dist/commands/new/marketplace.js.map +1 -1
  58. package/dist/commands/search.js +18 -12
  59. package/dist/commands/search.js.map +1 -1
  60. package/dist/commands/share.js +27 -52
  61. package/dist/commands/share.js.map +1 -1
  62. package/dist/commands/uninstall.js +145 -58
  63. package/dist/commands/uninstall.js.map +1 -1
  64. package/dist/commands/update.js +101 -36
  65. package/dist/commands/update.js.map +1 -1
  66. package/dist/components/common/header-row.js +9 -0
  67. package/dist/components/common/select-list.js +2 -2
  68. package/dist/components/common/skill-agent-summary.js +4 -3
  69. package/dist/components/common/summary-panel.js +6 -4
  70. package/dist/hooks/init.js +35 -21
  71. package/dist/hooks/init.js.map +1 -1
  72. package/dist/load-agent-defs-OCFWOZD2.js +14 -0
  73. package/dist/{recompile-project-agents-2QTFMYDC.js → recompile-project-agents-CXZBPIUS.js} +9 -9
  74. package/dist/{recompile-project-agents-2QTFMYDC.js.map → recompile-project-agents-CXZBPIUS.js.map} +1 -1
  75. package/dist/{source-loader-I6SWWDUF.js → source-loader-GGDQDMN4.js} +6 -4
  76. package/dist/source-loader-GGDQDMN4.js.map +1 -0
  77. package/package.json +1 -1
  78. package/src/schemas/stacks.schema.json +105 -1
  79. package/dist/chunk-37QFHJUW.js.map +0 -1
  80. package/dist/chunk-6HJVH27C.js.map +0 -1
  81. package/dist/chunk-EGC7PNDI.js.map +0 -1
  82. package/dist/chunk-EHEBN4NB.js.map +0 -1
  83. package/dist/chunk-GNMRXXRY.js.map +0 -1
  84. package/dist/chunk-ICHWAFAC.js +0 -263
  85. package/dist/chunk-ICHWAFAC.js.map +0 -1
  86. package/dist/chunk-MFCZARV2.js.map +0 -1
  87. package/dist/chunk-P5XEK7HC.js +0 -35
  88. package/dist/chunk-P5XEK7HC.js.map +0 -1
  89. package/dist/chunk-Q4NWATGH.js.map +0 -1
  90. package/dist/chunk-SI2LLEIR.js +0 -160
  91. package/dist/chunk-SI2LLEIR.js.map +0 -1
  92. package/dist/chunk-SNXEYAFP.js.map +0 -1
  93. package/dist/chunk-SRII2GMF.js +0 -428
  94. package/dist/chunk-SRII2GMF.js.map +0 -1
  95. package/dist/chunk-TG3SPPZY.js.map +0 -1
  96. package/dist/chunk-U46LYYRA.js.map +0 -1
  97. package/dist/chunk-YLFKFVQP.js +0 -39
  98. package/dist/chunk-YLFKFVQP.js.map +0 -1
  99. package/dist/chunk-YM3VEDAP.js.map +0 -1
  100. package/dist/load-agent-defs-BJ4KBKBA.js +0 -14
  101. /package/dist/{chunk-XYBHH3M5.js.map → chunk-WH7JXGDA.js.map} +0 -0
  102. /package/dist/{chunk-DQB3E2SX.js.map → chunk-XSR4WRXJ.js.map} +0 -0
  103. /package/dist/{load-agent-defs-BJ4KBKBA.js.map → components/common/header-row.js.map} +0 -0
  104. /package/dist/{source-loader-I6SWWDUF.js.map → load-agent-defs-OCFWOZD2.js.map} +0 -0
@@ -1,25 +1,35 @@
1
1
  #!/usr/bin/env node
2
- import "../chunk-SI2LLEIR.js";
2
+ import {
3
+ mapInTurn
4
+ } from "../chunk-VFD2XYM7.js";
5
+ import "../chunk-5ZK4IND4.js";
3
6
  import {
4
7
  filterExcludedEntries,
5
8
  listAgentFilesOf,
6
9
  listAgentMdFiles,
7
10
  splitAgentsByProvenance
8
- } from "../chunk-GNMRXXRY.js";
11
+ } from "../chunk-77SHXTDD.js";
9
12
  import {
10
13
  BaseCommand,
11
14
  EXIT_CODES,
12
- ambiguityFinding
13
- } from "../chunk-37QFHJUW.js";
15
+ ambiguityFinding,
16
+ placementsAskedIn,
17
+ refusalsAmong
18
+ } from "../chunk-E6W3PYGF.js";
19
+ import "../chunk-2FE4AJNC.js";
14
20
  import {
15
21
  ConfigDefaultExportError,
22
+ ConfigEvaluationError,
16
23
  ConfigLoadError,
24
+ ConfigSchemaError,
17
25
  INFO_MESSAGES,
18
26
  MarketplaceManifestRequiredError,
19
27
  MarketplaceNameRefusedError,
20
28
  MarketplaceRefusedError,
21
29
  MarketplaceUnreachableError,
30
+ NoSkillRulesError,
22
31
  SOURCE_ENV_VAR,
32
+ StacksLoadError,
23
33
  agentCodec,
24
34
  agentYamlGenerationSchema,
25
35
  agentsDir,
@@ -34,14 +44,13 @@ import {
34
44
  formatZodErrors,
35
45
  getErrorMessage,
36
46
  getInstalledPluginsRegistryPath,
47
+ getPluginsBySwitch,
37
48
  getProjectConfigPath,
38
49
  getProjectPluginsDir,
39
50
  getStackSkillIds,
40
51
  getUserPluginsDir,
41
- getVerifiedPluginInstallPaths,
42
52
  glob,
43
53
  hostCompilesAgent,
44
- hostFor,
45
54
  inheritedGlobalProvider,
46
55
  installBaseDir,
47
56
  invalidResult,
@@ -63,14 +72,16 @@ import {
63
72
  parseMarketplacePluginRef,
64
73
  providerArgument,
65
74
  providerInUse,
75
+ providerToNameAt,
66
76
  readFile,
67
77
  readForkedFromMetadata,
68
78
  readSkillMetadata,
69
79
  recreateConfigFrom,
70
- refuseUnofferedPlacements,
71
80
  relativeConfigPath,
72
81
  resolveInstallPaths,
73
82
  resolvePrimarySourceEntry,
83
+ resultFrom,
84
+ scopeAt,
74
85
  scopeLabel,
75
86
  scopeNoun,
76
87
  scopeRootsInPlay,
@@ -89,12 +100,11 @@ import {
89
100
  validateProjectConfig,
90
101
  validateSkillFrontmatter,
91
102
  validateSkillMetadata
92
- } from "../chunk-YM3VEDAP.js";
103
+ } from "../chunk-D2PC7NIR.js";
93
104
  import {
94
105
  matrix,
95
- plural,
96
- typedValues
97
- } from "../chunk-TG3SPPZY.js";
106
+ plural
107
+ } from "../chunk-KKGJH46C.js";
98
108
  import {
99
109
  CLI_INVOKE_COMMAND,
100
110
  DEFAULT_BRANDING,
@@ -108,8 +118,9 @@ import {
108
118
  STACKS_FILE_PATH,
109
119
  STANDARD_FILES,
110
120
  UI_SYMBOLS,
111
- effectivelyExcludedSkillIds
112
- } from "../chunk-U46LYYRA.js";
121
+ effectivelyExcludedSkillIds,
122
+ typedValues
123
+ } from "../chunk-4SIBDIIO.js";
113
124
  import "../chunk-GHHJYNAN.js";
114
125
 
115
126
  // src/cli/commands/doctor.ts
@@ -148,9 +159,7 @@ async function resolveConfigState({
148
159
  }
149
160
  async function readConfigState(projectDir, hosts) {
150
161
  const own = await loadProjectConfigFromDir(projectDir, hosts.project);
151
- if (own && !declaresNoContent(own.config)) {
152
- return { kind: "loaded", config: own.config, inherited: false };
153
- }
162
+ if (own && !declaresNoContent(own.config)) return ownConfigState(own.config, projectDir, hosts);
154
163
  const inherited = isHomeDirectory(projectDir) ? null : await loadProjectConfigFromDir(os.homedir(), hosts.global);
155
164
  if (inherited && !declaresNoContent(inherited.config)) {
156
165
  return {
@@ -162,42 +171,42 @@ async function readConfigState(projectDir, hosts) {
162
171
  }
163
172
  return own ? { kind: "declares-nothing", config: own.config } : { kind: "absent" };
164
173
  }
174
+ async function ownConfigState(config, projectDir, hosts) {
175
+ const failure = isHomeDirectory(projectDir) ? null : await globalConfigLoadFailure(hosts);
176
+ return failure === null ? { kind: "loaded", config, inherited: false } : { kind: "global-unreadable", config, failure };
177
+ }
178
+ async function globalConfigLoadFailure(hosts) {
179
+ try {
180
+ await loadProjectConfigFromDir(os.homedir(), hosts.global);
181
+ return null;
182
+ } catch (error) {
183
+ if (error instanceof ConfigLoadError) return error;
184
+ throw error;
185
+ }
186
+ }
165
187
  async function providerDeclaringNothingIn(projectDir) {
166
188
  const [leftover] = await configsDeclaringNothing(projectDir);
167
189
  return leftover === void 0 ? null : leftover.provider;
168
190
  }
169
191
  async function installedPluginSkillIds(baseDir, provider) {
170
- const plugins = await getVerifiedPluginInstallPaths(baseDir, provider);
192
+ const { enabled, switchedOff } = await getPluginsBySwitch(baseDir, provider);
193
+ return { enabled: skillIdsOf(enabled), switchedOff: skillIdsOf(switchedOff) };
194
+ }
195
+ function skillIdsOf(plugins) {
171
196
  return new Set(plugins.map((plugin) => parseMarketplacePluginRef(plugin.pluginKey)));
172
197
  }
173
- async function unofferablePlacements({
198
+ async function placementsOffered({
174
199
  projectDir,
175
200
  hosts
176
201
  }) {
177
202
  const projectFirst = [...scopeRootsInPlay(projectDir)].reverse();
178
- const findings = await Promise.all(
179
- projectFirst.map(({ kind, root }) => unofferablePlacementIn(root, hosts[kind]))
203
+ const asked = await Promise.all(
204
+ projectFirst.map(({ kind, root }) => placementsAskedIn({ dir: root, provider: hosts[kind] }))
180
205
  );
181
- return findings.filter((finding) => finding !== null);
182
- }
183
- async function unofferablePlacementIn(root, provider) {
184
- const skills = await configuredSkillsAt(root, provider);
185
- if (skills === null) return null;
186
- try {
187
- refuseUnofferedPlacements(skills, hostFor(provider));
188
- return null;
189
- } catch (error) {
190
- return getErrorMessage(error);
191
- }
192
- }
193
- async function configuredSkillsAt(root, provider) {
194
- try {
195
- const loaded = await loadProjectConfigFromDir(root, provider);
196
- return loaded?.config.skills ?? null;
197
- } catch (error) {
198
- if (error instanceof ConfigLoadError) return null;
199
- throw error;
200
- }
206
+ return {
207
+ configuresASkill: asked.some(({ skills }) => skills.length > 0),
208
+ findings: refusalsAmong(asked)
209
+ };
201
210
  }
202
211
 
203
212
  // src/cli/lib/doctor/ownership.ts
@@ -287,6 +296,7 @@ async function validateSource(sourcePath, reader = "author") {
287
296
  }
288
297
  const sourceProjectConfig = await loadSourceRepoConfig(resolvedPath);
289
298
  const skillsDirRelPath = sourceProjectConfig?.skillsDir ?? SKILLS_DIR_PATH;
299
+ const stacksRelFile = sourceProjectConfig?.stacksFile ?? STACKS_FILE_PATH;
290
300
  const skillsDir2 = path.join(resolvedPath, skillsDirRelPath);
291
301
  if (!await directoryExists(skillsDir2)) {
292
302
  return buildResult(
@@ -296,11 +306,11 @@ async function validateSource(sourcePath, reader = "author") {
296
306
  }
297
307
  const { pairIssues, validMetadataFiles } = await pairSkillFiles(skillsDir2);
298
308
  const skillIssues = await validateSkillsInTurn(skillsDir2, skillsDirRelPath, validMetadataFiles);
299
- const crossReferenceIssues = await checkCrossReferences(resolvedPath, reader);
309
+ const crossReferenceIssues = await checkCrossReferences(resolvedPath, stacksRelFile, reader);
300
310
  const extraIssues = await Promise.all([
301
311
  validateStacks(resolvedPath),
302
312
  validateAgents(resolvedPath),
303
- validateConfigFiles(resolvedPath)
313
+ validateConfigFiles(resolvedPath, stacksRelFile)
304
314
  ]);
305
315
  return buildResult(
306
316
  [...pairIssues, ...skillIssues, ...crossReferenceIssues, ...extraIssues.flat()],
@@ -308,8 +318,10 @@ async function validateSource(sourcePath, reader = "author") {
308
318
  );
309
319
  }
310
320
  async function pairSkillFiles(skillsDir2) {
311
- const skillMdFiles = await glob(`**/${STANDARD_FILES.SKILL_MD}`, skillsDir2);
312
- const metadataFiles = await glob(`**/${STANDARD_FILES.METADATA_YAML}`, skillsDir2);
321
+ const [skillMdFiles, metadataFiles] = await Promise.all([
322
+ glob(`**/${STANDARD_FILES.SKILL_MD}`, skillsDir2),
323
+ glob(`**/${STANDARD_FILES.METADATA_YAML}`, skillsDir2)
324
+ ]);
313
325
  const skillMdDirs = new Set(skillMdFiles.map((f) => path.dirname(f)));
314
326
  const metadataDirs = new Set(metadataFiles.map((f) => path.dirname(f)));
315
327
  return {
@@ -356,17 +368,31 @@ var MANIFEST_REQUIRED_SEVERITY = {
356
368
  author: "warning",
357
369
  consumer: "error"
358
370
  };
359
- async function checkCrossReferences(resolvedPath, reader) {
371
+ async function checkCrossReferences(resolvedPath, stacksRelFile, reader) {
360
372
  try {
361
373
  await loadSkillsMatrixFromSource({ sourceFlag: resolvedPath, skipExtraSources: true });
362
374
  return matrixHealthIssues(matrix).map(
363
375
  (healthIssue) => toSourceIssue(healthIssue, resolvedPath, reader)
364
376
  );
365
377
  } catch (error) {
366
- return [matrixLoadFailure(error, reader)];
378
+ const failedFile = fileThatFailedToLoad(error, resolvedPath, stacksRelFile);
379
+ return [matrixLoadFailure(error, reader, failedFile)];
380
+ }
381
+ }
382
+ function fileThatFailedToLoad(error, resolvedPath, stacksRelFile) {
383
+ if (error instanceof StacksLoadError) return stacksRelFile;
384
+ if (configThatFailedToLoad(error) === path.join(resolvedPath, SKILL_RULES_PATH)) {
385
+ return SKILL_RULES_PATH;
386
+ }
387
+ return void 0;
388
+ }
389
+ function configThatFailedToLoad(error) {
390
+ if (error instanceof ConfigEvaluationError || error instanceof ConfigDefaultExportError || error instanceof ConfigSchemaError || error instanceof NoSkillRulesError) {
391
+ return error.configPath;
367
392
  }
393
+ return void 0;
368
394
  }
369
- function matrixLoadFailure(error, reader) {
395
+ function matrixLoadFailure(error, reader, failedFile) {
370
396
  if (error instanceof MarketplaceManifestRequiredError) {
371
397
  return {
372
398
  severity: MANIFEST_REQUIRED_SEVERITY[reader],
@@ -381,10 +407,14 @@ function matrixLoadFailure(error, reader) {
381
407
  message: getErrorMessage(error)
382
408
  };
383
409
  }
410
+ if (failedFile !== void 0) return crossReferenceSkipped(failedFile, failedFile, error);
411
+ return crossReferenceSkipped(SKILL_CATEGORIES_PATH, "categories/rules", error);
412
+ }
413
+ function crossReferenceSkipped(file, whatFailed, error) {
384
414
  return {
385
415
  severity: "warning",
386
- file: SKILL_CATEGORIES_PATH,
387
- message: `Cross-reference validation skipped: failed to load categories/rules: ${getErrorMessage(error)}`
416
+ file,
417
+ message: `Cross-reference validation skipped: failed to load ${whatFailed}: ${getErrorMessage(error)}`
388
418
  };
389
419
  }
390
420
  var SKILL_AUDIT_PATH = "src/cli/lib/configuration/skill-audit.ts";
@@ -452,21 +482,18 @@ async function validateAgents(resolvedPath) {
452
482
  schema: agentYamlGenerationSchema
453
483
  });
454
484
  }
455
- async function validateConfigFiles(resolvedPath) {
485
+ async function validateConfigFiles(resolvedPath, stacksRelFile) {
456
486
  const results = await Promise.all([
457
487
  validateTsConfig(resolvedPath, SKILL_CATEGORIES_PATH, skillCategoriesFileSchema),
458
488
  validateTsConfig(resolvedPath, SKILL_RULES_PATH, skillRulesFileSchema),
459
- validateTsConfig(resolvedPath, STACKS_FILE_PATH, stacksConfigSchema)
489
+ validateTsConfig(resolvedPath, stacksRelFile, stacksConfigSchema)
460
490
  ]);
461
491
  return results.flat();
462
492
  }
463
493
  async function validateYamlFiles(scan) {
464
- const issues = [];
465
494
  const files = await glob(scan.pattern, scan.baseDir);
466
- for (const relFile of files) {
467
- issues.push(...await validateYamlFile(scan, relFile));
468
- }
469
- return issues;
495
+ const issuesPerFile = await Promise.all(files.map((relFile) => validateYamlFile(scan, relFile)));
496
+ return issuesPerFile.flat();
470
497
  }
471
498
  async function validateYamlFile(scan, relFile) {
472
499
  const displayPath = path.join(scan.relBaseDir, relFile);
@@ -515,16 +542,15 @@ function buildResult(issues, skillCount) {
515
542
 
516
543
  // src/cli/lib/content-validator.ts
517
544
  var CWD_SOURCE_NAME = "current directory";
518
- var NOTHING_VALIDATED = { count: 0, issues: [], notes: [] };
545
+ function nothingValidated() {
546
+ return { count: 0, issues: [], notes: [] };
547
+ }
519
548
  function mergeValidations(parts) {
520
- return parts.reduce(
521
- (acc, part) => ({
522
- count: acc.count + part.count,
523
- issues: [...acc.issues, ...part.issues],
524
- notes: [...acc.notes, ...part.notes]
525
- }),
526
- NOTHING_VALIDATED
527
- );
549
+ return {
550
+ count: parts.reduce((sum, part) => sum + part.count, 0),
551
+ issues: parts.flatMap((part) => part.issues),
552
+ notes: parts.flatMap((part) => part.notes)
553
+ };
528
554
  }
529
555
  function displayDir(absolutePath) {
530
556
  const home = os2.homedir();
@@ -540,6 +566,10 @@ function toIssues(file, result) {
540
566
  ...result.warnings.map((message) => ({ severity: "warning", file, message }))
541
567
  ];
542
568
  }
569
+ async function entryIssues(dir, name, validate) {
570
+ const entryPath = path2.join(dir, name);
571
+ return toIssues(displayDir(entryPath), await validate(entryPath));
572
+ }
543
573
  var CONFIG_UNREADABLE = "exists but could not be loaded";
544
574
  async function validateProjectConfigFile(projectDir) {
545
575
  const [present, failures] = await Promise.all([
@@ -612,13 +642,13 @@ async function validateInstalledPlugins(projectDir) {
612
642
  return mergeValidations(await Promise.all(dirs.map(validatePluginsDirectory)));
613
643
  }
614
644
  async function validatePluginsDirectory(pluginsDir) {
615
- if (!await directoryExists(pluginsDir)) return NOTHING_VALIDATED;
645
+ if (!await directoryExists(pluginsDir)) return nothingValidated();
616
646
  if (await fileExists(getInstalledPluginsRegistryPath(pluginsDir))) {
617
647
  const registryValidation = await validateRegistryPlugins(pluginsDir);
618
648
  if (registryValidation !== void 0) return registryValidation;
619
649
  }
620
650
  const pluginDirs = await listPluginDirNames(pluginsDir);
621
- if (pluginDirs.length === 0) return NOTHING_VALIDATED;
651
+ if (pluginDirs.length === 0) return nothingValidated();
622
652
  const { results } = await validateAllPlugins(pluginsDir);
623
653
  return {
624
654
  count: results.length,
@@ -708,18 +738,15 @@ async function listDisplayPaths(dir, listEntries) {
708
738
  return entries.map((entry) => displayDir(path2.join(dir, entry)));
709
739
  }
710
740
  async function validateSkillsDirectory(skillsDir2, configuredIds) {
711
- if (!await directoryExists(skillsDir2)) return NOTHING_VALIDATED;
741
+ if (!await directoryExists(skillsDir2)) return nothingValidated();
712
742
  const skillDirs = await listDirectories(skillsDir2);
713
- if (skillDirs.length === 0) return NOTHING_VALIDATED;
743
+ if (skillDirs.length === 0) return nothingValidated();
714
744
  const [ours, foreign] = await partitionByVerdict(
715
745
  skillDirs,
716
746
  (name) => isOurSkillDirectory(skillsDir2, name, configuredIds)
717
747
  );
718
748
  const results = await Promise.all(
719
- ours.map(async (name) => {
720
- const skillDir = path2.join(skillsDir2, name);
721
- return toIssues(displayDir(skillDir), await validateInstalledSkill(skillDir));
722
- })
749
+ ours.map((name) => entryIssues(skillsDir2, name, validateInstalledSkill))
723
750
  );
724
751
  return {
725
752
  count: ours.length,
@@ -738,14 +765,11 @@ function foreignSkillNote(skillsDir2, name) {
738
765
  return `${displayDir(path2.join(skillsDir2, name))} \u2014 not installed by this CLI and named by no configuration here: not validated`;
739
766
  }
740
767
  async function validateAgentsDirectory(agentsDir2) {
741
- if (!await directoryExists(agentsDir2)) return NOTHING_VALIDATED;
768
+ if (!await directoryExists(agentsDir2)) return nothingValidated();
742
769
  const agentFiles = await listAgentMdFiles(agentsDir2);
743
- if (agentFiles.length === 0) return NOTHING_VALIDATED;
770
+ if (agentFiles.length === 0) return nothingValidated();
744
771
  const results = await Promise.all(
745
- agentFiles.map(async (fileName) => {
746
- const agentPath = path2.join(agentsDir2, fileName);
747
- return toIssues(displayDir(agentPath), await validateAgentFrontmatter(agentPath));
748
- })
772
+ agentFiles.map((fileName) => entryIssues(agentsDir2, fileName, validateAgentFrontmatter))
749
773
  );
750
774
  return { count: agentFiles.length, issues: results.flat(), notes: [] };
751
775
  }
@@ -772,11 +796,10 @@ async function validateInstalledSkillMetadata(metadataPath) {
772
796
  return validResult();
773
797
  }
774
798
  const { errors, warnings } = splitMetadataValidationIssues(result.error, metadata);
775
- return {
776
- valid: errors.length === 0,
777
- errors: errors.map((e) => `${STANDARD_FILES.METADATA_YAML}: ${e}`),
778
- warnings: warnings.map((w) => `${STANDARD_FILES.METADATA_YAML}: ${w}`)
779
- };
799
+ return resultFrom(
800
+ errors.map((e) => `${STANDARD_FILES.METADATA_YAML}: ${e}`),
801
+ warnings.map((w) => `${STANDARD_FILES.METADATA_YAML}: ${w}`)
802
+ );
780
803
  }
781
804
 
782
805
  // src/cli/lib/doctor/ownership.ts
@@ -847,7 +870,7 @@ async function unclaimedAgentFiles({ dir, codec, claimed: claimed2 }) {
847
870
  }
848
871
 
849
872
  // src/cli/commands/doctor.ts
850
- import { countBy, unique as unique2 } from "remeda";
873
+ import { countBy, partition as partition2, unique as unique2 } from "remeda";
851
874
  function checkConfigValid(state, installation) {
852
875
  const theConfig = (verdict) => configRowMessage(state, installation, verdict);
853
876
  switch (state.kind) {
@@ -862,14 +885,11 @@ function checkConfigValid(state, installation) {
862
885
  config: null
863
886
  };
864
887
  case "unreadable":
888
+ return { result: unloadableConfigResult(state.failure, theConfig), config: null };
889
+ case "global-unreadable":
865
890
  return {
866
- result: {
867
- kind: "config",
868
- status: "fail",
869
- message: theConfig("exists but could not be loaded"),
870
- details: [state.failure.reason]
871
- },
872
- config: null
891
+ result: unloadableConfigResult(state.failure, theConfig),
892
+ config: checkLoadedConfig(state.config, theConfig).config
873
893
  };
874
894
  case "declares-nothing":
875
895
  return {
@@ -888,6 +908,14 @@ function checkConfigValid(state, installation) {
888
908
  }
889
909
  }
890
910
  }
911
+ function unloadableConfigResult(failure, theConfig) {
912
+ return {
913
+ kind: "config",
914
+ status: "fail",
915
+ message: theConfig("exists but could not be loaded"),
916
+ details: [failure.reason]
917
+ };
918
+ }
891
919
  function checkLoadedConfig(config, theConfig) {
892
920
  const validation = validateProjectConfig(config);
893
921
  if (!validation.valid) {
@@ -924,22 +952,19 @@ function checkLoadedConfig(config, theConfig) {
924
952
  function configRowMessage(state, { projectDir, hosts }, verdict) {
925
953
  if (state.kind === "loaded" && state.inherited)
926
954
  return `${theInheritedConfig(projectDir, state.declaringNothingIn, hosts.global)}, which ${verdict}`;
927
- if (state.kind === "unreadable") {
955
+ if (state.kind === "unreadable" || state.kind === "global-unreadable") {
928
956
  const { scopeRoot, scope } = state.failure;
929
957
  return `${theConfigAt(scopeRoot, hosts[scope])} ${verdict}`;
930
958
  }
931
959
  return `${theConfigAt(projectDir, hosts.project)} ${verdict}`;
932
960
  }
933
961
  function theConfigAt(root, provider) {
934
- return `${scopeLabel(scopeOf(root))}: ${configNamedFrom(root, provider)}`;
962
+ return `${scopeLabel(scopeAt(root))}: ${configNamedFrom(root, provider)}`;
935
963
  }
936
964
  function theInheritedConfig(projectDir, declaringNothingIn, provider) {
937
965
  const projectHolds = declaringNothingIn === null ? `no ${STANDARD_FILES.CONFIG_TS}` : `${relativeConfigPath(projectDir, declaringNothingIn)} declares nothing`;
938
966
  return `${scopeLabel("project")}: ${projectHolds}, using ${scopeNoun("global")}'s (${configNamedFrom(os3.homedir(), provider)})`;
939
967
  }
940
- function scopeOf(dir) {
941
- return isHomeDirectory(dir) ? "global" : "project";
942
- }
943
968
  function configNamedFrom(root, provider) {
944
969
  const relPath = relativeConfigPath(root, provider);
945
970
  return isHomeDirectory(root) ? `~/${relPath}` : relPath;
@@ -1028,11 +1053,12 @@ async function checkNoOrphans(state, config, installation) {
1028
1053
  return ownershipResult(state, await judgeOwnership(state, config, installation));
1029
1054
  }
1030
1055
  function ownershipResult(state, { unowned, orphanedAgentFiles }) {
1031
- if (unowned.skills.length > 0 || unowned.agents.length > 0) {
1056
+ const unownedCount = unowned.skills.length + unowned.agents.length;
1057
+ if (unownedCount > 0) {
1032
1058
  return {
1033
1059
  kind: "orphans-unowned",
1034
1060
  status: "fail",
1035
- message: `${countedArtifacts(unowned.skills, unowned.agents)} installed here, and no configuration declares them`,
1061
+ message: `${countedArtifacts(unowned.skills, unowned.agents)} installed here, and no configuration declares ${unownedCount === 1 ? "it" : "them"}`,
1036
1062
  details: [...unowned.skills, ...unowned.agents, ...orphanLines(orphanedAgentFiles)].map(
1037
1063
  (line) => `- ${line}`
1038
1064
  )
@@ -1061,7 +1087,7 @@ function countedArtifacts(skills, agents) {
1061
1087
  function nonZeroCounts(...counts) {
1062
1088
  return counts.filter(([count]) => count > 0).map(([count, noun]) => plural(count, noun)).join(" and ");
1063
1089
  }
1064
- async function checkSkillsInstalled(config, installation) {
1090
+ async function checkSkillsInstalled(config, installation, published) {
1065
1091
  const ejectSkills = config.skills.filter((s) => s.origin === EJECT_SOURCE);
1066
1092
  if (ejectSkills.length === 0) {
1067
1093
  return {
@@ -1079,7 +1105,9 @@ async function checkSkillsInstalled(config, installation) {
1079
1105
  kind: "installed",
1080
1106
  status: "warn",
1081
1107
  message: `${plural(missingSkills.length, "skill")} missing from disk`,
1082
- details: missingSkills.map((s) => `- ${s.id} (not found in ${s.lookedIn}/)`)
1108
+ details: missingSkills.map((s) => `- ${s.id} (not found in ${s.lookedIn}/)`),
1109
+ tipKinds: await missingSkillsTips(missingSkills, installation, published),
1110
+ providerAtHome: providerToNameAt(os3.homedir(), installation.hosts.global)
1083
1111
  };
1084
1112
  }
1085
1113
  return {
@@ -1088,12 +1116,50 @@ async function checkSkillsInstalled(config, installation) {
1088
1116
  message: `${ratio(ejectSkills.length, ejectSkills.length, "eject-mode skill")} installed`
1089
1117
  };
1090
1118
  }
1119
+ function missingSkillsTips(missingSkills, installation, published) {
1120
+ const scopes = unique2(missingSkills.map((check) => check.scope));
1121
+ return Promise.all(
1122
+ scopes.map(
1123
+ (scope) => missingFromOnePlaceTip(
1124
+ scope,
1125
+ missingSkills.filter((check) => check.scope === scope),
1126
+ installation,
1127
+ published
1128
+ )
1129
+ )
1130
+ );
1131
+ }
1132
+ async function missingFromOnePlaceTip(scope, missingSkills, installation, published) {
1133
+ const atHome = scope !== scopeAt(installation.projectDir);
1134
+ if (await ejectRestoresEvery(missingSkills, installation, published)) {
1135
+ return atHome ? "installed-at-home" : "installed";
1136
+ }
1137
+ return atHome ? "installed-take-out-at-home" : "installed-take-out";
1138
+ }
1139
+ var EDITOR_ADDED_SKILL_ID_PREFIX = "external-";
1140
+ async function ejectRestoresEvery(missingSkills, { projectDir, hosts }, published) {
1141
+ const unrestorable = missingSkills.some(
1142
+ (check) => check.id.startsWith(EDITOR_ADDED_SKILL_ID_PREFIX) || noLongerPublished(check, published)
1143
+ );
1144
+ if (unrestorable) return false;
1145
+ const globalSkillsDir = skillsDir(hosts.global, "global", projectDir);
1146
+ const heldGlobally = await Promise.all(
1147
+ missingSkills.map(
1148
+ (check) => fileExists(path4.join(globalSkillsDir, check.id, STANDARD_FILES.SKILL_MD))
1149
+ )
1150
+ );
1151
+ return !heldGlobally.includes(true);
1152
+ }
1153
+ function noLongerPublished(check, published) {
1154
+ return published !== null && !published.has(check.id);
1155
+ }
1091
1156
  async function ejectedSkillCheck(skill, { projectDir, hosts }) {
1092
1157
  const provider = hosts[skill.scope];
1093
1158
  const dir = skillsDir(provider, skill.scope, projectDir);
1094
1159
  const installed = await fileExists(path4.join(dir, skill.id, STANDARD_FILES.SKILL_MD));
1095
1160
  return {
1096
1161
  id: skill.id,
1162
+ scope: skill.scope,
1097
1163
  installed,
1098
1164
  lookedIn: skillsPathPrefix(provider, skill.scope, projectDir)
1099
1165
  };
@@ -1116,8 +1182,8 @@ async function checkPluginSkillsInstalled(config, installation) {
1116
1182
  return {
1117
1183
  kind: "plugins",
1118
1184
  status: "warn",
1119
- message: `${plural(missingSkills.length, "skill")} not installed as plugins`,
1120
- details: missingSkills.map((s) => `- ${s} (no enabled plugin found)`)
1185
+ message: missingPluginsHeadline(missingSkills),
1186
+ details: missingSkills.map(missingPluginLine)
1121
1187
  };
1122
1188
  }
1123
1189
  return {
@@ -1126,12 +1192,25 @@ async function checkPluginSkillsInstalled(config, installation) {
1126
1192
  message: `${ratio(pluginSkills.length, pluginSkills.length, "plugin-mode skill")} installed`
1127
1193
  };
1128
1194
  }
1195
+ function missingPluginsHeadline(missing) {
1196
+ const [switchedOff, notInstalled] = partition2(missing, (skill) => skill.switchedOff);
1197
+ return [
1198
+ ...notInstalled.length > 0 ? [notInstalledAsPlugins(notInstalled.length)] : [],
1199
+ ...switchedOff.length > 0 ? [pluginsSwitchedOff(switchedOff.length)] : []
1200
+ ].join(" and ");
1201
+ }
1202
+ function notInstalledAsPlugins(count) {
1203
+ return `${plural(count, "skill")} not installed as ${count === 1 ? "a plugin" : "plugins"}`;
1204
+ }
1205
+ function pluginsSwitchedOff(count) {
1206
+ return `${plural(count, "plugin")} switched off`;
1207
+ }
1208
+ function missingPluginLine({ id, switchedOff }) {
1209
+ return `- ${id} ${switchedOff ? "(plugin switched off)" : "(no enabled plugin found)"}`;
1210
+ }
1129
1211
  async function pluginSkillsMissingAt(scope, pluginSkills, { projectDir, hosts }) {
1130
- const installedIds = await installedPluginSkillIds(
1131
- installBaseDir(projectDir, scope),
1132
- hosts[scope]
1133
- );
1134
- return pluginSkills.filter((skill) => skill.scope === scope).filter((skill) => !installedIds.has(skill.id)).map((skill) => skill.id);
1212
+ const installed = await installedPluginSkillIds(installBaseDir(projectDir, scope), hosts[scope]);
1213
+ return pluginSkills.filter((skill) => skill.scope === scope).filter((skill) => !installed.enabled.has(skill.id)).map((skill) => ({ id: skill.id, switchedOff: installed.switchedOff.has(skill.id) }));
1135
1214
  }
1136
1215
  var MARKETPLACE_CHOSEN_BY = {
1137
1216
  flag: "named by this run",
@@ -1164,14 +1243,15 @@ async function checkSourceReachable({
1164
1243
  hosts
1165
1244
  }) {
1166
1245
  try {
1167
- return await askingEachMarketplaceItself(
1168
- async (differingCopiesReplaced) => reachedMarketplace(
1169
- await loadSkillsMatrixFromSource({ projectDir, provider: hosts.project }),
1170
- differingCopiesReplaced
1171
- )
1172
- );
1246
+ return await askingEachMarketplaceItself(async (differingCopiesReplaced) => {
1247
+ const loaded = await loadSkillsMatrixFromSource({ projectDir, provider: hosts.project });
1248
+ return {
1249
+ result: reachedMarketplace(loaded, differingCopiesReplaced),
1250
+ published: loaded.marketplaceSkillIds
1251
+ };
1252
+ });
1173
1253
  } catch (error) {
1174
- return marketplaceNotLoaded(error);
1254
+ return { result: marketplaceNotLoaded(error), published: null };
1175
1255
  }
1176
1256
  }
1177
1257
  var NO_SAVED_COPY_READ = "Doctor asks the marketplace itself, not the saved copy, which other commands still read offline";
@@ -1316,7 +1396,7 @@ var TIPS = [
1316
1396
  {
1317
1397
  kind: "agents",
1318
1398
  status: "warn",
1319
- line: (provider) => ` Tip: Run '${commandActingOn(provider, "compile")}' to generate missing agent files`
1399
+ line: ({ provider }) => ` Tip: Run '${commandActingOn(provider, "compile")}' to generate missing agent files`
1320
1400
  },
1321
1401
  {
1322
1402
  kind: "config",
@@ -1331,7 +1411,7 @@ var TIPS = [
1331
1411
  {
1332
1412
  kind: "orphans-unowned",
1333
1413
  status: "fail",
1334
- line: (provider) => ` Tip: Nothing declares the files above \u2014 '${commandActingOn(provider, "init --from <id>")}' writes a configuration that can own them again, or '${commandActingOn(provider, "uninstall")}' removes them, the compiled agents included: each file listed carries this CLI's own provenance, which is what that command reads when there is no configuration left`
1414
+ line: ({ provider }) => ` Tip: Nothing declares the files above \u2014 '${commandActingOn(provider, "init --from <id>")}' writes a configuration that can own them again, or '${commandActingOn(provider, "uninstall")}' removes them, the compiled agents included: each file listed carries this CLI's own provenance, which is what that command reads when there is no configuration left`
1335
1415
  },
1336
1416
  {
1337
1417
  kind: "skills",
@@ -1341,21 +1421,42 @@ var TIPS = [
1341
1421
  {
1342
1422
  kind: "installed",
1343
1423
  status: "warn",
1344
- // No command named: `eject skills --force` copies every skill, and only at project scope.
1345
- line: () => " Tip: Re-eject the missing skills from the marketplace to restore their files"
1424
+ line: ({ provider }, scope) => bothWaysOut(provider, scopeNoun(scope))
1425
+ },
1426
+ {
1427
+ kind: "installed-take-out",
1428
+ status: "warn",
1429
+ line: ({ provider }) => takeOut(provider)
1430
+ },
1431
+ {
1432
+ kind: "installed-at-home",
1433
+ status: "warn",
1434
+ line: ({ providerAtHome }) => bothWaysOut(providerAtHome, scopeNoun("global"), IN_YOUR_HOME_FOLDER)
1435
+ },
1436
+ {
1437
+ kind: "installed-take-out-at-home",
1438
+ status: "warn",
1439
+ line: ({ providerAtHome }) => takeOut(providerAtHome, IN_YOUR_HOME_FOLDER)
1346
1440
  }
1347
1441
  ];
1348
1442
  function commandActingOn(provider, command) {
1349
1443
  return `${CLI_INVOKE_COMMAND} ${command}${providerArgument(provider)}`;
1350
1444
  }
1351
- function formatTips(results) {
1352
- return unique2(TIPS.flatMap((tip) => linesOf(tip, results)));
1445
+ var IN_YOUR_HOME_FOLDER = " in your home folder";
1446
+ function takeOut(provider, where = "") {
1447
+ return ` Tip: If you removed the missing skills on purpose, take them out with '${commandActingOn(provider, "edit")}'${where}`;
1448
+ }
1449
+ function bothWaysOut(provider, installation, where = "") {
1450
+ return `${takeOut(provider, where)}; to bring them back, run '${commandActingOn(provider, "eject skills")}'${where}, which also copies every other marketplace skill ${installation} lacks`;
1451
+ }
1452
+ function formatTips(results, scope) {
1453
+ return unique2(TIPS.flatMap((tip) => linesOf(tip, results, scope)));
1353
1454
  }
1354
- function linesOf(tip, results) {
1355
- return results.filter((result) => answers(tip, result)).map((result) => tip.line(result.provider));
1455
+ function linesOf(tip, results, scope) {
1456
+ return results.filter((result) => answers(tip, result)).map((result) => tip.line(result, scope));
1356
1457
  }
1357
1458
  function answers(tip, result) {
1358
- return result.kind === tip.kind && result.status === tip.status;
1459
+ return (result.tipKinds ?? [result.kind]).includes(tip.kind) && result.status === tip.status;
1359
1460
  }
1360
1461
  async function recreateConfigTips(contentResults, projectDir) {
1361
1462
  if (!failedContentKinds(contentResults).has(CONFIG_CHECK.kind)) return [];
@@ -1396,16 +1497,23 @@ function toLayoutResult(scope) {
1396
1497
  }
1397
1498
  var PLACEMENTS_ROW_NAME = "Placements Offered";
1398
1499
  async function checkOfferedPlacements(installation) {
1399
- const findings = await unofferablePlacements(installation);
1400
- if (findings.length === 0) {
1401
- return { kind: "placements", status: "pass", message: "Every configured skill is placeable" };
1500
+ const { configuresASkill, findings } = await placementsOffered(installation);
1501
+ if (findings.length > 0) {
1502
+ return {
1503
+ kind: "placements",
1504
+ status: "fail",
1505
+ message: `${plural(findings.length, "finding")} would stop a command acting here`,
1506
+ details: findings.map((finding) => `- ${finding}`)
1507
+ };
1402
1508
  }
1403
- return {
1404
- kind: "placements",
1405
- status: "fail",
1406
- message: `${plural(findings.length, "finding")} would stop a command acting here`,
1407
- details: findings.map((finding) => `- ${finding}`)
1408
- };
1509
+ const message = configuresASkill ? "Every configured skill is placeable" : "No skills configured";
1510
+ return { kind: "placements", status: "pass", message };
1511
+ }
1512
+ function configRejected(config, state) {
1513
+ return config === null && state.kind !== "absent";
1514
+ }
1515
+ function placementsConfigRejected(config, state) {
1516
+ return configRejected(config, state) || state.kind === "global-unreadable";
1409
1517
  }
1410
1518
  function skippedResult(kind) {
1411
1519
  return { kind, status: "skip", message: "Skipped (config invalid)" };
@@ -1431,12 +1539,6 @@ async function runGatedContentCheck(check, projectDir, configUnreadable) {
1431
1539
  if (check.readsConfig && configUnreadable) return skippedContentResult(check.kind);
1432
1540
  return runContentCheck(check, projectDir);
1433
1541
  }
1434
- async function flatMapInTurn(items, step) {
1435
- return items.reduce(
1436
- async (earlier, item) => [...await earlier, ...await step(item)],
1437
- Promise.resolve([])
1438
- );
1439
- }
1440
1542
  async function safeCheck(kind, fn) {
1441
1543
  try {
1442
1544
  return await fn();
@@ -1465,7 +1567,11 @@ var Doctor = class _Doctor extends BaseCommand {
1465
1567
  const contentResults = await this.runContentChecks(projectDir);
1466
1568
  const operationalResults = await this.runOperationalChecks(projectDir, contentResults);
1467
1569
  const results = [...contentResults, ...operationalResults];
1468
- this.printResults(results, await recreateConfigTips(contentResults, projectDir));
1570
+ this.printResults(
1571
+ results,
1572
+ scopeAt(projectDir),
1573
+ await recreateConfigTips(contentResults, projectDir)
1574
+ );
1469
1575
  if (results.some((r) => r.status === "fail")) {
1470
1576
  this.exit(EXIT_CODES.ERROR);
1471
1577
  }
@@ -1532,11 +1638,11 @@ var Doctor = class _Doctor extends BaseCommand {
1532
1638
  () => checkInstallationsInPlay(projectDir, providers)
1533
1639
  );
1534
1640
  this.logCheck(INSTALLATIONS_ROW_NAME, installations);
1535
- const blocks = await flatMapInTurn(
1641
+ const blocks = await mapInTurn(
1536
1642
  providers,
1537
1643
  (provider) => this.checkOneOf(projectDir, provider, failedContent)
1538
1644
  );
1539
- return [installations, ...blocks];
1645
+ return [installations, ...blocks.flat()];
1540
1646
  }
1541
1647
  async checkOneOf(projectDir, provider, failedContent) {
1542
1648
  this.log("");
@@ -1553,12 +1659,9 @@ var Doctor = class _Doctor extends BaseCommand {
1553
1659
  const { result: configResult, config } = checkConfigValid(configState, installation);
1554
1660
  this.logCheck("Config Valid", configResult);
1555
1661
  const layoutResults = await this.reportLayout(installation);
1556
- const placementsResult = await safeCheck(
1557
- "placements",
1558
- () => checkOfferedPlacements(installation)
1559
- );
1662
+ const placementsResult = await this.resolvePlacementsCheck(config, configState, installation);
1560
1663
  this.logCheck(PLACEMENTS_ROW_NAME, placementsResult);
1561
- const sourceResult = await safeCheck("source", () => checkSourceReachable(installation));
1664
+ const { result: sourceResult, published } = await checkSourceReachable(installation);
1562
1665
  const filteredConfig = config ? filterExcludedEntries(config) : null;
1563
1666
  const skillsResult = await this.resolveSkillsCheck(config, sourceResult, failedContent);
1564
1667
  this.logCheck("Skills Resolved", skillsResult);
@@ -1566,7 +1669,11 @@ var Doctor = class _Doctor extends BaseCommand {
1566
1669
  this.logCheck("Agents Compiled", agentsResult);
1567
1670
  const orphansResult = await this.resolveOrphansCheck(config, configState, installation);
1568
1671
  this.logCheck("No Orphans", orphansResult);
1569
- const installedResult = await this.resolveInstalledCheck(filteredConfig, installation);
1672
+ const installedResult = await this.resolveInstalledCheck(
1673
+ filteredConfig,
1674
+ installation,
1675
+ skillsResult.status === "skip" ? null : published
1676
+ );
1570
1677
  this.logCheck("Skills Installed", installedResult);
1571
1678
  const pluginsResult = await this.resolvePluginsCheck(
1572
1679
  filteredConfig,
@@ -1594,9 +1701,14 @@ var Doctor = class _Doctor extends BaseCommand {
1594
1701
  }
1595
1702
  return rows;
1596
1703
  }
1704
+ /** Stands down over a rejected config; an absent one asks for no placement, which it says. */
1705
+ async resolvePlacementsCheck(config, configState, installation) {
1706
+ if (placementsConfigRejected(config, configState)) return skippedResult("placements");
1707
+ return safeCheck("placements", () => checkOfferedPlacements(installation));
1708
+ }
1597
1709
  /** Skips on a config the checks rejected: ownership can't be judged from a rejected file. */
1598
1710
  async resolveOrphansCheck(config, configState, installation) {
1599
- if (!config && configState.kind !== "absent") return skippedResult("orphans");
1711
+ if (configRejected(config, configState)) return skippedResult("orphans");
1600
1712
  return safeCheck("orphans", () => checkNoOrphans(configState, config, installation));
1601
1713
  }
1602
1714
  async resolveSkillsCheck(config, sourceResult, failedContent) {
@@ -1610,9 +1722,10 @@ var Doctor = class _Doctor extends BaseCommand {
1610
1722
  if (!config) return skippedResult("agents");
1611
1723
  return safeCheck("agents", () => checkAgentsCompiled(config, installation));
1612
1724
  }
1613
- async resolveInstalledCheck(config, installation) {
1725
+ /** `published`: the marketplace's own skills, or null where Skills Resolved stood down. */
1726
+ async resolveInstalledCheck(config, installation, published) {
1614
1727
  if (!config) return skippedResult("installed");
1615
- return safeCheck("installed", () => checkSkillsInstalled(config, installation));
1728
+ return safeCheck("installed", () => checkSkillsInstalled(config, installation, published));
1616
1729
  }
1617
1730
  async resolvePluginsCheck(config, installation, failedContent) {
1618
1731
  if (!config) return skippedResult("plugins");
@@ -1625,10 +1738,10 @@ var Doctor = class _Doctor extends BaseCommand {
1625
1738
  this.log(line);
1626
1739
  }
1627
1740
  }
1628
- printResults(results, recreateTips) {
1741
+ printResults(results, scope, recreateTips) {
1629
1742
  this.log("");
1630
1743
  this.log(formatSummary(results));
1631
- const tips = [...formatTips(results), ...recreateTips];
1744
+ const tips = [...formatTips(results, scope), ...recreateTips];
1632
1745
  if (tips.length > 0) {
1633
1746
  this.log("");
1634
1747
  for (const tip of tips) {