gh-inari 0.3.0 → 0.5.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.
- package/README.md +97 -13
- package/dist/artifact.d.ts +1 -1
- package/dist/artifact.js +1 -1
- package/dist/artifact.js.map +1 -1
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +497 -47
- package/dist/cli.js.map +1 -1
- package/dist/github/adapter.js +15 -4
- package/dist/github/adapter.js.map +1 -1
- package/dist/github/transport.js +10 -8
- package/dist/github/transport.js.map +1 -1
- package/dist/governance.d.ts +41 -5
- package/dist/governance.js +190 -15
- package/dist/governance.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pr-policy.js +109 -1
- package/dist/pr-policy.js.map +1 -1
- package/dist/pull-request-template.js +5 -1
- package/dist/pull-request-template.js.map +1 -1
- package/dist/reconciliation.d.ts +65 -0
- package/dist/reconciliation.js +274 -0
- package/dist/reconciliation.js.map +1 -0
- package/dist/semantic-template.d.ts +107 -0
- package/dist/semantic-template.js +1151 -0
- package/dist/semantic-template.js.map +1 -0
- package/gh-inari +7 -6
- package/package.json +26 -20
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type CanonicalContract } from "./contract/ir.js";
|
|
2
|
+
import { type TemplateSelector } from "./template-discovery.js";
|
|
3
|
+
export declare const SEMANTIC_TEMPLATE_VERSION: 1;
|
|
4
|
+
export declare const SEMANTIC_TEMPLATE_DIRECTORY: ".github/inari";
|
|
5
|
+
export declare const SEMANTIC_ISSUE_DIRECTORY: ".github/inari/issues";
|
|
6
|
+
export declare const SEMANTIC_PULL_REQUEST_FILE: ".github/inari/pull-request.json";
|
|
7
|
+
export declare const GENERATED_TEMPLATE_NOTICE: "Generated by gh-inari from .github/inari; do not edit.";
|
|
8
|
+
export type SemanticTemplateKind = "issue" | "pull_request";
|
|
9
|
+
export type SemanticInputType = "string" | "enum" | "array" | "checklist";
|
|
10
|
+
export interface SemanticOption {
|
|
11
|
+
readonly id?: string;
|
|
12
|
+
readonly value?: string;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
readonly required?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SemanticSection {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly kind: "input" | "documentation";
|
|
20
|
+
readonly type?: SemanticInputType;
|
|
21
|
+
readonly label?: string;
|
|
22
|
+
readonly description?: string;
|
|
23
|
+
readonly content?: string;
|
|
24
|
+
readonly required?: boolean;
|
|
25
|
+
readonly element?: "input" | "textarea" | "dropdown" | "checkboxes";
|
|
26
|
+
readonly placeholder?: string;
|
|
27
|
+
readonly defaultValue?: string | readonly string[];
|
|
28
|
+
readonly render?: string;
|
|
29
|
+
readonly multiple?: boolean;
|
|
30
|
+
readonly options?: readonly SemanticOption[];
|
|
31
|
+
readonly minLength?: number;
|
|
32
|
+
readonly maxLength?: number;
|
|
33
|
+
readonly pattern?: string;
|
|
34
|
+
readonly minItems?: number;
|
|
35
|
+
readonly maxItems?: number;
|
|
36
|
+
readonly headingLevel?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SemanticTemplateSource {
|
|
39
|
+
readonly version: typeof SEMANTIC_TEMPLATE_VERSION;
|
|
40
|
+
readonly kind: SemanticTemplateKind;
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly description?: string;
|
|
44
|
+
readonly title?: string;
|
|
45
|
+
readonly labels?: readonly string[];
|
|
46
|
+
readonly sections: readonly SemanticSection[];
|
|
47
|
+
}
|
|
48
|
+
export interface SemanticTemplateIdentity {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly kind: SemanticTemplateKind;
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly sourcePath: string;
|
|
53
|
+
readonly generatedPath: string;
|
|
54
|
+
}
|
|
55
|
+
export interface SemanticTemplateDocument extends SemanticTemplateIdentity {
|
|
56
|
+
readonly source: SemanticTemplateSource;
|
|
57
|
+
}
|
|
58
|
+
export type SemanticTemplateErrorCode = "SEMANTIC_TEMPLATE_INVALID_JSON" | "SEMANTIC_TEMPLATE_INVALID_ROOT" | "SEMANTIC_TEMPLATE_UNKNOWN_PROPERTY" | "SEMANTIC_TEMPLATE_UNSUPPORTED_VERSION" | "SEMANTIC_TEMPLATE_INVALID_VALUE" | "SEMANTIC_TEMPLATE_UNSUPPORTED_FIELD" | "SEMANTIC_TEMPLATE_AMBIGUOUS" | "SEMANTIC_TEMPLATE_DRIFT" | "SEMANTIC_TEMPLATE_SOURCE_ERROR";
|
|
59
|
+
export interface SemanticTemplateViolation {
|
|
60
|
+
readonly code: SemanticTemplateErrorCode;
|
|
61
|
+
readonly path: string;
|
|
62
|
+
readonly message: string;
|
|
63
|
+
}
|
|
64
|
+
export declare class SemanticTemplateError extends Error {
|
|
65
|
+
readonly code: SemanticTemplateErrorCode;
|
|
66
|
+
readonly path: string;
|
|
67
|
+
readonly violations: readonly SemanticTemplateViolation[];
|
|
68
|
+
constructor(violations: readonly SemanticTemplateViolation[], options?: ErrorOptions);
|
|
69
|
+
toJSON(): {
|
|
70
|
+
code: SemanticTemplateErrorCode;
|
|
71
|
+
path: string;
|
|
72
|
+
message: string;
|
|
73
|
+
violations: readonly SemanticTemplateViolation[];
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export interface SemanticTemplateSyncResult {
|
|
77
|
+
readonly check: boolean;
|
|
78
|
+
readonly changed: boolean;
|
|
79
|
+
readonly written: readonly string[];
|
|
80
|
+
readonly drift: readonly string[];
|
|
81
|
+
readonly staleGenerated: readonly string[];
|
|
82
|
+
readonly generated: readonly string[];
|
|
83
|
+
}
|
|
84
|
+
/** Find semantic contracts without reading their contents. */
|
|
85
|
+
export declare function discoverSemanticTemplates(repositoryRoot?: string | URL): Promise<readonly SemanticTemplateIdentity[]>;
|
|
86
|
+
/** Synchronous counterpart used by bounded governance and tooling callers. */
|
|
87
|
+
export declare function discoverSemanticTemplatesSync(repositoryRoot?: string | URL): readonly SemanticTemplateIdentity[];
|
|
88
|
+
export declare function readSemanticTemplate(repositoryRoot: string | URL, identity: SemanticTemplateIdentity): Promise<SemanticTemplateDocument>;
|
|
89
|
+
export declare function readSemanticTemplateSync(repositoryRoot: string | URL, identity: SemanticTemplateIdentity): SemanticTemplateDocument;
|
|
90
|
+
export declare function parseSemanticTemplate(serialized: string, sourcePath?: string): SemanticTemplateSource;
|
|
91
|
+
export declare function normalizeSemanticTemplate(value: unknown, sourcePath?: string): SemanticTemplateSource;
|
|
92
|
+
export declare function compileSemanticTemplate(repositoryRoot: string | URL, document: SemanticTemplateDocument): Promise<CanonicalContract>;
|
|
93
|
+
export declare function compileSemanticTemplateSync(repositoryRoot: string | URL, document: SemanticTemplateDocument): CanonicalContract;
|
|
94
|
+
/** Compile an already trusted semantic source without consulting the filesystem. */
|
|
95
|
+
export declare function compileSemanticTemplateSource(source: SemanticTemplateSource, generatedPath: string): CanonicalContract;
|
|
96
|
+
/** Render one semantic contract to the committed native GitHub projection. */
|
|
97
|
+
export declare function renderSemanticNative(source: SemanticTemplateSource, generatedPath: string): string;
|
|
98
|
+
export declare function renderSemanticCompactSchema(contract: unknown): unknown;
|
|
99
|
+
export declare function syncSemanticTemplates(repositoryRoot?: string | URL, check?: boolean): Promise<SemanticTemplateSyncResult>;
|
|
100
|
+
export declare function importNativeTemplate(repositoryRoot: string | URL, nativePath: string, destinationPath?: string): Promise<{
|
|
101
|
+
readonly path: string;
|
|
102
|
+
readonly source: SemanticTemplateSource;
|
|
103
|
+
readonly warning?: string;
|
|
104
|
+
}>;
|
|
105
|
+
export declare function semanticSourceFromContract(contractInput: unknown): SemanticTemplateSource;
|
|
106
|
+
export declare function selectSemanticTemplate(identities: readonly SemanticTemplateIdentity[], kind: SemanticTemplateKind, selector?: string | TemplateSelector): SemanticTemplateIdentity;
|
|
107
|
+
export declare function semanticTemplateGeneratedPath(kind: SemanticTemplateKind, id: string): string;
|