@ikyyofc/gemini-cli 5.0.3 → 5.0.5
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.
- package/package.json +1 -1
- package/src/agent.js +5 -45
- package/src/tools.js +29 -0
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -22,25 +22,21 @@ function buildSystemPrompt(extra = "") {
|
|
|
22
22
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
23
23
|
const datetime = now.toLocaleString("id-ID", { timeZone: tz, dateStyle: "full", timeStyle: "long" });
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
? "\n##
|
|
27
|
-
"Before starting any task, check if a skill applies. If yes, read it with read_file first.\n\n" +
|
|
28
|
-
skills.map(s =>
|
|
29
|
-
`- ${s.slug}: ${s.description}\n path: ${SKILLS_DIR}/${s.slug}/SKILL.md`
|
|
30
|
-
).join("\n")
|
|
25
|
+
const skillHint = skills.length
|
|
26
|
+
? "\n## SKILLS\nALWAYS call get_skills() first before starting any task."
|
|
31
27
|
: "";
|
|
32
28
|
|
|
33
29
|
return `You are an autonomous AI coding agent running in the user's terminal.
|
|
34
30
|
|
|
35
31
|
## CURRENT TIME
|
|
36
32
|
${datetime} (${tz})
|
|
37
|
-
${
|
|
33
|
+
${skillHint}
|
|
38
34
|
|
|
39
35
|
## CORE RULE — NEVER ASK, ALWAYS ACT
|
|
40
36
|
Use tools to complete every task. Never instruct the user to do anything themselves.
|
|
41
37
|
|
|
42
38
|
## WORKFLOW
|
|
43
|
-
1.
|
|
39
|
+
1. CALL get_skills() — always check for expert skill instructions first
|
|
44
40
|
2. EXPLORE — understand the project structure
|
|
45
41
|
3. ACT — complete the task fully using tools
|
|
46
42
|
4. VERIFY — test after changes
|
|
@@ -58,31 +54,6 @@ ${toolList}
|
|
|
58
54
|
${extra ? `\n## EXTRA\n${extra}` : ""}`.trim();
|
|
59
55
|
}
|
|
60
56
|
|
|
61
|
-
// ─────────────────────────────────────────────────────────────────
|
|
62
|
-
// Build skill-selection primer message
|
|
63
|
-
// This is a SEPARATE first user message that forces the agent
|
|
64
|
-
// to select and read skills before proceeding to the actual task.
|
|
65
|
-
// The agent must use read_file on any relevant skill, then the
|
|
66
|
-
// skill content enters context naturally via tool results.
|
|
67
|
-
// ─────────────────────────────────────────────────────────────────
|
|
68
|
-
function buildSkillPrimer(userMessage, skills) {
|
|
69
|
-
if (!skills.length) return null;
|
|
70
|
-
|
|
71
|
-
const index = skills.map(s =>
|
|
72
|
-
`- ${s.slug}: ${s.description}`
|
|
73
|
-
).join("\n");
|
|
74
|
-
|
|
75
|
-
return `You have the following skills available. Before working on the task below, identify which skills (if any) are relevant and read their SKILL.md file using read_file. Only read skills that actually apply — do not read all of them.
|
|
76
|
-
|
|
77
|
-
Skills:
|
|
78
|
-
${index}
|
|
79
|
-
|
|
80
|
-
Skills path: ${SKILLS_DIR}/<slug>/SKILL.md
|
|
81
|
-
|
|
82
|
-
After reading the relevant skill(s), proceed with the task:
|
|
83
|
-
"${userMessage}"`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
57
|
// ─────────────────────────────────────────────────────────────────
|
|
87
58
|
// Display thinking block
|
|
88
59
|
// ─────────────────────────────────────────────────────────────────
|
|
@@ -106,18 +77,7 @@ export async function runAgentLoop(userMessage, history, {
|
|
|
106
77
|
} = {}) {
|
|
107
78
|
|
|
108
79
|
const fullSystem = buildSystemPrompt(systemInstruction ?? "");
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
// Use skill primer as first user message if skills are available.
|
|
112
|
-
// This forces the model to select + read relevant skills via read_file
|
|
113
|
-
// before doing anything else. Skill content enters context naturally
|
|
114
|
-
// through tool results — no injection needed.
|
|
115
|
-
const primer = buildSkillPrimer(userMessage, skills);
|
|
116
|
-
const firstMessage = primer
|
|
117
|
-
? { role: "user", content: primer }
|
|
118
|
-
: { role: "user", content: userMessage };
|
|
119
|
-
|
|
120
|
-
const messages = [...history, firstMessage];
|
|
80
|
+
const messages = [...history, { role: "user", content: userMessage }];
|
|
121
81
|
|
|
122
82
|
const spinner = new Spinner();
|
|
123
83
|
const deadline = Date.now() + TIMEOUT_MS;
|
package/src/tools.js
CHANGED
|
@@ -273,6 +273,16 @@ export const FUNCTION_DECLARATIONS = [
|
|
|
273
273
|
description: "Get current environment info: working directory, platform, Node.js version, git branch, shell, home directory.",
|
|
274
274
|
parameters: { type: "OBJECT", properties: {} }
|
|
275
275
|
},
|
|
276
|
+
{
|
|
277
|
+
name: "get_skills",
|
|
278
|
+
description: "ALWAYS call this at the start of every task. Returns available skills — each skill contains expert instructions for specific task types. If a relevant skill exists, call get_skills again with its slug to read the full instructions before proceeding.",
|
|
279
|
+
parameters: {
|
|
280
|
+
type: "OBJECT",
|
|
281
|
+
properties: {
|
|
282
|
+
slug: { type: "STRING", description: "Skill slug to read full content. Leave empty to list all available skills." }
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
},
|
|
276
286
|
|
|
277
287
|
// ── Real-time ────────────────────────────────────────────────
|
|
278
288
|
{
|
|
@@ -694,6 +704,25 @@ export async function executeTool(name, args = {}, { autoApprove = false } = {})
|
|
|
694
704
|
};
|
|
695
705
|
}
|
|
696
706
|
|
|
707
|
+
case "get_skills": {
|
|
708
|
+
const { loadSkills, SKILLS_DIR } = await import("./skills.js");
|
|
709
|
+
const skills = loadSkills();
|
|
710
|
+
|
|
711
|
+
// No slug → list all available skills
|
|
712
|
+
if (!args.slug) {
|
|
713
|
+
if (!skills.length) return { result: "No skills installed." };
|
|
714
|
+
const list = skills.map(s =>
|
|
715
|
+
`${s.slug}\n description: ${s.description}`
|
|
716
|
+
).join("\n\n");
|
|
717
|
+
return { result: `Available skills:\n\n${list}\n\nTo read a skill: call get_skills with slug="<slug>"` };
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// Slug provided → return full SKILL.md content
|
|
721
|
+
const skill = skills.find(s => s.slug === args.slug);
|
|
722
|
+
if (!skill) return { error: `Skill "${args.slug}" not found. Call get_skills without slug to see available skills.` };
|
|
723
|
+
return { result: skill.content };
|
|
724
|
+
}
|
|
725
|
+
|
|
697
726
|
// ── Real-time ─────────────────────────────────────────
|
|
698
727
|
case "get_weather": {
|
|
699
728
|
const loc = encodeURIComponent(args.location);
|