project-cypher 0.12.0 → 0.13.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/bin/cypher.js +13 -2
- package/package.json +1 -1
package/bin/cypher.js
CHANGED
|
@@ -194,7 +194,17 @@ const cmds = {
|
|
|
194
194
|
let id = slug(p), n = 2; if (id === 'root') id = 'root-project'; while (list.some(x => x.id === id)) id = slug(p) + '-' + n++;
|
|
195
195
|
list.push({ id, name: path.basename(p), path: p, summary: '' }); writeRegistry(list); console.log(`added ${id} (${p})`);
|
|
196
196
|
},
|
|
197
|
-
remove(id) {
|
|
197
|
+
async remove(id, ...rest) {
|
|
198
|
+
if (id && id !== '--yes') { writeRegistry(readRegistry().filter(x => x.id !== id)); return console.log('removed project ' + id); }
|
|
199
|
+
console.log(`This fully removes Cypher from this computer:\n - unlinks it from your phone app\n - stops and deletes the background service\n - deletes ${CFG_DIR} (login, project list, Root notes, chat sessions)\nYour actual project folders are NOT touched.`);
|
|
200
|
+
if (id !== '--yes' && !rest.includes('--yes') && !yes(await ask('Continue? [y/N] '), false)) return console.log('cancelled.');
|
|
201
|
+
const c = rawCfg();
|
|
202
|
+
if (c.token) await fetch(httpOf(c.server || 'http://140.238.248.30:3300') + '/unlink', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ token: c.token }) }).then(() => console.log('[ok] unlinked from the app')).catch(() => console.log('[!!] could not reach the server; remove this computer from the app Projects list'));
|
|
203
|
+
SVC.remove(); console.log('[ok] background service removed');
|
|
204
|
+
fs.rmSync(CFG_DIR, { recursive: true, force: true }); console.log('[ok] deleted ' + CFG_DIR);
|
|
205
|
+
console.log('\nClean. To reinstall: npm i -g project-cypher@latest && cypher init\nTo also remove the program itself: npm uninstall -g project-cypher');
|
|
206
|
+
},
|
|
207
|
+
removeProject(id) { writeRegistry(readRegistry().filter(x => x.id !== id)); console.log('removed ' + id); },
|
|
198
208
|
projects() { const c = load(); if (!c.projects.length) return console.log('none yet. cypher add <folder>'); c.projects.forEach(p => console.log(`${p.id.padEnd(20)} ${p.path}`)); },
|
|
199
209
|
// Service control
|
|
200
210
|
start() { const c = load(); if (!c.token) return console.log('Not linked yet. Run: cypher init'); console.log(SVC.start() ? 'Cypher is running in the background and will start automatically when this computer turns on.' : 'Could not start the background service. Run it in this window instead: cypher connect'); },
|
|
@@ -266,7 +276,8 @@ const help = () => console.log(`Project Cypher
|
|
|
266
276
|
cypher link [server-url] link this computer to your phone (QR or code), add this folder, go online
|
|
267
277
|
cypher pair <server-url> <code> alternative: pair with a code made in the app
|
|
268
278
|
cypher add [folder] register a project folder (or just ask Root in the app)
|
|
269
|
-
cypher projects | remove <id> list / remove
|
|
279
|
+
cypher projects | remove <id> list projects / remove one project
|
|
280
|
+
cypher remove FULL removal (unlink, service, all local data) for a clean reinstall
|
|
270
281
|
cypher disconnect unlink this computer from the app
|
|
271
282
|
cypher connect go online in this window (no background service)
|
|
272
283
|
cypher start | stop start / stop the background service (auto-starts at boot)
|