@nagarjuna2002/ios-agent 0.2.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.
package/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # ios-agent
2
+
3
+ Project scaffolding and layout management for iOS work.
4
+
5
+ One idea: **the user owns `App/`, the tool owns `.ios-agent/`, and nothing else
6
+ appears at the project root.**
7
+
8
+ ```
9
+ MyApp/
10
+ ├── App/ # your source — the only directory you edit
11
+ ├── README.md
12
+ ├── LICENSE
13
+ └── .ios-agent/ # caches, logs, state, build artifacts, metadata
14
+ ```
15
+
16
+ Or, with `--minimal`:
17
+
18
+ ```
19
+ MyApp/
20
+ └── App/
21
+ ```
22
+
23
+ `.ios-agent/` materialises the first time a command needs it.
24
+
25
+ ## Install
26
+
27
+ ```
28
+ npm install -g ios-agent
29
+ ```
30
+
31
+ ## Create from a description
32
+
33
+ ```sh
34
+ ios-agent new TeaLog --brief 'An offline tea journal with tasting notes' --xcodegen
35
+ cd TeaLog/App
36
+ xcodegen generate --spec project.yml
37
+ open TeaLog.xcodeproj
38
+ ```
39
+
40
+ `--brief` saves the description and an implementation checklist in
41
+ `App/APP_BRIEF.md` for your coding agent. It does not call an AI service or
42
+ implement the described features. Both flags are optional and work with
43
+ `--minimal`; the visible root remains `App/`, `README.md`, and `LICENSE`
44
+ (or only `App/` in minimal mode).
45
+
46
+ `--xcodegen` writes an editable `App/project.yml`, `App/BUILD.md`, and separate
47
+ SVG starters under `App/<Name>/IconLayers/`. The specification includes an iOS
48
+ 17+ SwiftUI app, a unit-test target, and a shared scheme. The included test is a
49
+ placeholder to replace before shipping. Requires macOS, Xcode 15+ with an iOS
50
+ simulator runtime, and XcodeGen installed separately. The CLI neither installs
51
+ nor invokes them. Use an XcodeGen version compatible with your Xcode.
52
+
53
+ The layer folder contains background, foreground, and accent SVGs plus a manifest
54
+ and import instructions. Import them into [Icon Composer](https://developer.apple.com/icon-composer/)
55
+ using a compatible Xcode installation, customize the appearance, save a native
56
+ icon, configure the target, and validate it in Xcode. The manifest is our source
57
+ layer inventory, not Apple's format; no native `.icon` is generated or validated.
58
+ The starter layers are excluded from app resources.
59
+
60
+ `--force` permits a non-empty destination but refuses existing generated file
61
+ paths or symlink destinations before writing. It never overwrites your source,
62
+ brief, specification, README, or configuration. Choose a new app directory when
63
+ regenerating a starter.
64
+
65
+ Project configuration follows the [XcodeGen specification](https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md).
66
+ The CLI emits no `.xcodeproj`; running XcodeGen creates the real project.
67
+
68
+ ## Commands
69
+
70
+ ```
71
+ ios-agent new <Name> Scaffold a project
72
+ --brief <description> Save an implementation brief
73
+ --xcodegen Write project.yml and SVG icon layer starters
74
+ --minimal Only App/
75
+ --into <dir> Parent directory (default: cwd)
76
+ --no-license Skip LICENSE
77
+ --force Scaffold into a non-empty directory
78
+
79
+ ios-agent init [dir] Adopt an existing directory
80
+ ios-agent where Print resolved paths
81
+ ios-agent info Summarise the project
82
+ ios-agent clean [--dry-run] Delete disposable internal files
83
+ ios-agent doctor [--fix] Check the layout, and repair what is safe to repair
84
+ ios-agent completions <shell> Print a bash or zsh completion script
85
+ ```
86
+
87
+ `--json` works on `where`, `info`, `clean`, and `doctor`. `--project <dir>`
88
+ skips discovery on any command that reads a project.
89
+
90
+ `help` and the completion scripts are generated from the same table the parser
91
+ dispatches on, so they cannot describe a flag the CLI does not accept.
92
+
93
+ ### Exit codes
94
+
95
+ | Code | Meaning |
96
+ |---|---|
97
+ | 0 | Success |
98
+ | 1 | Usage error, or no project found |
99
+ | 2 | `doctor` found problems |
100
+
101
+ `doctor` is 2 rather than 1 so a script can tell "the project is unhealthy" from
102
+ "you called it wrong" without parsing stderr.
103
+
104
+ ### What `--fix` will and will not do
105
+
106
+ It repairs defects with a *derivable* correct value: a stale
107
+ `.ios-agent/.gitignore`, a missing internal directory, a config behind the
108
+ current layout version.
109
+
110
+ It will not create a missing `App/`. There is no safe automatic answer — the
111
+ tool would be inventing a project structure nobody asked for — so it stays
112
+ reported and untouched. A `--fix` that guesses is worse than no `--fix`.
113
+
114
+ ### Shell completions
115
+
116
+ ```
117
+ ios-agent completions zsh > ~/.zfunc/_ios-agent
118
+ ios-agent completions bash > /etc/bash_completion.d/ios-agent
119
+ ```
120
+
121
+ ## What is in `.ios-agent/`
122
+
123
+ | Entry | Tracked | Purpose |
124
+ |---|---|---|
125
+ | `config.json` | yes | Project identity and settings |
126
+ | `templates/` | yes | Project-local template overrides |
127
+ | `plugins/` | yes | Plugin manifests |
128
+ | `state.json` | no | Mutable runtime state |
129
+ | `metadata.json` | no | Derived facts from scanning |
130
+ | `cache/` | no | Project-derived cache |
131
+ | `logs/` | no | Command and build logs |
132
+ | `build/` | no | Derived build artifacts |
133
+ | `screenshots/` | no | Simulator captures |
134
+ | `tmp/` | no | Scratch space |
135
+
136
+ The generated `.ios-agent/.gitignore` ignores everything and unignores exactly
137
+ the tracked rows. Both that file and what `ios-agent clean` deletes come from
138
+ one declaration in `src/layout.ts`, so they cannot disagree — which is why
139
+ `clean` needs no confirmation prompt.
140
+
141
+ ## Interop
142
+
143
+ Other tools should not hardcode `.ios-agent`. Ask instead:
144
+
145
+ ```
146
+ ios-agent where --json
147
+ ```
148
+
149
+ `ios-agent-mcp` uses the directory only as a root marker — it reads, and never
150
+ writes, so its `filesystem: read` contract is unchanged.
151
+
152
+ ## Environment
153
+
154
+ | Variable | Effect |
155
+ |---|---|
156
+ | `IOS_AGENT_HOME` | Override project-root discovery |
157
+ | `IOS_AGENT_CACHE_DIR` | Override the user-level cache location |
158
+
159
+ The user-level cache defaults to `~/Library/Caches/ios-agent` on macOS,
160
+ `%LOCALAPPDATA%\ios-agent\Cache` on Windows, and `$XDG_CACHE_HOME/ios-agent`
161
+ (or `~/.cache/ios-agent`) elsewhere.
162
+
163
+ ## What this does not do
164
+
165
+ It does not implement features from the description, invoke an AI model, install
166
+ build tools, run XcodeGen, or create a native Icon Composer document. Without
167
+ `--xcodegen`, create the project in Xcode and add the generated sources.
@@ -0,0 +1,37 @@
1
+ import { ProjectLayout } from "./layout.js";
2
+ export interface IO {
3
+ out(text: string): void;
4
+ err(text: string): void;
5
+ cwd(): string;
6
+ env: NodeJS.ProcessEnv;
7
+ }
8
+ export declare const defaultIO: IO;
9
+ /**
10
+ * Exit codes, stable across releases.
11
+ *
12
+ * Separated so a script can tell "you called it wrong" from "the project is
13
+ * unhealthy". Collapsing both into 1 forces callers to parse stderr, which is
14
+ * the thing `--json` exists to avoid.
15
+ */
16
+ export declare const EXIT_OK = 0;
17
+ export declare const EXIT_USAGE = 1;
18
+ export declare const EXIT_UNHEALTHY = 2;
19
+ export declare function run(argv: string[], io?: IO): number;
20
+ export type Remedy = "regenerate-internal" | "migrate-config" | null;
21
+ export interface Diagnosis {
22
+ readonly ok: boolean;
23
+ readonly check: string;
24
+ readonly message: string;
25
+ /**
26
+ * How `--fix` repairs this, or null.
27
+ *
28
+ * Only defects with a *derivable* correct value are fixable. A missing `App/`
29
+ * has no safe automatic answer — creating it invents a project structure the
30
+ * user never asked for — so it is reported and left alone. A fix flag that
31
+ * guesses is worse than no fix flag.
32
+ */
33
+ readonly remedy: Remedy;
34
+ }
35
+ export declare function diagnose(layout: ProjectLayout, env?: NodeJS.ProcessEnv): Diagnosis[];
36
+ /** Exposed for tests: help and completions must cover every dispatchable command. */
37
+ export declare function commandNames(): string[];