Skip to content

Commit 73036be

Browse files
committed
fix(ci): add dead_code annotations to skill-based prompt API
The skill-based prompt functions are public API designed for future integration but are not yet used outside of tests. Add #[allow(dead_code)] annotations to suppress warnings while preserving the API surface. Also applies rustfmt formatting fixes.
1 parent ccd91ce commit 73036be

File tree

5 files changed

+116
-26
lines changed

5 files changed

+116
-26
lines changed

src/cortex-engine/src/session/prompt.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub(crate) const BASE_PROMPT_WITH_SKILLS: &str =
2525
///
2626
/// When `true`, the system uses a minimal base prompt with skills loaded on-demand.
2727
/// When `false`, the full monolithic prompt is used.
28+
#[allow(dead_code)]
2829
pub const USE_SKILL_BASED_PROMPT: bool = true;
2930

3031
/// Build the system prompt for the agent.
@@ -225,6 +226,7 @@ fn get_system_info() -> String {
225226
/// let skills = auto_detect_skills_from_message("Fix this bug and create a PR");
226227
/// let prompt = build_system_prompt_with_skills(&config, &skills);
227228
/// ```
229+
#[allow(dead_code)]
228230
pub fn build_system_prompt_with_skills(config: &Config, skills: &[&str]) -> String {
229231
// If skills mode is disabled and no skills specified, use monolithic prompt
230232
if !USE_SKILL_BASED_PROMPT && skills.is_empty() {
@@ -348,6 +350,7 @@ pub fn build_system_prompt_with_skills(config: &Config, skills: &[&str]) -> Stri
348350
/// assert!(prompt.contains("Git Operations Skill"));
349351
/// assert!(prompt.contains("Debugging Skill"));
350352
/// ```
353+
#[allow(dead_code)]
351354
pub fn inject_skills(base_prompt: &str, skills: &[&str]) -> String {
352355
if skills.is_empty() {
353356
return base_prompt.to_string();
@@ -383,6 +386,7 @@ pub fn inject_skills(base_prompt: &str, skills: &[&str]) -> String {
383386
///
384387
/// Skills include YAML frontmatter for metadata, but we don't need it
385388
/// in the injected prompt.
389+
#[allow(dead_code)]
386390
fn strip_yaml_frontmatter(content: &str) -> &str {
387391
if !content.starts_with("---\n") {
388392
return content;
@@ -425,6 +429,7 @@ fn strip_yaml_frontmatter(content: &str) -> &str {
425429
/// assert!(skills.contains(&"file-operations"));
426430
/// assert!(skills.contains(&"code-quality"));
427431
/// ```
432+
#[allow(dead_code)]
428433
pub fn auto_detect_skills_from_message(message: &str) -> Vec<&'static str> {
429434
cortex_prompt_harness::prompts::get_recommended_skills(message)
430435
}
@@ -434,6 +439,7 @@ pub fn auto_detect_skills_from_message(message: &str) -> Vec<&'static str> {
434439
/// # Returns
435440
///
436441
/// A slice of all available skill names.
442+
#[allow(dead_code)]
437443
pub fn available_skills() -> &'static [&'static str] {
438444
cortex_prompt_harness::prompts::AVAILABLE_SKILLS
439445
}
@@ -447,6 +453,7 @@ pub fn available_skills() -> &'static [&'static str] {
447453
/// # Returns
448454
///
449455
/// `true` if the skill exists, `false` otherwise.
456+
#[allow(dead_code)]
450457
pub fn is_valid_skill(skill: &str) -> bool {
451458
cortex_prompt_harness::prompts::is_builtin_skill(skill)
452459
}

src/cortex-engine/src/tools/handlers/skill.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,8 @@ impl SkillLoader {
230230
return Ok(None);
231231
}
232232

233-
let content = get_builtin_skill(name).ok_or_else(|| {
234-
CortexError::NotFound(format!("Built-in skill not found: {}", name))
235-
})?;
233+
let content = get_builtin_skill(name)
234+
.ok_or_else(|| CortexError::NotFound(format!("Built-in skill not found: {}", name)))?;
236235

237236
let (definition, markdown) = parse_skill_md(content)?;
238237

src/cortex-prompt-harness/src/prompts/base_agent.rs

Lines changed: 86 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,50 +157,122 @@ pub const SKILL_METADATA: &[SkillInfo] = &[
157157
name: "git",
158158
description: "Version control operations",
159159
keywords: &[
160-
"git", "commit", "push", "pull", "merge", "branch", "pr", "pull request",
161-
"rebase", "cherry-pick", "checkout", "stash", "diff", "log", "blame",
160+
"git",
161+
"commit",
162+
"push",
163+
"pull",
164+
"merge",
165+
"branch",
166+
"pr",
167+
"pull request",
168+
"rebase",
169+
"cherry-pick",
170+
"checkout",
171+
"stash",
172+
"diff",
173+
"log",
174+
"blame",
162175
],
163176
},
164177
SkillInfo {
165178
name: "code-quality",
166179
description: "Code standards and testing",
167180
keywords: &[
168-
"lint", "test", "format", "style", "convention", "review", "refactor",
169-
"clean", "quality", "coverage", "eslint", "pylint", "clippy", "prettier",
170-
"jest", "pytest", "cargo test",
181+
"lint",
182+
"test",
183+
"format",
184+
"style",
185+
"convention",
186+
"review",
187+
"refactor",
188+
"clean",
189+
"quality",
190+
"coverage",
191+
"eslint",
192+
"pylint",
193+
"clippy",
194+
"prettier",
195+
"jest",
196+
"pytest",
197+
"cargo test",
171198
],
172199
},
173200
SkillInfo {
174201
name: "file-operations",
175202
description: "File handling best practices",
176203
keywords: &[
177-
"create", "file", "write", "edit", "move", "rename", "delete", "copy",
178-
"directory", "folder", "path", "backup",
204+
"create",
205+
"file",
206+
"write",
207+
"edit",
208+
"move",
209+
"rename",
210+
"delete",
211+
"copy",
212+
"directory",
213+
"folder",
214+
"path",
215+
"backup",
179216
],
180217
},
181218
SkillInfo {
182219
name: "debugging",
183220
description: "Failure protocol and error handling",
184221
keywords: &[
185-
"debug", "error", "fix", "bug", "crash", "exception", "trace", "stack",
186-
"breakpoint", "investigate", "troubleshoot", "diagnose", "failing", "broken",
222+
"debug",
223+
"error",
224+
"fix",
225+
"bug",
226+
"crash",
227+
"exception",
228+
"trace",
229+
"stack",
230+
"breakpoint",
231+
"investigate",
232+
"troubleshoot",
233+
"diagnose",
234+
"failing",
235+
"broken",
187236
],
188237
},
189238
SkillInfo {
190239
name: "security",
191240
description: "Security rules and secrets handling",
192241
keywords: &[
193-
"security", "secret", "key", "token", "password", "credential", "auth",
194-
"authentication", "authorization", "encrypt", "hash", "vulnerability",
195-
"audit", "sensitive", "env", "environment variable",
242+
"security",
243+
"secret",
244+
"key",
245+
"token",
246+
"password",
247+
"credential",
248+
"auth",
249+
"authentication",
250+
"authorization",
251+
"encrypt",
252+
"hash",
253+
"vulnerability",
254+
"audit",
255+
"sensitive",
256+
"env",
257+
"environment variable",
196258
],
197259
},
198260
SkillInfo {
199261
name: "planning",
200262
description: "Task decomposition and cognitive phases",
201263
keywords: &[
202-
"plan", "design", "architect", "complex", "multi-step", "breakdown",
203-
"decompose", "strategy", "roadmap", "milestone", "phase", "implement feature",
264+
"plan",
265+
"design",
266+
"architect",
267+
"complex",
268+
"multi-step",
269+
"breakdown",
270+
"decompose",
271+
"strategy",
272+
"roadmap",
273+
"milestone",
274+
"phase",
275+
"implement feature",
204276
],
205277
},
206278
];

src/cortex-prompt-harness/src/prompts/builtin_skills.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,11 +1574,23 @@ mod tests {
15741574
];
15751575

15761576
for skill in skills {
1577-
assert!(skill.starts_with("---\n"), "Skill should start with YAML frontmatter");
1578-
assert!(skill.contains("\n---\n"), "Skill should have frontmatter end marker");
1577+
assert!(
1578+
skill.starts_with("---\n"),
1579+
"Skill should start with YAML frontmatter"
1580+
);
1581+
assert!(
1582+
skill.contains("\n---\n"),
1583+
"Skill should have frontmatter end marker"
1584+
);
15791585
assert!(skill.contains("name:"), "Skill should have name field");
1580-
assert!(skill.contains("description:"), "Skill should have description field");
1581-
assert!(skill.contains("version:"), "Skill should have version field");
1586+
assert!(
1587+
skill.contains("description:"),
1588+
"Skill should have description field"
1589+
);
1590+
assert!(
1591+
skill.contains("version:"),
1592+
"Skill should have version field"
1593+
);
15821594
assert!(skill.contains("tags:"), "Skill should have tags field");
15831595
}
15841596
}

src/cortex-prompt-harness/src/prompts/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ pub use base_agent::{
6060
AVAILABLE_SKILLS, CORTEX_BASE_PROMPT, CORTEX_BASE_PROMPT_WITH_SKILLS_PRELOADED,
6161
format_skill_loading_prompt, get_recommended_skills,
6262
};
63+
pub use builtin_skills::{
64+
BUILTIN_SKILL_NAMES, SKILL_CODE_QUALITY, SKILL_DEBUGGING, SKILL_FILE_OPERATIONS, SKILL_GIT,
65+
SKILL_PLANNING, SKILL_SECURITY, builtin_skill_count, get_builtin_skill, is_builtin_skill,
66+
list_builtin_skills,
67+
};
6368
pub use core::{
6469
CORTEX_MAIN_PROMPT, CortexPromptBuilder, SECTION_ANTI_PATTERNS, SECTION_CODE_DISCIPLINE,
6570
SECTION_COGNITIVE_ARCHITECTURE, SECTION_FAILURE_PROTOCOL, SECTION_HEADER, SECTION_NAMES,
6671
SECTION_OUTPUT_FORMAT, SECTION_PRIME_DIRECTIVES, SECTION_QUALITY_CHECKPOINTS,
6772
SECTION_RESPONSE_PATTERNS, SECTION_TOOLKIT, TUI_SYSTEM_PROMPT_TEMPLATE,
6873
};
69-
pub use builtin_skills::{
70-
BUILTIN_SKILL_NAMES, SKILL_CODE_QUALITY, SKILL_DEBUGGING, SKILL_FILE_OPERATIONS, SKILL_GIT,
71-
SKILL_PLANNING, SKILL_SECURITY, builtin_skill_count, get_builtin_skill, is_builtin_skill,
72-
list_builtin_skills,
73-
};
7474
pub use tasks::{COMPACTION_PROMPT, SUMMARIZATION_PROMPT};
7575
pub use top_agent::{
7676
TOP_AGENT_SECTION_NAMES, TOP_AGENT_SYSTEM_PROMPT, TopAgentPresets, TopAgentPromptBuilder,

0 commit comments

Comments
 (0)