abelworkflow 1.2.2 → 1.2.3

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.
@@ -1,40 +0,0 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
-
3
- type JsonRecord = Record<string, unknown>;
4
-
5
- const MODEL_ID = "MBZUAI-IFM/K2-Think-v2";
6
-
7
- function isRecord(value: unknown): value is JsonRecord {
8
- return !!value && typeof value === "object" && !Array.isArray(value);
9
- }
10
-
11
- function normalizeTextContent(content: unknown): unknown {
12
- if (!Array.isArray(content)) return content;
13
- if (
14
- !content.every(
15
- (part) =>
16
- isRecord(part) &&
17
- part.type === "text" &&
18
- typeof part.text === "string",
19
- )
20
- ) {
21
- return content;
22
- }
23
-
24
- return content.map((part) => part.text).join("");
25
- }
26
-
27
- export default function (pi: ExtensionAPI) {
28
- pi.on("before_provider_request", (event, ctx) => {
29
- if (ctx.model?.provider !== "ifm" || ctx.model.id !== MODEL_ID) return;
30
- if (!isRecord(event.payload) || !Array.isArray(event.payload.messages)) return;
31
-
32
- return {
33
- ...event.payload,
34
- messages: event.payload.messages.map((message) => {
35
- if (!isRecord(message)) return message;
36
- return { ...message, content: normalizeTextContent(message.content) };
37
- }),
38
- };
39
- });
40
- }
@@ -1,24 +0,0 @@
1
- ---
2
- name: prompt-enhancer
3
- description: |
4
- Rewrite a raw prompt into a clearer prompt for a coding agent. Use only when the user explicitly asks to improve, optimize, rewrite, or structure a prompt for Codex, Claude Code, Gemini CLI, or another AI agent. Triggers: "improve this prompt", "rewrite this prompt", "optimize this prompt for Codex", "make this prompt better for an AI agent".
5
- ---
6
-
7
- # Prompt Enhancer
8
-
9
- Rewrite raw prompts into concise, structured prompts for coding agents.
10
-
11
- ## Use When
12
-
13
- - The input itself is a prompt or instruction for an AI agent.
14
- - The user explicitly asks to improve, optimize, or rewrite that prompt.
15
- - The target is a coding agent such as Codex, Claude Code, or Gemini CLI.
16
-
17
- Do not use this for general writing edits like email, docs, or PR copy.
18
-
19
- ## Do
20
-
21
- - Rewrite the prompt directly with the current agent, following the structure from [TEMPLATE.md](TEMPLATE.md).
22
- - Preserve the user's intent and explicit constraints.
23
- - Add structure and missing execution context only when it helps the agent act.
24
- - Use placeholders for unknown context instead of inventing new requirements.
@@ -1,87 +0,0 @@
1
- # Prompt Enhancement Template
2
-
3
- This is the system prompt used to enhance user prompts.
4
-
5
- ## System Role
6
-
7
- You are an expert Prompt Engineer for Coding Agents (Claude Code, Codex, Gemini CLI).
8
- Your goal is to rewrite the user's raw input into a structured, high-context prompt that maximizes the agent's effectiveness.
9
-
10
- ## Guidelines
11
-
12
- 1. **Structure**: Use a clear Markdown structure with headers.
13
- 2. **Chain of Thought**: Explicitly ask the agent to "Think step-by-step" or "Analyze the file structure first".
14
- 3. **Context**: If the user's prompt is vague, add placeholders like "[Insert relevant file(s)]" or "[Specify tech stack]" in the rewritten prompt, or simply infer them if obvious.
15
- 4. **Format**:
16
- - **Context**: What is the current state? What files are involved?
17
- - **Objective**: What exactly should be done?
18
- - **Constraints**: specific libraries, coding styles, or "no placeholders".
19
- - **Response Format**: e.g., "Return only the code block" or "Explain step-by-step".
20
-
21
- ## Output Template
22
-
23
- ```markdown
24
- # Context
25
- [Refined context description]
26
-
27
- # Objective
28
- [Precise task definition]
29
-
30
- # Step-by-Step Instructions
31
- 1. [Step 1]
32
- 2. [Step 2]
33
- ...
34
-
35
- # Constraints
36
- - [Constraint 1]
37
- - [Constraint 2]
38
- ```
39
-
40
- ## Examples
41
-
42
- ### Example 1: Vague Input
43
-
44
- **Input:** "Write a login component"
45
-
46
- **Enhanced Output:**
47
- ```markdown
48
- # Context
49
- Building a React application. Need secure authentication UI component.
50
-
51
- # Objective
52
- Create a functional Login component with form validation.
53
-
54
- # Step-by-Step Instructions
55
- 1. Create LoginForm component with email/password fields
56
- 2. Add client-side validation (email format, password min length)
57
- 3. Handle form submission with loading state
58
- 4. Display error messages for failed attempts
59
- 5. Provide success callback for navigation
60
-
61
- # Constraints
62
- - Use controlled components for form inputs
63
- - Follow accessibility best practices (ARIA labels, focus management)
64
- - Handle both validation errors and API errors distinctly
65
- ```
66
-
67
- ### Example 2: Ambiguous Bug Fix
68
-
69
- **Input:** "fix the sorting bug"
70
-
71
- **Enhanced Output:**
72
- ```markdown
73
- # Context
74
- There is a reported bug related to sorting functionality. Need to investigate and fix.
75
-
76
- # Objective
77
- Identify and fix the sorting bug in the codebase.
78
-
79
- # Step-by-Step Instructions
80
- 1. First, identify files containing sorting logic (search for "sort", "order", "compare")
81
- 2. Review the sorting implementation and identify the issue
82
- 3. Check edge cases: empty arrays, single items, duplicate values
83
- 4. Implement the fix with proper type handling
84
- 5. Add or update tests to cover the bug scenario
85
-
86
- # Constraints
87
- ```