ptbk 0.113.0-5 → 0.113.0-6

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.
@@ -6,98 +6,12 @@
6
6
  * Note: [🔺] Purpose of this file is to forward `ptbk` package launches to `@promptbook/cli`
7
7
  */
8
8
 
9
- const { realpathSync } = require('fs');
10
- const { dirname, resolve } = require('path');
9
+ const { dirname } = require('path');
11
10
 
12
- const PROMPTBOOK_CLI_BIN_PATH = '@promptbook/cli/bin/promptbook-cli.js';
13
- const PROMPTBOOK_PACKAGE_JSON_PATH = 'promptbook/package.json';
14
- const PTBK_PACKAGE_JSON_PATH = 'ptbk/package.json';
15
- const PTBK_PROXY_BIN_PATH = 'bin/promptbook-cli-proxy.js';
16
- const CURRENT_PACKAGE_ROOT = resolve(__dirname, '..');
11
+ // Resolve through `promptbook` so the proxy works for both hoisted and nested installs.
12
+ const promptbookPackageRoot = dirname(require.resolve('promptbook/package.json'));
13
+ const promptbookCliEntrypoint = require.resolve('@promptbook/cli/bin/promptbook-cli.js', {
14
+ paths: [promptbookPackageRoot, __dirname],
15
+ });
17
16
 
18
- const localPtbkEntrypoint = resolveLocalPtbkEntrypoint();
19
-
20
- if (localPtbkEntrypoint !== null) {
21
- require(localPtbkEntrypoint);
22
- } else {
23
- require(resolvePromptbookCliEntrypoint());
24
- }
25
-
26
- /**
27
- * Resolves a cwd-local `ptbk` launcher when this proxy was reached from another install.
28
- *
29
- * This keeps `ptbk about` aligned with the project dependency even when another
30
- * `ptbk` install appears earlier on PATH.
31
- */
32
- function resolveLocalPtbkEntrypoint() {
33
- const localPtbkPackageJsonPath = tryRequireResolve(PTBK_PACKAGE_JSON_PATH, [process.cwd()]);
34
-
35
- if (localPtbkPackageJsonPath === null) {
36
- return null;
37
- }
38
-
39
- const localPtbkPackageRoot = dirname(localPtbkPackageJsonPath);
40
-
41
- if (isSameFilesystemPath(localPtbkPackageRoot, CURRENT_PACKAGE_ROOT)) {
42
- return null;
43
- }
44
-
45
- return resolve(localPtbkPackageRoot, PTBK_PROXY_BIN_PATH);
46
- }
47
-
48
- /**
49
- * Resolves the CLI binary from this package graph.
50
- */
51
- function resolvePromptbookCliEntrypoint() {
52
- const directPromptbookCliEntrypoint = tryRequireResolve(PROMPTBOOK_CLI_BIN_PATH, [
53
- CURRENT_PACKAGE_ROOT,
54
- __dirname,
55
- ]);
56
-
57
- if (directPromptbookCliEntrypoint !== null) {
58
- return directPromptbookCliEntrypoint;
59
- }
60
-
61
- const promptbookPackageRoot = dirname(
62
- require.resolve(PROMPTBOOK_PACKAGE_JSON_PATH, {
63
- paths: [CURRENT_PACKAGE_ROOT, __dirname],
64
- }),
65
- );
66
-
67
- return require.resolve(PROMPTBOOK_CLI_BIN_PATH, {
68
- paths: [promptbookPackageRoot, CURRENT_PACKAGE_ROOT, __dirname],
69
- });
70
- }
71
-
72
- /**
73
- * Resolves a module path and returns `null` when it cannot be resolved.
74
- */
75
- function tryRequireResolve(modulePath, resolvePaths) {
76
- try {
77
- return require.resolve(modulePath, { paths: resolvePaths });
78
- } catch {
79
- return null;
80
- }
81
- }
82
-
83
- /**
84
- * Compares filesystem paths after resolving symlinks where possible.
85
- */
86
- function isSameFilesystemPath(firstPath, secondPath) {
87
- return normalizeFilesystemPath(firstPath) === normalizeFilesystemPath(secondPath);
88
- }
89
-
90
- /**
91
- * Normalizes one filesystem path for cross-platform comparisons.
92
- */
93
- function normalizeFilesystemPath(path) {
94
- let resolvedPath = resolve(path);
95
-
96
- try {
97
- resolvedPath = realpathSync(resolvedPath);
98
- } catch {
99
- // Keep the resolved path when a transient install path cannot be realpathed.
100
- }
101
-
102
- return process.platform === 'win32' ? resolvedPath.toLowerCase() : resolvedPath;
103
- }
17
+ require(promptbookCliEntrypoint);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptbk",
3
- "version": "0.113.0-5",
3
+ "version": "0.113.0-6",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -91,11 +91,10 @@
91
91
  "zod": "$zod"
92
92
  },
93
93
  "peerDependencies": {
94
- "@promptbook/core": "0.113.0-5"
94
+ "@promptbook/core": "0.113.0-6"
95
95
  },
96
96
  "dependencies": {
97
- "@promptbook/cli": "0.113.0-5",
98
- "promptbook": "0.113.0-5"
97
+ "promptbook": "0.113.0-6"
99
98
  },
100
99
  "bin": {
101
100
  "ptbk": "bin/promptbook-cli-proxy.js"