Fix plugin hooks JSON, align Skill docs with repo API, and make skill generation portable

This commit is contained in:
KaifAhmad1
2026-04-08 22:55:11 +05:30
parent e60cef9eb7
commit 678d891b42
6 changed files with 47 additions and 21 deletions
-1
View File
@@ -16,7 +16,6 @@ This folder contains the plugin metadata for the Semantica Claude/Cursor/Codex p
```bash ```bash
/plugin marketplace add <owner>/semantica /plugin marketplace add <owner>/semantica
``` ```
```
## Supported platforms ## Supported platforms
+2 -1
View File
@@ -1,7 +1,8 @@
{ {
"hooks": { "hooks": {
"PostToolUse": [ "PostToolUse": [
{"matcher": "Write|Edit", "hooks": [{"type": "command", "command": "FILE=$(jq -r .tool_input.file_path 2>/dev/null); if echo $FILE | grep -qE semantica/; then python -c "import ast,sys; ast.parse(open(sys.argv[1]).read())" $FILE 2>&1; fi"}]}, {"matcher": "Write|Edit", "hooks": [{"type": "command", "command": "FILE=$(jq -r .tool_input.file_path 2>/dev/null); if echo $FILE | grep -qE semantica/; then python -c 'import ast,sys; ast.parse(open(sys.argv[1]).read())' $FILE 2>&1; fi"}]},
{"matcher": "Write|Edit", "hooks": [{"type": "command", "command": "echo PostToolUse provenance check"}]} {"matcher": "Write|Edit", "hooks": [{"type": "command", "command": "echo PostToolUse provenance check"}]}
], ],
"PreToolUse": [ "PreToolUse": [
+11 -7
View File
@@ -1,6 +1,6 @@
--- ---
name: deduplicate name: deduplicate
description: Identify and merge duplicate entities, relations, and graph objects in Semantica using fuzzy matching, schema heuristics, and graph similarity. description: Detect duplicate entities, duplicate groups, and relationship duplicates in Semantica using fuzzy matching, schema heuristics, and graph similarity.
--- ---
# /semantica:deduplicate # /semantica:deduplicate
@@ -13,25 +13,29 @@ Remove duplicates from the knowledge graph. Usage: `/semantica:deduplicate <stra
## `entities [--threshold <score>] [--field <name>]` ## `entities [--threshold <score>] [--field <name>]`
Find and merge duplicate entities. Detect duplicate entities and group them by similarity.
```python ```python
from semantica.deduplication import DuplicateDetector from semantica.deduplication import DuplicateDetector
finder = DuplicateDetector() finder = DuplicateDetector()
merged = finder.merge_duplicates(entity_type=entity_type, threshold=threshold) candidates = finder.detect_duplicates(entities, threshold=threshold)
groups = finder.detect_duplicate_groups(entities, threshold=threshold)
``` ```
Output: merged entity IDs, discarded duplicates, and merge confidence. Output: duplicate candidate list, duplicate groups, and representative merge recommendations.
--- ---
## `relations [--similarity <score>]` ## `relations [--similarity <score>]`
Detect duplicate relationships and normalize edges. Detect duplicate relationships and normalize edge representations.
```python ```python
relations = finder.find_duplicate_relations(similarity=similarity) from semantica.deduplication import DuplicateDetector
finder = DuplicateDetector()
relations = finder.detect_duplicates(relation_list, threshold=similarity)
``` ```
Result: relation clusters, normalized relation set, and cleanup summary. Result: duplicate relation candidates, normalized relationship groups, and cleanup summary.
+24 -6
View File
@@ -16,22 +16,23 @@ Export knowledge graph data. Usage: `/semantica:export <format> [args]`
Export graph data as JSON. Export graph data as JSON.
```python ```python
from semantica.export import GraphExporter from semantica.export.methods import export_json
exporter = GraphExporter() export_json(data=graph_data, file_path=output, format='json')
exporter.export_json(output_path=output, filter_query=filter_query)
``` ```
Output: JSON file or inline JSON payload. Output: JSON file or inline JSON payload.
--- ---
## `rdf [--format turtle|xml|ntriples] [--output <path>]` ## `rdf [--format turtle|rdfxml|jsonld|ntriples|n3] [--output <path>]`
Export the graph in RDF serialization. Export the graph in RDF serialization.
```python ```python
exporter.export_rdf(format='turtle', output_path=output) from semantica.export.methods import export_rdf
export_rdf(data=graph_data, file_path=output, format='turtle')
``` ```
Return: RDF text or file path. Return: RDF text or file path.
@@ -43,7 +44,24 @@ Return: RDF text or file path.
Export nodes and edges to Parquet for analytics. Export nodes and edges to Parquet for analytics.
```python ```python
exporter.export_parquet(output_path=output) from semantica.export.methods import export_parquet
export_parquet(data=graph_data, file_path=output, compression='snappy')
``` ```
Output: Parquet dataset ready for downstream processing. Output: Parquet dataset ready for downstream processing.
---
## `graphml|gexf|dot [--output <path>]`
Export the graph to a supported graph format.
```python
from semantica.export import GraphExporter
exporter = GraphExporter(format='graphml', include_attributes=True)
exporter.export(graph_data, output)
```
Output: Graph format file suitable for visualization tools.
+5 -4
View File
@@ -16,10 +16,9 @@ Ingest new data into the knowledge graph. Usage: `/semantica:ingest <source> [ar
Ingest structured data from a local file. Ingest structured data from a local file.
```python ```python
from semantica.ingest import DataIngestor from semantica.ingest import ingest_file
ingestor = DataIngestor() data = ingest_file(file_path=path, method='file', file_format=file_format)
ingestor.ingest_file(file_path=path, file_format=file_format)
``` ```
Output: imported node/edge count and ingestion summary. Output: imported node/edge count and ingestion summary.
@@ -31,7 +30,9 @@ Output: imported node/edge count and ingestion summary.
Ingest data from a database source. Ingest data from a database source.
```python ```python
ingestor.ingest_database(connection_string=conn, query=query) from semantica.ingest import ingest_database
result = ingest_database(connection_string=conn, query=query)
``` ```
Return: rows ingested, mapped entities, and warnings. Return: rows ingested, mapped entities, and warnings.
+5 -2
View File
@@ -1,6 +1,9 @@
import os import os
base = r'c:\Users\Mohd Kaif\semantica\plugins\skills' base = os.getenv(
'SKILLS_OUT_DIR',
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'plugins', 'skills')
)
SKILLS = {} SKILLS = {}
@@ -1025,7 +1028,7 @@ Flag as WARNING if gap rate > 5%.
for skill_name, content in SKILLS.items(): for skill_name, content in SKILLS.items():
path = os.path.join(base, skill_name, 'SKILL.md') path = os.path.join(base, skill_name, 'SKILL.md')
os.makedirs(os.path.dirname(path), exist_ok=True) os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, 'w') as f: with open(path, 'w', encoding='utf-8', newline='\n') as f:
f.write(content) f.write(content)
print(f'written: {skill_name}') print(f'written: {skill_name}')