@uluops/setup 0.10.0 → 0.12.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +772 -0
  2. package/README.md +81 -32
  3. package/dist/cli.js +7 -1
  4. package/dist/commands/helpers.js +70 -7
  5. package/dist/commands/per-harness.d.ts +5 -0
  6. package/dist/commands/per-harness.js +5 -0
  7. package/dist/commands/setup.d.ts +7 -0
  8. package/dist/commands/setup.js +100 -35
  9. package/dist/commands/uninstall.d.ts +7 -0
  10. package/dist/commands/uninstall.js +36 -9
  11. package/dist/commands/verify.d.ts +5 -0
  12. package/dist/commands/verify.js +5 -0
  13. package/dist/harnesses/claude-code.js +15 -7
  14. package/dist/harnesses/codex.js +21 -4
  15. package/dist/harnesses/gemini-cli.js +13 -6
  16. package/dist/harnesses/index.d.ts +8 -0
  17. package/dist/harnesses/index.js +10 -0
  18. package/dist/harnesses/opencode.js +25 -7
  19. package/dist/lib/asset-catalog.js +15 -2
  20. package/dist/lib/atomic-write.d.ts +6 -0
  21. package/dist/lib/atomic-write.js +10 -0
  22. package/dist/lib/config-merger.js +27 -8
  23. package/dist/lib/display.d.ts +8 -0
  24. package/dist/lib/display.js +27 -1
  25. package/dist/lib/file-ops.d.ts +13 -4
  26. package/dist/lib/file-ops.js +69 -18
  27. package/dist/lib/install-lock.js +45 -13
  28. package/dist/lib/json-guards.d.ts +15 -0
  29. package/dist/lib/json-guards.js +30 -0
  30. package/dist/lib/manifest.d.ts +9 -2
  31. package/dist/lib/manifest.js +66 -8
  32. package/dist/lib/mcp-packages.d.ts +17 -15
  33. package/dist/lib/mcp-packages.js +15 -13
  34. package/dist/lib/settings-merger.js +53 -9
  35. package/dist/lib/version.js +19 -2
  36. package/dist/lib/write-coordinator.d.ts +50 -0
  37. package/dist/lib/write-coordinator.js +89 -0
  38. package/dist/steps/agent-metrics-cli.d.ts +6 -0
  39. package/dist/steps/agent-metrics-cli.js +19 -1
  40. package/dist/steps/agents.js +22 -4
  41. package/dist/steps/auth.js +53 -13
  42. package/dist/steps/cli.js +14 -1
  43. package/dist/steps/commands.js +28 -10
  44. package/dist/steps/mcp.js +18 -9
  45. package/dist/steps/metrics.js +77 -7
  46. package/dist/steps/shell.d.ts +4 -1
  47. package/dist/steps/shell.js +44 -6
  48. package/dist/steps/signup.d.ts +4 -0
  49. package/dist/steps/signup.js +18 -2
  50. package/dist/steps/skills.d.ts +11 -0
  51. package/dist/steps/skills.js +35 -6
  52. package/dist/steps/username.js +10 -2
  53. package/dist/steps/verify.js +55 -6
  54. package/package.json +8 -5
  55. package/dist/lib/agent-transform.d.ts +0 -12
  56. package/dist/lib/agent-transform.js +0 -129
@@ -1,129 +0,0 @@
1
- /**
2
- * Agent Transform
3
- *
4
- * Transforms Claude Code agent markdown to other harness formats at install time.
5
- * Single source of truth: assets/agents/ contains Claude Code format only.
6
- * Each harness gets its frontmatter rewritten; the body is identical across all targets.
7
- */
8
- function parseAgentMarkdown(markdown) {
9
- const first = markdown.indexOf("---");
10
- if (first === -1)
11
- return { frontmatter: {}, body: markdown };
12
- const second = markdown.indexOf("---", first + 3);
13
- if (second === -1)
14
- return { frontmatter: {}, body: markdown };
15
- const fmBlock = markdown.substring(first + 3, second).trim();
16
- const body = markdown.substring(second + 3);
17
- const frontmatter = {};
18
- for (const line of fmBlock.split("\n")) {
19
- const colonIdx = line.indexOf(":");
20
- if (colonIdx === -1)
21
- continue;
22
- const key = line.substring(0, colonIdx).trim();
23
- const value = line.substring(colonIdx + 1).trim();
24
- if (key)
25
- frontmatter[key] = value;
26
- }
27
- return { frontmatter, body };
28
- }
29
- // --- Tool mapping ---
30
- const GEMINI_TOOL_MAP = {
31
- Read: "read_file",
32
- Grep: "grep_search",
33
- Glob: "glob",
34
- Bash: "run_shell_command",
35
- };
36
- const OPENCODE_PERMISSION_MAP = {
37
- Read: { key: "read", level: "allow" },
38
- Grep: { key: "grep", level: "allow" },
39
- Glob: { key: "glob", level: "allow" },
40
- Bash: { key: "bash", level: "ask" },
41
- };
42
- function parseToolsList(toolsStr) {
43
- // Handle both "Read, Grep, Glob" and "[Read, Grep, Glob]" formats
44
- return toolsStr
45
- .replace(/^\[|\]$/g, "")
46
- .split(",")
47
- .map((t) => t.trim())
48
- .filter(Boolean);
49
- }
50
- // --- Harness-specific frontmatter builders ---
51
- function buildGeminiFrontmatter(fm) {
52
- const lines = [];
53
- lines.push(`name: ${fm["name"] ?? "unknown"}`);
54
- const desc = fm["description"] ?? "";
55
- // Quote description if it contains YAML-special chars
56
- if (/[:#{}[\],&*?|>!%@`"']/.test(desc) || desc === "") {
57
- lines.push(`description: "${desc.replace(/"/g, '\\"')}"`);
58
- }
59
- else {
60
- lines.push(`description: ${desc}`);
61
- }
62
- lines.push("kind: local");
63
- // Map tools
64
- const tools = parseToolsList(fm["tools"] ?? "");
65
- const geminiTools = tools
66
- .map((t) => GEMINI_TOOL_MAP[t])
67
- .filter(Boolean);
68
- if (geminiTools.length > 0) {
69
- lines.push("tools:");
70
- for (const t of geminiTools) {
71
- lines.push(` - ${t}`);
72
- }
73
- }
74
- lines.push("model: gemini-3-preview");
75
- lines.push("temperature: 0.2");
76
- lines.push("max_turns: 30");
77
- lines.push("timeout_mins: 10");
78
- return lines.join("\n");
79
- }
80
- function buildOpenCodeFrontmatter(fm) {
81
- const lines = [];
82
- lines.push(`name: ${fm["name"] ?? "unknown"}`);
83
- const desc = fm["description"] ?? "";
84
- if (/[:#{}[\],&*?|>!%@`"']/.test(desc) || desc === "") {
85
- lines.push(`description: "${desc.replace(/"/g, '\\"')}"`);
86
- }
87
- else {
88
- lines.push(`description: ${desc}`);
89
- }
90
- lines.push("mode: subagent");
91
- // Map tools to permissions
92
- const tools = parseToolsList(fm["tools"] ?? "");
93
- const permissions = {};
94
- for (const t of tools) {
95
- const mapping = OPENCODE_PERMISSION_MAP[t];
96
- if (mapping)
97
- permissions[mapping.key] = mapping.level;
98
- }
99
- if (Object.keys(permissions).length > 0) {
100
- permissions["list"] = "allow";
101
- lines.push("permission:");
102
- for (const [key, level] of Object.entries(permissions)) {
103
- lines.push(` ${key}: ${level}`);
104
- }
105
- }
106
- lines.push("model: openai/gpt-5");
107
- return lines.join("\n");
108
- }
109
- // --- Public API ---
110
- /**
111
- * Transform a Claude Code agent markdown file to a target harness format.
112
- * Returns the original content for claude-code; rewrites frontmatter for others.
113
- */
114
- export function transformAgent(markdown, harnessName) {
115
- if (harnessName === "claude-code")
116
- return markdown;
117
- const { frontmatter, body } = parseAgentMarkdown(markdown);
118
- let newFrontmatter;
119
- if (harnessName === "gemini-cli") {
120
- newFrontmatter = buildGeminiFrontmatter(frontmatter);
121
- }
122
- else if (harnessName === "opencode") {
123
- newFrontmatter = buildOpenCodeFrontmatter(frontmatter);
124
- }
125
- else {
126
- return markdown; // Unknown harness — pass through unchanged
127
- }
128
- return `---\n${newFrontmatter}\n---${body}`;
129
- }