Skip to content

Commit

Permalink
Added spell checking to trunk check (#584)
Browse files Browse the repository at this point in the history
Signed-off-by: JonahSussman <[email protected]>
  • Loading branch information
JonahSussman authored Jan 24, 2025
1 parent 170114a commit 4b68209
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 9 deletions.
32 changes: 32 additions & 0 deletions .trunk/configs/cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# - Install
# https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker
#
# - Add this to your settings.json
# ```
# "cSpell.customDictionaries": {
# "custom-words": {
# "name": "custom-words",
# "path": "./.trunk/configs/custom-words.txt",
# "addWords": true,
# }
# },
# "cSpell.enabled": true,
# ```
#
# - Misspelled words will have a blue underline. Access the quick fix menu (Ctrl
# + .) and add the word to the `custom-words` dictionary.

version: "0.2"
# Suggestions can sometimes take longer on CI machines,
# leading to inconsistent results.
suggestionsTimeout: 5000 # ms
dictionaries:
- python
- typescript
- go
- java
- custom-words

dictionaryDefinitions:
- name: custom-words
path: ./.trunk/configs/custom-words.txt
42 changes: 42 additions & 0 deletions .trunk/configs/custom-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
caikit
codeplan
codeplanner
coolstore
coolstuff
deepseek
diffable
djzager
flywaydb
frobinate
genai
initialcontextfactory
jakartaee
javaee
javax
jaxrs
jdbc
jdtls
jndi
kantra
konveyor
langchain
levelname
LOGLEVEL
mistralai
mixtral
moderations
OBJC
Ollama
pgaikwad
picketlink
pydantic
PYTHONPATH
quarkus
resteasy
smallrye
springboot
sussman
templ
tgis
tiiuae
webmvc
3 changes: 3 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ lint:
- name: lint
run: bandit --exit-zero -c bandit.yaml --format json --output ${tmpfile} ${target}
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
Expand Down Expand Up @@ -65,6 +66,8 @@ lint:
- notebooks/**
# Complaining about intentionally empty values
- .github/workflows/**
# Weird recursive cspell thing doesn't check this file properly
- .trunk/configs/custom-words.txt
actions:
enabled:
- trunk-announce
Expand Down
10 changes: 5 additions & 5 deletions kai/reactive_codeplanner/agent/analyzer_fix/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class _llm_response:
reasoning: str | None
source_file: str | None
addional_information: str | None
additional_information: str | None


class AnalyzerAgent(Agent):
Expand Down Expand Up @@ -135,16 +135,16 @@ def execute(self, ask: AgentRequest) -> AnalyzerFixResponse:
incidents=ask.incidents,
)

aimessage = self._model_provider.invoke(
ai_message = self._model_provider.invoke(
[system_message, HumanMessage(content=content)]
)

resp = self.parse_llm_response(aimessage, language)
resp = self.parse_llm_response(ai_message, language)
return AnalyzerFixResponse(
encountered_errors=[],
file_to_modify=Path(os.path.abspath(ask.file_path)),
reasoning=resp.reasoning,
additional_information=resp.addional_information,
additional_information=resp.additional_information,
updated_file_content=resp.source_file,
)

Expand Down Expand Up @@ -186,7 +186,7 @@ def parse_llm_response(self, message: BaseMessage, language: str) -> _llm_respon
return _llm_response(
reasoning=reasoning,
source_file=source_file,
addional_information=additional_details,
additional_information=additional_details,
)


Expand Down
2 changes: 1 addition & 1 deletion kai/reactive_codeplanner/agent/reflection_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def _parse_llm_response(
if isinstance(content, list):
return None
match_updated_file = re.search(
r"[##|\*\*] [U|u]pdated [F|f]ile\s+.*?```\w+\n([\s\S]*?)```",
r"[##|\*\*] [U|u]pdated [F|f]ile\s+.*?```\w+\n([\s\S]*?)```", # trunk-ignore(cspell)
content,
re.DOTALL,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@


class AnalyzerTaskRunner(TaskRunner):
"""This agent is reponsible for taking a given Incident and determining a fix for that incident.
"""
This agent is responsible for taking a given Incident and determining a fix
for that incident.
For a given file it will asking LLM's for the changes that are needed for the at whole file
returning the results.
For a given file it will asking LLM's for the changes that are needed for
the at whole file returning the results.
"""

def __init__(self, agent: AnalyzerAgent) -> None:
Expand Down

0 comments on commit 4b68209

Please sign in to comment.