This guide shows how to use ast-grep with Pug template files using custom language support.
-
Built the Pug Parser: We've compiled the tree-sitter-pug parser as a dynamic library (
pug.so
) -
Configuration: Created
sgconfig.yml
with:
A lightweight, Node.js-based AI agent for code generation and project management, similar to Aider. It integrates with Git, supports a CLI with autocompletion, a rich web UI with visual commands, and fully configurable LLM prompts stored in separate .txt
files. Every code change is automatically committed with the prompt included, with support for managing context, undoing changes, running tests, and copying context to the clipboard.
@
file autocompletion, /
commands, !
or /run
for shell commands, and ?
for questions./undo
for reverting./add
and /drop
.A self-compiling tool to process vibe-coded projects using prompt stacks and LLM generation.
vibec
transforms stacks of prompts into code and tests, supporting static .md
and dynamic .js
plugins. It outputs staged artifacts (output/stages/
) for Git history and a current runtime version (output/current/
) aggregated from all stages with a "Last-Wins" strategy. It can compile itself using its own structure.
select | |
format_timestamp('%m/%d/%Y %H:%M:%S', timestamp_millis(div(block_timestamp, 1000000))) as `Date`, | |
parse_bignumeric(json_value(args, '$.deposit')) / POW(cast(10 as bignumeric), 24) as `Sent Quantity`, | |
'NEAR' as `Sent Currency` | |
, receipt_predecessor_account_id | |
, receipt_receiver_account_id | |
from `bigquery-public-data.crypto_near_mainnet_us.receipt_actions` | |
where receipt_predecessor_account_id in | |
( | |
'vlad.near', |
// Tokenize the JSON string by splitting on `{`, `}`, `[`, and `]`, unless the character is inside a string | |
char* token = strtok(jsonCopy, "{}[],"); | |
bool inString = false; | |
int depth = 0; | |
while (token != NULL) { | |
if (!inString && depth == 0 && strcmp(token, path) == 0) { | |
// The requested path was found, so return the next token as the value | |
token = strtok(NULL, "{}[],"); | |
slice_t value = { | |
.len = strlen(token), |
const std = @import("std"); | |
// NOTE: In smart contract context don't really have to free memory before execution ends | |
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
var allocator = arena.allocator(); | |
// Import host functions provided by NEAR runtime. | |
// See https://github.com/near/near-sdk-rs/blob/78c16447486285fd952765ef3e727e16d6c8c867/near-sdk/src/environment/env.rs#L117 | |
extern fn input(register_id: u64) void; | |
extern fn read_register(register_id: u64, ptr: u64) void; |
select | |
to_timestamp(receipt_included_in_block_timestamp / 1000000000) as timestamp, | |
(args->>'deposit')::numeric / (10 ^ 24) as deposit, | |
receipt_predecessor_account_id | |
from action_receipt_actions | |
where receipt_receiver_account_id = 'root.near' | |
and receipt_predecessor_account_id != 'system' |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>js-libp2p parcel.js browser example</title> | |
</head> | |
<body> |
You can do following to allow passing blob into contract without a lot of overhead:
export function setContractToDeploy(): void {
env.input(0);
util.read_register(0);
// ...
}