abelworkflow 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.
Files changed (51) hide show
  1. package/.gitignore +13 -0
  2. package/.skill-lock.json +29 -0
  3. package/AGENTS.md +45 -0
  4. package/README.md +147 -0
  5. package/bin/abelworkflow.mjs +2 -0
  6. package/commands/oc/diagnose.md +63 -0
  7. package/commands/oc/implementation.md +157 -0
  8. package/commands/oc/init.md +27 -0
  9. package/commands/oc/plan.md +88 -0
  10. package/commands/oc/research.md +126 -0
  11. package/lib/cli.mjs +222 -0
  12. package/package.json +23 -0
  13. package/skills/confidence-check/SKILL.md +124 -0
  14. package/skills/confidence-check/confidence.ts +335 -0
  15. package/skills/context7-auto-research/.env +4 -0
  16. package/skills/context7-auto-research/.env.example +4 -0
  17. package/skills/context7-auto-research/SKILL.md +83 -0
  18. package/skills/context7-auto-research/context7-api.js +283 -0
  19. package/skills/dev-browser/SKILL.md +225 -0
  20. package/skills/dev-browser/bun.lock +443 -0
  21. package/skills/dev-browser/package-lock.json +2988 -0
  22. package/skills/dev-browser/package.json +31 -0
  23. package/skills/dev-browser/references/scraping.md +155 -0
  24. package/skills/dev-browser/resolve-skill-dir.sh +35 -0
  25. package/skills/dev-browser/scripts/start-relay.ts +32 -0
  26. package/skills/dev-browser/scripts/start-server.ts +117 -0
  27. package/skills/dev-browser/server.sh +24 -0
  28. package/skills/dev-browser/src/client.ts +474 -0
  29. package/skills/dev-browser/src/index.ts +287 -0
  30. package/skills/dev-browser/src/relay.ts +731 -0
  31. package/skills/dev-browser/src/snapshot/browser-script.ts +877 -0
  32. package/skills/dev-browser/src/snapshot/index.ts +14 -0
  33. package/skills/dev-browser/src/snapshot/inject.ts +13 -0
  34. package/skills/dev-browser/src/types.ts +34 -0
  35. package/skills/dev-browser/tsconfig.json +36 -0
  36. package/skills/dev-browser/vitest.config.ts +12 -0
  37. package/skills/git-commit/SKILL.md +124 -0
  38. package/skills/grok-search/.env.example +24 -0
  39. package/skills/grok-search/SKILL.md +114 -0
  40. package/skills/grok-search/requirements.txt +2 -0
  41. package/skills/grok-search/scripts/groksearch_cli.py +1214 -0
  42. package/skills/grok-search/scripts/groksearch_entry.py +116 -0
  43. package/skills/prompt-enhancer/ADVANCED.md +74 -0
  44. package/skills/prompt-enhancer/SKILL.md +71 -0
  45. package/skills/prompt-enhancer/TEMPLATE.md +91 -0
  46. package/skills/prompt-enhancer/scripts/enhance.py +142 -0
  47. package/skills/sequential-think/SKILL.md +198 -0
  48. package/skills/sequential-think/scripts/.env.example +5 -0
  49. package/skills/sequential-think/scripts/sequential_think_cli.py +253 -0
  50. package/skills/time/SKILL.md +116 -0
  51. package/skills/time/scripts/time_cli.py +104 -0
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: OC:Research
3
+ description: Transform user requirements into constraint sets via structured exploration (NO implementation)
4
+ category: OC
5
+ tags: [OC, research, constraints, exploration, subagents]
6
+ ---
7
+
8
+ <!-- OC:RESEARCH:START -->
9
+
10
+ # OC:Research — Operating Mode (Constraints & Specs Only)
11
+
12
+ ## Non‑Negotiable Rules (Highest Priority)
13
+ 1. RESEARCH MODE ONLY.
14
+ - You MUST NOT generate code.
15
+ 2. WRITE SCOPE IS RESTRICTED.
16
+ - You MAY create/edit files ONLY under: openspec/changes/<change-name>/** (and only after passing the confirmation gates).
17
+ - You MUST NOT write anywhere else.
18
+ 3. Output must be constraint sets + verifiable success criteria, not an information dump.
19
+
20
+ ## Goal
21
+ Produce constraint sets that narrow the solution space, plus measurable success criteria.
22
+
23
+ ---
24
+
25
+
26
+
27
+ ## Phase 0 — Requirement Intake Gate (MANDATORY)
28
+ - **MUST** confirm the user’s requirement exists and is clear **before** any research/action.
29
+ - If missing/unclear, **MUST** use `AskUserQuestions` to collect: goal, in-scope area, top scenarios, non-goals, known constraints, success signals.
30
+ - **MUST NOT** run `/opsx:new`, any codebase retrieval, spawn subagents, or generate artifacts until the user confirms a brief requirement summary.
31
+
32
+ ---
33
+
34
+ ## Phase 1 — Initialize OpenSpec Change Folder
35
+ 1) Run: /opsx:new <change-name>
36
+ 2) From now on, you may write ONLY under openspec/changes/<change-name>/**.
37
+
38
+ ---
39
+
40
+ ## Phase 2 — Initial Codebase Assessment (Read‑Only)
41
+ - Use `mcp__augment-context-engine__codebase-retrieval` as the primary way to locate relevant code; avoid grep/find unless unavoidable.
42
+ - If technical research needed (architectural patterns, best practices), invoke `/grok-search` skill
43
+ - If the codebase spans multiple modules/directories, dispatch parallel explore subagents by context boundary.
44
+
45
+ ---
46
+
47
+ ## Phase 3 — Define Exploration Boundaries (Context-Based Division Only)
48
+ - Identify natural context boundaries in the codebase (NOT functional roles).
49
+ - Example divisions:
50
+ * Subagent 1: User domain code (user models, user services, user UI)
51
+ * Subagent 2: Authentication & authorization code (auth middleware, session, tokens)
52
+ * Subagent 3: Configuration & infrastructure (configs, deployments, build scripts)
53
+ - Each boundary should be self-contained: no cross-communication needed between subagents.
54
+ - Define exploration scope and expected output for each subagent.
55
+
56
+ ---
57
+
58
+ ## Phase 4 — Subagent Output Template (MANDATORY JSON)
59
+ All explore subagents MUST return valid JSON using this schema:
60
+ {
61
+ "module_name": "字符串 - 所探索的上下文边界",
62
+ "existing_structures": ["发现的关键结构/模式列表"],
63
+ "existing_conventions": ["当前使用的约定/标准列表"],
64
+ "constraints_discovered": ["限制解决方案空间的硬约束列表"],
65
+ "open_questions": ["需要用户输入的歧义问题列表"],
66
+ "dependencies": ["对其他模块/系统的依赖列表"],
67
+ "risks": ["潜在风险或阻碍列表"],
68
+ "success_criteria_hints": ["指示成功的可观察行为列表"]
69
+ }
70
+
71
+ ---
72
+
73
+ ## Phase 5 — Parallel Subagent Dispatch
74
+ - Monitor subagent execution and collect structured reports.
75
+ - For each boundary, spawn an Explore subagent with:
76
+ - Mandatory use of `mcp__augment-context-engine__codebase-retrieval`
77
+ - Clear scope
78
+ - self-contained with independent output
79
+ - Required output template (from Phase 4)
80
+ - If boundary involves 3+ interconnected components, invoke `/sequential-think` skill
81
+ - Clear success criteria: complete analysis of assigned boundary
82
+
83
+
84
+ ---
85
+
86
+ ## Phase 6 — Aggregate & Synthesize
87
+ - Collect all subagent JSON outputs.
88
+ - Merge findings into unified constraint sets:
89
+ * **Hard constraints**: Technical limitations, existing patterns that cannot be violated.
90
+ * **Soft constraints**: Conventions, preferences, style guides.
91
+ * **Dependencies**: Cross-module relationships that affect implementation order.
92
+ * **Risks**: Potential blockers that need mitigation.
93
+ - Identify **open questions** from all reports that require user clarification.
94
+ - Synthesize **success criteria** from scenario hints across all contexts.
95
+
96
+ ---
97
+
98
+ ## Phase 7 — User Interaction for Ambiguity Resolution
99
+ - Compile prioritized list of open questions from aggregated reports.
100
+ - Use `AskUserQuestions` tool to present questions systematically:
101
+ * Group related questions together.
102
+ * Provide context for each question.
103
+ * Suggest default answers when applicable.
104
+ - Capture user responses as additional constraints.
105
+ - Update constraint sets with confirmed decisions.
106
+
107
+ ---
108
+
109
+ ## Phase 8 — Generate OpenSpec Artifacts
110
+ - Transform finalized constraint sets into OpenSpec proposal/specs/design/tasks.
111
+ - Every requirement MUST have a verifiable scenario and success criteria.
112
+ - Keep all writes inside openspec/changes/<change-name>/**.
113
+
114
+ ## Reference
115
+ - Review existing constraints: `rg -n "Constraint:|MUST|MUST NOT" openspec/specs`
116
+ - Inspect codebase structure: `ls -R` or `mcp__augment-context-engine__codebase-retrieval` with `file list --recursive`
117
+
118
+ - Check prior research outputs: `ls openspec/changes/*/`
119
+ - OpenSpec CLI commands:
120
+ - `openspec view` - Interactive dashboard to browse changes
121
+ - `openspec list --changes` - List all active changes
122
+ - `openspec status --change <name>` - Check artifact completion status
123
+ - `openspec instructions proposal --change <name>` - Get proposal instructions
124
+ - Validate subagent outputs conform to template before aggregation.
125
+ - Use `AskUserQuestions` for ANY ambiguity—do not assume or guess.
126
+ <!-- OC:RESEARCH:END -->
package/lib/cli.mjs ADDED
@@ -0,0 +1,222 @@
1
+ import { cp, lstat, mkdir, readdir, readlink, rename, rm, symlink, writeFile } from "node:fs/promises";
2
+ import { homedir } from "node:os";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const packageRoot = dirname(dirname(__filename));
8
+ const home = homedir();
9
+ const defaultAgentsDir = join(home, ".agents");
10
+ const managedEntries = [
11
+ "AGENTS.md",
12
+ "README.md",
13
+ "commands",
14
+ "skills",
15
+ ".skill-lock.json",
16
+ ".gitignore"
17
+ ];
18
+
19
+ function parseArgs(argv) {
20
+ const options = {
21
+ agentsDir: defaultAgentsDir,
22
+ force: false,
23
+ relinkOnly: false
24
+ };
25
+
26
+ for (let i = 0; i < argv.length; i += 1) {
27
+ const arg = argv[i];
28
+ if (arg === "--force" || arg === "-f") {
29
+ options.force = true;
30
+ continue;
31
+ }
32
+ if (arg === "--link-only") {
33
+ options.relinkOnly = true;
34
+ continue;
35
+ }
36
+ if (arg === "--agents-dir") {
37
+ const value = argv[i + 1];
38
+ if (!value) {
39
+ throw new Error("--agents-dir requires a path");
40
+ }
41
+ options.agentsDir = resolve(value);
42
+ i += 1;
43
+ continue;
44
+ }
45
+ if (arg === "--help" || arg === "-h") {
46
+ printHelp();
47
+ process.exit(0);
48
+ }
49
+ throw new Error(`Unknown argument: ${arg}`);
50
+ }
51
+
52
+ return options;
53
+ }
54
+
55
+ function printHelp() {
56
+ console.log(`AbelWorkflow installer
57
+
58
+ Usage:
59
+ npx abelworkflow
60
+ npx abelworkflow --force
61
+ npx abelworkflow --link-only
62
+ npx abelworkflow --agents-dir /custom/path
63
+ `);
64
+ }
65
+
66
+ async function pathExists(path) {
67
+ try {
68
+ await lstat(path);
69
+ return true;
70
+ } catch {
71
+ return false;
72
+ }
73
+ }
74
+
75
+ async function backupIfNeeded(targetPath, force) {
76
+ if (!(await pathExists(targetPath))) {
77
+ return null;
78
+ }
79
+ if (!force) {
80
+ const backupPath = `${targetPath}.bak.${Date.now()}`;
81
+ await rename(targetPath, backupPath);
82
+ return backupPath;
83
+ }
84
+ await rm(targetPath, { recursive: true, force: true });
85
+ return null;
86
+ }
87
+
88
+ async function syncManagedFiles(agentsDir) {
89
+ await mkdir(agentsDir, { recursive: true });
90
+
91
+ for (const entry of managedEntries) {
92
+ const source = join(packageRoot, entry);
93
+ const target = join(agentsDir, entry);
94
+ await rm(target, { recursive: true, force: true });
95
+ await cp(source, target, { recursive: true });
96
+ }
97
+
98
+ await writeFile(
99
+ join(agentsDir, ".abelworkflow-install.json"),
100
+ JSON.stringify(
101
+ {
102
+ package: "abelworkflow",
103
+ installedAt: new Date().toISOString()
104
+ },
105
+ null,
106
+ 2
107
+ ) + "\n",
108
+ "utf8"
109
+ );
110
+ }
111
+
112
+ async function ensureSymlink(targetPath, sourcePath, kind, force) {
113
+ await mkdir(dirname(targetPath), { recursive: true });
114
+
115
+ if (await pathExists(targetPath)) {
116
+ const stat = await lstat(targetPath);
117
+ if (stat.isSymbolicLink()) {
118
+ const existing = await readlink(targetPath);
119
+ const existingResolved = resolve(dirname(targetPath), existing);
120
+ if (existingResolved === resolve(sourcePath)) {
121
+ return { targetPath, status: "unchanged" };
122
+ }
123
+ }
124
+ await backupIfNeeded(targetPath, force);
125
+ }
126
+
127
+ const linkType = process.platform === "win32" ? (kind === "dir" ? "junction" : "file") : kind;
128
+ await symlink(sourcePath, targetPath, linkType);
129
+ return { targetPath, status: "linked" };
130
+ }
131
+
132
+ async function linkSkillDirectories(baseDir, agentsDir, force) {
133
+ const results = [];
134
+ const skillsRoot = join(agentsDir, "skills");
135
+ const skillNames = await getDirectoryNames(skillsRoot);
136
+ for (const skillName of skillNames) {
137
+ results.push(
138
+ await ensureSymlink(
139
+ join(baseDir, "skills", skillName),
140
+ join(skillsRoot, skillName),
141
+ "dir",
142
+ force
143
+ )
144
+ );
145
+ }
146
+ return results;
147
+ }
148
+
149
+ async function getDirectoryNames(root) {
150
+ const entries = await readdir(root, { withFileTypes: true });
151
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
152
+ }
153
+
154
+ async function getCommandNames(commandsDir) {
155
+ const entries = await readdir(commandsDir, { withFileTypes: true });
156
+ return entries
157
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
158
+ .map((entry) => entry.name);
159
+ }
160
+
161
+ async function linkClaude(agentsDir, force) {
162
+ const claudeDir = join(home, ".claude");
163
+ await mkdir(join(claudeDir, "commands"), { recursive: true });
164
+ await mkdir(join(claudeDir, "skills"), { recursive: true });
165
+
166
+ return [
167
+ await ensureSymlink(join(claudeDir, "CLAUDE.md"), join(agentsDir, "AGENTS.md"), "file", force),
168
+ await ensureSymlink(join(claudeDir, "commands", "oc"), join(agentsDir, "commands", "oc"), "dir", force),
169
+ ...(await linkSkillDirectories(claudeDir, agentsDir, force))
170
+ ];
171
+ }
172
+
173
+ async function linkCodex(agentsDir, force) {
174
+ const results = [];
175
+ const codexDir = join(home, ".codex");
176
+ await mkdir(join(codexDir, "skills"), { recursive: true });
177
+ await mkdir(join(codexDir, "prompts"), { recursive: true });
178
+
179
+ results.push(await ensureSymlink(join(codexDir, "AGENTS.md"), join(agentsDir, "AGENTS.md"), "file", force));
180
+ results.push(...(await linkSkillDirectories(codexDir, agentsDir, force)));
181
+
182
+ const commandFiles = await getCommandNames(join(agentsDir, "commands", "oc"));
183
+ for (const fileName of commandFiles) {
184
+ results.push(
185
+ await ensureSymlink(
186
+ join(codexDir, "prompts", fileName),
187
+ join(agentsDir, "commands", "oc", fileName),
188
+ "file",
189
+ force
190
+ )
191
+ );
192
+ }
193
+
194
+ return results;
195
+ }
196
+
197
+ async function install() {
198
+ const options = parseArgs(process.argv.slice(2));
199
+
200
+ if (!options.relinkOnly) {
201
+ await syncManagedFiles(options.agentsDir);
202
+ } else if (!(await pathExists(options.agentsDir))) {
203
+ throw new Error(`${options.agentsDir} does not exist; remove --link-only or install first`);
204
+ }
205
+
206
+ const claudeResults = await linkClaude(options.agentsDir, options.force);
207
+ const codexResults = await linkCodex(options.agentsDir, options.force);
208
+
209
+ console.log(`Installed AbelWorkflow into ${options.agentsDir}`);
210
+ console.log("");
211
+ console.log("Linked targets:");
212
+ for (const result of [...claudeResults, ...codexResults]) {
213
+ console.log(`- ${result.status === "unchanged" ? "=" : "+"} ${result.targetPath}`);
214
+ }
215
+ console.log("");
216
+ console.log("Done. Re-run `npx abelworkflow@latest` to update the managed files.");
217
+ }
218
+
219
+ install().catch((error) => {
220
+ console.error(error instanceof Error ? error.message : String(error));
221
+ process.exit(1);
222
+ });
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "abelworkflow",
3
+ "version": "0.1.0",
4
+ "description": "Install AbelWorkflow into ~/.agents and create Claude/Codex symlinks.",
5
+ "type": "module",
6
+ "bin": {
7
+ "abelworkflow": "./bin/abelworkflow.mjs"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "lib",
12
+ "AGENTS.md",
13
+ "README.md",
14
+ "commands",
15
+ "skills",
16
+ ".skill-lock.json",
17
+ ".gitignore"
18
+ ],
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "license": "MIT"
23
+ }
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: Confidence Check
3
+ description: Pre-implementation confidence assessment (≥90% required). Use before starting any implementation to verify readiness with duplicate check, architecture compliance, official docs verification, OSS references, and root cause identification.
4
+ ---
5
+
6
+ # Confidence Check Skill
7
+
8
+ ## Purpose
9
+
10
+ Prevents wrong-direction execution by assessing confidence **BEFORE** starting implementation.
11
+
12
+ **Requirement**: ≥90% confidence to proceed with implementation.
13
+
14
+ **Test Results** (2025-10-21):
15
+ - Precision: 1.000 (no false positives)
16
+ - Recall: 1.000 (no false negatives)
17
+ - 8/8 test cases passed
18
+
19
+ ## When to Use
20
+
21
+ Use this skill BEFORE implementing any task to ensure:
22
+ - No duplicate implementations exist
23
+ - Architecture compliance verified
24
+ - Official documentation reviewed
25
+ - Working OSS implementations found
26
+ - Root cause properly identified
27
+
28
+ ## Confidence Assessment Criteria
29
+
30
+ Calculate confidence score (0.0 - 1.0) based on 5 checks:
31
+
32
+ ### 1. No Duplicate Implementations? (25%)
33
+
34
+ **Check**: Search codebase for existing functionality
35
+
36
+ ```bash
37
+ # Use Grep to search for similar functions
38
+ # Use Glob to find related modules
39
+ ```
40
+
41
+ ✅ Pass if no duplicates found
42
+ ❌ Fail if similar implementation exists
43
+
44
+ ### 2. Architecture Compliance? (25%)
45
+
46
+ **Check**: Verify tech stack alignment
47
+
48
+ - Read `CLAUDE.md`, `AGENTS.md`, `PLANNING.md`
49
+ - Confirm existing patterns used
50
+ - Avoid reinventing existing solutions
51
+
52
+ ✅ Pass if uses existing tech stack (e.g., Supabase, UV, pytest)
53
+ ❌ Fail if introduces new dependencies unnecessarily
54
+
55
+ ### 3. Official Documentation Verified? (20%)
56
+
57
+ **Check**: Review official docs before implementation
58
+
59
+ - Use Context7 MCP for official docs
60
+ - Use WebFetch for documentation URLs
61
+ - Verify API compatibility
62
+
63
+ ✅ Pass if official docs reviewed
64
+ ❌ Fail if relying on assumptions
65
+
66
+ ### 4. Working OSS Implementations Referenced? (15%)
67
+
68
+ **Check**: Find proven implementations
69
+
70
+ - Use Tavily MCP or WebSearch
71
+ - Search GitHub for examples
72
+ - Verify working code samples
73
+
74
+ ✅ Pass if OSS reference found
75
+ ❌ Fail if no working examples
76
+
77
+ ### 5. Root Cause Identified? (15%)
78
+
79
+ **Check**: Understand the actual problem
80
+
81
+ - Analyze error messages
82
+ - Check logs and stack traces
83
+ - Identify underlying issue
84
+
85
+ ✅ Pass if root cause clear
86
+ ❌ Fail if symptoms unclear
87
+
88
+ ## Confidence Score Calculation
89
+
90
+ ```
91
+ Total = Check1 (25%) + Check2 (25%) + Check3 (20%) + Check4 (15%) + Check5 (15%)
92
+
93
+ If Total >= 0.90: ✅ Proceed with implementation
94
+ If Total >= 0.70: ⚠️ Present alternatives, ask questions
95
+ If Total < 0.70: ❌ STOP - Request more context
96
+ ```
97
+
98
+ ## Output Format
99
+
100
+ ```
101
+ 📋 Confidence Checks:
102
+ ✅ No duplicate implementations found
103
+ ✅ Uses existing tech stack
104
+ ✅ Official documentation verified
105
+ ✅ Working OSS implementation found
106
+ ✅ Root cause identified
107
+
108
+ 📊 Confidence: 1.00 (100%)
109
+ ✅ High confidence - Proceeding to implementation
110
+ ```
111
+
112
+ ## Implementation Details
113
+
114
+ The TypeScript implementation is available in `confidence.ts` for reference, containing:
115
+
116
+ - `confidenceCheck(context)` - Main assessment function
117
+ - Detailed check implementations
118
+ - Context interface definitions
119
+
120
+ ## ROI
121
+
122
+ **Token Savings**: Spend 100-200 tokens on confidence check to save 5,000-50,000 tokens on wrong-direction work.
123
+
124
+ **Success Rate**: 100% precision and recall in production testing.