Skip to content

Commit 6f63ca5

Browse files
authored
chore(deps): migrate pi-continuous-learning to @earendil-works namespace (#120)
## Summary Migrates `packages/pi-continuous-learning` from the deprecated `@mariozechner/*@^0.62.0` packages to `@earendil-works/*@^0.74.0`, mirroring what PR #102 did for `pi-simplify`. - Updates `peerDependencies` in `package.json` to `@earendil-works/pi-coding-agent`, `@earendil-works/pi-ai`, and `@earendil-works/pi-tui` at `^0.74.0` - Replaces all `@mariozechner/*` import specifiers across 32 source and test files - Fixes all type errors arising from API shape changes between versions ## API shape changes fixed ### `loadSkills` — new required options `loadSkills` now requires `agentDir`, `skillPaths`, and `includeDefaults` in addition to `cwd`. Updated all three call sites: - `src/index.ts` (session_start hook) - Two dynamic `import()` calls in `src/cli/analyze.ts` All now pass `getAgentDir()`, `[]`, and `true` for the new fields. ### `ExtensionUIContext` — new required methods The `ExtensionUIContext` interface gained five new required methods between 0.62 and 0.74: `setWorkingVisible`, `setWorkingIndicator`, `setHiddenThinkingLabel`, `addAutocompleteProvider`, and `getEditorComponent`. Added these as `vi.fn()` stubs to the test mock in `src/analysis-notification.test.ts`. ### `ExtensionContext` — new `signal` property `ExtensionContext` now declares `signal: AbortSignal | undefined`. Added to the test mock alongside the existing fields. ### TypeBox / `StringEnum` compatibility `@earendil-works/pi-ai` now re-exports `Type` and `Static` from `typebox@^1.1.x` (not `@sinclair/typebox@0.34`). The `StringEnum` helper it exports returns `TUnsafe<T>` which extends `TSchema` from `typebox@1.x` — but is structurally incompatible with `@sinclair/typebox@0.34`'s `TSchema`. Fixed in `fact-tools.ts` and `instinct-tools.ts` by switching all three imports (`Type`, `Static`, `StringEnum`) from `@sinclair/typebox` / `@earendil-works/pi-ai` to importing everything from `@earendil-works/pi-ai` (which re-exports the compatible v1 `Type` and `Static`). ## Test plan - [x] `npm run typecheck -w packages/pi-continuous-learning` — 0 errors - [x] `npm run test -w packages/pi-continuous-learning` — 839 tests pass across 52 test files
1 parent a6dacc2 commit 6f63ca5

34 files changed

Lines changed: 54 additions & 50 deletions

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/pi-continuous-learning/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
"prepack": "test -d dist || { echo 'Error: dist/ missing. Run npm run build first.' && exit 1; }"
6262
},
6363
"peerDependencies": {
64-
"@mariozechner/pi-coding-agent": "^0.62.0",
65-
"@mariozechner/pi-ai": "^0.62.0",
66-
"@mariozechner/pi-tui": "^0.62.0",
64+
"@earendil-works/pi-coding-agent": "^0.74.0",
65+
"@earendil-works/pi-ai": "^0.74.0",
66+
"@earendil-works/pi-tui": "^0.74.0",
6767
"@sinclair/typebox": "^0.34.0"
6868
},
6969
"devDependencies": {

packages/pi-continuous-learning/src/analysis-notification.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
appendAnalysisEvent,
1111
type AnalysisEvent,
1212
} from "./analysis-event-log.js";
13-
import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
13+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
1414

1515
// ---------------------------------------------------------------------------
1616
// Helpers
@@ -38,6 +38,11 @@ function makeMockCtx(): ExtensionContext {
3838
onTerminalInput: vi.fn(),
3939
setStatus: vi.fn(),
4040
setWorkingMessage: vi.fn(),
41+
setWorkingVisible: vi.fn(),
42+
setWorkingIndicator: vi.fn(),
43+
setHiddenThinkingLabel: vi.fn(),
44+
addAutocompleteProvider: vi.fn(),
45+
getEditorComponent: vi.fn(),
4146
setWidget: vi.fn(),
4247
setFooter: vi.fn(),
4348
setHeader: vi.fn(),
@@ -63,6 +68,7 @@ function makeMockCtx(): ExtensionContext {
6368
modelRegistry: {} as unknown as ExtensionContext["modelRegistry"],
6469
model: undefined,
6570
isIdle: vi.fn(),
71+
signal: undefined,
6672
abort: vi.fn(),
6773
hasPendingMessages: vi.fn(),
6874
shutdown: vi.fn(),

packages/pi-continuous-learning/src/analysis-notification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* last session interaction.
77
*/
88

9-
import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
9+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
1010
import {
1111
consumeAnalysisEvents,
1212
type AnalysisEvent,

packages/pi-continuous-learning/src/cli/analyze-model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { AuthStorage } from "@mariozechner/pi-coding-agent";
1+
import type { AuthStorage } from "@earendil-works/pi-coding-agent";
22
import {
33
getModel,
44
getProviders,
55
type Api,
66
type KnownProvider,
77
type Model,
8-
} from "@mariozechner/pi-ai";
8+
} from "@earendil-works/pi-ai";
99
import type { Config } from "../types.js";
1010

1111
type AnalyzerAuthStorage = Pick<AuthStorage, "getApiKey">;

packages/pi-continuous-learning/src/cli/analyze-single-shot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* The model receives all current instincts inline and returns a JSON change-set.
66
* Changes are applied client-side, eliminating the ~16x cache-read multiplier.
77
*/
8-
import type { AssistantMessage, Context } from "@mariozechner/pi-ai";
9-
import { complete } from "@mariozechner/pi-ai";
8+
import type { AssistantMessage, Context } from "@earendil-works/pi-ai";
9+
import { complete } from "@earendil-works/pi-ai";
1010
import type { Instinct } from "../types.js";
1111
import { serializeInstinct } from "../instinct-parser.js";
1212

packages/pi-continuous-learning/src/cli/analyze.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "node:fs";
99
import { createHash } from "node:crypto";
1010
import { join } from "node:path";
11-
import { AuthStorage } from "@mariozechner/pi-coding-agent";
11+
import { AuthStorage } from "@earendil-works/pi-coding-agent";
1212

1313
import { loadConfig, DEFAULT_CONFIG } from "../config.js";
1414
import type { InstalledSkill, ProjectEntry } from "../types.js";
@@ -325,8 +325,8 @@ async function analyzeProject(
325325

326326
let installedSkills: InstalledSkill[] = [];
327327
try {
328-
const { loadSkills } = await import("@mariozechner/pi-coding-agent");
329-
const result = loadSkills({ cwd: project.root });
328+
const { loadSkills, getAgentDir } = await import("@earendil-works/pi-coding-agent");
329+
const result = loadSkills({ cwd: project.root, agentDir: getAgentDir(), skillPaths: [], includeDefaults: true });
330330
installedSkills = result.skills.map(
331331
(s: { name: string; description: string }) => ({
332332
name: s.name,
@@ -645,8 +645,8 @@ async function consolidateProject(
645645

646646
let installedSkills: InstalledSkill[] = [];
647647
try {
648-
const { loadSkills } = await import("@mariozechner/pi-coding-agent");
649-
const result = loadSkills({ cwd: project.root });
648+
const { loadSkills, getAgentDir } = await import("@earendil-works/pi-coding-agent");
649+
const result = loadSkills({ cwd: project.root, agentDir: getAgentDir(), skillPaths: [], includeDefaults: true });
650650
installedSkills = result.skills.map(
651651
(s: { name: string; description: string }) => ({
652652
name: s.name,

packages/pi-continuous-learning/src/fact-tools.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
2-
import { Type, type Static } from "@sinclair/typebox";
3-
import { StringEnum } from "@mariozechner/pi-ai";
1+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2+
import { Type, type Static, StringEnum } from "@earendil-works/pi-ai";
43
import { unlinkSync, existsSync } from "node:fs";
54
import { join } from "node:path";
65
import type { Fact } from "./types.js";

packages/pi-continuous-learning/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { describe, it, expect, vi, beforeEach } from "vitest";
7-
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
7+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
88
import { COMMAND_NAME as STATUS_CMD } from "./instinct-status.js";
99
import { COMMAND_NAME as EXPORT_CMD } from "./instinct-export.js";
1010
import { COMMAND_NAME as IMPORT_CMD } from "./instinct-import.js";

packages/pi-continuous-learning/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import type {
1010
ExtensionAPI,
1111
ExtensionCommandContext,
12-
} from "@mariozechner/pi-coding-agent";
13-
import { loadSkills } from "@mariozechner/pi-coding-agent";
12+
} from "@earendil-works/pi-coding-agent";
13+
import { loadSkills, getAgentDir } from "@earendil-works/pi-coding-agent";
1414

1515
import { loadConfig } from "./config.js";
1616
import { detectProject } from "./project.js";
@@ -80,7 +80,7 @@ export default function (pi: ExtensionAPI): void {
8080
cleanOldArchives(project.id);
8181

8282
try {
83-
const result = loadSkills({ cwd: ctx.cwd });
83+
const result = loadSkills({ cwd: ctx.cwd, agentDir: getAgentDir(), skillPaths: [], includeDefaults: true });
8484
installedSkills = result.skills.map((s) => ({
8585
name: s.name,
8686
description: s.description,

0 commit comments

Comments
 (0)