@tyyyho/treg 1.0.2 → 1.0.3

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.
@@ -1,7 +1,8 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { promises as fs } from "node:fs";
3
3
  import path from "node:path";
4
- const SKILL_SECTION_HEADING = "## Treg AI Skills";
4
+ const SKILL_SECTION_HEADING = "## Treg AI Rules";
5
+ const LEGACY_SKILL_SECTION_HEADINGS = ["## Treg AI Guide", "## Treg AI Skills"];
5
6
  const SKILLS_BASE_DIR = "skills";
6
7
  const AI_TOOL_DOCS = {
7
8
  claude: "CLAUDE.md",
@@ -126,7 +127,17 @@ async function ensureSkillFiles(projectDir, enabled, testRunner, dryRun) {
126
127
  function buildSkillSection(context) {
127
128
  const { enabledFeatures, testRunner } = context;
128
129
  const enabled = getEnabledFeatures(enabledFeatures);
129
- const lines = [SKILL_SECTION_HEADING, "", "### Steps and Skill Mapping", ""];
130
+ const lines = [
131
+ SKILL_SECTION_HEADING,
132
+ "",
133
+ "### Git rules",
134
+ "",
135
+ "1. Never use --verify",
136
+ "2. Unless the user asks, never relax TypeScript, lint, or format constraints, and never skip tests.",
137
+ "",
138
+ "### Steps and Skill Mapping",
139
+ "",
140
+ ];
130
141
  if (enabled.length === 0) {
131
142
  lines.push("1. No features are enabled in this run, so no skill call is required.");
132
143
  lines.push("");
@@ -153,7 +164,10 @@ function upsertSkillSection(content, nextSection) {
153
164
  const rebuilt = `${before}\n\n${nextSection.trim()}\n`;
154
165
  return after ? `${rebuilt}\n${after}\n` : `${rebuilt}`;
155
166
  };
156
- const headingStart = content.indexOf(SKILL_SECTION_HEADING);
167
+ const headingStart = [SKILL_SECTION_HEADING, ...LEGACY_SKILL_SECTION_HEADINGS]
168
+ .map(heading => content.indexOf(heading))
169
+ .filter(index => index !== -1)
170
+ .sort((a, b) => a - b)[0] ?? -1;
157
171
  if (headingStart !== -1) {
158
172
  const nextHeading = content.indexOf("\n## ", headingStart + 1);
159
173
  const sectionEnd = nextHeading === -1 ? content.length : nextHeading + 1;
@@ -173,7 +187,7 @@ export async function runAiSkillsRule(context) {
173
187
  for (const targetFile of targetFiles) {
174
188
  if (dryRun) {
175
189
  const action = existsSync(targetFile) ? "update" : "create";
176
- console.log(`[dry-run] Would ${action} ${path.basename(targetFile)} with AI skill guidance`);
190
+ console.log(`[dry-run] Would ${action} ${path.basename(targetFile)} with AI rules content`);
177
191
  continue;
178
192
  }
179
193
  const exists = existsSync(targetFile);
@@ -182,10 +196,10 @@ export async function runAiSkillsRule(context) {
182
196
  if (updated !== current) {
183
197
  await fs.mkdir(path.dirname(targetFile), { recursive: true });
184
198
  await fs.writeFile(targetFile, updated, "utf8");
185
- console.log(`${exists ? "Updated" : "Created"} ${path.basename(targetFile)} with AI skill guidance`);
199
+ console.log(`${exists ? "Updated" : "Created"} ${path.basename(targetFile)} with AI rules content`);
186
200
  continue;
187
201
  }
188
- console.log(`${path.basename(targetFile)} already contains latest AI skill guidance`);
202
+ console.log(`${path.basename(targetFile)} already contains latest AI rules content`);
189
203
  }
190
204
  }
191
205
  export const __testables__ = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tyyyho/treg",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Treg is a CLI tool that injects an engineering immune system into existing projects.",
5
5
  "license": "MIT",
6
6
  "repository": {