spreen-wiki 0.1.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.txt +21 -0
- data/README.md +114 -0
- data/exe/spreen +6 -0
- data/lib/spreen/wiki/application.rb +151 -0
- data/lib/spreen/wiki/cli.rb +159 -0
- data/lib/spreen/wiki/configuration.rb +217 -0
- data/lib/spreen/wiki/home.rb +102 -0
- data/lib/spreen/wiki/sidebar.rb +50 -0
- data/lib/spreen/wiki/templates/category/english.md +8 -0
- data/lib/spreen/wiki/templates/category/japanese.md +8 -0
- data/lib/spreen/wiki/templates/owner/english.md +8 -0
- data/lib/spreen/wiki/templates/owner/japanese.md +8 -0
- data/lib/spreen/wiki/unknown_wiki_count_list_exporter.rb +61 -0
- data/lib/spreen/wiki/unknown_wiki_list_exporter_for_llm.rb +53 -0
- data/lib/spreen/wiki/version.rb +8 -0
- data/lib/spreen/wiki.rb +20 -0
- data/lib/spreen-wiki.rb +6 -0
- data/sig/generated/spreen/wiki/application.rbs +93 -0
- data/sig/generated/spreen/wiki/cli.rbs +70 -0
- data/sig/generated/spreen/wiki/configuration.rbs +150 -0
- data/sig/generated/spreen/wiki/home.rbs +54 -0
- data/sig/generated/spreen/wiki/sidebar.rbs +31 -0
- data/sig/generated/spreen/wiki/unknown_wiki_count_list_exporter.rbs +40 -0
- data/sig/generated/spreen/wiki/unknown_wiki_list_exporter_for_llm.rbs +37 -0
- data/sig/generated/spreen/wiki/version.rbs +7 -0
- data/sig/generated/spreen/wiki.rbs +10 -0
- data/sig/generated/spreen-wiki.rbs +2 -0
- data/sig/generated/test/application_test.rbs +30 -0
- data/sig/generated/test/configuration_test.rbs +38 -0
- data/sig/generated/test/home_test.rbs +60 -0
- data/sig/generated/test/sidebar_test.rbs +42 -0
- data/sig/generated/test/unknown_wiki_count_list_exporter_test.rbs +161 -0
- data/sig/generated/test/unknown_wiki_list_exporter_for_llm_test.rbs +53 -0
- metadata +80 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require_relative 'application'
|
|
6
|
+
|
|
7
|
+
module Spreen
|
|
8
|
+
module Wiki
|
|
9
|
+
# Generates the wiki Home page, optionally splitting per-owner content out
|
|
10
|
+
# into `wikis-by-owner/<owner>.md` when home_overflow is enabled. Returns
|
|
11
|
+
# the configured wiki URL (if any) so callers can point at the result.
|
|
12
|
+
class Home < Application
|
|
13
|
+
# @rbs return: String?
|
|
14
|
+
def run
|
|
15
|
+
home_overflow ? write_concise_home_passage : write_home_passage
|
|
16
|
+
config.wiki_url
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
# @rbs return: String
|
|
22
|
+
def path_to_wikis_by_owner
|
|
23
|
+
@path_to_wikis_by_owner ||= File.join(base_path, 'wikis-by-owner')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @rbs return: String
|
|
27
|
+
def path_to_home_template
|
|
28
|
+
path = config.path_to_template(group_by, language)
|
|
29
|
+
unless File.exist?(path)
|
|
30
|
+
raise ArgumentError, "Missing Home template: `#{path}`. Ship one there or configure template_dir."
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
path
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @rbs return: Array[String]
|
|
37
|
+
def home_passage
|
|
38
|
+
@home_passage ||= File.readlines(path_to_home_template).append("\n")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @rbs return: void
|
|
42
|
+
def write_home_passage
|
|
43
|
+
FileUtils.rm_rf(path_to_wikis_by_owner)
|
|
44
|
+
owned_wiki_maps.each { |namespace, wikis| append_block(home_passage, namespace, wikis, owned: true) }
|
|
45
|
+
plain_wiki_maps.each { |namespace, wikis| append_block(home_passage, namespace, wikis, owned: false) }
|
|
46
|
+
File.write(path_to_home, home_passage.join.chomp)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# @rbs return: void
|
|
50
|
+
def write_concise_home_passage
|
|
51
|
+
FileUtils.mkdir_p(path_to_wikis_by_owner)
|
|
52
|
+
write_per_namespace_files
|
|
53
|
+
write_home_table_of_contents
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @rbs return: void
|
|
57
|
+
def write_per_namespace_files
|
|
58
|
+
owned_wiki_maps.each { |namespace, wikis| write_overflow_block(namespace, wikis, owned: true) }
|
|
59
|
+
plain_wiki_maps.each { |namespace, wikis| write_overflow_block(namespace, wikis, owned: false) }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# @rbs return: void
|
|
63
|
+
def write_home_table_of_contents
|
|
64
|
+
(owned_wiki_maps.keys + plain_wiki_maps.keys).each { |namespace| home_passage << "- [[#{namespace}]]\n" }
|
|
65
|
+
home_passage << "\n"
|
|
66
|
+
File.write(path_to_home, home_passage.join.chomp)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @rbs passage: Array[String]
|
|
70
|
+
# @rbs namespace: String
|
|
71
|
+
# @rbs wikis: Array[String]
|
|
72
|
+
# @rbs owned: bool
|
|
73
|
+
# @rbs return: void
|
|
74
|
+
def append_block(passage, namespace, wikis, owned:)
|
|
75
|
+
passage << "#{heading_for(namespace, owned:)}\n"
|
|
76
|
+
passage << "\n"
|
|
77
|
+
wikis.each { |wiki| passage << "- [[#{wiki.gsub('.md', '')}]]\n" }
|
|
78
|
+
passage << "\n"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @rbs namespace: String
|
|
82
|
+
# @rbs wikis: Array[String]
|
|
83
|
+
# @rbs owned: bool
|
|
84
|
+
# @rbs return: void
|
|
85
|
+
def write_overflow_block(namespace, wikis, owned:)
|
|
86
|
+
scratch = [] #: Array[String]
|
|
87
|
+
append_block(scratch, namespace, wikis, owned:)
|
|
88
|
+
File.write(File.join(path_to_wikis_by_owner, "#{namespace}.md"), scratch.join.chomp)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# @rbs namespace: String
|
|
92
|
+
# @rbs owned: bool
|
|
93
|
+
# @rbs return: String
|
|
94
|
+
def heading_for(namespace, owned:)
|
|
95
|
+
owner_base_url = config.owner_base_url
|
|
96
|
+
return "## #{namespace}" unless owned && owner_base_url
|
|
97
|
+
|
|
98
|
+
"## [#{namespace}](#{owner_base_url + namespace.delete('@')})"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
require_relative 'application'
|
|
5
|
+
|
|
6
|
+
module Spreen
|
|
7
|
+
module Wiki
|
|
8
|
+
# Generates the wiki _Sidebar.md as a nested list of owners/categories and
|
|
9
|
+
# their wiki pages.
|
|
10
|
+
class Sidebar < Application
|
|
11
|
+
# @rbs return: void
|
|
12
|
+
def run
|
|
13
|
+
update_wiki_list
|
|
14
|
+
File.write(path_to_sidebar, wiki_list.join)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
# @rbs return: Array[String]
|
|
20
|
+
def wiki_list
|
|
21
|
+
@wiki_list ||= []
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @rbs return: void
|
|
25
|
+
def update_wiki_list
|
|
26
|
+
owned_wiki_maps.each { |namespace, wikis| append_section(namespace, wikis, owned: true) }
|
|
27
|
+
plain_wiki_maps.each { |namespace, wikis| append_section(namespace, wikis, owned: false) }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @rbs namespace: String
|
|
31
|
+
# @rbs wikis: Array[String]
|
|
32
|
+
# @rbs owned: bool
|
|
33
|
+
# @rbs return: void
|
|
34
|
+
def append_section(namespace, wikis, owned:)
|
|
35
|
+
wiki_list << "#{section_heading(namespace, owned:)}\n"
|
|
36
|
+
wikis.each { |wiki| wiki_list << " - [[#{wiki.gsub('.md', '')}]]\n" }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @rbs namespace: String
|
|
40
|
+
# @rbs owned: bool
|
|
41
|
+
# @rbs return: String
|
|
42
|
+
def section_heading(namespace, owned:)
|
|
43
|
+
owner_base_url = config.owner_base_url
|
|
44
|
+
return "- #{namespace}" unless owned && owner_base_url
|
|
45
|
+
|
|
46
|
+
"- [#{namespace}](#{owner_base_url + namespace.delete('@')})"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## How to Manage Wiki Pages
|
|
2
|
+
|
|
3
|
+
This Home page manage wikis by category group.
|
|
4
|
+
|
|
5
|
+
Absence of category declaration worsens maintainability and searchability.
|
|
6
|
+
Kindly make sure to articulate `Category: CATEGORY_NAME` of the top of each of your wiki page to avoid it.
|
|
7
|
+
|
|
8
|
+
Also, please keep in mind that you do not have to edit Home and Sidebar by yourself, which are automatically updated by a GitHub Actions cron job.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## How to Manage Wiki Pages
|
|
2
|
+
|
|
3
|
+
This Home page manage wikis by owner group.
|
|
4
|
+
|
|
5
|
+
Absence of ownership declaration worsens maintainability and searchability because it makes ambiguous which team the responsibility belongs to.
|
|
6
|
+
Kindly make sure to articulate `Owner: @OWNER_TEAM` of the top of each of your wiki page to avoid it.
|
|
7
|
+
|
|
8
|
+
Also, please keep in mind that you do not have to edit Home and Sidebar by yourself, which are automatically updated by a GitHub Actions cron job.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
require_relative 'application'
|
|
5
|
+
|
|
6
|
+
module Spreen
|
|
7
|
+
module Wiki
|
|
8
|
+
# Writes a sorted text report of how many wikis exist under each of the
|
|
9
|
+
# configured "unknown owner/category" namespaces.
|
|
10
|
+
class UnknownWikiCountListExporter < Application
|
|
11
|
+
DEFAULT_OUTPUT_FILENAME = 'unknown_wiki_count_list_by_namespace.txt'
|
|
12
|
+
|
|
13
|
+
# @rbs base_path: String
|
|
14
|
+
# @rbs group_by: String
|
|
15
|
+
# @rbs language: String
|
|
16
|
+
# @rbs home_overflow: (bool | String)
|
|
17
|
+
# @rbs output: String?
|
|
18
|
+
# @rbs **options: untyped
|
|
19
|
+
# @rbs return: void
|
|
20
|
+
def initialize(base_path: Dir.pwd, group_by: 'Owner', language: 'English', home_overflow: 'false',
|
|
21
|
+
output: nil, **)
|
|
22
|
+
super(base_path:, group_by:, language:, home_overflow:, **)
|
|
23
|
+
@path_to_export = resolve_output_path(output || DEFAULT_OUTPUT_FILENAME)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @rbs return: [Array[String], String]
|
|
27
|
+
def run
|
|
28
|
+
File.open(path_to_export, 'wb') { |f| f.puts(count_list_by_namespace) }
|
|
29
|
+
[count_list_by_namespace, path_to_export]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
attr_reader :path_to_export #: String
|
|
35
|
+
|
|
36
|
+
# @rbs filename: String
|
|
37
|
+
# @rbs return: String
|
|
38
|
+
def resolve_output_path(filename)
|
|
39
|
+
File.absolute_path?(filename) ? filename : File.join(base_path, filename)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @rbs return: Array[String]
|
|
43
|
+
def namespace_list
|
|
44
|
+
config.unknown_namespaces(group_by, language)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# @rbs return: Array[String]
|
|
48
|
+
def missing_count_list_by_namespace
|
|
49
|
+
(namespace_list - plain_wiki_maps.keys).map { |namespace| "#{namespace}: 0" }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @rbs return: Array[String]
|
|
53
|
+
def count_list_by_namespace
|
|
54
|
+
@count_list_by_namespace ||= begin
|
|
55
|
+
counts = plain_wiki_maps.slice(*namespace_list).map { |namespace, wikis| "#{namespace}: #{wikis.length}" }
|
|
56
|
+
(counts + missing_count_list_by_namespace).sort
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
require_relative 'application'
|
|
5
|
+
|
|
6
|
+
module Spreen
|
|
7
|
+
module Wiki
|
|
8
|
+
# Writes a flat list of the wikis under the configured "unknown
|
|
9
|
+
# owner/category" namespace in a form suitable for feeding to an LLM.
|
|
10
|
+
class UnknownWikiListExporterForLLM < Application
|
|
11
|
+
DEFAULT_OUTPUT_FILENAME = 'unknown_wiki_list_for_llm.txt'
|
|
12
|
+
|
|
13
|
+
# @rbs base_path: String
|
|
14
|
+
# @rbs group_by: String
|
|
15
|
+
# @rbs language: String
|
|
16
|
+
# @rbs home_overflow: (bool | String)
|
|
17
|
+
# @rbs output: String?
|
|
18
|
+
# @rbs **options: untyped
|
|
19
|
+
# @rbs return: void
|
|
20
|
+
def initialize(base_path: Dir.pwd, group_by: 'Owner', language: 'English', home_overflow: 'false',
|
|
21
|
+
output: nil, **)
|
|
22
|
+
super(base_path:, group_by:, language:, home_overflow:, **)
|
|
23
|
+
@path_to_export = resolve_output_path(output || DEFAULT_OUTPUT_FILENAME)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @rbs return: String
|
|
27
|
+
def run
|
|
28
|
+
File.open(path_to_export, 'wb') { |f| f.puts(unknown_wiki_list_for_llm) }
|
|
29
|
+
path_to_export
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
attr_reader :path_to_export #: String
|
|
35
|
+
|
|
36
|
+
# @rbs filename: String
|
|
37
|
+
# @rbs return: String
|
|
38
|
+
def resolve_output_path(filename)
|
|
39
|
+
File.absolute_path?(filename) ? filename : File.join(base_path, filename)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @rbs return: String
|
|
43
|
+
def target_namespace
|
|
44
|
+
config.llm_target_namespace(group_by, language)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# @rbs return: Array[String]
|
|
48
|
+
def unknown_wiki_list_for_llm
|
|
49
|
+
@unknown_wiki_list_for_llm ||= plain_wiki_maps.slice(target_namespace).values.flatten
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
data/lib/spreen/wiki.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
require_relative 'wiki/version'
|
|
5
|
+
require_relative 'wiki/configuration'
|
|
6
|
+
require_relative 'wiki/application'
|
|
7
|
+
require_relative 'wiki/home'
|
|
8
|
+
require_relative 'wiki/sidebar'
|
|
9
|
+
require_relative 'wiki/unknown_wiki_count_list_exporter'
|
|
10
|
+
require_relative 'wiki/unknown_wiki_list_exporter_for_llm'
|
|
11
|
+
require_relative 'wiki/cli'
|
|
12
|
+
|
|
13
|
+
module Spreen
|
|
14
|
+
# Spreens a GitHub wiki — the falcon's stoop, then the preen: generates
|
|
15
|
+
# Home.md and _Sidebar.md grouped by the Owner/Category declared on the
|
|
16
|
+
# first line of each page, and exports reports of the pages whose owner
|
|
17
|
+
# or category is unknown.
|
|
18
|
+
module Wiki
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/spreen-wiki.rb
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Generated from lib/spreen/wiki/application.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Spreen
|
|
4
|
+
module Wiki
|
|
5
|
+
# Base class for the wiki-organising commands. Loads the wiki tree under
|
|
6
|
+
# base_path, groups it by Owner or Category in either English or Japanese,
|
|
7
|
+
# and exposes the resulting maps to its subclasses. Grouping criteria,
|
|
8
|
+
# languages and labels are resolved through Configuration and can be
|
|
9
|
+
# extended via a `.spreen.yml` file.
|
|
10
|
+
class Application
|
|
11
|
+
class NotImplementedError < StandardError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @rbs base_path: String
|
|
15
|
+
# @rbs group_by: String
|
|
16
|
+
# @rbs language: String
|
|
17
|
+
# @rbs home_overflow: (bool | String)
|
|
18
|
+
# @rbs **options: untyped
|
|
19
|
+
# @rbs return: untyped
|
|
20
|
+
def self.run: (?base_path: String, ?group_by: String, ?language: String, ?home_overflow: bool | String, **untyped) -> untyped
|
|
21
|
+
|
|
22
|
+
# @rbs base_path: String
|
|
23
|
+
# @rbs group_by: String
|
|
24
|
+
# @rbs language: String
|
|
25
|
+
# @rbs home_overflow: (bool | String)
|
|
26
|
+
# @rbs config: Configuration?
|
|
27
|
+
# @rbs **options: untyped
|
|
28
|
+
# @rbs return: void
|
|
29
|
+
def initialize: (?base_path: String, ?group_by: String, ?language: String, ?home_overflow: bool | String, ?config: Configuration?, **untyped) -> void
|
|
30
|
+
|
|
31
|
+
# @rbs return: void
|
|
32
|
+
def validate!: () -> void
|
|
33
|
+
|
|
34
|
+
# @rbs return: untyped
|
|
35
|
+
def run: () -> untyped
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
attr_reader base_path: untyped
|
|
40
|
+
|
|
41
|
+
attr_reader group_by: untyped
|
|
42
|
+
|
|
43
|
+
attr_reader language: untyped
|
|
44
|
+
|
|
45
|
+
attr_reader home_overflow: untyped
|
|
46
|
+
|
|
47
|
+
attr_reader config: untyped
|
|
48
|
+
|
|
49
|
+
attr_reader path_to_home: untyped
|
|
50
|
+
|
|
51
|
+
attr_reader path_to_sidebar: untyped
|
|
52
|
+
|
|
53
|
+
attr_reader paths_to_wikis: untyped
|
|
54
|
+
|
|
55
|
+
attr_reader excluded_paths: untyped
|
|
56
|
+
|
|
57
|
+
# @rbs return: void
|
|
58
|
+
def validate_home_overflow!: () -> void
|
|
59
|
+
|
|
60
|
+
# @rbs raw: (bool | String)
|
|
61
|
+
# @rbs return: (bool | String)
|
|
62
|
+
def parse_home_overflow: (bool | String raw) -> (bool | String)
|
|
63
|
+
|
|
64
|
+
# @rbs return: Array[String]
|
|
65
|
+
def target_paths: () -> Array[String]
|
|
66
|
+
|
|
67
|
+
# @rbs return: Regexp
|
|
68
|
+
def target_regexp: () -> Regexp
|
|
69
|
+
|
|
70
|
+
# @rbs return: String
|
|
71
|
+
def no_declaration: () -> String
|
|
72
|
+
|
|
73
|
+
# @rbs return: Hash[String, Array[String]]
|
|
74
|
+
def wiki_maps_with_namespace: () -> Hash[String, Array[String]]
|
|
75
|
+
|
|
76
|
+
# @rbs target_path: String
|
|
77
|
+
# @rbs named: Hash[String, Array[String]]
|
|
78
|
+
# @rbs undeclared: Hash[String, Array[String]]
|
|
79
|
+
# @rbs return: void
|
|
80
|
+
def populate_namespace: (String target_path, Hash[String, Array[String]] named, Hash[String, Array[String]] undeclared) -> void
|
|
81
|
+
|
|
82
|
+
# @rbs target_path: String
|
|
83
|
+
# @rbs return: String
|
|
84
|
+
def namespace_for: (String target_path) -> String
|
|
85
|
+
|
|
86
|
+
# @rbs return: Hash[String, Array[String]]
|
|
87
|
+
def owned_wiki_maps: () -> Hash[String, Array[String]]
|
|
88
|
+
|
|
89
|
+
# @rbs return: Hash[String, Array[String]]
|
|
90
|
+
def plain_wiki_maps: () -> Hash[String, Array[String]]
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Generated from lib/spreen/wiki/cli.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Spreen
|
|
4
|
+
module Wiki
|
|
5
|
+
# Command line interface behind the `spreen` executable:
|
|
6
|
+
# `spreen <update|count-report|llm-export> [options]`.
|
|
7
|
+
class CLI
|
|
8
|
+
HELP: ::String
|
|
9
|
+
|
|
10
|
+
# Flags shared by every command, mapped to the keyword arguments of the
|
|
11
|
+
# underlying classes. --exclude and the per-command flags are wired up
|
|
12
|
+
# separately because they need a type or a fixed value.
|
|
13
|
+
COMMON_OPTIONS: untyped
|
|
14
|
+
|
|
15
|
+
# @rbs argv: Array[String]
|
|
16
|
+
# @rbs return: Integer
|
|
17
|
+
def self.start: (?Array[String] argv) -> Integer
|
|
18
|
+
|
|
19
|
+
# @rbs argv: Array[String]
|
|
20
|
+
# @rbs return: void
|
|
21
|
+
def initialize: (Array[String] argv) -> void
|
|
22
|
+
|
|
23
|
+
# @rbs return: Integer
|
|
24
|
+
def run: () -> Integer
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
attr_reader argv: untyped
|
|
29
|
+
|
|
30
|
+
attr_reader options: untyped
|
|
31
|
+
|
|
32
|
+
# @rbs command: String
|
|
33
|
+
# @rbs return: Integer
|
|
34
|
+
def execute: (String command) -> Integer
|
|
35
|
+
|
|
36
|
+
# @rbs return: Integer
|
|
37
|
+
def print_version: () -> Integer
|
|
38
|
+
|
|
39
|
+
# @rbs command: String?
|
|
40
|
+
# @rbs return: Integer
|
|
41
|
+
def print_help: (String? command) -> Integer
|
|
42
|
+
|
|
43
|
+
# @rbs command: String
|
|
44
|
+
# @rbs return: Integer
|
|
45
|
+
def unknown_command: (String command) -> Integer
|
|
46
|
+
|
|
47
|
+
# @rbs return: void
|
|
48
|
+
def update: () -> void
|
|
49
|
+
|
|
50
|
+
# @rbs return: void
|
|
51
|
+
def count_report: () -> void
|
|
52
|
+
|
|
53
|
+
# @rbs return: void
|
|
54
|
+
def llm_export: () -> void
|
|
55
|
+
|
|
56
|
+
# @rbs command: String
|
|
57
|
+
# @rbs return: OptionParser
|
|
58
|
+
def parser: (String command) -> OptionParser
|
|
59
|
+
|
|
60
|
+
# @rbs opt: OptionParser
|
|
61
|
+
# @rbs return: void
|
|
62
|
+
def add_common_options: (OptionParser opt) -> void
|
|
63
|
+
|
|
64
|
+
# @rbs opt: OptionParser
|
|
65
|
+
# @rbs command: String
|
|
66
|
+
# @rbs return: void
|
|
67
|
+
def add_command_options: (OptionParser opt, String command) -> void
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Generated from lib/spreen/wiki/configuration.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Spreen
|
|
4
|
+
module Wiki
|
|
5
|
+
# Resolves the runtime configuration for a wiki checkout. Every value is
|
|
6
|
+
# looked up with the same precedence: explicit keyword argument, then the
|
|
7
|
+
# `.spreen.yml` file under base_path (or config_path), then the
|
|
8
|
+
# ORGANISATION_NAME environment variable (organisation only), then the
|
|
9
|
+
# built-in defaults.
|
|
10
|
+
class Configuration
|
|
11
|
+
CONFIG_FILENAME: ::String
|
|
12
|
+
|
|
13
|
+
EMPTY_HASH: Hash[String, untyped]
|
|
14
|
+
|
|
15
|
+
DEFAULT_TEMPLATE_DIR: untyped
|
|
16
|
+
|
|
17
|
+
DEFAULT_EXCLUDED_DIRS: untyped
|
|
18
|
+
|
|
19
|
+
# Built-in labels: how the first line of a wiki page is parsed (regexp),
|
|
20
|
+
# which namespace collects pages without a declaration (no_declaration),
|
|
21
|
+
# which namespaces the count report covers (unknown_namespaces) and which
|
|
22
|
+
# namespace the LLM export targets (llm_target_namespace). A config file
|
|
23
|
+
# can override any of these, add languages or add group_by criteria.
|
|
24
|
+
DEFAULT_LABELS: untyped
|
|
25
|
+
|
|
26
|
+
attr_reader organisation: untyped
|
|
27
|
+
|
|
28
|
+
attr_reader repository: untyped
|
|
29
|
+
|
|
30
|
+
attr_reader wiki_url: untyped
|
|
31
|
+
|
|
32
|
+
attr_reader owner_base_url: untyped
|
|
33
|
+
|
|
34
|
+
attr_reader excluded_dirs: untyped
|
|
35
|
+
|
|
36
|
+
attr_reader template_dir: untyped
|
|
37
|
+
|
|
38
|
+
@organisation: String?
|
|
39
|
+
|
|
40
|
+
@repository: String?
|
|
41
|
+
|
|
42
|
+
@wiki_url: String?
|
|
43
|
+
|
|
44
|
+
@owner_base_url: String?
|
|
45
|
+
|
|
46
|
+
@excluded_dirs: Array[String]
|
|
47
|
+
|
|
48
|
+
@template_dir: String
|
|
49
|
+
|
|
50
|
+
@file: Hash[String, untyped]
|
|
51
|
+
|
|
52
|
+
@labels: Hash[String, untyped]
|
|
53
|
+
|
|
54
|
+
# @rbs base_path: String
|
|
55
|
+
# @rbs config_path: String?
|
|
56
|
+
# @rbs organisation: String?
|
|
57
|
+
# @rbs repository: String?
|
|
58
|
+
# @rbs wiki_url: String?
|
|
59
|
+
# @rbs owner_base_url: String?
|
|
60
|
+
# @rbs excluded_dirs: Array[String]?
|
|
61
|
+
# @rbs template_dir: String?
|
|
62
|
+
# @rbs return: void
|
|
63
|
+
def initialize: (base_path: String, ?config_path: String?, ?organisation: String?, ?repository: String?, ?wiki_url: String?, ?owner_base_url: String?, ?excluded_dirs: Array[String]?, ?template_dir: String?) -> void
|
|
64
|
+
|
|
65
|
+
# @rbs return: Array[String]
|
|
66
|
+
def group_bys: () -> Array[String]
|
|
67
|
+
|
|
68
|
+
# @rbs group_by: String
|
|
69
|
+
# @rbs return: Array[String]
|
|
70
|
+
def languages: (String group_by) -> Array[String]
|
|
71
|
+
|
|
72
|
+
# @rbs group_by: String
|
|
73
|
+
# @rbs return: Regexp
|
|
74
|
+
def target_regexp: (String group_by) -> Regexp
|
|
75
|
+
|
|
76
|
+
# @rbs group_by: String
|
|
77
|
+
# @rbs language: String
|
|
78
|
+
# @rbs return: String
|
|
79
|
+
def no_declaration: (String group_by, String language) -> String
|
|
80
|
+
|
|
81
|
+
# @rbs group_by: String
|
|
82
|
+
# @rbs language: String
|
|
83
|
+
# @rbs return: Array[String]
|
|
84
|
+
def unknown_namespaces: (String group_by, String language) -> Array[String]
|
|
85
|
+
|
|
86
|
+
# @rbs group_by: String
|
|
87
|
+
# @rbs language: String
|
|
88
|
+
# @rbs return: String
|
|
89
|
+
def llm_target_namespace: (String group_by, String language) -> String
|
|
90
|
+
|
|
91
|
+
# @rbs group_by: String
|
|
92
|
+
# @rbs language: String
|
|
93
|
+
# @rbs return: String
|
|
94
|
+
def path_to_template: (String group_by, String language) -> String
|
|
95
|
+
|
|
96
|
+
private
|
|
97
|
+
|
|
98
|
+
attr_reader file: untyped
|
|
99
|
+
|
|
100
|
+
attr_reader labels: untyped
|
|
101
|
+
|
|
102
|
+
# Treats empty strings the same as nil so that callers can pass values
|
|
103
|
+
# straight from optional environment variables or CLI flags.
|
|
104
|
+
# @rbs value: String?
|
|
105
|
+
# @rbs return: String?
|
|
106
|
+
def presence: (String? value) -> String?
|
|
107
|
+
|
|
108
|
+
# @rbs explicit: String?
|
|
109
|
+
# @rbs key: String
|
|
110
|
+
# @rbs return: String?
|
|
111
|
+
def resolve: (String? explicit, String key) -> String?
|
|
112
|
+
|
|
113
|
+
# @rbs explicit: String?
|
|
114
|
+
# @rbs return: String?
|
|
115
|
+
def resolve_organisation: (String? explicit) -> String?
|
|
116
|
+
|
|
117
|
+
# @rbs explicit: String?
|
|
118
|
+
# @rbs return: String?
|
|
119
|
+
def resolve_wiki_url: (String? explicit) -> String?
|
|
120
|
+
|
|
121
|
+
# @rbs explicit: String?
|
|
122
|
+
# @rbs return: String?
|
|
123
|
+
def resolve_owner_base_url: (String? explicit) -> String?
|
|
124
|
+
|
|
125
|
+
# @rbs path: String
|
|
126
|
+
# @rbs return: Hash[String, untyped]
|
|
127
|
+
def load_file: (String path) -> Hash[String, untyped]
|
|
128
|
+
|
|
129
|
+
# @rbs group_by: String
|
|
130
|
+
# @rbs return: Hash[String, untyped]
|
|
131
|
+
def label_for: (String group_by) -> Hash[String, untyped]
|
|
132
|
+
|
|
133
|
+
# @rbs group_by: String
|
|
134
|
+
# @rbs language: String
|
|
135
|
+
# @rbs return: Hash[String, untyped]
|
|
136
|
+
def language_labels: (String group_by, String language) -> Hash[String, untyped]
|
|
137
|
+
|
|
138
|
+
# @rbs return: String?
|
|
139
|
+
def default_wiki_url: () -> String?
|
|
140
|
+
|
|
141
|
+
# @rbs return: String?
|
|
142
|
+
def default_owner_base_url: () -> String?
|
|
143
|
+
|
|
144
|
+
# @rbs base: Hash[String, untyped]
|
|
145
|
+
# @rbs override: Hash[String, untyped]
|
|
146
|
+
# @rbs return: Hash[String, untyped]
|
|
147
|
+
def deep_merge: (Hash[String, untyped] base, Hash[String, untyped] override) -> Hash[String, untyped]
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|