Add AI topics, a sources discovery command, and intelligence-radar's pointer sources.
Topics ai.benchmarks, ai.pricing and ai.models; 'sources --repo' lists visible sources matching a repo's topics. Registers the five ir-* URL sources contributed by intelligence-radar (IR-WP-0010-T04). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 7780@bnt-lap001 Assistant-Session: 622cd705-cb31-4322-ba08-dd42e44fa583
This commit is contained in:
parent
ac8227eead
commit
c810fe6dfe
11 changed files with 117 additions and 2 deletions
|
|
@ -81,6 +81,9 @@ def main(argv=None):
|
|||
get = sub.add_parser('get', help='write the original bytes of an item to stdout')
|
||||
get.add_argument('item')
|
||||
sub.add_parser('health', help='last scan, per-source counts, silence, quarantine')
|
||||
sources = sub.add_parser('sources', help='list registered sources a repo may see, by topic')
|
||||
sources.add_argument('--repo', required=True)
|
||||
sources.add_argument('--topic', help='limit to one topic (default: the repo subscription topics)')
|
||||
args = parser.parse_args(argv)
|
||||
root = Path(args.root)
|
||||
config = _config(root, args.config)
|
||||
|
|
@ -121,6 +124,9 @@ def main(argv=None):
|
|||
if args.command == 'get':
|
||||
sys.stdout.buffer.write(store.get_item(root, args.item))
|
||||
return 0
|
||||
if args.command == 'sources':
|
||||
_print(reg.sources_for(reg.load(root), args.repo, args.topic))
|
||||
return 0
|
||||
if args.command == 'health':
|
||||
report = notify.health(root)
|
||||
_print(report)
|
||||
|
|
|
|||
|
|
@ -120,3 +120,20 @@ def subscribers_for(registry, source_id):
|
|||
set(source.get('topics', [])) & set(subscription.get('topics', [])):
|
||||
matched.append(repo)
|
||||
return matched
|
||||
|
||||
|
||||
def sources_for(registry, repo, topic=None):
|
||||
"""Sources visible to a repo whose topics match its subscription (or one topic).
|
||||
|
||||
URL sources are pointers: the library lists them and does not fetch them.
|
||||
"""
|
||||
if topic:
|
||||
wanted = {topic}
|
||||
else:
|
||||
subscription = registry['subscriptions'].get(repo, {})
|
||||
wanted = set(subscription.get('topics', []))
|
||||
listed = []
|
||||
for ident, source in sorted(visible_sources(registry, repo).items()):
|
||||
if wanted & set(source.get('topics', [])):
|
||||
listed.append({key: value for key, value in source.items() if key != '_file'})
|
||||
return listed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue