its-magic 0.1.2-9 → 0.1.3-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 (237) hide show
  1. package/README.md +1602 -755
  2. package/bin/its-magic.js +121 -11
  3. package/bin/postinstall.js +93 -0
  4. package/installer.ps1 +759 -0
  5. package/installer.py +1036 -0
  6. package/installer.sh +649 -0
  7. package/package.json +18 -14
  8. package/scripts/check_intake_template_parity.py +312 -0
  9. package/scripts/doc_profile_lib.py +415 -0
  10. package/scripts/guard_installer_publish.py +88 -0
  11. package/scripts/intake_bug_routing_guard.py +67 -0
  12. package/scripts/intake_evidence_lib.py +802 -0
  13. package/scripts/intake_evidence_validate.py +73 -0
  14. package/scripts/materialize_codebase_map.py +184 -0
  15. package/scripts/remote_config_summary.py +243 -0
  16. package/template/.cursor/agents/curator.mdc +35 -0
  17. package/template/.cursor/agents/dev.mdc +29 -0
  18. package/template/.cursor/agents/po.mdc +141 -0
  19. package/template/.cursor/agents/qa.mdc +28 -0
  20. package/template/.cursor/agents/release.mdc +28 -0
  21. package/template/.cursor/agents/security.mdc +98 -0
  22. package/template/.cursor/agents/tech-lead.mdc +57 -0
  23. package/template/.cursor/commands/architecture.md +127 -0
  24. package/template/.cursor/commands/ask.md +55 -0
  25. package/template/.cursor/commands/auto.md +533 -0
  26. package/template/.cursor/commands/discovery.md +47 -0
  27. package/template/.cursor/commands/execute.md +343 -0
  28. package/template/.cursor/commands/intake.md +323 -0
  29. package/template/.cursor/commands/map-codebase.md +46 -0
  30. package/template/.cursor/commands/memory-audit.md +175 -0
  31. package/template/.cursor/commands/milestone-complete.md +51 -0
  32. package/template/.cursor/commands/milestone-start.md +59 -0
  33. package/template/.cursor/commands/pause.md +64 -0
  34. package/{.cursor/commands/gsd-phase-context.md → template/.cursor/commands/phase-context.md} +6 -2
  35. package/template/.cursor/commands/plan-verify.md +34 -0
  36. package/template/.cursor/commands/qa.md +226 -0
  37. package/template/.cursor/commands/quick.md +41 -0
  38. package/template/.cursor/commands/refresh-context.md +82 -0
  39. package/template/.cursor/commands/release.md +523 -0
  40. package/template/.cursor/commands/research.md +49 -0
  41. package/template/.cursor/commands/resume.md +67 -0
  42. package/template/.cursor/commands/security-review.md +81 -0
  43. package/template/.cursor/commands/sprint-plan.md +103 -0
  44. package/template/.cursor/commands/status-reconcile.md +95 -0
  45. package/template/.cursor/commands/verify-work.md +152 -0
  46. package/template/.cursor/dev-environment.json.example +22 -0
  47. package/{.cursor → template/.cursor}/hooks/README.md +3 -2
  48. package/{.cursor/hooks/gsd-hook.py → template/.cursor/hooks/hook.py} +15 -6
  49. package/template/.cursor/hooks.json +26 -0
  50. package/template/.cursor/remote.json +31 -0
  51. package/template/.cursor/rules/caveman.mdc +184 -0
  52. package/template/.cursor/rules/coding-standards.mdc +39 -0
  53. package/template/.cursor/rules/core.mdc +111 -0
  54. package/template/.cursor/rules/handoffs.mdc +27 -0
  55. package/template/.cursor/rules/quality.mdc +49 -0
  56. package/template/.cursor/scratchpad.local.example.md +323 -0
  57. package/template/.cursor/scratchpad.md +324 -0
  58. package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/SKILL.md +2 -2
  59. package/template/.cursorignore +6 -0
  60. package/template/.env.example +28 -0
  61. package/template/.github/workflows/ci.yml +194 -0
  62. package/{.github → template/.github}/workflows/deploy.yml +5 -2
  63. package/template/.its-magic-version +1 -0
  64. package/template/CHANGELOG.md +11 -0
  65. package/template/README.md +1602 -0
  66. package/template/decisions/DEC-0001.md +11 -0
  67. package/template/decisions/DEC-0002.md +11 -0
  68. package/template/docs/developer/README.md +44 -0
  69. package/template/docs/engineering/architecture.md +9 -0
  70. package/template/docs/engineering/artifact-ordering-policy.md +48 -0
  71. package/template/docs/engineering/artifact-ownership-policy.md +57 -0
  72. package/template/docs/engineering/auto-orchestration-reference.md +1211 -0
  73. package/{docs → template/docs}/engineering/codebase-map.md +0 -5
  74. package/template/docs/engineering/compatibility-report.md +20 -0
  75. package/template/docs/engineering/compatibility-signals.md +7 -0
  76. package/template/docs/engineering/component-scope-report.md +16 -0
  77. package/template/docs/engineering/component-scope.md +19 -0
  78. package/template/docs/engineering/context/installer-owned-paths.manifest +96 -0
  79. package/template/docs/engineering/context/readme-section-affinity.json +30 -0
  80. package/template/docs/engineering/decisions.md +16 -0
  81. package/template/docs/engineering/legacy-drift-audit.md +21 -0
  82. package/template/docs/engineering/manifests/components/api-gateway.manifest.yaml +12 -0
  83. package/template/docs/engineering/manifests/registry.manifest.yaml +20 -0
  84. package/template/docs/engineering/manifests/repo.manifest.yaml +11 -0
  85. package/template/docs/engineering/phase-context.md +16 -0
  86. package/template/docs/engineering/release-targets.json +123 -0
  87. package/template/docs/engineering/research.md +29 -0
  88. package/template/docs/engineering/runbook.md +2391 -0
  89. package/template/docs/engineering/runtime-connectivity.md +81 -0
  90. package/template/docs/engineering/security-review.md +33 -0
  91. package/template/docs/engineering/spec-pack/README.md +20 -0
  92. package/template/docs/engineering/state-archive/README.md +15 -0
  93. package/template/docs/engineering/state.md +20 -0
  94. package/template/docs/engineering/status-normalization-report.md +19 -0
  95. package/template/docs/engineering/token-cost-parity-manifest.md +16 -0
  96. package/template/docs/engineering/us-0084-remote-e2e.md +44 -0
  97. package/template/docs/product/acceptance.md +1 -0
  98. package/template/docs/product/backlog.md +5 -0
  99. package/template/docs/product/vision.md +11 -0
  100. package/template/docs/user-guides/README.md +40 -0
  101. package/{handoffs → template/handoffs}/dev_to_qa.md +0 -3
  102. package/{handoffs → template/handoffs}/po_to_tl.md +0 -3
  103. package/{handoffs → template/handoffs}/qa_to_dev.md +1 -2
  104. package/template/handoffs/release_notes.md +51 -0
  105. package/template/handoffs/release_queue.md +47 -0
  106. package/template/handoffs/release_to_dev.md +31 -0
  107. package/template/handoffs/releases/Sxxxx-release-notes.md +62 -0
  108. package/template/handoffs/releases/vX.Y.Z-release-notes.md.example +21 -0
  109. package/template/handoffs/resume_brief.md +14 -0
  110. package/{handoffs → template/handoffs}/tl_to_dev.md +0 -2
  111. package/template/handoffs/token_cost_runs/README.md +26 -0
  112. package/template/its_magic/.its-magic-version +1 -0
  113. package/template/its_magic/README.md +9 -0
  114. package/template/scripts/auto_outer_driver.py +521 -0
  115. package/template/scripts/caveman_compress_input.py +903 -0
  116. package/template/scripts/check_downstream_ci_guard.py +67 -0
  117. package/template/scripts/check_intake_template_parity.py +312 -0
  118. package/template/scripts/check_token_cost_parity.py +69 -0
  119. package/template/scripts/dev_environment_lib.py +601 -0
  120. package/template/scripts/doc_profile_lib.py +415 -0
  121. package/template/scripts/downstream_ci_guard_lib.py +222 -0
  122. package/template/scripts/enforce-triad-hot-surface.py +753 -0
  123. package/template/scripts/guard_installer_publish.py +88 -0
  124. package/template/scripts/intake_bug_resume_brief_refresh.py +303 -0
  125. package/template/scripts/intake_bug_routing_guard.py +67 -0
  126. package/template/scripts/intake_evidence_lib.py +802 -0
  127. package/template/scripts/intake_evidence_validate.py +73 -0
  128. package/template/scripts/materialize_codebase_map.py +184 -0
  129. package/template/scripts/pack_json_validate.py +130 -0
  130. package/template/scripts/project_readme_coverage_lib.py +417 -0
  131. package/template/scripts/readme_feature_coverage_lib.py +608 -0
  132. package/{scripts → template/scripts}/release-all.sh +27 -4
  133. package/template/scripts/release_changelog_backfill.py +153 -0
  134. package/template/scripts/release_changelog_lib.py +544 -0
  135. package/template/scripts/release_changelog_validate.py +134 -0
  136. package/template/scripts/remote_config_summary.py +243 -0
  137. package/template/scripts/sync_push_gates.py +198 -0
  138. package/template/scripts/token_cost_compare.py +40 -0
  139. package/template/scripts/token_cost_lib.py +108 -0
  140. package/template/scripts/uat_probe_lib.py +868 -0
  141. package/template/scripts/validate-and-push.ps1 +280 -0
  142. package/template/scripts/validate-and-push.sh +243 -0
  143. package/template/scripts/validate_doc_profile.py +103 -0
  144. package/template/scripts/validate_project_readme_coverage.py +151 -0
  145. package/template/scripts/validate_readme_feature_coverage.py +140 -0
  146. package/template/sprints/S0001/progress.md +1 -0
  147. package/template/sprints/S0001/qa-findings.md +9 -0
  148. package/template/sprints/S0001/release-findings.md +24 -0
  149. package/template/sprints/S0001/sprint.md +9 -0
  150. package/template/sprints/S0001/summary.md +7 -0
  151. package/template/sprints/S0001/tasks.md +1 -0
  152. package/template/sprints/S0001/uat.json +6 -0
  153. package/template/sprints/S0001/uat.md +5 -0
  154. package/template/sprints/quick/Q0001/summary.md +1 -0
  155. package/{sprints → template/sprints}/quick/Q0001/task.json +0 -1
  156. package/.cursor/agents/curator.mdc +0 -21
  157. package/.cursor/agents/dev.mdc +0 -20
  158. package/.cursor/agents/po.mdc +0 -19
  159. package/.cursor/agents/qa.mdc +0 -19
  160. package/.cursor/agents/release.mdc +0 -19
  161. package/.cursor/agents/tech-lead.mdc +0 -21
  162. package/.cursor/commands/gsd-architecture.md +0 -29
  163. package/.cursor/commands/gsd-auto.md +0 -27
  164. package/.cursor/commands/gsd-discovery.md +0 -27
  165. package/.cursor/commands/gsd-execute.md +0 -32
  166. package/.cursor/commands/gsd-intake.md +0 -28
  167. package/.cursor/commands/gsd-map-codebase.md +0 -25
  168. package/.cursor/commands/gsd-milestone-complete.md +0 -24
  169. package/.cursor/commands/gsd-milestone-start.md +0 -26
  170. package/.cursor/commands/gsd-pause.md +0 -25
  171. package/.cursor/commands/gsd-plan-verify.md +0 -26
  172. package/.cursor/commands/gsd-qa.md +0 -28
  173. package/.cursor/commands/gsd-quick.md +0 -24
  174. package/.cursor/commands/gsd-refresh-context.md +0 -26
  175. package/.cursor/commands/gsd-release.md +0 -29
  176. package/.cursor/commands/gsd-research.md +0 -28
  177. package/.cursor/commands/gsd-resume.md +0 -26
  178. package/.cursor/commands/gsd-sprint-plan.md +0 -30
  179. package/.cursor/commands/gsd-verify-work.md +0 -25
  180. package/.cursor/hooks.json +0 -26
  181. package/.cursor/plans/cursor-gsd-team-kit_8cfee9b8.plan.md +0 -57
  182. package/.cursor/remote.json +0 -18
  183. package/.cursor/rules/gsd-core.mdc +0 -18
  184. package/.cursor/rules/gsd-handoffs.mdc +0 -10
  185. package/.cursor/rules/gsd-quality.mdc +0 -15
  186. package/.cursor/scratchpad.md +0 -34
  187. package/.github/workflows/ci.yml +0 -47
  188. package/decisions/DEC-0001.md +0 -21
  189. package/decisions/DEC-0002.md +0 -21
  190. package/docs/engineering/architecture.md +0 -354
  191. package/docs/engineering/decisions.md +0 -6
  192. package/docs/engineering/research.md +0 -11
  193. package/docs/engineering/runbook.md +0 -32
  194. package/docs/engineering/state.md +0 -33
  195. package/docs/product/acceptance.md +0 -6
  196. package/docs/product/backlog.md +0 -7
  197. package/docs/product/vision.md +0 -46
  198. package/gsd-installer.ps1 +0 -189
  199. package/gsd-installer.py +0 -195
  200. package/gsd-installer.sh +0 -201
  201. package/handoffs/release_notes.md +0 -14
  202. package/handoffs/resume_brief.md +0 -8
  203. package/milestones/M0001/milestone.json +0 -7
  204. package/milestones/M0001/phases.json +0 -9
  205. package/milestones/M0001/progress.md +0 -3
  206. package/milestones/M0001/summary.md +0 -3
  207. package/scripts/generate-release-notes.ps1 +0 -74
  208. package/scripts/generate-release-notes.sh +0 -63
  209. package/scripts/release-all.ps1 +0 -423
  210. package/sprints/S0001/progress.md +0 -4
  211. package/sprints/S0001/qa-findings.md +0 -113
  212. package/sprints/S0001/sprint.md +0 -70
  213. package/sprints/S0001/summary.md +0 -46
  214. package/sprints/S0001/tasks.md +0 -35
  215. package/sprints/S0001/uat.json +0 -8
  216. package/sprints/S0001/uat.md +0 -8
  217. package/sprints/quick/Q0001/summary.md +0 -3
  218. /package/{.cursor/rules/gsd-escalation.mdc → template/.cursor/rules/escalation.mdc} +0 -0
  219. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/acceptance.json +0 -0
  220. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/acceptance.md +0 -0
  221. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/architecture.json +0 -0
  222. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/architecture.md +0 -0
  223. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/decision.json +0 -0
  224. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/decision.md +0 -0
  225. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/handoff.json +0 -0
  226. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/handoff.md +0 -0
  227. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/milestone.json +0 -0
  228. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/phase-context.json +0 -0
  229. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/plan-verify.json +0 -0
  230. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/sprint.json +0 -0
  231. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/sprint.md +0 -0
  232. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/story.json +0 -0
  233. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/story.md +0 -0
  234. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/uat.json +0 -0
  235. /package/{docs → template/docs}/engineering/context/phase-template.json +0 -0
  236. /package/{docs → template/docs}/engineering/dependencies.json +0 -0
  237. /package/{sprints → template/sprints}/S0001/plan-verify.json +0 -0
package/bin/its-magic.js CHANGED
@@ -1,9 +1,52 @@
1
1
  #!/usr/bin/env node
2
2
  const path = require("path");
3
3
  const { spawnSync } = require("child_process");
4
+ const packageJson = require("../package.json");
5
+
6
+ const REPO_URL = "https://github.com/fl0wm0ti0n/its-magic";
7
+
8
+ function printBanner() {
9
+ const M = "\x1b[1;35m";
10
+ const C = "\x1b[1;36m";
11
+ const Y = "\x1b[1;33m";
12
+ const R = "\x1b[0m";
13
+ console.log("");
14
+ console.log(`${M} ██╗████████╗███████╗ ███╗ ███╗ █████╗ ██████╗ ██╗ ██████╗${R}`);
15
+ console.log(`${M} ██║╚══██╔══╝██╔════╝ ████╗ ████║██╔══██╗██╔════╝ ██║██╔════╝${R}`);
16
+ console.log(`${M} ██║ ██║ ███████╗█████╗██╔████╔██║███████║██║ ███╗██║██║ ${R}`);
17
+ console.log(`${C} ██║ ██║ ╚════██║╚════╝██║╚██╔╝██║██╔══██║██║ ██║██║██║ ${R}`);
18
+ console.log(`${C} ██║ ██║ ███████║ ██║ ╚═╝ ██║██║ ██║╚██████╔╝██║╚██████╗${R}`);
19
+ console.log(`${C} ╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝${R}`);
20
+ console.log("");
21
+ console.log(`${Y} AI dev team${R}`);
22
+ console.log("");
23
+ }
4
24
 
5
25
  function parseArgs(argv) {
6
- const args = { target: process.cwd(), mode: "missing", backup: false, create: false };
26
+ const args = {
27
+ target: process.cwd(),
28
+ mode: "missing",
29
+ backup: false,
30
+ create: false,
31
+ cleanRepo: false,
32
+ yes: false,
33
+ help: false,
34
+ version: false,
35
+ };
36
+
37
+ if (argv.length === 0) {
38
+ args.help = true;
39
+ return args;
40
+ }
41
+
42
+ const first = argv[0];
43
+ if (first === "help") return { ...args, help: true };
44
+ if (first === "version") return { ...args, version: true };
45
+ if (first === "clean") {
46
+ args.cleanRepo = true;
47
+ argv = argv.slice(1);
48
+ }
49
+
7
50
  for (let i = 0; i < argv.length; i += 1) {
8
51
  const a = argv[i];
9
52
  if (a === "--target" && argv[i + 1]) {
@@ -24,24 +67,83 @@ function parseArgs(argv) {
24
67
  args.create = true;
25
68
  continue;
26
69
  }
70
+ if (a === "--clean-repo") {
71
+ args.cleanRepo = true;
72
+ continue;
73
+ }
74
+ if (a === "--yes") {
75
+ args.yes = true;
76
+ continue;
77
+ }
27
78
  if (a === "--help" || a === "-h") {
28
- return { help: true };
79
+ args.help = true;
80
+ continue;
81
+ }
82
+ if (a === "--version" || a === "-v") {
83
+ args.version = true;
84
+ continue;
29
85
  }
30
86
  }
31
87
  return args;
32
88
  }
33
89
 
34
90
  function printHelp() {
35
- console.log(`its-magic
91
+ printBanner();
92
+ console.log(`its-magic v${packageJson.version}
93
+ Repository: ${REPO_URL}
94
+
95
+ Install AI dev team workflow files into any Cursor repository.
36
96
 
37
97
  Usage:
38
- npx its-magic --target <path> --mode missing [--backup] [--create]
98
+ its-magic --target <path> [--mode <mode>] [--backup] [--create]
99
+ its-magic --clean-repo [--target <path>] [--yes]
100
+ its-magic --help | --version
39
101
 
40
- Options:
41
- --target Target repository path (default: current directory)
42
- --mode missing | overwrite | interactive (default: missing)
43
- --backup Backup files before overwrite
44
- --create Create target directory if missing
102
+ Install options:
103
+ --target <path> Path to the repository where workflow files are installed.
104
+ If omitted you will be prompted interactively.
105
+ --mode <mode> How to handle files that already exist in the target:
106
+ missing Only copy files that do not exist yet (default).
107
+ Safe for repos that already have some workflow files.
108
+ overwrite Replace every file, even if it already exists.
109
+ Combine with --backup to keep a snapshot first.
110
+ interactive Ask per file whether to overwrite or skip.
111
+ upgrade Update framework files (commands, rules, agents,
112
+ hooks, skills, CI, scripts) while preserving user
113
+ data (docs, sprints, handoffs, decisions, runbook).
114
+ Use after updating its-magic to a newer version.
115
+ --backup Before overwriting, save existing files to backups/<timestamp>/.
116
+ Ignored when mode is "missing" (nothing gets replaced).
117
+ --create Create the target directory if it does not exist.
118
+ Note: installer bootstraps runbook TEST/LINT/TYPECHECK commands from
119
+ OS+stack detection; unresolved TEST_COMMAND fails fast with
120
+ [RUNBOOK_BOOTSTRAP_ERROR] diagnostics.
121
+ Note: scratchpad Model B: .cursor/scratchpad.md is materialized when missing;
122
+ post-install always refreshes .cursor/scratchpad.local.example.md from the
123
+ template before baseline handling. PowerShell/bash installers require
124
+ Python 3 on PATH for merged scratchpad validation. Recovery:
125
+ python installer.py --scratchpad-postinstall --target <repo> --mode missing
126
+
127
+ Clean options:
128
+ --clean-repo Remove all its-magic workflow artifacts from the target repo
129
+ (owned paths from installer manifest, including .cursor,
130
+ docs/product, docs/engineering, docs/user-guides, sprints,
131
+ handoffs, decisions, workflow scripts, CI files, and
132
+ installer metadata under its_magic/ (legacy .its-magic-version
133
+ is also removed when present). Your own source code is never touched.
134
+ --target <path> Repo to clean (default: current directory).
135
+ --yes Skip the confirmation prompt.
136
+
137
+ Info:
138
+ --help, -h Show this help and exit.
139
+ --version, -v Print the installed version and exit.
140
+
141
+ Examples:
142
+ its-magic --target . --mode missing Safe first-time setup
143
+ its-magic --target . --mode upgrade Update framework, keep user data
144
+ its-magic --target . --mode upgrade --backup Upgrade with backup of old files
145
+ its-magic --target . --mode overwrite --backup Replace all files, keep backup
146
+ its-magic --clean-repo --target . --yes Remove workflow artifacts silently
45
147
  `);
46
148
  }
47
149
 
@@ -50,12 +152,16 @@ if (args.help) {
50
152
  printHelp();
51
153
  process.exit(0);
52
154
  }
155
+ if (args.version) {
156
+ console.log(`its-magic v${packageJson.version}`);
157
+ process.exit(0);
158
+ }
53
159
 
54
160
  const root = path.resolve(__dirname, "..");
55
161
  const isWin = process.platform === "win32";
56
162
 
57
163
  if (isWin) {
58
- const installer = path.join(root, "gsd-installer.ps1");
164
+ const installer = path.join(root, "installer.ps1");
59
165
  const psArgs = [
60
166
  "-ExecutionPolicy",
61
167
  "Bypass",
@@ -68,10 +174,12 @@ if (isWin) {
68
174
  ];
69
175
  if (args.backup) psArgs.push("-Backup");
70
176
  if (args.create) psArgs.push("-Create");
177
+ if (args.cleanRepo) psArgs.push("-CleanRepo");
178
+ if (args.yes) psArgs.push("-Yes");
71
179
  const res = spawnSync("powershell", psArgs, { stdio: "inherit" });
72
180
  process.exit(res.status || 0);
73
181
  } else {
74
- const installer = path.join(root, "gsd-installer.sh");
182
+ const installer = path.join(root, "installer.sh");
75
183
  const shArgs = [
76
184
  installer,
77
185
  "--target",
@@ -81,6 +189,8 @@ if (isWin) {
81
189
  ];
82
190
  if (args.backup) shArgs.push("--backup");
83
191
  if (args.create) shArgs.push("--create");
192
+ if (args.cleanRepo) shArgs.push("--clean-repo");
193
+ if (args.yes) shArgs.push("--yes");
84
194
  const res = spawnSync("sh", shArgs, { stdio: "inherit" });
85
195
  process.exit(res.status || 0);
86
196
  }
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env node
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+ const { spawnSync } = require("child_process");
5
+
6
+ const M = "\x1b[1;35m";
7
+ const C = "\x1b[1;36m";
8
+ const Y = "\x1b[1;33m";
9
+ const G = "\x1b[1;32m";
10
+ const W = "\x1b[1;37m";
11
+ const R = "\x1b[0m";
12
+
13
+ console.log("");
14
+ console.log(`${M} ██╗████████╗███████╗ ███╗ ███╗ █████╗ ██████╗ ██╗ ██████╗${R}`);
15
+ console.log(`${M} ██║╚══██╔══╝██╔════╝ ████╗ ████║██╔══██╗██╔════╝ ██║██╔════╝${R}`);
16
+ console.log(`${M} ██║ ██║ ███████╗█████╗██╔████╔██║███████║██║ ███╗██║██║ ${R}`);
17
+ console.log(`${C} ██║ ██║ ╚════██║╚════╝██║╚██╔╝██║██╔══██║██║ ██║██║██║ ${R}`);
18
+ console.log(`${C} ██║ ██║ ███████║ ██║ ╚═╝ ██║██║ ██║╚██████╔╝██║╚██████╗${R}`);
19
+ console.log(`${C} ╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝${R}`);
20
+ console.log("");
21
+ console.log(`${Y} AI dev team${R}`);
22
+ console.log(`${G} Installation complete!${R}`);
23
+ console.log("");
24
+ console.log(`${W} Run: its-magic --help${R}`);
25
+ console.log("");
26
+
27
+ const pkgRoot = path.resolve(__dirname, "..");
28
+ const templateRoot = path.join(pkgRoot, "template");
29
+ const bootstrapScript = path.join(pkgRoot, "scripts", "dev_environment_lib.py");
30
+
31
+ function detectConsumerRepoRoot() {
32
+ let dir = process.cwd();
33
+ for (let depth = 0; depth <= 6; depth += 1) {
34
+ const scratchpad = path.join(dir, ".cursor", "scratchpad.md");
35
+ const versionSentinel = path.join(dir, "its_magic", ".its-magic-version");
36
+ if (fs.existsSync(scratchpad) || fs.existsSync(versionSentinel)) {
37
+ return dir;
38
+ }
39
+ const parent = path.dirname(dir);
40
+ if (parent === dir) {
41
+ break;
42
+ }
43
+ dir = parent;
44
+ }
45
+ return null;
46
+ }
47
+
48
+ function resolvePythonCommand() {
49
+ if (process.platform === "win32") {
50
+ return "python";
51
+ }
52
+ return "python3";
53
+ }
54
+
55
+ function runDevEnvBootstrap() {
56
+ const repoRoot = detectConsumerRepoRoot();
57
+ if (!repoRoot) {
58
+ console.log("[DEV_ENV_BOOTSTRAP_SKIP] no consumer repository detected");
59
+ return;
60
+ }
61
+ if (!fs.existsSync(bootstrapScript)) {
62
+ console.log(
63
+ "[DEV_ENV_BOOTSTRAP_ERROR] bootstrap helper missing; copy template/.cursor/dev-environment.json.example manually"
64
+ );
65
+ return;
66
+ }
67
+ const py = resolvePythonCommand();
68
+ const res = spawnSync(
69
+ py,
70
+ [
71
+ bootstrapScript,
72
+ "--bootstrap",
73
+ "--target",
74
+ repoRoot,
75
+ "--source-root",
76
+ templateRoot,
77
+ ],
78
+ { encoding: "utf-8" }
79
+ );
80
+ if (res.stdout) {
81
+ process.stdout.write(res.stdout);
82
+ }
83
+ if (res.stderr) {
84
+ process.stderr.write(res.stderr);
85
+ }
86
+ if (res.status === 1) {
87
+ console.log(
88
+ "[DEV_ENV_BOOTSTRAP_ERROR] bootstrap failed; copy template/.cursor/dev-environment.json.example to .cursor/dev-environment.json"
89
+ );
90
+ }
91
+ }
92
+
93
+ runDevEnvBootstrap();