@ap3x/cli 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 (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/agent-session.d.ts +163 -0
  4. package/dist/agent-session.d.ts.map +1 -0
  5. package/dist/auth/anthropic-login.d.ts +98 -0
  6. package/dist/auth/anthropic-login.d.ts.map +1 -0
  7. package/dist/auth/codex-login.d.ts +80 -0
  8. package/dist/auth/codex-login.d.ts.map +1 -0
  9. package/dist/auth/copilot-login.d.ts +36 -0
  10. package/dist/auth/copilot-login.d.ts.map +1 -0
  11. package/dist/auth/login-dispatch.d.ts +76 -0
  12. package/dist/auth/login-dispatch.d.ts.map +1 -0
  13. package/dist/bin.d.ts +3 -0
  14. package/dist/bin.d.ts.map +1 -0
  15. package/dist/bin.js +15 -0
  16. package/dist/branding.d.ts +89 -0
  17. package/dist/branding.d.ts.map +1 -0
  18. package/dist/chunk-3WSVGI7R.js +10522 -0
  19. package/dist/cli.d.ts +135 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cron/agent-executor.d.ts +45 -0
  22. package/dist/cron/agent-executor.d.ts.map +1 -0
  23. package/dist/cron/cron-cli.d.ts +27 -0
  24. package/dist/cron/cron-cli.d.ts.map +1 -0
  25. package/dist/cron/schedule-file.d.ts +7 -0
  26. package/dist/cron/schedule-file.d.ts.map +1 -0
  27. package/dist/glob.d.ts +12 -0
  28. package/dist/glob.d.ts.map +1 -0
  29. package/dist/hooks/hooks-cli.d.ts +11 -0
  30. package/dist/hooks/hooks-cli.d.ts.map +1 -0
  31. package/dist/index.d.ts +26 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +462 -0
  34. package/dist/modes/index.d.ts +5 -0
  35. package/dist/modes/index.d.ts.map +1 -0
  36. package/dist/modes/interactive.d.ts +44 -0
  37. package/dist/modes/interactive.d.ts.map +1 -0
  38. package/dist/modes/print.d.ts +24 -0
  39. package/dist/modes/print.d.ts.map +1 -0
  40. package/dist/modes/render.d.ts +29 -0
  41. package/dist/modes/render.d.ts.map +1 -0
  42. package/dist/modes/rpc.d.ts +149 -0
  43. package/dist/modes/rpc.d.ts.map +1 -0
  44. package/dist/sdk.d.ts +95 -0
  45. package/dist/sdk.d.ts.map +1 -0
  46. package/dist/settings.d.ts +109 -0
  47. package/dist/settings.d.ts.map +1 -0
  48. package/dist/skills.d.ts +27 -0
  49. package/dist/skills.d.ts.map +1 -0
  50. package/dist/slash-commands.d.ts +79 -0
  51. package/dist/slash-commands.d.ts.map +1 -0
  52. package/dist/system-prompt.d.ts +21 -0
  53. package/dist/system-prompt.d.ts.map +1 -0
  54. package/dist/tools/a2a.d.ts +11 -0
  55. package/dist/tools/a2a.d.ts.map +1 -0
  56. package/dist/tools/bash.d.ts +4 -0
  57. package/dist/tools/bash.d.ts.map +1 -0
  58. package/dist/tools/context.d.ts +42 -0
  59. package/dist/tools/context.d.ts.map +1 -0
  60. package/dist/tools/edit.d.ts +16 -0
  61. package/dist/tools/edit.d.ts.map +1 -0
  62. package/dist/tools/find.d.ts +9 -0
  63. package/dist/tools/find.d.ts.map +1 -0
  64. package/dist/tools/grep.d.ts +9 -0
  65. package/dist/tools/grep.d.ts.map +1 -0
  66. package/dist/tools/index.d.ts +35 -0
  67. package/dist/tools/index.d.ts.map +1 -0
  68. package/dist/tools/ls.d.ts +5 -0
  69. package/dist/tools/ls.d.ts.map +1 -0
  70. package/dist/tools/read.d.ts +9 -0
  71. package/dist/tools/read.d.ts.map +1 -0
  72. package/dist/tools/swarm.d.ts +42 -0
  73. package/dist/tools/swarm.d.ts.map +1 -0
  74. package/dist/tools/walk.d.ts +48 -0
  75. package/dist/tools/walk.d.ts.map +1 -0
  76. package/dist/tools/write.d.ts +9 -0
  77. package/dist/tools/write.d.ts.map +1 -0
  78. package/dist/trace/trace-cli.d.ts +9 -0
  79. package/dist/trace/trace-cli.d.ts.map +1 -0
  80. package/dist/utils/clipboard.d.ts +23 -0
  81. package/dist/utils/clipboard.d.ts.map +1 -0
  82. package/dist/utils/git.d.ts +13 -0
  83. package/dist/utils/git.d.ts.map +1 -0
  84. package/dist/utils/highlight.d.ts +23 -0
  85. package/dist/utils/highlight.d.ts.map +1 -0
  86. package/dist/utils/index.d.ts +6 -0
  87. package/dist/utils/index.d.ts.map +1 -0
  88. package/dist/utils/resume.d.ts +9 -0
  89. package/dist/utils/resume.d.ts.map +1 -0
  90. package/dist/utils/version-check.d.ts +34 -0
  91. package/dist/utils/version-check.d.ts.map +1 -0
  92. package/package.json +45 -0
@@ -0,0 +1,35 @@
1
+ import type { AnyAgentTool } from "@ap3x/agent-core";
2
+ import { type ToolContext } from "./context";
3
+ export { createToolContext, type ToolContext, type SwarmBackend } from "./context";
4
+ export { createCallAgentTool, createA2aTools } from "./a2a";
5
+ export { createRunSwarmTool, createAutoSwarmTool, createBuildAgentTool, createSwarmTools, } from "./swarm";
6
+ export { createReadTool } from "./read";
7
+ export { createWriteTool } from "./write";
8
+ export { createEditTool } from "./edit";
9
+ export { createBashTool } from "./bash";
10
+ export { createLsTool } from "./ls";
11
+ export { createGrepTool } from "./grep";
12
+ export { createFindTool } from "./find";
13
+ /** Names of every built-in tool the CLI ships. */
14
+ export declare const ALL_TOOL_NAMES: readonly ["read", "bash", "edit", "write", "grep", "find", "ls", "run_swarm", "auto_swarm", "build_agent", "call_agent"];
15
+ /** Names of the tools that only observe (never mutate) the workspace. */
16
+ export declare const READ_ONLY_TOOL_NAMES: readonly ["read", "grep", "find", "ls"];
17
+ /** Build every built-in tool against a context. */
18
+ export declare function createAllTools(ctx?: ToolContext): AnyAgentTool[];
19
+ /**
20
+ * The standard coding-agent tool set: read, bash, edit, write, grep, find, ls.
21
+ * Mutating tools (edit/write) are wrapped so concurrent calls serialize.
22
+ */
23
+ export declare function createCodingTools(ctx?: ToolContext): AnyAgentTool[];
24
+ /** A read-only tool set (no edit/write/bash): read, grep, find, ls. */
25
+ export declare function createReadOnlyTools(ctx?: ToolContext): AnyAgentTool[];
26
+ /** Select a subset of tools by name, preserving the order in `names`. */
27
+ export declare function selectTools(tools: AnyAgentTool[], names: readonly string[]): AnyAgentTool[];
28
+ /**
29
+ * Serialize file-mutating tools (`edit`, `write`) through a shared promise
30
+ * chain so concurrent invocations cannot interleave reads and writes and
31
+ * corrupt a file. Non-mutating tools are returned untouched. The wrapped tools
32
+ * are also forced to `executionMode: "sequential"` as a second line of defense.
33
+ */
34
+ export declare function withFileMutationQueue(tools: AnyAgentTool[]): AnyAgentTool[];
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,WAAW,CAAC;AAQhE,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,kDAAkD;AAClD,eAAO,MAAM,cAAc,0HAYjB,CAAC;AAEX,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,yCAA0C,CAAC;AAE5E,mDAAmD;AACnD,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE,CAWhE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE,CAEnE;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE,CAGrE;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,EAAE,CAQ3F;AAID;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAuB3E"}
@@ -0,0 +1,5 @@
1
+ import { type AnyAgentTool } from "@ap3x/agent-core";
2
+ import type { ToolContext } from "./context";
3
+ /** `ls` — list the entries of a directory (non-recursive), sorted. */
4
+ export declare function createLsTool(ctx: ToolContext): AnyAgentTool;
5
+ //# sourceMappingURL=ls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../src/tools/ls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,kBAAkB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,CA2B3D"}
@@ -0,0 +1,9 @@
1
+ import { type AnyAgentTool } from "@ap3x/agent-core";
2
+ import type { ToolContext } from "./context";
3
+ /**
4
+ * `read` — read a text file (numbered line window) or an image (base64
5
+ * {@link ImageContent}). Images are detected by magic bytes and returned in a
6
+ * form vision models can view.
7
+ */
8
+ export declare function createReadTool(ctx: ToolContext): AnyAgentTool;
9
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAc,MAAM,kBAAkB,CAAC;AAEvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA0J7C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,CAqD7D"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Swarm orchestration tools for the coding agent. These let the `ap3x` agent
3
+ * spin up a team of sub-agents — each backed by the SAME model + auth the CLI is
4
+ * already using (so the swarm runs on the caller's subscription/credentials).
5
+ *
6
+ * Two tools:
7
+ * - `run_swarm` — explicit orchestration: you pick the architecture and define
8
+ * each specialist agent.
9
+ * - `auto_swarm` — goal → team: an LLM "architect" designs the team + topology
10
+ * from a one-line goal, then it is built and run.
11
+ *
12
+ * Every sub-agent is constructed via {@link makeAgent}, which threads the
13
+ * session model + resolved auth into the swarms {@link Agent}. The tools are only
14
+ * registered when the session actually has a swarm backend (see
15
+ * {@link createSwarmTools}); they additionally early-error if invoked without one.
16
+ */
17
+ import { type AnyAgentTool } from "@ap3x/agent-core";
18
+ import type { ToolContext } from "./context";
19
+ /**
20
+ * `run_swarm` — explicit multi-agent orchestration. The caller picks the
21
+ * architecture and defines each specialist agent; every agent is built on the
22
+ * session model + auth, then a {@link SwarmRouter} of the chosen type runs the task.
23
+ */
24
+ export declare function createRunSwarmTool(ctx: ToolContext): AnyAgentTool;
25
+ /**
26
+ * `auto_swarm` — describe a goal and an LLM architect designs the team + topology,
27
+ * which is then built (every agent on the session model + auth) and run.
28
+ */
29
+ export declare function createAutoSwarmTool(ctx: ToolContext): AnyAgentTool;
30
+ /**
31
+ * `build_agent` — design a SINGLE specialist agent from a role description (an
32
+ * LLM architect synthesizes its name + system prompt), then optionally run it on
33
+ * a task. The designed agent is built on the session model + auth. With no
34
+ * `task`, the designed spec is returned so it can be reused.
35
+ */
36
+ export declare function createBuildAgentTool(ctx: ToolContext): AnyAgentTool;
37
+ /**
38
+ * The swarm tool set — only available when the session can orchestrate (i.e. it
39
+ * resolved a model + auth into {@link ToolContext.swarm}).
40
+ */
41
+ export declare function createSwarmTools(ctx: ToolContext): AnyAgentTool[];
42
+ //# sourceMappingURL=swarm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../src/tools/swarm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,kBAAkB,CAAC;AAcjE,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,WAAW,CAAC;AA4F3D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,CA8DjE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,CAuElE;AAmBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,CAqEnE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,EAAE,CAIjE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * A compiled `.gitignore` line. `re` is tested against either the whole
3
+ * root-relative POSIX path (when `anchored`) or just the basename (otherwise).
4
+ */
5
+ export interface GitignoreRule {
6
+ negated: boolean;
7
+ dirOnly: boolean;
8
+ anchored: boolean;
9
+ re: RegExp;
10
+ }
11
+ /** Result of {@link walkFiles}. `truncated` signals the safety cap bit the walk. */
12
+ export interface WalkResult {
13
+ files: string[];
14
+ truncated: boolean;
15
+ }
16
+ /**
17
+ * Parse `.gitignore` text into ordered rules. Covers the common, high-value
18
+ * subset: blank/`#` comment lines are skipped; `!` negates; a trailing `/` makes
19
+ * a rule directory-only; a leading `/` (or a mid-pattern `/`) anchors to the
20
+ * gitignore's directory, otherwise the pattern matches a name at any depth.
21
+ * Last matching rule wins (so a later `!` re-includes).
22
+ *
23
+ * ponytail: deliberately NOT covered this slice (root-level .gitignore is the
24
+ * task scope): nested per-directory .gitignore, `.gitignore` escaping of `#`/`!`
25
+ * with backslash, character classes `[a-z]`. Add when a nested-ignore item lands.
26
+ */
27
+ export declare function parseGitignore(content: string): GitignoreRule[];
28
+ /**
29
+ * Whether `path` (root-relative, POSIX separators) is ignored by `rules`. Later
30
+ * matching rules override earlier ones, so `!name` after `name` re-includes.
31
+ */
32
+ export declare function isGitignored(rules: GitignoreRule[], path: string, isDir: boolean): boolean;
33
+ /**
34
+ * Recursively walk a directory, yielding file paths relative to `root`. Skips
35
+ * `.git`/build dirs and anything matched by the root `.gitignore`; symlinks are
36
+ * not followed. The walk is bounded by a HIGH safety cap (`maxEntries`) rather
37
+ * than a silent low ceiling — when the cap bites, `truncated` is set so callers
38
+ * can warn instead of silently dropping matches. Ignored dirs prune the walk.
39
+ *
40
+ * ponytail: because ignored directories are pruned, a `!child` cannot re-include
41
+ * a file under an ignored parent — this matches git's own limitation.
42
+ */
43
+ export declare function walkFiles(root: string, options?: {
44
+ maxEntries?: number;
45
+ ignore?: Set<string>;
46
+ rules?: GitignoreRule[];
47
+ }): Promise<WalkResult>;
48
+ //# sourceMappingURL=walk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/tools/walk.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAmCD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CA2B/D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAS1F;AAUD;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,aAAa,EAAE,CAAA;CAAE,GAC/E,OAAO,CAAC,UAAU,CAAC,CA6CrB"}
@@ -0,0 +1,9 @@
1
+ import { type AnyAgentTool } from "@ap3x/agent-core";
2
+ import type { ToolContext } from "./context";
3
+ /**
4
+ * `write` — create or overwrite a file with the given content. Parent
5
+ * directories are created as needed. This is a mutating tool: serialize it with
6
+ * {@link withFileMutationQueue} to avoid interleaved writes.
7
+ */
8
+ export declare function createWriteTool(ctx: ToolContext): AnyAgentTool;
9
+ //# sourceMappingURL=write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,kBAAkB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,CA4B9D"}
@@ -0,0 +1,9 @@
1
+ import type { CliIO } from "../cli";
2
+ export interface TraceCliDeps {
3
+ io: CliIO;
4
+ /** `--config-dir`-style override for the traces directory's parent. */
5
+ configDir?: string;
6
+ }
7
+ export declare function printTraceHelp(): string;
8
+ export declare function runTraceCli(args: string[], deps: TraceCliDeps): Promise<number>;
9
+ //# sourceMappingURL=trace-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-cli.d.ts","sourceRoot":"","sources":["../../src/trace/trace-cli.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,KAAK,CAAC;IACV,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,IAAI,MAAM,CAevC;AA8DD,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA0ErF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A best-effort clipboard sink. {@link copyToClipboard} resolves `true` on a
3
+ * successful copy and `false` when no clipboard mechanism is available — it
4
+ * never throws, so callers can offer "copy" without guarding for headless
5
+ * environments.
6
+ */
7
+ export interface Clipboard {
8
+ copy(text: string): Promise<boolean>;
9
+ }
10
+ /** Spawns a platform clipboard helper, piping `text` to its stdin. */
11
+ export type ClipboardRunner = (command: string, args: string[], text: string) => Promise<boolean>;
12
+ /**
13
+ * Best-effort copy to the system clipboard. Returns `false` (never throws) when
14
+ * the platform helper is missing or fails. `os` and `runner` are injectable for
15
+ * tests so this stays free of real subprocess side-effects.
16
+ */
17
+ export declare function copyToClipboard(text: string, options?: {
18
+ os?: NodeJS.Platform;
19
+ runner?: ClipboardRunner;
20
+ }): Promise<boolean>;
21
+ /** A clipboard that silently discards everything (headless / opt-out default). */
22
+ export declare const noopClipboard: Clipboard;
23
+ //# sourceMappingURL=clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC;AAED,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAgClG;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAO,GAC/D,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED,kFAAkF;AAClF,eAAO,MAAM,aAAa,EAAE,SAE3B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Runs a git subcommand and returns trimmed stdout, or `undefined` when git is
3
+ * unavailable / the command fails (e.g. outside a repo). Injectable so tests do
4
+ * not shell out.
5
+ */
6
+ export type GitRunner = (args: string[], cwd: string) => Promise<string | undefined>;
7
+ /** The default runner: invokes the real `git` binary via execFile. */
8
+ export declare const defaultGitRunner: GitRunner;
9
+ /** Absolute path of the git repository root containing `cwd`, if any. */
10
+ export declare function repoRoot(cwd?: string, run?: GitRunner): Promise<string | undefined>;
11
+ /** Current branch name (or `undefined` in a detached HEAD / non-repo). */
12
+ export declare function currentBranch(cwd?: string, run?: GitRunner): Promise<string | undefined>;
13
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAErF,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,EAAE,SAS3B,CAAC;AAEL,yEAAyE;AACzE,wBAAsB,QAAQ,CAC5B,GAAG,GAAE,MAAsB,EAC3B,GAAG,GAAE,SAA4B,GAChC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG7B;AAED,0EAA0E;AAC1E,wBAAsB,aAAa,CACjC,GAAG,GAAE,MAAsB,EAC3B,GAAG,GAAE,SAA4B,GAChC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAI7B"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A deliberately light syntax highlighter. It wraps a small set of token classes
3
+ * (keywords, strings, comments, numbers) in ANSI color codes for terminal
4
+ * output. It is language-agnostic and lossy by design — full grammar-aware
5
+ * highlighting is out of scope for the CLI; this is just enough to make code
6
+ * blocks readable. Pass {@link NO_HIGHLIGHT} (or `color: false`) to disable.
7
+ */
8
+ export interface HighlightTheme {
9
+ keyword: string;
10
+ string: string;
11
+ comment: string;
12
+ number: string;
13
+ reset: string;
14
+ }
15
+ /** A no-op theme: every slot is empty, so {@link highlight} returns input as-is. */
16
+ export declare const NO_HIGHLIGHT: HighlightTheme;
17
+ /**
18
+ * Highlight a snippet. With the default ANSI theme, line comments (`//`, `#`),
19
+ * double/single-quoted strings, numeric literals, and keywords are colored.
20
+ * With {@link NO_HIGHLIGHT} the input is returned unchanged.
21
+ */
22
+ export declare function highlight(code: string, theme?: HighlightTheme): string;
23
+ //# sourceMappingURL=highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/utils/highlight.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAUD,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,cAM1B,CAAC;AA+CF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,cAAqB,GAAG,MAAM,CAM5E"}
@@ -0,0 +1,6 @@
1
+ export { formatResumeCommand } from "./resume";
2
+ export { repoRoot, currentBranch, type GitRunner, defaultGitRunner } from "./git";
3
+ export { copyToClipboard, type Clipboard, noopClipboard, type ClipboardRunner, } from "./clipboard";
4
+ export { checkForUpdate, type VersionCheckOptions, type VersionCheckResult, type VersionFetcher, } from "./version-check";
5
+ export { highlight, type HighlightTheme, NO_HIGHLIGHT } from "./highlight";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EACL,eAAe,EACf,KAAK,SAAS,EACd,aAAa,EACb,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Format the shell command a user runs to resume a session (§10 #51). The result
3
+ * ALWAYS begins with the AP3X binary name (`ap3x `) sourced from
4
+ * {@link APP_NAME}, never a hardcoded binary name. Covered by tests.
5
+ *
6
+ * @example formatResumeCommand("session-abc") // "ap3x --resume session-abc"
7
+ */
8
+ export declare function formatResumeCommand(sessionId: string): string;
9
+ //# sourceMappingURL=resume.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../../src/utils/resume.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Compares the running version against a "latest" version obtained from an
3
+ * injectable fetcher. There is NO hardcoded external endpoint and no default
4
+ * network call: a check only runs when the caller supplies both a `source` URL
5
+ * and a `fetcher`, honoring the project's no-telemetry rule (the check is OFF by
6
+ * default).
7
+ */
8
+ export interface VersionCheckResult {
9
+ current: string;
10
+ latest?: string;
11
+ updateAvailable: boolean;
12
+ /** Set when the check could not complete (no source, fetch error, …). */
13
+ skipped?: string;
14
+ }
15
+ /** Resolves the latest published version string from `source`. May reject. */
16
+ export type VersionFetcher = (source: string, signal?: AbortSignal) => Promise<string>;
17
+ export interface VersionCheckOptions {
18
+ /** Where to look up the latest version. Required — none is assumed. */
19
+ source?: string;
20
+ /** How to fetch it. Required — there is no built-in network default. */
21
+ fetcher?: VersionFetcher;
22
+ /** The running version. Defaults to the CLI {@link VERSION}. */
23
+ current?: string;
24
+ signal?: AbortSignal;
25
+ }
26
+ /** Compare two `a.b.c` version strings. Returns -1 / 0 / 1 (missing parts = 0). */
27
+ export declare function compareVersions(a: string, b: string): number;
28
+ /**
29
+ * Run a version check. Skips (no network, returns `skipped`) unless both a
30
+ * `source` and a `fetcher` are provided. Fetch failures degrade to a skipped
31
+ * result rather than throwing.
32
+ */
33
+ export declare function checkForUpdate(options?: VersionCheckOptions): Promise<VersionCheckResult>;
34
+ //# sourceMappingURL=version-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-check.d.ts","sourceRoot":"","sources":["../../src/utils/version-check.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,8EAA8E;AAC9E,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEvF,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAU5D;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAmB7B"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@ap3x/cli",
3
+ "version": "0.1.0",
4
+ "description": "Interactive coding-agent CLI",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/AP3X-Dev/AP3X.git",
8
+ "directory": "packages/cli"
9
+ },
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "bin": {
24
+ "ap3x": "./dist/bin.js"
25
+ },
26
+ "files": ["dist"],
27
+ "scripts": {
28
+ "build": "tsup src/index.ts src/bin.ts --format esm --clean --tsconfig tsconfig.build.json && tsc -p tsconfig.build.json",
29
+ "prepublishOnly": "node ../../scripts/publish-gate.mjs",
30
+ "test": "vitest run"
31
+ },
32
+ "dependencies": {
33
+ "@ap3x/a2a": "2.0.0",
34
+ "@ap3x/agent-core": "0.1.0",
35
+ "@ap3x/ai": "0.1.0",
36
+ "@ap3x/cadence": "0.1.0",
37
+ "@ap3x/observe": "0.1.0",
38
+ "@ap3x/swarms": "0.1.0",
39
+ "@ap3x/tui": "0.1.0",
40
+ "zod": "^3.23.8"
41
+ },
42
+ "devDependencies": {
43
+ "yaml": "^2.9.0"
44
+ }
45
+ }