@piewf/cli 5.11.0 → 5.11.2

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 (2) hide show
  1. package/dist/src/doctor.js +25 -7
  2. package/package.json +2 -2
@@ -174,7 +174,7 @@ function scanExtensionRoleFiles(registrations) {
174
174
  if (!roleFiles.length)
175
175
  empty.push(registration);
176
176
  for (const entry of roleFiles)
177
- files.push({ name: basename(entry.name, ".md"), path: join(registration.path, entry.name), directory: registration.path, extension: registration.extension });
177
+ files.push({ name: basename(entry.name, ".md"), path: join(registration.path, entry.name), directory: registration.path, extension: registration.extension, ...(registration.builtin === true ? { builtin: true } : {}) });
178
178
  }
179
179
  catch (error) {
180
180
  errors.push({ registration, error });
@@ -404,18 +404,36 @@ export async function doctor(options = {}) {
404
404
  for (const file of extensionScan.files)
405
405
  extensionFilesByName.set(file.name, [...(extensionFilesByName.get(file.name) ?? []), file]);
406
406
  const duplicateExtensionNames = new Set();
407
- for (const [name, matches] of extensionFilesByName)
408
- if (matches.length > 1) {
407
+ const extensionPaths = new Map();
408
+ const starterOverrides = new Map();
409
+ const starterOverriddenBy = new Map();
410
+ for (const [name, matches] of extensionFilesByName) {
411
+ const regularMatches = matches.filter(({ builtin }) => builtin !== true);
412
+ const starterMatches = matches.filter(({ builtin }) => builtin === true);
413
+ if (regularMatches.length > 1) {
409
414
  duplicateExtensionNames.add(name);
410
- diagnostics.push(diagnostic("error", "ROLE_DUPLICATE", `Duplicate extension role "${name}": ${matches.map(({ path, directory, extension }) => `${extensionLabel(extension)} role directory "${directory}" (${path})`).join("; ")}`, matches[0]?.path, "Keep one extension role with this name; global and project roles may override packaged defaults."));
415
+ diagnostics.push(diagnostic("error", "ROLE_DUPLICATE", `Duplicate extension role "${name}": ${regularMatches.map(({ path, directory, extension }) => `${extensionLabel(extension)} role directory "${directory}" (${path})`).join("; ")}`, regularMatches[0]?.path, "Keep one extension role with this name; global and project roles may override packaged defaults."));
416
+ continue;
411
417
  }
412
- const extensionPaths = new Map();
418
+ const extension = regularMatches[0] ?? starterMatches[0];
419
+ if (extension)
420
+ extensionPaths.set(name, extension.path);
421
+ const regular = regularMatches[0];
422
+ const starter = starterMatches[0];
423
+ if (regular && starter) {
424
+ starterOverrides.set(regular.path, starter.path);
425
+ starterOverriddenBy.set(starter.path, regular.path);
426
+ }
427
+ }
413
428
  for (const file of extensionScan.files) {
414
- roles.push({ name: file.name, path: file.path, scope: "extension", active: true, extension: file.extension });
429
+ const starterPath = starterOverrides.get(file.path);
430
+ const overriddenBy = starterOverriddenBy.get(file.path);
431
+ roles.push({ name: file.name, path: file.path, scope: "extension", active: overriddenBy === undefined, extension: file.extension, ...(starterPath ? { overrides: starterPath } : {}), ...(overriddenBy ? { overriddenBy } : {}) });
415
432
  const definition = inspectRole(file.path, activeTools, knownModels, availableModels, diagnostics, aliases, dynamicAliases, settingsPath, { directory: file.directory, extension: file.extension });
416
433
  if (duplicateExtensionNames.has(file.name))
417
434
  continue;
418
- extensionPaths.set(file.name, file.path);
435
+ if (extensionPaths.get(file.name) !== file.path)
436
+ continue;
419
437
  if (definition)
420
438
  definitions.set(file.name, definition);
421
439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piewf/cli",
3
- "version": "5.11.0",
3
+ "version": "5.11.2",
4
4
  "description": "CLI for pi-extensible-workflows",
5
5
  "homepage": "https://vekexasia.github.io/pi-extensible-workflows/",
6
6
  "repository": {
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "license": "MIT",
48
48
  "dependencies": {
49
- "pi-extensible-workflows": "5.11.0"
49
+ "pi-extensible-workflows": "5.11.2"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"