graph-agent 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.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +50 -0
  3. data/.github/workflows/release.yml +49 -0
  4. data/.gitignore +6 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +126 -0
  7. data/CHANGELOG.md +26 -0
  8. data/CLAUDE.md +128 -0
  9. data/Gemfile +11 -0
  10. data/Gemfile.lock +94 -0
  11. data/LICENSE +21 -0
  12. data/Makefile +114 -0
  13. data/README.md +464 -0
  14. data/Rakefile +15 -0
  15. data/docs/README.md +55 -0
  16. data/docs/api_reference.md +832 -0
  17. data/docs/concepts.md +216 -0
  18. data/docs/edges.md +265 -0
  19. data/docs/error_handling.md +241 -0
  20. data/docs/human_in_the_loop.md +231 -0
  21. data/docs/persistence.md +276 -0
  22. data/docs/quickstart.md +154 -0
  23. data/docs/send_and_command.md +218 -0
  24. data/docs/state.md +181 -0
  25. data/docs/streaming.md +172 -0
  26. data/graph-agent.gemspec +48 -0
  27. data/lib/graph_agent/channels/base_channel.rb +52 -0
  28. data/lib/graph_agent/channels/binary_operator_aggregate.rb +56 -0
  29. data/lib/graph_agent/channels/ephemeral_value.rb +59 -0
  30. data/lib/graph_agent/channels/last_value.rb +49 -0
  31. data/lib/graph_agent/channels/topic.rb +58 -0
  32. data/lib/graph_agent/checkpoint/base_saver.rb +38 -0
  33. data/lib/graph_agent/checkpoint/in_memory_saver.rb +145 -0
  34. data/lib/graph_agent/constants.rb +9 -0
  35. data/lib/graph_agent/errors.rb +41 -0
  36. data/lib/graph_agent/graph/compiled_state_graph.rb +362 -0
  37. data/lib/graph_agent/graph/conditional_edge.rb +57 -0
  38. data/lib/graph_agent/graph/edge.rb +23 -0
  39. data/lib/graph_agent/graph/mermaid_visualizer.rb +154 -0
  40. data/lib/graph_agent/graph/message_graph.rb +18 -0
  41. data/lib/graph_agent/graph/node.rb +61 -0
  42. data/lib/graph_agent/graph/state_graph.rb +197 -0
  43. data/lib/graph_agent/reducers.rb +34 -0
  44. data/lib/graph_agent/state/schema.rb +54 -0
  45. data/lib/graph_agent/types/cache_policy.rb +12 -0
  46. data/lib/graph_agent/types/command.rb +26 -0
  47. data/lib/graph_agent/types/interrupt.rb +28 -0
  48. data/lib/graph_agent/types/retry_policy.rb +42 -0
  49. data/lib/graph_agent/types/send.rb +26 -0
  50. data/lib/graph_agent/types/state_snapshot.rb +28 -0
  51. data/lib/graph_agent/version.rb +5 -0
  52. data/lib/graph_agent.rb +29 -0
  53. metadata +158 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8feb3586679e9f720ecba6e24a00e616a6f093ca54959b0956b1c62eb5d93b4a
4
+ data.tar.gz: 6e6e28e26ae5f5f3437492f0ce0f74ffade68c764a490112c614aaff889f6dc0
5
+ SHA512:
6
+ metadata.gz: 52b306b0a913a88a4f4eaa7a1e1a5d851c3a3cb5e533560c5e425d2575efbde112acbf16598ed928c952e697de1dae1939e204ff5945a6dd5584bec9d5686c28
7
+ data.tar.gz: 3eacf28616617bdd2e85ca178088ad864485860fa81d809bb1cb2eee97ee103d391d9ad8032edf018e872b8e2a275d807c7ccdc5877933eeb9f2b831c1141622
@@ -0,0 +1,50 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ ruby-version: ['3.1', '3.2', '3.3', '3.4', '4.0']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Ruby ${{ matrix.ruby-version }}
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true
25
+
26
+ - name: Run tests
27
+ run: bundle exec rspec
28
+
29
+ - name: Run RuboCop
30
+ run: bundle exec rubocop
31
+ continue-on-error: true
32
+
33
+ build:
34
+ runs-on: ubuntu-latest
35
+ needs: test
36
+
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - name: Set up Ruby
41
+ uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: '3.4'
44
+ bundler-cache: true
45
+
46
+ - name: Build gem
47
+ run: gem build graph-agent.gemspec
48
+
49
+ - name: Verify gem can be installed
50
+ run: gem install graph-agent-*.gem
@@ -0,0 +1,49 @@
1
+ name: Release Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ if: startsWith(github.ref, 'refs/tags/v')
12
+ permissions:
13
+ contents: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: '3.4'
22
+ bundler-cache: true
23
+
24
+ - name: Run tests
25
+ run: bundle exec rspec
26
+
27
+ - name: Build gem
28
+ run: gem build graph-agent.gemspec
29
+
30
+ - name: Publish to RubyGems
31
+ run: |
32
+ mkdir -p ~/.gem
33
+ echo ":rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials
34
+ chmod 0600 ~/.gem/credentials
35
+ gem push *.gem
36
+ env:
37
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
38
+
39
+ - name: Create GitHub Release
40
+ uses: softprops/action-gh-release@v2
41
+ with:
42
+ files: "*.gem"
43
+ body: |
44
+ Changes in this Release
45
+ - Check CHANGELOG.md for details
46
+ draft: false
47
+ prerelease: false
48
+ env:
49
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle/
3
+ pkg/
4
+ tmp/
5
+ .rspec_status
6
+ coverage/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,126 @@
1
+ require: []
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+ TargetRubyVersion: 3.1
6
+ SuggestExtensions: false
7
+ Exclude:
8
+ - "vendor/**/*"
9
+ - "tmp/**/*"
10
+ - "pkg/**/*"
11
+
12
+ # ── Style ──
13
+
14
+ Style/Documentation:
15
+ Enabled: false
16
+
17
+ Style/StringLiterals:
18
+ EnforcedStyle: double_quotes
19
+
20
+ Style/StringLiteralsInInterpolation:
21
+ EnforcedStyle: double_quotes
22
+
23
+ Style/FrozenStringLiteralComment:
24
+ Enabled: true
25
+
26
+ Style/GuardClause:
27
+ Enabled: false
28
+
29
+ Style/IfUnlessModifier:
30
+ Enabled: false
31
+
32
+ Style/Next:
33
+ Enabled: false
34
+
35
+ Style/RaiseArgs:
36
+ EnforcedStyle: compact
37
+
38
+ Style/RescueStandardError:
39
+ EnforcedStyle: implicit
40
+
41
+ Style/StringConcatenation:
42
+ Enabled: false
43
+
44
+ Style/IdenticalConditionalBranches:
45
+ Enabled: false
46
+
47
+ Style/SymbolProc:
48
+ Enabled: false
49
+
50
+ Style/ConditionalAssignment:
51
+ Enabled: false
52
+
53
+ # ── Metrics ──
54
+
55
+ Metrics/MethodLength:
56
+ Max: 30
57
+ Exclude:
58
+ - "spec/**/*"
59
+
60
+ Metrics/BlockLength:
61
+ Exclude:
62
+ - "spec/**/*"
63
+ - "*.gemspec"
64
+
65
+ Metrics/AbcSize:
66
+ Max: 35
67
+ Exclude:
68
+ - "spec/**/*"
69
+
70
+ Metrics/CyclomaticComplexity:
71
+ Max: 12
72
+
73
+ Metrics/PerceivedComplexity:
74
+ Max: 12
75
+
76
+ Metrics/ClassLength:
77
+ Max: 250
78
+
79
+ Metrics/ParameterLists:
80
+ Max: 8
81
+
82
+ # ── Layout ──
83
+
84
+ Layout/LineLength:
85
+ Max: 120
86
+ Exclude:
87
+ - "spec/**/*"
88
+
89
+ Layout/FirstArrayElementIndentation:
90
+ EnforcedStyle: consistent
91
+
92
+ Layout/FirstHashElementIndentation:
93
+ EnforcedStyle: consistent
94
+
95
+ # ── Naming ──
96
+
97
+ Naming/AccessorMethodName:
98
+ Enabled: false
99
+
100
+ Naming/MethodParameterName:
101
+ Enabled: false
102
+
103
+ Naming/PredicateMethod:
104
+ Enabled: false
105
+
106
+ # ── Lint ──
107
+
108
+ Lint/UnusedBlockArgument:
109
+ Enabled: false
110
+
111
+ Lint/UnusedMethodArgument:
112
+ Enabled: false
113
+
114
+ Lint/UnderscorePrefixedVariableName:
115
+ Enabled: false
116
+
117
+ Lint/SharedMutableDefault:
118
+ Enabled: false
119
+
120
+ # ── Gemspec ──
121
+
122
+ Gemspec/RequireMFA:
123
+ Enabled: false
124
+
125
+ Gemspec/DevelopmentDependencies:
126
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2025-02-10
11
+
12
+ ### Added
13
+ - Initial release of GraphAgent Ruby SDK
14
+ - Graph-based workflow engine with Pregel execution model
15
+ - State management with Schema and typed fields
16
+ - Built-in reducers: ADD, APPEND, MERGE, REPLACE, add_messages
17
+ - StateGraph and MessageGraph for building workflows
18
+ - Conditional edges with dynamic routing
19
+ - Send (map-reduce) and Command (routing + state update) patterns
20
+ - Checkpoint system with InMemorySaver for persistence
21
+ - Human-in-the-loop support with interrupt_before/interrupt_after
22
+ - Streaming execution with :values and :updates modes
23
+ - Retry policies with exponential backoff and jitter
24
+ - Mermaid diagram visualization for graph structures
25
+ - Comprehensive error handling (GraphRecursionError, InvalidUpdateError, etc.)
26
+ - Full test suite with RSpec
data/CLAUDE.md ADDED
@@ -0,0 +1,128 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## 项目概述
6
+
7
+ GraphAgent 是 LangGraph 的 Ruby 移植版,是一个用于构建有状态、多参与者代理工作流的 Ruby 框架。框架实现了 Pregel 执行模型(整体同步并行计算模型)。
8
+
9
+ ## 常用命令
10
+
11
+ ```bash
12
+ # 安装依赖
13
+ make install
14
+ # 或
15
+ bundle install
16
+
17
+ # 运行测试
18
+ make test
19
+ # 或运行特定测试文件
20
+ make test TEST=spec/graph/state_graph_spec.rb
21
+
22
+ # 代码检查
23
+ make lint # 只检查不修复
24
+ make format # 自动修复格式问题
25
+
26
+ # 构建 gem
27
+ make build
28
+
29
+ # 清理构建产物
30
+ make clean
31
+
32
+ # 交互式控制台(加载 gem)
33
+ make console
34
+ # 或
35
+ bundle exec irb -r graph_agent
36
+
37
+ # 发布流程
38
+ make tag # 自动递增补丁版本并打 tag
39
+ make tag VERSION=1.2.3 # 指定版本号打 tag
40
+ make release # tag + 推送到 RubyGems
41
+ ```
42
+
43
+ ## 核心架构
44
+
45
+ ### 目录结构
46
+
47
+ ```
48
+ lib/graph_agent/
49
+ ├── graph/ # 图相关核心类
50
+ │ ├── state_graph.rb # StateGraph - 用于构建有向图的 DSL
51
+ │ ├── compiled_state_graph.rb # CompiledStateGraph - 编译后可执行的图
52
+ │ ├── message_graph.rb # MessageGraph - 预配置消息状态的便捷封装
53
+ │ ├── node.rb # Node - 图节点包装器
54
+ │ ├── edge.rb # Edge - 有向边
55
+ │ ├── conditional_edge.rb # ConditionalEdge - 条件边
56
+ │ └── mermaid_visualizer.rb # Mermaid 图表可视化
57
+ ├── state/
58
+ │ └── schema.rb # Schema - 状态 schema 定义
59
+ ├── channels/ # Channel 抽象(当前主要是 last_value、binary_operator_aggregate 等)
60
+ ├── checkpoint/ # 状态持久化
61
+ │ ├── base_saver.rb # 检查点保存器基类
62
+ │ └── in_memory_saver.rb # 内存检查点实现
63
+ ├── types/
64
+ │ ├── send.rb # Send - 动态创建并行任务(map-reduce 模式)
65
+ │ ├── command.rb # Command - 状态更新 + 路由决策的组合
66
+ │ ├── retry_policy.rb # RetryPolicy - 节点重试策略
67
+ │ ├── cache_policy.rb # CachePolicy - 缓存策略
68
+ │ ├── interrupt.rb # Interrupt - 中断信号
69
+ │ └── state_snapshot.rb # StateSnapshot - 状态快照
70
+ ├── reducers.rb # 内置 reducer 函数(ADD, APPEND, MERGE, REPLACE 等)
71
+ ├── errors.rb # 异常类定义
72
+ ├── constants.rb # 常量(START, END_NODE)
73
+ └── version.rb # 版本号
74
+ ```
75
+
76
+ ### 核心概念
77
+
78
+ 1. **State(状态)**: 共享数据结构,通过 Schema 定义。每个字段可以指定 reducer 来控制状态合并行为。
79
+ - 无 reducer 的字段使用 "last-value" 语义(直接替换)
80
+ - 有 reducer 的字段使用 reducer 定义的语义(如 ADD、MERGE)
81
+
82
+ 2. **Node(节点)**: 处理状态的函数,接收 state 和可选的 config 参数,返回状态更新(Hash)、Command 或 Send。
83
+
84
+ 3. **Edge(边)**: 定义节点间的流转
85
+ - 普通边:固定从 A 到 B
86
+ - 条件边:根据状态动态路由
87
+ - 等待边:多个源节点都执行完后才到目标节点
88
+
89
+ 4. **Pregel 执行流程**: PLAN → EXECUTE → UPDATE → CHECKPOINT → REPEAT
90
+
91
+ ### 关键类关系
92
+
93
+ ```
94
+ StateGraph (builder) → CompiledStateGraph (executable)
95
+ ↓ ↓
96
+ schema invoke/stream
97
+ nodes checkpointer
98
+ edges interrupt_before/after
99
+ branches
100
+ ```
101
+
102
+ ### Send 和 Command 的区别
103
+
104
+ - **Send**: 用于条件边返回,动态创建并行执行任务,可传递独立参数
105
+ - **Command**: 节点返回值,同时更新状态并指定下一个跳转的节点
106
+
107
+ ## 开发注意事项
108
+
109
+ 1. **Ruby 版本**: 最低要求 3.1.0
110
+
111
+ 2. **代码风格**: 使用 Rubocop 进行检查和格式化(`make format`)
112
+
113
+ 3. **测试**: 使用 RSpec,所有测试文件位于 `spec/` 目录
114
+
115
+ 4. **命名约定**:
116
+ - 内部方法以 `_` 前缀开头(如 `_normalize_schema`)
117
+ - 节点名称转换为字符串存储
118
+ - 所有配置键使用 Symbol
119
+
120
+ 5. **保留节点名**: `START` 和 `END_NODE`(实际字符串 "__start__" 和 "__end__")是保留的入口/出口哨兵
121
+
122
+ 6. **状态更新**: 节点返回的 Hash 会通过 Schema 中定义的 reducer 进行合并
123
+
124
+ 7. **错误处理**:
125
+ - `GraphRecursionError`: 超过最大递归步数
126
+ - `InvalidUpdateError`: 无效的状态更新
127
+ - `NodeExecutionError`: 节点执行错误(包装原始错误)
128
+ - `GraphInterrupt`: 人为中断(用于 human-in-the-loop)
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ group :development, :test do
8
+ gem "rake", "~> 13.0"
9
+ gem "rspec", "~> 3.12"
10
+ gem "rubocop", "~> 1.50"
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,94 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ graph-agent (0.1.0)
5
+ concurrent-ruby (~> 1.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.3)
11
+ concurrent-ruby (1.3.6)
12
+ diff-lcs (1.6.2)
13
+ json (2.18.1)
14
+ language_server-protocol (3.17.0.5)
15
+ lint_roller (1.1.0)
16
+ parallel (1.27.0)
17
+ parser (3.3.10.1)
18
+ ast (~> 2.4.1)
19
+ racc
20
+ prism (1.9.0)
21
+ racc (1.8.1)
22
+ rainbow (3.1.1)
23
+ rake (13.3.1)
24
+ regexp_parser (2.11.3)
25
+ rspec (3.13.2)
26
+ rspec-core (~> 3.13.0)
27
+ rspec-expectations (~> 3.13.0)
28
+ rspec-mocks (~> 3.13.0)
29
+ rspec-core (3.13.6)
30
+ rspec-support (~> 3.13.0)
31
+ rspec-expectations (3.13.5)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-mocks (3.13.7)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.13.0)
37
+ rspec-support (3.13.7)
38
+ rubocop (1.84.1)
39
+ json (~> 2.3)
40
+ language_server-protocol (~> 3.17.0.2)
41
+ lint_roller (~> 1.1.0)
42
+ parallel (~> 1.10)
43
+ parser (>= 3.3.0.2)
44
+ rainbow (>= 2.2.2, < 4.0)
45
+ regexp_parser (>= 2.9.3, < 3.0)
46
+ rubocop-ast (>= 1.49.0, < 2.0)
47
+ ruby-progressbar (~> 1.7)
48
+ unicode-display_width (>= 2.4.0, < 4.0)
49
+ rubocop-ast (1.49.0)
50
+ parser (>= 3.3.7.2)
51
+ prism (~> 1.7)
52
+ ruby-progressbar (1.13.0)
53
+ unicode-display_width (3.2.0)
54
+ unicode-emoji (~> 4.1)
55
+ unicode-emoji (4.2.0)
56
+
57
+ PLATFORMS
58
+ arm64-darwin-23
59
+ ruby
60
+
61
+ DEPENDENCIES
62
+ graph-agent!
63
+ rake (~> 13.0)
64
+ rspec (~> 3.12)
65
+ rubocop (~> 1.50)
66
+
67
+ CHECKSUMS
68
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
69
+ concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
70
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
71
+ graph-agent (0.1.0)
72
+ json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
73
+ language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
74
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
75
+ parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
76
+ parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
77
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
78
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
79
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
80
+ rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
81
+ regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
82
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
83
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
84
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
85
+ rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
86
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
87
+ rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
88
+ rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
89
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
90
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
91
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
92
+
93
+ BUNDLED WITH
94
+ 4.0.3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 GraphAgent Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,114 @@
1
+ .PHONY: all install format lint test test_watch clean build console tag release help
2
+
3
+ all: help
4
+
5
+ ######################
6
+ # SETUP
7
+ ######################
8
+
9
+ install: ## Install dependencies
10
+ bundle install
11
+
12
+ ######################
13
+ # TESTING AND COVERAGE
14
+ ######################
15
+
16
+ TEST ?= .
17
+
18
+ test: ## Run the test suite (TEST=path/to/spec.rb to run a specific file)
19
+ bundle exec rspec $(if $(filter-out .,$(TEST)),$(TEST),)
20
+
21
+ test_watch: ## Run tests in watch mode (requires guard-rspec)
22
+ bundle exec guard
23
+
24
+ ######################
25
+ # LINTING AND FORMATTING
26
+ ######################
27
+
28
+ format: ## Run code formatters
29
+ bundle exec rubocop -a
30
+
31
+ lint: ## Run linters
32
+ bundle exec rubocop
33
+
34
+ ######################
35
+ # BUILD AND RELEASE
36
+ ######################
37
+
38
+ build: ## Build the gem
39
+ bundle exec rake build
40
+
41
+ clean: ## Remove build artifacts
42
+ rm -f *.gem
43
+ rm -f graph-agent-*.gem
44
+ rm -rf pkg/ tmp/ coverage/ .rspec_status
45
+
46
+ console: ## Start an interactive console with the gem loaded
47
+ bundle exec irb -r graph_agent
48
+
49
+ tag: ## Create and push a version tag. Usage: make tag [VERSION=x.y.z]
50
+ @git fetch --tags; \
51
+ if [ -z "$(VERSION)" ]; then \
52
+ LATEST=$$(git tag -l 'v[0-9]*' --sort=-v:refname | head -n1); \
53
+ if [ -z "$$LATEST" ]; then \
54
+ NEW_TAG="v0.0.1"; \
55
+ else \
56
+ MAJOR=$$(echo $$LATEST | sed 's/^v//' | cut -d. -f1); \
57
+ MINOR=$$(echo $$LATEST | sed 's/^v//' | cut -d. -f2); \
58
+ PATCH=$$(echo $$LATEST | sed 's/^v//' | cut -d. -f3); \
59
+ PATCH=$$((PATCH + 1)); \
60
+ NEW_TAG="v$$MAJOR.$$MINOR.$$PATCH"; \
61
+ fi; \
62
+ else \
63
+ NEW_TAG="v$(VERSION)"; \
64
+ LATEST=$$(git tag -l 'v[0-9]*' --sort=-v:refname | head -n1); \
65
+ if [ "$$LATEST" = "$$NEW_TAG" ]; then \
66
+ echo "Tag $$NEW_TAG already exists on remote, deleting and re-pushing..."; \
67
+ git tag -d "$$NEW_TAG" 2>/dev/null || true; \
68
+ git push origin --delete "$$NEW_TAG" 2>/dev/null || true; \
69
+ elif git tag -l "$$NEW_TAG" | grep -q "$$NEW_TAG"; then \
70
+ echo "Error: Tag $$NEW_TAG exists but is not the latest tag (latest: $$LATEST). Aborting."; \
71
+ exit 1; \
72
+ fi; \
73
+ fi; \
74
+ NEW_VERSION=$$(echo $$NEW_TAG | sed 's/^v//'); \
75
+ echo "Updating version to $$NEW_VERSION ..."; \
76
+ sed -i '' "s/VERSION = [\"'].*[\"']/VERSION = '$$NEW_VERSION'/" lib/graph_agent/version.rb; \
77
+ git add lib/graph_agent/version.rb; \
78
+ git commit -m "Release $$NEW_TAG" --allow-empty; \
79
+ git tag "$$NEW_TAG"; \
80
+ echo "Pushing tag $$NEW_TAG ..."; \
81
+ git push origin HEAD; \
82
+ git push origin "$$NEW_TAG"; \
83
+ echo "Done! Tagged and pushed $$NEW_TAG"
84
+
85
+ release: tag ## Release the gem (tag + push to RubyGems)
86
+ bundle exec rake release_gem
87
+
88
+ ######################
89
+ # HELP
90
+ ######################
91
+
92
+ help: ## Show this help
93
+ @echo '=========================='
94
+ @echo ' GraphAgent — Makefile'
95
+ @echo '=========================='
96
+ @echo ''
97
+ @echo 'SETUP'
98
+ @echo ' make install — install dependencies'
99
+ @echo ''
100
+ @echo 'TESTING'
101
+ @echo ' make test — run the full test suite'
102
+ @echo ' make test TEST=spec/... — run a specific test file'
103
+ @echo ''
104
+ @echo 'LINTING & FORMATTING'
105
+ @echo ' make format — run code formatters'
106
+ @echo ' make lint — run linters'
107
+ @echo ''
108
+ @echo 'BUILD & RELEASE'
109
+ @echo ' make build — build the gem'
110
+ @echo ' make clean — remove build artifacts'
111
+ @echo ' make console — start interactive console'
112
+ @echo ' make tag — auto-increment patch version, tag & push'
113
+ @echo ' make tag VERSION=x.y.z — tag a specific version & push'
114
+ @echo ' make release — tag + release gem to RubyGems'