ptbk 0.119.0-54 → 0.119.0-62

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.
@@ -30,8 +30,15 @@ export type IntendedUser = {
30
30
  */
31
31
  export declare function intendedUser(env?: NodeJS.ProcessEnv): IntendedUser;
32
32
  /**
33
- * The shared home-based container of new projects: exactly `<home>/ptbk/project/` (lowercase `ptbk`, singular
34
- * `project`, one child per independent project). It is only a filesystem container, never a project or repository.
33
+ * Selects an available home-based projects container without changing existing files. When a file blocks
34
+ * `<home>/ptbk/project`, try `ptbk-projects`, then numbered siblings. Preserve permission and other OS errors.
35
+ *
36
+ * @private shared default-location policy, including the pre-Node Windows installer
37
+ */
38
+ export declare function projectsRootForHome(home: string): string;
39
+ /**
40
+ * The shared home-based container for new projects, with a non-destructive fallback when a file blocks the preferred
41
+ * `<home>/ptbk/project/`. This is only a filesystem container, never a project or repository.
35
42
  *
36
43
  * @private user home and identity
37
44
  */
@@ -1,5 +1,5 @@
1
1
  import { execFileSync } from 'node:child_process';
2
- import { readFileSync } from 'node:fs';
2
+ import { lstatSync, readFileSync, statSync } from 'node:fs';
3
3
  import { lchown, lstat, readdir } from 'node:fs/promises';
4
4
  import { homedir, userInfo } from 'node:os';
5
5
  import { dirname, join, resolve } from 'node:path';
@@ -73,13 +73,54 @@ export function intendedUser(env = process.env) {
73
73
  return { name: account.name, home: account.home, uid: account.uid, gid: account.gid, scope: 'sudo' };
74
74
  }
75
75
  /**
76
- * The shared home-based container of new projects: exactly `<home>/ptbk/project/` (lowercase `ptbk`, singular
77
- * `project`, one child per independent project). It is only a filesystem container, never a project or repository.
76
+ * Selects an available home-based projects container without changing existing files. When a file blocks
77
+ * `<home>/ptbk/project`, try `ptbk-projects`, then numbered siblings. Preserve permission and other OS errors.
78
+ *
79
+ * @private shared default-location policy, including the pre-Node Windows installer
80
+ */
81
+ export function projectsRootForHome(home) {
82
+ /** Checks existing ancestors without creating a directory or replacing an occupied item. */
83
+ const available = (path) => {
84
+ for (let current = path;; current = dirname(current)) {
85
+ try {
86
+ const entry = lstatSync(current);
87
+ if (!entry.isSymbolicLink())
88
+ return entry.isDirectory();
89
+ try {
90
+ return statSync(current).isDirectory();
91
+ }
92
+ catch (error) {
93
+ if (['ENOENT', 'ENOTDIR'].includes(error.code ?? ''))
94
+ return false;
95
+ throw error;
96
+ }
97
+ }
98
+ catch (error) {
99
+ const code = error.code;
100
+ if (code === 'ENOTDIR')
101
+ return false;
102
+ if (code !== 'ENOENT')
103
+ throw error;
104
+ if (dirname(current) === current)
105
+ throw error;
106
+ }
107
+ }
108
+ };
109
+ for (let index = 0; index < 100; index++) {
110
+ const candidate = index === 0 ? join(home, 'ptbk', 'project') : join(home, index === 1 ? 'ptbk-projects' : `ptbk-projects-${index}`);
111
+ if (available(candidate))
112
+ return candidate;
113
+ }
114
+ throw new Error('No available home-based projects location was found. Choose a projects folder explicitly.');
115
+ }
116
+ /**
117
+ * The shared home-based container for new projects, with a non-destructive fallback when a file blocks the preferred
118
+ * `<home>/ptbk/project/`. This is only a filesystem container, never a project or repository.
78
119
  *
79
120
  * @private user home and identity
80
121
  */
81
122
  export function sharedProjectsRoot(env = process.env) {
82
- return join(intendedUser(env).home, 'ptbk', 'project');
123
+ return projectsRootForHome(intendedUser(env).home);
83
124
  }
84
125
  /**
85
126
  * The directories that do not exist yet on the way to a destination (outermost first): exactly what creating it adds.
@@ -1 +1 @@
1
- {"version":3,"file":"user-home.js","sourceRoot":"","sources":["../../src/common/user-home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAA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C,CAAE,CAAC,CAAC;AAC7C,CAAC"}
@@ -6,7 +6,7 @@
6
6
 
7
7
  Give nontechnical users, initially a marketing agency, a short path from downloading Promptbook to the existing interactive `ptbk init`. They must not need to understand npm, install Git/Node.js manually, choose a project location from scratch or type the first command. Instructions and demonstration videos can begin with the shared initializer already open in the selected desktop or terminal presentation.
8
8
 
9
- Windows is the initial scope; installers for other operating systems are future work. Offer the optional [local desktop client](desktop.md), selected by default, alongside the engine/CLI and optional Codex and Claude Code installations. Existing global/local npm and CLI-only workflows remain supported.
9
+ Windows is the initial scope; installers for other operating systems are future work. Offer the optional [local desktop client](desktop.md), selected by default, alongside the engine/CLI. Harness selection and installation, including Codex and Claude Code, belong to the ordinary project initializer rather than Windows installer components. Existing global/local npm and CLI-only workflows remain supported.
10
10
 
11
11
  The installer is a very thin bootstrap layer: prepare prerequisites, install the ordinary npm package, prepare an empty destination and launch the selected desktop client or ordinary CLI. Do not fork the engine, reimplement the initialization wizard, configure project tools/authentication separately or introduce another scheduler/updater. Project semantics remain in the [shared domain logic](../coding-standards/shared-logic.md).
12
12
 
@@ -26,7 +26,9 @@ Inspect Node.js, npm and Git individually in the environment of the user who wil
26
26
 
27
27
  An incompatible Node.js installation remains intact; the installer selects its private compatible runtime for Promptbook. An unusable Git installation needs an understandable repair decision. Preserve unrelated tools, package-manager settings, PATH entries and Git configuration. Do not invent a Git author or require a GitHub account in the installer; project Git setup belongs to init.
28
28
 
29
- Prepare a usable global `ptbk` installation for the initiating user. Show concise progress and the planned dependencies/changes; technical output can be available as diagnostics rather than the main interface. Ordinary OS permission prompts are allowed where needed, but use elevation only for operations that require it. Project creation and CLI handoff run as the original user, not as an elevated administrator or a different administrator account.
29
+ Before installation, show the actual detection results: compatible software already available and the missing Node.js/npm or Git that will be installed. Required missing dependencies cannot be deselected; do not ask users to decide whether a tool is installed or present generic "install if missing" options.
30
+
31
+ Prepare a usable global `ptbk` installation for the initiating user. Keep preparation in the installer window, with an animated progress bar and current stage, while capturing technical output in diagnostics. Do not open PowerShell, command prompt or download progress windows during preparation. The deliberately interactive CLI-only initializer is opened only after preparation succeeds. Ordinary OS permission prompts are allowed where needed, but use elevation only for operations that require it. Project creation and CLI handoff run as the original user, not as an elevated administrator or a different administrator account.
30
32
 
31
33
  Make the selected executables available immediately to the launched terminal, including fresh PATH changes, and to subsequent ordinary terminals. Do not require a log-out, manual environment-variable editing or a pre-existing Windows Terminal application. Never bypass OS security warnings or relax machine-wide execution policy to make launching work. An unavoidable platform/restart prerequisite is an explicit incomplete state with a recovery action, not a successful handoff.
32
34
 
@@ -34,8 +36,12 @@ Make the selected executables available immediately to the launched terminal, in
34
36
 
35
37
  Propose a writable projects root beneath the initiating user's actual home, defaulting to `<resolved-user-home>/ptbk/project/` under the shared [home/identity policy](workspace.md#home-directory-and-shared-projects-root). Show the resolved path and allow a different location. Create it if missing, otherwise reuse it. This is an ordinary container for independent project directories, not itself a Promptbook project, Git repository or global engine workspace.
36
38
 
39
+ If a legacy file or unavailable link occupies either segment of that default, select the shared safe alternative `<home>/ptbk-projects` (then numbered siblings when needed), explain the alternative and display its resolved path in the wizard. Preserve the occupying item, including an empty file. Reserve npm's extensionless `ptbk` launcher at its resolved global prefix even before it exists; do not create a projects directory where npm needs that launcher. Recheck the default after preparing Node/npm. Explicitly supplied or edited locations never move to another folder automatically. Read-only default discovery creates no project directories; create the accepted container only after the software location is known.
40
+
37
41
  Offer **Create the first project** with an editable, sensible folder name and a way to skip it. Create one empty child directory for the accepted project. Folder naming is not a project brief; intent is still collected by init. Do not prepopulate Books, `ptbk.json`, package metadata or `.git` in either the projects root or its new child.
38
42
 
43
+ Validate the complete projects root and valid Windows child name before installing or changing prerequisites or the CLI, and recheck before handoff. Create all missing parent directories using literal filesystem paths. A file where a directory is needed, inaccessible ancestor, unavailable link, or existing nonempty destination is an actionable folder error; preserve the conflicting item. An existing first-project directory link is refused rather than initializing outside the selected root. Keep the original failing path, ancestor types and underlying OS error in diagnostics. Skipping project creation does not require or create a projects root.
44
+
39
45
  Validate writability and valid Windows names before handoff. A collision must not overwrite content: offer another name or explicit reuse of an existing empty directory. Do not silently initialize a nonempty directory, create a duplicate project on retry, or interpret a project name as a path escaping the selected root. Spaces, Unicode and shell-special characters in valid paths must be handled safely without changing their meaning or executing them as commands.
40
46
 
41
47
  Skipping the first project leaves the CLI installed and reports that no project was initialized. It must not initialize the projects root as a fallback. With desktop selected, open its project overview without starting first-project setup on that launch; New project returns to shared init. CLI-only completion explains how to run init later.
@@ -52,7 +58,9 @@ If automatic terminal launch is unavailable, report the failed handoff distinctl
52
58
 
53
59
  ## Retry and preservation
54
60
 
55
- Separate preparation, directory creation and terminal handoff outcomes. A failed download, denied permission or package installation must stop the dependent steps, show the failed stage and a useful retry action, and retain readable diagnostics without secrets. Never launch an initializer against missing/unverified dependencies or claim a project is ready merely because the installer finished.
61
+ Separate preparation, directory creation and terminal handoff outcomes. A failed download, denied permission or package installation must stop the dependent steps, show the actual failed stage, error and useful retry action directly in the installer, and retain readable diagnostics without secrets. Unexpected PowerShell exceptions use the same result channel; no message may rely on a separate terminal window. Retry transient downloads and verify their checksums before use. Never launch an initializer against missing/unverified dependencies or claim a project is ready merely because the installer finished.
62
+
63
+ Every handled preparation error, invalid destination and installed-version decision offers **Copy report**. The report is selectable/scrollable and includes the exact installer version, OS/PowerShell, failed stage/code, selected destination, useful recovery action and recent diagnostics, with credentials redacted and no environment dump. Copying must keep the dialog open without choosing Retry, Replace or Cancel; report access remains on the incomplete final page. If PowerShell or report creation fails, the native dialog still provides a minimal report. Folder failures after preparation allow selecting another projects root without discarding satisfied installation steps.
56
64
 
57
65
  Repeating setup rechecks and reuses satisfied prerequisites, the requested package version and approved empty destination. Do not duplicate PATH entries, reset project configuration, delete existing user files or launch duplicate initializers from repeated completion actions. Resume already-started project setup through ordinary CLI behavior with explicit user intent, not by treating its now-nonempty directory as a new empty project. Reinstallation, repair and any removal of the bootstrap layer preserve user projects and shared Node.js/npm/Git installations.
58
66
 
@@ -68,8 +76,12 @@ Repeating setup rechecks and reuses satisfied prerequisites, the requested packa
68
76
 
69
77
  ## Desktop components and completion
70
78
 
71
- The desktop executable and tray controller follow [the desktop contract](desktop.md). Install a matching release payload, register only the tray at Windows sign-in and launch a visible application window at completion. Closing that window leaves the engines and tray alone. Optional harness installation prepares missing selected executables without authenticating or overwriting existing ones; normal init remains authoritative. Desktop failure is an incomplete installation with retry diagnostics. CLI-only selection keeps the terminal handoff described above.
79
+ The desktop executable and tray controller follow [the desktop contract](desktop.md). Install a matching release payload, register only the tray at Windows sign-in and launch a visible application window at completion. Closing that window leaves the engines and tray alone. Normal init owns harness preparation and authentication. Desktop failure is an incomplete installation with retry diagnostics. CLI-only selection keeps the terminal handoff described above.
72
80
 
73
81
  ## Windows discovery and completion
74
82
 
75
- Show the Promptbook logo and license acceptance before installation. Create `Promptbook terminal` and `ptbk` Start menu shortcuts for the ordinary context-aware CLI, with the verified runtime and user home. With desktop selected, add `Promptbook` for the graphical client and register only its tray controller at sign-in. Uninstalling desktop removes that registration and its own files without stopping or deleting the separate engines/projects. Preserve lowercase `ptbk` in command examples. Failed or declined preparation must change the final page to an explicit incomplete result and return a nonzero setup exit code. Codex and Claude Code remain choices in ordinary init.
83
+ Show the Promptbook logo and license acceptance before installation. Create `Promptbook terminal` and `ptbk` Start menu shortcuts for the ordinary context-aware CLI, with the verified runtime and user home. Resolve the per-user Programs known folder without requiring it to exist yet, create missing directories through literal paths, and reuse those shortcuts on repeated setup, including redirected profiles. With desktop selected, add `Promptbook` for the graphical client and register only its tray controller at sign-in. Uninstalling desktop removes that registration and its own files without stopping or deleting the separate engines/projects. Preserve lowercase `ptbk` in command examples. Failed or declined preparation must change the final page to an explicit incomplete result and return a nonzero setup exit code. Codex and Claude Code remain choices in ordinary init.
84
+
85
+ ## Unattended installer verification
86
+
87
+ For reproducible Windows checks, `/ProjectsRoot="<path>"` and `/ProjectName="<name>"` select the same fields as the wizard. `/SkipProject=yes` selects its ordinary skip option. `/PrepareOnly=yes` explicitly suppresses initializer launch after verifying software and preparing the empty destination; completion states that project setup was not launched. These options compose with Inno Setup's standard silent/component switches, retain the same validation and nonzero incomplete outcomes, and never change ordinary double-click setup behavior.
@@ -12,6 +12,8 @@ Resolve the intended OS account's actual home at runtime through shared platform
12
12
 
13
13
  The convenience root is exactly `ptbk/project/` beneath that home: lowercase `ptbk`, singular lowercase `project`, one child per independent project. Example paths are `C:\Users\Alice\ptbk\project\demo`, `/Users/alice/ptbk/project/demo` and `/home/alice/ptbk/project/demo`; these illustrate layouts, not account lookup rules. Explicit destinations and existing projects remain unchanged.
14
14
 
15
+ When an existing file or unavailable directory link blocks that default, preserve it and propose `<home>/ptbk-projects`, then `ptbk-projects-2`, `ptbk-projects-3`, and so on until an available ordinary container is found. Reuse an existing usable container consistently on later launches. Show the resolved suggestion before confirmation. This fallback applies only to a suggested default; an explicit destination remains the user's choice and receives an actionable error when blocked. The Windows bootstrap also reserves npm's extensionless `ptbk` launcher before package installation when the global prefix is the user's home.
16
+
15
17
  On Linux an ordinary launch uses that user's home. A launch through `sudo` on behalf of another user keeps the validated **original invoking user's** home and ptbk project/discovery scope even if the effective process account or `HOME` names root. Direct root launch without an originating non-root sudo user uses root's actual home. Do not guess ownership from CWD or blindly trust an environment-supplied username/path. Diagnose an unresolved intended account/home before creating a project elsewhere.
16
18
 
17
19
  Init defaults, known-project registry and engine discovery share this identity resolution; detached/recovered launches preserve that intended scope. This grants no extra cross-user or harness/browser account authority. Keep created files/directories usable by their intended owner; elevated creation must not accidentally leave a user's project root-only. Do not recursively change unrelated ownership/permissions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptbk",
3
- "version": "0.119.0-54",
3
+ "version": "0.119.0-62",
4
4
  "description": "Autonomous AI agendas on your machine. Readable agents, your choice of models, and Git history under your control.",
5
5
  "private": false,
6
6
  "sideEffects": false,