@agent-pattern-labs/leads-rig 0.1.3

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.
Files changed (87) hide show
  1. package/.claude/agents/general-free.md +39 -0
  2. package/.claude/agents/general-paid.md +20 -0
  3. package/.claude/agents/glm-minimal.md +9 -0
  4. package/.claude/iso-route.resolved.json +21 -0
  5. package/.claude/settings.json +3 -0
  6. package/.codex/config.toml +24 -0
  7. package/.cursor/iso-route.md +17 -0
  8. package/.cursor/mcp.json +19 -0
  9. package/.cursor/rules/agent-general-free.mdc +38 -0
  10. package/.cursor/rules/agent-general-paid.mdc +19 -0
  11. package/.cursor/rules/agent-glm-minimal.mdc +8 -0
  12. package/.cursor/rules/main.mdc +61 -0
  13. package/.mcp.json +19 -0
  14. package/.opencode/agents/general-free.md +48 -0
  15. package/.opencode/agents/general-paid.md +29 -0
  16. package/.opencode/agents/glm-minimal.md +19 -0
  17. package/.opencode/instructions.md +3 -0
  18. package/.opencode/skills/lead-harness.md +56 -0
  19. package/.opencode/skills/public-leads.md +56 -0
  20. package/.pi/prompts/lead-harness.md +54 -0
  21. package/.pi/prompts/public-leads.md +54 -0
  22. package/.pi/skills/general-free/SKILL.md +38 -0
  23. package/.pi/skills/general-paid/SKILL.md +19 -0
  24. package/.pi/skills/glm-minimal/SKILL.md +8 -0
  25. package/AGENTS.md +56 -0
  26. package/CLAUDE.md +56 -0
  27. package/LICENSE +21 -0
  28. package/README.md +61 -0
  29. package/batch/README.md +37 -0
  30. package/batch/batch-prompt.md +19 -0
  31. package/batch/batch-runner.sh +18 -0
  32. package/bin/create-leads-harness.mjs +178 -0
  33. package/bin/lead-harness.mjs +201 -0
  34. package/bin/sync.mjs +150 -0
  35. package/config/profile.example.yml +34 -0
  36. package/docs/ARCHITECTURE.md +85 -0
  37. package/docs/CONSTRUCTION.md +40 -0
  38. package/docs/README.md +5 -0
  39. package/docs/SETUP.md +89 -0
  40. package/examples/README.md +9 -0
  41. package/examples/sample-leads.json +57 -0
  42. package/iso/agents/general-free.md +50 -0
  43. package/iso/agents/general-paid.md +31 -0
  44. package/iso/agents/glm-minimal.md +21 -0
  45. package/iso/commands/lead-harness.md +59 -0
  46. package/iso/commands/public-leads.md +59 -0
  47. package/iso/config.json +11 -0
  48. package/iso/instructions.md +56 -0
  49. package/iso/instructions.opencode.md +3 -0
  50. package/iso/mcp.json +16 -0
  51. package/lib/leadharness-crawler.mjs +911 -0
  52. package/lib/leadharness-ingest.mjs +157 -0
  53. package/lib/leadharness-leads.mjs +574 -0
  54. package/models.yaml +32 -0
  55. package/modes/_shared.md +50 -0
  56. package/modes/batch.md +34 -0
  57. package/modes/crawl.md +25 -0
  58. package/modes/ingest.md +33 -0
  59. package/modes/pipeline.md +27 -0
  60. package/modes/reference-local-helpers.md +13 -0
  61. package/modes/review.md +15 -0
  62. package/modes/setup.md +25 -0
  63. package/opencode.json +43 -0
  64. package/package.json +186 -0
  65. package/scripts/batch-orchestrator.mjs +558 -0
  66. package/scripts/crawl.mjs +129 -0
  67. package/scripts/ingest.mjs +48 -0
  68. package/scripts/manifest.mjs +71 -0
  69. package/scripts/pipeline.mjs +118 -0
  70. package/scripts/validate-leads.mjs +69 -0
  71. package/templates/canon.json +26 -0
  72. package/templates/capabilities.json +23 -0
  73. package/templates/context.json +20 -0
  74. package/templates/contracts.json +72 -0
  75. package/templates/facts.json +13 -0
  76. package/templates/index.json +13 -0
  77. package/templates/lead-schema.json +143 -0
  78. package/templates/lineage.json +10 -0
  79. package/templates/migrations.json +4 -0
  80. package/templates/postflight.json +11 -0
  81. package/templates/preflight.json +19 -0
  82. package/templates/prioritize.json +10 -0
  83. package/templates/redact.json +15 -0
  84. package/templates/score.json +18 -0
  85. package/templates/states.yml +25 -0
  86. package/templates/timeline.json +10 -0
  87. package/verify-pipeline.mjs +123 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "queues": [
4
+ {
5
+ "name": "ready-for-ingest",
6
+ "source": "data/lead-manifest.json",
7
+ "sort": ["errors:asc", "leadCount:desc", "generatedAt:asc"]
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "version": 1,
3
+ "rules": [
4
+ {
5
+ "name": "admin-token",
6
+ "pattern": "(?i)(authorization:\\s*bearer\\s+)[A-Za-z0-9._~+\\/-]+",
7
+ "replacement": "$1[REDACTED]"
8
+ },
9
+ {
10
+ "name": "env-token",
11
+ "pattern": "(PUBLIC_LEADS_API_TOKEN=|LEAD_HARNESS_API_TOKEN=|ADMIN_API_TOKEN=)[^\\s]+",
12
+ "replacement": "$1[REDACTED]"
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": 1,
3
+ "rubrics": [
4
+ {
5
+ "name": "lead-quality",
6
+ "scale": [1, 5],
7
+ "dimensions": [
8
+ { "id": "source_quality", "weight": 0.3 },
9
+ { "id": "person_specificity", "weight": 0.25 },
10
+ { "id": "verification", "weight": 0.25 },
11
+ { "id": "commercial_relevance", "weight": 0.2 }
12
+ ],
13
+ "gates": {
14
+ "ingest": { "min": 2.5 }
15
+ }
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,25 @@
1
+ states:
2
+ - id: discovered
3
+ label: Discovered
4
+ aliases: [found, queued]
5
+ - id: crawling
6
+ label: Crawling
7
+ aliases: [running, in_progress]
8
+ - id: extracted
9
+ label: Extracted
10
+ aliases: [parsed, collected]
11
+ - id: validated
12
+ label: Validated
13
+ aliases: [checked]
14
+ - id: ready_for_ingest
15
+ label: Ready for ingest
16
+ aliases: [ready]
17
+ - id: ingested
18
+ label: Ingested
19
+ aliases: [stored, submitted]
20
+ - id: failed
21
+ label: Failed
22
+ aliases: [error]
23
+ - id: skipped
24
+ label: Skipped
25
+ aliases: [skip]
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "events": [
4
+ {
5
+ "name": "review-after-ingest",
6
+ "afterStatus": "ingested",
7
+ "dueInDays": 1
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync } from 'fs';
4
+ import { readFileSync } from 'fs';
5
+ import { join } from 'path';
6
+ import {
7
+ discoverLeadArtifacts,
8
+ PROJECT_DIR,
9
+ readLeadArtifact,
10
+ relativeProjectPath,
11
+ validatePayload,
12
+ } from './lib/leadharness-leads.mjs';
13
+
14
+ let errors = 0;
15
+ let warnings = 0;
16
+
17
+ const requiredFiles = [
18
+ 'package.json',
19
+ 'bin/lead-harness.mjs',
20
+ 'bin/sync.mjs',
21
+ 'iso/instructions.md',
22
+ 'iso/commands/public-leads.md',
23
+ 'templates/lead-schema.json',
24
+ 'templates/contracts.json',
25
+ 'templates/states.yml',
26
+ 'config/profile.example.yml',
27
+ 'modes/_shared.md',
28
+ 'modes/crawl.md',
29
+ 'modes/pipeline.md',
30
+ 'modes/batch.md',
31
+ 'modes/ingest.md',
32
+ 'batch/batch-prompt.md',
33
+ 'batch/batch-runner.sh',
34
+ 'scripts/crawl.mjs',
35
+ 'scripts/pipeline.mjs',
36
+ 'scripts/batch-orchestrator.mjs',
37
+ 'docs/ARCHITECTURE.md',
38
+ ];
39
+
40
+ for (const rel of requiredFiles) {
41
+ if (existsSync(join(PROJECT_DIR, rel))) ok(`${rel} exists`);
42
+ else error(`${rel} is missing`);
43
+ }
44
+
45
+ const artifacts = discoverLeadArtifacts(PROJECT_DIR);
46
+ if (artifacts.length === 0) {
47
+ ok('No lead artifacts found; fresh setup is valid');
48
+ } else {
49
+ for (const artifact of artifacts) {
50
+ verifyArtifact(artifact);
51
+ }
52
+ }
53
+
54
+ verifyManifestIfPresent();
55
+
56
+ if (errors > 0) {
57
+ console.log(`\npublic-leads verify failed: ${errors} error(s), ${warnings} warning(s)`);
58
+ process.exit(1);
59
+ }
60
+
61
+ console.log(`\npublic-leads verify passed: ${warnings} warning(s)`);
62
+
63
+ function verifyArtifact(path) {
64
+ try {
65
+ const payload = readLeadArtifact(path);
66
+ const result = validatePayload(payload);
67
+ for (const item of result.issues) {
68
+ const message = `${relativeProjectPath(path)} ${item.path}: ${item.code}: ${item.message}`;
69
+ if (item.severity === 'error') error(message);
70
+ else warn(message);
71
+ }
72
+ if (result.ok) {
73
+ ok(`${relativeProjectPath(path)} valid (${result.summary.leadCount} leads, ${result.summary.domainCount} domains)`);
74
+ }
75
+ } catch (error_) {
76
+ error(`${relativeProjectPath(path)}: ${error_ instanceof Error ? error_.message : String(error_)}`);
77
+ }
78
+ }
79
+
80
+ function verifyManifestIfPresent() {
81
+ const path = join(PROJECT_DIR, 'data/lead-manifest.json');
82
+ if (!existsSync(path)) {
83
+ ok('Manifest not initialized');
84
+ return;
85
+ }
86
+ try {
87
+ const manifest = JSON.parse(readFileSync(path, 'utf8'));
88
+ if (!Array.isArray(manifest.batches)) {
89
+ error('data/lead-manifest.json batches must be an array');
90
+ return;
91
+ }
92
+ for (const batch of manifest.batches) {
93
+ if (!batch.input) {
94
+ error('manifest batch missing input');
95
+ continue;
96
+ }
97
+ const inputPath = join(PROJECT_DIR, batch.input);
98
+ if (!existsSync(inputPath)) {
99
+ error(`manifest input missing: ${batch.input}`);
100
+ }
101
+ if (batch.readyForIngest && batch.validation?.errors > 0) {
102
+ error(`manifest batch ${batch.id || batch.input} is readyForIngest with validation errors`);
103
+ }
104
+ }
105
+ ok(`Manifest valid (${manifest.batches.length} batch records)`);
106
+ } catch (error_) {
107
+ error(`data/lead-manifest.json: ${error_ instanceof Error ? error_.message : String(error_)}`);
108
+ }
109
+ }
110
+
111
+ function ok(message) {
112
+ console.log(`OK ${message}`);
113
+ }
114
+
115
+ function warn(message) {
116
+ warnings++;
117
+ console.log(`WARN ${message}`);
118
+ }
119
+
120
+ function error(message) {
121
+ errors++;
122
+ console.log(`ERROR ${message}`);
123
+ }