@justram/pie 0.2.5 → 0.2.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # Changelog
2
-
3
2
  ## [Unreleased]
4
3
 
5
4
  ### Breaking Changes
@@ -12,6 +11,40 @@
12
11
 
13
12
  ### Removed
14
13
 
14
+
15
+ ## 0.2.7
16
+
17
+ ### Breaking Changes
18
+
19
+ ### Added
20
+
21
+ - Added http-proxy example showing HTTP proxy environment variable routing.
22
+ - Added unit test covering HTTP proxy environment routing.
23
+
24
+ ### Changed
25
+
26
+ - Updated @mariozechner/pi-ai to v0.50.1 (includes HTTP proxy env support).
27
+
28
+ ### Fixed
29
+
30
+ ### Removed
31
+
32
+
33
+ ## 0.2.6
34
+
35
+ ### Breaking Changes
36
+
37
+ ### Added
38
+
39
+ - Added SDK helper utilities for checking updates and formatting update notifications.
40
+ - Added CLI update notification that checks npm registry for newer versions.
41
+
42
+ ### Changed
43
+
44
+ ### Fixed
45
+
46
+ ### Removed
47
+
15
48
  ## 0.2.5
16
49
 
17
50
  ### Breaking Changes
package/README.md CHANGED
@@ -110,6 +110,10 @@ Auth file entries take precedence over environment variables. To switch from OAu
110
110
 
111
111
  Edit or delete `~/.pi/agent/auth.json` to remove a provider and force re-login.
112
112
 
113
+ ## Release
114
+
115
+ See [docs/release.md](docs/release.md) for the release checklist.
116
+
113
117
  ## SDK Usage
114
118
 
115
119
  ```ts
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export { loadRecipeSetup, loadRecipes, resolveRecipe, } from "./recipes/index.js
12
12
  export type { ExtractionSetup, LoadExtractionSetupOptions } from "./setup.js";
13
13
  export { loadExtractionSetup } from "./setup.js";
14
14
  export type { ExtractOptions, ExtractResult, ExtractStream, ThinkingBudgets, ThinkingLevel, Usage } from "./types.js";
15
+ export { checkForUpdates, formatUpdateNotification, type UpdateInfo } from "./update.js";
package/dist/index.js CHANGED
@@ -7,3 +7,4 @@ export { extract, extractSync } from "./extract.js";
7
7
  export { getModel, getModels, getProviders } from "./models.js";
8
8
  export { loadRecipeSetup, loadRecipes, resolveRecipe, } from "./recipes/index.js";
9
9
  export { loadExtractionSetup } from "./setup.js";
10
+ export { checkForUpdates, formatUpdateNotification } from "./update.js";
package/dist/main.js CHANGED
@@ -11,6 +11,7 @@ import { loadExtractionSetupFromContent } from "./core/setup.js";
11
11
  import { extract } from "./extract.js";
12
12
  import { getModels, getProviders } from "./models.js";
13
13
  import { loadRecipeSetup, loadRecipes } from "./recipes/index.js";
14
+ import { checkForUpdates, formatUpdateNotification, getVersion } from "./update.js";
14
15
  const MODEL_PROVIDER_PREFERENCE = ["anthropic", "openai", "google"];
15
16
  class CliExitError extends Error {
16
17
  exitCode;
@@ -121,6 +122,7 @@ async function runCliInternal(argv, deps, stdout, stderr) {
121
122
  }
122
123
  return 0;
123
124
  }
125
+ startVersionCheck(stderr);
124
126
  const promptInput = args.promptFile ? readTextFile(args.promptFile, "prompt") : args.prompt;
125
127
  const promptPath = args.promptFile ? resolve(args.promptFile) : undefined;
126
128
  const promptIsSetup = !args.config && !useRecipe && typeof promptInput === "string" && promptInput.startsWith("---");
@@ -591,11 +593,14 @@ function mapExtractionExitCode(error) {
591
593
  function writeLine(stream, message) {
592
594
  stream.write(`${message}\n`);
593
595
  }
594
- function getVersion() {
595
- const pkgPath = new URL("../package.json", import.meta.url);
596
- const raw = readFileSync(pkgPath, "utf8");
597
- const pkg = JSON.parse(raw);
598
- return pkg.version ?? "0.0.0";
596
+ function startVersionCheck(stderr) {
597
+ void checkForUpdates().then((info) => {
598
+ if (!info)
599
+ return;
600
+ for (const line of formatUpdateNotification(info)) {
601
+ writeLine(stderr, line);
602
+ }
603
+ });
599
604
  }
600
605
  async function readStream(stream) {
601
606
  return await new Promise((resolveStream, reject) => {
@@ -0,0 +1,10 @@
1
+ export interface UpdateInfo {
2
+ packageName: string;
3
+ currentVersion: string;
4
+ latestVersion: string;
5
+ }
6
+ export declare function getVersion(): string;
7
+ export declare function checkForUpdates(options?: {
8
+ skipEnv?: boolean;
9
+ }): Promise<UpdateInfo | undefined>;
10
+ export declare function formatUpdateNotification(info: UpdateInfo): string[];
package/dist/update.js ADDED
@@ -0,0 +1,42 @@
1
+ import { readFileSync } from "node:fs";
2
+ function getPackageInfo() {
3
+ const pkgPath = new URL("../package.json", import.meta.url);
4
+ const raw = readFileSync(pkgPath, "utf8");
5
+ const pkg = JSON.parse(raw);
6
+ return {
7
+ name: pkg.name ?? "pie",
8
+ version: pkg.version ?? "0.0.0",
9
+ };
10
+ }
11
+ export function getVersion() {
12
+ return getPackageInfo().version;
13
+ }
14
+ export async function checkForUpdates(options = {}) {
15
+ if (!options.skipEnv && process.env.PI_SKIP_VERSION_CHECK)
16
+ return undefined;
17
+ const { name, version } = getPackageInfo();
18
+ try {
19
+ const response = await fetch(`https://registry.npmjs.org/${name}/latest`);
20
+ if (!response.ok)
21
+ return undefined;
22
+ const data = (await response.json());
23
+ const latestVersion = data.version;
24
+ if (latestVersion && latestVersion !== version) {
25
+ return {
26
+ packageName: name,
27
+ currentVersion: version,
28
+ latestVersion,
29
+ };
30
+ }
31
+ return undefined;
32
+ }
33
+ catch {
34
+ return undefined;
35
+ }
36
+ }
37
+ export function formatUpdateNotification(info) {
38
+ return [
39
+ `Update available for ${info.packageName}: v${info.latestVersion} (current v${info.currentVersion}). Run: npm install -g ${info.packageName}`,
40
+ "Changelog: https://github.com/justram/pie/blob/main/CHANGELOG.md",
41
+ ];
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justram/pie",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Structured extraction library and CLI built on @mariozechner/pi-ai.",
5
5
  "homepage": "https://github.com/justram/pie#readme",
6
6
  "repository": {
@@ -58,32 +58,28 @@
58
58
  "test:watch": "vitest",
59
59
  "test:e2e": "vitest run --config vitest.config.e2e.ts",
60
60
  "clean": "rm -rf dist",
61
- "version:patch": "npm version patch --no-git-tag-version && node scripts/sync-versions.js",
62
- "version:minor": "npm version minor --no-git-tag-version && node scripts/sync-versions.js",
63
- "version:major": "npm version major --no-git-tag-version && node scripts/sync-versions.js",
64
- "version:set": "npm version --no-git-tag-version",
65
61
  "prepublishOnly": "npm run clean && npm run build && npm run check",
66
- "publish:public": "npm run prepublishOnly && npm publish --access public",
67
- "publish:dry": "npm run prepublishOnly && npm publish --access public --dry-run",
62
+ "publish:public": "npm publish --access public",
63
+ "publish:dry": "npm publish --access public --dry-run",
68
64
  "release:patch": "node scripts/release.mjs patch",
69
65
  "release:minor": "node scripts/release.mjs minor",
70
- "release:major": "node scripts/release.mjs major",
71
- "prepare": "husky"
66
+ "release:push": "git push origin main --tags",
67
+ "release:github": "node scripts/release-github.mjs"
72
68
  },
73
69
  "dependencies": {
74
- "@mariozechner/pi-ai": "^0.49.2",
70
+ "@mariozechner/pi-ai": "^0.50.1",
75
71
  "@silvia-odwyer/photon-node": "^0.3.4",
76
72
  "@sinclair/typebox": "^0.34.46",
77
73
  "minijinja-js": "^2.14.0"
78
74
  },
79
75
  "devDependencies": {
80
76
  "@biomejs/biome": "^2.3.11",
77
+ "@j178/prek": "^0.3.0",
81
78
  "@types/node": "^22.10.2",
82
79
  "@typescript-eslint/parser": "^8.46.0",
83
80
  "eslint": "^9.36.0",
84
81
  "eslint-plugin-simple-import-sort": "^12.1.1",
85
82
  "fast-check": "^4.5.3",
86
- "husky": "^9.1.7",
87
83
  "typescript": "^5.9.3",
88
84
  "vitest": "^4.0.16"
89
85
  }