From 34777504f977018dba256e68d84fad257799b876 Mon Sep 17 00:00:00 2001 From: alex-mcgovern Date: Fri, 17 Jan 2025 16:35:46 +0000 Subject: [PATCH 1/5] feat: monaco text editor for system prompt --- package-lock.json | 132 +- package.json | 1 + src/App.tsx | 2 + .../components/system-prompt-editor.tsx | 53 + .../workspace-system-prompt/constants.ts | 1089 +++++++++++++++++ src/routes/route-workspace.tsx | 11 + 6 files changed, 1190 insertions(+), 98 deletions(-) create mode 100644 src/features/workspace-system-prompt/components/system-prompt-editor.tsx create mode 100644 src/features/workspace-system-prompt/constants.ts create mode 100644 src/routes/route-workspace.tsx diff --git a/package-lock.json b/package-lock.json index e171cfd1..666a5124 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.5.0", "dependencies": { "@hey-api/client-fetch": "^0.6.0", + "@monaco-editor/react": "^4.6.0", "@radix-ui/react-dialog": "^1.1.4", "@radix-ui/react-separator": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", @@ -1502,6 +1503,32 @@ "dev": true, "license": "MIT" }, + "node_modules/@monaco-editor/loader": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.4.0.tgz", + "integrity": "sha512-00ioBig0x642hytVspPl7DbQyaSWRaolYie/UFNjoTdvoKPzo6xrXLhTk9ixgIKcLH5b5vDOjVNiGyY+uDCUlg==", + "license": "MIT", + "dependencies": { + "state-local": "^1.0.6" + }, + "peerDependencies": { + "monaco-editor": ">= 0.21.0 < 1" + } + }, + "node_modules/@monaco-editor/react": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.6.0.tgz", + "integrity": "sha512-RFkU9/i7cN2bsq/iTkurMWOEErmYcY6JiQI3Jn+WeR/FGISH8JbHERjpS9oRuSOPvDMJI0Z8nJeKkbOs9sBYQw==", + "license": "MIT", + "dependencies": { + "@monaco-editor/loader": "^1.4.0" + }, + "peerDependencies": { + "monaco-editor": ">= 0.25.0 < 1", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/@mswjs/interceptors": { "version": "0.37.4", "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.37.4.tgz", @@ -4173,27 +4200,6 @@ "react": "^18 || ^19" } }, - "node_modules/@testing-library/dom": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", - "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.10.4", - "@babel/runtime": "^7.12.5", - "@types/aria-query": "^5.0.1", - "aria-query": "5.3.0", - "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.9", - "lz-string": "^1.5.0", - "pretty-format": "^27.0.2" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/@testing-library/jest-dom": { "version": "6.6.3", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz", @@ -4278,14 +4284,6 @@ "@testing-library/dom": ">=7.21.4" } }, - "node_modules/@types/aria-query": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", - "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", - "dev": true, - "license": "MIT", - "peer": true - }, "node_modules/@types/cookie": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", @@ -4438,7 +4436,7 @@ "version": "19.0.2", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.0.2.tgz", "integrity": "sha512-c1s+7TKFaDRRxr1TxccIX2u7sfCnc3RxkVyBIUA2lCpyqCF+QoAwQ/CBg7bsMdVwP120HEH143VQezKtef5nCg==", - "devOptional": true, + "dev": true, "license": "MIT", "peerDependencies": { "@types/react": "^19.0.0" @@ -5977,14 +5975,6 @@ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", "license": "MIT" }, - "node_modules/dom-accessibility-api": { - "version": "0.5.16", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", - "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", - "dev": true, - "license": "MIT", - "peer": true - }, "node_modules/dom-helpers": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", @@ -7829,17 +7819,6 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, - "node_modules/lz-string": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", - "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", - "dev": true, - "license": "MIT", - "peer": true, - "bin": { - "lz-string": "bin/bin.js" - } - }, "node_modules/magic-string": { "version": "0.30.17", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", @@ -9606,55 +9585,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/pretty-format": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", - "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "ansi-regex": "^5.0.1", - "ansi-styles": "^5.0.0", - "react-is": "^17.0.1" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/pretty-format/node_modules/react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", - "dev": true, - "license": "MIT", - "peer": true - }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", @@ -10701,6 +10631,12 @@ "dev": true, "license": "MIT" }, + "node_modules/state-local": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz", + "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==", + "license": "MIT" + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", diff --git a/package.json b/package.json index 91d40866..2a48b882 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ }, "dependencies": { "@hey-api/client-fetch": "^0.6.0", + "@monaco-editor/react": "^4.6.0", "@radix-ui/react-dialog": "^1.1.4", "@radix-ui/react-separator": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", diff --git a/src/App.tsx b/src/App.tsx index 25a1467e..f0da106f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -17,6 +17,7 @@ import { BreadcrumbPage, } from "./components/ui/breadcrumb"; import { useBreadcrumb } from "./hooks/useBreadcrumb"; +import { RouteWorkspace } from "./routes/route-workspace"; function App() { const { data: prompts, isLoading } = usePromptsData(); @@ -57,6 +58,7 @@ function App() { } /> } /> } /> + } /> } diff --git a/src/features/workspace-system-prompt/components/system-prompt-editor.tsx b/src/features/workspace-system-prompt/components/system-prompt-editor.tsx new file mode 100644 index 00000000..fed3f635 --- /dev/null +++ b/src/features/workspace-system-prompt/components/system-prompt-editor.tsx @@ -0,0 +1,53 @@ +import Editor, { type Theme } from "@monaco-editor/react"; +import { Button, DarkModeContext, Heading } from "@stacklok/ui-kit"; +import { Dispatch, SetStateAction, useContext, useState } from "react"; + +type DarkModeContextValue = { + preference: "dark" | "light" | null; + override: "dark" | "light" | null; +}; + +const DEFAULT_VALUE = + ""; + +function inferDarkMode( + contextValue: + | null + | [DarkModeContextValue, Dispatch>], +): Theme { + if (contextValue === null) return "light"; + if (contextValue[0].override === "dark") return "vs-dark"; + if (contextValue[0].preference === "dark") return "vs-dark"; + return "light"; +} + +export function SystemPromptEditor() { + const context = useContext(DarkModeContext); + const theme: Theme = inferDarkMode(context); + + const [value, setValue] = useState(() => DEFAULT_VALUE); + + return ( + <> +
+ System prompt + +
+ setValue(v ?? "")} + height="50dvh" + defaultLanguage="Markdown" + theme={theme} + className="bg-base" + defaultValue="" + /> + + ); +} diff --git a/src/features/workspace-system-prompt/constants.ts b/src/features/workspace-system-prompt/constants.ts new file mode 100644 index 00000000..a4fa7e27 --- /dev/null +++ b/src/features/workspace-system-prompt/constants.ts @@ -0,0 +1,1089 @@ +export const MONACO_THEME = { + base: "vs-dark", + inherit: true, + rules: [ + { + background: "var(--bg-base)", + token: "", + }, + { + foreground: "586e75", + token: "comment", + }, + { + foreground: "2aa198", + token: "string", + }, + { + foreground: "586e75", + token: "string", + }, + { + foreground: "dc322f", + token: "string.regexp", + }, + { + foreground: "d33682", + token: "constant.numeric", + }, + { + foreground: "268bd2", + token: "variable.language", + }, + { + foreground: "268bd2", + token: "variable.other", + }, + { + foreground: "859900", + token: "keyword", + }, + { + foreground: "859900", + token: "storage", + }, + { + foreground: "268bd2", + token: "entity.name.class", + }, + { + foreground: "268bd2", + token: "entity.name.type.class", + }, + { + foreground: "268bd2", + token: "entity.name.function", + }, + { + foreground: "859900", + token: "punctuation.definition.variable", + }, + { + foreground: "dc322f", + token: "punctuation.section.embedded.begin", + }, + { + foreground: "dc322f", + token: "punctuation.section.embedded.end", + }, + { + foreground: "b58900", + token: "constant.language", + }, + { + foreground: "b58900", + token: "meta.preprocessor", + }, + { + foreground: "dc322f", + token: "support.function.construct", + }, + { + foreground: "dc322f", + token: "keyword.other.new", + }, + { + foreground: "cb4b16", + token: "constant.character", + }, + { + foreground: "cb4b16", + token: "constant.other", + }, + { + foreground: "268bd2", + fontStyle: "bold", + token: "entity.name.tag", + }, + { + foreground: "586e75", + token: "punctuation.definition.tag.html", + }, + { + foreground: "586e75", + token: "punctuation.definition.tag.begin", + }, + { + foreground: "586e75", + token: "punctuation.definition.tag.end", + }, + { + foreground: "93a1a1", + token: "entity.other.attribute-name", + }, + { + foreground: "268bd2", + token: "support.function", + }, + { + foreground: "dc322f", + token: "punctuation.separator.continuation", + }, + { + foreground: "859900", + token: "support.type", + }, + { + foreground: "859900", + token: "support.class", + }, + { + foreground: "cb4b16", + token: "support.type.exception", + }, + { + foreground: "cb4b16", + token: "keyword.other.special-method", + }, + { + foreground: "2aa198", + token: "string.quoted.double", + }, + { + foreground: "2aa198", + token: "string.quoted.single", + }, + { + foreground: "dc322f", + token: "punctuation.definition.string.begin", + }, + { + foreground: "dc322f", + token: "punctuation.definition.string.end", + }, + { + foreground: "b58900", + token: "entity.name.tag.css", + }, + { + foreground: "b58900", + token: "support.type.property-name.css", + }, + { + foreground: "b58900", + token: "meta.property-name.css", + }, + { + foreground: "dc322f", + token: "source.css", + }, + { + foreground: "586e75", + token: "meta.selector.css", + }, + { + foreground: "6c71c4", + token: "punctuation.section.property-list.css", + }, + { + foreground: "2aa198", + token: "meta.property-value.css constant.numeric.css", + }, + { + foreground: "2aa198", + token: "keyword.other.unit.css", + }, + { + foreground: "2aa198", + token: "constant.other.color.rgb-value.css", + }, + { + foreground: "2aa198", + token: "meta.property-value.css", + }, + { + foreground: "dc322f", + token: "keyword.other.important.css", + }, + { + foreground: "2aa198", + token: "support.constant.color", + }, + { + foreground: "859900", + token: "entity.name.tag.css", + }, + { + foreground: "586e75", + token: "punctuation.separator.key-value.css", + }, + { + foreground: "586e75", + token: "punctuation.terminator.rule.css", + }, + { + foreground: "268bd2", + token: "entity.other.attribute-name.class.css", + }, + { + foreground: "cb4b16", + token: "entity.other.attribute-name.pseudo-element.css", + }, + { + foreground: "cb4b16", + token: "entity.other.attribute-name.pseudo-class.css", + }, + { + foreground: "268bd2", + token: "entity.other.attribute-name.id.css", + }, + { + foreground: "b58900", + token: "meta.function.js", + }, + { + foreground: "b58900", + token: "entity.name.function.js", + }, + { + foreground: "b58900", + token: "support.function.dom.js", + }, + { + foreground: "b58900", + token: "text.html.basic source.js.embedded.html", + }, + { + foreground: "268bd2", + token: "storage.type.function.js", + }, + { + foreground: "2aa198", + token: "constant.numeric.js", + }, + { + foreground: "268bd2", + token: "meta.brace.square.js", + }, + { + foreground: "268bd2", + token: "storage.type.js", + }, + { + foreground: "93a1a1", + token: "meta.brace.round", + }, + { + foreground: "93a1a1", + token: "punctuation.definition.parameters.begin.js", + }, + { + foreground: "93a1a1", + token: "punctuation.definition.parameters.end.js", + }, + { + foreground: "268bd2", + token: "meta.brace.curly.js", + }, + { + foreground: "93a1a1", + fontStyle: "italic", + token: "entity.name.tag.doctype.html", + }, + { + foreground: "93a1a1", + fontStyle: "italic", + token: "meta.tag.sgml.html", + }, + { + foreground: "93a1a1", + fontStyle: "italic", + token: "string.quoted.double.doctype.identifiers-and-DTDs.html", + }, + { + foreground: "839496", + fontStyle: "italic", + token: "comment.block.html", + }, + { + fontStyle: "italic", + token: "entity.name.tag.script.html", + }, + { + foreground: "2aa198", + token: "source.css.embedded.html string.quoted.double.html", + }, + { + foreground: "cb4b16", + fontStyle: "bold", + token: "text.html.ruby", + }, + { + foreground: "657b83", + token: "text.html.basic meta.tag.other.html", + }, + { + foreground: "657b83", + token: "text.html.basic meta.tag.any.html", + }, + { + foreground: "657b83", + token: "text.html.basic meta.tag.block.any", + }, + { + foreground: "657b83", + token: "text.html.basic meta.tag.inline.any", + }, + { + foreground: "657b83", + token: "text.html.basic meta.tag.structure.any.html", + }, + { + foreground: "657b83", + token: "text.html.basic source.js.embedded.html", + }, + { + foreground: "657b83", + token: "punctuation.separator.key-value.html", + }, + { + foreground: "657b83", + token: "text.html.basic entity.other.attribute-name.html", + }, + { + foreground: "2aa198", + token: + "text.html.basic meta.tag.structure.any.html punctuation.definition.string.begin.html", + }, + { + foreground: "2aa198", + token: "punctuation.definition.string.begin.html", + }, + { + foreground: "2aa198", + token: "punctuation.definition.string.end.html", + }, + { + foreground: "268bd2", + fontStyle: "bold", + token: "entity.name.tag.block.any.html", + }, + { + fontStyle: "italic", + token: "source.css.embedded.html entity.name.tag.style.html", + }, + { + foreground: "839496", + fontStyle: "italic", + token: "source.css.embedded.html", + }, + { + foreground: "839496", + fontStyle: "italic", + token: "comment.block.html", + }, + { + foreground: "268bd2", + token: "punctuation.definition.variable.ruby", + }, + { + foreground: "657b83", + token: "meta.function.method.with-arguments.ruby", + }, + { + foreground: "2aa198", + token: "variable.language.ruby", + }, + { + foreground: "268bd2", + token: "entity.name.function.ruby", + }, + { + foreground: "859900", + fontStyle: "bold", + token: "keyword.control.ruby", + }, + { + foreground: "859900", + fontStyle: "bold", + token: "keyword.control.def.ruby", + }, + { + foreground: "859900", + token: "keyword.control.class.ruby", + }, + { + foreground: "859900", + token: "meta.class.ruby", + }, + { + foreground: "b58900", + token: "entity.name.type.class.ruby", + }, + { + foreground: "859900", + token: "keyword.control.ruby", + }, + { + foreground: "b58900", + token: "support.class.ruby", + }, + { + foreground: "859900", + token: "keyword.other.special-method.ruby", + }, + { + foreground: "2aa198", + token: "constant.language.ruby", + }, + { + foreground: "2aa198", + token: "constant.numeric.ruby", + }, + { + foreground: "b58900", + token: "variable.other.constant.ruby", + }, + { + foreground: "2aa198", + token: "constant.other.symbol.ruby", + }, + { + foreground: "dc322f", + token: "punctuation.section.embedded.ruby", + }, + { + foreground: "dc322f", + token: "punctuation.definition.string.begin.ruby", + }, + { + foreground: "dc322f", + token: "punctuation.definition.string.end.ruby", + }, + { + foreground: "cb4b16", + token: "keyword.other.special-method.ruby", + }, + { + foreground: "cb4b16", + token: "keyword.control.import.include.php", + }, + { + foreground: "839496", + token: "text.html.ruby meta.tag.inline.any.html", + }, + { + foreground: "2aa198", + token: "text.html.ruby punctuation.definition.string.begin", + }, + { + foreground: "2aa198", + token: "text.html.ruby punctuation.definition.string.end", + }, + { + foreground: "839496", + token: "punctuation.definition.string.begin", + }, + { + foreground: "839496", + token: "punctuation.definition.string.end", + }, + { + foreground: "839496", + token: "support.class.php", + }, + { + foreground: "dc322f", + token: "keyword.operator.index-start.php", + }, + { + foreground: "dc322f", + token: "keyword.operator.index-end.php", + }, + { + foreground: "586e75", + token: "meta.array.php", + }, + { + foreground: "b58900", + token: "meta.array.php support.function.construct.php", + }, + { + foreground: "b58900", + token: "meta.array.empty.php support.function.construct.php", + }, + { + foreground: "b58900", + token: "support.function.construct.php", + }, + { + foreground: "dc322f", + token: "punctuation.definition.array.begin", + }, + { + foreground: "dc322f", + token: "punctuation.definition.array.end", + }, + { + foreground: "2aa198", + token: "constant.numeric.php", + }, + { + foreground: "cb4b16", + token: "keyword.other.new.php", + }, + { + foreground: "839496", + token: "keyword.operator.class", + }, + { + foreground: "93a1a1", + token: "variable.other.property.php", + }, + { + foreground: "b58900", + token: "storage.modifier.extends.php", + }, + { + foreground: "b58900", + token: "storage.type.class.php", + }, + { + foreground: "b58900", + token: "keyword.operator.class.php", + }, + { + foreground: "839496", + token: "punctuation.terminator.expression.php", + }, + { + foreground: "586e75", + token: "meta.other.inherited-class.php", + }, + { + foreground: "859900", + token: "storage.type.php", + }, + { + foreground: "93a1a1", + token: "entity.name.function.php", + }, + { + foreground: "859900", + token: "support.function.construct.php", + }, + { + foreground: "839496", + token: "entity.name.type.class.php", + }, + { + foreground: "839496", + token: "meta.function-call.php", + }, + { + foreground: "839496", + token: "meta.function-call.static.php", + }, + { + foreground: "839496", + token: "meta.function-call.object.php", + }, + { + foreground: "93a1a1", + token: "keyword.other.phpdoc", + }, + { + foreground: "cb4b16", + token: "source.php.embedded.block.html", + }, + { + foreground: "cb4b16", + token: "storage.type.function.php", + }, + { + foreground: "2aa198", + token: "constant.numeric.c", + }, + { + foreground: "cb4b16", + token: "meta.preprocessor.c.include", + }, + { + foreground: "cb4b16", + token: "meta.preprocessor.macro.c", + }, + { + foreground: "cb4b16", + token: "keyword.control.import.define.c", + }, + { + foreground: "cb4b16", + token: "keyword.control.import.include.c", + }, + { + foreground: "cb4b16", + token: "entity.name.function.preprocessor.c", + }, + { + foreground: "2aa198", + token: "meta.preprocessor.c.include string.quoted.other.lt-gt.include.c", + }, + { + foreground: "2aa198", + token: + "meta.preprocessor.c.include punctuation.definition.string.begin.c", + }, + { + foreground: "2aa198", + token: "meta.preprocessor.c.include punctuation.definition.string.end.c", + }, + { + foreground: "586e75", + token: "support.function.C99.c", + }, + { + foreground: "586e75", + token: "support.function.any-method.c", + }, + { + foreground: "586e75", + token: "entity.name.function.c", + }, + { + foreground: "2aa198", + token: "punctuation.definition.string.begin.c", + }, + { + foreground: "2aa198", + token: "punctuation.definition.string.end.c", + }, + { + foreground: "b58900", + token: "storage.type.c", + }, + { + foreground: "e0eddd", + background: "b58900", + fontStyle: "italic", + token: "meta.diff", + }, + { + foreground: "e0eddd", + background: "b58900", + fontStyle: "italic", + token: "meta.diff.header", + }, + { + foreground: "dc322f", + background: "eee8d5", + token: "markup.deleted", + }, + { + foreground: "cb4b16", + background: "eee8d5", + token: "markup.changed", + }, + { + foreground: "219186", + background: "eee8d5", + token: "markup.inserted", + }, + { + foreground: "e0eddd", + background: "b58900", + token: "text.html.markdown meta.dummy.line-break", + }, + { + foreground: "2aa198", + token: "text.html.markdown markup.raw.inline", + }, + { + foreground: "2aa198", + token: "text.restructuredtext markup.raw", + }, + { + foreground: "dc322f", + token: "other.package.exclude", + }, + { + foreground: "dc322f", + token: "other.remove", + }, + { + foreground: "2aa198", + token: "other.add", + }, + { + foreground: "dc322f", + token: "punctuation.section.group.tex", + }, + { + foreground: "dc322f", + token: "punctuation.definition.arguments.begin.latex", + }, + { + foreground: "dc322f", + token: "punctuation.definition.arguments.end.latex", + }, + { + foreground: "dc322f", + token: "punctuation.definition.arguments.latex", + }, + { + foreground: "b58900", + token: "meta.group.braces.tex", + }, + { + foreground: "b58900", + token: "string.other.math.tex", + }, + { + foreground: "cb4b16", + token: "variable.parameter.function.latex", + }, + { + foreground: "dc322f", + token: "punctuation.definition.constant.math.tex", + }, + { + foreground: "2aa198", + token: "text.tex.latex constant.other.math.tex", + }, + { + foreground: "2aa198", + token: "constant.other.general.math.tex", + }, + { + foreground: "2aa198", + token: "constant.other.general.math.tex", + }, + { + foreground: "2aa198", + token: "constant.character.math.tex", + }, + { + foreground: "b58900", + token: "string.other.math.tex", + }, + { + foreground: "dc322f", + token: "punctuation.definition.string.begin.tex", + }, + { + foreground: "dc322f", + token: "punctuation.definition.string.end.tex", + }, + { + foreground: "2aa198", + token: "keyword.control.label.latex", + }, + { + foreground: "2aa198", + token: "text.tex.latex constant.other.general.math.tex", + }, + { + foreground: "dc322f", + token: "variable.parameter.definition.label.latex", + }, + { + foreground: "859900", + token: "support.function.be.latex", + }, + { + foreground: "cb4b16", + token: "support.function.section.latex", + }, + { + foreground: "2aa198", + token: "support.function.general.tex", + }, + { + fontStyle: "italic", + token: "punctuation.definition.comment.tex", + }, + { + fontStyle: "italic", + token: "comment.line.percentage.tex", + }, + { + foreground: "2aa198", + token: "keyword.control.ref.latex", + }, + { + foreground: "586e75", + token: "string.quoted.double.block.python", + }, + { + foreground: "859900", + token: "storage.type.class.python", + }, + { + foreground: "859900", + token: "storage.type.function.python", + }, + { + foreground: "859900", + token: "storage.modifier.global.python", + }, + { + foreground: "cb4b16", + token: "keyword.control.import.python", + }, + { + foreground: "cb4b16", + token: "keyword.control.import.from.python", + }, + { + foreground: "b58900", + token: "support.type.exception.python", + }, + { + foreground: "859900", + token: "support.function.builtin.shell", + }, + { + foreground: "cb4b16", + token: "variable.other.normal.shell", + }, + { + foreground: "268bd2", + token: "source.shell", + }, + { + foreground: "586e75", + token: "meta.scope.for-in-loop.shell", + }, + { + foreground: "586e75", + token: "variable.other.loop.shell", + }, + { + foreground: "859900", + token: "punctuation.definition.string.end.shell", + }, + { + foreground: "859900", + token: "punctuation.definition.string.begin.shell", + }, + { + foreground: "586e75", + token: "meta.scope.case-block.shell", + }, + { + foreground: "586e75", + token: "meta.scope.case-body.shell", + }, + { + foreground: "dc322f", + token: "punctuation.definition.logical-expression.shell", + }, + { + fontStyle: "italic", + token: "comment.line.number-sign.shell", + }, + { + foreground: "cb4b16", + token: "keyword.other.import.java", + }, + { + foreground: "586e75", + token: "storage.modifier.import.java", + }, + { + foreground: "b58900", + token: "meta.class.java storage.modifier.java", + }, + { + foreground: "586e75", + token: "source.java comment.block", + }, + { + foreground: "586e75", + token: + "comment.block meta.documentation.tag.param.javadoc keyword.other.documentation.param.javadoc", + }, + { + foreground: "b58900", + token: "punctuation.definition.variable.perl", + }, + { + foreground: "b58900", + token: "variable.other.readwrite.global.perl", + }, + { + foreground: "b58900", + token: "variable.other.predefined.perl", + }, + { + foreground: "b58900", + token: "keyword.operator.comparison.perl", + }, + { + foreground: "859900", + token: "support.function.perl", + }, + { + foreground: "586e75", + fontStyle: "italic", + token: "comment.line.number-sign.perl", + }, + { + foreground: "2aa198", + token: "punctuation.definition.string.begin.perl", + }, + { + foreground: "2aa198", + token: "punctuation.definition.string.end.perl", + }, + { + foreground: "dc322f", + token: "constant.character.escape.perl", + }, + { + foreground: "268bd2", + token: "markup.heading.markdown", + }, + { + foreground: "268bd2", + token: "markup.heading.1.markdown", + }, + { + foreground: "268bd2", + token: "markup.heading.2.markdown", + }, + { + foreground: "268bd2", + token: "markup.heading.3.markdown", + }, + { + foreground: "268bd2", + token: "markup.heading.4.markdown", + }, + { + foreground: "268bd2", + token: "markup.heading.5.markdown", + }, + { + foreground: "268bd2", + token: "markup.heading.6.markdown", + }, + { + foreground: "839496", + fontStyle: "bold", + token: "markup.bold.markdown", + }, + { + foreground: "839496", + fontStyle: "italic", + token: "markup.italic.markdown", + }, + { + foreground: "dc322f", + token: "punctuation.definition.bold.markdown", + }, + { + foreground: "dc322f", + token: "punctuation.definition.italic.markdown", + }, + { + foreground: "dc322f", + token: "punctuation.definition.raw.markdown", + }, + { + foreground: "b58900", + token: "markup.list.unnumbered.markdown", + }, + { + foreground: "859900", + token: "markup.list.numbered.markdown", + }, + { + foreground: "2aa198", + token: "markup.raw.block.markdown", + }, + { + foreground: "2aa198", + token: "markup.raw.inline.markdown", + }, + { + foreground: "6c71c4", + token: "markup.quote.markdown", + }, + { + foreground: "6c71c4", + token: "punctuation.definition.blockquote.markdown", + }, + { + foreground: "d33682", + token: "meta.separator.markdown", + }, + { + foreground: "586e75", + fontStyle: "italic", + token: "meta.image.inline.markdown", + }, + { + foreground: "586e75", + fontStyle: "italic", + token: "markup.underline.link.markdown", + }, + { + foreground: "93a1a1", + token: "string.other.link.title.markdown", + }, + { + foreground: "93a1a1", + token: "string.other.link.description.markdown", + }, + { + foreground: "586e75", + token: "punctuation.definition.link.markdown", + }, + { + foreground: "586e75", + token: "punctuation.definition.metadata.markdown", + }, + { + foreground: "586e75", + token: "punctuation.definition.string.begin.markdown", + }, + { + foreground: "586e75", + token: "punctuation.definition.string.end.markdown", + }, + { + foreground: "586e75", + token: "punctuation.definition.constant.markdown", + }, + { + foreground: "eee8d5", + background: "eee8d5", + token: "sublimelinter.notes", + }, + { + foreground: "93a1a1", + background: "93a1a1", + token: "sublimelinter.outline.illegal", + }, + { + background: "dc322f", + token: "sublimelinter.underline.illegal", + }, + { + foreground: "839496", + background: "839496", + token: "sublimelinter.outline.warning", + }, + { + background: "b58900", + token: "sublimelinter.underline.warning", + }, + { + foreground: "657b83", + background: "657b83", + token: "sublimelinter.outline.violation", + }, + { + background: "cb4b16", + token: "sublimelinter.underline.violation", + }, + ], + colors: { + "editor.foreground": "#839496", + "editor.background": "#002B36", + "editor.selectionBackground": "#073642", + "editor.lineHighlightBackground": "#073642", + "editorCursor.foreground": "#819090", + "editorWhitespace.foreground": "#073642", + }, +}; diff --git a/src/routes/route-workspace.tsx b/src/routes/route-workspace.tsx new file mode 100644 index 00000000..ebf28da3 --- /dev/null +++ b/src/routes/route-workspace.tsx @@ -0,0 +1,11 @@ +import { SystemPromptEditor } from "@/features/workspace-system-prompt/components/system-prompt-editor"; +import { Heading } from "@stacklok/ui-kit"; + +export function RouteWorkspace() { + return ( + <> + Workspace: foo + + + ); +} From b82be1f2cf4e1d2a1d4d1c0307b1393592f33718 Mon Sep 17 00:00:00 2001 From: alex-mcgovern Date: Mon, 20 Jan 2025 08:57:46 +0000 Subject: [PATCH 2/5] feat: further work on editing system prompt, and workspace route --- .../components/system-prompt-editor.tsx | 99 +++++++++++++++---- .../hooks/use-post-system-prompt.tsx | 10 ++ .../lib/post-system-prompt.tsx | 10 ++ .../workspace/components/workspace-name.tsx | 14 +++ src/routes/route-workspace.tsx | 6 +- 5 files changed, 116 insertions(+), 23 deletions(-) create mode 100644 src/features/workspace-system-prompt/hooks/use-post-system-prompt.tsx create mode 100644 src/features/workspace-system-prompt/lib/post-system-prompt.tsx create mode 100644 src/features/workspace/components/workspace-name.tsx diff --git a/src/features/workspace-system-prompt/components/system-prompt-editor.tsx b/src/features/workspace-system-prompt/components/system-prompt-editor.tsx index fed3f635..3ee574f0 100644 --- a/src/features/workspace-system-prompt/components/system-prompt-editor.tsx +++ b/src/features/workspace-system-prompt/components/system-prompt-editor.tsx @@ -1,14 +1,29 @@ import Editor, { type Theme } from "@monaco-editor/react"; -import { Button, DarkModeContext, Heading } from "@stacklok/ui-kit"; -import { Dispatch, SetStateAction, useContext, useState } from "react"; +import { + Button, + Card, + CardBody, + CardFooter, + DarkModeContext, + LinkButton, + Text, +} from "@stacklok/ui-kit"; +import { + Dispatch, + SetStateAction, + useContext, + useEffect, + useState, +} from "react"; +import { usePostSystemPrompt } from "../hooks/use-post-system-prompt"; +import { Check } from "lucide-react"; type DarkModeContextValue = { preference: "dark" | "light" | null; override: "dark" | "light" | null; }; -const DEFAULT_VALUE = - ""; +const DEFAULT_VALUE = `You are a security expert conducting a thorough code review.\nIdentify potential security vulnerabilities, suggest improvements, and explain security best practices.`; function inferDarkMode( contextValue: @@ -16,38 +31,80 @@ function inferDarkMode( | [DarkModeContextValue, Dispatch>], ): Theme { if (contextValue === null) return "light"; + + // Handle override if (contextValue[0].override === "dark") return "vs-dark"; + if (contextValue[0].override === "light") return "light"; + + // Handle preference if (contextValue[0].preference === "dark") return "vs-dark"; return "light"; } -export function SystemPromptEditor() { +function useSavedStatus() { + const [saved, setSaved] = useState(false); + + useEffect(() => { + const id = setTimeout(() => setSaved(false), 2000); + return () => clearTimeout(id); + }, [saved]); + + return { saved, setSaved }; +} + +export function SystemPromptEditor({ className }: { className?: string }) { const context = useContext(DarkModeContext); const theme: Theme = inferDarkMode(context); const [value, setValue] = useState(() => DEFAULT_VALUE); + const { mutate, isPending } = usePostSystemPrompt(); + + const { saved, setSaved } = useSavedStatus(); + return ( - <> -
- System prompt + + + Custom prompt + + Pass custom instructions to your LLM to augment it's behavior, and + save time & tokens. + +
+ setValue(v ?? "")} + height="20rem" + defaultLanguage="Markdown" + theme={theme} + className="bg-base" + defaultValue="" + /> +
+
+ + Cancel -
- setValue(v ?? "")} - height="50dvh" - defaultLanguage="Markdown" - theme={theme} - className="bg-base" - defaultValue="" - /> - + + ); } diff --git a/src/features/workspace-system-prompt/hooks/use-post-system-prompt.tsx b/src/features/workspace-system-prompt/hooks/use-post-system-prompt.tsx new file mode 100644 index 00000000..d7cc08a6 --- /dev/null +++ b/src/features/workspace-system-prompt/hooks/use-post-system-prompt.tsx @@ -0,0 +1,10 @@ +import { useMutation } from "@tanstack/react-query"; +import { postSystemPrompt } from "../lib/post-system-prompt"; + +export function usePostSystemPrompt() { + // TODO: Get queryclient, invalidate "get system prompt" query + + return useMutation({ + mutationFn: postSystemPrompt, + }); +} diff --git a/src/features/workspace-system-prompt/lib/post-system-prompt.tsx b/src/features/workspace-system-prompt/lib/post-system-prompt.tsx new file mode 100644 index 00000000..e58282b6 --- /dev/null +++ b/src/features/workspace-system-prompt/lib/post-system-prompt.tsx @@ -0,0 +1,10 @@ +// Temporary fixture until API is implemented +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export async function postSystemPrompt(prompt: string) { + return new Promise((resolve) => { + setTimeout(() => { + alert("Prompt saved"); + resolve(); + }, 1000); // 1 second timeout + }); +} diff --git a/src/features/workspace/components/workspace-name.tsx b/src/features/workspace/components/workspace-name.tsx new file mode 100644 index 00000000..d5b09e6e --- /dev/null +++ b/src/features/workspace/components/workspace-name.tsx @@ -0,0 +1,14 @@ +import { Card, CardBody, Input, Label, TextField } from "@stacklok/ui-kit"; + +export function WorkspaceName({ className }: { className?: string }) { + return ( + + + + + + + + + ); +} diff --git a/src/routes/route-workspace.tsx b/src/routes/route-workspace.tsx index ebf28da3..efb89eb5 100644 --- a/src/routes/route-workspace.tsx +++ b/src/routes/route-workspace.tsx @@ -1,11 +1,13 @@ import { SystemPromptEditor } from "@/features/workspace-system-prompt/components/system-prompt-editor"; +import { WorkspaceName } from "@/features/workspace/components/workspace-name"; import { Heading } from "@stacklok/ui-kit"; export function RouteWorkspace() { return ( <> - Workspace: foo - + Workspace settings + + ); } From ca70bf43ac6f379a6d39ac557e6be31a09b633b7 Mon Sep 17 00:00:00 2001 From: alex-mcgovern Date: Mon, 20 Jan 2025 09:13:07 +0000 Subject: [PATCH 3/5] fix: add `legacy-peer-deps` to `.npmrc` --- .gitignore | 3 --- .npmrc | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) create mode 100644 .npmrc diff --git a/.gitignore b/.gitignore index 30c357ef..80672b93 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,6 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* -# NPM -.npmrc - node_modules dist dist-ssr diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..521a9f7c --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +legacy-peer-deps=true From e7425757868388bed5045621d5a8f4ac97e13bf8 Mon Sep 17 00:00:00 2001 From: alex-mcgovern Date: Mon, 20 Jan 2025 09:17:41 +0000 Subject: [PATCH 4/5] chore: declare dev deps --- package-lock.json | 98 +++++++++++++++++++++++++++++++++++++++++++++-- package.json | 3 +- 2 files changed, 96 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 09a0f072..34836277 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,8 +39,9 @@ "@faker-js/faker": "^9.4.0", "@hey-api/openapi-ts": "^0.61.2", "@tailwindcss/typography": "^0.5.16", + "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "^6.6.3", - "@testing-library/react": "^16.1.0", + "@testing-library/react": "^16.2.0", "@testing-library/user-event": "^14.6.0", "@types/node": "^22.10.1", "@types/react": "^19.0.2", @@ -4200,6 +4201,26 @@ "react": "^18 || ^19" } }, + "node_modules/@testing-library/dom": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", + "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "chalk": "^4.1.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@testing-library/jest-dom": { "version": "6.6.3", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz", @@ -4243,9 +4264,9 @@ "license": "MIT" }, "node_modules/@testing-library/react": { - "version": "16.1.0", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.1.0.tgz", - "integrity": "sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.2.0.tgz", + "integrity": "sha512-2cSskAvA1QNtKc8Y9VJQRv0tm3hLVgxRGDB+KYhIaPQJ1I+RHbhIXcM+zClKXzMes/wshsMVzf4B9vS4IZpqDQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4283,6 +4304,13 @@ "@testing-library/dom": ">=7.21.4" } }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/cookie": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", @@ -5974,6 +6002,13 @@ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", "license": "MIT" }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT" + }, "node_modules/dom-helpers": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", @@ -7818,6 +7853,16 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "bin": { + "lz-string": "bin/bin.js" + } + }, "node_modules/magic-string": { "version": "0.30.17", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", @@ -9584,6 +9629,51 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-format/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT" + }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", diff --git a/package.json b/package.json index 15a55820..10b241a4 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,9 @@ "@faker-js/faker": "^9.4.0", "@hey-api/openapi-ts": "^0.61.2", "@tailwindcss/typography": "^0.5.16", + "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "^6.6.3", - "@testing-library/react": "^16.1.0", + "@testing-library/react": "^16.2.0", "@testing-library/user-event": "^14.6.0", "@types/node": "^22.10.1", "@types/react": "^19.0.2", From 120ffc6601f8a2a8034308da1d868c8393c4f893 Mon Sep 17 00:00:00 2001 From: alex-mcgovern Date: Mon, 20 Jan 2025 09:22:28 +0000 Subject: [PATCH 5/5] fix: add @ts-expect-error to mocked function --- src/features/workspace-system-prompt/lib/post-system-prompt.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/features/workspace-system-prompt/lib/post-system-prompt.tsx b/src/features/workspace-system-prompt/lib/post-system-prompt.tsx index e58282b6..96df418d 100644 --- a/src/features/workspace-system-prompt/lib/post-system-prompt.tsx +++ b/src/features/workspace-system-prompt/lib/post-system-prompt.tsx @@ -1,4 +1,5 @@ // Temporary fixture until API is implemented +// @ts-expect-error - mocked until implemented in backend // eslint-disable-next-line @typescript-eslint/no-unused-vars export async function postSystemPrompt(prompt: string) { return new Promise((resolve) => {