mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-11 20:00:29 +01:00
[PR #229] [CLOSED] Add a plugin that gets secrets from the macOS Keychain #154
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mountain-loop/yaak/pull/229
Author: @nicwolff
Created: 6/20/2025
Status: ❌ Closed
Base:
main← Head:secrets-from-os-keychain📝 Commits (3)
a2a8874Add a plugin that gets secrets from the macOS Keychain88f58f9Update package name92947feAdd README.md📊 Changes
4 files changed (+79 additions, -0 deletions)
View changed files
➕
plugins/template-function-keychain-macos/README.md(+3 -0)➕
plugins/template-function-keychain-macos/package-lock.json(+21 -0)➕
plugins/template-function-keychain-macos/package.json(+13 -0)➕
plugins/template-function-keychain-macos/src/index.ts(+42 -0)📄 Description
Claude Sonnet 4 user prompt
Using Kilo Code in Orchestrator mode:
Orchestrator's task for Coder
You need to modify this Yaak plugin to use the macOS keychain instead of reading from the filesystem. Based on previous analysis, here's what you need to do:
Context from Previous Analysis
Current Plugin Structure:
@yaakapp/template-function-fsfs.readFilethat reads files from filesystemsrc/index.tswith dependencies inpackage.jsonKeychain Package Requirements:
keychainnpm packageserviceandaccountparameterstypeparameter ('generic' or 'internet', defaults to 'generic')Specific Tasks to Complete
Update
package.json:@yaakapp/template-function-fsto@yaakapp/template-function-keychain-macoskeychainas a dependencyModify
src/index.ts:import * as fs from 'node:fs'import keychain from 'keychain'(or require statement)fs.readFiletokeychain.getPasswordservice(text input, required)account(text input, required)type(select input with 'generic'/'internet' options, defaults to 'generic')Implementation Details:
{ account, service, type }Promise<string | null>Code Structure Reference
Based on the research, the keychain integration should follow this pattern:
Only perform the implementation work outlined above and do not add additional features or modifications. Use the attempt_completion tool when done with a summary of all changes made.
These specific instructions supersede any conflicting general instructions your mode might have.
Coder's "Task completed" message
I have successfully modified the Yaak plugin to use the macOS keychain instead of reading from the filesystem. Here's a summary of all changes made:
Changes Made
1. Updated
package.json:@yaakapp/template-function-fsto@yaakapp/template-function-keychain-macoskeychaindependency (version ^1.5.0)2. Modified
src/index.ts:import fs from 'node:fs'import keychain from 'keychain'fs.readFiletokeychain.getPasswordservice(required text input)account(required text input)type(select input with 'generic'/'internet' options, defaults to 'generic')Promise<string | null>return type3. Installation and Build:
/build/index.jsThe plugin now provides a
keychain.getPasswordtemplate function that can retrieve passwords from the macOS keychain using service and account identifiers, with support for both generic and internet keychain item types.Orchestrator's "Task completed" message
Yaak Plugin Transformation Complete
I have successfully transformed your Yaak plugin from a filesystem reader to a macOS keychain password retriever. Here's a comprehensive overview of what was accomplished:
Workflow Summary
The transformation was completed through a systematic 4-step workflow:
Key Changes Made
Plugin Identity
@yaakapp/template-function-fsto@yaakapp/template-function-keychain-macosfs.readFiletokeychain.getPasswordDependencies
keychain@1.5.0npm package for macOS keychain accessfsmodule dependencyFunctionality Transformation
Input Parameters: Replaced single file picker with three text/select inputs:
service- The service name (required)account- The account name (required)type- Keychain type (generic/internet, defaults to generic)Core Logic: Replaced filesystem reading with keychain password retrieval using Promise-wrapped callback API
Error Handling: Maintained graceful failure pattern (returns null on errors)
Return Type: Preserved
Promise<string | null>signatureTechnical Implementation
Verification Results
✅ Build Verification: Compiles successfully with no errors
✅ Code Quality: Proper TypeScript syntax and structure
✅ Dependencies: All packages installed correctly
✅ Plugin Structure: Matches Yaak's expected format
✅ Functionality: Ready for keychain password retrieval
Usage
The plugin now provides a
keychain.getPasswordtemplate function that can be used in Yaak to retrieve passwords from the macOS keychain by specifying:The plugin maintains the same error-tolerant behavior as the original, returning null when passwords cannot be retrieved, ensuring robust integration with Yaak's templating system.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.