pi-onedev-toolkit 0.1.0 → 0.1.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
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1
4
+
5
+ - Add `/od-settings` to enable or disable the OneDev project status in the TUI footer.
6
+ - Persist the footer preference in the current session branch.
7
+
3
8
  ## 0.1.0
4
9
 
5
10
  - Initial release.
package/README.md CHANGED
@@ -22,7 +22,7 @@ pi install npm:pi-onedev-toolkit
22
22
  pi install git:github.com/alpertarhan/pi-onedev-toolkit
23
23
  ```
24
24
 
25
- Then run `/od-health` once. When the current directory is a OneDev repository, the status line shows the active project.
25
+ Then run `/od-health` once. When the current directory is a OneDev repository, the status line shows the active project. Use `/od-settings` to enable or disable it for the current session branch.
26
26
 
27
27
  ## Tools
28
28
 
@@ -39,6 +39,7 @@ Lazy by design: domain tools activate only through `onedev_tools`, keeping the d
39
39
 
40
40
  - `/od-context` — active server, inferred project, login
41
41
  - `/od-health` — re-check tod configuration and server reachability
42
+ - `/od-settings` — enable or disable the OneDev footer status in the TUI
42
43
 
43
44
  ## Skills
44
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-onedev-toolkit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Lightweight OneDev integration for Pi via the TOD CLI: repo-aware issue, pull request, and build tools",
5
5
  "type": "module",
6
6
  "author": {
package/src/extension.ts CHANGED
@@ -1,4 +1,7 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
1
+ import type {
2
+ ExtensionAPI,
3
+ ExtensionContext,
4
+ } from "@earendil-works/pi-coding-agent";
2
5
  import {
3
6
  formatContext,
4
7
  probeOneDevContext,
@@ -10,9 +13,16 @@ import {
10
13
  } from "./tools/index.js";
11
14
  import type { ToolDeps } from "./tools/common.js";
12
15
 
16
+ const SETTINGS_ENTRY = "onedev-settings";
17
+
18
+ interface OnedevSettings {
19
+ footerStatus: boolean;
20
+ }
21
+
13
22
  export default function onedevExtension(pi: ExtensionAPI): void {
14
23
  let context: OneDevSessionContext | undefined;
15
24
  let controller: OnedevToolController | undefined;
25
+ let footerStatus = true;
16
26
 
17
27
  const deps: ToolDeps = {
18
28
  exec: (command, args, options) => pi.exec(command, args, options),
@@ -27,13 +37,24 @@ export default function onedevExtension(pi: ExtensionAPI): void {
27
37
  ui: { setStatus: (key: string, value: string | undefined) => void };
28
38
  }): void => {
29
39
  if (!ctx.hasUI) return;
30
- if (context?.status === "ready" && context.project) {
40
+ if (footerStatus && context?.status === "ready" && context.project) {
31
41
  ctx.ui.setStatus("onedev", `onedev: ${context.project}`);
32
42
  } else {
33
43
  ctx.ui.setStatus("onedev", undefined);
34
44
  }
35
45
  };
36
46
 
47
+ const restoreSettings = (ctx: ExtensionContext): void => {
48
+ footerStatus = true;
49
+ for (const entry of ctx.sessionManager.getBranch()) {
50
+ if (entry.type !== "custom" || entry.customType !== SETTINGS_ENTRY) continue;
51
+ const saved = entry.data as Partial<OnedevSettings> | undefined;
52
+ if (typeof saved?.footerStatus === "boolean") {
53
+ footerStatus = saved.footerStatus;
54
+ }
55
+ }
56
+ };
57
+
37
58
  pi.registerCommand("od-context", {
38
59
  description: "Show the active OneDev server, project, and user",
39
60
  handler: async (_args, ctx) => {
@@ -57,14 +78,47 @@ export default function onedevExtension(pi: ExtensionAPI): void {
57
78
  },
58
79
  });
59
80
 
81
+ pi.registerCommand("od-settings", {
82
+ description: "Configure OneDev TUI settings",
83
+ handler: async (_args, ctx) => {
84
+ if (ctx.mode !== "tui") {
85
+ ctx.ui.notify("/od-settings requires TUI mode", "error");
86
+ return;
87
+ }
88
+ const selected = await ctx.ui.select(
89
+ `OneDev footer status (currently ${footerStatus ? "enabled" : "disabled"})`,
90
+ ["Enabled", "Disabled"],
91
+ );
92
+ if (!selected) return;
93
+ const enabled = selected === "Enabled";
94
+ if (enabled !== footerStatus) {
95
+ pi.appendEntry<OnedevSettings>(SETTINGS_ENTRY, {
96
+ footerStatus: enabled,
97
+ });
98
+ footerStatus = enabled;
99
+ applyStatus(ctx);
100
+ }
101
+ ctx.ui.notify(
102
+ `OneDev footer status ${enabled ? "enabled" : "disabled"}`,
103
+ "info",
104
+ );
105
+ },
106
+ });
107
+
60
108
  controller = registerOnedevTools(pi, deps);
61
109
 
62
110
  pi.on("session_start", async (_event, ctx) => {
63
111
  controller?.reset();
112
+ restoreSettings(ctx);
64
113
  context = await probeOneDevContext(deps.exec, ctx.cwd);
65
114
  applyStatus(ctx);
66
115
  });
67
116
 
117
+ pi.on("session_tree", async (_event, ctx) => {
118
+ restoreSettings(ctx);
119
+ applyStatus(ctx);
120
+ });
121
+
68
122
  pi.on("session_shutdown", async (_event, ctx) => {
69
123
  if (ctx.hasUI) ctx.ui.setStatus("onedev", undefined);
70
124
  context = undefined;