monacopilot 0.8.6 → 0.8.8

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Arshad Yaseen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # Monacopilot
2
+
3
+ Extended Monaco Editor with AI auto-completion and new themes for React.
4
+
5
+ ## Documentation
6
+
7
+ [https://monacopilot.vercel.app/docs](https://monacopilot.vercel.app/docs)
8
+
9
+ ## Contributing
10
+
11
+ #### Installation
12
+
13
+ The Monacopilot repository uses [PNPM Workspaces](https://pnpm.io/workspaces) and [Tsup](https://tsup.egoist.dev/). To install dependencies, run `pnpm install` in the project root directory.
14
+
15
+ #### Building the Package
16
+
17
+ To build the package, execute the following command:
18
+
19
+ ```bash
20
+ pnpm build
21
+ ```
22
+
23
+ Alternatively, `pnpm dev` to start the watch mode for automatic rebuilds on file changes.
24
+
25
+ #### Testing Monacopilot Locally
26
+
27
+ To test Monacopilot locally, first, you need to set the Groq API key as an environment variable in the `test` directory root within the `.env.local` file.
28
+
29
+ ```plaintext
30
+ GROQ_API_KEY=your_api_key
31
+ ```
32
+
33
+ Then, run:
34
+
35
+ ```bash
36
+ pnpm dev:test
37
+ ```
38
+
39
+ #### Adding or Editing Themes
40
+
41
+ To add a theme, you can add the `.tmTheme` file of the theme you want to include to the `themes` directory at the root. If you wish to edit any theme, simply edit the `.tmTheme` file of the theme you want to modify. Then, run the following command after updating or adding.
42
+
43
+ ```bash
44
+ pnpm generate-themes
45
+ ```
46
+
47
+ This command will read the theme you added/edited and automatically generate Monaco Editor-compatible theme data as if by magic. Additionally, it will automatically add the theme name to the theme type if you've added a new theme.
48
+
49
+ #### Contributing to the Documentation
50
+
51
+ If you wish to contribute to the documentation, use the following command:
52
+
53
+ ```bash
54
+ pnpm dev:docs
55
+ ```
56
+
57
+ Edit the `.mdx` files in the docs directory, and the documentation will refresh instantly, reflecting your changes.
58
+
59
+ ---
60
+
61
+ We welcome contributions from the community to enhance Monacopilot's capabilities and make it even more powerful ❤️
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import React from 'react';
5
5
 
6
6
  type EditorBuiltInTheme = Theme;
7
7
 
8
- declare const _default: readonly ["React", "Angular", "Vue.js", "Express", "Django", "Flask", "Spring Boot", "ASP.NET Core", "Ruby on Rails", "Laravel", "Symfony", "Node.js", "Bootstrap", "Tailwind CSS", "Svelte", "Meteor", "Kotlin", "SwiftUI", "Xamarin", "React Native", "Flutter", "TensorFlow", "PyTorch", "Keras", "Scikit-learn", "FastAPI", "GraphQL", "Redux", "Electron", "QT", "Unity", "Unreal Engine", "Apache Hadoop", "Apache Spark", "Apache Kafka", "Next.js", "Nuxt.js", "Gatsby", "Hugo", "Jekyll", "Strapi", "Drupal", "Magento", "Shopify", "WooCommerce", "Cordova", "Ionic", "Pandas", "NumPy", "VueX", "Three.js", "Anime.js", "Babylon.js", "Backbone.js", "Ember.js", "Mocha", "Jest", "Enzyme", "Chai", "Sinon", "Cypress", "Selenium", "Playwright", "Puppeteer", "GreenSock (GSAP)", "Framer Motion", "Vuetify", "Ant Design", "Material-UI", "Foundation", "Alpine.js", "Akka", "Vert.x", "Quarkus", "Helidon", "Micronaut", "Grails", "Phoenix", "Blazor", "Tornado", "Bottle", "Falcon", "Masonite", "Zurb Foundation", "Bulma", "Milligram", "Stimulus", "Mithril", "Aurelia", "D3.js", "Chart.js", "Highcharts", "Plotly.js", "Leaflet", "OpenLayers", "Thymeleaf", "Mustache.js", "Handlebars", "Freemarker", "Liquid"];
8
+ declare const _default: readonly ["react", "angular", "vue.js", "express", "django", "flask", "spring boot", "asp.net core", "ruby on rails", "laravel", "symfony", "node.js", "bootstrap", "tailwind css", "svelte", "meteor", "kotlin", "swiftui", "xamarin", "react native", "flutter", "tensorflow", "pytorch", "keras", "scikit-learn", "fastapi", "graphql", "redux", "electron", "qt", "unity", "unreal engine", "apache hadoop", "apache spark", "apache kafka", "next.js", "nuxt.js", "gatsby", "hugo", "jekyll", "strapi", "drupal", "magento", "shopify", "woocommerce", "cordova", "ionic", "pandas", "numpy", "vuex", "three.js", "anime.js", "babylon.js", "backbone.js", "ember.js", "mocha", "jest", "enzyme", "chai", "sinon", "cypress", "selenium", "playwright", "puppeteer", "greensock (gsap)", "framer motion", "vuetify", "ant design", "material-ui", "foundation", "alpine.js", "akka", "vert.x", "quarkus", "helidon", "micronaut", "grails", "phoenix", "blazor", "tornado", "bottle", "falcon", "masonite", "zurb foundation", "bulma", "milligram", "stimulus", "mithril", "aurelia", "d3.js", "chart.js", "highcharts", "plotly.js", "leaflet", "openlayers", "thymeleaf", "mustache.js", "handlebars", "freemarker", "liquid"];
9
9
 
10
10
  type endpointType = string;
11
11
  type FrameworkType = (typeof _default)[number];
@@ -68,7 +68,7 @@ interface CompletionMetadata {
68
68
  * such as the model ID. Defaults to `llama3-70b-8192` if not specified.
69
69
  *
70
70
  * @example
71
- * ```ts
71
+ * ```typescript
72
72
  * const copilot = new Copilot(process.env.GROQ_API_KEY, {
73
73
  * model: 'llama3-70b-8192',
74
74
  * });
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import React from 'react';
5
5
 
6
6
  type EditorBuiltInTheme = Theme;
7
7
 
8
- declare const _default: readonly ["React", "Angular", "Vue.js", "Express", "Django", "Flask", "Spring Boot", "ASP.NET Core", "Ruby on Rails", "Laravel", "Symfony", "Node.js", "Bootstrap", "Tailwind CSS", "Svelte", "Meteor", "Kotlin", "SwiftUI", "Xamarin", "React Native", "Flutter", "TensorFlow", "PyTorch", "Keras", "Scikit-learn", "FastAPI", "GraphQL", "Redux", "Electron", "QT", "Unity", "Unreal Engine", "Apache Hadoop", "Apache Spark", "Apache Kafka", "Next.js", "Nuxt.js", "Gatsby", "Hugo", "Jekyll", "Strapi", "Drupal", "Magento", "Shopify", "WooCommerce", "Cordova", "Ionic", "Pandas", "NumPy", "VueX", "Three.js", "Anime.js", "Babylon.js", "Backbone.js", "Ember.js", "Mocha", "Jest", "Enzyme", "Chai", "Sinon", "Cypress", "Selenium", "Playwright", "Puppeteer", "GreenSock (GSAP)", "Framer Motion", "Vuetify", "Ant Design", "Material-UI", "Foundation", "Alpine.js", "Akka", "Vert.x", "Quarkus", "Helidon", "Micronaut", "Grails", "Phoenix", "Blazor", "Tornado", "Bottle", "Falcon", "Masonite", "Zurb Foundation", "Bulma", "Milligram", "Stimulus", "Mithril", "Aurelia", "D3.js", "Chart.js", "Highcharts", "Plotly.js", "Leaflet", "OpenLayers", "Thymeleaf", "Mustache.js", "Handlebars", "Freemarker", "Liquid"];
8
+ declare const _default: readonly ["react", "angular", "vue.js", "express", "django", "flask", "spring boot", "asp.net core", "ruby on rails", "laravel", "symfony", "node.js", "bootstrap", "tailwind css", "svelte", "meteor", "kotlin", "swiftui", "xamarin", "react native", "flutter", "tensorflow", "pytorch", "keras", "scikit-learn", "fastapi", "graphql", "redux", "electron", "qt", "unity", "unreal engine", "apache hadoop", "apache spark", "apache kafka", "next.js", "nuxt.js", "gatsby", "hugo", "jekyll", "strapi", "drupal", "magento", "shopify", "woocommerce", "cordova", "ionic", "pandas", "numpy", "vuex", "three.js", "anime.js", "babylon.js", "backbone.js", "ember.js", "mocha", "jest", "enzyme", "chai", "sinon", "cypress", "selenium", "playwright", "puppeteer", "greensock (gsap)", "framer motion", "vuetify", "ant design", "material-ui", "foundation", "alpine.js", "akka", "vert.x", "quarkus", "helidon", "micronaut", "grails", "phoenix", "blazor", "tornado", "bottle", "falcon", "masonite", "zurb foundation", "bulma", "milligram", "stimulus", "mithril", "aurelia", "d3.js", "chart.js", "highcharts", "plotly.js", "leaflet", "openlayers", "thymeleaf", "mustache.js", "handlebars", "freemarker", "liquid"];
9
9
 
10
10
  type endpointType = string;
11
11
  type FrameworkType = (typeof _default)[number];
@@ -68,7 +68,7 @@ interface CompletionMetadata {
68
68
  * such as the model ID. Defaults to `llama3-70b-8192` if not specified.
69
69
  *
70
70
  * @example
71
- * ```ts
71
+ * ```typescript
72
72
  * const copilot = new Copilot(process.env.GROQ_API_KEY, {
73
73
  * model: 'llama3-70b-8192',
74
74
  * });
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ie=Object.create;var v=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var me=(e,o)=>{for(var t in o)v(e,t,{get:o[t],enumerable:!0})},h=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of ke(o))!le.call(e,r)&&r!==t&&v(e,r,{get:()=>o[r],enumerable:!(n=ge(o,r))||n.enumerable});return e},y=(e,o,t)=>(h(e,o,"default"),t&&h(t,o,"default")),q=(e,o,t)=>(t=e!=null?ie(se(e)):{},h(o||!e||!e.__esModule?v(t,"default",{value:e,enumerable:!0}):t,e)),pe=e=>h(v({},"__esModule",{value:!0}),e);var m={};me(m,{Copilot:()=>R,Editor:()=>ce});module.exports=pe(m);var S="{cursor_position}",W=`Based on the code surrounding the current cursor position at ${S}, generate a code snippet that fits contextually. Output only the code snippet, without any surrounding context, to ensure it is easy to copy, paste, or insert at the cursor position ${S}.`,x="llama3-70b-8192",O="https://api.groq.com/openai/v1/chat/completions";async function be(e,o,t={}){let n={"Content-Type":"application/json",...t.headers},r=o==="POST"&&t.body?JSON.stringify(t.body):void 0,a=await fetch(e,{method:o,headers:n,body:r,signal:t.signal});if(!a.ok)throw new Error(`${t.error||"Network error"}: ${a.statusText}`);return a.json()}function w(e,o,t){return be(e,"POST",{...t,body:o})}var F=class{static getModel(){return this.model}static setModel(o){this.model=o}};F.model=x;var D=F;var A=class{constructor(o,t){if(!o)throw new Error("API key is missing in Completion constructor.");this.apiKey=o,D.setModel(t?.model||x)}async complete(o){try{let t=D.getModel(),n=O,r={model:t,max_tokens:200,temperature:.5,messages:[{role:"system",content:W.replaceAll(S,`line ${o.completionMetadata.cursorPosition.line}, column ${o.completionMetadata.cursorPosition.column}`)},{role:"user",content:JSON.stringify(o)}]},a={Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"};return await w(n,r,{headers:a,error:"Error while fetching from groq API"})}catch(t){return{error:`An unexpected error occurred: ${t}`}}}},R=A;var E=q(require("react")),ue=require("@monaco-editor/react");var G={scrollBeyondLastColumn:0,codeLens:!1,minimap:{enabled:!1},quickSuggestions:!1,folding:!1,foldingHighlight:!1,foldingImportsByDefault:!1,links:!1,fontSize:14,wordWrap:"on",automaticLayout:!0},N=["light","vs-dark"];var B=q(require("react"));var $={conso:"le.log($1)","new P":`romise((resolve, reject) => {
1
+ "use strict";var ie=Object.create;var v=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var me=(e,o)=>{for(var t in o)v(e,t,{get:o[t],enumerable:!0})},h=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of ke(o))!le.call(e,r)&&r!==t&&v(e,r,{get:()=>o[r],enumerable:!(n=ge(o,r))||n.enumerable});return e},y=(e,o,t)=>(h(e,o,"default"),t&&h(t,o,"default")),q=(e,o,t)=>(t=e!=null?ie(se(e)):{},h(o||!e||!e.__esModule?v(t,"default",{value:e,enumerable:!0}):t,e)),pe=e=>h(v({},"__esModule",{value:!0}),e);var m={};me(m,{Copilot:()=>R,Editor:()=>ce});module.exports=pe(m);var S="{cursor_position}",W=`Based on the code surrounding the current cursor position at ${S}, generate a code snippet that fits contextually. Output only the code snippet, without any surrounding context, to ensure it is easy to copy, paste, or insert at the cursor position ${S}.`,x="llama3-70b-8192",O="https://api.groq.com/openai/v1/chat/completions";async function be(e,o,t={}){let n={"Content-Type":"application/json",...t.headers},r=o==="POST"&&t.body?JSON.stringify(t.body):void 0,a=await fetch(e,{method:o,headers:n,body:r,signal:t.signal});if(!a.ok)throw new Error(`${t.error||"Network error"}: ${a.statusText}`);return a.json()}function w(e,o,t){return be(e,"POST",{...t,body:o})}var F=class{static getModel(){return this.model}static setModel(o){this.model=o}};F.model=x;var D=F;var A=class{constructor(o,t){if(!o)throw new Error("API key is missing.");this.apiKey=o,D.setModel(t?.model||x)}async complete(o){try{let t=D.getModel(),n=O,r={model:t,max_tokens:200,temperature:.5,messages:[{role:"system",content:W.replaceAll(S,`line ${o.completionMetadata.cursorPosition.line}, column ${o.completionMetadata.cursorPosition.column}`)},{role:"user",content:JSON.stringify(o.completionMetadata)}]},a={Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"};return await w(n,r,{headers:a,error:"Error while fetching from groq API"})}catch(t){return{error:`An unexpected error occurred: ${t}`}}}},R=A;var E=q(require("react")),ue=require("@monaco-editor/react");var G={scrollBeyondLastColumn:0,codeLens:!1,minimap:{enabled:!1},quickSuggestions:!1,folding:!1,foldingHighlight:!1,foldingImportsByDefault:!1,links:!1,fontSize:14,wordWrap:"on",automaticLayout:!0},N=["light","vs-dark"];var B=q(require("react"));var $={conso:"le.log($1)","new P":`romise((resolve, reject) => {
2
2
  $1
3
3
  })`,"new A":"rray","new S":"et","throw n":"ew Error($1)",setTimeout:`(() => {
4
4
  $1
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var b="{cursor_position}",M=`Based on the code surrounding the current cursor position at ${b}, generate a code snippet that fits contextually. Output only the code snippet, without any surrounding context, to ensure it is easy to copy, paste, or insert at the cursor position ${b}.`,y="llama3-70b-8192",_="https://api.groq.com/openai/v1/chat/completions";async function te(e,o,t={}){let n={"Content-Type":"application/json",...t.headers},r=o==="POST"&&t.body?JSON.stringify(t.body):void 0,a=await fetch(e,{method:o,headers:n,body:r,signal:t.signal});if(!a.ok)throw new Error(`${t.error||"Network error"}: ${a.statusText}`);return a.json()}function h(e,o,t){return te(e,"POST",{...t,body:o})}var v=class{static getModel(){return this.model}static setModel(o){this.model=o}};v.model=y;var w=v;var F=class{constructor(o,t){if(!o)throw new Error("API key is missing in Completion constructor.");this.apiKey=o,w.setModel(t?.model||y)}async complete(o){try{let t=w.getModel(),n=_,r={model:t,max_tokens:200,temperature:.5,messages:[{role:"system",content:M.replaceAll(b,`line ${o.completionMetadata.cursorPosition.line}, column ${o.completionMetadata.cursorPosition.column}`)},{role:"user",content:JSON.stringify(o)}]},a={Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"};return await h(n,r,{headers:a,error:"Error while fetching from groq API"})}catch(t){return{error:`An unexpected error occurred: ${t}`}}}},ne=F;import D from"react";import{Editor as ce}from"@monaco-editor/react";var I={scrollBeyondLastColumn:0,codeLens:!1,minimap:{enabled:!1},quickSuggestions:!1,folding:!1,foldingHighlight:!1,foldingImportsByDefault:!1,links:!1,fontSize:14,wordWrap:"on",automaticLayout:!0},H=["light","vs-dark"];import T from"react";var L={conso:"le.log($1)","new P":`romise((resolve, reject) => {
1
+ var b="{cursor_position}",M=`Based on the code surrounding the current cursor position at ${b}, generate a code snippet that fits contextually. Output only the code snippet, without any surrounding context, to ensure it is easy to copy, paste, or insert at the cursor position ${b}.`,y="llama3-70b-8192",_="https://api.groq.com/openai/v1/chat/completions";async function te(e,o,t={}){let n={"Content-Type":"application/json",...t.headers},r=o==="POST"&&t.body?JSON.stringify(t.body):void 0,a=await fetch(e,{method:o,headers:n,body:r,signal:t.signal});if(!a.ok)throw new Error(`${t.error||"Network error"}: ${a.statusText}`);return a.json()}function h(e,o,t){return te(e,"POST",{...t,body:o})}var v=class{static getModel(){return this.model}static setModel(o){this.model=o}};v.model=y;var w=v;var F=class{constructor(o,t){if(!o)throw new Error("API key is missing.");this.apiKey=o,w.setModel(t?.model||y)}async complete(o){try{let t=w.getModel(),n=_,r={model:t,max_tokens:200,temperature:.5,messages:[{role:"system",content:M.replaceAll(b,`line ${o.completionMetadata.cursorPosition.line}, column ${o.completionMetadata.cursorPosition.column}`)},{role:"user",content:JSON.stringify(o.completionMetadata)}]},a={Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"};return await h(n,r,{headers:a,error:"Error while fetching from groq API"})}catch(t){return{error:`An unexpected error occurred: ${t}`}}}},ne=F;import D from"react";import{Editor as ce}from"@monaco-editor/react";var I={scrollBeyondLastColumn:0,codeLens:!1,minimap:{enabled:!1},quickSuggestions:!1,folding:!1,foldingHighlight:!1,foldingImportsByDefault:!1,links:!1,fontSize:14,wordWrap:"on",automaticLayout:!0},H=["light","vs-dark"];import T from"react";var L={conso:"le.log($1)","new P":`romise((resolve, reject) => {
2
2
  $1
3
3
  })`,"new A":"rray","new S":"et","throw n":"ew Error($1)",setTimeout:`(() => {
4
4
  $1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monacopilot",
3
- "version": "0.8.6",
3
+ "version": "0.8.8",
4
4
  "description": "Extended Monaco Editor with AI auto-completion and new themes for React.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",