why-now-account-briefs 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 +41 -0
- data/bin/why-now +28 -0
- data/lib/why_now.rb +167 -0
- metadata +48 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: bceb6c98c1befb71ce101a6c4884fa5243532ab1395dca8fa588d1bd3d4c8ac8
|
|
4
|
+
data.tar.gz: 812bf6dfe7e43d5dca5ea370731bcc216a8da26fc1ce78c19824f1352fdcc997
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c81407debd395257f0be35eb09c66371cb3ef7bf2bbe1a4d2846b7a743bc601ca2b67d38533c071562c9d692db633bbf7628868ac0834b5781a059565dcc29ee
|
|
7
|
+
data.tar.gz: 47cd2703c49d702ec773674621bc9e69b87c997305321dd5983b906521bceddf4ec0a191c0c4243d715c7b2bf57843ed2fc1d16a0d20adc5e8485e275b80d78a
|
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,41 @@
|
|
|
1
|
+
# why-now-account-briefs
|
|
2
|
+
|
|
3
|
+
A target account list tells you who fits. It does not tell you **why this account, why now**. This Ruby CLI turns a CSV of target
|
|
4
|
+
accounts, each with the timing signal you recorded for it, into one Markdown research brief per account plus an index grouped by
|
|
5
|
+
tier and by the vendor the account uses today. Ruby 3.0+, standard library only.
|
|
6
|
+
|
|
7
|
+
The rule it enforces is the useful part: **an account without a recorded "why now" signal does not get a brief.** It is listed under
|
|
8
|
+
"Skipped" in `INDEX.md` with the reason, and the command exits with 1, so a list with gaps cannot silently move on to outreach.
|
|
9
|
+
Optionally it also skips signals older than N days. The same idea (a timing signal attached to every record, accounts tiered,
|
|
10
|
+
competitor-vendor accounts counted) is described in this write-up of building a
|
|
11
|
+
[large enriched account list with timing signals](https://www.onegtmlab.dev/case-studies/from-zero-outbound-infrastructure-to-20k-enriched-accounts-in-45-days).
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ruby bin/why-now examples/accounts.csv -o briefs
|
|
17
|
+
ruby bin/why-now accounts.csv -t my_template.md --stale-days 60 --require account,why_now,domain
|
|
18
|
+
ruby bin/why-now --print-template > template.md
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
CSV columns (any extra columns can be used in a custom template): `account, domain, tier, current_vendor, why_now, signal_date
|
|
22
|
+
(YYYY-MM-DD), signal_source, personas, notes`. `personas` is a semicolon list, optionally labelled: `A:VP Security;B:Director AppSec`.
|
|
23
|
+
|
|
24
|
+
Template placeholders are `{{field}}` and `{{field|text used when empty}}`; `{{personas_list}}` renders the persona list. Two
|
|
25
|
+
accounts with the same name get `-2`, `-3` file names rather than overwriting each other.
|
|
26
|
+
|
|
27
|
+
Output:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
briefs/
|
|
31
|
+
INDEX.md written/skipped counts, accounts per tier, accounts per current vendor, skipped list with reasons
|
|
32
|
+
northwind-example.md one brief per account
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Test
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
ruby test/why_now_test.rb
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
MIT licensed.
|
data/bin/why-now
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
|
4
|
+
require 'optparse'
|
|
5
|
+
require 'why_now'
|
|
6
|
+
|
|
7
|
+
opts = { out: 'briefs', require: %w[account why_now], template: nil, stale: nil, today: Date.today }
|
|
8
|
+
OptionParser.new do |o|
|
|
9
|
+
o.banner = 'Usage: why-now ACCOUNTS.csv [options]'
|
|
10
|
+
o.on('-o', '--out DIR', 'output folder (default briefs)') { |v| opts[:out] = v }
|
|
11
|
+
o.on('-t', '--template FILE', 'Markdown template with {{field}} and {{field|default}}') { |v| opts[:template] = v }
|
|
12
|
+
o.on('--require A,B', Array, 'columns that must be filled (default account,why_now)') { |v| opts[:require] = v }
|
|
13
|
+
o.on('--stale-days N', Integer, 'skip accounts whose signal_date is older than N days') { |v| opts[:stale] = v }
|
|
14
|
+
o.on('--today DATE', 'reference date YYYY-MM-DD (default today)') { |v| opts[:today] = Date.iso8601(v) }
|
|
15
|
+
o.on('--print-template', 'print the built-in template and exit') { puts WhyNow::DEFAULT_TEMPLATE; exit }
|
|
16
|
+
end.parse!
|
|
17
|
+
|
|
18
|
+
file = ARGV.shift or abort('accounts CSV required (see --help)')
|
|
19
|
+
begin
|
|
20
|
+
recs = WhyNow.parse_csv(File.read(file))
|
|
21
|
+
tpl = opts[:template] ? File.read(opts[:template]) : WhyNow::DEFAULT_TEMPLATE
|
|
22
|
+
res = WhyNow.build(recs, outdir: opts[:out], template: tpl, required: opts[:require], stale_days: opts[:stale], today: opts[:today])
|
|
23
|
+
rescue WhyNow::Error, Errno::ENOENT => e
|
|
24
|
+
abort "error: #{e.message}"
|
|
25
|
+
end
|
|
26
|
+
puts "#{res[:written]} briefs written to #{opts[:out]}/, #{res[:skipped].size} skipped"
|
|
27
|
+
res[:skipped].each { |a, p| puts " skipped #{a}: #{p.join('; ')}" }
|
|
28
|
+
exit(res[:skipped].empty? ? 0 : 1)
|
data/lib/why_now.rb
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'date'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
# Builds one Markdown research brief per target account from a CSV and a template.
|
|
6
|
+
module WhyNow
|
|
7
|
+
class Error < StandardError; end
|
|
8
|
+
|
|
9
|
+
DEFAULT_TEMPLATE = <<~MD
|
|
10
|
+
# {{account}}
|
|
11
|
+
|
|
12
|
+
- Domain: {{domain|not recorded}}
|
|
13
|
+
- Tier: {{tier|unassigned}}
|
|
14
|
+
- Using today: {{current_vendor|not recorded}}
|
|
15
|
+
|
|
16
|
+
## Why now
|
|
17
|
+
|
|
18
|
+
{{why_now|MISSING: no timing signal recorded. Do not contact on fit alone.}}
|
|
19
|
+
|
|
20
|
+
Signal date: {{signal_date|not recorded}}. Source: {{signal_source|not recorded}}.
|
|
21
|
+
|
|
22
|
+
## People to reach
|
|
23
|
+
|
|
24
|
+
{{personas_list}}
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
|
|
28
|
+
{{notes|none}}
|
|
29
|
+
MD
|
|
30
|
+
|
|
31
|
+
# Minimal RFC 4180 CSV parser (quotes, doubled quotes, embedded newlines).
|
|
32
|
+
def self.parse_csv(text)
|
|
33
|
+
rows = []
|
|
34
|
+
row = []
|
|
35
|
+
field = +''
|
|
36
|
+
quoted = false
|
|
37
|
+
i = 0
|
|
38
|
+
text = text.sub(/\A/, '')
|
|
39
|
+
while i < text.length
|
|
40
|
+
c = text[i]
|
|
41
|
+
if quoted
|
|
42
|
+
if c == '"'
|
|
43
|
+
if text[i + 1] == '"'
|
|
44
|
+
field << '"'
|
|
45
|
+
i += 1
|
|
46
|
+
else
|
|
47
|
+
quoted = false
|
|
48
|
+
end
|
|
49
|
+
else
|
|
50
|
+
field << c
|
|
51
|
+
end
|
|
52
|
+
elsif c == '"'
|
|
53
|
+
quoted = true
|
|
54
|
+
elsif c == ','
|
|
55
|
+
row << field
|
|
56
|
+
field = +''
|
|
57
|
+
elsif c == "\n" || c == "\r"
|
|
58
|
+
i += 1 if c == "\r" && text[i + 1] == "\n"
|
|
59
|
+
row << field
|
|
60
|
+
rows << row unless row.all?(&:empty?)
|
|
61
|
+
row = []
|
|
62
|
+
field = +''
|
|
63
|
+
else
|
|
64
|
+
field << c
|
|
65
|
+
end
|
|
66
|
+
i += 1
|
|
67
|
+
end
|
|
68
|
+
unless field.empty? && row.empty?
|
|
69
|
+
row << field
|
|
70
|
+
rows << row
|
|
71
|
+
end
|
|
72
|
+
raise Error, 'CSV is empty' if rows.empty?
|
|
73
|
+
header = rows.shift.map(&:strip)
|
|
74
|
+
rows.map { |r| header.zip(r.map { |v| v.to_s.strip }).to_h }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def self.slug(s)
|
|
78
|
+
out = s.to_s.downcase.gsub(/[^a-z0-9]+/, '-').gsub(/\A-|-\z/, '')
|
|
79
|
+
out.empty? ? 'account' : out
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# "A:VP Security;B:Director AppSec" -> list items. Plain "VP Security;Director" also works.
|
|
83
|
+
def self.personas_list(raw)
|
|
84
|
+
items = raw.to_s.split(';').map(&:strip).reject(&:empty?)
|
|
85
|
+
return '_none recorded_' if items.empty?
|
|
86
|
+
items.map do |it|
|
|
87
|
+
tier, role = it.split(':', 2)
|
|
88
|
+
role ? "- Persona #{tier.strip}: #{role.strip}" : "- #{it}"
|
|
89
|
+
end.join("\n")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def self.render(template, rec)
|
|
93
|
+
vals = rec.merge('personas_list' => personas_list(rec['personas']))
|
|
94
|
+
template.gsub(/\{\{\s*([a-z_0-9]+)(?:\|([^}]*))?\s*\}\}/i) do
|
|
95
|
+
v = vals[$1].to_s.strip
|
|
96
|
+
v.empty? ? ($2 || '').strip : v
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Returns problems for one record. +required+ is a list of column names that must be non-empty.
|
|
101
|
+
def self.problems(rec, required:, stale_days: nil, today: Date.today)
|
|
102
|
+
out = required.select { |k| rec[k].to_s.strip.empty? }.map { |k| "missing #{k}" }
|
|
103
|
+
if stale_days && !rec['signal_date'].to_s.empty?
|
|
104
|
+
begin
|
|
105
|
+
age = (today - Date.iso8601(rec['signal_date'])).to_i
|
|
106
|
+
out << "signal is #{age} days old (limit #{stale_days})" if age > stale_days
|
|
107
|
+
out << 'signal date is in the future' if age < 0
|
|
108
|
+
rescue ArgumentError
|
|
109
|
+
out << "signal_date #{rec['signal_date'].inspect} is not YYYY-MM-DD"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
out
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Writes briefs + INDEX.md into +outdir+. Returns a result hash.
|
|
116
|
+
def self.build(records, outdir:, template: DEFAULT_TEMPLATE, required: %w[account why_now], stale_days: nil, today: Date.today)
|
|
117
|
+
FileUtils.mkdir_p(outdir)
|
|
118
|
+
used = {}
|
|
119
|
+
written = []
|
|
120
|
+
skipped = []
|
|
121
|
+
records.each do |rec|
|
|
122
|
+
probs = problems(rec, required: required, stale_days: stale_days, today: today)
|
|
123
|
+
if rec['account'].to_s.empty?
|
|
124
|
+
skipped << ['(no account name)', probs]
|
|
125
|
+
next
|
|
126
|
+
end
|
|
127
|
+
unless probs.empty?
|
|
128
|
+
skipped << [rec['account'], probs]
|
|
129
|
+
next
|
|
130
|
+
end
|
|
131
|
+
base = slug(rec['account'])
|
|
132
|
+
name = base
|
|
133
|
+
n = 2
|
|
134
|
+
while used[name]
|
|
135
|
+
name = "#{base}-#{n}"
|
|
136
|
+
n += 1
|
|
137
|
+
end
|
|
138
|
+
used[name] = true
|
|
139
|
+
File.write(File.join(outdir, "#{name}.md"), render(template, rec))
|
|
140
|
+
written << [name, rec]
|
|
141
|
+
end
|
|
142
|
+
File.write(File.join(outdir, 'INDEX.md'), index(written, skipped))
|
|
143
|
+
{ written: written.size, skipped: skipped }
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def self.index(written, skipped)
|
|
147
|
+
lines = ["# Account briefs", '', "#{written.size} written, #{skipped.size} skipped.", '']
|
|
148
|
+
by_tier = written.group_by { |_, r| r['tier'].to_s.empty? ? 'unassigned' : r['tier'] }
|
|
149
|
+
by_tier.keys.sort.each do |t|
|
|
150
|
+
lines << "## Tier: #{t}" << ''
|
|
151
|
+
by_tier[t].each { |name, r| lines << "- [#{r['account']}](#{name}.md)" + (r['current_vendor'].to_s.empty? ? '' : " (using #{r['current_vendor']})") }
|
|
152
|
+
lines << ''
|
|
153
|
+
end
|
|
154
|
+
vendors = written.map { |_, r| r['current_vendor'].to_s }.reject(&:empty?).tally
|
|
155
|
+
unless vendors.empty?
|
|
156
|
+
lines << '## Accounts per current vendor' << ''
|
|
157
|
+
vendors.sort_by { |v, c| [-c, v] }.each { |v, c| lines << "- #{v}: #{c}" }
|
|
158
|
+
lines << ''
|
|
159
|
+
end
|
|
160
|
+
unless skipped.empty?
|
|
161
|
+
lines << '## Skipped' << ''
|
|
162
|
+
skipped.each { |a, p| lines << "- #{a}: #{p.join('; ')}" }
|
|
163
|
+
lines << ''
|
|
164
|
+
end
|
|
165
|
+
lines.join("\n")
|
|
166
|
+
end
|
|
167
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: why-now-account-briefs
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jainendra Ojha
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: "Ruby CLI that turns a target-account CSV with timing signals into one Markdown brief per account plus a tier and vendor index. Accounts without a why-now signal are skipped, not guessed."
|
|
13
|
+
email:
|
|
14
|
+
- account@onegtmlab.dev
|
|
15
|
+
executables:
|
|
16
|
+
- why-now
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- LICENSE
|
|
21
|
+
- README.md
|
|
22
|
+
- bin/why-now
|
|
23
|
+
- lib/why_now.rb
|
|
24
|
+
homepage: "https://www.onegtmlab.dev/case-studies/from-zero-outbound-infrastructure-to-20k-enriched-accounts-in-45-days"
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata:
|
|
28
|
+
source_code_uri: "https://github.com/jaizendra-netizen/why-now-account-briefs"
|
|
29
|
+
rdoc_options: []
|
|
30
|
+
require_paths:
|
|
31
|
+
- lib
|
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
-
|
|
35
|
+
- ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: "2.7"
|
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
-
|
|
41
|
+
- ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "0"
|
|
44
|
+
requirements: []
|
|
45
|
+
rubygems_version: 4.1.0
|
|
46
|
+
specification_version: 4
|
|
47
|
+
summary: Ruby CLI that turns a target-account CSV with timing signals into one Markdown brief per account plus a tier and vendor index. Accounts with
|
|
48
|
+
test_files: []
|