diff --git a/README.md b/README.md index b2d827d..ff2652b 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,17 @@ ## Install -Use it as a local package root today: +Local path: ```bash pi install /absolute/path/to/context-manager ``` -After this folder is moved into its own repository, the same package can be installed from git. +Git: + +```bash +pi install https://gitea.rwiesner.com/pi/pi-context-manager +``` ## Resources diff --git a/package.json b/package.json index 0f9a2cb..bfaea44 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,13 @@ { "name": "pi-context-manager", "version": "0.1.0", + "description": "Pi extension package for context-pressure management, snapshots, resume packets, and branch-summary compaction behavior.", "type": "module", "keywords": ["pi-package"], + "repository": { + "type": "git", + "url": "https://gitea.rwiesner.com/pi/pi-context-manager" + }, "scripts": { "test": "tsx --test src/*.test.ts" }, diff --git a/src/package-manifest.test.ts b/src/package-manifest.test.ts index dc75f2a..9757e8c 100644 --- a/src/package-manifest.test.ts +++ b/src/package-manifest.test.ts @@ -1,17 +1,36 @@ import test from "node:test"; import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; import { existsSync, readFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); const pkg = JSON.parse(readFileSync(resolve(packageRoot, "package.json"), "utf8")); +const readme = readFileSync(resolve(packageRoot, "README.md"), "utf8"); + +function getPackedPaths() { + const output = execFileSync("npm", ["pack", "--dry-run", "--json"], { + cwd: packageRoot, + encoding: "utf8", + }); + const [packResult] = JSON.parse(output) as Array<{ files: Array<{ path: string }> }>; + return packResult.files.map((file) => file.path); +} test("package.json exposes pi-context-manager as a standalone pi package", () => { assert.equal(pkg.name, "pi-context-manager"); assert.equal(pkg.type, "module"); + assert.equal( + pkg.description, + "Pi extension package for context-pressure management, snapshots, resume packets, and branch-summary compaction behavior.", + ); assert.ok(Array.isArray(pkg.keywords)); assert.ok(pkg.keywords.includes("pi-package")); + assert.deepEqual(pkg.repository, { + type: "git", + url: "https://gitea.rwiesner.com/pi/pi-context-manager", + }); assert.deepEqual(pkg.pi, { extensions: ["./index.ts"], }); @@ -26,3 +45,17 @@ test("package.json exposes pi-context-manager as a standalone pi package", () => assert.ok(existsSync(resolve(packageRoot, "index.ts"))); assert.ok(existsSync(resolve(packageRoot, "src/runtime.ts"))); }); + +test("README documents local and git installation", () => { + assert.match(readme, /pi install \/absolute\/path\/to\/context-manager/); + assert.match(readme, /pi install https:\/\/gitea\.rwiesner\.com\/pi\/pi-context-manager/); +}); + +test("npm pack includes runtime package assets", () => { + const packedPaths = getPackedPaths(); + + assert.ok(packedPaths.includes("README.md")); + assert.ok(packedPaths.includes("package.json")); + assert.ok(packedPaths.includes("index.ts")); + assert.ok(packedPaths.includes("src/runtime.ts")); +});