-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merging main into docs-branch (#405)
* fix: Add style attribute to all relevant components (#384) * chore(main): release 0.5.1 (#385) * fix: Restore deleted publish code (#387) * chore(main): release 0.5.2 (#388) * fix: Free versions and proper environment installs (#389) * fix: Free versions and proper environment installs * fix: Missed condition * chore(main): release 0.5.3 (#390) * fix: updated docs with higher res screenshots and fixed typos/errors in code (#382) * updated docs with higher res screenshots and to fix typos/errors in code * minor docs updates and saving/reading as python file * made slight change to handle multine cell definitions in parser * restored backend and moved saving to python file to new branch * fix: Restore yarn lock and remove unwanted changes * fix: space --------- Co-authored-by: Red Giuliano <red.giuliano@zero-true.com> Co-authored-by: Carson-Shaar <carson.shaar@zero-true.com> * fix(solve-parser-issue): Solved parsing issue with list of variables define globally and in function together (#379) * fix(solve-bug-in-linting): Updated the linting command to check only stable errors according to ruff and ignore others (#383) * fix: Actions artifacts v3 is closing down and other upgrades (#391) * chore(updated-cell-traversal): Updated cell traversal to move between notebook cells using up and down arrow (#381) * chore(updated-cell-traversal): Updated cell traversal to move between notebook cells using up and down arrow * fix(solve-text-component-issue): Fix traversal in text component * chore(optimize-ui): Improved UI for file explorer and copilot components (#380) * chore(optimize-ui): Improved UI for file explorer and copilot components * Updated bug found in copilot unauthorized state * fix(UI-file-explorer): Maintaining proper ui with file item * chore(file-explorer-UI): Optimize UI to open and clsoe folders when clicked on title * chore(optimize-ui-file-explorer):OPtimized file explorer by providing features like right click menu,subfolder item creation, crag drop items, and click open titles in explorer * fix(drag-drop-ui): imporove drag drop funcitonalities * fix(text-cell-traversal): Debugged the issue with text cell traversal and handled all the edge cases for traversal with different decorations and elements (#395) fix(text-cell-traversal):Debugged the issue with text cell traversal and handled all the edge cases for traversal with different decorations and elements * chore(update-copilot-reference): Updated copilot added reference for zero true components to suggest (#396) * Added document context for zero_true components to provide reference for copilot * chore(update-copilot-reference): Updated copilot added reference for zero true components to suggest * fix: Include docs files for copilot in package (#397) * chore(deps): bump nanoid from 3.3.7 to 3.3.8 in /zt_frontend (#398) Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8. - [Release notes](https://github.com/ai/nanoid/releases) - [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md) - [Commits](ai/nanoid@3.3.7...3.3.8) --- updated-dependencies: - dependency-name: nanoid dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(logic-optimizations): Added copy button on copilot code,update search logic in file explorer, optimized copilot suggesstions (#402) * fix(logic-optimizations): Added copy button on copilot code,update search logic in file explorer, optimized copilot suggesstions * fix(copilot-suggesstions): improved some context and increased debounce --------- Co-authored-by: Carson-Shaar <120226019+Carson-Shaar@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Carson-Shaar <120226019+Carson-Shaar@users.noreply.github.com> Co-authored-by: Jonathan Meyers <jmymy@users.noreply.github.com> Co-authored-by: Red Giuliano <red.giuliano@zero-true.com> Co-authored-by: Carson-Shaar <carson.shaar@zero-true.com> Co-authored-by: Priya Kanabar <119392691+priyakanabar-crest@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
fa94ea8
commit 4993559
Showing
80 changed files
with
5,624 additions
and
7,284 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
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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
recursive-include zt_backend/dist_dev * | ||
recursive-include zt_backend/dist_app * | ||
recursive-include copilot/node_modules * | ||
recursive-include mintlify-docs/Components * | ||
include copilot/client.js | ||
include zt_cli/log_config.yaml | ||
include zt_dev_cli/log_config.yaml |
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,121 @@ | ||
from dataclasses import dataclass | ||
from typing import Dict, List, Optional | ||
import os | ||
import re | ||
|
||
@dataclass | ||
class ComponentProperty: | ||
name: str | ||
type: str | ||
description: str | ||
|
||
@dataclass | ||
class ComponentMetadata: | ||
name: str | ||
properties: List[ComponentProperty] | ||
example: str | ||
|
||
class MdxComponentParser: | ||
def __init__(self, mdx_directory: str): | ||
self.mdx_directory = mdx_directory | ||
self._component_cache: Dict[str, ComponentMetadata] = {} | ||
|
||
def parse_mdx_file(self, filename: str) -> Optional[ComponentMetadata]: | ||
if filename in self._component_cache: | ||
return self._component_cache[filename] | ||
|
||
filepath = os.path.join(self.mdx_directory, filename) | ||
if not os.path.exists(filepath): | ||
return None | ||
|
||
with open(filepath, 'r', encoding='utf-8') as file: | ||
content = file.read() | ||
|
||
component_match = re.search(r'<ResponseField name="zero_true\.(\w+)"', content) | ||
if not component_match: | ||
return None | ||
component_name = component_match.group(1) | ||
|
||
properties = self._extract_properties(content) | ||
example = self._extract_complete_example(content, component_name) | ||
|
||
metadata = ComponentMetadata( | ||
name=component_name, | ||
properties=properties, | ||
example=example | ||
) | ||
self._component_cache[filename] = metadata | ||
return metadata | ||
|
||
def _extract_properties(self, content: str) -> List[ComponentProperty]: | ||
properties = [] | ||
property_pattern = r'<Accordion title="([^"]+)">\s+\*\*([^:]+):\s*([^)]+)\*\*:\s*([^<]+)' | ||
matches = re.finditer(property_pattern, content, re.MULTILINE | re.DOTALL) | ||
|
||
for match in matches: | ||
name, prop_name, type_str, description = match.groups() | ||
properties.append(ComponentProperty( | ||
name=name.strip(), | ||
type=type_str.strip(), | ||
description=description.strip() | ||
)) | ||
return properties | ||
|
||
def _extract_complete_example(self, content: str, component_name: str) -> str: | ||
"""Extract complete example with all parameters but without comments.""" | ||
example_match = re.search(r'```python(.*?)```', content, re.DOTALL) | ||
if not example_match: | ||
return "" | ||
|
||
example = example_match.group(1) | ||
|
||
component_pattern = rf'(\w+)\s*=\s*zt\.{component_name}\((.*?)\)' | ||
component_match = re.search(component_pattern, example, re.DOTALL) | ||
|
||
if not component_match: | ||
return "" | ||
|
||
var_name = component_match.group(1) | ||
params_block = component_match.group(2) | ||
|
||
params_list = [] | ||
lines = params_block.split('\n') | ||
for line in lines: | ||
param_line = re.sub(r'#.*$', '', line).strip() | ||
if param_line: | ||
param_match = re.match(r'(\w+)\s*=\s*([^,]+)(?:,|$)', param_line) | ||
if param_match: | ||
param_name, param_value = param_match.groups() | ||
param_value = param_value.strip() | ||
params_list.append(f"{param_name}={param_value}") | ||
|
||
clean_params = ','.join(params_list) | ||
clean_example = f"{var_name}=zt.{component_name}({clean_params})" | ||
|
||
return clean_example | ||
|
||
def generate_completion_context(self) -> str: | ||
"""Generate minimal context with no extra spacing.""" | ||
context_parts = [ | ||
"/* COPILOT RULES", | ||
"- Only use components listed below - no custom components", | ||
"- No empty lines in suggestions", | ||
"- No indentation", | ||
"- No alignment formatting", | ||
"- Minimal spaces between parameters", | ||
"- Don't Create own parameters for component only show if present in usage" | ||
"*/", | ||
] | ||
|
||
# Component definitions | ||
context_parts.append("\n/* Component definitions and their common usage:") | ||
for filename in os.listdir(self.mdx_directory): | ||
if filename.endswith('.mdx'): | ||
metadata = self.parse_mdx_file(filename) | ||
if metadata: | ||
example = metadata.example if metadata.example else f"sample_{metadata.name.lower()}=zt.{metadata.name}(id='sample_{metadata.name.lower()}')" | ||
context_parts.append(f"Component: {metadata.name}") | ||
context_parts.append(f"Usage: {example}") | ||
|
||
context_parts.append("*/") | ||
return '\n'.join(context_parts) |
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
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
Empty file.
Oops, something went wrong.