@laitszkin/apollo-toolkit 4.1.4 → 5.0.1

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 (205) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/bin/apollo-toolkit.ts +4 -0
  3. package/dist/bin/apollo-toolkit.js +4 -0
  4. package/package.json +3 -2
  5. package/packages/cli/dist/help-text-builder.d.ts +23 -0
  6. package/packages/cli/dist/help-text-builder.js +166 -0
  7. package/packages/cli/dist/index.d.ts +6 -17
  8. package/packages/cli/dist/index.js +52 -246
  9. package/packages/cli/dist/installer.d.ts +1 -0
  10. package/packages/cli/dist/installer.js +20 -7
  11. package/packages/cli/dist/parsers/install-parser.d.ts +15 -0
  12. package/packages/cli/dist/parsers/install-parser.js +87 -0
  13. package/packages/cli/dist/parsers/parser-utils.d.ts +9 -0
  14. package/packages/cli/dist/parsers/parser-utils.js +16 -0
  15. package/packages/cli/dist/parsers/tool-parser.d.ts +16 -0
  16. package/packages/cli/dist/parsers/tool-parser.js +58 -0
  17. package/packages/cli/dist/parsers/types.d.ts +50 -0
  18. package/packages/cli/dist/parsers/types.js +1 -0
  19. package/packages/cli/dist/parsers/uninstall-parser.d.ts +15 -0
  20. package/packages/cli/dist/parsers/uninstall-parser.js +67 -0
  21. package/packages/cli/dist/tool-registration.d.ts +2 -0
  22. package/packages/cli/dist/tool-registration.js +2 -0
  23. package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
  24. package/packages/cli/dist/types.d.ts +3 -1
  25. package/packages/cli/dist/updater.js +11 -5
  26. package/packages/cli/help-text-builder.ts +180 -0
  27. package/packages/cli/index.ts +59 -251
  28. package/packages/cli/installer.ts +19 -7
  29. package/packages/cli/package.json +14 -4
  30. package/packages/cli/parsers/install-parser.ts +94 -0
  31. package/packages/cli/parsers/parser-utils.ts +17 -0
  32. package/packages/cli/parsers/tool-parser.ts +65 -0
  33. package/packages/cli/parsers/types.ts +56 -0
  34. package/packages/cli/parsers/uninstall-parser.ts +75 -0
  35. package/packages/cli/tool-registration.ts +3 -0
  36. package/packages/cli/types.ts +6 -1
  37. package/packages/cli/updater.ts +11 -5
  38. package/packages/tool-registry/dist/registry.js +3 -4
  39. package/packages/tool-registry/dist/tsconfig.tsbuildinfo +1 -1
  40. package/packages/tool-registry/dist/types.d.ts +2 -9
  41. package/packages/tool-registry/package.json +11 -4
  42. package/packages/tool-registry/registry.ts +3 -4
  43. package/packages/tool-registry/tsconfig.json +6 -2
  44. package/packages/tool-registry/types.ts +3 -9
  45. package/packages/tool-utils/app-error.ts +97 -0
  46. package/packages/tool-utils/dist/app-error.d.ts +49 -0
  47. package/packages/tool-utils/dist/app-error.js +80 -0
  48. package/packages/tool-utils/dist/index.d.ts +5 -0
  49. package/packages/tool-utils/dist/index.js +3 -0
  50. package/packages/tool-utils/dist/platform-adapter.d.ts +48 -0
  51. package/packages/tool-utils/dist/platform-adapter.js +73 -0
  52. package/packages/tool-utils/dist/schema.d.ts +68 -0
  53. package/packages/tool-utils/dist/schema.js +67 -0
  54. package/packages/tool-utils/dist/tsconfig.tsbuildinfo +1 -1
  55. package/packages/tool-utils/index.ts +12 -0
  56. package/packages/tool-utils/package.json +11 -4
  57. package/packages/tool-utils/platform-adapter.ts +112 -0
  58. package/packages/tool-utils/schema.ts +122 -0
  59. package/packages/tools/architecture/dist/index.d.ts +13 -0
  60. package/packages/tools/architecture/dist/index.js +55 -57
  61. package/packages/tools/architecture/dist/index.test.js +17 -4
  62. package/packages/tools/architecture/dist/tsconfig.tsbuildinfo +1 -1
  63. package/packages/tools/architecture/index.test.ts +27 -14
  64. package/packages/tools/architecture/index.ts +85 -88
  65. package/packages/tools/architecture/package.json +11 -4
  66. package/packages/tools/codegraph/dist/index.js +12 -22
  67. package/packages/tools/codegraph/dist/tsconfig.tsbuildinfo +1 -1
  68. package/packages/tools/codegraph/index.ts +13 -22
  69. package/packages/tools/codegraph/package.json +11 -4
  70. package/packages/tools/create-review-report/dist/index.d.ts +1 -2
  71. package/packages/tools/create-review-report/dist/index.js +46 -77
  72. package/packages/tools/create-review-report/dist/tsconfig.tsbuildinfo +1 -1
  73. package/packages/tools/create-review-report/index.ts +52 -81
  74. package/packages/tools/create-review-report/package.json +11 -4
  75. package/packages/tools/create-specs/dist/index.d.ts +1 -2
  76. package/packages/tools/create-specs/dist/index.js +70 -123
  77. package/packages/tools/create-specs/dist/tsconfig.tsbuildinfo +1 -1
  78. package/packages/tools/create-specs/index.ts +82 -128
  79. package/packages/tools/create-specs/package.json +11 -4
  80. package/packages/tools/docs-to-voice/dist/index.d.ts +1 -2
  81. package/packages/tools/docs-to-voice/dist/index.js +116 -219
  82. package/packages/tools/docs-to-voice/dist/tsconfig.tsbuildinfo +1 -1
  83. package/packages/tools/docs-to-voice/index.ts +265 -385
  84. package/packages/tools/docs-to-voice/package.json +11 -4
  85. package/packages/tools/enforce-video-aspect-ratio/dist/index.d.ts +1 -2
  86. package/packages/tools/enforce-video-aspect-ratio/dist/index.js +77 -154
  87. package/packages/tools/enforce-video-aspect-ratio/dist/tsconfig.tsbuildinfo +1 -1
  88. package/packages/tools/enforce-video-aspect-ratio/index.ts +87 -172
  89. package/packages/tools/enforce-video-aspect-ratio/package.json +11 -4
  90. package/packages/tools/eval/dist/index.js +7 -0
  91. package/packages/tools/eval/dist/tsconfig.tsbuildinfo +1 -1
  92. package/packages/tools/eval/index.ts +8 -0
  93. package/packages/tools/eval/package.json +11 -4
  94. package/packages/tools/extract-conversations/dist/index.d.ts +1 -2
  95. package/packages/tools/extract-conversations/dist/index.js +31 -29
  96. package/packages/tools/extract-conversations/dist/tsconfig.tsbuildinfo +1 -1
  97. package/packages/tools/extract-conversations/index.ts +37 -30
  98. package/packages/tools/extract-conversations/package.json +11 -4
  99. package/packages/tools/extract-pdf-text/dist/index.d.ts +1 -2
  100. package/packages/tools/extract-pdf-text/dist/index.js +44 -65
  101. package/packages/tools/extract-pdf-text/dist/tsconfig.tsbuildinfo +1 -1
  102. package/packages/tools/extract-pdf-text/index.ts +55 -74
  103. package/packages/tools/extract-pdf-text/package.json +11 -4
  104. package/packages/tools/filter-logs/dist/index.js +60 -84
  105. package/packages/tools/filter-logs/dist/tsconfig.tsbuildinfo +1 -1
  106. package/packages/tools/filter-logs/index.ts +67 -97
  107. package/packages/tools/filter-logs/package.json +11 -4
  108. package/packages/tools/find-github-issues/dist/index.d.ts +10 -0
  109. package/packages/tools/find-github-issues/dist/index.js +34 -5
  110. package/packages/tools/find-github-issues/dist/tsconfig.tsbuildinfo +1 -1
  111. package/packages/tools/find-github-issues/index.ts +37 -5
  112. package/packages/tools/find-github-issues/package.json +11 -4
  113. package/packages/tools/generate-storyboard-images/dist/index.d.ts +1 -2
  114. package/packages/tools/generate-storyboard-images/dist/index.js +98 -173
  115. package/packages/tools/generate-storyboard-images/dist/tsconfig.tsbuildinfo +1 -1
  116. package/packages/tools/generate-storyboard-images/index.ts +100 -188
  117. package/packages/tools/generate-storyboard-images/package.json +11 -4
  118. package/packages/tools/open-github-issue/dist/index.d.ts +13 -0
  119. package/packages/tools/open-github-issue/dist/index.js +67 -68
  120. package/packages/tools/open-github-issue/dist/tsconfig.tsbuildinfo +1 -1
  121. package/packages/tools/open-github-issue/index.ts +71 -72
  122. package/packages/tools/open-github-issue/package.json +11 -4
  123. package/packages/tools/read-github-issue/dist/index.d.ts +16 -1
  124. package/packages/tools/read-github-issue/dist/index.js +32 -40
  125. package/packages/tools/read-github-issue/dist/tsconfig.tsbuildinfo +1 -1
  126. package/packages/tools/read-github-issue/index.ts +32 -45
  127. package/packages/tools/read-github-issue/package.json +11 -4
  128. package/packages/tools/render-error-book/dist/index.d.ts +1 -2
  129. package/packages/tools/render-error-book/dist/index.js +74 -95
  130. package/packages/tools/render-error-book/dist/tsconfig.tsbuildinfo +1 -1
  131. package/packages/tools/render-error-book/index.ts +88 -103
  132. package/packages/tools/render-error-book/package.json +11 -4
  133. package/packages/tools/render-katex/dist/index.d.ts +1 -2
  134. package/packages/tools/render-katex/dist/index.js +70 -157
  135. package/packages/tools/render-katex/dist/tsconfig.tsbuildinfo +1 -1
  136. package/packages/tools/render-katex/index.ts +138 -222
  137. package/packages/tools/render-katex/package.json +11 -4
  138. package/packages/tools/review-threads/dist/index.d.ts +12 -0
  139. package/packages/tools/review-threads/dist/index.js +83 -86
  140. package/packages/tools/review-threads/dist/tsconfig.tsbuildinfo +1 -1
  141. package/packages/tools/review-threads/index.ts +90 -84
  142. package/packages/tools/review-threads/package.json +11 -4
  143. package/packages/tools/search-logs/dist/index.js +100 -136
  144. package/packages/tools/search-logs/dist/tsconfig.tsbuildinfo +1 -1
  145. package/packages/tools/search-logs/index.ts +113 -145
  146. package/packages/tools/search-logs/package.json +11 -4
  147. package/packages/tools/sync-memory-index/dist/index.js +34 -28
  148. package/packages/tools/sync-memory-index/dist/tsconfig.tsbuildinfo +1 -1
  149. package/packages/tools/sync-memory-index/index.ts +37 -28
  150. package/packages/tools/sync-memory-index/package.json +11 -4
  151. package/packages/tools/validate-openai-agent-config/dist/index.js +13 -7
  152. package/packages/tools/validate-openai-agent-config/dist/tsconfig.tsbuildinfo +1 -1
  153. package/packages/tools/validate-openai-agent-config/index.ts +13 -7
  154. package/packages/tools/validate-openai-agent-config/package.json +11 -4
  155. package/packages/tools/validate-skill-frontmatter/dist/index.js +12 -6
  156. package/packages/tools/validate-skill-frontmatter/dist/tsconfig.tsbuildinfo +1 -1
  157. package/packages/tools/validate-skill-frontmatter/index.ts +12 -6
  158. package/packages/tools/validate-skill-frontmatter/package.json +11 -4
  159. package/packages/tui/dist/index.d.ts +2 -1
  160. package/packages/tui/dist/index.js +1 -0
  161. package/packages/tui/dist/stdio-adapter.d.ts +36 -0
  162. package/packages/tui/dist/stdio-adapter.js +69 -0
  163. package/packages/tui/dist/terminal.js +3 -1
  164. package/packages/tui/dist/tsconfig.tsbuildinfo +1 -1
  165. package/packages/tui/dist/types.d.ts +17 -0
  166. package/packages/tui/index.ts +2 -1
  167. package/packages/tui/package.json +14 -6
  168. package/packages/tui/stdio-adapter.ts +85 -0
  169. package/packages/tui/terminal.ts +3 -1
  170. package/packages/tui/tsconfig.json +5 -2
  171. package/packages/tui/types.ts +19 -0
  172. package/resources/project-architecture/assets/architecture.css +2 -1
  173. package/resources/project-architecture/atlas/atlas.history.log +1 -0
  174. package/resources/project-architecture/atlas/atlas.history.undo.json +13 -2
  175. package/resources/project-architecture/atlas/atlas.history.undo.stack.json +610 -0
  176. package/resources/project-architecture/atlas/atlas.index.yaml +81 -5
  177. package/resources/project-architecture/atlas/features/cli-dispatch.yaml +43 -0
  178. package/resources/project-architecture/atlas/features/terminal-ui.yaml +29 -0
  179. package/resources/project-architecture/atlas/features/tool-registry.yaml +22 -0
  180. package/resources/project-architecture/atlas/features/tool-utils.yaml +22 -0
  181. package/resources/project-architecture/features/cli-dispatch/arg-parser.html +40 -0
  182. package/resources/project-architecture/features/cli-dispatch/help-builder.html +40 -0
  183. package/resources/project-architecture/features/cli-dispatch/index.html +64 -0
  184. package/resources/project-architecture/features/cli-dispatch/installer-core.html +40 -0
  185. package/resources/project-architecture/features/cli-dispatch/tool-discovery.html +40 -0
  186. package/resources/project-architecture/features/cli-dispatch/update-checker.html +40 -0
  187. package/resources/project-architecture/features/terminal-ui/banner-display.html +40 -0
  188. package/resources/project-architecture/features/terminal-ui/index.html +50 -0
  189. package/resources/project-architecture/features/terminal-ui/interactive-prompts.html +40 -0
  190. package/resources/project-architecture/features/terminal-ui/terminal-detection.html +40 -0
  191. package/resources/project-architecture/features/tool-registry/formatter.html +40 -0
  192. package/resources/project-architecture/features/tool-registry/index.html +43 -0
  193. package/resources/project-architecture/features/tool-registry/registry-core.html +40 -0
  194. package/resources/project-architecture/features/tool-utils/index.html +43 -0
  195. package/resources/project-architecture/features/tool-utils/log-utils.html +40 -0
  196. package/resources/project-architecture/features/tool-utils/skill-discovery.html +40 -0
  197. package/resources/project-architecture/index.html +365 -121
  198. package/scripts/rewrite-imports.mjs +2 -2
  199. package/scripts/test.sh +144 -8
  200. package/skills/design/SKILL.md +57 -64
  201. package/skills/design/assets/templates/DESIGN.md +12 -0
  202. package/skills/design/references/code-smells.md +94 -0
  203. package/skills/design/references/module-boundary-adjustment.md +126 -0
  204. package/skills/design/references/module-internal-restructuring.md +132 -0
  205. package/skills/design/references/module-internal-simplification.md +164 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,51 @@
2
2
 
3
3
  All notable changes to this repository are documented in this file.
4
4
 
5
+ ## [v5.0.1] - 2026-06-06
6
+
7
+ ### Fixed
8
+
9
+ - **Publish CI**: Build now passes in fresh CI checkout. Added missing tsconfig `references` for `tui` and `tool-registry` to fix `tsc --build` dependency ordering. Broke circular type dependency between `tool-utils` and `tool-registry` by moving `ToolContext` into `tool-utils`.
10
+ - **Stale tests**: `ToolNotFoundError` formatting tests updated to match `formatAppError` behavior (bare message, no "Error:" prefix). Architecture `REGTEST-15/17` tests updated to handle error-throwing handlers.
11
+ - **Lockfile sync**: `package-lock.json` regenerated to match workspace `package.json` files after version bump.
12
+
13
+ ## [v5.0.0] - 2026-06-06
14
+
15
+ ### Added
16
+
17
+ - **Schema-based tool argument parsing**: New `createToolRunner()` function in `@laitszkin/tool-utils` that wraps `node:util.parseArgs`. Tools declare options, help text, and validation logic in a single `ToolSchema` declaration — no more hand-rolled `parseArgs()` loops. 18 of 21 in-scope tools migrated.
18
+ - **`PlatformAdapter` cross-platform abstraction**: New `PlatformAdapter` interface in `@laitszkin/tool-utils` with `WindowsAdapter`/`PosixAdapter` implementations. Encapsulates `symlinkType()` (junction on Windows), `resolveCommand()` (`.cmd` resolution), `homeDir()` (multi-env fallback), and `EOL`.
19
+ - **`AppError` hierarchy**: Typed error classes (`UserInputError`, `ToolNotFoundError`, `SystemError`) with `formatAppError()` boundary function. Business logic throws typed errors → CLI boundary catches + consistent stderr formatting.
20
+ - **Command parser classes**: `InstallArgsParser`, `UninstallArgsParser`, `ToolArgsParser` implementing `CommandParser<T>` interface. Independently testable, map-based dispatch table replaces the monolithic `parseArguments()` if-else chain.
21
+ - **`HelpTextBuilder`**: Unified help text generator replaces 4 nearly-identical help builders. Command types provide section content declaratively.
22
+ - **Per-group test coverage thresholds**: Two-tier enforcement — Group 1 (`test/`) at 75/60/65 lines/branches/functions; Group 2 (`packages/`) at 65/60/65. Combined file-weighted ≥80% enforced in `scripts/test.sh`.
23
+ - **CI matrix (ubuntu + windows)**: `.github/workflows/test.yml` runs `npm test` on both `ubuntu-latest` and `windows-latest` with `fail-fast: false`.
24
+
25
+ ### Changed
26
+
27
+ - **Internal package versions unified to 5.0.0**: All 24 `@laitszkin/*` packages bumped from 4.0.8 to 5.0.0 to match the root package version.
28
+ - **Global install dependency chain fixed**: Root `package.json` now lists `@laitszkin/cli` as a direct dependency; `@laitszkin/cli` now lists `@laitszkin/tool-codegraph` and `@laitszkin/tool-eval` so all registered tools are resolvable when installed via `npm install -g @laitszkin/apollo-toolkit`.
29
+ - **Coverage enforcement**: `scripts/test.sh` enforces combined file-weighted ≥80% line coverage across Groups 1 and 2, with per-group minimums. Group 3 (mock.module tests, codegraph) excluded due to Node.js flag incompatibility.
30
+ - **Design doc accuracy**: Six inaccuracies in DESIGN.md corrected — branch thresholds, split-process description, `--check-coverage` references aligned with actual implementation.
31
+ - **Windows CI comment updated**: `.github/workflows/test.yml` comment now accurately describes coverage enforcement mechanism.
32
+
33
+ ### Fixed
34
+
35
+ - **`docs-to-voice` syntax corruption**: Three structural defects from ToolSchema migration (fdf8628b) repaired — duplicated code block, missing `if (mode === "say")` wrapper, missing `textChunks` definition. These caused `tsc --build` to emit garbled JS, blocking `registerAllTools()` from loading any tool.
36
+ - **Error cause chain preservation**: Original error causes are now passed via `{ cause: err }` in filter-logs, codegraph, and open-github-issue error re-wraps. Regression tests added.
37
+ - **EPERM symlink fallback**: `installer.ts` degrades to copy mode with a warning when `fs.symlink` fails with EPERM on Windows.
38
+ - **All `\n` hardcodes replaced**: Manifest writes, schema output, error formatting, and EPERM warnings now use `os.EOL` or `adapter.EOL`.
39
+ - **Carryover tools `--help` support**: Three carryover tools (open-github-issue, find-github-issues, review-threads) received `--help` output handling.
40
+ - **Storyboard failure return code**: `generate-storyboard-images` now returns non-zero exit code when API failures occur.
41
+ - **TypeScript build config**: Narrowed `tui` and `tool-registry` tsconfig `include` from `"**/*.ts"` to `"*.ts"` to prevent TS5055 dist/ overwrite errors in TypeScript 5.5+.
42
+
43
+ ### Removed
44
+
45
+ - **Monolithic `parseArguments()` if-else chain**: Replaced with Map-based dispatch table and per-command parser classes.
46
+ - **Individual tool `parseArgs()` implementations**: 18 tools' ad-hoc argument parsing removed in favor of `createToolRunner` schema.
47
+ - **Dead code in enforce-video-aspect-ratio**: ~75 lines of unreachable `parseArgs`/`AspectArgs`/`help` field removed after `createToolRunner` migration.
48
+ - **Unused stderr bindings in architecture tool**: Both `handleApply` and `handleTemplate` cleaned.
49
+
5
50
  ## [v4.1.4] - 2026-06-04
6
51
 
7
52
  ### Fixed
@@ -8,4 +8,8 @@ const sourceRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.
8
8
 
9
9
  run(process.argv.slice(2), { sourceRoot }).then((code: number) => {
10
10
  process.exitCode = code;
11
+ }).catch((err: unknown) => {
12
+ const message = err instanceof Error ? err.message : String(err);
13
+ process.stderr.write(message + '\n');
14
+ process.exitCode = 1;
11
15
  });
@@ -5,4 +5,8 @@ import { fileURLToPath } from 'node:url';
5
5
  const sourceRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
6
6
  run(process.argv.slice(2), { sourceRoot }).then((code) => {
7
7
  process.exitCode = code;
8
+ }).catch((err) => {
9
+ const message = err instanceof Error ? err.message : String(err);
10
+ process.stderr.write(message + '\n');
11
+ process.exitCode = 1;
8
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laitszkin/apollo-toolkit",
3
- "version": "4.1.4",
3
+ "version": "5.0.1",
4
4
  "description": "Apollo Toolkit npm installer for managed skill copying across Codex, OpenClaw, and Trae.",
5
5
  "license": "MIT",
6
6
  "author": "LaiTszKin",
@@ -28,6 +28,7 @@
28
28
  "prepublishOnly": "npm run build",
29
29
  "watch": "tsc --build --watch",
30
30
  "test": "scripts/test.sh",
31
+ "test:coverage": "COVERAGE=true npm test",
31
32
  "test:ts": "node --test dist/test/"
32
33
  },
33
34
  "engines": {
@@ -58,4 +59,4 @@
58
59
  "@types/node": "^25.9.1",
59
60
  "typescript": "^6.0.3"
60
61
  }
61
- }
62
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Produces the four help text sections previously generated by standalone
3
+ * functions. Each method returns text identical to the original builder so
4
+ * that observable CLI output is unchanged.
5
+ */
6
+ export declare class HelpTextBuilder {
7
+ private version;
8
+ private colorEnabled;
9
+ constructor({ version, colorEnabled }: {
10
+ version: string;
11
+ colorEnabled: boolean;
12
+ });
13
+ private modeUsagePattern;
14
+ private joinLines;
15
+ /** Replaces buildHelpText – top-level overview help. */
16
+ overview(): string;
17
+ /** Replaces buildInstallHelpText – install-specific help. */
18
+ install(): string;
19
+ /** Replaces buildUninstallHelpText – uninstall-specific help. */
20
+ uninstall(): string;
21
+ /** Replaces buildToolsHelp – tools listing help screen. */
22
+ toolsHelp(): string;
23
+ }
@@ -0,0 +1,166 @@
1
+ import { buildBanner, buildSupportedTargetLines } from '../../tui/dist/index.js';
2
+ import { formatToolList, buildToolDiscoveryHelp, formatExamples } from '../../tool-registry/dist/index.js';
3
+ import { TARGET_DEFINITIONS, VALID_MODES } from './installer.js';
4
+ /**
5
+ * Produces the four help text sections previously generated by standalone
6
+ * functions. Each method returns text identical to the original builder so
7
+ * that observable CLI output is unchanged.
8
+ */
9
+ export class HelpTextBuilder {
10
+ version;
11
+ colorEnabled;
12
+ constructor({ version, colorEnabled }) {
13
+ this.version = version;
14
+ this.colorEnabled = colorEnabled;
15
+ }
16
+ // ---- shared helpers -------------------------------------------------------
17
+ modeUsagePattern() {
18
+ return `${VALID_MODES.join('|')}|all`;
19
+ }
20
+ joinLines(lines) {
21
+ return lines.filter(Boolean).join('\n');
22
+ }
23
+ // ---- public methods -------------------------------------------------------
24
+ /** Replaces buildHelpText – top-level overview help. */
25
+ overview() {
26
+ const examples = [
27
+ { command: 'apltk --help', result: 'Shows the top-level Apollo Toolkit guide, including install modes and bundled task-tool discovery.' },
28
+ { command: 'apltk tools --help', result: 'Lists bundled tools by task so you can decide which CLI helper to inspect next.' },
29
+ { command: 'apltk architecture --help', result: 'Shows the architecture atlas command tree, task guidance, and action-specific follow-up help paths.' },
30
+ { command: 'apltk tools architecture --help', result: 'Shows what the architecture atlas tool is for, then prints its native command tree and examples.' },
31
+ { command: 'apltk filter-logs app.log --start 2026-03-24T10:00:00Z', result: 'Prints only the log lines whose timestamps fall within the requested time window.' },
32
+ ];
33
+ return this.joinLines([
34
+ buildBanner({ version: this.version, colorEnabled: this.colorEnabled }),
35
+ '',
36
+ 'Usage:',
37
+ ` apltk [install] [${this.modeUsagePattern()}]...`,
38
+ ` apollo-toolkit [install] [${this.modeUsagePattern()}]...`,
39
+ ` apltk uninstall [${this.modeUsagePattern()}]... [--yes]`,
40
+ ' apltk tools',
41
+ ' apltk <tool> [...args]',
42
+ ' apltk tools <tool> [...args]',
43
+ ' apltk --help',
44
+ ' apollo-toolkit --help',
45
+ '',
46
+ 'Common goals:',
47
+ ' - Install or refresh skills in one or more agent targets: `apltk install --help`',
48
+ ' - Remove manifest-tracked installs from selected targets: `apltk uninstall --help`',
49
+ ' - Discover which bundled helper tool matches a task: `apltk tools --help`',
50
+ ' - Inspect one tool deeply before running it: `apltk tools <tool> --help`',
51
+ '',
52
+ 'Bundled tools:',
53
+ formatToolList(),
54
+ '',
55
+ buildToolDiscoveryHelp(),
56
+ '',
57
+ 'Options:',
58
+ ' --home <path> Override Apollo Toolkit home directory',
59
+ ' --symlink Install skills as symlinks instead of copied directories',
60
+ ' --copy Install skills as copied directories instead of symlinks',
61
+ ' --yes, -y Skip uninstall confirmation',
62
+ ' --help Show this help text',
63
+ '',
64
+ 'Examples:',
65
+ formatExamples(examples),
66
+ ]);
67
+ }
68
+ /** Replaces buildInstallHelpText – install-specific help. */
69
+ install() {
70
+ const examples = [
71
+ { command: 'apltk', result: 'Launches the interactive installer, opens the target selector, and then walks through link-mode confirmation.' },
72
+ { command: 'apltk codex openclaw --symlink', result: 'Performs a non-interactive install into `codex` and `openclaw` targets using symlinks.' },
73
+ { command: 'npx @laitszkin/apollo-toolkit all --copy', result: 'Installs a copied snapshot into every supported target instead of symlinking.' },
74
+ ];
75
+ return this.joinLines([
76
+ buildBanner({ version: this.version, colorEnabled: this.colorEnabled }),
77
+ '',
78
+ 'Usage:',
79
+ ` apltk [install] [${this.modeUsagePattern()}]...`,
80
+ ` apollo-toolkit [install] [${this.modeUsagePattern()}]...`,
81
+ '',
82
+ 'Use this when:',
83
+ ' - You want to install or refresh Apollo Toolkit skills in one or more agent targets.',
84
+ ' - You need to choose between symlink mode (auto-updating) and copy mode (stable snapshot).',
85
+ '',
86
+ 'Supported targets:',
87
+ buildSupportedTargetLines({ targets: [...TARGET_DEFINITIONS], colorEnabled: this.colorEnabled }),
88
+ '',
89
+ 'Behavior notes:',
90
+ ' - Running `apltk` with no targets opens the interactive installer and target selector.',
91
+ ' - `--symlink` keeps installed skills connected to the managed toolkit checkout in `~/.apollo-toolkit`.',
92
+ ' - `--copy` installs a snapshot that only changes when you run the installer again.',
93
+ ' - The installer can optionally include codex-exclusive skills in non-codex targets after prompting.',
94
+ '',
95
+ 'Options:',
96
+ ' --home <path> Override Apollo Toolkit home directory',
97
+ ' --symlink Install skills as symlinks (recommended)',
98
+ ' --copy Install skills as copied directories',
99
+ ' --help Show this install help',
100
+ '',
101
+ 'Examples:',
102
+ formatExamples(examples),
103
+ ]);
104
+ }
105
+ /** Replaces buildUninstallHelpText – uninstall-specific help. */
106
+ uninstall() {
107
+ const examples = [
108
+ { command: 'apltk uninstall', result: 'Opens the interactive uninstall selector when running in a TTY and then asks for confirmation before removal.' },
109
+ { command: 'apltk uninstall codex agents --yes', result: 'Removes Apollo Toolkit-managed installs from `codex` and `agents` without another confirmation prompt.' },
110
+ { command: 'apltk uninstall codex --home /tmp/custom-home', result: 'Uses the custom managed toolkit home while removing manifest-tracked installs from the selected target.' },
111
+ ];
112
+ return this.joinLines([
113
+ buildBanner({ version: this.version, colorEnabled: this.colorEnabled }),
114
+ '',
115
+ 'Usage:',
116
+ ` apltk uninstall [${this.modeUsagePattern()}]... [--yes]`,
117
+ '',
118
+ 'Use this when:',
119
+ ' - You want to remove Apollo Toolkit-managed skills from one or more agent targets.',
120
+ ' - You need to clean up manifest-tracked historical installs as well as the current installed skills.',
121
+ '',
122
+ 'Supported targets:',
123
+ buildSupportedTargetLines({ targets: [...TARGET_DEFINITIONS], colorEnabled: this.colorEnabled }),
124
+ '',
125
+ 'Behavior notes:',
126
+ ' - With no explicit targets, uninstall opens the interactive selector in a TTY and otherwise falls back to all targets.',
127
+ ' - Uninstall removes manifest-tracked current and historical Apollo Toolkit skill directories.',
128
+ ' - `--yes` skips the confirmation prompt after the target list is resolved.',
129
+ '',
130
+ 'Options:',
131
+ ' --home <path> Override Apollo Toolkit home directory',
132
+ ' --yes, -y Skip uninstall confirmation',
133
+ ' --help Show this uninstall help',
134
+ '',
135
+ 'Examples:',
136
+ formatExamples(examples),
137
+ ]);
138
+ }
139
+ /** Replaces buildToolsHelp – tools listing help screen. */
140
+ toolsHelp() {
141
+ const examples = [
142
+ { command: 'apltk tools', result: 'Lists all bundled tools plus the task-oriented discovery guide.' },
143
+ { command: 'apltk tools open-github-issue --help', result: 'Shows when to use the GitHub issue publisher, then prints its exact script flags and examples.' },
144
+ { command: 'apltk tools architecture --help', result: 'Shows when to use the architecture atlas CLI, then prints its native command tree.' },
145
+ ];
146
+ return this.joinLines([
147
+ buildBanner({ version: this.version, colorEnabled: this.colorEnabled }),
148
+ '',
149
+ 'Usage:',
150
+ ' apltk tools',
151
+ ' apltk <tool> [...args]',
152
+ ' apltk tools <tool> [...args]',
153
+ '',
154
+ buildToolDiscoveryHelp(),
155
+ '',
156
+ 'Bundled tools:',
157
+ formatToolList(),
158
+ '',
159
+ 'Tip:',
160
+ ' Pass `--help` after a tool name to view task guidance, native script flags, and concrete examples.',
161
+ '',
162
+ 'Examples:',
163
+ formatExamples(examples),
164
+ ]);
165
+ }
166
+ }
@@ -4,22 +4,11 @@ import { checkForPackageUpdate, compareVersions, execCommand } from './updater.j
4
4
  import { registerAllTools } from './tool-registration.js';
5
5
  export { TARGET_DEFINITIONS, VALID_MODES, installLinks, listAllKnownSkillNames, listCodexSkillNames, normalizeModes, resolveToolkitHome, syncToolkitHome, uninstallSkills, getTargetRoots, getUninstallTargetRoots, expandUserPath, readManifest, writeManifest, resolveHomeDirectory, listSkillNames, checkForPackageUpdate, compareVersions, execCommand, };
6
6
  import type { CliContext, ParsedArguments } from './types.js';
7
- declare function buildHelpText({ version, colorEnabled }: {
8
- version: string;
9
- colorEnabled: boolean;
10
- }): string;
11
- declare function buildToolsHelp({ version, colorEnabled }: {
12
- version: string;
13
- colorEnabled: boolean;
14
- }): string;
15
- declare function buildInstallHelpText({ version, colorEnabled }: {
16
- version: string;
17
- colorEnabled: boolean;
18
- }): string;
19
- declare function buildUninstallHelpText({ version, colorEnabled }: {
20
- version: string;
21
- colorEnabled: boolean;
22
- }): string;
23
7
  declare function parseArguments(argv: string[]): ParsedArguments;
24
- export { parseArguments, buildHelpText, buildInstallHelpText, buildUninstallHelpText, buildToolsHelp, buildBanner, buildWelcomeScreen, registerAllTools };
8
+ export { InstallArgsParser } from './parsers/install-parser.js';
9
+ export { UninstallArgsParser } from './parsers/uninstall-parser.js';
10
+ export { ToolArgsParser } from './parsers/tool-parser.js';
11
+ export { HelpTextBuilder } from './help-text-builder.js';
12
+ export { normalizeParseError } from './parsers/parser-utils.js';
13
+ export { parseArguments, buildBanner, buildWelcomeScreen, registerAllTools };
25
14
  export declare function run(argv: string[], context?: CliContext): Promise<number>;