Class: RosettAi::Migration::NnccProjectMigrator

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/migration/nncc_project_migrator.rb

Overview

Migrates legacy .nncc/ project directories to .rosett-ai/.

Can operate on a single project root or scan an entire workspace for projects containing .nncc/ directories.

Author:

  • hugo

  • claude

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNnccProjectMigrator

Returns a new instance of NnccProjectMigrator.



20
21
22
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 20

def initialize
  @results = []
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



18
19
20
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 18

def results
  @results
end

Instance Method Details

#detect(workspace) ⇒ Array<String>

Detect projects with .nncc/ in a workspace (dry-run).

Parameters:

  • workspace (Pathname, String)

    root directory to scan

Returns:

  • (Array<String>)

    list of project paths with .nncc/



48
49
50
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 48

def detect(workspace)
  find_nncc_projects(workspace)
end

#migrate_project(project_root) ⇒ Hash

Migrate a single project's .nncc/ to .rosett-ai/.

Parameters:

  • project_root (Pathname, String)

    path to project root

Returns:

  • (Hash)

    result with :path, :status, :message keys



28
29
30
31
32
33
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 28

def migrate_project(project_root)
  root = Pathname.new(project_root)
  perform_migration(root)
rescue Errno::EACCES => e
  record_result(root, :error, "Permission denied: #{e.message}")
end

#migrate_workspace(workspace) ⇒ Array<Hash>

Scan a workspace for projects with .nncc/ and migrate them.

Parameters:

  • workspace (Pathname, String)

    root directory to scan

Returns:

  • (Array<Hash>)

    results for each project found



39
40
41
42
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 39

def migrate_workspace(workspace)
  find_nncc_projects(workspace).each { |path| migrate_project(path) }
  @results
end