Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions .claude/skills/update-api/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ Update generated types and API endpoints from the latest Telegram Bot API docume

## Step 2: Parse

Run both parse tasks to scrape the latest Telegram Bot API docs:
Download the docs once and parse both types and methods from that snapshot:

```
bundle exec rake parse:types
bundle exec rake parse:methods
bundle exec rake parse:all
```

`parse:all` is `parse:fetch` (cache the page under `tmp/api.html`) followed by
`parse:types` and `parse:methods`. Re-run `parse:types` / `parse:methods` alone to
re-parse the cached page without hitting the network.

`parse:methods` **aborts** if any documented method's return type cannot be read.
That is a parser bug, not a missing endpoint — a new phrasing has appeared in the
docs and `rakelib/parsers/return_type_rules.rb` needs a rule for it. Do not proceed
with a partial `data/methods.json`.

## Step 3: Rebuild

Before rebuilding, read the custom method files listed in Step 4 so you have a snapshot of their current content.
Expand Down Expand Up @@ -68,3 +76,18 @@ bundle exec rake spec
```

If rubocop or tests fail, fix the issues before finishing.

## Step 7: Verify the parser did not drift

When the intent is *only* to pick up a new Bot API version, the parser changes in
`data/` should be exactly the documented additions. If a re-parse of an unchanged
docs page produces any diff at all, the parser has drifted and that must be
understood before shipping:

```
bundle exec rake parse:all
git diff data/
```

This is the regression test for `rakelib/docs/` and `rakelib/parsers/`; it needs
network, so it is not part of CI.
15 changes: 1 addition & 14 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,18 @@ Metrics/BlockLength:
AllowedMethods:
- context
- describe
- namespace
- task

Metrics/ClassLength:
Exclude:
- lib/telegram/bot/api/endpoints.rb
- lib/telegram/bot/types/message.rb
- rakelib/builders/type_builder.rb
- rakelib/parsers/**/*

Metrics/MethodLength:
Exclude:
- spec/**/*
- rakelib/parsers/**/*

Metrics/AbcSize:
Exclude:
- rakelib/parsers/**/*

Metrics/CyclomaticComplexity:
Exclude:
- rakelib/parsers/**/*

Metrics/PerceivedComplexity:
Exclude:
- rakelib/parsers/**/*

Layout/LineLength:
Max: 120
Expand Down
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ gem 'rubocop', '~> 1.66.1'
gem 'rubocop-performance', '~> 1.18'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-rspec', '~> 3.1.0'

group :development do
gem 'openapi3_parser', '~> 0.9.2'
end
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require 'rspec/core/rake_task'
RuboCop::RakeTask.new(:rubocop) do |task|
task.fail_on_error = false
task.options = %w[--force-exclusion]
task.patterns = %w[{lib,spec}/**/*.rb Rakefile]
task.patterns = %w[{lib,rakelib,spec}/**/*.rb Rakefile rakelib/**/*.rake]
task.requires << 'rubocop-rspec'
end

Expand Down
1 change: 1 addition & 0 deletions data/methods.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"leaveChat": "Boolean",
"getChat": "ChatFullInfo",
"getChatAdministrators": "Array<ChatMember>",
"getChatMemberCount": "Integer",
"getChatMember": "ChatMember",
"getUserPersonalChatMessages": "Array<Message>",
"setChatStickerSet": "Boolean",
Expand Down
Loading
Loading