@aurora.purecore.codes/latest 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.
@@ -0,0 +1,380 @@
1
+ # Testing `aurora init` Command
2
+
3
+ This guide helps you test the `aurora init` command that downloads pre-compiled binaries from GitHub releases.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js installed
8
+ - Internet connection
9
+ - WSL (if on Windows)
10
+
11
+ ## Test 1: Basic Init with Binary Download
12
+
13
+ ```bash
14
+ # Create a test directory
15
+ mkdir test-aurora-project
16
+ cd test-aurora-project
17
+
18
+ # Run aurora init
19
+ aurora init
20
+ ```
21
+
22
+ ### Expected Output
23
+
24
+ ```
25
+ 🚀 Initializing Aurora project...
26
+
27
+ âś“ Created aurora.json
28
+ âś“ Created project directories
29
+ â ‹ Downloading Austral compiler...
30
+ âś“ Compiler v0.2.0 downloaded: /home/user/.aurora_austral/bin/austral
31
+ âś“ Compiler installed: .aurora/bin/austral
32
+ â ‹ Downloading standard library...
33
+ âś“ Standard library installed: .aurora/stdlib
34
+ âś“ Created src/Main.aui
35
+ âś“ Created src/Main.aum
36
+ âś“ Created Makefile
37
+ âś“ Created .gitignore
38
+
39
+ ✨ Project initialized successfully!
40
+
41
+ Next steps:
42
+ 1. Edit src/Main.aum
43
+ 2. Run: make build
44
+ 3. Run: ./main
45
+ 4. Install packages: aurora install <package-name>
46
+ ```
47
+
48
+ ### Expected File Structure
49
+
50
+ ```
51
+ test-aurora-project/
52
+ ├── .aurora/
53
+ │ ├── bin/
54
+ │ │ └── austral # Downloaded compiler binary
55
+ │ └── stdlib/ # Standard library
56
+ │ ├── Tuples.aui
57
+ │ ├── Tuples.aum
58
+ │ ├── String.aui
59
+ │ └── ...
60
+ ├── aurora_packages/ # Empty initially
61
+ ├── src/
62
+ │ ├── Main.aui
63
+ │ └── Main.aum
64
+ ├── aurora.json
65
+ ├── Makefile
66
+ └── .gitignore
67
+ ```
68
+
69
+ ### Verify aurora.json
70
+
71
+ ```json
72
+ {
73
+ "name": "test-aurora-project",
74
+ "version": "0.1.0",
75
+ "description": "Aurora Austral project",
76
+ "main": "src/Main.aum",
77
+ "scripts": {
78
+ "build": "make",
79
+ "test": "make test",
80
+ "clean": "make clean"
81
+ },
82
+ "dependencies": {},
83
+ "devDependencies": {},
84
+ "aurora": {
85
+ "compiler": "local",
86
+ "compilerPath": ".aurora/bin/austral",
87
+ "stdlibPath": ".aurora/stdlib"
88
+ }
89
+ }
90
+ ```
91
+
92
+ ## Test 2: Build the Project
93
+
94
+ ```bash
95
+ # Build using the downloaded compiler
96
+ make build
97
+ ```
98
+
99
+ ### Expected Output
100
+
101
+ ```
102
+ Building project...
103
+ .aurora/bin/austral compile .aurora/stdlib/Tuples.aui,.aurora/stdlib/Tuples.aum ... src/Main.aui,src/Main.aum --entrypoint=Example.Main:main --output=main
104
+ Build successful!
105
+ ```
106
+
107
+ ### Run the Program
108
+
109
+ ```bash
110
+ ./main
111
+ ```
112
+
113
+ ### Expected Output
114
+
115
+ ```
116
+ Hello, Aurora Austral!
117
+ ```
118
+
119
+ ## Test 3: Init Without Binary Download
120
+
121
+ ```bash
122
+ # Create another test directory
123
+ mkdir test-no-binary
124
+ cd test-no-binary
125
+
126
+ # Run aurora init without downloading binaries
127
+ aurora init --no-binary
128
+ ```
129
+
130
+ ### Expected Behavior
131
+
132
+ - Creates project structure
133
+ - Does NOT download compiler or stdlib
134
+ - aurora.json will have `"compiler": "local"` but no paths
135
+ - User must have `austral` in system PATH
136
+
137
+ ## Test 4: Verify Cached Binaries
138
+
139
+ ```bash
140
+ # Check global cache
141
+ ls -la ~/.aurora_austral/bin/
142
+ ls -la ~/.aurora_austral/bin/stdlib/
143
+ ```
144
+
145
+ ### Expected Files
146
+
147
+ ```
148
+ ~/.aurora_austral/
149
+ ├── bin/
150
+ │ └── austral # Cached compiler (755 permissions)
151
+ └── packages/ # Package cache (from aurora install)
152
+ ```
153
+
154
+ ## Test 5: Platform Detection
155
+
156
+ The command should automatically detect your platform:
157
+
158
+ - **Linux x64**: Downloads `austral-linux`
159
+ - **macOS Intel**: Downloads `austral-macos`
160
+ - **macOS ARM**: Downloads `austral-macos`
161
+ - **Windows x64**: Downloads `austral-windows.exe`
162
+
163
+ ### Verify Platform Detection
164
+
165
+ ```bash
166
+ node -e "console.log(require('os').platform(), require('os').arch())"
167
+ ```
168
+
169
+ ## Test 6: Second Init (Using Cache)
170
+
171
+ ```bash
172
+ # Create another project
173
+ mkdir test-cached
174
+ cd test-cached
175
+
176
+ # Run aurora init again
177
+ aurora init
178
+ ```
179
+
180
+ ### Expected Behavior
181
+
182
+ - Should show: "Standard library already cached"
183
+ - Should copy from cache instead of downloading again
184
+ - Much faster than first init
185
+
186
+ ## Troubleshooting
187
+
188
+ ### Error: "Failed to download compiler"
189
+
190
+ **Possible causes:**
191
+ 1. No internet connection
192
+ 2. GitHub API rate limit exceeded
193
+ 3. Release v0.2.0 doesn't exist or binaries not uploaded
194
+
195
+ **Solution:**
196
+ - Check internet connection
197
+ - Wait for GitHub rate limit to reset (1 hour)
198
+ - Use `--no-binary` flag and install compiler manually
199
+
200
+ ### Error: "No binary available for platform"
201
+
202
+ **Cause:** Your platform is not supported (e.g., 32-bit systems, ARM Linux)
203
+
204
+ **Solution:**
205
+ - Compile the compiler from source
206
+ - Use `aurora init --no-binary`
207
+
208
+ ### Error: "Permission denied" when running ./main
209
+
210
+ **Cause:** Binary doesn't have execute permissions
211
+
212
+ **Solution:**
213
+ ```bash
214
+ chmod +x .aurora/bin/austral
215
+ chmod +x main
216
+ ```
217
+
218
+ ### Error: "cannot execute: required file not found"
219
+
220
+ **Cause:** Binary was compiled with dynamic linking (Nix, etc.)
221
+
222
+ **Solution:**
223
+ - The official release binaries should be statically linked
224
+ - If this happens, report it as a bug
225
+ - Workaround: Install compiler from source
226
+
227
+ ## Verifying Binary Integrity
228
+
229
+ Check the downloaded binary:
230
+
231
+ ```bash
232
+ # Check file type
233
+ file .aurora/bin/austral
234
+
235
+ # Expected output (Linux):
236
+ # .aurora/bin/austral: ELF 64-bit LSB executable, x86-64
237
+
238
+ # Check version
239
+ ./.aurora/bin/austral --version
240
+
241
+ # Expected output:
242
+ # 0.2.0
243
+ ```
244
+
245
+ ## Testing on Different Platforms
246
+
247
+ ### Linux (WSL or Native)
248
+
249
+ ```bash
250
+ cd /tmp
251
+ mkdir aurora-test-linux
252
+ cd aurora-test-linux
253
+ aurora init
254
+ make build
255
+ ./main
256
+ ```
257
+
258
+ ### macOS
259
+
260
+ ```bash
261
+ cd /tmp
262
+ mkdir aurora-test-macos
263
+ cd aurora-test-macos
264
+ aurora init
265
+ make build
266
+ ./main
267
+ ```
268
+
269
+ ### Windows (via WSL)
270
+
271
+ ```bash
272
+ # In WSL
273
+ cd /mnt/c/Users/YourName/Desktop
274
+ mkdir aurora-test-windows
275
+ cd aurora-test-windows
276
+ aurora init
277
+ make build
278
+ ./main
279
+ ```
280
+
281
+ ## Performance Benchmarks
282
+
283
+ ### First Init (with download)
284
+ - Expected time: 10-30 seconds (depends on internet speed)
285
+ - Downloads: ~5-10 MB (compiler) + ~500 KB (stdlib)
286
+
287
+ ### Second Init (from cache)
288
+ - Expected time: 1-3 seconds
289
+ - No downloads, just file copying
290
+
291
+ ## Integration with VSCode Extension
292
+
293
+ After running `aurora init`, the VSCode extension should:
294
+
295
+ 1. Detect `.aurora/bin/austral` compiler
296
+ 2. Use `.aurora/stdlib` for module resolution
297
+ 3. Validate imports against `aurora_packages/`
298
+ 4. Show install button for missing packages
299
+
300
+ ## Next Steps After Successful Init
301
+
302
+ 1. **Edit code**: Modify `src/Main.aum`
303
+ 2. **Build**: Run `make build`
304
+ 3. **Run**: Execute `./main`
305
+ 4. **Install packages**: `aurora install dpop-token`
306
+ 5. **Update packages**: `aurora update`
307
+
308
+ ## Reporting Issues
309
+
310
+ If you encounter problems:
311
+
312
+ 1. Check this troubleshooting guide
313
+ 2. Verify your platform is supported
314
+ 3. Check GitHub release exists: https://github.com/austral/austral/releases/tag/v0.2.0
315
+ 4. Report issue with:
316
+ - Platform and architecture (`uname -a`)
317
+ - Node.js version (`node --version`)
318
+ - Full error message
319
+ - Output of `aurora init` command
320
+
321
+ ## Success Criteria
322
+
323
+ âś… `aurora init` completes without errors
324
+ âś… Compiler binary is downloaded and executable
325
+ âś… Standard library is downloaded
326
+ âś… `make build` compiles successfully
327
+ âś… `./main` runs and prints "Hello, Aurora Austral!"
328
+ âś… Second init uses cache (faster)
329
+ âś… Project structure matches expected layout
330
+
331
+ ## Additional Tests
332
+
333
+ ### Test with Existing aurora.json
334
+
335
+ ```bash
336
+ # Create aurora.json first
337
+ echo '{"name":"test"}' > aurora.json
338
+
339
+ # Run init
340
+ aurora init
341
+
342
+ # Should show: "⚠️ aurora.json already exists"
343
+ # Should NOT overwrite existing file
344
+ ```
345
+
346
+ ### Test Makefile Detection
347
+
348
+ ```bash
349
+ # After init, verify Makefile detects compiler
350
+ grep "AU_COMPILER" Makefile
351
+
352
+ # Should show:
353
+ # ifneq (,$(wildcard .aurora/bin/austral))
354
+ # AU_COMPILER = .aurora/bin/austral
355
+ ```
356
+
357
+ ### Test .gitignore
358
+
359
+ ```bash
360
+ cat .gitignore
361
+
362
+ # Should include:
363
+ # aurora_packages/
364
+ # .aurora/bin/
365
+ # .aurora/stdlib/
366
+ # main
367
+ ```
368
+
369
+ ## Conclusion
370
+
371
+ The `aurora init` command provides a seamless onboarding experience by:
372
+
373
+ 1. âś… Creating project structure
374
+ 2. âś… Downloading pre-compiled binaries
375
+ 3. âś… Setting up standard library
376
+ 4. âś… Generating working example code
377
+ 5. âś… Creating intelligent Makefile
378
+ 6. âś… Caching for faster subsequent inits
379
+
380
+ This eliminates the need for users to manually compile the compiler or set up the environment!
package/TEST_LOCAL.md ADDED
@@ -0,0 +1,307 @@
1
+ # Testando Localmente
2
+
3
+ Guia para testar o `aurora init` localmente antes de fazer release.
4
+
5
+ ## Setup
6
+
7
+ ### 1. Instalar o aurora-npm localmente
8
+
9
+ ```bash
10
+ cd aurora-npm
11
+ npm install
12
+ npm link
13
+ ```
14
+
15
+ Isso cria um link simbĂłlico global para o comando `aurora`.
16
+
17
+ ### 2. Compilar binário local
18
+
19
+ ```bash
20
+ cd ../aurora-austral
21
+ make
22
+ ```
23
+
24
+ ### 3. Simular estrutura de release
25
+
26
+ Como ainda nĂŁo temos releases no GitHub, vamos simular localmente:
27
+
28
+ ```bash
29
+ cd aurora-npm
30
+
31
+ # Criar estrutura de "releases" local
32
+ mkdir -p releases
33
+ cp ../aurora-austral/austral releases/austral-linux-x64
34
+ chmod +x releases/austral-linux-x64
35
+
36
+ # Copiar stdlib
37
+ cp -r ../aurora-austral/standard/src releases/stdlib
38
+ ```
39
+
40
+ ### 4. Modificar temporariamente o cĂłdigo
41
+
42
+ Para testar localmente sem GitHub, modifique `bin/aurora.js`:
43
+
44
+ ```javascript
45
+ // Adicione no início da função downloadCompiler():
46
+ async function downloadCompiler(version = 'latest') {
47
+ const spinner = ora('Downloading Austral compiler...').start();
48
+
49
+ try {
50
+ const platform = getPlatform();
51
+ const binName = platform.startsWith('win') ? 'austral.exe' : 'austral';
52
+
53
+ // TESTE LOCAL: Use binário local em vez de GitHub
54
+ const localBinary = path.join(__dirname, '..', 'releases', `austral-${platform}`);
55
+ if (await fs.pathExists(localBinary)) {
56
+ spinner.text = 'Using local binary for testing...';
57
+ const cachedBinPath = path.join(BIN_CACHE_DIR, binName);
58
+ await fs.copy(localBinary, cachedBinPath);
59
+ await fs.chmod(cachedBinPath, 0o755);
60
+ spinner.succeed(`Compiler installed: ${cachedBinPath}`);
61
+ return cachedBinPath;
62
+ }
63
+
64
+ // Resto do cĂłdigo original...
65
+ ```
66
+
67
+ ## Testando
68
+
69
+ ### Teste 1: Init com binários
70
+
71
+ ```bash
72
+ # Criar diretĂłrio de teste
73
+ mkdir /tmp/test-aurora-init
74
+ cd /tmp/test-aurora-init
75
+
76
+ # Executar init
77
+ aurora init
78
+
79
+ # Verificar estrutura criada
80
+ ls -la
81
+ tree -L 2
82
+
83
+ # Verificar binário
84
+ ./.aurora/bin/austral --version
85
+
86
+ # Compilar exemplo
87
+ make build
88
+
89
+ # Executar
90
+ ./main
91
+ ```
92
+
93
+ **Resultado esperado:**
94
+ ```
95
+ Hello, Aurora Austral!
96
+ ```
97
+
98
+ ### Teste 2: Init sem binários
99
+
100
+ ```bash
101
+ mkdir /tmp/test-aurora-no-binary
102
+ cd /tmp/test-aurora-no-binary
103
+
104
+ aurora init --no-binary
105
+
106
+ # Deve usar austral do sistema
107
+ which austral
108
+ make build
109
+ ./main
110
+ ```
111
+
112
+ ### Teste 3: Instalar pacote
113
+
114
+ ```bash
115
+ cd /tmp/test-aurora-init
116
+
117
+ # Instalar pacote
118
+ aurora install dpop-token
119
+
120
+ # Verificar instalação
121
+ ls aurora_packages/
122
+ ls aurora_packages/dpop-token/
123
+ ```
124
+
125
+ ### Teste 4: Projeto existente
126
+
127
+ ```bash
128
+ mkdir /tmp/test-existing
129
+ cd /tmp/test-existing
130
+
131
+ # Criar alguns arquivos primeiro
132
+ mkdir src
133
+ echo "test" > src/test.txt
134
+
135
+ # Init deve respeitar arquivos existentes
136
+ aurora init
137
+
138
+ # Verificar que test.txt ainda existe
139
+ cat src/test.txt
140
+ ```
141
+
142
+ ## Verificações
143
+
144
+ ### âś… Checklist de Testes
145
+
146
+ - [ ] `aurora init` cria todos os arquivos
147
+ - [ ] `aurora init` baixa binário correto
148
+ - [ ] `aurora init` baixa stdlib
149
+ - [ ] Binário é executável
150
+ - [ ] `make build` funciona
151
+ - [ ] Programa compilado executa
152
+ - [ ] `aurora init --no-binary` funciona
153
+ - [ ] `aurora install` funciona apĂłs init
154
+ - [ ] Arquivos existentes sĂŁo preservados
155
+ - [ ] `.gitignore` Ă© criado corretamente
156
+ - [ ] `aurora.json` tem configuração correta
157
+
158
+ ### 🔍 Verificar Arquivos Criados
159
+
160
+ ```bash
161
+ cd /tmp/test-aurora-init
162
+
163
+ # Estrutura
164
+ tree -L 3
165
+
166
+ # aurora.json
167
+ cat aurora.json
168
+
169
+ # Makefile
170
+ cat Makefile
171
+
172
+ # Exemplo
173
+ cat src/Main.aui
174
+ cat src/Main.aum
175
+
176
+ # .gitignore
177
+ cat .gitignore
178
+
179
+ # Binário
180
+ file .aurora/bin/austral
181
+ .aurora/bin/austral --version
182
+
183
+ # Stdlib
184
+ ls .aurora/stdlib/
185
+ ```
186
+
187
+ ## Limpeza
188
+
189
+ ```bash
190
+ # Remover link global
191
+ npm unlink -g aurora-npm
192
+
193
+ # Remover diretĂłrios de teste
194
+ rm -rf /tmp/test-aurora-*
195
+
196
+ # Remover cache
197
+ rm -rf ~/.aurora_austral
198
+ ```
199
+
200
+ ## Problemas Comuns
201
+
202
+ ### Erro: "austral: command not found"
203
+
204
+ **Causa:** Binário não foi baixado ou não está executável
205
+
206
+ **Solução:**
207
+ ```bash
208
+ chmod +x .aurora/bin/austral
209
+ ls -la .aurora/bin/
210
+ ```
211
+
212
+ ### Erro: "AUSTRAL_STDLIB not found"
213
+
214
+ **Causa:** Stdlib nĂŁo foi baixada
215
+
216
+ **Solução:**
217
+ ```bash
218
+ ls .aurora/stdlib/
219
+ # Se vazio, baixar manualmente
220
+ cp -r ../aurora-austral/standard/src .aurora/stdlib/
221
+ ```
222
+
223
+ ### Erro: "cannot execute: required file not found"
224
+
225
+ **Causa:** Binário compilado com dependências dinâmicas (Nix)
226
+
227
+ **Solução:**
228
+ ```bash
229
+ # Recompilar sem Nix
230
+ cd aurora-austral
231
+ make clean
232
+ make
233
+ ```
234
+
235
+ ### Erro: "Permission denied"
236
+
237
+ **Causa:** Binário sem permissão de execução
238
+
239
+ **Solução:**
240
+ ```bash
241
+ chmod +x .aurora/bin/austral
242
+ ```
243
+
244
+ ## Teste de Integração Completo
245
+
246
+ Script para testar tudo de uma vez:
247
+
248
+ ```bash
249
+ #!/bin/bash
250
+
251
+ set -e
252
+
253
+ echo "đź§Ş Testing Aurora Init..."
254
+
255
+ # Cleanup
256
+ rm -rf /tmp/aurora-test
257
+ mkdir -p /tmp/aurora-test
258
+ cd /tmp/aurora-test
259
+
260
+ # Test 1: Init
261
+ echo "Test 1: aurora init"
262
+ aurora init
263
+ [ -f aurora.json ] || exit 1
264
+ [ -f Makefile ] || exit 1
265
+ [ -f .gitignore ] || exit 1
266
+ [ -d src ] || exit 1
267
+ [ -d .aurora ] || exit 1
268
+ echo "âś… Test 1 passed"
269
+
270
+ # Test 2: Build
271
+ echo "Test 2: make build"
272
+ make build
273
+ [ -f main ] || exit 1
274
+ echo "âś… Test 2 passed"
275
+
276
+ # Test 3: Run
277
+ echo "Test 3: ./main"
278
+ OUTPUT=$(./main)
279
+ [[ "$OUTPUT" == *"Hello"* ]] || exit 1
280
+ echo "âś… Test 3 passed"
281
+
282
+ # Test 4: Install package
283
+ echo "Test 4: aurora install dpop-token"
284
+ aurora install dpop-token
285
+ [ -d aurora_packages/dpop-token ] || exit 1
286
+ echo "âś… Test 4 passed"
287
+
288
+ echo ""
289
+ echo "🎉 All tests passed!"
290
+ ```
291
+
292
+ Salve como `test-integration.sh` e execute:
293
+
294
+ ```bash
295
+ chmod +x test-integration.sh
296
+ ./test-integration.sh
297
+ ```
298
+
299
+ ## PrĂłximos Passos
300
+
301
+ ApĂłs testar localmente com sucesso:
302
+
303
+ 1. âś… Remover cĂłdigo de teste local
304
+ 2. ✅ Compilar binários para todas as plataformas
305
+ 3. âś… Fazer release no GitHub
306
+ 4. âś… Testar download real do GitHub
307
+ 5. âś… Publicar no npm