auq-mcp-server 2.3.0 → 2.5.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/README.md +122 -0
- package/dist/bin/auq.js +87 -93
- package/dist/bin/tui-app.js +183 -7
- package/dist/package.json +1 -1
- package/dist/src/__tests__/server.abort.test.js +214 -0
- package/dist/src/cli/commands/__tests__/answer.test.js +199 -0
- package/dist/src/cli/commands/__tests__/config.test.js +218 -0
- package/dist/src/cli/commands/__tests__/sessions.test.js +282 -0
- package/dist/src/cli/commands/answer.js +128 -0
- package/dist/src/cli/commands/config.js +263 -0
- package/dist/src/cli/commands/sessions.js +300 -0
- package/dist/src/cli/commands/update.js +124 -0
- package/dist/src/cli/utils.js +95 -0
- package/dist/src/config/__tests__/ConfigLoader.test.js +41 -0
- package/dist/src/config/__tests__/updateCheck.test.js +34 -0
- package/dist/src/config/defaults.js +5 -0
- package/dist/src/config/types.js +6 -0
- package/dist/src/core/ask-user-questions.js +3 -2
- package/dist/src/i18n/locales/en.js +7 -0
- package/dist/src/i18n/locales/ko.js +7 -0
- package/dist/src/server.js +64 -11
- package/dist/src/session/SessionManager.js +69 -4
- package/dist/src/session/__tests__/SessionManager.test.js +65 -0
- package/dist/src/tui/__tests__/session-watcher.test.js +109 -0
- package/dist/src/tui/components/Footer.js +4 -1
- package/dist/src/tui/components/Header.js +3 -1
- package/dist/src/tui/components/SessionDots.js +33 -4
- package/dist/src/tui/components/SessionPicker.js +25 -17
- package/dist/src/tui/components/StepperView.js +68 -5
- package/dist/src/tui/components/UpdateBadge.js +29 -0
- package/dist/src/tui/components/UpdateOverlay.js +199 -0
- package/dist/src/tui/components/__tests__/SessionDots.test.js +160 -1
- package/dist/src/tui/components/__tests__/SessionPicker.test.js +43 -1
- package/dist/src/tui/components/__tests__/StepperView.abandoned.test.js +160 -0
- package/dist/src/tui/components/__tests__/StepperView.state.test.js +1 -0
- package/dist/src/tui/constants/keybindings.js +3 -0
- package/dist/src/tui/session-watcher.js +50 -0
- package/dist/src/tui/themes/catppuccin-latte.js +7 -0
- package/dist/src/tui/themes/catppuccin-mocha.js +7 -0
- package/dist/src/tui/themes/dark.js +7 -0
- package/dist/src/tui/themes/dracula.js +7 -0
- package/dist/src/tui/themes/github-dark.js +7 -0
- package/dist/src/tui/themes/github-light.js +7 -0
- package/dist/src/tui/themes/gruvbox-dark.js +7 -0
- package/dist/src/tui/themes/gruvbox-light.js +7 -0
- package/dist/src/tui/themes/light.js +7 -0
- package/dist/src/tui/themes/monokai.js +7 -0
- package/dist/src/tui/themes/nord.js +7 -0
- package/dist/src/tui/themes/one-dark.js +7 -0
- package/dist/src/tui/themes/rose-pine.js +7 -0
- package/dist/src/tui/themes/solarized-dark.js +7 -0
- package/dist/src/tui/themes/solarized-light.js +7 -0
- package/dist/src/tui/themes/tokyo-night.js +7 -0
- package/dist/src/tui/utils/__tests__/staleDetection.test.js +118 -0
- package/dist/src/tui/utils/staleDetection.js +51 -0
- package/dist/src/update/__tests__/cache.test.js +136 -0
- package/dist/src/update/__tests__/changelog.test.js +86 -0
- package/dist/src/update/__tests__/checker.test.js +148 -0
- package/dist/src/update/__tests__/index.test.js +37 -0
- package/dist/src/update/__tests__/installer.test.js +117 -0
- package/dist/src/update/__tests__/package-manager.test.js +73 -0
- package/dist/src/update/__tests__/version.test.js +74 -0
- package/dist/src/update/cache.js +74 -0
- package/dist/src/update/changelog.js +63 -0
- package/dist/src/update/checker.js +121 -0
- package/dist/src/update/index.js +15 -0
- package/dist/src/update/installer.js +51 -0
- package/dist/src/update/package-manager.js +49 -0
- package/dist/src/update/types.js +7 -0
- package/dist/src/update/version.js +114 -0
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semver comparison utilities for the auto-update system.
|
|
3
|
+
*
|
|
4
|
+
* Provides version parsing, comparison, and update type detection
|
|
5
|
+
* without requiring external dependencies like the `semver` package.
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync } from "fs";
|
|
8
|
+
import { dirname, join } from "path";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
/**
|
|
11
|
+
* Parse a version string into its numeric components.
|
|
12
|
+
*
|
|
13
|
+
* Strips a leading `v` prefix if present. Splits prerelease
|
|
14
|
+
* identifiers on `-`. Handles two-part versions like "2.5"
|
|
15
|
+
* by treating the missing patch as 0.
|
|
16
|
+
*
|
|
17
|
+
* @param version - Semver string, e.g., "2.5.0", "v1.2.3-beta.1"
|
|
18
|
+
* @returns Parsed version object
|
|
19
|
+
* @throws Error if any numeric component is NaN
|
|
20
|
+
*/
|
|
21
|
+
export function parseVersion(version) {
|
|
22
|
+
// Strip leading 'v' prefix
|
|
23
|
+
const cleaned = version.startsWith("v") ? version.slice(1) : version;
|
|
24
|
+
// Separate prerelease from numeric parts
|
|
25
|
+
const [numericPart, ...prereleaseParts] = cleaned.split("-");
|
|
26
|
+
const prerelease = prereleaseParts.length > 0 ? prereleaseParts.join("-") : undefined;
|
|
27
|
+
const parts = numericPart.split(".");
|
|
28
|
+
const major = Number(parts[0]);
|
|
29
|
+
const minor = Number(parts[1] ?? "0");
|
|
30
|
+
const patch = Number(parts[2] ?? "0");
|
|
31
|
+
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) {
|
|
32
|
+
throw new Error(`Invalid version string: "${version}"`);
|
|
33
|
+
}
|
|
34
|
+
return { major, minor, patch, prerelease };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Determine if `latest` is newer than `current`.
|
|
38
|
+
*
|
|
39
|
+
* Compares major, minor, and patch components numerically.
|
|
40
|
+
* For prerelease handling: a version WITH a prerelease tag is
|
|
41
|
+
* considered OLDER than the same version WITHOUT one
|
|
42
|
+
* (e.g., `2.5.0-beta.1 < 2.5.0`).
|
|
43
|
+
*
|
|
44
|
+
* @param current - Currently installed version
|
|
45
|
+
* @param latest - Latest available version
|
|
46
|
+
* @returns true if `latest` is strictly newer than `current`
|
|
47
|
+
*/
|
|
48
|
+
export function isNewer(current, latest) {
|
|
49
|
+
const c = parseVersion(current);
|
|
50
|
+
const l = parseVersion(latest);
|
|
51
|
+
// Compare major.minor.patch numerically
|
|
52
|
+
if (l.major !== c.major)
|
|
53
|
+
return l.major > c.major;
|
|
54
|
+
if (l.minor !== c.minor)
|
|
55
|
+
return l.minor > c.minor;
|
|
56
|
+
if (l.patch !== c.patch)
|
|
57
|
+
return l.patch > c.patch;
|
|
58
|
+
// Same numeric version — check prerelease
|
|
59
|
+
// A version with prerelease is older than the same version without
|
|
60
|
+
if (c.prerelease && !l.prerelease)
|
|
61
|
+
return true;
|
|
62
|
+
if (!c.prerelease && l.prerelease)
|
|
63
|
+
return false;
|
|
64
|
+
// Both have prerelease or both don't — considered equal
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Determine the type of update between two versions.
|
|
69
|
+
*
|
|
70
|
+
* @param current - Currently installed version
|
|
71
|
+
* @param latest - Latest available version
|
|
72
|
+
* @returns "major" | "minor" | "patch"
|
|
73
|
+
*/
|
|
74
|
+
export function getUpdateType(current, latest) {
|
|
75
|
+
const c = parseVersion(current);
|
|
76
|
+
const l = parseVersion(latest);
|
|
77
|
+
if (l.major > c.major)
|
|
78
|
+
return "major";
|
|
79
|
+
if (l.minor > c.minor)
|
|
80
|
+
return "minor";
|
|
81
|
+
return "patch";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Read the current installed version from the package's package.json.
|
|
85
|
+
*
|
|
86
|
+
* Resolves the path relative to this module's location, trying
|
|
87
|
+
* multiple paths to handle both local dev and global install layouts.
|
|
88
|
+
*
|
|
89
|
+
* @returns The current version string
|
|
90
|
+
* @throws Error if package.json cannot be found or parsed
|
|
91
|
+
*/
|
|
92
|
+
export function getCurrentVersion() {
|
|
93
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
94
|
+
const __dirname = dirname(__filename);
|
|
95
|
+
// Try different possible paths for package.json
|
|
96
|
+
// - ../../package.json: from src/update/ in local dev (src/update -> src -> root)
|
|
97
|
+
// - ../../../package.json: from dist/update/ in global install (dist/update -> dist -> root)
|
|
98
|
+
const possiblePaths = [
|
|
99
|
+
join(__dirname, "..", "..", "package.json"),
|
|
100
|
+
join(__dirname, "..", "..", "..", "package.json"),
|
|
101
|
+
];
|
|
102
|
+
for (const path of possiblePaths) {
|
|
103
|
+
try {
|
|
104
|
+
const packageJson = JSON.parse(readFileSync(path, "utf-8"));
|
|
105
|
+
if (packageJson.version) {
|
|
106
|
+
return packageJson.version;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// Try next path
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
throw new Error("Could not determine current version from package.json");
|
|
114
|
+
}
|