this.me 2.4.4 → 2.4.5
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 +1 -0
- package/main.js +90 -21
- package/package.json +1 -1
- package/this/dir.js +0 -0
- package/this/file.js +0 -0
- package/this/url.js +0 -0
- package/this/video.js +0 -0
package/README.md
CHANGED
package/main.js
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
//main.js
|
|
3
3
|
const { exec } = require("child_process");
|
|
4
4
|
const path = require("path");
|
|
5
|
+
const crypto = require('crypto');
|
|
6
|
+
const fs = require('fs');
|
|
5
7
|
const args = process.argv.slice(2);
|
|
6
8
|
const neurons = require("neurons.me");
|
|
7
9
|
const cleaker = require("cleaker");
|
|
8
10
|
const Atom = require("this.atom");
|
|
9
11
|
// Your CLI logic goes here, display welcome message, handle other commands, etc.
|
|
10
|
-
|
|
12
|
+
function displayWelcomeMessage() {
|
|
13
|
+
console.log(`
|
|
11
14
|
___________
|
|
12
15
|
[------------]
|
|
13
16
|
| .--------. |
|
|
@@ -24,34 +27,100 @@ console.log(`
|
|
|
24
27
|
Welcome to .me - Your AI Playground
|
|
25
28
|
give me one sec please...
|
|
26
29
|
`);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
};
|
|
31
|
+
//ATOMS ELECTRONS AND PARTICLES IN PROGRESS...
|
|
32
|
+
//WE WILL RUN OUR NODE PROCCESSES IN ELECTRON WINDOWS AND EACH ATOM WILL HOLD ELECTRONS WHICH HOLDS THE PROCESSES
|
|
33
|
+
//THUS WE WILL KNOW HOW CHARGED AN ATOM IS BY THE NUMBER OF ELECTRONS IT HAS AND HOW MANY PROCESSES IT IS RUNNING.
|
|
34
|
+
//WE WILL ALSO BE ABLE TO SEE THE PROCESSES RUNNING IN EACH ELECTRON AND THE ATOMS THAT ARE RUNNING THEM.
|
|
35
|
+
function handleViewerCommand() {
|
|
30
36
|
const atom = new Atom();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
atom.createElectron('viewer', {
|
|
38
|
+
width: 800,
|
|
39
|
+
height: 600,
|
|
40
|
+
viewFile: path.resolve(__dirname, 'viewer.html')
|
|
41
|
+
});
|
|
34
42
|
atom.showElectron('viewer');
|
|
35
43
|
}
|
|
36
|
-
|
|
37
|
-
if (args[0] === 'atom') {
|
|
38
|
-
// Create an instance of the Atom class
|
|
44
|
+
function handleAtomCommand() {
|
|
39
45
|
const atom = new Atom();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
atom.createElectron('electron1', {
|
|
47
|
+
width: 800,
|
|
48
|
+
height: 600,
|
|
49
|
+
viewFile: './view1.html'
|
|
50
|
+
});
|
|
51
|
+
atom.createElectron('electron2', {
|
|
52
|
+
width: 600,
|
|
53
|
+
height: 400,
|
|
54
|
+
viewFile: './view2.html'
|
|
55
|
+
});
|
|
56
|
+
atom.createElectron('electron3', {
|
|
57
|
+
width: 1000,
|
|
58
|
+
height: 800,
|
|
59
|
+
viewFile: './view3.html'
|
|
60
|
+
});
|
|
46
61
|
atom.showAtom();
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
64
|
+
//.. THIS SECTION IS FOR HASHING PURPOSES ...//
|
|
65
|
+
/* Create a function that computes the hash of the @src directory.
|
|
66
|
+
'hash-src') to handle hashing when the relevant command is passed to the script.*/
|
|
67
|
+
function getAllFilesFromSourceCode(directory) {
|
|
68
|
+
const entries = fs.readdirSync(directory, { withFileTypes: true });
|
|
69
|
+
const files = entries.filter(fileDirent => fileDirent.isFile()).map(fileDirent => path.join(directory, fileDirent.name));
|
|
70
|
+
const folders = entries.filter(folderDirent => folderDirent.isDirectory());
|
|
71
|
+
for (const folder of folders) {
|
|
72
|
+
files.push(...getAllFilesFromSourceCode(path.join(directory, folder.name)));
|
|
73
|
+
}
|
|
74
|
+
return files;
|
|
75
|
+
}
|
|
76
|
+
function hashSourceCode(directoryPath) {
|
|
77
|
+
// Ensure path is absolute
|
|
78
|
+
if (!path.isAbsolute(directoryPath)) {
|
|
79
|
+
throw new Error('Directory path must be absolute.');
|
|
80
|
+
}
|
|
81
|
+
// Get all files from the directory recursively
|
|
82
|
+
const allFiles = getAllFilesFromSourceCode(directoryPath);
|
|
83
|
+
// Read all file content and concatenate it
|
|
84
|
+
const allContent = allFiles.map(file => fs.readFileSync(file)).join('');
|
|
85
|
+
// Hash the content using SHA256 (or another hashing algorithm)
|
|
86
|
+
const hash = crypto.createHash('sha256').update(allContent).digest('hex');
|
|
87
|
+
return hash;
|
|
88
|
+
}
|
|
54
89
|
|
|
90
|
+
function HashSrc() {
|
|
91
|
+
try {
|
|
92
|
+
// Adjust this to the exact location of your @src directory
|
|
93
|
+
const srcDirPath = path.resolve(__dirname, '@src');
|
|
94
|
+
const hash = hashSourceCode(srcDirPath);
|
|
95
|
+
console.log(`Hash of @src directory: ${hash}`);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('Error hashing @src directory:', error.message);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
55
100
|
|
|
101
|
+
// Display the welcome message
|
|
102
|
+
displayWelcomeMessage();
|
|
56
103
|
|
|
104
|
+
// COMMAND HANDLERS
|
|
105
|
+
switch(args[0]) {
|
|
106
|
+
case 'hash-src':
|
|
107
|
+
HashSrc();
|
|
108
|
+
break;
|
|
109
|
+
case 'viewer':
|
|
110
|
+
handleViewerCommand();
|
|
111
|
+
break;
|
|
112
|
+
case 'atom':
|
|
113
|
+
handleAtomCommand();
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
console.log('Command not recognized. Use "viewer" or "atom" as arguments.');
|
|
117
|
+
}
|
|
57
118
|
|
|
119
|
+
module.exports = {
|
|
120
|
+
cleaker,
|
|
121
|
+
neurons,
|
|
122
|
+
Atom,
|
|
123
|
+
getAllFilesFromSourceCode,
|
|
124
|
+
hashSourceCode,
|
|
125
|
+
HashSrc
|
|
126
|
+
};
|
package/package.json
CHANGED
package/this/dir.js
ADDED
|
File without changes
|
package/this/file.js
ADDED
|
File without changes
|
package/this/url.js
ADDED
|
File without changes
|
package/this/video.js
ADDED
|
File without changes
|