pi-cc-extensions 0.1.2 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cc-extensions",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "Personal extensions for the Pi coding agent",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -16,13 +16,17 @@
16
16
  "extensions": [
17
17
  "./extensions/claude-code-style.ts",
18
18
  "./extensions/context.ts",
19
- "./extensions/session-reference/index.ts"
19
+ "./extensions/session-reference/index.ts",
20
+ "./extensions/agent-autocomplete.ts"
20
21
  ]
21
22
  },
22
23
  "scripts": {
23
- "test": "node --test extensions/session-reference/core.test.ts",
24
- "prepublishOnly": "npm test",
25
- "release": "npm publish"
24
+ "test": "node --test tests/**/*.test.ts",
25
+ "typecheck": "node scripts/typecheck.mjs",
26
+ "postversion": "npm run typecheck && npm test && git push && git push --tags",
27
+ "release": "npm version patch && npm publish",
28
+ "release:minor": "npm version minor && npm publish",
29
+ "release:major": "npm version major && npm publish"
26
30
  },
27
31
  "peerDependencies": {
28
32
  "@earendil-works/pi-ai": "*",
@@ -31,5 +35,8 @@
31
35
  },
32
36
  "engines": {
33
37
  "node": ">=22.19.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^26.1.1"
34
41
  }
35
42
  }
@@ -1,74 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import test from "node:test";
3
- import { Buffer } from "node:buffer";
4
- import {
5
- SESSION_REFERENCE_CUSTOM_TYPE,
6
- buildReferenceContent,
7
- extractSessionReferenceIds,
8
- sessionTitle,
9
- truncateUtf8,
10
- } from "./core.ts";
11
-
12
- const info = {
13
- id: "019f78f7-526e-78ac-afa5-ff6d5e06beb8",
14
- cwd: "/repo",
15
- firstMessage: " Refactor\n\tthe auth module ",
16
- messageCount: 2,
17
- modified: new Date("2025-01-02T03:04:05.000Z"),
18
- };
19
-
20
- test("extractSessionReferenceIds finds boundary-delimited references and deduplicates them", () => {
21
- assert.deepEqual(
22
- extractSessionReferenceIds(
23
- "Use @session:abc-123 and\n@session:def_456.v2, then @session:abc-123. Ignore x@session:nope.",
24
- ),
25
- ["abc-123", "def_456.v2"],
26
- );
27
- });
28
-
29
- test("sessionTitle normalizes and truncates display text", () => {
30
- assert.equal(sessionTitle(info), "Refactor the auth module");
31
- assert.equal(sessionTitle({ ...info, name: "Named session" }), "Named session");
32
- assert.equal(sessionTitle({ ...info, name: "123456789" }, 6), "12345…");
33
- });
34
-
35
- test("truncateUtf8 enforces byte limits for multibyte content", () => {
36
- const result = truncateUtf8("你".repeat(1_000), 100);
37
- assert.ok(Buffer.byteLength(result, "utf8") <= 100);
38
- assert.match(result, /truncated/);
39
- });
40
-
41
- test("buildReferenceContent formats active context and drops nested references", () => {
42
- const content = buildReferenceContent([
43
- {
44
- info,
45
- messages: [
46
- { role: "user", content: "Implement it" },
47
- { role: "assistant", content: [{ type: "text", text: "Done" }] },
48
- {
49
- role: "custom",
50
- customType: SESSION_REFERENCE_CUSTOM_TYPE,
51
- content: "nested prior reference",
52
- },
53
- ],
54
- },
55
- ]);
56
-
57
- assert.match(content, /Referenced Pi sessions/);
58
- assert.match(content, /User: Implement it/);
59
- assert.match(content, /Assistant: Done/);
60
- assert.doesNotMatch(content, /nested prior reference/);
61
- });
62
-
63
- test("buildReferenceContent enforces incremental session and total byte limits", () => {
64
- const messages = Array.from({ length: 1_000 }, (_, index) => ({
65
- role: "user",
66
- content: `${index}: ${"x".repeat(1_000)}`,
67
- }));
68
- const content = buildReferenceContent(
69
- [{ info, messages }],
70
- { maxMessageBytes: 400, maxSessionBytes: 2_000, maxTotalBytes: 1_000 },
71
- );
72
- assert.ok(Buffer.byteLength(content, "utf8") <= 1_000);
73
- assert.match(content, /truncated/);
74
- });