axiodb 7.33.230 → 7.33.233
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/.antigravity/rules.md +228 -0
- package/.claude/SETTINGS.md +161 -0
- package/.claude/commands/build-check.md +18 -0
- package/.claude/commands/collection-op.md +53 -0
- package/.claude/commands/docs.md +49 -0
- package/.claude/commands/feature.md +38 -0
- package/.claude/commands/fix-build.md +46 -0
- package/.claude/commands/helper.md +67 -0
- package/.claude/commands/index-op.md +50 -0
- package/.claude/commands/perf-check.md +75 -0
- package/.claude/commands/review.md +12 -0
- package/.claude/commands/tcp-command.md +58 -0
- package/.claude/commands/test.md +30 -0
- package/.claude/commands/transaction-op.md +72 -0
- package/.claude/rules/architecture.md +98 -0
- package/.claude/rules/code-standards.md +282 -0
- package/.claude/rules/commands.md +40 -0
- package/.claude/rules/documentation.md +183 -0
- package/.claude/rules/workflow.md +160 -0
- package/.codex/config.toml +149 -0
- package/.cursor/rules/axiodb-core.md +391 -0
- package/.cursorrules +60 -0
- package/AGENTS.md +371 -0
- package/AI_TOOLS_SETUP.md +368 -0
- package/CLAUDE.md +92 -0
- package/GEMINI.md +117 -0
- package/lib/client/AxioDBCloud.client.js +33 -1
- package/lib/client/AxioDBCloud.client.js.map +1 -1
- package/lib/tcp/config/protocol.js +8 -0
- package/lib/tcp/config/protocol.js.map +1 -1
- package/lib/tcp/connection/ConnectionManager.js +2 -0
- package/lib/tcp/connection/ConnectionManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Antigravity IDE Rules for AxioDB
|
|
2
|
+
|
|
3
|
+
## Project Identity
|
|
4
|
+
|
|
5
|
+
**AxioDB** - Embedded NoSQL database for Node.js
|
|
6
|
+
- TypeScript strict mode → CommonJS
|
|
7
|
+
- Node.js ≥20.0.0
|
|
8
|
+
- Zero native dependencies
|
|
9
|
+
- Singleton pattern, file-per-document storage
|
|
10
|
+
|
|
11
|
+
## Agent Instructions
|
|
12
|
+
|
|
13
|
+
### Planning Mode
|
|
14
|
+
|
|
15
|
+
When in Planning Mode, create detailed task lists:
|
|
16
|
+
1. Identify affected components
|
|
17
|
+
2. Plan implementation approach
|
|
18
|
+
3. List test requirements
|
|
19
|
+
4. Document update requirements
|
|
20
|
+
5. Build verification steps
|
|
21
|
+
|
|
22
|
+
### Fast Mode
|
|
23
|
+
|
|
24
|
+
For quick tasks, ensure:
|
|
25
|
+
- Build after changes
|
|
26
|
+
- No breaking existing tests
|
|
27
|
+
- Follow existing patterns
|
|
28
|
+
|
|
29
|
+
## Core Principles
|
|
30
|
+
|
|
31
|
+
### 1. ALWAYS Build
|
|
32
|
+
```bash
|
|
33
|
+
npm run build # After every code change
|
|
34
|
+
```
|
|
35
|
+
TypeScript errors in production are unacceptable.
|
|
36
|
+
|
|
37
|
+
### 2. ALWAYS Test
|
|
38
|
+
Update `Test/modules/` for ANY feature change:
|
|
39
|
+
- `crud.test.js` - CRUD operations
|
|
40
|
+
- `transaction.test.js` - Transactions, WAL
|
|
41
|
+
- `read.test.js` - Read optimizations
|
|
42
|
+
|
|
43
|
+
### 3. NEVER Incomplete
|
|
44
|
+
Definition of "Done":
|
|
45
|
+
- ✅ Code written
|
|
46
|
+
- ✅ `npm run build` passes
|
|
47
|
+
- ✅ Tests added/updated
|
|
48
|
+
- ✅ `npm test` passes
|
|
49
|
+
- ✅ Docs updated
|
|
50
|
+
- ✅ No regressions
|
|
51
|
+
|
|
52
|
+
### 4. SOLID + DRY
|
|
53
|
+
- Single responsibility per class
|
|
54
|
+
- Extract duplicated logic to helpers
|
|
55
|
+
- No hacky solutions
|
|
56
|
+
- Production-grade code only
|
|
57
|
+
|
|
58
|
+
### 5. TypeScript Strict
|
|
59
|
+
- No `any` types (use proper interfaces)
|
|
60
|
+
- Null checks: `if (obj !== null)`
|
|
61
|
+
- Type guards for unknown types
|
|
62
|
+
- Enums or const objects (no magic strings)
|
|
63
|
+
|
|
64
|
+
## Architecture Patterns
|
|
65
|
+
|
|
66
|
+
### Singleton Pattern
|
|
67
|
+
```typescript
|
|
68
|
+
private static _instance: AxioDB;
|
|
69
|
+
constructor() {
|
|
70
|
+
if (AxioDB._instance) throw new Error("Only one instance allowed");
|
|
71
|
+
AxioDB._instance = this;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
**Implication**: Tests must run in separate processes
|
|
75
|
+
|
|
76
|
+
### Dual-Write (Indexes)
|
|
77
|
+
```typescript
|
|
78
|
+
// Memory (speed) + Disk (durability)
|
|
79
|
+
await this.indexCache.set(key, data, TTL);
|
|
80
|
+
await this.fileManager.writeFile(path, JSON.stringify(data));
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Random Cache TTL
|
|
84
|
+
```typescript
|
|
85
|
+
// 5-15 minutes (prevent cache stampede)
|
|
86
|
+
const TTL = Math.floor(Math.random() * (15 - 5 + 1) + 5) * 60 * 1000;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### File Structure
|
|
90
|
+
- Database: `{RootPath}/{DatabaseName}/`
|
|
91
|
+
- Collection: `{DatabasePath}/{CollectionName}/`
|
|
92
|
+
- Document: `{CollectionPath}/{documentId}.axiodb`
|
|
93
|
+
|
|
94
|
+
## Module Organization
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
source/
|
|
98
|
+
├── Services/ # Database, Collection, CRUD, Index, Transaction
|
|
99
|
+
├── engine/ # FileManager, FolderManager
|
|
100
|
+
├── server/ # HTTP GUI (Fastify, port 27018)
|
|
101
|
+
├── tcp/ # TCP server (AxioDBCloud, port 27019)
|
|
102
|
+
├── client/ # TCP client + Proxies
|
|
103
|
+
├── Helper/ # Converter, Crypto, Response
|
|
104
|
+
└── Memory/ # InMemoryCache
|
|
105
|
+
|
|
106
|
+
Test/modules/ # Tests (separate processes)
|
|
107
|
+
Document/ # React docs site
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Naming Conventions
|
|
111
|
+
|
|
112
|
+
- **Files**: `{Feature}.operation.ts`, `{Feature}.service.ts`, `{Feature}.helper.ts`
|
|
113
|
+
- **Classes**: PascalCase: `FileManager`, `QueryMatcher`
|
|
114
|
+
- **Methods**: camelCase: `createDatabase()`, `isValidDocument()`
|
|
115
|
+
- **Variables**: camelCase: `documentId`, `collectionPath`
|
|
116
|
+
|
|
117
|
+
## Error Handling
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
async function operation(): Promise<SuccessInterface | ErrorInterface> {
|
|
121
|
+
try {
|
|
122
|
+
const result = await this.execute();
|
|
123
|
+
return this.ResponseHelper.success(result);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
this.logger.error('Operation failed', error);
|
|
126
|
+
return this.ResponseHelper.error('Failed', StatusCodes.ERROR);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Performance
|
|
132
|
+
|
|
133
|
+
1. **Use InMemoryCache**: Check cache before disk reads
|
|
134
|
+
2. **Batch operations**: `Promise.all` instead of sequential
|
|
135
|
+
3. **Avoid unnecessary I/O**: Read once, process in memory
|
|
136
|
+
4. **Use Map**: O(1) lookups vs Array O(n)
|
|
137
|
+
|
|
138
|
+
## Security
|
|
139
|
+
|
|
140
|
+
1. **Validate input**: Check types, reject arrays as documents
|
|
141
|
+
2. **Sanitize paths**: `documentId.replace(/[^a-zA-Z0-9-_]/g, '_')`
|
|
142
|
+
3. **Encrypt sensitive**: Use AES-256 for collections with sensitive data
|
|
143
|
+
4. **No stack traces**: Return generic error messages to users
|
|
144
|
+
|
|
145
|
+
## Documentation Requirements
|
|
146
|
+
|
|
147
|
+
When adding/changing features, update:
|
|
148
|
+
1. **README.md** - Public API, examples, features list
|
|
149
|
+
2. **Document/** - React docs site (run `cd Document && npm run dev`)
|
|
150
|
+
3. **Dockerfile** - If ports/env/commands change
|
|
151
|
+
4. **JSDoc** - All public methods
|
|
152
|
+
|
|
153
|
+
## Common Workflows
|
|
154
|
+
|
|
155
|
+
### Add Collection Operation
|
|
156
|
+
1. Edit `source/Services/Collection/collection.operation.ts`
|
|
157
|
+
2. Add method with proper types, error handling
|
|
158
|
+
3. Add to HTTP API: `source/server/router/` + `controller/`
|
|
159
|
+
4. Add to TCP API: `source/tcp/handler/`
|
|
160
|
+
5. Create tests in `Test/modules/crud.test.js`
|
|
161
|
+
6. Update docs (README, Document/)
|
|
162
|
+
7. Build: `npm run build && npm test`
|
|
163
|
+
|
|
164
|
+
### Add TCP Command
|
|
165
|
+
1. Create handler: `source/tcp/handler/{command}.ts`
|
|
166
|
+
2. Add client proxy: `source/client/{Feature}Proxy.ts`
|
|
167
|
+
3. Register in command map
|
|
168
|
+
4. Add tests
|
|
169
|
+
5. Update docs
|
|
170
|
+
|
|
171
|
+
### Add Helper Utility
|
|
172
|
+
1. Create: `source/Helper/{Feature}.helper.ts`
|
|
173
|
+
2. Use static methods (stateless)
|
|
174
|
+
3. Import in services that need it
|
|
175
|
+
4. DRY principle - extract duplicated logic
|
|
176
|
+
|
|
177
|
+
## Anti-Patterns to Avoid
|
|
178
|
+
|
|
179
|
+
❌ Using `any` types
|
|
180
|
+
❌ Duplicated code (copy-paste)
|
|
181
|
+
❌ Sequential operations that could be parallel
|
|
182
|
+
❌ Ignoring build errors
|
|
183
|
+
❌ Skipping tests
|
|
184
|
+
❌ Missing documentation
|
|
185
|
+
❌ Hardcoded values (use constants/config)
|
|
186
|
+
❌ Unclear variable names
|
|
187
|
+
❌ Deep nesting (>3 levels)
|
|
188
|
+
|
|
189
|
+
## Agent-Specific Tips
|
|
190
|
+
|
|
191
|
+
### When Creating Features
|
|
192
|
+
1. Read related files first
|
|
193
|
+
2. Understand existing patterns
|
|
194
|
+
3. Follow established architecture
|
|
195
|
+
4. Test edge cases
|
|
196
|
+
5. Document thoroughly
|
|
197
|
+
|
|
198
|
+
### When Refactoring
|
|
199
|
+
1. Ensure tests exist first
|
|
200
|
+
2. Make changes incrementally
|
|
201
|
+
3. Run tests after each change
|
|
202
|
+
4. Verify no performance regression
|
|
203
|
+
|
|
204
|
+
### When Fixing Bugs
|
|
205
|
+
1. Write failing test first
|
|
206
|
+
2. Fix the bug
|
|
207
|
+
3. Verify test passes
|
|
208
|
+
4. Check for similar issues elsewhere
|
|
209
|
+
5. Document the fix
|
|
210
|
+
|
|
211
|
+
## Multi-Agent Coordination
|
|
212
|
+
|
|
213
|
+
If using parallel agents:
|
|
214
|
+
- Assign different files/modules to each agent
|
|
215
|
+
- Avoid concurrent edits to same file
|
|
216
|
+
- Coordinate through planning artifacts
|
|
217
|
+
- Merge changes carefully
|
|
218
|
+
|
|
219
|
+
## Success Criteria
|
|
220
|
+
|
|
221
|
+
Every task must meet ALL criteria:
|
|
222
|
+
- Builds successfully
|
|
223
|
+
- Tests pass
|
|
224
|
+
- Docs updated
|
|
225
|
+
- No regressions
|
|
226
|
+
- Follows patterns
|
|
227
|
+
- Security validated
|
|
228
|
+
- Performance acceptable
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Claude Code Settings
|
|
2
|
+
|
|
3
|
+
## Permissions Configuration
|
|
4
|
+
|
|
5
|
+
### Allowed Commands
|
|
6
|
+
|
|
7
|
+
**Build & Test:**
|
|
8
|
+
- `npm run build`, `npm test`, `npm run lint`
|
|
9
|
+
- `npm install`, `npm ci`
|
|
10
|
+
- `npx tsc`, `npx eslint`
|
|
11
|
+
- `node Test/*` - Run specific tests
|
|
12
|
+
- `node -e` - Execute Node.js code
|
|
13
|
+
|
|
14
|
+
**Git Operations:**
|
|
15
|
+
- `git status`, `git diff`, `git log` - Read operations
|
|
16
|
+
- `git add`, `git commit` - Stage and commit
|
|
17
|
+
- `git push`, `git pull`, `git fetch` - Sync with remote
|
|
18
|
+
- `git branch`, `git checkout`, `git merge` - Branch operations
|
|
19
|
+
- `git stash` - Temporary storage
|
|
20
|
+
- `gh pr`, `gh repo` - GitHub CLI (PRs, repo info)
|
|
21
|
+
|
|
22
|
+
**Docker Commands:**
|
|
23
|
+
- `docker build`, `docker run` - Build and run containers
|
|
24
|
+
- `docker logs`, `docker exec` - Debugging
|
|
25
|
+
- `docker ps`, `docker images` - List resources
|
|
26
|
+
- `docker stop` - Stop containers (safe)
|
|
27
|
+
|
|
28
|
+
**File Operations:**
|
|
29
|
+
- `ls`, `cat`, `wc`, `grep` - Read operations
|
|
30
|
+
- `find`, `tree`, `du` - Search and stats
|
|
31
|
+
- `mkdir` - Create directories (safe)
|
|
32
|
+
- `echo`, `pwd`, `which` - Info commands
|
|
33
|
+
|
|
34
|
+
### Denied Commands (Security)
|
|
35
|
+
|
|
36
|
+
**Destructive File Operations:**
|
|
37
|
+
- `rm -rf`, `rm -fr`, `rm -r`, `rm -f` - Prevent accidental deletion
|
|
38
|
+
- `chmod 777` - Prevent security issues
|
|
39
|
+
- `chown` - Prevent ownership changes
|
|
40
|
+
|
|
41
|
+
**Destructive Git Operations:**
|
|
42
|
+
- `git push --force`, `git push -f` - Prevent force pushes
|
|
43
|
+
- `git reset --hard` - Prevent hard resets
|
|
44
|
+
- `git clean -fd` - Prevent untracked file deletion
|
|
45
|
+
- `git branch -D` - Prevent force branch deletion
|
|
46
|
+
|
|
47
|
+
**Destructive Docker Operations:**
|
|
48
|
+
- `docker rm -f`, `docker rmi -f` - Prevent force removal
|
|
49
|
+
- `docker system prune -af` - Prevent pruning all resources
|
|
50
|
+
|
|
51
|
+
**Package Management:**
|
|
52
|
+
- `npm uninstall`, `npm remove` - Prevent dependency removal
|
|
53
|
+
- `npm publish` - Prevent accidental publishing
|
|
54
|
+
|
|
55
|
+
**Security Risks:**
|
|
56
|
+
- `sudo` - Prevent privilege escalation
|
|
57
|
+
- `curl *| bash`, `wget *| sh` - Prevent script injection
|
|
58
|
+
- `eval` - Prevent code injection
|
|
59
|
+
- Disk operations (`> /dev/sda`, `dd if=`) - Prevent disk damage
|
|
60
|
+
|
|
61
|
+
## Approval Requirements
|
|
62
|
+
|
|
63
|
+
### Require User Approval For:
|
|
64
|
+
- Editing config files: `package.json`, `tsconfig.json`, `.gitignore`, `Dockerfile`
|
|
65
|
+
- Publishing: `git push`, `npm publish`, `docker push`
|
|
66
|
+
|
|
67
|
+
### Auto-Approved (No Confirmation):
|
|
68
|
+
- Reading files: `Read`, `Glob`, `Grep`
|
|
69
|
+
- Building: `npm run build`
|
|
70
|
+
- Testing: `npm test`
|
|
71
|
+
- Linting: `npm run lint`
|
|
72
|
+
- Git info: `git status`, `git diff`, `git log`
|
|
73
|
+
|
|
74
|
+
## Development Rules
|
|
75
|
+
|
|
76
|
+
**Enabled:**
|
|
77
|
+
- `require_tests_for_features: true` - Tests mandatory for new features
|
|
78
|
+
- `require_docs_for_features: true` - Docs mandatory for new features
|
|
79
|
+
|
|
80
|
+
**Disabled (Manual Control):**
|
|
81
|
+
- `auto_build_after_edit: false` - Don't auto-build (you control when)
|
|
82
|
+
- `auto_test_after_build: false` - Don't auto-test (you control when)
|
|
83
|
+
|
|
84
|
+
## AxioDB-Specific Rules
|
|
85
|
+
|
|
86
|
+
**Enforced Patterns:**
|
|
87
|
+
- `singleton_check: true` - Verify singleton pattern compliance
|
|
88
|
+
- `test_isolation_required: true` - Tests must run in separate processes
|
|
89
|
+
- `dual_write_pattern_enforced: true` - Indexes must write to memory + disk
|
|
90
|
+
- `cache_ttl_random: true` - Cache TTL must be randomized (5-15min)
|
|
91
|
+
|
|
92
|
+
## Why These Settings?
|
|
93
|
+
|
|
94
|
+
### Safety First
|
|
95
|
+
Prevents accidental destructive operations:
|
|
96
|
+
- No `rm -rf` to delete entire directories
|
|
97
|
+
- No `git push --force` to overwrite remote history
|
|
98
|
+
- No `docker system prune -af` to remove all resources
|
|
99
|
+
|
|
100
|
+
### Development Workflow
|
|
101
|
+
Allows normal development tasks:
|
|
102
|
+
- Build, test, lint freely
|
|
103
|
+
- Commit and push safely
|
|
104
|
+
- Run Docker containers for testing
|
|
105
|
+
- Execute Node.js scripts
|
|
106
|
+
|
|
107
|
+
### Quality Control
|
|
108
|
+
Requires approval for critical changes:
|
|
109
|
+
- Package.json modifications need review
|
|
110
|
+
- Publishing requires confirmation
|
|
111
|
+
- Config changes need approval
|
|
112
|
+
|
|
113
|
+
### AxioDB Compliance
|
|
114
|
+
Enforces project-specific patterns:
|
|
115
|
+
- Singleton pattern verification
|
|
116
|
+
- Test isolation (separate processes)
|
|
117
|
+
- Dual-write pattern for indexes
|
|
118
|
+
- Random cache TTL
|
|
119
|
+
|
|
120
|
+
## Modifying Settings
|
|
121
|
+
|
|
122
|
+
To add new allowed commands:
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"permissions": {
|
|
126
|
+
"allow": [
|
|
127
|
+
"Bash(your-command:*)"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
To deny additional commands:
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"permissions": {
|
|
137
|
+
"deny": [
|
|
138
|
+
"Bash(dangerous-command:*)"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Emergency Override
|
|
145
|
+
|
|
146
|
+
If you need to run a blocked command:
|
|
147
|
+
1. Temporarily edit `.claude/settings.json`
|
|
148
|
+
2. Add command to `allow` list
|
|
149
|
+
3. Run the command
|
|
150
|
+
4. Remove from `allow` list (restore safety)
|
|
151
|
+
|
|
152
|
+
**Better approach**: Ask Claude to use alternative safe commands.
|
|
153
|
+
|
|
154
|
+
## Summary
|
|
155
|
+
|
|
156
|
+
This configuration provides:
|
|
157
|
+
- ✅ Full development workflow access
|
|
158
|
+
- ✅ Protection against destructive operations
|
|
159
|
+
- ✅ Approval gates for critical changes
|
|
160
|
+
- ✅ AxioDB pattern enforcement
|
|
161
|
+
- ✅ Safe by default, flexible when needed
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Build and verify the project for: $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Execute in order:
|
|
4
|
+
1. **TypeScript compilation**: `npm run build`
|
|
5
|
+
2. **Lint check**: `npm run lint`
|
|
6
|
+
3. **Type check**: `npx tsc --noEmit`
|
|
7
|
+
|
|
8
|
+
If any step fails:
|
|
9
|
+
- Show exact error messages with file paths and line numbers
|
|
10
|
+
- Suggest specific fixes
|
|
11
|
+
- Do NOT continue to next step until current step passes
|
|
12
|
+
|
|
13
|
+
If all pass:
|
|
14
|
+
- Report success
|
|
15
|
+
- Show compiled output location (lib/)
|
|
16
|
+
- Suggest running tests: `npm test`
|
|
17
|
+
|
|
18
|
+
This is MANDATORY before declaring any task complete.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Create new collection operation: $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Location: `source/Services/Collection/collection.operation.ts`
|
|
4
|
+
|
|
5
|
+
**Step 1: Add Method to Collection Class**
|
|
6
|
+
```typescript
|
|
7
|
+
/**
|
|
8
|
+
* Description of operation
|
|
9
|
+
* @param {Type} param - Parameter description
|
|
10
|
+
* @returns {Promise<SuccessInterface | ErrorInterface>} Result
|
|
11
|
+
*/
|
|
12
|
+
async operationName(param: Type): Promise<SuccessInterface | ErrorInterface> {
|
|
13
|
+
try {
|
|
14
|
+
// Validation
|
|
15
|
+
if (!param) {
|
|
16
|
+
return this.ResponseHelper.error('Invalid input', StatusCodes.BAD_REQUEST);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Operation logic
|
|
20
|
+
const result = await this.performOperation(param);
|
|
21
|
+
|
|
22
|
+
// Cache update if needed
|
|
23
|
+
this.cache.invalidate(cacheKey);
|
|
24
|
+
|
|
25
|
+
return this.ResponseHelper.success(result);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
this.logger.error('Operation failed', error);
|
|
28
|
+
return this.ResponseHelper.error('Operation failed', StatusCodes.INTERNAL_SERVER_ERROR);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Step 2: Add to HTTP API** (if needed)
|
|
34
|
+
- Router: `source/server/router/Routers/Collection.routes.ts`
|
|
35
|
+
- Controller: `source/server/controller/Collection/collection.controller.ts`
|
|
36
|
+
|
|
37
|
+
**Step 3: Add to TCP API** (if needed)
|
|
38
|
+
- Handler: `source/tcp/handler/`
|
|
39
|
+
- Add command to protocol types
|
|
40
|
+
|
|
41
|
+
**Step 4: Add Tests**
|
|
42
|
+
- File: `Test/modules/crud.test.js` or relevant module
|
|
43
|
+
- Test success, errors, edge cases
|
|
44
|
+
|
|
45
|
+
**Step 5: Documentation**
|
|
46
|
+
- Update README.md API Reference
|
|
47
|
+
- Update Document/ with examples
|
|
48
|
+
- Add JSDoc comments
|
|
49
|
+
|
|
50
|
+
**Step 6: Build & Verify**
|
|
51
|
+
```bash
|
|
52
|
+
npm run build && npm test
|
|
53
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Update documentation for: $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
**Step 1: README.md**
|
|
4
|
+
- Location: Root `/README.md`
|
|
5
|
+
- Update sections: Features, API Reference, Quick Start, Examples
|
|
6
|
+
- Add version tag if new feature (e.g., "v5.33+")
|
|
7
|
+
- Ensure examples are tested and working
|
|
8
|
+
|
|
9
|
+
**Step 2: Document/ (React Docs Site)**
|
|
10
|
+
```bash
|
|
11
|
+
cd Document
|
|
12
|
+
npm run dev # Start at localhost:5173
|
|
13
|
+
```
|
|
14
|
+
- Create or update page in `src/pages/`
|
|
15
|
+
- Add navigation links
|
|
16
|
+
- Include:
|
|
17
|
+
- Overview (what, why)
|
|
18
|
+
- Quick start example
|
|
19
|
+
- Detailed usage
|
|
20
|
+
- API reference
|
|
21
|
+
- Best practices
|
|
22
|
+
- Common pitfalls
|
|
23
|
+
- Test examples work
|
|
24
|
+
- Build: `npm run build`
|
|
25
|
+
|
|
26
|
+
**Step 3: Dockerfile** (if needed)
|
|
27
|
+
- Update port numbers (EXPOSE)
|
|
28
|
+
- Update environment variables (ENV)
|
|
29
|
+
- Update comments explaining changes
|
|
30
|
+
- Update volume mounts (VOLUME)
|
|
31
|
+
|
|
32
|
+
**Step 4: JSDoc Comments**
|
|
33
|
+
Add to all public methods:
|
|
34
|
+
```typescript
|
|
35
|
+
/**
|
|
36
|
+
* Method description
|
|
37
|
+
* @param {Type} paramName - Description
|
|
38
|
+
* @returns {Promise<Type>} Description
|
|
39
|
+
* @example
|
|
40
|
+
* const result = await method();
|
|
41
|
+
*/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Verify:
|
|
45
|
+
- [ ] README.md updated
|
|
46
|
+
- [ ] Document/ updated and builds
|
|
47
|
+
- [ ] Dockerfile updated (if relevant)
|
|
48
|
+
- [ ] JSDoc added
|
|
49
|
+
- [ ] Examples tested
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Implement new feature: $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Follow AxioDB patterns:
|
|
4
|
+
|
|
5
|
+
**Step 1: Plan**
|
|
6
|
+
- Identify affected components (Collection, CRUD, Index, Transaction)
|
|
7
|
+
- Choose appropriate location:
|
|
8
|
+
- Services/{category}/ for core operations
|
|
9
|
+
- Helper/ for utilities
|
|
10
|
+
- engine/ for file operations
|
|
11
|
+
- server/router/ + controller/ for HTTP API
|
|
12
|
+
- tcp/handler/ for TCP commands
|
|
13
|
+
|
|
14
|
+
**Step 2: Implement**
|
|
15
|
+
- Follow SOLID principles (single responsibility, dependency injection)
|
|
16
|
+
- Use TypeScript strict mode (no `any` types)
|
|
17
|
+
- Add proper error handling with ResponseHelper
|
|
18
|
+
- Use InMemoryCache where appropriate
|
|
19
|
+
- Follow dual-write pattern for indexes (memory + disk)
|
|
20
|
+
|
|
21
|
+
**Step 3: Test**
|
|
22
|
+
- Add tests to Test/modules/ (MANDATORY)
|
|
23
|
+
- Test happy path, edge cases, errors
|
|
24
|
+
- Run `npm run build && npm test`
|
|
25
|
+
|
|
26
|
+
**Step 4: Document**
|
|
27
|
+
- Update README.md (if public API)
|
|
28
|
+
- Update Document/ folder (create/update page)
|
|
29
|
+
- Update Dockerfile (if deployment-related)
|
|
30
|
+
- Add JSDoc comments to public methods
|
|
31
|
+
|
|
32
|
+
**Step 5: Verify**
|
|
33
|
+
- Build passes: `npm run build`
|
|
34
|
+
- Tests pass: `npm test`
|
|
35
|
+
- Lint passes: `npm run lint`
|
|
36
|
+
- Documentation builds: `cd Document && npm run build`
|
|
37
|
+
|
|
38
|
+
Only mark complete when ALL steps are done.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Fix build errors for: $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
**Step 1: Run Build**
|
|
4
|
+
```bash
|
|
5
|
+
npm run build
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
**Step 2: Analyze Errors**
|
|
9
|
+
Common TypeScript errors in AxioDB:
|
|
10
|
+
|
|
11
|
+
**Type Errors:**
|
|
12
|
+
- `Type 'any' is not assignable` → Add proper interface
|
|
13
|
+
- `Property does not exist` → Add to interface or check spelling
|
|
14
|
+
- `Cannot find module` → Check import path (relative: ../, absolute: source/)
|
|
15
|
+
- `Type 'X' is not assignable to type 'Y'` → Fix type mismatch
|
|
16
|
+
|
|
17
|
+
**Import Errors:**
|
|
18
|
+
- Missing imports → Add import statement
|
|
19
|
+
- Circular dependencies → Refactor to break cycle
|
|
20
|
+
- Wrong path → Verify file location in source/
|
|
21
|
+
|
|
22
|
+
**Strict Mode Errors:**
|
|
23
|
+
- `Object is possibly 'null'` → Add null check: `if (obj !== null)`
|
|
24
|
+
- `Object is possibly 'undefined'` → Add undefined check or use `??`
|
|
25
|
+
- `Parameter 'x' implicitly has 'any' type` → Add explicit type
|
|
26
|
+
|
|
27
|
+
**Step 3: Fix Each Error**
|
|
28
|
+
For each error:
|
|
29
|
+
1. Note file path and line number
|
|
30
|
+
2. Read surrounding code for context
|
|
31
|
+
3. Apply fix following AxioDB patterns
|
|
32
|
+
4. Verify fix doesn't break other code
|
|
33
|
+
|
|
34
|
+
**Step 4: Verify**
|
|
35
|
+
```bash
|
|
36
|
+
npm run build # Must pass
|
|
37
|
+
npx tsc --noEmit # Type check
|
|
38
|
+
npm run lint # Lint check
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Step 5: Test**
|
|
42
|
+
```bash
|
|
43
|
+
npm test # Ensure no regressions
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Only mark complete when build succeeds with zero errors.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Create new helper utility: $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Location: `source/Helper/{FeatureName}.helper.ts`
|
|
4
|
+
|
|
5
|
+
**Helper Pattern:**
|
|
6
|
+
```typescript
|
|
7
|
+
/**
|
|
8
|
+
* Helper class for {feature description}
|
|
9
|
+
*/
|
|
10
|
+
export class {FeatureName}Helper {
|
|
11
|
+
/**
|
|
12
|
+
* Method description
|
|
13
|
+
* @param {Type} param - Parameter description
|
|
14
|
+
* @returns {ReturnType} Return description
|
|
15
|
+
*/
|
|
16
|
+
static methodName(param: Type): ReturnType {
|
|
17
|
+
// Pure function - no side effects
|
|
18
|
+
// Stateless - no instance variables
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Guidelines:**
|
|
25
|
+
- Use static methods (helpers are stateless)
|
|
26
|
+
- Pure functions (same input = same output)
|
|
27
|
+
- No dependencies on AxioDB instance
|
|
28
|
+
- Single responsibility (one concern per helper)
|
|
29
|
+
- Reusable across multiple services
|
|
30
|
+
|
|
31
|
+
**Common Helper Types:**
|
|
32
|
+
- **Data transformation**: `Converter.helper.ts`
|
|
33
|
+
- **Validation**: `Validator.helper.ts`
|
|
34
|
+
- **Encryption**: `Crypto.helper.ts`
|
|
35
|
+
- **Formatting**: `Formatter.helper.ts`
|
|
36
|
+
- **Query matching**: `QueryMatcher.helper.ts`
|
|
37
|
+
|
|
38
|
+
**DRY Principle:**
|
|
39
|
+
If the same logic appears in 2+ files, extract to a helper.
|
|
40
|
+
|
|
41
|
+
**Example:**
|
|
42
|
+
```typescript
|
|
43
|
+
// Helper/QueryMatcher.helper.ts
|
|
44
|
+
export class QueryMatcher {
|
|
45
|
+
static matchDocument(doc: any, query: any): boolean {
|
|
46
|
+
// Logic here
|
|
47
|
+
return matches;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static filterDocuments(docs: any[], query: any): any[] {
|
|
51
|
+
return docs.filter(d => this.matchDocument(d, query));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Usage in Reader.operation.ts
|
|
56
|
+
import { QueryMatcher } from '../Helper/QueryMatcher.helper';
|
|
57
|
+
const filtered = QueryMatcher.filterDocuments(documents, query);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Steps:**
|
|
61
|
+
1. Create helper file in `source/Helper/`
|
|
62
|
+
2. Implement static methods
|
|
63
|
+
3. Add TypeScript interfaces for parameters
|
|
64
|
+
4. Add JSDoc comments
|
|
65
|
+
5. Import and use in relevant services
|
|
66
|
+
6. Add tests (if complex logic)
|
|
67
|
+
7. Build: `npm run build`
|