@iloom/cli 0.7.0 → 0.7.1
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/dist/{ProjectCapabilityDetector-UZYW32SY.js → ProjectCapabilityDetector-IA56AUE6.js} +3 -3
- package/dist/agents/iloom-framework-detector.md +78 -9
- package/dist/{build-O2EJHDEW.js → build-HQ5HGA3T.js} +4 -4
- package/dist/{chunk-3CDWFEGL.js → chunk-7GLZVDPQ.js} +2 -2
- package/dist/{chunk-GV5X6XUE.js → chunk-AFRICMSW.js} +3 -3
- package/dist/{chunk-LQBLDI47.js → chunk-DAOS6EC3.js} +4 -4
- package/dist/{chunk-Z6BO53V7.js → chunk-ELJKYFSH.js} +3 -3
- package/dist/{chunk-S7YMZQUD.js → chunk-QQFBMCAH.js} +26 -3
- package/dist/chunk-QQFBMCAH.js.map +1 -0
- package/dist/{chunk-LLWX3PCW.js → chunk-RD7I2Q2F.js} +2 -2
- package/dist/{chunk-ITN64ENQ.js → chunk-XPKN3QWY.js} +24 -6
- package/dist/chunk-XPKN3QWY.js.map +1 -0
- package/dist/{chunk-NTIZLX42.js → chunk-YQNSZKKT.js} +3 -3
- package/dist/{cleanup-ZPOMRSNN.js → cleanup-77U5ATYI.js} +5 -5
- package/dist/cli.js +38 -18
- package/dist/cli.js.map +1 -1
- package/dist/{commit-6S2RIA2K.js → commit-ONRXU67O.js} +4 -4
- package/dist/{compile-LRMAADUT.js → compile-CT7IR7O2.js} +4 -4
- package/dist/{dev-server-GREJUEKW.js → dev-server-UKAPBGUR.js} +5 -5
- package/dist/{feedback-G7G5QCY4.js → feedback-K3A4QUSG.js} +3 -3
- package/dist/{lint-OFVN7FT6.js → lint-HAVU4U34.js} +4 -4
- package/dist/{open-MCWQAPSZ.js → open-QI63XQ4F.js} +5 -5
- package/dist/{projects-PQOTWUII.js → projects-TWY4RT2Z.js} +3 -3
- package/dist/prompts/init-prompt.txt +57 -0
- package/dist/{rebase-RKQED567.js → rebase-QYCRF7JG.js} +5 -5
- package/dist/{run-CCG24PBC.js → run-YDVYORT2.js} +5 -5
- package/dist/{test-QZDOEUIO.js → test-75WAA6DU.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-ITN64ENQ.js.map +0 -1
- package/dist/chunk-S7YMZQUD.js.map +0 -1
- /package/dist/{ProjectCapabilityDetector-UZYW32SY.js.map → ProjectCapabilityDetector-IA56AUE6.js.map} +0 -0
- /package/dist/{build-O2EJHDEW.js.map → build-HQ5HGA3T.js.map} +0 -0
- /package/dist/{chunk-3CDWFEGL.js.map → chunk-7GLZVDPQ.js.map} +0 -0
- /package/dist/{chunk-GV5X6XUE.js.map → chunk-AFRICMSW.js.map} +0 -0
- /package/dist/{chunk-LQBLDI47.js.map → chunk-DAOS6EC3.js.map} +0 -0
- /package/dist/{chunk-Z6BO53V7.js.map → chunk-ELJKYFSH.js.map} +0 -0
- /package/dist/{chunk-LLWX3PCW.js.map → chunk-RD7I2Q2F.js.map} +0 -0
- /package/dist/{chunk-NTIZLX42.js.map → chunk-YQNSZKKT.js.map} +0 -0
- /package/dist/{cleanup-ZPOMRSNN.js.map → cleanup-77U5ATYI.js.map} +0 -0
- /package/dist/{commit-6S2RIA2K.js.map → commit-ONRXU67O.js.map} +0 -0
- /package/dist/{compile-LRMAADUT.js.map → compile-CT7IR7O2.js.map} +0 -0
- /package/dist/{dev-server-GREJUEKW.js.map → dev-server-UKAPBGUR.js.map} +0 -0
- /package/dist/{feedback-G7G5QCY4.js.map → feedback-K3A4QUSG.js.map} +0 -0
- /package/dist/{lint-OFVN7FT6.js.map → lint-HAVU4U34.js.map} +0 -0
- /package/dist/{open-MCWQAPSZ.js.map → open-QI63XQ4F.js.map} +0 -0
- /package/dist/{projects-PQOTWUII.js.map → projects-TWY4RT2Z.js.map} +0 -0
- /package/dist/{rebase-RKQED567.js.map → rebase-QYCRF7JG.js.map} +0 -0
- /package/dist/{run-CCG24PBC.js.map → run-YDVYORT2.js.map} +0 -0
- /package/dist/{test-QZDOEUIO.js.map → test-75WAA6DU.js.map} +0 -0
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CommitManager,
|
|
4
4
|
ValidationRunner
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-YQNSZKKT.js";
|
|
6
|
+
import "./chunk-RD7I2Q2F.js";
|
|
7
7
|
import {
|
|
8
8
|
GitWorktreeManager
|
|
9
9
|
} from "./chunk-UDRZY65Y.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-XPKN3QWY.js";
|
|
11
11
|
import {
|
|
12
12
|
IssueManagementProviderFactory
|
|
13
13
|
} from "./chunk-GJMEKEI5.js";
|
|
@@ -234,4 +234,4 @@ export {
|
|
|
234
234
|
CommitCommand,
|
|
235
235
|
WorktreeValidationError
|
|
236
236
|
};
|
|
237
|
-
//# sourceMappingURL=commit-
|
|
237
|
+
//# sourceMappingURL=commit-ONRXU67O.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ScriptCommandBase
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ELJKYFSH.js";
|
|
5
5
|
import "./chunk-5V74K5ZA.js";
|
|
6
6
|
import {
|
|
7
7
|
runScript
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RD7I2Q2F.js";
|
|
9
9
|
import "./chunk-UDRZY65Y.js";
|
|
10
10
|
import {
|
|
11
11
|
getPackageScripts
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XPKN3QWY.js";
|
|
13
13
|
import "./chunk-ZA575VLF.js";
|
|
14
14
|
import "./chunk-WFQ5CLTR.js";
|
|
15
15
|
import "./chunk-VWGKGNJP.js";
|
|
@@ -54,4 +54,4 @@ var CompileCommand = class extends ScriptCommandBase {
|
|
|
54
54
|
export {
|
|
55
55
|
CompileCommand
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=compile-
|
|
57
|
+
//# sourceMappingURL=compile-CT7IR7O2.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
DevServerManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AFRICMSW.js";
|
|
5
5
|
import {
|
|
6
6
|
getWorkspacePort
|
|
7
7
|
} from "./chunk-453NC377.js";
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
} from "./chunk-5V74K5ZA.js";
|
|
11
11
|
import {
|
|
12
12
|
ProjectCapabilityDetector
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-7GLZVDPQ.js";
|
|
14
|
+
import "./chunk-RD7I2Q2F.js";
|
|
15
15
|
import {
|
|
16
16
|
GitWorktreeManager
|
|
17
17
|
} from "./chunk-UDRZY65Y.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-XPKN3QWY.js";
|
|
19
19
|
import {
|
|
20
20
|
extractSettingsOverrides
|
|
21
21
|
} from "./chunk-GYCR2LOU.js";
|
|
@@ -255,4 +255,4 @@ var DevServerCommand = class {
|
|
|
255
255
|
export {
|
|
256
256
|
DevServerCommand
|
|
257
257
|
};
|
|
258
|
-
//# sourceMappingURL=dev-server-
|
|
258
|
+
//# sourceMappingURL=dev-server-UKAPBGUR.js.map
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
} from "./chunk-HVQNVRAF.js";
|
|
6
6
|
import {
|
|
7
7
|
ProjectCapabilityDetector
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7GLZVDPQ.js";
|
|
9
9
|
import {
|
|
10
10
|
AgentManager
|
|
11
11
|
} from "./chunk-N7FVXZNI.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-XPKN3QWY.js";
|
|
13
13
|
import "./chunk-YETJNRQM.js";
|
|
14
14
|
import "./chunk-TIYJEEVO.js";
|
|
15
15
|
import {
|
|
@@ -164,4 +164,4 @@ ${userBody}`;
|
|
|
164
164
|
export {
|
|
165
165
|
FeedbackCommand
|
|
166
166
|
};
|
|
167
|
-
//# sourceMappingURL=feedback-
|
|
167
|
+
//# sourceMappingURL=feedback-K3A4QUSG.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ScriptCommandBase
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ELJKYFSH.js";
|
|
5
5
|
import "./chunk-5V74K5ZA.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-RD7I2Q2F.js";
|
|
7
7
|
import "./chunk-UDRZY65Y.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-XPKN3QWY.js";
|
|
9
9
|
import "./chunk-ZA575VLF.js";
|
|
10
10
|
import "./chunk-WFQ5CLTR.js";
|
|
11
11
|
import "./chunk-VWGKGNJP.js";
|
|
@@ -24,4 +24,4 @@ var LintCommand = class extends ScriptCommandBase {
|
|
|
24
24
|
export {
|
|
25
25
|
LintCommand
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=lint-
|
|
27
|
+
//# sourceMappingURL=lint-HAVU4U34.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
DevServerManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AFRICMSW.js";
|
|
5
5
|
import {
|
|
6
6
|
getWorkspacePort
|
|
7
7
|
} from "./chunk-453NC377.js";
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
} from "./chunk-5V74K5ZA.js";
|
|
11
11
|
import {
|
|
12
12
|
ProjectCapabilityDetector
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-7GLZVDPQ.js";
|
|
14
|
+
import "./chunk-RD7I2Q2F.js";
|
|
15
15
|
import {
|
|
16
16
|
GitWorktreeManager
|
|
17
17
|
} from "./chunk-UDRZY65Y.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-XPKN3QWY.js";
|
|
19
19
|
import {
|
|
20
20
|
openBrowser
|
|
21
21
|
} from "./chunk-YETJNRQM.js";
|
|
@@ -237,4 +237,4 @@ Make sure the project is built (run 'il start' first)`
|
|
|
237
237
|
export {
|
|
238
238
|
OpenCommand
|
|
239
239
|
};
|
|
240
|
-
//# sourceMappingURL=open-
|
|
240
|
+
//# sourceMappingURL=open-QI63XQ4F.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ProjectCapabilityDetector
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-7GLZVDPQ.js";
|
|
5
|
+
import "./chunk-XPKN3QWY.js";
|
|
6
6
|
import {
|
|
7
7
|
MetadataManager
|
|
8
8
|
} from "./chunk-VWGKGNJP.js";
|
|
@@ -84,4 +84,4 @@ var ProjectsCommand = class {
|
|
|
84
84
|
export {
|
|
85
85
|
ProjectsCommand
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=projects-
|
|
87
|
+
//# sourceMappingURL=projects-TWY4RT2Z.js.map
|
|
@@ -7,6 +7,35 @@
|
|
|
7
7
|
|
|
8
8
|
**If NO to all → IMMEDIATELY decline and redirect to exit session**
|
|
9
9
|
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🍴 FORK CONTRIBUTOR RULE - APPLIES TO ALL FILE DECISIONS
|
|
13
|
+
|
|
14
|
+
**CRITICAL: Check this FIRST before recommending ANY iloom configuration file.**
|
|
15
|
+
|
|
16
|
+
**Fork Detection Check:**
|
|
17
|
+
If BOTH "origin" AND "upstream" git remotes are detected → This is a FORK.
|
|
18
|
+
|
|
19
|
+
**When Fork Detected:**
|
|
20
|
+
ALL iloom configuration files should default to their `.local` variants:
|
|
21
|
+
- `settings.local.json` (NOT `settings.json`)
|
|
22
|
+
- `package.iloom.local.json` (NOT `package.iloom.json`)
|
|
23
|
+
|
|
24
|
+
**Why:**
|
|
25
|
+
- Local variants are globally gitignored and won't appear in PRs to upstream
|
|
26
|
+
- Prevents personal iloom configuration from polluting upstream repository
|
|
27
|
+
- Your code changes should be the only thing in your PRs - not iloom settings
|
|
28
|
+
|
|
29
|
+
**How to Apply:**
|
|
30
|
+
1. At the START of any configuration session, check for fork pattern
|
|
31
|
+
2. If fork detected, set mental "fork mode" flag for the entire session
|
|
32
|
+
3. When ANY file creation/recommendation is made, default to `.local` variant
|
|
33
|
+
4. Remind the user why local files are recommended for forks
|
|
34
|
+
|
|
35
|
+
**This rule supersedes other file location recommendations when fork is detected.**
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
10
39
|
## 🚫 FILE ACCESS RULES - STRICTLY ENFORCE
|
|
11
40
|
|
|
12
41
|
**SETTINGS FILES (.iloom/settings.json and .iloom/settings.local.json):**
|
|
@@ -708,6 +737,8 @@ Use AskUserQuestion to ask ALL local development settings questions **IN A SINGL
|
|
|
708
737
|
|
|
709
738
|
iloom needs to detect the project's language and framework to configure build/test/dev scripts.
|
|
710
739
|
|
|
740
|
+
**IMPORTANT - Fork Mode Reminder:** If fork was detected earlier (origin + upstream remotes), pass this context to the framework detector. The detector should recommend `package.iloom.local.json` instead of `package.iloom.json` for fork contributors.
|
|
741
|
+
|
|
711
742
|
**Invoke the framework detector agent** using the `iloom-framework-detector` agent:
|
|
712
743
|
|
|
713
744
|
The agent will:
|
|
@@ -1401,6 +1432,32 @@ If users ask about specific configurations, help them add these sections to thei
|
|
|
1401
1432
|
- Running additional commands before/after the standard npm scripts
|
|
1402
1433
|
- Wrapping commands with environment variables or tools
|
|
1403
1434
|
|
|
1435
|
+
**Local Overrides for Fork Contributors:**
|
|
1436
|
+
|
|
1437
|
+
If you're contributing to a forked repository, save your customizations to `.iloom/package.iloom.local.json` instead of `package.iloom.json`. This file:
|
|
1438
|
+
- Is automatically added to global gitignore (won't appear in PRs)
|
|
1439
|
+
- Merges with package.iloom.json (local scripts override base scripts)
|
|
1440
|
+
- Is automatically copied to new looms
|
|
1441
|
+
|
|
1442
|
+
**When to use each file:**
|
|
1443
|
+
- `package.iloom.json` - Shared team configuration, committed to git
|
|
1444
|
+
- `package.iloom.local.json` - Personal overrides, never committed (gitignored globally)
|
|
1445
|
+
|
|
1446
|
+
Example `.iloom/package.iloom.local.json`:
|
|
1447
|
+
```json
|
|
1448
|
+
{
|
|
1449
|
+
"scripts": {
|
|
1450
|
+
"test": "pytest --my-local-options",
|
|
1451
|
+
"dev": "python -m mymodule --debug"
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
```
|
|
1455
|
+
|
|
1456
|
+
This is especially useful when:
|
|
1457
|
+
- Working on a fork where upstream has different script requirements
|
|
1458
|
+
- Your local environment needs different commands than the team standard
|
|
1459
|
+
- You want to add debug flags or local-only tooling without affecting others
|
|
1460
|
+
|
|
1404
1461
|
## Important Notes
|
|
1405
1462
|
|
|
1406
1463
|
- **Validate ALL inputs** against the schema before writing files
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BuildRunner,
|
|
4
4
|
MergeManager
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-DAOS6EC3.js";
|
|
6
|
+
import "./chunk-7GLZVDPQ.js";
|
|
7
7
|
import {
|
|
8
8
|
installDependencies
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RD7I2Q2F.js";
|
|
10
10
|
import {
|
|
11
11
|
GitWorktreeManager
|
|
12
12
|
} from "./chunk-UDRZY65Y.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-XPKN3QWY.js";
|
|
14
14
|
import {
|
|
15
15
|
getWorktreeRoot,
|
|
16
16
|
isValidGitRepo
|
|
@@ -139,4 +139,4 @@ export {
|
|
|
139
139
|
RebaseCommand,
|
|
140
140
|
WorktreeValidationError
|
|
141
141
|
};
|
|
142
|
-
//# sourceMappingURL=rebase-
|
|
142
|
+
//# sourceMappingURL=rebase-QYCRF7JG.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
DevServerManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AFRICMSW.js";
|
|
5
5
|
import {
|
|
6
6
|
getWorkspacePort
|
|
7
7
|
} from "./chunk-453NC377.js";
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
} from "./chunk-5V74K5ZA.js";
|
|
11
11
|
import {
|
|
12
12
|
ProjectCapabilityDetector
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-7GLZVDPQ.js";
|
|
14
|
+
import "./chunk-RD7I2Q2F.js";
|
|
15
15
|
import {
|
|
16
16
|
GitWorktreeManager
|
|
17
17
|
} from "./chunk-UDRZY65Y.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-XPKN3QWY.js";
|
|
19
19
|
import {
|
|
20
20
|
openBrowser
|
|
21
21
|
} from "./chunk-YETJNRQM.js";
|
|
@@ -237,4 +237,4 @@ Make sure the project is built (run 'il start' first)`
|
|
|
237
237
|
export {
|
|
238
238
|
RunCommand
|
|
239
239
|
};
|
|
240
|
-
//# sourceMappingURL=run-
|
|
240
|
+
//# sourceMappingURL=run-YDVYORT2.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ScriptCommandBase
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ELJKYFSH.js";
|
|
5
5
|
import "./chunk-5V74K5ZA.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-RD7I2Q2F.js";
|
|
7
7
|
import "./chunk-UDRZY65Y.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-XPKN3QWY.js";
|
|
9
9
|
import "./chunk-ZA575VLF.js";
|
|
10
10
|
import "./chunk-WFQ5CLTR.js";
|
|
11
11
|
import "./chunk-VWGKGNJP.js";
|
|
@@ -24,4 +24,4 @@ var TestCommand = class extends ScriptCommandBase {
|
|
|
24
24
|
export {
|
|
25
25
|
TestCommand
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=test-
|
|
27
|
+
//# sourceMappingURL=test-75WAA6DU.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iloom/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Control plane for maintaining alignment between you and Claude Code as you work across multiple issues using isolated environments, visible context, and multi-agent workflows to scale understanding, not just output",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/package-json.ts"],"sourcesContent":["import fs from 'fs-extra'\nimport path from 'path'\nimport { getLogger } from './logger-context.js'\nimport type { ProjectCapability } from '../types/loom.js'\n\n/**\n * Path to the iloom package configuration file (relative to project root)\n * This file allows non-Node.js projects to define scripts for iloom workflows\n */\nexport const ILOOM_PACKAGE_PATH = '.iloom/package.iloom.json'\n\nexport interface PackageJson {\n name: string\n version?: string\n bin?: string | Record<string, string>\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n scripts?: Record<string, string>\n capabilities?: ProjectCapability[]\n [key: string]: unknown\n}\n\n/**\n * Source of a script - determines how it should be executed\n * - 'package-manager': Execute via package manager (pnpm/npm/yarn)\n * - 'iloom-config': Execute directly as shell command\n */\nexport type ScriptSource = 'package-manager' | 'iloom-config'\n\n/**\n * Configuration for a single script including its source\n * The source determines whether to use package manager or direct shell execution\n */\nexport interface PackageScriptConfig {\n /** The script command to execute */\n command: string\n /** Source of the script - determines execution method */\n source: ScriptSource\n}\n\n/**\n * Read and parse package.json from a directory\n * @param dir Directory containing package.json\n * @returns Parsed package.json object\n * @throws Error if package.json doesn't exist or contains invalid JSON\n */\nexport async function readPackageJson(dir: string): Promise<PackageJson> {\n const pkgPath = path.join(dir, 'package.json')\n\n try {\n const pkgJson = await fs.readJson(pkgPath)\n return pkgJson as PackageJson\n } catch (error) {\n if ((error as { code?: string }).code === 'ENOENT') {\n throw new Error(`package.json not found in ${dir}`)\n }\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new Error(`Invalid package.json in ${dir}: ${message}`)\n }\n}\n\n/**\n * Read scripts from .iloom/package.iloom.json if it exists\n * This file takes precedence over package.json and contains raw shell commands\n * @param dir Directory containing .iloom/package.iloom.json\n * @returns PackageJson-like object with scripts, or null if file doesn't exist\n */\nexport async function readIloomPackageScripts(dir: string): Promise<PackageJson | null> {\n const iloomPkgPath = path.join(dir, ILOOM_PACKAGE_PATH)\n\n try {\n const exists = await fs.pathExists(iloomPkgPath)\n if (!exists) {\n return null\n }\n\n const content = await fs.readJson(iloomPkgPath)\n return content as PackageJson\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error'\n getLogger().warn(`Failed to read ${ILOOM_PACKAGE_PATH}: ${message}`)\n return null\n }\n}\n\n/**\n * Read package configuration for a project, merging .iloom/package.iloom.json scripts over package.json\n * This allows non-Node.js projects to define scripts for iloom workflows while preserving\n * all other package.json fields (name, version, bin, dependencies, etc.)\n *\n * @param dir Directory to read package configuration from\n * @returns PackageJson object with merged scripts (iloom scripts take precedence)\n * @throws Error if neither file exists or contains valid JSON\n */\nexport async function getPackageConfig(dir: string): Promise<PackageJson> {\n // Check for .iloom/package.iloom.json first\n const iloomPackage = await readIloomPackageScripts(dir)\n\n if (iloomPackage) {\n // Try to read package.json as base\n try {\n const basePackage = await readPackageJson(dir)\n getLogger().debug('Merging scripts from .iloom/package.iloom.json over package.json')\n // Merge: base package.json with iloom scripts taking precedence\n return {\n ...basePackage,\n scripts: {\n ...basePackage.scripts,\n ...iloomPackage.scripts,\n },\n }\n } catch {\n // No package.json - use iloom package as-is (non-Node project)\n getLogger().debug('Using scripts from .iloom/package.iloom.json (no package.json)')\n return iloomPackage\n }\n }\n\n // Fall back to package.json only\n return readPackageJson(dir)\n}\n\n/**\n * Parse bin field into normalized Record format\n * @param bin The bin field from package.json (string or object)\n * @param packageName Package name to use for string bin variant\n * @returns Normalized bin entries as Record<string, string>\n */\nexport function parseBinField(\n bin: string | Record<string, string> | undefined,\n packageName: string\n): Record<string, string> {\n if (!bin) {\n return {}\n }\n\n if (typeof bin === 'string') {\n return { [packageName]: bin }\n }\n\n return bin\n}\n\n/**\n * Check if package.json indicates a web application\n * @param pkgJson Parsed package.json object\n * @returns true if package has web framework dependencies\n */\nexport function hasWebDependencies(pkgJson: PackageJson): boolean {\n const webIndicators = [\n 'next',\n 'vite',\n 'express',\n 'react-scripts',\n 'nuxt',\n 'svelte-kit',\n 'astro',\n 'remix',\n 'fastify',\n 'koa',\n 'hapi',\n '@angular/core',\n 'gatsby',\n '@11ty/eleventy',\n 'ember-cli'\n ]\n\n const allDeps = {\n ...pkgJson.dependencies,\n ...pkgJson.devDependencies\n }\n\n return webIndicators.some(indicator => indicator in allDeps)\n}\n\n/**\n * Check if package.json has a specific script\n * @param pkgJson Parsed package.json object\n * @param scriptName Script name to check for\n * @returns true if script exists\n */\nexport function hasScript(pkgJson: PackageJson, scriptName: string): boolean {\n return !!pkgJson.scripts?.[scriptName]\n}\n\n/**\n * Get all scripts with their source metadata\n * Scripts from .iloom/package.iloom.json are marked as 'iloom-config' and should be executed directly\n * Scripts from package.json are marked as 'package-manager' and should use pnpm/npm/yarn\n *\n * @param dir Directory to read package configuration from\n * @returns Map of script names to their configurations including source\n */\nexport async function getPackageScripts(dir: string): Promise<Record<string, PackageScriptConfig>> {\n const scripts: Record<string, PackageScriptConfig> = {}\n\n // First, check if package.json exists and read scripts (these are package-manager sourced)\n const packageJsonPath = path.join(dir, 'package.json')\n if (await fs.pathExists(packageJsonPath)) {\n const pkgJson = await readPackageJson(dir)\n if (pkgJson.scripts) {\n for (const [name, command] of Object.entries(pkgJson.scripts)) {\n scripts[name] = { command, source: 'package-manager' }\n }\n }\n }\n\n // Then, read iloom package scripts (these override and are iloom-config sourced)\n const iloomPackage = await readIloomPackageScripts(dir)\n if (iloomPackage?.scripts) {\n for (const [name, command] of Object.entries(iloomPackage.scripts)) {\n scripts[name] = { command, source: 'iloom-config' }\n }\n }\n\n return scripts\n}\n\n/**\n * Valid capability values that can be explicitly declared\n */\nconst VALID_CAPABILITIES: readonly ProjectCapability[] = ['cli', 'web'] as const\n\n/**\n * Extract explicit capabilities from package configuration\n * Used for non-Node.js projects that declare capabilities in package.iloom.json\n * @param pkgJson Parsed package configuration object\n * @returns Array of valid ProjectCapability values, or empty array if none declared\n */\nexport function getExplicitCapabilities(pkgJson: PackageJson): ProjectCapability[] {\n // Return empty if no capabilities field or not an array\n if (!pkgJson.capabilities || !Array.isArray(pkgJson.capabilities)) {\n return []\n }\n\n // Filter to only valid ProjectCapability values\n return pkgJson.capabilities.filter(\n (cap): cap is ProjectCapability => VALID_CAPABILITIES.includes(cap as ProjectCapability)\n )\n}\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAQV,IAAM,qBAAqB;AAqClC,eAAsB,gBAAgB,KAAmC;AACvE,QAAM,UAAU,KAAK,KAAK,KAAK,cAAc;AAE7C,MAAI;AACF,UAAM,UAAU,MAAM,GAAG,SAAS,OAAO;AACzC,WAAO;AAAA,EACT,SAAS,OAAO;AACd,QAAK,MAA4B,SAAS,UAAU;AAClD,YAAM,IAAI,MAAM,6BAA6B,GAAG,EAAE;AAAA,IACpD;AACA,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,UAAM,IAAI,MAAM,2BAA2B,GAAG,KAAK,OAA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