archondev 0.1.0 → 1.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.
@@ -0,0 +1,62 @@
1
+ // src/cli/config.ts
2
+ import { homedir } from "os";
3
+ import { join } from "path";
4
+ import { readFile, writeFile, mkdir, chmod, unlink } from "fs/promises";
5
+ import { existsSync } from "fs";
6
+ var CONFIG_DIR = join(homedir(), ".archon");
7
+ var CONFIG_FILE = join(CONFIG_DIR, "config.json");
8
+ function getAuthToken(config) {
9
+ return config.accessToken;
10
+ }
11
+ function getApiUrl(config) {
12
+ return config.apiUrl || "https://archondev-api.fly.dev";
13
+ }
14
+ async function ensureConfigDir() {
15
+ if (!existsSync(CONFIG_DIR)) {
16
+ await mkdir(CONFIG_DIR, { recursive: true, mode: 448 });
17
+ }
18
+ }
19
+ async function loadConfig() {
20
+ try {
21
+ if (!existsSync(CONFIG_FILE)) {
22
+ return {};
23
+ }
24
+ const content = await readFile(CONFIG_FILE, "utf-8");
25
+ return JSON.parse(content);
26
+ } catch {
27
+ return {};
28
+ }
29
+ }
30
+ async function saveConfig(config) {
31
+ await ensureConfigDir();
32
+ const content = JSON.stringify(config, null, 2);
33
+ await writeFile(CONFIG_FILE, content, { mode: 384 });
34
+ await chmod(CONFIG_FILE, 384);
35
+ }
36
+ async function clearConfig() {
37
+ if (existsSync(CONFIG_FILE)) {
38
+ await unlink(CONFIG_FILE);
39
+ }
40
+ }
41
+ async function isAuthenticated() {
42
+ const config = await loadConfig();
43
+ if (!config.accessToken) {
44
+ return false;
45
+ }
46
+ if (config.expiresAt) {
47
+ const expiresAt = new Date(config.expiresAt);
48
+ if (expiresAt < /* @__PURE__ */ new Date()) {
49
+ return false;
50
+ }
51
+ }
52
+ return true;
53
+ }
54
+
55
+ export {
56
+ getAuthToken,
57
+ getApiUrl,
58
+ loadConfig,
59
+ saveConfig,
60
+ clearConfig,
61
+ isAuthenticated
62
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ ReviewDatabase,
3
+ ReviewService,
4
+ analyzeProject,
5
+ featuresToTasks,
6
+ readArchitectureContext
7
+ } from "./chunk-VKM3HAHW.js";
8
+ import "./chunk-A7QU6JC6.js";
9
+ import "./chunk-QGM4M3NI.js";
10
+ export {
11
+ ReviewDatabase,
12
+ ReviewService,
13
+ analyzeProject,
14
+ featuresToTasks,
15
+ readArchitectureContext
16
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ execute
3
+ } from "./chunk-I4ZVNLNO.js";
4
+ import "./chunk-EDP55FCI.js";
5
+ import "./chunk-2CFO5GVH.js";
6
+ import "./chunk-MOZHC2GX.js";
7
+ import "./chunk-A7QU6JC6.js";
8
+ import "./chunk-SMR7JQK6.js";
9
+ import "./chunk-WCCBJSNI.js";
10
+ import "./chunk-QGM4M3NI.js";
11
+ export {
12
+ execute
13
+ };