htm 0.0.32 → 0.1.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.
- checksums.yaml +4 -4
- data/.architecture/decisions/adrs/005-rag-based-retrieval-with-hybrid-search.md +4 -0
- data/.architecture/decisions/adrs/017-bitemporal-event-time.md +78 -0
- data/.architecture/decisions/adrs/018-memory-timelines-and-node-links.md +64 -0
- data/.architecture/decisions/adrs/019-epistemic-status.md +66 -0
- data/.claude.json +11 -0
- data/.envrc +9 -7
- data/.irbrc +14 -14
- data/.reek.yml +104 -0
- data/.rubocop.yml +0 -11
- data/.ruby-version +1 -0
- data/CHANGELOG.md +160 -98
- data/README.md +22 -17
- data/SETUP.md +49 -46
- data/_typos.toml +17 -0
- data/bin/htm +18 -0
- data/db/migrate/00010_convert_embedding_to_sparsevec.rb +47 -0
- data/db/migrate/00011_strip_frontmatter_from_chunks.rb +66 -0
- data/db/migrate/00012_add_event_time_to_nodes.rb +110 -0
- data/db/migrate/00013_create_node_links.rb +158 -0
- data/db/migrate/00014_add_epistemic_status.rb +110 -0
- data/db/schema.sql +238 -7
- data/db/seed_data/README.md +11 -11
- data/db/seeds.rb +11 -11
- data/docs/api/database.md +8 -8
- data/docs/api/embedding-service.md +138 -262
- data/docs/api/htm.md +128 -12
- data/docs/api/index.md +8 -8
- data/docs/api/long-term-memory.md +8 -19
- data/docs/api/working-memory.md +34 -46
- data/docs/api/yard/HTM/Admin/Console.md +53 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands/Console.md +38 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands.md +127 -0
- data/docs/api/yard/HTM/Admin/EnrichCommands.md +85 -0
- data/docs/api/yard/HTM/Admin/Error.md +9 -0
- data/docs/api/yard/HTM/Admin/FileCommands/Console.md +50 -0
- data/docs/api/yard/HTM/Admin/FileCommands.md +83 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Base.md +17 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Edit.md +74 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Search.md +77 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/TagSearch.md +46 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/WorkingMemory.md +36 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands.md +67 -0
- data/docs/api/yard/HTM/Admin/TagCommands/Console.md +48 -0
- data/docs/api/yard/HTM/Admin/TagCommands.md +105 -0
- data/docs/api/yard/HTM/Admin/TagGraph.md +149 -0
- data/docs/api/yard/HTM/Admin/YardDocs.md +60 -0
- data/docs/api/yard/HTM/Admin.md +102 -0
- data/docs/api/yard/HTM/AuthorizationError.md +6 -6
- data/docs/api/yard/HTM/CLI/ConfigFile.md +40 -0
- data/docs/api/yard/HTM/CLI/Db.md +63 -0
- data/docs/api/yard/HTM/CLI/Enrich.md +39 -0
- data/docs/api/yard/HTM/CLI/ErrorSuggestion.md +56 -0
- data/docs/api/yard/HTM/CLI/Files.md +36 -0
- data/docs/api/yard/HTM/CLI/Group/ClassMethods.md +11 -0
- data/docs/api/yard/HTM/CLI/Group.md +13 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand/ClassMethods.md +20 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand.md +9 -0
- data/docs/api/yard/HTM/CLI/Robots.md +31 -0
- data/docs/api/yard/HTM/CLI/Support.md +9 -0
- data/docs/api/yard/HTM/CLI/Tags.md +57 -0
- data/docs/api/yard/HTM/CLI/WorkingMemory.md +24 -0
- data/docs/api/yard/HTM/CLI.md +84 -0
- data/docs/api/yard/HTM/CircuitBreaker/Guarded.md +29 -0
- data/docs/api/yard/HTM/CircuitBreaker/Settings.md +21 -0
- data/docs/api/yard/HTM/CircuitBreaker/Status.md +42 -0
- data/docs/api/yard/HTM/CircuitBreaker.md +54 -49
- data/docs/api/yard/HTM/CircuitBreakerOpenError.md +9 -9
- data/docs/api/yard/HTM/Config/Builder.md +87 -0
- data/docs/api/yard/HTM/Config/Coercion.md +59 -0
- data/docs/api/yard/HTM/Config/Database.md +102 -0
- data/docs/api/yard/HTM/Config/Readers.md +30 -0
- data/docs/api/yard/HTM/Config/RubyLlmSettings.md +32 -0
- data/docs/api/yard/HTM/Config/Validator.md +59 -0
- data/docs/api/yard/HTM/Config.md +224 -105
- data/docs/api/yard/HTM/ConfigurationError.md +20 -0
- data/docs/api/yard/HTM/Confirmation.md +22 -0
- data/docs/api/yard/HTM/Database/Connection.md +26 -0
- data/docs/api/yard/HTM/Database/Migrations.md +32 -0
- data/docs/api/yard/HTM/Database/Report.md +26 -0
- data/docs/api/yard/HTM/Database/SchemaFile.md +52 -0
- data/docs/api/yard/HTM/Database/Teardown.md +15 -0
- data/docs/api/yard/HTM/Database.md +58 -70
- data/docs/api/yard/HTM/DatabaseDocs.md +67 -0
- data/docs/api/yard/HTM/DatabaseError.md +6 -6
- data/docs/api/yard/HTM/Deletion.md +32 -0
- data/docs/api/yard/HTM/EmbeddingError.md +6 -6
- data/docs/api/yard/HTM/EmbeddingService.md +37 -38
- data/docs/api/yard/HTM/Epistemics.md +135 -0
- data/docs/api/yard/HTM/Error.md +6 -6
- data/docs/api/yard/HTM/EventTime.md +110 -0
- data/docs/api/yard/HTM/FileMemory.md +76 -0
- data/docs/api/yard/HTM/InputValidator.md +82 -0
- data/docs/api/yard/HTM/JobAdapter/Job.md +26 -0
- data/docs/api/yard/HTM/JobAdapter.md +35 -16
- data/docs/api/yard/HTM/Jobs/FailureLogging.md +14 -0
- data/docs/api/yard/HTM/Jobs/GenerateEmbeddingJob.md +16 -0
- data/docs/api/yard/HTM/Jobs/GeneratePropositionsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/GenerateRelationshipsJob.md +26 -0
- data/docs/api/yard/HTM/Jobs/GenerateTagsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/LlmCallTimer.md +58 -0
- data/docs/api/yard/HTM/Jobs/NodeLookup.md +14 -0
- data/docs/api/yard/HTM/Jobs.md +13 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync/Chunk.md +22 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync.md +50 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Coalescer.md +24 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Packer.md +20 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Splitter.md +18 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker.md +83 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader/Document.md +43 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader.md +62 -0
- data/docs/api/yard/HTM/Loaders.md +5 -0
- data/docs/api/yard/HTM/LongTermMemory/FulltextSearch.md +36 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfMerger.md +25 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfRows.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Query.md +79 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Source.md +45 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql.md +11 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/TagDepth.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/NodeOperations.md +95 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/HierarchicalJaccard.md +58 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/TagSearch.md +27 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer.md +81 -0
- data/docs/api/yard/HTM/LongTermMemory/RobotOperations.md +22 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/ExpiringValue.md +24 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/TagMatchSql.md +40 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations.md +129 -0
- data/docs/api/yard/HTM/LongTermMemory/VectorSearch.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory.md +279 -31
- data/docs/api/yard/HTM/MCP/AssembleContextTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ClearGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ClearWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfigResource.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfirmTool.md +12 -0
- data/docs/api/yard/HTM/MCP/CreateGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/EnrichPendingTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ExtractPropositionsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FailoverTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FileInfoTool.md +13 -0
- data/docs/api/yard/HTM/MCP/FileSourcesResource.md +12 -0
- data/docs/api/yard/HTM/MCP/FileSupport.md +7 -0
- data/docs/api/yard/HTM/MCP/FindByTopicTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FirstMentionTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetContentTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupStatusTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRecallTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupSession.md +23 -0
- data/docs/api/yard/HTM/MCP/JoinGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LeaveGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/ListGroupsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListRobotsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LoadDirectoryTool.md +13 -0
- data/docs/api/yard/HTM/MCP/LoadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/MemoryStatsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/PopularTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PromoteRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PurgeDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RecallTool.md +16 -0
- data/docs/api/yard/HTM/MCP/RecentMemoriesResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RelatedNodesTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RestoreTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RobotGroupsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RobotTeamsStatusTool.md +13 -0
- data/docs/api/yard/HTM/MCP/RunRobotTeamsTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SearchByTagsTool.md +16 -0
- data/docs/api/yard/HTM/MCP/SearchTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Server.md +37 -0
- data/docs/api/yard/HTM/MCP/Session.md +32 -0
- data/docs/api/yard/HTM/MCP/SetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ShutdownGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/StartupPromptResource.md +16 -0
- data/docs/api/yard/HTM/MCP/StatsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/SyncFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SyncGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagHierarchyResource.md +16 -0
- data/docs/api/yard/HTM/MCP/TagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagTreeTool.md +22 -0
- data/docs/api/yard/HTM/MCP/TeamNames.md +7 -0
- data/docs/api/yard/HTM/MCP/TimelineTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Tool.md +24 -0
- data/docs/api/yard/HTM/MCP/ToolSupport.md +17 -0
- data/docs/api/yard/HTM/MCP/TopicRelationshipsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TransferWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/UnloadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/UntagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP.md +30 -0
- data/docs/api/yard/HTM/Migration.md +44 -0
- data/docs/api/yard/HTM/Models/FileSource.md +66 -0
- data/docs/api/yard/HTM/Models/Node/Scopes.md +74 -0
- data/docs/api/yard/HTM/Models/Node/SoftDeletion.md +22 -0
- data/docs/api/yard/HTM/Models/Node/VectorSimilarity.md +28 -0
- data/docs/api/yard/HTM/Models/Node.md +113 -0
- data/docs/api/yard/HTM/Models/NodeLink.md +65 -0
- data/docs/api/yard/HTM/Models/NodeRelationship.md +31 -0
- data/docs/api/yard/HTM/Models/NodeTag.md +38 -0
- data/docs/api/yard/HTM/Models/Robot.md +50 -0
- data/docs/api/yard/HTM/Models/RobotNode.md +35 -0
- data/docs/api/yard/HTM/Models/Tag/Scopes.md +32 -0
- data/docs/api/yard/HTM/Models/Tag.md +112 -0
- data/docs/api/yard/HTM/Models.md +5 -0
- data/docs/api/yard/HTM/NodeEnrichment.md +36 -0
- data/docs/api/yard/HTM/NodeView.md +113 -0
- data/docs/api/yard/HTM/NotFoundError.md +6 -5
- data/docs/api/yard/HTM/Observability.md +58 -40
- data/docs/api/yard/HTM/PropositionError.md +6 -6
- data/docs/api/yard/HTM/PropositionService.md +63 -29
- data/docs/api/yard/HTM/QueryCache/KeyNormalizer.md +25 -0
- data/docs/api/yard/HTM/QueryCache/NullStore.md +19 -0
- data/docs/api/yard/HTM/QueryCache/Store.md +43 -0
- data/docs/api/yard/HTM/QueryCache.md +41 -46
- data/docs/api/yard/HTM/QueryTimeoutError.md +9 -8
- data/docs/api/yard/HTM/Railtie.md +11 -7
- data/docs/api/yard/HTM/RecallQuery.md +111 -0
- data/docs/api/yard/HTM/ResourceExhaustedError.md +6 -6
- data/docs/api/yard/HTM/RobotGroup/CacheSync.md +35 -0
- data/docs/api/yard/HTM/RobotGroup/Membership.md +96 -0
- data/docs/api/yard/HTM/RobotGroup/TransferOptions.md +14 -0
- data/docs/api/yard/HTM/RobotGroup/WorkingMemoryLedger.md +65 -0
- data/docs/api/yard/HTM/RobotGroup.md +116 -360
- data/docs/api/yard/HTM/Robots/Actions/TagMove.md +31 -0
- data/docs/api/yard/HTM/Robots/Actions.md +153 -0
- data/docs/api/yard/HTM/Robots/Neighbors.md +20 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Idler.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Roster.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor.md +42 -0
- data/docs/api/yard/HTM/Robots/Team.md +60 -0
- data/docs/api/yard/HTM/Robots/Teams/Archivist.md +43 -0
- data/docs/api/yard/HTM/Robots/Teams/Consolidator.md +29 -0
- data/docs/api/yard/HTM/Robots/Teams/ContradictionDetector.md +33 -0
- data/docs/api/yard/HTM/Robots/Teams/TagCurator.md +37 -0
- data/docs/api/yard/HTM/Robots/Teams.md +5 -0
- data/docs/api/yard/HTM/Robots/Tools/ArchiveNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Base.md +16 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeTags.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Pass.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/RecordConflict.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/SupersedeNode.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools.md +14 -0
- data/docs/api/yard/HTM/Robots.md +72 -0
- data/docs/api/yard/HTM/SearchFilters.md +82 -0
- data/docs/api/yard/HTM/SequelConfig.md +97 -0
- data/docs/api/yard/HTM/Settings.md +39 -0
- data/docs/api/yard/HTM/Sinatra/Helpers.md +37 -0
- data/docs/api/yard/HTM/Sinatra/Middleware.md +29 -0
- data/docs/api/yard/HTM/Sinatra.md +44 -0
- data/docs/api/yard/HTM/SqlBuilder/Sparsevec.md +69 -0
- data/docs/api/yard/HTM/SqlBuilder.md +62 -75
- data/docs/api/yard/HTM/StartupPrompt.md +45 -0
- data/docs/api/yard/HTM/TagError.md +6 -6
- data/docs/api/yard/HTM/TagService.md +100 -37
- data/docs/api/yard/HTM/TagTree/Branch.md +43 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer/Layout.md +51 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer.md +25 -0
- data/docs/api/yard/HTM/TagTree.md +65 -0
- data/docs/api/yard/HTM/Telemetry/NullInstrument.md +12 -9
- data/docs/api/yard/HTM/Telemetry/NullMeter.md +17 -9
- data/docs/api/yard/HTM/Telemetry.md +53 -50
- data/docs/api/yard/HTM/Timeframe/Result.md +13 -16
- data/docs/api/yard/HTM/Timeframe.md +17 -20
- data/docs/api/yard/HTM/TimeframeExtractor/Patterns.md +18 -0
- data/docs/api/yard/HTM/TimeframeExtractor/Result.md +13 -16
- data/docs/api/yard/HTM/TimeframeExtractor.md +27 -16
- data/docs/api/yard/HTM/Timeline.md +113 -0
- data/docs/api/yard/HTM/ValidationError.md +6 -5
- data/docs/api/yard/HTM/Workflows/RememberWorkflow/NodeState.md +73 -0
- data/docs/api/yard/HTM/Workflows/RememberWorkflow.md +80 -0
- data/docs/api/yard/HTM/Workflows.md +5 -0
- data/docs/api/yard/HTM/WorkingMemory/Entry.md +67 -0
- data/docs/api/yard/HTM/WorkingMemory/Store.md +54 -0
- data/docs/api/yard/HTM/WorkingMemory.md +113 -87
- data/docs/api/yard/HTM/WorkingMemoryChannel/Subscribers.md +28 -0
- data/docs/api/yard/HTM/WorkingMemoryChannel.md +108 -102
- data/docs/api/yard/HTM.md +483 -5
- data/docs/api/yard/README.md +211 -0
- data/docs/api/yard/Sinatra/Base.md +30 -0
- data/docs/api/yard/Sinatra.md +7 -0
- data/docs/api/yard/index.csv +1834 -181
- data/docs/api/yard-reference.md +228 -9
- data/docs/architecture/adrs/005-rag-retrieval.md +3 -0
- data/docs/architecture/adrs/index.md +1 -1
- data/docs/architecture/index.md +2 -2
- data/docs/architecture/overview.md +3 -3
- data/docs/assets/images/project-structure.svg +2 -2
- data/docs/database/INDEX.md +113 -0
- data/docs/database/README.md +60 -176
- data/docs/database/file_sources.md +51 -0
- data/docs/database/file_sources.svg +120 -0
- data/docs/database/naming-convention.md +12 -12
- data/docs/database/node_links.md +65 -0
- data/docs/database/node_links.svg +171 -0
- data/docs/database/node_relationships.md +62 -0
- data/docs/database/node_relationships.svg +124 -0
- data/docs/database/node_tags.md +50 -0
- data/docs/database/node_tags.svg +125 -0
- data/docs/database/nodes.md +120 -0
- data/docs/database/nodes.svg +394 -0
- data/docs/database/robot_nodes.md +57 -0
- data/docs/database/robot_nodes.svg +155 -0
- data/docs/database/robots.md +40 -0
- data/docs/database/robots.svg +131 -0
- data/docs/database/schema.svg +384 -275
- data/docs/database/schema_migrations.md +19 -0
- data/docs/database/schema_migrations.svg +31 -0
- data/docs/database/tags.md +47 -0
- data/docs/database/tags.svg +90 -0
- data/docs/development/asgard-tasks.md +114 -0
- data/docs/development/contributing.md +6 -6
- data/docs/development/index.md +15 -17
- data/docs/development/schema.md +43 -14
- data/docs/development/setup.md +60 -70
- data/docs/development/testing.md +57 -65
- data/docs/examples/basic-usage.md +9 -9
- data/docs/examples/config-files.md +8 -8
- data/docs/examples/file-loading.md +12 -12
- data/docs/examples/index.md +15 -8
- data/docs/examples/llm-configuration.md +13 -9
- data/docs/examples/mcp-client.md +61 -59
- data/docs/examples/rails-integration.md +5 -4
- data/docs/examples/sinatra-integration.md +5 -4
- data/docs/examples/standalone-app.md +17 -16
- data/docs/getting-started/index.md +3 -3
- data/docs/getting-started/installation.md +76 -83
- data/docs/getting-started/quick-start.md +24 -22
- data/docs/guides/adding-memories.md +14 -3
- data/docs/guides/cli.md +458 -0
- data/docs/guides/configuration.md +72 -37
- data/docs/guides/epistemic-status.md +138 -0
- data/docs/guides/event-time.md +106 -0
- data/docs/guides/file-loading.md +26 -22
- data/docs/guides/getting-started.md +21 -17
- data/docs/guides/long-term-memory.md +1 -1
- data/docs/guides/mcp-server.md +416 -173
- data/docs/guides/propositions.md +18 -29
- data/docs/guides/recalling-memories.md +22 -7
- data/docs/guides/robot-teams.md +96 -0
- data/docs/guides/search-strategies.md +10 -7
- data/docs/guides/tags.md +19 -19
- data/docs/guides/timeline.md +106 -0
- data/docs/index.md +7 -7
- data/docs/llms.txt +35 -0
- data/docs/multi_framework_support.md +13 -13
- data/docs/robots/robot-groups.md +9 -9
- data/docs/robots/two-tier-memory.md +13 -26
- data/docs/setup_local_database.md +33 -31
- data/examples/00_create_examples_db.rb +20 -7
- data/examples/01_basic_usage.rb +20 -18
- data/examples/02_config_file_example/README.md +13 -12
- data/examples/02_config_file_example/config/htm.local.yml +8 -8
- data/examples/02_config_file_example/show_config.rb +3 -4
- data/examples/03_custom_llm_configuration.rb +12 -12
- data/examples/04_file_loader_usage.rb +15 -21
- data/examples/05_timeframe_demo.rb +282 -234
- data/examples/06_example_app/.loki +36 -0
- data/examples/06_example_app/app.rb +21 -33
- data/examples/07_cli_app/README.md +18 -18
- data/examples/07_cli_app/htm_cli.rb +25 -19
- data/examples/08_sinatra_app/Gemfile +1 -0
- data/examples/08_sinatra_app/Gemfile.lock +101 -67
- data/examples/08_sinatra_app/app.rb +64 -62
- data/examples/09_mcp_client.rb +92 -119
- data/examples/10_telemetry/README.md +3 -3
- data/examples/10_telemetry/SETUP_README.md +2 -2
- data/examples/10_telemetry/demo.rb +5 -5
- data/examples/11_robot_groups/README.md +5 -4
- data/examples/11_robot_groups/lib/robot_worker.rb +0 -5
- data/examples/11_robot_groups/multi_process.rb +5 -4
- data/examples/11_robot_groups/same_process.rb +18 -17
- data/examples/12_rails_app/Gemfile +1 -1
- data/examples/12_rails_app/Gemfile.lock +146 -97
- data/examples/12_rails_app/README.md +21 -17
- data/examples/12_rails_app/app/controllers/chats_controller.rb +33 -63
- data/examples/12_rails_app/app/controllers/memories_controller.rb +7 -1
- data/examples/12_rails_app/app/controllers/messages_controller.rb +21 -58
- data/examples/12_rails_app/app/controllers/search_controller.rb +7 -2
- data/examples/12_rails_app/app/models/chat.rb +0 -33
- data/examples/12_rails_app/app/models/message.rb +0 -2
- data/examples/12_rails_app/app/views/chats/show.html.erb +2 -2
- data/examples/12_rails_app/app/views/files/new.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/new.html.erb +12 -0
- data/examples/12_rails_app/app/views/memories/show.html.erb +13 -0
- data/examples/12_rails_app/app/views/search/index.html.erb +18 -2
- data/examples/12_rails_app/config/initializers/ruby_llm.rb +11 -15
- data/examples/12_rails_app/db/migrate/20261205061932_create_ruby_llm_records.rb +160 -0
- data/examples/12_rails_app/db/migrate/20261205061933_create_chats.rb +13 -0
- data/examples/12_rails_app/db/migrate/20261205061934_create_messages.rb +23 -0
- data/examples/12_rails_app/db/schema.rb +163 -20
- data/examples/README.md +53 -44
- data/examples/examples_helper.rb +29 -5
- data/htm.gemspec +68 -0
- data/lib/htm/admin/database_commands.rb +454 -0
- data/lib/htm/admin/enrich_commands.rb +209 -0
- data/lib/htm/admin/file_commands.rb +323 -0
- data/lib/htm/admin/memory_commands/edit.rb +157 -0
- data/lib/htm/admin/memory_commands/search.rb +178 -0
- data/lib/htm/admin/memory_commands/tag_search.rb +98 -0
- data/lib/htm/admin/memory_commands/text.rb +164 -0
- data/lib/htm/admin/memory_commands/working_memory.rb +71 -0
- data/lib/htm/admin/memory_commands.rb +179 -0
- data/lib/htm/admin/tag_commands.rb +352 -0
- data/lib/htm/admin/tag_graph.rb +290 -0
- data/lib/htm/admin/templates/tag_graph.html +295 -0
- data/lib/htm/admin/yard_docs.rb +206 -0
- data/lib/htm/admin.rb +253 -0
- data/lib/htm/circuit_breaker.rb +142 -68
- data/lib/htm/class_methods.rb +136 -0
- data/lib/htm/cli/config_file.rb +86 -0
- data/lib/htm/cli/db.rb +77 -0
- data/lib/htm/cli/enrich.rb +44 -0
- data/lib/htm/cli/environment.rb +74 -0
- data/lib/htm/cli/error_suggestion.rb +97 -0
- data/lib/htm/cli/files.rb +41 -0
- data/lib/htm/cli/group.rb +32 -0
- data/lib/htm/cli/memory.rb +320 -0
- data/lib/htm/cli/memory_command.rb +71 -0
- data/lib/htm/cli/robots.rb +71 -0
- data/lib/htm/cli/support.rb +46 -0
- data/lib/htm/cli/tags.rb +103 -0
- data/lib/htm/cli/working_memory.rb +41 -0
- data/lib/htm/cli.rb +75 -0
- data/lib/htm/config/builder.rb +99 -68
- data/lib/htm/config/coercion.rb +91 -0
- data/lib/htm/config/database.rb +81 -52
- data/lib/htm/config/defaults.yml +52 -16
- data/lib/htm/config/readers.rb +85 -0
- data/lib/htm/config/ruby_llm_settings.rb +58 -0
- data/lib/htm/config/validator.rb +45 -26
- data/lib/htm/config.rb +112 -297
- data/lib/htm/database.rb +305 -396
- data/lib/htm/database_docs.rb +149 -0
- data/lib/htm/embedding_service.rb +26 -66
- data/lib/htm/epistemics.rb +254 -0
- data/lib/htm/errors.rb +4 -4
- data/lib/htm/event_time.rb +201 -0
- data/lib/htm/file_memory.rb +106 -0
- data/lib/htm/input_validator.rb +158 -0
- data/lib/htm/integrations/sinatra.rb +43 -31
- data/lib/htm/job_adapter.rb +78 -83
- data/lib/htm/jobs/failure_logging.rb +49 -0
- data/lib/htm/jobs/generate_embedding_job.rb +21 -28
- data/lib/htm/jobs/generate_propositions_job.rb +56 -28
- data/lib/htm/jobs/generate_relationships_job.rb +28 -24
- data/lib/htm/jobs/generate_tags_job.rb +32 -37
- data/lib/htm/jobs/llm_call_timer.rb +53 -0
- data/lib/htm/jobs/node_lookup.rb +27 -0
- data/lib/htm/knowledge_memory.rb +153 -0
- data/lib/htm/loaders/chunk_sync.rb +168 -0
- data/lib/htm/loaders/markdown_chunker.rb +207 -36
- data/lib/htm/loaders/markdown_loader.rb +76 -120
- data/lib/htm/long_term_memory/fulltext_search.rb +15 -36
- data/lib/htm/long_term_memory/hybrid_search.rb +471 -544
- data/lib/htm/long_term_memory/node_operations.rb +110 -81
- data/lib/htm/long_term_memory/relevance_scorer.rb +232 -237
- data/lib/htm/long_term_memory/tag_operations.rb +201 -130
- data/lib/htm/long_term_memory/vector_search.rb +33 -61
- data/lib/htm/long_term_memory.rb +5 -17
- data/lib/htm/mcp/file_tools.rb +190 -0
- data/lib/htm/mcp/group_tools.rb +223 -233
- data/lib/htm/mcp/node_tools.rb +350 -0
- data/lib/htm/mcp/resources.rb +102 -28
- data/lib/htm/mcp/robot_team_tools.rb +119 -0
- data/lib/htm/mcp/server.rb +26 -14
- data/lib/htm/mcp/tag_tools.rb +130 -0
- data/lib/htm/mcp/tool.rb +40 -0
- data/lib/htm/mcp/tool_support.rb +88 -0
- data/lib/htm/mcp/tools.rb +232 -283
- data/lib/htm/models/file_source.rb +35 -20
- data/lib/htm/models/node.rb +287 -193
- data/lib/htm/models/node_link.rb +97 -0
- data/lib/htm/models/node_relationship.rb +3 -2
- data/lib/htm/models/node_tag.rb +22 -2
- data/lib/htm/models/robot.rb +4 -8
- data/lib/htm/models/robot_node.rb +5 -2
- data/lib/htm/models/tag.rb +53 -207
- data/lib/htm/node_enrichment.rb +75 -0
- data/lib/htm/node_view.rb +295 -0
- data/lib/htm/observability.rb +114 -98
- data/lib/htm/proposition_service.rb +38 -74
- data/lib/htm/query_cache.rb +145 -91
- data/lib/htm/railtie.rb +3 -7
- data/lib/htm/request_options.rb +149 -0
- data/lib/htm/robot_group/cache_sync.rb +69 -0
- data/lib/htm/robot_group/membership.rb +147 -0
- data/lib/htm/robot_group/working_memory_ledger.rb +111 -0
- data/lib/htm/robot_group.rb +128 -521
- data/lib/htm/robots/actions.rb +371 -0
- data/lib/htm/robots/neighbors.rb +63 -0
- data/lib/htm/robots/node_brief.rb +49 -0
- data/lib/htm/robots/supervisor.rb +140 -0
- data/lib/htm/robots/team.rb +124 -0
- data/lib/htm/robots/teams/archivist.rb +88 -0
- data/lib/htm/robots/teams/consolidator.rb +52 -0
- data/lib/htm/robots/teams/contradiction_detector.rb +67 -0
- data/lib/htm/robots/teams/tag_curator.rb +75 -0
- data/lib/htm/robots/tools.rb +127 -0
- data/lib/htm/robots.rb +125 -0
- data/lib/htm/search_filters.rb +116 -0
- data/lib/htm/sequel_config.rb +95 -59
- data/lib/htm/sql_builder.rb +162 -53
- data/lib/htm/startup_prompt.rb +73 -0
- data/lib/htm/tag_service.rb +104 -109
- data/lib/htm/tag_tree.rb +206 -0
- data/lib/htm/telemetry.rb +15 -16
- data/lib/htm/timeframe.rb +27 -9
- data/lib/htm/timeframe_extractor.rb +77 -55
- data/lib/htm/timeline.rb +230 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +145 -136
- data/lib/htm/working_memory/entry.rb +53 -0
- data/lib/htm/working_memory/store.rb +97 -0
- data/lib/htm/working_memory.rb +137 -139
- data/lib/htm/working_memory_channel.rb +90 -40
- data/lib/htm.rb +177 -501
- data/mkdocs.yml +100 -23
- data/scripts/install_local_database.sh +7 -6
- metadata +1032 -594
- data/.tbls.yml +0 -31
- data/Rakefile +0 -240
- data/bin/htm_mcp +0 -27
- data/docs/api/yard/HTM/ActiveRecordConfig.md +0 -29
- data/docs/api/yard/HTM/ConfigSection.md +0 -28
- data/docs/database/public.file_sources.md +0 -42
- data/docs/database/public.file_sources.svg +0 -219
- data/docs/database/public.node_stats.md +0 -48
- data/docs/database/public.node_stats.svg +0 -41
- data/docs/database/public.node_tags.md +0 -41
- data/docs/database/public.node_tags.svg +0 -251
- data/docs/database/public.nodes.md +0 -61
- data/docs/database/public.nodes.svg +0 -283
- data/docs/database/public.nodes_tags.md +0 -39
- data/docs/database/public.nodes_tags.svg +0 -112
- data/docs/database/public.ontology_structure.md +0 -48
- data/docs/database/public.ontology_structure.svg +0 -38
- data/docs/database/public.operations_log.md +0 -42
- data/docs/database/public.operations_log.svg +0 -130
- data/docs/database/public.relationships.md +0 -39
- data/docs/database/public.relationships.svg +0 -41
- data/docs/database/public.robot_activity.md +0 -46
- data/docs/database/public.robot_activity.svg +0 -35
- data/docs/database/public.robot_nodes.md +0 -48
- data/docs/database/public.robot_nodes.svg +0 -251
- data/docs/database/public.robots.md +0 -34
- data/docs/database/public.robots.svg +0 -165
- data/docs/database/public.schema_migrations.md +0 -29
- data/docs/database/public.schema_migrations.svg +0 -26
- data/docs/database/public.tags.md +0 -38
- data/docs/database/public.tags.svg +0 -147
- data/docs/database/public.topic_relationships.md +0 -45
- data/docs/database/public.topic_relationships.svg +0 -32
- data/docs/database/schema.json +0 -1814
- data/docs/database_rake_tasks.md +0 -345
- data/docs/development/rake-tasks.md +0 -1113
- data/docs/using_rake_tasks_in_your_app.md +0 -383
- data/examples/06_example_app/Rakefile +0 -71
- data/examples/12_rails_app/app/models/model.rb +0 -5
- data/examples/12_rails_app/app/models/tool_call.rb +0 -5
- data/examples/12_rails_app/db/migrate/20250124000001_create_ruby_llm_tables.rb +0 -34
- data/examples/12_rails_app/db/migrate/20250124000002_create_models_table.rb +0 -28
- data/lib/htm/mcp/cli.rb +0 -583
- data/lib/htm/tasks.rb +0 -79
- data/lib/tasks/db.rake +0 -15
- data/lib/tasks/doc.rake +0 -301
- data/lib/tasks/files.rake +0 -285
- data/lib/tasks/htm.rake +0 -703
- data/lib/tasks/jobs.rake +0 -429
- data/lib/tasks/tags.rake +0 -184
- data/scripts/backfill_parent_tags.rb +0 -376
- data/scripts/normalize_plural_tags.rb +0 -335
data/lib/htm/mcp/cli.rb
DELETED
|
@@ -1,583 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class HTM
|
|
4
|
-
module MCP
|
|
5
|
-
# CLI commands for htm_mcp executable
|
|
6
|
-
module CLI
|
|
7
|
-
module_function
|
|
8
|
-
|
|
9
|
-
def print_help
|
|
10
|
-
puts <<~HELP
|
|
11
|
-
HTM MCP Server v#{HTM::VERSION} - Memory management for AI assistants
|
|
12
|
-
|
|
13
|
-
USAGE:
|
|
14
|
-
htm_mcp [COMMAND]
|
|
15
|
-
|
|
16
|
-
COMMANDS:
|
|
17
|
-
server Start the MCP server (default if no command given)
|
|
18
|
-
stdio Alias for server (for MCP client compatibility)
|
|
19
|
-
setup Initialize the database schema
|
|
20
|
-
init Alias for setup
|
|
21
|
-
verify Verify database connection and extensions
|
|
22
|
-
stats Show memory statistics
|
|
23
|
-
config Output default configuration to STDOUT
|
|
24
|
-
rake Run HTM rake tasks (use -T [pattern] to list)
|
|
25
|
-
version Show HTM version
|
|
26
|
-
help Show this help message
|
|
27
|
-
|
|
28
|
-
ENVIRONMENT VARIABLES:
|
|
29
|
-
|
|
30
|
-
Note: Nested config uses double underscores (e.g., HTM_EMBEDDING__PROVIDER)
|
|
31
|
-
|
|
32
|
-
Environment:
|
|
33
|
-
HTM_ENV Environment name: development, test, production
|
|
34
|
-
(priority: HTM_ENV > RAILS_ENV > RACK_ENV > 'development')
|
|
35
|
-
|
|
36
|
-
Database:
|
|
37
|
-
HTM_DATABASE__URL PostgreSQL connection URL (preferred)
|
|
38
|
-
Example: postgresql://user:pass@localhost:5432/htm_development
|
|
39
|
-
HTM_DATABASE__HOST Database host (default: localhost)
|
|
40
|
-
HTM_DATABASE__PORT Database port (default: 5432)
|
|
41
|
-
HTM_DATABASE__NAME Database name
|
|
42
|
-
HTM_DATABASE__USER Database username
|
|
43
|
-
HTM_DATABASE__PASSWORD Database password
|
|
44
|
-
HTM_DATABASE__SSLMODE SSL mode (default: prefer)
|
|
45
|
-
HTM_DATABASE__POOL_SIZE Connection pool size (default: 10)
|
|
46
|
-
|
|
47
|
-
Embedding:
|
|
48
|
-
HTM_EMBEDDING__PROVIDER Provider (default: ollama)
|
|
49
|
-
HTM_EMBEDDING__MODEL Model (default: nomic-embed-text:latest)
|
|
50
|
-
HTM_EMBEDDING__DIMENSIONS Dimensions (default: 768)
|
|
51
|
-
HTM_EMBEDDING__TIMEOUT Timeout seconds (default: 120)
|
|
52
|
-
HTM_EMBEDDING__MAX_DIMENSION Max dimensions (default: 2000)
|
|
53
|
-
|
|
54
|
-
Tag Extraction:
|
|
55
|
-
HTM_TAG__PROVIDER Provider (default: ollama)
|
|
56
|
-
HTM_TAG__MODEL Model (default: gemma3:latest)
|
|
57
|
-
HTM_TAG__TIMEOUT Timeout seconds (default: 180)
|
|
58
|
-
HTM_TAG__MAX_DEPTH Max hierarchy depth (default: 4)
|
|
59
|
-
|
|
60
|
-
Proposition Extraction:
|
|
61
|
-
HTM_PROPOSITION__PROVIDER Provider (default: ollama)
|
|
62
|
-
HTM_PROPOSITION__MODEL Model (default: gemma3:latest)
|
|
63
|
-
HTM_PROPOSITION__TIMEOUT Timeout seconds (default: 180)
|
|
64
|
-
HTM_PROPOSITION__ENABLED Enable extraction (default: false)
|
|
65
|
-
|
|
66
|
-
Chunking:
|
|
67
|
-
HTM_CHUNKING__SIZE Max chars per chunk (default: 1024)
|
|
68
|
-
HTM_CHUNKING__OVERLAP Chunk overlap chars (default: 64)
|
|
69
|
-
|
|
70
|
-
Job Backend:
|
|
71
|
-
HTM_JOB__BACKEND Backend: inline, thread, active_job, sidekiq
|
|
72
|
-
|
|
73
|
-
Provider API Keys:
|
|
74
|
-
HTM_PROVIDERS__OLLAMA__URL Ollama URL (default: http://localhost:11434)
|
|
75
|
-
HTM_PROVIDERS__OPENAI__API_KEY OpenAI API key
|
|
76
|
-
HTM_PROVIDERS__ANTHROPIC__API_KEY Anthropic API key
|
|
77
|
-
HTM_PROVIDERS__GEMINI__API_KEY Google Gemini API key
|
|
78
|
-
HTM_PROVIDERS__AZURE__API_KEY Azure OpenAI API key
|
|
79
|
-
HTM_PROVIDERS__AZURE__ENDPOINT Azure OpenAI endpoint
|
|
80
|
-
|
|
81
|
-
Other:
|
|
82
|
-
HTM_LOG_LEVEL Log level (default: info)
|
|
83
|
-
HTM_CONNECTION_TIMEOUT Connection timeout seconds (default: 30)
|
|
84
|
-
HTM_TELEMETRY_ENABLED Enable OpenTelemetry (default: false)
|
|
85
|
-
|
|
86
|
-
OPTIONS:
|
|
87
|
-
-c, --config [PATH] Without PATH: output default config to STDOUT
|
|
88
|
-
With PATH: load config from YAML file
|
|
89
|
-
|
|
90
|
-
EXAMPLES:
|
|
91
|
-
# Generate a config file template
|
|
92
|
-
htm_mcp --config > my_config.yml
|
|
93
|
-
|
|
94
|
-
# Start server with custom config
|
|
95
|
-
htm_mcp --config my_config.yml
|
|
96
|
-
|
|
97
|
-
# First-time setup
|
|
98
|
-
export HTM_DATABASE__URL="postgresql://postgres@localhost:5432/htm"
|
|
99
|
-
htm_mcp setup
|
|
100
|
-
|
|
101
|
-
# Verify connection
|
|
102
|
-
htm_mcp verify
|
|
103
|
-
|
|
104
|
-
# Use test database
|
|
105
|
-
HTM_ENV=test htm_mcp setup
|
|
106
|
-
HTM_ENV=test htm_mcp stats
|
|
107
|
-
|
|
108
|
-
# Start MCP server (for Claude Desktop)
|
|
109
|
-
htm_mcp
|
|
110
|
-
|
|
111
|
-
# List available rake tasks
|
|
112
|
-
htm_mcp rake -T
|
|
113
|
-
htm_mcp rake --tasks
|
|
114
|
-
|
|
115
|
-
# List tasks matching a pattern
|
|
116
|
-
htm_mcp rake -T htm:jobs
|
|
117
|
-
htm_mcp rake -T db
|
|
118
|
-
|
|
119
|
-
# Run rake tasks
|
|
120
|
-
htm_mcp rake htm:db:stats
|
|
121
|
-
htm_mcp rake htm:tags:tree
|
|
122
|
-
htm_mcp rake 'htm:tags:tree[database]'
|
|
123
|
-
|
|
124
|
-
CLAUDE DESKTOP CONFIGURATION:
|
|
125
|
-
Add to ~/.config/claude/claude_desktop_config.json:
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
"mcpServers": {
|
|
129
|
-
"htm-memory": {
|
|
130
|
-
"command": "/path/to/htm_mcp",
|
|
131
|
-
"env": {
|
|
132
|
-
"HTM_DATABASE__URL": "postgresql://postgres@localhost:5432/htm_development"
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
HELP
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def check_database_config!
|
|
141
|
-
return if ENV['HTM_DATABASE__URL'] || ENV['HTM_DATABASE__NAME']
|
|
142
|
-
warn "Error: Database not configured."
|
|
143
|
-
warn "Set HTM_DATABASE__URL or HTM_DATABASE__NAME environment variable."
|
|
144
|
-
warn "Run 'htm_mcp help' for details."
|
|
145
|
-
exit 1
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
def print_error_suggestion(error_message)
|
|
149
|
-
warn ""
|
|
150
|
-
suggestion_lines_for(error_message.to_s.downcase).each { |line| warn line }
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def extract_dbname(url_or_name)
|
|
154
|
-
return url_or_name unless url_or_name&.include?("://")
|
|
155
|
-
|
|
156
|
-
# Extract database name from URL like postgresql://user@host:port/dbname
|
|
157
|
-
if url_or_name =~ %r{/([^/?]+)(?:\?|$)}
|
|
158
|
-
::Regexp.last_match(1)
|
|
159
|
-
else
|
|
160
|
-
"htm_development"
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
def run_setup
|
|
165
|
-
puts "HTM Database Setup"
|
|
166
|
-
puts "=================="
|
|
167
|
-
puts
|
|
168
|
-
|
|
169
|
-
check_database_config!
|
|
170
|
-
|
|
171
|
-
begin
|
|
172
|
-
HTM::Database.setup
|
|
173
|
-
puts
|
|
174
|
-
puts "Database initialized successfully!"
|
|
175
|
-
puts "You can now start the MCP server with: htm_mcp"
|
|
176
|
-
rescue => e
|
|
177
|
-
warn "Setup failed: #{e.message}"
|
|
178
|
-
print_error_suggestion(e.message)
|
|
179
|
-
warn e.backtrace.first(5).join("\n") if ENV['DEBUG']
|
|
180
|
-
exit 1
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
def run_verify
|
|
185
|
-
puts "HTM Database Verification"
|
|
186
|
-
puts "========================="
|
|
187
|
-
puts
|
|
188
|
-
|
|
189
|
-
check_database_config!
|
|
190
|
-
|
|
191
|
-
begin
|
|
192
|
-
HTM::Database.info
|
|
193
|
-
puts
|
|
194
|
-
|
|
195
|
-
# Check migration status
|
|
196
|
-
pending = check_migration_status
|
|
197
|
-
puts
|
|
198
|
-
|
|
199
|
-
if pending.positive?
|
|
200
|
-
warn "Warning: #{pending} pending migration(s) detected."
|
|
201
|
-
warn " Run 'htm_mcp setup' to apply pending migrations."
|
|
202
|
-
puts
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
puts "Database connection verified!"
|
|
206
|
-
rescue => e
|
|
207
|
-
warn "Verification failed: #{e.message}"
|
|
208
|
-
print_error_suggestion(e.message)
|
|
209
|
-
warn e.backtrace.first(5).join("\n") if ENV['DEBUG']
|
|
210
|
-
exit 1
|
|
211
|
-
end
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
def check_migration_status
|
|
215
|
-
migrations_path = File.expand_path('../../../db/migrate', __dir__)
|
|
216
|
-
|
|
217
|
-
# Get available migrations from files
|
|
218
|
-
available_migrations = Dir.glob(File.join(migrations_path, '*.rb')).map do |file|
|
|
219
|
-
{
|
|
220
|
-
version: File.basename(file).split('_').first,
|
|
221
|
-
name: File.basename(file, '.rb')
|
|
222
|
-
}
|
|
223
|
-
end
|
|
224
|
-
available_migrations = available_migrations.sort_by { |m| m[:version] }
|
|
225
|
-
|
|
226
|
-
# Ensure Sequel connection for migration check
|
|
227
|
-
HTM::SequelConfig.establish_connection!
|
|
228
|
-
|
|
229
|
-
# Get applied migrations from database
|
|
230
|
-
applied_versions = begin
|
|
231
|
-
HTM.db[:schema_migrations].select_order_map(:version)
|
|
232
|
-
rescue Sequel::DatabaseError
|
|
233
|
-
[]
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
puts "Migration Status"
|
|
237
|
-
puts "-" * 80
|
|
238
|
-
|
|
239
|
-
if available_migrations.empty?
|
|
240
|
-
puts " No migration files found"
|
|
241
|
-
return 0
|
|
242
|
-
end
|
|
243
|
-
|
|
244
|
-
available_migrations.each do |migration|
|
|
245
|
-
applied = applied_versions.include?(migration[:version])
|
|
246
|
-
status_mark = applied ? "+" : "-"
|
|
247
|
-
puts " #{status_mark} #{migration[:name]}"
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
applied_count = applied_versions.length
|
|
251
|
-
pending_count = available_migrations.length - applied_count
|
|
252
|
-
|
|
253
|
-
puts "-" * 80
|
|
254
|
-
puts " #{applied_count} applied, #{pending_count} pending"
|
|
255
|
-
|
|
256
|
-
pending_count
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
def output_default_config
|
|
260
|
-
defaults_path = File.expand_path('../config/defaults.yml', __dir__)
|
|
261
|
-
if File.exist?(defaults_path)
|
|
262
|
-
puts File.read(defaults_path)
|
|
263
|
-
else
|
|
264
|
-
warn "Error: defaults.yml not found at #{defaults_path}"
|
|
265
|
-
exit 1
|
|
266
|
-
end
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
def load_config_file(path)
|
|
270
|
-
unless File.exist?(path)
|
|
271
|
-
warn "Error: Config file not found: #{path}"
|
|
272
|
-
exit 1
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
begin
|
|
276
|
-
require 'yaml'
|
|
277
|
-
config_data = YAML.safe_load_file(path, permitted_classes: [Symbol],
|
|
278
|
-
symbolize_names: true,
|
|
279
|
-
aliases: true) || {}
|
|
280
|
-
|
|
281
|
-
# Determine which section to use based on environment
|
|
282
|
-
env = HTM::Config.env.to_sym
|
|
283
|
-
base = config_data[:defaults] || {}
|
|
284
|
-
env_overrides = config_data[env] || {}
|
|
285
|
-
|
|
286
|
-
# Merge base with environment-specific overrides
|
|
287
|
-
merged = deep_merge(base, env_overrides)
|
|
288
|
-
|
|
289
|
-
apply_config(merged)
|
|
290
|
-
|
|
291
|
-
warn "Loaded configuration from: #{path}"
|
|
292
|
-
warn "Environment: #{env}"
|
|
293
|
-
rescue => e
|
|
294
|
-
warn "Error loading config file: #{e.message}"
|
|
295
|
-
warn e.backtrace.first(5).join("\n") if ENV['DEBUG']
|
|
296
|
-
exit 1
|
|
297
|
-
end
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
def deep_merge(base, override)
|
|
301
|
-
base.merge(override) do |_key, old_val, new_val|
|
|
302
|
-
if old_val.is_a?(Hash) && new_val.is_a?(Hash)
|
|
303
|
-
deep_merge(old_val, new_val)
|
|
304
|
-
else
|
|
305
|
-
new_val.nil? ? old_val : new_val
|
|
306
|
-
end
|
|
307
|
-
end
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
def apply_config(config)
|
|
311
|
-
HTM.configure do |c|
|
|
312
|
-
# Apply nested sections
|
|
313
|
-
apply_section(c, :database, config[:database])
|
|
314
|
-
apply_section(c, :service, config[:service])
|
|
315
|
-
apply_section(c, :embedding, config[:embedding])
|
|
316
|
-
apply_section(c, :tag, config[:tag])
|
|
317
|
-
apply_section(c, :proposition, config[:proposition])
|
|
318
|
-
apply_section(c, :chunking, config[:chunking])
|
|
319
|
-
apply_section(c, :circuit_breaker, config[:circuit_breaker])
|
|
320
|
-
apply_section(c, :relevance, config[:relevance])
|
|
321
|
-
apply_section(c, :job, config[:job])
|
|
322
|
-
apply_section(c, :providers, config[:providers])
|
|
323
|
-
|
|
324
|
-
# Apply top-level scalars
|
|
325
|
-
c.week_start = config[:week_start] if config[:week_start]
|
|
326
|
-
c.connection_timeout = config[:connection_timeout] if config[:connection_timeout]
|
|
327
|
-
c.telemetry_enabled = config[:telemetry_enabled] unless config[:telemetry_enabled].nil?
|
|
328
|
-
c.log_level = config[:log_level] if config[:log_level]
|
|
329
|
-
end
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
def apply_section(config, section_name, values)
|
|
333
|
-
return unless values.is_a?(Hash)
|
|
334
|
-
|
|
335
|
-
section = config.send(section_name)
|
|
336
|
-
values.each do |key, value|
|
|
337
|
-
next if value.nil?
|
|
338
|
-
|
|
339
|
-
if value.is_a?(Hash)
|
|
340
|
-
# Handle nested sections (like providers.openai)
|
|
341
|
-
subsection = section.send(key)
|
|
342
|
-
value.each do |subkey, subvalue|
|
|
343
|
-
subsection.send("#{subkey}=", subvalue) unless subvalue.nil?
|
|
344
|
-
end
|
|
345
|
-
else
|
|
346
|
-
section.send("#{key}=", value)
|
|
347
|
-
end
|
|
348
|
-
end
|
|
349
|
-
end
|
|
350
|
-
|
|
351
|
-
def run_stats
|
|
352
|
-
puts "HTM Memory Statistics"
|
|
353
|
-
puts "====================="
|
|
354
|
-
puts
|
|
355
|
-
|
|
356
|
-
check_database_config!
|
|
357
|
-
|
|
358
|
-
begin
|
|
359
|
-
HTM::SequelConfig.establish_connection!
|
|
360
|
-
|
|
361
|
-
total_nodes = HTM::Models::Node.count
|
|
362
|
-
deleted_nodes = HTM::Models::Node.deleted.count
|
|
363
|
-
with_embeddings = HTM::Models::Node.with_embeddings.count
|
|
364
|
-
total_tags = HTM::Models::Tag.count
|
|
365
|
-
total_robots = HTM::Models::Robot.count
|
|
366
|
-
total_files = HTM::Models::FileSource.count
|
|
367
|
-
|
|
368
|
-
# Get database size
|
|
369
|
-
db_size = HTM.db.fetch(
|
|
370
|
-
"SELECT pg_size_pretty(pg_database_size(current_database())) AS size"
|
|
371
|
-
).first[:size]
|
|
372
|
-
|
|
373
|
-
puts "Nodes: #{total_nodes} active, #{deleted_nodes} deleted, #{with_embeddings} with embeddings"
|
|
374
|
-
puts "Tags: #{total_tags}"
|
|
375
|
-
puts "Robots: #{total_robots}"
|
|
376
|
-
puts "Files: #{total_files}"
|
|
377
|
-
puts
|
|
378
|
-
puts "Database size: #{db_size}"
|
|
379
|
-
rescue => e
|
|
380
|
-
warn "Stats failed: #{e.message}"
|
|
381
|
-
print_error_suggestion(e.message)
|
|
382
|
-
warn e.backtrace.first(5).join("\n") if ENV['DEBUG']
|
|
383
|
-
exit 1
|
|
384
|
-
end
|
|
385
|
-
end
|
|
386
|
-
|
|
387
|
-
def run(args)
|
|
388
|
-
args = args.dup
|
|
389
|
-
|
|
390
|
-
# Handle -c / --config option first (can be combined with other commands)
|
|
391
|
-
handle_config_option(args)
|
|
392
|
-
|
|
393
|
-
# Process remaining command
|
|
394
|
-
case args[0]&.downcase
|
|
395
|
-
when 'help', '-h', '--help'
|
|
396
|
-
print_help
|
|
397
|
-
when 'version', '-v', '--version'
|
|
398
|
-
puts "HTM #{HTM::VERSION}"
|
|
399
|
-
when 'setup', 'init'
|
|
400
|
-
run_setup
|
|
401
|
-
when 'verify'
|
|
402
|
-
run_verify
|
|
403
|
-
when 'stats'
|
|
404
|
-
run_stats
|
|
405
|
-
when 'config'
|
|
406
|
-
output_default_config
|
|
407
|
-
when 'rake'
|
|
408
|
-
run_rake(args[1..] || [])
|
|
409
|
-
when 'server', 'stdio', nil
|
|
410
|
-
# Return false to indicate server should start
|
|
411
|
-
# 'stdio' is accepted for compatibility with MCP clients that pass it as an argument
|
|
412
|
-
return false
|
|
413
|
-
when /^-/
|
|
414
|
-
warn "Unknown option: #{args[0]}"
|
|
415
|
-
warn "Run 'htm_mcp help' for usage."
|
|
416
|
-
exit 1
|
|
417
|
-
else
|
|
418
|
-
warn "Unknown command: #{args[0]}"
|
|
419
|
-
warn "Run 'htm_mcp help' for usage."
|
|
420
|
-
exit 1
|
|
421
|
-
end
|
|
422
|
-
true
|
|
423
|
-
end
|
|
424
|
-
|
|
425
|
-
# Handle -c / --config option, modifying args in place
|
|
426
|
-
# Returns true if config was loaded, nil otherwise
|
|
427
|
-
def handle_config_option(args)
|
|
428
|
-
config_idx = args.index('-c') || args.index('--config')
|
|
429
|
-
return nil unless config_idx
|
|
430
|
-
|
|
431
|
-
# Remove the -c/--config flag
|
|
432
|
-
args.delete_at(config_idx)
|
|
433
|
-
|
|
434
|
-
# Check if next arg is a path (not another flag or command)
|
|
435
|
-
next_arg = args[config_idx]
|
|
436
|
-
|
|
437
|
-
if next_arg.nil? || next_arg.start_with?('-') || command?(next_arg)
|
|
438
|
-
# No path provided - output default config and exit
|
|
439
|
-
output_default_config
|
|
440
|
-
exit 0
|
|
441
|
-
else
|
|
442
|
-
# Path provided - load config file
|
|
443
|
-
config_path = args.delete_at(config_idx)
|
|
444
|
-
load_config_file(config_path)
|
|
445
|
-
true
|
|
446
|
-
end
|
|
447
|
-
end
|
|
448
|
-
|
|
449
|
-
def command?(arg)
|
|
450
|
-
%w[help version setup init verify stats config server stdio rake].include?(arg.downcase)
|
|
451
|
-
end
|
|
452
|
-
|
|
453
|
-
def run_rake(args)
|
|
454
|
-
require 'rake'
|
|
455
|
-
|
|
456
|
-
# Handle --tasks / -T to list available tasks (with optional pattern)
|
|
457
|
-
if args.empty? || args.first == '--tasks' || args.first == '-T'
|
|
458
|
-
# Check for optional pattern after -T/--tasks
|
|
459
|
-
pattern = nil
|
|
460
|
-
if ['--tasks', '-T'].include?(args.first)
|
|
461
|
-
pattern = args[1] # May be nil if no pattern provided
|
|
462
|
-
end
|
|
463
|
-
list_rake_tasks(pattern: pattern)
|
|
464
|
-
return
|
|
465
|
-
end
|
|
466
|
-
|
|
467
|
-
task_name = args.shift
|
|
468
|
-
|
|
469
|
-
# Load HTM rake tasks
|
|
470
|
-
load_htm_rake_tasks
|
|
471
|
-
|
|
472
|
-
# Check if task exists
|
|
473
|
-
unless Rake::Task.task_defined?(task_name)
|
|
474
|
-
warn "Unknown rake task: #{task_name}"
|
|
475
|
-
warn "Run 'htm_mcp rake --tasks' to see available tasks."
|
|
476
|
-
exit 1
|
|
477
|
-
end
|
|
478
|
-
|
|
479
|
-
# Set remaining args as task arguments if any
|
|
480
|
-
# Rake tasks use ARGV for arguments in brackets like task[arg1,arg2]
|
|
481
|
-
begin
|
|
482
|
-
Rake::Task[task_name].invoke
|
|
483
|
-
rescue => e
|
|
484
|
-
warn "Rake task failed: #{e.message}"
|
|
485
|
-
warn e.backtrace.first(5).join("\n") if ENV['DEBUG']
|
|
486
|
-
exit 1
|
|
487
|
-
end
|
|
488
|
-
end
|
|
489
|
-
|
|
490
|
-
def load_htm_rake_tasks
|
|
491
|
-
# Clear any existing tasks to avoid conflicts
|
|
492
|
-
Rake::TaskManager.record_task_metadata = true
|
|
493
|
-
Rake.application = Rake::Application.new
|
|
494
|
-
Rake.application.init('htm_mcp')
|
|
495
|
-
|
|
496
|
-
# Load all HTM task files
|
|
497
|
-
tasks_dir = File.expand_path('../../tasks', __dir__)
|
|
498
|
-
Dir.glob(File.join(tasks_dir, '*.rake')).each do |rake_file|
|
|
499
|
-
load rake_file
|
|
500
|
-
end
|
|
501
|
-
end
|
|
502
|
-
|
|
503
|
-
def list_rake_tasks(pattern: nil)
|
|
504
|
-
load_htm_rake_tasks
|
|
505
|
-
|
|
506
|
-
# Collect tasks with descriptions, sorted by name
|
|
507
|
-
tasks = Rake.application.tasks
|
|
508
|
-
.select { |t| t.comment && t.name.start_with?('htm:') }
|
|
509
|
-
.sort_by(&:name)
|
|
510
|
-
|
|
511
|
-
# Filter by pattern if provided (matches task name)
|
|
512
|
-
if pattern
|
|
513
|
-
tasks = tasks.select { |t| t.name.include?(pattern) }
|
|
514
|
-
end
|
|
515
|
-
|
|
516
|
-
if tasks.empty?
|
|
517
|
-
if pattern
|
|
518
|
-
puts "No HTM rake tasks matching '#{pattern}'"
|
|
519
|
-
else
|
|
520
|
-
puts "No HTM rake tasks found"
|
|
521
|
-
end
|
|
522
|
-
return
|
|
523
|
-
end
|
|
524
|
-
|
|
525
|
-
if pattern
|
|
526
|
-
puts "HTM rake tasks matching '#{pattern}':"
|
|
527
|
-
else
|
|
528
|
-
puts "Available HTM rake tasks:"
|
|
529
|
-
end
|
|
530
|
-
puts
|
|
531
|
-
|
|
532
|
-
# Find max task name length for alignment
|
|
533
|
-
max_len = tasks.map { |t| t.name.length }.max || 0
|
|
534
|
-
|
|
535
|
-
tasks.each do |task|
|
|
536
|
-
printf " %-#{max_len}s # %s\n", task.name, task.comment
|
|
537
|
-
end
|
|
538
|
-
|
|
539
|
-
puts
|
|
540
|
-
puts "Run with: htm_mcp rake <task_name>"
|
|
541
|
-
puts "Example: htm_mcp rake htm:db:stats"
|
|
542
|
-
end
|
|
543
|
-
|
|
544
|
-
private
|
|
545
|
-
|
|
546
|
-
def suggestion_lines_for(msg)
|
|
547
|
-
if msg.include?("does not exist") && !msg.include?("role")
|
|
548
|
-
dbname = extract_dbname(ENV['HTM_DATABASE__URL'] || ENV.fetch('HTM_DATABASE__NAME', nil))
|
|
549
|
-
["Suggestion: The database does not exist. Create it with:",
|
|
550
|
-
" createdb #{dbname}",
|
|
551
|
-
"Then initialize the schema with:", " htm_mcp setup"]
|
|
552
|
-
elsif msg.include?("password authentication failed") || msg.include?("no password supplied")
|
|
553
|
-
["Suggestion: Check your database credentials.",
|
|
554
|
-
"Verify HTM_DATABASE__URL has correct username and password:",
|
|
555
|
-
" postgresql://USER:PASSWORD@localhost:5432/DATABASE"]
|
|
556
|
-
elsif msg.include?("connection refused") || msg.include?("could not connect")
|
|
557
|
-
["Suggestion: PostgreSQL server is not running or not accepting connections.",
|
|
558
|
-
"Start PostgreSQL with:",
|
|
559
|
-
" brew services start postgresql@17 # macOS with Homebrew",
|
|
560
|
-
" sudo systemctl start postgresql # Linux"]
|
|
561
|
-
elsif msg.include?("role") && msg.include?("does not exist")
|
|
562
|
-
["Suggestion: The database user does not exist. Create it with:",
|
|
563
|
-
" createuser -s YOUR_USERNAME"]
|
|
564
|
-
elsif msg.include?("permission denied")
|
|
565
|
-
["Suggestion: The user lacks permission to access this database.",
|
|
566
|
-
"Grant access or use a different user with appropriate privileges."]
|
|
567
|
-
elsif msg.include?("timeout") || msg.include?("timed out")
|
|
568
|
-
["Suggestion: Connection timed out. Check:",
|
|
569
|
-
" - PostgreSQL is running",
|
|
570
|
-
" - Firewall allows connections on port 5432",
|
|
571
|
-
" - Host address is correct"]
|
|
572
|
-
elsif msg.include?("extension") && msg.include?("vector")
|
|
573
|
-
["Suggestion: pgvector extension is not installed. Install it with:",
|
|
574
|
-
" brew install pgvector # macOS",
|
|
575
|
-
"Then enable it in your database:",
|
|
576
|
-
" psql -d DATABASE -c 'CREATE EXTENSION vector;'"]
|
|
577
|
-
else
|
|
578
|
-
["Suggestion: Run 'htm_mcp help' for configuration details."]
|
|
579
|
-
end
|
|
580
|
-
end
|
|
581
|
-
end
|
|
582
|
-
end
|
|
583
|
-
end
|
data/lib/htm/tasks.rb
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# HTM Rake Tasks Loader
|
|
4
|
-
#
|
|
5
|
-
# Load HTM database management tasks into your application's Rakefile:
|
|
6
|
-
#
|
|
7
|
-
# require 'htm/tasks'
|
|
8
|
-
#
|
|
9
|
-
# This will make the following tasks available:
|
|
10
|
-
#
|
|
11
|
-
# Database tasks (all respect HTM_ENV/RAILS_ENV, default: development):
|
|
12
|
-
# rake htm:db:create # Create database if it doesn't exist
|
|
13
|
-
# rake htm:db:setup # Set up HTM database schema and run migrations
|
|
14
|
-
# rake htm:db:migrate # Run pending database migrations
|
|
15
|
-
# rake htm:db:status # Show migration status
|
|
16
|
-
# rake htm:db:info # Show database info
|
|
17
|
-
# rake htm:db:verify # Verify database connection
|
|
18
|
-
# rake htm:db:console # Open PostgreSQL console
|
|
19
|
-
# rake htm:db:seed # Seed database with sample data
|
|
20
|
-
# rake htm:db:drop # Drop all HTM tables (destructive!)
|
|
21
|
-
# rake htm:db:reset # Drop and recreate database (destructive!)
|
|
22
|
-
#
|
|
23
|
-
# Environment detection priority: HTM_ENV > RAILS_ENV > RACK_ENV > 'development'
|
|
24
|
-
#
|
|
25
|
-
# Examples:
|
|
26
|
-
# HTM_ENV=test rake htm:db:create # Create htm_test database
|
|
27
|
-
# HTM_ENV=test rake htm:db:setup # Setup test database with migrations
|
|
28
|
-
# HTM_ENV=test rake htm:db:drop # Drop test database
|
|
29
|
-
# RAILS_ENV=test rake htm:db:create # Also works (for Rails apps)
|
|
30
|
-
#
|
|
31
|
-
# Async job tasks:
|
|
32
|
-
# rake htm:jobs:stats # Show async job statistics
|
|
33
|
-
# rake htm:jobs:process_embeddings # Process pending embedding jobs
|
|
34
|
-
# rake htm:jobs:process_tags # Process pending tag extraction jobs
|
|
35
|
-
# rake htm:jobs:process_all # Process all pending jobs
|
|
36
|
-
# rake htm:jobs:reprocess_embeddings # Force regenerate all embeddings
|
|
37
|
-
# rake htm:jobs:failed # Show nodes with processing issues
|
|
38
|
-
# rake htm:jobs:clear_all # Clear all embeddings and tags (testing)
|
|
39
|
-
#
|
|
40
|
-
# Tag tasks:
|
|
41
|
-
# rake htm:tags:tree # Display tags as hierarchical tree
|
|
42
|
-
# rake htm:tags:tree[prefix] # Display tags with prefix filter
|
|
43
|
-
# rake htm:tags:mermaid # Export all tags to tags.md (Mermaid)
|
|
44
|
-
# rake htm:tags:mermaid[prefix] # Export filtered tags to tags.md
|
|
45
|
-
# rake htm:tags:svg # Export all tags to tags.svg
|
|
46
|
-
# rake htm:tags:svg[prefix] # Export filtered tags to tags.svg
|
|
47
|
-
# rake htm:tags:export # Export all tags to tags.txt, tags.md, tags.svg
|
|
48
|
-
# rake htm:tags:export[prefix] # Export filtered tags to all formats
|
|
49
|
-
#
|
|
50
|
-
# File loading tasks:
|
|
51
|
-
# rake htm:files:load[path] # Load a markdown file into memory
|
|
52
|
-
# rake htm:files:load_dir[path] # Load all markdown files from a directory
|
|
53
|
-
# rake htm:files:list # List all loaded file sources
|
|
54
|
-
# rake htm:files:info[path] # Show details for a loaded file
|
|
55
|
-
# rake htm:files:unload[path] # Unload a file from memory
|
|
56
|
-
# rake htm:files:sync # Sync all loaded files (reload changed files)
|
|
57
|
-
# rake htm:files:stats # Show file loading statistics
|
|
58
|
-
#
|
|
59
|
-
# Documentation tasks:
|
|
60
|
-
# rake htm:doc:yard # Build YARD API documentation website
|
|
61
|
-
# rake htm:doc:server # Start YARD documentation server (live reload)
|
|
62
|
-
# rake htm:doc:server[port] # Start server on custom port
|
|
63
|
-
# rake htm:doc:stats # Show documentation coverage statistics
|
|
64
|
-
# rake htm:doc:clean # Clean generated documentation
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
if defined?(Rake)
|
|
68
|
-
# Load HTM before loading rake tasks
|
|
69
|
-
require_relative '../htm'
|
|
70
|
-
|
|
71
|
-
# Load the rake tasks
|
|
72
|
-
load File.expand_path('../tasks/htm.rake', __dir__)
|
|
73
|
-
load File.expand_path('../tasks/jobs.rake', __dir__)
|
|
74
|
-
load File.expand_path('../tasks/tags.rake', __dir__)
|
|
75
|
-
load File.expand_path('../tasks/files.rake', __dir__)
|
|
76
|
-
load File.expand_path('../tasks/doc.rake', __dir__)
|
|
77
|
-
else
|
|
78
|
-
warn "HTM tasks not loaded: Rake is not available"
|
|
79
|
-
end
|
data/lib/tasks/db.rake
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
namespace :db do
|
|
4
|
-
desc "Run database migrations"
|
|
5
|
-
task :migrate do
|
|
6
|
-
HTM::Database.migrate
|
|
7
|
-
puts "Database migrations completed successfully"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
desc "Setup database schema (includes migrations)"
|
|
11
|
-
task :setup do
|
|
12
|
-
HTM::Database.setup
|
|
13
|
-
puts "Database setup completed successfully"
|
|
14
|
-
end
|
|
15
|
-
end
|