Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
f5aa926
Refactor Clava to conform to the changes introduced by the new weaver…
lm-sousa May 23, 2026
5d4d02f
Refactor ACxxWeaverJoinPoint into CxxJoinpoint, simplifying the hiera…
lm-sousa May 23, 2026
8ec2c90
Remove ACxxWeaverJoinPoint from .gitignore since it no longer exists
lm-sousa May 23, 2026
0cf6d4c
Update CxxSpec to use the new weaverPrefix descriptor
lm-sousa May 24, 2026
f84aaf8
Refactor joinpoint methods to use *Impl methods for consistency
lm-sousa May 24, 2026
14fcfec
Remove Copilot instructions document from the repository
lm-sousa May 29, 2026
f2a967f
Add LLM Skill for Clava scripts
lm-sousa May 29, 2026
cc1852f
Refactor BatchParser to simplify error handling and remove unused Cla…
lm-sousa May 29, 2026
dc3428c
rafactor: Reflect recent changes of 'instanceOf', 'equals' and 'toSt…
lm-sousa May 29, 2026
92d8afc
Update tsconfig.json to include "types" for node and jest
lm-sousa May 29, 2026
21a0b73
fix: update TS JP wrappers with the new version of the builder script…
lm-sousa May 29, 2026
6167aaf
refactor: remove unused InitializationStyle enum from the project
lm-sousa May 30, 2026
eb9c849
fix: rectify CxxCudaKernelCall's class name
lm-sousa Jun 1, 2026
24b7d37
fix: update mainClass for generateWeaver task to use the new CLI class
lm-sousa Jun 1, 2026
7466f14
fix: update generics in various classes because they are the cause of…
lm-sousa Jun 2, 2026
e2b0655
Clava-JS: Make the project compatible with Node.js' TS parser where o…
lm-sousa Jun 8, 2026
9e58452
Clava-JS: Move TS files into the old JS locations.
lm-sousa Jun 8, 2026
6ad5012
Clava-JS: Run new TS version of the LARA helper scripts
lm-sousa Jun 8, 2026
f1a74d2
Clava-JS: Convert Jest configuration files to Typescript
lm-sousa Jun 8, 2026
38c94ba
Clava-JS: Remove unused TypeScript configuration files and simplify b…
lm-sousa Jun 8, 2026
44a9c00
Clava-JS: Fix the linter configuration
lm-sousa Jun 8, 2026
2aab56c
Clava-JS: Convert ESLint configuration to TypeScript
lm-sousa Jun 8, 2026
39abb8b
Clava-JS: Update Typedoc configuration
lm-sousa Jun 9, 2026
141aeb7
Clava-JS: Add proper exports to the package and cleanup tsconfig
lm-sousa Jun 9, 2026
e917ba3
Update Node.js supported versions
lm-sousa Jun 30, 2026
5d71fdb
Fix JS CI workflow setup
lm-sousa Jun 30, 2026
a8c215e
Upgrade Clava-JS to TypeScript 7
lm-sousa Jul 14, 2026
6cf8cc2
Update clang dumper resources to manifest release
lm-sousa Jul 3, 2026
604fcd9
Read clang dumper include entrypoints
lm-sousa Jul 3, 2026
d0def94
Cache clang dumper by release version
lm-sousa Jul 6, 2026
3e24c44
Throttle clang dumper include validation
lm-sousa Jul 7, 2026
afb2372
Restore strict clang dumper integration
lm-sousa Jul 15, 2026
9018763
Support testing local clang-dumper builds
lm-sousa Jul 15, 2026
8929424
Use canonical dumper threshold option
lm-sousa Jul 16, 2026
29e6e84
Update character literal kind for LLVM 18
lm-sousa Jul 27, 2026
81d4c60
Support local clang-dumper builds from tag file
lm-sousa Jul 27, 2026
9c57928
Allow unresolved unary transform types
lm-sousa Jul 27, 2026
cdb5c7d
Test source locations across macro expansions
lm-sousa Jul 27, 2026
fa93823
Test source locations in ClangAstParser
lm-sousa Jul 27, 2026
4a0b0e8
Prevent races during stale dumper cache cleanup
lm-sousa Jul 28, 2026
5cbd7e2
Refactor bundled include handling
lm-sousa Jul 28, 2026
e9bf87f
Regenerate Clava-JS enum interfaces
lm-sousa Jul 28, 2026
bec96ea
Update the dumper tag
lm-sousa Jul 30, 2026
c2c0840
Fix C++20 parenthesized list initialization
lm-sousa Jul 30, 2026
1975463
Synchronize clang cache initialization locks
lm-sousa Jul 30, 2026
e203ed0
Make stale cache cleanup portable
lm-sousa Jul 30, 2026
048e797
Support CUDA discovery for local clang-dumper builds
lm-sousa Jul 30, 2026
6877087
Remove persistent clang cache lock artifacts
lm-sousa Jul 30, 2026
609c293
Publish CUDA compatibility header atomically
lm-sousa Jul 30, 2026
24a0658
Preserve JavaScript initialization style names
lm-sousa Jul 30, 2026
1068bcf
test: exercise clang dumper cache races
lm-sousa Jul 31, 2026
954f6ef
test: cover stale cleanup of cached dumper paths
lm-sousa Jul 31, 2026
7ebcda6
fix: coordinate cached clang resource heartbeat updates
lm-sousa Jul 31, 2026
7df968c
Avoid hashing cached clang-dumper includes
lm-sousa Jul 31, 2026
e275a1f
fix: simplify clang cache coordination
lm-sousa Aug 1, 2026
66e00ba
fix: use system libc for local clang-dumper builds
lm-sousa Aug 4, 2026
41228cc
refactor: simplify clang dumper resource setup
lm-sousa Aug 4, 2026
09a0d0e
fix: preserve unevaluated string literal spelling
lm-sousa Aug 4, 2026
ebbc2dd
fix: preserve unevaluated string source spelling
lm-sousa Aug 4, 2026
61be00d
fix: update C++ standard versions in Standard enum
lm-sousa Aug 4, 2026
58fcd62
test: cover dependent unary transform types
lm-sousa Aug 4, 2026
611ea4a
test: cover strict optional node resolution
lm-sousa Aug 4, 2026
f1de83c
test: assert parenthesized initialization style
lm-sousa Aug 4, 2026
452054f
fix: restore built-in CUDA archive parsing
lm-sousa Aug 4, 2026
91f74d1
fix: always use built-in CUDA archive
lm-sousa Aug 4, 2026
7c4c22b
fix: simplify legacy CUDA resource handling
lm-sousa Aug 4, 2026
3f112a9
docs: clarify CUDA standard workaround
lm-sousa Aug 4, 2026
8103726
refactor: deduplicate clang-dumper include cache
lm-sousa Aug 5, 2026
824dc2d
fix: enforce immutable clang-dumper include cache
lm-sousa Aug 5, 2026
f361e8b
fix: serialize clang-dumper cache maintenance
lm-sousa Aug 5, 2026
4adea34
fix: lock clang-dumper staging directories
lm-sousa Aug 5, 2026
32b7d53
simplify: clean staging locks directly
lm-sousa Aug 5, 2026
2fd5934
fix: serialize staging lock registration
lm-sousa Aug 5, 2026
3399184
fix: clean current release staging locks
lm-sousa Aug 5, 2026
f0dd0f6
feat(clang): assemble CUDA resources from NVIDIA manifest
lm-sousa Aug 6, 2026
c202bfc
fix(clang): protect initializing CUDA releases
lm-sousa Aug 6, 2026
5b32ebe
fix(clang): select CUDA platform from NVIDIA manifest
lm-sousa Aug 6, 2026
60462ff
fix(clang): resolve libc mode and CUDA support
lm-sousa Aug 7, 2026
8919c36
Add aggregate Clava build and JS coverage
lm-sousa Jul 6, 2026
d94f203
test: run Jest serially without forced exit
lm-sousa Jul 14, 2026
d77441d
migrate tests to vitest
lm-sousa Jul 14, 2026
781d89b
restore clava TypeScript dependency
lm-sousa Jul 14, 2026
aaebc42
set integration test timeouts
lm-sousa Jul 14, 2026
aeb5abf
extend inliner test timeout
lm-sousa Jul 14, 2026
9abce8d
build: migrate Clava-JS checks to Oxc
lm-sousa Jul 14, 2026
18cfd44
Declare Clava development tool dependencies
lm-sousa Jul 14, 2026
62301f8
test: share Lara Vitest lifecycle
lm-sousa Jul 14, 2026
f37fb12
fix: sync Java binaries after installDist
lm-sousa Jul 15, 2026
70ac726
ci: resolve dependencies through branch ancestry
lm-sousa Jul 23, 2026
7f29b39
test: harden dependency branch resolution
lm-sousa Jul 23, 2026
7a3295b
fix: resolve stack from workflow event commit
lm-sousa Jul 23, 2026
ec43dfa
ci: infer branch order across repositories
lm-sousa Jul 23, 2026
0c1a841
fix: retain advanced stack branches
lm-sousa Jul 23, 2026
db0df00
fix: reject unproven sibling branches
lm-sousa Jul 23, 2026
1c21976
fix: propagate stack proof toward ancestors
lm-sousa Jul 23, 2026
a50683e
fix(test): use Vitest helper instead of removed Jest helper
lm-sousa Aug 22, 2026
5a8f872
ci: consume specs-feup/branch-resolver action for dependency refs
lm-sousa Sep 1, 2026
bb3c807
ci: check out the same PR revision in build-js as build-java
lm-sousa Sep 2, 2026
43e7b81
ci: restrict push trigger to master and staging
lm-sousa Sep 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 39 additions & 0 deletions .codex/skills/clava-scripting/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: clava-scripting
description: Create, update, and explain Clava/LARA scripts in TypeScript using Clava-JS and Lara-JS APIs, including Query/Selector usage, joinpoint selection and filters, and AST transformations. Use for Clava script authoring, joinpoint queries, or refactoring code via Clava/Lara weaver APIs.
---

# Clava Scripting

## Overview

Write and modify Clava scripts in TypeScript using Clava/Lara APIs for joinpoint selection and AST transformations.

## Quick Start

Use ESM imports with `.js` extensions, select joinpoints with `Query`, and transform with Clava APIs.

```ts
import Query from "@specs-feup/lara/api/weaver/Query.ts";
import { FunctionJp } from "@specs-feup/clava/api/Joinpoints.ts";

const $fn = Query.search(FunctionJp, { isImplementation: true }).first();
if ($fn) $fn.clone(`${$fn.name}_clone`);
```

## Workflow

1. Identify joinpoints and attributes.
Use the generated joinpoint wrappers in `@specs-feup/clava/api/Joinpoints.ts` and check `Joinpoints.ts` for default attributes and available fields.

2. Select joinpoints with Query/Selector.
Use `Query.search`, `Query.searchFrom`, `Query.searchFromInclusive`, `Query.childrenFrom`, and `Selector.scope`. Filters accept strings, regex, predicate functions, or objects keyed by attributes. `Selector` is iterable and methods like `.get()`, `.first()`, and `.chain()` consume the current selection.

3. Transform and emit code.
Use joinpoint methods like `.clone()`, `.replaceWith()`, `.addParam()`, `.setReturnType()`, and factories in `ClavaJoinPoints` for new nodes. Use `Query.root().code` or `Clava.writeCode()` to inspect or emit output.

## References

- `references/query-api.md` for Query/Selector behavior and filters.
- `references/clava-apis.md` for key Clava/Lara API entry points and file locations.
- `references/examples.md` for real scripts and test patterns.
4 changes: 4 additions & 0 deletions .codex/skills/clava-scripting/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface:
display_name: "Clava Scripting"
short_description: "Write and edit Clava/Lara scripts"
default_prompt: "Use $clava-scripting to draft a Clava TypeScript script that queries joinpoints and applies a transformation."
33 changes: 33 additions & 0 deletions .codex/skills/clava-scripting/references/clava-apis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Clava and Lara API Entry Points

Use this to locate the right TypeScript APIs and understand where functionality lives.

## Clava-JS APIs (this repo)

- Joinpoint wrappers (generated): `Clava-JS/api/Joinpoints.ts`
- Joinpoint factories/utilities: `Clava-JS/api/clava/ClavaJoinPoints.ts`
- Core Clava utilities and AST stack: `Clava-JS/api/clava/Clava.ts`
- Common passes/opts built on Query: `Clava-JS/api/clava/opt`, `Clava-JS/api/clava/pass`

Imports typically use:
- `@specs-feup/clava/api/Joinpoints.ts`
- `@specs-feup/clava/api/clava/ClavaJoinPoints.ts`
- `@specs-feup/clava/api/clava/Clava.ts`

## Lara-JS APIs (sibling repo)

- Query API: `../lara/Lara-JS/api/weaver/Query.ts`
- Selector behavior and filters: `../lara/Lara-JS/api/weaver/Selector.ts`
- Weaver utilities: `../lara/Lara-JS/api/weaver/Weaver.ts`

If the Lara-JS repo is not a sibling of Clava, search for `Lara-JS/api/weaver/Query.ts`.

Imports typically use:
- `@specs-feup/lara/api/weaver/Query.ts`
- `@specs-feup/lara/api/weaver/Weaver.ts`

## Notes

- Joinpoint wrappers expose attributes and methods specific to each type.
- `ClavaJoinPoints` provides factory helpers for types, statements, expressions, and declarations.
- Use `.code` on joinpoints (or `Query.root().code`) to inspect generated code quickly.
28 changes: 28 additions & 0 deletions .codex/skills/clava-scripting/references/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Script Examples and Patterns

Use these files for concrete patterns and idioms.

## Weaver tests (JS, but patterns apply to TS)

- `ClavaWeaver/resources/clava/test/weaver/Function2.js`
- Select function, clone it, change return type, replace body, add param.

- `ClavaWeaver/resources/clava/test/weaver/Clone.js`
- Clone all functions with definitions and print file code.

- `ClavaWeaver/resources/clava/test/weaver/Field.js`
- Navigate record fields and read attributes like `isPublic`.

- `ClavaWeaver/resources/clava/test/issues/Issue168.js`
- Normalize loops and decompose statements using `NormalizeToSubset` and `StatementDecomposer`.

- `ClavaWeaver/resources/clava/test/issues/Issue_aiq_1.js`
- Filter loops by kind, inspect condition relation.

## API tests

- `ClavaWeaver/resources/clava/test/api/ClavaJoinPointsTest.js`
- Large catalog of `ClavaJoinPoints` factory helpers.

- `Clava-JS/api/Query.test.ts`
- Query chaining, `.scope()`, `.chain()`, and regex selection.
47 changes: 47 additions & 0 deletions .codex/skills/clava-scripting/references/query-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Query and Selector API

Use this when writing or debugging joinpoint selection logic.

## Primary sources

- Query API: `../lara/Lara-JS/api/weaver/Query.ts` (sibling worktree)
- Selector behavior: `../lara/Lara-JS/api/weaver/Selector.ts` (sibling worktree)
- Query usage tests: `Clava-JS/api/Query.test.ts`

If the Lara-JS repo is not a sibling of Clava, search for `Lara-JS/api/weaver/Query.ts`.

## Core patterns

- `Query.root()` returns the root joinpoint.
- `Query.search(Type, filter?, traversal?)` starts from root.
- `Query.searchFrom($base, Type?, filter?, traversal?)` searches below a base node (exclusive).
- `Query.searchFromInclusive($base, Type?, filter?, traversal?)` includes the base node.
- `Query.childrenFrom($base, Type?, filter?)` searches direct children.
- `Selector.scope(Type?, filter?)` searches inside the scope of the previously selected nodes.

## Filters

Filters accept:
- A string or regex applied to the default attribute for that joinpoint type.
- A predicate function `(jp) => boolean`.
- An object with attribute names as keys and values of string/regex/predicate.

Default attributes are defined in the joinpoint wrappers and can be resolved via `Weaver.getDefaultAttribute()`.

## Selector consumption

`Selector` is iterable and is consumed by `for..of`, `.get()`, `.first()`, and `.chain()`.
Use `.chain()` when you need the full chain map (e.g., `loop`, `loop_0`, `loop_1`).

## Minimal examples

```ts
for (const $fn of Query.search(FunctionJp, { isImplementation: true })) {
// $fn is a joinpoint instance
}

const chains = Query.search(FunctionJp, "query_loop")
.search(Loop)
.search(Loop)
.chain();
```
100 changes: 0 additions & 100 deletions .github/copilot-instructions.md

This file was deleted.

70 changes: 17 additions & 53 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
on:
workflow_dispatch:
push:
branches: [master, staging]
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
Expand Down Expand Up @@ -46,77 +47,40 @@
uses: actions/checkout@v6
with:
path: clava
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Determine repository refs
id: repo-refs
shell: bash
env:
BRANCH_NAME: ${{ env.BRANCH_NAME }}
BASE_BRANCH: ${{ github.base_ref }}
run: |
set -euo pipefail

# For each dependency repository, determine which branch to checkout.
# Priority order:
# 1. A branch with the same name as the current branch
# 2. If this is a PR, the target branch (base_ref)
# 3. The default branch of the repository

determine_ref() {
local prefix=$1
local repo=$2
local url="https://github.com/${repo}.git"

# Get the default branch
local default_branch
default_branch=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ {print $2}' | sed 's@refs/heads/@@')
echo "${prefix}_default=${default_branch}" >> "$GITHUB_OUTPUT"
echo "Default branch for ${repo} is '${default_branch}'"

local ref_to_use=""

# Priority 1: Same branch name
if [ -n "$(git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}")" ]; then
ref_to_use="${BRANCH_NAME}"
echo "Using matching branch '${BRANCH_NAME}' in ${repo}"
# Priority 2: PR target branch (if this is a PR)
elif [ -n "${BASE_BRANCH}" ] && [ -n "$(git ls-remote --heads "$url" "refs/heads/${BASE_BRANCH}")" ]; then
ref_to_use="${BASE_BRANCH}"
echo "Using PR target branch '${BASE_BRANCH}' in ${repo}"
# Priority 3: Default branch
else
ref_to_use="${default_branch}"
echo "Using default branch '${default_branch}' for ${repo}"
fi

echo "${prefix}_ref=${ref_to_use}" >> "$GITHUB_OUTPUT"
}

determine_ref "lara" "specs-feup/lara-framework"
determine_ref "specs" "specs-feup/specs-java-libs"
uses: specs-feup/branch-resolver@v1

Check failure on line 54 in .github/workflows/copilot-setup-steps.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use full commit SHA hash for this dependency.

See more on https://sonarcloud.io/project/issues?id=specs-feup_clava&issues=AaBeSCPXsK4QbmkDZBdX&open=AaBeSCPXsK4QbmkDZBdX&pullRequest=232
with:
source-directory: clava
dependencies: |
lara specs-feup/lara-framework
specs specs-feup/specs-java-libs

- name: Echo checks
run: |
echo "Weaver branch: ${{ env.BRANCH_NAME }}"
echo "PR target branch (if any): ${{ github.base_ref }}"
echo "Lara framework ref: ${{ steps.repo-refs.outputs.lara_ref }}"
echo "Lara framework default: ${{ steps.repo-refs.outputs.lara_default }}"
echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}"
echo "Specs-java-libs default: ${{ steps.repo-refs.outputs.specs_default }}"
echo "Lara framework branch: ${{ env.lara_branch }}"
echo "Lara framework commit: ${{ env.lara_ref }}"
echo "Lara framework default: ${{ env.lara_default }}"
echo "Specs-java-libs branch: ${{ env.specs_branch }}"
echo "Specs-java-libs commit: ${{ env.specs_ref }}"
echo "Specs-java-libs default: ${{ env.specs_default }}"

- name: Checkout lara-framework
uses: actions/checkout@v6
with:
repository: specs-feup/lara-framework
path: lara-framework
ref: ${{ steps.repo-refs.outputs.lara_ref }}
ref: ${{ env.lara_ref }}

- name: Checkout specs-java-libs
uses: actions/checkout@v6
with:
repository: specs-feup/specs-java-libs
path: specs-java-libs
ref: ${{ steps.repo-refs.outputs.specs_ref }}
ref: ${{ env.specs_ref }}

- name: Build Weaver
run: |
Expand Down
Loading
Loading