@ibgib/web-gib 0.0.23 → 0.0.26
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/AUTO-GENERATED-version.d.mts +14 -0
- package/dist/AUTO-GENERATED-version.d.mts.map +1 -0
- package/dist/AUTO-GENERATED-version.mjs +14 -0
- package/dist/AUTO-GENERATED-version.mjs.map +1 -0
- package/package.json +4 -1
- package/src/AUTO-GENERATED-version.mts +14 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/SKILL.md +81 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/generate-id.js +9 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/bootstrap.mts.template +58 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/constants.mts.template +75 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/declarations.d.ts.template +9 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/helpers.web.mts.template +199 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/index.html.template +65 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/index.mts.template +61 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/types.mts.template +128 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/SKILL.md +59 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/api/function-infos.web.mts.template +11 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/app-v1.mts.template +124 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/constants.mts.template +48 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/helper.mts.template +72 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/types.mts.template +38 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/SKILL.md +36 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/templates/components/component-name/component.css.template +26 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/templates/components/component-name/component.html.template +6 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/templates/components/component-name/component.mts.template +131 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/SKILL.md +34 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/templates/ui/shell/shell-constants.mts.template +10 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/templates/ui/shell/shell-service.mts.template +139 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/templates/ui/shell/shell-types.mts.template +6 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-enum-pattern/SKILL.md +153 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-get-pattern/SKILL.md +92 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-scaffold-app/SKILL.md +42 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-targeted-refactoring/SKILL.md +84 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-targeted-refactoring/generate-id.js +9 -0
- package/tools/copy-agent-skills.js +51 -0
- package/{generate-version-file.js → tools/generate-version-file.js} +1 -1
- package/tools/init-agents.js +51 -10
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Ibgib Targeted Refactoring
|
|
3
|
+
description: Refactor a file to conform to specified style guidelines, using a metadata file to track user-selected rules and code changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ibgib Targeted Refactoring
|
|
7
|
+
|
|
8
|
+
This skill guides the agent to refactor a target file using guidelines from a specified styleguide. The process relies on an intermediate review step where the user can pick exactly which guidelines to apply.
|
|
9
|
+
|
|
10
|
+
## Required Inputs
|
|
11
|
+
When invoking this skill or when the user asks for guided refactoring, ensure you have:
|
|
12
|
+
1. **Target file path**: The file to be refactored.
|
|
13
|
+
2. **Styleguide file path**: The markdown file containing the stylistic or architectural rules.
|
|
14
|
+
3. **Refactor Focus**: A description of the focus or subset of rules to apply (e.g. "function review rules", "naming conventions").
|
|
15
|
+
|
|
16
|
+
## Step-by-Step Workflow
|
|
17
|
+
|
|
18
|
+
Follow these steps exactly in order:
|
|
19
|
+
|
|
20
|
+
### Step 1: Generate Metadata File
|
|
21
|
+
1. Read the provided styleguide file.
|
|
22
|
+
2. Based on the **Refactor Focus** provided by the user, extract ONLY the relevant subset of rules/guidelines. Do NOT extract the entire styleguide unless explicitly requested.
|
|
23
|
+
3. Create a markdown tracking file at `[target_file_path].metadata.md` (e.g., if the target is `path/to/file.ext`, the metadata file is `path/to/file.ext.metadata.md`).
|
|
24
|
+
3. Format the metadata file exactly as follows, populating the `## guidelines` section with the extracted rules:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
# agent refactor metadata
|
|
28
|
+
|
|
29
|
+
## guidelines
|
|
30
|
+
|
|
31
|
+
* rule 1
|
|
32
|
+
* rule 2
|
|
33
|
+
* optional clarification to rule 2
|
|
34
|
+
* rule 3
|
|
35
|
+
etc...
|
|
36
|
+
|
|
37
|
+
## path/to/file.ext
|
|
38
|
+
|
|
39
|
+
[changes will go here]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 2: Prompt for User Review
|
|
43
|
+
1. **STOP execution**.
|
|
44
|
+
2. Use the `notify_user` tool to prompt the user to review the generated metadata file.
|
|
45
|
+
3. Set `BlockedOnUser: true` and pass the new metadata file's path in `PathsToReview`.
|
|
46
|
+
4. Instruct the user: "Please review the generated metadata file. Delete any rules under the `## guidelines` section that you do NOT want applied to the file, leave any optional clarifications or notes, and then let me know when you are ready to proceed."
|
|
47
|
+
|
|
48
|
+
### Step 3: Perform Refactor
|
|
49
|
+
1. Once the user replies that they are ready, re-read the `[target_file_path].metadata.md` file.
|
|
50
|
+
2. Identify which rules the user left under `## guidelines`.
|
|
51
|
+
3. Read the target file.
|
|
52
|
+
4. **Apply only the remaining rules** to the target file. (If there is a helper script provided along with this skill, use it as instructed in the specific user prompt).
|
|
53
|
+
5. **CRITICAL LOGGING RULE**: If any of the remaining rules involve tagging log messages, warnings, or errors (e.g., as specified by `STYLEGUIDE.md`: "* Tag ALL logging messages, warnings, and errors with the proper prefix, a uuid or 'genuuid', inside parens*"), you MUST run the provided custom script to generate actual IDs.
|
|
54
|
+
* Run the command: `node .agent/skills/targeted_refactoring/generate-id.js`
|
|
55
|
+
* This will output a list of 10 unique IDs ending in the current year.
|
|
56
|
+
* Use these generated IDs to replace any placeholder `(genuuid)` strings in your newly refactored code (or anywhere you had to add a new tag). If you run out of IDs, just run the command again. Do NOT just insert the literal string `"genuuid"` in the final code.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Step 4: Document Changes
|
|
60
|
+
1. After refactoring the target file, update the `[target_file_path].metadata.md` file with a summary of the exact changes made.
|
|
61
|
+
2. Document the changes under the `## [path/to/file.ext]` section.
|
|
62
|
+
3. Include a timestamp and a breakdown of the modifications per rule and line number, with the diff or changed code in triple-backtick blocks.
|
|
63
|
+
4. The updated section MUST follow this exact format:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
## path/to/file.ext
|
|
67
|
+
|
|
68
|
+
### YYYY/MM/DD - hh:mm A/PM
|
|
69
|
+
|
|
70
|
+
#### line [line_number] - [rule_name]
|
|
71
|
+
|
|
72
|
+
\`\`\`[language_extension]
|
|
73
|
+
[triple-backtick code block here of changes]
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
#### line [line_number] - [rule_name]
|
|
77
|
+
|
|
78
|
+
\`\`\`[language_extension]
|
|
79
|
+
[triple-backtick code block here of changes]
|
|
80
|
+
\`\`\`
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Step 5: Final Review
|
|
84
|
+
Notify the user that the refactoring is complete, and if they have further files to process, repeat the skill.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
|
|
3
|
+
const yearStr = new Date().getFullYear().toString().slice(-2);
|
|
4
|
+
|
|
5
|
+
for (let i = 0; i < 10; i++) {
|
|
6
|
+
const hash = crypto.createHash('md5').update(crypto.randomBytes(16)).digest('hex');
|
|
7
|
+
const id = hash.slice(0, 30) + yearStr;
|
|
8
|
+
console.log(id);
|
|
9
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
const lc = `[${import.meta.url}]`;
|
|
9
|
+
console.log(`${lc} starting...`);
|
|
10
|
+
|
|
11
|
+
// The source .agents folder is at the monorepo root: libs/web-gib/../../../.agents
|
|
12
|
+
const sourceAgentsDir = path.resolve(__dirname, '../../../.agents');
|
|
13
|
+
// The target is libs/web-gib/tools/auto-generated-agent-skills
|
|
14
|
+
const targetAgentsDir = path.resolve(__dirname, './auto-generated-agent-skills');
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(sourceAgentsDir)) {
|
|
17
|
+
console.error(`${lc} Error: Source directory not found: ${sourceAgentsDir}`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
if (fs.existsSync(targetAgentsDir)) {
|
|
23
|
+
fs.rmSync(targetAgentsDir, { recursive: true, force: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// We only want to copy skills that start with "ibgib-"
|
|
27
|
+
const sourceSkillsDir = path.join(sourceAgentsDir, 'skills');
|
|
28
|
+
const targetSkillsDir = path.join(targetAgentsDir, 'skills');
|
|
29
|
+
|
|
30
|
+
if (fs.existsSync(sourceSkillsDir)) {
|
|
31
|
+
fs.mkdirSync(targetSkillsDir, { recursive: true });
|
|
32
|
+
const skillDirs = fs.readdirSync(sourceSkillsDir, { withFileTypes: true });
|
|
33
|
+
|
|
34
|
+
let copyCount = 0;
|
|
35
|
+
for (const dirent of skillDirs) {
|
|
36
|
+
if (dirent.isDirectory() && dirent.name.startsWith('ibgib-')) {
|
|
37
|
+
const srcPath = path.join(sourceSkillsDir, dirent.name);
|
|
38
|
+
const destPath = path.join(targetSkillsDir, dirent.name);
|
|
39
|
+
fs.cpSync(srcPath, destPath, { recursive: true });
|
|
40
|
+
copyCount++;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
console.log(`${lc} successfully copied ${copyCount} 'ibgib-' prefixed skills to ${targetAgentsDir}`);
|
|
44
|
+
} else {
|
|
45
|
+
console.log(`${lc} No skills directory found in source.`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
} catch (e) {
|
|
49
|
+
console.error(`${lc} Error copying agent skills:`, e);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as pathUtils from 'path';
|
|
3
3
|
import { writeFile } from 'node:fs/promises';
|
|
4
4
|
|
|
5
|
-
import packageJson from '
|
|
5
|
+
import packageJson from '../package.json' with {type: 'json'};
|
|
6
6
|
|
|
7
7
|
const lc = `[${import.meta.url}]`;
|
|
8
8
|
console.log(`${lc} starting... (I: 1cb5f4175a1e2ccff8045ec622ed6825)`)
|
package/tools/init-agents.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import readline from 'node:readline/promises';
|
|
5
6
|
|
|
6
7
|
// ESM doesn't natively have __dirname, so we reconstruct it.
|
|
7
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -9,9 +10,8 @@ const __dirname = path.dirname(__filename);
|
|
|
9
10
|
|
|
10
11
|
const logPref = '[web-gib init-agents]';
|
|
11
12
|
|
|
12
|
-
// Target the
|
|
13
|
-
const
|
|
14
|
-
const sourceAgentsDir = path.join(packageRoot, '.agents');
|
|
13
|
+
// Target the auto-generated-agent-skills folder in the tools directory
|
|
14
|
+
const sourceAgentsDir = path.join(__dirname, 'auto-generated-agent-skills');
|
|
15
15
|
|
|
16
16
|
// The consumer's repository root (where they run npx web-gib-init-agents)
|
|
17
17
|
const targetAgentsDir = path.join(process.cwd(), '.agents');
|
|
@@ -25,15 +25,56 @@ console.log(`${logPref} Copying ibgib agent skills...`);
|
|
|
25
25
|
console.log(`${logPref} From: ${sourceAgentsDir}`);
|
|
26
26
|
console.log(`${logPref} To: ${targetAgentsDir}`);
|
|
27
27
|
|
|
28
|
+
const sourceSkillsDir = path.join(sourceAgentsDir, 'skills');
|
|
29
|
+
const targetSkillsDir = path.join(targetAgentsDir, 'skills');
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(sourceSkillsDir)) {
|
|
32
|
+
console.error(`${logPref} Error: Source skills directory not found at ${sourceSkillsDir}`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Ensure the target skills directory exists
|
|
37
|
+
if (!fs.existsSync(targetSkillsDir)) {
|
|
38
|
+
fs.mkdirSync(targetSkillsDir, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const skillDirs = fs.readdirSync(sourceSkillsDir, { withFileTypes: true });
|
|
42
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
43
|
+
|
|
28
44
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
for (const dirent of skillDirs) {
|
|
46
|
+
if (!dirent.isDirectory()) continue;
|
|
47
|
+
|
|
48
|
+
const skillName = dirent.name;
|
|
49
|
+
// Proceed only with explicitly targeted ibgib prefixed skills
|
|
50
|
+
if (!skillName.startsWith('ibgib-')) continue;
|
|
51
|
+
|
|
52
|
+
const srcSkillPath = path.join(sourceSkillsDir, skillName);
|
|
53
|
+
const targetSkillPath = path.join(targetSkillsDir, skillName);
|
|
54
|
+
|
|
55
|
+
let shouldCopy = true;
|
|
56
|
+
|
|
57
|
+
if (fs.existsSync(targetSkillPath)) {
|
|
58
|
+
const answer = await rl.question(`${logPref} Skill folder '${skillName}' already exists. Overwrite? (y/N) `);
|
|
59
|
+
if (answer.toLowerCase() !== 'y') {
|
|
60
|
+
shouldCopy = false;
|
|
61
|
+
console.log(`${logPref} Skipped overwriting ${skillName}.`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (shouldCopy) {
|
|
66
|
+
fs.cpSync(srcSkillPath, targetSkillPath, {
|
|
67
|
+
recursive: true,
|
|
68
|
+
force: true,
|
|
69
|
+
errorOnExist: false
|
|
70
|
+
});
|
|
71
|
+
console.log(`${logPref} ✅ Copied skill: ${skillName}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
console.log(`${logPref} Finished initializing agent skills.`);
|
|
36
75
|
} catch (error) {
|
|
37
76
|
console.error(`${logPref} ❌ Failed to copy agent skills:`, error);
|
|
38
77
|
process.exit(1);
|
|
78
|
+
} finally {
|
|
79
|
+
rl.close();
|
|
39
80
|
}
|