several changes
This commit is contained in:
@@ -8,5 +8,6 @@ mkdir -p "$HOME/.cache"
|
|||||||
{
|
{
|
||||||
ssh mac-attio "mkdir -p ~/.pi/agent/themes"
|
ssh mac-attio "mkdir -p ~/.pi/agent/themes"
|
||||||
scp "$HOME/.pi/agent/themes/matugen.json" \
|
scp "$HOME/.pi/agent/themes/matugen.json" \
|
||||||
mac-attio:~/.pi/agent/themes/
|
mac-attio:~/.pi/agent/themes/matugen.json.tmp
|
||||||
|
ssh mac-attio "mv ~/.pi/agent/themes/matugen.json.tmp ~/.pi/agent/themes/matugen.json"
|
||||||
} >>"$log_file" 2>&1
|
} >>"$log_file" 2>&1
|
||||||
|
|||||||
1
pi/files/agent/extensions/matugen-theme-watch/.gitignore
vendored
Normal file
1
pi/files/agent/extensions/matugen-theme-watch/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import tseslint from "@typescript-eslint/eslint-plugin";
|
||||||
|
import tsParser from "@typescript-eslint/parser";
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
files: ["**/*.ts"],
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: "latest",
|
||||||
|
sourceType: "module",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
"@typescript-eslint": tseslint,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...tseslint.configs.recommended.rules,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -96,7 +96,7 @@ async function loadThemeFromPath(filePath: string): Promise<PiTheme> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (pi: ExtensionAPI) {
|
export default function matugenThemeWatch(pi: ExtensionAPI) {
|
||||||
let watcher: fs.StatWatcher | null = null;
|
let watcher: fs.StatWatcher | null = null;
|
||||||
let debounce: NodeJS.Timeout | null = null;
|
let debounce: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
@@ -113,14 +113,14 @@ export default function (pi: ExtensionAPI) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
debounce = setTimeout(async () => {
|
debounce = setTimeout(async () => {
|
||||||
try {
|
// i wish this fucking worked
|
||||||
|
// pi.sendUserMessage("/reload", { deliverAs: "followUp" });
|
||||||
const theme = await loadThemeFromPath(THEME_PATH);
|
const theme = await loadThemeFromPath(THEME_PATH);
|
||||||
const result = ctx.ui.setTheme(theme);
|
const res = ctx.ui.setTheme(theme);
|
||||||
if (!result.success && result.error) {
|
if (res.success) {
|
||||||
ctx.ui.notify(`Theme reload failed: ${result.error}`, "error");
|
ctx.ui.notify("Background changed. Colors: ", "info");
|
||||||
}
|
} else {
|
||||||
} catch (error) {
|
ctx.ui.notify("Theme update failed, fuck", "error");
|
||||||
ctx.ui.notify(`Theme reload failed: ${String(error)}`, "error");
|
|
||||||
}
|
}
|
||||||
}, 150);
|
}, 150);
|
||||||
},
|
},
|
||||||
@@ -132,7 +132,8 @@ export default function (pi: ExtensionAPI) {
|
|||||||
|
|
||||||
pi.on("session_shutdown", () => {
|
pi.on("session_shutdown", () => {
|
||||||
if (watcher) {
|
if (watcher) {
|
||||||
fs.unwatchFile(THEME_PATH, watcher);
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- weird types
|
||||||
|
fs.unwatchFile(THEME_PATH, watcher as any);
|
||||||
watcher = null;
|
watcher = null;
|
||||||
}
|
}
|
||||||
if (debounce) {
|
if (debounce) {
|
||||||
13
pi/files/agent/extensions/matugen-theme-watch/package.json
Normal file
13
pi/files/agent/extensions/matugen-theme-watch/package.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "pi-extensions",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"@mariozechner/pi-coding-agent": "^0.54.0",
|
||||||
|
"@sinclair/typebox": "^0.34.0",
|
||||||
|
"eslint": "^9.0.0",
|
||||||
|
"@typescript-eslint/parser": "^8.0.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
3427
pi/files/agent/extensions/matugen-theme-watch/pnpm-lock.yaml
generated
Normal file
3427
pi/files/agent/extensions/matugen-theme-watch/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
pi/files/agent/extensions/matugen-theme-watch/tsconfig.json
Normal file
12
pi/files/agent/extensions/matugen-theme-watch/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"types": ["node"],
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"resolveJsonModule": true
|
||||||
|
},
|
||||||
|
"include": ["**/*.ts"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user