@mmon-co/ncept-pi 0.0.0-stage → 0.2.0

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/src/init.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { join, resolve } from "node:path";
3
+ import { init } from "@mmon-co/ncept-local";
4
+ import { tutorSystemPrompt } from "@mmon-co/ncept-default-theory";
5
+
6
+ /** Create a learning project without changing the user's pi agent directory. */
7
+ export async function initProject(directory: string): Promise<string> {
8
+ const dir = resolve(directory);
9
+ await init(dir);
10
+ await mkdir(join(dir, ".pi"), { recursive: true });
11
+ await writeFile(
12
+ join(dir, ".pi/settings.json"),
13
+ JSON.stringify({ packages: ["npm:@mmon-co/ncept-pi"], sessionDir: "sessions", codemode: { mode: "on" } }, null, 2) +
14
+ "\n",
15
+ { flag: "wx" },
16
+ );
17
+ await writeFile(join(dir, ".pi/SYSTEM.md"), tutorSystemPrompt("empty") + "\n", { flag: "wx" });
18
+ return dir;
19
+ }