Skip to content

Commit

Permalink
Add autoInclude param for mentions (#199)
Browse files Browse the repository at this point in the history
- Removed unused mentionSelectors params.
- Added `meta.mentions.autoInclude` to auto-include mentions as initial
context.
- Added `uri?` and `codebase?` params for `mentions`.
  • Loading branch information
thenamankumar authored Sep 2, 2024
1 parent 720d5e8 commit 50490a4
Show file tree
Hide file tree
Showing 38 changed files with 175 additions and 107 deletions.
2 changes: 1 addition & 1 deletion bin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/cli",
"version": "0.0.12",
"version": "0.0.13",
"description": "OpenCtx CLI",
"license": "Apache-2.0",
"homepage": "https://openctx.org/docs/clients/cli",
Expand Down
2 changes: 1 addition & 1 deletion client/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@openctx/browser-extension",
"version": "0.0.13",
"version": "0.0.14",
"license": "Apache-2.0",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion client/codemirror/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"@openctx/codemirror-extension": "workspace:*",
"@openctx/provider-hello-world": "workspace:*"
},
"version": "0.0.6"
"version": "0.0.7"
}
8 changes: 6 additions & 2 deletions client/codemirror/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/codemirror-extension",
"version": "0.0.12",
"version": "0.0.13",
"description": "OpenCtx extension for CodeMirror",
"license": "Apache-2.0",
"homepage": "https://openctx.org/docs/clients/codemirror",
Expand All @@ -12,7 +12,11 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["README.md", "dist", "!**/*.test.*"],
"files": [
"README.md",
"dist",
"!**/*.test.*"
],
"sideEffects": false,
"scripts": {
"build": "tsc --build",
Expand Down
2 changes: 1 addition & 1 deletion client/monaco-editor/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"devDependencies": {
"vite-plugin-monaco-editor": "^1.1.0"
},
"version": "0.0.6"
"version": "0.0.7"
}
8 changes: 6 additions & 2 deletions client/monaco-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/monaco-editor-extension",
"version": "0.0.11",
"version": "0.0.12",
"description": "OpenCtx extension for Monaco Editor",
"license": "Apache-2.0",
"homepage": "https://openctx.org/docs/clients/monaco-editor",
Expand All @@ -12,7 +12,11 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["README.md", "dist", "!**/*.test.*"],
"files": [
"README.md",
"dist",
"!**/*.test.*"
],
"sideEffects": false,
"scripts": {
"build": "tsc --build",
Expand Down
2 changes: 1 addition & 1 deletion client/vscode-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/vscode-lib",
"version": "0.0.21",
"version": "0.0.22",
"description": "OpenCtx library for VS Code extensions",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion client/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "openctx",
"private": true,
"displayName": "OpenCtx",
"version": "0.4.4",
"version": "0.4.5",
"publisher": "sourcegraph",
"license": "Apache-2.0",
"icon": "resources/logomark-v0.png",
Expand Down
2 changes: 1 addition & 1 deletion client/web-playground/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@openctx/web-playground",
"version": "0.0.11",
"version": "0.0.12",
"description": "OpenCtx web playground",
"license": "Apache-2.0",
"homepage": "https://openctx.org",
Expand Down
2 changes: 1 addition & 1 deletion lib/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/client",
"version": "0.0.25",
"version": "0.0.26",
"description": "OpenCtx client library",
"license": "Apache-2.0",
"repository": {
Expand Down
7 changes: 5 additions & 2 deletions lib/protocol/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/protocol",
"version": "0.0.16",
"version": "0.0.17",
"description": "OpenCtx client/provider protocol",
"license": "Apache-2.0",
"repository": {
Expand All @@ -11,7 +11,10 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist", "src"],
"files": [
"dist",
"src"
],
"sideEffects": false,
"scripts": {
"generate": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only ../schema/dev/generateJsonSchemaTypes.ts src/openctx-protocol.schema.json \"import type { Annotation, Item } from '@openctx/schema'\" > src/openctx-protocol.schema.ts && pnpm -w exec biome check --apply-unsafe \"$PNPM_SCRIPT_SRC_DIR/src/openctx-protocol.schema.ts\"",
Expand Down
33 changes: 11 additions & 22 deletions lib/protocol/src/openctx-protocol.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
{
"$ref": "#/definitions/MessageSelector"
},
{
"$ref": "#/definitions/MentionSelector"
},
{
"$ref": "#/definitions/AnnotationSelector"
},
Expand Down Expand Up @@ -126,18 +123,6 @@
"properties": {},
"tsType": "Record<string, never>"
},
"MentionSelector": {
"description": "List of regex patterns matching the mention text for which the provider can return mentions.",
"type": "object",
"additionalProperties": false,
"required": ["pattern"],
"properties": {
"pattern": {
"description": "The regex pattern matching the mention text for which the provider can return mentions",
"type": "string"
}
}
},
"AnnotationSelector": {
"description": "Defines a scope in which a provider is called.\n\nTo satisfy a selector, all of the selector's conditions must be met. For example, if both `path` and `content` are specified, the resource must satisfy both conditions.",
"type": "object",
Expand Down Expand Up @@ -186,13 +171,9 @@
"description": "The label that is shown when a user wants to query mentions. For example `Search...` or `Paste Linear URL`.",
"type": "string"
},
"selectors": {
"description": "The list of regex patterns for triggering mentions for the provider when users directly types a matching text, for example a url, allowing the user to bypass choosing the provider manually.",
"type": "array",
"items": {
"$ref": "#/definitions/MentionSelector"
},
"tsType": "MentionSelector[]"
"autoInclude": {
"description": "Whether to automatically include the returned mention items as initial context for new messages.",
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -270,6 +251,14 @@
"query": {
"description": "A search query that is interpreted by providers to filter the items in the result set.",
"type": "string"
},
"uri": {
"description": "URI of the active document.",
"type": "string"
},
"codebase": {
"description": "Name of the active codebase infered from .git.",
"type": "string"
}
}
},
Expand Down
22 changes: 10 additions & 12 deletions lib/protocol/src/openctx-protocol.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export type Protocol =
| MetaResult
| Mention
| MessageSelector
| MentionSelector
| AnnotationSelector
| MentionsParams
| MentionsResult
Expand Down Expand Up @@ -67,9 +66,9 @@ export interface MetaResult {
*/
label?: string
/**
* The list of regex patterns for triggering mentions for the provider when users directly types a matching text, for example a url, allowing the user to bypass choosing the provider manually.
* Whether to automatically include the returned mention items as initial context for new messages.
*/
selectors?: MentionSelector[]
autoInclude?: boolean
}
/**
* Configuration for the annotations feature.
Expand Down Expand Up @@ -110,15 +109,6 @@ export interface MessageSelector {
*/
pattern: string
}
/**
* List of regex patterns matching the mention text for which the provider can return mentions.
*/
export interface MentionSelector {
/**
* The regex pattern matching the mention text for which the provider can return mentions
*/
pattern: string
}
/**
* Defines a scope in which a provider is called.
*
Expand All @@ -141,6 +131,14 @@ export interface MentionsParams {
* A search query that is interpreted by providers to filter the items in the result set.
*/
query?: string
/**
* URI of the active document.
*/
uri?: string
/**
* Name of the active codebase infered from .git.
*/
codebase?: string
}
export interface ItemsParams {
/**
Expand Down
8 changes: 6 additions & 2 deletions lib/provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/provider",
"version": "0.0.15",
"version": "0.0.16",
"description": "OpenCtx provider library",
"license": "Apache-2.0",
"repository": {
Expand All @@ -11,7 +11,11 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist", "src", "!**/*.test.*"],
"files": [
"dist",
"src",
"!**/*.test.*"
],
"sideEffects": false,
"scripts": {
"build": "tsc --build",
Expand Down
7 changes: 5 additions & 2 deletions lib/schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/schema",
"version": "0.0.12",
"version": "0.0.13",
"description": "OpenCtx schema",
"license": "Apache-2.0",
"repository": {
Expand All @@ -12,7 +12,10 @@
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist", "src"],
"files": [
"dist",
"src"
],
"sideEffects": false,
"scripts": {
"generate": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only dev/generateJsonSchemaTypes.ts src/openctx.schema.json > src/openctx.schema.ts && pnpm -w exec biome check --apply-unsafe \"$PNPM_SCRIPT_SRC_DIR/src/openctx.schema.ts\"",
Expand Down
9 changes: 7 additions & 2 deletions lib/ui-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/ui-common",
"version": "0.0.11",
"version": "0.0.12",
"description": "OpenCtx common UI library",
"license": "Apache-2.0",
"repository": {
Expand All @@ -11,7 +11,12 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist", "src", "!**/*.test.*", "dist/**/*.d.ts"],
"files": [
"dist",
"src",
"!**/*.test.*",
"dist/**/*.d.ts"
],
"sideEffects": false,
"scripts": {
"build": "tsc --build",
Expand Down
11 changes: 9 additions & 2 deletions lib/ui-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/ui-react",
"version": "0.0.11",
"version": "0.0.12",
"description": "OpenCtx React UI library",
"license": "Apache-2.0",
"repository": {
Expand All @@ -11,7 +11,14 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist", "src", "!**/*.test.*", "!**/*.story.*", "!dist/**/*.ts?(x)", "dist/**/*.d.ts"],
"files": [
"dist",
"src",
"!**/*.test.*",
"!**/*.story.*",
"!dist/**/*.ts?(x)",
"dist/**/*.d.ts"
],
"sideEffects": false,
"scripts": {
"prebuild": "mkdir -p dist && cp -R src/* dist/ && find dist/ -name '*.tsx' -delete",
Expand Down
11 changes: 9 additions & 2 deletions lib/ui-standalone/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openctx/ui-standalone",
"version": "0.0.11",
"version": "0.0.12",
"description": "OpenCtx standalone UI library",
"license": "Apache-2.0",
"repository": {
Expand All @@ -11,7 +11,14 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist", "src", "!**/*.test.*", "!**/*.story.*", "!dist/**/*.ts?(x)", "dist/**/*.d.ts"],
"files": [
"dist",
"src",
"!**/*.test.*",
"!**/*.story.*",
"!dist/**/*.ts?(x)",
"dist/**/*.d.ts"
],
"sideEffects": false,
"scripts": {
"prebuild": "mkdir -p dist && cp -R src/* dist/ && find dist/ -name '*.ts' -not -name '*.d.ts' -delete",
Expand Down
7 changes: 5 additions & 2 deletions provider/azure-devops-workitems/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openctx/provider-azure-devops-workitems",
"private": false,
"version": "0.0.3",
"version": "0.0.4",
"description": "Azure DevOps Work Items (OpenCtx provider)",
"license": "Apache-2.0",
"homepage": "https://openctx.org/docs/providers/azure-devops-workitems",
Expand All @@ -13,7 +13,10 @@
"type": "module",
"main": "dist/bundle.js",
"types": "dist/index.d.ts",
"files": ["dist/bundle.js", "dist/index.d.ts"],
"files": [
"dist/bundle.js",
"dist/index.d.ts"
],
"sideEffects": false,
"scripts": {
"bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts",
Expand Down
7 changes: 5 additions & 2 deletions provider/confluence/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openctx/provider-confluence",
"private": false,
"version": "0.0.4",
"version": "0.0.5",
"description": "Confluence (OpenCtx provider)",
"license": "Apache-2.0",
"homepage": "https://openctx.org/docs/providers/confluence",
Expand All @@ -13,7 +13,10 @@
"type": "module",
"main": "dist/bundle.js",
"types": "dist/index.d.ts",
"files": ["dist/bundle.js", "dist/index.d.ts"],
"files": [
"dist/bundle.js",
"dist/index.d.ts"
],
"sideEffects": false,
"scripts": {
"bundle": "tsc --build && esbuild --log-level=error --bundle --format=esm --outfile=dist/bundle.js index.ts",
Expand Down
Loading

0 comments on commit 50490a4

Please sign in to comment.