@interf/compiler 0.2.5 → 0.3.1
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 +192 -187
- package/dist/bin.js +3 -3
- package/dist/bin.js.map +1 -1
- package/dist/commands/compile.d.ts +1 -0
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +45 -138
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/create-workflow-wizard.d.ts +4 -25
- package/dist/commands/create-workflow-wizard.d.ts.map +1 -1
- package/dist/commands/create-workflow-wizard.js +46 -222
- package/dist/commands/create-workflow-wizard.js.map +1 -1
- package/dist/commands/create.d.ts +2 -11
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +78 -477
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/default.d.ts.map +1 -1
- package/dist/commands/default.js +27 -43
- package/dist/commands/default.js.map +1 -1
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/executor-flow.d.ts +9 -0
- package/dist/commands/executor-flow.d.ts.map +1 -0
- package/dist/commands/executor-flow.js +55 -0
- package/dist/commands/executor-flow.js.map +1 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +320 -321
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +12 -22
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/reset.d.ts.map +1 -1
- package/dist/commands/reset.js +27 -124
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/source-config-wizard.d.ts +10 -11
- package/dist/commands/source-config-wizard.d.ts.map +1 -1
- package/dist/commands/source-config-wizard.js +100 -97
- package/dist/commands/source-config-wizard.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +60 -56
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/test-flow.d.ts +21 -0
- package/dist/commands/test-flow.d.ts.map +1 -0
- package/dist/commands/test-flow.js +106 -0
- package/dist/commands/test-flow.js.map +1 -0
- package/dist/commands/test.d.ts +4 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +131 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +63 -98
- package/dist/commands/verify.js.map +1 -1
- package/dist/commands/workspace-flow.d.ts +21 -0
- package/dist/commands/workspace-flow.d.ts.map +1 -0
- package/dist/commands/workspace-flow.js +90 -0
- package/dist/commands/workspace-flow.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-constants.js +1 -1
- package/dist/lib/agent-constants.js.map +1 -1
- package/dist/lib/agent-detection.js +4 -4
- package/dist/lib/agent-detection.js.map +1 -1
- package/dist/lib/agent-skills.js +6 -6
- package/dist/lib/agent-skills.js.map +1 -1
- package/dist/lib/benchmark-execution.d.ts.map +1 -1
- package/dist/lib/benchmark-execution.js +32 -19
- package/dist/lib/benchmark-execution.js.map +1 -1
- package/dist/lib/benchmark-sandbox.d.ts +10 -0
- package/dist/lib/benchmark-sandbox.d.ts.map +1 -0
- package/dist/lib/benchmark-sandbox.js +75 -0
- package/dist/lib/benchmark-sandbox.js.map +1 -0
- package/dist/lib/benchmark-targets.d.ts +4 -4
- package/dist/lib/benchmark-targets.d.ts.map +1 -1
- package/dist/lib/benchmark-targets.js +20 -54
- package/dist/lib/benchmark-targets.js.map +1 -1
- package/dist/lib/benchmark-types.d.ts +2 -3
- package/dist/lib/benchmark-types.d.ts.map +1 -1
- package/dist/lib/benchmark.d.ts +1 -1
- package/dist/lib/benchmark.d.ts.map +1 -1
- package/dist/lib/benchmark.js +1 -1
- package/dist/lib/benchmark.js.map +1 -1
- package/dist/lib/config.d.ts +1 -2
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +2 -4
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/discovery.d.ts +1 -1
- package/dist/lib/discovery.d.ts.map +1 -1
- package/dist/lib/discovery.js +7 -2
- package/dist/lib/discovery.js.map +1 -1
- package/dist/lib/eval-packs.d.ts +6 -52
- package/dist/lib/eval-packs.d.ts.map +1 -1
- package/dist/lib/eval-packs.js +11 -39
- package/dist/lib/eval-packs.js.map +1 -1
- package/dist/lib/interf-bootstrap.d.ts +3 -5
- package/dist/lib/interf-bootstrap.d.ts.map +1 -1
- package/dist/lib/interf-bootstrap.js +10 -57
- package/dist/lib/interf-bootstrap.js.map +1 -1
- package/dist/lib/interf-detect.d.ts +13 -11
- package/dist/lib/interf-detect.d.ts.map +1 -1
- package/dist/lib/interf-detect.js +59 -45
- package/dist/lib/interf-detect.js.map +1 -1
- package/dist/lib/interf-scaffold.d.ts +2 -5
- package/dist/lib/interf-scaffold.d.ts.map +1 -1
- package/dist/lib/interf-scaffold.js +99 -235
- package/dist/lib/interf-scaffold.js.map +1 -1
- package/dist/lib/interf-workflow-package.d.ts +1 -2
- package/dist/lib/interf-workflow-package.d.ts.map +1 -1
- package/dist/lib/interf-workflow-package.js +99 -90
- package/dist/lib/interf-workflow-package.js.map +1 -1
- package/dist/lib/interf.d.ts +4 -5
- package/dist/lib/interf.d.ts.map +1 -1
- package/dist/lib/interf.js +3 -6
- package/dist/lib/interf.js.map +1 -1
- package/dist/lib/local-workflows.d.ts +9 -8
- package/dist/lib/local-workflows.d.ts.map +1 -1
- package/dist/lib/local-workflows.js +56 -92
- package/dist/lib/local-workflows.js.map +1 -1
- package/dist/lib/obsidian.d.ts +1 -3
- package/dist/lib/obsidian.d.ts.map +1 -1
- package/dist/lib/obsidian.js +10 -81
- package/dist/lib/obsidian.js.map +1 -1
- package/dist/lib/registry.d.ts +6 -17
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +36 -50
- package/dist/lib/registry.js.map +1 -1
- package/dist/lib/runtime-contracts.d.ts +4 -3
- package/dist/lib/runtime-contracts.d.ts.map +1 -1
- package/dist/lib/runtime-contracts.js +125 -9
- package/dist/lib/runtime-contracts.js.map +1 -1
- package/dist/lib/runtime-reconcile.d.ts +3 -5
- package/dist/lib/runtime-reconcile.d.ts.map +1 -1
- package/dist/lib/runtime-reconcile.js +70 -167
- package/dist/lib/runtime-reconcile.js.map +1 -1
- package/dist/lib/runtime-runs.d.ts.map +1 -1
- package/dist/lib/runtime-runs.js +61 -57
- package/dist/lib/runtime-runs.js.map +1 -1
- package/dist/lib/runtime-types.d.ts +16 -6
- package/dist/lib/runtime-types.d.ts.map +1 -1
- package/dist/lib/runtime.d.ts +2 -2
- package/dist/lib/runtime.d.ts.map +1 -1
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/runtime.js.map +1 -1
- package/dist/lib/schema.d.ts +69 -311
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/schema.js +49 -210
- package/dist/lib/schema.js.map +1 -1
- package/dist/lib/source-config.d.ts +8 -7
- package/dist/lib/source-config.d.ts.map +1 -1
- package/dist/lib/source-config.js +59 -63
- package/dist/lib/source-config.js.map +1 -1
- package/dist/lib/state-artifacts.d.ts +5 -11
- package/dist/lib/state-artifacts.d.ts.map +1 -1
- package/dist/lib/state-artifacts.js +8 -18
- package/dist/lib/state-artifacts.js.map +1 -1
- package/dist/lib/state-health.d.ts +4 -8
- package/dist/lib/state-health.d.ts.map +1 -1
- package/dist/lib/state-health.js +52 -233
- package/dist/lib/state-health.js.map +1 -1
- package/dist/lib/state-io.d.ts +7 -12
- package/dist/lib/state-io.d.ts.map +1 -1
- package/dist/lib/state-io.js +32 -93
- package/dist/lib/state-io.js.map +1 -1
- package/dist/lib/state-view.d.ts +4 -6
- package/dist/lib/state-view.d.ts.map +1 -1
- package/dist/lib/state-view.js +62 -101
- package/dist/lib/state-view.js.map +1 -1
- package/dist/lib/state.d.ts +5 -5
- package/dist/lib/state.d.ts.map +1 -1
- package/dist/lib/state.js +4 -4
- package/dist/lib/state.js.map +1 -1
- package/dist/lib/summarize-plan.d.ts +2 -2
- package/dist/lib/summarize-plan.d.ts.map +1 -1
- package/dist/lib/summarize-plan.js +13 -13
- package/dist/lib/summarize-plan.js.map +1 -1
- package/dist/lib/{validate-kb.d.ts → validate-workspace.d.ts} +49 -8
- package/dist/lib/validate-workspace.d.ts.map +1 -0
- package/dist/lib/validate-workspace.js +398 -0
- package/dist/lib/validate-workspace.js.map +1 -0
- package/dist/lib/validate.d.ts +5 -7
- package/dist/lib/validate.d.ts.map +1 -1
- package/dist/lib/validate.js +22 -20
- package/dist/lib/validate.js.map +1 -1
- package/dist/lib/workflow-definitions.d.ts +14 -50
- package/dist/lib/workflow-definitions.d.ts.map +1 -1
- package/dist/lib/workflow-definitions.js +100 -353
- package/dist/lib/workflow-definitions.js.map +1 -1
- package/dist/lib/workflow-helpers.d.ts +3 -4
- package/dist/lib/workflow-helpers.d.ts.map +1 -1
- package/dist/lib/workflow-helpers.js +17 -49
- package/dist/lib/workflow-helpers.js.map +1 -1
- package/dist/lib/workflow-stage-runner.d.ts +1 -2
- package/dist/lib/workflow-stage-runner.d.ts.map +1 -1
- package/dist/lib/workflow-stage-runner.js +4 -6
- package/dist/lib/workflow-stage-runner.js.map +1 -1
- package/dist/lib/workflow-starter-docs.d.ts +3 -5
- package/dist/lib/workflow-starter-docs.d.ts.map +1 -1
- package/dist/lib/workflow-starter-docs.js +2 -17
- package/dist/lib/workflow-starter-docs.js.map +1 -1
- package/dist/lib/workflows.d.ts +9 -14
- package/dist/lib/workflows.d.ts.map +1 -1
- package/dist/lib/workflows.js +15 -30
- package/dist/lib/workflows.js.map +1 -1
- package/dist/lib/workspace-compile.d.ts +51 -0
- package/dist/lib/workspace-compile.d.ts.map +1 -0
- package/dist/lib/workspace-compile.js +397 -0
- package/dist/lib/workspace-compile.js.map +1 -0
- package/package.json +9 -9
- package/skills/benchmark/SKILL.md +20 -27
- package/skills/workflow/create/SKILL.md +10 -14
- package/skills/workspace/shape/SKILL.md +15 -0
- package/skills/workspace/structure/SKILL.md +15 -0
- package/skills/workspace/summarize/SKILL.md +15 -0
- package/templates/workspace/README.md +23 -0
- package/templates/workspace/interfignore +2 -0
- package/dist/commands/benchmark.d.ts +0 -3
- package/dist/commands/benchmark.d.ts.map +0 -1
- package/dist/commands/benchmark.js +0 -374
- package/dist/commands/benchmark.js.map +0 -1
- package/dist/lib/bundled-templates.d.ts +0 -5
- package/dist/lib/bundled-templates.d.ts.map +0 -1
- package/dist/lib/bundled-templates.js +0 -23
- package/dist/lib/bundled-templates.js.map +0 -1
- package/dist/lib/interf-compile-plan.d.ts +0 -12
- package/dist/lib/interf-compile-plan.d.ts.map +0 -1
- package/dist/lib/interf-compile-plan.js +0 -143
- package/dist/lib/interf-compile-plan.js.map +0 -1
- package/dist/lib/validate-interface.d.ts +0 -79
- package/dist/lib/validate-interface.d.ts.map +0 -1
- package/dist/lib/validate-interface.js +0 -535
- package/dist/lib/validate-interface.js.map +0 -1
- package/dist/lib/validate-kb.d.ts.map +0 -1
- package/dist/lib/validate-kb.js +0 -252
- package/dist/lib/validate-kb.js.map +0 -1
- package/dist/lib/workflows-interface-contracts.d.ts +0 -24
- package/dist/lib/workflows-interface-contracts.d.ts.map +0 -1
- package/dist/lib/workflows-interface-contracts.js +0 -304
- package/dist/lib/workflows-interface-contracts.js.map +0 -1
- package/dist/lib/workflows-interface.d.ts +0 -72
- package/dist/lib/workflows-interface.d.ts.map +0 -1
- package/dist/lib/workflows-interface.js +0 -377
- package/dist/lib/workflows-interface.js.map +0 -1
- package/dist/lib/workflows-kb.d.ts +0 -50
- package/dist/lib/workflows-kb.d.ts.map +0 -1
- package/dist/lib/workflows-kb.js +0 -306
- package/dist/lib/workflows-kb.js.map +0 -1
- package/skills/interface/analyze/SKILL.md +0 -191
- package/skills/interface/compile/SKILL.md +0 -152
- package/skills/interface/compile/references/output-format.md +0 -48
- package/skills/interface/create/SKILL.md +0 -87
- package/skills/interface/create/references/compile-plan-format.md +0 -109
- package/skills/interface/create/references/workflows.md +0 -35
- package/skills/interface/query/SKILL.md +0 -48
- package/skills/interface/retrieve/SKILL.md +0 -133
- package/skills/knowledge-base/compile/SKILL.md +0 -196
- package/skills/knowledge-base/compile/references/output-format.md +0 -48
- package/skills/knowledge-base/compile/references/stage-claims.md +0 -60
- package/skills/knowledge-base/compile/references/stage-entities.md +0 -46
- package/skills/knowledge-base/query/SKILL.md +0 -45
- package/skills/knowledge-base/summarize/SKILL.md +0 -152
- package/templates/interface/README.md +0 -159
- package/templates/interface/interfaces.md +0 -102
- package/templates/knowledge-base/README.md +0 -137
- package/templates/knowledge-base/interfignore +0 -19
- package/templates/knowledge-base/registry.md +0 -118
- package/templates/workflow-package/README.md +0 -16
- package/templates/workflow-package/create/SKILL.md +0 -8
- package/templates/workflow-package/interface-query/SKILL.md +0 -29
- package/templates/workflow-package/interface-stage/SKILL.md +0 -13
- package/templates/workflow-package/knowledge-base-query/SKILL.md +0 -36
- package/templates/workflow-package/knowledge-base-stage/SKILL.md +0 -13
- package/templates/workflow-starters/interface/interf/README.md +0 -13
- package/templates/workflow-starters/interface/interf/create/SKILL.md +0 -15
- package/templates/workflow-starters/knowledge-base/interf/README.md +0 -13
- package/templates/workflow-starters/knowledge-base/karpathy/README.md +0 -13
package/dist/commands/compile.js
CHANGED
|
@@ -1,155 +1,62 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { compileKnowledgeBase, compileInterface, } from "../lib/workflows.js";
|
|
8
|
-
import { addExecutionProfileOptions, executionProfileFromArgv, formatWorkflowExecutionProfile, } from "../lib/execution-profile.js";
|
|
2
|
+
import { detectInterf, readInterfConfig, resolveSourceFolderPath, } from "../lib/interf.js";
|
|
3
|
+
import { formatWorkspaceWorkflowStageStep, resolveWorkspaceWorkflowFromConfig, } from "../lib/workflow-definitions.js";
|
|
4
|
+
import { addExecutionProfileOptions, executionProfileFromArgv, } from "../lib/execution-profile.js";
|
|
5
|
+
import { chooseWorkspaceConfigToBuild, compileWorkspaceWithReporter, ensureWorkspaceFromConfig, } from "./workspace-flow.js";
|
|
6
|
+
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
9
7
|
export const compileCommand = {
|
|
10
|
-
command: "compile
|
|
11
|
-
describe: "
|
|
12
|
-
builder: (yargs) => addExecutionProfileOptions(yargs
|
|
13
|
-
describe: "What to compile (`knowledge-base` or `interface`; auto-detected if omitted)",
|
|
14
|
-
})),
|
|
8
|
+
command: "compile",
|
|
9
|
+
describe: "Build a workspace for this folder",
|
|
10
|
+
builder: (yargs) => addExecutionProfileOptions(yargs),
|
|
15
11
|
handler: async (argv) => {
|
|
16
|
-
|
|
17
|
-
if (type === "knowledge-base" || type === "kb" || type === "base") {
|
|
18
|
-
type = "knowledge-base";
|
|
19
|
-
}
|
|
20
|
-
if (type && type !== "knowledge-base" && type !== "interface") {
|
|
21
|
-
process.exitCode = 1;
|
|
22
|
-
console.log(chalk.red(`Unknown compile target: ${type}`));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const executionProfile = executionProfileFromArgv(argv);
|
|
26
|
-
const { executor, error } = resolveLocalExecutor({ executionProfile });
|
|
27
|
-
if (!executor) {
|
|
28
|
-
process.exitCode = 1;
|
|
29
|
-
console.log(chalk.red(error ?? "No coding agent detected."));
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (!type) {
|
|
33
|
-
const detected = detectInterf(process.cwd());
|
|
34
|
-
if (detected) {
|
|
35
|
-
type = detected.config.type;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
const localKnowledgeBases = listKnowledgeBasesForSourceFolder(process.cwd());
|
|
39
|
-
if (localKnowledgeBases.length > 0) {
|
|
40
|
-
type = "knowledge-base";
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (!type) {
|
|
44
|
-
process.exitCode = 1;
|
|
45
|
-
console.log(chalk.red(" Could not detect a knowledge base. Run this from a source folder with ./interf/<name>, from that knowledge base, or from ./interf/<name>/interfaces/<name>."));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
let knowledgeBasePath;
|
|
50
|
-
const detected = detectInterf(process.cwd());
|
|
51
|
-
const localKnowledgeBases = type === "knowledge-base"
|
|
52
|
-
? listKnowledgeBasesForSourceFolder(process.cwd())
|
|
53
|
-
: [];
|
|
54
|
-
if (detected && detected.config.type === type) {
|
|
55
|
-
knowledgeBasePath = detected.path;
|
|
56
|
-
}
|
|
57
|
-
else if (type === "knowledge-base" && localKnowledgeBases.length > 0) {
|
|
58
|
-
if (localKnowledgeBases.length === 1) {
|
|
59
|
-
knowledgeBasePath = localKnowledgeBases[0].path;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const choice = await p.select({
|
|
63
|
-
message: "Which local knowledge base?",
|
|
64
|
-
options: localKnowledgeBases.map((entry) => ({ value: entry.path, label: entry.config.name })),
|
|
65
|
-
});
|
|
66
|
-
if (p.isCancel(choice))
|
|
67
|
-
return;
|
|
68
|
-
knowledgeBasePath = choice;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
const reg = loadRegistry();
|
|
73
|
-
const entries = type === "knowledge-base" ? reg.knowledgeBases : reg.interfaces;
|
|
74
|
-
if (entries.length === 0) {
|
|
75
|
-
const label = type === "knowledge-base" ? "knowledge bases" : "interfaces";
|
|
76
|
-
process.exitCode = 1;
|
|
77
|
-
console.log(chalk.red(`No ${label} found. Create one first.`));
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (entries.length === 1) {
|
|
81
|
-
knowledgeBasePath = entries[0].path;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
const choice = await p.select({
|
|
85
|
-
message: type === "knowledge-base" ? "Which knowledge base?" : "Which interface?",
|
|
86
|
-
options: entries.map((entry) => ({ value: entry.path, label: entry.name })),
|
|
87
|
-
});
|
|
88
|
-
if (p.isCancel(choice))
|
|
89
|
-
return;
|
|
90
|
-
knowledgeBasePath = choice;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (type === "knowledge-base") {
|
|
94
|
-
await compileKnowledgeBaseCommand(executor, knowledgeBasePath);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
await compileInterfaceCommand(executor, knowledgeBasePath);
|
|
98
|
-
}
|
|
12
|
+
await runCompileCommand(argv);
|
|
99
13
|
},
|
|
100
14
|
};
|
|
101
|
-
async function
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (profileLabel) {
|
|
106
|
-
console.log(chalk.dim(` Execution profile: ${profileLabel}`));
|
|
107
|
-
}
|
|
108
|
-
console.log();
|
|
109
|
-
const reporter = {
|
|
110
|
-
line: (message) => console.log(chalk.dim(` ${message}`)),
|
|
111
|
-
blankLine: () => console.log(),
|
|
112
|
-
};
|
|
113
|
-
const result = await compileKnowledgeBase({
|
|
114
|
-
executor,
|
|
115
|
-
knowledgeBasePath,
|
|
116
|
-
reporter,
|
|
117
|
-
});
|
|
118
|
-
if (!result.ok) {
|
|
15
|
+
export async function runCompileCommand(argv = {}) {
|
|
16
|
+
const executionProfile = executionProfileFromArgv(argv);
|
|
17
|
+
const { executor, error } = await resolveOrConfigureLocalExecutor({ executionProfile });
|
|
18
|
+
if (!executor) {
|
|
119
19
|
process.exitCode = 1;
|
|
120
|
-
|
|
121
|
-
const failedStage = formatKnowledgeBaseWorkflowStageStep(workflowId, result.failedStage ?? "compile", { workspacePath: knowledgeBasePath });
|
|
122
|
-
console.log(chalk.red(` ${failedStage} failed.`));
|
|
20
|
+
console.log(chalk.red(error ?? "No coding agent detected."));
|
|
123
21
|
return;
|
|
124
22
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
console.log();
|
|
130
|
-
console.log(chalk.bold(" Compiling interface..."));
|
|
131
|
-
const profileLabel = formatWorkflowExecutionProfile(executor.executionProfile);
|
|
132
|
-
if (profileLabel) {
|
|
133
|
-
console.log(chalk.dim(` Execution profile: ${profileLabel}`));
|
|
23
|
+
let workspacePath = null;
|
|
24
|
+
const detected = detectInterf(process.cwd());
|
|
25
|
+
if (detected) {
|
|
26
|
+
workspacePath = detected.path;
|
|
134
27
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
28
|
+
else {
|
|
29
|
+
workspacePath = await maybeCreateWorkspaceFromSavedSetup(process.cwd());
|
|
30
|
+
if (!workspacePath) {
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
console.log(chalk.red(" No workspaces are set up for this folder yet."));
|
|
33
|
+
console.log(chalk.dim(" Start with `interf` or `interf init` to set up this folder."));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
await compileWorkspaceCommand(executor, workspacePath);
|
|
38
|
+
}
|
|
39
|
+
async function maybeCreateWorkspaceFromSavedSetup(sourcePath) {
|
|
40
|
+
const selected = await chooseWorkspaceConfigToBuild({
|
|
41
|
+
sourcePath,
|
|
42
|
+
selectMessage: "Which workspace do you want to build?",
|
|
144
43
|
});
|
|
44
|
+
if (!selected)
|
|
45
|
+
return null;
|
|
46
|
+
const workspacePath = ensureWorkspaceFromConfig(sourcePath, selected);
|
|
47
|
+
console.log(chalk.dim(` Workspace: ${selected.name}`));
|
|
48
|
+
return workspacePath;
|
|
49
|
+
}
|
|
50
|
+
async function compileWorkspaceCommand(executor, workspacePath) {
|
|
51
|
+
const result = await compileWorkspaceWithReporter(executor, workspacePath);
|
|
145
52
|
if (!result.ok) {
|
|
146
53
|
process.exitCode = 1;
|
|
147
|
-
const workflowId =
|
|
148
|
-
const failedStage =
|
|
54
|
+
const workflowId = resolveWorkspaceWorkflowFromConfig(readInterfConfig(workspacePath));
|
|
55
|
+
const failedStage = formatWorkspaceWorkflowStageStep(workflowId, result.failedStage ?? "compile", {
|
|
56
|
+
sourcePath: resolveSourceFolderPath(workspacePath),
|
|
57
|
+
});
|
|
149
58
|
console.log(chalk.red(` ${failedStage} failed.`));
|
|
150
59
|
return;
|
|
151
60
|
}
|
|
152
|
-
console.log();
|
|
153
|
-
console.log(chalk.green(" ✓ Interface compiled."));
|
|
154
61
|
}
|
|
155
62
|
//# sourceMappingURL=compile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type InterfaceWorkflowId, type KnowledgeBaseWorkflowId } from "../lib/workflow-definitions.js";
|
|
2
|
-
import type { WorkflowTargetType } from "../lib/local-workflows.js";
|
|
3
1
|
export interface WorkflowWizardPrompts {
|
|
4
2
|
intro(message: string): void;
|
|
5
3
|
select(options: {
|
|
@@ -22,7 +20,6 @@ export interface WorkflowWizardPrompts {
|
|
|
22
20
|
};
|
|
23
21
|
}
|
|
24
22
|
export declare const clackWorkflowPrompts: WorkflowWizardPrompts;
|
|
25
|
-
export declare function selectWorkflowTargetType(prompts?: WorkflowWizardPrompts): Promise<WorkflowTargetType | symbol>;
|
|
26
23
|
export declare function formatWorkflowLabel(workflow: {
|
|
27
24
|
id: string;
|
|
28
25
|
label: string;
|
|
@@ -33,33 +30,15 @@ export declare function formatWorkflowLabel(workflow: {
|
|
|
33
30
|
label: string;
|
|
34
31
|
hint: string;
|
|
35
32
|
};
|
|
36
|
-
export declare
|
|
37
|
-
export declare function buildKnowledgeBaseWorkflowOptions(sourcePath: string): {
|
|
33
|
+
export declare function buildWorkspaceWorkflowOptions(sourcePath: string): {
|
|
38
34
|
value: string;
|
|
39
35
|
label: string;
|
|
40
36
|
hint: string;
|
|
41
37
|
}[];
|
|
42
|
-
export declare function
|
|
43
|
-
value: string;
|
|
44
|
-
label: string;
|
|
45
|
-
hint: string;
|
|
46
|
-
}[];
|
|
47
|
-
export declare function buildStandaloneInterfaceWorkflowOptions(sourcePath: string): {
|
|
48
|
-
value: string;
|
|
49
|
-
label: string;
|
|
50
|
-
hint: string;
|
|
51
|
-
}[];
|
|
52
|
-
export declare function chooseKnowledgeBaseWorkflow(sourcePath: string): Promise<KnowledgeBaseWorkflowId | symbol>;
|
|
53
|
-
export declare function chooseInterfaceWorkflow(knowledgeBasePath: string): Promise<InterfaceWorkflowId | symbol>;
|
|
38
|
+
export declare function chooseWorkspaceWorkflow(sourcePath: string): Promise<string | symbol>;
|
|
54
39
|
export declare function createWorkflowWizard(options?: {
|
|
55
40
|
intro?: boolean;
|
|
56
|
-
type?: WorkflowTargetType;
|
|
57
41
|
sourcePath?: string;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export declare function createKnowledgeBaseWorkflowWizard(sourcePath: string, prompts?: WorkflowWizardPrompts): Promise<KnowledgeBaseWorkflowId | symbol>;
|
|
61
|
-
export declare function createInterfaceWorkflowWizard(options: {
|
|
62
|
-
sourcePath: string;
|
|
63
|
-
knowledgeBasePath?: string;
|
|
64
|
-
}, prompts?: WorkflowWizardPrompts): Promise<InterfaceWorkflowId | symbol>;
|
|
42
|
+
}, prompts?: WorkflowWizardPrompts): Promise<string | symbol>;
|
|
43
|
+
export declare function createWorkspaceWorkflowWizard(sourcePath: string, prompts?: WorkflowWizardPrompts): Promise<string | symbol>;
|
|
65
44
|
//# sourceMappingURL=create-workflow-wizard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workflow-wizard.d.ts","sourceRoot":"","sources":["../../src/commands/create-workflow-wizard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-workflow-wizard.d.ts","sourceRoot":"","sources":["../../src/commands/create-workflow-wizard.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjE,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;KAClD,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC;IAC1C,GAAG,EAAE;QACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7B,CAAC;CACH;AAED,eAAO,MAAM,oBAAoB,EAAE,qBAQlC,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE;IACR,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC7B,GACA;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAMhD;AAED,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM;WARpD,MAAM;WAAS,MAAM;UAAQ,MAAM;IAU9C;AAED,wBAAsB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAK1F;AAED,wBAAsB,oBAAoB,CACxC,OAAO,GAAE;IACP,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CAChB,EACN,OAAO,GAAE,qBAA4C,GACpD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAO1B;AAED,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,qBAA4C,GACpD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAwF1B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
|
-
import {
|
|
4
|
-
import { listInterfaceWorkflowChoices, listKnowledgeBaseInterfaceWorkflowChoices, listKnowledgeBaseWorkflowChoices, } from "../lib/workflow-definitions.js";
|
|
3
|
+
import { listWorkspaceWorkflowChoices, } from "../lib/workflow-definitions.js";
|
|
5
4
|
import { isWorkflowId, writeLocalWorkflowDefinition, } from "../lib/local-workflows.js";
|
|
6
5
|
import { renderJsonFrontmatter } from "../lib/parse.js";
|
|
7
6
|
import { slugify } from "../lib/util.js";
|
|
@@ -14,23 +13,6 @@ export const clackWorkflowPrompts = {
|
|
|
14
13
|
info: p.log.info,
|
|
15
14
|
},
|
|
16
15
|
};
|
|
17
|
-
export async function selectWorkflowTargetType(prompts = clackWorkflowPrompts) {
|
|
18
|
-
return prompts.select({
|
|
19
|
-
message: "Workflow type?",
|
|
20
|
-
options: [
|
|
21
|
-
{
|
|
22
|
-
value: "knowledge-base",
|
|
23
|
-
label: "Knowledge Base Workflow (Recommended)",
|
|
24
|
-
hint: "Create a reusable compile method for attached folders",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
value: "interface",
|
|
28
|
-
label: "Interface Workflow",
|
|
29
|
-
hint: "Create a reusable task-specific method on top of a knowledge base",
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
16
|
export function formatWorkflowLabel(workflow) {
|
|
35
17
|
return {
|
|
36
18
|
value: workflow.id,
|
|
@@ -38,93 +20,26 @@ export function formatWorkflowLabel(workflow) {
|
|
|
38
20
|
hint: workflow.hint,
|
|
39
21
|
};
|
|
40
22
|
}
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
return [
|
|
44
|
-
...listKnowledgeBaseWorkflowChoices(sourcePath).map(formatWorkflowLabel),
|
|
45
|
-
{
|
|
46
|
-
value: CREATE_NEW_WORKFLOW_VALUE,
|
|
47
|
-
label: "Create new workflow...",
|
|
48
|
-
hint: "Answer a few questions and save a reusable local workflow under interf/workflows/",
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
export function buildInterfaceWorkflowOptions(knowledgeBasePath) {
|
|
53
|
-
const sourcePath = resolveKnowledgeBaseSourcePath(knowledgeBasePath);
|
|
54
|
-
const workflowMap = new Map();
|
|
55
|
-
for (const workflow of listKnowledgeBaseInterfaceWorkflowChoices(knowledgeBasePath)) {
|
|
56
|
-
workflowMap.set(workflow.id, workflow);
|
|
57
|
-
}
|
|
58
|
-
for (const workflow of listInterfaceWorkflowChoices(sourcePath)) {
|
|
59
|
-
if (!workflowMap.has(workflow.id))
|
|
60
|
-
workflowMap.set(workflow.id, workflow);
|
|
61
|
-
}
|
|
62
|
-
return [
|
|
63
|
-
...Array.from(workflowMap.values()).map(formatWorkflowLabel),
|
|
64
|
-
{
|
|
65
|
-
value: CREATE_NEW_WORKFLOW_VALUE,
|
|
66
|
-
label: "Create new interface workflow...",
|
|
67
|
-
hint: "Answer a few questions and save a reusable interface workflow template",
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
export function buildStandaloneInterfaceWorkflowOptions(sourcePath) {
|
|
72
|
-
return [
|
|
73
|
-
...listInterfaceWorkflowChoices(sourcePath).map(formatWorkflowLabel),
|
|
74
|
-
{
|
|
75
|
-
value: CREATE_NEW_WORKFLOW_VALUE,
|
|
76
|
-
label: "Create new interface workflow...",
|
|
77
|
-
hint: "Answer a few questions and save a reusable interface workflow template",
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
export async function chooseKnowledgeBaseWorkflow(sourcePath) {
|
|
82
|
-
const workflowChoice = await p.select({
|
|
83
|
-
message: "Knowledge-base workflow?",
|
|
84
|
-
options: buildKnowledgeBaseWorkflowOptions(sourcePath),
|
|
85
|
-
});
|
|
86
|
-
if (p.isCancel(workflowChoice))
|
|
87
|
-
return workflowChoice;
|
|
88
|
-
if (workflowChoice === CREATE_NEW_WORKFLOW_VALUE) {
|
|
89
|
-
return createKnowledgeBaseWorkflowWizard(sourcePath);
|
|
90
|
-
}
|
|
91
|
-
return workflowChoice;
|
|
23
|
+
export function buildWorkspaceWorkflowOptions(sourcePath) {
|
|
24
|
+
return listWorkspaceWorkflowChoices(sourcePath).map(formatWorkflowLabel);
|
|
92
25
|
}
|
|
93
|
-
export async function
|
|
94
|
-
|
|
95
|
-
message: "
|
|
96
|
-
options:
|
|
26
|
+
export async function chooseWorkspaceWorkflow(sourcePath) {
|
|
27
|
+
return p.select({
|
|
28
|
+
message: "Workspace workflow?",
|
|
29
|
+
options: buildWorkspaceWorkflowOptions(sourcePath),
|
|
97
30
|
});
|
|
98
|
-
if (p.isCancel(workflowChoice))
|
|
99
|
-
return workflowChoice;
|
|
100
|
-
if (workflowChoice === CREATE_NEW_WORKFLOW_VALUE) {
|
|
101
|
-
return createInterfaceWorkflowWizard({
|
|
102
|
-
sourcePath: resolveKnowledgeBaseSourcePath(knowledgeBasePath),
|
|
103
|
-
knowledgeBasePath,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return workflowChoice;
|
|
107
31
|
}
|
|
108
32
|
export async function createWorkflowWizard(options = {}, prompts = clackWorkflowPrompts) {
|
|
109
33
|
if (options.intro !== false) {
|
|
110
34
|
prompts.intro(chalk.bold("Create a workflow"));
|
|
111
35
|
}
|
|
112
|
-
const workflowType = options.type ?? await selectWorkflowTargetType(prompts);
|
|
113
|
-
if (prompts.isCancel(workflowType))
|
|
114
|
-
return workflowType;
|
|
115
36
|
const sourcePath = options.sourcePath ?? process.cwd();
|
|
116
|
-
|
|
117
|
-
return createKnowledgeBaseWorkflowWizard(sourcePath, prompts);
|
|
118
|
-
}
|
|
119
|
-
return createInterfaceWorkflowWizard({
|
|
120
|
-
sourcePath,
|
|
121
|
-
knowledgeBasePath: options.knowledgeBasePath,
|
|
122
|
-
}, prompts);
|
|
37
|
+
return createWorkspaceWorkflowWizard(sourcePath, prompts);
|
|
123
38
|
}
|
|
124
|
-
export async function
|
|
39
|
+
export async function createWorkspaceWorkflowWizard(sourcePath, prompts = clackWorkflowPrompts) {
|
|
125
40
|
const baseWorkflow = await prompts.select({
|
|
126
|
-
message: "Start from which existing
|
|
127
|
-
options:
|
|
41
|
+
message: "Start from which existing workflow?",
|
|
42
|
+
options: listWorkspaceWorkflowChoices(sourcePath).map(formatWorkflowLabel),
|
|
128
43
|
});
|
|
129
44
|
if (prompts.isCancel(baseWorkflow))
|
|
130
45
|
return baseWorkflow;
|
|
@@ -137,7 +52,7 @@ export async function createKnowledgeBaseWorkflowWizard(sourcePath, prompts = cl
|
|
|
137
52
|
const workflowId = slugify(value);
|
|
138
53
|
if (!isWorkflowId(workflowId))
|
|
139
54
|
return "Use letters, numbers, and dashes only";
|
|
140
|
-
if (
|
|
55
|
+
if (listWorkspaceWorkflowChoices(sourcePath).some((workflow) => workflow.id === workflowId)) {
|
|
141
56
|
return "That workflow name already exists";
|
|
142
57
|
}
|
|
143
58
|
return undefined;
|
|
@@ -149,7 +64,7 @@ export async function createKnowledgeBaseWorkflowWizard(sourcePath, prompts = cl
|
|
|
149
64
|
const label = rawName.trim();
|
|
150
65
|
const hint = await prompts.text({
|
|
151
66
|
message: "One-line workflow description?",
|
|
152
|
-
placeholder: "Bias toward
|
|
67
|
+
placeholder: "Bias toward evidence-backed summaries and strong retrieval structure",
|
|
153
68
|
validate: (value) => (value.trim().length === 0 ? "Description is required" : undefined),
|
|
154
69
|
});
|
|
155
70
|
if (prompts.isCancel(hint))
|
|
@@ -161,138 +76,47 @@ export async function createKnowledgeBaseWorkflowWizard(sourcePath, prompts = cl
|
|
|
161
76
|
});
|
|
162
77
|
if (prompts.isCancel(summarizeBias))
|
|
163
78
|
return summarizeBias;
|
|
164
|
-
const
|
|
165
|
-
message: "What should
|
|
166
|
-
placeholder: "Build retrieval-ready
|
|
167
|
-
validate: (value) => (value.trim().length === 0 ? "
|
|
168
|
-
});
|
|
169
|
-
if (prompts.isCancel(
|
|
170
|
-
return
|
|
171
|
-
const
|
|
79
|
+
const structureBias = await prompts.text({
|
|
80
|
+
message: "What should structure emphasize?",
|
|
81
|
+
placeholder: "Build retrieval-ready entities, claims, timelines, and indexes",
|
|
82
|
+
validate: (value) => (value.trim().length === 0 ? "Structure guidance is required" : undefined),
|
|
83
|
+
});
|
|
84
|
+
if (prompts.isCancel(structureBias))
|
|
85
|
+
return structureBias;
|
|
86
|
+
const shapeBias = await prompts.text({
|
|
87
|
+
message: "What should shape emphasize?",
|
|
88
|
+
placeholder: "Bias home.md and navigation toward the questions this workspace should answer best",
|
|
89
|
+
validate: (value) => (value.trim().length === 0 ? "Shape guidance is required" : undefined),
|
|
90
|
+
});
|
|
91
|
+
if (prompts.isCancel(shapeBias))
|
|
92
|
+
return shapeBias;
|
|
93
|
+
const workflowPath = writeLocalWorkflowDefinition(sourcePath, workflowId, {
|
|
172
94
|
id: workflowId,
|
|
173
|
-
type: "
|
|
95
|
+
type: "workspace",
|
|
174
96
|
label,
|
|
175
97
|
hint: hint.trim(),
|
|
176
98
|
extends: baseWorkflow,
|
|
177
99
|
stage_policy_notes: {
|
|
178
100
|
summarize: [summarizeBias.trim()],
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
starter_docs: [
|
|
182
|
-
{
|
|
183
|
-
relativePath: "README.md",
|
|
184
|
-
content: [
|
|
185
|
-
renderJsonFrontmatter({ mode: "extend" }),
|
|
186
|
-
`# ${label}`,
|
|
187
|
-
"",
|
|
188
|
-
`This local knowledge-base workflow extends \`${baseWorkflow}\`.`,
|
|
189
|
-
"",
|
|
190
|
-
`- summarize bias: ${summarizeBias.trim()}`,
|
|
191
|
-
`- compile bias: ${compileBias.trim()}`,
|
|
192
|
-
"",
|
|
193
|
-
].join("\n"),
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
});
|
|
197
|
-
prompts.log.info(`Saved local workflow: ${workflowPath}`);
|
|
198
|
-
return workflowId;
|
|
199
|
-
}
|
|
200
|
-
export async function createInterfaceWorkflowWizard(options, prompts = clackWorkflowPrompts) {
|
|
201
|
-
const sourcePath = options.sourcePath;
|
|
202
|
-
const knowledgeBasePath = options.knowledgeBasePath;
|
|
203
|
-
const workflowOptions = knowledgeBasePath
|
|
204
|
-
? buildInterfaceWorkflowOptions(knowledgeBasePath)
|
|
205
|
-
: buildStandaloneInterfaceWorkflowOptions(sourcePath);
|
|
206
|
-
const baseWorkflow = await prompts.select({
|
|
207
|
-
message: "Start from which existing interface workflow?",
|
|
208
|
-
options: workflowOptions
|
|
209
|
-
.filter((option) => option.value !== CREATE_NEW_WORKFLOW_VALUE),
|
|
210
|
-
});
|
|
211
|
-
if (prompts.isCancel(baseWorkflow))
|
|
212
|
-
return baseWorkflow;
|
|
213
|
-
const rawName = await prompts.text({
|
|
214
|
-
message: "New workflow name?",
|
|
215
|
-
placeholder: "diligence-memo",
|
|
216
|
-
validate: (value) => {
|
|
217
|
-
if (value.trim().length === 0)
|
|
218
|
-
return "Name is required";
|
|
219
|
-
const workflowId = slugify(value);
|
|
220
|
-
if (!isWorkflowId(workflowId))
|
|
221
|
-
return "Use letters, numbers, and dashes only";
|
|
222
|
-
if (workflowOptions.some((workflow) => workflow.value === workflowId)) {
|
|
223
|
-
return "That workflow name already exists";
|
|
224
|
-
}
|
|
225
|
-
return undefined;
|
|
101
|
+
structure: [structureBias.trim()],
|
|
102
|
+
shape: [shapeBias.trim()],
|
|
226
103
|
},
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
placeholder: "What should this interface focus on for this knowledge base?",
|
|
242
|
-
validate: (value) => (value.trim().length === 0 ? "Placeholder is required" : undefined),
|
|
243
|
-
});
|
|
244
|
-
if (prompts.isCancel(placeholder))
|
|
245
|
-
return placeholder;
|
|
246
|
-
const retrieveBias = await prompts.text({
|
|
247
|
-
message: "What should retrieve emphasize?",
|
|
248
|
-
placeholder: "Current decisions, canonical docs, and materials with strong signal",
|
|
249
|
-
validate: (value) => (value.trim().length === 0 ? "Retrieve guidance is required" : undefined),
|
|
250
|
-
});
|
|
251
|
-
if (prompts.isCancel(retrieveBias))
|
|
252
|
-
return retrieveBias;
|
|
253
|
-
const analyzeBias = await prompts.text({
|
|
254
|
-
message: "What should analyze emphasize?",
|
|
255
|
-
placeholder: "Risks, contradictions, and evidence-weighted findings",
|
|
256
|
-
validate: (value) => (value.trim().length === 0 ? "Analyze guidance is required" : undefined),
|
|
257
|
-
});
|
|
258
|
-
if (prompts.isCancel(analyzeBias))
|
|
259
|
-
return analyzeBias;
|
|
260
|
-
const compileBias = await prompts.text({
|
|
261
|
-
message: "What should compile emphasize?",
|
|
262
|
-
placeholder: "Decision-ready notes, concise briefs, and linked evidence",
|
|
263
|
-
validate: (value) => (value.trim().length === 0 ? "Compile guidance is required" : undefined),
|
|
264
|
-
});
|
|
265
|
-
if (prompts.isCancel(compileBias))
|
|
266
|
-
return compileBias;
|
|
267
|
-
const workflowPath = writeLocalWorkflowDefinition(sourcePath, {
|
|
268
|
-
id: workflowId,
|
|
269
|
-
type: "interface",
|
|
270
|
-
label,
|
|
271
|
-
hint: hint.trim(),
|
|
272
|
-
extends: baseWorkflow,
|
|
273
|
-
placeholder: placeholder.trim(),
|
|
274
|
-
stage_policy_notes: {
|
|
275
|
-
retrieve: [retrieveBias.trim()],
|
|
276
|
-
analyze: [analyzeBias.trim()],
|
|
277
|
-
compile: [compileBias.trim()],
|
|
104
|
+
}, [
|
|
105
|
+
{
|
|
106
|
+
relativePath: "README.md",
|
|
107
|
+
content: [
|
|
108
|
+
renderJsonFrontmatter({ mode: "extend" }),
|
|
109
|
+
`# ${label}`,
|
|
110
|
+
"",
|
|
111
|
+
`This local workspace workflow extends \`${baseWorkflow}\`.`,
|
|
112
|
+
"",
|
|
113
|
+
`- summarize bias: ${summarizeBias.trim()}`,
|
|
114
|
+
`- structure bias: ${structureBias.trim()}`,
|
|
115
|
+
`- shape bias: ${shapeBias.trim()}`,
|
|
116
|
+
"",
|
|
117
|
+
].join("\n"),
|
|
278
118
|
},
|
|
279
|
-
|
|
280
|
-
{
|
|
281
|
-
relativePath: "README.md",
|
|
282
|
-
content: [
|
|
283
|
-
renderJsonFrontmatter({ mode: "extend" }),
|
|
284
|
-
`# ${label}`,
|
|
285
|
-
"",
|
|
286
|
-
`This local interface workflow extends \`${baseWorkflow}\`.`,
|
|
287
|
-
"",
|
|
288
|
-
`- retrieve bias: ${retrieveBias.trim()}`,
|
|
289
|
-
`- analyze bias: ${analyzeBias.trim()}`,
|
|
290
|
-
`- compile bias: ${compileBias.trim()}`,
|
|
291
|
-
"",
|
|
292
|
-
].join("\n"),
|
|
293
|
-
},
|
|
294
|
-
],
|
|
295
|
-
});
|
|
119
|
+
]);
|
|
296
120
|
prompts.log.info(`Saved local workflow: ${workflowPath}`);
|
|
297
121
|
return workflowId;
|
|
298
122
|
}
|