opencodekit 0.21.0 → 0.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/index.js +4 -4
  2. package/dist/template/.opencode/AGENTS.md +51 -30
  3. package/dist/template/.opencode/agent/vision.md +0 -1
  4. package/dist/template/.opencode/memory.db +0 -0
  5. package/dist/template/.opencode/memory.db-shm +0 -0
  6. package/dist/template/.opencode/memory.db-wal +0 -0
  7. package/dist/template/.opencode/opencode.json +2 -2
  8. package/dist/template/.opencode/package.json +20 -21
  9. package/dist/template/.opencode/plugin/README.md +0 -7
  10. package/dist/template/.opencode/plugin/copilot-auth.ts +59 -0
  11. package/dist/template/.opencode/plugin/prompt-leverage.ts +136 -138
  12. package/dist/template/.opencode/pnpm-lock.yaml +140 -706
  13. package/dist/template/.opencode/skill/agent-evals/SKILL.md +208 -0
  14. package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +76 -0
  15. package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +222 -0
  16. package/dist/template/.opencode/skill/context-condensation/SKILL.md +149 -0
  17. package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +139 -0
  18. package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +253 -0
  19. package/dist/template/.opencode/skill/html-deck-export/SKILL.md +189 -0
  20. package/dist/template/.opencode/skill/test-driven-development/SKILL.md +15 -0
  21. package/package.json +1 -1
  22. package/dist/template/.opencode/plugin/prompt-leverage.ts.bak +0 -228
  23. package/dist/template/.opencode/plugin/stitch.ts +0 -307
  24. package/dist/template/.opencode/skill/stitch/SKILL.md +0 -164
  25. package/dist/template/.opencode/skill/stitch-design-taste/DESIGN.md +0 -121
  26. package/dist/template/.opencode/skill/stitch-design-taste/SKILL.md +0 -197
@@ -8,116 +8,116 @@
8
8
  import type { Plugin } from "@opencode-ai/plugin";
9
9
 
10
10
  const TASK_KEYWORDS: Record<string, string[]> = {
11
- coding: [
12
- "code",
13
- "bug",
14
- "repo",
15
- "refactor",
16
- "test",
17
- "implement",
18
- "fix",
19
- "function",
20
- "api",
21
- "add",
22
- "update",
23
- "remove",
24
- ],
25
- research: [
26
- "research",
27
- "compare",
28
- "find",
29
- "latest",
30
- "sources",
31
- "analyze",
32
- "look up",
33
- ],
34
- writing: [
35
- "write",
36
- "rewrite",
37
- "draft",
38
- "email",
39
- "memo",
40
- "blog",
41
- "copy",
42
- "tone",
43
- ],
44
- review: ["review", "audit", "critique", "inspect", "evaluate", "assess"],
45
- planning: ["plan", "roadmap", "strategy", "framework", "outline"],
46
- analysis: ["analyze", "explain", "break down", "diagnose", "root cause"],
11
+ coding: [
12
+ "code",
13
+ "bug",
14
+ "repo",
15
+ "refactor",
16
+ "test",
17
+ "implement",
18
+ "fix",
19
+ "function",
20
+ "api",
21
+ "add",
22
+ "update",
23
+ "remove",
24
+ ],
25
+ research: [
26
+ "research",
27
+ "compare",
28
+ "find",
29
+ "latest",
30
+ "sources",
31
+ "analyze",
32
+ "look up",
33
+ ],
34
+ writing: [
35
+ "write",
36
+ "rewrite",
37
+ "draft",
38
+ "email",
39
+ "memo",
40
+ "blog",
41
+ "copy",
42
+ "tone",
43
+ ],
44
+ review: ["review", "audit", "critique", "inspect", "evaluate", "assess"],
45
+ planning: ["plan", "roadmap", "strategy", "framework", "outline"],
46
+ analysis: ["analyze", "explain", "break down", "diagnose", "root cause"],
47
47
  };
48
48
 
49
49
  function detectTask(prompt: string): string {
50
- const lowered = prompt.toLowerCase();
51
- const scores: Record<string, number> = {};
52
- for (const [task, keywords] of Object.entries(TASK_KEYWORDS)) {
53
- scores[task] = keywords.filter((k) => lowered.includes(k)).length;
54
- }
55
- const best = Object.entries(scores).sort((a, b) => b[1] - a[1]);
56
- return best[0]?.[1] ? best[0][0] : "analysis";
50
+ const lowered = prompt.toLowerCase();
51
+ const scores: Record<string, number> = {};
52
+ for (const [task, keywords] of Object.entries(TASK_KEYWORDS)) {
53
+ scores[task] = keywords.filter((k) => lowered.includes(k)).length;
54
+ }
55
+ const best = Object.entries(scores).sort((a, b) => b[1] - a[1]);
56
+ return best[0]?.[1] ? best[0][0] : "analysis";
57
57
  }
58
58
 
59
59
  function inferIntensity(prompt: string, task: string): string {
60
- const lowered = prompt.toLowerCase();
61
- if (
62
- ["careful", "deep", "thorough", "critical", "production"].some((t) =>
63
- lowered.includes(t),
64
- )
65
- ) {
66
- return "Deep";
67
- }
68
- if (task === "coding" || task === "research" || task === "review") {
69
- return "Standard";
70
- }
71
- return "Light";
60
+ const lowered = prompt.toLowerCase();
61
+ if (
62
+ ["careful", "deep", "thorough", "critical", "production"].some((t) =>
63
+ lowered.includes(t),
64
+ )
65
+ ) {
66
+ return "Deep";
67
+ }
68
+ if (task === "coding" || task === "research" || task === "review") {
69
+ return "Standard";
70
+ }
71
+ return "Light";
72
72
  }
73
73
 
74
74
  function buildToolRules(task: string): string {
75
- const rules: Record<string, string> = {
76
- coding:
77
- "Inspect the relevant files and dependencies first. Validate the final change with the narrowest useful checks before broadening scope.",
78
- research:
79
- "Retrieve evidence from reliable sources before concluding. Do not guess facts that can be checked.",
80
- review:
81
- "Read enough surrounding context to understand intent before critiquing. Distinguish confirmed issues from plausible risks.",
82
- };
83
- return (
84
- rules[task] ||
85
- "Use tools or extra context only when they materially improve correctness or completeness."
86
- );
75
+ const rules: Record<string, string> = {
76
+ coding:
77
+ "Inspect the relevant files and dependencies first. Validate the final change with the narrowest useful checks before broadening scope.",
78
+ research:
79
+ "Retrieve evidence from reliable sources before concluding. Do not guess facts that can be checked.",
80
+ review:
81
+ "Read enough surrounding context to understand intent before critiquing. Distinguish confirmed issues from plausible risks.",
82
+ };
83
+ return (
84
+ rules[task] ||
85
+ "Use tools or extra context only when they materially improve correctness or completeness."
86
+ );
87
87
  }
88
88
 
89
89
  function buildOutputContract(task: string): string {
90
- const contracts: Record<string, string> = {
91
- coding:
92
- "Return the result in a practical execution format: concise summary, concrete changes or code, validation notes, and any remaining risks.",
93
- research:
94
- "Return a structured synthesis with key findings, supporting evidence, uncertainty where relevant, and a concise bottom line.",
95
- writing:
96
- "Return polished final copy in the requested tone and format. If useful, include a short rationale for major editorial choices.",
97
- review:
98
- "Return findings grouped by severity or importance, explain why each matters, and suggest the smallest credible next step.",
99
- };
100
- return (
101
- contracts[task] ||
102
- "Return a clear, well-structured response matched to the task, with no unnecessary verbosity."
103
- );
90
+ const contracts: Record<string, string> = {
91
+ coding:
92
+ "Return the result in a practical execution format: concise summary, concrete changes or code, validation notes, and any remaining risks.",
93
+ research:
94
+ "Return a structured synthesis with key findings, supporting evidence, uncertainty where relevant, and a concise bottom line.",
95
+ writing:
96
+ "Return polished final copy in the requested tone and format. If useful, include a short rationale for major editorial choices.",
97
+ review:
98
+ "Return findings grouped by severity or importance, explain why each matters, and suggest the smallest credible next step.",
99
+ };
100
+ return (
101
+ contracts[task] ||
102
+ "Return a clear, well-structured response matched to the task, with no unnecessary verbosity."
103
+ );
104
104
  }
105
105
 
106
106
  function upgradePrompt(userPrompt: string): string {
107
- const normalized = userPrompt.trim().replace(/\s+/g, " ");
108
- const task = detectTask(normalized);
109
- const intensity = inferIntensity(normalized, task);
110
- const toolRules = buildToolRules(task);
111
- const outputContract = buildOutputContract(task);
112
-
113
- if (normalized.includes("Objective:") && normalized.includes("Context:")) {
114
- return userPrompt;
115
- }
116
- if (normalized.length < 15 || normalized.split(" ").length < 3) {
117
- return userPrompt;
118
- }
119
-
120
- return `Objective:
107
+ const normalized = userPrompt.trim().replace(/\s+/g, " ");
108
+ const task = detectTask(normalized);
109
+ const intensity = inferIntensity(normalized, task);
110
+ const toolRules = buildToolRules(task);
111
+ const outputContract = buildOutputContract(task);
112
+
113
+ if (normalized.includes("Objective:") && normalized.includes("Context:")) {
114
+ return userPrompt;
115
+ }
116
+ if (normalized.length < 15 || normalized.split(" ").length < 3) {
117
+ return userPrompt;
118
+ }
119
+
120
+ return `Objective:
121
121
  - Complete this task: ${normalized}
122
122
  - Optimize for a correct, useful result rather than a merely plausible one.
123
123
 
@@ -147,47 +147,45 @@ Done Criteria:
147
147
  }
148
148
 
149
149
  export const PromptLeverage: Plugin = async ({ client }) => {
150
- console.log("PromptLeverage: Initializing...");
151
-
152
- const showToast = async (message: string) => {
153
- try {
154
- await client.tui.showToast({
155
- body: {
156
- title: "PromptLeverage",
157
- message,
158
- variant: "info",
159
- duration: 3000,
160
- },
161
- });
162
- } catch {
163
- /* Toast API unavailable */
164
- }
165
- };
166
-
167
- return {
168
- "experimental.chat.messages.transform": async (input: any, output: any) => {
169
- try {
170
- const msgs = output.messages || input.messages || [];
171
-
172
- // Find the last message with parts (user message)
173
- for (let i = msgs.length - 1; i >= 0; i--) {
174
- const msg = msgs[i];
175
- if (msg?.parts) {
176
- for (const part of msg.parts) {
177
- if (part.type === "text" && part.text) {
178
- const upgraded = upgradePrompt(part.text);
179
- if (upgraded !== part.text) {
180
- part.text = upgraded;
181
- showToast("Upgraded prompt!");
182
- }
183
- }
184
- }
185
- break; // Only upgrade the most recent message
186
- }
187
- }
188
- } catch (e: any) {
189
- showToast(`Error: ${e.message}`);
190
- }
191
- },
192
- };
150
+ const showToast = async (message: string) => {
151
+ try {
152
+ await client.tui.showToast({
153
+ body: {
154
+ title: "PromptLeverage",
155
+ message,
156
+ variant: "info",
157
+ duration: 3000,
158
+ },
159
+ });
160
+ } catch {
161
+ /* Toast API unavailable */
162
+ }
163
+ };
164
+
165
+ return {
166
+ "experimental.chat.messages.transform": async (input: any, output: any) => {
167
+ try {
168
+ const msgs = output.messages || input.messages || [];
169
+
170
+ // Find the last message with parts (user message)
171
+ for (let i = msgs.length - 1; i >= 0; i--) {
172
+ const msg = msgs[i];
173
+ if (msg?.parts) {
174
+ for (const part of msg.parts) {
175
+ if (part.type === "text" && part.text) {
176
+ const upgraded = upgradePrompt(part.text);
177
+ if (upgraded !== part.text) {
178
+ part.text = upgraded;
179
+ showToast("Upgraded prompt!");
180
+ }
181
+ }
182
+ }
183
+ break; // Only upgrade the most recent message
184
+ }
185
+ }
186
+ } catch (e: any) {
187
+ showToast(`Error: ${e.message}`);
188
+ }
189
+ },
190
+ };
193
191
  };