stellar-agent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -0
- package/package.json +37 -0
- package/src/core-skills/module-help.csv +5 -0
- package/src/core-skills/module.yaml +33 -0
- package/src/core-skills/stellar-brainstorming/SKILL.md +6 -0
- package/src/core-skills/stellar-brainstorming/steps/step-01-session-setup.md +67 -0
- package/src/core-skills/stellar-brainstorming/steps/step-02a-user-selected.md +20 -0
- package/src/core-skills/stellar-brainstorming/steps/step-02b-ai-recommended.md +29 -0
- package/src/core-skills/stellar-brainstorming/steps/step-03-technique-execution.md +69 -0
- package/src/core-skills/stellar-brainstorming/steps/step-04-idea-organization.md +64 -0
- package/src/core-skills/stellar-brainstorming/workflow.md +50 -0
- package/src/core-skills/stellar-help/SKILL.md +71 -0
- package/src/core-skills/stellar-party-mode/SKILL.md +109 -0
- package/src/scripts/resolve_config.py +170 -0
- package/src/scripts/resolve_customization.py +209 -0
- package/src/stellar-skills/1-analysis/stellar-agent-analyst/SKILL.md +71 -0
- package/src/stellar-skills/1-analysis/stellar-agent-analyst/customize.toml +41 -0
- package/src/stellar-skills/1-analysis/stellar-analytics/SKILL.md +239 -0
- package/src/stellar-skills/1-analysis/stellar-domain-research/SKILL.md +82 -0
- package/src/stellar-skills/1-analysis/stellar-market-research/SKILL.md +90 -0
- package/src/stellar-skills/2-planning/stellar-agent-pm/SKILL.md +57 -0
- package/src/stellar-skills/2-planning/stellar-agent-pm/customize.toml +36 -0
- package/src/stellar-skills/2-planning/stellar-epics-stories/SKILL.md +106 -0
- package/src/stellar-skills/2-planning/stellar-prd/SKILL.md +115 -0
- package/src/stellar-skills/2-planning/stellar-project-brief/SKILL.md +83 -0
- package/src/stellar-skills/3-architecture/stellar-agent-architect/SKILL.md +53 -0
- package/src/stellar-skills/3-architecture/stellar-agent-architect/customize.toml +31 -0
- package/src/stellar-skills/3-architecture/stellar-architecture-doc/SKILL.md +162 -0
- package/src/stellar-skills/4-implementation/stellar-agent-developer/SKILL.md +54 -0
- package/src/stellar-skills/4-implementation/stellar-agent-developer/customize.toml +56 -0
- package/src/stellar-skills/4-implementation/stellar-agent-devops/SKILL.md +54 -0
- package/src/stellar-skills/4-implementation/stellar-agent-devops/customize.toml +36 -0
- package/src/stellar-skills/4-implementation/stellar-agent-frontend/SKILL.md +54 -0
- package/src/stellar-skills/4-implementation/stellar-agent-frontend/customize.toml +52 -0
- package/src/stellar-skills/4-implementation/stellar-agent-qa/SKILL.md +54 -0
- package/src/stellar-skills/4-implementation/stellar-agent-qa/customize.toml +31 -0
- package/src/stellar-skills/4-implementation/stellar-create-asset/SKILL.md +145 -0
- package/src/stellar-skills/4-implementation/stellar-create-transaction/SKILL.md +134 -0
- package/src/stellar-skills/4-implementation/stellar-deploy-contract/SKILL.md +124 -0
- package/src/stellar-skills/4-implementation/stellar-freighter-integration/SKILL.md +193 -0
- package/src/stellar-skills/4-implementation/stellar-horizon-integration/SKILL.md +198 -0
- package/src/stellar-skills/4-implementation/stellar-init-contract/SKILL.md +102 -0
- package/src/stellar-skills/4-implementation/stellar-liquidity-pool/SKILL.md +156 -0
- package/src/stellar-skills/4-implementation/stellar-nextjs-setup/SKILL.md +198 -0
- package/src/stellar-skills/4-implementation/stellar-nextjs-soroban/SKILL.md +228 -0
- package/src/stellar-skills/4-implementation/stellar-nextjs-wallet/SKILL.md +276 -0
- package/src/stellar-skills/4-implementation/stellar-sep10-auth/SKILL.md +252 -0
- package/src/stellar-skills/4-implementation/stellar-setup-environment/SKILL.md +163 -0
- package/src/stellar-skills/4-implementation/stellar-setup-trustline/SKILL.md +107 -0
- package/src/stellar-skills/4-implementation/stellar-test-contract/SKILL.md +146 -0
- package/src/stellar-skills/4-implementation/stellar-write-contract/SKILL.md +140 -0
- package/src/stellar-skills/module-help.csv +24 -0
- package/src/stellar-skills/module.yaml +103 -0
- package/tools/installer/cli-utils.js +39 -0
- package/tools/installer/commands/init.js +335 -0
- package/tools/installer/fs-native.js +116 -0
- package/tools/installer/prompts.js +852 -0
- package/tools/installer/stellar-cli.js +80 -0
- package/tools/installer/yaml-format.js +245 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stellar-write-contract
|
|
3
|
+
description: 'Guide implementation of Soroban smart contract logic including storage types, host functions, error handling, and cross-contract calls. Use when the user needs to implement or expand a Soroban contract.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Write Soroban Contract
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Guide the user through implementing production-quality Soroban contract code.
|
|
11
|
+
|
|
12
|
+
## On Activation
|
|
13
|
+
|
|
14
|
+
Load config from `{project-root}/_stellar/stellar/config.yaml`. Read any architecture document at `{project-root}/_stellar-output/planning-artifacts/architecture.md` if it exists.
|
|
15
|
+
|
|
16
|
+
## Core Knowledge
|
|
17
|
+
|
|
18
|
+
### Storage Types
|
|
19
|
+
|
|
20
|
+
Explain when to use each:
|
|
21
|
+
|
|
22
|
+
- **Persistent** โ data that must survive contract instance expiration (token balances, ownership records). Higher rent cost.
|
|
23
|
+
- **Temporary** โ data with short TTL, cheaper rent (nonces, session tokens, rate limits).
|
|
24
|
+
- **Instance** โ contract-level metadata tied to the contract instance lifetime (admin address, paused flag, config). Expires with the instance.
|
|
25
|
+
|
|
26
|
+
```rust
|
|
27
|
+
use soroban_sdk::{contractimpl, Env, Address};
|
|
28
|
+
|
|
29
|
+
pub struct MyContract;
|
|
30
|
+
|
|
31
|
+
#[contractimpl]
|
|
32
|
+
impl MyContract {
|
|
33
|
+
pub fn set_admin(env: Env, admin: Address) {
|
|
34
|
+
// Instance storage: tied to contract instance lifetime
|
|
35
|
+
env.storage().instance().set(&Symbol::new(&env, "Admin"), &admin);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pub fn get_balance(env: Env, account: Address) -> i128 {
|
|
39
|
+
// Persistent storage: survives archival cycles
|
|
40
|
+
env.storage().persistent().get(&account).unwrap_or(0)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Host Functions
|
|
46
|
+
|
|
47
|
+
Key Soroban host functions:
|
|
48
|
+
- `env.storage()` โ access Persistent/Temporary/Instance storage
|
|
49
|
+
- `env.invoker()` โ get the address that invoked this function (deprecated; use auth instead)
|
|
50
|
+
- `env.current_contract_address()` โ get this contract's own address
|
|
51
|
+
- `env.events().publish((symbol, ...), data)` โ emit contract events
|
|
52
|
+
- `env.ledger().timestamp()` โ current ledger timestamp
|
|
53
|
+
- `env.ledger().sequence()` โ current ledger sequence number
|
|
54
|
+
|
|
55
|
+
### Authorization
|
|
56
|
+
|
|
57
|
+
```rust
|
|
58
|
+
pub fn transfer(env: Env, from: Address, to: Address, amount: i128) {
|
|
59
|
+
// Require the 'from' address to have authorized this call
|
|
60
|
+
from.require_auth();
|
|
61
|
+
// ... transfer logic
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Error Handling
|
|
66
|
+
|
|
67
|
+
```rust
|
|
68
|
+
use soroban_sdk::contracterror;
|
|
69
|
+
|
|
70
|
+
#[contracterror]
|
|
71
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
|
|
72
|
+
#[repr(u32)]
|
|
73
|
+
pub enum ContractError {
|
|
74
|
+
NotInitialized = 1,
|
|
75
|
+
Unauthorized = 2,
|
|
76
|
+
InsufficientBalance = 3,
|
|
77
|
+
InvalidAmount = 4,
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Cross-Contract Calls
|
|
82
|
+
|
|
83
|
+
```rust
|
|
84
|
+
use soroban_sdk::contract_client;
|
|
85
|
+
|
|
86
|
+
// Import external contract interface
|
|
87
|
+
contract_client!(OtherContract, "../other_contract");
|
|
88
|
+
|
|
89
|
+
pub fn call_other(env: Env, other_contract_id: Address) -> i128 {
|
|
90
|
+
let client = OtherContractClient::new(&env, &other_contract_id);
|
|
91
|
+
client.some_function()
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Workflow
|
|
96
|
+
|
|
97
|
+
### Step 1: Review Architecture
|
|
98
|
+
|
|
99
|
+
Read any existing architecture document. Ask the user to describe the contract's purpose if no document exists.
|
|
100
|
+
|
|
101
|
+
### Step 2: Define the Interface
|
|
102
|
+
|
|
103
|
+
Work with the user to define function signatures before implementation:
|
|
104
|
+
|
|
105
|
+
```rust
|
|
106
|
+
pub trait MyContractTrait {
|
|
107
|
+
fn initialize(env: Env, admin: Address) -> Result<(), ContractError>;
|
|
108
|
+
fn deposit(env: Env, from: Address, amount: i128) -> Result<(), ContractError>;
|
|
109
|
+
fn withdraw(env: Env, to: Address, amount: i128) -> Result<(), ContractError>;
|
|
110
|
+
fn get_balance(env: Env, account: Address) -> i128;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Step 3: Implement Storage Layer
|
|
115
|
+
|
|
116
|
+
Write storage key enums and read/write helpers:
|
|
117
|
+
|
|
118
|
+
```rust
|
|
119
|
+
#[contracttype]
|
|
120
|
+
pub enum DataKey {
|
|
121
|
+
Admin,
|
|
122
|
+
Balance(Address),
|
|
123
|
+
Paused,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
fn get_balance(env: &Env, account: &Address) -> i128 {
|
|
127
|
+
env.storage()
|
|
128
|
+
.persistent()
|
|
129
|
+
.get(&DataKey::Balance(account.clone()))
|
|
130
|
+
.unwrap_or(0)
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Step 4: Implement Business Logic
|
|
135
|
+
|
|
136
|
+
Implement each function with proper auth, error handling, and event emission.
|
|
137
|
+
|
|
138
|
+
### Step 5: Write Tests
|
|
139
|
+
|
|
140
|
+
Suggest `stellar-test-contract` for comprehensive test coverage.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module,skill,display-name,menu-code,description,action,args,phase,preceded-by,followed-by,required,output-location,outputs
|
|
2
|
+
Stellar,_meta,,,,,,,,,false,https://github.com/tolgazorlu/stellar-agent#readme,
|
|
3
|
+
Stellar,stellar-analytics,Analytics Setup,AN,Set up dbt blockchain analytics for Stellar network data and tokenomics reporting.,,,1-analysis,,,false,{project_knowledge},dbt models
|
|
4
|
+
Stellar,stellar-market-research,Market Research,MR,DeFi landscape competitive analysis and Stellar ecosystem research.,,,1-analysis,,,false,{planning_artifacts},research document
|
|
5
|
+
Stellar,stellar-domain-research,Domain Research,DR,Stellar protocol deep dive โ tokenomics regulatory landscape and use case research.,,,1-analysis,,,false,{planning_artifacts},research document
|
|
6
|
+
Stellar,stellar-project-brief,Project Brief,PB,Define the dApp concept goals and target users in a concise brief.,,,2-planning,,,false,{planning_artifacts},project-brief
|
|
7
|
+
Stellar,stellar-prd,Stellar dApp PRD,PR,Create or update Product Requirements Document for a Stellar application.,,,2-planning,stellar-project-brief,,true,{planning_artifacts},prd
|
|
8
|
+
Stellar,stellar-epics-stories,Epics and Stories,ES,Break PRD into development epics and user stories with Stellar-specific acceptance criteria.,,,2-planning,stellar-prd,,true,{planning_artifacts},epics-stories
|
|
9
|
+
Stellar,stellar-architecture-doc,Architecture Document,AD,Create technical architecture document covering on-chain vs off-chain Soroban contract design and Horizon integration.,,,3-architecture,stellar-prd,,true,{planning_artifacts},architecture
|
|
10
|
+
Stellar,stellar-setup-environment,Setup Environment,SE,Set up local Stellar development environment with Docker quickstart Stellar CLI and SDK.,,,4-implementation,,,true,{project_knowledge},environment-guide
|
|
11
|
+
Stellar,stellar-init-contract,Init Contract,IC,Initialize a new Soroban smart contract project with Rust workspace and scaffold.,,,4-implementation,stellar-setup-environment,,false,{implementation_artifacts},contract scaffold
|
|
12
|
+
Stellar,stellar-write-contract,Write Contract,WC,Implement Soroban contract logic including storage types host functions and error handling.,,,4-implementation,stellar-init-contract,,false,{implementation_artifacts},contract code
|
|
13
|
+
Stellar,stellar-test-contract,Test Contract,TC,Write and run comprehensive Soroban contract tests using the Rust test harness.,,,4-implementation,stellar-write-contract,,true,{implementation_artifacts},test suite
|
|
14
|
+
Stellar,stellar-deploy-contract,Deploy Contract,DC,Deploy Soroban contract through full pipeline โ build optimize upload instantiate verify.,,,4-implementation,stellar-test-contract,,false,{implementation_artifacts},deployed-contracts
|
|
15
|
+
Stellar,stellar-create-transaction,Create Transaction,TX,Build sign and submit Stellar transactions using the JS/TS or Python SDK.,,,4-implementation,stellar-setup-environment,,false,{implementation_artifacts},transaction
|
|
16
|
+
Stellar,stellar-create-asset,Create Asset,CA,Create a custom Stellar asset with issuing account stellar.toml and distribution setup.,,,4-implementation,stellar-setup-environment,,false,{implementation_artifacts},asset-config
|
|
17
|
+
Stellar,stellar-setup-trustline,Setup Trustline,TL,Configure trustlines so accounts can hold and receive custom Stellar assets.,,,4-implementation,stellar-create-asset,,false,{implementation_artifacts},trustline-config
|
|
18
|
+
Stellar,stellar-liquidity-pool,Liquidity Pool,LP,Create and interact with Stellar AMM liquidity pools and DEX order books.,,,4-implementation,stellar-setup-trustline,,false,{implementation_artifacts},pool-config
|
|
19
|
+
Stellar,stellar-horizon-integration,Horizon Integration,HI,Integrate with Stellar Horizon REST API for account queries transaction streaming and order book data.,,,4-implementation,stellar-setup-environment,,false,{implementation_artifacts},horizon-client
|
|
20
|
+
Stellar,stellar-nextjs-setup,Next.js Setup,NX,Scaffold a Next.js App Router project with Stellar SDK environment config and network setup.,,,4-implementation,stellar-setup-environment,,false,{implementation_artifacts},nextjs-project
|
|
21
|
+
Stellar,stellar-nextjs-wallet,Next.js Wallet,NW,Integrate Freighter wallet into Next.js with connect/disconnect signing and account state.,,,4-implementation,stellar-nextjs-setup,,false,{implementation_artifacts},wallet-integration
|
|
22
|
+
Stellar,stellar-nextjs-soroban,Next.js Soroban,NS,Call Soroban contracts from Next.js using Server Components API routes and client-side signing.,,,4-implementation,stellar-nextjs-wallet,,false,{implementation_artifacts},soroban-integration
|
|
23
|
+
Stellar,stellar-freighter-integration,Freighter Integration,FI,Deep Freighter wallet integration โ full API reference connection lifecycle and blob signing.,,,4-implementation,stellar-setup-environment,,false,{implementation_artifacts},freighter-integration
|
|
24
|
+
Stellar,stellar-sep10-auth,SEP-10 Auth,S10,Implement SEP-10 Web Authentication with JWT for Next.js API routes and protected endpoints.,,,4-implementation,stellar-nextjs-setup,,false,{implementation_artifacts},sep10-auth
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
code: stellar
|
|
2
|
+
name: "Stellar Agent Skills"
|
|
3
|
+
description: "Complete AI agent team for Stellar blockchain development"
|
|
4
|
+
default_selected: true
|
|
5
|
+
|
|
6
|
+
# Variables inherited from Core module:
|
|
7
|
+
# user_name, project_name, communication_language, document_output_language, output_folder
|
|
8
|
+
|
|
9
|
+
network_preference:
|
|
10
|
+
prompt: "Which Stellar network are you primarily developing for?"
|
|
11
|
+
default: "testnet"
|
|
12
|
+
result: "{value}"
|
|
13
|
+
single-select:
|
|
14
|
+
- value: "testnet"
|
|
15
|
+
label: "Testnet โ Safe development environment"
|
|
16
|
+
- value: "mainnet"
|
|
17
|
+
label: "Mainnet โ Production deployment"
|
|
18
|
+
- value: "futurenet"
|
|
19
|
+
label: "Futurenet โ Cutting-edge feature testing"
|
|
20
|
+
|
|
21
|
+
primary_language:
|
|
22
|
+
prompt: "What is your primary development language?"
|
|
23
|
+
default: "typescript"
|
|
24
|
+
result: "{value}"
|
|
25
|
+
single-select:
|
|
26
|
+
- value: "typescript"
|
|
27
|
+
label: "JavaScript/TypeScript โ dApp and SDK development"
|
|
28
|
+
- value: "rust"
|
|
29
|
+
label: "Rust โ Soroban smart contracts"
|
|
30
|
+
- value: "python"
|
|
31
|
+
label: "Python โ Analytics and automation"
|
|
32
|
+
- value: "fullstack"
|
|
33
|
+
label: "Full stack โ Both TypeScript and Rust"
|
|
34
|
+
|
|
35
|
+
planning_artifacts:
|
|
36
|
+
prompt: "Where should planning artifacts be stored?"
|
|
37
|
+
default: "{output_folder}/planning-artifacts"
|
|
38
|
+
result: "{project-root}/{value}"
|
|
39
|
+
|
|
40
|
+
implementation_artifacts:
|
|
41
|
+
prompt: "Where should implementation artifacts be stored?"
|
|
42
|
+
default: "{output_folder}/implementation-artifacts"
|
|
43
|
+
result: "{project-root}/{value}"
|
|
44
|
+
|
|
45
|
+
project_knowledge:
|
|
46
|
+
prompt: "Where should project knowledge be stored?"
|
|
47
|
+
default: "docs"
|
|
48
|
+
result: "{project-root}/{value}"
|
|
49
|
+
|
|
50
|
+
directories:
|
|
51
|
+
- "{planning_artifacts}"
|
|
52
|
+
- "{implementation_artifacts}"
|
|
53
|
+
- "{project_knowledge}"
|
|
54
|
+
|
|
55
|
+
agents:
|
|
56
|
+
- code: stellar-agent-analyst
|
|
57
|
+
name: Aria
|
|
58
|
+
title: Blockchain Analyst
|
|
59
|
+
icon: "๐"
|
|
60
|
+
team: stellar-development
|
|
61
|
+
description: "Data-driven blockchain analyst who grounds every insight in on-chain evidence. Specializes in tokenomics, dbt analytics, Stellar network data, and competitive DeFi landscape analysis. Speaks like a detective following the on-chain trail โ precise, evidence-first, never speculates without data."
|
|
62
|
+
|
|
63
|
+
- code: stellar-agent-pm
|
|
64
|
+
name: Kai
|
|
65
|
+
title: dApp Product Manager
|
|
66
|
+
icon: "๐"
|
|
67
|
+
team: stellar-development
|
|
68
|
+
description: "User-value-first product manager who translates financial inclusion goals into actionable Stellar dApp specs. Cuts through blockchain hype to focus on real user needs. Speaks with direct questions and sharp follow-ups โ every 'why?' leads back to the user."
|
|
69
|
+
|
|
70
|
+
- code: stellar-agent-architect
|
|
71
|
+
name: Nova
|
|
72
|
+
title: Stellar System Architect
|
|
73
|
+
icon: "๐๏ธ"
|
|
74
|
+
team: stellar-development
|
|
75
|
+
description: "Makes the critical on-chain vs. off-chain calls, Soroban vs. Classic Stellar decisions, and multi-contract architecture choices. Favors simple, auditable designs. Speaks at the whiteboard โ trade-offs first, verdicts only when evidence is clear."
|
|
76
|
+
|
|
77
|
+
- code: stellar-agent-developer
|
|
78
|
+
name: Sol
|
|
79
|
+
title: Stellar Developer
|
|
80
|
+
icon: "๐ป"
|
|
81
|
+
team: stellar-development
|
|
82
|
+
description: "Builds Soroban smart contracts in Rust, dApps with Stellar SDK (JS/TS), and Python automation. Test-first across both Rust test harness and testnet. Speaks in contract addresses, XDR formats, and transaction hashes โ exact, citable, no filler."
|
|
83
|
+
|
|
84
|
+
- code: stellar-agent-qa
|
|
85
|
+
name: Vera
|
|
86
|
+
title: Contract QA Engineer
|
|
87
|
+
icon: "๐งช"
|
|
88
|
+
team: stellar-development
|
|
89
|
+
description: "Validates smart contracts against edge cases, simulates transaction failures, and runs testnet regression suites. Never ships until simulation is clean. Speaks in test IDs and failure modes โ every claim backed by a test result."
|
|
90
|
+
|
|
91
|
+
- code: stellar-agent-devops
|
|
92
|
+
name: Orion
|
|
93
|
+
title: Stellar DevOps Engineer
|
|
94
|
+
icon: "โ๏ธ"
|
|
95
|
+
team: stellar-development
|
|
96
|
+
description: "Sets up local Stellar quickstart environments, manages Horizon instances, handles deployment pipelines from testnet to mainnet, and diagnoses network issues with stellar doctor. Speaks in commands โ direct, copy-pasteable, no vague instructions."
|
|
97
|
+
|
|
98
|
+
- code: stellar-agent-frontend
|
|
99
|
+
name: Lyra
|
|
100
|
+
title: Stellar Frontend Developer
|
|
101
|
+
icon: "๐จ"
|
|
102
|
+
team: stellar-development
|
|
103
|
+
description: "Builds Next.js App Router dApps connected to the Stellar network. Expert in Freighter wallet integration, Soroban contract calls from React, Horizon data fetching in Server Components, and SEP-10 authentication. Knows exactly when to use Server vs Client Components and never exposes private keys."
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const prompts = require('./prompts');
|
|
2
|
+
|
|
3
|
+
const CLIUtils = {
|
|
4
|
+
async displayLogo() {
|
|
5
|
+
const color = await prompts.getColor();
|
|
6
|
+
const termWidth = process.stdout.columns || 80;
|
|
7
|
+
|
|
8
|
+
const logoWide = [
|
|
9
|
+
' โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโ โโโโโโโ โโโโโโ โโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ',
|
|
10
|
+
' โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโ',
|
|
11
|
+
' โโโโโโโโ โโโ โโโโโโ โโโ โโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโ โโโโโโ โโโ โโโ ',
|
|
12
|
+
' โโโโโโโโ โโโ โโโโโโ โโโ โโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโ โโโโโโโโโโ โโโ ',
|
|
13
|
+
' โโโโโโโโ โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโ โโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโ ',
|
|
14
|
+
' โโโโโโโโ โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโ โโโ โโโ โโโโโโโ โโโโโโโโโโโ โโโโโ โโโ ',
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const logoNarrow = [
|
|
18
|
+
' โ
STELLAR AGENT',
|
|
19
|
+
' โโโโโโโโโโโโโโโโโโ',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const logoLines = termWidth >= 110 ? logoWide : logoNarrow;
|
|
23
|
+
const logo = logoLines.map((line) => color.cyan(line)).join('\n');
|
|
24
|
+
const tagline = color.white(' AI Agent Team for the Stellar Network\n Build on the blockchain for the world');
|
|
25
|
+
|
|
26
|
+
await prompts.box(`${logo}\n${tagline}`, '', {
|
|
27
|
+
contentAlign: 'center',
|
|
28
|
+
rounded: true,
|
|
29
|
+
formatBorder: color.cyan,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
async displayModuleConfigHeader(moduleName, header = null, subheader = null) {
|
|
34
|
+
const title = header || `Configuring ${moduleName.toUpperCase()} Module`;
|
|
35
|
+
await prompts.note(subheader || '', title);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
module.exports = { CLIUtils };
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
const path = require('node:path');
|
|
2
|
+
const os = require('node:os');
|
|
3
|
+
const fsp = require('node:fs/promises');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const yaml = require('yaml');
|
|
6
|
+
const prompts = require('../prompts');
|
|
7
|
+
const { CLIUtils } = require('../cli-utils');
|
|
8
|
+
|
|
9
|
+
// Escape a value for safe embedding in a TOML double-quoted string
|
|
10
|
+
function tomlEscape(str) {
|
|
11
|
+
return String(str).replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const STELLAR_DIR = '_stellar';
|
|
15
|
+
const OUTPUT_DIR = '_stellar-output';
|
|
16
|
+
|
|
17
|
+
async function installStellarAgent(targetDir, config) {
|
|
18
|
+
const stellarDir = path.join(targetDir, STELLAR_DIR);
|
|
19
|
+
const outputDir = path.join(targetDir, OUTPUT_DIR);
|
|
20
|
+
|
|
21
|
+
// Create directory structure
|
|
22
|
+
const dirs = [
|
|
23
|
+
path.join(stellarDir, '_config'),
|
|
24
|
+
path.join(stellarDir, 'core'),
|
|
25
|
+
path.join(stellarDir, 'stellar'),
|
|
26
|
+
path.join(stellarDir, 'scripts'),
|
|
27
|
+
path.join(stellarDir, 'custom'),
|
|
28
|
+
path.join(outputDir, 'planning-artifacts'),
|
|
29
|
+
path.join(outputDir, 'implementation-artifacts'),
|
|
30
|
+
path.join(outputDir, 'project-knowledge'),
|
|
31
|
+
];
|
|
32
|
+
for (const dir of dirs) {
|
|
33
|
+
await fsp.mkdir(dir, { recursive: true });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Write core config
|
|
37
|
+
const coreConfig = {
|
|
38
|
+
user_name: config.user_name,
|
|
39
|
+
project_name: config.project_name,
|
|
40
|
+
communication_language: config.communication_language,
|
|
41
|
+
document_output_language: config.communication_language,
|
|
42
|
+
output_folder: OUTPUT_DIR,
|
|
43
|
+
};
|
|
44
|
+
await fsp.writeFile(
|
|
45
|
+
path.join(stellarDir, 'core', 'config.yaml'),
|
|
46
|
+
yaml.stringify(coreConfig),
|
|
47
|
+
'utf8'
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// Write stellar module config
|
|
51
|
+
const stellarConfig = {
|
|
52
|
+
network_preference: config.network_preference,
|
|
53
|
+
primary_language: config.primary_language,
|
|
54
|
+
planning_artifacts: `${OUTPUT_DIR}/planning-artifacts`,
|
|
55
|
+
implementation_artifacts: `${OUTPUT_DIR}/implementation-artifacts`,
|
|
56
|
+
project_knowledge: 'docs',
|
|
57
|
+
};
|
|
58
|
+
await fsp.writeFile(
|
|
59
|
+
path.join(stellarDir, 'stellar', 'config.yaml'),
|
|
60
|
+
yaml.stringify(stellarConfig),
|
|
61
|
+
'utf8'
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
// Write manifest
|
|
65
|
+
const manifest = {
|
|
66
|
+
version: require('../../../package.json').version,
|
|
67
|
+
installed_at: new Date().toISOString(),
|
|
68
|
+
project_name: config.project_name,
|
|
69
|
+
};
|
|
70
|
+
await fsp.writeFile(
|
|
71
|
+
path.join(stellarDir, '_config', 'manifest.yaml'),
|
|
72
|
+
yaml.stringify(manifest),
|
|
73
|
+
'utf8'
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
// Copy Python scripts
|
|
77
|
+
const scriptsSource = path.join(__dirname, '..', '..', '..', 'src', 'scripts');
|
|
78
|
+
const scriptsTarget = path.join(stellarDir, 'scripts');
|
|
79
|
+
for (const script of ['resolve_customization.py', 'resolve_config.py']) {
|
|
80
|
+
const src = path.join(scriptsSource, script);
|
|
81
|
+
const dest = path.join(scriptsTarget, script);
|
|
82
|
+
if (fs.existsSync(src)) {
|
|
83
|
+
await fsp.copyFile(src, dest);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Build and write stellar-help.csv by collecting all module-help.csv files
|
|
88
|
+
await buildHelpCatalog(targetDir, stellarDir);
|
|
89
|
+
|
|
90
|
+
// Write custom gitignore
|
|
91
|
+
await fsp.writeFile(
|
|
92
|
+
path.join(stellarDir, 'custom', '.gitignore'),
|
|
93
|
+
'*.user.toml\n',
|
|
94
|
+
'utf8'
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Write base config.toml with agent roster
|
|
98
|
+
await writeBaseConfigToml(stellarDir, config);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function buildHelpCatalog(targetDir, stellarDir) {
|
|
102
|
+
const srcDir = path.join(__dirname, '..', '..', '..', 'src');
|
|
103
|
+
const csvFiles = [];
|
|
104
|
+
|
|
105
|
+
function findCsvFiles(dir) {
|
|
106
|
+
if (!fs.existsSync(dir)) return;
|
|
107
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
108
|
+
if (entry.isDirectory()) {
|
|
109
|
+
findCsvFiles(path.join(dir, entry.name));
|
|
110
|
+
} else if (entry.name === 'module-help.csv') {
|
|
111
|
+
csvFiles.push(path.join(dir, entry.name));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
findCsvFiles(srcDir);
|
|
117
|
+
|
|
118
|
+
let combined = 'module,skill,display-name,menu-code,description,action,args,phase,preceded-by,followed-by,required,output-location,outputs\n';
|
|
119
|
+
for (const csvFile of csvFiles) {
|
|
120
|
+
const content = fs.readFileSync(csvFile, 'utf8');
|
|
121
|
+
const lines = content.split('\n').slice(1).filter((l) => l.trim());
|
|
122
|
+
combined += lines.join('\n') + '\n';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
await fsp.writeFile(
|
|
126
|
+
path.join(stellarDir, '_config', 'stellar-help.csv'),
|
|
127
|
+
combined,
|
|
128
|
+
'utf8'
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function writeBaseConfigToml(stellarDir, config) {
|
|
133
|
+
const tomlContent = `# Stellar Agent Configuration
|
|
134
|
+
# Generated by stellar-agent init โ edit with care
|
|
135
|
+
|
|
136
|
+
[core]
|
|
137
|
+
user_name = "${tomlEscape(config.user_name)}"
|
|
138
|
+
project_name = "${tomlEscape(config.project_name)}"
|
|
139
|
+
communication_language = "${tomlEscape(config.communication_language)}"
|
|
140
|
+
document_output_language = "${tomlEscape(config.communication_language)}"
|
|
141
|
+
output_folder = "${OUTPUT_DIR}"
|
|
142
|
+
|
|
143
|
+
[stellar]
|
|
144
|
+
network_preference = "${tomlEscape(config.network_preference)}"
|
|
145
|
+
primary_language = "${tomlEscape(config.primary_language)}"
|
|
146
|
+
planning_artifacts = "${OUTPUT_DIR}/planning-artifacts"
|
|
147
|
+
implementation_artifacts = "${OUTPUT_DIR}/implementation-artifacts"
|
|
148
|
+
project_knowledge = "docs"
|
|
149
|
+
|
|
150
|
+
[[agents]]
|
|
151
|
+
code = "stellar-agent-analyst"
|
|
152
|
+
name = "Aria"
|
|
153
|
+
title = "Blockchain Analyst"
|
|
154
|
+
icon = "๐"
|
|
155
|
+
team = "stellar-development"
|
|
156
|
+
module = "stellar"
|
|
157
|
+
description = "Data-driven blockchain analyst specializing in tokenomics, dbt analytics, and Stellar network data."
|
|
158
|
+
|
|
159
|
+
[[agents]]
|
|
160
|
+
code = "stellar-agent-pm"
|
|
161
|
+
name = "Kai"
|
|
162
|
+
title = "dApp Product Manager"
|
|
163
|
+
icon = "๐"
|
|
164
|
+
team = "stellar-development"
|
|
165
|
+
module = "stellar"
|
|
166
|
+
description = "User-value-first product manager who translates financial inclusion goals into Stellar dApp specs."
|
|
167
|
+
|
|
168
|
+
[[agents]]
|
|
169
|
+
code = "stellar-agent-architect"
|
|
170
|
+
name = "Nova"
|
|
171
|
+
title = "Stellar System Architect"
|
|
172
|
+
icon = "๐๏ธ"
|
|
173
|
+
team = "stellar-development"
|
|
174
|
+
module = "stellar"
|
|
175
|
+
description = "Makes on-chain vs. off-chain calls, Soroban vs. Classic Stellar decisions, and multi-contract architecture."
|
|
176
|
+
|
|
177
|
+
[[agents]]
|
|
178
|
+
code = "stellar-agent-developer"
|
|
179
|
+
name = "Sol"
|
|
180
|
+
title = "Stellar Developer"
|
|
181
|
+
icon = "๐ป"
|
|
182
|
+
team = "stellar-development"
|
|
183
|
+
module = "stellar"
|
|
184
|
+
description = "Builds Soroban smart contracts in Rust and dApps with Stellar SDK (JS/TS). Test-first always."
|
|
185
|
+
|
|
186
|
+
[[agents]]
|
|
187
|
+
code = "stellar-agent-qa"
|
|
188
|
+
name = "Vera"
|
|
189
|
+
title = "Contract QA Engineer"
|
|
190
|
+
icon = "๐งช"
|
|
191
|
+
team = "stellar-development"
|
|
192
|
+
module = "stellar"
|
|
193
|
+
description = "Validates smart contracts, simulates transaction failures, and runs testnet regression suites."
|
|
194
|
+
|
|
195
|
+
[[agents]]
|
|
196
|
+
code = "stellar-agent-devops"
|
|
197
|
+
name = "Orion"
|
|
198
|
+
title = "Stellar DevOps Engineer"
|
|
199
|
+
icon = "โ๏ธ"
|
|
200
|
+
team = "stellar-development"
|
|
201
|
+
module = "stellar"
|
|
202
|
+
description = "Sets up local Stellar environments, manages Horizon instances, and handles deployment pipelines."
|
|
203
|
+
|
|
204
|
+
[[agents]]
|
|
205
|
+
code = "stellar-agent-frontend"
|
|
206
|
+
name = "Lyra"
|
|
207
|
+
title = "Stellar Frontend Developer"
|
|
208
|
+
icon = "๐จ"
|
|
209
|
+
team = "stellar-development"
|
|
210
|
+
module = "stellar"
|
|
211
|
+
description = "Builds Next.js App Router dApps connected to Stellar โ Freighter wallet, Soroban contract calls, SEP-10 auth."
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
await fsp.writeFile(path.join(stellarDir, 'config.toml'), tomlContent, 'utf8');
|
|
215
|
+
// Empty user config
|
|
216
|
+
await fsp.writeFile(path.join(stellarDir, 'config.user.toml'), '# Personal overrides โ gitignore this file\n', 'utf8');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
async function action(options) {
|
|
220
|
+
await CLIUtils.displayLogo();
|
|
221
|
+
await prompts.intro('Stellar Agent โ AI agent team for Stellar blockchain development');
|
|
222
|
+
|
|
223
|
+
// Directory selection
|
|
224
|
+
const rawDir = await prompts.text({
|
|
225
|
+
message: 'Which directory to initialize?',
|
|
226
|
+
default: process.cwd(),
|
|
227
|
+
placeholder: process.cwd(),
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Canonicalize and restrict to an absolute path โ prevents path traversal
|
|
231
|
+
const targetDir = path.resolve(
|
|
232
|
+
rawDir.startsWith('~') ? rawDir.replace('~', os.homedir()) : rawDir
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
// Reject anything that escapes the user's home directory
|
|
236
|
+
const homeDir = os.homedir();
|
|
237
|
+
if (!targetDir.startsWith(homeDir + path.sep) && targetDir !== homeDir) {
|
|
238
|
+
await prompts.cancel(`Directory must be inside your home folder (${homeDir}).`);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Check for existing installation
|
|
243
|
+
const stellarPath = path.join(targetDir, STELLAR_DIR);
|
|
244
|
+
const hasExisting = fs.existsSync(stellarPath);
|
|
245
|
+
|
|
246
|
+
if (hasExisting) {
|
|
247
|
+
const actionChoice = await prompts.select({
|
|
248
|
+
message: 'Stellar Agent is already installed here. What would you like to do?',
|
|
249
|
+
choices: [
|
|
250
|
+
{ name: 'Update (refresh skills, preserve config)', value: 'update' },
|
|
251
|
+
{ name: 'Cancel', value: 'cancel' },
|
|
252
|
+
],
|
|
253
|
+
});
|
|
254
|
+
if (actionChoice === 'cancel') {
|
|
255
|
+
await prompts.cancel('Installation cancelled.');
|
|
256
|
+
process.exit(0);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Gather config
|
|
261
|
+
const userName = await prompts.text({
|
|
262
|
+
message: 'What should agents call you?',
|
|
263
|
+
default: os.userInfo().username,
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
const projectName = await prompts.text({
|
|
267
|
+
message: 'What is your Stellar project called?',
|
|
268
|
+
default: path.basename(targetDir),
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
const networkPreference = await prompts.select({
|
|
272
|
+
message: 'Which Stellar network are you primarily developing for?',
|
|
273
|
+
choices: [
|
|
274
|
+
{ name: 'Testnet โ Safe development environment', value: 'testnet' },
|
|
275
|
+
{ name: 'Mainnet โ Production deployment', value: 'mainnet' },
|
|
276
|
+
{ name: 'Futurenet โ Cutting-edge feature testing', value: 'futurenet' },
|
|
277
|
+
],
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
const primaryLanguage = await prompts.select({
|
|
281
|
+
message: 'What is your primary development language?',
|
|
282
|
+
choices: [
|
|
283
|
+
{ name: 'JavaScript/TypeScript โ dApp and SDK development', value: 'typescript' },
|
|
284
|
+
{ name: 'Rust โ Soroban smart contracts', value: 'rust' },
|
|
285
|
+
{ name: 'Python โ Analytics and automation', value: 'python' },
|
|
286
|
+
{ name: 'Full stack โ Both TypeScript and Rust', value: 'fullstack' },
|
|
287
|
+
],
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
const communicationLanguage = await prompts.text({
|
|
291
|
+
message: 'What language should agents use when chatting with you?',
|
|
292
|
+
default: 'English',
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
const config = {
|
|
296
|
+
user_name: userName,
|
|
297
|
+
project_name: projectName,
|
|
298
|
+
network_preference: networkPreference,
|
|
299
|
+
primary_language: primaryLanguage,
|
|
300
|
+
communication_language: communicationLanguage,
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// Install
|
|
304
|
+
const spinner = await prompts.spinner();
|
|
305
|
+
spinner.start('Installing Stellar Agent...');
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
await installStellarAgent(targetDir, config);
|
|
309
|
+
spinner.stop('Stellar Agent installed successfully!');
|
|
310
|
+
} catch (err) {
|
|
311
|
+
spinner.error(`Installation failed: ${err.message}`);
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const color = await prompts.getColor();
|
|
316
|
+
await prompts.outro(
|
|
317
|
+
[
|
|
318
|
+
color.green('Get started:'),
|
|
319
|
+
'',
|
|
320
|
+
' 1. Open your AI assistant in this project folder',
|
|
321
|
+
' 2. Invoke stellar-help to see available skills',
|
|
322
|
+
` 3. Say "@stellar-developer" to start building Soroban contracts`,
|
|
323
|
+
' or "@stellar-architect" to design your system first',
|
|
324
|
+
'',
|
|
325
|
+
` Network: ${color.cyan(networkPreference)} | Language: ${color.cyan(primaryLanguage)}`,
|
|
326
|
+
].join('\n')
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
module.exports = {
|
|
331
|
+
command: 'init',
|
|
332
|
+
description: 'Initialize Stellar Agent in your project',
|
|
333
|
+
options: [],
|
|
334
|
+
action,
|
|
335
|
+
};
|