agent-doc-system 0.0.0-stage → 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.
Files changed (117) hide show
  1. package/INSTALL_FOR_AGENTS.md +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +151 -2
  4. package/adapters/cache.mjs +27 -0
  5. package/adapters/contract-consumers.mjs +56 -0
  6. package/adapters/database.mjs +116 -0
  7. package/adapters/deploy-config.mjs +34 -0
  8. package/adapters/dockerfile.mjs +26 -0
  9. package/adapters/events.mjs +145 -0
  10. package/adapters/generic.mjs +86 -0
  11. package/adapters/github-actions.mjs +106 -0
  12. package/adapters/go.mjs +91 -0
  13. package/adapters/graphql.mjs +28 -0
  14. package/adapters/index.mjs +55 -0
  15. package/adapters/node.mjs +118 -0
  16. package/adapters/object-store.mjs +64 -0
  17. package/adapters/oidc.mjs +56 -0
  18. package/adapters/openapi.mjs +50 -0
  19. package/adapters/pnpm.mjs +42 -0
  20. package/adapters/protobuf.mjs +35 -0
  21. package/adapters/registry.mjs +27 -0
  22. package/adapters/resource-client.mjs +61 -0
  23. package/adapters/turborepo.mjs +135 -0
  24. package/adapters/typescript.mjs +85 -0
  25. package/adapters/wrangler.mjs +206 -0
  26. package/bin/agentdoc.mjs +478 -0
  27. package/bin/usage.txt +26 -0
  28. package/core/acceptances.mjs +69 -0
  29. package/core/audit.mjs +407 -0
  30. package/core/authority/classes.mjs +39 -0
  31. package/core/authority/engine.mjs +243 -0
  32. package/core/authority/facts.mjs +41 -0
  33. package/core/codes.mjs +119 -0
  34. package/core/compile.mjs +881 -0
  35. package/core/contracts.mjs +121 -0
  36. package/core/derive.mjs +102 -0
  37. package/core/descriptors.mjs +486 -0
  38. package/core/determinism.mjs +95 -0
  39. package/core/discover.mjs +147 -0
  40. package/core/facts.mjs +53 -0
  41. package/core/fsx.mjs +342 -0
  42. package/core/graph.mjs +260 -0
  43. package/core/impact.mjs +175 -0
  44. package/core/indexes.mjs +165 -0
  45. package/core/jsonschema.mjs +298 -0
  46. package/core/observations.mjs +129 -0
  47. package/core/provenance.mjs +83 -0
  48. package/core/query.mjs +384 -0
  49. package/core/relations.mjs +286 -0
  50. package/core/scaffold.mjs +322 -0
  51. package/core/secrets.mjs +92 -0
  52. package/core/sourcescan.mjs +88 -0
  53. package/core/toml.mjs +163 -0
  54. package/core/yaml.mjs +475 -0
  55. package/docs/ADAPTERS.md +172 -0
  56. package/docs/AUTHORITY.md +260 -0
  57. package/docs/CI.md +136 -0
  58. package/docs/COMPARISON-KODA.md +164 -0
  59. package/docs/EVALS.md +166 -0
  60. package/docs/MIGRATION.md +193 -0
  61. package/docs/PROVENANCE.md +133 -0
  62. package/docs/QUERY.md +180 -0
  63. package/docs/SPEC.md +339 -0
  64. package/docs/VERIFICATION.md +28 -0
  65. package/docs/ci/generic-ci.sh +28 -0
  66. package/docs/ci/github-actions.yml +35 -0
  67. package/evals/harness.mjs +426 -0
  68. package/evals/scenarios/fixture-a-01-change-api.json +9 -0
  69. package/evals/scenarios/fixture-a-02-change-db.json +9 -0
  70. package/evals/scenarios/fixture-a-03-enforce-constraint.json +9 -0
  71. package/evals/scenarios/fixture-b-01-change-proto.json +9 -0
  72. package/evals/scenarios/fixture-b-02-change-write-path.json +9 -0
  73. package/evals/scenarios/fixture-b-03-change-shared-lib.json +9 -0
  74. package/evals/scenarios/fixture-b-04-journey.json +9 -0
  75. package/evals/scenarios/fixture-c-01-mixed-runtime-edge.json +19 -0
  76. package/evals/scenarios/fixture-c-02-stale-doc-contradiction.json +9 -0
  77. package/evals/scenarios/fixture-c-03-shared-vocabulary.json +9 -0
  78. package/evals/scenarios/fixture-c-04-contract-change.json +9 -0
  79. package/evals/scenarios/koda-01-modify-api-consumer.json +26 -0
  80. package/evals/scenarios/koda-02-change-db-schema.json +20 -0
  81. package/evals/scenarios/koda-03-change-auth.json +21 -0
  82. package/evals/scenarios/koda-04-add-event-producer.json +19 -0
  83. package/evals/scenarios/koda-05-modify-worker-binding.json +25 -0
  84. package/evals/scenarios/koda-06-change-cross-component-endpoint.json +22 -0
  85. package/evals/scenarios/koda-07-change-shared-package.json +16 -0
  86. package/evals/scenarios/koda-08-change-runtime-cron.json +23 -0
  87. package/evals/scenarios/koda-09-debug-production-mismatch.json +26 -0
  88. package/evals/thresholds.json +11 -0
  89. package/package.json +46 -4
  90. package/schemas/api.schema.json +84 -0
  91. package/schemas/common.schema.json +107 -0
  92. package/schemas/component.schema.json +40 -0
  93. package/schemas/config.schema.json +685 -0
  94. package/schemas/domain.schema.json +14 -0
  95. package/schemas/graph.schema.json +1084 -0
  96. package/schemas/journeys.schema.json +47 -0
  97. package/schemas/observation.schema.json +143 -0
  98. package/schemas/resource.schema.json +28 -0
  99. package/schemas/system.schema.json +26 -0
  100. package/skills/agent-doc-system/SKILL.md +113 -0
  101. package/skills/agent-doc-system/references/authority-and-conflicts.md +70 -0
  102. package/skills/agent-doc-system/references/cli.md +89 -0
  103. package/skills/agent-doc-system/references/create-migrate.md +101 -0
  104. package/skills/agent-doc-system/references/maintenance.md +52 -0
  105. package/templates/ADR.md +26 -0
  106. package/templates/ARCHITECTURE.md +19 -0
  107. package/templates/CONSTRAINTS.md +17 -0
  108. package/templates/PRODUCT.md +17 -0
  109. package/templates/api.yaml +10 -0
  110. package/templates/ci.yml +31 -0
  111. package/templates/component.yaml +14 -0
  112. package/templates/domain.yaml +6 -0
  113. package/templates/journey.yaml +7 -0
  114. package/templates/observation.yaml +19 -0
  115. package/templates/resource.yaml +8 -0
  116. package/templates/system.yaml +10 -0
  117. package/templates/warning-acceptance.yaml +14 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "id": "koda-05",
3
+ "repository": "koda",
4
+ "title": "Modify a scheduler worker binding",
5
+ "touch": [
6
+ "workers/koda-cron/wrangler.toml"
7
+ ],
8
+ "truth": [
9
+ "component:default/koda-cron",
10
+ "constraint:workers/koda-cron/CONSTRAINTS.md",
11
+ "doc:workers/koda-cron/README.md",
12
+ "observation:production",
13
+ "conflict:binding.declared",
14
+ "conflict:binding.kind"
15
+ ],
16
+ "critical": [
17
+ "constraint:workers/koda-cron/CONSTRAINTS.md",
18
+ "observation:production",
19
+ "conflict:binding.declared",
20
+ "conflict:binding.kind"
21
+ ],
22
+ "verification": [
23
+ "verify:turbo run test --filter=@koda/koda-cron"
24
+ ]
25
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "koda-06",
3
+ "repository": "koda",
4
+ "title": "Change the canonical teacher ingest contract",
5
+ "touch": [
6
+ "contracts/teacher-ingest.openapi.yaml"
7
+ ],
8
+ "truth": [
9
+ "api:default/teacher-ingest-api",
10
+ "component:default/teacher",
11
+ "component:default/learning-event-relay",
12
+ "provides:api:default/teacher-ingest-api",
13
+ "provider:component:default/teacher"
14
+ ],
15
+ "critical": [
16
+ "provides:api:default/teacher-ingest-api"
17
+ ],
18
+ "verification": [
19
+ "verify:turbo run test --filter=@koda/teacher",
20
+ "verify:pnpm --filter @koda/teacher test"
21
+ ]
22
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "koda-07",
3
+ "repository": "koda",
4
+ "title": "Change the shared lesson vocabulary package",
5
+ "touch": [
6
+ "packages/lesson-canon/src/events.ts"
7
+ ],
8
+ "truth": [
9
+ "component:default/lesson-canon",
10
+ "component:default/teacher",
11
+ "component:default/koda-cron",
12
+ "doc:packages/lesson-canon/README.md"
13
+ ],
14
+ "critical": [],
15
+ "verification": []
16
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "id": "koda-08",
3
+ "repository": "koda",
4
+ "title": "Change the scheduled trigger expression",
5
+ "touch": [
6
+ "workers/koda-cron/wrangler.toml"
7
+ ],
8
+ "truth": [
9
+ "component:default/koda-cron",
10
+ "component:default/calendar",
11
+ "conflict:schedule.cron",
12
+ "observation:production",
13
+ "constraint:workers/koda-cron/CONSTRAINTS.md"
14
+ ],
15
+ "critical": [
16
+ "conflict:schedule.cron",
17
+ "observation:production",
18
+ "constraint:workers/koda-cron/CONSTRAINTS.md"
19
+ ],
20
+ "verification": [
21
+ "verify:turbo run test --filter=@koda/koda-cron"
22
+ ]
23
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "koda-09",
3
+ "repository": "koda",
4
+ "title": "Debug why the nightly digest does not fire in production",
5
+ "touch": [
6
+ "workers/koda-cron/src/jobs.ts"
7
+ ],
8
+ "truth": [
9
+ "component:default/koda-cron",
10
+ "component:default/calendar",
11
+ "component:default/notifications",
12
+ "conflict:schedule.cron",
13
+ "conflict:schedule.target",
14
+ "observation:production",
15
+ "constraint:workers/koda-cron/CONSTRAINTS.md"
16
+ ],
17
+ "critical": [
18
+ "conflict:schedule.cron",
19
+ "conflict:schedule.target",
20
+ "observation:production",
21
+ "constraint:workers/koda-cron/CONSTRAINTS.md"
22
+ ],
23
+ "verification": [
24
+ "verify:turbo run test --filter=@koda/koda-cron"
25
+ ]
26
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "_comment": "PRE-REGISTERED THRESHOLDS. Fixed before any scenario was executed against any repository. Moving a number here to convert a FAIL into a PASS invalidates the evaluation.",
3
+ "_registered_at": "2026-09-28",
4
+ "minRecall": 0.9,
5
+ "minCriticalRecall": 0.95,
6
+ "minVerificationRecall": 0.8,
7
+ "minPrecision": 0.75,
8
+ "maxNoise": 0.6,
9
+ "minRetrievalReduction": 0.4,
10
+ "minRecallOverBaseline": 0.9
11
+ }
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "agent-doc-system",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Portable documentation and software-catalog system with an explicit authority model, for AI coding agents",
6
+ "keywords": [
7
+ "agentdoc",
8
+ "software-catalog",
9
+ "documentation",
10
+ "ai-agents",
11
+ "architecture",
12
+ "cli"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/lbframe/agent-doc-system.git"
17
+ },
18
+ "homepage": "https://github.com/lbframe/agent-doc-system",
19
+ "bugs": "https://github.com/lbframe/agent-doc-system/issues",
20
+ "bin": {
21
+ "agentdoc": "./bin/agentdoc.mjs"
22
+ },
23
+ "engines": {
24
+ "node": ">=22"
25
+ },
26
+ "scripts": {
27
+ "test": "node --test tests/*.test.mjs",
28
+ "eval": "node evals/run-all.mjs",
29
+ "selfcheck": "node bin/agentdoc.mjs doctor",
30
+ "compare": "python3 scripts/compare-koda.py"
31
+ },
32
+ "dependencies": {},
33
+ "devDependencies": {},
34
+ "files": [
35
+ "adapters",
36
+ "bin",
37
+ "core",
38
+ "docs",
39
+ "evals/harness.mjs",
40
+ "evals/scenarios",
41
+ "evals/thresholds.json",
42
+ "schemas",
43
+ "skills",
44
+ "templates",
45
+ "INSTALL_FOR_AGENTS.md"
46
+ ],
47
+ "license": "MIT"
48
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agentdoc.dev/schema/api.schema.json",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "apiVersion",
8
+ "kind",
9
+ "metadata",
10
+ "spec"
11
+ ],
12
+ "properties": {
13
+ "apiVersion": {
14
+ "const": "agentdoc.dev/v1"
15
+ },
16
+ "kind": {
17
+ "const": "API"
18
+ },
19
+ "metadata": {
20
+ "$ref": "common.json#/$defs/metadata"
21
+ },
22
+ "spec": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": [
26
+ "type",
27
+ "provider",
28
+ "contract"
29
+ ],
30
+ "properties": {
31
+ "type": {
32
+ "enum": [
33
+ "openapi",
34
+ "asyncapi",
35
+ "protobuf",
36
+ "graphql",
37
+ "oidc",
38
+ "grpc-json",
39
+ "graphql-sdl"
40
+ ]
41
+ },
42
+ "provider": {
43
+ "$ref": "common.json#/$defs/componentRef"
44
+ },
45
+ "contract": {
46
+ "$ref": "#/$defs/contract"
47
+ },
48
+ "consumers": {
49
+ "description": "Optional reviewed consumer list. Discovery-derived consumers win; this is for consumers a deterministic extractor cannot see.",
50
+ "type": "array",
51
+ "maxItems": 64,
52
+ "uniqueItems": true,
53
+ "items": {
54
+ "$ref": "common.json#/$defs/componentRef"
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "extensions": {
60
+ "$ref": "common.json#/$defs/extensions"
61
+ }
62
+ },
63
+ "$defs": {
64
+ "contract": {
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "minProperties": 1,
68
+ "properties": {
69
+ "ref": {
70
+ "$ref": "common.json#/$defs/repoPath"
71
+ },
72
+ "standard": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "maxLength": 120
76
+ },
77
+ "discoveryPath": {
78
+ "type": "string",
79
+ "pattern": "^/[^?#\\s]*$"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agentdoc.dev/schema/common.json",
4
+ "$defs": {
5
+ "name": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 63,
9
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
10
+ },
11
+ "description": {
12
+ "type": "string",
13
+ "minLength": 1,
14
+ "maxLength": 280,
15
+ "pattern": "\\S"
16
+ },
17
+ "rationale": {
18
+ "type": "string",
19
+ "minLength": 1,
20
+ "maxLength": 600,
21
+ "pattern": "\\S"
22
+ },
23
+ "entityRef": {
24
+ "type": "string",
25
+ "pattern": "^(domain|system|component|api|resource):[a-z0-9][a-z0-9-]*/[a-z0-9]+(?:-[a-z0-9]+)*$"
26
+ },
27
+ "componentRef": { "$ref": "#/$defs/entityRef" },
28
+ "apiRef": { "$ref": "#/$defs/entityRef" },
29
+ "repoPath": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 300,
33
+ "pattern": "^[^\\s\\\\][^\\s]*$"
34
+ },
35
+ "namespace": {
36
+ "type": "string",
37
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
38
+ "minLength": 1,
39
+ "maxLength": 40
40
+ },
41
+ "metadata": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["name", "description"],
45
+ "properties": {
46
+ "name": { "$ref": "#/$defs/name" },
47
+ "description": { "$ref": "#/$defs/description" },
48
+ "labels": {
49
+ "type": "object",
50
+ "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 120 }
51
+ }
52
+ }
53
+ },
54
+ "evidence": {
55
+ "type": "array",
56
+ "minItems": 1,
57
+ "maxItems": 12,
58
+ "uniqueItems": true,
59
+ "items": {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "required": ["path", "sha256"],
63
+ "properties": {
64
+ "path": { "$ref": "#/$defs/repoPath" },
65
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
66
+ }
67
+ }
68
+ },
69
+ "warningAcceptance": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": ["code", "subject", "classification", "reason", "reviewWhen", "observedRefs", "evidence"],
73
+ "properties": {
74
+ "code": { "type": "string", "pattern": "^AGENTDOC_[A-Z_]+$" },
75
+ "subject": { "type": "string", "minLength": 1, "maxLength": 400, "pattern": "^\\S+$" },
76
+ "classification": { "type": "string", "pattern": "^[A-Z]+(?:_[A-Z]+)*$" },
77
+ "reason": { "$ref": "#/$defs/rationale" },
78
+ "reviewWhen": { "$ref": "#/$defs/rationale" },
79
+ "observedRefs": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/entityRef" } },
80
+ "evidence": { "$ref": "#/$defs/evidence" }
81
+ }
82
+ },
83
+ "context": {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "properties": {
87
+ "docs": {
88
+ "type": "array", "minItems": 1, "maxItems": 12, "uniqueItems": true,
89
+ "items": { "$ref": "#/$defs/repoPath" }
90
+ },
91
+ "constraints": {
92
+ "type": "array", "minItems": 1, "maxItems": 12, "uniqueItems": true,
93
+ "items": { "$ref": "#/$defs/repoPath" }
94
+ },
95
+ "runbooks": {
96
+ "type": "array", "minItems": 1, "maxItems": 12, "uniqueItems": true,
97
+ "items": { "$ref": "#/$defs/repoPath" }
98
+ }
99
+ }
100
+ },
101
+ "extensions": {
102
+ "type": "object",
103
+ "description": "Forward-evolution escape hatch. Core validators ignore these keys.",
104
+ "additionalProperties": true
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agentdoc.dev/schema/component.schema.json",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["apiVersion", "kind", "metadata", "spec"],
7
+ "properties": {
8
+ "apiVersion": { "const": "agentdoc.dev/v1" },
9
+ "kind": { "const": "Component" },
10
+ "metadata": { "$ref": "common.json#/$defs/metadata" },
11
+ "spec": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["type"],
15
+ "properties": {
16
+ "type": {
17
+ "enum": ["service", "worker", "job", "library", "contract-library", "web-app", "static-site", "cli", "infrastructure", "other"]
18
+ },
19
+ "system": { "$ref": "common.json#/$defs/name" },
20
+ "domain": { "$ref": "common.json#/$defs/name" },
21
+ "placementRationale": { "$ref": "common.json#/$defs/rationale" },
22
+ "repositories": {
23
+ "type": "array",
24
+ "minItems": 1,
25
+ "maxItems": 12,
26
+ "uniqueItems": true,
27
+ "description": "Published artifacts or remotes this component is consumed through.",
28
+ "items": { "$ref": "common.json#/$defs/repoPath" }
29
+ },
30
+ "context": { "$ref": "common.json#/$defs/context" }
31
+ },
32
+ "oneOf": [
33
+ { "required": ["system"], "not": { "anyOf": [{ "required": ["domain"] }, { "required": ["placementRationale"] }] } },
34
+ { "required": ["domain"], "not": { "anyOf": [{ "required": ["system"] }, { "required": ["placementRationale"] }] } },
35
+ { "required": ["placementRationale"], "not": { "anyOf": [{ "required": ["system"] }, { "required": ["domain"] }] } }
36
+ ]
37
+ },
38
+ "extensions": { "$ref": "common.json#/$defs/extensions" }
39
+ }
40
+ }