@bx-h/meta-flow 0.1.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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/bin/meta-flow.js +7 -0
- package/examples/sample-task/adjudication-report.json +14 -0
- package/examples/sample-task/final-report.md +26 -0
- package/examples/sample-task/goal-contract.json +44 -0
- package/examples/sample-task/milestone-plan.json +31 -0
- package/examples/sample-task/milestones/M1/direction-evaluation.json +16 -0
- package/examples/sample-task/milestones/M1/task-list.json +41 -0
- package/examples/sample-task/milestones/M1/tasks/T1/execution-report.json +25 -0
- package/examples/sample-task/milestones/M1/tasks/T1/task-spec.json +37 -0
- package/examples/sample-task/milestones/M1/tasks/T1/verification-report.json +23 -0
- package/examples/sample-task/proposal-summary.md +21 -0
- package/examples/sample-task/proposal.md +29 -0
- package/examples/sample-task/questioning-report.json +31 -0
- package/examples/sample-task/raw-request.md +1 -0
- package/examples/sample-task/review-aggregate.json +34 -0
- package/examples/sample-task/reviews/product-reviewer.json +16 -0
- package/examples/sample-task/reviews/risk-reviewer.json +16 -0
- package/examples/sample-task/reviews/technical-reviewer.json +16 -0
- package/examples/sample-task/reviews/verification-reviewer.json +15 -0
- package/examples/sample-task/state.json +35 -0
- package/marketplace/marketplace.json +20 -0
- package/package.json +50 -0
- package/plugin/.codex-plugin/plugin.json +36 -0
- package/plugin/agent-templates/adjudicator.toml +26 -0
- package/plugin/agent-templates/direction-evaluator.toml +18 -0
- package/plugin/agent-templates/executor.toml +21 -0
- package/plugin/agent-templates/final-summarizer.toml +17 -0
- package/plugin/agent-templates/planner.toml +18 -0
- package/plugin/agent-templates/product-reviewer.toml +15 -0
- package/plugin/agent-templates/proposal-summarizer.toml +17 -0
- package/plugin/agent-templates/questioner.toml +22 -0
- package/plugin/agent-templates/researcher-proposer.toml +18 -0
- package/plugin/agent-templates/result-verifier.toml +20 -0
- package/plugin/agent-templates/risk-reviewer.toml +14 -0
- package/plugin/agent-templates/task-decomposer.toml +19 -0
- package/plugin/agent-templates/technical-reviewer.toml +14 -0
- package/plugin/agent-templates/verification-reviewer.toml +15 -0
- package/plugin/assets/icon.svg +10 -0
- package/plugin/assets/screenshot-placeholder.md +3 -0
- package/plugin/scripts/_common.py +95 -0
- package/plugin/scripts/aggregate_reviews.py +99 -0
- package/plugin/scripts/new_task.py +78 -0
- package/plugin/scripts/status.py +95 -0
- package/plugin/scripts/validate_adjudication.py +47 -0
- package/plugin/scripts/validate_goal_contract.py +56 -0
- package/plugin/scripts/validate_milestone_plan.py +49 -0
- package/plugin/scripts/validate_task_list.py +59 -0
- package/plugin/scripts/validate_task_verification.py +49 -0
- package/plugin/skills/meta-flow/SKILL.md +159 -0
- package/plugin/skills/meta-flow/references/adjudication-policy.md +30 -0
- package/plugin/skills/meta-flow/references/direction-evaluation-policy.md +24 -0
- package/plugin/skills/meta-flow/references/execution-policy.md +35 -0
- package/plugin/skills/meta-flow/references/review-rubric.md +28 -0
- package/plugin/skills/meta-flow/references/role-contracts.md +29 -0
- package/plugin/templates/adjudication-report.json +11 -0
- package/plugin/templates/direction-evaluation.json +16 -0
- package/plugin/templates/final-report.md +11 -0
- package/plugin/templates/goal-contract.json +20 -0
- package/plugin/templates/milestone-plan.json +15 -0
- package/plugin/templates/proposal-summary.md +11 -0
- package/plugin/templates/proposal.md +17 -0
- package/plugin/templates/questioning-report.json +15 -0
- package/plugin/templates/raw-request.md +3 -0
- package/plugin/templates/review-aggregate.json +14 -0
- package/plugin/templates/reviewer-report.json +10 -0
- package/plugin/templates/state.json +23 -0
- package/plugin/templates/task-execution-report.json +13 -0
- package/plugin/templates/task-list.json +20 -0
- package/plugin/templates/task-spec.json +16 -0
- package/plugin/templates/task-verification-report.json +13 -0
- package/src/cli/commands/doctor.js +171 -0
- package/src/cli/commands/install.js +120 -0
- package/src/cli/commands/print_paths.js +20 -0
- package/src/cli/commands/uninstall.js +56 -0
- package/src/cli/commands/verify.js +197 -0
- package/src/cli/index.js +53 -0
- package/src/cli/lib/agents.js +89 -0
- package/src/cli/lib/args.js +49 -0
- package/src/cli/lib/codex_config.js +106 -0
- package/src/cli/lib/fs_safe.js +142 -0
- package/src/cli/lib/logger.js +23 -0
- package/src/cli/lib/marketplace.js +72 -0
- package/src/cli/lib/paths.js +37 -0
- package/src/cli/lib/plugin.js +57 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function createLogger(options = {}) {
|
|
2
|
+
const verbose = Boolean(options.verbose);
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
info(message) {
|
|
6
|
+
console.log(message);
|
|
7
|
+
},
|
|
8
|
+
warn(message) {
|
|
9
|
+
console.warn(`WARN: ${message}`);
|
|
10
|
+
},
|
|
11
|
+
fail(message) {
|
|
12
|
+
console.error(`FAIL: ${message}`);
|
|
13
|
+
},
|
|
14
|
+
pass(message) {
|
|
15
|
+
console.log(`PASS: ${message}`);
|
|
16
|
+
},
|
|
17
|
+
verbose(message) {
|
|
18
|
+
if (verbose) {
|
|
19
|
+
console.log(message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { readJsonOrDefault, writeJsonPretty } from "./fs_safe.js";
|
|
3
|
+
import { repoMarketplacePath } from "./paths.js";
|
|
4
|
+
|
|
5
|
+
export function marketplaceEntry(targets) {
|
|
6
|
+
return {
|
|
7
|
+
name: "meta-flow",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
source: {
|
|
10
|
+
source: "local",
|
|
11
|
+
path: targets.scope === "repo" ? repoMarketplacePath() : targets.pluginTarget
|
|
12
|
+
},
|
|
13
|
+
policy: {
|
|
14
|
+
installation: "AVAILABLE",
|
|
15
|
+
authentication: "ON_INSTALL"
|
|
16
|
+
},
|
|
17
|
+
category: "Productivity"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function mergeMarketplace(existing, entry) {
|
|
22
|
+
const marketplace = existing && typeof existing === "object" ? structuredClone(existing) : {};
|
|
23
|
+
if (!marketplace.name) {
|
|
24
|
+
marketplace.name = "meta-flow-marketplace";
|
|
25
|
+
}
|
|
26
|
+
if (!marketplace.interface) {
|
|
27
|
+
marketplace.interface = { displayName: "Meta Flow Marketplace" };
|
|
28
|
+
}
|
|
29
|
+
if (!Array.isArray(marketplace.plugins)) {
|
|
30
|
+
marketplace.plugins = [];
|
|
31
|
+
}
|
|
32
|
+
const index = marketplace.plugins.findIndex((plugin) => plugin?.name === entry.name);
|
|
33
|
+
if (index >= 0) {
|
|
34
|
+
marketplace.plugins[index] = { ...marketplace.plugins[index], ...entry };
|
|
35
|
+
} else {
|
|
36
|
+
marketplace.plugins.push(entry);
|
|
37
|
+
}
|
|
38
|
+
return marketplace;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function removeMarketplaceEntry(existing, name = "meta-flow") {
|
|
42
|
+
const marketplace = existing && typeof existing === "object" ? structuredClone(existing) : {};
|
|
43
|
+
if (!Array.isArray(marketplace.plugins)) {
|
|
44
|
+
marketplace.plugins = [];
|
|
45
|
+
}
|
|
46
|
+
marketplace.plugins = marketplace.plugins.filter((plugin) => plugin?.name !== name);
|
|
47
|
+
return marketplace;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function updateMarketplace(targets, options = {}) {
|
|
51
|
+
const current = await readJsonOrDefault(targets.marketplaceTarget, {
|
|
52
|
+
name: "meta-flow-marketplace",
|
|
53
|
+
interface: { displayName: "Meta Flow Marketplace" },
|
|
54
|
+
plugins: []
|
|
55
|
+
});
|
|
56
|
+
const next = mergeMarketplace(current, marketplaceEntry(targets));
|
|
57
|
+
await writeJsonPretty(targets.marketplaceTarget, next, options);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function uninstallMarketplace(targets, options = {}) {
|
|
61
|
+
const current = await readJsonOrDefault(targets.marketplaceTarget, {
|
|
62
|
+
name: "meta-flow-marketplace",
|
|
63
|
+
interface: { displayName: "Meta Flow Marketplace" },
|
|
64
|
+
plugins: []
|
|
65
|
+
});
|
|
66
|
+
const next = removeMarketplaceEntry(current);
|
|
67
|
+
await writeJsonPretty(targets.marketplaceTarget, next, options);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function describeMarketplace(targets) {
|
|
71
|
+
return path.resolve(targets.marketplaceTarget);
|
|
72
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
6
|
+
export const packageRoot = path.resolve(path.dirname(thisFile), "../../..");
|
|
7
|
+
export const pluginSource = path.join(packageRoot, "plugin");
|
|
8
|
+
export const agentTemplatesSource = path.join(pluginSource, "agent-templates");
|
|
9
|
+
export const marketplaceSource = path.join(packageRoot, "marketplace", "marketplace.json");
|
|
10
|
+
export const examplesRoot = path.join(packageRoot, "examples");
|
|
11
|
+
export const sampleTaskRoot = path.join(examplesRoot, "sample-task");
|
|
12
|
+
|
|
13
|
+
export function resolveTargets({ scope = "repo", target } = {}) {
|
|
14
|
+
if (!["repo", "user"].includes(scope)) {
|
|
15
|
+
throw new Error("--scope must be repo or user");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const base = scope === "user"
|
|
19
|
+
? os.homedir()
|
|
20
|
+
: path.resolve(target || process.cwd());
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
scope,
|
|
24
|
+
target: base,
|
|
25
|
+
pluginTarget: scope === "user"
|
|
26
|
+
? path.join(base, ".codex", "plugins", "meta-flow")
|
|
27
|
+
: path.join(base, "plugins", "meta-flow"),
|
|
28
|
+
marketplaceTarget: path.join(base, ".agents", "plugins", "marketplace.json"),
|
|
29
|
+
agentsTarget: path.join(base, ".codex", "agents"),
|
|
30
|
+
codexConfigTarget: path.join(base, ".codex", "config.toml"),
|
|
31
|
+
tasksTarget: path.join(base, ".meta-flow", "tasks")
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function repoMarketplacePath() {
|
|
36
|
+
return "./plugins/meta-flow";
|
|
37
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { backupIfExists, copyDirSafe, pathExists, removeDirSafe } from "./fs_safe.js";
|
|
4
|
+
import { pluginSource } from "./paths.js";
|
|
5
|
+
|
|
6
|
+
async function isMetaFlowPlugin(dir) {
|
|
7
|
+
try {
|
|
8
|
+
const manifest = JSON.parse(await fs.readFile(path.join(dir, ".codex-plugin", "plugin.json"), "utf8"));
|
|
9
|
+
return manifest.name === "meta-flow";
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function installPlugin(targets, options = {}) {
|
|
16
|
+
const { dryRun = false, force = false, logger } = options;
|
|
17
|
+
if (await pathExists(targets.pluginTarget)) {
|
|
18
|
+
if (!(await isMetaFlowPlugin(targets.pluginTarget)) && !force) {
|
|
19
|
+
return { installed: false, conflict: targets.pluginTarget };
|
|
20
|
+
}
|
|
21
|
+
if (force) {
|
|
22
|
+
await backupIfExists(targets.pluginTarget, { dryRun, logger });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
await copyDirSafe(pluginSource, targets.pluginTarget, { dryRun, logger });
|
|
26
|
+
return { installed: true, conflict: null };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function uninstallPlugin(targets, options = {}) {
|
|
30
|
+
if (!(await pathExists(targets.pluginTarget))) {
|
|
31
|
+
return { removed: false, skipped: false };
|
|
32
|
+
}
|
|
33
|
+
if (!(await isMetaFlowPlugin(targets.pluginTarget))) {
|
|
34
|
+
return { removed: false, skipped: true };
|
|
35
|
+
}
|
|
36
|
+
const parent = path.dirname(targets.pluginTarget);
|
|
37
|
+
await removeDirSafe(parent, targets.pluginTarget, options);
|
|
38
|
+
return { removed: true, skipped: false };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function validatePlugin(root = pluginSource) {
|
|
42
|
+
const manifestPath = path.join(root, ".codex-plugin", "plugin.json");
|
|
43
|
+
const skillPath = path.join(root, "skills", "meta-flow", "SKILL.md");
|
|
44
|
+
const manifest = JSON.parse(await fs.readFile(manifestPath, "utf8"));
|
|
45
|
+
const skill = await fs.readFile(skillPath, "utf8");
|
|
46
|
+
const errors = [];
|
|
47
|
+
if (manifest.name !== "meta-flow") {
|
|
48
|
+
errors.push("plugin manifest name must be meta-flow");
|
|
49
|
+
}
|
|
50
|
+
if (manifest.version !== "0.1.0") {
|
|
51
|
+
errors.push("plugin manifest version must be 0.1.0");
|
|
52
|
+
}
|
|
53
|
+
if (!/^---\n[\s\S]*?name:\s*meta-flow[\s\S]*?---/m.test(skill)) {
|
|
54
|
+
errors.push("SKILL.md frontmatter must contain name: meta-flow");
|
|
55
|
+
}
|
|
56
|
+
return { manifestPath, skillPath, errors };
|
|
57
|
+
}
|