@orderful/droid 0.27.2 → 0.27.3
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 +17 -0
- package/dist/bin/droid.js +11 -17
- package/dist/index.js +3 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/migrations.d.ts.map +1 -1
- package/dist/lib/tools.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +25 -8
- package/src/lib/migrations.ts +13 -7
- package/src/lib/tools.ts +1 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @orderful/droid
|
|
2
2
|
|
|
3
|
+
## 0.27.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#152](https://github.com/Orderful/droid/pull/152) [`8bd3a4f`](https://github.com/Orderful/droid/commit/8bd3a4f4c6ef1352ed683be584693124a202f35a) Thanks [@frytyler](https://github.com/frytyler)! - Fix config skill name migration actually persisting changes to disk
|
|
8
|
+
|
|
9
|
+
**Bug fixes:**
|
|
10
|
+
- **Per-platform change tracking**: Migration now uses a `platformChanged` flag to track changes independently for each platform, ensuring all platform configs are properly saved
|
|
11
|
+
- **Prevent config overwrites**: `runPackageMigrations` now reloads config before saving the version marker, preventing stale data from overwriting migration changes
|
|
12
|
+
- **Remove conflicting legacy code**: Deleted v0.18.0 migration fallback that was actively undoing the config renaming by deleting newly-migrated unprefixed entries
|
|
13
|
+
|
|
14
|
+
**Impact:**
|
|
15
|
+
|
|
16
|
+
The v0.27.2 config migration now successfully renames tool entries (e.g. `droid-codex` → `codex`) and persists changes to `~/.droid/config.yaml`. Tools will correctly show as installed in the TUI after upgrade.
|
|
17
|
+
|
|
18
|
+
This completes the fix for tools showing as "not installed" after upgrading to v0.27.x.
|
|
19
|
+
|
|
3
20
|
## 0.27.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/bin/droid.js
CHANGED
|
@@ -352,16 +352,6 @@ function getInstalledToolVersion(toolName) {
|
|
|
352
352
|
if (installedTools[skillName]) {
|
|
353
353
|
return installedTools[skillName].version;
|
|
354
354
|
}
|
|
355
|
-
if (skillName.startsWith("droid-")) {
|
|
356
|
-
const oldSkillName = skillName.replace(/^droid-/, "");
|
|
357
|
-
if (installedTools[oldSkillName]) {
|
|
358
|
-
const version2 = installedTools[oldSkillName].version;
|
|
359
|
-
delete installedTools[oldSkillName];
|
|
360
|
-
setPlatformTools(config, installedTools);
|
|
361
|
-
saveConfig(config);
|
|
362
|
-
return version2;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
355
|
}
|
|
366
356
|
return null;
|
|
367
357
|
}
|
|
@@ -628,6 +618,7 @@ function createConfigSkillNameMigration(version2) {
|
|
|
628
618
|
config.platform = platformKey;
|
|
629
619
|
const trackedTools = getPlatformTools(config);
|
|
630
620
|
const skillNames = Object.keys(trackedTools);
|
|
621
|
+
let platformChanged = false;
|
|
631
622
|
for (const skillName of skillNames) {
|
|
632
623
|
if (!skillName.startsWith("droid-") || skillName === "droid") {
|
|
633
624
|
continue;
|
|
@@ -636,10 +627,11 @@ function createConfigSkillNameMigration(version2) {
|
|
|
636
627
|
if (!trackedTools[unprefixedName]) {
|
|
637
628
|
trackedTools[unprefixedName] = trackedTools[skillName];
|
|
638
629
|
delete trackedTools[skillName];
|
|
630
|
+
platformChanged = true;
|
|
639
631
|
configChanged = true;
|
|
640
632
|
}
|
|
641
633
|
}
|
|
642
|
-
if (
|
|
634
|
+
if (platformChanged) {
|
|
643
635
|
setPlatformTools(config, trackedTools);
|
|
644
636
|
}
|
|
645
637
|
}
|
|
@@ -740,9 +732,10 @@ function runPackageMigrations(packageVersion) {
|
|
|
740
732
|
return afterFrom && beforeOrAtTo;
|
|
741
733
|
});
|
|
742
734
|
if (pendingMigrations.length === 0) {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
735
|
+
const freshConfig = loadConfig();
|
|
736
|
+
freshConfig.migrations = freshConfig.migrations || {};
|
|
737
|
+
freshConfig.migrations.package = packageVersion;
|
|
738
|
+
saveConfig(freshConfig);
|
|
746
739
|
return { success: true };
|
|
747
740
|
}
|
|
748
741
|
const configDir = getConfigDir();
|
|
@@ -765,9 +758,10 @@ function runPackageMigrations(packageVersion) {
|
|
|
765
758
|
};
|
|
766
759
|
}
|
|
767
760
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
761
|
+
const updatedConfig = loadConfig();
|
|
762
|
+
updatedConfig.migrations = updatedConfig.migrations || {};
|
|
763
|
+
updatedConfig.migrations.package = packageVersion;
|
|
764
|
+
saveConfig(updatedConfig);
|
|
771
765
|
return { success: true };
|
|
772
766
|
}
|
|
773
767
|
|
package/dist/index.js
CHANGED
|
@@ -591,6 +591,7 @@ function createConfigSkillNameMigration(version) {
|
|
|
591
591
|
config.platform = platformKey;
|
|
592
592
|
const trackedTools = getPlatformTools(config);
|
|
593
593
|
const skillNames = Object.keys(trackedTools);
|
|
594
|
+
let platformChanged = false;
|
|
594
595
|
for (const skillName of skillNames) {
|
|
595
596
|
if (!skillName.startsWith("droid-") || skillName === "droid") {
|
|
596
597
|
continue;
|
|
@@ -599,10 +600,11 @@ function createConfigSkillNameMigration(version) {
|
|
|
599
600
|
if (!trackedTools[unprefixedName]) {
|
|
600
601
|
trackedTools[unprefixedName] = trackedTools[skillName];
|
|
601
602
|
delete trackedTools[skillName];
|
|
603
|
+
platformChanged = true;
|
|
602
604
|
configChanged = true;
|
|
603
605
|
}
|
|
604
606
|
}
|
|
605
|
-
if (
|
|
607
|
+
if (platformChanged) {
|
|
606
608
|
setPlatformTools(config, trackedTools);
|
|
607
609
|
}
|
|
608
610
|
}
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAmDjB;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAItC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,WAAW,CA4BxC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAKpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAanD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAiBhE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAWD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAapE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,cAAc,GACxB,IAAI,CAWN;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAMtD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAQ5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/lib/migrations.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/lib/migrations.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,SAAS,CAAC;AAmOjB;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,CAE/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAc/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAmBN;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA2CtC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GACvB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAStC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAyDA"}
|
package/dist/lib/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/lib/tools.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/lib/tools.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAyBrE;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,YAAY,EAAE,CAmBhD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAczD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmBvE;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAuBpE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,EAAE,CA2BtD"}
|
package/package.json
CHANGED
package/src/lib/config.ts
CHANGED
|
@@ -2,14 +2,21 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import { homedir } from 'os';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import YAML from 'yaml';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Platform,
|
|
7
|
+
BuiltInOutput,
|
|
8
|
+
type DroidConfig,
|
|
9
|
+
type LegacyDroidConfig,
|
|
10
|
+
type SkillOverrides,
|
|
11
|
+
type AutoUpdateConfig,
|
|
12
|
+
} from './types';
|
|
6
13
|
|
|
7
14
|
const CONFIG_DIR = join(homedir(), '.droid');
|
|
8
15
|
const CONFIG_FILE = join(CONFIG_DIR, 'config.yaml');
|
|
9
16
|
|
|
10
17
|
const DEFAULT_AUTO_UPDATE: AutoUpdateConfig = {
|
|
11
|
-
app: false,
|
|
12
|
-
tools: true,
|
|
18
|
+
app: false, // Opt-in: user must enable
|
|
19
|
+
tools: true, // Opt-out: enabled by default (tools only update when app updates)
|
|
13
20
|
};
|
|
14
21
|
|
|
15
22
|
const DEFAULT_CONFIG: DroidConfig = {
|
|
@@ -25,14 +32,17 @@ const DEFAULT_CONFIG: DroidConfig = {
|
|
|
25
32
|
* v1: ai_tool + skills flat
|
|
26
33
|
* v2: platform + platforms map with per-platform tools
|
|
27
34
|
*/
|
|
28
|
-
function migrateConfig(
|
|
35
|
+
function migrateConfig(
|
|
36
|
+
config: Partial<DroidConfig> & Partial<LegacyDroidConfig>,
|
|
37
|
+
): DroidConfig {
|
|
29
38
|
// Check if this is a legacy config (has ai_tool, no platform)
|
|
30
39
|
if ('ai_tool' in config && !('platform' in config)) {
|
|
31
40
|
const legacyConfig = config as LegacyDroidConfig;
|
|
32
41
|
return {
|
|
33
42
|
platform: legacyConfig.ai_tool,
|
|
34
43
|
user_mention: legacyConfig.user_mention ?? DEFAULT_CONFIG.user_mention,
|
|
35
|
-
output_preference:
|
|
44
|
+
output_preference:
|
|
45
|
+
legacyConfig.output_preference ?? DEFAULT_CONFIG.output_preference,
|
|
36
46
|
git_username: legacyConfig.git_username ?? DEFAULT_CONFIG.git_username,
|
|
37
47
|
platforms: {
|
|
38
48
|
[legacyConfig.ai_tool]: {
|
|
@@ -79,7 +89,8 @@ export function loadConfig(): DroidConfig {
|
|
|
79
89
|
|
|
80
90
|
try {
|
|
81
91
|
const content = readFileSync(CONFIG_FILE, 'utf-8');
|
|
82
|
-
const rawConfig = YAML.parse(content) as Partial<DroidConfig> &
|
|
92
|
+
const rawConfig = YAML.parse(content) as Partial<DroidConfig> &
|
|
93
|
+
Partial<LegacyDroidConfig>;
|
|
83
94
|
|
|
84
95
|
// Check if migration is needed
|
|
85
96
|
// TODO: Remove after v0.14.0 (target: late Jan 2025)
|
|
@@ -133,7 +144,10 @@ export function getConfigValue(key: string): unknown {
|
|
|
133
144
|
export function setConfigValue(key: string, value: unknown): void {
|
|
134
145
|
const config = loadConfig();
|
|
135
146
|
const keys = key.split('.');
|
|
136
|
-
let current: Record<string, unknown> = config as unknown as Record<
|
|
147
|
+
let current: Record<string, unknown> = config as unknown as Record<
|
|
148
|
+
string,
|
|
149
|
+
unknown
|
|
150
|
+
>;
|
|
137
151
|
|
|
138
152
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
139
153
|
if (current[keys[i]] === undefined) {
|
|
@@ -198,7 +212,10 @@ export function loadSkillOverrides(skillName: string): SkillOverrides {
|
|
|
198
212
|
/**
|
|
199
213
|
* Save skill-specific overrides
|
|
200
214
|
*/
|
|
201
|
-
export function saveSkillOverrides(
|
|
215
|
+
export function saveSkillOverrides(
|
|
216
|
+
skillName: string,
|
|
217
|
+
overrides: SkillOverrides,
|
|
218
|
+
): void {
|
|
202
219
|
const normalizedName = normalizeSkillNameForConfig(skillName);
|
|
203
220
|
const overridesPath = getSkillOverridesPath(skillName);
|
|
204
221
|
const skillDir = join(CONFIG_DIR, 'skills', normalizedName);
|
package/src/lib/migrations.ts
CHANGED
|
@@ -179,6 +179,7 @@ function createConfigSkillNameMigration(version: string): Migration {
|
|
|
179
179
|
config.platform = platformKey;
|
|
180
180
|
const trackedTools = getPlatformTools(config);
|
|
181
181
|
const skillNames = Object.keys(trackedTools);
|
|
182
|
+
let platformChanged = false;
|
|
182
183
|
|
|
183
184
|
for (const skillName of skillNames) {
|
|
184
185
|
// Skip if already unprefixed or is the special 'droid' tool
|
|
@@ -192,11 +193,12 @@ function createConfigSkillNameMigration(version: string): Migration {
|
|
|
192
193
|
if (!trackedTools[unprefixedName]) {
|
|
193
194
|
trackedTools[unprefixedName] = trackedTools[skillName];
|
|
194
195
|
delete trackedTools[skillName];
|
|
196
|
+
platformChanged = true;
|
|
195
197
|
configChanged = true;
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
|
|
199
|
-
if (
|
|
201
|
+
if (platformChanged) {
|
|
200
202
|
setPlatformTools(config, trackedTools);
|
|
201
203
|
}
|
|
202
204
|
}
|
|
@@ -387,9 +389,11 @@ export function runPackageMigrations(packageVersion: string): {
|
|
|
387
389
|
|
|
388
390
|
if (pendingMigrations.length === 0) {
|
|
389
391
|
// No migrations to run, but still update the version marker
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
// Reload config in case it was modified elsewhere
|
|
393
|
+
const freshConfig = loadConfig();
|
|
394
|
+
freshConfig.migrations = freshConfig.migrations || {};
|
|
395
|
+
freshConfig.migrations.package = packageVersion;
|
|
396
|
+
saveConfig(freshConfig);
|
|
393
397
|
return { success: true };
|
|
394
398
|
}
|
|
395
399
|
|
|
@@ -418,8 +422,10 @@ export function runPackageMigrations(packageVersion: string): {
|
|
|
418
422
|
}
|
|
419
423
|
|
|
420
424
|
// All migrations succeeded, update version marker
|
|
421
|
-
config
|
|
422
|
-
|
|
423
|
-
|
|
425
|
+
// Reload config in case migrations modified it
|
|
426
|
+
const updatedConfig = loadConfig();
|
|
427
|
+
updatedConfig.migrations = updatedConfig.migrations || {};
|
|
428
|
+
updatedConfig.migrations.package = packageVersion;
|
|
429
|
+
saveConfig(updatedConfig);
|
|
424
430
|
return { success: true };
|
|
425
431
|
}
|
package/src/lib/tools.ts
CHANGED
|
@@ -2,12 +2,11 @@ import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
|
2
2
|
import { join, dirname } from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import YAML from 'yaml';
|
|
5
|
-
import { loadConfig
|
|
5
|
+
import { loadConfig } from './config';
|
|
6
6
|
import {
|
|
7
7
|
type ToolManifest,
|
|
8
8
|
type ToolIncludes,
|
|
9
9
|
getPlatformTools,
|
|
10
|
-
setPlatformTools,
|
|
11
10
|
} from './types';
|
|
12
11
|
import { compareSemver } from './version';
|
|
13
12
|
|
|
@@ -113,20 +112,6 @@ export function getInstalledToolVersion(toolName: string): string | null {
|
|
|
113
112
|
if (installedTools[skillName]) {
|
|
114
113
|
return installedTools[skillName].version;
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
// Migration fallback (v0.18.0): Check for old skill name without droid- prefix
|
|
118
|
-
// This allows tools to show as "update available" rather than "not installed"
|
|
119
|
-
if (skillName.startsWith('droid-')) {
|
|
120
|
-
const oldSkillName = skillName.replace(/^droid-/, '');
|
|
121
|
-
if (installedTools[oldSkillName]) {
|
|
122
|
-
const version = installedTools[oldSkillName].version;
|
|
123
|
-
// Clean up stale config entry now that we've detected it
|
|
124
|
-
delete installedTools[oldSkillName];
|
|
125
|
-
setPlatformTools(config, installedTools);
|
|
126
|
-
saveConfig(config);
|
|
127
|
-
return version;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
115
|
}
|
|
131
116
|
|
|
132
117
|
return null;
|