@howaboua/pi-codex-conversion 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -79,6 +79,7 @@ pi install git:github.com/IgorWarzocha/pi-codex-conversion
79
79
  The adapter does not build a standalone replacement prompt anymore. Instead it:
80
80
 
81
81
  - keeps Pi's tool descriptions, Pi docs section, AGENTS/project context, skills inventory, and date/cwd when Pi already surfaced them
82
+ - adds the current shell to the transformed prompt so quoting and escaping can match the runtime environment
82
83
  - rewrites the top-level role framing to Codex-style wording
83
84
  - adds a small Codex delta to the existing `Guidelines` section
84
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-codex-conversion",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Codex-oriented tool and prompt adapter for pi coding agent",
5
5
  "type": "module",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -65,7 +65,12 @@ export default function codexConversion(pi: ExtensionAPI) {
65
65
  if (!isCodexLikeContext(ctx)) {
66
66
  return undefined;
67
67
  }
68
- return { systemPrompt: buildCodexSystemPrompt(event.systemPrompt, { skills: state.promptSkills }) };
68
+ return {
69
+ systemPrompt: buildCodexSystemPrompt(event.systemPrompt, {
70
+ skills: state.promptSkills,
71
+ shell: process.env.SHELL || "/bin/bash",
72
+ }),
73
+ };
69
74
  });
70
75
  }
71
76
 
@@ -30,6 +30,13 @@ function insertBeforeTrailingContext(prompt: string, section: string): string {
30
30
  return `${prompt}\n\n${section}`;
31
31
  }
32
32
 
33
+ function injectShell(prompt: string, shell?: string): string {
34
+ if (!shell || /\nCurrent shell:/.test(prompt)) {
35
+ return prompt;
36
+ }
37
+ return insertBeforeTrailingContext(prompt, `Current shell: ${shell}`);
38
+ }
39
+
33
40
  function decodeXml(text: string): string {
34
41
  return text
35
42
  .replace(/'/g, "'")
@@ -106,6 +113,6 @@ function injectGuidelines(prompt: string): string {
106
113
  return `${prompt.slice(0, match.index)}${replacement}${prompt.slice(match.index + match[0].length)}`;
107
114
  }
108
115
 
109
- export function buildCodexSystemPrompt(basePrompt: string, options: { skills?: PromptSkill[] } = {}): string {
110
- return injectSkills(injectGuidelines(rewriteIntro(basePrompt)), options.skills ?? []);
116
+ export function buildCodexSystemPrompt(basePrompt: string, options: { skills?: PromptSkill[]; shell?: string } = {}): string {
117
+ return injectShell(injectSkills(injectGuidelines(rewriteIntro(basePrompt)), options.skills ?? []), options.shell);
111
118
  }