@maycombhq/sdk 2.0.0-beta.1 → 2.0.0-beta.11
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/{dist → npm}/cache.d.ts +1 -1
- package/npm/core/api.d.ts +7964 -0
- package/npm/core/assistant-actor.d.ts +15 -0
- package/npm/core/audit.d.ts +153 -0
- package/npm/core/branches.d.ts +21 -0
- package/npm/core/cancel.d.ts +9 -0
- package/npm/core/catalog.d.ts +4735 -0
- package/npm/core/change-types-migrate.d.ts +10 -0
- package/npm/core/cite.d.ts +54 -0
- package/npm/core/contract-check.d.ts +251 -0
- package/npm/core/curated.d.ts +37 -0
- package/npm/core/fact-paths.d.ts +14 -0
- package/npm/core/facts-callers.d.ts +152 -0
- package/npm/core/facts-carry.d.ts +36 -0
- package/npm/core/facts-join-prototype.d.ts +239 -0
- package/npm/core/facts-join-vendor.d.ts +110 -0
- package/npm/core/facts-join.d.ts +482 -0
- package/npm/core/facts-terms.d.ts +108 -0
- package/npm/core/facts.d.ts +94 -0
- package/npm/core/fs.d.ts +47 -0
- package/npm/core/gates-migrate.d.ts +10 -0
- package/npm/core/host-questions.d.ts +111 -0
- package/npm/core/identity.d.ts +17 -0
- package/npm/core/index.d.ts +77 -0
- package/npm/core/json-schema.d.ts +20 -0
- package/npm/core/judgments.d.ts +63 -0
- package/npm/core/light.d.ts +8 -0
- package/npm/core/link-evidence.d.ts +212 -0
- package/npm/core/log.d.ts +49 -0
- package/npm/core/manifest-edit.d.ts +57 -0
- package/npm/core/merge.d.ts +85 -0
- package/npm/core/metarepo.d.ts +91 -0
- package/npm/core/migrate.d.ts +32 -0
- package/npm/core/migration-files.d.ts +13 -0
- package/npm/core/org-notes.d.ts +180 -0
- package/npm/core/orgpack-defaults.d.ts +199 -0
- package/npm/core/orgpack-load.d.ts +102 -0
- package/npm/core/profile-migrate.d.ts +11 -0
- package/npm/core/question-order.d.ts +23 -0
- package/npm/core/question-owners.d.ts +53 -0
- package/npm/core/question-proposals.d.ts +77 -0
- package/npm/core/questions.d.ts +312 -0
- package/npm/core/record-cache.d.ts +52 -0
- package/npm/core/refs.d.ts +9 -0
- package/npm/core/repo-description.d.ts +44 -0
- package/npm/core/repo-reads.d.ts +44 -0
- package/npm/core/roles-migrate.d.ts +9 -0
- package/npm/core/runtime-migrate.d.ts +11 -0
- package/npm/core/schema/ai.d.ts +397 -0
- package/npm/core/schema/change.d.ts +244 -0
- package/npm/core/schema/common.d.ts +135 -0
- package/npm/core/schema/conventions.d.ts +80 -0
- package/npm/core/schema/dialect.d.ts +801 -0
- package/npm/core/schema/executors.d.ts +396 -0
- package/npm/core/schema/fact-corrections.d.ts +56 -0
- package/npm/core/schema/facts.d.ts +1773 -0
- package/npm/core/schema/frameworks.d.ts +371 -0
- package/npm/core/schema/judgment.d.ts +77 -0
- package/npm/core/schema/kinds.d.ts +5168 -0
- package/npm/core/schema/layout.d.ts +25 -0
- package/npm/core/schema/orgpack.d.ts +1193 -0
- package/npm/core/schema/plugin.d.ts +73 -0
- package/npm/core/schema/question.d.ts +230 -0
- package/npm/core/schema/repo-type.d.ts +127 -0
- package/npm/core/schema/review.d.ts +558 -0
- package/npm/core/schema/scan-settings.d.ts +34 -0
- package/npm/core/schema/scan-verify.d.ts +535 -0
- package/npm/core/schema/spec.d.ts +269 -0
- package/npm/core/schema/version.d.ts +10 -0
- package/npm/core/schema/workspace.d.ts +330 -0
- package/npm/core/serialize.d.ts +17 -0
- package/npm/core/shared-maps.d.ts +146 -0
- package/npm/core/sources-migrate.d.ts +15 -0
- package/npm/core/specs.d.ts +66 -0
- package/npm/core/stack-helpers.d.ts +32 -0
- package/npm/core/tar-read.d.ts +13 -0
- package/npm/core/template.d.ts +101 -0
- package/npm/core/words.d.ts +13 -0
- package/npm/core/zip-read.d.ts +37 -0
- package/npm/core/zip.d.ts +13 -0
- package/npm/index.js +10097 -0
- package/{dist → npm}/plugin.d.ts +1 -1
- package/{dist → npm}/runner.d.ts +1 -1
- package/package.json +10 -11
- package/dist/cache.js +0 -115
- package/dist/cache.js.map +0 -1
- package/dist/fs-repo.js +0 -120
- package/dist/fs-repo.js.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/parse-cache.js +0 -275
- package/dist/parse-cache.js.map +0 -1
- package/dist/plugin.js +0 -85
- package/dist/plugin.js.map +0 -1
- package/dist/runner.js +0 -209
- package/dist/runner.js.map +0 -1
- package/dist/sandbox.js +0 -443
- package/dist/sandbox.js.map +0 -1
- /package/{dist → npm}/fs-repo.d.ts +0 -0
- /package/{dist → npm}/index.d.ts +0 -0
- /package/{dist → npm}/parse-cache.d.ts +0 -0
- /package/{dist → npm}/sandbox.d.ts +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
export declare const DEFAULT_CHANGE_TYPES: {
|
|
2
|
+
schemaVersion: 1 | 2;
|
|
3
|
+
types: {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
phases: ("release" | "design" | "qa" | "define" | "plan" | "build")[];
|
|
7
|
+
artifacts: ("interfaces" | "data" | "ux" | "brief" | "proposal" | "specs" | "mappings" | "design" | "stories" | "tasks" | "snow")[];
|
|
8
|
+
lenses: ("true" | "complete" | "safe" | "ship" | "business" | "architecture" | "story" | "ux" | "delivery" | "code-and-test" | "release")[];
|
|
9
|
+
approvals: Partial<Record<"release" | "design" | "qa" | "define" | "plan" | "build", string[]>>;
|
|
10
|
+
postReleaseReview: boolean;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
size?: "small" | "standard" | undefined;
|
|
13
|
+
smallWhenBriefSays?: boolean | undefined;
|
|
14
|
+
fastGate?: string | undefined;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
export declare const DEFAULT_GATES: {
|
|
18
|
+
schemaVersion: 1 | 2;
|
|
19
|
+
gates: {
|
|
20
|
+
id: string;
|
|
21
|
+
phase: "release" | "design" | "qa" | "define" | "plan" | "build";
|
|
22
|
+
approvers: string[];
|
|
23
|
+
minApprovals: number;
|
|
24
|
+
checklists: string[];
|
|
25
|
+
checks: {
|
|
26
|
+
check: string;
|
|
27
|
+
params: Record<string, unknown>;
|
|
28
|
+
}[];
|
|
29
|
+
maxAuthorRounds?: number | "unlimited" | undefined;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
export declare const DEFAULT_ROLES: {
|
|
33
|
+
schemaVersion: 1 | 2;
|
|
34
|
+
teams: {
|
|
35
|
+
id: string;
|
|
36
|
+
people: string[];
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
}[];
|
|
39
|
+
custom: {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
basedOn: "product-owner" | "business-analyst" | "architect" | "team-lead" | "developer" | "qa" | "delivery-lead" | "platform-lead" | "designer" | "process-owner" | "data-architect" | "sre" | "security-reviewer";
|
|
43
|
+
}[];
|
|
44
|
+
enabledOptional: ("process-owner" | "data-architect" | "sre" | "security-reviewer")[];
|
|
45
|
+
mappings: {
|
|
46
|
+
group: string;
|
|
47
|
+
role: string;
|
|
48
|
+
}[];
|
|
49
|
+
approvals: Partial<Record<"release-go-no-go" | "waiver" | "snow-submission" | "org-pack-change" | "catalog-assert", {
|
|
50
|
+
roles: string[];
|
|
51
|
+
groups: string[];
|
|
52
|
+
people: string[];
|
|
53
|
+
}>>;
|
|
54
|
+
separation: {
|
|
55
|
+
actions: [string, string];
|
|
56
|
+
reason: string;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
export declare const DEFAULT_RUNTIME: {
|
|
60
|
+
schemaVersion: 1 | 2;
|
|
61
|
+
assistants: {
|
|
62
|
+
allowed: ("copilot" | "claude-code" | "cursor" | "gemini-cli" | "windsurf" | "agents-md")[];
|
|
63
|
+
default: "copilot" | "claude-code" | "cursor" | "gemini-cli" | "windsurf" | "agents-md";
|
|
64
|
+
};
|
|
65
|
+
editors: ("vscode" | "intellij")[];
|
|
66
|
+
ai: "on" | "text-only" | "off";
|
|
67
|
+
modes: {
|
|
68
|
+
allowed: ("model" | "hand-off" | "headless-claude-code")[];
|
|
69
|
+
default: "model" | "hand-off" | "headless-claude-code";
|
|
70
|
+
};
|
|
71
|
+
models: {
|
|
72
|
+
allowed: string[];
|
|
73
|
+
recommended: Record<string, string>;
|
|
74
|
+
read?: string | undefined;
|
|
75
|
+
draft?: string | undefined;
|
|
76
|
+
critic?: string | undefined;
|
|
77
|
+
knowledge?: string | undefined;
|
|
78
|
+
quick?: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
autonomy: {
|
|
81
|
+
default: "draft" | "plan-only" | "draft-and-pr";
|
|
82
|
+
capPerRepo: Record<string, "draft" | "plan-only" | "draft-and-pr">;
|
|
83
|
+
maxFixRounds: number;
|
|
84
|
+
};
|
|
85
|
+
budgets: {
|
|
86
|
+
defaultTokens: number;
|
|
87
|
+
perAgent: Record<string, number>;
|
|
88
|
+
};
|
|
89
|
+
retention: {
|
|
90
|
+
runsDays: number;
|
|
91
|
+
};
|
|
92
|
+
telemetry: {
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
};
|
|
95
|
+
adapters: {
|
|
96
|
+
workTracker?: {
|
|
97
|
+
type: string;
|
|
98
|
+
settings: Record<string, string | number | boolean | string[]>;
|
|
99
|
+
} | undefined;
|
|
100
|
+
serviceDesk?: {
|
|
101
|
+
type: string;
|
|
102
|
+
settings: Record<string, string | number | boolean | string[]>;
|
|
103
|
+
} | undefined;
|
|
104
|
+
gitHost?: {
|
|
105
|
+
type: string;
|
|
106
|
+
settings: Record<string, string | number | boolean | string[]>;
|
|
107
|
+
} | undefined;
|
|
108
|
+
wiki?: {
|
|
109
|
+
type: string;
|
|
110
|
+
settings: Record<string, string | number | boolean | string[]>;
|
|
111
|
+
} | undefined;
|
|
112
|
+
notify?: {
|
|
113
|
+
type: string;
|
|
114
|
+
settings: Record<string, string | number | boolean | string[]>;
|
|
115
|
+
} | undefined;
|
|
116
|
+
design?: {
|
|
117
|
+
type: string;
|
|
118
|
+
settings: Record<string, string | number | boolean | string[]>;
|
|
119
|
+
} | undefined;
|
|
120
|
+
model?: {
|
|
121
|
+
type: string;
|
|
122
|
+
settings: Record<string, string | number | boolean | string[]>;
|
|
123
|
+
} | undefined;
|
|
124
|
+
};
|
|
125
|
+
history?: {
|
|
126
|
+
record: boolean;
|
|
127
|
+
} | undefined;
|
|
128
|
+
retrieval?: {
|
|
129
|
+
embeddings: {
|
|
130
|
+
model: string;
|
|
131
|
+
runtime?: string | undefined;
|
|
132
|
+
};
|
|
133
|
+
expansion: boolean;
|
|
134
|
+
rerank: boolean;
|
|
135
|
+
} | undefined;
|
|
136
|
+
buildEngine?: {
|
|
137
|
+
default: "atticus" | "speckit";
|
|
138
|
+
perRepo: Record<string, "atticus" | "speckit">;
|
|
139
|
+
} | undefined;
|
|
140
|
+
};
|
|
141
|
+
export declare const DEFAULT_SOURCES: {
|
|
142
|
+
schemaVersion: 1 | 2 | 3;
|
|
143
|
+
layout: {
|
|
144
|
+
openspec: string;
|
|
145
|
+
catalog: string;
|
|
146
|
+
skills: string[];
|
|
147
|
+
prompts: string[];
|
|
148
|
+
constitution?: string | undefined;
|
|
149
|
+
};
|
|
150
|
+
wikis: {
|
|
151
|
+
id: string;
|
|
152
|
+
type: "confluence-export" | "sharepoint-export" | "confluence" | "ado-wiki" | "sharepoint" | "markdown-folder" | "git";
|
|
153
|
+
location: string;
|
|
154
|
+
spaces: string[];
|
|
155
|
+
owner?: string | undefined;
|
|
156
|
+
tags?: {
|
|
157
|
+
kinds: string[];
|
|
158
|
+
frameworks: string[];
|
|
159
|
+
} | undefined;
|
|
160
|
+
ref?: string | undefined;
|
|
161
|
+
path?: string | undefined;
|
|
162
|
+
checkout?: "clone" | "submodule" | undefined;
|
|
163
|
+
include?: string[] | undefined;
|
|
164
|
+
exclude?: string[] | undefined;
|
|
165
|
+
authority?: "platform" | "standard" | "framework" | "team" | "reference" | undefined;
|
|
166
|
+
byPage?: {
|
|
167
|
+
match: string[];
|
|
168
|
+
authority?: "platform" | "standard" | "framework" | "team" | "reference" | undefined;
|
|
169
|
+
status?: "current" | "deprecated" | "superseded" | "archived" | undefined;
|
|
170
|
+
}[] | undefined;
|
|
171
|
+
reviewMonths?: number | undefined;
|
|
172
|
+
appliesTo?: {
|
|
173
|
+
systems?: string[] | undefined;
|
|
174
|
+
components?: string[] | undefined;
|
|
175
|
+
platforms?: string[] | undefined;
|
|
176
|
+
repoTypes?: string[] | undefined;
|
|
177
|
+
frameworks?: string[] | undefined;
|
|
178
|
+
newComponents?: boolean | undefined;
|
|
179
|
+
} | undefined;
|
|
180
|
+
readRestricted?: boolean | undefined;
|
|
181
|
+
maxPages?: number | undefined;
|
|
182
|
+
}[];
|
|
183
|
+
absorbed: {
|
|
184
|
+
id: string;
|
|
185
|
+
url: string;
|
|
186
|
+
format: "openspec" | "atticus" | "speckit" | "plain";
|
|
187
|
+
mode: "link" | "adopt" | "ignore";
|
|
188
|
+
ref?: string | undefined;
|
|
189
|
+
}[];
|
|
190
|
+
};
|
|
191
|
+
export declare const DEFAULT_TEST_STRATEGY: {
|
|
192
|
+
schemaVersion: 1;
|
|
193
|
+
matrix: {
|
|
194
|
+
changeType: string;
|
|
195
|
+
risk: "low" | "medium" | "high";
|
|
196
|
+
required: ("unit" | "contract" | "integration" | "e2e" | "regression" | "performance" | "security" | "accessibility" | "data-migration")[];
|
|
197
|
+
}[];
|
|
198
|
+
definitionOfReady: string[];
|
|
199
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { FrameworkModel } from "./schema/frameworks.js";
|
|
2
|
+
import { ScanSettings } from "./schema/scan-settings.js";
|
|
3
|
+
import { RepoType } from "./schema/repo-type.js";
|
|
4
|
+
import { ModelProviderPlugin, ScannerPlugin } from "./schema/plugin.js";
|
|
5
|
+
import { SpecTemplate } from "./schema/spec.js";
|
|
6
|
+
import type { z } from "zod";
|
|
7
|
+
import { AgentDefinition } from "./schema/ai.js";
|
|
8
|
+
import { Dialect } from "./schema/dialect.js";
|
|
9
|
+
import { ChangeTypes, Estimates, Gates, OpenSpecSettings, IntegrationPattern, PackManifest, Procedure, Profile, Roles, Runtime, ServiceRequestTemplate, SkillMeta, Sources, TestStrategy } from "./schema/orgpack.js";
|
|
10
|
+
import { ChecklistPack } from "./schema/review.js";
|
|
11
|
+
import { RepoManifest } from "./schema/workspace.js";
|
|
12
|
+
import { Conventions } from "./schema/conventions.js";
|
|
13
|
+
export interface OrgPackProblem {
|
|
14
|
+
/** File relative to the org-pack folder. */
|
|
15
|
+
file: string;
|
|
16
|
+
path: string;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
export interface OrgPack {
|
|
20
|
+
pack?: PackManifest;
|
|
21
|
+
/** Deprecated (ADR 0073): loaded and validated when present, read by nothing. */
|
|
22
|
+
roles: Roles;
|
|
23
|
+
changeTypes: z.infer<typeof ChangeTypes>;
|
|
24
|
+
gates: z.infer<typeof Gates>;
|
|
25
|
+
runtime: Runtime;
|
|
26
|
+
sources: z.infer<typeof Sources>;
|
|
27
|
+
testStrategy: z.infer<typeof TestStrategy>;
|
|
28
|
+
profiles: {
|
|
29
|
+
profile?: Profile;
|
|
30
|
+
repos?: RepoManifest;
|
|
31
|
+
platform: string;
|
|
32
|
+
}[];
|
|
33
|
+
patterns: IntegrationPattern[];
|
|
34
|
+
dialects: Dialect[];
|
|
35
|
+
/** Framework models (ADR 0054), from frameworks/. */
|
|
36
|
+
frameworks: FrameworkModel[];
|
|
37
|
+
/** Scan settings per repo (ADR 0075), from scan/<repo>.yaml. */
|
|
38
|
+
scanSettings: ScanSettings[];
|
|
39
|
+
/** Repo types (ADR 0077), from repo-types/<id>/type.yaml. */
|
|
40
|
+
repoTypes: RepoType[];
|
|
41
|
+
/** Scanner plugins (ADR 0080), from plugins/<id>/plugin.yaml, with their folders. */
|
|
42
|
+
plugins: {
|
|
43
|
+
manifest: ScannerPlugin;
|
|
44
|
+
dir: string;
|
|
45
|
+
}[];
|
|
46
|
+
/** Model-provider plugins (ADR 0121 item 4): plugins/model-providers/<id>/plugin.yaml. */
|
|
47
|
+
modelProviders: {
|
|
48
|
+
manifest: ModelProviderPlugin;
|
|
49
|
+
dir: string;
|
|
50
|
+
}[];
|
|
51
|
+
/** Spec templates (ADR 0079), from repo-types/<id>/spec-template.yaml; a type may have none. */
|
|
52
|
+
specTemplates: SpecTemplate[];
|
|
53
|
+
checklists: ChecklistPack[];
|
|
54
|
+
skills: (z.infer<typeof SkillMeta> & {
|
|
55
|
+
body: string;
|
|
56
|
+
})[];
|
|
57
|
+
serviceRequests: z.infer<typeof ServiceRequestTemplate>[];
|
|
58
|
+
/** Procedures (ADR 0033), from process/procedures/. */
|
|
59
|
+
procedures: Procedure[];
|
|
60
|
+
agents: AgentDefinition[];
|
|
61
|
+
/**
|
|
62
|
+
* The house conventions a read leans on (ADR 0147), from conventions.yaml: the built-in lists
|
|
63
|
+
* when the pack has none. Optional so a pack built in code (a test's) needs none.
|
|
64
|
+
*/
|
|
65
|
+
conventions?: Conventions;
|
|
66
|
+
/** Files that came from built-in defaults because the pack doesn't have them. */
|
|
67
|
+
defaulted: string[];
|
|
68
|
+
problems: OrgPackProblem[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Read and validate a whole org pack. Never throws for content problems: every schema or
|
|
72
|
+
* cross-file problem is listed in `problems` with its file, so a team sees all of them at
|
|
73
|
+
* once. Missing files fall back to the built-in defaults.
|
|
74
|
+
*/
|
|
75
|
+
export declare function loadOrgPack(dir: string): Promise<OrgPack>;
|
|
76
|
+
/**
|
|
77
|
+
* The org pack's OpenSpec store settings (ADR 0126), `openspec.yaml`: the defaults (nothing on)
|
|
78
|
+
* when the pack has none, and also, with a problem, when the file is there and doesn't read.
|
|
79
|
+
*/
|
|
80
|
+
export declare function loadOpenSpecSettings(dir: string): Promise<{
|
|
81
|
+
settings: OpenSpecSettings;
|
|
82
|
+
problem?: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* The org pack's reference ranges for estimates (ADR 0109), `estimates.yaml`: undefined when
|
|
86
|
+
* the pack has none (an estimate then sizes the work and gives no days); a problem when the
|
|
87
|
+
* file is there and doesn't read.
|
|
88
|
+
*/
|
|
89
|
+
export declare function loadEstimates(dir: string): Promise<{
|
|
90
|
+
estimates?: Estimates;
|
|
91
|
+
problem?: string;
|
|
92
|
+
}>;
|
|
93
|
+
/** The conventions of a pack (ADR 0147), its defaults when it has none. */
|
|
94
|
+
export declare const conventionsOf: (op: Pick<OrgPack, "conventions"> | undefined) => Conventions;
|
|
95
|
+
/** What the estate join takes from a pack's conventions (ADR 0147): its facing words and bundle folders. */
|
|
96
|
+
export declare function joinConventions(op: Pick<OrgPack, "conventions"> | undefined): {
|
|
97
|
+
facing: {
|
|
98
|
+
internal: readonly string[];
|
|
99
|
+
external: readonly string[];
|
|
100
|
+
};
|
|
101
|
+
bundleFolders: readonly string[];
|
|
102
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* profile.yaml version 1 → 2 (ADR 0162 amendment). Version 2 adds a system's `topics`; a file
|
|
3
|
+
* without them names no topic, as version 1 did, so the step writes the new number only and keeps
|
|
4
|
+
* the file's comments, order and line layout. Nothing is moved from `aliases` to `topics`: which
|
|
5
|
+
* alias is a topic is a person's call. A version-1 profile stays valid, so `atticus upgrade` has no
|
|
6
|
+
* step for it; `addProfileSystem` applies this when it writes a topic.
|
|
7
|
+
*/
|
|
8
|
+
export declare function migrateProfileText(text: string): {
|
|
9
|
+
text: string;
|
|
10
|
+
changed: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Question } from "./schema/question.js";
|
|
2
|
+
/** The changes in flight: their ids, sorted. */
|
|
3
|
+
export declare function changesInFlight(root: string): Promise<string[]>;
|
|
4
|
+
/**
|
|
5
|
+
* The questions each change in flight rests on, by question id: the changes, sorted. A change's
|
|
6
|
+
* own questions are found by `questionWeights` (their repo is the change's id); this reads the
|
|
7
|
+
* question files the newest round of each of its gates cites.
|
|
8
|
+
*/
|
|
9
|
+
export declare function questionsInFlight(root: string): Promise<Map<string, string[]>>;
|
|
10
|
+
/** Why a question is where it is in the list. */
|
|
11
|
+
export interface QuestionWeight {
|
|
12
|
+
/** The changes in flight that rest on it, sorted; empty when none. */
|
|
13
|
+
restsOn: string[];
|
|
14
|
+
/** How many calls its answer joins; 0 for a question that isn't about a link. */
|
|
15
|
+
joins: number;
|
|
16
|
+
}
|
|
17
|
+
/** The weight of each question (see `QuestionWeight`), by id. */
|
|
18
|
+
export declare function questionWeights(root: string, questions: readonly Question[]): Promise<Map<string, QuestionWeight>>;
|
|
19
|
+
/**
|
|
20
|
+
* The questions in the order to ask them: what a change in flight rests on first, then the
|
|
21
|
+
* answers that join the most calls; otherwise as they came (oldest first, from listQuestions).
|
|
22
|
+
*/
|
|
23
|
+
export declare function orderQuestions<Q extends Pick<Question, "id">>(questions: readonly Q[], weights: ReadonlyMap<string, QuestionWeight>): Q[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Team } from "./schema/orgpack.js";
|
|
2
|
+
import type { Question } from "./schema/question.js";
|
|
3
|
+
/**
|
|
4
|
+
* Route each question to its owner (ADR 0140, Q4): the team that owns the question's repo is the
|
|
5
|
+
* repo manifest's `owner`; roles.yaml's `teams` (version 2) gives the team a name and says who is
|
|
6
|
+
* on it, so `atticus questions list --mine` and the app's Questions page can list a person's own.
|
|
7
|
+
* The person is the metarepo's Git user (ADR 0073). Words, not permissions: anyone can still
|
|
8
|
+
* read and answer any question.
|
|
9
|
+
*/
|
|
10
|
+
/** The team a question goes to, or why none does. */
|
|
11
|
+
export type QuestionOwner = {
|
|
12
|
+
team: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
} | {
|
|
15
|
+
none: string;
|
|
16
|
+
};
|
|
17
|
+
/** The teams roles.yaml names, and why they couldn't be read when they couldn't. */
|
|
18
|
+
export declare function readTeams(root: string): Promise<{
|
|
19
|
+
teams: Team[];
|
|
20
|
+
problem?: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** The teams a person is on, by their Git handle. */
|
|
23
|
+
export declare function teamsOfPerson(handle: string, teams: readonly Team[]): Team[];
|
|
24
|
+
/**
|
|
25
|
+
* Who a question goes to: the team the manifest names as its repo's owner, with the name
|
|
26
|
+
* roles.yaml gives it. A change's own questions, and a repo no manifest lists, have no team.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ownerOfQuestion(q: Pick<Question, "repo">, o: {
|
|
29
|
+
/** Each listed repo's owner, from the repo manifests. */
|
|
30
|
+
owners: ReadonlyMap<string, string>;
|
|
31
|
+
teams: readonly Team[];
|
|
32
|
+
/** The ids of the changes, whose own questions are filed under them. */
|
|
33
|
+
changes?: ReadonlySet<string>;
|
|
34
|
+
}): QuestionOwner;
|
|
35
|
+
/**
|
|
36
|
+
* Who a question goes to, a change's people included (ADR 0153, Q4): a change's own question,
|
|
37
|
+
* filed under the change's id, goes to the people its change.yaml names under `owners`, whatever
|
|
38
|
+
* they do on it; every other question goes to its repo's team (`ownerOfQuestion`).
|
|
39
|
+
*/
|
|
40
|
+
export type QuestionRoute = QuestionOwner | {
|
|
41
|
+
change: string;
|
|
42
|
+
people: string[];
|
|
43
|
+
};
|
|
44
|
+
/** Everyone a change.yaml's `owners` names, by handle, once each, sorted. */
|
|
45
|
+
export declare function peopleOfChange(owners: Readonly<Record<string, readonly string[]>>): string[];
|
|
46
|
+
export declare function routeOfQuestion(q: Pick<Question, "repo">, o: Parameters<typeof ownerOfQuestion>[1] & {
|
|
47
|
+
/** The people of each change (`peopleOfChange`), by change id. */
|
|
48
|
+
changePeople?: ReadonlyMap<string, readonly string[]>;
|
|
49
|
+
}): QuestionRoute;
|
|
50
|
+
/** Whether a question is the person's: they are on its team, or one of its change's people. */
|
|
51
|
+
export declare function isPersonsQuestion(handle: string, route: QuestionRoute, teams: readonly Team[]): boolean;
|
|
52
|
+
/** The owner in a few words: "team-ledger (Ledger team)", "add-pins's people: ari, sam", or "no owner: why". */
|
|
53
|
+
export declare function ownerWords(o: QuestionRoute): string;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { answerQuestion } from "./questions.js";
|
|
3
|
+
import { QuestionScopeLevel, type Question } from "./schema/question.js";
|
|
4
|
+
/**
|
|
5
|
+
* The assistant proposes, a person confirms (ADR 0144, Q5). The `/atticus-propose` step reads the
|
|
6
|
+
* code and config behind each open question and writes a proposed answer beside it, in
|
|
7
|
+
* `proposals/questions/<id>.yaml` (under `.atticus/` in a repo adopted in place), with the lines
|
|
8
|
+
* it rests on. It never answers: the question file is untouched until a person accepts.
|
|
9
|
+
*
|
|
10
|
+
* Every citation is checked here, deterministically, before a proposal is shown: its repo is the
|
|
11
|
+
* question's or one a manifest lists, and has a checkout here (only a change's own question cites
|
|
12
|
+
* the metarepo, and never Atticus's own folders: proposals, questions, facts, knowledge, judgments,
|
|
13
|
+
* runs); the file is in that checkout once links are followed; the line is there; and the quoted
|
|
14
|
+
* words are on it (spacing, curly quotes and case aside, as `quotedIn`). A refused citation's
|
|
15
|
+
* problem never says what the file holds. A proposal that fails is never shown as a proposal, only as its problems.
|
|
16
|
+
* `acceptProposal` checks it again and records the answer as the person's (`answerQuestion`).
|
|
17
|
+
*
|
|
18
|
+
* The proposals folder holds drafts for a person to review, not a contract. An accepted answer
|
|
19
|
+
* records, in the question file, that it was a proposal (ADR 0153): who proposed it, when, and the
|
|
20
|
+
* lines it cited.
|
|
21
|
+
*/
|
|
22
|
+
export declare const QUESTION_PROPOSAL_SCHEMA_VERSION: 1;
|
|
23
|
+
/** A line the proposal rests on (the same shape an accepted answer keeps, ADR 0153). */
|
|
24
|
+
export declare const ProposalCite: z.ZodObject<{
|
|
25
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
26
|
+
file: z.ZodString;
|
|
27
|
+
line: z.ZodNumber;
|
|
28
|
+
quote: z.ZodString;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export type ProposalCite = z.infer<typeof ProposalCite>;
|
|
31
|
+
export declare const QuestionProposal: z.ZodObject<{
|
|
32
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
33
|
+
answer: z.ZodObject<{
|
|
34
|
+
option: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
text: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
why: z.ZodString;
|
|
38
|
+
cites: z.ZodArray<z.ZodObject<{
|
|
39
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
40
|
+
file: z.ZodString;
|
|
41
|
+
line: z.ZodNumber;
|
|
42
|
+
quote: z.ZodString;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
by: z.ZodString;
|
|
45
|
+
at: z.ZodISODateTime;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type QuestionProposal = z.infer<typeof QuestionProposal>;
|
|
48
|
+
/** Where a question's proposal lives, relative to the root. */
|
|
49
|
+
export declare const proposalRelOf: (root: string, id: string) => string;
|
|
50
|
+
/** A proposal as read and checked. `ok` only when it read and every check passed. */
|
|
51
|
+
export interface CheckedProposal {
|
|
52
|
+
id: string;
|
|
53
|
+
/** Relative to the root. */
|
|
54
|
+
file: string;
|
|
55
|
+
proposal?: QuestionProposal;
|
|
56
|
+
ok: boolean;
|
|
57
|
+
/** Its question is answered, retired or gone: nothing to propose. */
|
|
58
|
+
stale?: true;
|
|
59
|
+
problems: string[];
|
|
60
|
+
}
|
|
61
|
+
/** The problems of one proposal against its question and the files it cites; none: it holds. */
|
|
62
|
+
export declare function checkProposal(root: string, q: Question, p: QuestionProposal): Promise<string[]>;
|
|
63
|
+
/** Every proposal on file, each read and checked against its question; by question id. */
|
|
64
|
+
export declare function checkedProposals(root: string): Promise<CheckedProposal[]>;
|
|
65
|
+
/** One question's proposal, checked; undefined when there is none. */
|
|
66
|
+
export declare function proposalOf(root: string, id: string): Promise<CheckedProposal | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* A person accepts the proposal: checked again, then written as their answer, by them, at the
|
|
69
|
+
* scope they confirm (the question's own by default). Refused when there is none or it fails.
|
|
70
|
+
*/
|
|
71
|
+
export declare function acceptProposal(root: string, id: string, a: {
|
|
72
|
+
by: string;
|
|
73
|
+
at: string;
|
|
74
|
+
scope?: QuestionScopeLevel;
|
|
75
|
+
repoType?: string;
|
|
76
|
+
match?: string;
|
|
77
|
+
}): ReturnType<typeof answerQuestion>;
|