@kleber.mottajr/juninho 2.0.0 → 2.0.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/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +110 -16
- package/dist/installer.js.map +1 -1
- package/dist/project-types.d.ts.map +1 -1
- package/dist/project-types.js +6 -0
- package/dist/project-types.js.map +1 -1
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +670 -358
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/commands.js +525 -449
- package/dist/templates/commands.js.map +1 -1
- package/dist/templates/docs.d.ts.map +1 -1
- package/dist/templates/docs.js +13 -0
- package/dist/templates/docs.js.map +1 -1
- package/dist/templates/lib.d.ts +2 -0
- package/dist/templates/lib.d.ts.map +1 -0
- package/dist/templates/lib.js +506 -0
- package/dist/templates/lib.js.map +1 -0
- package/dist/templates/plugins.d.ts.map +1 -1
- package/dist/templates/plugins.js +2287 -1213
- package/dist/templates/plugins.js.map +1 -1
- package/dist/templates/skills.d.ts.map +1 -1
- package/dist/templates/skills.js +30 -0
- package/dist/templates/skills.js.map +1 -1
- package/dist/templates/state.d.ts.map +1 -1
- package/dist/templates/state.js +21 -0
- package/dist/templates/state.js.map +1 -1
- package/dist/templates/support-scripts.d.ts.map +1 -1
- package/dist/templates/support-scripts.js +85 -0
- package/dist/templates/support-scripts.js.map +1 -1
- package/package.json +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/templates/commands.ts"],"names":[],"mappings":";;;;;AAGA,sCAiBC;AApBD,2BAAkC;AAClC,gDAAuB;AAEvB,SAAgB,aAAa,CAAC,UAAkB;IAC9C,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,UAA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;IACd,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,WAA2B,EACxC,QAAQ,GAAE,OAAe,GACxB,IAAI,CASN;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/templates/docs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGtD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,WAA2B,EACxC,QAAQ,GAAE,OAAe,GACxB,IAAI,CASN;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CA0InF"}
|
package/dist/templates/docs.js
CHANGED
|
@@ -109,6 +109,16 @@ function patchOpencodeJson(projectDir, models) {
|
|
|
109
109
|
question: "deny",
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
|
+
"j.checker": {
|
|
113
|
+
model: m.medium,
|
|
114
|
+
permission: {
|
|
115
|
+
bash: "allow",
|
|
116
|
+
write: "allow",
|
|
117
|
+
edit: "allow",
|
|
118
|
+
task: "allow",
|
|
119
|
+
question: "deny",
|
|
120
|
+
},
|
|
121
|
+
},
|
|
112
122
|
"j.unify": {
|
|
113
123
|
model: m.medium,
|
|
114
124
|
permission: {
|
|
@@ -280,6 +290,9 @@ Can fix FIX-tier issues directly. Writes per-task audit trail to \`docs/specs/{s
|
|
|
280
290
|
### @j.reviewer
|
|
281
291
|
Detailed read-only reviewer. Used via \`/j.pr-review\` and by \`/j.check\` to generate actionable follow-up findings.
|
|
282
292
|
|
|
293
|
+
### @j.checker
|
|
294
|
+
Full quality-gate orchestrator. Runs \`.opencode/scripts/check-all.sh\`, delegates multi-pass review to \`@j.reviewer\`, persists \`check-review.md\`, and returns reentry guidance for \`@j.implementer\`.
|
|
295
|
+
|
|
283
296
|
### @j.unify
|
|
284
297
|
Closes the loop according to \`.opencode/juninho-config.json\` under \`workflow\`.
|
|
285
298
|
Can update docs, cleanup integrated task worktrees/branches, and create PRs when those steps are enabled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/templates/docs.ts"],"names":[],"mappings":";;;;;AAYA,8BAaC;AAED,
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/templates/docs.ts"],"names":[],"mappings":";;;;;AAYA,8BAaC;AAED,8CA0IC;AArKD,2BAA4D;AAC5D,gDAAuB;AACvB,4CAA6C;AAE7C,0DAA2D;AAQ3D,SAAgB,SAAS,CACvB,UAAkB,EAClB,cAA2B,aAAa,EACxC,WAAoB,KAAK;IAEzB,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAA;IAClF,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,YAAY,CAAC,CAAA;IAChF,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;IAChF,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,kBAAkB,CAAC,EAAE,aAAa,CAAC,CAAA;IAC7F,IAAA,kBAAa,EAAC,cAAI,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AAED,MAAM,YAAY,GAAG;;;;;;;;;;CAUpB,CAAA;AAED,MAAM,aAAa,GAAG;;;;;;;;;;CAUrB,CAAA;AAED,MAAM,aAAa,GAAG;;;;;;;;;;CAUrB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/templates/lib.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAOjD"}
|
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeLib = writeLib;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
function writeLib(projectDir) {
|
|
10
|
+
const libDir = path_1.default.join(projectDir, ".opencode", "lib");
|
|
11
|
+
(0, fs_1.writeFileSync)(path_1.default.join(libDir, "j.workspace-paths.ts"), WORKSPACE_PATHS);
|
|
12
|
+
(0, fs_1.writeFileSync)(path_1.default.join(libDir, "j.feature-state-paths.ts"), FEATURE_STATE_PATHS);
|
|
13
|
+
(0, fs_1.writeFileSync)(path_1.default.join(libDir, "j.state-paths.ts"), STATE_PATHS);
|
|
14
|
+
(0, fs_1.writeFileSync)(path_1.default.join(libDir, "j.juninho-config.ts"), JUNINHO_CONFIG);
|
|
15
|
+
}
|
|
16
|
+
const WORKSPACE_PATHS = `import { existsSync, readFileSync, readdirSync, statSync } from "fs"
|
|
17
|
+
import path from "path"
|
|
18
|
+
|
|
19
|
+
type ProjectHints = {
|
|
20
|
+
prompt?: string
|
|
21
|
+
planPath?: string
|
|
22
|
+
specPath?: string
|
|
23
|
+
contextPath?: string
|
|
24
|
+
taskContractPath?: string
|
|
25
|
+
targetRepoRoot?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type ActivePlanTarget = {
|
|
29
|
+
project?: string
|
|
30
|
+
slug?: string
|
|
31
|
+
planPath?: string
|
|
32
|
+
specPath?: string
|
|
33
|
+
contextPath?: string
|
|
34
|
+
targetRepoRoot?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type ActivePlanReferenceProject = {
|
|
38
|
+
project?: string
|
|
39
|
+
targetRepoRoot?: string
|
|
40
|
+
reason?: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type ActivePlanState = ActivePlanTarget & {
|
|
44
|
+
writeTargets?: ActivePlanTarget[]
|
|
45
|
+
targets?: ActivePlanTarget[]
|
|
46
|
+
referenceProjects?: ActivePlanReferenceProject[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type ProjectPaths = {
|
|
50
|
+
workspaceRoot: string
|
|
51
|
+
harnessRoot: string
|
|
52
|
+
projectRoot: string
|
|
53
|
+
stateRoot: string
|
|
54
|
+
docsRoot: string
|
|
55
|
+
specsRoot: string
|
|
56
|
+
principlesRoot: string
|
|
57
|
+
domainRoot: string
|
|
58
|
+
projectLabel: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const IGNORED_DIRS = new Set([
|
|
62
|
+
".git",
|
|
63
|
+
".idea",
|
|
64
|
+
".opencode",
|
|
65
|
+
"build",
|
|
66
|
+
"dist",
|
|
67
|
+
"node_modules",
|
|
68
|
+
"target",
|
|
69
|
+
"tmp",
|
|
70
|
+
"worktrees",
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
const discoveryCache = new Map<string, string[]>()
|
|
74
|
+
|
|
75
|
+
function normalizePath(filePath: string): string {
|
|
76
|
+
return filePath.replace(/\\\\/g, "/")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function looksLikeProjectRoot(directory: string): boolean {
|
|
80
|
+
if (!existsSync(directory)) return false
|
|
81
|
+
return existsSync(path.join(directory, ".git")) || (existsSync(path.join(directory, "opencode.json")) && existsSync(path.join(directory, "docs")))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function walkProjects(current: string, depth: number, found: Set<string>): void {
|
|
85
|
+
if (depth < 0 || !existsSync(current)) return
|
|
86
|
+
if (looksLikeProjectRoot(current)) {
|
|
87
|
+
found.add(current)
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let entries: ReturnType<typeof readdirSync>
|
|
92
|
+
try {
|
|
93
|
+
entries = readdirSync(current, { withFileTypes: true })
|
|
94
|
+
} catch {
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const entry of entries) {
|
|
99
|
+
if (!entry.isDirectory()) continue
|
|
100
|
+
if (IGNORED_DIRS.has(entry.name)) continue
|
|
101
|
+
walkProjects(path.join(current, entry.name), depth - 1, found)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function uniqueSorted(paths: Iterable<string>): string[] {
|
|
106
|
+
return Array.from(new Set(paths)).sort((left, right) => left.localeCompare(right))
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function looksLikeDirectDocsPath(value: string): boolean {
|
|
110
|
+
return /^docs\\//.test(normalizePath(value))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function escapeRegex(value: string): string {
|
|
114
|
+
return value.replace(/[.*+?^\${}()|[\\]\\\\]/g, "\\\\$&")
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function discoverWorkspaceProjects(workspaceRoot: string): string[] {
|
|
118
|
+
const cached = discoveryCache.get(workspaceRoot)
|
|
119
|
+
if (cached) return cached
|
|
120
|
+
|
|
121
|
+
const found = new Set<string>()
|
|
122
|
+
if (looksLikeProjectRoot(workspaceRoot)) found.add(workspaceRoot)
|
|
123
|
+
walkProjects(workspaceRoot, 4, found)
|
|
124
|
+
|
|
125
|
+
const projects = uniqueSorted(found)
|
|
126
|
+
discoveryCache.set(workspaceRoot, projects)
|
|
127
|
+
return projects
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function findContainingProjectRoot(workspaceRoot: string, targetPath: string): string | null {
|
|
131
|
+
const absolutePath = path.resolve(targetPath)
|
|
132
|
+
let current = absolutePath
|
|
133
|
+
try {
|
|
134
|
+
if (!statSync(absolutePath).isDirectory()) current = path.dirname(absolutePath)
|
|
135
|
+
} catch {
|
|
136
|
+
current = path.dirname(absolutePath)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const normalizedWorkspaceRoot = path.resolve(workspaceRoot)
|
|
140
|
+
while (current.startsWith(normalizedWorkspaceRoot)) {
|
|
141
|
+
if (looksLikeProjectRoot(current)) return current
|
|
142
|
+
if (current === normalizedWorkspaceRoot) break
|
|
143
|
+
const parent = path.dirname(current)
|
|
144
|
+
if (parent === current) break
|
|
145
|
+
current = parent
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return null
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function scoreProjectMatch(workspaceRoot: string, projectRoot: string, text: string): number {
|
|
152
|
+
const normalizedText = normalizePath(text)
|
|
153
|
+
const relativeRoot = normalizePath(path.relative(workspaceRoot, projectRoot))
|
|
154
|
+
const projectName = path.basename(projectRoot)
|
|
155
|
+
let score = 0
|
|
156
|
+
|
|
157
|
+
if (relativeRoot && normalizedText.includes(relativeRoot)) score = Math.max(score, relativeRoot.length + 20)
|
|
158
|
+
if (relativeRoot && normalizedText.includes("@" + relativeRoot + "/")) score = Math.max(score, relativeRoot.length + 30)
|
|
159
|
+
if (relativeRoot && normalizedText.includes(relativeRoot + "/docs/")) score = Math.max(score, relativeRoot.length + 40)
|
|
160
|
+
|
|
161
|
+
const projectNamePattern = new RegExp("(^|[^\\\\w-])" + escapeRegex(projectName) + "([^\\\\w-]|$)", "i")
|
|
162
|
+
if (projectNamePattern.test(normalizedText)) score = Math.max(score, projectName.length)
|
|
163
|
+
|
|
164
|
+
return score
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function inferProjectRootFromText(workspaceRoot: string, text: string): string | null {
|
|
168
|
+
const projects = discoverWorkspaceProjects(workspaceRoot)
|
|
169
|
+
if (projects.length === 0) return null
|
|
170
|
+
if (!text.trim()) return projects.length === 1 ? projects[0] : null
|
|
171
|
+
|
|
172
|
+
const ranked = projects
|
|
173
|
+
.map((projectRoot) => ({ projectRoot, score: scoreProjectMatch(workspaceRoot, projectRoot, text) }))
|
|
174
|
+
.filter((entry) => entry.score > 0)
|
|
175
|
+
.sort((left, right) => right.score - left.score)
|
|
176
|
+
|
|
177
|
+
if (ranked.length > 0) return ranked[0].projectRoot
|
|
178
|
+
return projects.length === 1 ? projects[0] : null
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function resolveProjectFromPathHint(workspaceRoot: string, value?: string): string | null {
|
|
182
|
+
if (!value) return null
|
|
183
|
+
const trimmed = value.trim()
|
|
184
|
+
if (!trimmed) return null
|
|
185
|
+
|
|
186
|
+
if (path.isAbsolute(trimmed)) return findContainingProjectRoot(workspaceRoot, trimmed)
|
|
187
|
+
|
|
188
|
+
const normalized = normalizePath(trimmed)
|
|
189
|
+
if (looksLikeDirectDocsPath(normalized)) return null
|
|
190
|
+
|
|
191
|
+
const candidate = path.resolve(workspaceRoot, trimmed)
|
|
192
|
+
const containing = findContainingProjectRoot(workspaceRoot, candidate)
|
|
193
|
+
if (containing) return containing
|
|
194
|
+
|
|
195
|
+
return inferProjectRootFromText(workspaceRoot, normalized)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function resolveTargetProjectRoot(workspaceRoot: string, hints: ProjectHints = {}): string | null {
|
|
199
|
+
const explicitTarget = hints.targetRepoRoot?.trim()
|
|
200
|
+
if (explicitTarget) {
|
|
201
|
+
const resolvedExplicit = path.isAbsolute(explicitTarget) ? explicitTarget : path.resolve(workspaceRoot, explicitTarget)
|
|
202
|
+
if (looksLikeProjectRoot(resolvedExplicit)) return resolvedExplicit
|
|
203
|
+
const containing = findContainingProjectRoot(workspaceRoot, resolvedExplicit)
|
|
204
|
+
if (containing) return containing
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const pathHints = [hints.planPath, hints.specPath, hints.contextPath, hints.taskContractPath]
|
|
208
|
+
for (const hint of pathHints) {
|
|
209
|
+
const projectRoot = resolveProjectFromPathHint(workspaceRoot, hint)
|
|
210
|
+
if (projectRoot) return projectRoot
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (hints.prompt) {
|
|
214
|
+
const fromPrompt = inferProjectRootFromText(workspaceRoot, hints.prompt)
|
|
215
|
+
if (fromPrompt) return fromPrompt
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const projects = discoverWorkspaceProjects(workspaceRoot)
|
|
219
|
+
if (projects.length === 1) return projects[0]
|
|
220
|
+
if (looksLikeProjectRoot(workspaceRoot)) return workspaceRoot
|
|
221
|
+
return workspaceRoot
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function resolvePathFromProjectRoot(projectRoot: string, value: string): string {
|
|
225
|
+
return path.isAbsolute(value) ? value : path.join(projectRoot, value)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function resolveProjectPaths(workspaceRoot: string, hints: ProjectHints = {}): ProjectPaths | null {
|
|
229
|
+
const projectRoot = resolveTargetProjectRoot(workspaceRoot, hints)
|
|
230
|
+
if (!projectRoot) return null
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
workspaceRoot,
|
|
234
|
+
harnessRoot: path.join(workspaceRoot, ".opencode"),
|
|
235
|
+
projectRoot,
|
|
236
|
+
stateRoot: path.join(workspaceRoot, ".opencode", "state"),
|
|
237
|
+
docsRoot: path.join(projectRoot, "docs"),
|
|
238
|
+
specsRoot: path.join(projectRoot, "docs", "specs"),
|
|
239
|
+
principlesRoot: path.join(projectRoot, "docs", "principles"),
|
|
240
|
+
domainRoot: path.join(projectRoot, "docs", "domain"),
|
|
241
|
+
projectLabel: normalizePath(path.relative(workspaceRoot, projectRoot)) || ".",
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function normalizeActivePlanTargets(workspaceRoot: string, state: ActivePlanState): ActivePlanTarget[] {
|
|
246
|
+
const directTargets = Array.isArray(state.writeTargets)
|
|
247
|
+
? state.writeTargets
|
|
248
|
+
: Array.isArray(state.targets)
|
|
249
|
+
? state.targets
|
|
250
|
+
: []
|
|
251
|
+
const fallbackTarget = state.planPath || state.specPath || state.contextPath || state.targetRepoRoot
|
|
252
|
+
? [{
|
|
253
|
+
project: state.project,
|
|
254
|
+
slug: state.slug,
|
|
255
|
+
planPath: state.planPath,
|
|
256
|
+
specPath: state.specPath,
|
|
257
|
+
contextPath: state.contextPath,
|
|
258
|
+
targetRepoRoot: state.targetRepoRoot,
|
|
259
|
+
} satisfies ActivePlanTarget]
|
|
260
|
+
: []
|
|
261
|
+
|
|
262
|
+
return directTargets.concat(fallbackTarget)
|
|
263
|
+
.map((target) => {
|
|
264
|
+
const targetRepoRoot = target.targetRepoRoot?.trim() || resolveTargetProjectRoot(workspaceRoot, {
|
|
265
|
+
targetRepoRoot: target.targetRepoRoot,
|
|
266
|
+
planPath: target.planPath,
|
|
267
|
+
specPath: target.specPath,
|
|
268
|
+
contextPath: target.contextPath,
|
|
269
|
+
}) || undefined
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
...target,
|
|
273
|
+
targetRepoRoot,
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
.filter((target) => Boolean(target.targetRepoRoot && (target.planPath || target.specPath || target.contextPath)))
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function loadActivePlanTargets(workspaceRoot: string): ActivePlanTarget[] {
|
|
280
|
+
const activePlanPath = path.join(workspaceRoot, ".opencode", "state", "active-plan.json")
|
|
281
|
+
if (!existsSync(activePlanPath)) return []
|
|
282
|
+
|
|
283
|
+
try {
|
|
284
|
+
const parsed = JSON.parse(readFileSync(activePlanPath, "utf-8")) as ActivePlanState
|
|
285
|
+
return normalizeActivePlanTargets(workspaceRoot, parsed)
|
|
286
|
+
} catch {
|
|
287
|
+
return []
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export function loadActivePlanTarget(workspaceRoot: string): ActivePlanTarget | null {
|
|
292
|
+
return loadActivePlanTargets(workspaceRoot)[0] ?? null
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export function loadActivePlanReferenceProjects(workspaceRoot: string): ActivePlanReferenceProject[] {
|
|
296
|
+
const activePlanPath = path.join(workspaceRoot, ".opencode", "state", "active-plan.json")
|
|
297
|
+
if (!existsSync(activePlanPath)) return []
|
|
298
|
+
|
|
299
|
+
try {
|
|
300
|
+
const parsed = JSON.parse(readFileSync(activePlanPath, "utf-8")) as ActivePlanState
|
|
301
|
+
return (Array.isArray(parsed.referenceProjects) ? parsed.referenceProjects : [])
|
|
302
|
+
.map((project) => ({
|
|
303
|
+
...project,
|
|
304
|
+
targetRepoRoot: project.targetRepoRoot?.trim()
|
|
305
|
+
|| resolveTargetProjectRoot(workspaceRoot, { targetRepoRoot: project.targetRepoRoot })
|
|
306
|
+
|| undefined,
|
|
307
|
+
}))
|
|
308
|
+
.filter((project): project is ActivePlanReferenceProject => Boolean(project.targetRepoRoot))
|
|
309
|
+
} catch {
|
|
310
|
+
return []
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
`;
|
|
314
|
+
const STATE_PATHS = `import path from "path"
|
|
315
|
+
import { resolveProjectPaths } from "./j.workspace-paths"
|
|
316
|
+
|
|
317
|
+
export function resolveStateFile(directory: string, filename: string): string {
|
|
318
|
+
return path.join(directory, ".opencode", "state", filename)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export function resolveProjectStateFile(directory: string, filename: string, hints?: { targetRepoRoot?: string; planPath?: string; specPath?: string; contextPath?: string; taskContractPath?: string; prompt?: string }): string | null {
|
|
322
|
+
const projectPaths = resolveProjectPaths(directory, hints)
|
|
323
|
+
if (!projectPaths) return null
|
|
324
|
+
return path.join(projectPaths.projectRoot, ".opencode", "state", filename)
|
|
325
|
+
}
|
|
326
|
+
`;
|
|
327
|
+
const FEATURE_STATE_PATHS = `import { mkdirSync } from "fs"
|
|
328
|
+
import path from "path"
|
|
329
|
+
import { resolveProjectPaths } from "./j.workspace-paths"
|
|
330
|
+
|
|
331
|
+
type FeaturePathHints = {
|
|
332
|
+
targetRepoRoot?: string
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function resolveFeatureSpecsRoot(directory: string, featureSlug: string, hints?: FeaturePathHints): string {
|
|
336
|
+
const projectPaths = resolveProjectPaths(directory, {
|
|
337
|
+
targetRepoRoot: hints?.targetRepoRoot,
|
|
338
|
+
planPath: \`docs/specs/\${featureSlug}/plan.md\`,
|
|
339
|
+
})
|
|
340
|
+
const specsRoot = projectPaths?.specsRoot ?? path.join(directory, "docs", "specs")
|
|
341
|
+
return path.join(specsRoot, featureSlug)
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export function featureStateDir(directory: string, featureSlug: string, hints?: FeaturePathHints): string {
|
|
345
|
+
return path.join(resolveFeatureSpecsRoot(directory, featureSlug, hints), "state")
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function featureStateTaskDir(directory: string, featureSlug: string, taskID: string, hints?: FeaturePathHints): string {
|
|
349
|
+
return path.join(featureStateDir(directory, featureSlug, hints), "tasks", "task-" + taskID)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export function featureStateSessionsDir(directory: string, featureSlug: string, hints?: FeaturePathHints): string {
|
|
353
|
+
return path.join(featureStateDir(directory, featureSlug, hints), "sessions")
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export function ensureFeatureStateStructure(directory: string, featureSlug: string, hints?: FeaturePathHints): void {
|
|
357
|
+
mkdirSync(featureStateDir(directory, featureSlug, hints), { recursive: true })
|
|
358
|
+
mkdirSync(path.join(featureStateDir(directory, featureSlug, hints), "tasks"), { recursive: true })
|
|
359
|
+
mkdirSync(featureStateSessionsDir(directory, featureSlug, hints), { recursive: true })
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export function featureStateTaskPaths(directory: string, featureSlug: string, taskID: string, hints?: FeaturePathHints) {
|
|
363
|
+
const taskDir = featureStateTaskDir(directory, featureSlug, taskID, hints)
|
|
364
|
+
return {
|
|
365
|
+
taskDir,
|
|
366
|
+
statePath: path.join(taskDir, "execution-state.md"),
|
|
367
|
+
retryStatePath: path.join(taskDir, "retry-state.json"),
|
|
368
|
+
runtimePath: path.join(taskDir, "runtime.json"),
|
|
369
|
+
validatorPath: path.join(taskDir, "validator-work.md"),
|
|
370
|
+
contractPath: path.join(taskDir, "task-contract.json"),
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export function featureStateSessionRuntimePath(directory: string, featureSlug: string, sessionID: string, hints?: FeaturePathHints): string {
|
|
375
|
+
return path.join(featureStateSessionsDir(directory, featureSlug, hints), sessionID + "-runtime.json")
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export function featureStateImplementerLogPath(directory: string, featureSlug: string, hints?: FeaturePathHints): string {
|
|
379
|
+
return path.join(featureStateDir(directory, featureSlug, hints), "implementer-work.md")
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export function featureStateManifestPath(directory: string, featureSlug: string, hints?: FeaturePathHints): string {
|
|
383
|
+
return path.join(featureStateDir(directory, featureSlug, hints), "integration-state.json")
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export function featureStateReadmePath(directory: string, featureSlug: string, hints?: FeaturePathHints): string {
|
|
387
|
+
return path.join(featureStateDir(directory, featureSlug, hints), "README.md")
|
|
388
|
+
}
|
|
389
|
+
`;
|
|
390
|
+
const JUNINHO_CONFIG = `import { existsSync, readFileSync } from "fs"
|
|
391
|
+
import path from "path"
|
|
392
|
+
import { resolveProjectPaths } from "./j.workspace-paths"
|
|
393
|
+
|
|
394
|
+
export type JuninhoConfig = {
|
|
395
|
+
strong?: string
|
|
396
|
+
medium?: string
|
|
397
|
+
weak?: string
|
|
398
|
+
projectType?: string
|
|
399
|
+
isKotlin?: boolean
|
|
400
|
+
buildTool?: string
|
|
401
|
+
workflow?: {
|
|
402
|
+
automation?: {
|
|
403
|
+
nonInteractive?: boolean
|
|
404
|
+
autoApproveArtifacts?: boolean
|
|
405
|
+
}
|
|
406
|
+
implement?: {
|
|
407
|
+
preCommitScope?: string
|
|
408
|
+
postImplementFullCheck?: boolean
|
|
409
|
+
reenterImplementOnFullCheckFailure?: boolean
|
|
410
|
+
watchdogSessionStale?: boolean
|
|
411
|
+
}
|
|
412
|
+
unify?: {
|
|
413
|
+
enabled?: boolean
|
|
414
|
+
updatePersistentContext?: boolean
|
|
415
|
+
updateDomainDocs?: boolean
|
|
416
|
+
updateDomainIndex?: boolean
|
|
417
|
+
cleanupIntegratedTaskBranches?: boolean
|
|
418
|
+
createPullRequest?: boolean
|
|
419
|
+
createDeliveryPrBody?: boolean
|
|
420
|
+
}
|
|
421
|
+
documentation?: {
|
|
422
|
+
preferAgentsMdForLocalRules?: boolean
|
|
423
|
+
preferDomainDocsForBusinessBehavior?: boolean
|
|
424
|
+
preferPrincipleDocsForCrossCuttingTech?: boolean
|
|
425
|
+
syncMarkers?: boolean
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
const DEFAULT_CONFIG: JuninhoConfig = {
|
|
431
|
+
workflow: {
|
|
432
|
+
automation: {
|
|
433
|
+
nonInteractive: false,
|
|
434
|
+
autoApproveArtifacts: false,
|
|
435
|
+
},
|
|
436
|
+
implement: {
|
|
437
|
+
preCommitScope: "related",
|
|
438
|
+
postImplementFullCheck: true,
|
|
439
|
+
reenterImplementOnFullCheckFailure: true,
|
|
440
|
+
watchdogSessionStale: true,
|
|
441
|
+
},
|
|
442
|
+
unify: {
|
|
443
|
+
enabled: true,
|
|
444
|
+
updatePersistentContext: true,
|
|
445
|
+
updateDomainDocs: true,
|
|
446
|
+
updateDomainIndex: true,
|
|
447
|
+
cleanupIntegratedTaskBranches: true,
|
|
448
|
+
createPullRequest: true,
|
|
449
|
+
createDeliveryPrBody: true,
|
|
450
|
+
},
|
|
451
|
+
documentation: {
|
|
452
|
+
preferAgentsMdForLocalRules: true,
|
|
453
|
+
preferDomainDocsForBusinessBehavior: true,
|
|
454
|
+
preferPrincipleDocsForCrossCuttingTech: true,
|
|
455
|
+
syncMarkers: true,
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export function loadJuninhoConfig(directory: string): JuninhoConfig {
|
|
461
|
+
const configCandidates = [
|
|
462
|
+
path.join(directory, ".opencode", "juninho-config.json"),
|
|
463
|
+
path.join(directory, "juninho-config.json"),
|
|
464
|
+
]
|
|
465
|
+
const projectPaths = resolveProjectPaths(directory)
|
|
466
|
+
if (projectPaths) {
|
|
467
|
+
configCandidates.push(path.join(projectPaths.projectRoot, ".opencode", "juninho-config.json"))
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
for (const configPath of configCandidates) {
|
|
471
|
+
if (!existsSync(configPath)) continue
|
|
472
|
+
try {
|
|
473
|
+
const parsed = JSON.parse(readFileSync(configPath, "utf-8")) as JuninhoConfig
|
|
474
|
+
return {
|
|
475
|
+
...DEFAULT_CONFIG,
|
|
476
|
+
...parsed,
|
|
477
|
+
workflow: {
|
|
478
|
+
...DEFAULT_CONFIG.workflow,
|
|
479
|
+
...parsed.workflow,
|
|
480
|
+
automation: {
|
|
481
|
+
...DEFAULT_CONFIG.workflow?.automation,
|
|
482
|
+
...parsed.workflow?.automation,
|
|
483
|
+
},
|
|
484
|
+
implement: {
|
|
485
|
+
...DEFAULT_CONFIG.workflow?.implement,
|
|
486
|
+
...parsed.workflow?.implement,
|
|
487
|
+
},
|
|
488
|
+
unify: {
|
|
489
|
+
...DEFAULT_CONFIG.workflow?.unify,
|
|
490
|
+
...parsed.workflow?.unify,
|
|
491
|
+
},
|
|
492
|
+
documentation: {
|
|
493
|
+
...DEFAULT_CONFIG.workflow?.documentation,
|
|
494
|
+
...parsed.workflow?.documentation,
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
}
|
|
498
|
+
} catch {
|
|
499
|
+
// Try next config candidate.
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
return DEFAULT_CONFIG
|
|
504
|
+
}
|
|
505
|
+
`;
|
|
506
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/templates/lib.ts"],"names":[],"mappings":";;;;;AAGA,4BAOC;AAVD,2BAAkC;AAClC,gDAAuB;AAEvB,SAAgB,QAAQ,CAAC,UAAkB;IACzC,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,CAAA;IAExD,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAAE,eAAe,CAAC,CAAA;IACzE,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,0BAA0B,CAAC,EAAE,mBAAmB,CAAC,CAAA;IACjF,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,WAAW,CAAC,CAAA;IACjE,IAAA,kBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,cAAc,CAAC,CAAA;AACzE,CAAC;AAED,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAySvB,CAAA;AAED,MAAM,WAAW,GAAG;;;;;;;;;;;;CAYnB,CAAA;AAED,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8D3B,CAAA;AAED,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHtB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/templates/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,WAA2B,EACxC,QAAQ,GAAE,OAAe,GACxB,IAAI,
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/templates/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,WAA2B,EACxC,QAAQ,GAAE,OAAe,GACxB,IAAI,CAwBN"}
|