@aurora.purecore.codes/latest 1.0.0 → 1.1.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/QUICK_START.md +1 -1
- package/README.md +2 -2
- package/bin/aurora.js +166 -80
- package/package.json +1 -1
- package/ARCHITECTURE.md +0 -416
- package/BINARY_RELEASE.md +0 -216
- package/CONTEXT_SUMMARY.md +0 -366
- package/DEPLOYMENT_CHECKLIST.md +0 -560
- package/IMPLEMENTATION_STATUS.md +0 -353
- package/NIX_BINARY_ISSUE.md +0 -264
- package/TEST_INIT_COMMAND.md +0 -380
- package/TEST_LOCAL.md +0 -307
package/QUICK_START.md
CHANGED
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Gerenciador de pacotes para a linguagem Aurora Austral **sem dependências exter
|
|
|
5
5
|
## Instalação
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -g aurora
|
|
8
|
+
npm install -g @aurora.purecore.codes/latest@1.0.0
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
**Nota:** Este package não tem dependências externas. Usa apenas o Node.js nativo (fetch, fs, path, os, child_process).
|
|
@@ -240,7 +240,7 @@ Os pacotes e binários são salvos em cache:
|
|
|
240
240
|
### Compilar Binários para Release
|
|
241
241
|
|
|
242
242
|
```bash
|
|
243
|
-
cd aurora
|
|
243
|
+
cd @aurora.purecore.codes/latest@1.0.0
|
|
244
244
|
./scripts/build-release.sh 0.2.0
|
|
245
245
|
```
|
|
246
246
|
|
package/bin/aurora.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Zero-dependency: no require('commander') needed.
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const os = require('os');
|
|
7
7
|
|
|
8
|
-
const program = new Command();
|
|
9
|
-
|
|
10
8
|
const CACHE_DIR = path.join(os.homedir(), '.aurora_austral', 'packages');
|
|
11
9
|
const BIN_CACHE_DIR = path.join(os.homedir(), '.aurora_austral', 'bin');
|
|
12
10
|
const LOCAL_DIR = path.join(process.cwd(), 'aurora_packages');
|
|
@@ -97,9 +95,26 @@ function runCmd(cmd, cwd, silent = false) {
|
|
|
97
95
|
if (process.platform === 'win32') {
|
|
98
96
|
finalCmd = `wsl ${cmd}`;
|
|
99
97
|
}
|
|
98
|
+
|
|
99
|
+
// Resolve local standard library path (two levels up from cwd's aurora_packages/pkg)
|
|
100
|
+
const stdlibCandidates = [
|
|
101
|
+
path.resolve(__dirname, '..', '..', '..', 'aurora-austral-standard-lib', 'src'),
|
|
102
|
+
path.resolve(process.cwd(), '..', 'aurora-austral-standard-lib', 'src'),
|
|
103
|
+
path.resolve(process.cwd(), '../../aurora-austral-standard-lib/src'),
|
|
104
|
+
];
|
|
105
|
+
const STDLIB_PATH = stdlibCandidates.find(p => fs.existsSync(p)) || process.env.AUSTRAL_STDLIB || '';
|
|
106
|
+
|
|
100
107
|
try {
|
|
101
108
|
const { execSync } = require('child_process');
|
|
102
|
-
const output = execSync(finalCmd, {
|
|
109
|
+
const output = execSync(finalCmd, {
|
|
110
|
+
cwd,
|
|
111
|
+
stdio: silent ? 'pipe' : 'inherit',
|
|
112
|
+
encoding: 'utf-8',
|
|
113
|
+
env: {
|
|
114
|
+
...process.env,
|
|
115
|
+
...(STDLIB_PATH ? { AUSTRAL_STDLIB: STDLIB_PATH } : {})
|
|
116
|
+
}
|
|
117
|
+
});
|
|
103
118
|
return { success: true, message: output };
|
|
104
119
|
} catch (error) {
|
|
105
120
|
return {
|
|
@@ -149,6 +164,11 @@ class Spinner {
|
|
|
149
164
|
process.stdout.write(`\r${colorize('red', '✖')} ${message}\n`);
|
|
150
165
|
}
|
|
151
166
|
|
|
167
|
+
stop() {
|
|
168
|
+
clearInterval(this.interval);
|
|
169
|
+
process.stdout.write('\r' + ' '.repeat(process.stdout.columns || 80) + '\r');
|
|
170
|
+
}
|
|
171
|
+
|
|
152
172
|
info(message) {
|
|
153
173
|
clearInterval(this.interval);
|
|
154
174
|
process.stdout.write(`\r${colorize('cyan', 'ℹ')} ${message}\n`);
|
|
@@ -176,6 +196,26 @@ async function partialCleanup(dir) {
|
|
|
176
196
|
}
|
|
177
197
|
}
|
|
178
198
|
|
|
199
|
+
// Recursive directory copy
|
|
200
|
+
function copyDirAll(src, dst) {
|
|
201
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
202
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
203
|
+
const srcPath = path.join(src, entry.name);
|
|
204
|
+
const dstPath = path.join(dst, entry.name);
|
|
205
|
+
if (entry.isDirectory()) {
|
|
206
|
+
copyDirAll(srcPath, dstPath);
|
|
207
|
+
} else {
|
|
208
|
+
fs.copyFileSync(srcPath, dstPath);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Cross-device safe move (copy + delete), avoids EXDEV on WSL/Windows
|
|
214
|
+
function moveDir(src, dst) {
|
|
215
|
+
copyDirAll(src, dst);
|
|
216
|
+
fs.rmSync(src, { recursive: true, force: true });
|
|
217
|
+
}
|
|
218
|
+
|
|
179
219
|
// Main aurora init command
|
|
180
220
|
async function initCommand(options) {
|
|
181
221
|
console.log(colorize('bold', colorize('cyan', '\n🚀 Initializing Aurora project...\n')));
|
|
@@ -282,25 +322,7 @@ async function initCommand(options) {
|
|
|
282
322
|
testSpinner.succeed('Compiler binary works!');
|
|
283
323
|
}
|
|
284
324
|
|
|
285
|
-
//
|
|
286
|
-
const stdlibSpinner = new Spinner('Downloading standard library...');
|
|
287
|
-
stdlibSpinner.start();
|
|
288
|
-
|
|
289
|
-
const stdlibPath = path.join(BIN_CACHE_DIR, 'stdlib');
|
|
290
|
-
await downloadDirectoryFromRepo(
|
|
291
|
-
COMPILER_REPO_OWNER,
|
|
292
|
-
COMPILER_REPO_NAME,
|
|
293
|
-
'standard/src',
|
|
294
|
-
stdlibPath
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
const localStdlibPath = path.join(process.cwd(), '.aurora', 'stdlib');
|
|
298
|
-
if (fs.existsSync(localStdlibPath)) {
|
|
299
|
-
fs.rmSync(localStdlibPath, { recursive: true, force: true });
|
|
300
|
-
}
|
|
301
|
-
fs.renameSync(stdlibPath, localStdlibPath);
|
|
302
|
-
|
|
303
|
-
stdlibSpinner.succeed(`Standard library installed: ${localStdlibPath}`);
|
|
325
|
+
// stdlib download removed — we use the local aurora-austral-standard-lib
|
|
304
326
|
|
|
305
327
|
// Update aurora.json
|
|
306
328
|
const config = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
@@ -311,7 +333,7 @@ async function initCommand(options) {
|
|
|
311
333
|
config.aurora.compiler = 'system';
|
|
312
334
|
config.aurora.note = 'Using system-installed austral compiler';
|
|
313
335
|
}
|
|
314
|
-
config.aurora.stdlibPath = '
|
|
336
|
+
config.aurora.stdlibPath = 'local:aurora-austral-standard-lib/src';
|
|
315
337
|
fs.writeFileSync(packageJsonPath, JSON.stringify(config, null, 2));
|
|
316
338
|
|
|
317
339
|
} catch (error) {
|
|
@@ -461,7 +483,7 @@ async function installPackage(packageName) {
|
|
|
461
483
|
spinner.text = `Using cached version of ${packageName}...`;
|
|
462
484
|
if (!fs.existsSync(LOCAL_DIR)) fs.mkdirSync(LOCAL_DIR);
|
|
463
485
|
if (fs.existsSync(localPath)) fs.rmSync(localPath, { recursive: true, force: true });
|
|
464
|
-
|
|
486
|
+
moveDir(cachePath, localPath); // cross-device safe
|
|
465
487
|
spinner.succeed(`Package ${packageName} installed from cache.`);
|
|
466
488
|
return;
|
|
467
489
|
}
|
|
@@ -489,9 +511,12 @@ async function installPackage(packageName) {
|
|
|
489
511
|
}
|
|
490
512
|
|
|
491
513
|
spinner.start(`Caching ${packageName}...`);
|
|
492
|
-
|
|
514
|
+
// Copy to cache but KEEP in aurora_packages/ so the Austral compiler can find the .aui/.aum files
|
|
515
|
+
if (fs.existsSync(cachePath)) fs.rmSync(cachePath, { recursive: true, force: true });
|
|
516
|
+
copyDirAll(localPath, cachePath);
|
|
493
517
|
|
|
494
518
|
spinner.succeed(`Package ${packageName} installed successfully.`);
|
|
519
|
+
console.log(colorize('cyan', ` → Files available at: aurora_packages/${packageName}`));
|
|
495
520
|
} catch (error) {
|
|
496
521
|
spinner.fail(`Error installing ${packageName}: ${error.message}`);
|
|
497
522
|
if (fs.existsSync(localPath)) await partialCleanup(localPath);
|
|
@@ -524,21 +549,53 @@ async function listPackages(options) {
|
|
|
524
549
|
}
|
|
525
550
|
}
|
|
526
551
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
552
|
+
async function findPackage(query) {
|
|
553
|
+
const spinner = new Spinner(`Searching for "${query}" in names and READMEs...`);
|
|
554
|
+
spinner.start();
|
|
530
555
|
try {
|
|
531
556
|
const response = await fetch(API_URL, { headers: { 'User-Agent': 'aurora-npm' } });
|
|
532
|
-
if (!response.ok) throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
557
|
+
if (!response.ok) throw new Error(`Failed to fetch package list: ${response.statusText}`);
|
|
533
558
|
const items = await response.json();
|
|
534
|
-
const
|
|
535
|
-
|
|
559
|
+
const packageDirs = items.filter(item => item.type === 'dir');
|
|
560
|
+
|
|
561
|
+
const searchResults = await Promise.all(packageDirs.map(async (dir) => {
|
|
562
|
+
const name = dir.name;
|
|
563
|
+
const lowerQuery = query.toLowerCase();
|
|
564
|
+
|
|
565
|
+
// Match by name
|
|
566
|
+
if (name.toLowerCase().includes(lowerQuery)) {
|
|
567
|
+
return { name, match: 'name' };
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// Match by README content
|
|
571
|
+
try {
|
|
572
|
+
// We use raw.githubusercontent.com to get the file content directly
|
|
573
|
+
const readmeUrl = `https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_NAME}/main/packages/${name}/README.md`;
|
|
574
|
+
const readmeRes = await fetch(readmeUrl);
|
|
575
|
+
if (readmeRes.ok) {
|
|
576
|
+
const content = await readmeRes.text();
|
|
577
|
+
if (content.toLowerCase().includes(lowerQuery)) {
|
|
578
|
+
return { name, match: 'readme' };
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
} catch (e) {
|
|
582
|
+
// Ignore README errors
|
|
583
|
+
}
|
|
584
|
+
return null;
|
|
585
|
+
}));
|
|
586
|
+
|
|
587
|
+
const filtered = searchResults.filter(r => r !== null);
|
|
588
|
+
|
|
536
589
|
spinner.stop();
|
|
537
590
|
if (filtered.length > 0) {
|
|
538
|
-
console.log(colorize('bold',
|
|
539
|
-
filtered.forEach(p =>
|
|
591
|
+
console.log(colorize('bold', `\nFound ${filtered.length} packages matching "${query}":`));
|
|
592
|
+
filtered.forEach(p => {
|
|
593
|
+
const reason = p.match === 'readme' ? colorize('cyan', ' (found in README)') : '';
|
|
594
|
+
console.log(` - ${colorize('green', p.name)}${reason}`);
|
|
595
|
+
});
|
|
596
|
+
console.log('');
|
|
540
597
|
} else {
|
|
541
|
-
console.log(colorize('yellow',
|
|
598
|
+
console.log(colorize('yellow', `\nNo packages found matching "${query}".`));
|
|
542
599
|
}
|
|
543
600
|
} catch (error) {
|
|
544
601
|
spinner.fail(`Error: ${error.message}`);
|
|
@@ -644,12 +701,12 @@ async function updatePackage(packageName) {
|
|
|
644
701
|
if (fs.existsSync(localPath)) {
|
|
645
702
|
fs.rmSync(localPath, { recursive: true, force: true });
|
|
646
703
|
}
|
|
647
|
-
|
|
704
|
+
moveDir(tempDir, localPath);
|
|
648
705
|
|
|
649
706
|
if (fs.existsSync(cachePath)) {
|
|
650
707
|
fs.rmSync(cachePath, { recursive: true, force: true });
|
|
651
708
|
}
|
|
652
|
-
|
|
709
|
+
copyDirAll(localPath, cachePath);
|
|
653
710
|
|
|
654
711
|
spinner.succeed(`Package ${pkg} updated.`);
|
|
655
712
|
} catch (error) {
|
|
@@ -658,46 +715,75 @@ async function updatePackage(packageName) {
|
|
|
658
715
|
}
|
|
659
716
|
}
|
|
660
717
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
.
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
718
|
+
// ── Native CLI parser (zero dependencies) ────────────────────────────────────
|
|
719
|
+
const args = process.argv.slice(2);
|
|
720
|
+
const command = args[0];
|
|
721
|
+
const flags = new Set(args.filter(a => a.startsWith('--')));
|
|
722
|
+
const positional = args.filter(a => !a.startsWith('--'));
|
|
723
|
+
|
|
724
|
+
function printHelp() {
|
|
725
|
+
console.log(`
|
|
726
|
+
${colorize('bold', colorize('cyan', 'aurora'))} - Aurora Austral Package Manager v0.1.0
|
|
727
|
+
|
|
728
|
+
${colorize('bold', 'Usage:')}
|
|
729
|
+
aurora <command> [options]
|
|
730
|
+
|
|
731
|
+
${colorize('bold', 'Commands:')}
|
|
732
|
+
init Initialize a new Aurora project
|
|
733
|
+
install <package> Install a package from the vault
|
|
734
|
+
list [--local] List remote (or local) packages
|
|
735
|
+
find <name> Search for a package
|
|
736
|
+
uninstall <package> Remove a package
|
|
737
|
+
test <package> Run tests for an installed package
|
|
738
|
+
update [package] Update one or all packages
|
|
739
|
+
|
|
740
|
+
${colorize('bold', 'Options:')}
|
|
741
|
+
--no-binary (init) Skip downloading compiler binary
|
|
742
|
+
--local (list) List locally cached packages
|
|
743
|
+
--help, -h Show this help message
|
|
744
|
+
--version, -v Show version
|
|
745
|
+
`);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
(async () => {
|
|
749
|
+
if (!command || command === '--help' || command === '-h') {
|
|
750
|
+
printHelp();
|
|
751
|
+
process.exit(0);
|
|
752
|
+
}
|
|
753
|
+
if (command === '--version' || command === '-v') {
|
|
754
|
+
console.log('aurora 0.1.0');
|
|
755
|
+
process.exit(0);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
switch (command) {
|
|
759
|
+
case 'init':
|
|
760
|
+
await initCommand({ binary: !flags.has('--no-binary') });
|
|
761
|
+
break;
|
|
762
|
+
case 'install':
|
|
763
|
+
if (!positional[1]) { console.log(colorize('red', 'Usage: aurora install <package-name>')); process.exit(1); }
|
|
764
|
+
await installPackage(positional[1]);
|
|
765
|
+
break;
|
|
766
|
+
case 'list':
|
|
767
|
+
await listPackages({ local: flags.has('--local') });
|
|
768
|
+
break;
|
|
769
|
+
case 'find':
|
|
770
|
+
if (!positional[1]) { console.log(colorize('red', 'Usage: aurora find <package-name>')); process.exit(1); }
|
|
771
|
+
await findPackage(positional[1]);
|
|
772
|
+
break;
|
|
773
|
+
case 'uninstall':
|
|
774
|
+
if (!positional[1]) { console.log(colorize('red', 'Usage: aurora uninstall <package-name>')); process.exit(1); }
|
|
775
|
+
await uninstallPackage(positional[1]);
|
|
776
|
+
break;
|
|
777
|
+
case 'test':
|
|
778
|
+
if (!positional[1]) { console.log(colorize('red', 'Usage: aurora test <package-name>')); process.exit(1); }
|
|
779
|
+
await testPackage(positional[1]);
|
|
780
|
+
break;
|
|
781
|
+
case 'update':
|
|
782
|
+
await updatePackage(positional[1] || null);
|
|
783
|
+
break;
|
|
784
|
+
default:
|
|
785
|
+
console.log(colorize('red', `Unknown command: ${command}`));
|
|
786
|
+
printHelp();
|
|
787
|
+
process.exit(1);
|
|
788
|
+
}
|
|
789
|
+
})();
|