movementkit-cli 1.0.0 → 1.0.3
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/index.js +12 -8
- package/kits/engineer/.claude/agents/devops.md +176 -0
- package/kits/engineer/.claude/agents/frontend.md +207 -0
- package/kits/engineer/.claude/agents/smart-contract.md +150 -0
- package/kits/engineer/.claude/agents/tester.md +174 -0
- package/kits/engineer/.claude/commands/cook/contracts.md +174 -0
- package/kits/engineer/.claude/commands/cook/frontend.md +325 -0
- package/kits/engineer/.claude/commands/cook.md +118 -0
- package/kits/engineer/.claude/commands/deploy-full.md +158 -0
- package/kits/engineer/.claude/commands/deploy-smart-contract.md +177 -0
- package/kits/engineer/.claude/commands/docs/generate.md +121 -0
- package/kits/engineer/.claude/commands/docs/init.md +132 -0
- package/kits/engineer/.claude/commands/plan.md +103 -0
- package/kits/engineer/.claude/commands/review.md +98 -0
- package/kits/engineer/.claude/commands/test.md +92 -0
- package/kits/engineer/.claude/commands/watzup.md +100 -0
- package/kits/engineer/.claude/workflows/development-rules.md +110 -0
- package/kits/engineer/.claude/workflows/primary-workflow.md +95 -0
- package/kits/engineer/CLAUDE.md +105 -0
- package/kits/engineer/contracts/Move.toml +13 -0
- package/kits/engineer/contracts/sources/counter.move +122 -0
- package/kits/engineer/contracts/tests/counter_tests.move +96 -0
- package/kits/engineer/docs/MOVE_LANGUAGE_REFERENCE.md +560 -0
- package/kits/engineer/frontend/.env.example +9 -0
- package/kits/engineer/frontend/index.html +14 -0
- package/kits/engineer/frontend/package.json +29 -0
- package/kits/engineer/frontend/src/App.tsx +41 -0
- package/kits/engineer/frontend/src/components/WalletConnect.tsx +54 -0
- package/kits/engineer/frontend/src/contexts/WalletContext.tsx +42 -0
- package/kits/engineer/frontend/src/hooks/useContract.ts +95 -0
- package/kits/engineer/frontend/src/index.css +76 -0
- package/kits/engineer/frontend/src/main.tsx +11 -0
- package/kits/engineer/frontend/tsconfig.json +22 -0
- package/kits/engineer/frontend/tsconfig.node.json +11 -0
- package/kits/engineer/frontend/vite.config.ts +17 -0
- package/package.json +3 -3
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# /plan - Architecture Planning for Movement dApps
|
|
2
|
+
|
|
3
|
+
Plan the architecture for a Movement blockchain dApp based on the user's requirements.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
### Step 1: Analyze Requirements
|
|
8
|
+
Carefully analyze the user's request: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
Identify:
|
|
11
|
+
- **Core functionality** - What does the dApp need to do?
|
|
12
|
+
- **Smart contract requirements** - What on-chain logic is needed?
|
|
13
|
+
- **Frontend requirements** - What UI/UX is needed?
|
|
14
|
+
- **Integration points** - Wallets, oracles, other contracts?
|
|
15
|
+
|
|
16
|
+
### Step 2: Research Phase
|
|
17
|
+
Read the Move language reference for correct syntax:
|
|
18
|
+
```bash
|
|
19
|
+
cat docs/MOVE_LANGUAGE_REFERENCE.md
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Step 3: Create Planning Artifacts
|
|
23
|
+
Create a timestamped plan directory: `plans/YYYYMMDD-HHmm-{plan-name}/`
|
|
24
|
+
|
|
25
|
+
Generate the following files:
|
|
26
|
+
1. `00-overview.md` - Executive summary and high-level architecture
|
|
27
|
+
2. `01-contracts.md` - Move smart contract design with modules, structs, functions
|
|
28
|
+
3. `02-frontend.md` - React frontend design with components and state management
|
|
29
|
+
4. `03-testing.md` - Test strategy with unit, integration, and e2e tests
|
|
30
|
+
5. `04-deployment.md` - Deployment plan for testnet and mainnet
|
|
31
|
+
|
|
32
|
+
### Step 4: Validate Plan
|
|
33
|
+
Ensure the plan addresses:
|
|
34
|
+
- [ ] All user requirements are covered
|
|
35
|
+
- [ ] Move contract security best practices
|
|
36
|
+
- [ ] Proper resource management
|
|
37
|
+
- [ ] Event emission for state changes
|
|
38
|
+
- [ ] Error handling strategy
|
|
39
|
+
- [ ] Gas optimization considerations
|
|
40
|
+
|
|
41
|
+
### Step 5: Present Plan Summary
|
|
42
|
+
Present a concise summary to the user with:
|
|
43
|
+
- Architecture diagram (Mermaid)
|
|
44
|
+
- Key components and their responsibilities
|
|
45
|
+
- Estimated implementation time
|
|
46
|
+
- Potential risks and mitigations
|
|
47
|
+
- Next steps (suggest `/cook` to start implementation)
|
|
48
|
+
|
|
49
|
+
## Complexity Modes
|
|
50
|
+
|
|
51
|
+
### /plan:fast
|
|
52
|
+
For simple dApps (single contract, basic CRUD):
|
|
53
|
+
- Skip detailed research phase
|
|
54
|
+
- Use standard patterns
|
|
55
|
+
- Minimal documentation
|
|
56
|
+
|
|
57
|
+
### /plan:hard
|
|
58
|
+
For complex dApps (multiple contracts, complex logic):
|
|
59
|
+
- Deep dive into security considerations
|
|
60
|
+
- Comprehensive documentation
|
|
61
|
+
- Formal verification recommendations
|
|
62
|
+
|
|
63
|
+
## Output Format
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
# Plan: {Plan Name}
|
|
67
|
+
Created: {timestamp}
|
|
68
|
+
|
|
69
|
+
## Overview
|
|
70
|
+
{Brief description of the dApp}
|
|
71
|
+
|
|
72
|
+
## Architecture
|
|
73
|
+
{Mermaid diagram}
|
|
74
|
+
|
|
75
|
+
## Components
|
|
76
|
+
### Smart Contracts
|
|
77
|
+
- {Contract 1}: {Description}
|
|
78
|
+
|
|
79
|
+
### Frontend
|
|
80
|
+
- {Component 1}: {Description}
|
|
81
|
+
- {State management approach}
|
|
82
|
+
|
|
83
|
+
## Implementation Order
|
|
84
|
+
1. {First task}
|
|
85
|
+
2. {Second task}
|
|
86
|
+
...
|
|
87
|
+
|
|
88
|
+
## Estimated Time
|
|
89
|
+
- Contracts: {X} hours
|
|
90
|
+
- Frontend: {X} hours
|
|
91
|
+
- Testing: {X} hours
|
|
92
|
+
- Total: {X} hours
|
|
93
|
+
|
|
94
|
+
## Next Steps
|
|
95
|
+
Run `/cook` to start implementation
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Success Criteria
|
|
99
|
+
- Plan created in <5 minutes
|
|
100
|
+
- All requirements addressed
|
|
101
|
+
- Clear implementation path
|
|
102
|
+
- Security considerations documented
|
|
103
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# /review - Code Quality and Security Auditing
|
|
2
|
+
|
|
3
|
+
Perform comprehensive code review and security audit for the Movement dApp.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
### Step 1: Move Contract Security Audit
|
|
8
|
+
|
|
9
|
+
Check for common vulnerabilities:
|
|
10
|
+
|
|
11
|
+
#### Resource Safety
|
|
12
|
+
- [ ] No resource leaks (resources properly moved/destroyed)
|
|
13
|
+
- [ ] Proper use of `move_to`, `move_from`, `borrow_global`
|
|
14
|
+
- [ ] No dangling references
|
|
15
|
+
|
|
16
|
+
#### Access Control
|
|
17
|
+
- [ ] Signer validation on privileged functions
|
|
18
|
+
- [ ] Proper capability checks
|
|
19
|
+
- [ ] Admin functions protected
|
|
20
|
+
|
|
21
|
+
#### Arithmetic Safety
|
|
22
|
+
- [ ] No integer overflow/underflow
|
|
23
|
+
- [ ] Safe division (no divide by zero)
|
|
24
|
+
- [ ] Proper use of checked arithmetic
|
|
25
|
+
|
|
26
|
+
#### Reentrancy Protection
|
|
27
|
+
- [ ] State changes before external calls
|
|
28
|
+
- [ ] No recursive vulnerabilities
|
|
29
|
+
|
|
30
|
+
#### Event Emission
|
|
31
|
+
- [ ] All state changes emit events
|
|
32
|
+
- [ ] Events contain sufficient information
|
|
33
|
+
|
|
34
|
+
#### Gas Optimization
|
|
35
|
+
- [ ] No unbounded loops
|
|
36
|
+
- [ ] Efficient data structures
|
|
37
|
+
- [ ] Minimal storage operations
|
|
38
|
+
|
|
39
|
+
### Step 2: Frontend Security Audit
|
|
40
|
+
|
|
41
|
+
Check for:
|
|
42
|
+
- [ ] No hardcoded secrets
|
|
43
|
+
- [ ] Proper wallet connection handling
|
|
44
|
+
- [ ] Transaction signing validation
|
|
45
|
+
- [ ] XSS prevention
|
|
46
|
+
- [ ] Secure storage of user data
|
|
47
|
+
|
|
48
|
+
### Step 3: Generate Review Report
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# 🔍 Code Review Report
|
|
52
|
+
|
|
53
|
+
## Security Audit
|
|
54
|
+
|
|
55
|
+
### Critical Issues (Must Fix)
|
|
56
|
+
| ID | Location | Issue | Recommendation |
|
|
57
|
+
|----|----------|-------|----------------|
|
|
58
|
+
| C1 | contracts/sources/main.move:42 | Issue desc | Fix recommendation |
|
|
59
|
+
|
|
60
|
+
### High Priority Issues
|
|
61
|
+
| ID | Location | Issue | Recommendation |
|
|
62
|
+
|----|----------|-------|----------------|
|
|
63
|
+
|
|
64
|
+
### Medium Priority Issues
|
|
65
|
+
| ID | Location | Issue | Recommendation |
|
|
66
|
+
|----|----------|-------|----------------|
|
|
67
|
+
|
|
68
|
+
### Low Priority Issues
|
|
69
|
+
| ID | Location | Issue | Recommendation |
|
|
70
|
+
|----|----------|-------|----------------|
|
|
71
|
+
|
|
72
|
+
## Code Quality
|
|
73
|
+
### Contracts
|
|
74
|
+
- Style compliance: ✅/❌
|
|
75
|
+
- Documentation: ✅/❌
|
|
76
|
+
- Test coverage: {percentage}%
|
|
77
|
+
|
|
78
|
+
## Approval Status
|
|
79
|
+
- [ ] Ready for testnet deployment
|
|
80
|
+
- [ ] Ready for mainnet deployment
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Sub-Commands
|
|
84
|
+
|
|
85
|
+
### /review:security
|
|
86
|
+
Focus only on security audit
|
|
87
|
+
|
|
88
|
+
### /review:quality
|
|
89
|
+
Focus only on code quality
|
|
90
|
+
|
|
91
|
+
### /review:contracts
|
|
92
|
+
Review only Move contracts
|
|
93
|
+
|
|
94
|
+
## Success Criteria
|
|
95
|
+
- Review completed in <2 minutes
|
|
96
|
+
- All critical issues identified
|
|
97
|
+
- Clear remediation steps provided
|
|
98
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# /test - Comprehensive Test Generation and Execution
|
|
2
|
+
|
|
3
|
+
Generate and run comprehensive tests for the Movement dApp.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
### Step 1: Analyze Codebase
|
|
8
|
+
Scan the project to identify:
|
|
9
|
+
- Move contracts in `contracts/sources/`
|
|
10
|
+
- Frontend code in `frontend/src/`
|
|
11
|
+
- Existing tests
|
|
12
|
+
|
|
13
|
+
### Step 2: Generate Move Tests
|
|
14
|
+
For each Move module, generate tests in `contracts/tests/`:
|
|
15
|
+
|
|
16
|
+
```move
|
|
17
|
+
#[test_only]
|
|
18
|
+
module test_module_name {
|
|
19
|
+
use std::signer;
|
|
20
|
+
use aptos_framework::account;
|
|
21
|
+
|
|
22
|
+
#[test(account = @0x1)]
|
|
23
|
+
fun test_function_name(account: &signer) {
|
|
24
|
+
// Setup
|
|
25
|
+
// Action
|
|
26
|
+
// Assert
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#[test]
|
|
30
|
+
#[expected_failure(abort_code = ERROR_CODE)]
|
|
31
|
+
fun test_failure_case() {
|
|
32
|
+
// Test error conditions
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Step 3: Run All Tests
|
|
38
|
+
|
|
39
|
+
1. **Move Tests**
|
|
40
|
+
```bash
|
|
41
|
+
cd contracts && movement move test
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. **Frontend Tests**
|
|
45
|
+
```bash
|
|
46
|
+
cd frontend && npm test
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Step 4: Generate Coverage Report
|
|
50
|
+
Analyze test coverage and identify gaps:
|
|
51
|
+
- Line coverage
|
|
52
|
+
- Branch coverage
|
|
53
|
+
- Function coverage
|
|
54
|
+
|
|
55
|
+
### Step 5: Report Results
|
|
56
|
+
```markdown
|
|
57
|
+
# 🧪 Test Results
|
|
58
|
+
|
|
59
|
+
## Move Contract Tests
|
|
60
|
+
| Module | Tests | Passed | Failed | Coverage |
|
|
61
|
+
|--------|-------|--------|--------|----------|
|
|
62
|
+
| module_name | 10 | 10 | 0 | 95% |
|
|
63
|
+
|
|
64
|
+
## Frontend Tests
|
|
65
|
+
| Component | Tests | Passed | Failed | Coverage |
|
|
66
|
+
|-----------|-------|--------|--------|----------|
|
|
67
|
+
| ComponentName | 8 | 8 | 0 | 88% |
|
|
68
|
+
|
|
69
|
+
## Overall Coverage: 91%
|
|
70
|
+
|
|
71
|
+
## Recommendations
|
|
72
|
+
- Add tests for {uncovered areas}
|
|
73
|
+
- Consider edge cases for {specific functions}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Sub-Commands
|
|
77
|
+
|
|
78
|
+
### /test:contracts
|
|
79
|
+
Run only Move contract tests
|
|
80
|
+
|
|
81
|
+
### /test:frontend
|
|
82
|
+
Run only frontend tests
|
|
83
|
+
|
|
84
|
+
### /test:coverage
|
|
85
|
+
Generate detailed coverage report
|
|
86
|
+
|
|
87
|
+
## Success Criteria
|
|
88
|
+
- All tests generated in <3 minutes
|
|
89
|
+
- All tests passing
|
|
90
|
+
- Coverage >90%
|
|
91
|
+
- No security vulnerabilities in test code
|
|
92
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# /watzup - Project Status Check
|
|
2
|
+
|
|
3
|
+
Quick status check for the Movement dApp project.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
### Step 1: Scan Project Structure
|
|
8
|
+
|
|
9
|
+
Check for existence and status of:
|
|
10
|
+
- `contracts/` - Move smart contracts
|
|
11
|
+
- `frontend/` - React frontend
|
|
12
|
+
- `plans/` - Architecture plans
|
|
13
|
+
- `docs/` - Documentation
|
|
14
|
+
|
|
15
|
+
### Step 2: Analyze Each Component
|
|
16
|
+
|
|
17
|
+
#### Contracts Status
|
|
18
|
+
```bash
|
|
19
|
+
ls -la contracts/sources/*.move 2>/dev/null | wc -l
|
|
20
|
+
ls -la contracts/tests/*.move 2>/dev/null | wc -l
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Check:
|
|
24
|
+
- Number of Move modules
|
|
25
|
+
- Number of test files
|
|
26
|
+
- Last modified dates
|
|
27
|
+
- Compilation status
|
|
28
|
+
|
|
29
|
+
#### Frontend Status
|
|
30
|
+
```bash
|
|
31
|
+
ls -la frontend/src/**/*.tsx 2>/dev/null | wc -l
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Check:
|
|
35
|
+
- Number of React components
|
|
36
|
+
- Dependencies installed
|
|
37
|
+
- Build status
|
|
38
|
+
|
|
39
|
+
### Step 3: Check Test Status
|
|
40
|
+
|
|
41
|
+
Run quick test check:
|
|
42
|
+
```bash
|
|
43
|
+
cd contracts && movement move test --coverage 2>&1 | tail -5
|
|
44
|
+
cd ../frontend && npm test 2>&1 | tail -5
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 4: Check Deployment Status
|
|
48
|
+
|
|
49
|
+
Look for deployment records:
|
|
50
|
+
- Deployed contract addresses
|
|
51
|
+
- Network (testnet/mainnet)
|
|
52
|
+
- Last deployment date
|
|
53
|
+
|
|
54
|
+
### Step 5: Generate Status Report
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
# 📊 Project Status: {Project Name}
|
|
58
|
+
|
|
59
|
+
## Overview
|
|
60
|
+
| Component | Status | Files | Coverage | Last Updated |
|
|
61
|
+
|-----------|--------|-------|----------|--------------|
|
|
62
|
+
| Contracts | ✅/⚠️/❌ | {n} | {%} | {date} |
|
|
63
|
+
| Frontend | ✅/⚠️/❌ | {n} | {%} | {date} |
|
|
64
|
+
| Tests | ✅/⚠️/❌ | {n} | {%} | {date} |
|
|
65
|
+
| Docs | ✅/⚠️/❌ | {n} | - | {date} |
|
|
66
|
+
|
|
67
|
+
## Deployment Status
|
|
68
|
+
| Network | Status | Address | Last Deployed |
|
|
69
|
+
|---------|--------|---------|---------------|
|
|
70
|
+
| Testnet | ✅/❌ | 0x... | {date} |
|
|
71
|
+
| Mainnet | ✅/❌ | 0x... | {date} |
|
|
72
|
+
|
|
73
|
+
## Recent Activity
|
|
74
|
+
- {Recent change 1}
|
|
75
|
+
- {Recent change 2}
|
|
76
|
+
- {Recent change 3}
|
|
77
|
+
|
|
78
|
+
## Recommendations
|
|
79
|
+
1. {Recommendation based on status}
|
|
80
|
+
2. {Next logical step}
|
|
81
|
+
|
|
82
|
+
## Quick Actions
|
|
83
|
+
- `/cook` - Generate missing components
|
|
84
|
+
- `/test` - Run all tests
|
|
85
|
+
- `/review` - Security audit
|
|
86
|
+
- `/deploy-full` - Deploy to network
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Status Indicators
|
|
90
|
+
|
|
91
|
+
- ✅ **Complete** - Component is fully implemented and tested
|
|
92
|
+
- ⚠️ **In Progress** - Component exists but incomplete
|
|
93
|
+
- ❌ **Missing** - Component does not exist
|
|
94
|
+
- 🔄 **Needs Update** - Component is outdated
|
|
95
|
+
|
|
96
|
+
## Success Criteria
|
|
97
|
+
- Status check completed in <30 seconds
|
|
98
|
+
- Accurate representation of project state
|
|
99
|
+
- Clear next steps provided
|
|
100
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Development Rules for Movement dApps
|
|
2
|
+
|
|
3
|
+
Strict rules to follow when developing dApps on the Movement blockchain.
|
|
4
|
+
|
|
5
|
+
## Move Smart Contract Rules
|
|
6
|
+
|
|
7
|
+
### 1. Always Read the Reference First
|
|
8
|
+
```
|
|
9
|
+
BEFORE generating any Move code, ALWAYS read:
|
|
10
|
+
docs/MOVE_LANGUAGE_REFERENCE.md
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### 2. Resource Safety
|
|
14
|
+
- Never leave resources dangling
|
|
15
|
+
- Always use `move_to`, `move_from`, `borrow_global`, `borrow_global_mut` correctly
|
|
16
|
+
- Resources with `key` ability must be stored in global storage
|
|
17
|
+
|
|
18
|
+
### 3. Access Control
|
|
19
|
+
- Always validate signers on privileged functions
|
|
20
|
+
- Use `signer::address_of(account)` to get caller address
|
|
21
|
+
- Check ownership before modifying resources
|
|
22
|
+
|
|
23
|
+
### 4. Error Handling
|
|
24
|
+
- Define error constants at module top
|
|
25
|
+
- Use descriptive names: `E_NOT_AUTHORIZED`, `E_INSUFFICIENT_BALANCE`
|
|
26
|
+
- Use `assert!` with error codes
|
|
27
|
+
|
|
28
|
+
### 5. Events
|
|
29
|
+
- Emit events for ALL state changes
|
|
30
|
+
- Use `#[event]` attribute for event structs
|
|
31
|
+
- Include relevant data in events
|
|
32
|
+
|
|
33
|
+
### 6. Testing
|
|
34
|
+
- Write tests for every public function
|
|
35
|
+
- Test error conditions with `#[expected_failure]`
|
|
36
|
+
- Aim for >90% coverage
|
|
37
|
+
|
|
38
|
+
## TypeScript Backend Rules
|
|
39
|
+
|
|
40
|
+
### 1. Type Safety
|
|
41
|
+
- Use strict TypeScript (`strict: true`)
|
|
42
|
+
- No `any` types
|
|
43
|
+
- Define interfaces for all data structures
|
|
44
|
+
|
|
45
|
+
### 2. Movement SDK Usage
|
|
46
|
+
- Use `@aptos-labs/ts-sdk` for blockchain interaction
|
|
47
|
+
- Configure for Movement network endpoints
|
|
48
|
+
- Handle transaction errors properly
|
|
49
|
+
|
|
50
|
+
### 3. Error Handling
|
|
51
|
+
- Wrap all async operations in try-catch
|
|
52
|
+
- Return consistent error responses
|
|
53
|
+
- Log errors for debugging
|
|
54
|
+
|
|
55
|
+
### 4. Configuration
|
|
56
|
+
- Use environment variables for secrets
|
|
57
|
+
- Never hardcode private keys
|
|
58
|
+
- Use `.env` files with `.env.example` templates
|
|
59
|
+
|
|
60
|
+
## React Frontend Rules
|
|
61
|
+
|
|
62
|
+
### 1. Wallet Integration
|
|
63
|
+
- Use `@aptos-labs/wallet-adapter-react`
|
|
64
|
+
- Handle connection states properly
|
|
65
|
+
- Show clear feedback for transactions
|
|
66
|
+
|
|
67
|
+
### 2. State Management
|
|
68
|
+
- Use React hooks for local state
|
|
69
|
+
- Use context for global state (wallet, config)
|
|
70
|
+
- Avoid prop drilling
|
|
71
|
+
|
|
72
|
+
### 3. Error Handling
|
|
73
|
+
- Show user-friendly error messages
|
|
74
|
+
- Handle wallet disconnection gracefully
|
|
75
|
+
- Provide transaction status feedback
|
|
76
|
+
|
|
77
|
+
### 4. Security
|
|
78
|
+
- Never store private keys in frontend
|
|
79
|
+
- Validate all user inputs
|
|
80
|
+
- Use HTTPS for API calls
|
|
81
|
+
|
|
82
|
+
## Network Configuration
|
|
83
|
+
|
|
84
|
+
### Testnet
|
|
85
|
+
```typescript
|
|
86
|
+
const TESTNET_CONFIG = {
|
|
87
|
+
fullnode: "https://full.testnet.movementinfra.xyz/v1",
|
|
88
|
+
chainId: 250,
|
|
89
|
+
faucet: "https://faucet.movementnetwork.xyz/",
|
|
90
|
+
explorer: "https://explorer.movementnetwork.xyz/?network=testnet"
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Mainnet
|
|
95
|
+
```typescript
|
|
96
|
+
const MAINNET_CONFIG = {
|
|
97
|
+
fullnode: "https://full.mainnet.movementinfra.xyz/v1",
|
|
98
|
+
chainId: 126,
|
|
99
|
+
explorer: "https://explorer.movementnetwork.xyz/?network=mainnet"
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Code Quality Standards
|
|
104
|
+
|
|
105
|
+
1. **Formatting**: Use consistent formatting (Prettier for TS, Move formatter for Move)
|
|
106
|
+
2. **Comments**: Document complex logic, public APIs, and non-obvious code
|
|
107
|
+
3. **Naming**: Use descriptive names, follow language conventions
|
|
108
|
+
4. **Testing**: Write tests before or alongside code
|
|
109
|
+
5. **Review**: Always run `/review` before deployment
|
|
110
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Primary Workflow for Movement dApp Development
|
|
2
|
+
|
|
3
|
+
This document outlines the primary workflow for building dApps on the Movement blockchain.
|
|
4
|
+
|
|
5
|
+
## Workflow Overview
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
/plan → /cook → /test → /review → /deploy-full
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Phase 1: Planning (/plan)
|
|
12
|
+
|
|
13
|
+
1. **Analyze Requirements**
|
|
14
|
+
- Understand user's dApp requirements
|
|
15
|
+
- Identify on-chain vs off-chain logic
|
|
16
|
+
- Determine wallet integration needs
|
|
17
|
+
|
|
18
|
+
2. **Research**
|
|
19
|
+
- Read `docs/MOVE_LANGUAGE_REFERENCE.md`
|
|
20
|
+
- Check existing patterns in codebase
|
|
21
|
+
- Review Movement network specifics
|
|
22
|
+
|
|
23
|
+
3. **Create Plan**
|
|
24
|
+
- Generate architecture documents in `plans/`
|
|
25
|
+
- Create Mermaid diagrams for visualization
|
|
26
|
+
- Define implementation order
|
|
27
|
+
|
|
28
|
+
## Phase 2: Implementation (/cook)
|
|
29
|
+
|
|
30
|
+
1. **Smart Contracts** (`/cook:contracts`)
|
|
31
|
+
- Generate Move modules in `contracts/sources/`
|
|
32
|
+
- Create unit tests in `contracts/tests/`
|
|
33
|
+
- Compile and verify
|
|
34
|
+
|
|
35
|
+
2. **Frontend** (`/cook:frontend`)
|
|
36
|
+
- Generate React components in `frontend/src/`
|
|
37
|
+
- Implement wallet integration
|
|
38
|
+
- Create custom hooks for contract interaction
|
|
39
|
+
|
|
40
|
+
## Phase 3: Testing (/test)
|
|
41
|
+
|
|
42
|
+
1. **Unit Tests**
|
|
43
|
+
- Move contract tests
|
|
44
|
+
- Frontend component tests
|
|
45
|
+
|
|
46
|
+
2. **Integration Tests**
|
|
47
|
+
- Contract interaction tests
|
|
48
|
+
- E2E wallet flow tests
|
|
49
|
+
|
|
50
|
+
3. **Coverage Analysis**
|
|
51
|
+
- Target >90% coverage
|
|
52
|
+
- Identify gaps
|
|
53
|
+
- Add missing tests
|
|
54
|
+
|
|
55
|
+
## Phase 4: Review (/review)
|
|
56
|
+
|
|
57
|
+
1. **Security Audit**
|
|
58
|
+
- Move contract vulnerabilities
|
|
59
|
+
- Frontend security concerns
|
|
60
|
+
|
|
61
|
+
2. **Code Quality**
|
|
62
|
+
- Style compliance
|
|
63
|
+
- Documentation completeness
|
|
64
|
+
- Best practices adherence
|
|
65
|
+
|
|
66
|
+
3. **Performance Review**
|
|
67
|
+
- Gas optimization
|
|
68
|
+
- Frontend bundle size
|
|
69
|
+
|
|
70
|
+
## Phase 5: Deployment (/deploy-full)
|
|
71
|
+
|
|
72
|
+
1. **Testnet Deployment**
|
|
73
|
+
- Deploy contracts to Movement testnet
|
|
74
|
+
- Verify on Explorer
|
|
75
|
+
- Test all functionality
|
|
76
|
+
|
|
77
|
+
2. **Mainnet Deployment**
|
|
78
|
+
- Final security review
|
|
79
|
+
- Deploy to Movement mainnet
|
|
80
|
+
- Monitor and verify
|
|
81
|
+
|
|
82
|
+
## Quick Reference
|
|
83
|
+
|
|
84
|
+
| Phase | Command | Output |
|
|
85
|
+
|-------|---------|--------|
|
|
86
|
+
| Plan | `/plan` | Architecture docs in `plans/` |
|
|
87
|
+
| Build | `/cook` | Code in `contracts/`, `frontend/` |
|
|
88
|
+
| Test | `/test` | Test results and coverage |
|
|
89
|
+
| Review | `/review` | Security and quality report |
|
|
90
|
+
| Deploy | `/deploy-full` | Deployed contracts and apps |
|
|
91
|
+
|
|
92
|
+
## Status Check
|
|
93
|
+
|
|
94
|
+
Use `/watzup` at any time to check project status and get recommendations for next steps.
|
|
95
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# CLAUDE.md - Movement Kit
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when building dApps on the Movement blockchain.
|
|
4
|
+
|
|
5
|
+
## Role & Responsibilities
|
|
6
|
+
|
|
7
|
+
Your role is to analyze user requirements for Movement blockchain dApps, generate production-ready code using Move smart contracts and React frontend with wallet integration.
|
|
8
|
+
|
|
9
|
+
## Movement Network Context
|
|
10
|
+
|
|
11
|
+
**Network Endpoints:**
|
|
12
|
+
- Mainnet: `https://full.mainnet.movementinfra.xyz/v1` (Chain ID: 126)
|
|
13
|
+
- Testnet: `https://full.testnet.movementinfra.xyz/v1` (Chain ID: 250)
|
|
14
|
+
- Faucet: `https://faucet.movementnetwork.xyz/`
|
|
15
|
+
- Explorer: `https://explorer.movementnetwork.xyz/`
|
|
16
|
+
|
|
17
|
+
**Key Technologies:**
|
|
18
|
+
- Smart Contracts: Move language (Aptos-compatible)
|
|
19
|
+
- TypeScript SDK: `@aptos-labs/ts-sdk`
|
|
20
|
+
- Wallet Integration: `@aptos-labs/wallet-adapter-react`
|
|
21
|
+
- CLI: `movement` (Aptos-compatible commands)
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
Slash commands for dApp development:
|
|
26
|
+
|
|
27
|
+
| Command | Description |
|
|
28
|
+
|---------|-------------|
|
|
29
|
+
| `/plan` | Create architecture plan for a dApp |
|
|
30
|
+
| `/cook` | Generate full dApp code (contracts + frontend) |
|
|
31
|
+
| `/cook:contracts` | Generate Move smart contracts only |
|
|
32
|
+
| `/cook:frontend` | Generate React frontend only |
|
|
33
|
+
| `/test` | Generate and run comprehensive tests |
|
|
34
|
+
| `/review` | Perform security audit and code review |
|
|
35
|
+
| `/deploy-smart-contract` | Deploy Move smart contracts to Movement Network |
|
|
36
|
+
| `/deploy-full` | Deploy complete dApp to testnet or mainnet |
|
|
37
|
+
| `/watzup` | Check project status |
|
|
38
|
+
| `/docs:init` | Initialize documentation structure |
|
|
39
|
+
| `/docs:generate` | Auto-generate API and contract docs |
|
|
40
|
+
|
|
41
|
+
## Workflows
|
|
42
|
+
|
|
43
|
+
- Primary workflow: `./.claude/workflows/primary-workflow.md`
|
|
44
|
+
- Development rules: `./.claude/workflows/development-rules.md`
|
|
45
|
+
- Commands reference: `./.claude/commands/*.md`
|
|
46
|
+
|
|
47
|
+
## Project Structure
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
movement-kit/
|
|
51
|
+
├── CLAUDE.md # This file
|
|
52
|
+
├── contracts/ # Move smart contracts
|
|
53
|
+
│ ├── Move.toml
|
|
54
|
+
│ ├── sources/ # .move source files
|
|
55
|
+
│ └── tests/ # Move unit tests
|
|
56
|
+
├── frontend/ # React frontend
|
|
57
|
+
│ ├── package.json
|
|
58
|
+
│ ├── src/
|
|
59
|
+
│ │ ├── App.tsx
|
|
60
|
+
│ │ ├── components/
|
|
61
|
+
│ │ ├── hooks/
|
|
62
|
+
│ │ └── contexts/
|
|
63
|
+
│ └── tests/
|
|
64
|
+
├── docs/ # Documentation
|
|
65
|
+
│ ├── MOVE_LANGUAGE_REFERENCE.md
|
|
66
|
+
│ └── contracts/
|
|
67
|
+
├── plans/ # Architecture plans
|
|
68
|
+
└── templates/ # Code templates
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Development Principles
|
|
72
|
+
|
|
73
|
+
1. **Security First**: All contracts must follow Move security best practices
|
|
74
|
+
2. **Type Safety**: Use strict TypeScript with no `any` types
|
|
75
|
+
3. **Test Coverage**: Target >90% code coverage
|
|
76
|
+
4. **Event Emission**: Emit events for all state changes
|
|
77
|
+
5. **Error Handling**: Use descriptive error codes in contracts
|
|
78
|
+
|
|
79
|
+
## Critical Instructions
|
|
80
|
+
|
|
81
|
+
**IMPORTANT:** Always read `docs/MOVE_LANGUAGE_REFERENCE.md` before generating Move contracts
|
|
82
|
+
**IMPORTANT:** Use Movement-specific network configuration (not generic Aptos)
|
|
83
|
+
**IMPORTANT:** Test on Movement testnet before mainnet deployment
|
|
84
|
+
**IMPORTANT:** Follow the command workflows in `.claude/commands/`
|
|
85
|
+
**IMPORTANT:** For dates, use `bash -c 'date +%y%m%d'` command
|
|
86
|
+
|
|
87
|
+
## Quick Start
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Create a new dApp
|
|
91
|
+
/plan Create a simple counter dApp
|
|
92
|
+
|
|
93
|
+
# Generate the code
|
|
94
|
+
/cook
|
|
95
|
+
|
|
96
|
+
# Test everything
|
|
97
|
+
/test
|
|
98
|
+
|
|
99
|
+
# Review for security
|
|
100
|
+
/review
|
|
101
|
+
|
|
102
|
+
# Deploy to testnet
|
|
103
|
+
/deploy-full:testnet
|
|
104
|
+
```
|
|
105
|
+
|