@rudinmax87/united-we-stand 0.1.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 (169) hide show
  1. package/.united-we-stand/README.md +523 -0
  2. package/.united-we-stand/agents/0-status-checker.md +65 -0
  3. package/.united-we-stand/agents/1-initializer.md +48 -0
  4. package/.united-we-stand/agents/2-planner.md +44 -0
  5. package/.united-we-stand/agents/3-designer.md +50 -0
  6. package/.united-we-stand/agents/4-implementer.md +56 -0
  7. package/.united-we-stand/agents/5-code-reviewer.md +51 -0
  8. package/.united-we-stand/agents/6-finalizer.md +53 -0
  9. package/.united-we-stand/agents/accessibility-reviewer.md +15 -0
  10. package/.united-we-stand/agents/api-contract-writer.md +15 -0
  11. package/.united-we-stand/agents/data-modeler.md +15 -0
  12. package/.united-we-stand/agents/debugger.md +15 -0
  13. package/.united-we-stand/agents/documentation-writer.md +15 -0
  14. package/.united-we-stand/agents/migration-planner.md +15 -0
  15. package/.united-we-stand/agents/observability-reviewer.md +15 -0
  16. package/.united-we-stand/agents/performance-reviewer.md +15 -0
  17. package/.united-we-stand/agents/project-manager.md +15 -0
  18. package/.united-we-stand/agents/refactorer.md +15 -0
  19. package/.united-we-stand/agents/release-coordinator.md +15 -0
  20. package/.united-we-stand/agents/sql-database-designer.md +24 -0
  21. package/.united-we-stand/agents/test-strategist.md +15 -0
  22. package/.united-we-stand/agents/web-designer.md +19 -0
  23. package/.united-we-stand/agents-md-block.md +153 -0
  24. package/.united-we-stand/antigravity-workflow.md +15 -0
  25. package/.united-we-stand/copilot-instructions.md +15 -0
  26. package/.united-we-stand/cursor-rule.mdc +18 -0
  27. package/.united-we-stand/framework/00-index.md +53 -0
  28. package/.united-we-stand/framework/01-core-rules.md +157 -0
  29. package/.united-we-stand/framework/02-state-model.md +143 -0
  30. package/.united-we-stand/framework/03-stage-lifecycle.md +67 -0
  31. package/.united-we-stand/framework/04-command-routing.md +258 -0
  32. package/.united-we-stand/framework/05-conflict-resolution.md +41 -0
  33. package/.united-we-stand/framework/06-spec-writing-standard.md +156 -0
  34. package/.united-we-stand/framework/07-definition-of-done.md +52 -0
  35. package/.united-we-stand/framework/08-skip-force-policy.md +51 -0
  36. package/.united-we-stand/framework/09-traceability-model.md +37 -0
  37. package/.united-we-stand/framework/10-review-model.md +67 -0
  38. package/.united-we-stand/framework/11-glossary.md +16 -0
  39. package/.united-we-stand/framework/profiles/00-profile-selection.md +21 -0
  40. package/.united-we-stand/framework/profiles/api-service.md +11 -0
  41. package/.united-we-stand/framework/profiles/cli-tool.md +9 -0
  42. package/.united-we-stand/framework/profiles/csharp.md +10 -0
  43. package/.united-we-stand/framework/profiles/data-pipeline.md +9 -0
  44. package/.united-we-stand/framework/profiles/generic.md +37 -0
  45. package/.united-we-stand/framework/profiles/go.md +12 -0
  46. package/.united-we-stand/framework/profiles/java.md +11 -0
  47. package/.united-we-stand/framework/profiles/javascript-typescript.md +51 -0
  48. package/.united-we-stand/framework/profiles/library-package.md +10 -0
  49. package/.united-we-stand/framework/profiles/mobile-app.md +9 -0
  50. package/.united-we-stand/framework/profiles/php.md +10 -0
  51. package/.united-we-stand/framework/profiles/python.md +16 -0
  52. package/.united-we-stand/framework/profiles/ruby.md +10 -0
  53. package/.united-we-stand/framework/profiles/rust.md +11 -0
  54. package/.united-we-stand/framework/profiles/web-app.md +11 -0
  55. package/.united-we-stand/playbooks/00-index.md +19 -0
  56. package/.united-we-stand/playbooks/api-change.md +3 -0
  57. package/.united-we-stand/playbooks/bugfix.md +3 -0
  58. package/.united-we-stand/playbooks/data-model-change.md +3 -0
  59. package/.united-we-stand/playbooks/docs-only-change.md +3 -0
  60. package/.united-we-stand/playbooks/existing-feature-enhancement.md +3 -0
  61. package/.united-we-stand/playbooks/greenfield-feature.md +3 -0
  62. package/.united-we-stand/playbooks/migration.md +3 -0
  63. package/.united-we-stand/playbooks/refactor.md +3 -0
  64. package/.united-we-stand/playbooks/release-preparation.md +3 -0
  65. package/.united-we-stand/playbooks/security-hotfix.md +3 -0
  66. package/.united-we-stand/playbooks/ui-ux-change.md +3 -0
  67. package/.united-we-stand/spec-driven/branch-template/00-current-status.md +46 -0
  68. package/.united-we-stand/spec-driven/branch-template/01-init.md +24 -0
  69. package/.united-we-stand/spec-driven/branch-template/02-plan.md +19 -0
  70. package/.united-we-stand/spec-driven/branch-template/03-design.md +22 -0
  71. package/.united-we-stand/spec-driven/branch-template/04-implementation.md +19 -0
  72. package/.united-we-stand/spec-driven/branch-template/05-code-review.md +16 -0
  73. package/.united-we-stand/spec-driven/branch-template/06-finalization.md +22 -0
  74. package/.united-we-stand/spec-driven/branch-template/07-decisions.md +10 -0
  75. package/.united-we-stand/spec-driven/branch-template/08-traceability.md +7 -0
  76. package/.united-we-stand/spec-driven/branch-template/09-risks-issues.md +10 -0
  77. package/.united-we-stand/spec-driven/branch-template/10-test-strategy.md +16 -0
  78. package/.united-we-stand/spec-driven/branch-template/11-change-log.md +5 -0
  79. package/.united-we-stand/spec-driven/branch-template/12-handoff.md +10 -0
  80. package/.united-we-stand/spec-driven/branch-template/13-retrospective.md +10 -0
  81. package/.united-we-stand/spec-driven/branch-template/api/auth-boundaries.md +3 -0
  82. package/.united-we-stand/spec-driven/branch-template/api/contracts.md +3 -0
  83. package/.united-we-stand/spec-driven/branch-template/api/endpoints.md +3 -0
  84. package/.united-we-stand/spec-driven/branch-template/data/data-boundaries.md +3 -0
  85. package/.united-we-stand/spec-driven/branch-template/data/migrations.md +3 -0
  86. package/.united-we-stand/spec-driven/branch-template/data/schema-notes.md +3 -0
  87. package/.united-we-stand/spec-driven/branch-template/modules/example-module.md +12 -0
  88. package/.united-we-stand/spec-driven/branch-template/ux/copy-notes.md +3 -0
  89. package/.united-we-stand/spec-driven/branch-template/ux/screen-states.md +3 -0
  90. package/.united-we-stand/spec-driven/branch-template/ux/user-flows.md +3 -0
  91. package/.united-we-stand/steering/00-index.md +15 -0
  92. package/.united-we-stand/steering/architecture-steering.md +13 -0
  93. package/.united-we-stand/steering/coding-steering.md +77 -0
  94. package/.united-we-stand/steering/data-steering.md +31 -0
  95. package/.united-we-stand/steering/documentation-steering.md +11 -0
  96. package/.united-we-stand/steering/observability-steering.md +11 -0
  97. package/.united-we-stand/steering/product-steering.md +16 -0
  98. package/.united-we-stand/steering/repo-conventions.md +12 -0
  99. package/.united-we-stand/steering/security-steering.md +12 -0
  100. package/.united-we-stand/steering/testing-steering.md +11 -0
  101. package/.united-we-stand/steering/ux-steering.md +26 -0
  102. package/LICENSE +21 -0
  103. package/README.md +595 -0
  104. package/dist/cli.d.ts +7 -0
  105. package/dist/cli.d.ts.map +1 -0
  106. package/dist/cli.js +96 -0
  107. package/dist/cli.js.map +1 -0
  108. package/dist/commands/branch-init.d.ts +16 -0
  109. package/dist/commands/branch-init.d.ts.map +1 -0
  110. package/dist/commands/branch-init.js +337 -0
  111. package/dist/commands/branch-init.js.map +1 -0
  112. package/dist/commands/doctor.d.ts +17 -0
  113. package/dist/commands/doctor.d.ts.map +1 -0
  114. package/dist/commands/doctor.js +527 -0
  115. package/dist/commands/doctor.js.map +1 -0
  116. package/dist/commands/install.d.ts +18 -0
  117. package/dist/commands/install.d.ts.map +1 -0
  118. package/dist/commands/install.js +127 -0
  119. package/dist/commands/install.js.map +1 -0
  120. package/dist/commands/refresh.d.ts +17 -0
  121. package/dist/commands/refresh.d.ts.map +1 -0
  122. package/dist/commands/refresh.js +69 -0
  123. package/dist/commands/refresh.js.map +1 -0
  124. package/dist/index.d.ts +8 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.js +8 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/lib/branch-routing.d.ts +14 -0
  129. package/dist/lib/branch-routing.d.ts.map +1 -0
  130. package/dist/lib/branch-routing.js +62 -0
  131. package/dist/lib/branch-routing.js.map +1 -0
  132. package/dist/lib/branch.d.ts +12 -0
  133. package/dist/lib/branch.d.ts.map +1 -0
  134. package/dist/lib/branch.js +19 -0
  135. package/dist/lib/branch.js.map +1 -0
  136. package/dist/lib/fs.d.ts +37 -0
  137. package/dist/lib/fs.d.ts.map +1 -0
  138. package/dist/lib/fs.js +123 -0
  139. package/dist/lib/fs.js.map +1 -0
  140. package/dist/lib/git.d.ts +20 -0
  141. package/dist/lib/git.d.ts.map +1 -0
  142. package/dist/lib/git.js +87 -0
  143. package/dist/lib/git.js.map +1 -0
  144. package/dist/lib/github.d.ts +13 -0
  145. package/dist/lib/github.d.ts.map +1 -0
  146. package/dist/lib/github.js +105 -0
  147. package/dist/lib/github.js.map +1 -0
  148. package/dist/lib/logger.d.ts +26 -0
  149. package/dist/lib/logger.d.ts.map +1 -0
  150. package/dist/lib/logger.js +37 -0
  151. package/dist/lib/logger.js.map +1 -0
  152. package/dist/lib/markers.d.ts +25 -0
  153. package/dist/lib/markers.d.ts.map +1 -0
  154. package/dist/lib/markers.js +60 -0
  155. package/dist/lib/markers.js.map +1 -0
  156. package/dist/lib/package-version.d.ts +6 -0
  157. package/dist/lib/package-version.d.ts.map +1 -0
  158. package/dist/lib/package-version.js +18 -0
  159. package/dist/lib/package-version.js.map +1 -0
  160. package/dist/lib/runtime-state.d.ts +35 -0
  161. package/dist/lib/runtime-state.d.ts.map +1 -0
  162. package/dist/lib/runtime-state.js +131 -0
  163. package/dist/lib/runtime-state.js.map +1 -0
  164. package/dist/lib/templates.d.ts +88 -0
  165. package/dist/lib/templates.d.ts.map +1 -0
  166. package/dist/lib/templates.js +213 -0
  167. package/dist/lib/templates.js.map +1 -0
  168. package/package.json +57 -0
  169. package/public/united-we-stand-logo.png +0 -0
@@ -0,0 +1,87 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { existsSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ /**
5
+ * Checks whether the given directory is inside a git repository.
6
+ */
7
+ export function isGitRepository(targetDirectory) {
8
+ // Fast path: look for a .git directory at the target root.
9
+ if (existsSync(join(targetDirectory, '.git'))) {
10
+ return true;
11
+ }
12
+ // Fallback: ask git itself (handles worktrees and nested repos).
13
+ try {
14
+ execSync('git rev-parse --is-inside-work-tree', {
15
+ cwd: targetDirectory,
16
+ stdio: 'pipe',
17
+ encoding: 'utf-8',
18
+ });
19
+ return true;
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ }
25
+ /**
26
+ * Returns the current git branch name for the given directory.
27
+ * Returns null when the repository is in detached HEAD state or branch cannot be determined.
28
+ */
29
+ export function tryGetCurrentBranchName(targetDirectory) {
30
+ try {
31
+ const symbolicRef = execSync('git symbolic-ref --quiet --short HEAD', {
32
+ cwd: targetDirectory,
33
+ stdio: 'pipe',
34
+ encoding: 'utf-8',
35
+ }).trim();
36
+ return symbolicRef || null;
37
+ }
38
+ catch {
39
+ return null;
40
+ }
41
+ }
42
+ /**
43
+ * Returns the current git branch name for the given directory.
44
+ * Throws when the repository is in detached HEAD state.
45
+ */
46
+ export function getCurrentBranchName(targetDirectory) {
47
+ const branchName = tryGetCurrentBranchName(targetDirectory);
48
+ if (!branchName) {
49
+ throw new Error('Unable to determine current branch (detached HEAD).');
50
+ }
51
+ return branchName;
52
+ }
53
+ /**
54
+ * Returns the repository default branch name when `origin/HEAD` is available.
55
+ * Falls back to parsing `git remote show origin` when needed.
56
+ */
57
+ export function tryGetDefaultBranchName(targetDirectory) {
58
+ try {
59
+ const symbolicRef = execSync('git symbolic-ref --quiet --short refs/remotes/origin/HEAD', {
60
+ cwd: targetDirectory,
61
+ stdio: 'pipe',
62
+ encoding: 'utf-8',
63
+ }).trim();
64
+ if (symbolicRef.startsWith('origin/')) {
65
+ return symbolicRef.slice('origin/'.length) || null;
66
+ }
67
+ }
68
+ catch {
69
+ // Fall through to the slower remote-show parsing path.
70
+ }
71
+ try {
72
+ const remoteShowOutput = execSync('git remote show origin', {
73
+ cwd: targetDirectory,
74
+ stdio: 'pipe',
75
+ encoding: 'utf-8',
76
+ });
77
+ const headBranchMatch = remoteShowOutput.match(/HEAD branch:\s*(.+)/i);
78
+ if (headBranchMatch && headBranchMatch[1]) {
79
+ return headBranchMatch[1].trim() || null;
80
+ }
81
+ }
82
+ catch {
83
+ return null;
84
+ }
85
+ return null;
86
+ }
87
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/lib/git.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,eAAuB;IACnD,2DAA2D;IAC3D,IAAI,UAAU,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,iEAAiE;IACjE,IAAI,CAAC;QACD,QAAQ,CAAC,qCAAqC,EAAE;YAC5C,GAAG,EAAE,eAAe;YACpB,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,eAAuB;IAC3D,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,QAAQ,CAAC,uCAAuC,EAAE;YAClE,GAAG,EAAE,eAAe;YACpB,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC,IAAI,EAAE,CAAC;QAEV,OAAO,WAAW,IAAI,IAAI,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,eAAuB;IACxD,MAAM,UAAU,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAC5D,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,eAAuB;IAC3D,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,QAAQ,CAAC,2DAA2D,EAAE;YACtF,GAAG,EAAE,eAAe;YACpB,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC,IAAI,EAAE,CAAC;QAEV,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACpC,OAAO,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;QACvD,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,uDAAuD;IAC3D,CAAC;IAED,IAAI,CAAC;QACD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,wBAAwB,EAAE;YACxD,GAAG,EAAE,eAAe;YACpB,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC;QACH,MAAM,eAAe,GAAG,gBAAgB,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACvE,IAAI,eAAe,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;YACxC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;QAC7C,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * GitHub integration: attempts to star the united-we-stand-framework repository
3
+ * as a best-effort, non-blocking operation during init.
4
+ */
5
+ import type { Logger } from './logger.js';
6
+ /**
7
+ * Attempts to star the united-we-stand-framework repository on GitHub.
8
+ *
9
+ * Checks for GITHUB_TOKEN / GH_TOKEN env vars first, then falls back
10
+ * to the `gh` CLI. Logs the result in all cases.
11
+ */
12
+ export declare function tryStarRepository(logger: Logger): Promise<void>;
13
+ //# sourceMappingURL=github.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/lib/github.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQ1C;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAerE"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * GitHub integration: attempts to star the united-we-stand-framework repository
3
+ * as a best-effort, non-blocking operation during init.
4
+ */
5
+ import { execSync } from 'node:child_process';
6
+ import https from 'node:https';
7
+ const GITHUB_OWNER = 'mrudinal';
8
+ const GITHUB_REPO = 'united-we-stand-framework';
9
+ const GITHUB_REPO_DISPLAY = `${GITHUB_OWNER}/${GITHUB_REPO}`;
10
+ const API_TIMEOUT_MS = 5000;
11
+ const CLI_TIMEOUT_MS = 10000;
12
+ /**
13
+ * Attempts to star the united-we-stand-framework repository on GitHub.
14
+ *
15
+ * Checks for GITHUB_TOKEN / GH_TOKEN env vars first, then falls back
16
+ * to the `gh` CLI. Logs the result in all cases.
17
+ */
18
+ export async function tryStarRepository(logger) {
19
+ const authToken = getTokenFromEnvironment();
20
+ if (authToken) {
21
+ await starRepositoryViaRestApi(authToken, logger);
22
+ return;
23
+ }
24
+ if (isGitHubCliAuthenticated()) {
25
+ starRepositoryViaGitHubCli(logger);
26
+ return;
27
+ }
28
+ // No authentication method available.
29
+ logger.info('GitHub auth not detected, skipping repo star.');
30
+ }
31
+ // ---- Environment token extraction ----------------------------------
32
+ /**
33
+ * Reads a GitHub token from well-known environment variables.
34
+ */
35
+ function getTokenFromEnvironment() {
36
+ return process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN ?? null;
37
+ }
38
+ // ---- GitHub CLI authentication check -------------------------------
39
+ /**
40
+ * Checks whether the GitHub CLI (`gh`) is installed and authenticated.
41
+ */
42
+ function isGitHubCliAuthenticated() {
43
+ try {
44
+ execSync('gh auth status', { stdio: 'pipe', timeout: API_TIMEOUT_MS });
45
+ return true;
46
+ }
47
+ catch {
48
+ return false;
49
+ }
50
+ }
51
+ // ---- Star via REST API ---------------------------------------------
52
+ /**
53
+ * Stars the repository using the GitHub REST API with bearer token auth.
54
+ */
55
+ function starRepositoryViaRestApi(authToken, logger) {
56
+ return new Promise((resolve) => {
57
+ const requestOptions = {
58
+ hostname: 'api.github.com',
59
+ path: `/user/starred/${GITHUB_OWNER}/${GITHUB_REPO}`,
60
+ method: 'PUT',
61
+ headers: {
62
+ Authorization: `Bearer ${authToken}`,
63
+ Accept: 'application/vnd.github+json',
64
+ 'User-Agent': 'united-we-stand-cli',
65
+ 'X-GitHub-Api-Version': '2022-11-28',
66
+ 'Content-Length': '0',
67
+ },
68
+ };
69
+ const request = https.request(requestOptions, (response) => {
70
+ // 204 = starred successfully, 304 = was already starred.
71
+ if (response.statusCode === 204 || response.statusCode === 304) {
72
+ logger.success(`Project ${GITHUB_REPO_DISPLAY} successfully starred.`);
73
+ }
74
+ else {
75
+ logger.warn('Error during starring of the repo, skipping to the next step...');
76
+ }
77
+ response.resume();
78
+ resolve();
79
+ });
80
+ request.on('error', () => {
81
+ logger.warn('Error during starring of the repo, skipping to the next step...');
82
+ resolve();
83
+ });
84
+ request.setTimeout(API_TIMEOUT_MS, () => {
85
+ logger.warn('Error during starring of the repo, skipping to the next step...');
86
+ request.destroy();
87
+ resolve();
88
+ });
89
+ request.end();
90
+ });
91
+ }
92
+ // ---- Star via GitHub CLI -------------------------------------------
93
+ /**
94
+ * Stars the repository using the `gh` CLI tool.
95
+ */
96
+ function starRepositoryViaGitHubCli(logger) {
97
+ try {
98
+ execSync(`gh api -X PUT /user/starred/${GITHUB_OWNER}/${GITHUB_REPO}`, { stdio: 'pipe', timeout: CLI_TIMEOUT_MS });
99
+ logger.success(`Project ${GITHUB_REPO_DISPLAY} successfully starred.`);
100
+ }
101
+ catch {
102
+ logger.warn('Error during starring of the repo, skipping to the next step...');
103
+ }
104
+ }
105
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/lib/github.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,YAAY,CAAC;AAG/B,MAAM,YAAY,GAAG,UAAU,CAAC;AAChC,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAChD,MAAM,mBAAmB,GAAG,GAAG,YAAY,IAAI,WAAW,EAAE,CAAC;AAC7D,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAc;IAClD,MAAM,SAAS,GAAG,uBAAuB,EAAE,CAAC;IAE5C,IAAI,SAAS,EAAE,CAAC;QACZ,MAAM,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO;IACX,CAAC;IAED,IAAI,wBAAwB,EAAE,EAAE,CAAC;QAC7B,0BAA0B,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;IACX,CAAC;IAED,sCAAsC;IACtC,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;AACjE,CAAC;AAED,uEAAuE;AAEvE;;GAEG;AACH,SAAS,uBAAuB;IAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC;AACpE,CAAC;AAED,uEAAuE;AAEvE;;GAEG;AACH,SAAS,wBAAwB;IAC7B,IAAI,CAAC;QACD,QAAQ,CAAC,gBAAgB,EAAE,EA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AAG,EAAE;YACpC,MAAM,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;YAC/E,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,uEAAuE;AAEvE;;GAEG;AACH,SAAS,0BAA0B,CAAC,MAAc;IAC9C,IAAI,CAAC;QACD,QAAQ,CACJ,+BAA+B,YAAY,IAAI,WAAW,EAAE,EAC5D,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,CAC7C,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,WAAW,mBAAmB,wBAAwB,CAAC,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IACnF,CAAC;AACL,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Structured logger interface for CLI output with color-coded messages.
3
+ */
4
+ export interface Logger {
5
+ /** Log an informational message. */
6
+ info(message: string): void;
7
+ /** Log a success message. */
8
+ success(message: string): void;
9
+ /** Log a warning message. */
10
+ warn(message: string): void;
11
+ /** Log an error message. */
12
+ error(message: string): void;
13
+ /** Log that a file was created. */
14
+ created(filePath: string): void;
15
+ /** Log that a file was updated. */
16
+ updated(filePath: string): void;
17
+ /** Log that a file was skipped (no changes needed). */
18
+ skipped(filePath: string): void;
19
+ /** Log a pass/fail check result for doctor output. */
20
+ check(label: string, passed: boolean, detail?: string): void;
21
+ }
22
+ /**
23
+ * Creates a logger instance with optional dry-run prefix on all messages.
24
+ */
25
+ export declare function createLogger(isDryRun: boolean): Logger;
26
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,MAAM;IACnB,oCAAoC;IACpC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,6BAA6B;IAC7B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,6BAA6B;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,4BAA4B;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mCAAmC;IACnC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mCAAmC;IACnC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,uDAAuD;IACvD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,sDAAsD;IACtD,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAuCtD"}
@@ -0,0 +1,37 @@
1
+ import chalk from 'chalk';
2
+ /**
3
+ * Creates a logger instance with optional dry-run prefix on all messages.
4
+ */
5
+ export function createLogger(isDryRun) {
6
+ const dryRunPrefix = isDryRun ? chalk.yellow('[DRY RUN] ') : '';
7
+ return {
8
+ info(message) {
9
+ console.log(`${dryRunPrefix}${chalk.blue('ℹ')} ${message}`);
10
+ },
11
+ success(message) {
12
+ console.log(`${dryRunPrefix}${chalk.green('✔')} ${message}`);
13
+ },
14
+ warn(message) {
15
+ console.log(`${dryRunPrefix}${chalk.yellow('⚠')} ${message}`);
16
+ },
17
+ error(message) {
18
+ console.error(`${dryRunPrefix}${chalk.red('✖')} ${message}`);
19
+ },
20
+ created(filePath) {
21
+ console.log(`${dryRunPrefix}${chalk.green('+')} ${chalk.dim('created')} ${filePath}`);
22
+ },
23
+ updated(filePath) {
24
+ console.log(`${dryRunPrefix}${chalk.cyan('~')} ${chalk.dim('updated')} ${filePath}`);
25
+ },
26
+ skipped(filePath) {
27
+ console.log(`${dryRunPrefix}${chalk.dim('-')} ${chalk.dim('skipped')} ${filePath}`);
28
+ },
29
+ check(label, passed, detail) {
30
+ const icon = passed ? chalk.green('✔') : chalk.red('✖');
31
+ const text = passed ? label : chalk.red(label);
32
+ const suffix = detail ? chalk.dim(` — ${detail}`) : '';
33
+ console.log(` ${icon} ${text}${suffix}`);
34
+ },
35
+ };
36
+ }
37
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAwB1B;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,QAAiB;IAC1C,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhE,OAAO;QACH,IAAI,CAAC,OAAe;YAChB,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,CAAC,OAAe;YACnB,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;QACjE,CAAC;QAED,IAAI,CAAC,OAAe;YAChB,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,KAAK,CAAC,OAAe;YACjB,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAA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inside
3
+ * user-owned files like AGENTS.md and .github/copilot-instructions.md.
4
+ */
5
+ export declare const MARKER_START = "<!-- united-we-stand:start -->";
6
+ export declare const MARKER_END = "<!-- united-we-stand:end -->";
7
+ /**
8
+ * Checks whether the given content string contains a managed block.
9
+ */
10
+ export declare function hasManagedBlock(content: string): boolean;
11
+ /**
12
+ * Wraps inner content with the managed block start/end markers.
13
+ */
14
+ export declare function wrapInManagedBlock(innerContent: string): string;
15
+ /**
16
+ * Inserts or replaces the managed block inside existing file content.
17
+ *
18
+ * Behavior:
19
+ * - If both markers are found → replaces everything between them (inclusive).
20
+ * - If neither marker is found → appends the block after a blank line.
21
+ * - If the file content is empty → returns just the block.
22
+ * - If only one marker is found (orphaned) → strips it and appends a fresh block.
23
+ */
24
+ export declare function upsertManagedBlock(existingContent: string, innerContent: string): string;
25
+ //# sourceMappingURL=markers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../src/lib/markers.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,YAAY,mCAAmC,CAAC;AAC7D,eAAO,MAAM,UAAU,iCAAiC,CAAC;AAEzD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAgCxF"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Managed-block markers used to fence united-we-stand content inside
3
+ * user-owned files like AGENTS.md and .github/copilot-instructions.md.
4
+ */
5
+ export const MARKER_START = '<!-- united-we-stand:start -->';
6
+ export const MARKER_END = '<!-- united-we-stand:end -->';
7
+ /**
8
+ * Checks whether the given content string contains a managed block.
9
+ */
10
+ export function hasManagedBlock(content) {
11
+ return content.includes(MARKER_START) && content.includes(MARKER_END);
12
+ }
13
+ /**
14
+ * Wraps inner content with the managed block start/end markers.
15
+ */
16
+ export function wrapInManagedBlock(innerContent) {
17
+ return `${MARKER_START}\n${innerContent.trimEnd()}\n${MARKER_END}`;
18
+ }
19
+ /**
20
+ * Inserts or replaces the managed block inside existing file content.
21
+ *
22
+ * Behavior:
23
+ * - If both markers are found → replaces everything between them (inclusive).
24
+ * - If neither marker is found → appends the block after a blank line.
25
+ * - If the file content is empty → returns just the block.
26
+ * - If only one marker is found (orphaned) → strips it and appends a fresh block.
27
+ */
28
+ export function upsertManagedBlock(existingContent, innerContent) {
29
+ const wrappedBlock = wrapInManagedBlock(innerContent);
30
+ // Empty file: return just the managed block.
31
+ if (existingContent.length === 0) {
32
+ return wrappedBlock + '\n';
33
+ }
34
+ // Orphaned marker: one marker is present without its pair.
35
+ // Strip the stray marker so the block can be cleanly appended.
36
+ const hasStart = existingContent.includes(MARKER_START);
37
+ const hasEnd = existingContent.includes(MARKER_END);
38
+ let sanitizedContent = existingContent;
39
+ if (hasStart !== hasEnd) {
40
+ const orphanedMarker = hasStart ? MARKER_START : MARKER_END;
41
+ sanitizedContent = existingContent
42
+ .replace(orphanedMarker, '')
43
+ .replace(/\n{3,}/g, '\n\n');
44
+ }
45
+ // Existing managed block found: replace it in-place.
46
+ if (hasManagedBlock(sanitizedContent)) {
47
+ const markerPattern = new RegExp(`${escapeRegExpChars(MARKER_START)}[\\s\\S]*?${escapeRegExpChars(MARKER_END)}`, 'm');
48
+ return sanitizedContent.replace(markerPattern, wrappedBlock);
49
+ }
50
+ // No managed block present: append with a blank line separator.
51
+ const separator = sanitizedContent.endsWith('\n') ? '\n' : '\n\n';
52
+ return sanitizedContent + separator + wrappedBlock + '\n';
53
+ }
54
+ /**
55
+ * Escapes special regex characters in a string for safe use in RegExp constructors.
56
+ */
57
+ function escapeRegExpChars(rawString) {
58
+ return rawString.replace(/[.*+?^${}()|[\]\\]/g, '\\$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AM,CAAC,CAAC;IACpC,CAAC;IAED,qDAAqD;IACrD,IAAI,eAAe,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACpC,MAAM,aAAa,GAAG,IAAI,MAAM,CAC5B,GAAG,iBAAiB,CAAC,YAAY,CAAC,aAAa,iBAAiB,CAAC,UAAU,CAAC,EAAE,EAC9E,GAAG,CACN,CAAC;QACF,OAAO,gBAAgB,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC;IAED,gEAAgE;IAChE,MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IAClE,OAAO,gBAAgB,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,SAAiB;IACxC,OAAO,SAAS,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Reads the package version from the package manifest so the CLI uses the same
3
+ * single source of truth as publishing.
4
+ */
5
+ export declare function readPackageVersion(): string;
6
+ //# sourceMappingURL=package-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/lib/package-version.tsx"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAW3C"}
@@ -0,0 +1,18 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ /**
5
+ * Reads the package version from the package manifest so the CLI uses the same
6
+ * single source of truth as publishing.
7
+ */
8
+ export function readPackageVersion() {
9
+ const currentFilePath = fileURLToPath(import.meta.url);
10
+ const currentDirectory = dirname(currentFilePath);
11
+ const packageJsonPath = join(currentDirectory, '..', '..', 'package.json');
12
+ const packageManifest = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
13
+ if (typeof packageManifest.version !== 'string' || packageManifest.version.trim().length === 0) {
14
+ throw new Error(`Package version is missing or invalid in ${packageJsonPath}.`);
15
+ }
16
+ return packageManifest.version;
17
+ }
18
+ //# sourceMappingURL=package-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/lib/package-version.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMzC;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAC9B,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAClD,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAC3E,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAoB,CAAC;IAE9F,IAAI,OAAO,eAAe,CAAC,OAAO,KAAK,QAAQ,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7F,MAAM,IAAI,KAAK,CAAC,4CAA4C,eAAe,GAAG,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,eAAe,CAAC,OAAO,CAAC;AACnC,CAAC"}
@@ -0,0 +1,35 @@
1
+ export interface BranchRuntimeState {
2
+ branchName: string;
3
+ sanitizedBranchName: string;
4
+ branchMemoryFolder: string;
5
+ currentStage: string;
6
+ completedSteps: string[];
7
+ incompletedStages: string[];
8
+ nextRecommendedStep: string;
9
+ lastUpdatedBy: string;
10
+ lastUpdatedAt: string;
11
+ initialized: boolean;
12
+ finalized: boolean;
13
+ }
14
+ export interface BuildInitializedBranchRuntimeStateOptions {
15
+ branchName: string;
16
+ sanitizedBranchName: string;
17
+ branchMemoryFolder: string;
18
+ }
19
+ /**
20
+ * Builds the initial runtime state for a newly created branch memory folder.
21
+ */
22
+ export declare function buildInitializedBranchRuntimeState(options: BuildInitializedBranchRuntimeStateOptions): BranchRuntimeState;
23
+ /**
24
+ * Parses a branch runtime state JSON document into a validated object shape.
25
+ */
26
+ export declare function parseBranchRuntimeState(rawContent: string): BranchRuntimeState | null;
27
+ /**
28
+ * Serializes branch runtime state into stable JSON text with a trailing newline.
29
+ */
30
+ export declare function serializeBranchRuntimeState(state: BranchRuntimeState): string;
31
+ /**
32
+ * Validates required fields and semantic invariants for branch runtime state.
33
+ */
34
+ export declare function validateBranchRuntimeState(state: BranchRuntimeState): string[];
35
+ //# sourceMappingURL=runtime-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-state.d.ts","sourceRoot":"","sources":["../../src/lib/runtime-state.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,yCAAyC;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAMD;;GAEG;AACH,wBAAgB,kCAAkC,CAC9C,OAAO,EAAE,yCAAyC,GACnD,kBAAkB,CAcpB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAuCrF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAE7E;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,EAAE,CA8D9E"}
@@ -0,0 +1,131 @@
1
+ function isClosedWorkflowState(state) {
2
+ return /^none$/i.test(state.currentStage) && state.finalized;
3
+ }
4
+ /**
5
+ * Builds the initial runtime state for a newly created branch memory folder.
6
+ */
7
+ export function buildInitializedBranchRuntimeState(options) {
8
+ return {
9
+ branchName: options.branchName,
10
+ sanitizedBranchName: options.sanitizedBranchName,
11
+ branchMemoryFolder: options.branchMemoryFolder,
12
+ currentStage: '1-initializer',
13
+ completedSteps: [],
14
+ incompletedStages: [],
15
+ nextRecommendedStep: '1-initializer',
16
+ lastUpdatedBy: '1-initializer',
17
+ lastUpdatedAt: new Date().toISOString(),
18
+ initialized: true,
19
+ finalized: false,
20
+ };
21
+ }
22
+ /**
23
+ * Parses a branch runtime state JSON document into a validated object shape.
24
+ */
25
+ export function parseBranchRuntimeState(rawContent) {
26
+ try {
27
+ const parsed = JSON.parse(rawContent);
28
+ if (!parsed || typeof parsed !== 'object') {
29
+ return null;
30
+ }
31
+ if (typeof parsed.branchName !== 'string'
32
+ || typeof parsed.sanitizedBranchName !== 'string'
33
+ || typeof parsed.branchMemoryFolder !== 'string'
34
+ || typeof parsed.currentStage !== 'string'
35
+ || !Array.isArray(parsed.completedSteps)
36
+ || !Array.isArray(parsed.incompletedStages)
37
+ || typeof parsed.nextRecommendedStep !== 'string'
38
+ || typeof parsed.lastUpdatedBy !== 'string'
39
+ || typeof parsed.lastUpdatedAt !== 'string'
40
+ || typeof parsed.initialized !== 'boolean'
41
+ || typeof parsed.finalized !== 'boolean') {
42
+ return null;
43
+ }
44
+ return {
45
+ branchName: parsed.branchName,
46
+ sanitizedBranchName: parsed.sanitizedBranchName,
47
+ branchMemoryFolder: parsed.branchMemoryFolder,
48
+ currentStage: parsed.currentStage,
49
+ completedSteps: parsed.completedSteps.filter((value) => typeof value === 'string'),
50
+ incompletedStages: parsed.incompletedStages.filter((value) => typeof value === 'string'),
51
+ nextRecommendedStep: parsed.nextRecommendedStep,
52
+ lastUpdatedBy: parsed.lastUpdatedBy,
53
+ lastUpdatedAt: parsed.lastUpdatedAt,
54
+ initialized: parsed.initialized,
55
+ finalized: parsed.finalized,
56
+ };
57
+ }
58
+ catch {
59
+ return null;
60
+ }
61
+ }
62
+ /**
63
+ * Serializes branch runtime state into stable JSON text with a trailing newline.
64
+ */
65
+ export function serializeBranchRuntimeState(state) {
66
+ return `${JSON.stringify(state, null, 2)}\n`;
67
+ }
68
+ /**
69
+ * Validates required fields and semantic invariants for branch runtime state.
70
+ */
71
+ export function validateBranchRuntimeState(state) {
72
+ const validationErrors = [];
73
+ const isClosedWorkflow = isClosedWorkflowState(state);
74
+ if (!state.branchName.trim()) {
75
+ validationErrors.push('branchName is empty.');
76
+ }
77
+ if (!state.sanitizedBranchName.trim()) {
78
+ validationErrors.push('sanitizedBranchName is empty.');
79
+ }
80
+ if (!state.branchMemoryFolder.trim()) {
81
+ validationErrors.push('branchMemoryFolder is empty.');
82
+ }
83
+ if (!state.currentStage.trim()) {
84
+ validationErrors.push('currentStage is empty.');
85
+ }
86
+ if (!state.nextRecommendedStep.trim()) {
87
+ validationErrors.push('nextRecommendedStep is empty.');
88
+ }
89
+ if (!state.lastUpdatedBy.trim()) {
90
+ validationErrors.push('lastUpdatedBy is empty.');
91
+ }
92
+ if (!state.lastUpdatedAt.trim() || Number.isNaN(Date.parse(state.lastUpdatedAt))) {
93
+ validationErrors.push('lastUpdatedAt is not a valid ISO date.');
94
+ }
95
+ if (state.sanitizedBranchName !== state.sanitizedBranchName.toLowerCase()) {
96
+ validationErrors.push('sanitizedBranchName must be lowercase.');
97
+ }
98
+ if (!isClosedWorkflow && /^none$/i.test(state.currentStage)) {
99
+ validationErrors.push('currentStage cannot be "none" unless the workflow is explicitly finalized.');
100
+ }
101
+ if (state.finalized && !/^none$/i.test(state.currentStage)) {
102
+ validationErrors.push('finalized workflow must use currentStage = "none".');
103
+ }
104
+ if (isClosedWorkflow && !/^none$/i.test(state.nextRecommendedStep)) {
105
+ validationErrors.push('finalized workflow must use nextRecommendedStep = "none".');
106
+ }
107
+ if (!isClosedWorkflow && /^none$/i.test(state.nextRecommendedStep)) {
108
+ validationErrors.push('nextRecommendedStep cannot be "none" unless the workflow is explicitly finalized.');
109
+ }
110
+ if (state.finalized && !state.completedSteps.includes('6-finalizer')) {
111
+ validationErrors.push('finalized workflow must record "6-finalizer" in completedSteps.');
112
+ }
113
+ const completedSet = new Set(state.completedSteps);
114
+ const incompletedSet = new Set(state.incompletedStages);
115
+ if (completedSet.size !== state.completedSteps.length) {
116
+ validationErrors.push('completedSteps has duplicated values.');
117
+ }
118
+ if (incompletedSet.size !== state.incompletedStages.length) {
119
+ validationErrors.push('incompletedStages has duplicated values.');
120
+ }
121
+ if (!/^none$/i.test(state.currentStage) && (completedSet.has(state.currentStage) || incompletedSet.has(state.currentStage))) {
122
+ validationErrors.push('currentStage is duplicated in completedSteps or incompletedStages.');
123
+ }
124
+ for (const stageName of completedSet) {
125
+ if (incompletedSet.has(stageName)) {
126
+ validationErrors.push(`stage "${stageName}" exists in both completedSteps and incompletedStages.`);
127
+ }
128
+ }
129
+ return validationErrors;
130
+ }
131
+ //# sourceMappingURL=runtime-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-state.js","sourceRoot":"","sources":["../../src/lib/runtime-state.tsx"],"names":[],"mappings":"AAoBA,SAAS,qBAAqB,CAAC,KAAyB;IACpD,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY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