iriq 0.2.0 → 0.33.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 +4 -4
- data/CHANGELOG.md +110 -0
- data/README.md +259 -356
- data/completions/_iriq +54 -0
- data/completions/iriq.bash +70 -0
- data/iriq.gemspec +2 -2
- data/lib/iriq/cli.rb +502 -50
- data/lib/iriq/cluster.rb +332 -14
- data/lib/iriq/clusterer.rb +0 -11
- data/lib/iriq/corpus.rb +321 -38
- data/lib/iriq/cross_host_shape.rb +37 -0
- data/lib/iriq/event.rb +22 -0
- data/lib/iriq/evidence.rb +114 -0
- data/lib/iriq/explanation.rb +1 -1
- data/lib/iriq/identifier.rb +1 -1
- data/lib/iriq/normalizer.rb +71 -29
- data/lib/iriq/parser.rb +5 -1
- data/lib/iriq/path_shape.rb +30 -24
- data/lib/iriq/position.rb +75 -0
- data/lib/iriq/position_stats.rb +74 -8
- data/lib/iriq/recognizer.rb +54 -0
- data/lib/iriq/recognizer_proposal.rb +167 -0
- data/lib/iriq/recognizers/date.rb +53 -0
- data/lib/iriq/recognizers/integer.rb +37 -0
- data/lib/iriq/recognizers/uuid.rb +16 -0
- data/lib/iriq/reducer.rb +37 -0
- data/lib/iriq/registrable_domain.rb +56 -0
- data/lib/iriq/segment_classifier.rb +478 -23
- data/lib/iriq/segment_hints.rb +9 -0
- data/lib/iriq/shape.rb +106 -0
- data/lib/iriq/specificity.rb +35 -0
- data/lib/iriq/storage/memory.rb +83 -12
- data/lib/iriq/storage/sqlite.rb +279 -43
- data/lib/iriq/synthesized_recognizer.rb +56 -0
- data/lib/iriq/trace.rb +294 -0
- data/lib/iriq/version.rb +1 -1
- data/lib/iriq.rb +17 -0
- metadata +19 -6
- data/CLAUDE.md +0 -121
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -103
- data/Makefile +0 -56
data/completions/_iriq
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#compdef iriq
|
|
2
|
+
# Zsh completion for the `iriq` CLI.
|
|
3
|
+
#
|
|
4
|
+
# Install (pick one):
|
|
5
|
+
# - Persist via Homebrew: brew install dpep/tools/iriq drops this file
|
|
6
|
+
# into Homebrew's zsh site-functions dir automatically.
|
|
7
|
+
# - Try in the current shell:
|
|
8
|
+
# source <(iriq completion zsh)
|
|
9
|
+
# - Or copy this file into a directory listed in $fpath and run
|
|
10
|
+
# `compinit` (typically run by your zshrc).
|
|
11
|
+
|
|
12
|
+
_iriq() {
|
|
13
|
+
local context state state_descr line
|
|
14
|
+
typeset -A opt_args
|
|
15
|
+
|
|
16
|
+
_arguments -C \
|
|
17
|
+
'(-h --help)'{-h,--help}'[show usage]' \
|
|
18
|
+
'(-V --version)'{-V,--version}'[print version]' \
|
|
19
|
+
'(-p --parse)'{-p,--parse}'[parsed fields section]' \
|
|
20
|
+
'(-n --normalize)'{-n,--normalize}'[normalized section]' \
|
|
21
|
+
'(-c --canonical)'{-c,--canonical}'[canonical form section]' \
|
|
22
|
+
'(-e --explain)'{-e,--explain}'[annotated trace section]' \
|
|
23
|
+
'(-j --json)'{-j,--json}'[JSON output]' \
|
|
24
|
+
'(-J --ndjson)'{-J,--ndjson}'[newline-delimited JSON]' \
|
|
25
|
+
'(-N --no-hints)'{-N,--no-hints}'[use {type} placeholders, not {hint}]' \
|
|
26
|
+
'--hints[enable hint placeholders]' \
|
|
27
|
+
'--no-scheme-less[skip schemeless URL extraction]' \
|
|
28
|
+
'--scheme-less[enable schemeless URL extraction]' \
|
|
29
|
+
'--corpus[load/create a JSON or SQLite corpus]:corpus path:_files -g "*.(json|db|sqlite|sqlite3)"' \
|
|
30
|
+
'(-C --no-corpus)'{-C,--no-corpus}'[disable corpus persistence for this invocation]' \
|
|
31
|
+
'--reset[delete the corpus database and exit]' \
|
|
32
|
+
'--host[host-keying strategy for clustering]:strategy:(full registrable reg none)' \
|
|
33
|
+
'--stats[print rolling aggregates]' \
|
|
34
|
+
'--reinfer[replay the source-IRI log]' \
|
|
35
|
+
'--propose-recognizers[propose new Recognizers from observed shapes]' \
|
|
36
|
+
'--cross-host-shapes[list route shapes seen across multiple hosts]' \
|
|
37
|
+
'--activate-above[auto-activate proposals at or above this confidence]:F:' \
|
|
38
|
+
'--min-observations[proposal threshold]:N:' \
|
|
39
|
+
'--min-coverage[proposal threshold]:F:' \
|
|
40
|
+
'--min-hosts[threshold for proposals and cross-host shapes]:N:' \
|
|
41
|
+
'1:command or file:->first' \
|
|
42
|
+
'*:file:_files' \
|
|
43
|
+
&& return 0
|
|
44
|
+
|
|
45
|
+
case $state in
|
|
46
|
+
first)
|
|
47
|
+
_alternative \
|
|
48
|
+
'commands:command:(cluster completion)' \
|
|
49
|
+
'files:file:_files'
|
|
50
|
+
;;
|
|
51
|
+
esac
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_iriq "$@"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Bash completion for the `iriq` CLI.
|
|
2
|
+
#
|
|
3
|
+
# Install (pick one):
|
|
4
|
+
# - Persist via Homebrew: brew install dpep/tools/iriq automatically
|
|
5
|
+
# drops this script into Homebrew's bash-completion dir.
|
|
6
|
+
# - Try it out in the current shell:
|
|
7
|
+
# source <(iriq completion bash)
|
|
8
|
+
# - Persist to ~/.bashrc:
|
|
9
|
+
# echo 'source <(iriq completion bash)' >> ~/.bashrc
|
|
10
|
+
# - Or write to your system's bash completion dir:
|
|
11
|
+
# iriq completion bash > /usr/local/etc/bash_completion.d/iriq
|
|
12
|
+
|
|
13
|
+
_iriq() {
|
|
14
|
+
local cur prev words cword
|
|
15
|
+
_init_completion 2>/dev/null || {
|
|
16
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
17
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# Argument completion for flags that take a value.
|
|
21
|
+
case "$prev" in
|
|
22
|
+
--corpus)
|
|
23
|
+
# Corpus paths are file-shaped. _filedir picks up *.json / *.db
|
|
24
|
+
# / *.sqlite / *.sqlite3 by default extension; the user can also
|
|
25
|
+
# tab through any path.
|
|
26
|
+
_filedir
|
|
27
|
+
return
|
|
28
|
+
;;
|
|
29
|
+
--host)
|
|
30
|
+
COMPREPLY=( $(compgen -W "full registrable reg none" -- "$cur") )
|
|
31
|
+
return
|
|
32
|
+
;;
|
|
33
|
+
--min-observations|--min-hosts|--min-coverage|--activate-above)
|
|
34
|
+
# Numeric argument — no completion candidates.
|
|
35
|
+
return
|
|
36
|
+
;;
|
|
37
|
+
completion)
|
|
38
|
+
COMPREPLY=( $(compgen -W "bash zsh" -- "$cur") )
|
|
39
|
+
return
|
|
40
|
+
;;
|
|
41
|
+
esac
|
|
42
|
+
|
|
43
|
+
# If the current token starts with `-`, complete flags.
|
|
44
|
+
if [[ "$cur" == -* ]]; then
|
|
45
|
+
local flags="-h --help -V --version -p --parse -n --normalize -c --canonical -e --explain
|
|
46
|
+
-j --json -J --ndjson -N --no-hints --hints --no-scheme-less
|
|
47
|
+
--scheme-less --corpus -C --no-corpus --reset --host --stats --reinfer
|
|
48
|
+
--propose-recognizers --activate-above --cross-host-shapes
|
|
49
|
+
--min-observations --min-coverage --min-hosts"
|
|
50
|
+
COMPREPLY=( $(compgen -W "$flags" -- "$cur") )
|
|
51
|
+
return
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# First non-flag positional may be a subcommand or a file/IRI.
|
|
55
|
+
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
56
|
+
COMPREPLY=( $(compgen -W "cluster completion" -- "$cur") )
|
|
57
|
+
# Also offer files for the auto-extract path (iriq ./access.log).
|
|
58
|
+
local files
|
|
59
|
+
files=$(compgen -f -- "$cur")
|
|
60
|
+
if [[ -n "$files" ]]; then
|
|
61
|
+
COMPREPLY+=( $files )
|
|
62
|
+
fi
|
|
63
|
+
return
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Otherwise fall back to file completion (e.g. `iriq cluster <file>`).
|
|
67
|
+
_filedir
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
complete -F _iriq iriq
|
data/iriq.gemspec
CHANGED
|
@@ -5,14 +5,14 @@ Gem::Specification.new do |s|
|
|
|
5
5
|
s.version = Iriq::VERSION
|
|
6
6
|
s.authors = ["Daniel Pepper"]
|
|
7
7
|
s.description = "IRI extraction, normalization, and clustering."
|
|
8
|
-
s.files = `git ls-files
|
|
8
|
+
s.files = `git ls-files lib exe completions README.md LICENSE.txt CHANGELOG.md iriq.gemspec`.split("\n")
|
|
9
9
|
s.bindir = "exe"
|
|
10
10
|
s.executables = ["iriq"]
|
|
11
11
|
s.homepage = "https://github.com/dpep/iriq"
|
|
12
12
|
s.license = "MIT"
|
|
13
13
|
s.summary = "IRI extraction, normalization, and clustering."
|
|
14
14
|
|
|
15
|
-
s.required_ruby_version = ">= 3.
|
|
15
|
+
s.required_ruby_version = ">= 3.4"
|
|
16
16
|
|
|
17
17
|
s.add_development_dependency 'debug', '>= 1'
|
|
18
18
|
s.add_development_dependency 'rspec', '>= 3.10'
|