@cratis/pi 2.0.2 → 2.0.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.
|
@@ -8,18 +8,18 @@ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
|
8
8
|
|
|
9
9
|
const corpusRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..');
|
|
10
10
|
|
|
11
|
-
/** Loads
|
|
11
|
+
/** Loads every rule from the managed corpus, including general guidance when AGENTS.md is project-owned. */
|
|
12
12
|
export function managedRules(cwd: string): string {
|
|
13
13
|
const managedRoot = join(cwd, '.cratis', 'ai', 'rules');
|
|
14
14
|
const rulesRoot = existsSync(managedRoot) ? managedRoot : join(corpusRoot, 'rules');
|
|
15
15
|
return readdirSync(rulesRoot, { recursive: true, encoding: 'utf8' })
|
|
16
|
-
.filter((entry): entry is string => entry.endsWith('.md')
|
|
16
|
+
.filter((entry): entry is string => entry.endsWith('.md'))
|
|
17
17
|
.sort()
|
|
18
18
|
.map(entry => readFileSync(join(rulesRoot, entry), 'utf8'))
|
|
19
19
|
.join('\n\n');
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/** Adds every
|
|
22
|
+
/** Adds every managed Cratis rule to Pi without requiring the @cratis/pi package. */
|
|
23
23
|
export default function (pi: ExtensionAPI): void {
|
|
24
24
|
pi.on('before_agent_start', (event, context) => ({
|
|
25
25
|
systemPrompt: `${event.systemPrompt}\n\n${managedRules(context.cwd)}`,
|