airdy 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.
- package/LICENSE +21 -0
- package/README.md +84 -0
- package/bin/airdy.js +8 -0
- package/dist/adapters/claude-code.js +41 -0
- package/dist/adapters/codex.js +11 -0
- package/dist/adapters/index.js +9 -0
- package/dist/adapters/types.js +1 -0
- package/dist/cli/args.js +45 -0
- package/dist/config/user.js +49 -0
- package/dist/context.js +69 -0
- package/dist/git/steps.js +32 -0
- package/dist/main.js +312 -0
- package/dist/merge/json.js +33 -0
- package/dist/merge/markdown.js +16 -0
- package/dist/merge/template.js +3 -0
- package/dist/plan/builder.js +82 -0
- package/dist/plan/conflicts.js +113 -0
- package/dist/plan/executor.js +183 -0
- package/dist/profiles/index.js +15 -0
- package/dist/profiles/templates.js +68 -0
- package/dist/prompts/conflict.js +39 -0
- package/dist/prompts/wizard.js +217 -0
- package/dist/skills/package.js +53 -0
- package/dist/state/agentsetup.js +42 -0
- package/dist/types.js +1 -0
- package/dist/version.js +6 -0
- package/dist/workflows/module.js +88 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Raiy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# airdy
|
|
2
|
+
|
|
3
|
+
airdy is an interactive setup wizard for coding-agent projects. Run it inside a
|
|
4
|
+
project directory and it asks which agent(s) to configure, the project type,
|
|
5
|
+
workflows, skill packages, and a git strategy, then writes the project-level
|
|
6
|
+
config files those choices imply and optionally launches the chosen agent. It
|
|
7
|
+
writes only project files and never scaffolds application source code.
|
|
8
|
+
|
|
9
|
+
## Quickstart
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx airdy
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Run it in the directory you want to set up. The wizard walks these steps:
|
|
16
|
+
|
|
17
|
+
1. Which coding agent(s) to configure (`claude-code`, `codex`).
|
|
18
|
+
2. Project type (web, mobile-app, backend, desktop, oss-fork, minimal) — this
|
|
19
|
+
pre-selects the suggested skill packages for that type.
|
|
20
|
+
3. Development workflows (superpowers, verify-loop, ship-gate, none).
|
|
21
|
+
4. Skill packages to install.
|
|
22
|
+
5. Extra skills by git URL (optional; git installs land post-MVP).
|
|
23
|
+
6. Git setup (`git init`, `git clone`, `gh repo create`, or skip).
|
|
24
|
+
7. Which agent to launch — or print the launch command and exit.
|
|
25
|
+
|
|
26
|
+
## Flags
|
|
27
|
+
|
|
28
|
+
| Flag | Effect |
|
|
29
|
+
| ----------------- | -------------------------------------------------------- |
|
|
30
|
+
| `-y`, `--yes` | Non-interactive; requires `--config`. |
|
|
31
|
+
| `--config <file>` | Answers JSON for non-interactive mode. |
|
|
32
|
+
| `--dry-run` | Print the plan and the launch command; write nothing. |
|
|
33
|
+
| `--copy` | Copy skills into `.claude/skills` instead of symlinking. |
|
|
34
|
+
| `-v`, `--version` | Print the version. |
|
|
35
|
+
| `-h`, `--help` | Print help. |
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
Optional user config lives at `~/.config/airdy/config.json`:
|
|
40
|
+
|
|
41
|
+
- `packages` — named skill packages (merged over the built-ins).
|
|
42
|
+
- `presetSources` — directories holding workflow modules loaded by path.
|
|
43
|
+
- `preferences` — defaults such as `linkMode` (`link` or `copy`).
|
|
44
|
+
|
|
45
|
+
## What it writes
|
|
46
|
+
|
|
47
|
+
Depending on the selections, airdy writes some subset of:
|
|
48
|
+
|
|
49
|
+
| Path | Purpose |
|
|
50
|
+
| ----------------------- | ----------------------------------------------------------- |
|
|
51
|
+
| `AGENTS.md` | Canonical agent instructions (workflow sections merged in). |
|
|
52
|
+
| `CLAUDE.md` | One-line pointer to AGENTS.md (claude-code only). |
|
|
53
|
+
| `.gitignore` | Project ignore rules (on `git init` / `gh repo create`). |
|
|
54
|
+
| `.agents/skills/<name>` | Installed skill directories. |
|
|
55
|
+
| `.claude/skills` | Symlink (or copy) to `.agents/skills` (claude-code). |
|
|
56
|
+
| `.claude/settings.json` | Workflow-module hooks (deep-merged with existing). |
|
|
57
|
+
| `agentsetup.json` | airdy's own state: your selections plus the paths it owns. |
|
|
58
|
+
|
|
59
|
+
## Re-runs, idempotency, and conflicts
|
|
60
|
+
|
|
61
|
+
airdy is safe to re-run. Marker-based markdown sections and JSON settings are
|
|
62
|
+
merged idempotently, so re-running does not duplicate content. `agentsetup.json`
|
|
63
|
+
records the exact paths airdy has written (`ownedPaths`); a file airdy did not
|
|
64
|
+
create is never overwritten silently — in interactive mode you are prompted to
|
|
65
|
+
skip, overwrite, or merge, and under `--yes` such files are skipped and
|
|
66
|
+
reported.
|
|
67
|
+
|
|
68
|
+
## Security
|
|
69
|
+
|
|
70
|
+
Every write destination is confined to the project directory. Containment is
|
|
71
|
+
checked both lexically and via `realpath` — covering both a symlinked ancestor
|
|
72
|
+
directory and the destination path itself being a symlink — so a symlink
|
|
73
|
+
anywhere on the path cannot redirect a write outside the project tree. airdy
|
|
74
|
+
never touches global config (`~/.claude`, `~/.codex`).
|
|
75
|
+
|
|
76
|
+
Known limitation: containment is checked before each write, not atomically
|
|
77
|
+
with it (TOCTOU). Exploiting the gap requires local hostile timing (something
|
|
78
|
+
racing to swap in a symlink between the check and the write) rather than a
|
|
79
|
+
remote or data-only attack.
|
|
80
|
+
|
|
81
|
+
## Scope
|
|
82
|
+
|
|
83
|
+
This is the MVP. Local skill packages install by copying a directory. Git-source
|
|
84
|
+
and marketplace skill installs are stubbed and land post-MVP.
|
package/bin/airdy.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const CLAUDE_POINTER = `See [AGENTS.md](./AGENTS.md) for all project context, conventions, and workflows.
|
|
2
|
+
|
|
3
|
+
This file is only a pointer. Edit AGENTS.md, not this file.
|
|
4
|
+
`;
|
|
5
|
+
function hasSkills(answers) {
|
|
6
|
+
return answers.skillPackages.length > 0 || answers.extraSkills.length > 0;
|
|
7
|
+
}
|
|
8
|
+
export const claudeCodeAdapter = {
|
|
9
|
+
id: "claude-code",
|
|
10
|
+
cliName: "claude",
|
|
11
|
+
contribute(answers, _ctx) {
|
|
12
|
+
const actions = [
|
|
13
|
+
{
|
|
14
|
+
type: "write-file",
|
|
15
|
+
path: "CLAUDE.md",
|
|
16
|
+
mode: "create",
|
|
17
|
+
contents: CLAUDE_POINTER,
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
if (hasSkills(answers)) {
|
|
21
|
+
if (answers.linkMode === "link") {
|
|
22
|
+
actions.push({
|
|
23
|
+
type: "symlink",
|
|
24
|
+
path: ".claude/skills",
|
|
25
|
+
target: "../.agents/skills",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
actions.push({
|
|
30
|
+
type: "copy-dir",
|
|
31
|
+
from: ".agents/skills",
|
|
32
|
+
to: ".claude/skills",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return actions;
|
|
37
|
+
},
|
|
38
|
+
launchCommand(_ctx) {
|
|
39
|
+
return { cmd: "claude", args: [] };
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const codexAdapter = {
|
|
2
|
+
id: "codex",
|
|
3
|
+
cliName: "codex",
|
|
4
|
+
contribute(_answers, _ctx) {
|
|
5
|
+
return [];
|
|
6
|
+
},
|
|
7
|
+
launchCommand(_ctx) {
|
|
8
|
+
return { cmd: "codex", args: [] };
|
|
9
|
+
},
|
|
10
|
+
trustNote: "Codex ignores an untrusted project's .codex/ directory on first launch. Run codex once and trust this folder for project config to take effect.",
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { claudeCodeAdapter } from "./claude-code.js";
|
|
2
|
+
import { codexAdapter } from "./codex.js";
|
|
3
|
+
export const allAdapters = [claudeCodeAdapter, codexAdapter];
|
|
4
|
+
export function getAdapter(id) {
|
|
5
|
+
const found = allAdapters.find((a) => a.id === id);
|
|
6
|
+
if (!found)
|
|
7
|
+
throw new Error(`No adapter registered for agent "${id}"`);
|
|
8
|
+
return found;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli/args.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function parseArgs(argv) {
|
|
2
|
+
const out = {
|
|
3
|
+
yes: false,
|
|
4
|
+
configPath: null,
|
|
5
|
+
dryRun: false,
|
|
6
|
+
copy: false,
|
|
7
|
+
version: false,
|
|
8
|
+
help: false,
|
|
9
|
+
};
|
|
10
|
+
for (let i = 0; i < argv.length; i++) {
|
|
11
|
+
const arg = argv[i];
|
|
12
|
+
switch (arg) {
|
|
13
|
+
case "--yes":
|
|
14
|
+
case "-y":
|
|
15
|
+
out.yes = true;
|
|
16
|
+
break;
|
|
17
|
+
case "--config": {
|
|
18
|
+
const value = argv[i + 1];
|
|
19
|
+
if (value === undefined || value.startsWith("-")) {
|
|
20
|
+
throw new Error("--config requires a file path");
|
|
21
|
+
}
|
|
22
|
+
out.configPath = value;
|
|
23
|
+
i++;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case "--dry-run":
|
|
27
|
+
out.dryRun = true;
|
|
28
|
+
break;
|
|
29
|
+
case "--copy":
|
|
30
|
+
out.copy = true;
|
|
31
|
+
break;
|
|
32
|
+
case "--version":
|
|
33
|
+
case "-v":
|
|
34
|
+
out.version = true;
|
|
35
|
+
break;
|
|
36
|
+
case "--help":
|
|
37
|
+
case "-h":
|
|
38
|
+
out.help = true;
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
throw new Error(`unknown flag: ${arg}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { isAbsolute, join } from "node:path";
|
|
4
|
+
export const BUILTIN_PACKAGES = {
|
|
5
|
+
core: { description: "Baseline skills", skills: [] },
|
|
6
|
+
web: { description: "Web development", skills: [] },
|
|
7
|
+
backend: { description: "Backend development", skills: [] },
|
|
8
|
+
mobile: { description: "Mobile development", skills: [] },
|
|
9
|
+
desktop: { description: "Desktop development", skills: [] },
|
|
10
|
+
};
|
|
11
|
+
export async function loadUserConfig(home = homedir()) {
|
|
12
|
+
const path = join(home, ".config", "airdy", "config.json");
|
|
13
|
+
try {
|
|
14
|
+
const raw = JSON.parse(await readFile(path, "utf8"));
|
|
15
|
+
return {
|
|
16
|
+
packages: raw.packages ?? {},
|
|
17
|
+
preferences: raw.preferences ?? {},
|
|
18
|
+
presetSources: raw.presetSources ?? [],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return { packages: {}, preferences: {}, presetSources: [] };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function mergePackages(config) {
|
|
26
|
+
return { ...BUILTIN_PACKAGES, ...config.packages };
|
|
27
|
+
}
|
|
28
|
+
export async function loadAnswersFromConfig(configPath, root, copy) {
|
|
29
|
+
const abs = isAbsolute(configPath) ? configPath : join(root, configPath);
|
|
30
|
+
const raw = JSON.parse(await readFile(abs, "utf8"));
|
|
31
|
+
if (!raw.agents || raw.agents.length === 0) {
|
|
32
|
+
throw new Error("config: 'agents' must be a non-empty array");
|
|
33
|
+
}
|
|
34
|
+
if (!raw.projectType) {
|
|
35
|
+
throw new Error("config: 'projectType' is required");
|
|
36
|
+
}
|
|
37
|
+
const agents = raw.agents;
|
|
38
|
+
return {
|
|
39
|
+
agents,
|
|
40
|
+
launchAgent: raw.launchAgent ?? agents[0],
|
|
41
|
+
projectType: raw.projectType,
|
|
42
|
+
workflows: raw.workflows ?? ["none"],
|
|
43
|
+
skillPackages: raw.skillPackages ?? [],
|
|
44
|
+
extraSkills: raw.extraSkills ?? [],
|
|
45
|
+
git: raw.git ?? { kind: "skip" },
|
|
46
|
+
linkMode: raw.linkMode ?? (copy ? "copy" : "link"),
|
|
47
|
+
autoLaunch: raw.autoLaunch ?? true,
|
|
48
|
+
};
|
|
49
|
+
}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { readdir, stat } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { execFile } from "node:child_process";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
const pExecFile = promisify(execFile);
|
|
6
|
+
export async function commandExists(name) {
|
|
7
|
+
const finder = process.platform === "win32" ? "where" : "which";
|
|
8
|
+
try {
|
|
9
|
+
await pExecFile(finder, [name]);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function exists(path) {
|
|
17
|
+
try {
|
|
18
|
+
await stat(path);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function detectContext(cwd) {
|
|
26
|
+
let entries = [];
|
|
27
|
+
try {
|
|
28
|
+
entries = await readdir(cwd);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
entries = [];
|
|
32
|
+
}
|
|
33
|
+
const visible = entries.filter((e) => e !== ".git");
|
|
34
|
+
const [git, claude, codex, gh] = await Promise.all([
|
|
35
|
+
commandExists("git"),
|
|
36
|
+
commandExists("claude"),
|
|
37
|
+
commandExists("codex"),
|
|
38
|
+
commandExists("gh"),
|
|
39
|
+
]);
|
|
40
|
+
return {
|
|
41
|
+
cwd,
|
|
42
|
+
isEmpty: visible.length === 0,
|
|
43
|
+
isGitRepo: await exists(join(cwd, ".git")),
|
|
44
|
+
hasAgentsMd: await exists(join(cwd, "AGENTS.md")),
|
|
45
|
+
hasClaudeMd: await exists(join(cwd, "CLAUDE.md")),
|
|
46
|
+
hasClaudeDir: await exists(join(cwd, ".claude")),
|
|
47
|
+
hasAgentSetup: await exists(join(cwd, "agentsetup.json")),
|
|
48
|
+
cli: { git, claude, codex, gh },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function checkPreflight(answers, ctx) {
|
|
52
|
+
const warnings = [];
|
|
53
|
+
const needsGit = answers.git.kind === "init" ||
|
|
54
|
+
answers.git.kind === "clone" ||
|
|
55
|
+
answers.git.kind === "gh-create";
|
|
56
|
+
if (needsGit && !ctx.cli.git) {
|
|
57
|
+
warnings.push("git is not installed — the git step will be skipped. Install: https://git-scm.com");
|
|
58
|
+
}
|
|
59
|
+
if (answers.git.kind === "gh-create" && !ctx.cli.gh) {
|
|
60
|
+
warnings.push("gh (GitHub CLI) is not installed — cannot create a remote repo. Install: https://cli.github.com");
|
|
61
|
+
}
|
|
62
|
+
if (answers.launchAgent === "claude-code" && !ctx.cli.claude) {
|
|
63
|
+
warnings.push("claude CLI not found — files will be written but the agent will not auto-launch.");
|
|
64
|
+
}
|
|
65
|
+
if (answers.launchAgent === "codex" && !ctx.cli.codex) {
|
|
66
|
+
warnings.push("codex CLI not found — files will be written but the agent will not auto-launch.");
|
|
67
|
+
}
|
|
68
|
+
return warnings;
|
|
69
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
const pExecFile = promisify(execFile);
|
|
4
|
+
export async function preGit(action, root) {
|
|
5
|
+
switch (action.kind) {
|
|
6
|
+
case "init":
|
|
7
|
+
await pExecFile("git", ["init", "-b", action.branch], { cwd: root });
|
|
8
|
+
return;
|
|
9
|
+
case "gh-create":
|
|
10
|
+
await pExecFile("git", ["init", "-b", "main"], { cwd: root });
|
|
11
|
+
return;
|
|
12
|
+
case "clone":
|
|
13
|
+
await pExecFile("git", ["clone", action.url, "."], { cwd: root });
|
|
14
|
+
return;
|
|
15
|
+
case "skip":
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export async function postGit(action, root) {
|
|
20
|
+
if (action.kind === "gh-create") {
|
|
21
|
+
await pExecFile("gh", [
|
|
22
|
+
"repo",
|
|
23
|
+
"create",
|
|
24
|
+
action.name,
|
|
25
|
+
`--${action.visibility}`,
|
|
26
|
+
"--source",
|
|
27
|
+
".",
|
|
28
|
+
"--remote",
|
|
29
|
+
"origin",
|
|
30
|
+
], { cwd: root });
|
|
31
|
+
}
|
|
32
|
+
}
|