Skip to main content

ask/
lib.rs

1//! Core library for the `ask` CLI (Rust port of `@pleaseai/ask`).
2//!
3//! Phase 0: this crate is a walking skeleton. The command surface is defined in
4//! [`cli`], but the per-command logic is ported from the TypeScript
5//! implementation (`packages/cli/src/`) module by module in later phases (see
6//! the `rust-port-20260704` track). Until a command is ported it reports a
7//! "not yet ported" notice via [`NotPorted`].
8
9pub mod agents;
10pub mod ask_json;
11pub mod cli;
12pub mod commands;
13pub mod discovery;
14pub mod http;
15pub mod ignore_files;
16pub mod install;
17pub mod io;
18pub mod list;
19pub mod lockfiles;
20pub mod markers;
21pub mod registry;
22pub mod resolved;
23pub mod resolvers;
24pub mod skill;
25pub mod skills;
26pub mod sources;
27pub mod spec;
28pub mod storage;
29pub mod store;
30
31use std::fmt;
32
33/// Sentinel error for a command whose logic has not been ported to Rust yet.
34///
35/// The binary maps this to a clear, non-zero-exit message pointing at the still
36/// authoritative TypeScript build, rather than silently doing nothing.
37#[derive(Debug)]
38pub struct NotPorted {
39    pub command: &'static str,
40}
41
42impl NotPorted {
43    pub fn new(command: &'static str) -> Self {
44        Self { command }
45    }
46}
47
48impl fmt::Display for NotPorted {
49    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50        write!(
51            f,
52            "`ask {}` is not ported to the Rust build yet.\n\
53             The TypeScript build (`npx @pleaseai/ask {}`) remains the source of truth \
54             during the migration — see .please/docs/tracks/active/rust-port-20260704/.",
55            self.command, self.command
56        )
57    }
58}
59
60impl std::error::Error for NotPorted {}