-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4e5b2b
commit d61bb0e
Showing
10 changed files
with
554 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: JSON linter + luacheck | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
env: | ||
DBTYPE: mysql | ||
DBUSER: root | ||
|
||
jobs: | ||
# PHP linters: phpcs, parallel-lint, etc. | ||
linter: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
tools: composer | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.composer/cache | ||
key: buildcache-linter | ||
- run: sudo apt-get install -y composer && composer install | ||
- run: composer test | ||
|
||
# Phan (PHP static analyzer) | ||
phan: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
branch: REL1_39 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
extensions: ast | ||
tools: composer | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.composer/cache | ||
buildcache | ||
key: buildcache-phan | ||
- uses: edwardspec/github-action-build-mediawiki@v1 | ||
with: | ||
branch: ${{ env.branch }} | ||
noinstall: 1 | ||
- name: Install dependencies | ||
run: | | ||
rsync -a --exclude buildcache --exclude mediawiki --exclude .git . mediawiki/extensions/AskAI/ | ||
cd mediawiki/extensions/AskAI | ||
composer install | ||
- name: RUN -- phan | ||
run: cd mediawiki/extensions/AskAI && ./vendor/bin/phan --analyze-twice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
return require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0"?> | ||
<ruleset> | ||
<file>.</file> | ||
<arg name="extensions" value="php,php5,inc" /> | ||
<arg name="encoding" value="UTF-8" /> | ||
|
||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> | ||
<!-- Don't want to apply this --> | ||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" /> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"require-dev": { | ||
"php-parallel-lint/php-parallel-lint": "1.4.0", | ||
"php-parallel-lint/php-console-highlighter": "1.0.0", | ||
"mediawiki/minus-x": "1.1.3", | ||
"mediawiki/mediawiki-codesniffer": "44.0.0", | ||
"mediawiki/mediawiki-phan-config": "0.14.0" | ||
}, | ||
"scripts": { | ||
"test": [ | ||
"parallel-lint . --exclude vendor --exclude node_modules", | ||
"minus-x check .", | ||
"phpcs -p -s" | ||
], | ||
"fix": [ | ||
"minus-x fix .", | ||
"phpcbf" | ||
] | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "AskAI", | ||
"version": "0.0.1", | ||
"author": "Edward Chernenko", | ||
"url": "https://www.mediawiki.org/wiki/Extension:AskAI", | ||
"descriptionmsg": "askai-desc", | ||
"license-name": "GPL-2.0+", | ||
"requires": { | ||
"MediaWiki": ">= 1.39.0" | ||
}, | ||
"type": "other", | ||
"AutoloadClasses": { | ||
"MediaWiki\\AskAI\\SpecialAI": "includes/SpecialAI.php" | ||
}, | ||
"MessagesDirs": { | ||
"AskAI": [ | ||
"i18n" | ||
] | ||
}, | ||
"config": { | ||
"AskAIService": { | ||
"description": "Parameters of the external AI service.", | ||
"value": { | ||
"type": "openai", | ||
"apiUrl": "https://api.openai.com/v1/chat/completions", | ||
"model": "gpt-3.5-turbo" | ||
} | ||
}, | ||
"AskAIApiKey": { | ||
value: "", | ||
description: "API key for the external AI service." | ||
} | ||
}, | ||
"manifest_version": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"@metadata": { | ||
"authors": [ | ||
"Edward Chernenko" | ||
] | ||
}, | ||
|
||
"askai-desc": "Provides [[Special:AI]], which allows user to make AI queries about content of articles in this wiki." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"@metadata": { | ||
"authors": [ | ||
"Edward Chernenko" | ||
] | ||
}, | ||
|
||
"askai-desc": "{{desc|name=AskAI|url=https://www.mediawiki.org/wiki/Extension:AskAI}}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/** | ||
* Implements AskAI extension for MediaWiki. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* http://www.gnu.org/copyleft/gpl.html | ||
* | ||
* @file | ||
*/ | ||
|
||
namespace MediaWiki\AskAI; | ||
|
||
use FormSpecialPage; | ||
use MediaWiki\HTMLForm\HTMLForm; | ||
|
||
/** | ||
* Implements [[Special:AI]]. | ||
*/ | ||
class SpecialAI extends FormSpecialPage { | ||
public function __construct() { | ||
parent::__construct( 'AI', 'askai' ); | ||
} | ||
|
||
public function requiresWrite() { | ||
return false; | ||
} | ||
|
||
/** @inheritDoc */ | ||
protected function getFormFields() { | ||
return [ | ||
]; | ||
} | ||
|
||
/** @inheritDoc */ | ||
protected function alterForm( HTMLForm $form ) { | ||
} | ||
|
||
/** @inheritDoc */ | ||
public function onSubmit( array $data ) { | ||
return Status::newGood(); | ||
} | ||
|
||
public function onSuccess() { | ||
} | ||
|
||
/** @inheritDoc */ | ||
protected function getDisplayFormat() { | ||
return 'ooui'; | ||
} | ||
|
||
/** @inheritDoc */ | ||
protected function getGroupName() { | ||
return 'wiki'; | ||
} | ||
} |