opencode-dev-framework 0.1.13 → 0.1.14
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 +15 -9
- package/dist/tools.js +117 -0
- package/package.json +1 -1
- package/templates/.opencode/commands/df-status.md +8 -0
package/README.md
CHANGED
|
@@ -25,13 +25,15 @@ reimplemented as an OpenCode-native plugin.
|
|
|
25
25
|
versions the gate reports loudly via `session.idle`.
|
|
26
26
|
- **Custom tools.** `dev_framework_init` scaffolds project-level agents,
|
|
27
27
|
skills, commands, and config; `dev_framework_set_profile` changes the profile
|
|
28
|
-
in-session without restarting
|
|
28
|
+
in-session without restarting; `dev_framework_status` reports the current
|
|
29
|
+
profile, guardrails, gate, and tracked changed files.
|
|
29
30
|
- **CLI installer.** `df init` auto-detects your language and writes a config
|
|
30
31
|
with sensible commands; `df profile <name>` changes the profile from the
|
|
31
32
|
shell; `df status` / `df version` report template state and the version.
|
|
32
|
-
- **Slash-command templates.** `/df-verify
|
|
33
|
-
into `.opencode/commands/` by `df init` or the `dev_framework_init`
|
|
34
|
-
(OpenCode does not load slash commands from plugin packages
|
|
33
|
+
- **Slash-command templates.** `/df-verify`, `/df-profile`, and `/df-status` are
|
|
34
|
+
installed into `.opencode/commands/` by `df init` or the `dev_framework_init`
|
|
35
|
+
tool. (OpenCode does not load slash commands from plugin packages
|
|
36
|
+
automatically.)
|
|
35
37
|
|
|
36
38
|
## Profiles
|
|
37
39
|
|
|
@@ -150,12 +152,16 @@ compatibility, but the native format above is preferred. See
|
|
|
150
152
|
config reference and [`examples/go-service/`](examples/go-service/) for a
|
|
151
153
|
complete example.
|
|
152
154
|
|
|
153
|
-
## Slash
|
|
155
|
+
## Slash commands
|
|
154
156
|
|
|
155
|
-
The `/df-verify
|
|
156
|
-
`dev_framework_init` tool) into `.opencode/commands/`. Inside
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
The `/df-verify`, `/df-profile`, and `/df-status` commands are installed by
|
|
158
|
+
`df init` (or the `dev_framework_init` tool) into `.opencode/commands/`. Inside
|
|
159
|
+
an OpenCode session:
|
|
160
|
+
|
|
161
|
+
- `/df-verify` asks the agent to run the configured verification suite manually.
|
|
162
|
+
- `/df-profile strict` changes the active profile.
|
|
163
|
+
- `/df-status` shows the current profile, guardrails, completion gate, and
|
|
164
|
+
tracked changed files.
|
|
159
165
|
|
|
160
166
|
## Limitations
|
|
161
167
|
|
package/dist/tools.js
CHANGED
|
@@ -8,6 +8,35 @@ const PROFILES = ["off", "advisory", "standard", "strict"];
|
|
|
8
8
|
function isProfile(value) {
|
|
9
9
|
return PROFILES.includes(value);
|
|
10
10
|
}
|
|
11
|
+
function formatCommandMap(map, indent) {
|
|
12
|
+
if (map === undefined) {
|
|
13
|
+
return `${indent}(not configured)`;
|
|
14
|
+
}
|
|
15
|
+
if (typeof map === "string") {
|
|
16
|
+
return `${indent}${map}`;
|
|
17
|
+
}
|
|
18
|
+
const entries = Object.entries(map);
|
|
19
|
+
if (entries.length === 0) {
|
|
20
|
+
return `${indent}(not configured)`;
|
|
21
|
+
}
|
|
22
|
+
return entries.map(([ext, cmd]) => `${indent}${ext}: ${cmd}`).join("\n");
|
|
23
|
+
}
|
|
24
|
+
function formatRules(rules) {
|
|
25
|
+
if (rules === undefined) {
|
|
26
|
+
return " (bundled rules)";
|
|
27
|
+
}
|
|
28
|
+
const lines = [` mode: ${rules.mode}`];
|
|
29
|
+
if (rules.files.length === 0) {
|
|
30
|
+
lines.push(" files: (none)");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
lines.push(" files:");
|
|
34
|
+
for (const file of rules.files) {
|
|
35
|
+
lines.push(` - ${file}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return lines.join("\n");
|
|
39
|
+
}
|
|
11
40
|
export function buildTools(_ctx) {
|
|
12
41
|
return {
|
|
13
42
|
dev_framework_init: tool({
|
|
@@ -76,5 +105,93 @@ export function buildTools(_ctx) {
|
|
|
76
105
|
return `opencode-dev-framework profile set to "${profile}" in ${configPath}. Change applied immediately.`;
|
|
77
106
|
},
|
|
78
107
|
}),
|
|
108
|
+
dev_framework_status: tool({
|
|
109
|
+
description: "Show the current opencode-dev-framework state for the project: active profile, guardrails, completion gate, on-edit behavior, tracked changed files, and block counts.",
|
|
110
|
+
args: {
|
|
111
|
+
directory: tool.schema
|
|
112
|
+
.string()
|
|
113
|
+
.optional()
|
|
114
|
+
.describe("Project directory (defaults to current project)"),
|
|
115
|
+
},
|
|
116
|
+
async execute(args, context) {
|
|
117
|
+
const targetDir = args.directory ?? context.directory;
|
|
118
|
+
const state = getHookState(targetDir);
|
|
119
|
+
const config = state?.config ?? loadConfig(targetDir);
|
|
120
|
+
const lines = [];
|
|
121
|
+
lines.push(`opencode-dev-framework status for ${targetDir}`);
|
|
122
|
+
lines.push("");
|
|
123
|
+
lines.push(`Profile: ${config.profile}`);
|
|
124
|
+
lines.push(`Config: ${config.configPath ?? "(none — defaults to off)"}`);
|
|
125
|
+
lines.push("");
|
|
126
|
+
lines.push("Guardrails:");
|
|
127
|
+
lines.push(` protect_mode: ${config.protect_mode}`);
|
|
128
|
+
lines.push(` protect_off: ${config.protect_off}`);
|
|
129
|
+
if (config.protect.length === 0) {
|
|
130
|
+
lines.push(" protected paths: (none)");
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
lines.push(" protected paths:");
|
|
134
|
+
for (const pattern of config.protect) {
|
|
135
|
+
lines.push(` - ${pattern}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
lines.push("");
|
|
139
|
+
lines.push("On edit:");
|
|
140
|
+
lines.push(` format: ${config.on_edit.format}`);
|
|
141
|
+
lines.push(` lint: ${config.on_edit.lint}`);
|
|
142
|
+
lines.push(` precommit: ${config.precommit}`);
|
|
143
|
+
if (state && config.precommit === "auto") {
|
|
144
|
+
lines.push(` pre-commit binary available: ${state.precommitAvailable === true ? "yes" : state.precommitAvailable === false ? "no" : "not checked yet"}`);
|
|
145
|
+
}
|
|
146
|
+
lines.push("");
|
|
147
|
+
lines.push("Completion gate:");
|
|
148
|
+
lines.push(` run_typecheck: ${config.gate.run_typecheck}`);
|
|
149
|
+
lines.push(` run_tests: ${config.gate.run_tests}`);
|
|
150
|
+
lines.push(` lint_changed: ${config.gate.lint_changed}`);
|
|
151
|
+
lines.push(` block_on_failure: ${config.gate.block_on_failure}`);
|
|
152
|
+
lines.push(` skip_unchanged: ${config.gate.skip_unchanged}`);
|
|
153
|
+
lines.push(` scope: ${config.gate.scope}`);
|
|
154
|
+
lines.push(` timeout: ${config.gate.timeout ?? "(default)"}`);
|
|
155
|
+
lines.push(` max_blocks: ${config.gate.max_blocks}`);
|
|
156
|
+
lines.push("");
|
|
157
|
+
lines.push("Commands:");
|
|
158
|
+
lines.push(` typecheck:`);
|
|
159
|
+
lines.push(formatCommandMap(config.commands.typecheck, " "));
|
|
160
|
+
lines.push(` test:`);
|
|
161
|
+
lines.push(formatCommandMap(config.commands.test, " "));
|
|
162
|
+
lines.push(` test_changed:`);
|
|
163
|
+
lines.push(config.commands.test_changed
|
|
164
|
+
? ` ${config.commands.test_changed}`
|
|
165
|
+
: " (not configured)");
|
|
166
|
+
lines.push(` lint:`);
|
|
167
|
+
lines.push(formatCommandMap(config.commands.lint, " "));
|
|
168
|
+
lines.push(` format:`);
|
|
169
|
+
lines.push(formatCommandMap(config.commands.format, " "));
|
|
170
|
+
lines.push("");
|
|
171
|
+
lines.push("Constitution rules:");
|
|
172
|
+
lines.push(formatRules(config.rules));
|
|
173
|
+
if (config.style_guide) {
|
|
174
|
+
lines.push(` style_guide: ${config.style_guide}`);
|
|
175
|
+
}
|
|
176
|
+
if (state) {
|
|
177
|
+
const changedFiles = state.tracker.getChangedFiles();
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push(`Changed files tracked: ${changedFiles.length}`);
|
|
180
|
+
if (changedFiles.length > 0) {
|
|
181
|
+
for (const file of changedFiles) {
|
|
182
|
+
lines.push(` - ${file}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (state.blockCounts.size > 0) {
|
|
186
|
+
lines.push("");
|
|
187
|
+
lines.push("Completion gate blocks this session:");
|
|
188
|
+
for (const [sessionID, count] of state.blockCounts) {
|
|
189
|
+
lines.push(` ${sessionID}: ${count}/${config.gate.max_blocks}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return lines.join("\n");
|
|
194
|
+
},
|
|
195
|
+
}),
|
|
79
196
|
};
|
|
80
197
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show the current dev-framework state for this project
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Show the current opencode-dev-framework state for this project. Call the
|
|
6
|
+
`dev_framework_status` tool and present the result in a compact, readable form.
|
|
7
|
+
Include the active profile, guardrail mode, completion gate settings, configured
|
|
8
|
+
commands, pre-commit status, and any changed files currently tracked.
|