Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extensions/agent-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function parseChainYaml(raw: string): ChainDef[] {

function parseAgentFile(filePath: string): AgentDef | null {
try {
const raw = readFileSync(filePath, "utf-8");
const raw = readFileSync(filePath, "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
if (!match) return null;

Expand Down Expand Up @@ -216,7 +216,7 @@ export default function (pi: ExtensionAPI) {
const chainPath = join(cwd, ".pi", "agents", "agent-chain.yaml");
if (existsSync(chainPath)) {
try {
chains = parseChainYaml(readFileSync(chainPath, "utf-8"));
chains = parseChainYaml(readFileSync(chainPath, "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n"));
} catch {
chains = [];
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/agent-team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function parseTeamsYaml(raw: string): Record<string, string[]> {

function parseAgentFile(filePath: string): AgentDef | null {
try {
const raw = readFileSync(filePath, "utf-8");
const raw = readFileSync(filePath, "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
if (!match) return null;

Expand Down Expand Up @@ -158,7 +158,7 @@ export default function (pi: ExtensionAPI) {
const teamsPath = join(cwd, ".pi", "agents", "teams.yaml");
if (existsSync(teamsPath)) {
try {
teams = parseTeamsYaml(readFileSync(teamsPath, "utf-8"));
teams = parseTeamsYaml(readFileSync(teamsPath, "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n"));
} catch {
teams = {};
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/cross-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function scanCommands(dir: string): Discovered[] {
try {
for (const file of readdirSync(dir)) {
if (!file.endsWith(".md")) continue;
const raw = readFileSync(join(dir, file), "utf-8");
const raw = readFileSync(join(dir, file), "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const { description, body } = parseFrontmatter(raw);
items.push({
name: basename(file, ".md"),
Expand Down Expand Up @@ -117,7 +117,7 @@ function scanAgents(dir: string): Discovered[] {
try {
for (const file of readdirSync(dir)) {
if (!file.endsWith(".md")) continue;
const raw = readFileSync(join(dir, file), "utf-8");
const raw = readFileSync(join(dir, file), "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const { fields } = parseFrontmatter(raw);
items.push({
name: fields.name || basename(file, ".md"),
Expand Down
2 changes: 1 addition & 1 deletion extensions/damage-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function (pi: ExtensionAPI) {
const rulesPath = path.join(ctx.cwd, ".pi", "damage-control-rules.yaml");
try {
if (fs.existsSync(rulesPath)) {
const content = fs.readFileSync(rulesPath, "utf8");
const content = fs.readFileSync(rulesPath, "utf8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const loaded = yamlParse(content) as Partial<Rules>;
rules = {
bashToolPatterns: loaded.bashToolPatterns || [],
Expand Down
4 changes: 2 additions & 2 deletions extensions/pi-pi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function displayName(name: string): string {

function parseAgentFile(filePath: string): ExpertDef | null {
try {
const raw = readFileSync(filePath, "utf-8");
const raw = readFileSync(filePath, "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
if (!match) return null;

Expand Down Expand Up @@ -564,7 +564,7 @@ Ask specific questions about what you need to BUILD. Each expert will return doc
const orchestratorPath = join(_ctx.cwd, ".pi", "agents", "pi-pi", "pi-orchestrator.md");
let systemPrompt = "";
try {
const raw = readFileSync(orchestratorPath, "utf-8");
const raw = readFileSync(orchestratorPath, "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
const template = match ? match[2].trim() : raw;

Expand Down
2 changes: 1 addition & 1 deletion extensions/system-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function scanAgents(dir: string, source: string): AgentDef[] {
try {
for (const file of readdirSync(dir)) {
if (!file.endsWith(".md")) continue;
const raw = readFileSync(join(dir, file), "utf-8");
const raw = readFileSync(join(dir, file), "utf-8").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
const { fields, body } = parseFrontmatter(raw);
agents.push({
name: fields.name || basename(file, ".md"),
Expand Down
Loading