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
73 changes: 73 additions & 0 deletions .github/workflows/jac-gpt-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Release on Docs Sync

on:
workflow_run:
workflows: ["Sync Jaseci Docs"]
types:
- completed
branches:
- jac-gpt_optimization

jobs:
create-release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get latest tag
id: get_tag
run: |
git fetch --tags
LATEST_TAG=$(git tag -l "jac-gpt-v*" | sort -V | tail -n 1)
if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="jac-gpt-v0.0.0"
fi
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "Found latest tag: $LATEST_TAG"

- name: Bump version
id: bump_version
run: |
LATEST_TAG=${{ steps.get_tag.outputs.latest_tag }}
# Extract version number: jac-gpt-v0.6.8 -> 0.6.8
VERSION=${LATEST_TAG#jac-gpt-v}

IFS='.' read -ra PARTS <<< "$VERSION"
MAJOR=${PARTS[0]:-0}
MINOR=${PARTS[1]:-0}
PATCH=${PARTS[2]:-0}

# Always bump patch version
PATCH=$((PATCH + 1))

NEW_VERSION="jac-gpt-v$MAJOR.$MINOR.$PATCH"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "Creating release: $NEW_VERSION (bumped patch from $LATEST_TAG)"

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_version }}
release_name: Release ${{ steps.bump_version.outputs.new_version }}
body: |
## JAC-GPT Release ${{ steps.bump_version.outputs.new_version }}

📚 Automated release triggered by documentation sync

### Changes
- Updated documentation from Jaseci repository

### Deployment
This release will automatically trigger Docker image builds and deployment to:
- **Backend API**: https://jac-gpt-api.jaseci.org
- **Frontend**: https://jac-gpt.jaseci.org
draft: false
prerelease: false
3 changes: 2 additions & 1 deletion jac-gpt/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ server/mydatabase/
__pycache__/
*.bin
*.sqlite3
*.pickle
*.pickle
!test_dataset.json
2 changes: 1 addition & 1 deletion jac-gpt/server/docs/assets/examples/basic/assignments.jac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
with entry {
a = b=16;
let c = 18;
c = 18;
print(a, b, c);
a >>= 2;
print(a);
Expand Down
31 changes: 31 additions & 0 deletions jac-gpt/server/docs/communityhub/breaking_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@ This page documents significant breaking changes in Jac and Jaseci that may affe

MTLLM library is now deprecated and replaced by the byLLM package. In all place where `mtllm` was used before can be replaced with `byllm`.

### Version 0.9.4

#### 1. `let` Keyword Removed - Use Direct Assignment

The `let` keyword has been removed from Jaclang. Variable declarations now use direct assignment syntax, aligning with Python's approach to variable binding.

**Before**

```jac
with entry {
let x = 10;
let name = "Alice";
let [count, setCount] = useState(0);
}
```

**After**

```jac
with entry {
x = 10;
name = "Alice";
[count, setCount] = useState(0);
}
```

**Key Changes:**
- Remove the `let` keyword from all variable declarations
- Use direct assignment (`x = value`) instead of `let x = value`
- This applies to all contexts including destructuring assignments

### Version 0.8.10

#### 1. byLLM Imports Moved to `byllm.lib`
Expand Down
4 changes: 3 additions & 1 deletion jac-gpt/server/docs/communityhub/release_notes/jaclang.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ This document provides a summary of new features, improvements, and bug fixes in

## jaclang 0.9.4 (Unreleased)

- **`let` Keyword Removed**: The `let` keyword has been removed from Jaclang. Variable declarations now use direct assignment syntax (e.g., `x = 10` instead of `let x = 10`), aligning with Python's approach to variable binding.
- **Py2Jac Robustness Improvements**: Improved reliability of Python-to-Jac conversion with better handling of f-strings (smart quote switching, no keyword escaping in interpolations), match pattern class names, attribute access formatting (no extra spaces around dots), and nested docstrings in classes and functions.
- **Format Command Enhancements**: The `jac format` command now tracks and reports which files were actually changed during formatting. The summary output shows both total files processed and the count of files that were modified (e.g., `Formatted 10/12 '.jac' files (3 changed).`). Additionally, syntax errors encountered during formatting are now printed with full error details.
- **Py2Jac Stability**: Fixed conversion of Python code with augmented assignments and nested docstrings so generated Jac no longer redeclares targets or merges docstrings into following defs.
- **F-String Escape Sequence Fix**: Fixed a bug where escape sequences like `\n`, `\t`, etc. inside f-strings were not being properly decoded, causing literal backslash-n to appear in output instead of actual newlines. The fix correctly decodes escape sequences for f-string literal fragments in `unitree.py`.

## jaclang 0.9.3 (Latest Release)

Expand Down
182 changes: 182 additions & 0 deletions jac-gpt/server/docs/learn/imports/basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# <span style="color: orange">Import Basics</span>

Jac provides a powerful and flexible import system to organize code across multiple files and packages.

!!! tip "Prefer Absolute Imports"
**We recommend using absolute imports** over relative imports. Absolute imports are explicit, easier to read, and avoid ambiguity.

---

## Import Syntax Overview

| Pattern | Syntax | Use Case |
|---------|--------|----------|
| Absolute import | `import module;` | Import entire module |
| From-import | `import from module { X, Y }` | Import specific symbols |
| Include (wildcard) | `include module;` | Include all symbols into namespace |
| Aliased import | `import module as alias;` | Rename module |
| From-import alias | `import from module { X as Y }` | Rename symbol |

!!! note "File Extensions"
Jac resolves both `.jac` and `.py` files—you don't need to include the extension in import paths. This makes Jac fully interoperable with Python modules.

---

## Absolute Import

Import an entire module and access its members using dot notation.

> 📂 [**absolute_import/**](https://github.com/Jaseci-Labs/jaseci/tree/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/absolute_import)

=== "main.jac"
```jac title="absolute_import/main.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/absolute_import/main.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/absolute_import/main.jac)

=== "module_a.jac"
```jac title="absolute_import/module_a.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/absolute_import/module_a.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/absolute_import/module_a.jac)

```
absolute_import/
├── main.jac
└── module_a.jac
```

??? example "Output"
```
Absolute import - VALUE_A: Hello from module_a
Absolute import - greet(): Greet from module_a
```

!!! tip "When to use"
Use absolute imports when you need multiple items from a module and want to make the source clear (e.g., `module_a.VALUE_A`).

---

## From-Import (Selective Import)

Import specific symbols directly into your namespace.

> 📂 [**from_import/**](https://github.com/Jaseci-Labs/jaseci/tree/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/from_import)

=== "main.jac"
```jac title="from_import/main.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/from_import/main.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/from_import/main.jac)

=== "module_b.jac"
```jac title="from_import/module_b.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/from_import/module_b.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/from_import/module_b.jac)

```
from_import/
├── main.jac
└── module_b.jac
```

??? example "Output"
```
From-import - VALUE_B: Hello from module_b
From-import - calculate(5): 10
From-import - MyClass: MyClass instance
```

!!! tip "When to use"
Use from-imports when you need specific items and want shorter names in your code.

---

## Include Statement (Wildcard Import)

The `include` statement imports all public symbols from a module directly into your namespace.

> 📂 [**include_statement/**](https://github.com/Jaseci-Labs/jaseci/tree/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/include_statement)

=== "main.jac"
```jac title="include_statement/main.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/include_statement/main.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/include_statement/main.jac)

=== "module_c.jac"
```jac title="include_statement/module_c.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/include_statement/module_c.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/include_statement/module_c.jac)

```
include_statement/
├── main.jac
└── module_c.jac
```

??? example "Output"
```
Star import - PUBLIC_VAR: I am public
Star import - public_func(): Public function
```

!!! info "Private symbols"
Symbols starting with `_` (underscore) are considered private and are **not** included.

!!! warning "Use sparingly"
Include statements can pollute your namespace. Prefer explicit imports in production code.

---

## Aliased Imports

Rename modules or symbols during import to avoid conflicts or for convenience.

> 📂 [**aliased_import/**](https://github.com/Jaseci-Labs/jaseci/tree/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/aliased_import)

=== "main.jac"
```jac title="aliased_import/main.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/aliased_import/main.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/aliased_import/main.jac)

=== "module_d.jac"
```jac title="aliased_import/module_d.jac"
--8<-- "jac/jaclang/compiler/tests/fixtures/imports_fixture/aliased_import/module_d.jac"
```
[🔗 View on GitHub](https://github.com/Jaseci-Labs/jaseci/blob/main/jac/jaclang/compiler/tests/fixtures/imports_fixture/aliased_import/module_d.jac)

```
aliased_import/
├── main.jac
└── module_d.jac
```

??? example "Output"
```
Import as - md.LONG_MODULE_VALUE: Value from long named module
From import as - lfn(): Result from long function
```

!!! tip "When to use"
- Shorten long module names
- Avoid naming conflicts
- Create more descriptive names

---

## Key Takeaways

| Concept | Description |
|---------|-------------|
| **`import X;`** | Access via `X.symbol` |
| **`import from X { Y }`** | Access `Y` directly |
| **`include X;`** | All public symbols available directly |
| **`import X as Z;`** | Access via `Z.symbol` |
| **`import from X { Y as Z }`** | Access `Y` as `Z` |

!!! success "Best Practice: Use Absolute Imports"
Absolute imports like `import from mypackage.module { X }` are clearer and more maintainable than relative imports.
Loading