pi-gitnexus-fork 0.7.0
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/.github/workflows/ci.yml +20 -0
- package/.gitnexusignore +11 -0
- package/.sg-rules/async-function-must-await-or-return.yml +55 -0
- package/.sg-rules/catch-must-log-error.yml +78 -0
- package/.sg-rules/class-must-implement-or-extend.yml +61 -0
- package/.sg-rules/class-property-must-be-readonly.yml +61 -0
- package/.sg-rules/error-must-extend-base.yml +56 -0
- package/.sg-rules/generic-must-be-constrained.yml +60 -0
- package/.sg-rules/import-reexport-risk.yml +9 -0
- package/.sg-rules/missing-session-id-in-api.yml +16 -0
- package/.sg-rules/no-any-in-generic-args.yml +57 -0
- package/.sg-rules/no-await-in-promise-all.yml +28 -0
- package/.sg-rules/no-barrel-export.yml +17 -0
- package/.sg-rules/no-bq-write-in-module.yml +65 -0
- package/.sg-rules/no-console-except-error.yml +27 -0
- package/.sg-rules/no-console-in-server.yml +42 -0
- package/.sg-rules/no-empty-catch.yml +20 -0
- package/.sg-rules/no-empty-function.yml +24 -0
- package/.sg-rules/no-eval.yml +28 -0
- package/.sg-rules/no-explicit-any.yml +34 -0
- package/.sg-rules/no-hardcoded-placeholder-string.yml +23 -0
- package/.sg-rules/no-hardcoded-secrets.yml +32 -0
- package/.sg-rules/no-innerHTML.yml +22 -0
- package/.sg-rules/no-json-parse-without-trycatch.yml +33 -0
- package/.sg-rules/no-magic-numbers.yml +25 -0
- package/.sg-rules/no-nested-ternary.yml +21 -0
- package/.sg-rules/no-non-null-assertion.yml +25 -0
- package/.sg-rules/no-stub-implementation.yml +44 -0
- package/.sg-rules/no-throw-literal.yml +50 -0
- package/.sg-rules/no-todo-comment.yml +24 -0
- package/.sg-rules/no-ts-ignore-comment.yml +48 -0
- package/.sg-rules/no-type-assertion-in-jsx.yml +23 -0
- package/.sg-rules/no-unguarded-trim.yml +24 -0
- package/.sg-rules/no-unknown-without-narrowing.yml +76 -0
- package/.sg-rules/no-unsafe-bracket-access.yml +58 -0
- package/.sg-rules/no-unsafe-type-assertion.yml +45 -0
- package/.sg-rules/switch-must-be-exhaustive.yml +62 -0
- package/.sg-rules/zod-async-refine-without-abort.yml +62 -0
- package/.sg-rules/zod-enum-unsafe-access.yml +59 -0
- package/.sg-rules/zod-nested-object-deep-path.yml +70 -0
- package/.sg-rules/zod-optional-without-default-in-route.yml +50 -0
- package/.sg-rules/zod-parse-not-safe.yml +42 -0
- package/.sg-rules/zod-preprocess-without-fallback.yml +58 -0
- package/.sg-rules/zod-refine-no-return-undefined.yml +54 -0
- package/.sg-rules/zod-transform-without-output-type.yml +52 -0
- package/.sg-sha +1 -0
- package/.sgignore +4 -0
- package/AGENTS.md +1 -0
- package/CHANGELOG.md +99 -0
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/biome.json +25 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +890 -0
- package/coverage/coverage-final.json +12 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +131 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/coverage/src/augment-remote.ts.html +274 -0
- package/coverage/src/gitnexus.ts.html +1363 -0
- package/coverage/src/index.html +236 -0
- package/coverage/src/index.ts.html +1561 -0
- package/coverage/src/mcp-client-factory.ts.html +367 -0
- package/coverage/src/mcp-client-stdio.ts.html +736 -0
- package/coverage/src/mcp-client.ts.html +568 -0
- package/coverage/src/remote-mcp-client.ts.html +709 -0
- package/coverage/src/repo-resolver.ts.html +526 -0
- package/coverage/src/tools.ts.html +970 -0
- package/coverage/src/ui/index.html +131 -0
- package/coverage/src/ui/main-menu.ts.html +502 -0
- package/coverage/src/ui/settings-menu.ts.html +460 -0
- package/dist/augment-remote.d.ts +11 -0
- package/dist/augment-remote.js +55 -0
- package/dist/gitnexus.d.ts +103 -0
- package/dist/gitnexus.js +410 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +479 -0
- package/dist/mcp-client-factory.d.ts +19 -0
- package/dist/mcp-client-factory.js +78 -0
- package/dist/mcp-client-stdio.d.ts +35 -0
- package/dist/mcp-client-stdio.js +186 -0
- package/dist/mcp-client.d.ts +45 -0
- package/dist/mcp-client.js +145 -0
- package/dist/remote-mcp-client.d.ts +43 -0
- package/dist/remote-mcp-client.js +181 -0
- package/dist/repo-resolver.d.ts +47 -0
- package/dist/repo-resolver.js +123 -0
- package/dist/tools.d.ts +6 -0
- package/dist/tools.js +230 -0
- package/dist/ui/main-menu.d.ts +33 -0
- package/dist/ui/main-menu.js +102 -0
- package/dist/ui/settings-menu.d.ts +16 -0
- package/dist/ui/settings-menu.js +95 -0
- package/docs/design/remote-mcp-backend.md +153 -0
- package/media/screenshot.png +0 -0
- package/package.json +61 -0
- package/sgconfig.yml +4 -0
- package/skills/gitnexus-debugging/SKILL.md +84 -0
- package/skills/gitnexus-exploring/SKILL.md +73 -0
- package/skills/gitnexus-impact-analysis/SKILL.md +93 -0
- package/skills/gitnexus-pr-review/SKILL.md +109 -0
- package/skills/gitnexus-refactoring/SKILL.md +85 -0
- package/src/augment-remote.ts +63 -0
- package/src/gitnexus.ts +426 -0
- package/src/index.ts +492 -0
- package/src/mcp-client-factory.ts +94 -0
- package/src/mcp-client-stdio.ts +217 -0
- package/src/mcp-client.ts +208 -0
- package/src/remote-mcp-client.ts +250 -0
- package/src/repo-resolver.ts +147 -0
- package/src/tools.ts +295 -0
- package/src/ui/main-menu.ts +139 -0
- package/src/ui/settings-menu.ts +125 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* settings-menu.ts — Interactive settings panel for /gitnexus settings.
|
|
3
|
+
*
|
|
4
|
+
* Uses ui.custom() + SettingsList for native TUI rendering with keyboard
|
|
5
|
+
* navigation, live toggle, and per-row descriptions.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { getSettingsListTheme } from "@mariozechner/pi-coding-agent";
|
|
9
|
+
import { Container, type SettingItem, SettingsList, Spacer, Text } from "@mariozechner/pi-tui";
|
|
10
|
+
import { type GitNexusConfig, saveConfig } from "../gitnexus.js";
|
|
11
|
+
|
|
12
|
+
// ── Types ───────────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
export type SettingsUI = {
|
|
15
|
+
custom<T>(
|
|
16
|
+
factory: (tui: any, theme: any, keybindings: any, done: (result: T) => void) => any,
|
|
17
|
+
options?: { overlay?: boolean; overlayOptions?: any },
|
|
18
|
+
): Promise<T>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// ── Settings panel ──────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
export async function openSettingsMenu(
|
|
24
|
+
ui: SettingsUI,
|
|
25
|
+
cfg: GitNexusConfig,
|
|
26
|
+
state: { augmentEnabled: boolean },
|
|
27
|
+
onBack: () => Promise<void>,
|
|
28
|
+
): Promise<void> {
|
|
29
|
+
await ui.custom((_tui, theme, _kb, done) => {
|
|
30
|
+
const items: SettingItem[] = [
|
|
31
|
+
{
|
|
32
|
+
id: "autoAugment",
|
|
33
|
+
label: "Auto-augment",
|
|
34
|
+
description:
|
|
35
|
+
"When ON: search results (grep, find, read, bash) are automatically " +
|
|
36
|
+
"enriched with knowledge graph context. When OFF: graph context is " +
|
|
37
|
+
"only available via explicit /gitnexus commands and tools.",
|
|
38
|
+
currentValue: state.augmentEnabled ? "on" : "off",
|
|
39
|
+
values: ["on", "off"],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "augmentTimeout",
|
|
43
|
+
label: "Augment timeout",
|
|
44
|
+
description:
|
|
45
|
+
"Maximum time (in seconds) to wait for a graph augmentation response. " +
|
|
46
|
+
"Increase for large repos with slow I/O, decrease for snappier responses. " +
|
|
47
|
+
"Default: 8s.",
|
|
48
|
+
currentValue: String(cfg.augmentTimeout ?? 8),
|
|
49
|
+
values: ["4", "6", "8", "10", "15", "20"],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "maxAugmentsPerResult",
|
|
53
|
+
label: "Max augments per result",
|
|
54
|
+
description:
|
|
55
|
+
"Maximum number of patterns to augment in parallel per search result. " +
|
|
56
|
+
"Higher values provide more context but use more tokens. Default: 3.",
|
|
57
|
+
currentValue: String(cfg.maxAugmentsPerResult ?? 3),
|
|
58
|
+
values: ["1", "2", "3", "5"],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "maxSecondaryPatterns",
|
|
62
|
+
label: "Max secondary patterns",
|
|
63
|
+
description:
|
|
64
|
+
"Maximum number of secondary file-based patterns extracted from grep/bash " +
|
|
65
|
+
"output. These provide additional context from files mentioned in results. " +
|
|
66
|
+
"Default: 2.",
|
|
67
|
+
currentValue: String(cfg.maxSecondaryPatterns ?? 2),
|
|
68
|
+
values: ["0", "1", "2", "3", "5"],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "cmd",
|
|
72
|
+
label: "GitNexus command",
|
|
73
|
+
description:
|
|
74
|
+
"The shell command used to invoke gitnexus. " +
|
|
75
|
+
"Change if gitnexus is installed in a non-standard location or you want " +
|
|
76
|
+
"to use npx. Default: gitnexus.",
|
|
77
|
+
currentValue: cfg.cmd ?? "gitnexus",
|
|
78
|
+
values: ["gitnexus", "npx gitnexus@latest", "npx -y gitnexus@latest"],
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const list = new SettingsList(
|
|
83
|
+
items,
|
|
84
|
+
Math.min(items.length + 2, 15),
|
|
85
|
+
getSettingsListTheme(),
|
|
86
|
+
/* onChange */ (id, newValue) => {
|
|
87
|
+
if (id === "autoAugment") {
|
|
88
|
+
state.augmentEnabled = newValue === "on";
|
|
89
|
+
cfg.autoAugment = newValue === "on";
|
|
90
|
+
saveConfig(cfg);
|
|
91
|
+
}
|
|
92
|
+
if (id === "augmentTimeout") {
|
|
93
|
+
cfg.augmentTimeout = parseInt(newValue, 10);
|
|
94
|
+
saveConfig(cfg);
|
|
95
|
+
}
|
|
96
|
+
if (id === "maxAugmentsPerResult") {
|
|
97
|
+
cfg.maxAugmentsPerResult = parseInt(newValue, 10);
|
|
98
|
+
saveConfig(cfg);
|
|
99
|
+
}
|
|
100
|
+
if (id === "maxSecondaryPatterns") {
|
|
101
|
+
cfg.maxSecondaryPatterns = parseInt(newValue, 10);
|
|
102
|
+
saveConfig(cfg);
|
|
103
|
+
}
|
|
104
|
+
if (id === "cmd") {
|
|
105
|
+
cfg.cmd = newValue;
|
|
106
|
+
saveConfig(cfg);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
/* onCancel */ () => done(undefined),
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const container = new Container();
|
|
113
|
+
container.addChild(new Text(theme.bold(theme.fg("accent", "⚙ GitNexus Settings")), 0, 0));
|
|
114
|
+
container.addChild(new Spacer(1));
|
|
115
|
+
container.addChild(list);
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
render: (w: number) => container.render(w),
|
|
119
|
+
invalidate: () => container.invalidate(),
|
|
120
|
+
handleInput: (data: string) => list.handleInput?.(data),
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return onBack();
|
|
125
|
+
}
|