gyoshu 0.4.17 → 0.4.19
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/package.json +1 -1
- package/src/gyoshu-manifest.json +1 -1
- package/src/index.ts +33 -20
package/package.json
CHANGED
package/src/gyoshu-manifest.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { readFileNoFollowSync, openNoFollowSync } from "./lib/atomic-write";
|
|
|
8
8
|
import { ensureDirSync, validatePathSegment } from "./lib/paths";
|
|
9
9
|
|
|
10
10
|
import manifest from "./gyoshu-manifest.json";
|
|
11
|
-
import { GyoshuPlugin as GyoshuHooks } from "./plugin/gyoshu-hooks";
|
|
12
11
|
|
|
13
12
|
const OPENCODE_CONFIG = path.join(homedir(), ".config", "opencode");
|
|
14
13
|
const GYOSHU_STATE_DIR = path.join(OPENCODE_CONFIG, ".gyoshu");
|
|
@@ -867,32 +866,46 @@ function autoInstall(): InstallResult {
|
|
|
867
866
|
}
|
|
868
867
|
|
|
869
868
|
export const GyoshuPlugin: Plugin = async (ctx) => {
|
|
870
|
-
|
|
869
|
+
// Always return a valid Hooks object, even on error
|
|
870
|
+
const emptyHooks = {};
|
|
871
|
+
|
|
872
|
+
try {
|
|
873
|
+
const installResult = autoInstall();
|
|
871
874
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
875
|
+
if (installResult.fatal) {
|
|
876
|
+
console.error(`❌ Gyoshu: Fatal installation error`);
|
|
877
|
+
for (const error of installResult.errors) {
|
|
878
|
+
console.error(` - ${error}`);
|
|
879
|
+
}
|
|
876
880
|
}
|
|
877
|
-
return GyoshuHooks(ctx);
|
|
878
|
-
}
|
|
879
881
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
882
|
+
if (installResult.installed > 0) {
|
|
883
|
+
console.log(`🎓 Gyoshu: Installed ${installResult.installed} files to ~/.config/opencode/`);
|
|
884
|
+
}
|
|
883
885
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
886
|
+
if (installResult.updated > 0) {
|
|
887
|
+
console.log(`🎓 Gyoshu: Updated ${installResult.updated} files`);
|
|
888
|
+
}
|
|
887
889
|
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
890
|
+
if (installResult.errors.length > 0) {
|
|
891
|
+
console.warn(`⚠️ Gyoshu: Some issues occurred:`);
|
|
892
|
+
for (const error of installResult.errors) {
|
|
893
|
+
console.warn(` - ${error}`);
|
|
894
|
+
}
|
|
892
895
|
}
|
|
893
|
-
}
|
|
894
896
|
|
|
895
|
-
|
|
897
|
+
try {
|
|
898
|
+
const { GyoshuPlugin: GyoshuHooks } = await import("./plugin/gyoshu-hooks");
|
|
899
|
+
const hooks = await GyoshuHooks(ctx);
|
|
900
|
+
return hooks || emptyHooks;
|
|
901
|
+
} catch (hooksError) {
|
|
902
|
+
console.error(`❌ Gyoshu: Failed to initialize hooks: ${hooksError instanceof Error ? hooksError.message : String(hooksError)}`);
|
|
903
|
+
return emptyHooks;
|
|
904
|
+
}
|
|
905
|
+
} catch (err) {
|
|
906
|
+
console.error(`❌ Gyoshu: Plugin initialization failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
907
|
+
return emptyHooks;
|
|
908
|
+
}
|
|
896
909
|
};
|
|
897
910
|
|
|
898
911
|
export default GyoshuPlugin;
|