knowns 0.8.5 → 0.8.7

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.
@@ -32778,14 +32778,144 @@ async function handleGetBoard(fileStore2) {
32778
32778
  import { existsSync as existsSync4 } from "node:fs";
32779
32779
  import { mkdir as mkdir3, readFile as readFile3, readdir as readdir2, writeFile as writeFile2 } from "node:fs/promises";
32780
32780
  import { join as join7 } from "node:path";
32781
+
32782
+ // src/utils/markdown-toc.ts
32783
+ function extractToc(markdown) {
32784
+ const lines = markdown.split("\n");
32785
+ const toc = [];
32786
+ for (let i = 0; i < lines.length; i++) {
32787
+ const line = lines[i];
32788
+ const match = line.match(/^(#{1,6})\s+(.+)$/);
32789
+ if (match) {
32790
+ const level = match[1].length;
32791
+ const title = match[2].trim();
32792
+ const slug = slugify2(title);
32793
+ toc.push({ level, title, slug, line: i + 1 });
32794
+ }
32795
+ }
32796
+ return toc;
32797
+ }
32798
+ function extractSection(markdown, sectionTitle) {
32799
+ const lines = markdown.split("\n");
32800
+ const normalizedTarget = normalizeTitle(sectionTitle);
32801
+ let startLine = -1;
32802
+ let startLevel = 0;
32803
+ let endLine = lines.length;
32804
+ for (let i = 0; i < lines.length; i++) {
32805
+ const line = lines[i];
32806
+ const match = line.match(/^(#{1,6})\s+(.+)$/);
32807
+ if (match) {
32808
+ const level = match[1].length;
32809
+ const title = match[2].trim();
32810
+ if (startLine === -1) {
32811
+ if (normalizeTitle(title) === normalizedTarget || matchesPartial(title, sectionTitle)) {
32812
+ startLine = i;
32813
+ startLevel = level;
32814
+ }
32815
+ } else {
32816
+ if (level <= startLevel) {
32817
+ endLine = i;
32818
+ break;
32819
+ }
32820
+ }
32821
+ }
32822
+ }
32823
+ if (startLine === -1) {
32824
+ return null;
32825
+ }
32826
+ return lines.slice(startLine, endLine).join("\n").trim();
32827
+ }
32828
+ function replaceSection(markdown, sectionTitle, newContent) {
32829
+ const lines = markdown.split("\n");
32830
+ const normalizedTarget = normalizeTitle(sectionTitle);
32831
+ let startLine = -1;
32832
+ let startLevel = 0;
32833
+ let endLine = lines.length;
32834
+ let originalHeading = "";
32835
+ for (let i = 0; i < lines.length; i++) {
32836
+ const line = lines[i];
32837
+ const match = line.match(/^(#{1,6})\s+(.+)$/);
32838
+ if (match) {
32839
+ const level = match[1].length;
32840
+ const title = match[2].trim();
32841
+ if (startLine === -1) {
32842
+ if (normalizeTitle(title) === normalizedTarget || matchesPartial(title, sectionTitle)) {
32843
+ startLine = i;
32844
+ startLevel = level;
32845
+ originalHeading = line;
32846
+ }
32847
+ } else {
32848
+ if (level <= startLevel) {
32849
+ endLine = i;
32850
+ break;
32851
+ }
32852
+ }
32853
+ }
32854
+ }
32855
+ if (startLine === -1) {
32856
+ return null;
32857
+ }
32858
+ const beforeSection = lines.slice(0, startLine);
32859
+ const afterSection = lines.slice(endLine);
32860
+ const newSection = `${originalHeading}
32861
+
32862
+ ${newContent.trim()}`;
32863
+ return [...beforeSection, newSection, ...afterSection].join("\n");
32864
+ }
32865
+ function slugify2(title) {
32866
+ return title.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").trim();
32867
+ }
32868
+ function normalizeTitle(title) {
32869
+ return title.toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, " ").trim();
32870
+ }
32871
+ function calculateDocStats(markdown) {
32872
+ const chars = markdown.length;
32873
+ const words = markdown.split(/\s+/).filter((w) => w.length > 0).length;
32874
+ const lines = markdown.split("\n").length;
32875
+ const toc = extractToc(markdown);
32876
+ const headingCount = toc.length;
32877
+ const estimatedTokens = Math.ceil(chars / 3.5);
32878
+ return {
32879
+ chars,
32880
+ words,
32881
+ lines,
32882
+ estimatedTokens,
32883
+ headingCount
32884
+ };
32885
+ }
32886
+ function matchesPartial(title, search) {
32887
+ const normalizedTitle = normalizeTitle(title);
32888
+ const normalizedSearch = normalizeTitle(search);
32889
+ if (normalizedTitle === normalizedSearch) return true;
32890
+ if (normalizedTitle.startsWith(normalizedSearch)) return true;
32891
+ const numMatch = search.match(/^(\d+)\.?\s*(.*)$/);
32892
+ if (numMatch) {
32893
+ const [, num, rest] = numMatch;
32894
+ const titleNumMatch = title.match(/^(\d+)\.?\s*(.*)$/);
32895
+ if (titleNumMatch && titleNumMatch[1] === num) {
32896
+ if (!rest || normalizeTitle(titleNumMatch[2]).startsWith(normalizeTitle(rest))) {
32897
+ return true;
32898
+ }
32899
+ }
32900
+ }
32901
+ return false;
32902
+ }
32903
+
32904
+ // src/mcp/handlers/doc.ts
32781
32905
  var import_gray_matter3 = __toESM(require_gray_matter(), 1);
32782
32906
  var DOCS_DIR = join7(process.cwd(), ".knowns", "docs");
32783
32907
  var listDocsSchema = external_exports3.object({
32784
32908
  tag: external_exports3.string().optional()
32785
32909
  });
32786
32910
  var getDocSchema = external_exports3.object({
32787
- path: external_exports3.string()
32911
+ path: external_exports3.string(),
32788
32912
  // Document path (filename or folder/filename)
32913
+ info: external_exports3.boolean().optional(),
32914
+ // Return document stats (size, tokens, headings) without content
32915
+ toc: external_exports3.boolean().optional(),
32916
+ // Return table of contents only
32917
+ section: external_exports3.string().optional()
32918
+ // Return specific section by heading title or number
32789
32919
  });
32790
32920
  var createDocSchema = external_exports3.object({
32791
32921
  title: external_exports3.string(),
@@ -32802,8 +32932,10 @@ var updateDocSchema = external_exports3.object({
32802
32932
  description: external_exports3.string().optional(),
32803
32933
  content: external_exports3.string().optional(),
32804
32934
  tags: external_exports3.array(external_exports3.string()).optional(),
32805
- appendContent: external_exports3.string().optional()
32935
+ appendContent: external_exports3.string().optional(),
32806
32936
  // Append to existing content
32937
+ section: external_exports3.string().optional()
32938
+ // Target section to replace (use with content)
32807
32939
  });
32808
32940
  var searchDocsSchema = external_exports3.object({
32809
32941
  query: external_exports3.string(),
@@ -32822,13 +32954,25 @@ var docTools = [
32822
32954
  },
32823
32955
  {
32824
32956
  name: "get_doc",
32825
- description: "Get a documentation file by path (filename or folder/filename)",
32957
+ description: "Get a documentation file by path. Use 'info: true' first to check size, then 'toc: true' for table of contents, then 'section' to read specific parts.",
32826
32958
  inputSchema: {
32827
32959
  type: "object",
32828
32960
  properties: {
32829
32961
  path: {
32830
32962
  type: "string",
32831
32963
  description: "Document path (e.g., 'readme', 'guides/setup', 'conventions/naming.md')"
32964
+ },
32965
+ info: {
32966
+ type: "boolean",
32967
+ description: "Return document stats (size, tokens, headings) without content. Use this first to decide how to read."
32968
+ },
32969
+ toc: {
32970
+ type: "boolean",
32971
+ description: "Return table of contents only (list of headings). Use this first for large documents."
32972
+ },
32973
+ section: {
32974
+ type: "string",
32975
+ description: "Return specific section by heading title or number (e.g., '2. Overview' or '2'). Use after viewing TOC."
32832
32976
  }
32833
32977
  },
32834
32978
  required: ["path"]
@@ -32858,7 +33002,7 @@ var docTools = [
32858
33002
  },
32859
33003
  {
32860
33004
  name: "update_doc",
32861
- description: "Update an existing documentation file",
33005
+ description: "Update an existing documentation file. Use 'section' with 'content' to replace only a specific section.",
32862
33006
  inputSchema: {
32863
33007
  type: "object",
32864
33008
  properties: {
@@ -32868,7 +33012,10 @@ var docTools = [
32868
33012
  },
32869
33013
  title: { type: "string", description: "New title" },
32870
33014
  description: { type: "string", description: "New description" },
32871
- content: { type: "string", description: "Replace content" },
33015
+ content: {
33016
+ type: "string",
33017
+ description: "Replace content (or section content if 'section' is specified)"
33018
+ },
32872
33019
  tags: {
32873
33020
  type: "array",
32874
33021
  items: { type: "string" },
@@ -32877,6 +33024,10 @@ var docTools = [
32877
33024
  appendContent: {
32878
33025
  type: "string",
32879
33026
  description: "Append to existing content"
33027
+ },
33028
+ section: {
33029
+ type: "string",
33030
+ description: "Target section to replace by heading title or number (use with 'content')"
32880
33031
  }
32881
33032
  },
32882
33033
  required: ["path"]
@@ -32989,6 +33140,70 @@ async function handleGetDoc(args) {
32989
33140
  const fileContent = await readFile3(resolved.filepath, "utf-8");
32990
33141
  const { data, content } = (0, import_gray_matter3.default)(fileContent);
32991
33142
  const metadata = data;
33143
+ if (input.info) {
33144
+ const stats = calculateDocStats(content);
33145
+ let recommendation;
33146
+ if (stats.estimatedTokens > 4e3) {
33147
+ recommendation = "Document is large. Use 'toc: true' first, then 'section' to read specific parts.";
33148
+ } else if (stats.estimatedTokens > 2e3) {
33149
+ recommendation = "Consider using 'toc: true' and 'section' for specific info.";
33150
+ } else {
33151
+ recommendation = "Document is small enough to read directly.";
33152
+ }
33153
+ return successResponse({
33154
+ doc: {
33155
+ path: resolved.filename.replace(/\.md$/, ""),
33156
+ title: metadata.title,
33157
+ stats: {
33158
+ chars: stats.chars,
33159
+ words: stats.words,
33160
+ lines: stats.lines,
33161
+ estimatedTokens: stats.estimatedTokens,
33162
+ headingCount: stats.headingCount
33163
+ },
33164
+ recommendation
33165
+ }
33166
+ });
33167
+ }
33168
+ if (input.toc) {
33169
+ const toc = extractToc(content);
33170
+ if (toc.length === 0) {
33171
+ return successResponse({
33172
+ doc: {
33173
+ path: resolved.filename.replace(/\.md$/, ""),
33174
+ title: metadata.title,
33175
+ toc: [],
33176
+ message: "No headings found in this document."
33177
+ }
33178
+ });
33179
+ }
33180
+ return successResponse({
33181
+ doc: {
33182
+ path: resolved.filename.replace(/\.md$/, ""),
33183
+ title: metadata.title,
33184
+ toc: toc.map((entry, index) => ({
33185
+ index: index + 1,
33186
+ level: entry.level,
33187
+ title: entry.title
33188
+ })),
33189
+ hint: "Use 'section' parameter with a heading title or number to read specific content."
33190
+ }
33191
+ });
33192
+ }
33193
+ if (input.section) {
33194
+ const sectionContent = extractSection(content, input.section);
33195
+ if (!sectionContent) {
33196
+ return errorResponse(`Section not found: ${input.section}. Use 'toc: true' to see available sections.`);
33197
+ }
33198
+ return successResponse({
33199
+ doc: {
33200
+ path: resolved.filename.replace(/\.md$/, ""),
33201
+ title: metadata.title,
33202
+ section: input.section,
33203
+ content: sectionContent
33204
+ }
33205
+ });
33206
+ }
32992
33207
  return successResponse({
32993
33208
  doc: {
32994
33209
  path: resolved.filename.replace(/\.md$/, ""),
@@ -33059,11 +33274,21 @@ async function handleUpdateDoc(args) {
33059
33274
  if (input.tags) metadata.tags = input.tags;
33060
33275
  metadata.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
33061
33276
  let updatedContent = content;
33062
- if (input.content) {
33277
+ let sectionUpdated;
33278
+ if (input.section && input.content) {
33279
+ const result = replaceSection(content, input.section, input.content);
33280
+ if (!result) {
33281
+ return errorResponse(
33282
+ `Section not found: ${input.section}. Use 'toc: true' with get_doc to see available sections.`
33283
+ );
33284
+ }
33285
+ updatedContent = result;
33286
+ sectionUpdated = input.section;
33287
+ } else if (input.content) {
33063
33288
  updatedContent = input.content;
33064
33289
  }
33065
33290
  if (input.appendContent) {
33066
- updatedContent = `${content.trimEnd()}
33291
+ updatedContent = `${updatedContent.trimEnd()}
33067
33292
 
33068
33293
  ${input.appendContent}`;
33069
33294
  }
@@ -33071,13 +33296,14 @@ ${input.appendContent}`;
33071
33296
  await writeFile2(resolved.filepath, newFileContent, "utf-8");
33072
33297
  await notifyDocUpdate(resolved.filename);
33073
33298
  return successResponse({
33074
- message: `Updated documentation: ${resolved.filename}`,
33299
+ message: sectionUpdated ? `Updated section "${sectionUpdated}" in ${resolved.filename}` : `Updated documentation: ${resolved.filename}`,
33075
33300
  doc: {
33076
33301
  path: resolved.filename.replace(/\.md$/, ""),
33077
33302
  title: metadata.title,
33078
33303
  description: metadata.description,
33079
33304
  tags: metadata.tags,
33080
- updatedAt: metadata.updatedAt
33305
+ updatedAt: metadata.updatedAt,
33306
+ ...sectionUpdated && { section: sectionUpdated }
33081
33307
  }
33082
33308
  });
33083
33309
  }
@@ -33124,68 +33350,166 @@ async function handleSearchDocs(args) {
33124
33350
  });
33125
33351
  }
33126
33352
 
33127
- // src/templates/guidelines/core-rules.md
33128
- var core_rules_default = '# Core Rules\n\nYou MUST follow these rules. If you cannot follow any rule, stop and ask for guidance before proceeding.\n\n---\n\n## \u{1F3AF} The Golden Rule\n\n**If you want to change ANYTHING in a task or doc, use CLI commands or MCP tools. NEVER edit .md files directly.**\n\nWhy? Direct file editing breaks metadata synchronization, Git tracking, and relationships.\n\n---\n\n## \u26A0\uFE0F CRITICAL: The -a Flag Confusion\n\nThe `-a` flag means DIFFERENT things in different commands:\n\n| Command | `-a` Means | NOT This! |\n|---------|------------|-----------|\n| `task create` | `--assignee` (assign user) | ~~acceptance criteria~~ |\n| `task edit` | `--assignee` (assign user) | ~~acceptance criteria~~ |\n| `doc edit` | `--append` (append content) | ~~assignee~~ |\n\n### Acceptance Criteria: Use --ac\n\n```bash\n# \u274C WRONG: -a is assignee, NOT acceptance criteria!\nknowns task edit 35 -a "- [ ] Criterion" # Sets assignee to garbage!\nknowns task create "Title" -a "Criterion" # Sets assignee to garbage!\n\n# \u2705 CORRECT: Use --ac for acceptance criteria\nknowns task edit 35 --ac "Criterion one"\nknowns task edit 35 --ac "Criterion two"\nknowns task create "Title" --ac "Criterion one" --ac "Criterion two"\n```\n\n---\n\n## Core Principles\n\n| Rule | Description |\n|------|-------------|\n| **CLI/MCP Only** | Use commands for ALL operations. NEVER edit .md files directly |\n| **Docs First** | Read project docs BEFORE planning or coding |\n| **Time Tracking** | Always start timer when taking task, stop when done |\n| **Plan Approval** | Share plan with user, WAIT for approval before coding |\n| **Check AC After Work** | Only mark acceptance criteria done AFTER completing the work |\n\n---\n\n## The --plain Flag\n\n**ONLY for view/list/search commands (NOT create/edit):**\n\n```bash\n# \u2705 CORRECT\nknowns task <id> --plain\nknowns task list --plain\nknowns doc "path" --plain\nknowns doc list --plain\nknowns search "query" --plain\n\n# \u274C WRONG (create/edit don\'t support --plain)\nknowns task create "Title" --plain # ERROR!\nknowns task edit <id> -s done --plain # ERROR!\nknowns doc create "Title" --plain # ERROR!\nknowns doc edit "name" -c "..." --plain # ERROR!\n```\n\n---\n\n## Reference System\n\n| Context | Task Format | Doc Format |\n|---------|-------------|------------|\n| **Writing** (input) | `@task-<id>` | `@doc/<path>` |\n| **Reading** (output) | `@.knowns/tasks/task-<id>` | `@.knowns/docs/<path>.md` |\n\nFollow refs recursively until complete context gathered.\n\n---\n\n## Task IDs\n\n| Format | Example | Notes |\n|--------|---------|-------|\n| Sequential | `48`, `49` | Legacy numeric |\n| Hierarchical | `48.1`, `48.2` | Legacy subtasks |\n| Random | `qkh5ne` | Current (6-char) |\n\n**CRITICAL:** Use raw ID for `--parent`:\n```bash\n# \u2705 CORRECT\nknowns task create "Title" --parent 48\n\n# \u274C WRONG\nknowns task create "Title" --parent task-48\n```\n\n---\n\n## Status & Priority\n\n| Status | When |\n|--------|------|\n| `todo` | Not started (default) |\n| `in-progress` | Currently working |\n| `in-review` | PR submitted |\n| `blocked` | Waiting on dependency |\n| `done` | All criteria met |\n\n| Priority | Level |\n|----------|-------|\n| `low` | Nice-to-have |\n| `medium` | Normal (default) |\n| `high` | Urgent |\n';
33353
+ // src/templates/guidelines/cli/commands-reference.md
33354
+ var commands_reference_default = '# Commands Reference\n\n## task create\n\n```bash\nknowns task create <title> [options]\n```\n\n| Flag | Short | Purpose |\n| --------------- | ----- | --------------------------------- |\n| `--description` | `-d` | Task description |\n| `--ac` | | Acceptance criterion (repeatable) |\n| `--labels` | `-l` | Comma-separated labels |\n| `--assignee` | `-a` | Assign to user \u26A0\uFE0F |\n| `--priority` | | low/medium/high |\n| `--status` | `-s` | Initial status |\n| `--parent` | | Parent task ID (raw ID only!) |\n\n**\u26A0\uFE0F `-a` = assignee, NOT acceptance criteria! Use `--ac` for AC.**\n\n---\n\n## task edit\n\n```bash\nknowns task edit <id> [options]\n```\n\n| Flag | Short | Purpose |\n| ---------------- | ----- | ------------------------ |\n| `--title` | `-t` | Change title |\n| `--description` | `-d` | Change description |\n| `--status` | `-s` | Change status |\n| `--priority` | | Change priority |\n| `--labels` | `-l` | Set labels |\n| `--assignee` | `-a` | Assign user \u26A0\uFE0F |\n| `--parent` | | Move to parent |\n| `--ac` | | Add acceptance criterion |\n| `--check-ac` | | Mark AC done (1-indexed) |\n| `--uncheck-ac` | | Unmark AC (1-indexed) |\n| `--remove-ac` | | Delete AC (1-indexed) |\n| `--plan` | | Set implementation plan |\n| `--notes` | | Replace notes |\n| `--append-notes` | | Add to notes |\n\n**\u26A0\uFE0F `-a` = assignee, NOT acceptance criteria! Use `--ac` for AC.**\n\n---\n\n## task view/list\n\n```bash\nknowns task <id> --plain # View single task\nknowns task list --plain # List all\nknowns task list --status in-progress --plain\nknowns task list --assignee @me --plain\nknowns task list --tree --plain # Tree hierarchy\n```\n\n---\n\n## doc create\n\n```bash\nknowns doc create <title> [options]\n```\n\n| Flag | Short | Purpose |\n| --------------- | ----- | -------------------- |\n| `--description` | `-d` | Description |\n| `--tags` | `-t` | Comma-separated tags |\n| `--folder` | `-f` | Folder path |\n\n### Document Structure Best Practice\n\nWhen creating/editing docs, use clear heading structure for `--toc` and `--section` to work properly:\n\n```markdown\n# Main Title (H1 - only one)\n\n## 1. Overview\n\nBrief introduction...\n\n## 2. Installation\n\nStep-by-step guide...\n\n## 3. Configuration\n\n### 3.1 Basic Config\n\n...\n\n### 3.2 Advanced Config\n\n...\n\n## 4. API Reference\n\n...\n```\n\n**Writing rules:**\n\n- Use numbered headings (`## 1. Overview`) for easy `--section "1"` access\n- Keep H1 for title only, use H2 for main sections\n- Use H3 for subsections within H2\n- Each section should be self-contained (readable without context)\n\n**Reading workflow:**\n\n```bash\n# Step 1: Check size first\nknowns doc <path> --info --plain\n# \u2192 If <2000 tokens: read directly with --plain\n# \u2192 If >2000 tokens: continue to step 2\n\n# Step 2: Get table of contents\nknowns doc <path> --toc --plain\n\n# Step 3: Read specific section\nknowns doc <path> --section "2" --plain\n```\n\n---\n\n## doc edit\n\n```bash\nknowns doc edit <name> [options]\n```\n\n| Flag | Short | Purpose |\n| ---------------- | ----- | ----------------------------------------- |\n| `--title` | `-t` | Change title |\n| `--description` | `-d` | Change description |\n| `--tags` | | Set tags |\n| `--content` | `-c` | Replace content (or section if --section) |\n| `--append` | `-a` | Append content \u26A0\uFE0F |\n| `--section` | | Target section to replace (use with -c) |\n| `--content-file` | | Content from file |\n| `--append-file` | | Append from file |\n\n**\u26A0\uFE0F In doc edit, `-a` = append content, NOT assignee!**\n\n### Section Edit (Context-Efficient)\n\nReplace only a specific section instead of entire document:\n\n```bash\n# Step 1: View TOC to find section\nknowns doc readme --toc --plain\n\n# Step 2: Edit only that section\nknowns doc edit readme --section "2. Installation" -c "New content here..."\nknowns doc edit readme --section "2" -c "New content..." # By number works too\n```\n\nThis reduces context usage significantly - no need to read/write entire document.\n\n---\n\n## doc view/list\n\n```bash\nknowns doc <path> --plain # View single doc\nknowns doc list --plain # List all\nknowns doc list --tag api --plain # Filter by tag\n```\n\n### Large Documents (--info, --toc, --section)\n\nFor large documents, check size first with `--info`, then use `--toc` and `--section`:\n\n```bash\n# Step 1: Check document size and token count\nknowns doc readme --info --plain\n# Output: Size: 42,461 chars (~12,132 tokens) | Headings: 83\n# Recommendation: Document is large. Use --toc first, then --section.\n\n# Step 2: View table of contents\nknowns doc readme --toc --plain\n\n# Step 3: Read specific section by title or number\nknowns doc readme --section "5. Sync" --plain\nknowns doc readme --section "3" --plain\n```\n\n**Decision flow:**\n\n- `--info` \u2192 Check size (~tokens) \u2192 If >2000 tokens, use --toc/--section\n- `--toc` \u2192 Get heading list \u2192 Choose section to read\n- `--section` \u2192 Read only what you need\n\n---\n\n## time\n\n```bash\nknowns time start <id> # REQUIRED when taking task\nknowns time stop # REQUIRED when completing\nknowns time pause\nknowns time resume\nknowns time status\nknowns time add <id> <duration> -n "Note" -d "2025-01-01"\n```\n\n---\n\n## search\n\n```bash\nknowns search "query" --plain\nknowns search "auth" --type task --plain\nknowns search "api" --type doc --plain\nknowns search "bug" --type task --status in-progress --priority high --plain\n```\n\n---\n\n## Multi-line Input (Bash/Zsh)\n\n```bash\nknowns task edit <id> --plan $\'1. Step\\n2. Step\\n3. Step\'\n```\n';
33355
+
33356
+ // src/templates/guidelines/cli/common-mistakes.md
33357
+ var common_mistakes_default = '# Common Mistakes\n\n## \u26A0\uFE0F CRITICAL: The -a Flag\n\n| Command | `-a` Means | NOT This! |\n|---------|------------|-----------|\n| `task create/edit` | `--assignee` | ~~acceptance criteria~~ |\n| `doc edit` | `--append` | ~~assignee~~ |\n\n```bash\n# \u274C WRONG (sets assignee to garbage!)\nknowns task edit 35 -a "Criterion text"\n\n# \u2705 CORRECT (use --ac)\nknowns task edit 35 --ac "Criterion text"\n```\n\n---\n\n## Quick Reference\n\n| \u274C DON\'T | \u2705 DO |\n|----------|-------|\n| Edit .md files directly | Use CLI commands |\n| `-a "criterion"` | `--ac "criterion"` |\n| `--parent task-48` | `--parent 48` (raw ID) |\n| `--plain` with create/edit | `--plain` only for view/list |\n| Check AC before work done | Check AC AFTER work done |\n| Code before plan approval | Wait for user approval |\n| Code before reading docs | Read docs FIRST |\n| Skip time tracking | Always `time start`/`stop` |\n| Ignore task refs | Follow ALL `@.knowns/...` refs |\n\n---\n\n## Error Recovery\n\n| Problem | Solution |\n|---------|----------|\n| Set assignee to AC text | `knowns task edit <id> -a @me` |\n| Forgot to stop timer | `knowns time add <id> <duration>` |\n| Checked AC too early | `knowns task edit <id> --uncheck-ac N` |\n| Task not found | `knowns task list --plain` |\n';
33129
33358
 
33130
- // src/templates/guidelines/commands-reference.md
33131
- var commands_reference_default = '# Commands Reference\n\n## task create\n\n```bash\nknowns task create <title> [options]\n```\n\n| Flag | Short | Purpose |\n|------|-------|---------|\n| `--description` | `-d` | Task description |\n| `--ac` | | Acceptance criterion (repeatable) |\n| `--labels` | `-l` | Comma-separated labels |\n| `--assignee` | `-a` | Assign to user \u26A0\uFE0F |\n| `--priority` | | low/medium/high |\n| `--status` | `-s` | Initial status |\n| `--parent` | | Parent task ID (raw ID only!) |\n\n**\u26A0\uFE0F `-a` = assignee, NOT acceptance criteria! Use `--ac` for AC.**\n\n---\n\n## task edit\n\n```bash\nknowns task edit <id> [options]\n```\n\n| Flag | Short | Purpose |\n|------|-------|---------|\n| `--title` | `-t` | Change title |\n| `--description` | `-d` | Change description |\n| `--status` | `-s` | Change status |\n| `--priority` | | Change priority |\n| `--labels` | `-l` | Set labels |\n| `--assignee` | `-a` | Assign user \u26A0\uFE0F |\n| `--parent` | | Move to parent |\n| `--ac` | | Add acceptance criterion |\n| `--check-ac` | | Mark AC done (1-indexed) |\n| `--uncheck-ac` | | Unmark AC (1-indexed) |\n| `--remove-ac` | | Delete AC (1-indexed) |\n| `--plan` | | Set implementation plan |\n| `--notes` | | Replace notes |\n| `--append-notes` | | Add to notes |\n\n**\u26A0\uFE0F `-a` = assignee, NOT acceptance criteria! Use `--ac` for AC.**\n\n---\n\n## task view/list\n\n```bash\nknowns task <id> --plain # View single task\nknowns task list --plain # List all\nknowns task list --status in-progress --plain\nknowns task list --assignee @me --plain\nknowns task list --tree --plain # Tree hierarchy\n```\n\n---\n\n## doc create\n\n```bash\nknowns doc create <title> [options]\n```\n\n| Flag | Short | Purpose |\n|------|-------|---------|\n| `--description` | `-d` | Description |\n| `--tags` | `-t` | Comma-separated tags |\n| `--folder` | `-f` | Folder path |\n\n---\n\n## doc edit\n\n```bash\nknowns doc edit <name> [options]\n```\n\n| Flag | Short | Purpose |\n|------|-------|---------|\n| `--title` | `-t` | Change title |\n| `--description` | `-d` | Change description |\n| `--tags` | | Set tags |\n| `--content` | `-c` | Replace content |\n| `--append` | `-a` | Append content \u26A0\uFE0F |\n| `--content-file` | | Content from file |\n| `--append-file` | | Append from file |\n\n**\u26A0\uFE0F In doc edit, `-a` = append content, NOT assignee!**\n\n---\n\n## doc view/list\n\n```bash\nknowns doc <path> --plain # View single doc\nknowns doc list --plain # List all\nknowns doc list --tag api --plain # Filter by tag\n```\n\n---\n\n## time\n\n```bash\nknowns time start <id> # REQUIRED when taking task\nknowns time stop # REQUIRED when completing\nknowns time pause\nknowns time resume\nknowns time status\nknowns time add <id> <duration> -n "Note" -d "2025-01-01"\n```\n\n---\n\n## search\n\n```bash\nknowns search "query" --plain\nknowns search "auth" --type task --plain\nknowns search "api" --type doc --plain\nknowns search "bug" --type task --status in-progress --priority high --plain\n```\n\n---\n\n## Multi-line Input (Bash/Zsh)\n\n```bash\nknowns task edit <id> --plan $\'1. Step\\n2. Step\\n3. Step\'\n```\n';
33359
+ // src/templates/guidelines/cli/context-optimization.md
33360
+ var context_optimization_default = '# Context Optimization\n\nOptimize your context usage to work more efficiently within token limits.\n\n---\n\n## Output Format\n\n```bash\n# \u274C Verbose output\nknowns task 42 --json\n\n# \u2705 Compact output (always use --plain)\nknowns task 42 --plain\n```\n\n---\n\n## Search Before Read\n\n```bash\n# \u274C Reading all docs to find info\nknowns doc "doc1" --plain\nknowns doc "doc2" --plain\nknowns doc "doc3" --plain\n\n# \u2705 Search first, then read only relevant docs\nknowns search "authentication" --type doc --plain\nknowns doc "security-patterns" --plain # Only the relevant one\n```\n\n---\n\n## Selective File Reading\n\n```bash\n# \u274C Reading entire large file\nRead file (2000+ lines)\n\n# \u2705 Read specific sections\nRead file with offset=100 limit=50\n```\n\n---\n\n## Large Documents (--info, --toc, --section)\n\nFor large documents, check size first with `--info`:\n\n```bash\n# \u274C Reading entire large document (may be truncated)\nknowns doc readme --plain\n\n# \u2705 Step 1: Check document size first\nknowns doc readme --info --plain\n# Output: Size: 42,461 chars (~12,132 tokens) | Headings: 83\n\n# \u2705 Step 2: View table of contents (if >2000 tokens)\nknowns doc readme --toc --plain\n\n# \u2705 Step 3: Read only the section you need\nknowns doc readme --section "3. Config" --plain\n```\n\n**Decision flow:** `--info` \u2192 check tokens \u2192 if >2000, use `--toc` then `--section`\n\n---\n\n## Compact Notes\n\n```bash\n# \u274C Verbose notes\nknowns task edit 42 --append-notes "I have successfully completed the implementation of the authentication middleware which validates JWT tokens and handles refresh logic..."\n\n# \u2705 Compact notes\nknowns task edit 42 --append-notes "\u2713 Auth middleware + JWT validation done"\n```\n\n---\n\n## Avoid Redundant Operations\n\n| Don\'t | Do Instead |\n| -------------------------------- | --------------------------- |\n| Re-read files already in context | Reference from memory |\n| List tasks/docs multiple times | List once, remember results |\n| Quote entire file contents | Summarize key points |\n| Repeat full error messages | Reference error briefly |\n\n---\n\n## Efficient Workflow\n\n| Phase | Context-Efficient Approach |\n| -------------- | ------------------------------ |\n| **Research** | Search \u2192 Read only matches |\n| **Planning** | Brief plan, not detailed prose |\n| **Coding** | Read only files being modified |\n| **Notes** | Bullet points, not paragraphs |\n| **Completion** | Summary, not full log |\n\n---\n\n## Quick Rules\n\n1. **Always `--plain`** - Never use `--json` unless specifically needed\n2. **Search first** - Don\'t read all docs hoping to find info\n3. **Read selectively** - Use offset/limit for large files\n4. **Use --info first** - Check doc size before reading, then --toc/--section if needed\n5. **Write concise** - Compact notes, not essays\n6. **Don\'t repeat** - Reference context already loaded\n7. **Summarize** - Key points, not full quotes\n';
33132
33361
 
33133
- // src/templates/guidelines/workflow-completion.md
33362
+ // src/templates/guidelines/cli/core-rules.md
33363
+ var core_rules_default = '# Core Rules\n\nYou MUST follow these rules. If you cannot follow any rule, stop and ask for guidance before proceeding.\n\n---\n\n## \u{1F3AF} The Golden Rule\n\n**If you want to change ANYTHING in a task or doc, use CLI commands or MCP tools. NEVER edit .md files directly.**\n\nWhy? Direct file editing breaks metadata synchronization, Git tracking, and relationships.\n\n---\n\n## \u26A0\uFE0F CRITICAL: The -a Flag Confusion\n\nThe `-a` flag means DIFFERENT things in different commands:\n\n| Command | `-a` Means | NOT This! |\n|---------|------------|-----------|\n| `task create` | `--assignee` (assign user) | ~~acceptance criteria~~ |\n| `task edit` | `--assignee` (assign user) | ~~acceptance criteria~~ |\n| `doc edit` | `--append` (append content) | ~~assignee~~ |\n\n### Acceptance Criteria: Use --ac\n\n```bash\n# \u274C WRONG: -a is assignee, NOT acceptance criteria!\nknowns task edit 35 -a "- [ ] Criterion" # Sets assignee to garbage!\nknowns task create "Title" -a "Criterion" # Sets assignee to garbage!\n\n# \u2705 CORRECT: Use --ac for acceptance criteria\nknowns task edit 35 --ac "Criterion one"\nknowns task edit 35 --ac "Criterion two"\nknowns task create "Title" --ac "Criterion one" --ac "Criterion two"\n```\n\n---\n\n## Core Principles\n\n| Rule | Description |\n|------|-------------|\n| **CLI/MCP Only** | Use commands for ALL operations. NEVER edit .md files directly |\n| **Docs First** | Read project docs BEFORE planning or coding |\n| **Time Tracking** | Always start timer when taking task, stop when done |\n| **Plan Approval** | Share plan with user, WAIT for approval before coding |\n| **Check AC After Work** | Only mark acceptance criteria done AFTER completing the work |\n\n---\n\n## The --plain Flag\n\n**ONLY for view/list/search commands (NOT create/edit):**\n\n```bash\n# \u2705 CORRECT\nknowns task <id> --plain\nknowns task list --plain\nknowns doc "path" --plain\nknowns doc list --plain\nknowns search "query" --plain\n\n# \u274C WRONG (create/edit don\'t support --plain)\nknowns task create "Title" --plain # ERROR!\nknowns task edit <id> -s done --plain # ERROR!\nknowns doc create "Title" --plain # ERROR!\nknowns doc edit "name" -c "..." --plain # ERROR!\n```\n\n---\n\n## Reference System\n\n| Context | Task Format | Doc Format |\n|---------|-------------|------------|\n| **Writing** (input) | `@task-<id>` | `@doc/<path>` |\n| **Reading** (output) | `@.knowns/tasks/task-<id>` | `@.knowns/docs/<path>.md` |\n\nFollow refs recursively until complete context gathered.\n\n---\n\n## Task IDs\n\n| Format | Example | Notes |\n|--------|---------|-------|\n| Sequential | `48`, `49` | Legacy numeric |\n| Hierarchical | `48.1`, `48.2` | Legacy subtasks |\n| Random | `qkh5ne` | Current (6-char) |\n\n**CRITICAL:** Use raw ID for `--parent`:\n```bash\n# \u2705 CORRECT\nknowns task create "Title" --parent 48\n\n# \u274C WRONG\nknowns task create "Title" --parent task-48\n```\n\n---\n\n## Status & Priority\n\n| Status | When |\n|--------|------|\n| `todo` | Not started (default) |\n| `in-progress` | Currently working |\n| `in-review` | PR submitted |\n| `blocked` | Waiting on dependency |\n| `done` | All criteria met |\n\n| Priority | Level |\n|----------|-------|\n| `low` | Nice-to-have |\n| `medium` | Normal (default) |\n| `high` | Urgent |\n';
33364
+
33365
+ // src/templates/guidelines/cli/workflow-completion.md
33134
33366
  var workflow_completion_default = '# Task Completion\n\n## Definition of Done\n\nA task is **Done** when ALL of these are complete:\n\n| Requirement | Command |\n|-------------|---------|\n| All AC checked | `knowns task edit <id> --check-ac N` |\n| Notes added | `knowns task edit <id> --notes "Summary"` |\n| Timer stopped | `knowns time stop` |\n| Status = done | `knowns task edit <id> -s done` |\n| Tests pass | Run test suite |\n\n---\n\n## Completion Steps\n\n```bash\n# 1. Verify all AC are checked\nknowns task <id> --plain\n\n# 2. Add implementation notes\nknowns task edit <id> --notes $\'## Summary\nWhat was done and key decisions.\'\n\n# 3. Stop timer (REQUIRED!)\nknowns time stop\n\n# 4. Mark done\nknowns task edit <id> -s done\n```\n\n---\n\n## Post-Completion Changes\n\nIf user requests changes after task is done:\n\n```bash\nknowns task edit <id> -s in-progress # Reopen\nknowns time start <id> # Restart timer\nknowns task edit <id> --ac "Fix: description"\nknowns task edit <id> --append-notes "\u{1F504} Reopened: reason"\n# Complete work, then follow completion steps again\n```\n\n---\n\n## Checklist\n\n- [ ] All AC checked (`--check-ac`)\n- [ ] Notes added (`--notes`)\n- [ ] Timer stopped (`time stop`)\n- [ ] Tests pass\n- [ ] Status = done (`-s done`)\n';
33135
33367
 
33136
- // src/templates/guidelines/workflow-creation.md
33368
+ // src/templates/guidelines/cli/workflow-creation.md
33137
33369
  var workflow_creation_default = '# Task Creation\n\n## Before Creating\n\n```bash\n# Search for existing tasks first\nknowns search "keyword" --type task --plain\n```\n\n---\n\n## Create Task\n\n```bash\nknowns task create "Clear title (WHAT)" \\\n -d "Description (WHY)" \\\n --ac "Outcome 1" \\\n --ac "Outcome 2" \\\n --priority medium \\\n -l "labels"\n```\n\n---\n\n## Quality Guidelines\n\n### Title\n| \u274C Bad | \u2705 Good |\n|--------|---------|\n| Do auth stuff | Add JWT authentication |\n| Fix bug | Fix login timeout |\n\n### Description\nExplain WHY. Include doc refs: `@doc/security-patterns`\n\n### Acceptance Criteria\n**Outcome-focused, NOT implementation steps:**\n\n| \u274C Bad | \u2705 Good |\n|--------|---------|\n| Add handleLogin() function | User can login |\n| Use bcrypt | Passwords are hashed |\n| Add try-catch | Errors return proper HTTP codes |\n\n---\n\n## Subtasks\n\n```bash\nknowns task create "Parent task"\nknowns task create "Subtask" --parent 48 # Raw ID only!\n```\n\n---\n\n## Anti-Patterns\n\n- \u274C Too many AC in one task \u2192 Split into multiple tasks\n- \u274C Implementation steps as AC \u2192 Write outcomes instead\n- \u274C Skip search \u2192 Always check existing tasks first\n';
33138
33370
 
33139
- // src/templates/guidelines/workflow-execution.md
33371
+ // src/templates/guidelines/cli/workflow-execution.md
33140
33372
  var workflow_execution_default = '# Task Execution\n\n## Step 1: Take Task\n\n```bash\nknowns task edit <id> -s in-progress -a @me\nknowns time start <id> # REQUIRED!\n```\n\n---\n\n## Step 2: Research\n\n```bash\n# Read task and follow ALL refs\nknowns task <id> --plain\n# @.knowns/docs/xxx.md \u2192 knowns doc "xxx" --plain\n# @.knowns/tasks/task-YY \u2192 knowns task YY --plain\n\n# Search related docs\nknowns search "keyword" --type doc --plain\n\n# Check similar done tasks\nknowns search "keyword" --type task --status done --plain\n```\n\n---\n\n## Step 3: Plan (BEFORE coding!)\n\n```bash\nknowns task edit <id> --plan $\'1. Research (see @doc/xxx)\n2. Implement\n3. Test\n4. Document\'\n```\n\n**\u26A0\uFE0F Share plan with user. WAIT for approval before coding.**\n\n---\n\n## Step 4: Implement\n\n```bash\n# Check AC only AFTER work is done\nknowns task edit <id> --check-ac 1\nknowns task edit <id> --append-notes "\u2713 Done: feature X"\n```\n\n---\n\n## Scope Changes\n\nIf new requirements emerge during work:\n\n```bash\n# Small: Add to current task\nknowns task edit <id> --ac "New requirement"\nknowns task edit <id> --append-notes "\u26A0\uFE0F Scope updated: reason"\n\n# Large: Ask user first, then create follow-up\nknowns task create "Follow-up: feature" -d "From task <id>"\n```\n\n**\u26A0\uFE0F Don\'t silently expand scope. Ask user first.**\n\n---\n\n## Key Rules\n\n1. **Plan before code** - Capture approach first\n2. **Wait for approval** - Don\'t start without OK\n3. **Check AC after work** - Not before\n4. **Ask on scope changes** - Don\'t expand silently\n';
33141
33373
 
33142
- // src/templates/guidelines/common-mistakes.md
33143
- var common_mistakes_default = '# Common Mistakes\n\n## \u26A0\uFE0F CRITICAL: The -a Flag\n\n| Command | `-a` Means | NOT This! |\n|---------|------------|-----------|\n| `task create/edit` | `--assignee` | ~~acceptance criteria~~ |\n| `doc edit` | `--append` | ~~assignee~~ |\n\n```bash\n# \u274C WRONG (sets assignee to garbage!)\nknowns task edit 35 -a "Criterion text"\n\n# \u2705 CORRECT (use --ac)\nknowns task edit 35 --ac "Criterion text"\n```\n\n---\n\n## Quick Reference\n\n| \u274C DON\'T | \u2705 DO |\n|----------|-------|\n| Edit .md files directly | Use CLI commands |\n| `-a "criterion"` | `--ac "criterion"` |\n| `--parent task-48` | `--parent 48` (raw ID) |\n| `--plain` with create/edit | `--plain` only for view/list |\n| Check AC before work done | Check AC AFTER work done |\n| Code before plan approval | Wait for user approval |\n| Code before reading docs | Read docs FIRST |\n| Skip time tracking | Always `time start`/`stop` |\n| Ignore task refs | Follow ALL `@.knowns/...` refs |\n\n---\n\n## Error Recovery\n\n| Problem | Solution |\n|---------|----------|\n| Set assignee to AC text | `knowns task edit <id> -a @me` |\n| Forgot to stop timer | `knowns time add <id> <duration>` |\n| Checked AC too early | `knowns task edit <id> --uncheck-ac N` |\n| Task not found | `knowns task list --plain` |\n';
33374
+ // src/templates/guidelines/cli/index.ts
33375
+ var CLI_CORE_RULES = core_rules_default.trim();
33376
+ var CLI_COMMANDS_REFERENCE = commands_reference_default.trim();
33377
+ var CLI_WORKFLOW_CREATION = workflow_creation_default.trim();
33378
+ var CLI_WORKFLOW_EXECUTION = workflow_execution_default.trim();
33379
+ var CLI_WORKFLOW_COMPLETION = workflow_completion_default.trim();
33380
+ var CLI_COMMON_MISTAKES = common_mistakes_default.trim();
33381
+ var CLI_CONTEXT_OPTIMIZATION = context_optimization_default.trim();
33382
+ var CLIGuidelines = {
33383
+ // Core rules - always needed
33384
+ core: CLI_CORE_RULES,
33385
+ // Commands reference
33386
+ commands: CLI_COMMANDS_REFERENCE,
33387
+ // Workflow stages
33388
+ workflow: {
33389
+ creation: CLI_WORKFLOW_CREATION,
33390
+ execution: CLI_WORKFLOW_EXECUTION,
33391
+ completion: CLI_WORKFLOW_COMPLETION
33392
+ },
33393
+ // Common mistakes
33394
+ mistakes: CLI_COMMON_MISTAKES,
33395
+ // Context optimization
33396
+ contextOptimization: CLI_CONTEXT_OPTIMIZATION,
33397
+ /**
33398
+ * Get full CLI guidelines (all sections combined)
33399
+ */
33400
+ getFull(withMarkers = false) {
33401
+ const content = [
33402
+ CLI_CORE_RULES,
33403
+ "---",
33404
+ CLI_CONTEXT_OPTIMIZATION,
33405
+ "---",
33406
+ CLI_COMMANDS_REFERENCE,
33407
+ "---",
33408
+ CLI_WORKFLOW_CREATION,
33409
+ "---",
33410
+ CLI_WORKFLOW_EXECUTION,
33411
+ "---",
33412
+ CLI_WORKFLOW_COMPLETION,
33413
+ "---",
33414
+ CLI_COMMON_MISTAKES
33415
+ ].join("\n\n");
33416
+ if (withMarkers) {
33417
+ return `<!-- KNOWNS GUIDELINES START -->
33418
+ ${content}
33419
+ <!-- KNOWNS GUIDELINES END -->`;
33420
+ }
33421
+ return content;
33422
+ },
33423
+ /**
33424
+ * Get compact CLI guidelines (core + context optimization + mistakes only)
33425
+ */
33426
+ getCompact() {
33427
+ return [CLI_CORE_RULES, "---", CLI_CONTEXT_OPTIMIZATION, "---", CLI_COMMON_MISTAKES].join("\n\n");
33428
+ },
33429
+ /**
33430
+ * Get CLI guidelines for specific workflow stage
33431
+ */
33432
+ getForStage(stage) {
33433
+ const sections = [CLI_CORE_RULES, "---", CLI_CONTEXT_OPTIMIZATION, "---"];
33434
+ switch (stage) {
33435
+ case "creation":
33436
+ sections.push(CLI_WORKFLOW_CREATION);
33437
+ break;
33438
+ case "execution":
33439
+ sections.push(CLI_WORKFLOW_EXECUTION);
33440
+ sections.push("---", CLI_COMMANDS_REFERENCE);
33441
+ break;
33442
+ case "completion":
33443
+ sections.push(CLI_WORKFLOW_COMPLETION);
33444
+ break;
33445
+ }
33446
+ sections.push("---", CLI_COMMON_MISTAKES);
33447
+ return sections.join("\n\n");
33448
+ }
33449
+ };
33144
33450
 
33145
- // src/templates/guidelines/context-optimization.md
33146
- var context_optimization_default = '# Context Optimization\n\nOptimize your context usage to work more efficiently within token limits.\n\n---\n\n## Output Format\n\n```bash\n# \u274C Verbose output\nknowns task 42 --json\n\n# \u2705 Compact output (always use --plain)\nknowns task 42 --plain\n```\n\n---\n\n## Search Before Read\n\n```bash\n# \u274C Reading all docs to find info\nknowns doc "doc1" --plain\nknowns doc "doc2" --plain\nknowns doc "doc3" --plain\n\n# \u2705 Search first, then read only relevant docs\nknowns search "authentication" --type doc --plain\nknowns doc "security-patterns" --plain # Only the relevant one\n```\n\n---\n\n## Selective File Reading\n\n```bash\n# \u274C Reading entire large file\nRead file (2000+ lines)\n\n# \u2705 Read specific sections\nRead file with offset=100 limit=50\n```\n\n---\n\n## Compact Notes\n\n```bash\n# \u274C Verbose notes\nknowns task edit 42 --append-notes "I have successfully completed the implementation of the authentication middleware which validates JWT tokens and handles refresh logic..."\n\n# \u2705 Compact notes\nknowns task edit 42 --append-notes "\u2713 Auth middleware + JWT validation done"\n```\n\n---\n\n## Avoid Redundant Operations\n\n| Don\'t | Do Instead |\n|-------|------------|\n| Re-read files already in context | Reference from memory |\n| List tasks/docs multiple times | List once, remember results |\n| Quote entire file contents | Summarize key points |\n| Repeat full error messages | Reference error briefly |\n\n---\n\n## Efficient Workflow\n\n| Phase | Context-Efficient Approach |\n|-------|---------------------------|\n| **Research** | Search \u2192 Read only matches |\n| **Planning** | Brief plan, not detailed prose |\n| **Coding** | Read only files being modified |\n| **Notes** | Bullet points, not paragraphs |\n| **Completion** | Summary, not full log |\n\n---\n\n## Quick Rules\n\n1. **Always `--plain`** - Never use `--json` unless specifically needed\n2. **Search first** - Don\'t read all docs hoping to find info\n3. **Read selectively** - Use offset/limit for large files\n4. **Write concise** - Compact notes, not essays\n5. **Don\'t repeat** - Reference context already loaded\n6. **Summarize** - Key points, not full quotes\n';
33451
+ // src/templates/guidelines/mcp/commands-reference.md
33452
+ var commands_reference_default2 = '# MCP Tools Reference\n\n## mcp**knowns**create_task\n\nCreate a new task.\n\n```json\n{\n "title": "Task title",\n "description": "Task description",\n "status": "todo",\n "priority": "medium",\n "labels": ["label1", "label2"],\n "assignee": "@me",\n "parent": "parent-task-id"\n}\n```\n\n| Parameter | Required | Description |\n| ------------- | -------- | --------------------------------------- |\n| `title` | Yes | Task title |\n| `description` | No | Task description |\n| `status` | No | todo/in-progress/in-review/blocked/done |\n| `priority` | No | low/medium/high |\n| `labels` | No | Array of labels |\n| `assignee` | No | Assignee (use @me for self) |\n| `parent` | No | Parent task ID for subtasks |\n\n**Note:** Acceptance criteria must be added via `mcp__knowns__update_task` after creation.\n\n---\n\n## mcp**knowns**update_task\n\nUpdate task fields.\n\n```json\n{\n "taskId": "abc123",\n "title": "New title",\n "description": "New description",\n "status": "in-progress",\n "priority": "high",\n "labels": ["updated"],\n "assignee": "@me"\n}\n```\n\n| Parameter | Required | Description |\n| ------------- | -------- | ----------------- |\n| `taskId` | Yes | Task ID to update |\n| `title` | No | New title |\n| `description` | No | New description |\n| `status` | No | New status |\n| `priority` | No | New priority |\n| `labels` | No | New labels array |\n| `assignee` | No | New assignee |\n\n**Note:** For acceptance criteria, implementation plan, and notes - use CLI commands or edit task file directly through knowns CLI.\n\n---\n\n## mcp**knowns**get_task\n\nGet a task by ID.\n\n```json\n{\n "taskId": "abc123"\n}\n```\n\n---\n\n## mcp**knowns**list_tasks\n\nList tasks with optional filters.\n\n```json\n{\n "status": "in-progress",\n "priority": "high",\n "assignee": "@me",\n "label": "bug"\n}\n```\n\nAll parameters are optional filters.\n\n---\n\n## mcp**knowns**search_tasks\n\nSearch tasks by query string.\n\n```json\n{\n "query": "authentication"\n}\n```\n\n---\n\n## mcp**knowns**get_doc\n\nGet a documentation file by path.\n\n```json\n{\n "path": "README"\n}\n```\n\nPath can be filename or folder/filename (without .md extension).\n\n### Large Documents (info, toc, section)\n\nFor large documents, check size first with `info`, then use `toc` and `section`:\n\n```json\n// Step 1: Check document size and token count\n{\n "path": "readme",\n "info": true\n}\n// Response: { stats: { chars: 42461, estimatedTokens: 12132, headingCount: 83 }, recommendation: "..." }\n\n// Step 2: Get table of contents\n{\n "path": "readme",\n "toc": true\n}\n\n// Step 3: Read specific section by title or number\n{\n "path": "readme",\n "section": "5. Sync"\n}\n```\n\n| Parameter | Description |\n| --------- | -------------------------------------------------------- |\n| `info` | Set `true` to get stats (size, tokens, headings) only |\n| `toc` | Set `true` to get table of contents only |\n| `section` | Section title or number to read (e.g., "5. Sync" or "3") |\n\n**Decision flow:**\n\n- `info: true` \u2192 Check estimatedTokens \u2192 If >2000, use toc/section\n- `toc: true` \u2192 Get heading list \u2192 Choose section to read\n- `section: "X"` \u2192 Read only what you need\n\n---\n\n## mcp**knowns**list_docs\n\nList all documentation files.\n\n```json\n{\n "tag": "api"\n}\n```\n\nOptional `tag` parameter to filter by tag.\n\n---\n\n## mcp**knowns**create_doc\n\nCreate a new documentation file.\n\n```json\n{\n "title": "Doc Title",\n "description": "Doc description",\n "tags": ["tag1", "tag2"],\n "folder": "guides",\n "content": "Initial content"\n}\n```\n\n### Document Structure Best Practice\n\nWhen creating/updating docs, use clear heading structure for `toc` and `section` to work properly:\n\n```markdown\n# Main Title (H1 - only one)\n\n## 1. Overview\n\nBrief introduction...\n\n## 2. Installation\n\nStep-by-step guide...\n\n## 3. Configuration\n\n### 3.1 Basic Config\n\n...\n\n### 3.2 Advanced Config\n\n...\n\n## 4. API Reference\n\n...\n```\n\n**Writing rules:**\n\n- Use numbered headings (`## 1. Overview`) for easy `section: "1"` access\n- Keep H1 for title only, use H2 for main sections\n- Use H3 for subsections within H2\n- Each section should be self-contained (readable without context)\n\n**Reading workflow:**\n\n```json\n// Step 1: Check size first\n{ "path": "<path>", "info": true }\n// \u2192 If estimatedTokens <2000: read directly (no options)\n// \u2192 If estimatedTokens >2000: continue to step 2\n\n// Step 2: Get table of contents\n{ "path": "<path>", "toc": true }\n\n// Step 3: Read specific section\n{ "path": "<path>", "section": "2" }\n```\n\n---\n\n## mcp**knowns**update_doc\n\nUpdate an existing documentation file.\n\n```json\n{\n "path": "README",\n "title": "New Title",\n "description": "New description",\n "tags": ["new", "tags"],\n "content": "Replace content",\n "appendContent": "Append to existing"\n}\n```\n\nUse either `content` (replace) or `appendContent` (append), not both.\n\n### Section Edit (Context-Efficient)\n\nReplace only a specific section instead of entire document:\n\n```json\n// Step 1: View TOC to find section\n{ "path": "readme", "toc": true }\n\n// Step 2: Edit only that section\n{\n "path": "readme",\n "section": "2. Installation",\n "content": "New content here..."\n}\n```\n\nThis reduces context usage significantly - no need to read/write entire document.\n\n---\n\n## mcp**knowns**search_docs\n\nSearch documentation by query.\n\n```json\n{\n "query": "authentication",\n "tag": "api"\n}\n```\n\n---\n\n## mcp**knowns**start_time\n\nStart time tracking for a task.\n\n```json\n{\n "taskId": "abc123"\n}\n```\n\n---\n\n## mcp**knowns**stop_time\n\nStop time tracking.\n\n```json\n{\n "taskId": "abc123"\n}\n```\n\n---\n\n## mcp**knowns**add_time\n\nManually add a time entry.\n\n```json\n{\n "taskId": "abc123",\n "duration": "2h30m",\n "note": "Optional note",\n "date": "2025-01-15"\n}\n```\n\n---\n\n## mcp**knowns**get_time_report\n\nGet time tracking report.\n\n```json\n{\n "from": "2025-01-01",\n "to": "2025-01-31",\n "groupBy": "task"\n}\n```\n\n`groupBy` can be: task, label, or status.\n\n---\n\n## mcp**knowns**get_board\n\nGet current board state with tasks grouped by status.\n\n```json\n{}\n```\n\nNo parameters required.\n';
33147
33453
 
33148
- // src/templates/guidelines/index.ts
33149
- var CORE_RULES = core_rules_default.trim();
33150
- var COMMANDS_REFERENCE = commands_reference_default.trim();
33151
- var WORKFLOW_CREATION = workflow_creation_default.trim();
33152
- var WORKFLOW_EXECUTION = workflow_execution_default.trim();
33153
- var WORKFLOW_COMPLETION = workflow_completion_default.trim();
33154
- var COMMON_MISTAKES = common_mistakes_default.trim();
33155
- var CONTEXT_OPTIMIZATION = context_optimization_default.trim();
33156
- var Guidelines = {
33454
+ // src/templates/guidelines/mcp/common-mistakes.md
33455
+ var common_mistakes_default2 = "# Common Mistakes (MCP)\n\n## Quick Reference\n\n| DON'T | DO |\n|-------|-----|\n| Edit .md files directly | Use MCP tools |\n| Skip time tracking | Always `start_time`/`stop_time` |\n| Check AC before work done | Check AC AFTER work done |\n| Code before plan approval | Wait for user approval |\n| Code before reading docs | Read docs FIRST |\n| Ignore task refs | Follow ALL `@.knowns/...` refs |\n| Use wrong task ID format | Use raw ID string |\n\n---\n\n## MCP vs CLI Usage\n\nSome operations require CLI (not available in MCP):\n\n| Operation | Tool |\n|-----------|------|\n| Add acceptance criteria | CLI: `--ac` |\n| Check/uncheck AC | CLI: `--check-ac`, `--uncheck-ac` |\n| Set implementation plan | CLI: `--plan` |\n| Add/append notes | CLI: `--notes`, `--append-notes` |\n| Create/update task basic fields | MCP tools |\n| Time tracking | MCP tools |\n| Read tasks/docs | MCP tools |\n| Search | MCP tools |\n\n---\n\n## Error Recovery\n\n| Problem | Solution |\n|---------|----------|\n| Forgot to stop timer | `mcp__knowns__add_time` with duration |\n| Wrong status | `mcp__knowns__update_task` to fix |\n| Task not found | `mcp__knowns__list_tasks` to find ID |\n| Need to uncheck AC | CLI: `knowns task edit <id> --uncheck-ac N` |\n";
33456
+
33457
+ // src/templates/guidelines/mcp/context-optimization.md
33458
+ var context_optimization_default2 = '# Context Optimization (MCP)\n\nOptimize your context usage to work more efficiently within token limits.\n\n---\n\n## Search Before Read\n\n```json\n// DON\'T: Read all docs hoping to find info\nmcp__knowns__get_doc({ "path": "doc1" })\nmcp__knowns__get_doc({ "path": "doc2" })\nmcp__knowns__get_doc({ "path": "doc3" })\n\n// DO: Search first, then read only relevant docs\nmcp__knowns__search_docs({ "query": "authentication" })\nmcp__knowns__get_doc({ "path": "security-patterns" }) // Only the relevant one\n```\n\n---\n\n## Use Filters\n\n```json\n// DON\'T: List all tasks then filter manually\nmcp__knowns__list_tasks({})\n\n// DO: Use filters in the query\nmcp__knowns__list_tasks({\n "status": "in-progress",\n "assignee": "@me"\n})\n```\n\n---\n\n## Large Documents (info, toc, section)\n\nFor large documents, check size first with `info`:\n\n```json\n// DON\'T: Read entire large document (may be truncated)\nmcp__knowns__get_doc({ "path": "readme" })\n\n// DO: Step 1 - Check document size first\nmcp__knowns__get_doc({ "path": "readme", "info": true })\n// Response: { stats: { estimatedTokens: 12132 }, recommendation: "..." }\n\n// DO: Step 2 - Get table of contents (if >2000 tokens)\nmcp__knowns__get_doc({ "path": "readme", "toc": true })\n\n// DO: Step 3 - Read only the section you need\nmcp__knowns__get_doc({ "path": "readme", "section": "3. Config" })\n```\n\n**Decision flow:** `info: true` \u2192 check tokens \u2192 if >2000, use `toc` then `section`\n\n---\n\n## Compact Notes\n\n```bash\n# DON\'T: Verbose notes\nknowns task edit 42 --append-notes "I have successfully completed the implementation..."\n\n# DO: Compact notes\nknowns task edit 42 --append-notes "Done: Auth middleware + JWT validation"\n```\n\n---\n\n## Avoid Redundant Operations\n\n| Don\'t | Do Instead |\n| ------------------------------------- | --------------------------- |\n| Re-read tasks/docs already in context | Reference from memory |\n| List tasks/docs multiple times | List once, remember results |\n| Fetch same task repeatedly | Cache the result |\n\n---\n\n## Efficient Workflow\n\n| Phase | Context-Efficient Approach |\n| -------------- | ------------------------------ |\n| **Research** | Search -> Read only matches |\n| **Planning** | Brief plan, not detailed prose |\n| **Coding** | Read only files being modified |\n| **Notes** | Bullet points, not paragraphs |\n| **Completion** | Summary, not full log |\n\n---\n\n## Quick Rules\n\n1. **Search first** - Don\'t read all docs hoping to find info\n2. **Use filters** - Don\'t list everything then filter manually\n3. **Read selectively** - Only fetch what you need\n4. **Use info first** - Check doc size before reading, then toc/section if needed\n5. **Write concise** - Compact notes, not essays\n6. **Don\'t repeat** - Reference context already loaded\n7. **Summarize** - Key points, not full quotes\n';
33459
+
33460
+ // src/templates/guidelines/mcp/core-rules.md
33461
+ var core_rules_default2 = "# Core Rules (MCP)\n\nYou MUST follow these rules. If you cannot follow any rule, stop and ask for guidance before proceeding.\n\n---\n\n## The Golden Rule\n\n**If you want to change ANYTHING in a task or doc, use MCP tools. NEVER edit .md files directly.**\n\nWhy? Direct file editing breaks metadata synchronization, Git tracking, and relationships.\n\n---\n\n## Core Principles\n\n| Rule | Description |\n|------|-------------|\n| **MCP Tools Only** | Use MCP tools for ALL operations. NEVER edit .md files directly |\n| **Docs First** | Read project docs BEFORE planning or coding |\n| **Time Tracking** | Always start timer when taking task, stop when done |\n| **Plan Approval** | Share plan with user, WAIT for approval before coding |\n| **Check AC After Work** | Only mark acceptance criteria done AFTER completing the work |\n\n---\n\n## Reference System\n\n| Context | Task Format | Doc Format |\n|---------|-------------|------------|\n| **Writing** (input) | `@task-<id>` | `@doc/<path>` |\n| **Reading** (output) | `@.knowns/tasks/task-<id>` | `@.knowns/docs/<path>.md` |\n\nFollow refs recursively until complete context gathered.\n\n---\n\n## Task IDs\n\n| Format | Example | Notes |\n|--------|---------|-------|\n| Sequential | `48`, `49` | Legacy numeric |\n| Hierarchical | `48.1`, `48.2` | Legacy subtasks |\n| Random | `qkh5ne` | Current (6-char) |\n\n**CRITICAL:** Use raw ID (string) for all MCP tool calls.\n\n---\n\n## Status & Priority\n\n| Status | When |\n|--------|------|\n| `todo` | Not started (default) |\n| `in-progress` | Currently working |\n| `in-review` | PR submitted |\n| `blocked` | Waiting on dependency |\n| `done` | All criteria met |\n\n| Priority | Level |\n|----------|-------|\n| `low` | Nice-to-have |\n| `medium` | Normal (default) |\n| `high` | Urgent |\n";
33462
+
33463
+ // src/templates/guidelines/mcp/workflow-completion.md
33464
+ var workflow_completion_default2 = '# Task Completion (MCP)\n\n## Definition of Done\n\nA task is **Done** when ALL of these are complete:\n\n| Requirement | How |\n|-------------|-----|\n| All AC checked | CLI: `knowns task edit <id> --check-ac N` |\n| Notes added | CLI: `knowns task edit <id> --notes "Summary"` |\n| Timer stopped | MCP: `mcp__knowns__stop_time` |\n| Status = done | MCP: `mcp__knowns__update_task` |\n| Tests pass | Run test suite |\n\n---\n\n## Completion Steps\n\n```json\n// 1. Verify all AC are checked\nmcp__knowns__get_task({ "taskId": "abc123" })\n```\n\n```bash\n# 2. Add implementation notes (use CLI)\nknowns task edit abc123 --notes $\'## Summary\nWhat was done and key decisions.\'\n```\n\n```json\n// 3. Stop timer (REQUIRED!)\nmcp__knowns__stop_time({ "taskId": "abc123" })\n\n// 4. Mark done\nmcp__knowns__update_task({\n "taskId": "abc123",\n "status": "done"\n})\n```\n\n---\n\n## Post-Completion Changes\n\nIf user requests changes after task is done:\n\n```json\n// 1. Reopen task\nmcp__knowns__update_task({\n "taskId": "abc123",\n "status": "in-progress"\n})\n\n// 2. Restart timer\nmcp__knowns__start_time({ "taskId": "abc123" })\n```\n\n```bash\n# 3. Add AC for the fix\nknowns task edit abc123 --ac "Fix: description"\nknowns task edit abc123 --append-notes "Reopened: reason"\n```\n\nThen follow completion steps again.\n\n---\n\n## Checklist\n\n- [ ] All AC checked (CLI `--check-ac`)\n- [ ] Notes added (CLI `--notes`)\n- [ ] Timer stopped (`mcp__knowns__stop_time`)\n- [ ] Tests pass\n- [ ] Status = done (`mcp__knowns__update_task`)\n';
33465
+
33466
+ // src/templates/guidelines/mcp/workflow-creation.md
33467
+ var workflow_creation_default2 = '# Task Creation (MCP)\n\n## Before Creating\n\n```json\n// Search for existing tasks first\nmcp__knowns__search_tasks({ "query": "keyword" })\n```\n\n---\n\n## Create Task\n\n```json\nmcp__knowns__create_task({\n "title": "Clear title (WHAT)",\n "description": "Description (WHY). Related: @doc/security-patterns",\n "priority": "medium",\n "labels": ["feature", "auth"]\n})\n```\n\n**Note:** Add acceptance criteria after creation using CLI:\n```bash\nknowns task edit <id> --ac "Outcome 1" --ac "Outcome 2"\n```\n\n---\n\n## Quality Guidelines\n\n### Title\n| Bad | Good |\n|-----|------|\n| Do auth stuff | Add JWT authentication |\n| Fix bug | Fix login timeout |\n\n### Description\nExplain WHY. Include doc refs: `@doc/security-patterns`\n\n### Acceptance Criteria\n**Outcome-focused, NOT implementation steps:**\n\n| Bad | Good |\n|-----|------|\n| Add handleLogin() function | User can login |\n| Use bcrypt | Passwords are hashed |\n| Add try-catch | Errors return proper HTTP codes |\n\n---\n\n## Subtasks\n\n```json\n// Create parent first\nmcp__knowns__create_task({ "title": "Parent task" })\n\n// Then create subtask with parent ID\nmcp__knowns__create_task({\n "title": "Subtask",\n "parent": "parent-task-id"\n})\n```\n\n---\n\n## Anti-Patterns\n\n- Too many AC in one task -> Split into multiple tasks\n- Implementation steps as AC -> Write outcomes instead\n- Skip search -> Always check existing tasks first\n';
33468
+
33469
+ // src/templates/guidelines/mcp/workflow-execution.md
33470
+ var workflow_execution_default2 = '# Task Execution (MCP)\n\n## Step 1: Take Task\n\n```json\n// Update status and assignee\nmcp__knowns__update_task({\n "taskId": "abc123",\n "status": "in-progress",\n "assignee": "@me"\n})\n\n// Start timer (REQUIRED!)\nmcp__knowns__start_time({ "taskId": "abc123" })\n```\n\n---\n\n## Step 2: Research\n\n```json\n// Read task and follow ALL refs\nmcp__knowns__get_task({ "taskId": "abc123" })\n\n// @.knowns/docs/xxx.md -> read the doc\nmcp__knowns__get_doc({ "path": "xxx" })\n\n// @.knowns/tasks/task-YY -> read the task\nmcp__knowns__get_task({ "taskId": "YY" })\n\n// Search related docs\nmcp__knowns__search_docs({ "query": "keyword" })\n\n// Check similar done tasks\nmcp__knowns__list_tasks({ "status": "done" })\n```\n\n---\n\n## Step 3: Plan (BEFORE coding!)\n\nUse CLI for implementation plan:\n```bash\nknowns task edit <id> --plan $\'1. Research (see @doc/xxx)\n2. Implement\n3. Test\n4. Document\'\n```\n\n**Share plan with user. WAIT for approval before coding.**\n\n---\n\n## Step 4: Implement\n\nUse CLI for checking acceptance criteria:\n```bash\n# Check AC only AFTER work is done\nknowns task edit <id> --check-ac 1\nknowns task edit <id> --append-notes "Done: feature X"\n```\n\n---\n\n## Scope Changes\n\nIf new requirements emerge during work:\n\n```bash\n# Small: Add to current task\nknowns task edit <id> --ac "New requirement"\nknowns task edit <id> --append-notes "Scope updated: reason"\n\n# Large: Ask user first, then create follow-up\n```\n\n```json\nmcp__knowns__create_task({\n "title": "Follow-up: feature",\n "description": "From task <id>"\n})\n```\n\n**Don\'t silently expand scope. Ask user first.**\n\n---\n\n## Key Rules\n\n1. **Plan before code** - Capture approach first\n2. **Wait for approval** - Don\'t start without OK\n3. **Check AC after work** - Not before\n4. **Ask on scope changes** - Don\'t expand silently\n';
33471
+
33472
+ // src/templates/guidelines/mcp/index.ts
33473
+ var MCP_CORE_RULES = core_rules_default2.trim();
33474
+ var MCP_COMMANDS_REFERENCE = commands_reference_default2.trim();
33475
+ var MCP_WORKFLOW_CREATION = workflow_creation_default2.trim();
33476
+ var MCP_WORKFLOW_EXECUTION = workflow_execution_default2.trim();
33477
+ var MCP_WORKFLOW_COMPLETION = workflow_completion_default2.trim();
33478
+ var MCP_COMMON_MISTAKES = common_mistakes_default2.trim();
33479
+ var MCP_CONTEXT_OPTIMIZATION = context_optimization_default2.trim();
33480
+ var MCPGuidelines = {
33157
33481
  // Core rules - always needed
33158
- core: CORE_RULES,
33482
+ core: MCP_CORE_RULES,
33159
33483
  // Commands reference
33160
- commands: COMMANDS_REFERENCE,
33484
+ commands: MCP_COMMANDS_REFERENCE,
33161
33485
  // Workflow stages
33162
33486
  workflow: {
33163
- creation: WORKFLOW_CREATION,
33164
- execution: WORKFLOW_EXECUTION,
33165
- completion: WORKFLOW_COMPLETION
33487
+ creation: MCP_WORKFLOW_CREATION,
33488
+ execution: MCP_WORKFLOW_EXECUTION,
33489
+ completion: MCP_WORKFLOW_COMPLETION
33166
33490
  },
33167
33491
  // Common mistakes
33168
- mistakes: COMMON_MISTAKES,
33492
+ mistakes: MCP_COMMON_MISTAKES,
33169
33493
  // Context optimization
33170
- contextOptimization: CONTEXT_OPTIMIZATION,
33494
+ contextOptimization: MCP_CONTEXT_OPTIMIZATION,
33171
33495
  /**
33172
- * Get full guidelines (all sections combined)
33496
+ * Get full MCP guidelines (all sections combined)
33173
33497
  */
33174
33498
  getFull(withMarkers = false) {
33175
33499
  const content = [
33176
- CORE_RULES,
33500
+ MCP_CORE_RULES,
33177
33501
  "---",
33178
- CONTEXT_OPTIMIZATION,
33502
+ MCP_CONTEXT_OPTIMIZATION,
33179
33503
  "---",
33180
- COMMANDS_REFERENCE,
33504
+ MCP_COMMANDS_REFERENCE,
33181
33505
  "---",
33182
- WORKFLOW_CREATION,
33506
+ MCP_WORKFLOW_CREATION,
33183
33507
  "---",
33184
- WORKFLOW_EXECUTION,
33508
+ MCP_WORKFLOW_EXECUTION,
33185
33509
  "---",
33186
- WORKFLOW_COMPLETION,
33510
+ MCP_WORKFLOW_COMPLETION,
33187
33511
  "---",
33188
- COMMON_MISTAKES
33512
+ MCP_COMMON_MISTAKES
33189
33513
  ].join("\n\n");
33190
33514
  if (withMarkers) {
33191
33515
  return `<!-- KNOWNS GUIDELINES START -->
@@ -33195,33 +33519,43 @@ ${content}
33195
33519
  return content;
33196
33520
  },
33197
33521
  /**
33198
- * Get compact guidelines (core + context optimization + mistakes only)
33522
+ * Get compact MCP guidelines (core + context optimization + mistakes only)
33199
33523
  */
33200
33524
  getCompact() {
33201
- return [CORE_RULES, "---", CONTEXT_OPTIMIZATION, "---", COMMON_MISTAKES].join("\n\n");
33525
+ return [MCP_CORE_RULES, "---", MCP_CONTEXT_OPTIMIZATION, "---", MCP_COMMON_MISTAKES].join("\n\n");
33202
33526
  },
33203
33527
  /**
33204
- * Get guidelines for specific workflow stage
33528
+ * Get MCP guidelines for specific workflow stage
33205
33529
  */
33206
33530
  getForStage(stage) {
33207
- const sections = [CORE_RULES, "---", CONTEXT_OPTIMIZATION, "---"];
33531
+ const sections = [MCP_CORE_RULES, "---", MCP_CONTEXT_OPTIMIZATION, "---"];
33208
33532
  switch (stage) {
33209
33533
  case "creation":
33210
- sections.push(WORKFLOW_CREATION);
33534
+ sections.push(MCP_WORKFLOW_CREATION);
33211
33535
  break;
33212
33536
  case "execution":
33213
- sections.push(WORKFLOW_EXECUTION);
33214
- sections.push("---", COMMANDS_REFERENCE);
33537
+ sections.push(MCP_WORKFLOW_EXECUTION);
33538
+ sections.push("---", MCP_COMMANDS_REFERENCE);
33215
33539
  break;
33216
33540
  case "completion":
33217
- sections.push(WORKFLOW_COMPLETION);
33541
+ sections.push(MCP_WORKFLOW_COMPLETION);
33218
33542
  break;
33219
33543
  }
33220
- sections.push("---", COMMON_MISTAKES);
33544
+ sections.push("---", MCP_COMMON_MISTAKES);
33221
33545
  return sections.join("\n\n");
33222
33546
  }
33223
33547
  };
33224
33548
 
33549
+ // src/templates/guidelines/index.ts
33550
+ var Guidelines = CLIGuidelines;
33551
+ var CORE_RULES = CLIGuidelines.core;
33552
+ var COMMANDS_REFERENCE = CLIGuidelines.commands;
33553
+ var WORKFLOW_CREATION = CLIGuidelines.workflow.creation;
33554
+ var WORKFLOW_EXECUTION = CLIGuidelines.workflow.execution;
33555
+ var WORKFLOW_COMPLETION = CLIGuidelines.workflow.completion;
33556
+ var COMMON_MISTAKES = CLIGuidelines.mistakes;
33557
+ var CONTEXT_OPTIMIZATION = CLIGuidelines.contextOptimization;
33558
+
33225
33559
  // src/mcp/handlers/guideline.ts
33226
33560
  var getGuidelineSchema = external_exports3.object({
33227
33561
  type: external_exports3.enum(["unified", "cli", "mcp"]).optional().default("unified")
@@ -33244,7 +33578,18 @@ var guidelineTools = [
33244
33578
  ];
33245
33579
  async function handleGetGuideline(args) {
33246
33580
  const input = getGuidelineSchema.parse(args || {});
33247
- const guidelines = Guidelines.getFull();
33581
+ let guidelines;
33582
+ switch (input.type) {
33583
+ case "mcp":
33584
+ guidelines = MCPGuidelines.getFull();
33585
+ break;
33586
+ case "cli":
33587
+ guidelines = Guidelines.getFull();
33588
+ break;
33589
+ default:
33590
+ guidelines = MCPGuidelines.getFull();
33591
+ break;
33592
+ }
33248
33593
  return {
33249
33594
  content: [
33250
33595
  {