@jals1212/pi-spaces 0.4.0 → 0.4.1

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
@@ -6,6 +6,14 @@ commands and options and a patch version fixes.
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.4.1
10
+
11
+ ### Changed
12
+
13
+ - The status line shows `◆ base` in the base home when pi-spaces opened it
14
+ (`pi --space base`, `pi-space base`, or a switch back to base); Pi started
15
+ plainly still shows nothing there.
16
+
9
17
  ## 0.4.0
10
18
 
11
19
  ### Added
package/README.md CHANGED
@@ -67,7 +67,7 @@ A new space starts empty except for a `settings.json` that declares this package
67
67
  | `pi --space <name>` | Starts Pi directly in a space, keeping the prompt and every other option. |
68
68
  | `pi --space <name> <command> [args...]` | Runs one of Pi's package commands (`install`, `remove`, `uninstall`, `update`, `list`) in a space, or in the base home with `base`: `pi --space work update --extensions`, `pi --space work install npm:<package>`. |
69
69
 
70
- The status line shows `◆ <name>` while a space is active, and nothing in the base home.
70
+ The status line shows `◆ <name>` while a space is active. In the base home it shows `◆ base` when pi-spaces opened it (`pi --space base`, `pi-space base`, or `/space switch base`), and nothing when Pi was started plainly.
71
71
 
72
72
  Choosing an argument such as `switch` from the `/space ` suggestions only fills the line; press Enter again to run it. `/space` and Enter opens the picker in one step.
73
73
 
package/dist/command.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // The /space command, kept apart from Pi's extension API so it can be tested directly.
2
2
  import { join } from "node:path";
3
- import { relaunchEnv, resolveSwitch } from "./relaunch.js";
3
+ import { parseSpaceFlag, relaunchEnv, resolveSwitch } from "./relaunch.js";
4
4
  import {
5
5
  activeSpace,
6
6
  BACKUPS,
@@ -154,10 +154,17 @@ function switchTo(name , deps ) {
154
154
  ctx.shutdown();
155
155
  }
156
156
 
157
- /** Status line text: the active space, or nothing in the base home. */
158
- export function statusText(dir , currentHome ) {
157
+ /**
158
+ * Status line text: the active space; in the base home, `◆ base` only when pi-spaces opened it
159
+ * (`pi --space base`, which `pi-space base` runs, or a switch back to base, which sets
160
+ * PI_SPACES_BASE_HOME), and nothing when Pi was started plainly.
161
+ */
162
+ export function statusText(dir , currentHome , proc = process, env = process.env) {
159
163
  const active = activeSpace(dir, currentHome);
160
- return active === undefined ? undefined : `◆ ${active}`;
164
+ if (active !== undefined) return `◆ ${active}`;
165
+ const parsed = parseSpaceFlag(proc.argv.slice(2));
166
+ const openedBySpaces = ("name" in parsed && parsed.name === BASE) || Boolean(env.PI_SPACES_BASE_HOME);
167
+ return openedBySpaces ? `◆ ${BASE}` : undefined;
161
168
  }
162
169
 
163
170
  export function completeSpaceArgs(prefix , dir ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jals1212/pi-spaces",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Named spaces for Pi: keep several agent homes (sign-ins, packages, settings) and pick one by name.",
5
5
  "license": "MIT",
6
6
  "author": "jals1212",
package/src/command.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // The /space command, kept apart from Pi's extension API so it can be tested directly.
2
2
  import { join } from "node:path";
3
- import { type Command, relaunchEnv, resolveSwitch } from "./relaunch.ts";
3
+ import { type Command, parseSpaceFlag, relaunchEnv, resolveSwitch } from "./relaunch.ts";
4
4
  import {
5
5
  activeSpace,
6
6
  BACKUPS,
@@ -154,10 +154,17 @@ function switchTo(name: string, deps: SpaceCommandDeps): void {
154
154
  ctx.shutdown();
155
155
  }
156
156
 
157
- /** Status line text: the active space, or nothing in the base home. */
158
- export function statusText(dir: string, currentHome: string): string | undefined {
157
+ /**
158
+ * Status line text: the active space; in the base home, `◆ base` only when pi-spaces opened it
159
+ * (`pi --space base`, which `pi-space base` runs, or a switch back to base, which sets
160
+ * PI_SPACES_BASE_HOME), and nothing when Pi was started plainly.
161
+ */
162
+ export function statusText(dir: string, currentHome: string, proc: { argv: string[] } = process, env: Env = process.env): string | undefined {
159
163
  const active = activeSpace(dir, currentHome);
160
- return active === undefined ? undefined : `◆ ${active}`;
164
+ if (active !== undefined) return `◆ ${active}`;
165
+ const parsed = parseSpaceFlag(proc.argv.slice(2));
166
+ const openedBySpaces = ("name" in parsed && parsed.name === BASE) || Boolean(env.PI_SPACES_BASE_HOME);
167
+ return openedBySpaces ? `◆ ${BASE}` : undefined;
161
168
  }
162
169
 
163
170
  export function completeSpaceArgs(prefix: string, dir: string): { value: string; label: string }[] | null {