···67676868LLMs can't read error messages buried in HTML or long stack traces. Provide a `--no-input` flag that forces the CLI to error if it can't resolve context or if required flags are missing.
69697070-## 6. Implementation Roadmap
7171-7272-### Phase 1: Context & Auth (The "Plumbing")
7373-7474-1. **Auth Storage:** Store the AT Proto session in conf.
7575-2. **Context Resolver:**
7676- - Implement a helper getRepoFromContext().
7777- - It calls git remote get-url origin.
7878- - Regex matches the Tangled DID from the URL.
7979- - Returns the repo param required by XRPC.
8080-8181-### Phase 2: CRUD Commands (The "Porcelain")
8282-8383-1. **repo create:**
8484- - Creates record via XRPC.
8585- - **Auto-config:** Runs git init and git remote add if local dir is empty.
8686-2. **issue list/create:**
8787- - Uses getRepoFromContext() so the user just types tangled issue create.
8888-8989-### Phase 3: The "Machine" View
9090-9191-1. Implement a generic Formatter class.
9292- - Formatter.render(data, { json: true, fields: \['id', 'name'\] })
9393- - If json: pick fields, JSON.stringify.
9494- - If human: use cli-table3.
9595-9696-## 7. Example: The Context Pattern
9797-9898-This is how we solve the usability problem (and the LLM hallucination problem).
9999-100100-`// src/lib/context.ts`
101101-`import simpleGit from 'simple-git';`
102102-103103-`export async function resolveRepoContext(explicitFlag?: string): Promise<string> {`
104104-`// 1. If user passed --repo flag, use it`
105105-`if (explicitFlag) return explicitFlag;`
106106-107107-`// 2. Try to infer from local git config`
108108-`const git = simpleGit();`
109109-`const isRepo = await git.checkIsRepo();`
110110-111111-`if (isRepo) {`
112112-`const remotes = await git.getRemotes(true);`
113113-`const tangledRemote = remotes.find(r => r.name === 'tangled' || r.name === 'origin');`
114114-115115- `if (tangledRemote) {`
116116- `// Logic to extract DID from URL (e.g., [https://tangled.sh/did:plc:123/repo](https://tangled.sh/did:plc:123/repo))`
117117- `const did = extractDidFromUrl(tangledRemote.refs.fetch);`
118118- `if (did) return did;`
119119- `}`
120120-121121-`}`
122122-123123-`throw new Error("Could not infer repository context. Please use --repo <did> or run this inside a Tangled repository.");`
124124-`}`
125125-12670### Summary of Improvements
1277112872- **Context Inference:** This is the "killer feature" of gh that we are copying. It makes the tool usable for humans and safer for LLMs (less typing \= fewer errors).
···13276### Examples Tangled CLI Usage
1337713478```bash
135135-tangled auth login
7979+tangled auth login (opens a browser for auth)
13680tangled repo create my-new-repo
13781cd my-new-repo
13882tangled issue create "Bug: Something is broken"
13983tangled issue list --json "id,title"
14084```
141858686+### Task Management
8787+8888+We're bootstrapping task tracking with TODO.md, but will migrate all tasks into Tangled issues and dog food the product as soon as we have basic issue creation and listing working.
8989+14290### Outstanding Issues
14391144921. Can we allow auth through the web browser, rather than just CLI username/password? This would be more secure and user-friendly.
145932. The GitHub CLI manages the private keys allowing you to authenticate git operations. Can we do something similar, or will users have to manage SSH keys separately? Currently, I store my SSH keys in 1Password which signs requests for me. It would be great if tangled CLI could detect this and use it seamlessly, itentifying the user by the signed ssh key.
146146-3. How should we handle storing the AT Proto session securely? The GitHub CLI uses the OS keychain. We could do something similar.
9494+3. How should we handle storing the AT Proto session securely? The GitHub CLI uses the OS keychain. We could do something similar. How does this work across different platforms (Windows, macOS, Linux)? We want to avoid storing sensitive tokens in plaintext files.
147954. How are settings resolved (e.g. local config file, home folder, command-line flags)? We should define a clear precedence order.