@zenobius/opencode-skillful 1.2.4-next.1 → 1.2.4-next.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/index.js +65 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17566,6 +17566,17 @@ var SkillFrontmatterSchema = tool.schema.object({
17566
17566
  "allowed-tools": tool.schema.array(tool.schema.string()).optional(),
17567
17567
  metadata: tool.schema.record(tool.schema.string(), tool.schema.string()).optional()
17568
17568
  });
17569
+ var stripTrailingPathSeparators = (path) => path.replace(/[\\/]+$/, "");
17570
+ var suggestSkillsDirectoryPath = (path) => {
17571
+ const trimmedPath = stripTrailingPathSeparators(path);
17572
+ if (trimmedPath.toLowerCase() === "skill") {
17573
+ return "skills";
17574
+ }
17575
+ if (!/[\\/]skill$/i.test(trimmedPath)) {
17576
+ return null;
17577
+ }
17578
+ return trimmedPath.replace(/skill$/i, () => "skills");
17579
+ };
17569
17580
  function createSkillRegistryController() {
17570
17581
  const store = new Map;
17571
17582
  const controller = {
@@ -17603,6 +17614,19 @@ async function createSkillRegistry(config2, logger) {
17603
17614
  const existingBasePaths = config2.basePaths.filter(doesPathExist);
17604
17615
  if (existingBasePaths.length === 0) {
17605
17616
  logger.warn("[OpencodeSkillful] No valid base paths found for skill discovery:", config2.basePaths);
17617
+ const typoCandidates = config2.basePaths.flatMap((basePath) => {
17618
+ const suggestedPath = suggestSkillsDirectoryPath(basePath);
17619
+ if (!suggestedPath) {
17620
+ return [];
17621
+ }
17622
+ if (doesPathExist(suggestedPath)) {
17623
+ return [`${basePath} -> ${suggestedPath}`];
17624
+ }
17625
+ return [];
17626
+ });
17627
+ if (typoCandidates.length > 0) {
17628
+ logger.warn('[OpencodeSkillful] Detected possible "skill" vs "skills" typo in basePaths:', typoCandidates);
17629
+ }
17606
17630
  controller.ready.setStatus("ready");
17607
17631
  return;
17608
17632
  }
@@ -22919,7 +22943,7 @@ var defaultGeneratedDir3 = resolve7(process12.cwd(), "src/generated");
22919
22943
 
22920
22944
  // src/config.ts
22921
22945
  import { homedir as homedir3 } from "os";
22922
- import { join as join4 } from "path";
22946
+ import { isAbsolute as isAbsolute2, join as join4, normalize, resolve as resolve8 } from "path";
22923
22947
  function getOpenCodeConfigPaths() {
22924
22948
  const home = homedir3();
22925
22949
  const paths = [];
@@ -22948,6 +22972,41 @@ function expandTildePath(path3) {
22948
22972
  }
22949
22973
  return path3;
22950
22974
  }
22975
+ var createPathKey = (absolutePath) => {
22976
+ const normalizedPath = normalize(absolutePath);
22977
+ if (process.platform === "win32") {
22978
+ return normalizedPath.toLowerCase();
22979
+ }
22980
+ return normalizedPath;
22981
+ };
22982
+ function resolveBasePath(basePath, projectDirectory) {
22983
+ const trimmedPath = basePath.trim();
22984
+ if (trimmedPath.length === 0) {
22985
+ return "";
22986
+ }
22987
+ const expandedPath = expandTildePath(trimmedPath);
22988
+ if (isAbsolute2(expandedPath)) {
22989
+ return normalize(expandedPath);
22990
+ }
22991
+ return resolve8(projectDirectory, expandedPath);
22992
+ }
22993
+ function normalizeBasePaths(basePaths, projectDirectory) {
22994
+ const uniquePaths = new Set;
22995
+ const normalizedPaths = [];
22996
+ for (const basePath of basePaths) {
22997
+ const normalizedPath = resolveBasePath(basePath, projectDirectory);
22998
+ if (!normalizedPath) {
22999
+ continue;
23000
+ }
23001
+ const key = createPathKey(normalizedPath);
23002
+ if (uniquePaths.has(key)) {
23003
+ continue;
23004
+ }
23005
+ uniquePaths.add(key);
23006
+ normalizedPaths.push(normalizedPath);
23007
+ }
23008
+ return normalizedPaths;
23009
+ }
22951
23010
  var defaultSkillBasePaths = getOpenCodeConfigPaths().map((configPath) => join4(configPath, "skills"));
22952
23011
  var options2 = {
22953
23012
  name: "opencode-skillful",
@@ -22961,8 +23020,11 @@ var options2 = {
22961
23020
  };
22962
23021
  async function getPluginConfig(ctx) {
22963
23022
  const resolvedConfig = await loadConfig5(options2);
22964
- resolvedConfig.basePaths.push(join4(ctx.directory, ".opencode", "skills"));
22965
- resolvedConfig.basePaths = resolvedConfig.basePaths.map(expandTildePath);
23023
+ const configuredBasePaths = [
23024
+ ...resolvedConfig.basePaths,
23025
+ join4(ctx.directory, ".opencode", "skills")
23026
+ ];
23027
+ resolvedConfig.basePaths = normalizeBasePaths(configuredBasePaths, ctx.directory);
22966
23028
  return resolvedConfig;
22967
23029
  }
22968
23030
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenobius/opencode-skillful",
3
- "version": "1.2.4-next.1",
3
+ "version": "1.2.4-next.2",
4
4
  "description": "OpenCode Skills Plugin - Anthropic Agent Skills Specification implementation",
5
5
  "type": "module",
6
6
  "module": "src/index.ts",