@cassiomc1/forgeloop 1.12.0 → 1.13.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 (62) hide show
  1. package/.github/copilot-instructions.md +1 -1
  2. package/AGENTS.md +1 -1
  3. package/CLAUDE.md +1 -1
  4. package/CONTRIBUTING.md +90 -0
  5. package/DOCS_INDEX.md +13 -11
  6. package/ENG/c-development-eng.md +112 -0
  7. package/ENG/cpp-development-eng.md +109 -0
  8. package/ENG/dotnet-aspnetcore-development-eng.md +401 -0
  9. package/ENG/go-development-eng.md +103 -0
  10. package/ENG/java-development-eng.md +125 -0
  11. package/ENG/nodejs-backend-development-eng.md +605 -0
  12. package/ENG/php-development-eng.md +104 -0
  13. package/ENG/rust-development-eng.md +422 -0
  14. package/ENG/sql-development-eng.md +108 -0
  15. package/ENG/swift-development-eng.md +111 -0
  16. package/ENG/typescript-development-eng.md +108 -0
  17. package/GUIDE_ROUTER.md +418 -9
  18. package/QUALITY_SCORECARD.md +1 -0
  19. package/README.md +44 -33
  20. package/THIRD_PARTY_NOTICES.md +19 -7
  21. package/completions/_forgeloop +3 -3
  22. package/completions/forgeloop.bash +3 -3
  23. package/completions/forgeloop.fish +7 -0
  24. package/docs/AGENT_PROTOCOL_SUMMARY.md +55 -2
  25. package/docs/CLI_REFERENCE.md +28 -6
  26. package/docs/DOCUMENTATION_GUIDE.md +2 -1
  27. package/docs/GETTING_STARTED.md +59 -0
  28. package/docs/PACKAGE_CONTENTS.md +28 -14
  29. package/docs/RECIPES.md +23 -0
  30. package/docs/RELEASE_CHECKLIST.md +30 -2
  31. package/docs/TROUBLESHOOTING.md +100 -2
  32. package/docs/documentation-manifest.json +652 -0
  33. package/docs/protocol-requirements.json +77 -0
  34. package/package.json +19 -4
  35. package/schemas/routing-input.schema.json +1 -1
  36. package/scripts/CI_VALIDATORS.md +84 -11
  37. package/scripts/generate-agent-protocol-summary.mjs +36 -0
  38. package/src/commands/next.js +19 -7
  39. package/src/commands/task-create.js +84 -25
  40. package/src/commands/task-list.js +22 -2
  41. package/src/config/guides.json +44 -0
  42. package/src/core/build-script.js +151 -0
  43. package/src/core/c-cpp-project.js +143 -0
  44. package/src/core/cli-command-definitions.js +8 -1
  45. package/src/core/command-executors.js +5 -3
  46. package/src/core/command-input.js +140 -102
  47. package/src/core/contract-presets.js +82 -0
  48. package/src/core/error-codes.js +3 -3
  49. package/src/core/filesystem.js +1 -10
  50. package/src/core/go-project.js +206 -0
  51. package/src/core/java-project.js +403 -0
  52. package/src/core/multi-language-project.js +117 -0
  53. package/src/core/next-explanation.js +63 -0
  54. package/src/core/php-project.js +85 -0
  55. package/src/core/project-detection.js +1760 -52
  56. package/src/core/reconcile-closure.js +4 -1
  57. package/src/core/router.js +156 -3
  58. package/src/core/rust-project.js +400 -0
  59. package/src/core/sql-project.js +141 -0
  60. package/src/core/swift-project.js +200 -0
  61. package/src/core/typescript-project.js +349 -0
  62. package/src/core/xml-structure.js +123 -0
@@ -0,0 +1,123 @@
1
+ const DEFAULT_XML_MAX_BYTES = 1024 * 1024;
2
+
3
+ function findTagEnd(text, start) {
4
+ let quote = null;
5
+ for (let index = start; index < text.length; index += 1) {
6
+ const character = text[index];
7
+ if (quote) {
8
+ if (character === quote) quote = null;
9
+ } else if (character === "\"" || character === "'") {
10
+ quote = character;
11
+ } else if (character === ">") {
12
+ return index;
13
+ }
14
+ }
15
+ return -1;
16
+ }
17
+
18
+ function parseAttributes(text) {
19
+ const attributes = {};
20
+ let index = 0;
21
+ while (index < text.length) {
22
+ while (index < text.length && /\s/u.test(text[index])) index += 1;
23
+ if (index >= text.length) break;
24
+ const name = text.slice(index).match(/^[A-Za-z_][A-Za-z0-9_.:-]*/u)?.[0];
25
+ if (!name) return null;
26
+ index += name.length;
27
+ while (index < text.length && /\s/u.test(text[index])) index += 1;
28
+ if (text[index] !== "=") return null;
29
+ index += 1;
30
+ while (index < text.length && /\s/u.test(text[index])) index += 1;
31
+ const quote = text[index];
32
+ if (quote !== "\"" && quote !== "'") return null;
33
+ index += 1;
34
+ const end = text.indexOf(quote, index);
35
+ if (end < 0 || Object.prototype.hasOwnProperty.call(attributes, name)) return null;
36
+ attributes[name] = text.slice(index, end);
37
+ index = end + 1;
38
+ }
39
+ return attributes;
40
+ }
41
+
42
+ function appendText(stack, value) {
43
+ if (value === "") return true;
44
+ const current = stack[stack.length - 1];
45
+ if (!current) return value.trim() === "";
46
+ current.textParts.push(value);
47
+ return true;
48
+ }
49
+
50
+ function specialToken(text, start, stack) {
51
+ if (text.startsWith("<!--", start)) {
52
+ const end = text.indexOf("-->", start + 4);
53
+ return end < 0 ? { valid: false } : { valid: true, next: end + 3 };
54
+ }
55
+ if (text.startsWith("<![CDATA[", start)) {
56
+ const end = text.indexOf("]]>", start + 9);
57
+ if (end < 0 || stack.length === 0) return { valid: false };
58
+ stack[stack.length - 1].textParts.push(text.slice(start + 9, end));
59
+ return { valid: true, next: end + 3 };
60
+ }
61
+ if (text.startsWith("<?", start)) {
62
+ const end = text.indexOf("?>", start + 2);
63
+ return end < 0 ? { valid: false } : { valid: true, next: end + 2 };
64
+ }
65
+ if (text.startsWith("<!", start)) return { valid: false };
66
+ return null;
67
+ }
68
+
69
+ function closeNode(raw, state) {
70
+ const closing = raw.slice(1).trim().match(/^([A-Za-z_][A-Za-z0-9_.:-]*)\s*$/u)?.[1];
71
+ const open = state.stack.pop();
72
+ if (!closing || !open || open.name !== closing) return false;
73
+ open.text = open.textParts.join("");
74
+ if (state.stack.length === 0) {
75
+ if (state.rootClosed || open !== state.root) return false;
76
+ state.rootClosed = true;
77
+ }
78
+ return true;
79
+ }
80
+
81
+ function openNode(raw, state) {
82
+ const selfClosing = /\/\s*$/u.test(raw);
83
+ const body = selfClosing ? raw.replace(/\/\s*$/u, "").trimEnd() : raw;
84
+ const name = body.match(/^([A-Za-z_][A-Za-z0-9_.:-]*)/u)?.[1];
85
+ if (!name || (state.stack.length === 0 && (state.root || state.rootClosed))) return false;
86
+ if (!state.root && state.expectedRoot && name !== state.expectedRoot) return false;
87
+ const attributes = parseAttributes(body.slice(name.length).trim());
88
+ if (!attributes) return false;
89
+ const node = { name, attributes, textParts: [], children: [], text: "" };
90
+ state.nodes.push(node);
91
+ if (state.stack.length > 0) state.stack[state.stack.length - 1].children.push(node);
92
+ if (!state.root) state.root = node;
93
+ if (!selfClosing) state.stack.push(node);
94
+ else if (node === state.root) state.rootClosed = true;
95
+ return true;
96
+ }
97
+
98
+ export function parseXmlStructure(text, expectedRoot = null, maxBytes = DEFAULT_XML_MAX_BYTES) {
99
+ if (typeof text !== "string" || text.length > maxBytes || /\r(?!\n)/u.test(text)) return null;
100
+ const state = { nodes: [], stack: [], root: null, rootClosed: false, expectedRoot };
101
+ let index = 0;
102
+ while (index < text.length) {
103
+ const tagStart = text.indexOf("<", index);
104
+ if (tagStart < 0) break;
105
+ if (!appendText(state.stack, text.slice(index, tagStart))) return null;
106
+ const special = specialToken(text, tagStart, state.stack);
107
+ if (special) {
108
+ if (!special.valid) return null;
109
+ index = special.next;
110
+ continue;
111
+ }
112
+ const tagEnd = findTagEnd(text, tagStart + 1);
113
+ if (tagEnd < 0) return null;
114
+ const raw = text.slice(tagStart + 1, tagEnd).trim();
115
+ if (raw === "") return null;
116
+ const valid = raw.startsWith("/") ? closeNode(raw, state) : openNode(raw, state);
117
+ if (!valid) return null;
118
+ index = tagEnd + 1;
119
+ }
120
+ if (!appendText(state.stack, text.slice(index))) return null;
121
+ if (!state.root || state.stack.length > 0 || !state.rootClosed) return null;
122
+ return { root: state.root, nodes: state.nodes };
123
+ }