nlos 1.5.0 → 1.6.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.
Files changed (2) hide show
  1. package/bin/nlos.js +123 -1
  2. package/package.json +1 -1
package/bin/nlos.js CHANGED
@@ -477,6 +477,123 @@ function payload(options = {}) {
477
477
  }
478
478
  }
479
479
 
480
+ function init(options = {}) {
481
+ const targetDir = process.cwd();
482
+
483
+ log('blue', `Initializing NL-OS workspace in ${targetDir}...\n`);
484
+
485
+ // Files to copy from package to local workspace
486
+ const filesToCopy = [
487
+ { src: 'memory.md', dest: 'memory.md', desc: 'Directive stack (customize this!)' },
488
+ { src: 'KERNEL.md', dest: 'KERNEL.md', desc: 'Kernel entry point' },
489
+ { src: 'AGENTS.md', dest: 'AGENTS.md', desc: 'Agent rules and invariants' },
490
+ { src: 'axioms.yaml', dest: 'axioms.yaml', desc: 'Canonical definitions' },
491
+ { src: 'personalities.md', dest: 'personalities.md', desc: 'Voice presets' },
492
+ ];
493
+
494
+ const commandsToCopy = [
495
+ 'hype.md',
496
+ 'note.md',
497
+ 'assume.md',
498
+ ];
499
+
500
+ // Create directories
501
+ const commandsDir = path.join(targetDir, 'commands');
502
+ if (!fs.existsSync(commandsDir)) {
503
+ fs.mkdirSync(commandsDir, { recursive: true });
504
+ }
505
+
506
+ // Copy kernel files
507
+ log('yellow', 'Copying kernel files:');
508
+ for (const { src, dest, desc } of filesToCopy) {
509
+ const srcPath = path.join(PACKAGE_ROOT, src);
510
+ const destPath = path.join(targetDir, dest);
511
+
512
+ if (fs.existsSync(destPath)) {
513
+ log('cyan', ` [skip] ${dest} (already exists)`);
514
+ } else if (fs.existsSync(srcPath)) {
515
+ fs.copyFileSync(srcPath, destPath);
516
+ log('green', ` [created] ${dest} - ${desc}`);
517
+ } else {
518
+ log('red', ` [missing] ${src} not found in package`);
519
+ }
520
+ }
521
+
522
+ // Copy command files
523
+ console.log();
524
+ log('yellow', 'Copying command files:');
525
+ for (const cmd of commandsToCopy) {
526
+ const srcPath = path.join(PACKAGE_ROOT, '.cursor', 'commands', cmd);
527
+ const destPath = path.join(commandsDir, cmd);
528
+
529
+ if (fs.existsSync(destPath)) {
530
+ log('cyan', ` [skip] commands/${cmd} (already exists)`);
531
+ } else if (fs.existsSync(srcPath)) {
532
+ fs.copyFileSync(srcPath, destPath);
533
+ log('green', ` [created] commands/${cmd}`);
534
+ } else {
535
+ log('red', ` [missing] ${cmd} not found in package`);
536
+ }
537
+ }
538
+
539
+ // Create .nlos config file
540
+ const configPath = path.join(targetDir, '.nlos.yaml');
541
+ if (!fs.existsSync(configPath)) {
542
+ const config = `# NL-OS Workspace Configuration
543
+ # Generated: ${new Date().toISOString().split('T')[0]}
544
+
545
+ workspace:
546
+ name: "${path.basename(targetDir)}"
547
+ initialized: true
548
+
549
+ kernel:
550
+ # Use local files (set to false to use global package)
551
+ use_local: true
552
+
553
+ # Default model for this workspace
554
+ default_model: qwen2.5:3b
555
+
556
+ # Tier: minimal, mandatory, full
557
+ default_tier: minimal
558
+
559
+ # Add workspace-specific settings below
560
+ `;
561
+ fs.writeFileSync(configPath, config);
562
+ log('green', ` [created] .nlos.yaml - workspace config`);
563
+ }
564
+
565
+ // Create .gitignore addition
566
+ const gitignorePath = path.join(targetDir, '.gitignore');
567
+ const gitignoreContent = `# NL-OS
568
+ .nlos-cache/
569
+ `;
570
+ if (!fs.existsSync(gitignorePath)) {
571
+ fs.writeFileSync(gitignorePath, gitignoreContent);
572
+ log('green', ` [created] .gitignore`);
573
+ }
574
+
575
+ console.log();
576
+ log('green', 'Workspace initialized!\n');
577
+
578
+ console.log(`${colors.yellow}Next steps:${colors.reset}`);
579
+ console.log(` 1. Edit ${colors.cyan}memory.md${colors.reset} to customize your directives`);
580
+ console.log(` 2. Add commands to ${colors.cyan}commands/${colors.reset}`);
581
+ console.log(` 3. Run ${colors.cyan}nlos chat --minimal${colors.reset} to start\n`);
582
+
583
+ console.log(`${colors.yellow}Files created:${colors.reset}`);
584
+ console.log(` ${targetDir}/`);
585
+ console.log(` ├── KERNEL.md # Entry point`);
586
+ console.log(` ├── memory.md # Your directives (edit this!)`);
587
+ console.log(` ├── AGENTS.md # Agent rules`);
588
+ console.log(` ├── axioms.yaml # Definitions`);
589
+ console.log(` ├── personalities.md # Voice presets`);
590
+ console.log(` ├── commands/ # Your commands`);
591
+ console.log(` │ ├── hype.md`);
592
+ console.log(` │ ├── note.md`);
593
+ console.log(` │ └── assume.md`);
594
+ console.log(` └── .nlos.yaml # Workspace config`);
595
+ }
596
+
480
597
  function showHelp() {
481
598
  console.log(`
482
599
  ${colors.cyan}NL-OS${colors.reset} - Natural Language Operating System
@@ -485,6 +602,7 @@ ${colors.yellow}Usage:${colors.reset}
485
602
  nlos <command> [options]
486
603
 
487
604
  ${colors.yellow}Commands:${colors.reset}
605
+ init Initialize NL-OS workspace in current directory
488
606
  chat Interactive NL-OS chat session (recommended)
489
607
  boot Boot NL-OS and verify kernel loads
490
608
  payload Generate portable kernel payloads
@@ -507,7 +625,7 @@ ${colors.yellow}Payload Options:${colors.reset}
507
625
  --all Generate all variants
508
626
 
509
627
  ${colors.yellow}Examples:${colors.reset}
510
- nlos chat # Start interactive chat (recommended)
628
+ nlos init # Initialize workspace with kernel files
511
629
  nlos chat --minimal # Use minimal kernel for small models (3B)
512
630
  nlos chat --model llama3.1:8b # Chat with specific model
513
631
  nlos chat --profile quality --full # Quality mode with full kernel
@@ -565,6 +683,10 @@ const command = args[0];
565
683
  const options = parseArgs(args.slice(1));
566
684
 
567
685
  switch (command) {
686
+ case 'init':
687
+ init(options);
688
+ break;
689
+
568
690
  case 'chat':
569
691
  chat(options);
570
692
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nlos",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Natural Language Operating System - A model-agnostic kernel for any LLM",
5
5
  "main": "bin/nlos.js",
6
6
  "bin": {