create-agdf 0.4.1 → 0.4.2
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 +21 -0
- package/bin/create-agdf.js +89 -5
- package/generated/.agdf/control/templates/AGDF_RUN.md +1 -0
- package/generated/.agdf/control/templates/artefacts/OR.md +1 -0
- package/generated/.github/skills/README.md +1 -0
- package/generated/.github/skills/agdf-delivery-closeout/SKILL.md +9 -4
- package/generated/.github/skills/agdf-delivery-path-search/SKILL.md +75 -0
- package/generated/.github/skills/agdf-release-or/SKILL.md +8 -4
- package/generated/.github/skills/agdf-runtime-contract.md +24 -0
- package/generated/.opencode/AGDF.md +2 -0
- package/generated/.opencode/README.md +1 -0
- package/generated/.opencode/agdf-runtime-contract.md +24 -0
- package/generated/.opencode/agents/agdf-delivery-closeout.md +9 -4
- package/generated/.opencode/agents/agdf-delivery-path-search.md +76 -0
- package/generated/.opencode/agents/agdf-release-or.md +8 -4
- package/generated/AGENTS.md +2 -0
- package/generated/plugins/agdf/.codex-plugin/plugin.json +1 -1
- package/generated/plugins/agdf/control/templates/AGDF_RUN.md +1 -0
- package/generated/plugins/agdf/control/templates/artefacts/OR.md +1 -0
- package/generated/plugins/agdf/meta/agdf-agent-router.md +2 -0
- package/generated/plugins/agdf/meta/agdf-plugin.definition.json +6 -1
- package/generated/plugins/agdf/meta/agdf-runtime-contract.md +24 -0
- package/generated/plugins/agdf/skills/delivery-closeout/SKILL.md +9 -4
- package/generated/plugins/agdf/skills/delivery-path-search/SKILL.md +75 -0
- package/generated/plugins/agdf/skills/delivery-path-search/help.md +5 -0
- package/generated/plugins/agdf/skills/release-or/SKILL.md +8 -4
- package/lib/delivery-path-search/candidate-policy.js +34 -0
- package/lib/delivery-path-search/contracts.js +110 -0
- package/lib/delivery-path-search/evaluators/codex.js +67 -0
- package/lib/delivery-path-search/evaluators/protocol.js +13 -0
- package/lib/delivery-path-search/persistence.js +34 -0
- package/lib/delivery-path-search/scoring.js +21 -0
- package/lib/delivery-path-search/search-engine.js +92 -0
- package/lib/delivery-path-search/state-adapter.js +58 -0
- package/lib/delivery-path-search/surfaces/capabilities.js +14 -0
- package/package.json +4 -2
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { CONTRACT_VERSION } from "./contracts.js";
|
|
4
|
+
|
|
5
|
+
function section(content, heading) {
|
|
6
|
+
return content.match(new RegExp(`## ${heading}\\r?\\n([\\s\\S]*?)(?=\\r?\\n## |$)`))?.[1] ?? "";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function tableAnswers(content) {
|
|
10
|
+
const answers = {};
|
|
11
|
+
for (const line of section(content, "Current Control State").split(/\r?\n/)) {
|
|
12
|
+
const cells = line.split("|").slice(1, -1).map((cell) => cell.trim());
|
|
13
|
+
if (cells.length >= 2 && cells[0] && !cells[0].startsWith("---") && cells[0] !== "Question") answers[cells[0]] = cells[1];
|
|
14
|
+
}
|
|
15
|
+
return answers;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function statusCard(content) {
|
|
19
|
+
const card = {};
|
|
20
|
+
for (const line of section(content, "Run Status Card").split(/\r?\n/)) {
|
|
21
|
+
const cells = line.split("|").slice(1, -1).map((cell) => cell.trim().replace(/^`|`$/g, ""));
|
|
22
|
+
if (cells.length >= 2 && cells[0] && !cells[0].startsWith("---") && cells[0] !== "Run status") card[cells[0]] = cells[1];
|
|
23
|
+
}
|
|
24
|
+
return card;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function listCell(value) {
|
|
28
|
+
return String(value ?? "").split(/\s*;\s*/).map((item) => item.trim()).filter(Boolean);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function searchInputFromControl(targetDir, options = {}) {
|
|
32
|
+
const runPath = join(targetDir, ".agdf", "control", "AGDF_RUN.md");
|
|
33
|
+
if (!existsSync(runPath)) throw new Error("missing .agdf/control/AGDF_RUN.md");
|
|
34
|
+
const content = readFileSync(runPath, "utf8");
|
|
35
|
+
const meta = Object.fromEntries([...content.matchAll(/^- ([a-z_]+):\s*(.+)$/gm)].map((match) => [match[1], match[2].replace(/^`|`$/g, "").trim()]));
|
|
36
|
+
const answers = tableAnswers(content);
|
|
37
|
+
const card = statusCard(content);
|
|
38
|
+
return {
|
|
39
|
+
contract_version: CONTRACT_VERSION,
|
|
40
|
+
scope_key: options.scopeKey ?? meta.run_id ?? "unknown-scope",
|
|
41
|
+
objective: section(content, "Objective").trim(),
|
|
42
|
+
current_gate: card["Current gate"] ?? meta.current_gate ?? "unknown",
|
|
43
|
+
allowed_actions: options.allowedActions ?? listCell(card["Allowed now"]),
|
|
44
|
+
forbidden_actions: options.forbiddenActions ?? listCell(answers["What is explicitly forbidden right now?"]),
|
|
45
|
+
evidence_refs: [...content.matchAll(/\|\s*([^|]+)\s*\|\s*([^|]+)\s*\|\s*([^|]+)\s*\|\s*(direct|indirect)\s*\|/g)]
|
|
46
|
+
.slice(1).map((match) => `${match[1].trim()}: ${match[2].trim()}`),
|
|
47
|
+
risks: section(content, "Risks").split(/\r?\n/).filter((line) => line.startsWith("|") && !line.includes("---") && !line.includes("| Risk |")).map((line) => line.split("|")[1].trim()),
|
|
48
|
+
enforcement: options.enforcement ?? { level: "instruction_only", evidence: ["surface instruction prohibits implementation during search"] },
|
|
49
|
+
budgets: {
|
|
50
|
+
max_candidates: options.maxCandidates ?? 5,
|
|
51
|
+
max_depth: options.maxDepth ?? 2,
|
|
52
|
+
max_evaluations: options.maxEvaluations ?? 8,
|
|
53
|
+
max_duration_ms: options.maxDurationMs ?? 120000,
|
|
54
|
+
max_cost_units: options.maxCostUnits ?? 20,
|
|
55
|
+
stability_window: options.stabilityWindow ?? 3,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { validateEnforcement } from "../contracts.js";
|
|
2
|
+
|
|
3
|
+
export function enforcementForSurface(surface, evidence = []) {
|
|
4
|
+
const defaults = {
|
|
5
|
+
codex: { level: "tool_enforced", evidence: ["codex exec --sandbox read-only --ephemeral"] },
|
|
6
|
+
claude: { level: "instruction_only", evidence: [] },
|
|
7
|
+
copilot: { level: "instruction_only", evidence: [] },
|
|
8
|
+
opencode: { level: "instruction_only", evidence: [] },
|
|
9
|
+
generic: { level: "instruction_only", evidence: [] },
|
|
10
|
+
};
|
|
11
|
+
const selected = structuredClone(defaults[surface] ?? defaults.generic);
|
|
12
|
+
if (evidence.length) selected.evidence = evidence;
|
|
13
|
+
return validateEnforcement(selected);
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-agdf",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Bootstrap AGDF repository-local plugin files, Copilot/OpenCode instructions, skills, control files and machine-readable checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"bin",
|
|
8
|
+
"lib",
|
|
8
9
|
"generated",
|
|
9
10
|
"opencode-plugin.js",
|
|
10
11
|
"README.md",
|
|
@@ -20,8 +21,9 @@
|
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
23
|
"sync-package-assets": "node ./scripts/sync-package-assets.js",
|
|
24
|
+
"test:delivery-path-search": "node ./scripts/delivery-path-search-test.js",
|
|
23
25
|
"test:routing": "npm run sync-package-assets && node ./scripts/test-routing.js",
|
|
24
|
-
"smoke-test": "npm run sync-package-assets && node ./scripts/smoke-test.js && node ./scripts/test-routing.js",
|
|
26
|
+
"smoke-test": "npm run sync-package-assets && npm run test:delivery-path-search && node ./scripts/smoke-test.js && node ./scripts/test-routing.js",
|
|
25
27
|
"prepack": "npm run sync-package-assets"
|
|
26
28
|
},
|
|
27
29
|
"keywords": [
|