@orderful/droid 0.11.1 → 0.12.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/CHANGELOG.md +13 -0
- package/dist/commands/tui.d.ts.map +1 -1
- package/dist/commands/tui.js +221 -35
- package/dist/commands/tui.js.map +1 -1
- package/dist/lib/config.d.ts +9 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +26 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/tools.d.ts +11 -5
- package/dist/lib/tools.d.ts.map +1 -1
- package/dist/lib/tools.js +30 -1
- package/dist/lib/tools.js.map +1 -1
- package/dist/lib/types.d.ts +5 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/tui.tsx +373 -39
- package/src/lib/config.ts +30 -1
- package/src/lib/tools.ts +45 -6
- package/src/lib/types.ts +6 -0
package/src/lib/tools.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'url';
|
|
|
4
4
|
import YAML from 'yaml';
|
|
5
5
|
import { loadConfig } from './config.js';
|
|
6
6
|
import { type ToolManifest, type ToolIncludes, getPlatformTools } from './types.js';
|
|
7
|
+
import { compareSemver } from './version.js';
|
|
7
8
|
|
|
8
9
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
const BUNDLED_TOOLS_DIR = join(__dirname, '../tools');
|
|
@@ -112,29 +113,67 @@ export function getInstalledToolVersion(toolName: string): string | null {
|
|
|
112
113
|
return null;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*/
|
|
118
|
-
export function getToolUpdateStatus(toolName: string): {
|
|
116
|
+
export interface ToolUpdateInfo {
|
|
117
|
+
name: string;
|
|
119
118
|
hasUpdate: boolean;
|
|
120
119
|
installedVersion: string | null;
|
|
121
120
|
bundledVersion: string | null;
|
|
122
|
-
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Check if a tool has an update available
|
|
125
|
+
*/
|
|
126
|
+
export function getToolUpdateStatus(toolName: string): ToolUpdateInfo {
|
|
123
127
|
const installedVersion = getInstalledToolVersion(toolName);
|
|
124
128
|
const tool = getBundledTools().find(t => t.name === toolName);
|
|
125
129
|
const bundledVersion = tool?.version || null;
|
|
126
130
|
|
|
127
131
|
if (!installedVersion || !bundledVersion) {
|
|
128
132
|
return {
|
|
133
|
+
name: toolName,
|
|
129
134
|
hasUpdate: false,
|
|
130
135
|
installedVersion,
|
|
131
136
|
bundledVersion,
|
|
132
137
|
};
|
|
133
138
|
}
|
|
134
139
|
|
|
140
|
+
// Use semver comparison: bundled > installed means update available
|
|
141
|
+
const hasUpdate = compareSemver(bundledVersion, installedVersion) > 0;
|
|
142
|
+
|
|
135
143
|
return {
|
|
136
|
-
|
|
144
|
+
name: toolName,
|
|
145
|
+
hasUpdate,
|
|
137
146
|
installedVersion,
|
|
138
147
|
bundledVersion,
|
|
139
148
|
};
|
|
140
149
|
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get all installed tools that have updates available
|
|
153
|
+
*/
|
|
154
|
+
export function getToolsWithUpdates(): ToolUpdateInfo[] {
|
|
155
|
+
const config = loadConfig();
|
|
156
|
+
const installedTools = getPlatformTools(config);
|
|
157
|
+
const bundledTools = getBundledTools();
|
|
158
|
+
|
|
159
|
+
const toolsWithUpdates: ToolUpdateInfo[] = [];
|
|
160
|
+
|
|
161
|
+
// Check each bundled tool to see if it's installed and has an update
|
|
162
|
+
for (const tool of bundledTools) {
|
|
163
|
+
// Find if any of the tool's required skills are installed
|
|
164
|
+
const requiredSkills = tool.includes.skills
|
|
165
|
+
.filter(s => s.required)
|
|
166
|
+
.map(s => s.name);
|
|
167
|
+
|
|
168
|
+
const isInstalled = requiredSkills.some(skillName => skillName in installedTools);
|
|
169
|
+
|
|
170
|
+
if (isInstalled) {
|
|
171
|
+
const updateStatus = getToolUpdateStatus(tool.name);
|
|
172
|
+
if (updateStatus.hasUpdate) {
|
|
173
|
+
toolsWithUpdates.push(updateStatus);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return toolsWithUpdates;
|
|
179
|
+
}
|
package/src/lib/types.ts
CHANGED
|
@@ -42,12 +42,18 @@ export interface PlatformConfig {
|
|
|
42
42
|
tools: Record<string, InstalledSkill>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export interface AutoUpdateConfig {
|
|
46
|
+
app: boolean; // Auto-update droid CLI (default: false)
|
|
47
|
+
tools: boolean; // Auto-update installed tools (default: true)
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
export interface DroidConfig {
|
|
46
51
|
platform: Platform;
|
|
47
52
|
user_mention: string;
|
|
48
53
|
output_preference: OutputPreference;
|
|
49
54
|
git_username: string;
|
|
50
55
|
platforms: Record<string, PlatformConfig>;
|
|
56
|
+
auto_update?: AutoUpdateConfig;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
// Legacy config structure for migration
|