chore(vendor): update Pi to 1.3.0 #189

Merged
alexion merged 2 commits from chore/vendor-pi-1.3.0 into main 2026-10-15 18:06:53 -04:00
3 changed files with 50 additions and 58 deletions
Showing only changes of commit 6e545c0a15 - Show all commits

View File

@@ -118,6 +118,7 @@
- OMP does not discover project skills from `.pi/skills`. - OMP does not discover project skills from `.pi/skills`.
Put skills shared by Pi and OMP under `.agents/skills`, or configure OMP's `skills.customDirectories`. Put skills shared by Pi and OMP under `.agents/skills`, or configure OMP's `skills.customDirectories`.
- Pi is vendored under `third_party/pi` as a linear vendor import. - Pi is vendored under `third_party/pi` as a linear vendor import.
`pkgs.alexion.pi-coding-agent` packages that source and does not use Nixpkgs Pi.
Do not use `git subtree add` or `git subtree pull` for Pi PR branches. Do not use `git subtree add` or `git subtree pull` for Pi PR branches.
Gitea rebases the synthetic upstream root commit without the `third_party/pi` prefix. Gitea rebases the synthetic upstream root commit without the `third_party/pi` prefix.
Preserve `git-subtree-dir` and `git-subtree-split` trailers on Pi vendor commits. Preserve `git-subtree-dir` and `git-subtree-split` trailers on Pi vendor commits.

View File

@@ -1,8 +1,4 @@
{ { pkgs, root }:
pi-coding-agent, pkgs.callPackage (root + "/third_party/pi/nix/package.nix") {
root, source = root + "/third_party/pi";
}:
pi-coding-agent.overrideAttrs {
src = root + "/third_party/pi";
patches = [ ];
} }

View File

@@ -471,14 +471,14 @@ function findGitRepoRoot(startDir: string): string | null {
} }
} }
function collectAncestorAgentsSkillDirs(startDir: string): string[] { function collectAncestorConfigDirs(startDir: string, configDirName: string): string[] {
const skillDirs: string[] = []; const configDirs: string[] = [];
const resolvedStartDir = resolve(startDir); const resolvedStartDir = resolve(startDir);
const gitRepoRoot = findGitRepoRoot(resolvedStartDir); const gitRepoRoot = findGitRepoRoot(resolvedStartDir);
let dir = resolvedStartDir; let dir = resolvedStartDir;
while (true) { while (true) {
skillDirs.push(join(dir, ".agents", "skills")); configDirs.push(join(dir, configDirName));
if (gitRepoRoot && dir === gitRepoRoot) { if (gitRepoRoot && dir === gitRepoRoot) {
break; break;
} }
@@ -489,7 +489,7 @@ function collectAncestorAgentsSkillDirs(startDir: string): string[] {
dir = parent; dir = parent;
} }
return skillDirs; return configDirs;
} }
function collectAutoPromptEntries(dir: string): string[] { function collectAutoPromptEntries(dir: string): string[] {
@@ -2455,16 +2455,13 @@ export class DefaultPackageManager implements PackageManager {
prompts: join(globalBaseDir, "prompts"), prompts: join(globalBaseDir, "prompts"),
themes: join(globalBaseDir, "themes"), themes: join(globalBaseDir, "themes"),
}; };
const projectDirs = {
extensions: join(projectBaseDir, "extensions"),
skills: join(projectBaseDir, "skills"),
prompts: join(projectBaseDir, "prompts"),
themes: join(projectBaseDir, "themes"),
};
const userAgentsSkillsDir = join(getHomeDir(), ".agents", "skills"); const userAgentsSkillsDir = join(getHomeDir(), ".agents", "skills");
const projectTrusted = this.settingsManager.isProjectTrusted(); const projectTrusted = this.settingsManager.isProjectTrusted();
const projectAgentsSkillDirs = projectTrusted const projectConfigDirs = projectTrusted
? collectAncestorAgentsSkillDirs(this.cwd).filter((dir) => resolve(dir) !== resolve(userAgentsSkillsDir)) ? collectAncestorConfigDirs(this.cwd, CONFIG_DIR_NAME).filter((dir) => resolve(dir) !== resolve(globalBaseDir))
: [];
const projectAgentsDirs = projectTrusted
? collectAncestorConfigDirs(this.cwd, ".agents").filter((dir) => resolve(dir) !== resolve(dirname(userAgentsSkillsDir)))
: []; : [];
const addResources = ( const addResources = (
@@ -2481,56 +2478,54 @@ export class DefaultPackageManager implements PackageManager {
} }
}; };
if (projectTrusted) { // Project resources from .pi/ in cwd and ancestors.
// Project extensions from .pi/ for (const configDir of projectConfigDirs) {
addResources( const configMetadata: PathMetadata = {
"extensions",
collectAutoExtensionEntries(projectDirs.extensions),
projectMetadata,
projectOverrides.extensions,
projectBaseDir,
);
// Project skills from .pi/
addResources(
"skills",
collectAutoSkillEntries(projectDirs.skills, "pi"),
projectMetadata,
projectOverrides.skills,
projectBaseDir,
);
}
// Project skills from .agents/ (each with its own baseDir)
for (const agentsSkillsDir of projectAgentsSkillDirs) {
const agentsBaseDir = dirname(agentsSkillsDir); // the .agents directory
const agentsMetadata: PathMetadata = {
...projectMetadata, ...projectMetadata,
baseDir: agentsBaseDir, baseDir: configDir,
}; };
addResources( addResources(
"skills", "extensions",
collectAutoSkillEntries(agentsSkillsDir, "agents"), collectAutoExtensionEntries(join(configDir, "extensions")),
agentsMetadata, configMetadata,
projectOverrides.skills, projectOverrides.extensions,
agentsBaseDir, configDir,
);
addResources(
"skills",
collectAutoSkillEntries(join(configDir, "skills"), "pi"),
configMetadata,
projectOverrides.skills,
configDir,
); );
}
if (projectTrusted) {
addResources( addResources(
"prompts", "prompts",
collectAutoPromptEntries(projectDirs.prompts), collectAutoPromptEntries(join(configDir, "prompts")),
projectMetadata, configMetadata,
projectOverrides.prompts, projectOverrides.prompts,
projectBaseDir, configDir,
); );
addResources( addResources(
"themes", "themes",
collectAutoThemeEntries(projectDirs.themes), collectAutoThemeEntries(join(configDir, "themes")),
projectMetadata, configMetadata,
projectOverrides.themes, projectOverrides.themes,
projectBaseDir, configDir,
);
}
// Project skills from .agents/ in cwd and ancestors.
for (const agentsDir of projectAgentsDirs) {
const agentsMetadata: PathMetadata = {
...projectMetadata,
baseDir: agentsDir,
};
addResources(
"skills",
collectAutoSkillEntries(join(agentsDir, "skills"), "agents"),
agentsMetadata,
projectOverrides.skills,
agentsDir,
); );
} }