@moreih29/nexus-core 0.4.0 → 0.5.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.
Files changed (31) hide show
  1. package/conformance/README.md +5 -1
  2. package/conformance/examples/plan.extension.schema.example.json +25 -0
  3. package/conformance/lifecycle/agent-complete.json +2 -1
  4. package/conformance/lifecycle/agent-resume.json +2 -1
  5. package/conformance/lifecycle/agent-spawn.json +7 -4
  6. package/conformance/lifecycle/session-end.json +3 -2
  7. package/conformance/lifecycle/session-start.json +5 -3
  8. package/conformance/scenarios/full-plan-cycle.json +3 -3
  9. package/conformance/schema/fixture.schema.json +3 -3
  10. package/conformance/state-schemas/agent-tracker.schema.json +10 -5
  11. package/conformance/state-schemas/history.schema.json +11 -1
  12. package/conformance/state-schemas/plan.schema.json +5 -0
  13. package/conformance/state-schemas/runtime.schema.json +13 -4
  14. package/conformance/state-schemas/tasks.schema.json +5 -0
  15. package/conformance/tools/plan-decide.json +7 -7
  16. package/conformance/tools/plan-start.json +1 -1
  17. package/conformance/tools/task-add.json +1 -1
  18. package/conformance/tools/task-close.json +2 -0
  19. package/docs/consumer-implementation-guide.md +1 -1
  20. package/docs/nexus-outputs-contract.md +10 -0
  21. package/docs/nexus-tools-contract.md +12 -2
  22. package/manifest.json +55 -55
  23. package/package.json +5 -1
  24. package/scripts/.gitkeep +0 -0
  25. package/scripts/conformance-coverage.ts +466 -0
  26. package/scripts/import-from-claude-nexus.ts +403 -0
  27. package/scripts/lib/frontmatter.ts +71 -0
  28. package/scripts/lib/lint.ts +216 -0
  29. package/scripts/lib/structure.ts +159 -0
  30. package/scripts/lib/validate.ts +668 -0
  31. package/scripts/validate.ts +90 -0
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env bun
2
+
3
+ import path from 'node:path';
4
+ import {
5
+ loadSchemas,
6
+ runAll as runSchemaAndIntegrity,
7
+ type ValidationResult,
8
+ } from './lib/validate.ts';
9
+ import {
10
+ checkHarnessSpecific,
11
+ checkConcreteModel,
12
+ checkPromptOnly,
13
+ checkTagTriggerConsistency,
14
+ } from './lib/lint.ts';
15
+ import {
16
+ checkDirectoryStrict,
17
+ checkIdMatch,
18
+ } from './lib/structure.ts';
19
+
20
+ const IS_GITHUB_ACTIONS = process.env.GITHUB_ACTIONS === 'true';
21
+
22
+ async function main(): Promise<void> {
23
+ const root = process.cwd();
24
+ const allResults: ValidationResult[] = [];
25
+
26
+ // Gate 1-5: schema + referential integrity + manifest generation
27
+ // (runAll internally does per-file fail-forward and generates manifest on success)
28
+ await loadSchemas(root);
29
+ const schemaResults = await runSchemaAndIntegrity(root);
30
+ allResults.push(...schemaResults);
31
+
32
+ // Gate 6: harness-specific tool names
33
+ const harnessResults = await checkHarnessSpecific(root);
34
+ allResults.push(...harnessResults);
35
+
36
+ // Gate 7: concrete model names
37
+ const modelResults = await checkConcreteModel(root);
38
+ allResults.push(...modelResults);
39
+
40
+ // Gate 8: prompt-only enforcement
41
+ const promptOnlyResults = await checkPromptOnly(root);
42
+ allResults.push(...promptOnlyResults);
43
+
44
+ // Gate 9: directory strict
45
+ const dirResults = await checkDirectoryStrict(root);
46
+ allResults.push(...dirResults);
47
+
48
+ // Gate 10: id ↔ directory name + kebab pattern
49
+ const idResults = await checkIdMatch(root);
50
+ allResults.push(...idResults);
51
+
52
+ // Gate 11: tag trigger consistency
53
+ const tagTriggerResults = await checkTagTriggerConsistency(root);
54
+ allResults.push(...tagTriggerResults);
55
+
56
+ // Report
57
+ const errors = allResults.filter((r) => r.severity === 'error');
58
+ const warnings = allResults.filter((r) => r.severity === 'warning');
59
+
60
+ if (allResults.length === 0) {
61
+ console.log('All 11 validation gates passed.');
62
+ return;
63
+ }
64
+
65
+ if (IS_GITHUB_ACTIONS) {
66
+ // GitHub annotations format
67
+ for (const r of allResults) {
68
+ const level = r.severity === 'error' ? 'error' : 'warning';
69
+ const lineAttr = r.line ? `,line=${r.line}` : '';
70
+ console.log(`::${level} file=${r.file}${lineAttr}::[${r.gate}] ${r.message}`);
71
+ }
72
+ } else {
73
+ // Human-readable format
74
+ for (const r of allResults) {
75
+ const loc = r.line ? `${r.file}:${r.line}` : r.file;
76
+ console.log(`${loc} [${r.gate}] ${r.severity.toUpperCase()}: ${r.message}`);
77
+ }
78
+ console.log('');
79
+ console.log(`Summary: ${errors.length} error(s), ${warnings.length} warning(s)`);
80
+ }
81
+
82
+ if (errors.length > 0) {
83
+ process.exit(1);
84
+ }
85
+ }
86
+
87
+ main().catch((err) => {
88
+ console.error('Fatal error in validate.ts:', err);
89
+ process.exit(2);
90
+ });