stacksagent 1.0.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/dist/assets/.agent/workflows/stacks-agent.md +71 -0
- package/dist/assets/.claude/settings.local.json +36 -0
- package/dist/assets/.claude/skills/stacks-agent/SKILL.md +219 -0
- package/dist/assets/.claude/skills/stacks-agent/data/bns.csv +11 -0
- package/dist/assets/.claude/skills/stacks-agent/data/clarity-syntax.csv +62 -0
- package/dist/assets/.claude/skills/stacks-agent/data/contract-templates.csv +15 -0
- package/dist/assets/.claude/skills/stacks-agent/data/defi-protocols.csv +16 -0
- package/dist/assets/.claude/skills/stacks-agent/data/deployment.csv +26 -0
- package/dist/assets/.claude/skills/stacks-agent/data/security-patterns.csv +16 -0
- package/dist/assets/.claude/skills/stacks-agent/data/stacking.csv +16 -0
- package/dist/assets/.claude/skills/stacks-agent/data/stacks-js.csv +31 -0
- package/dist/assets/.claude/skills/stacks-agent/scripts/core.py +165 -0
- package/dist/assets/.claude/skills/stacks-agent/scripts/search.py +62 -0
- package/dist/assets/.codex/skills/stacks-agent/SKILL.md +126 -0
- package/dist/assets/.cursor/commands/stacks-agent.md +50 -0
- package/dist/assets/.github/prompts/stacks-agent.prompt.md +80 -0
- package/dist/assets/.kiro/steering/stacks-agent.md +78 -0
- package/dist/assets/.shared/stacks-agent/data/bns.csv +11 -0
- package/dist/assets/.shared/stacks-agent/data/clarity-syntax.csv +62 -0
- package/dist/assets/.shared/stacks-agent/data/contract-templates.csv +15 -0
- package/dist/assets/.shared/stacks-agent/data/defi-protocols.csv +16 -0
- package/dist/assets/.shared/stacks-agent/data/deployment.csv +26 -0
- package/dist/assets/.shared/stacks-agent/data/security-patterns.csv +16 -0
- package/dist/assets/.shared/stacks-agent/data/stacking.csv +16 -0
- package/dist/assets/.shared/stacks-agent/data/stacks-js.csv +31 -0
- package/dist/assets/.shared/stacks-agent/scripts/core.py +165 -0
- package/dist/assets/.shared/stacks-agent/scripts/search.py +62 -0
- package/dist/assets/.windsurf/workflows/stacks-agent.md +58 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +53 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +31 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/versions.d.ts +2 -0
- package/dist/commands/versions.d.ts.map +1 -0
- package/dist/commands/versions.js +33 -0
- package/dist/commands/versions.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
id,protocol,category,name,description,contract_address,function_signature,example,docs_url
|
|
2
|
+
1,alex,swap,swap-helper,"Swap tokens via Alex","SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-swap-pool-v1-1","(swap-helper token-x token-y factor-x factor-y dx min-dy)","(contract-call? .amm-swap-pool-v1-1 swap-helper .token-wstx .age000-governance-token u100000000 u100000000 u1000000 u1)","https://docs.alexlab.co"
|
|
3
|
+
2,alex,pool,get-pool-details,"Get pool info","SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-swap-pool-v1-1","(get-pool-details token-x token-y)","(contract-call? .amm-swap-pool-v1-1 get-pool-details .token-wstx .age000-governance-token)","https://docs.alexlab.co"
|
|
4
|
+
3,alex,liquidity,add-to-position,"Add liquidity to Alex","SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-swap-pool-v1-1","(add-to-position token-x token-y factor-x factor-y dx)","(contract-call? .amm-swap-pool-v1-1 add-to-position .token-wstx .age000-governance-token u100000000 u100000000 u1000000)","https://docs.alexlab.co"
|
|
5
|
+
4,velar,swap,swap-exact-tokens,"Swap on Velar","SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.univ2-router","(swap-exact-tokens-for-tokens amount-in min-out path)","(contract-call? .univ2-router swap-exact-tokens-for-tokens u1000000 u950000 (list .token-a .token-b))","https://docs.velar.co"
|
|
6
|
+
5,velar,liquidity,add-liquidity,"Add liquidity to Velar","SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.univ2-router","(add-liquidity token-a token-b amount-a amount-b min-a min-b)","(contract-call? .univ2-router add-liquidity .token-a .token-b u1000000 u1000000 u900000 u900000)","https://docs.velar.co"
|
|
7
|
+
6,velar,liquidity,remove-liquidity,"Remove liquidity from Velar","SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.univ2-router","(remove-liquidity token-a token-b liquidity min-a min-b)","(contract-call? .univ2-router remove-liquidity .token-a .token-b u1000000 u900000 u900000)","https://docs.velar.co"
|
|
8
|
+
7,bitflow,swap,swap-stx-for-token,"Swap STX for tokens","SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.swap-helper-v1-03","(swap-helper token-in token-out amt-in min-out)","(contract-call? .swap-helper-v1-03 swap-helper .wstx .token-out u1000000 u950000)","https://docs.bitflow.finance"
|
|
9
|
+
8,bitflow,swap,swap-token-for-stx,"Swap tokens for STX","SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.swap-helper-v1-03","(swap-helper token-in token-out amt-in min-out)","(contract-call? .swap-helper-v1-03 swap-helper .token-in .wstx u1000000 u950000)","https://docs.bitflow.finance"
|
|
10
|
+
9,zest,supply,supply-asset,"Supply collateral to Zest","SP2VCQJGH7PHP2DJK7Z0V48AGBHQAW3R3ZW1QF4N.pool-v1-0","(add-asset pool-id asset amount)","(contract-call? .pool-v1-0 add-asset u0 .sbtc u1000000)","https://docs.zestprotocol.com"
|
|
11
|
+
10,zest,borrow,borrow-asset,"Borrow from Zest","SP2VCQJGH7PHP2DJK7Z0V48AGBHQAW3R3ZW1QF4N.pool-v1-0","(drawdown pool-id lp-token amount)","(contract-call? .pool-v1-0 drawdown u0 .lp-token u500000)","https://docs.zestprotocol.com"
|
|
12
|
+
11,zest,info,get-pool-data,"Get Zest pool info","SP2VCQJGH7PHP2DJK7Z0V48AGBHQAW3R3ZW1QF4N.pool-v1-0","(get-pool pool-id)","(contract-call? .pool-v1-0 get-pool u0)","https://docs.zestprotocol.com"
|
|
13
|
+
12,stackingdao,stake,deposit,"Stake STX for stSTX","SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-v1","(deposit amount)","(contract-call? .stacking-dao-core-v1 deposit u100000000)","https://docs.stackingdao.com"
|
|
14
|
+
13,stackingdao,unstake,withdraw,"Unstake stSTX for STX","SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-v1","(withdraw amount)","(contract-call? .stacking-dao-core-v1 withdraw u100000000)","https://docs.stackingdao.com"
|
|
15
|
+
14,boost,boost,boost-stx,"Boost STX earnings","SP2VCQJGH7PHP2DJK7Z0V48AGBHQAW3R3ZW1QF4N.pox-fast-pool-v2","(delegate-stx amount pox-addr)","(contract-call? .pox-fast-pool-v2 delegate-stx u100000000 pox-addr)","https://boost.stacks.co"
|
|
16
|
+
15,faktory,swap,swap-tokens,"Swap on Faktory","SPTF1TGKT2AF5EJ0ZN56T87J14XSRFR9JFPFG2QV.faktory-v2-01","(swap token-in token-out amt-in min-out)","(contract-call? .faktory-v2-01 swap .token-in .token-out u1000000 u950000)","https://fak.fun"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
id,network,step,description,command,notes
|
|
2
|
+
1,testnet,faucet,"Get testnet STX","Visit https://explorer.hiro.so/sandbox/faucet?chain=testnet","Free testnet tokens for testing"
|
|
3
|
+
2,testnet,check-syntax,"Check contract syntax","clarinet check","Local validation before deployment"
|
|
4
|
+
3,testnet,deploy-cli,"Deploy via Clarinet CLI","clarinet deployments apply -p deployments/default.testnet-plan.yaml","Requires Clarinet installed"
|
|
5
|
+
4,testnet,deploy-explorer,"Deploy via Hiro Explorer","Visit https://explorer.hiro.so/sandbox/deploy?chain=testnet","Paste contract code in browser"
|
|
6
|
+
5,testnet,verify,"Verify testnet deployment","Visit https://explorer.hiro.so/txid/{txid}?chain=testnet","Check transaction status"
|
|
7
|
+
6,testnet,call-function,"Call function on testnet","clarinet console (contract-call? .contract-name function-name args)","Test contract functionality"
|
|
8
|
+
7,mainnet,check-balance,"Ensure sufficient STX","stacks-cli balance {address}","Need ~0.5 STX for deployment fee"
|
|
9
|
+
8,mainnet,deploy-cli,"Deploy via Clarinet CLI","clarinet deployments apply -p deployments/default.mainnet-plan.yaml","~0.1-0.5 STX fee"
|
|
10
|
+
9,mainnet,deploy-explorer,"Deploy via Hiro Explorer","Visit https://explorer.hiro.so/sandbox/deploy?chain=mainnet","Connect Leather or Xverse wallet"
|
|
11
|
+
10,mainnet,verify,"Verify mainnet deployment","Visit https://explorer.hiro.so/txid/{txid}?chain=mainnet","Wait ~10 minutes for confirmation"
|
|
12
|
+
11,mainnet,contract-address,"Get contract address","SP{address}.{contract-name}","Format: deployer-address.contract-name"
|
|
13
|
+
12,both,clarinet-check,"Validate contract locally","clarinet check","Check syntax and type errors"
|
|
14
|
+
13,both,clarinet-test,"Run contract tests","clarinet test","Execute test suite"
|
|
15
|
+
14,both,clarinet-console,"Interactive REPL","clarinet console","Test functions interactively"
|
|
16
|
+
15,both,format-check,"Check code formatting","clarinet format --check","Ensure proper Clarity formatting"
|
|
17
|
+
16,devnet,start-devnet,"Start local devnet","clarinet integrate","Local blockchain for development"
|
|
18
|
+
17,devnet,deploy-local,"Deploy to local devnet","clarinet deployments apply -p deployments/default.devnet-plan.yaml","Test on local chain"
|
|
19
|
+
18,tools,install-clarinet,"Install Clarinet CLI","brew install clarinet (macOS) or visit https://github.com/hirosystems/clarinet","Required for local development"
|
|
20
|
+
19,tools,install-stacks-cli,"Install Stacks CLI","npm install -g @stacks/cli","Command-line tool for Stacks"
|
|
21
|
+
20,verification,read-contract,"Read deployed contract","https://api.hiro.so/v2/contracts/interface/{address}/{name}","Get contract ABI and source"
|
|
22
|
+
21,verification,call-read-only,"Test read-only function","curl https://api.hiro.so/v2/contracts/call-read/{address}/{name}/{function}","Call without transaction"
|
|
23
|
+
22,security,audit-checklist,"Security audit checklist","Review access controls input validation error handling reentrancy","Pre-deployment security review"
|
|
24
|
+
23,security,testnet-first,"Always test on testnet first","Deploy to testnet -> test thoroughly -> then deploy to mainnet","Prevent costly mainnet mistakes"
|
|
25
|
+
24,monitoring,setup-alerts,"Monitor contract activity","Use Hiro Platform or custom indexer","Track contract calls and events"
|
|
26
|
+
25,post-deployment,verify-source,"Publish verified source","Submit to Hiro Explorer or blockchain explorers","Increase contract transparency and trust"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
id,severity,category,name,description,vulnerable_code,secure_code,explanation
|
|
2
|
+
1,critical,access,missing-sender-check,"No tx-sender validation","(define-public (withdraw (amount uint)) (stx-transfer? amount (as-contract tx-sender) recipient))","(define-public (withdraw (amount uint)) (begin (asserts! (is-eq tx-sender owner) ERR-UNAUTHORIZED) (stx-transfer? amount (as-contract tx-sender) tx-sender)))","Always verify tx-sender for sensitive operations"
|
|
3
|
+
2,critical,access,missing-owner-check,"Owner-only function not protected","(define-public (set-fee (new-fee uint)) (ok (var-set fee new-fee)))","(define-public (set-fee (new-fee uint)) (begin (asserts! (is-eq tx-sender (var-get owner)) ERR-UNAUTHORIZED) (ok (var-set fee new-fee))))","Admin functions must check ownership"
|
|
4
|
+
3,critical,errors,unchecked-transfer,"Transfer without error handling","(stx-transfer? amount tx-sender recipient)","(try! (stx-transfer? amount tx-sender recipient))","Always check transfer return values with try! or unwrap!"
|
|
5
|
+
4,high,reentrancy,state-after-call,"State updated after external call","(begin (contract-call? .other transfer) (var-set balance u0))","(begin (var-set balance u0) (contract-call? .other transfer))","Update state before external calls to prevent reentrancy"
|
|
6
|
+
5,high,arithmetic,unchecked-subtraction,"Subtraction can underflow","(- balance amount)","(if (>= balance amount) (- balance amount) u0)","Check before subtracting uints to prevent underflow"
|
|
7
|
+
6,high,arithmetic,division-by-zero,"No zero divisor check","(/ total count)","(if (> count u0) (/ total count) u0)","Always check divisor > 0 before division"
|
|
8
|
+
7,high,validation,missing-amount-check,"Zero amount not validated","(define-public (transfer (amount uint)) ...)","(begin (asserts! (> amount u0) ERR-INVALID-AMOUNT) ...)","Reject zero amounts to prevent useless transactions"
|
|
9
|
+
8,medium,validation,missing-address-check,"Self-transfer not prevented","(ft-transfer? token amount sender recipient)","(begin (asserts! (not (is-eq sender recipient)) ERR-SELF-TRANSFER) (ft-transfer? token amount sender recipient))","Prevent sender = recipient to avoid bugs"
|
|
10
|
+
9,medium,access,unprotected-mint,"Anyone can mint tokens","(define-public (mint (amount uint)) (ft-mint? token amount tx-sender))","(define-public (mint (amount uint)) (begin (asserts! (is-eq tx-sender minter) ERR-UNAUTHORIZED) (ft-mint? token amount tx-sender)))","Restrict minting to authorized addresses only"
|
|
11
|
+
10,medium,access,tx-sender-vs-caller,"Wrong sender check","(asserts! (is-eq contract-caller owner) ERR-UNAUTHORIZED)","(asserts! (is-eq tx-sender owner) ERR-UNAUTHORIZED)","Use tx-sender for auth not contract-caller"
|
|
12
|
+
11,low,gas,unbounded-loop,"Loop without size limit","(map process-item (list-get items))","(begin (asserts! (<= (len items) u100) ERR-TOO-MANY) (map process-item items))","Limit iteration count to prevent excessive gas"
|
|
13
|
+
12,low,clarity,magic-numbers,"Hardcoded values","(if (> fee u100) ...)","(define-constant MAX-FEE u100) (if (> fee MAX-FEE) ...)","Use named constants for clarity and maintainability"
|
|
14
|
+
13,low,style,missing-error-constant,"Inline error codes","(err u100)","(define-constant ERR-UNAUTHORIZED (err u100))","Define error codes as named constants"
|
|
15
|
+
14,informational,docs,missing-comments,"No function documentation","(define-public (transfer (amount uint)) ...)",";;@desc Transfer tokens\n(define-public (transfer (amount uint)) ...)","Add comments to explain function purpose"
|
|
16
|
+
15,informational,naming,non-kebab-case,"Wrong naming convention","(define-public (transferTokens ...)","(define-public (transfer-tokens ...)","Use kebab-case for all identifiers"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
id,category,name,description,code,contract,notes
|
|
2
|
+
1,info,get-pox-info,"Get current PoX cycle info","(contract-call? .pox-4 get-pox-info)","SP000000000000000000002Q6VF78.pox-4","Returns cycle number reward-cycle-length prepare-cycle-length min-threshold"
|
|
3
|
+
2,info,get-stacker-info,"Get stacker status","(contract-call? .pox-4 get-stacker-info stacker)","SP000000000000000000002Q6VF78.pox-4","Returns lock-period pox-addr start-burn-ht unlock-burn-ht"
|
|
4
|
+
3,stack,stack-stx,"Stack STX directly","(contract-call? .pox-4 stack-stx amount-ustx pox-addr start-burn-ht lock-period)","SP000000000000000000002Q6VF78.pox-4","Minimum 100000 STX (100000000000 microSTX)"
|
|
5
|
+
4,stack,stack-increase,"Increase stacked amount","(contract-call? .pox-4 stack-increase increase-by)","SP000000000000000000002Q6VF78.pox-4","Add more STX to existing stack"
|
|
6
|
+
5,stack,stack-extend,"Extend stacking period","(contract-call? .pox-4 stack-extend extend-count pox-addr)","SP000000000000000000002Q6VF78.pox-4","Extend lock period by cycles"
|
|
7
|
+
6,delegate,delegate-stx,"Delegate to pool operator","(contract-call? .pox-4 delegate-stx amount-ustx delegate-to until-burn-ht pox-addr)","SP000000000000000000002Q6VF78.pox-4","Pool will stack on your behalf"
|
|
8
|
+
7,delegate,revoke-delegate,"Revoke delegation","(contract-call? .pox-4 revoke-delegate-stx)","SP000000000000000000002Q6VF78.pox-4","Cancel delegation after unlock"
|
|
9
|
+
8,pool,fast-pool-delegate,"Delegate to Fast Pool","(contract-call? 'SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP.pox4-fast-pool-v3 delegate-stx amount)","SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP.pox4-fast-pool-v3","Popular community pool ~8% APY"
|
|
10
|
+
9,pool,planbetter-pool,"Delegate to PlanBetter Pool","(contract-call? 'SP1K1A1PMGW2ZJCNF46NWZWHG8TS1D23EGH1KNK60.pox4-pools delegate amount)","SP1K1A1PMGW2ZJCNF46NWZWHG8TS1D23EGH1KNK60.pox4-pools","Community pool variable APY"
|
|
11
|
+
10,pool,stackingdao-deposit,"Deposit to StackingDAO","(contract-call? 'SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-v1 deposit amount)","SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.stacking-dao-core-v1","Get stSTX liquid stacking token"
|
|
12
|
+
11,rewards,get-reward-info,"Get stacking rewards","(contract-call? .pox-4 get-stacking-minimum)","SP000000000000000000002Q6VF78.pox-4","Returns minimum STX to stack"
|
|
13
|
+
12,address,create-pox-address,"Create PoX BTC address","{ version: (buff 1) hashbytes: (buff 32) }","N/A","Tuple for BTC reward address (version 0x00-0x06)"
|
|
14
|
+
13,cycle,get-current-cycle,"Get current reward cycle","(contract-call? .pox-4 current-pox-reward-cycle)","SP000000000000000000002Q6VF78.pox-4","Returns current cycle number"
|
|
15
|
+
14,cycle,burn-height-to-cycle,"Convert block to cycle","(contract-call? .pox-4 burn-height-to-reward-cycle height)","SP000000000000000000002Q6VF78.pox-4","Get cycle number from block height"
|
|
16
|
+
15,status,check-delegation,"Check delegation status","(contract-call? .pox-4 get-delegation-info stacker)","SP000000000000000000002Q6VF78.pox-4","Returns amount-ustx delegated-to until-burn-ht pox-addr"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
id,category,name,description,code,imports,notes
|
|
2
|
+
1,wallet,connect-wallet,"Connect to Leather/Xverse","const userData = await showConnect({ appDetails onFinish: (data) => setUser(data) userSession })","import { showConnect } from '@stacks/connect'","Returns user session with address and profile"
|
|
3
|
+
2,wallet,get-address,"Get user's STX address","const address = userSession.loadUserData().profile.stxAddress.mainnet","import { AppConfig UserSession } from '@stacks/auth'","mainnet or testnet property"
|
|
4
|
+
3,wallet,disconnect,"Disconnect wallet","userSession.signUserOut()","import { UserSession } from '@stacks/auth'","Clears local session data"
|
|
5
|
+
4,transaction,stx-transfer,"Transfer STX","await makeSTXTokenTransfer({ recipient amount senderKey network anchorMode: AnchorMode.Any })","import { makeSTXTokenTransfer AnchorMode } from '@stacks/transactions'","Amount in microSTX (1 STX = 1000000 microSTX)"
|
|
6
|
+
5,transaction,contract-call,"Call contract function","await makeContractCall({ contractAddress contractName functionName functionArgs senderKey network anchorMode: AnchorMode.Any })","import { makeContractCall AnchorMode } from '@stacks/transactions'","Use cv.* constructors for functionArgs"
|
|
7
|
+
6,transaction,deploy-contract,"Deploy Clarity contract","await makeContractDeploy({ contractName codeBody senderKey network anchorMode: AnchorMode.Any })","import { makeContractDeploy AnchorMode } from '@stacks/transactions'","codeBody is Clarity code as string"
|
|
8
|
+
7,transaction,broadcast-tx,"Broadcast transaction","const txid = await broadcastTransaction(transaction network)","import { broadcastTransaction } from '@stacks/transactions'","Returns transaction ID"
|
|
9
|
+
8,clarity-values,uint,"Create Clarity uint","uintCV(100)","import { uintCV } from '@stacks/transactions'","For uint function arguments"
|
|
10
|
+
9,clarity-values,int,"Create Clarity int","intCV(-100)","import { intCV } from '@stacks/transactions'","For int function arguments"
|
|
11
|
+
10,clarity-values,principal,"Create Clarity principal","principalCV('SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR')","import { principalCV } from '@stacks/transactions'","Standard or contract principal"
|
|
12
|
+
11,clarity-values,string-ascii,"Create Clarity ASCII string","stringAsciiCV('hello world')","import { stringAsciiCV } from '@stacks/transactions'","ASCII characters only"
|
|
13
|
+
12,clarity-values,string-utf8,"Create Clarity UTF-8 string","stringUtf8CV('hello 世界')","import { stringUtf8CV } from '@stacks/transactions'","Supports Unicode characters"
|
|
14
|
+
13,clarity-values,buffer,"Create Clarity buffer","bufferCV(Buffer.from('data'))","import { bufferCV } from '@stacks/transactions'","Node.js Buffer or Uint8Array"
|
|
15
|
+
14,clarity-values,tuple,"Create Clarity tuple","tupleCV({ name: stringAsciiCV('test') value: uintCV(100) })","import { tupleCV stringAsciiCV uintCV } from '@stacks/transactions'","Object with CV values"
|
|
16
|
+
15,clarity-values,list,"Create Clarity list","listCV([uintCV(1) uintCV(2) uintCV(3)])","import { listCV uintCV } from '@stacks/transactions'","Array of CV values of same type"
|
|
17
|
+
16,clarity-values,some,"Create Clarity some value","someCV(uintCV(100))","import { someCV uintCV } from '@stacks/transactions'","Optional value present"
|
|
18
|
+
17,clarity-values,none,"Create Clarity none value","noneCV()","import { noneCV } from '@stacks/transactions'","Optional value absent"
|
|
19
|
+
18,clarity-values,ok-response,"Create Clarity ok response","responseOkCV(uintCV(100))","import { responseOkCV uintCV } from '@stacks/transactions'","Success response"
|
|
20
|
+
19,clarity-values,err-response,"Create Clarity err response","responseErrorCV(uintCV(404))","import { responseErrorCV uintCV } from '@stacks/transactions'","Error response"
|
|
21
|
+
20,api,get-balance,"Get STX balance","const response = await fetch(`https://api.hiro.so/extended/v1/address/${address}/balances`)","fetch or axios","Returns STX balance and all token balances"
|
|
22
|
+
21,api,get-transactions,"Get address transactions","const response = await fetch(`https://api.hiro.so/extended/v1/address/${address}/transactions`)","fetch or axios","Paginated results with limit and offset"
|
|
23
|
+
22,api,get-contract-info,"Get contract info","const response = await fetch(`https://api.hiro.so/v2/contracts/interface/${address}/${contractName}`)","fetch or axios","Returns ABI and source code"
|
|
24
|
+
23,api,call-read-only,"Call read-only function","const result = await callReadOnlyFunction({ contractAddress contractName functionName functionArgs senderAddress network })","import { callReadOnlyFunction } from '@stacks/transactions'","No transaction needed for read-only calls"
|
|
25
|
+
24,api,get-transaction,"Get transaction by ID","const response = await fetch(`https://api.hiro.so/extended/v1/tx/${txid}`)","fetch or axios","Returns transaction details and status"
|
|
26
|
+
25,network,mainnet,"Mainnet config","new StacksMainnet()","import { StacksMainnet } from '@stacks/network'","Production network"
|
|
27
|
+
26,network,testnet,"Testnet config","new StacksTestnet()","import { StacksTestnet } from '@stacks/network'","Testing network"
|
|
28
|
+
27,network,devnet,"Devnet config","new StacksDevnet()","import { StacksDevnet } from '@stacks/network'","Local development"
|
|
29
|
+
28,post-conditions,stx-postcondition,"STX transfer post-condition","makeStandardSTXPostCondition(address FungibleConditionCode.Equal amount)","import { makeStandardSTXPostCondition FungibleConditionCode } from '@stacks/transactions'","Ensures exact STX amount transferred"
|
|
30
|
+
29,post-conditions,ft-postcondition,"FT transfer post-condition","makeStandardFungiblePostCondition(address FungibleConditionCode.Equal amount assetInfo)","import { makeStandardFungiblePostCondition FungibleConditionCode createAssetInfo } from '@stacks/transactions'","Ensures exact token amount transferred"
|
|
31
|
+
30,post-conditions,nft-postcondition,"NFT transfer post-condition","makeStandardNonFungiblePostCondition(address NonFungibleConditionCode.Sends assetInfo tokenId)","import { makeStandardNonFungiblePostCondition NonFungibleConditionCode createAssetInfo } from '@stacks/transactions'","Ensures NFT ownership transfer"
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Core search engine using BM25 ranking with regex matching
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import csv
|
|
6
|
+
import re
|
|
7
|
+
import math
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import List, Dict, Any, Optional
|
|
10
|
+
from collections import defaultdict
|
|
11
|
+
|
|
12
|
+
# Domain to CSV file mapping
|
|
13
|
+
DOMAINS = {
|
|
14
|
+
'clarity': 'clarity-syntax.csv',
|
|
15
|
+
'templates': 'contract-templates.csv',
|
|
16
|
+
'security': 'security-patterns.csv',
|
|
17
|
+
'defi': 'defi-protocols.csv',
|
|
18
|
+
'stacksjs': 'stacks-js.csv',
|
|
19
|
+
'bns': 'bns.csv',
|
|
20
|
+
'stacking': 'stacking.csv',
|
|
21
|
+
'deployment': 'deployment.csv'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# Auto-detection keywords
|
|
25
|
+
DOMAIN_KEYWORDS = {
|
|
26
|
+
'clarity': ['define', 'uint', 'principal', 'let', 'begin', 'asserts', 'unwrap', 'function', 'type', 'syntax'],
|
|
27
|
+
'templates': ['token', 'nft', 'sip-010', 'sip-009', 'vault', 'dao', 'template', 'contract'],
|
|
28
|
+
'security': ['vulnerability', 'security', 'audit', 'attack', 'safe', 'check', 'exploit'],
|
|
29
|
+
'defi': ['swap', 'pool', 'liquidity', 'alex', 'velar', 'bitflow', 'zest', 'borrow', 'lend', 'boost'],
|
|
30
|
+
'stacksjs': ['javascript', 'stacks.js', 'connect', 'wallet', 'frontend', 'react', 'typescript'],
|
|
31
|
+
'bns': ['bns', 'name', 'domain', '.btc', 'resolve', 'register'],
|
|
32
|
+
'stacking': ['stacking', 'pox', 'delegate', 'pool', 'reward', 'cycle', 'bitcoin'],
|
|
33
|
+
'deployment': ['deploy', 'mainnet', 'testnet', 'clarinet', 'devnet']
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class BM25:
|
|
38
|
+
"""BM25 ranking algorithm"""
|
|
39
|
+
|
|
40
|
+
def __init__(self, documents: List[str], k1: float = 1.5, b: float = 0.75):
|
|
41
|
+
self.k1 = k1
|
|
42
|
+
self.b = b
|
|
43
|
+
self.documents = documents
|
|
44
|
+
self.doc_len = [len(doc.split()) for doc in documents]
|
|
45
|
+
self.avgdl = sum(self.doc_len) / len(documents) if documents else 0
|
|
46
|
+
self.doc_freqs = self._calc_doc_freqs()
|
|
47
|
+
self.idf = self._calc_idf()
|
|
48
|
+
|
|
49
|
+
def _calc_doc_freqs(self) -> Dict[str, int]:
|
|
50
|
+
freqs = defaultdict(int)
|
|
51
|
+
for doc in self.documents:
|
|
52
|
+
for term in set(doc.lower().split()):
|
|
53
|
+
freqs[term] += 1
|
|
54
|
+
return freqs
|
|
55
|
+
|
|
56
|
+
def _calc_idf(self) -> Dict[str, float]:
|
|
57
|
+
idf = {}
|
|
58
|
+
n = len(self.documents)
|
|
59
|
+
for term, df in self.doc_freqs.items():
|
|
60
|
+
idf[term] = math.log((n - df + 0.5) / (df + 0.5) + 1)
|
|
61
|
+
return idf
|
|
62
|
+
|
|
63
|
+
def score(self, query: str, doc_idx: int) -> float:
|
|
64
|
+
score = 0.0
|
|
65
|
+
doc = self.documents[doc_idx].lower()
|
|
66
|
+
doc_terms = doc.split()
|
|
67
|
+
term_freqs = defaultdict(int)
|
|
68
|
+
for term in doc_terms:
|
|
69
|
+
term_freqs[term] += 1
|
|
70
|
+
|
|
71
|
+
for term in query.lower().split():
|
|
72
|
+
if term not in self.idf:
|
|
73
|
+
continue
|
|
74
|
+
tf = term_freqs[term]
|
|
75
|
+
idf = self.idf[term]
|
|
76
|
+
dl = self.doc_len[doc_idx]
|
|
77
|
+
score += idf * (tf * (self.k1 + 1)) / (tf + self.k1 * (1 - self.b + self.b * dl / self.avgdl))
|
|
78
|
+
|
|
79
|
+
return score
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def detect_domain(query: str) -> str:
|
|
83
|
+
"""Auto-detect domain based on query keywords"""
|
|
84
|
+
query_lower = query.lower()
|
|
85
|
+
scores = {}
|
|
86
|
+
|
|
87
|
+
for domain, keywords in DOMAIN_KEYWORDS.items():
|
|
88
|
+
score = sum(1 for kw in keywords if kw in query_lower)
|
|
89
|
+
if score > 0:
|
|
90
|
+
scores[domain] = score
|
|
91
|
+
|
|
92
|
+
if scores:
|
|
93
|
+
return max(scores, key=scores.get)
|
|
94
|
+
return 'templates' # Default to templates
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def load_data(domain: str) -> List[Dict[str, Any]]:
|
|
98
|
+
"""Load CSV data for a domain"""
|
|
99
|
+
data_dir = Path(__file__).parent.parent / 'data'
|
|
100
|
+
csv_file = data_dir / DOMAINS[domain]
|
|
101
|
+
|
|
102
|
+
if not csv_file.exists():
|
|
103
|
+
return []
|
|
104
|
+
|
|
105
|
+
with open(csv_file, 'r', encoding='utf-8') as f:
|
|
106
|
+
reader = csv.DictReader(f)
|
|
107
|
+
return list(reader)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def search(
|
|
111
|
+
query: str,
|
|
112
|
+
domain: str = 'auto',
|
|
113
|
+
max_results: int = 5
|
|
114
|
+
) -> List[Dict[str, Any]]:
|
|
115
|
+
"""
|
|
116
|
+
Search knowledge base using BM25 + regex
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
query: Search query
|
|
120
|
+
domain: Domain to search or 'auto' for auto-detection
|
|
121
|
+
max_results: Maximum results to return
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
List of matching records
|
|
125
|
+
"""
|
|
126
|
+
# Auto-detect domain if needed
|
|
127
|
+
if domain == 'auto':
|
|
128
|
+
domain = detect_domain(query)
|
|
129
|
+
|
|
130
|
+
# Load data
|
|
131
|
+
data = load_data(domain)
|
|
132
|
+
if not data:
|
|
133
|
+
return []
|
|
134
|
+
|
|
135
|
+
# Create searchable text for each record
|
|
136
|
+
def record_to_text(record: Dict) -> str:
|
|
137
|
+
return ' '.join(str(v) for v in record.values())
|
|
138
|
+
|
|
139
|
+
documents = [record_to_text(r) for r in data]
|
|
140
|
+
|
|
141
|
+
# BM25 scoring
|
|
142
|
+
bm25 = BM25(documents)
|
|
143
|
+
scores = [(i, bm25.score(query, i)) for i in range(len(documents))]
|
|
144
|
+
|
|
145
|
+
# Regex boost for exact matches
|
|
146
|
+
try:
|
|
147
|
+
query_pattern = re.compile(re.escape(query), re.IGNORECASE)
|
|
148
|
+
for i, (idx, score) in enumerate(scores):
|
|
149
|
+
if query_pattern.search(documents[idx]):
|
|
150
|
+
scores[i] = (idx, score * 2) # Boost exact matches
|
|
151
|
+
except re.error:
|
|
152
|
+
pass # Skip regex boost if pattern is invalid
|
|
153
|
+
|
|
154
|
+
# Sort by score and return top results
|
|
155
|
+
scores.sort(key=lambda x: x[1], reverse=True)
|
|
156
|
+
|
|
157
|
+
results = []
|
|
158
|
+
for idx, score in scores[:max_results]:
|
|
159
|
+
if score > 0:
|
|
160
|
+
result = data[idx].copy()
|
|
161
|
+
result['_score'] = round(score, 3)
|
|
162
|
+
result['_domain'] = domain
|
|
163
|
+
results.append(result)
|
|
164
|
+
|
|
165
|
+
return results
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Stacks Agent Skill - Search Engine
|
|
4
|
+
BM25 + regex hybrid search across knowledge databases
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
# Add parent directory to path for imports
|
|
12
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
13
|
+
|
|
14
|
+
from core import search, DOMAINS
|
|
15
|
+
|
|
16
|
+
def main():
|
|
17
|
+
parser = argparse.ArgumentParser(
|
|
18
|
+
description='Search Stacks Agent knowledge base'
|
|
19
|
+
)
|
|
20
|
+
parser.add_argument('query', help='Search query')
|
|
21
|
+
parser.add_argument(
|
|
22
|
+
'--domain', '-d',
|
|
23
|
+
choices=list(DOMAINS.keys()) + ['auto'],
|
|
24
|
+
default='auto',
|
|
25
|
+
help='Domain to search (default: auto-detect)'
|
|
26
|
+
)
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
'--max-results', '-n',
|
|
29
|
+
type=int,
|
|
30
|
+
default=5,
|
|
31
|
+
help='Maximum results to return (default: 5)'
|
|
32
|
+
)
|
|
33
|
+
parser.add_argument(
|
|
34
|
+
'--format', '-f',
|
|
35
|
+
choices=['text', 'json'],
|
|
36
|
+
default='text',
|
|
37
|
+
help='Output format (default: text)'
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
args = parser.parse_args()
|
|
41
|
+
|
|
42
|
+
results = search(
|
|
43
|
+
query=args.query,
|
|
44
|
+
domain=args.domain,
|
|
45
|
+
max_results=args.max_results
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
if args.format == 'json':
|
|
49
|
+
import json
|
|
50
|
+
print(json.dumps(results, indent=2))
|
|
51
|
+
else:
|
|
52
|
+
if not results:
|
|
53
|
+
print(f"No results found for: {args.query}")
|
|
54
|
+
else:
|
|
55
|
+
for i, result in enumerate(results, 1):
|
|
56
|
+
print(f"\n--- Result {i} (Score: {result.get('_score', 0)}) ---")
|
|
57
|
+
for key, value in result.items():
|
|
58
|
+
if not key.startswith('_'):
|
|
59
|
+
print(f"{key}: {value}")
|
|
60
|
+
|
|
61
|
+
if __name__ == '__main__':
|
|
62
|
+
main()
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Stacks Agent - Windsurf Workflow
|
|
2
|
+
|
|
3
|
+
AI-powered intelligence for building Stacks blockchain applications.
|
|
4
|
+
|
|
5
|
+
## Workflow Trigger
|
|
6
|
+
This workflow activates for Stacks blockchain development tasks.
|
|
7
|
+
|
|
8
|
+
## Capabilities
|
|
9
|
+
|
|
10
|
+
- **Clarity Contracts**: Generate, audit, and deploy smart contracts
|
|
11
|
+
- **Token Standards**: SIP-010 (fungible) and SIP-009 (NFT) templates
|
|
12
|
+
- **DeFi Integration**: Alex, Velar, Bitflow, Zest, Boost, Faktory
|
|
13
|
+
- **Security Analysis**: Vulnerability detection and best practices
|
|
14
|
+
- **Stacks.js**: Frontend integration code snippets
|
|
15
|
+
- **BNS**: Bitcoin Name System operations
|
|
16
|
+
- **Stacking**: PoX stacking and pool delegation
|
|
17
|
+
|
|
18
|
+
## Knowledge Search
|
|
19
|
+
|
|
20
|
+
Search the knowledge base with:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python3 .shared/stacks-agent/scripts/search.py "<query>" --domain <domain>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Domains**: clarity, templates, security, defi, stacksjs, bns, stacking, deployment
|
|
27
|
+
|
|
28
|
+
## Process
|
|
29
|
+
|
|
30
|
+
1. Analyze user request for contract type and requirements
|
|
31
|
+
2. Search knowledge base for relevant patterns
|
|
32
|
+
3. Generate code following Clarity best practices
|
|
33
|
+
4. Apply security checks and validations
|
|
34
|
+
5. Provide network-appropriate deployment guide
|
|
35
|
+
|
|
36
|
+
## Security Checks
|
|
37
|
+
|
|
38
|
+
Always verify:
|
|
39
|
+
- Access control (tx-sender validation)
|
|
40
|
+
- Error handling (try! unwrap!)
|
|
41
|
+
- Input validation (asserts!)
|
|
42
|
+
- Network trait compatibility
|
|
43
|
+
- Arithmetic safety
|
|
44
|
+
|
|
45
|
+
## Networks
|
|
46
|
+
|
|
47
|
+
- **Mainnet**: SP... addresses (production)
|
|
48
|
+
- **Testnet**: ST... addresses (testing)
|
|
49
|
+
- **Devnet**: Local with Clarinet
|
|
50
|
+
|
|
51
|
+
## Key Resources
|
|
52
|
+
|
|
53
|
+
- Stacks Docs: https://docs.stacks.co
|
|
54
|
+
- Clarity Reference: https://docs.stacks.co/clarity
|
|
55
|
+
- Hiro Explorer: https://explorer.hiro.so
|
|
56
|
+
|
|
57
|
+
## Version
|
|
58
|
+
1.0.0 by kai-builder
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAeA,wBAAsB,IAAI,CAAC,OAAO,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,iBAsCpF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.init = init;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const PLATFORMS = {
|
|
11
|
+
claude: ['.claude/skills/stacks-agent'],
|
|
12
|
+
cursor: ['.cursor/commands', '.shared/stacks-agent'],
|
|
13
|
+
windsurf: ['.windsurf/workflows', '.shared/stacks-agent'],
|
|
14
|
+
antigravity: ['.agent/workflows', '.shared/stacks-agent'],
|
|
15
|
+
copilot: ['.github/prompts', '.shared/stacks-agent'],
|
|
16
|
+
kiro: ['.kiro/steering', '.shared/stacks-agent'],
|
|
17
|
+
codex: ['.codex/skills/stacks-agent'],
|
|
18
|
+
all: [] // Special case: all platforms
|
|
19
|
+
};
|
|
20
|
+
async function init(options) {
|
|
21
|
+
const { ai, force } = options;
|
|
22
|
+
const cwd = process.cwd();
|
|
23
|
+
console.log(chalk_1.default.blue(`\n🚀 Installing Stacks Agent skill for ${ai}...\n`));
|
|
24
|
+
const platforms = ai === 'all'
|
|
25
|
+
? Object.keys(PLATFORMS).filter(p => p !== 'all')
|
|
26
|
+
: [ai];
|
|
27
|
+
for (const platform of platforms) {
|
|
28
|
+
const folders = PLATFORMS[platform];
|
|
29
|
+
for (const folder of folders) {
|
|
30
|
+
const srcPath = path_1.default.join(__dirname, '../assets', folder);
|
|
31
|
+
const destPath = path_1.default.join(cwd, folder);
|
|
32
|
+
if (fs_extra_1.default.existsSync(destPath) && !force) {
|
|
33
|
+
console.log(chalk_1.default.yellow(` ⚠️ ${folder} already exists (use --force to overwrite)`));
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
await fs_extra_1.default.copy(srcPath, destPath);
|
|
38
|
+
console.log(chalk_1.default.green(` ✅ Copied ${folder}`));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.log(chalk_1.default.red(` ❌ Failed to copy ${folder}: ${error}`));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
console.log(chalk_1.default.blue(`\n✨ Stacks Agent skill installed successfully!\n`));
|
|
46
|
+
console.log(chalk_1.default.gray('Usage:'));
|
|
47
|
+
console.log(chalk_1.default.gray(' Claude Code: Skill activates automatically on Stacks tasks'));
|
|
48
|
+
console.log(chalk_1.default.gray(' Cursor/Windsurf: Use /stacksagent command'));
|
|
49
|
+
console.log(chalk_1.default.gray(' Copilot: Use @stacksagent in chat\n'));
|
|
50
|
+
console.log(chalk_1.default.gray('Search knowledge base:'));
|
|
51
|
+
console.log(chalk_1.default.gray(' python3 .claude/skills/stacks-agent/scripts/search.py "query"\n'));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAMA,wBAAsB,MAAM,kBAsB3B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.update = update;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const util_1 = require("util");
|
|
10
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
11
|
+
async function update() {
|
|
12
|
+
console.log(chalk_1.default.blue('\n🔄 Checking for updates...\n'));
|
|
13
|
+
try {
|
|
14
|
+
// Check current version
|
|
15
|
+
const { stdout: currentVersion } = await execAsync('npm list -g stacks-agent --depth=0');
|
|
16
|
+
console.log(chalk_1.default.gray(`Current version: ${currentVersion.trim()}`));
|
|
17
|
+
// Check latest version
|
|
18
|
+
const { stdout: latestVersion } = await execAsync('npm view stacks-agent version');
|
|
19
|
+
console.log(chalk_1.default.gray(`Latest version: ${latestVersion.trim()}\n`));
|
|
20
|
+
// Update
|
|
21
|
+
console.log(chalk_1.default.blue('Installing latest version...'));
|
|
22
|
+
await execAsync('npm install -g stacks-agent@latest');
|
|
23
|
+
console.log(chalk_1.default.green('\n✅ Successfully updated to latest version!\n'));
|
|
24
|
+
console.log(chalk_1.default.gray('Run "stacks-agent init" in your project to update skill files.\n'));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.log(chalk_1.default.red(`\n❌ Update failed: ${error}\n`));
|
|
28
|
+
console.log(chalk_1.default.gray('Try running: npm install -g stacks-agent@latest\n'));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":";;;;;AAMA,wBAsBC;AA5BD,kDAA0B;AAC1B,iDAAqC;AACrC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAE3B,KAAK,UAAU,MAAM;IAC1B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAE1D,IAAI,CAAC;QACH,wBAAwB;QACxB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,SAAS,CAAC,oCAAoC,CAAC,CAAC;QACzF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oBAAoB,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QAErE,uBAAuB;QACvB,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,SAAS,CAAC,+BAA+B,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,mBAAmB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAErE,SAAS;QACT,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;QACxD,MAAM,SAAS,CAAC,oCAAoC,CAAC,CAAC;QAEtD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC,CAAC;IAC9F,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,sBAAsB,KAAK,IAAI,CAAC,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/commands/versions.ts"],"names":[],"mappings":"AAMA,wBAAsB,QAAQ,kBAuB7B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.versions = versions;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const util_1 = require("util");
|
|
10
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
11
|
+
async function versions() {
|
|
12
|
+
console.log(chalk_1.default.blue('\n📦 Stacks Agent versions:\n'));
|
|
13
|
+
try {
|
|
14
|
+
const { stdout } = await execAsync('npm view stacks-agent versions --json');
|
|
15
|
+
const versionList = JSON.parse(stdout);
|
|
16
|
+
console.log(chalk_1.default.gray('Available versions:'));
|
|
17
|
+
versionList.slice(-10).forEach((v) => {
|
|
18
|
+
console.log(chalk_1.default.green(` • ${v}`));
|
|
19
|
+
});
|
|
20
|
+
if (versionList.length > 10) {
|
|
21
|
+
console.log(chalk_1.default.gray(` ... and ${versionList.length - 10} more\n`));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log('');
|
|
25
|
+
}
|
|
26
|
+
console.log(chalk_1.default.gray('Install specific version:'));
|
|
27
|
+
console.log(chalk_1.default.gray(' npm install -g stacks-agent@<version>\n'));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.log(chalk_1.default.red(`\n❌ Failed to fetch versions: ${error}\n`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/commands/versions.ts"],"names":[],"mappings":";;;;;AAMA,4BAuBC;AA7BD,kDAA0B;AAC1B,iDAAqC;AACrC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAE3B,KAAK,UAAU,QAAQ;IAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAEzD,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,uCAAuC,CAAC,CAAC;QAC5E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEvC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC/C,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE;YAC3C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,IAAI,WAAW,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,aAAa,WAAW,CAAC,MAAM,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;QACzE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,iCAAiC,KAAK,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const init_1 = require("./commands/init");
|
|
6
|
+
const update_1 = require("./commands/update");
|
|
7
|
+
const versions_1 = require("./commands/versions");
|
|
8
|
+
const program = new commander_1.Command();
|
|
9
|
+
program
|
|
10
|
+
.name('stacksagent')
|
|
11
|
+
.description('AI Skill for building Stacks blockchain applications')
|
|
12
|
+
.version('1.0.0');
|
|
13
|
+
program
|
|
14
|
+
.command('init')
|
|
15
|
+
.description('Initialize Stacks Agent skill in your project')
|
|
16
|
+
.option('--ai <platform>', 'AI platform (claude, cursor, windsurf, antigravity, copilot, kiro, codex, all)', 'claude')
|
|
17
|
+
.option('--version <version>', 'Specific version to install')
|
|
18
|
+
.option('--force', 'Overwrite existing files')
|
|
19
|
+
.action(init_1.init);
|
|
20
|
+
program
|
|
21
|
+
.command('update')
|
|
22
|
+
.description('Update to the latest version')
|
|
23
|
+
.action(update_1.update);
|
|
24
|
+
program
|
|
25
|
+
.command('versions')
|
|
26
|
+
.description('List available versions')
|
|
27
|
+
.action(versions_1.versions);
|
|
28
|
+
program.parse();
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,0CAAuC;AACvC,8CAA2C;AAC3C,kDAA+C;AAE/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,sDAAsD,CAAC;KACnE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,+CAA+C,CAAC;KAC5D,MAAM,CAAC,iBAAiB,EAAE,gFAAgF,EAAE,QAAQ,CAAC;KACrH,MAAM,CAAC,qBAAqB,EAAE,6BAA6B,CAAC;KAC5D,MAAM,CAAC,SAAS,EAAE,0BAA0B,CAAC;KAC7C,MAAM,CAAC,WAAI,CAAC,CAAC;AAEhB,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,8BAA8B,CAAC;KAC3C,MAAM,CAAC,eAAM,CAAC,CAAC;AAElB,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,mBAAQ,CAAC,CAAC;AAEpB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|