opencode: align tools directory with upstream documentation

This commit is contained in:
betaboon
2026-04-12 09:13:02 +02:00
committed by Austin Horstman
parent 26c9d5dca1
commit 287f84846c
5 changed files with 18 additions and 18 deletions

View File

@@ -365,11 +365,11 @@ in
If an attribute set is used, the attribute name becomes the tool filename,
and the value is either:
- Inline content as a string (creates `opencode/tool/<name>.ts`)
- A path to a file (creates `opencode/tool/<name>.ts` or `opencode/tool/<name>.js`)
- Inline content as a string (creates `opencode/tools/<name>.ts`)
- A path to a file (creates `opencode/tools/<name>.ts` or `opencode/tools/<name>.js`)
If a path is used, it is expected to contain tool files.
The directory is symlinked to {file}`$XDG_CONFIG_HOME/opencode/tool/`.
The directory is symlinked to {file}`$XDG_CONFIG_HOME/opencode/tools/`.
See <https://opencode.ai/docs/tools/> for the documentation.
'';
@@ -494,7 +494,7 @@ in
recursive = true;
};
"opencode/tool" = mkIf (lib.isPath cfg.tools) {
"opencode/tools" = mkIf (lib.isPath cfg.tools) {
source = cfg.tools;
recursive = true;
};
@@ -528,7 +528,7 @@ in
// lib.optionalAttrs (builtins.isAttrs cfg.tools) (
lib.mapAttrs' (
name: content:
lib.nameValuePair "opencode/tool/${name}.ts" (
lib.nameValuePair "opencode/tools/${name}.ts" (
if lib.isPath content then { source = content; } else { text = content; }
)
) cfg.tools

View File

@@ -71,10 +71,10 @@
${./test-agent.md}
# Tools
assertFileExists home-files/.config/opencode/tool/inline-tool.ts
assertFileExists home-files/.config/opencode/tool/path-tool.ts
assertFileExists home-files/.config/opencode/tools/inline-tool.ts
assertFileExists home-files/.config/opencode/tools/path-tool.ts
assertFileContent home-files/.config/opencode/tool/path-tool.ts \
assertFileContent home-files/.config/opencode/tools/path-tool.ts \
${./test-tool.ts}
# Skills

View File

@@ -5,11 +5,11 @@
};
nmt.script = ''
assertFileExists home-files/.config/opencode/tool/database-query.ts
assertFileExists home-files/.config/opencode/tool/api-client.ts
assertFileContent home-files/.config/opencode/tool/database-query.ts \
assertFileExists home-files/.config/opencode/tools/database-query.ts
assertFileExists home-files/.config/opencode/tools/api-client.ts
assertFileContent home-files/.config/opencode/tools/database-query.ts \
${./tools-bulk/database-query.ts}
assertFileContent home-files/.config/opencode/tool/api-client.ts \
assertFileContent home-files/.config/opencode/tools/api-client.ts \
${./tools-bulk/api-client.ts}
'';
}

View File

@@ -32,11 +32,11 @@
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/tool/database-query.ts
assertFileExists home-files/.config/opencode/tool/api-client.ts
assertFileContent home-files/.config/opencode/tool/database-query.ts \
assertFileExists home-files/.config/opencode/tools/database-query.ts
assertFileExists home-files/.config/opencode/tools/api-client.ts
assertFileContent home-files/.config/opencode/tools/database-query.ts \
${./database-query-tool.ts}
assertFileContent home-files/.config/opencode/tool/api-client.ts \
assertFileContent home-files/.config/opencode/tools/api-client.ts \
${./api-client-tool.ts}
'';
}

View File

@@ -6,8 +6,8 @@
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/tool/test-tool.ts
assertFileContent home-files/.config/opencode/tool/test-tool.ts \
assertFileExists home-files/.config/opencode/tools/test-tool.ts
assertFileContent home-files/.config/opencode/tools/test-tool.ts \
${./test-tool.ts}
'';
}