this.me 2.4.4 → 2.4.6

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 CHANGED
@@ -7,6 +7,8 @@ For every recursive action, there's a repercussion.
7
7
  npm install this.me
8
8
  ```
9
9
 
10
+ **Docs:** [this.me](https://www.neurons.me/this-me)
11
+
10
12
  ### Conceptual Flow:
11
13
 
12
14
  - [ ] Set up your context with [this.me.](https://www.npmjs.com/package/this.me)
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
- console.log(`
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
- if (args[0] === 'viewer') {
29
- // Create an instance of the Atom class
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
- // Create a new Electron window with viewer.html inside
32
- atom.createElectron('viewer', { width: 800, height: 600, viewFile: path.resolve(__dirname, 'viewer.html') });
33
- // Show the Electron window
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
- // Create Electrons for Atom 1
41
- atom.createElectron('electron1', { width: 800, height: 600, viewFile: './view1.html' });
42
- atom.createElectron('electron2', { width: 600, height: 400, viewFile: './view2.html' });
43
- // Create Electrons for Atom 2
44
- atom.createElectron('electron3', { width: 1000, height: 800, viewFile: './view3.html' });
45
- // Show the Atom window with electrons
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
- module.exports = {
50
- cleaker,
51
- neurons,
52
- Atom
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "this.me",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "description": "This.me should This.be",
5
5
  "bin": {
6
6
  ".me": "./main.js"
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