Add AL code generation skill contracts

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bd6344b4-eafd-4a58-a1c9-5a2d96fa2938
This commit is contained in:
Jesper Schulz-Wedde 2026-07-14 13:43:31 +02:00
parent be1b92b624
commit b0d71418fa
17 changed files with 1885 additions and 39 deletions

View file

@ -0,0 +1,67 @@
{
"output-kind": "generated-files-report",
"contract-version": 1,
"skill": {
"id": "al-code-generation",
"version": 1
},
"outcome": "completed",
"outcome-reason": "Generated the requested create-only AL object from the complete worklist.",
"summary": {
"artifact-count": 1,
"total-content-bytes": 217,
"coverage": {
"candidate-count": 3,
"relevant-count": 1,
"worklist-count": 1,
"opened-article-count": 1,
"opened-good-sample-count": 1,
"opened-bad-sample-count": 0,
"omitted-count": 0
}
},
"knowledge-revision": {
"repository": "https://github.com/microsoft/BCQuality",
"commit-sha": "1111111111111111111111111111111111111111"
},
"assumptions": [
"The requested table is a new object and the consumer will verify the destination does not exist."
],
"artifacts": [
{
"path": "src/SampleApp/Setup/CQSampleSetup.Table.al",
"encoding": "utf-8",
"object-type": "table",
"object-id": 70000,
"object-name": "CQ Sample Setup",
"content": "table 70000 \"CQ Sample Setup\"\n{\n Caption = 'Sample Setup';\n DataClassification = CustomerContent;\n\n fields\n {\n field(1; Enabled; Boolean)\n {\n Caption = 'Enabled';\n }\n }\n}",
"rationale": "Creates the requested bounded setup table with a reserved CQ affix and explicit classification.",
"article-references": [
{
"path": "microsoft/knowledge/appsource/object-affixes-prevent-collisions.md",
"sha": "1111111111111111111111111111111111111111"
}
],
"good-sample-references": [
{
"path": "microsoft/knowledge/appsource/object-affixes-prevent-collisions.good.al",
"sha": "1111111111111111111111111111111111111111"
}
]
}
],
"applied-guidance": [
{
"reference": {
"path": "microsoft/knowledge/appsource/object-affixes-prevent-collisions.md",
"sha": "1111111111111111111111111111111111111111"
},
"artifact-paths": [
"src/SampleApp/Setup/CQSampleSetup.Table.al"
],
"application": "Applied the CQ object-name affix without copying demonstration object IDs or names."
}
],
"omitted-guidance": [],
"suppressed": []
}

View file

@ -0,0 +1,54 @@
{
"schema-version": 1,
"project-root": ".",
"app-root": "src/SampleApp",
"requested-artifacts": [
{
"operation": "create",
"path": "src/SampleApp/Setup/CQSampleSetup.Table.al",
"object-type": "table",
"object-id": 70000,
"object-name": "CQ Sample Setup",
"intent": "Store one setup record with an enabled flag and an appropriate data classification."
}
],
"related-file-allowlist": [
"src/SampleApp/app.json",
"src/SampleApp/Setup/CQSampleSetup.Page.al"
],
"context": {
"countries": [
"w1"
],
"application-areas": [
"all"
]
},
"target": {
"effective-bc-major": 28,
"runtime": "15.0",
"app": {
"id": "11111111-1111-4111-8111-111111111111",
"name": "CQ Sample App",
"publisher": "Contoso",
"version": "1.0.0.0",
"platform": "28.0.0.0",
"application": "28.0.0.0",
"target": "Cloud",
"dependencies": [],
"id-ranges": [
{
"from": 70000,
"to": 70049
}
]
}
},
"generation-settings": {
"context-budget": 24
},
"app-json-provenance": {
"path": "src/SampleApp/app.json",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}

View file

@ -0,0 +1,509 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/microsoft/BCQuality/blob/main/schemas/generated-files-report-v1.schema.json",
"title": "BCQuality generated files report v1",
"type": "object",
"additionalProperties": false,
"required": [
"output-kind",
"contract-version",
"skill",
"outcome",
"outcome-reason",
"summary",
"knowledge-revision",
"assumptions",
"artifacts",
"applied-guidance",
"omitted-guidance",
"suppressed"
],
"properties": {
"output-kind": {
"const": "generated-files-report"
},
"contract-version": {
"const": 1
},
"skill": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"version"
],
"properties": {
"id": {
"const": "al-code-generation"
},
"version": {
"const": 1
}
}
},
"outcome": {
"enum": [
"completed",
"not-applicable",
"no-knowledge",
"partial",
"failed"
]
},
"outcome-reason": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"summary": {
"$ref": "#/$defs/summary"
},
"knowledge-revision": {
"type": "object",
"additionalProperties": false,
"required": [
"repository",
"commit-sha"
],
"properties": {
"repository": {
"type": "string",
"format": "uri",
"pattern": "^https://",
"description": "Immutable-revision repository containing every cited enabled layer, including a fork's custom layer."
},
"commit-sha": {
"$ref": "#/$defs/commitSha"
}
}
},
"assumptions": {
"type": "array",
"maxItems": 64,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 1000
}
},
"artifacts": {
"type": "array",
"maxItems": 64,
"items": {
"$ref": "#/$defs/artifact"
}
},
"applied-guidance": {
"type": "array",
"maxItems": 64,
"items": {
"$ref": "#/$defs/appliedGuidance"
}
},
"omitted-guidance": {
"type": "array",
"maxItems": 64,
"items": {
"$ref": "#/$defs/omittedGuidance"
}
},
"suppressed": {
"type": "array",
"maxItems": 64,
"items": {
"$ref": "#/$defs/suppression"
}
}
},
"allOf": [
{
"if": {
"properties": {
"outcome": {
"const": "completed"
}
},
"required": [
"outcome"
]
},
"then": {
"properties": {
"artifacts": {
"minItems": 1
},
"omitted-guidance": {
"maxItems": 0
}
}
}
},
{
"if": {
"properties": {
"outcome": {
"const": "partial"
}
},
"required": [
"outcome"
]
},
"then": {
"properties": {
"artifacts": {
"minItems": 1
},
"omitted-guidance": {
"minItems": 1
}
}
}
},
{
"if": {
"properties": {
"omitted-guidance": {
"minItems": 1
}
},
"required": [
"omitted-guidance"
]
},
"then": {
"properties": {
"outcome": {
"const": "partial"
}
}
}
},
{
"if": {
"properties": {
"outcome": {
"enum": [
"not-applicable",
"no-knowledge",
"failed"
]
}
},
"required": [
"outcome"
]
},
"then": {
"properties": {
"artifacts": {
"maxItems": 0
}
}
}
}
],
"$defs": {
"commitSha": {
"type": "string",
"pattern": "^[0-9a-f]{40}$"
},
"canonicalAlPath": {
"type": "string",
"minLength": 4,
"maxLength": 512,
"pattern": "^(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.git(?:/|$))[^/\\u0000]+(?:/[^/\\u0000]+)*\\.al$"
},
"knowledgePath": {
"type": "string",
"pattern": "^(microsoft|community|custom)/knowledge/[a-z0-9-]+/[a-z0-9-]+\\.md$"
},
"goodSamplePath": {
"type": "string",
"pattern": "^(microsoft|community|custom)/knowledge/[a-z0-9-]+/[a-z0-9-]+\\.good\\.al$"
},
"objectType": {
"enum": [
"codeunit",
"controladdin",
"enum",
"enumextension",
"interface",
"page",
"pagecustomization",
"pageextension",
"permissionset",
"permissionsetextension",
"profile",
"query",
"report",
"reportextension",
"table",
"tableextension",
"xmlport"
]
},
"revisionScopedArticleReference": {
"type": "object",
"additionalProperties": false,
"required": [
"path",
"sha"
],
"properties": {
"path": {
"$ref": "#/$defs/knowledgePath"
},
"sha": {
"$ref": "#/$defs/commitSha"
}
}
},
"revisionScopedGoodSampleReference": {
"type": "object",
"additionalProperties": false,
"required": [
"path",
"sha"
],
"properties": {
"path": {
"$ref": "#/$defs/goodSamplePath"
},
"sha": {
"$ref": "#/$defs/commitSha"
}
}
},
"coverage": {
"type": "object",
"additionalProperties": false,
"required": [
"candidate-count",
"relevant-count",
"worklist-count",
"opened-article-count",
"opened-good-sample-count",
"opened-bad-sample-count",
"omitted-count"
],
"properties": {
"candidate-count": {
"type": "integer",
"minimum": 0
},
"relevant-count": {
"type": "integer",
"minimum": 0
},
"worklist-count": {
"type": "integer",
"minimum": 0,
"maximum": 64
},
"opened-article-count": {
"type": "integer",
"minimum": 0,
"maximum": 64
},
"opened-good-sample-count": {
"type": "integer",
"minimum": 0,
"maximum": 64
},
"opened-bad-sample-count": {
"type": "integer",
"minimum": 0,
"maximum": 64
},
"omitted-count": {
"type": "integer",
"minimum": 0,
"maximum": 64
}
}
},
"summary": {
"type": "object",
"additionalProperties": false,
"required": [
"artifact-count",
"total-content-bytes",
"coverage"
],
"properties": {
"artifact-count": {
"type": "integer",
"minimum": 0,
"maximum": 64
},
"total-content-bytes": {
"type": "integer",
"minimum": 0,
"maximum": 4194304
},
"coverage": {
"$ref": "#/$defs/coverage"
}
}
},
"artifact": {
"type": "object",
"additionalProperties": false,
"required": [
"path",
"encoding",
"object-type",
"object-id",
"object-name",
"content",
"rationale",
"article-references",
"good-sample-references"
],
"properties": {
"path": {
"$ref": "#/$defs/canonicalAlPath"
},
"encoding": {
"const": "utf-8"
},
"object-type": {
"$ref": "#/$defs/objectType"
},
"object-id": {
"type": "integer",
"minimum": 1,
"maximum": 999999999
},
"object-name": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"content": {
"type": "string",
"minLength": 1,
"maxLength": 262144
},
"rationale": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"article-references": {
"type": "array",
"minItems": 1,
"maxItems": 16,
"uniqueItems": true,
"items": {
"$ref": "#/$defs/revisionScopedArticleReference"
}
},
"good-sample-references": {
"type": "array",
"maxItems": 16,
"uniqueItems": true,
"items": {
"$ref": "#/$defs/revisionScopedGoodSampleReference"
}
}
}
},
"appliedGuidance": {
"type": "object",
"additionalProperties": false,
"required": [
"reference",
"artifact-paths",
"application"
],
"properties": {
"reference": {
"$ref": "#/$defs/revisionScopedArticleReference"
},
"artifact-paths": {
"type": "array",
"minItems": 1,
"maxItems": 64,
"uniqueItems": true,
"items": {
"$ref": "#/$defs/canonicalAlPath"
}
},
"application": {
"type": "string",
"minLength": 1,
"maxLength": 2000
}
}
},
"omittedGuidance": {
"type": "object",
"additionalProperties": false,
"required": [
"reference",
"reason",
"detail"
],
"properties": {
"reference": {
"$ref": "#/$defs/revisionScopedArticleReference"
},
"reason": {
"enum": [
"context-budget",
"article-unavailable",
"article-invalid",
"sample-unavailable",
"allowlist-boundary"
]
},
"detail": {
"type": "string",
"minLength": 1,
"maxLength": 2000
}
}
},
"suppression": {
"type": "object",
"additionalProperties": false,
"required": [
"reference",
"reason"
],
"properties": {
"reference": {
"$ref": "#/$defs/revisionScopedArticleReference"
},
"reason": {
"const": "layer-precedence"
},
"superseded-by": {
"$ref": "#/$defs/revisionScopedArticleReference"
}
},
"allOf": [
{
"if": {
"properties": {
"reason": {
"const": "layer-precedence"
}
},
"required": [
"reason"
]
},
"then": {
"required": [
"superseded-by"
]
}
}
]
}
}
}

View file

@ -0,0 +1,348 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/microsoft/BCQuality/blob/main/schemas/requirement-spec-v1.schema.json",
"title": "BCQuality AL code generation requirement specification v1",
"type": "object",
"additionalProperties": false,
"required": [
"schema-version",
"project-root",
"app-root",
"requested-artifacts",
"related-file-allowlist",
"context",
"target"
],
"properties": {
"schema-version": {
"const": 1
},
"project-root": {
"const": ".",
"description": "Canonical root of the bounded project view."
},
"app-root": {
"anyOf": [
{
"const": "."
},
{
"$ref": "#/$defs/canonicalRelativePath"
}
]
},
"requested-artifacts": {
"type": "array",
"minItems": 1,
"maxItems": 64,
"items": {
"$ref": "#/$defs/requestedArtifact"
}
},
"related-file-allowlist": {
"type": "array",
"maxItems": 1024,
"uniqueItems": true,
"items": {
"$ref": "#/$defs/canonicalRelativePath"
},
"description": "Complete set of existing project-relative files that generation may read."
},
"context": {
"type": "object",
"additionalProperties": false,
"required": [
"countries",
"application-areas"
],
"properties": {
"countries": {
"type": "array",
"minItems": 1,
"maxItems": 32,
"uniqueItems": true,
"items": {
"type": "string",
"pattern": "^(w1|[a-z]{2})$"
},
"allOf": [
{
"if": {
"contains": {
"const": "w1"
}
},
"then": {
"maxItems": 1
}
}
]
},
"application-areas": {
"type": "array",
"minItems": 1,
"maxItems": 64,
"uniqueItems": true,
"items": {
"type": "string",
"pattern": "^(all|[a-z0-9]+(?:-[a-z0-9]+)*)$"
},
"allOf": [
{
"if": {
"contains": {
"const": "all"
}
},
"then": {
"maxItems": 1
}
}
]
}
},
"description": "Explicit applicability context used with normalized BC/runtime metadata."
},
"target": {
"$ref": "#/$defs/target"
},
"generation-settings": {
"type": "object",
"additionalProperties": false,
"properties": {
"context-budget": {
"type": "integer",
"minimum": 1,
"maximum": 64,
"default": 24
}
}
},
"app-json-provenance": {
"type": "object",
"additionalProperties": false,
"required": [
"path",
"sha256"
],
"properties": {
"path": {
"$ref": "#/$defs/canonicalRelativePath"
},
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
}
},
"description": "Optional provenance only. It never substitutes for normalized target metadata."
}
},
"$defs": {
"canonicalRelativePath": {
"type": "string",
"minLength": 1,
"maxLength": 512,
"pattern": "^(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.git(?:/|$))[^/\\u0000]+(?:/[^/\\u0000]+)*$"
},
"canonicalAlPath": {
"type": "string",
"minLength": 4,
"maxLength": 512,
"pattern": "^(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.git(?:/|$))[^/\\u0000]+(?:/[^/\\u0000]+)*\\.al$"
},
"requestedArtifact": {
"type": "object",
"additionalProperties": false,
"required": [
"operation",
"path",
"object-type",
"object-name",
"intent"
],
"properties": {
"operation": {
"const": "create"
},
"path": {
"$ref": "#/$defs/canonicalAlPath"
},
"object-type": {
"enum": [
"codeunit",
"controladdin",
"enum",
"enumextension",
"interface",
"page",
"pagecustomization",
"pageextension",
"permissionset",
"permissionsetextension",
"profile",
"query",
"report",
"reportextension",
"table",
"tableextension",
"xmlport"
]
},
"object-id": {
"type": "integer",
"minimum": 1,
"maximum": 999999999
},
"object-name": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"intent": {
"type": "string",
"minLength": 1,
"maxLength": 2000
}
}
},
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+\\.\\d+$"
},
"runtime": {
"type": "string",
"pattern": "^\\d+\\.\\d+$"
},
"dependency": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"name",
"publisher",
"version"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 250
},
"publisher": {
"type": "string",
"minLength": 1,
"maxLength": 250
},
"version": {
"$ref": "#/$defs/version"
}
}
},
"idRange": {
"type": "object",
"additionalProperties": false,
"required": [
"from",
"to"
],
"properties": {
"from": {
"type": "integer",
"minimum": 1,
"maximum": 999999999
},
"to": {
"type": "integer",
"minimum": 1,
"maximum": 999999999
}
}
},
"target": {
"type": "object",
"additionalProperties": false,
"required": [
"effective-bc-major",
"runtime",
"app"
],
"properties": {
"effective-bc-major": {
"type": "integer",
"minimum": 1,
"maximum": 999
},
"runtime": {
"$ref": "#/$defs/runtime"
},
"app": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"name",
"publisher",
"version",
"platform",
"application",
"target",
"dependencies",
"id-ranges"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 250
},
"publisher": {
"type": "string",
"minLength": 1,
"maxLength": 250
},
"version": {
"$ref": "#/$defs/version"
},
"platform": {
"$ref": "#/$defs/version"
},
"application": {
"$ref": "#/$defs/version"
},
"target": {
"enum": [
"Cloud",
"OnPrem"
]
},
"dependencies": {
"type": "array",
"maxItems": 128,
"uniqueItems": true,
"items": {
"$ref": "#/$defs/dependency"
}
},
"id-ranges": {
"type": "array",
"minItems": 1,
"maxItems": 64,
"uniqueItems": true,
"items": {
"$ref": "#/$defs/idRange"
}
}
}
}
}
}
}
}