@geraldmaron/construct 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.
- package/.env.example +69 -0
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/agents/prompts/cx-accessibility.md +29 -0
- package/agents/prompts/cx-ai-engineer.md +31 -0
- package/agents/prompts/cx-architect.md +40 -0
- package/agents/prompts/cx-business-strategist.md +25 -0
- package/agents/prompts/cx-data-analyst.md +30 -0
- package/agents/prompts/cx-data-engineer.md +32 -0
- package/agents/prompts/cx-debugger.md +27 -0
- package/agents/prompts/cx-designer.md +33 -0
- package/agents/prompts/cx-devil-advocate.md +36 -0
- package/agents/prompts/cx-docs-keeper.md +50 -0
- package/agents/prompts/cx-engineer.md +36 -0
- package/agents/prompts/cx-evaluator.md +26 -0
- package/agents/prompts/cx-explorer.md +38 -0
- package/agents/prompts/cx-legal-compliance.md +25 -0
- package/agents/prompts/cx-operations.md +28 -0
- package/agents/prompts/cx-orchestrator.md +30 -0
- package/agents/prompts/cx-platform-engineer.md +25 -0
- package/agents/prompts/cx-product-manager.md +30 -0
- package/agents/prompts/cx-qa.md +42 -0
- package/agents/prompts/cx-rd-lead.md +25 -0
- package/agents/prompts/cx-release-manager.md +31 -0
- package/agents/prompts/cx-researcher.md +31 -0
- package/agents/prompts/cx-reviewer.md +36 -0
- package/agents/prompts/cx-security.md +37 -0
- package/agents/prompts/cx-sre.md +26 -0
- package/agents/prompts/cx-test-automation.md +35 -0
- package/agents/prompts/cx-trace-reviewer.md +76 -0
- package/agents/prompts/cx-ux-researcher.md +30 -0
- package/agents/registry.json +879 -0
- package/agents/teams.json +94 -0
- package/bin/construct +613 -0
- package/commands/build/feature.md +21 -0
- package/commands/build/fix.md +20 -0
- package/commands/design/access.md +19 -0
- package/commands/design/flow.md +16 -0
- package/commands/design/ui.md +18 -0
- package/commands/measure/experiment.md +18 -0
- package/commands/measure/metrics.md +18 -0
- package/commands/measure/results.md +18 -0
- package/commands/plan/api.md +19 -0
- package/commands/plan/challenge.md +18 -0
- package/commands/plan/decide.md +20 -0
- package/commands/plan/feature.md +49 -0
- package/commands/plan/requirements.md +24 -0
- package/commands/remember/context.md +26 -0
- package/commands/remember/handoff.md +19 -0
- package/commands/remember/runbook.md +20 -0
- package/commands/review/code.md +21 -0
- package/commands/review/quality.md +19 -0
- package/commands/review/security.md +16 -0
- package/commands/ship/ready.md +19 -0
- package/commands/ship/release.md +19 -0
- package/commands/ship/status.md +18 -0
- package/commands/understand/docs.md +22 -0
- package/commands/understand/research.md +22 -0
- package/commands/understand/this.md +23 -0
- package/commands/understand/why.md +18 -0
- package/commands/work/clean.md +32 -0
- package/commands/work/drive.md +69 -0
- package/commands/work/optimize-prompts.md +46 -0
- package/commands/work/parallel-review.md +40 -0
- package/db/migrations/001_init.sql +38 -0
- package/langfuse/docker-compose.yml +82 -0
- package/lib/audit-skills.mjs +118 -0
- package/lib/auto-docs.mjs +293 -0
- package/lib/cli-commands.mjs +409 -0
- package/lib/codex-config.mjs +114 -0
- package/lib/comment-lint.mjs +191 -0
- package/lib/completions.mjs +170 -0
- package/lib/context-state.mjs +99 -0
- package/lib/cost.mjs +213 -0
- package/lib/distill.mjs +403 -0
- package/lib/efficiency.mjs +139 -0
- package/lib/env-config.mjs +53 -0
- package/lib/eval-harness.mjs +59 -0
- package/lib/features.mjs +209 -0
- package/lib/headhunt.mjs +597 -0
- package/lib/hooks/adaptive-lint.mjs +112 -0
- package/lib/hooks/agent-tracker.mjs +50 -0
- package/lib/hooks/bootstrap-guard.mjs +90 -0
- package/lib/hooks/comment-lint.mjs +26 -0
- package/lib/hooks/config-protection.mjs +52 -0
- package/lib/hooks/console-warn.mjs +43 -0
- package/lib/hooks/context-window-recovery.mjs +90 -0
- package/lib/hooks/continuation-enforcer.mjs +72 -0
- package/lib/hooks/dep-audit.mjs +155 -0
- package/lib/hooks/drive-guard.mjs +89 -0
- package/lib/hooks/edit-accumulator.mjs +36 -0
- package/lib/hooks/edit-error-recovery.mjs +46 -0
- package/lib/hooks/edit-guard.mjs +109 -0
- package/lib/hooks/env-check.mjs +80 -0
- package/lib/hooks/guard-bash.mjs +83 -0
- package/lib/hooks/mcp-audit.mjs +57 -0
- package/lib/hooks/mcp-health-check.mjs +51 -0
- package/lib/hooks/mcp-task-scope.mjs +47 -0
- package/lib/hooks/model-fallback.mjs +105 -0
- package/lib/hooks/pre-compact.mjs +212 -0
- package/lib/hooks/pre-push-gate.mjs +129 -0
- package/lib/hooks/read-tracker.mjs +129 -0
- package/lib/hooks/registry-sync.mjs +23 -0
- package/lib/hooks/scan-secrets.mjs +76 -0
- package/lib/hooks/session-start.mjs +95 -0
- package/lib/hooks/stop-notify.mjs +191 -0
- package/lib/hooks/stop-typecheck.mjs +83 -0
- package/lib/hooks/task-completed-guard.mjs +43 -0
- package/lib/hooks/teammate-idle-guard.mjs +54 -0
- package/lib/hooks/workflow-guard.mjs +62 -0
- package/lib/host-capabilities.mjs +123 -0
- package/lib/init-docs.mjs +382 -0
- package/lib/mcp/server.mjs +1123 -0
- package/lib/mcp-catalog.json +243 -0
- package/lib/mcp-manager.mjs +433 -0
- package/lib/mcp-platform-config.mjs +104 -0
- package/lib/model-router.mjs +810 -0
- package/lib/opencode-config.mjs +44 -0
- package/lib/opencode-runtime-plugin.mjs +909 -0
- package/lib/opencode-telemetry.mjs +433 -0
- package/lib/orchestration-policy.mjs +258 -0
- package/lib/prompt-composer.mjs +196 -0
- package/lib/prompt-metadata.mjs +68 -0
- package/lib/review.mjs +429 -0
- package/lib/role-preload.mjs +52 -0
- package/lib/schemas/decision.json +50 -0
- package/lib/schemas/implementation.json +51 -0
- package/lib/schemas/review-report.json +32 -0
- package/lib/schemas/test-report.json +43 -0
- package/lib/server/index.mjs +334 -0
- package/lib/server/static/app.js +841 -0
- package/lib/server/static/index.html +820 -0
- package/lib/service-manager.mjs +225 -0
- package/lib/setup.mjs +319 -0
- package/lib/status.mjs +707 -0
- package/lib/storage/backend.mjs +44 -0
- package/lib/storage/embeddings.mjs +70 -0
- package/lib/storage/hybrid-query.mjs +184 -0
- package/lib/storage/sql-store.mjs +55 -0
- package/lib/storage/state-source.mjs +101 -0
- package/lib/storage/sync.mjs +164 -0
- package/lib/storage/vector-store.mjs +59 -0
- package/lib/telemetry/backends/langfuse.mjs +58 -0
- package/lib/telemetry/backends/noop.mjs +16 -0
- package/lib/telemetry/langfuse-ingest.mjs +108 -0
- package/lib/telemetry/langfuse-model-sync.mjs +270 -0
- package/lib/telemetry/team-rollup.mjs +143 -0
- package/lib/toolkit-env.mjs +30 -0
- package/lib/validator.mjs +181 -0
- package/lib/workflow-state.mjs +794 -0
- package/package.json +53 -0
- package/personas/construct.md +94 -0
- package/platforms/claude/CLAUDE.md +30 -0
- package/platforms/claude/settings.template.json +472 -0
- package/platforms/opencode/config.template.json +65 -0
- package/platforms/opencode/plugins/construct-fallback.js +5 -0
- package/platforms/opencode/sync-config.mjs +69 -0
- package/rules/common/agents.md +55 -0
- package/rules/common/code-review.md +129 -0
- package/rules/common/coding-style.md +95 -0
- package/rules/common/comments.md +139 -0
- package/rules/common/cx-agent-routing.md +61 -0
- package/rules/common/cx-skill-routing.md +11 -0
- package/rules/common/development-workflow.md +49 -0
- package/rules/common/git-workflow.md +29 -0
- package/rules/common/hooks.md +35 -0
- package/rules/common/patterns.md +36 -0
- package/rules/common/performance.md +71 -0
- package/rules/common/security.md +34 -0
- package/rules/common/testing.md +62 -0
- package/rules/golang/coding-style.md +37 -0
- package/rules/golang/hooks.md +22 -0
- package/rules/golang/patterns.md +50 -0
- package/rules/golang/security.md +39 -0
- package/rules/golang/testing.md +36 -0
- package/rules/python/coding-style.md +47 -0
- package/rules/python/hooks.md +24 -0
- package/rules/python/patterns.md +44 -0
- package/rules/python/security.md +35 -0
- package/rules/python/testing.md +43 -0
- package/rules/swift/coding-style.md +52 -0
- package/rules/swift/hooks.md +25 -0
- package/rules/swift/patterns.md +71 -0
- package/rules/swift/security.md +38 -0
- package/rules/swift/testing.md +50 -0
- package/rules/typescript/coding-style.md +204 -0
- package/rules/typescript/hooks.md +27 -0
- package/rules/typescript/patterns.md +57 -0
- package/rules/typescript/security.md +33 -0
- package/rules/typescript/testing.md +23 -0
- package/rules/web/coding-style.md +101 -0
- package/rules/web/design-quality.md +68 -0
- package/rules/web/hooks.md +125 -0
- package/rules/web/patterns.md +84 -0
- package/rules/web/performance.md +69 -0
- package/rules/web/security.md +62 -0
- package/rules/web/testing.md +60 -0
- package/rules/zh/README.md +113 -0
- package/rules/zh/agents.md +55 -0
- package/rules/zh/code-review.md +129 -0
- package/rules/zh/coding-style.md +53 -0
- package/rules/zh/development-workflow.md +49 -0
- package/rules/zh/git-workflow.md +29 -0
- package/rules/zh/hooks.md +35 -0
- package/rules/zh/patterns.md +36 -0
- package/rules/zh/performance.md +60 -0
- package/rules/zh/security.md +34 -0
- package/rules/zh/testing.md +34 -0
- package/skills/ai/agent-dev.md +102 -0
- package/skills/ai/llm-security.md +105 -0
- package/skills/ai/ml-ops.md +169 -0
- package/skills/ai/orchestration-workflow.md +87 -0
- package/skills/ai/prompt-and-eval.md +114 -0
- package/skills/ai/prompt-optimizer.md +114 -0
- package/skills/ai/rag-system.md +104 -0
- package/skills/architecture/api-design.md +100 -0
- package/skills/architecture/caching.md +101 -0
- package/skills/architecture/cloud-native.md +97 -0
- package/skills/architecture/message-queue.md +100 -0
- package/skills/architecture/security-arch.md +105 -0
- package/skills/development/cpp.md +127 -0
- package/skills/development/go.md +129 -0
- package/skills/development/java.md +134 -0
- package/skills/development/kotlin.md +140 -0
- package/skills/development/mobile-crossplatform.md +144 -0
- package/skills/development/python.md +109 -0
- package/skills/development/rust.md +127 -0
- package/skills/development/shell.md +127 -0
- package/skills/development/swift.md +129 -0
- package/skills/development/typescript.md +129 -0
- package/skills/devops/ci-cd.md +108 -0
- package/skills/devops/containerization.md +106 -0
- package/skills/devops/cost-optimization.md +105 -0
- package/skills/devops/data-engineering.md +181 -0
- package/skills/devops/database.md +95 -0
- package/skills/devops/dependency-management.md +91 -0
- package/skills/devops/devsecops.md +96 -0
- package/skills/devops/git-workflow.md +100 -0
- package/skills/devops/incident-response.md +167 -0
- package/skills/devops/monorepo.md +87 -0
- package/skills/devops/observability.md +103 -0
- package/skills/devops/performance.md +104 -0
- package/skills/devops/testing.md +104 -0
- package/skills/docs/adr-workflow.md +32 -0
- package/skills/docs/backlog-proposal-workflow.md +19 -0
- package/skills/docs/customer-profile-workflow.md +22 -0
- package/skills/docs/evidence-ingest-workflow.md +23 -0
- package/skills/docs/init-docs.md +160 -0
- package/skills/docs/init-project.md +50 -0
- package/skills/docs/prd-workflow.md +57 -0
- package/skills/docs/prfaq-workflow.md +25 -0
- package/skills/docs/product-intelligence-review.md +22 -0
- package/skills/docs/product-intelligence-workflow.md +62 -0
- package/skills/docs/product-signal-workflow.md +27 -0
- package/skills/docs/research-workflow.md +28 -0
- package/skills/docs/runbook-workflow.md +24 -0
- package/skills/exploration/repo-map.md +297 -0
- package/skills/frameworks/django.md +159 -0
- package/skills/frameworks/nextjs.md +148 -0
- package/skills/frameworks/react.md +132 -0
- package/skills/frameworks/spring-boot.md +165 -0
- package/skills/frontend-design/accessibility.md +153 -0
- package/skills/frontend-design/component-patterns.md +111 -0
- package/skills/frontend-design/engineering.md +122 -0
- package/skills/frontend-design/state-management.md +118 -0
- package/skills/frontend-design/ui-aesthetics.md +102 -0
- package/skills/frontend-design/ux-principles.md +126 -0
- package/skills/quality-gates/review-work.md +90 -0
- package/skills/quality-gates/verify-change.md +94 -0
- package/skills/quality-gates/verify-module.md +96 -0
- package/skills/quality-gates/verify-quality.md +93 -0
- package/skills/quality-gates/verify-security.md +95 -0
- package/skills/roles/architect.ai-systems.md +37 -0
- package/skills/roles/architect.data.md +37 -0
- package/skills/roles/architect.enterprise.md +37 -0
- package/skills/roles/architect.integration.md +37 -0
- package/skills/roles/architect.md +68 -0
- package/skills/roles/architect.platform.md +37 -0
- package/skills/roles/data-analyst.experiment.md +37 -0
- package/skills/roles/data-analyst.md +68 -0
- package/skills/roles/data-analyst.product-intelligence.md +37 -0
- package/skills/roles/data-analyst.product.md +37 -0
- package/skills/roles/data-analyst.telemetry.md +37 -0
- package/skills/roles/data-engineer.pipeline.md +37 -0
- package/skills/roles/data-engineer.vector-retrieval.md +37 -0
- package/skills/roles/data-engineer.warehouse.md +37 -0
- package/skills/roles/debugger.md +68 -0
- package/skills/roles/designer.accessibility.md +43 -0
- package/skills/roles/designer.md +68 -0
- package/skills/roles/engineer.ai.md +49 -0
- package/skills/roles/engineer.data.md +49 -0
- package/skills/roles/engineer.md +85 -0
- package/skills/roles/engineer.platform.md +49 -0
- package/skills/roles/operator.docs.md +43 -0
- package/skills/roles/operator.md +68 -0
- package/skills/roles/operator.release.md +43 -0
- package/skills/roles/operator.sre.md +43 -0
- package/skills/roles/orchestrator.md +66 -0
- package/skills/roles/product-manager.ai-product.md +37 -0
- package/skills/roles/product-manager.business-strategy.md +43 -0
- package/skills/roles/product-manager.enterprise.md +37 -0
- package/skills/roles/product-manager.growth.md +37 -0
- package/skills/roles/product-manager.md +67 -0
- package/skills/roles/product-manager.platform.md +37 -0
- package/skills/roles/product-manager.product.md +37 -0
- package/skills/roles/qa.ai-eval.md +37 -0
- package/skills/roles/qa.api-contract.md +37 -0
- package/skills/roles/qa.data-pipeline.md +37 -0
- package/skills/roles/qa.md +68 -0
- package/skills/roles/qa.test-automation.md +49 -0
- package/skills/roles/qa.web-ui.md +37 -0
- package/skills/roles/researcher.explorer.md +43 -0
- package/skills/roles/researcher.md +68 -0
- package/skills/roles/researcher.ux.md +43 -0
- package/skills/roles/reviewer.devil-advocate.md +43 -0
- package/skills/roles/reviewer.evaluator.md +43 -0
- package/skills/roles/reviewer.md +68 -0
- package/skills/roles/reviewer.trace.md +43 -0
- package/skills/roles/security.ai.md +37 -0
- package/skills/roles/security.appsec.md +37 -0
- package/skills/roles/security.cloud.md +37 -0
- package/skills/roles/security.legal-compliance.md +49 -0
- package/skills/roles/security.md +68 -0
- package/skills/roles/security.privacy.md +37 -0
- package/skills/roles/security.supply-chain.md +37 -0
- package/skills/routing.md +139 -0
- package/skills/security/blue-team.md +83 -0
- package/skills/security/code-audit.md +94 -0
- package/skills/security/pentest.md +84 -0
- package/skills/security/red-team.md +81 -0
- package/skills/security/threat-intel.md +89 -0
- package/skills/security/vuln-research.md +87 -0
- package/skills/utility/clean-code.md +165 -0
- package/sync-agents.mjs +899 -0
- package/templates/docs/adr.md +27 -0
- package/templates/docs/backlog-proposal.md +26 -0
- package/templates/docs/customer-profile.md +34 -0
- package/templates/docs/evidence-brief.md +37 -0
- package/templates/docs/incident-report.md +46 -0
- package/templates/docs/memo.md +27 -0
- package/templates/docs/meta-prd.md +56 -0
- package/templates/docs/one-pager.md +24 -0
- package/templates/docs/prd-business.md +61 -0
- package/templates/docs/prd-platform.md +62 -0
- package/templates/docs/prd.md +47 -0
- package/templates/docs/prfaq.md +31 -0
- package/templates/docs/product-intelligence-report.md +31 -0
- package/templates/docs/research-brief.md +29 -0
- package/templates/docs/rfc-platform.md +60 -0
- package/templates/docs/rfc.md +46 -0
- package/templates/docs/runbook.md +33 -0
- package/templates/docs/signal-brief.md +25 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/validator.mjs — <one-line purpose>
|
|
3
|
+
*
|
|
4
|
+
* <2–6 line summary: what it does, who calls it, key side effects.>
|
|
5
|
+
*/
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
8
|
+
import { join, dirname } from 'node:path';
|
|
9
|
+
|
|
10
|
+
const VALID_TIERS = new Set(['reasoning', 'standard', 'fast']);
|
|
11
|
+
const VALID_REASONING_EFFORTS = new Set(['low', 'medium', 'high', 'xhigh']);
|
|
12
|
+
|
|
13
|
+
function hasProviderModelShape(value) {
|
|
14
|
+
return typeof value === 'string' && /^[^\s/]+\/\S+$/.test(value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function validateStringArray(errors, value, label, validValues = null) {
|
|
18
|
+
if (value === undefined) return;
|
|
19
|
+
if (!Array.isArray(value)) {
|
|
20
|
+
errors.push(`${label}: must be an array`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (const [index, item] of value.entries()) {
|
|
24
|
+
if (!item || typeof item !== 'string') {
|
|
25
|
+
errors.push(`${label}[${index}]: must be a non-empty string`);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (validValues && !validValues.has(item)) {
|
|
29
|
+
errors.push(`${label}[${index}]: unknown reference '${item}'`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function validateRegistry(reg, options = {}) {
|
|
35
|
+
const errors = [];
|
|
36
|
+
const rootDir = options.rootDir ?? join(__dirname, '..');
|
|
37
|
+
|
|
38
|
+
if (!reg.version && reg.version !== 0) errors.push('registry: version is missing');
|
|
39
|
+
if (!reg.system) errors.push('registry: system is missing');
|
|
40
|
+
if (!reg.prefix) errors.push('registry: prefix is missing');
|
|
41
|
+
|
|
42
|
+
if (!Array.isArray(reg.agents) || reg.agents.length === 0) {
|
|
43
|
+
errors.push('registry: agents must be a non-empty array');
|
|
44
|
+
}
|
|
45
|
+
if (!Array.isArray(reg.personas) || reg.personas.length === 0) {
|
|
46
|
+
errors.push('registry: personas must be a non-empty array');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const agents = Array.isArray(reg.agents) ? reg.agents : [];
|
|
50
|
+
const personas = Array.isArray(reg.personas) ? reg.personas : [];
|
|
51
|
+
|
|
52
|
+
const allIds = new Set();
|
|
53
|
+
const agentNames = new Set(agents.map((agent) => agent?.name).filter(Boolean));
|
|
54
|
+
|
|
55
|
+
function validateIdentity(entry, kind) {
|
|
56
|
+
const n = entry.name;
|
|
57
|
+
if (!n || typeof n !== 'string') {
|
|
58
|
+
errors.push(`${kind}: name must be a non-empty string`);
|
|
59
|
+
return '(unnamed)';
|
|
60
|
+
}
|
|
61
|
+
if (allIds.has(n)) errors.push(`${n}: duplicate id across agents/personas`);
|
|
62
|
+
allIds.add(n);
|
|
63
|
+
if (!/^[a-z][a-z0-9-]*$/.test(n)) {
|
|
64
|
+
errors.push(`${n}: id must be lowercase kebab-case`);
|
|
65
|
+
}
|
|
66
|
+
return n;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (const agent of agents) {
|
|
70
|
+
const label = validateIdentity(agent, 'agent');
|
|
71
|
+
|
|
72
|
+
if (!agent.description || typeof agent.description !== 'string') {
|
|
73
|
+
errors.push(`${label}: description must be a non-empty string`);
|
|
74
|
+
}
|
|
75
|
+
if (agent.prompt !== undefined && typeof agent.prompt !== 'string') {
|
|
76
|
+
errors.push(`${label}: prompt must be a string when present`);
|
|
77
|
+
}
|
|
78
|
+
if (agent.promptFile !== undefined && typeof agent.promptFile !== 'string') {
|
|
79
|
+
errors.push(`${label}: promptFile must be a string when present`);
|
|
80
|
+
}
|
|
81
|
+
if (!agent.prompt && !agent.promptFile) {
|
|
82
|
+
errors.push(`${label}: must define prompt or promptFile`);
|
|
83
|
+
} else if (agent.promptFile && !existsSync(join(rootDir, agent.promptFile))) {
|
|
84
|
+
errors.push(`${label}: promptFile does not exist (${agent.promptFile})`);
|
|
85
|
+
}
|
|
86
|
+
if (!agent.model && !agent.modelTier) {
|
|
87
|
+
errors.push(`${label}: must define model or modelTier`);
|
|
88
|
+
}
|
|
89
|
+
if (agent.modelTier && !VALID_TIERS.has(agent.modelTier)) {
|
|
90
|
+
errors.push(`${label}: modelTier must be reasoning|standard|fast, got '${agent.modelTier}'`);
|
|
91
|
+
}
|
|
92
|
+
if (agent.model && !hasProviderModelShape(agent.model)) {
|
|
93
|
+
errors.push(`${label}: model must be provider/model-id format`);
|
|
94
|
+
}
|
|
95
|
+
if (agent.reasoningEffort && !VALID_REASONING_EFFORTS.has(agent.reasoningEffort)) {
|
|
96
|
+
errors.push(`${label}: reasoningEffort must be low|medium|high|xhigh`);
|
|
97
|
+
}
|
|
98
|
+
if ('claudeTools' in agent && (!agent.claudeTools || typeof agent.claudeTools !== 'string')) {
|
|
99
|
+
errors.push(`${label}: claudeTools must be a non-empty string when present`);
|
|
100
|
+
}
|
|
101
|
+
validateStringArray(errors, agent.chain, `${label}.chain`, agentNames);
|
|
102
|
+
validateStringArray(errors, agent.alsoInvokes, `${label}.alsoInvokes`, agentNames);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (const persona of personas) {
|
|
106
|
+
const label = validateIdentity(persona, 'persona');
|
|
107
|
+
|
|
108
|
+
if (!persona.description || typeof persona.description !== 'string') {
|
|
109
|
+
errors.push(`${label}: description must be a non-empty string`);
|
|
110
|
+
}
|
|
111
|
+
if (!persona.role || typeof persona.role !== 'string') {
|
|
112
|
+
errors.push(`${label}: role must be a non-empty string`);
|
|
113
|
+
}
|
|
114
|
+
if (!persona.promptFile || typeof persona.promptFile !== 'string') {
|
|
115
|
+
errors.push(`${label}: promptFile must be a non-empty string`);
|
|
116
|
+
} else if (!existsSync(join(rootDir, persona.promptFile))) {
|
|
117
|
+
errors.push(`${label}: promptFile does not exist (${persona.promptFile})`);
|
|
118
|
+
}
|
|
119
|
+
if (!persona.model && !persona.modelTier) {
|
|
120
|
+
errors.push(`${label}: must define model or modelTier`);
|
|
121
|
+
}
|
|
122
|
+
if (persona.modelTier && !VALID_TIERS.has(persona.modelTier)) {
|
|
123
|
+
errors.push(`${label}: modelTier must be reasoning|standard|fast, got '${persona.modelTier}'`);
|
|
124
|
+
}
|
|
125
|
+
if (persona.model && !hasProviderModelShape(persona.model)) {
|
|
126
|
+
errors.push(`${label}: model must be provider/model-id format`);
|
|
127
|
+
}
|
|
128
|
+
if (persona.reasoningEffort && !VALID_REASONING_EFFORTS.has(persona.reasoningEffort)) {
|
|
129
|
+
errors.push(`${label}: reasoningEffort must be low|medium|high|xhigh`);
|
|
130
|
+
}
|
|
131
|
+
validateStringArray(errors, persona.chain, `${label}.chain`, agentNames);
|
|
132
|
+
validateStringArray(errors, persona.alsoInvokes, `${label}.alsoInvokes`, agentNames);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!reg.models || typeof reg.models !== 'object') {
|
|
136
|
+
errors.push('registry: models is missing');
|
|
137
|
+
} else {
|
|
138
|
+
for (const tier of ['reasoning', 'standard', 'fast']) {
|
|
139
|
+
const t = reg.models[tier];
|
|
140
|
+
if (!t || typeof t !== 'object') {
|
|
141
|
+
errors.push(`models.${tier}: tier object is missing`);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (!hasProviderModelShape(t.primary)) {
|
|
145
|
+
errors.push(`models.${tier}: primary must be a string in provider/model-id format`);
|
|
146
|
+
}
|
|
147
|
+
if (!Array.isArray(t.fallback)) {
|
|
148
|
+
errors.push(`models.${tier}: fallback must be an array`);
|
|
149
|
+
} else {
|
|
150
|
+
const tierModels = new Set([t.primary]);
|
|
151
|
+
t.fallback.forEach((entry, i) => {
|
|
152
|
+
if (!hasProviderModelShape(entry)) {
|
|
153
|
+
errors.push(`models.${tier}.fallback[${i}]: must be a string in provider/model-id format`);
|
|
154
|
+
}
|
|
155
|
+
if (tierModels.has(entry)) {
|
|
156
|
+
errors.push(`models.${tier}.fallback[${i}]: duplicate model '${entry}'`);
|
|
157
|
+
}
|
|
158
|
+
tierModels.add(entry);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const summary = `${personas.length} personas, ${agents.length} agents`;
|
|
165
|
+
return { valid: errors.length === 0, errors, summary };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
169
|
+
|
|
170
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
171
|
+
const reg = JSON.parse(readFileSync(join(__dirname, '..', 'agents', 'registry.json'), 'utf8'));
|
|
172
|
+
const result = validateRegistry(reg);
|
|
173
|
+
if (result.valid) {
|
|
174
|
+
console.log(`✓ Registry valid (${result.summary})`);
|
|
175
|
+
process.exit(0);
|
|
176
|
+
} else {
|
|
177
|
+
console.error('Registry validation failed:');
|
|
178
|
+
result.errors.forEach((e, i) => console.error(`${i + 1}. ${e}`));
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
}
|