Class: Aidp::Database::Repositories::ExperienceArtifactRepository
- Inherits:
-
Aidp::Database::Repository
- Object
- Aidp::Database::Repository
- Aidp::Database::Repositories::ExperienceArtifactRepository
- Defined in:
- lib/aidp/database/repositories/experience_artifact_repository.rb
Instance Attribute Summary
Attributes inherited from Aidp::Database::Repository
Instance Method Summary collapse
-
#initialize(project_dir: Dir.pwd) ⇒ ExperienceArtifactRepository
constructor
A new instance of ExperienceArtifactRepository.
- #list_for_run(run_id) ⇒ Object
- #record(run_id:, role:, path:, metadata: {}) ⇒ Object
Constructor Details
#initialize(project_dir: Dir.pwd) ⇒ ExperienceArtifactRepository
Returns a new instance of ExperienceArtifactRepository.
9 10 11 |
# File 'lib/aidp/database/repositories/experience_artifact_repository.rb', line 9 def initialize(project_dir: Dir.pwd) super(project_dir: project_dir, table_name: "experience_artifacts") end |
Instance Method Details
#list_for_run(run_id) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/aidp/database/repositories/experience_artifact_repository.rb', line 23 def list_for_run(run_id) rows = query( "SELECT * FROM experience_artifacts WHERE run_id = ? AND project_dir = ? ORDER BY id ASC", [run_id, project_dir] ) rows.map do |row| { role: row["role"], path: row["path"], metadata: deserialize_json(row["metadata"]) || {}, created_at: row["created_at"] } end end |
#record(run_id:, role:, path:, metadata: {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/aidp/database/repositories/experience_artifact_repository.rb', line 13 def record(run_id:, role:, path:, metadata: {}) execute( insert_sql([:project_dir, :run_id, :role, :path, :metadata]), [project_dir, run_id, role, path, serialize_json( || {})] ) Aidp.log_debug("experience_artifact_repository", "recorded", run_id: run_id, role: role, path: path) end |