Skip to content
Merged
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
84 changes: 0 additions & 84 deletions affinescript-ecosystem/affinescript-vite/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -356,90 +356,6 @@ verify-template:
exit 1
fi

# Generate a V-lang connector scaffold from the Groove manifest
gen-v-connector:
#!/usr/bin/env bash
set -euo pipefail
MANIFEST=".machine_readable/integrations/groove.a2ml"
if [ ! -f "$MANIFEST" ]; then
echo "Error: No Groove manifest. Run 'just groove-setup' first."
exit 1
fi

# Extract service name and port from manifest
SERVICE=$(grep '(service "' "$MANIFEST" | head -1 | sed 's/.*"\(.*\)".*/\1/')
PORT=$(grep '(port ' "$MANIFEST" | head -1 | sed 's/.*(port \([0-9]*\)).*/\1/')

if [ "$PORT" = "0" ] || [ -z "$PORT" ]; then
echo "Error: Port not assigned. Run 'just groove-setup' first."
exit 1
fi

# Check which API surfaces are enabled
REST=$(grep -q '(rest.*enabled true)' "$MANIFEST" && echo "true" || echo "false")
GRPC=$(grep -q '(grpc.*enabled true)' "$MANIFEST" && echo "true" || echo "false")
GRAPHQL=$(grep -q '(graphql.*enabled true)' "$MANIFEST" && echo "true" || echo "false")

OUTDIR="connectors/v-${SERVICE}"
mkdir -p "${OUTDIR}/src"

cat << VEOF | sed "s/^ //" > "${OUTDIR}/src/main.v"
// SPDX-License-Identifier: PMPL-1.0-or-later
// V-${SERVICE} — auto-generated V-lang connector.
// Generated by: just gen-v-connector
// From: ${MANIFEST}

module v_${SERVICE//-/_}

import net.http
import json

pub struct Config {
pub mut:
base_url string = 'http://localhost:${PORT}'
}

pub fn new_client(config Config) &Client {
return &Client{ config: config }
}

pub fn new_default() &Client {
return new_client(Config{})
}

pub struct Client {
config Config
}

pub fn (c &Client) health() !string {
resp := http.get('\${c.config.base_url}/health') or {
return error('${SERVICE} unreachable: \${err}')
}
if resp.status_code != 200 {
return error('${SERVICE} unhealthy: HTTP \${resp.status_code}')
}
return resp.body
}

// Groove discovery
pub fn discover() ?&Client {
client := new_default()
if _ := client.health() { return client }
return none
}

// PENDING: Add endpoint-specific methods for your API
// REST=${REST} gRPC=${GRPC} GraphQL=${GRAPHQL}
VEOF

echo "Generated: ${OUTDIR}/src/main.v"
echo " Service: "${SERVICE}""
echo " Port: "${PORT}""
echo " REST: "${REST}", gRPC: "${GRPC}", GraphQL: "${GRAPHQL}""
echo ""
echo "Next: add endpoint methods to ${OUTDIR}/src/main.v"
echo "Then copy to developer-ecosystem/v-ecosystem/connectors/"

# ═══════════════════════════════════════════════════════════════════════════════
# PROJECT SELF-ASSESSMENT
# ═══════════════════════════════════════════════════════════════════════════════
Expand Down
84 changes: 0 additions & 84 deletions affinescript-ecosystem/rattlescript/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -360,90 +360,6 @@ verify-template:
exit 1
fi

# Generate a V-lang connector scaffold from the Groove manifest
gen-v-connector:
#!/usr/bin/env bash
set -euo pipefail
MANIFEST=".machine_readable/integrations/groove.a2ml"
if [ ! -f "$MANIFEST" ]; then
echo "Error: No Groove manifest. Run 'just groove-setup' first."
exit 1
fi

# Extract service name and port from manifest
SERVICE=$(grep '(service "' "$MANIFEST" | head -1 | sed 's/.*"\(.*\)".*/\1/')
PORT=$(grep '(port ' "$MANIFEST" | head -1 | sed 's/.*(port \([0-9]*\)).*/\1/')

if [ "$PORT" = "0" ] || [ -z "$PORT" ]; then
echo "Error: Port not assigned. Run 'just groove-setup' first."
exit 1
fi

# Check which API surfaces are enabled
REST=$(grep -q '(rest.*enabled true)' "$MANIFEST" && echo "true" || echo "false")
GRPC=$(grep -q '(grpc.*enabled true)' "$MANIFEST" && echo "true" || echo "false")
GRAPHQL=$(grep -q '(graphql.*enabled true)' "$MANIFEST" && echo "true" || echo "false")

OUTDIR="connectors/v-${SERVICE}"
mkdir -p "${OUTDIR}/src"

cat << VEOF | sed "s/^ //" > "${OUTDIR}/src/main.v"
// SPDX-License-Identifier: PMPL-1.0-or-later
// V-${SERVICE} — auto-generated V-lang connector.
// Generated by: just gen-v-connector
// From: ${MANIFEST}

module v_${SERVICE//-/_}

import net.http
import json

pub struct Config {
pub mut:
base_url string = 'http://localhost:${PORT}'
}

pub fn new_client(config Config) &Client {
return &Client{ config: config }
}

pub fn new_default() &Client {
return new_client(Config{})
}

pub struct Client {
config Config
}

pub fn (c &Client) health() !string {
resp := http.get('\${c.config.base_url}/health') or {
return error('${SERVICE} unreachable: \${err}')
}
if resp.status_code != 200 {
return error('${SERVICE} unhealthy: HTTP \${resp.status_code}')
}
return resp.body
}

// Groove discovery
pub fn discover() ?&Client {
client := new_default()
if _ := client.health() { return client }
return none
}

// TODO: Add endpoint-specific methods for your API
// REST=${REST} gRPC=${GRPC} GraphQL=${GRAPHQL}
VEOF

echo "Generated: ${OUTDIR}/src/main.v"
echo " Service: ${SERVICE}"
echo " Port: ${PORT}"
echo " REST: ${REST}, gRPC: ${GRPC}, GraphQL: ${GRAPHQL}"
echo ""
echo "Next: add endpoint methods to ${OUTDIR}/src/main.v"
echo "Then copy to developer-ecosystem/v-ecosystem/connectors/"

# ═══════════════════════════════════════════════════════════════════════════════
# PROJECT SELF-ASSESSMENT
# ═══════════════════════════════════════════════════════════════════════════════
Expand Down
Loading