paytaca-cli 0.3.1 → 0.4.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 +23 -5
- package/dist/commands/chat.d.ts +3 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +592 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/nostr/chat.d.ts +42 -0
- package/dist/nostr/chat.d.ts.map +1 -0
- package/dist/nostr/chat.js +72 -0
- package/dist/nostr/chat.js.map +1 -0
- package/dist/nostr/chat.test.d.ts +2 -0
- package/dist/nostr/chat.test.d.ts.map +1 -0
- package/dist/nostr/chat.test.js +121 -0
- package/dist/nostr/chat.test.js.map +1 -0
- package/dist/nostr/keys.d.ts +8 -0
- package/dist/nostr/keys.d.ts.map +1 -0
- package/dist/nostr/keys.js +22 -0
- package/dist/nostr/keys.js.map +1 -0
- package/dist/nostr/relay.d.ts +47 -0
- package/dist/nostr/relay.d.ts.map +1 -0
- package/dist/nostr/relay.js +370 -0
- package/dist/nostr/relay.js.map +1 -0
- package/dist/nostr/store.d.ts +75 -0
- package/dist/nostr/store.d.ts.map +1 -0
- package/dist/nostr/store.js +410 -0
- package/dist/nostr/store.js.map +1 -0
- package/dist/nostr/store.test.d.ts +2 -0
- package/dist/nostr/store.test.d.ts.map +1 -0
- package/dist/nostr/store.test.js +448 -0
- package/dist/nostr/store.test.js.map +1 -0
- package/package.json +2 -1
- package/skills/README.md +68 -0
- package/skills/paytaca-send/SKILL.md +159 -0
- package/skills/paytaca-wallet/SKILL.md +155 -0
- package/dist/commands/claude.d.ts +0 -9
- package/dist/commands/claude.d.ts.map +0 -1
- package/dist/commands/claude.js +0 -20
- package/dist/commands/claude.js.map +0 -1
- package/dist/commands/opencode.d.ts +0 -9
- package/dist/commands/opencode.d.ts.map +0 -1
- package/dist/commands/opencode.js +0 -20
- package/dist/commands/opencode.js.map +0 -1
- package/dist/utils/skill.d.ts +0 -17
- package/dist/utils/skill.d.ts.map +0 -1
- package/dist/utils/skill.js +0 -100
- package/dist/utils/skill.js.map +0 -1
- /package/skills/{paytaca → paytaca-x402}/SKILL.md +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: paytaca-send
|
|
3
|
+
description: Send BCH and CashTokens from the wallet. REQUIRES USER APPROVAL before any sending operation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Paytaca Send
|
|
7
|
+
|
|
8
|
+
This skill handles sending BCH and CashTokens. **All sending operations require explicit user approval before execution.**
|
|
9
|
+
|
|
10
|
+
## ⚠️ User Approval Required
|
|
11
|
+
|
|
12
|
+
**CRITICAL**: The agent MUST NOT execute any `paytaca send` or `paytaca token send` command without first:
|
|
13
|
+
1. Informing the user of the exact amount and recipient
|
|
14
|
+
2. Waiting for explicit user confirmation (e.g., "yes", "send it", "confirm")
|
|
15
|
+
3. Only then executing the send command
|
|
16
|
+
|
|
17
|
+
These commands spend real funds from the user's wallet.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Send BCH
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Basic send (BCH amount)
|
|
25
|
+
paytaca send <address> <amount>
|
|
26
|
+
|
|
27
|
+
# Send in satoshis
|
|
28
|
+
paytaca send <address> 50000 --unit sats
|
|
29
|
+
|
|
30
|
+
# Testnet (chipnet)
|
|
31
|
+
paytaca send <address> 0.001 --chipnet
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Example Workflow
|
|
35
|
+
```
|
|
36
|
+
Agent: I'll send 0.001 BCH to bitcoincash:qpm5...
|
|
37
|
+
Confirm? (This will spend real funds)
|
|
38
|
+
|
|
39
|
+
User: yes
|
|
40
|
+
|
|
41
|
+
Agent: paytaca send bitcoincash:qpm5... 0.001
|
|
42
|
+
→ Transaction sent: txid...
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Send Fungible Tokens
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Send tokens (amount in base units)
|
|
51
|
+
paytaca token send <address> <amount> --token <category>
|
|
52
|
+
|
|
53
|
+
# Example: Send 1000 units of a token
|
|
54
|
+
paytaca token send bitcoincash:zpm5... 1000 --token abc123...
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Note**: Token amounts are in base units. If a token has 8 decimals, sending `1` token requires `100000000` base units.
|
|
58
|
+
|
|
59
|
+
### Token Address Warning
|
|
60
|
+
Tokens should be sent to token-aware (z-prefix) addresses. The CLI will warn if the recipient address is not token-aware.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Send NFTs
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Send NFT (auto-detect UTXO)
|
|
68
|
+
paytaca token send-nft <address> --token <category> --commitment <hex>
|
|
69
|
+
|
|
70
|
+
# Example: Send NFT with empty commitment
|
|
71
|
+
paytaca token send-nft bitcoincash:zpm5... --token abc123... --commitment ""
|
|
72
|
+
|
|
73
|
+
# With capability (minting or mutable)
|
|
74
|
+
paytaca token send-nft <address> --token <category> --commitment <hex> --capability minting
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Find NFT details
|
|
78
|
+
```bash
|
|
79
|
+
# List NFTs for a token category
|
|
80
|
+
paytaca token info <category>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Network
|
|
86
|
+
|
|
87
|
+
All commands default to **mainnet**. Use `--chipnet` for testnet:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
paytaca send <address> 0.01 --chipnet
|
|
91
|
+
paytaca token send <address> 100 --token <cat> --chipnet
|
|
92
|
+
paytaca token send-nft <address> --token <cat> --commitment "" --chipnet
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Decision Flow
|
|
98
|
+
|
|
99
|
+
When user requests to send funds:
|
|
100
|
+
|
|
101
|
+
1. **Validate inputs**: Check address format and amount
|
|
102
|
+
2. **Inform user**: State the exact amount, recipient, and network
|
|
103
|
+
3. **Wait for approval**: Ask "Send X [BCH/tokens] to <address>? Confirm?"
|
|
104
|
+
4. **Execute**: Only after explicit approval
|
|
105
|
+
|
|
106
|
+
### Example: Sending BCH
|
|
107
|
+
```
|
|
108
|
+
User: Send 0.01 BCH to bitcoincash:qpm5qz6j5p5s5s5s5s5s5s5s5s5s5s5s5s5
|
|
109
|
+
|
|
110
|
+
Agent: Checking wallet balance...
|
|
111
|
+
paytaca balance
|
|
112
|
+
|
|
113
|
+
Agent: Balance: 0.5 BCH
|
|
114
|
+
Sending 0.01 BCH to bitcoincash:qpm5qz6j5p5s5s5s5s5s5s5s5s5s5s5s5s
|
|
115
|
+
Confirm? (yes/no)
|
|
116
|
+
|
|
117
|
+
User: yes
|
|
118
|
+
|
|
119
|
+
Agent: paytaca send bitcoincash:qpm5qz6j5p5s5s5s5s5s5s5s5s5s5s5s5s 0.01
|
|
120
|
+
→ Transaction sent!
|
|
121
|
+
txid: abc123...
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Example: Sending Tokens
|
|
125
|
+
```
|
|
126
|
+
User: Send 1000 tokens to bitcoincash:zpm5...
|
|
127
|
+
|
|
128
|
+
Agent: Let me check your token balance first...
|
|
129
|
+
paytaca token info <category>
|
|
130
|
+
|
|
131
|
+
Agent: You have 5000 tokens.
|
|
132
|
+
Sending 1000 base units to bitcoincash:zpm5...
|
|
133
|
+
Confirm? (yes/no)
|
|
134
|
+
|
|
135
|
+
User: yes
|
|
136
|
+
|
|
137
|
+
Agent: paytaca token send bitcoincash:zpm5... 1000 --token <category>
|
|
138
|
+
→ Transaction sent!
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Error Handling
|
|
144
|
+
|
|
145
|
+
| Error | Cause | Solution |
|
|
146
|
+
|-------|-------|----------|
|
|
147
|
+
| `Insufficient balance` | Not enough BCH | Check `paytaca balance` first |
|
|
148
|
+
| `Insufficient BCH for fees` | Can't afford tx fee | Need more BCH for miner fee |
|
|
149
|
+
| `Invalid address` | Bad address format | Use CashAddr format |
|
|
150
|
+
| `Token not found` | Unknown category | Check token category ID |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Security Notes
|
|
155
|
+
|
|
156
|
+
- Seed phrase is stored in OS keychain (never transmitted)
|
|
157
|
+
- Transactions are signed locally
|
|
158
|
+
- Always verify recipient address before confirming
|
|
159
|
+
- Test with small amounts on mainnet, or use `--chipnet` for testing
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: paytaca-wallet
|
|
3
|
+
description: Query wallet information including BCH balance, CashToken holdings, addresses, and transaction history. Use for read-only wallet operations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Paytaca Wallet Info
|
|
7
|
+
|
|
8
|
+
This skill provides read-only access to wallet information via the Paytaca CLI.
|
|
9
|
+
|
|
10
|
+
## Commands
|
|
11
|
+
|
|
12
|
+
### Check Balance
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# BCH balance
|
|
16
|
+
paytaca balance
|
|
17
|
+
|
|
18
|
+
# Balance in satoshis
|
|
19
|
+
paytaca balance --sats
|
|
20
|
+
|
|
21
|
+
# Token balance
|
|
22
|
+
paytaca balance --token <category>
|
|
23
|
+
|
|
24
|
+
# Testnet (chipnet)
|
|
25
|
+
paytaca balance --chipnet
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### View Transaction History
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Recent transactions
|
|
32
|
+
paytaca history
|
|
33
|
+
|
|
34
|
+
# Filter by type
|
|
35
|
+
paytaca history --type incoming
|
|
36
|
+
paytaca history --type outgoing
|
|
37
|
+
|
|
38
|
+
# Filter by token
|
|
39
|
+
paytaca history --token <category>
|
|
40
|
+
|
|
41
|
+
# Pagination
|
|
42
|
+
paytaca history --page 2
|
|
43
|
+
|
|
44
|
+
# Satoshis display
|
|
45
|
+
paytaca history --sats
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Get Receiving Address
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# BCH address with QR code
|
|
52
|
+
paytaca receive
|
|
53
|
+
|
|
54
|
+
# Address at specific index
|
|
55
|
+
paytaca receive --index 5
|
|
56
|
+
|
|
57
|
+
# Address only (no QR)
|
|
58
|
+
paytaca receive --no-qr
|
|
59
|
+
|
|
60
|
+
# Token-aware address (z-prefix)
|
|
61
|
+
paytaca receive --token
|
|
62
|
+
|
|
63
|
+
# With payment amount (BIP21 URI)
|
|
64
|
+
paytaca receive --amount 0.5
|
|
65
|
+
|
|
66
|
+
# Token payment URI
|
|
67
|
+
paytaca receive --token <category> --amount 100
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Derive Addresses
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Address at index 0
|
|
74
|
+
paytaca address derive
|
|
75
|
+
|
|
76
|
+
# Address at index 5
|
|
77
|
+
paytaca address derive 5
|
|
78
|
+
|
|
79
|
+
# Token address
|
|
80
|
+
paytaca address derive --token
|
|
81
|
+
|
|
82
|
+
# List first 5 addresses
|
|
83
|
+
paytaca address list
|
|
84
|
+
|
|
85
|
+
# List 20 addresses
|
|
86
|
+
paytaca address list -n 20
|
|
87
|
+
|
|
88
|
+
# Token addresses
|
|
89
|
+
paytaca address list --token
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Wallet Info
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Wallet hash, address, balance
|
|
96
|
+
paytaca wallet info
|
|
97
|
+
|
|
98
|
+
# Testnet
|
|
99
|
+
paytaca wallet info --chipnet
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Token Information
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# List all fungible tokens
|
|
106
|
+
paytaca token list
|
|
107
|
+
|
|
108
|
+
# Token details (name, symbol, decimals, balance, NFTs)
|
|
109
|
+
paytaca token info <category>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## JSON Output
|
|
113
|
+
|
|
114
|
+
For programmatic parsing, use `--json` where available:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
paytaca balance --json # Not yet supported
|
|
118
|
+
paytaca history --json # Not yet supported
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Network
|
|
122
|
+
|
|
123
|
+
All commands default to **mainnet**. Use `--chipnet` for testnet:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
paytaca balance --chipnet
|
|
127
|
+
paytaca history --chipnet
|
|
128
|
+
paytaca receive --chipnet
|
|
129
|
+
paytaca token list --chipnet
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Common Workflows
|
|
133
|
+
|
|
134
|
+
### Check wallet status
|
|
135
|
+
```bash
|
|
136
|
+
paytaca wallet info
|
|
137
|
+
paytaca balance
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Get deposit address
|
|
141
|
+
```bash
|
|
142
|
+
paytaca receive
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Check token holdings
|
|
146
|
+
```bash
|
|
147
|
+
paytaca token list
|
|
148
|
+
paytaca token info <category>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### View recent activity
|
|
152
|
+
```bash
|
|
153
|
+
paytaca history
|
|
154
|
+
paytaca history --type incoming
|
|
155
|
+
```
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI command: claude
|
|
3
|
-
*
|
|
4
|
-
* Set up paytaca x402 payment handling for Claude Code AI assistant.
|
|
5
|
-
* Installs the paytaca skill so Claude Code knows how to handle 402 responses.
|
|
6
|
-
*/
|
|
7
|
-
import { Command } from 'commander';
|
|
8
|
-
export declare function registerClaudeCommand(program: Command): void;
|
|
9
|
-
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/commands/claude.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAW5D"}
|
package/dist/commands/claude.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI command: claude
|
|
3
|
-
*
|
|
4
|
-
* Set up paytaca x402 payment handling for Claude Code AI assistant.
|
|
5
|
-
* Installs the paytaca skill so Claude Code knows how to handle 402 responses.
|
|
6
|
-
*/
|
|
7
|
-
import { SUPPORTED_ASSISTANTS, handleSkillAction } from '../utils/skill.js';
|
|
8
|
-
export function registerClaudeCommand(program) {
|
|
9
|
-
const assistant = SUPPORTED_ASSISTANTS.find(a => a.name === 'Claude Code');
|
|
10
|
-
if (!assistant)
|
|
11
|
-
return;
|
|
12
|
-
program
|
|
13
|
-
.command('claude')
|
|
14
|
-
.description('Set up paytaca x402 payments for Claude Code AI assistant')
|
|
15
|
-
.argument('[action]', 'Action: install, uninstall, status', 'status')
|
|
16
|
-
.action(async (action) => {
|
|
17
|
-
handleSkillAction(assistant, action);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=claude.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/commands/claude.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAA;IAC1E,IAAI,CAAC,SAAS;QAAE,OAAM;IAEtB,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,2DAA2D,CAAC;SACxE,QAAQ,CAAC,UAAU,EAAE,oCAAoC,EAAE,QAAQ,CAAC;SACpE,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,EAAE;QAC/B,iBAAiB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI command: opencode
|
|
3
|
-
*
|
|
4
|
-
* Set up paytaca x402 payment handling for opencode AI assistant.
|
|
5
|
-
* Installs the paytaca skill so opencode knows how to handle 402 responses.
|
|
6
|
-
*/
|
|
7
|
-
import { Command } from 'commander';
|
|
8
|
-
export declare function registerOpencodeCommand(program: Command): void;
|
|
9
|
-
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/commands/opencode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAW9D"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI command: opencode
|
|
3
|
-
*
|
|
4
|
-
* Set up paytaca x402 payment handling for opencode AI assistant.
|
|
5
|
-
* Installs the paytaca skill so opencode knows how to handle 402 responses.
|
|
6
|
-
*/
|
|
7
|
-
import { SUPPORTED_ASSISTANTS, handleSkillAction } from '../utils/skill.js';
|
|
8
|
-
export function registerOpencodeCommand(program) {
|
|
9
|
-
const assistant = SUPPORTED_ASSISTANTS.find(a => a.name === 'opencode');
|
|
10
|
-
if (!assistant)
|
|
11
|
-
return;
|
|
12
|
-
program
|
|
13
|
-
.command('opencode')
|
|
14
|
-
.description('Set up paytaca x402 payments for opencode AI assistant')
|
|
15
|
-
.argument('[action]', 'Action: install, uninstall, status', 'status')
|
|
16
|
-
.action(async (action) => {
|
|
17
|
-
handleSkillAction(assistant, action);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=opencode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../src/commands/opencode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;IACvE,IAAI,CAAC,SAAS;QAAE,OAAM;IAEtB,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,wDAAwD,CAAC;SACrE,QAAQ,CAAC,UAAU,EAAE,oCAAoC,EAAE,QAAQ,CAAC;SACpE,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,EAAE;QAC/B,iBAAiB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;AACN,CAAC"}
|
package/dist/utils/skill.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill management utilities for AI assistant integration.
|
|
3
|
-
* Provides generic functions for installing/uninstalling/checking status
|
|
4
|
-
* of paytaca skill for various AI assistants.
|
|
5
|
-
*/
|
|
6
|
-
export interface AssistantConfig {
|
|
7
|
-
name: string;
|
|
8
|
-
skillsDir: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const SUPPORTED_ASSISTANTS: AssistantConfig[];
|
|
11
|
-
export declare function getSkillSourcePath(): string;
|
|
12
|
-
export declare function getSkillDestPath(skillsDir: string): string;
|
|
13
|
-
export declare function installSkill(skillsDir: string, assistantName: string): void;
|
|
14
|
-
export declare function uninstallSkill(skillsDir: string, assistantName: string): void;
|
|
15
|
-
export declare function checkStatus(skillsDir: string, assistantName: string): void;
|
|
16
|
-
export declare function handleSkillAction(assistant: AssistantConfig, action: string): void;
|
|
17
|
-
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/utils/skill.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,eAAO,MAAM,oBAAoB,EAAE,eAAe,EAGjD,CAAA;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAU3C;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CA4B3E;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAgB7E;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAW1E;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,MAAM,GACb,IAAI,CAeN"}
|
package/dist/utils/skill.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill management utilities for AI assistant integration.
|
|
3
|
-
* Provides generic functions for installing/uninstalling/checking status
|
|
4
|
-
* of paytaca skill for various AI assistants.
|
|
5
|
-
*/
|
|
6
|
-
import chalk from 'chalk';
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import os from 'os';
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
export const SUPPORTED_ASSISTANTS = [
|
|
12
|
-
{ name: 'opencode', skillsDir: path.join(os.homedir(), '.config', 'opencode', 'skills') },
|
|
13
|
-
{ name: 'Claude Code', skillsDir: path.join(os.homedir(), '.claude', 'skills') },
|
|
14
|
-
];
|
|
15
|
-
export function getSkillSourcePath() {
|
|
16
|
-
try {
|
|
17
|
-
const modulePath = require.resolve('paytaca-cli');
|
|
18
|
-
const packageDir = path.dirname(modulePath);
|
|
19
|
-
return path.join(packageDir, 'skills', 'paytaca', 'SKILL.md');
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
const currentFilePath = fileURLToPath(import.meta.url);
|
|
23
|
-
const srcPath = path.dirname(currentFilePath);
|
|
24
|
-
return path.join(srcPath, '..', '..', 'skills', 'paytaca', 'SKILL.md');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function getSkillDestPath(skillsDir) {
|
|
28
|
-
return path.join(skillsDir, 'paytaca', 'SKILL.md');
|
|
29
|
-
}
|
|
30
|
-
export function installSkill(skillsDir, assistantName) {
|
|
31
|
-
try {
|
|
32
|
-
const sourcePath = getSkillSourcePath();
|
|
33
|
-
const destDir = path.join(skillsDir, 'paytaca');
|
|
34
|
-
const destPath = getSkillDestPath(skillsDir);
|
|
35
|
-
if (!fs.existsSync(sourcePath)) {
|
|
36
|
-
console.log(chalk.red('Skill source file not found. Is paytaca-cli properly installed?'));
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
40
|
-
const content = fs.readFileSync(sourcePath, 'utf8');
|
|
41
|
-
fs.writeFileSync(destPath, content);
|
|
42
|
-
console.log(chalk.green(`\n✓ Skill installed successfully for ${assistantName}!\n`));
|
|
43
|
-
console.log(chalk.bold('What this does:'));
|
|
44
|
-
console.log(' When the AI assistant encounters HTTP 402 or calls x402-enabled APIs,');
|
|
45
|
-
console.log(' it will automatically use paytaca to handle payments.\n');
|
|
46
|
-
console.log(chalk.dim('Location: ') + destPath);
|
|
47
|
-
console.log(chalk.dim('Source: ') + sourcePath);
|
|
48
|
-
console.log();
|
|
49
|
-
console.log(`Restart ${assistantName} to load the new skill.\n`);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
console.log(chalk.red(`\nFailed to install skill: ${err.message}\n`));
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export function uninstallSkill(skillsDir, assistantName) {
|
|
57
|
-
try {
|
|
58
|
-
const destDir = path.join(skillsDir, 'paytaca');
|
|
59
|
-
const destPath = getSkillDestPath(skillsDir);
|
|
60
|
-
if (!fs.existsSync(destPath)) {
|
|
61
|
-
console.log(chalk.yellow('\nSkill is not installed.\n'));
|
|
62
|
-
process.exit(0);
|
|
63
|
-
}
|
|
64
|
-
fs.rmSync(destDir, { recursive: true });
|
|
65
|
-
console.log(chalk.green(`\n✓ Skill uninstalled for ${assistantName}!\n`));
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
console.log(chalk.red(`\nFailed to uninstall skill: ${err.message}\n`));
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export function checkStatus(skillsDir, assistantName) {
|
|
73
|
-
const destPath = getSkillDestPath(skillsDir);
|
|
74
|
-
if (fs.existsSync(destPath)) {
|
|
75
|
-
console.log(chalk.green('\n✓ Paytaca skill is installed\n'));
|
|
76
|
-
console.log(chalk.dim('Location: ') + destPath);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
console.log(chalk.yellow(`\n○ Paytaca skill is not installed for ${assistantName}\n`));
|
|
80
|
-
console.log(`Run: paytaca ${assistantName.toLowerCase()} install`);
|
|
81
|
-
console.log();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
export function handleSkillAction(assistant, action) {
|
|
85
|
-
switch (action) {
|
|
86
|
-
case 'install':
|
|
87
|
-
installSkill(assistant.skillsDir, assistant.name);
|
|
88
|
-
break;
|
|
89
|
-
case 'uninstall':
|
|
90
|
-
uninstallSkill(assistant.skillsDir, assistant.name);
|
|
91
|
-
break;
|
|
92
|
-
case 'status':
|
|
93
|
-
checkStatus(assistant.skillsDir, assistant.name);
|
|
94
|
-
break;
|
|
95
|
-
default:
|
|
96
|
-
console.log(chalk.yellow(`Unknown action: ${action}`));
|
|
97
|
-
console.log('Use: install, uninstall, or status');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=skill.js.map
|
package/dist/utils/skill.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/utils/skill.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAOnC,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE;IACzF,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE;CACjF,CAAA;AAED,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QACjD,M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