@workflow-cannon/workspace-kit 0.17.0 → 0.24.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.
- package/README.md +23 -9
- package/dist/cli/doctor-planning-issues.js +3 -22
- package/dist/cli/run-command.js +22 -38
- package/dist/cli.js +95 -4
- package/dist/contracts/command-manifest.d.ts +17 -0
- package/dist/contracts/command-manifest.js +1 -0
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/module-contract.d.ts +12 -11
- package/dist/core/agent-instruction-surface.d.ts +33 -0
- package/dist/core/agent-instruction-surface.js +46 -0
- package/dist/core/config-cli.js +13 -17
- package/dist/core/config-metadata.js +101 -2
- package/dist/core/index.d.ts +4 -1
- package/dist/core/index.js +3 -0
- package/dist/core/module-command-router.js +19 -1
- package/dist/core/module-registry-resolve.d.ts +27 -0
- package/dist/core/module-registry-resolve.js +91 -0
- package/dist/core/module-registry.d.ts +14 -0
- package/dist/core/module-registry.js +57 -0
- package/dist/core/planning/build-plan-session-file.d.ts +29 -0
- package/dist/core/planning/build-plan-session-file.js +58 -0
- package/dist/core/planning/index.d.ts +17 -0
- package/dist/core/planning/index.js +15 -0
- package/dist/core/policy.js +18 -8
- package/dist/core/state/unified-state-db.d.ts +21 -0
- package/dist/core/state/unified-state-db.js +80 -0
- package/dist/core/workspace-kit-config.js +13 -1
- package/dist/modules/agent-behavior/builtins.d.ts +3 -0
- package/dist/modules/agent-behavior/builtins.js +71 -0
- package/dist/modules/agent-behavior/explain.d.ts +6 -0
- package/dist/modules/agent-behavior/explain.js +46 -0
- package/dist/modules/agent-behavior/index.d.ts +4 -0
- package/dist/modules/agent-behavior/index.js +461 -0
- package/dist/modules/agent-behavior/interview-session-file.d.ts +9 -0
- package/dist/modules/agent-behavior/interview-session-file.js +43 -0
- package/dist/modules/agent-behavior/interview.d.ts +13 -0
- package/dist/modules/agent-behavior/interview.js +88 -0
- package/dist/modules/agent-behavior/persistence.d.ts +6 -0
- package/dist/modules/agent-behavior/persistence.js +89 -0
- package/dist/modules/agent-behavior/store.d.ts +34 -0
- package/dist/modules/agent-behavior/store.js +119 -0
- package/dist/modules/agent-behavior/types.d.ts +28 -0
- package/dist/modules/agent-behavior/types.js +1 -0
- package/dist/modules/agent-behavior/validate.d.ts +11 -0
- package/dist/modules/agent-behavior/validate.js +123 -0
- package/dist/modules/approvals/index.js +54 -51
- package/dist/modules/approvals/policy-sensitive-commands.d.ts +4 -0
- package/dist/modules/approvals/policy-sensitive-commands.js +4 -0
- package/dist/modules/approvals/review-runtime.js +1 -2
- package/dist/modules/documentation/index.js +47 -45
- package/dist/modules/documentation/normalizer.d.ts +3 -0
- package/dist/modules/documentation/normalizer.js +171 -0
- package/dist/modules/documentation/parser.d.ts +7 -0
- package/dist/modules/documentation/parser.js +39 -0
- package/dist/modules/documentation/policy-sensitive-commands.d.ts +5 -0
- package/dist/modules/documentation/policy-sensitive-commands.js +8 -0
- package/dist/modules/documentation/renderer.d.ts +23 -0
- package/dist/modules/documentation/renderer.js +105 -0
- package/dist/modules/documentation/runtime-batch.d.ts +10 -0
- package/dist/modules/documentation/runtime-batch.js +67 -0
- package/dist/modules/documentation/runtime-config.d.ts +11 -0
- package/dist/modules/documentation/runtime-config.js +54 -0
- package/dist/modules/documentation/runtime-render-support.d.ts +8 -0
- package/dist/modules/documentation/runtime-render-support.js +36 -0
- package/dist/modules/documentation/runtime.js +22 -510
- package/dist/modules/documentation/types.d.ts +182 -0
- package/dist/modules/documentation/validator.d.ts +8 -0
- package/dist/modules/documentation/validator.js +234 -0
- package/dist/modules/documentation/view-models.d.ts +3 -0
- package/dist/modules/documentation/view-models.js +124 -0
- package/dist/modules/improvement/generate-recommendations-runtime.js +3 -3
- package/dist/modules/improvement/improvement-state.d.ts +2 -2
- package/dist/modules/improvement/improvement-state.js +52 -23
- package/dist/modules/improvement/index.js +140 -138
- package/dist/modules/improvement/ingest.d.ts +1 -1
- package/dist/modules/improvement/policy-sensitive-commands.d.ts +4 -0
- package/dist/modules/improvement/policy-sensitive-commands.js +7 -0
- package/dist/modules/index.d.ts +6 -0
- package/dist/modules/index.js +17 -0
- package/dist/modules/planning/artifact.d.ts +19 -0
- package/dist/modules/planning/artifact.js +72 -0
- package/dist/modules/planning/index.js +605 -6
- package/dist/modules/planning/question-engine.d.ts +25 -0
- package/dist/modules/planning/question-engine.js +284 -0
- package/dist/modules/planning/types.d.ts +9 -0
- package/dist/modules/planning/types.js +39 -0
- package/dist/modules/task-engine/doctor-planning-persistence.js +21 -13
- package/dist/modules/task-engine/index.d.ts +1 -2
- package/dist/modules/task-engine/index.js +1 -1143
- package/dist/modules/task-engine/migrate-task-persistence-runtime.js +31 -4
- package/dist/modules/task-engine/migrate-wishlist-intake-runtime.d.ts +2 -0
- package/dist/modules/task-engine/migrate-wishlist-intake-runtime.js +146 -0
- package/dist/modules/task-engine/planning-open.d.ts +2 -9
- package/dist/modules/task-engine/planning-open.js +4 -15
- package/dist/modules/task-engine/policy-sensitive-commands.d.ts +5 -0
- package/dist/modules/task-engine/policy-sensitive-commands.js +5 -0
- package/dist/modules/task-engine/sqlite-dual-planning.d.ts +11 -2
- package/dist/modules/task-engine/sqlite-dual-planning.js +134 -28
- package/dist/modules/task-engine/strict-task-validation.js +3 -0
- package/dist/modules/task-engine/suggestions.js +2 -1
- package/dist/modules/task-engine/task-engine-internal.d.ts +2 -0
- package/dist/modules/task-engine/task-engine-internal.js +1304 -0
- package/dist/modules/task-engine/task-type-validation.js +40 -0
- package/dist/modules/task-engine/wishlist-intake.d.ts +22 -0
- package/dist/modules/task-engine/wishlist-intake.js +180 -0
- package/dist/modules/task-engine/wishlist-validation.d.ts +4 -0
- package/dist/modules/task-engine/wishlist-validation.js +19 -0
- package/dist/modules/workspace-config/index.js +9 -11
- package/package.json +2 -2
- package/schemas/agent-behavior-profile.schema.json +52 -0
- package/schemas/task-engine-run-contracts.schema.json +80 -5
- package/src/modules/documentation/README.md +16 -25
- package/src/modules/documentation/RULES.md +9 -9
- package/src/modules/documentation/index.ts +54 -49
- package/src/modules/documentation/instructions/document-project.md +6 -6
- package/src/modules/documentation/instructions/generate-document.md +4 -4
- package/src/modules/documentation/normalizer.ts +187 -0
- package/src/modules/documentation/parser.ts +41 -0
- package/src/modules/documentation/policy-sensitive-commands.ts +8 -0
- package/src/modules/documentation/renderer.ts +121 -0
- package/src/modules/documentation/runtime-batch.ts +74 -0
- package/src/modules/documentation/runtime-config.ts +68 -0
- package/src/modules/documentation/runtime-render-support.ts +39 -0
- package/src/modules/documentation/runtime.ts +28 -600
- package/src/modules/documentation/schemas/documentation-schema.md +37 -54
- package/src/modules/documentation/types.ts +228 -0
- package/src/modules/documentation/validator.ts +247 -0
- package/src/modules/documentation/view-models.ts +132 -0
- package/src/modules/documentation/views/agents.view.yaml +18 -0
- package/src/modules/documentation/views/architecture.view.yaml +18 -0
- package/src/modules/documentation/views/principles.view.yaml +18 -0
- package/src/modules/documentation/views/readme.view.yaml +18 -0
- package/src/modules/documentation/views/releasing.view.yaml +18 -0
- package/src/modules/documentation/views/roadmap.view.yaml +18 -0
- package/src/modules/documentation/views/runbooks-consumer-cadence.view.yaml +18 -0
- package/src/modules/documentation/views/runbooks-parity-validation-flow.view.yaml +18 -0
- package/src/modules/documentation/views/runbooks-release-channels.view.yaml +18 -0
- package/src/modules/documentation/views/security.view.yaml +18 -0
- package/src/modules/documentation/views/support.view.yaml +18 -0
- package/src/modules/documentation/views/terms.view.yaml +18 -0
- package/src/modules/documentation/views/workbooks-phase2-config-policy-workbook.view.yaml +18 -0
- package/src/modules/documentation/views/workbooks-task-engine-workbook.view.yaml +18 -0
- package/src/modules/documentation/views/workbooks-transcript-automation-baseline.view.yaml +18 -0
- package/src/modules/documentation/state.md +0 -8
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve, sep } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
export type DocumentationRuntimeConfig = {
|
|
7
|
+
aiRoot: string;
|
|
8
|
+
humanRoot: string;
|
|
9
|
+
templatesRoot: string;
|
|
10
|
+
instructionsRoot: string;
|
|
11
|
+
schemasRoot: string;
|
|
12
|
+
maxValidationAttempts: number;
|
|
13
|
+
sourceRoot: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function isPathWithinRoot(path: string, root: string): boolean {
|
|
17
|
+
return path === root || path.startsWith(`${root}${sep}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function parseDefaultValue(fileContent: string, key: string, fallback: string): string {
|
|
21
|
+
const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
22
|
+
const regex = new RegExp(`\\\`${escaped}\\\`[^\\n]*default:\\s*\\\`([^\\\`]+)\\\``);
|
|
23
|
+
const match = fileContent.match(regex);
|
|
24
|
+
return match?.[1] ?? fallback;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function loadRuntimeConfig(workspacePath: string): Promise<DocumentationRuntimeConfig> {
|
|
28
|
+
const runtimeSourceRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
|
|
29
|
+
const sourceRoots = [workspacePath, runtimeSourceRoot];
|
|
30
|
+
let sourceRoot = workspacePath;
|
|
31
|
+
let configContent: string | undefined;
|
|
32
|
+
for (const candidateRoot of sourceRoots) {
|
|
33
|
+
const candidate = resolve(candidateRoot, "src/modules/documentation/config.md");
|
|
34
|
+
if (!existsSync(candidate)) continue;
|
|
35
|
+
configContent = await readFile(candidate, "utf8");
|
|
36
|
+
sourceRoot = candidateRoot;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!configContent) {
|
|
41
|
+
return {
|
|
42
|
+
aiRoot: "/.ai",
|
|
43
|
+
humanRoot: "docs/maintainers",
|
|
44
|
+
templatesRoot: "src/modules/documentation/templates",
|
|
45
|
+
instructionsRoot: "src/modules/documentation/instructions",
|
|
46
|
+
schemasRoot: "src/modules/documentation/schemas",
|
|
47
|
+
maxValidationAttempts: 3,
|
|
48
|
+
sourceRoot
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const aiRoot = parseDefaultValue(configContent, "sources.aiRoot", "/.ai");
|
|
53
|
+
const humanRoot = parseDefaultValue(configContent, "sources.humanRoot", "docs/maintainers");
|
|
54
|
+
const templatesRoot = parseDefaultValue(configContent, "sources.templatesRoot", "src/modules/documentation/templates");
|
|
55
|
+
const instructionsRoot = parseDefaultValue(configContent, "sources.instructionsRoot", "src/modules/documentation/instructions");
|
|
56
|
+
const schemasRoot = parseDefaultValue(configContent, "sources.schemasRoot", "src/modules/documentation/schemas");
|
|
57
|
+
const maxValidationAttemptsRaw = parseDefaultValue(configContent, "generation.maxValidationAttempts", "3");
|
|
58
|
+
const maxValidationAttempts = Number.parseInt(maxValidationAttemptsRaw, 10);
|
|
59
|
+
return {
|
|
60
|
+
aiRoot,
|
|
61
|
+
humanRoot,
|
|
62
|
+
templatesRoot,
|
|
63
|
+
instructionsRoot,
|
|
64
|
+
schemasRoot,
|
|
65
|
+
maxValidationAttempts: Number.isFinite(maxValidationAttempts) ? maxValidationAttempts : 3,
|
|
66
|
+
sourceRoot
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DocumentationConflict, DocumentationValidationIssue } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export function resolveExpectedDocFamily(docType: string): "rules" | "runbook" | "workbook" {
|
|
4
|
+
if (docType.includes("runbooks/") || docType.startsWith("runbooks/")) return "runbook";
|
|
5
|
+
if (docType.includes("workbooks/") || docType.startsWith("workbooks/")) return "workbook";
|
|
6
|
+
return "rules";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function renderTemplate(templateContent: string): { output: string; unresolvedBlocks: boolean } {
|
|
10
|
+
const output = templateContent.replace(/\{\{\{([\s\S]*?)\}\}\}/g, (_match, instructionText: string) => {
|
|
11
|
+
const normalized = instructionText.trim().split("\n")[0] ?? "template instructions";
|
|
12
|
+
return `Generated content based on instruction: ${normalized}`;
|
|
13
|
+
});
|
|
14
|
+
return { output, unresolvedBlocks: output.includes("{{{") };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function validateSectionCoverage(templateContent: string, output: string): DocumentationValidationIssue[] {
|
|
18
|
+
const issues: DocumentationValidationIssue[] = [];
|
|
19
|
+
const sectionRegex = /^##\s+(.+)$/gm;
|
|
20
|
+
const expectedSections = [...templateContent.matchAll(sectionRegex)].map((match) => match[1]);
|
|
21
|
+
for (const section of expectedSections) {
|
|
22
|
+
if (!output.includes(`## ${section}`)) {
|
|
23
|
+
issues.push({ check: "section-coverage", message: `Missing required section: ${section}`, resolved: false });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return issues;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function detectConflicts(aiOutput: string, humanOutput: string): DocumentationConflict[] {
|
|
30
|
+
const conflicts: DocumentationConflict[] = [];
|
|
31
|
+
if (`${aiOutput}\n${humanOutput}`.includes("CONFLICT:")) {
|
|
32
|
+
conflicts.push({
|
|
33
|
+
source: "generated-output",
|
|
34
|
+
reason: "Generated output flagged a conflict marker",
|
|
35
|
+
severity: "stop"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return conflicts;
|
|
39
|
+
}
|