build(pi): integrate vendored Pi 1.3.0
This commit was merged in pull request #189.
This commit is contained in:
@@ -118,6 +118,7 @@
|
||||
- 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`.
|
||||
- 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.
|
||||
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.
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
pi-coding-agent,
|
||||
root,
|
||||
}:
|
||||
pi-coding-agent.overrideAttrs {
|
||||
src = root + "/third_party/pi";
|
||||
patches = [ ];
|
||||
{ pkgs, root }:
|
||||
pkgs.callPackage (root + "/third_party/pi/nix/package.nix") {
|
||||
source = root + "/third_party/pi";
|
||||
}
|
||||
|
||||
@@ -471,14 +471,14 @@ function findGitRepoRoot(startDir: string): string | null {
|
||||
}
|
||||
}
|
||||
|
||||
function collectAncestorAgentsSkillDirs(startDir: string): string[] {
|
||||
const skillDirs: string[] = [];
|
||||
function collectAncestorConfigDirs(startDir: string, configDirName: string): string[] {
|
||||
const configDirs: string[] = [];
|
||||
const resolvedStartDir = resolve(startDir);
|
||||
const gitRepoRoot = findGitRepoRoot(resolvedStartDir);
|
||||
|
||||
let dir = resolvedStartDir;
|
||||
while (true) {
|
||||
skillDirs.push(join(dir, ".agents", "skills"));
|
||||
configDirs.push(join(dir, configDirName));
|
||||
if (gitRepoRoot && dir === gitRepoRoot) {
|
||||
break;
|
||||
}
|
||||
@@ -489,7 +489,7 @@ function collectAncestorAgentsSkillDirs(startDir: string): string[] {
|
||||
dir = parent;
|
||||
}
|
||||
|
||||
return skillDirs;
|
||||
return configDirs;
|
||||
}
|
||||
|
||||
function collectAutoPromptEntries(dir: string): string[] {
|
||||
@@ -2455,16 +2455,13 @@ export class DefaultPackageManager implements PackageManager {
|
||||
prompts: join(globalBaseDir, "prompts"),
|
||||
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 projectTrusted = this.settingsManager.isProjectTrusted();
|
||||
const projectAgentsSkillDirs = projectTrusted
|
||||
? collectAncestorAgentsSkillDirs(this.cwd).filter((dir) => resolve(dir) !== resolve(userAgentsSkillsDir))
|
||||
const projectConfigDirs = projectTrusted
|
||||
? 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 = (
|
||||
@@ -2481,56 +2478,54 @@ export class DefaultPackageManager implements PackageManager {
|
||||
}
|
||||
};
|
||||
|
||||
if (projectTrusted) {
|
||||
// Project extensions from .pi/
|
||||
addResources(
|
||||
"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 = {
|
||||
// Project resources from .pi/ in cwd and ancestors.
|
||||
for (const configDir of projectConfigDirs) {
|
||||
const configMetadata: PathMetadata = {
|
||||
...projectMetadata,
|
||||
baseDir: agentsBaseDir,
|
||||
baseDir: configDir,
|
||||
};
|
||||
addResources(
|
||||
"skills",
|
||||
collectAutoSkillEntries(agentsSkillsDir, "agents"),
|
||||
agentsMetadata,
|
||||
projectOverrides.skills,
|
||||
agentsBaseDir,
|
||||
"extensions",
|
||||
collectAutoExtensionEntries(join(configDir, "extensions")),
|
||||
configMetadata,
|
||||
projectOverrides.extensions,
|
||||
configDir,
|
||||
);
|
||||
addResources(
|
||||
"skills",
|
||||
collectAutoSkillEntries(join(configDir, "skills"), "pi"),
|
||||
configMetadata,
|
||||
projectOverrides.skills,
|
||||
configDir,
|
||||
);
|
||||
}
|
||||
|
||||
if (projectTrusted) {
|
||||
addResources(
|
||||
"prompts",
|
||||
collectAutoPromptEntries(projectDirs.prompts),
|
||||
projectMetadata,
|
||||
collectAutoPromptEntries(join(configDir, "prompts")),
|
||||
configMetadata,
|
||||
projectOverrides.prompts,
|
||||
projectBaseDir,
|
||||
configDir,
|
||||
);
|
||||
addResources(
|
||||
"themes",
|
||||
collectAutoThemeEntries(projectDirs.themes),
|
||||
projectMetadata,
|
||||
collectAutoThemeEntries(join(configDir, "themes")),
|
||||
configMetadata,
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user