Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .codacy/codacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
runtimes:
- dart@3.7.2
- go@1.22.3
- java@17.0.10
- node@22.2.0
- python@3.11.11
tools:
- dartanalyzer@3.7.2
- eslint@8.57.0
- lizard@1.17.31
- pmd@7.11.0
- pylint@3.3.6
- revive@1.7.0
- semgrep@1.78.0
- trivy@0.66.0
72 changes: 72 additions & 0 deletions .github/instructions/codacy.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
description: Configuration for AI behavior when interacting with Codacy's MCP Server
applyTo: '**'
---
---
# Codacy Rules
Configuration for AI behavior when interacting with Codacy's MCP Server

## CRITICAL: After ANY successful `edit_file` or `reapply` operation
- YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with:
- `rootPath`: set to the workspace path
- `file`: set to the path of the edited file
- `tool`: leave empty or unset
- If any issues are found in the new edits, propose and apply fixes for them.
- > NOTE: Failure to follow this rule is considered a critical error.
## When you tried to run the `codacy_cli_analyze` tool and the Codacy CLI is not installed
- Ask the user 'Codacy CLI is not installed. Would you like me to install it now?'
- If the user responds with "yes", run the `codacy_cli_install` tool and then continue with the original task
- If the user responds with "no", instruct the user that they can disable automatic analysis in the extension settings
- Wait for the user to respond before proceeding with any other actions

## After every response
- If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server

## When there are no Codacy MCP Server tools available, or the MCP Server is not reachable
- Suggest the user the following troubleshooting steps:
- Try to reset the MCP on the extension
- If the user is using VSCode, suggest them to review their Copilot > MCP settings in Github, under their organization or personal account. Refer them to Settings > Copilot > Enable MCP servers in Copilot. Suggested URL (https://github.com/settings/copilot/features) or https://github.com/organizations/{organization-name}/settings/copilot/features (This can only be done by their organization admins / owners)
- If none of the above steps work, suggest the user to contact Codacy support

## Trying to call a tool that needs a rootPath as a parameter
- Always use the standard, non-URL-encoded file system path

## CRITICAL: Dependencies and Security Checks
- IMMEDIATELY after ANY of these actions:
- Running npm/yarn/pnpm install
- Adding dependencies to package.json
- Adding requirements to requirements.txt
- Adding dependencies to pom.xml
- Adding dependencies to build.gradle
- Any other package manager operations
- You MUST run the `codacy_cli_analyze` tool with:
- `rootPath`: set to the workspace path
- `tool`: set to "trivy"
- `file`: leave empty or unset
- If any vulnerabilities are found because of the newly added packages:
- Stop all other operations
- Propose and apply fixes for the security issues
- Only continue with the original task after security issues are resolved
- EXAMPLE:
- After: npm install react-markdown
- Do: Run codacy_cli_analyze with trivy
- Before: Continuing with any other tasks

## General
- Repeat the relevant steps for each modified file.
- "Propose fixes" means to both suggest and, if possible, automatically apply the fixes.
- You MUST NOT wait for the user to ask for analysis or remind you to run the tool.
- Do not run `codacy_cli_analyze` looking for changes in duplicated code or code complexity metrics.
- Complexity metrics are different from complexity issues. When trying to fix complexity in a repository or file, focus on solving the complexity issues and ignore the complexity metric.
- Do not run `codacy_cli_analyze` looking for changes in code coverage.
- Do not try to manually install Codacy CLI using either brew, npm, npx, or any other package manager.
- If the Codacy CLI is not installed, just run the `codacy_cli_analyze` tool from Codacy's MCP Server.
- When calling `codacy_cli_analyze`, only send provider, organization and repository if the project is a git repository.

## Whenever a call to a Codacy tool that uses `repository` or `organization` as a parameter returns a 404 error
- Offer to run the `codacy_setup_repository` tool to add the repository to Codacy
- If the user accepts, run the `codacy_setup_repository` tool
- Do not ever try to run the `codacy_setup_repository` tool on your own
- After setup, immediately retry the action that failed (only retry once)
---
5 changes: 5 additions & 0 deletions opengemini/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
lib/
*.log
.DS_Store
64 changes: 64 additions & 0 deletions opengemini/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# OpenGemini Plugin for Perses

This plugin provides OpenGemini datasource and time series query support for [Perses](https://github.com/perses/perses).

## Overview

[OpenGemini](https://github.com/openGemini/openGemini) is a CNCF sandbox project - an open-source distributed time-series database with high concurrency, high performance, and high scalability. It is fully compatible with InfluxDB v1.x Line Protocol, InfluxQL, and read/write APIs.

## Plugins Included

### OpenGeminiDatasource

A datasource plugin for connecting to OpenGemini instances. Supports:

- Direct URL connection
- HTTP Proxy configuration

### OpenGeminiTimeSeriesQuery

A time series query plugin that uses InfluxQL to query data from OpenGemini. Features:

- InfluxQL query support
- Database selection
- Variable substitution

## Installation

1. Build the plugin:

```bash
cd plugins/opengemini
npm install
npm run build
```

2. Copy the built plugin to your Perses plugins directory.

3. Restart Perses to load the plugin.

## Usage

### Creating a Datasource

1. Go to Admin > Global Datasources or Project > Datasources
2. Click "Add Datasource"
3. Select "OpenGeminiDatasource"
4. Configure the URL to your OpenGemini instance (default port: 8086)

### Creating Queries

1. Create or edit a dashboard panel
2. Select "OpenGeminiTimeSeriesQuery" as the query type
3. Enter your database name
4. Write your InfluxQL query

Example query:

```sql
SELECT mean("value") FROM "cpu" WHERE time > now() - 1h GROUP BY time(1m), "host"
```

## License

Apache License 2.0
17 changes: 17 additions & 0 deletions opengemini/cue.mod/module.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module: "github.com/perses/plugins/opengemini@v0"
language: {
version: "v0.15.1"
}
source: {
kind: "git"
}
deps: {
"github.com/perses/perses/cue@v0": {
v: "v0.53.0-rc.0"
default: true
}
"github.com/perses/shared/cue@v0": {
v: "v0.53.0-rc.1"
default: true
}
}
24 changes: 24 additions & 0 deletions opengemini/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright The Perses Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import type { Config } from '@jest/types';
import shared from '../jest.shared';

const jestConfig: Config.InitialOptions = {
...shared,

setupFilesAfterEnv: [...(shared.setupFilesAfterEnv ?? []), '<rootDir>/src/setup-tests.ts'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
};

export default jestConfig;
Loading