Skip to content

Commit f0059eb

Browse files
committed
feat: close 9 world-class gaps vs rtk and caveman
Addresses the 2-day-old rtk v0.37.1 delta and caveman distribution conventions. New CLI commands - tok pr-review [--base|--pr] : batch review all changes in a PR or branch; groups findings by file. Rule-based (no LLM). rtk /pr-review parity - tok hook mode {activate|track|status|set} : Go-native SessionStart and UserPromptSubmit hook bodies. Drop-in replacement for hooks/tok-mode-*.js sharing the same flag-file format so migration is atomic. Matches rtk v0.37.0 binary-hook architecture; Node.js scripts remain as fallback Filter expansion - filters/aws.toml : expanded from 5 → 26 subcommands (ec2, s3, lambda, iam, rds, dynamodb, ecs, eks, ecr, cloudformation, cloudwatch, logs, vpc/elb/route53, sns/sqs, ssm, secretsmanager, kms, sts, + generic). rtk v0.35.0 parity - filters/swift.toml : 6 subcommands (swift build/test/run/package, swift-format, xcodebuild test). rtk v0.36.0 parity Distribution + release ops - Formula/tok.rb : canonical rtk-convention location (packaging/brew/ kept as pointer). packaging/README.md documents tap publishing - release-please-config.json + .release-please-manifest.json + .github/workflows/release-please.yml : automated Conventional-Commits changelog + tag generation - scripts/build-skill.sh : bundles skills/ tree into tok.skill zip archive (mirrors caveman.skill distribution). zip(1) or python3 fallback Claude Code slash commands - commands/{tok-compress,tok-help,pr-review}.toml : descriptions + prompt fragments so the /command form works in Claude Code End-to-end test harness - tests/e2e/{README,run.sh,fixtures/git/} : Docker-based scenario runner diffing filtered output against golden files. rtk multipass-VM spirit without the Multipass dep Verified twice (go build + vet + test -count=1 = 49/49 packages pass) + smoke-tested pr-review, hook mode activate/track, cheatsheet.
1 parent 3028726 commit f0059eb

17 files changed

Lines changed: 1110 additions & 7 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: release-please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: googleapis/release-please-action@v4
16+
with:
17+
config-file: release-please-config.json
18+
manifest-file: .release-please-manifest.json

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.0"
3+
}

Formula/tok.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1+
# Homebrew formula for tok.
2+
#
3+
# Install: brew install --HEAD lakshmanpatel/tok/tok
4+
# Upgrade: brew upgrade tok
5+
#
6+
# For tagged releases, replace `head` with `url` + `sha256` once a GitHub
7+
# Releases page is publishing signed archives.
18
class Tok < Formula
2-
desc "Unified token optimization CLI"
3-
homepage "https://github.com/GrayCodeAI/tok"
4-
url "https://github.com/GrayCodeAI/tok/archive/refs/tags/v0.29.0.tar.gz"
5-
sha256 "..." # will be updated on release
9+
desc "Transparent command-output filter that reduces LLM token consumption"
10+
homepage "https://github.com/lakshmanpatel/tok"
611
license "MIT"
12+
head "https://github.com/lakshmanpatel/tok.git", branch: "main"
713

814
depends_on "go" => :build
915

1016
def install
11-
system "go", "build", *std_go_args(ldflags: "-s -w"), "./cmd/tok/"
12-
bin.install "tok"
17+
system "go", "build", *std_go_args(ldflags: "-s -w"), "./cmd/tok"
1318
end
1419

1520
test do
16-
assert_match "tok", shell_output("#{bin}/tok --version")
21+
assert_match "tok", shell_output("#{bin}/tok --version 2>&1", 0)
1722
end
1823
end

commands/pr-review.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description = "Batch review the full diff of the current PR in tok style"
2+
prompt = "Run tok-review semantics across every file changed in the current PR. Group findings by file. Output one-line comments: <path>:<line> <severity> <problem>. <fix>. Finish with a total-findings summary."

commands/tok-compress.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description = "Compress a markdown/memory file via tok md (preserves code, URLs, structure)"
2+
prompt = "Invoke the tok-compress skill. Call `tok md <filepath>` on the path the user supplies. Report the token savings and backup path."

commands/tok-help.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description = "Show tok quick-reference card (modes, skills, activation)"
2+
prompt = "Invoke the tok-help skill. Display the reference card. One-shot — do not change mode or write state."

filters/aws.toml

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# AWS CLI — expanded filter matching rtk's 25-subcommand coverage.
2+
# Each section targets one verb (ec2 describe, s3 ls, etc).
3+
# Order matters: more specific rules first, generic aws fallback last.
4+
schema_version = 1
5+
6+
# --- compute: EC2 ---
7+
[aws_ec2_describe]
8+
match_command = "^aws\\s+ec2\\s+describe"
9+
strip_ansi = true
10+
strip_lines_matching = ["^\\s*$"]
11+
keep_lines_matching = [
12+
"InstanceId", "State\\s*:", "PublicIpAddress", "PrivateIpAddress",
13+
"InstanceType", "Tags", "VpcId", "SubnetId", "AvailabilityZone",
14+
]
15+
max_lines = 200
16+
17+
[aws_ec2_run]
18+
match_command = "^aws\\s+ec2\\s+run-instances"
19+
strip_ansi = true
20+
keep_lines_matching = ["InstanceId", "State", "Tags"]
21+
max_lines = 60
22+
23+
[aws_ec2_stop]
24+
match_command = "^aws\\s+ec2\\s+(stop|start|terminate|reboot)-instances"
25+
strip_ansi = true
26+
keep_lines_matching = ["CurrentState", "InstanceId", "PreviousState"]
27+
max_lines = 40
28+
29+
# --- storage: S3 ---
30+
[aws_s3_ls]
31+
match_command = "^aws\\s+s3(\\s+ls)?\\b"
32+
strip_ansi = true
33+
strip_lines_matching = ["^PRE\\b", "^\\s*$"]
34+
max_lines = 100
35+
36+
[aws_s3_cp]
37+
match_command = "^aws\\s+s3\\s+(cp|mv|sync|rm)\\b"
38+
strip_ansi = true
39+
strip_lines_matching = ["^Completed \\d"]
40+
keep_lines_matching = ["^(upload|download|copy|move|delete):", "error"]
41+
max_lines = 60
42+
43+
[aws_s3api]
44+
match_command = "^aws\\s+s3api\\b"
45+
strip_ansi = true
46+
strip_lines_matching = ["^\\s*$"]
47+
max_lines = 100
48+
49+
# --- lambda ---
50+
[aws_lambda_list]
51+
match_command = "^aws\\s+lambda\\s+list"
52+
strip_ansi = true
53+
keep_lines_matching = ["FunctionName", "Runtime", "LastModified", "State"]
54+
max_lines = 100
55+
56+
[aws_lambda_get]
57+
match_command = "^aws\\s+lambda\\s+get"
58+
strip_ansi = true
59+
keep_lines_matching = ["FunctionName", "State", "Runtime", "Handler", "Timeout", "MemorySize"]
60+
max_lines = 40
61+
62+
[aws_lambda_invoke]
63+
match_command = "^aws\\s+lambda\\s+invoke"
64+
strip_ansi = true
65+
keep_lines_matching = ["StatusCode", "FunctionError", "ExecutedVersion", "LogResult"]
66+
max_lines = 20
67+
68+
# --- iam ---
69+
[aws_iam]
70+
match_command = "^aws\\s+iam\\b"
71+
strip_ansi = true
72+
strip_lines_matching = ["^\\s*$"]
73+
keep_lines_matching = [
74+
"UserName", "GroupName", "RoleName", "PolicyName",
75+
"Arn", "CreateDate", "AttachedPolicies",
76+
]
77+
max_lines = 100
78+
79+
# --- databases: RDS / DynamoDB ---
80+
[aws_rds]
81+
match_command = "^aws\\s+rds\\b"
82+
strip_ansi = true
83+
keep_lines_matching = [
84+
"DBInstanceIdentifier", "DBInstanceStatus", "Engine",
85+
"Endpoint", "Address", "Port", "AvailabilityZone",
86+
]
87+
max_lines = 80
88+
89+
[aws_dynamodb]
90+
match_command = "^aws\\s+dynamodb\\b"
91+
strip_ansi = true
92+
keep_lines_matching = [
93+
"TableName", "TableStatus", "ItemCount", "TableSizeBytes",
94+
"KeySchema", "AttributeDefinitions", "GlobalSecondaryIndexes",
95+
]
96+
max_lines = 80
97+
98+
# --- containers: ECS / EKS / ECR ---
99+
[aws_ecs]
100+
match_command = "^aws\\s+ecs\\b"
101+
strip_ansi = true
102+
keep_lines_matching = [
103+
"clusterName", "serviceName", "taskArn", "status",
104+
"runningCount", "desiredCount", "pendingCount",
105+
]
106+
max_lines = 80
107+
108+
[aws_eks]
109+
match_command = "^aws\\s+eks\\b"
110+
strip_ansi = true
111+
keep_lines_matching = [
112+
"name\\s*:", "status", "version", "roleArn", "endpoint",
113+
"nodegroupName", "clusterName",
114+
]
115+
max_lines = 60
116+
117+
[aws_ecr]
118+
match_command = "^aws\\s+ecr\\b"
119+
strip_ansi = true
120+
keep_lines_matching = [
121+
"repositoryName", "repositoryUri", "imageTag", "imageDigest",
122+
"registryId",
123+
]
124+
max_lines = 60
125+
126+
# --- infra: CloudFormation / CloudWatch / Logs ---
127+
[aws_cloudformation]
128+
match_command = "^aws\\s+cloudformation\\b"
129+
strip_ansi = true
130+
keep_lines_matching = [
131+
"StackName", "StackStatus", "CREATE_COMPLETE", "CREATE_FAILED",
132+
"UPDATE_COMPLETE", "UPDATE_FAILED", "DELETE_COMPLETE", "ROLLBACK",
133+
"StackId", "LogicalResourceId",
134+
]
135+
max_lines = 100
136+
137+
[aws_cloudwatch]
138+
match_command = "^aws\\s+cloudwatch\\b"
139+
strip_ansi = true
140+
keep_lines_matching = [
141+
"AlarmName", "StateValue", "MetricName", "Namespace",
142+
"Threshold", "ComparisonOperator",
143+
]
144+
max_lines = 80
145+
146+
[aws_logs]
147+
match_command = "^aws\\s+logs\\b"
148+
strip_ansi = true
149+
strip_lines_matching = ["^\\s*$"]
150+
max_lines = 200
151+
152+
# --- networking: VPC / ELB / Route53 ---
153+
[aws_ec2_vpc]
154+
match_command = "^aws\\s+ec2\\s+(describe-vpcs|describe-subnets|describe-security-groups|describe-route-tables)"
155+
strip_ansi = true
156+
keep_lines_matching = [
157+
"VpcId", "SubnetId", "CidrBlock", "GroupId", "GroupName",
158+
"IsDefault", "State", "Tags",
159+
]
160+
max_lines = 120
161+
162+
[aws_elbv2]
163+
match_command = "^aws\\s+elb(v2)?\\b"
164+
strip_ansi = true
165+
keep_lines_matching = [
166+
"LoadBalancerName", "LoadBalancerArn", "DNSName", "State", "Type",
167+
"TargetGroupName", "TargetGroupArn",
168+
]
169+
max_lines = 60
170+
171+
[aws_route53]
172+
match_command = "^aws\\s+route53\\b"
173+
strip_ansi = true
174+
keep_lines_matching = [
175+
"HostedZoneId", "Name", "ResourceRecordSets", "Type",
176+
"TTL", "Value",
177+
]
178+
max_lines = 80
179+
180+
# --- messaging: SNS / SQS ---
181+
[aws_sns]
182+
match_command = "^aws\\s+sns\\b"
183+
strip_ansi = true
184+
keep_lines_matching = ["TopicArn", "SubscriptionArn", "MessageId", "Protocol", "Endpoint"]
185+
max_lines = 60
186+
187+
[aws_sqs]
188+
match_command = "^aws\\s+sqs\\b"
189+
strip_ansi = true
190+
keep_lines_matching = ["QueueUrl", "QueueArn", "ApproximateNumberOfMessages", "MessageId"]
191+
max_lines = 60
192+
193+
# --- secrets & config: SSM / Secrets Manager / KMS ---
194+
[aws_ssm]
195+
match_command = "^aws\\s+ssm\\b"
196+
strip_ansi = true
197+
keep_lines_matching = ["Name", "Value", "Type", "ParameterType", "LastModifiedDate"]
198+
max_lines = 80
199+
200+
[aws_secretsmanager]
201+
match_command = "^aws\\s+secretsmanager\\b"
202+
strip_ansi = true
203+
keep_lines_matching = ["Name", "ARN", "VersionId", "VersionStages", "LastChangedDate"]
204+
max_lines = 40
205+
206+
[aws_kms]
207+
match_command = "^aws\\s+kms\\b"
208+
strip_ansi = true
209+
keep_lines_matching = ["KeyId", "Arn", "KeyState", "Description", "Enabled"]
210+
max_lines = 40
211+
212+
# --- identity ---
213+
[aws_sts]
214+
match_command = "^aws\\s+sts\\b"
215+
strip_ansi = true
216+
keep_lines_matching = ["Account", "Arn", "UserId", "AccessKeyId"]
217+
max_lines = 20
218+
219+
# --- generic fallback (lowest priority — last match wins) ---
220+
[aws_generic]
221+
match_command = "^aws\\s+"
222+
strip_ansi = true
223+
strip_lines_matching = ["^\\s*$"]
224+
max_lines = 150

filters/swift.toml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Swift ecosystem — 6 subcommands matching rtk v0.36.0 coverage.
2+
schema_version = 1
3+
4+
[swift_build]
5+
match_command = "^swift\\s+build\\b"
6+
strip_ansi = true
7+
strip_lines_matching = [
8+
"^\\s*$",
9+
"^Compiling\\s",
10+
"^Fetching\\s",
11+
"^Computing version",
12+
"^Resolving dependencies",
13+
"^Build complete!$",
14+
]
15+
keep_lines_matching = [
16+
"error:",
17+
"warning:",
18+
"^\\w+\\.swift:\\d+:\\d+:",
19+
"Build complete!",
20+
]
21+
max_lines = 150
22+
23+
[swift_test]
24+
match_command = "^swift\\s+test\\b"
25+
strip_ansi = true
26+
strip_lines_matching = [
27+
"^\\s*$",
28+
"^Test Suite '.*' started",
29+
"^Test Case '.*' started",
30+
]
31+
keep_lines_matching = [
32+
"Test Suite '.*' (passed|failed)",
33+
"Test Case '.*' (passed|failed)",
34+
"error:",
35+
"XCTAssert",
36+
"Executed \\d+ tests",
37+
]
38+
max_lines = 150
39+
40+
[swift_run]
41+
match_command = "^swift\\s+run\\b"
42+
strip_ansi = true
43+
strip_lines_matching = [
44+
"^Building for debugging",
45+
"^\\s*$",
46+
]
47+
keep_lines_matching = [
48+
"error:",
49+
"^warning:",
50+
"\\.swift:\\d+:\\d+:",
51+
]
52+
max_lines = 120
53+
54+
[swift_package]
55+
match_command = "^swift\\s+package\\b"
56+
strip_ansi = true
57+
strip_lines_matching = [
58+
"^\\s*$",
59+
"^Fetching\\s",
60+
"^Resolving dependencies",
61+
"^Creating working copy",
62+
]
63+
keep_lines_matching = [
64+
"error:",
65+
"Updating\\s",
66+
"Completed resolution",
67+
"^\\s+[\\w-]+\\s+\\d+\\.\\d+",
68+
]
69+
max_lines = 80
70+
71+
[swift_format]
72+
match_command = "^swift-format\\b|^swift\\s+format\\b"
73+
strip_ansi = true
74+
strip_lines_matching = ["^\\s*$"]
75+
keep_lines_matching = ["\\.swift:\\d+:\\d+:", "error:", "warning:"]
76+
max_lines = 100
77+
78+
[xcodebuild_test]
79+
match_command = "^xcodebuild\\s+.*\\btest\\b"
80+
strip_ansi = true
81+
strip_lines_matching = [
82+
"^Test Suite '.*' started",
83+
"^Test Case '.*' started",
84+
"^Touch\\s",
85+
"^ProcessInfoPlistFile",
86+
"^CpResource",
87+
"^\\s*$",
88+
]
89+
keep_lines_matching = [
90+
"Test Case '.*' (passed|failed)",
91+
"Test Suite '.*' (passed|failed)",
92+
"error:",
93+
"\\*\\* TEST (SUCCEEDED|FAILED) \\*\\*",
94+
"Executed \\d+ tests",
95+
]
96+
max_lines = 150

0 commit comments

Comments
 (0)