@interf/compiler 0.16.0 → 0.21.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/LICENSE.md +1 -0
- package/README.md +90 -73
- package/TRADEMARKS.md +4 -4
- package/dist/cli/commands/mcp.d.ts +0 -34
- package/dist/cli/commands/mcp.js +246 -45
- package/dist/cli/commands/method.js +261 -15
- package/dist/cli/commands/prep.js +116 -15
- package/dist/cli/commands/runs.js +103 -9
- package/dist/cli/commands/status.js +4 -2
- package/dist/cli/commands/test.d.ts +10 -0
- package/dist/cli/commands/{verify.js → test.js} +24 -17
- package/dist/cli/commands/web.js +82 -8
- package/dist/cli/commands/wizard.js +158 -51
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +3 -3
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +5 -5
- package/dist/compiler-ui/__next._full.txt +13 -12
- package/dist/compiler-ui/__next._head.txt +3 -3
- package/dist/compiler-ui/__next._index.txt +5 -4
- package/dist/compiler-ui/__next._tree.txt +4 -3
- package/dist/compiler-ui/_next/static/chunks/01646j7yi.w5a.css +1 -0
- package/dist/compiler-ui/_next/static/chunks/{0n51hrfoufc7g.js → 02f_.8.ebn556.js} +1 -1
- package/dist/compiler-ui/_next/static/chunks/02r7siaw-_p5w.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/{08m7vf5asqlsm.js → 04d0ly-7xb~-j.js} +10 -10
- package/dist/compiler-ui/_next/static/chunks/0fhs9psnxqd8s.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0mssmhpbifj15.css +2 -0
- package/dist/compiler-ui/_next/static/chunks/0nypu~ddwxari.js +116 -0
- package/dist/compiler-ui/_next/static/chunks/0p3s8iyhgcww2.js +31 -0
- package/dist/compiler-ui/_next/static/chunks/0tjf-vu_rz8s0.css +1 -0
- package/dist/compiler-ui/_next/static/chunks/0u6p3fpbbfgtl.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0wpx5..8dnh0w.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0y0uj160p0ts~.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/10t8l~_oenf.c.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/13gz9e7z~imx1.js +5 -0
- package/dist/compiler-ui/_next/static/chunks/156xed-b6czaw.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/{turbopack-0.uq1k8c0j4s..js → turbopack-02-3e_c-yz~5g.js} +1 -1
- package/dist/compiler-ui/_next/static/chunks/{turbopack-10e~t1yzi4svj.js → turbopack-0apv8vb-nczuy.js} +1 -1
- package/dist/compiler-ui/_not-found/__next._full.txt +10 -9
- package/dist/compiler-ui/_not-found/__next._head.txt +3 -3
- package/dist/compiler-ui/_not-found/__next._index.txt +5 -4
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.txt +3 -3
- package/dist/compiler-ui/_not-found/__next._tree.txt +3 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +10 -9
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +13 -12
- package/dist/packages/contracts/index.d.ts +2 -2
- package/dist/packages/contracts/index.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +275 -72
- package/dist/packages/contracts/lib/schema.js +244 -83
- package/dist/packages/engine/action-definitions.d.ts +174 -13
- package/dist/packages/engine/action-definitions.js +125 -122
- package/dist/packages/engine/action-planner.js +4 -11
- package/dist/packages/engine/agents/lib/shells.d.ts +15 -5
- package/dist/packages/engine/agents/lib/shells.js +134 -123
- package/dist/packages/engine/agents/role-executors.js +1 -1
- package/dist/packages/engine/cloud-seams.d.ts +115 -0
- package/dist/packages/engine/cloud-seams.js +84 -0
- package/dist/packages/engine/compile/artifact-counts.d.ts +1 -1
- package/dist/packages/engine/compile/artifact-counts.js +3 -3
- package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
- package/dist/packages/engine/compile/artifact-status.js +166 -0
- package/dist/packages/engine/compile/billing-events.d.ts +89 -0
- package/dist/packages/engine/compile/billing-events.js +74 -0
- package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
- package/dist/packages/engine/compile/check-evaluator.js +298 -0
- package/dist/packages/engine/compile/compiled-paths.js +6 -6
- package/dist/packages/engine/compile/compiled-schema.d.ts +7 -17
- package/dist/packages/engine/compile/compiled-schema.js +55 -70
- package/dist/packages/engine/compile/compiled-stage-plan.d.ts +1 -0
- package/dist/packages/engine/compile/compiled-stage-plan.js +32 -15
- package/dist/packages/engine/compile/compiled-stage-runner.js +1 -1
- package/dist/packages/engine/compile/index.d.ts +0 -1
- package/dist/packages/engine/compile/index.js +0 -1
- package/dist/packages/engine/compile/lib/schema.d.ts +111 -92
- package/dist/packages/engine/compile/lib/schema.js +35 -39
- package/dist/packages/engine/compile/method-primitives.d.ts +2 -2
- package/dist/packages/engine/compile/method-primitives.js +1 -1
- package/dist/packages/engine/compile/reset.js +4 -4
- package/dist/packages/engine/compile/runtime-contracts.js +2 -1
- package/dist/packages/engine/compile/runtime-prompt.js +3 -2
- package/dist/packages/engine/compile/runtime-reconcile.js +35 -35
- package/dist/packages/engine/compile/runtime-runs.js +0 -1
- package/dist/packages/engine/compile/runtime-types.d.ts +7 -8
- package/dist/packages/engine/compile/runtime.d.ts +1 -2
- package/dist/packages/engine/compile/runtime.js +0 -1
- package/dist/packages/engine/compile/state-health.js +6 -6
- package/dist/packages/engine/compile/state-view.js +7 -6
- package/dist/packages/engine/compile/validate-compiled.js +61 -30
- package/dist/packages/engine/compile/validate.js +26 -24
- package/dist/packages/engine/connection-config.js +1 -1
- package/dist/packages/engine/execution/lib/schema.d.ts +89 -33
- package/dist/packages/engine/execution/lib/schema.js +13 -5
- package/dist/packages/engine/index.d.ts +2 -2
- package/dist/packages/engine/index.js +1 -1
- package/dist/packages/engine/instance-paths.d.ts +15 -9
- package/dist/packages/engine/instance-paths.js +15 -9
- package/dist/packages/engine/lib/schema.d.ts +1316 -351
- package/dist/packages/engine/lib/schema.js +99 -36
- package/dist/packages/engine/native-run-handlers.js +25 -15
- package/dist/packages/engine/preparation-store.d.ts +9 -7
- package/dist/packages/engine/preparation-store.js +20 -0
- package/dist/packages/engine/requested-artifacts.d.ts +5 -0
- package/dist/packages/engine/requested-artifacts.js +36 -0
- package/dist/packages/engine/routes.d.ts +7 -1
- package/dist/packages/engine/routes.js +7 -1
- package/dist/packages/engine/run-observability.js +4 -4
- package/dist/packages/engine/runtime-event-applier.js +7 -0
- package/dist/packages/engine/runtime-proposal-helpers.d.ts +2 -2
- package/dist/packages/engine/runtime-proposal-helpers.js +6 -8
- package/dist/packages/engine/runtime-resource-builders.d.ts +11 -6
- package/dist/packages/engine/runtime-resource-builders.js +18 -6
- package/dist/packages/engine/runtime.d.ts +70 -8
- package/dist/packages/engine/runtime.js +304 -49
- package/dist/packages/engine/server.d.ts +25 -0
- package/dist/packages/engine/server.js +161 -50
- package/dist/packages/engine/verify/index.d.ts +10 -10
- package/dist/packages/engine/verify/index.js +8 -8
- package/dist/packages/engine/verify/readiness-check-run.d.ts +27 -4
- package/dist/packages/engine/verify/readiness-check-run.js +92 -24
- package/dist/packages/engine/verify/{test-execution.d.ts → verify-execution.d.ts} +2 -2
- package/dist/packages/engine/verify/{test-execution.js → verify-execution.js} +3 -3
- package/dist/packages/engine/verify/{test-paths.d.ts → verify-paths.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-sandbox.d.ts → verify-sandbox.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.d.ts → verify-specs.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.js → verify-specs.js} +1 -1
- package/dist/packages/engine/verify/{test-targets.d.ts → verify-targets.d.ts} +1 -1
- package/dist/packages/engine/verify/{test.d.ts → verify.d.ts} +4 -4
- package/dist/packages/engine/verify/{test.js → verify.js} +3 -3
- package/dist/packages/engine/wire-schemas.d.ts +549 -0
- package/dist/packages/engine/wire-schemas.js +59 -0
- package/dist/packages/methods/authoring/method-authoring.d.ts +5 -1
- package/dist/packages/methods/authoring/method-authoring.js +68 -18
- package/dist/packages/methods/authoring/method-edit-session.js +5 -5
- package/dist/packages/methods/authoring/method-improvement.js +1 -1
- package/dist/packages/methods/package/builtin-compiled-method.d.ts +12 -12
- package/dist/packages/methods/package/builtin-compiled-method.js +26 -23
- package/dist/packages/methods/package/context-interface.d.ts +39 -26
- package/dist/packages/methods/package/context-interface.js +48 -39
- package/dist/packages/methods/package/interf-method-package.js +28 -47
- package/dist/packages/methods/package/local-methods.d.ts +4 -4
- package/dist/packages/methods/package/local-methods.js +53 -66
- package/dist/packages/methods/package/method-definitions.d.ts +4 -6
- package/dist/packages/methods/package/method-definitions.js +1 -5
- package/dist/packages/methods/package/method-helpers.d.ts +0 -2
- package/dist/packages/methods/package/method-helpers.js +0 -4
- package/dist/packages/project/interf-detect.js +6 -6
- package/dist/packages/project/interf-scaffold.js +12 -12
- package/dist/packages/project/lib/schema.d.ts +193 -0
- package/dist/packages/project/lib/schema.js +46 -1
- package/dist/packages/project/source-config.js +6 -1
- package/dist/packages/project/source-folders.js +1 -1
- package/package.json +12 -23
- package/public-repo/CONTRIBUTING.md +47 -0
- package/public-repo/LICENSE.md +1 -0
- package/public-repo/README.md +325 -0
- package/public-repo/SECURITY.md +67 -0
- package/public-repo/TRADEMARKS.md +8 -0
- package/{builtin-methods → public-repo/methods}/interf-default/README.md +10 -7
- package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/shape/SKILL.md +4 -8
- package/{builtin-methods → public-repo/methods}/interf-default/method.json +8 -69
- package/public-repo/methods/interf-default/method.schema.json +75 -0
- package/public-repo/methods/interf-default/use/query/SKILL.md +23 -0
- package/public-repo/plugins/README.md +9 -0
- package/public-repo/plugins/interf/.claude-plugin/plugin.json +21 -0
- package/public-repo/plugins/interf/.mcp.json +12 -0
- package/public-repo/plugins/interf/README.md +29 -0
- package/public-repo/plugins/interf/skills/interf/SKILL.md +477 -0
- package/public-repo/skills/interf/SKILL.md +477 -0
- package/agent-skills/interf-actions/SKILL.md +0 -185
- package/agent-skills/interf-actions/references/cli.md +0 -243
- package/builtin-methods/interf-default/method.schema.json +0 -73
- package/builtin-methods/interf-default/use/query/SKILL.md +0 -28
- package/dist/cli/commands/verify.d.ts +0 -8
- package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +0 -5
- package/dist/compiler-ui/_next/static/chunks/06z~l3kwb891e.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/08g7lvje.te.u.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0_i-3_5l9t2qe.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0b-ywny_j0g~0.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0b52v41o1gixx.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0gpzgsv0w.q~m.js +0 -31
- package/dist/compiler-ui/_next/static/chunks/0ilwfezfvu6~-.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0jipmpez3_ehh.js +0 -89
- package/dist/compiler-ui/_next/static/chunks/0xxmf45eskdt~.css +0 -1
- package/dist/compiler-ui/_next/static/chunks/13awzu4tooflw.css +0 -3
- package/dist/compiler-ui/_next/static/chunks/14wtz~vq25~qq.js +0 -1
- package/dist/packages/engine/compile/runtime-acceptance.d.ts +0 -9
- package/dist/packages/engine/compile/runtime-acceptance.js +0 -265
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_ssgManifest.js +0 -0
- /package/dist/packages/engine/verify/{test-paths.js → verify-paths.js} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.d.ts → verify-profile-presets.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.js → verify-profile-presets.js} +0 -0
- /package/dist/packages/engine/verify/{test-sandbox.js → verify-sandbox.js} +0 -0
- /package/dist/packages/engine/verify/{test-targets.js → verify-targets.js} +0 -0
- /package/dist/packages/engine/verify/{test-types.d.ts → verify-types.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-types.js → verify-types.js} +0 -0
- /package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/structure/SKILL.md +0 -0
- /package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/summarize/SKILL.md +0 -0
- /package/{builtin-methods → public-repo/methods}/interf-default/improve/SKILL.md +0 -0
|
@@ -3,7 +3,7 @@ import { dirname, join } from "node:path";
|
|
|
3
3
|
import { renderCompiledQuerySkill } from "../../engine/agents/lib/shells.js";
|
|
4
4
|
import { copyMethodPackageDirectory, isPortableMethodPackage, patchMethodPackageMetadata, resolveMethodPackageSourcePath, methodDefinitionPath, mergeStagePolicyNotesForStages, } from "./local-methods.js";
|
|
5
5
|
import { getCompiledMethod, } from "./method-definitions.js";
|
|
6
|
-
import { CONTEXT_INTERFACE_FILE, deriveMethodInputsFromContextInterface, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
|
|
6
|
+
import { CONTEXT_INTERFACE_FILE, deriveMethodInputsFromContextInterface, listContextInterfaceArtifacts, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
|
|
7
7
|
import { methodPackagePathForCompiled } from "../../engine/compile/compiled-paths.js";
|
|
8
8
|
function writeMethodStarterDocs(dirPath, docs, options) {
|
|
9
9
|
for (const doc of docs ?? []) {
|
|
@@ -47,7 +47,6 @@ function writeMethodPackageJson(rootPath, method, options) {
|
|
|
47
47
|
skill_dir: stage.skillDir,
|
|
48
48
|
reads: stage.reads,
|
|
49
49
|
writes: stage.writes,
|
|
50
|
-
...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
|
|
51
50
|
})),
|
|
52
51
|
...(method.stagePolicyNotes ? { stage_policy_notes: method.stagePolicyNotes } : {}),
|
|
53
52
|
}, null, 2)}\n`);
|
|
@@ -60,9 +59,12 @@ function renderMethodReadme(method) {
|
|
|
60
59
|
const interfaceSummary = contextInterface
|
|
61
60
|
? summarizeContextInterface(contextInterface)
|
|
62
61
|
: null;
|
|
63
|
-
const
|
|
64
|
-
? contextInterface
|
|
65
|
-
|
|
62
|
+
const contextInterfaceArtifacts = contextInterface
|
|
63
|
+
? listContextInterfaceArtifacts(contextInterface)
|
|
64
|
+
: [];
|
|
65
|
+
const contextInterfaceLines = contextInterfaceArtifacts.length > 0
|
|
66
|
+
? contextInterfaceArtifacts
|
|
67
|
+
.map((artifact) => `- \`${artifact.id}\` — ${artifact.role} ${artifact.kind} Artifact at \`${artifact.path}\`: ${artifact.description}`)
|
|
66
68
|
.join("\n")
|
|
67
69
|
: null;
|
|
68
70
|
const inputs = method.inputs?.length
|
|
@@ -75,10 +77,10 @@ function renderMethodReadme(method) {
|
|
|
75
77
|
: null;
|
|
76
78
|
const contextInterfaceSummaryLines = interfaceSummary
|
|
77
79
|
? [
|
|
78
|
-
`- Input
|
|
79
|
-
`- Working
|
|
80
|
-
`- Output
|
|
81
|
-
`- Runtime
|
|
80
|
+
`- Input Artifacts: ${interfaceSummary.inputArtifacts.length > 0 ? interfaceSummary.inputArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
81
|
+
`- Working Artifacts: ${interfaceSummary.workingArtifacts.length > 0 ? interfaceSummary.workingArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
82
|
+
`- Output Artifacts: ${interfaceSummary.outputArtifacts.length > 0 ? interfaceSummary.outputArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
83
|
+
`- Runtime Artifacts: ${interfaceSummary.runtimeArtifacts.length > 0 ? interfaceSummary.runtimeArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
82
84
|
].join("\n")
|
|
83
85
|
: null;
|
|
84
86
|
return [
|
|
@@ -113,7 +115,7 @@ function renderMethodReadme(method) {
|
|
|
113
115
|
"",
|
|
114
116
|
]
|
|
115
117
|
: []),
|
|
116
|
-
"
|
|
118
|
+
"Artifact map:",
|
|
117
119
|
"",
|
|
118
120
|
contextInterfaceLines,
|
|
119
121
|
]
|
|
@@ -142,7 +144,7 @@ function renderDerivedMethodReadme(options) {
|
|
|
142
144
|
options.hint,
|
|
143
145
|
"",
|
|
144
146
|
`This Method package was forked from \`${options.baseMethodId}\` and materialized as a standalone package for this kind of agent work.`,
|
|
145
|
-
"It starts with that Method's topology; edit the package when the agent work needs different stages,
|
|
147
|
+
"It starts with that Method's topology; edit the package when the agent work needs different stages, Artifacts, or checks.",
|
|
146
148
|
"",
|
|
147
149
|
"Interf runs the local copy of this package directly. Keep purpose, inputs, context interface, and stage docs self-contained in this folder instead of relying on runtime inheritance.",
|
|
148
150
|
"",
|
|
@@ -161,7 +163,7 @@ function renderSeedMethodReadme(options) {
|
|
|
161
163
|
options.hint,
|
|
162
164
|
"",
|
|
163
165
|
`This Method package was forked from \`${options.baseMethodId}\` as a standalone local package.`,
|
|
164
|
-
"It starts with that Method's topology; edit the package when the agent work needs different stages,
|
|
166
|
+
"It starts with that Method's topology; edit the package when the agent work needs different stages, Artifacts, or checks.",
|
|
165
167
|
"",
|
|
166
168
|
"Interf runs the local copy of this package directly. Refine purpose, inputs, context interface, and stage instructions in this folder instead of relying on inheritance.",
|
|
167
169
|
"",
|
|
@@ -206,7 +208,6 @@ function renderImproveSkill(method) {
|
|
|
206
208
|
}
|
|
207
209
|
function renderStageSkill(method, stage) {
|
|
208
210
|
const notes = method.stagePolicyNotes?.[stage.id] ?? [];
|
|
209
|
-
const acceptanceKeys = stage.acceptance ? Object.keys(stage.acceptance) : [];
|
|
210
211
|
const abstractRules = stage.contractType === "compiled-file-evidence"
|
|
211
212
|
? [
|
|
212
213
|
"- Valid abstract forms for deterministic validation are:",
|
|
@@ -223,27 +224,19 @@ function renderStageSkill(method, stage) {
|
|
|
223
224
|
"## Stage Contract",
|
|
224
225
|
"",
|
|
225
226
|
`- Contract type: \`${stage.contractType}\``,
|
|
226
|
-
`- Reads
|
|
227
|
-
`- Writes
|
|
227
|
+
`- Reads Artifacts: ${stage.reads.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
|
|
228
|
+
`- Writes Artifacts: ${stage.writes.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
|
|
228
229
|
"",
|
|
229
230
|
"## Requirements",
|
|
230
231
|
"",
|
|
231
232
|
"- Treat `method.json` and `method.schema.json` as the authoritative package contract for this stage.",
|
|
232
|
-
"- Read only from the declared input
|
|
233
|
-
"- Write only inside the declared output
|
|
234
|
-
"- Keep stage instructions,
|
|
233
|
+
"- Read only from the declared input Artifacts unless this package explicitly documents a broader method.",
|
|
234
|
+
"- Write only inside the declared output Artifacts for this stage. Do not invent undeclared Artifacts or implicit outputs.",
|
|
235
|
+
"- Keep stage instructions, artifact ownership, and Method-level checks aligned when you change this stage.",
|
|
235
236
|
"- Treat runtime files as proof and execution state, not as the source of truth for Method behavior.",
|
|
236
237
|
"- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
237
238
|
...abstractRules,
|
|
238
239
|
"",
|
|
239
|
-
...(acceptanceKeys.length > 0
|
|
240
|
-
? [
|
|
241
|
-
"## Declarative Acceptance",
|
|
242
|
-
"",
|
|
243
|
-
...acceptanceKeys.map((key) => `- \`${key}\``),
|
|
244
|
-
"",
|
|
245
|
-
]
|
|
246
|
-
: []),
|
|
247
240
|
...(notes.length > 0
|
|
248
241
|
? [
|
|
249
242
|
"## Notes",
|
|
@@ -428,24 +421,15 @@ export function createScratchLocalMethodPackage(options) {
|
|
|
428
421
|
version: 1,
|
|
429
422
|
target_type: "compiled",
|
|
430
423
|
label: `${options.label} Method schema`,
|
|
431
|
-
|
|
424
|
+
artifacts: [
|
|
432
425
|
{
|
|
433
426
|
id: "draft-context",
|
|
434
|
-
|
|
435
|
-
path: "draft",
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
id: "runtime",
|
|
443
|
-
role: "runtime",
|
|
444
|
-
path: ".interf/runtime",
|
|
445
|
-
kind: "runtime",
|
|
446
|
-
required: true,
|
|
447
|
-
owned_by: [],
|
|
448
|
-
description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
|
|
427
|
+
description: "Temporary placeholder Artifact for the neutral authoring scaffold. Replace it with task-specific Artifacts.",
|
|
428
|
+
shape: { kind: "path", path: "draft", artifact_kind: "directory" },
|
|
429
|
+
checks: [
|
|
430
|
+
{ id: "exists", kind: "min_file_count", required: true, params: { min: 1 } },
|
|
431
|
+
],
|
|
432
|
+
built_by_stages: ["prepare"],
|
|
449
433
|
},
|
|
450
434
|
],
|
|
451
435
|
},
|
|
@@ -457,17 +441,14 @@ export function createScratchLocalMethodPackage(options) {
|
|
|
457
441
|
contractType: "method-draft-stage",
|
|
458
442
|
skillDir: "prepare",
|
|
459
443
|
role: "general",
|
|
460
|
-
reads: [
|
|
444
|
+
reads: [],
|
|
461
445
|
writes: ["draft-context"],
|
|
462
|
-
acceptance: {
|
|
463
|
-
stage_truthy: ["finished_at"],
|
|
464
|
-
},
|
|
465
446
|
},
|
|
466
447
|
],
|
|
467
448
|
stagePolicyNotes: {
|
|
468
449
|
prepare: [
|
|
469
450
|
"This is a neutral authoring scaffold, not a recommended method topology.",
|
|
470
|
-
"Replace this stage,
|
|
451
|
+
"Replace this stage, Artifact, and check when drafting the final method.",
|
|
471
452
|
],
|
|
472
453
|
},
|
|
473
454
|
starterDocs: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { MethodCompilerApiSchema,
|
|
2
|
+
import { MethodCompilerApiSchema, MethodPurposeSchema, type MethodStageArtifactReadAccess, type MethodStageArtifactWriteAccess } from "../../engine/compile/lib/schema.js";
|
|
3
3
|
import { RuntimeContractTypeSchema } from "../../contracts/lib/schema.js";
|
|
4
4
|
import { MethodInputSpecSchema, type ContextInterface, type MethodInputSpec } from "./context-interface.js";
|
|
5
5
|
export interface LocalMethodStarterDoc {
|
|
@@ -18,9 +18,8 @@ export interface LocalMethodStageDefinition {
|
|
|
18
18
|
* role-map (`~/.interf/agents.json`).
|
|
19
19
|
*/
|
|
20
20
|
role?: string;
|
|
21
|
-
reads:
|
|
22
|
-
writes:
|
|
23
|
-
acceptance?: z.infer<typeof RuntimeStageAcceptanceSchema>;
|
|
21
|
+
reads: MethodStageArtifactReadAccess;
|
|
22
|
+
writes: MethodStageArtifactWriteAccess;
|
|
24
23
|
}
|
|
25
24
|
export interface LocalMethodDefinition {
|
|
26
25
|
id: string;
|
|
@@ -44,6 +43,7 @@ export declare function mergeStagePolicyNotesForStages(stages: readonly {
|
|
|
44
43
|
export declare function builtinMethodPackagePath(methodId: string): string;
|
|
45
44
|
export declare function methodDefinitionPath(prepDataDir: string, id: string): string;
|
|
46
45
|
export declare function loadMethodDefinitionFromDir(dirPath: string): LocalMethodDefinition | null;
|
|
46
|
+
export declare function isNeutralScaffoldMethodDefinition(definition: Pick<LocalMethodDefinition, "purpose" | "stages" | "method_schema">): boolean;
|
|
47
47
|
export declare function listLocalMethodDefinitions(prepDataDir: string): LocalMethodDefinition[];
|
|
48
48
|
export declare function loadLocalMethodDefinition(prepDataDir: string, id: string): LocalMethodDefinition | null;
|
|
49
49
|
export declare function resolveMethodPackageSourcePath(prepDataDir: string, methodId: string): string | null;
|
|
@@ -5,11 +5,10 @@ import { listFilesRecursive } from "../../contracts/utils/filesystem.js";
|
|
|
5
5
|
import { warnInterf } from "../../contracts/utils/logger.js";
|
|
6
6
|
import { readJsonFileUnchecked, readJsonFileWithSchema } from "../../contracts/utils/parse.js";
|
|
7
7
|
import { isMarkdownFile } from "../../contracts/utils/file-types.js";
|
|
8
|
-
import { MethodCompilerApiSchema,
|
|
8
|
+
import { MethodCompilerApiSchema, MethodPurposeSchema, MethodStageArtifactReadAccessSchema, MethodStageArtifactWriteAccessSchema, } from "../../engine/compile/lib/schema.js";
|
|
9
9
|
import { RuntimeContractTypeSchema, InterfIdPattern, } from "../../contracts/lib/schema.js";
|
|
10
10
|
import { asPreparationDataDir, preparationMethodsRoot, } from "../../contracts/lib/preparation-paths.js";
|
|
11
|
-
import {
|
|
12
|
-
import { CONTEXT_INTERFACE_FILE, ContextInterfaceSchema, contextInterfaceExists, contextInterfaceFilePath, readContextInterface, MethodInputSpecSchema, writeContextInterface, } from "./context-interface.js";
|
|
11
|
+
import { CONTEXT_INTERFACE_FILE, ContextInterfaceSchema, contextInterfaceExists, contextInterfaceFilePath, listContextInterfaceArtifacts, readContextInterface, MethodInputSpecSchema, writeContextInterface, } from "./context-interface.js";
|
|
13
12
|
import { PACKAGE_ROOT } from "./lib/package-root.js";
|
|
14
13
|
const LocalMethodStageDefinitionSchema = z.object({
|
|
15
14
|
id: z.string().regex(InterfIdPattern),
|
|
@@ -18,9 +17,8 @@ const LocalMethodStageDefinitionSchema = z.object({
|
|
|
18
17
|
skill_dir: z.string().regex(InterfIdPattern).optional(),
|
|
19
18
|
description: z.string().min(1).optional(),
|
|
20
19
|
role: z.string().min(1).optional(),
|
|
21
|
-
reads:
|
|
22
|
-
writes:
|
|
23
|
-
acceptance: RuntimeStageAcceptanceSchema.optional(),
|
|
20
|
+
reads: MethodStageArtifactReadAccessSchema,
|
|
21
|
+
writes: MethodStageArtifactWriteAccessSchema,
|
|
24
22
|
});
|
|
25
23
|
const LocalMethodDefinitionSchema = z.object({
|
|
26
24
|
id: z.string().regex(InterfIdPattern),
|
|
@@ -68,7 +66,7 @@ function methodRootPath(prepDataDir) {
|
|
|
68
66
|
return preparationMethodsRoot(asPreparationDataDir(prepDataDir));
|
|
69
67
|
}
|
|
70
68
|
export function builtinMethodPackagePath(methodId) {
|
|
71
|
-
return join(PACKAGE_ROOT, "
|
|
69
|
+
return join(PACKAGE_ROOT, "public-repo", "methods", methodId);
|
|
72
70
|
}
|
|
73
71
|
export function methodDefinitionPath(prepDataDir, id) {
|
|
74
72
|
return join(methodRootPath(prepDataDir), id);
|
|
@@ -141,6 +139,16 @@ export function loadMethodDefinitionFromDir(dirPath) {
|
|
|
141
139
|
methodSchemaPath: contextInterfaceFilePath(dirPath),
|
|
142
140
|
};
|
|
143
141
|
}
|
|
142
|
+
export function isNeutralScaffoldMethodDefinition(definition) {
|
|
143
|
+
const hasScaffoldPurpose = definition.purpose?.label === "From-scratch Method draft" ||
|
|
144
|
+
Boolean(definition.purpose?.task_hint?.includes("Replace this neutral scaffold"));
|
|
145
|
+
const hasScaffoldStage = Boolean(definition.stages?.some((stage) => stage.id === "prepare" &&
|
|
146
|
+
stage.contract_type === "method-draft-stage" &&
|
|
147
|
+
stage.writes.includes("draft-context")));
|
|
148
|
+
const hasScaffoldArtifact = listContextInterfaceArtifacts(definition.method_schema).some((artifact) => artifact.id === "draft-context" &&
|
|
149
|
+
artifact.description.includes("neutral authoring scaffold"));
|
|
150
|
+
return hasScaffoldPurpose || hasScaffoldStage || hasScaffoldArtifact;
|
|
151
|
+
}
|
|
144
152
|
export function listLocalMethodDefinitions(prepDataDir) {
|
|
145
153
|
const definitions = new Map();
|
|
146
154
|
const root = methodRootPath(prepDataDir);
|
|
@@ -154,18 +162,23 @@ export function listLocalMethodDefinitions(prepDataDir) {
|
|
|
154
162
|
continue;
|
|
155
163
|
}
|
|
156
164
|
const definition = loadMethodDefinitionFromDir(entryPath);
|
|
157
|
-
if (definition)
|
|
165
|
+
if (definition && !isNeutralScaffoldMethodDefinition(definition)) {
|
|
158
166
|
definitions.set(definition.id, definition);
|
|
167
|
+
}
|
|
159
168
|
}
|
|
160
169
|
}
|
|
161
170
|
return [...definitions.values()].sort((a, b) => a.label.localeCompare(b.label));
|
|
162
171
|
}
|
|
163
172
|
export function loadLocalMethodDefinition(prepDataDir, id) {
|
|
164
|
-
|
|
173
|
+
const definition = loadMethodDefinitionFromDir(methodDefinitionPath(prepDataDir, id));
|
|
174
|
+
if (!definition || isNeutralScaffoldMethodDefinition(definition))
|
|
175
|
+
return null;
|
|
176
|
+
return definition;
|
|
165
177
|
}
|
|
166
178
|
export function resolveMethodPackageSourcePath(prepDataDir, methodId) {
|
|
167
179
|
const localPath = methodDefinitionPath(prepDataDir, methodId);
|
|
168
|
-
|
|
180
|
+
const local = loadMethodDefinitionFromDir(localPath);
|
|
181
|
+
if (local && !isNeutralScaffoldMethodDefinition(local))
|
|
169
182
|
return localPath;
|
|
170
183
|
const builtinPath = builtinMethodPackagePath(methodId);
|
|
171
184
|
if (loadMethodDefinitionFromDir(builtinPath))
|
|
@@ -365,8 +378,9 @@ export function validateMethodPackage(dirPath) {
|
|
|
365
378
|
const stages = def.stages ?? [];
|
|
366
379
|
const stageIds = new Set(stages.map((stage) => stage.id));
|
|
367
380
|
const seenPaths = new Map();
|
|
368
|
-
const
|
|
369
|
-
const
|
|
381
|
+
const seenArtifactIds = new Set();
|
|
382
|
+
const schemaArtifacts = listContextInterfaceArtifacts(methodSchema);
|
|
383
|
+
const artifactById = new Map(schemaArtifacts.map((artifact) => [artifact.id, artifact]));
|
|
370
384
|
const normalizedParts = (value) => value.replaceAll("\\", "/").split("/").filter(Boolean);
|
|
371
385
|
const hasOverlappingPath = (value, other) => {
|
|
372
386
|
const a = normalizedParts(value);
|
|
@@ -375,79 +389,52 @@ export function validateMethodPackage(dirPath) {
|
|
|
375
389
|
const longer = a.length <= b.length ? b : a;
|
|
376
390
|
return shorter.every((part, index) => longer[index] === part);
|
|
377
391
|
};
|
|
378
|
-
for (const
|
|
379
|
-
if (
|
|
380
|
-
errors.push(`method.schema.json repeats
|
|
392
|
+
for (const artifact of schemaArtifacts) {
|
|
393
|
+
if (seenArtifactIds.has(artifact.id)) {
|
|
394
|
+
errors.push(`method.schema.json repeats Artifact id "${artifact.id}".`);
|
|
381
395
|
}
|
|
382
|
-
|
|
383
|
-
const existingPathOwner = seenPaths.get(
|
|
396
|
+
seenArtifactIds.add(artifact.id);
|
|
397
|
+
const existingPathOwner = seenPaths.get(artifact.path);
|
|
384
398
|
if (existingPathOwner) {
|
|
385
|
-
errors.push(`method.schema.json repeats
|
|
399
|
+
errors.push(`method.schema.json repeats Artifact path "${artifact.path}".`);
|
|
386
400
|
}
|
|
387
401
|
for (const [existingPath, existingZoneId] of seenPaths.entries()) {
|
|
388
|
-
if (existingPath ===
|
|
402
|
+
if (existingPath === artifact.path)
|
|
389
403
|
continue;
|
|
390
|
-
if (hasOverlappingPath(
|
|
391
|
-
errors.push(`method.schema.json
|
|
404
|
+
if (hasOverlappingPath(artifact.path, existingPath)) {
|
|
405
|
+
errors.push(`method.schema.json Artifacts "${artifact.id}" and "${existingZoneId}" overlap on path "${artifact.path}" / "${existingPath}".`);
|
|
392
406
|
}
|
|
393
407
|
}
|
|
394
|
-
seenPaths.set(
|
|
395
|
-
if ((
|
|
396
|
-
errors.push(`method.schema.json
|
|
408
|
+
seenPaths.set(artifact.path, artifact.id);
|
|
409
|
+
if ((artifact.role === "input" || artifact.role === "runtime") && artifact.owned_by.length > 0) {
|
|
410
|
+
errors.push(`method.schema.json Artifact "${artifact.id}" cannot declare owners because its role is "${artifact.role}".`);
|
|
397
411
|
}
|
|
398
|
-
for (const owner of
|
|
412
|
+
for (const owner of artifact.owned_by) {
|
|
399
413
|
if (!stageIds.has(owner)) {
|
|
400
|
-
errors.push(`method.schema.json references unknown stage "${owner}" for
|
|
414
|
+
errors.push(`method.schema.json references unknown stage "${owner}" for Artifact path "${artifact.path}".`);
|
|
401
415
|
}
|
|
402
416
|
}
|
|
403
417
|
}
|
|
404
418
|
for (const stage of stages) {
|
|
405
|
-
for (const
|
|
406
|
-
if (!
|
|
407
|
-
errors.push(`Stage "${stage.id}" reads unknown
|
|
419
|
+
for (const artifactId of stage.reads) {
|
|
420
|
+
if (!artifactById.has(artifactId)) {
|
|
421
|
+
errors.push(`Stage "${stage.id}" reads unknown Artifact "${artifactId}".`);
|
|
408
422
|
}
|
|
409
423
|
}
|
|
410
|
-
for (const
|
|
411
|
-
const
|
|
412
|
-
if (!
|
|
413
|
-
errors.push(`Stage "${stage.id}" writes unknown
|
|
424
|
+
for (const artifactId of stage.writes) {
|
|
425
|
+
const artifact = artifactById.get(artifactId);
|
|
426
|
+
if (!artifact) {
|
|
427
|
+
errors.push(`Stage "${stage.id}" writes unknown Artifact "${artifactId}".`);
|
|
414
428
|
continue;
|
|
415
429
|
}
|
|
416
|
-
if (
|
|
417
|
-
errors.push(`Stage "${stage.id}" writes
|
|
418
|
-
}
|
|
419
|
-
if (!zone.owned_by.includes(stage.id)) {
|
|
420
|
-
errors.push(`Stage "${stage.id}" writes zone "${zoneId}" but that zone is not owned by the stage in method.schema.json.`);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
for (const artifactPath of Object.keys(stage.acceptance?.artifacts_must_not_contain ?? {})) {
|
|
424
|
-
const normalizedArtifactPath = artifactPath.replaceAll("\\", "/");
|
|
425
|
-
const artifactParts = normalizedArtifactPath.split("/").filter(Boolean);
|
|
426
|
-
if (artifactPath.startsWith("/") ||
|
|
427
|
-
artifactPath.startsWith("\\") ||
|
|
428
|
-
artifactParts.some((part) => part === "..")) {
|
|
429
|
-
errors.push(`Stage "${stage.id}" artifacts_must_not_contain key "${artifactPath}" must be a portable-context relative artifact path.`);
|
|
430
|
-
continue;
|
|
430
|
+
if (artifact.role === "input" || artifact.role === "runtime") {
|
|
431
|
+
errors.push(`Stage "${stage.id}" writes Artifact "${artifactId}" but Artifacts with role "${artifact.role}" are engine-owned inputs, not writable stage outputs.`);
|
|
431
432
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
errors.push(`Stage "${stage.id}" artifacts_must_not_contain key "${artifactPath}" is a zone id. Use the zone path "${matchingZone.path}" instead.`);
|
|
433
|
+
if (!artifact.owned_by.includes(stage.id)) {
|
|
434
|
+
errors.push(`Stage "${stage.id}" writes Artifact "${artifactId}" but that Artifact is not owned by the stage in method.schema.json.`);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
for (const requiredZone of listBuiltinCompiledZoneSpecs().filter((zone) => zone.id === "runtime")) {
|
|
439
|
-
const match = zoneById.get(requiredZone.id);
|
|
440
|
-
if (!match) {
|
|
441
|
-
errors.push(`method.schema.json is missing required zone "${requiredZone.id}".`);
|
|
442
|
-
continue;
|
|
443
|
-
}
|
|
444
|
-
if (match.kind !== requiredZone.kind) {
|
|
445
|
-
errors.push(`method.schema.json zone "${requiredZone.id}" should be kind "${requiredZone.kind}".`);
|
|
446
|
-
}
|
|
447
|
-
if (match.role !== requiredZone.role) {
|
|
448
|
-
errors.push(`method.schema.json zone "${requiredZone.id}" should have role "${requiredZone.role}".`);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
438
|
}
|
|
452
439
|
const stageDirs = existsSync(join(dirPath, "compile", "stages"))
|
|
453
440
|
? listFilesRecursive(join(dirPath, "compile", "stages"), (filePath) => basename(filePath) === "SKILL.md")
|
|
@@ -455,8 +442,8 @@ export function validateMethodPackage(dirPath) {
|
|
|
455
442
|
const counts = {
|
|
456
443
|
starter_docs: collectStarterDocs(dirPath).length,
|
|
457
444
|
compile_stage_docs: stageDirs.length,
|
|
458
|
-
|
|
459
|
-
|
|
445
|
+
compiled_artifacts: methodSchema ? listContextInterfaceArtifacts(methodSchema).length : 0,
|
|
446
|
+
method_artifacts: methodSchema ? listContextInterfaceArtifacts(methodSchema).length : 0,
|
|
460
447
|
};
|
|
461
448
|
return {
|
|
462
449
|
ok: errors.length === 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type LocalMethodDefinition } from "./local-methods.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { MethodCompilerApi } from "../../engine/compile/lib/schema.js";
|
|
3
3
|
import type { MethodId, RuntimeContractType } from "../../contracts/lib/schema.js";
|
|
4
|
-
import { type ContextInterface, type
|
|
4
|
+
import { type ContextInterface, type ContextInterfaceArtifactId, type MethodInputSpec } from "./context-interface.js";
|
|
5
5
|
export interface MethodStarterDoc {
|
|
6
6
|
relativePath: string;
|
|
7
7
|
content: string;
|
|
@@ -18,9 +18,8 @@ export interface MethodStageDefinition {
|
|
|
18
18
|
* time.
|
|
19
19
|
*/
|
|
20
20
|
role: string;
|
|
21
|
-
reads:
|
|
22
|
-
writes:
|
|
23
|
-
acceptance?: RuntimeStageAcceptance;
|
|
21
|
+
reads: ContextInterfaceArtifactId[];
|
|
22
|
+
writes: ContextInterfaceArtifactId[];
|
|
24
23
|
}
|
|
25
24
|
export interface MethodDefinition<TId extends string> {
|
|
26
25
|
id: TId;
|
|
@@ -59,5 +58,4 @@ export declare function getMethodStagePosition(methodId: MethodId, stage: string
|
|
|
59
58
|
export declare function getMethodStages(methodId: MethodId, prepDataDir?: string): string[];
|
|
60
59
|
export declare function getActiveCompiledStages(compiledPath: string): string[];
|
|
61
60
|
export declare function getActiveCompiledStagePolicyNotes(compiledPath: string, stage: string): string[];
|
|
62
|
-
export declare function resolveActiveCompiledStageAcceptance(compiledPath: string, stage: string): MethodStageDefinition["acceptance"] | undefined;
|
|
63
61
|
export declare function formatActiveCompiledMethodStageStep(compiledPath: string, stage: string): string;
|
|
@@ -19,7 +19,6 @@ function toMethodStages(stages) {
|
|
|
19
19
|
role: stage.role && stage.role.trim().length > 0 ? stage.role : "general",
|
|
20
20
|
reads: [...stage.reads],
|
|
21
21
|
writes: [...stage.writes],
|
|
22
|
-
...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
|
|
23
22
|
}));
|
|
24
23
|
}
|
|
25
24
|
export function standaloneMethodDefinitionFromLocalPackage(local) {
|
|
@@ -62,7 +61,7 @@ function getBuiltinDefaultMethod() {
|
|
|
62
61
|
return builtinDefaultMethodCache;
|
|
63
62
|
const local = loadMethodDefinitionFromDir(builtinMethodPackagePath(DEFAULT_METHOD_ID));
|
|
64
63
|
if (!local) {
|
|
65
|
-
throw new Error(`Missing built-in Interf Method package at
|
|
64
|
+
throw new Error(`Missing built-in Interf Method package at public-repo/methods/${DEFAULT_METHOD_ID}.`);
|
|
66
65
|
}
|
|
67
66
|
const resolved = standaloneMethodDefinitionFromLocalPackage(local);
|
|
68
67
|
builtinDefaultMethodCache = {
|
|
@@ -210,9 +209,6 @@ export function getActiveCompiledStagePolicyNotes(compiledPath, stage) {
|
|
|
210
209
|
const method = getActiveCompiledMethod(compiledPath);
|
|
211
210
|
return [...(method.stagePolicyNotes?.[stage] ?? [])];
|
|
212
211
|
}
|
|
213
|
-
export function resolveActiveCompiledStageAcceptance(compiledPath, stage) {
|
|
214
|
-
return getActiveCompiledMethod(compiledPath).stages.find((candidate) => candidate.id === stage)?.acceptance;
|
|
215
|
-
}
|
|
216
212
|
export function formatActiveCompiledMethodStageStep(compiledPath, stage) {
|
|
217
213
|
return formatMethodStageStep(getActiveCompiledMethod(compiledPath), stage);
|
|
218
214
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type LocalInstructionMode, type RuntimeInstructionMode, type RuntimeStageInstructions } from "../../engine/compile/lib/schema.js";
|
|
2
|
-
import { type MethodStageDefinition } from "./method-definitions.js";
|
|
3
2
|
export interface MethodReporter {
|
|
4
3
|
line?: (message: string) => void;
|
|
5
4
|
blankLine?: () => void;
|
|
@@ -23,4 +22,3 @@ export declare function buildStageInstructions(stageSkillDir: string, localSkill
|
|
|
23
22
|
export declare function reportLine(reporter: MethodReporter | undefined, message: string): void;
|
|
24
23
|
export declare function reportBlankLine(reporter: MethodReporter | undefined): void;
|
|
25
24
|
export declare function reportValidationFailure(reporter: MethodReporter | undefined, summary: string, errors?: string[]): void;
|
|
26
|
-
export declare function resolveStageAcceptance(methodId: string, stageId: string, prepDataDir?: string): MethodStageDefinition["acceptance"] | undefined;
|
|
@@ -3,7 +3,6 @@ import { join, relative, sep } from "node:path";
|
|
|
3
3
|
import { listFilesRecursive } from "../../contracts/utils/filesystem.js";
|
|
4
4
|
import { parseJsonFrontmatter } from "../../contracts/utils/parse.js";
|
|
5
5
|
import { isMarkdownFile } from "../../contracts/utils/file-types.js";
|
|
6
|
-
import { getCompiledMethod, } from "./method-definitions.js";
|
|
7
6
|
import { COMPILED_METHOD_DIR, methodPackagePathForCompiled } from "../../engine/compile/compiled-paths.js";
|
|
8
7
|
const LOCAL_SKILL_READ_LIMIT = 50;
|
|
9
8
|
export function methodCompileStageDirectory(stageDir) {
|
|
@@ -128,6 +127,3 @@ export function reportValidationFailure(reporter, summary, errors = []) {
|
|
|
128
127
|
reportLine(reporter, `- ${error}`);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
|
-
export function resolveStageAcceptance(methodId, stageId, prepDataDir) {
|
|
132
|
-
return getCompiledMethod(methodId, { prepDataDir }).stages.find((stage) => stage.id === stageId)?.acceptance;
|
|
133
|
-
}
|
|
@@ -80,7 +80,7 @@ export function listPortableContextsForSourceFolder(prepDataDir) {
|
|
|
80
80
|
return [];
|
|
81
81
|
}
|
|
82
82
|
catch (error) {
|
|
83
|
-
warnInterf(`Warning: failed to inspect Interf
|
|
83
|
+
warnInterf(`Warning: failed to inspect Interf preparation data folder at ${prepDataDir}: ${error instanceof Error ? error.message : String(error)}`);
|
|
84
84
|
return [];
|
|
85
85
|
}
|
|
86
86
|
return readdirSync(prepDataDir)
|
|
@@ -100,7 +100,7 @@ export function assertCompiledContainer(prepDataDir) {
|
|
|
100
100
|
if (existsSync(prepDataDir)) {
|
|
101
101
|
const stat = statSync(prepDataDir);
|
|
102
102
|
if (!stat.isDirectory()) {
|
|
103
|
-
throw new Error(`Interf
|
|
103
|
+
throw new Error(`Interf preparation data folder exists and is not a directory: ${prepDataDir}`);
|
|
104
104
|
}
|
|
105
105
|
const unexpectedRootEntries = readdirSync(prepDataDir).filter((entry) => {
|
|
106
106
|
if (entry.startsWith("."))
|
|
@@ -121,7 +121,7 @@ export function assertCompiledContainer(prepDataDir) {
|
|
|
121
121
|
return !statSync(entryPath).isDirectory();
|
|
122
122
|
}
|
|
123
123
|
catch (error) {
|
|
124
|
-
warnInterf(`Warning: failed to inspect Interf
|
|
124
|
+
warnInterf(`Warning: failed to inspect Interf preparation data path at ${entryPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
125
125
|
return true;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -134,7 +134,7 @@ export function assertCompiledContainer(prepDataDir) {
|
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
if (unexpectedRootEntries.length > 0) {
|
|
137
|
-
throw new Error(`Interf
|
|
137
|
+
throw new Error(`Interf preparation data folder contains unexpected entries: ${prepDataDir}`);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
if (!existsSync(prepDataDir)) {
|
|
@@ -142,7 +142,7 @@ export function assertCompiledContainer(prepDataDir) {
|
|
|
142
142
|
}
|
|
143
143
|
const stat = statSync(prepDataDir);
|
|
144
144
|
if (!stat.isDirectory()) {
|
|
145
|
-
throw new Error(`Interf
|
|
145
|
+
throw new Error(`Interf preparation data folder exists and is not a directory: ${prepDataDir}`);
|
|
146
146
|
}
|
|
147
147
|
const unexpectedEntries = readdirSync(prepDataDir).filter((entry) => {
|
|
148
148
|
if (entry.startsWith("."))
|
|
@@ -172,7 +172,7 @@ export function assertCompiledContainer(prepDataDir) {
|
|
|
172
172
|
return false;
|
|
173
173
|
});
|
|
174
174
|
if (unexpectedEntries.length > 0) {
|
|
175
|
-
throw new Error(`Interf
|
|
175
|
+
throw new Error(`Interf preparation data folder contains invalid Preparation entries: ${prepDataDir}`);
|
|
176
176
|
}
|
|
177
177
|
return prepDataDir;
|
|
178
178
|
}
|
|
@@ -7,8 +7,8 @@ import { refreshCompiledBootstrapGuidance } from "../engine/agents/lib/compiled-
|
|
|
7
7
|
import { assertCompiledContainer, assertCompiledName, } from "./interf-detect.js";
|
|
8
8
|
import { seedCompiledMethodPackage } from "../methods/package/interf-method-package.js";
|
|
9
9
|
import { asPreparationDataDir, preparationPortableContextPath, } from "../contracts/lib/preparation-paths.js";
|
|
10
|
-
import {
|
|
11
|
-
import { findSourcePreparationConfig, loadSourceFolderConfig, methodIdForSourcePreparationConfig, resolveSourcePreparationPath, saveCompiledInterfConfig, } from "./source-config.js";
|
|
10
|
+
import { ensureCompiledArtifactTargets, listCompiledSchemaArtifacts, readCompiledSchemaFile } from "../engine/compile/compiled-schema.js";
|
|
11
|
+
import { findSourcePreparationConfig, loadSourceFolderConfig, methodIdForSourcePreparationConfig, resolveConfiguredSourceFolderPath, resolveSourcePreparationPath, saveCompiledInterfConfig, } from "./source-config.js";
|
|
12
12
|
import { defaultControlPathForCompiled, testRootForCompiled, methodPackagePathForCompiled } from "../engine/compile/compiled-paths.js";
|
|
13
13
|
import { DEFAULT_METHOD_ID } from "../methods/method-resolution.js";
|
|
14
14
|
const DEFAULT_INTERFIGNORE = [
|
|
@@ -33,11 +33,11 @@ function renderUncompiledCompiledFile(compiledName, relativePath, about) {
|
|
|
33
33
|
}
|
|
34
34
|
function compiledGitignoreEntries(compiledPath) {
|
|
35
35
|
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(compiledPath));
|
|
36
|
-
const
|
|
37
|
-
.filter((
|
|
38
|
-
.map((
|
|
36
|
+
const artifactEntries = (schema ? listCompiledSchemaArtifacts(schema) : [])
|
|
37
|
+
.filter((artifact) => artifact.kind !== "runtime")
|
|
38
|
+
.map((artifact) => artifact.kind === "file" ? artifact.path : `${artifact.path}/`);
|
|
39
39
|
return [
|
|
40
|
-
...
|
|
40
|
+
...artifactEntries,
|
|
41
41
|
".claude/",
|
|
42
42
|
".codex/",
|
|
43
43
|
".agents/",
|
|
@@ -52,14 +52,14 @@ function scaffoldCompiledOutputs(compiledPath, compiledName, about) {
|
|
|
52
52
|
if (!schema) {
|
|
53
53
|
throw new Error(`Missing Method schema at ${methodPackagePathForCompiled(compiledPath)}.`);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
for (const
|
|
57
|
-
if (!
|
|
55
|
+
ensureCompiledArtifactTargets(compiledPath, schema);
|
|
56
|
+
for (const artifact of listCompiledSchemaArtifacts(schema)) {
|
|
57
|
+
if (!artifact.required || artifact.kind !== "file" || artifact.role !== "output")
|
|
58
58
|
continue;
|
|
59
|
-
const targetPath = join(compiledPath,
|
|
59
|
+
const targetPath = join(compiledPath, artifact.path);
|
|
60
60
|
if (existsSync(targetPath))
|
|
61
61
|
continue;
|
|
62
|
-
writeFileSync(targetPath, renderUncompiledCompiledFile(compiledName,
|
|
62
|
+
writeFileSync(targetPath, renderUncompiledCompiledFile(compiledName, artifact.path, about));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
function localMethodMatches(compiledPath, methodId) {
|
|
@@ -99,7 +99,7 @@ export function createCompiled(name, prepDataDir, methodId = DEFAULT_METHOD_ID,
|
|
|
99
99
|
const compiledPath = ensurePortableContextScaffold(prepDataDir, name, selectedMethod.id);
|
|
100
100
|
const resolvedAbout = about ?? savedCompiled?.about;
|
|
101
101
|
const resolvedSourceFolderPath = savedCompiled
|
|
102
|
-
? resolveSourcePreparationPath(prepDataDir, savedCompiled)
|
|
102
|
+
? resolveConfiguredSourceFolderPath(prepDataDir) ?? resolveSourcePreparationPath(prepDataDir, savedCompiled)
|
|
103
103
|
: sourceFolderPath;
|
|
104
104
|
const sourceRelativePath = relative(compiledPath, resolvedSourceFolderPath).split(sep).join("/") || ".";
|
|
105
105
|
saveCompiledInterfConfig(compiledPath, {
|