refactor(skills): remove unused SkillConfig.apiKey/env/primaryEnv (#192)
These fields were only checked during eligibility but never injected at runtime via credentialManager.getEnv(). Remove the half-implemented per-skill credential config to reduce confusion. API key configuration remains supported via skills.env.json5 and process.env. Refs: MUL-246, MUL-255 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
058af56d47
commit
7a92f716d9
3 changed files with 1 additions and 67 deletions
|
|
@ -284,56 +284,6 @@ describe("eligibility", () => {
|
|||
expect(result.reasons?.length).toBe(2);
|
||||
});
|
||||
|
||||
it("should be eligible when env var provided via skillConfig", () => {
|
||||
delete process.env.API_KEY;
|
||||
|
||||
const skill = createSkill("test", {
|
||||
name: "Test Skill",
|
||||
metadata: {
|
||||
requires: {
|
||||
env: ["API_KEY"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const result = checkEligibility(skill, {
|
||||
platform: "darwin",
|
||||
config: {
|
||||
entries: {
|
||||
test: {
|
||||
env: { API_KEY: "secret" },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(result.eligible).toBe(true);
|
||||
});
|
||||
|
||||
it("should be eligible when env var provided via apiKey + primaryEnv", () => {
|
||||
delete process.env.GEMINI_API_KEY;
|
||||
|
||||
const skill = createSkill("test", {
|
||||
name: "Test Skill",
|
||||
metadata: {
|
||||
primaryEnv: "GEMINI_API_KEY",
|
||||
requires: {
|
||||
env: ["GEMINI_API_KEY"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const result = checkEligibility(skill, {
|
||||
platform: "darwin",
|
||||
config: {
|
||||
entries: {
|
||||
test: {
|
||||
apiKey: "my-api-key",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(result.eligible).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("always flag", () => {
|
||||
|
|
|
|||
|
|
@ -308,12 +308,6 @@ export function checkEligibilityDetailed(
|
|||
// Check if env var exists
|
||||
if (envExists(envVar)) continue;
|
||||
|
||||
// Check if provided via skill config env
|
||||
if (skillConfig?.env?.[envVar]) continue;
|
||||
|
||||
// Check if provided via apiKey + primaryEnv match
|
||||
if (skillConfig?.apiKey && metadata?.primaryEnv === envVar) continue;
|
||||
|
||||
missingEnvVars.push(envVar);
|
||||
reasons.push(`Required environment variable not set: ${envVar}`);
|
||||
}
|
||||
|
|
@ -443,9 +437,8 @@ function getBinaryInstallHint(binary: string, platform: NodeJS.Platform): string
|
|||
/**
|
||||
* Generate hints for missing environment variables
|
||||
*/
|
||||
function generateEnvHint(envVars: string[], skill: Skill): string {
|
||||
function generateEnvHint(envVars: string[], _skill: Skill): string {
|
||||
const hints: string[] = [];
|
||||
const skillKey = getSkillKey(skill);
|
||||
|
||||
for (const envVar of envVars) {
|
||||
// Check for well-known API key patterns
|
||||
|
|
@ -463,9 +456,6 @@ function generateEnvHint(envVars: string[], skill: Skill): string {
|
|||
}
|
||||
}
|
||||
|
||||
// Also suggest config-based approach
|
||||
hints.push(`Or configure via: skills.${skillKey}.env.${envVars[0]}`);
|
||||
|
||||
return hints.slice(0, 3).join(" OR ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ export interface SkillMetadata {
|
|||
always?: boolean | undefined;
|
||||
/** Custom key for config lookup (defaults to skill id) */
|
||||
skillKey?: string | undefined;
|
||||
/** Primary environment variable for API key injection */
|
||||
primaryEnv?: string | undefined;
|
||||
/** Emoji for display (e.g., "📝") */
|
||||
emoji?: string | undefined;
|
||||
/** Homepage URL for documentation */
|
||||
|
|
@ -162,10 +160,6 @@ export interface Skill {
|
|||
export interface SkillConfig {
|
||||
/** Explicitly enable/disable this skill */
|
||||
enabled?: boolean | undefined;
|
||||
/** API key for skills with primaryEnv set */
|
||||
apiKey?: string | undefined;
|
||||
/** Environment variables to inject */
|
||||
env?: Record<string, string> | undefined;
|
||||
/** Custom per-skill configuration */
|
||||
config?: Record<string, unknown> | undefined;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue