stalled-deal-finder 1.0.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 +7 -0
- data/LICENSE +22 -0
- data/README.md +44 -0
- data/bin/stalled-deal-finder +30 -0
- data/lib/stalled_deal_finder.rb +60 -0
- metadata +66 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 1aa5bea5b2e092f2229ac600e064725f4a67c80f661bd2f2bb4f6bec8c4d5917
|
|
4
|
+
data.tar.gz: 20031a282997779924e4b82e78343abc514a831e0b73010d0afe0fca972cf888
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 324c369bb2dd00c284d3bf17bf9b415299f27e58bcf3d1a7f8c6ca8d33c7123a23a93c51f5cad20664a718e523dd5612791011da1d477890cced2d74b23456d2
|
|
7
|
+
data.tar.gz: 78604fa6b1618c763bbf85b816eda2011c1d41bd6ff54a1e9fc3547de2748fa89eb4463bc4e14ef2b35fde4dbb729ae767d39995b425ddbc49d25f53278d50cc
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OneGTMLab
|
|
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.
|
|
22
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# stalled-deal-finder
|
|
2
|
+
|
|
3
|
+
A small Ruby command-line tool and library that finds the deals stuck in your [sales pipeline](https://www.onegtmlab.dev/glossary/sales-pipeline).
|
|
4
|
+
Give it a deals CSV with the date each deal entered its current stage and a day limit per stage; it lists every deal that has been in its stage longer than
|
|
5
|
+
the limit, biggest first, and shows how much of the pipeline value sits in stalled deals. Offline and deterministic.
|
|
6
|
+
Built by [OneGTMLab](https://www.onegtmlab.dev/glossary/sales-pipeline) (GTM engineering for B2B teams).
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
gem install stalled-deal-finder
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Use
|
|
15
|
+
|
|
16
|
+
```csv
|
|
17
|
+
deal,stage,amount,stage_entered
|
|
18
|
+
Acme,discovery,20000,2026-10-01
|
|
19
|
+
Beta,proposal,"50,000",2026-11-10
|
|
20
|
+
Cobalt,proposal,30000,2026-10-20
|
|
21
|
+
Delta,commit,10000,2026-11-20
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
stalled-deal-finder deals.csv --as-of 2026-11-28 --limits discovery=14,proposal=21
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
deal stage amount days limit
|
|
30
|
+
Cobalt proposal 30000 39 21
|
|
31
|
+
Acme discovery 20000 58 14
|
|
32
|
+
2 of 4 deals stalled, 50000 of 110000 in stalled deals (45.5%)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
A stage without a limit uses `--default-days` (30). A deal exactly at its limit is not stalled; one day over is. `--as-of` defaults to today. A missing column, a
|
|
36
|
+
date that is not `YYYY-MM-DD` or a bad option stops with `error: ...` and exit code 1; no arguments prints usage and exits 2.
|
|
37
|
+
|
|
38
|
+
## Test
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
ruby test/run.rb
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
MIT licence.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative '../lib/stalled_deal_finder'
|
|
5
|
+
|
|
6
|
+
args = ARGV.dup
|
|
7
|
+
if args.empty? || args.include?('-h') || args.include?('--help')
|
|
8
|
+
warn "usage: stalled-deal-finder deals.csv [--as-of 2026-11-28] [--limits discovery=14,proposal=21] [--default-days 30]\n" \
|
|
9
|
+
"CSV columns: deal, stage, amount, stage_entered (YYYY-MM-DD). More: https://www.onegtmlab.dev/glossary/sales-pipeline"
|
|
10
|
+
exit 2
|
|
11
|
+
end
|
|
12
|
+
file = args.shift
|
|
13
|
+
as_of = Date.today
|
|
14
|
+
limits = {}
|
|
15
|
+
default = StalledDealFinder::DEFAULT_LIMIT
|
|
16
|
+
begin
|
|
17
|
+
until args.empty?
|
|
18
|
+
flag = args.shift
|
|
19
|
+
val = args.shift or abort "#{flag} needs a value"
|
|
20
|
+
case flag
|
|
21
|
+
when '--as-of' then as_of = Date.iso8601(val)
|
|
22
|
+
when '--limits' then limits = StalledDealFinder.parse_limits(val)
|
|
23
|
+
when '--default-days' then default = Integer(val)
|
|
24
|
+
else abort "unknown option #{flag}"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
print StalledDealFinder.render(StalledDealFinder.from_csv(File.read(file), as_of, limits, default: default))
|
|
28
|
+
rescue ArgumentError, Date::Error, Errno::ENOENT => e
|
|
29
|
+
abort "error: #{e.message}"
|
|
30
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'csv'
|
|
4
|
+
require 'date'
|
|
5
|
+
|
|
6
|
+
# Finds open deals that have sat in their current stage longer than that stage allows.
|
|
7
|
+
module StalledDealFinder
|
|
8
|
+
Deal = Struct.new(:name, :stage, :amount, :entered, :days, :limit, keyword_init: true)
|
|
9
|
+
|
|
10
|
+
DEFAULT_LIMIT = 30
|
|
11
|
+
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
# "discovery=14,proposal=21" -> { 'discovery' => 14, 'proposal' => 21 }
|
|
15
|
+
def parse_limits(text)
|
|
16
|
+
text.to_s.split(',').to_h do |pair|
|
|
17
|
+
k, v = pair.split('=', 2)
|
|
18
|
+
raise ArgumentError, "bad limit #{pair.inspect}, use stage=days" if v.nil?
|
|
19
|
+
|
|
20
|
+
[k.strip.downcase, Integer(v)]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def number(value)
|
|
25
|
+
Float(value.to_s.delete(',_ '))
|
|
26
|
+
rescue ArgumentError
|
|
27
|
+
0.0
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def from_csv(text, as_of, limits = {}, default: DEFAULT_LIMIT)
|
|
31
|
+
table = CSV.parse(text, headers: true, header_converters: ->(h) { h.to_s.strip.downcase })
|
|
32
|
+
%w[deal stage stage_entered].each { |c| raise ArgumentError, "missing column #{c}" unless table.headers.include?(c) }
|
|
33
|
+
table.map do |row|
|
|
34
|
+
begin
|
|
35
|
+
entered = Date.iso8601(row['stage_entered'].to_s.strip)
|
|
36
|
+
rescue Date::Error
|
|
37
|
+
raise ArgumentError, "bad date #{row['stage_entered'].inspect} for #{row['deal']}, use YYYY-MM-DD"
|
|
38
|
+
end
|
|
39
|
+
stage = row['stage'].to_s.strip.downcase
|
|
40
|
+
Deal.new(name: row['deal'].to_s.strip, stage: stage, amount: number(row['amount']), entered: entered,
|
|
41
|
+
days: (as_of - entered).to_i, limit: limits.fetch(stage, default))
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def stalled(deals)
|
|
46
|
+
deals.select { |d| d.days > d.limit }.sort_by { |d| [-d.amount, -d.days] }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def render(deals)
|
|
50
|
+
s = stalled(deals)
|
|
51
|
+
out = +''
|
|
52
|
+
out << format("%-14s %-10s %10s %6s %6s\n", 'deal', 'stage', 'amount', 'days', 'limit') unless s.empty?
|
|
53
|
+
s.each { |d| out << format("%-14s %-10s %10.0f %6d %6d\n", d.name, d.stage, d.amount, d.days, d.limit) }
|
|
54
|
+
total = deals.sum(&:amount)
|
|
55
|
+
risk = s.sum(&:amount)
|
|
56
|
+
out << "#{s.size} of #{deals.size} deals stalled, #{risk.round} of #{total.round} in stalled deals"
|
|
57
|
+
out << format(' (%.1f%%)', total.zero? ? 0 : 100 * risk / total)
|
|
58
|
+
out << "\n"
|
|
59
|
+
end
|
|
60
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: stalled-deal-finder
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- OneGTMLab
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: csv
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: "0"
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
-
|
|
25
|
+
- ">="
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: "0"
|
|
28
|
+
description: "Ruby CLI and library: from a deals CSV with the date each deal entered its stage, list the deals older than your per-stage day limits, biggest first, with the amount sitting in stalled deals. Offline."
|
|
29
|
+
email:
|
|
30
|
+
- account@onegtmlab.dev
|
|
31
|
+
executables:
|
|
32
|
+
- stalled-deal-finder
|
|
33
|
+
extensions: []
|
|
34
|
+
extra_rdoc_files: []
|
|
35
|
+
files:
|
|
36
|
+
- LICENSE
|
|
37
|
+
- README.md
|
|
38
|
+
- bin/stalled-deal-finder
|
|
39
|
+
- lib/stalled_deal_finder.rb
|
|
40
|
+
homepage: "https://www.onegtmlab.dev/glossary/sales-pipeline"
|
|
41
|
+
licenses:
|
|
42
|
+
- MIT
|
|
43
|
+
metadata:
|
|
44
|
+
homepage_uri: "https://www.onegtmlab.dev/glossary/sales-pipeline"
|
|
45
|
+
source_code_uri: "https://github.com/jaizendra-netizen/stalled-deal-finder"
|
|
46
|
+
documentation_uri: "https://www.onegtmlab.dev/glossary/sales-pipeline"
|
|
47
|
+
rdoc_options: []
|
|
48
|
+
require_paths:
|
|
49
|
+
- lib
|
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
-
|
|
53
|
+
- ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: "2.7"
|
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
-
|
|
59
|
+
- ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: "0"
|
|
62
|
+
requirements: []
|
|
63
|
+
rubygems_version: 4.1.0
|
|
64
|
+
specification_version: 4
|
|
65
|
+
summary: List open deals that sat in a pipeline stage longer than that stage allows
|
|
66
|
+
test_files: []
|